diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4338219f31..979a8311e0 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -17,7 +17,7 @@ If adding a new definition: 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. -- [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dslint/dt.json" }`. +- [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dtslint/dt.json" }`. If removing a declaration: - [ ] If a package was never on DefinitelyTyped, you don't need to do anything. (If you wrote a package and provided types, you don't need to register it with us.) diff --git a/.gitignore b/.gitignore index 5b79863e52..c8e25cec8d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,6 @@ *.map *.swp .DS_Store -npm-debug.log _Resharper.DefinitelyTyped bin @@ -25,19 +24,28 @@ Properties # test folder _infrastructure/tests/build +# IntelliJ based IDEs .idea *.iml + *.js.map !*.js/ !scripts/new-package.js !scripts/not-needed.js !scripts/lint.js +# npm node_modules +package-lock.json +npm-debug.log +# Sublime .sublimets -.settings/launch.json +# Visual Studio Code +.settings/launch.json .vs .vscode + +# yarn yarn.lock diff --git a/README.md b/README.md index 3028c233d0..9f3c4fe78f 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,13 @@ First, [fork](https://guides.github.com/activities/forking/) this repository, in * Make changes. Remember to edit tests. * You may also want to add yourself to "Definitions by" section of the package header. - Do this by adding your name to the end of the line, as in `// Definitions by: Alice , Bob `. + - Or if there are more people, it can be multiline + ```typescript + // Definitions by: Alice + // Bob + // Steve + // John + ``` * `npm install -g typescript@2.0` and run `tsc`. When you make a PR to edit an existing package, `dt-bot` should @-mention previous authors. diff --git a/notNeededPackages.json b/notNeededPackages.json index 2bc2de286f..d6e99fbf9b 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -54,6 +54,12 @@ "sourceRepoURL": "http://www.babylonjs.com/", "asOfVersion": "2.4.1" }, + { + "libraryName": "BigInteger.js", + "typingsPackageName": "big-integer", + "sourceRepoURL": "https://github.com/peterolson/BigInteger.js", + "asOfVersion": "0.0.31" + }, { "libraryName": "Bugsnag Browser", "typingsPackageName": "bugsnag-js", @@ -120,6 +126,12 @@ "sourceRepoURL": "https://github.com/bterlson/ecmarkup", "asOfVersion": "3.4.0" }, + { + "libraryName": "electron", + "typingsPackageName": "electron", + "sourceRepoURL": "https://github.com/electron/electron", + "asOfVersion": "1.6.10" + }, { "libraryName": "electron-builder", "typingsPackageName": "electron-builder", @@ -132,6 +144,12 @@ "sourceRepoURL": "https://github.com/primus/eventemitter3", "asOfVersion": "2.0.2" }, + { + "libraryName": "express-validator", + "typingsPackageName": "express-validator", + "sourceRepoURL": "https://github.com/ctavan/express-validator", + "asOfVersion": "3.0.0" + }, { "libraryName": "JSON-Patch", "typingsPackageName": "fast-json-patch", @@ -222,6 +240,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/is-upper-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "jquery.ajaxfile", + "typingsPackageName": "jquery.ajaxfile", + "sourceRepoURL": "https://github.com/fpellet/jquery.ajaxFile", + "asOfVersion": "0.2.29" + }, { "libraryName": "JSNLog", "typingsPackageName": "jsnlog", @@ -354,6 +378,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/path-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "path-to-regexp", + "typingsPackageName": "path-to-regexp", + "sourceRepoURL": "https://github.com/pillarjs/path-to-regexp", + "asOfVersion": "1.7.0" + }, { "libraryName": "pg-promise", "typingsPackageName": "pg-promise", @@ -396,6 +426,12 @@ "sourceRepoURL": "https://github.com/getsentry/raven-js", "asOfVersion": "3.10.0" }, + { + "libraryName": "react-day-picker", + "typingsPackageName": "react-day-picker", + "sourceRepoURL": "https://github.com/gpbl/react-day-picker", + "asOfVersion": "5.3.0" + }, { "libraryName": "Redux", "typingsPackageName": "redux", @@ -408,6 +444,12 @@ "sourceRepoURL": "https://github.com/tshelburne/redux-batched-actions", "asOfVersion": "0.1.5" }, + { + "libraryName": "redux-devtools-extension", + "typingsPackageName": "redux-devtools-extension", + "sourceRepoURL": "https://github.com/zalmoxisus/redux-devtools-extension", + "asOfVersion": "2.13.2" + }, { "libraryName": "redux-persist", "typingsPackageName": "redux-persist", diff --git a/types/ace/index.d.ts b/types/ace/index.d.ts index 1ac19c7c63..90466c946e 100644 --- a/types/ace/index.d.ts +++ b/types/ace/index.d.ts @@ -2643,7 +2643,9 @@ declare namespace AceAjax { characterWidth: number; lineHeight: number; - + + setScrollMargin(top:number, bottom:number, left: number, right: number): void; + screenToTextCoordinates(left: number, top: number): void; /** diff --git a/types/ace/test/virtual_renderer.ts b/types/ace/test/virtual_renderer.ts index 74bcec2fa8..262f81e885 100644 --- a/types/ace/test/virtual_renderer.ts +++ b/types/ace/test/virtual_renderer.ts @@ -15,6 +15,7 @@ const aceVirtualRendererTests = { var renderer = new AceAjax.VirtualRenderer(el); renderer.setPadding(0); + renderer.setScrollMargin(0,0,0,0) renderer.setSession(new AceAjax.EditSession("1234")); var r = renderer.scroller.getBoundingClientRect(); diff --git a/types/acl/index.d.ts b/types/acl/index.d.ts index 069631d2e0..3aa81de8e3 100644 --- a/types/acl/index.d.ts +++ b/types/acl/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/optimalbits/node_acl // Definitions by: Qubo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// diff --git a/types/agenda/index.d.ts b/types/agenda/index.d.ts index e859de3188..fe8ecc45a6 100644 --- a/types/agenda/index.d.ts +++ b/types/agenda/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/rschmukler/agenda // Definitions by: Meir Gottlieb // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 9f99b14995..c19892425d 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -1,13 +1,17 @@ -// Type definitions for Alexa SDK for Node.js v1.0.3 +// Type definitions for Alexa SDK for Node.js v1.1.0 // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs -// Definitions by: Pete Beegle +// Definitions by: Pete Beegle , Huw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; export var StateString: string; -interface AlexaObject { +type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; +type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED"; + +interface AlexaObject extends Handler { _event: any; _context: any; _callback: any; @@ -74,12 +78,20 @@ interface SessionUser { interface LaunchRequest extends IRequest { } interface IntentRequest extends IRequest { + dialogState: DialogStates; intent: Intent; } -interface Intent { +interface SlotValue { + confirmationStatus: ConfirmationStatuses; name: string; - slots: any; + value?: any; +} + +interface Intent { + confirmationStatus: ConfirmationStatuses; + name: string; + slots: Record; } interface SessionEndedRequest extends IRequest { @@ -127,5 +139,3 @@ interface Image { interface Reprompt { outputSpeech: OutputSpeech; } - - diff --git a/types/alexa-voice-service/alexa-voice-service-tests.ts b/types/alexa-voice-service/alexa-voice-service-tests.ts new file mode 100644 index 0000000000..f9bac4e549 --- /dev/null +++ b/types/alexa-voice-service/alexa-voice-service-tests.ts @@ -0,0 +1,34 @@ +import * as AVS from "alexa-voice-service"; + +const options = { + debug: true, + clientId: "", + clientSecret: "", + deviceId: "", + refreshToken: "", +}; + +const avsInstance = new AVS(options); + +avsInstance.on(AVS.EventTypes.RECORD_START, () => { +}); + +avsInstance.on(AVS.EventTypes.RECORD_STOP, () => { +}); + +avsInstance.player.on(AVS.Player.EventTypes.PLAY, () => { +}); + +avsInstance.refreshToken().then((tokens) => { +}).catch((error: Error) => { +}); + +avsInstance.requestMic(); + +avsInstance.startRecording(); + +avsInstance.stopRecording().then((dataView: any) => { }); + +const dataView = new DataView(new ArrayBuffer(1)); + +avsInstance.sendAudio(dataView).then(({ xhr, response }: any) => { }); diff --git a/types/alexa-voice-service/index.d.ts b/types/alexa-voice-service/index.d.ts new file mode 100644 index 0000000000..eb639729fd --- /dev/null +++ b/types/alexa-voice-service/index.d.ts @@ -0,0 +1,60 @@ +// Type definitions for alexa-voice-service 0.0 +// Project: https://github.com/miguelmota/alexa-voice-service.js +// Definitions by: Dolan Miu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace AVS; +export = AVS; + +declare namespace AVS { + enum EventTypes { + RECORD_STOP, RECORD_START, ERROR, TOKEN_INVALID, LOG, LOGIN, LOGOUT, TOKEN_SET, REFRESH_TOKEN_SET + } + + interface AVSParams { + debug: boolean; + clientId: string; + clientSecret: string; + deviceId: string; + refreshToken: string; + } + + interface TokenResponse { + token: string; + refreshToken: string; + } + + class Player { + on(eventType: Player.EventTypes, callback?: () => void): void; + } + + namespace Player { + enum EventTypes { + LOG, ERROR, PLAY, REPLAY, PAUSE, STOP, ENQUEUE, DEQUE + } + } +} + +declare class AVS { + player: AVS.Player; + constructor(params: AVS.AVSParams); + + on(eventType: AVS.EventTypes, callback?: () => void): void; + refreshToken(): Promise; + requestMic(): Promise; + startRecording(): Promise; + stopRecording(): Promise; + sendAudio(dataView: DataView): Promise<{ + xhr: any, response: { + httpVersion: string, + statusCode: string, + statusMessage: string, + method: string, + url: string, + headers: string, + body: string, + boundary: string, + multipart: string + } + }>; +} diff --git a/types/alexa-voice-service/tsconfig.json b/types/alexa-voice-service/tsconfig.json new file mode 100644 index 0000000000..70cb9b2201 --- /dev/null +++ b/types/alexa-voice-service/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "alexa-voice-service-tests.ts" + ] +} \ No newline at end of file diff --git a/types/leaflet-markercluster/tslint.json b/types/alexa-voice-service/tslint.json similarity index 100% rename from types/leaflet-markercluster/tslint.json rename to types/alexa-voice-service/tslint.json diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index a3a04aadc2..43a4d677cf 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -1,41 +1,52 @@ -import algoliasearch = require('algoliasearch'); -import { ClientOptions, SynonymOption, AlgoliaUserKeyOptions, SearchSynonymOptions, +import * as algoliasearch from "algoliasearch"; +import { ClientOptions, SynonymOption, AlgoliaUserKeyOptions, SearchSynonymOptions, AlgoliaResponse, AlgoliaSecuredApiOptions, AlgoliaIndexSettings, AlgoliaQueryParameters, AlgoliaIndex } from "algoliasearch"; -var _clientOptions: ClientOptions = { - timeout : 12, +let _algoliaResponse: AlgoliaResponse = { + hits: [{}, {}], + page: 0, + nbHits: 12, + nbPages: 6, + hitsPerPage: 2, + processingTimeMS: 32, + query: "", + params: "", +}; + +let _clientOptions: ClientOptions = { + timeout: 12, protocol: "", - httpAgent: "" + httpAgent: "", }; -var _synonymOption: SynonymOption = { +let _synonymOption: SynonymOption = { forwardToSlaves: false, - replaceExistingSynonyms: false + replaceExistingSynonyms: false, }; -var _algoliaUserKeyOptions : AlgoliaUserKeyOptions = { +let _algoliaUserKeyOptions: AlgoliaUserKeyOptions = { validity: 0, maxQueriesPerIPPerHour: 0, indexes: [""], queryParameters: { attributesToRetrieve: ["algolia"] }, - description: "" + description: "", }; -var _searchSynonymOptions : SearchSynonymOptions = { +let _searchSynonymOptions: SearchSynonymOptions = { query: "", page: 0, type: "", - hitsPerPage: 0 + hitsPerPage: 0, }; -var _algoliaSecuredApiOptions: AlgoliaSecuredApiOptions = { +let _algoliaSecuredApiOptions: AlgoliaSecuredApiOptions = { filters: "", validUntil: 0, restrictIndices: "", - userToken: "" + userToken: "", }; -var _algoliaIndexSettings : AlgoliaIndexSettings = { +let _algoliaIndexSettings: AlgoliaIndexSettings = { attributesToIndex: [""], attributesforFaceting: [""], unretrievableAttributes: [""], @@ -43,12 +54,12 @@ var _algoliaIndexSettings : AlgoliaIndexSettings = { ranking: [""], customRanking: [""], slaves: [""], - maxValuesPerFacet: '', + maxValuesPerFacet: "", attributesToHighlight: [""], attributesToSnippet: [""], - highlightPreTag: '', - highlightPostTag: '', - snippetEllipsisText: '', + highlightPreTag: "", + highlightPostTag: "", + snippetEllipsisText: "", restrictHighlightAndSnippetArrays: false, hitsPerPage: 0, minWordSizefor1Typo: 0, @@ -56,16 +67,16 @@ var _algoliaIndexSettings : AlgoliaIndexSettings = { typoTolerance: false, allowTyposOnNumericTokens: false, ignorePlurals: false, - disableTypoToleranceOnAttributes: '', - separatorsToIndex: '', - queryType: '', - removeWordsIfNoResults: '', + disableTypoToleranceOnAttributes: "", + separatorsToIndex: "", + queryType: "", + removeWordsIfNoResults: "", advancedSyntax: false, optionalWords: [""], removeStopWords: [""], disablePrefixOnAttributes: [""], disableExactOnAttributes: [""], - exactOnSingleWordQuery: '', + exactOnSingleWordQuery: "", alternativesAsExact: false, attributeForDistinct: "", distinct: false, @@ -73,21 +84,21 @@ var _algoliaIndexSettings : AlgoliaIndexSettings = { allowCompressionOfIntegerArray: false, altCorrections: [{}], minProximity: 0, - placeholders: '' + placeholders: "", }; -var _algoliaQueryParameters : AlgoliaQueryParameters = { - query: '', - filters: '', +let _algoliaQueryParameters: AlgoliaQueryParameters = { + query: "", + filters: "", attributesToRetrieve: [""], restrictSearchableAttributes: [""], - facets: '', - maxValuesPerFacet: '', - attributesToHighlight: [''], - attributesToSnippet: [''], - highlightPreTag: '', - highlightPostTag: '', - snippetEllipsisText: '', + facets: "", + maxValuesPerFacet: "", + attributesToHighlight: [""], + attributesToSnippet: [""], + highlightPreTag: "", + highlightPostTag: "", + snippetEllipsisText: "", restrictHighlightAndSnippetArrays: false, hitsPerPage: 0, page: 0, @@ -98,38 +109,36 @@ var _algoliaQueryParameters : AlgoliaQueryParameters = { typoTolerance: false, allowTyposOnNumericTokens: false, ignorePlurals: false, - disableTypoToleranceOnAttributes: '', - aroundLatLng: '', - aroundLatLngViaIP: '', - aroundRadius: '', + disableTypoToleranceOnAttributes: "", + aroundLatLng: "", + aroundLatLngViaIP: "", + aroundRadius: "", aroundPrecision: 0, minimumAroundRadius: 0, - insideBoundingBox: '', - queryType: '', - insidePolygon: '', - removeWordsIfNoResults: '', + insideBoundingBox: "", + queryType: "", + insidePolygon: "", + removeWordsIfNoResults: "", advancedSyntax: false, - optionalWords: [''], - removeStopWords: [''], - disableExactOnAttributes: [''], - exactOnSingleWordQuery: '', + optionalWords: [""], + removeStopWords: [""], + disableExactOnAttributes: [""], + exactOnSingleWordQuery: "", alternativesAsExact: true, distinct: 0, getRankingInfo: false, - numericAttributesToIndex: [''], - numericFilters: [''], - tagFilters: '', - facetFilters: '', + numericAttributesToIndex: [""], + numericFilters: [""], + tagFilters: "", + facetFilters: "", analytics: false, - analyticsTags: [''], + analyticsTags: [""], synonyms: true, replaceSynonymsInHighlight: false, - minProximity: 0 + minProximity: 0, }; -var index: AlgoliaIndex = algoliasearch('', '').initIndex(''); - -var search = index.search({query: ""}); -index.search({query: ""}, function(err, res){}); - +let index: AlgoliaIndex = algoliasearch("", "").initIndex(""); +let search = index.search({query: ""}); + index.search({query: ""}, (err, res) => {}); diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 582e91999b..2fdd00f983 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -24,7 +24,7 @@ declare namespace algoliasearch { * Number of pages * https://github.com/algolia/algoliasearch-client-js#response-format */ - nbPage: number; + nbPages: number; /** * Number of hits per pages * https://github.com/algolia/algoliasearch-client-js#response-format @@ -407,7 +407,7 @@ declare namespace algoliasearch { * @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; + saveSynonym(synonym: AlgoliaSynonym, options: SynonymOption, cb: (err: Error, res: any) => void): void; /** * Save a synonym object * @param synonyms @@ -659,7 +659,7 @@ declare namespace algoliasearch { * return {Promise} * https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym */ - saveSynonym(synonym: AlgoliaSynonym, option: SynonymOption): Promise ; + saveSynonym(synonym: AlgoliaSynonym, options: SynonymOption): Promise ; /** * Save a synonym object * @param synonyms diff --git a/types/alt/alt-tests.ts b/types/alt/alt-tests.ts index 8d1108ada3..3556e3a167 100644 --- a/types/alt/alt-tests.ts +++ b/types/alt/alt-tests.ts @@ -119,7 +119,7 @@ interface ExtendedTestStore extends AltJS.AltStore { split():Array; } -var testStore = alt.createStore(TestStore); +var testStore = alt.createStore(new TestStore()); function testCallback(state:AltTestState) { console.log(state); diff --git a/types/amcharts/index.d.ts b/types/amcharts/index.d.ts index bc41907d50..98fae5adeb 100644 --- a/types/amcharts/index.d.ts +++ b/types/amcharts/index.d.ts @@ -2271,6 +2271,10 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val hideBulletsCount: number; /** Name of the high field (used by candlesticks and ohlc) in your dataProvider. */ highField: string; + + /** Unique id of a graph. It is not required to set one, unless you want to use this graph for as your scrollbar's graph and need to indicate which graph should be used.*/ + id?: string; + /** Whether to include this graph when calculating min and max value of the axis. @default true */ diff --git a/types/amqp/amqp-tests.ts b/types/amqp/amqp-tests.ts new file mode 100644 index 0000000000..7940f44ed4 --- /dev/null +++ b/types/amqp/amqp-tests.ts @@ -0,0 +1,69 @@ +import * as amqp from 'amqp'; + +async function connect() { + const promise = new Promise((resolve, reject) => { + const client = amqp.createConnection({ + url: 'amqp://admin:password@localhost:5672' + }); + + client.once('error', reject); + client.once('ready', resolve); + }); + + return promise; +} + +async function start() { + try { + const client = await connect(); + console.log('Connected'); + + const queue = client.queue('perth-now', + { + autoDelete: false, + durable: true, + }, q => { + console.log('Queue opened'); + console.log('Name: %s Channel: %s', q.name, q.channel); + + queue.bind('amq.fanout', '#', () => { + queue.subscribe( + { ack: true }, + (msg, _, __, ack) => { + ack.acknowledge(true); + }); + }); + }); + + const exchange = client.exchange('amq.fanout', { confirm: true }); + + exchange.once('open', () => { + exchange.publish( + 'content', + { message: new Date().toLocaleTimeString() }, + { deliveryMode: 2 }, + (err, msg) => { + if (!err) { + return; + } + throw new Error(`Failed to publish: ${msg}`); + } + ); + + exchange.publish('content', { message: 'content message' }, () => { + console.log('Published'); + }); + }); + } catch (ex) { + console.log(ex); + process.exit(1); + } +} + +async function wait(ms: number) { + return new Promise(resolve => { + setTimeout(resolve, ms); + }); +} + +start(); diff --git a/types/amqp/index.d.ts b/types/amqp/index.d.ts new file mode 100644 index 0000000000..a7dae4eb56 --- /dev/null +++ b/types/amqp/index.d.ts @@ -0,0 +1,419 @@ +// Type definitions for amqp 0.2 +// Project: https://github.com/postwait/node-amqp +// Definitions by: Carl Winkler +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as net from 'net'; +import * as events from 'events'; + +export type Callback = (value: T) => void; +export interface AMQPClient extends net.Socket { + publish(routingKey: string, body: any, options: {}, callback: (err?: boolean, msg?: string) => void): void; + + disconnect(): void; + + queue(queueName: string, callback?: Callback): AMQPQueue; + queue(queueName: string, options: QueueOptions, callback?: Callback): AMQPQueue; + + exchange(callback?: Callback): AMQPExchange; + exchange(exchangeName: string, callback?: Callback): AMQPExchange; + exchange(exchangeName: string, options: ExchangeOptions, callback?: Callback): AMQPExchange; +} + +export interface AMQPQueue extends events.EventEmitter { + subscribe(callback: SubscribeCallback): void; + subscribe(options: SubscribeOptions, callback: SubscribeCallback): void; + + unsubscribe(consumerTag: string): void; + + bind(exchangeName: string, routingKey: string, callback?: Callback): void; + bind(routingKey: string, callback?: Callback): void; + + unbind(exchangeName: string, routingKey: string): void; + unbind(routingKey: string): void; + + bind_headers(exchangeName: string, routingKey: string): void; + bind_headers(routingKey: string): void; + + unbind_headers(exchangeName: string, routingKey: string): void; + unbind_headers(routingKey: string): void; + + shift(reject: boolean): void; + shift(reject: boolean, requeue: boolean): void; + + destroy(options?: DestroyOptions): void; +} + +export interface AMQPExchange extends events.EventEmitter { + on(event: 'open' | 'ack' | 'error' | 'exchangeBindOk' | 'exchangeUnbindOk', callback: Callback): this; + + publish(routingKey: string, message: Buffer | {}, options: ExchangePublishOptions, callback?: (err?: boolean, msg?: string) => void): void; + + /** + * ifUnused default: true + * + * Deletes an exchange. + * + * If the optional boolean second argument is set, the server will only delete the exchange if it has no queue bindings. + * + * If the exchange has queue bindings the server does not delete it but raises a channel exception instead + */ + destroy(ifUnused: boolean): void; + + bind(sourceExchange: string, routingKey: string, callback?: Callback): void; + unbind(sourceExchange: string, routingKey: string, callback?: Callback): void; + bind_headers(exchange: string, routing: string, callback?: Callback): void; +} + +export function createConnection(options: ConnectionOptions): AMQPClient; + +export interface DeliveryInfo { + contentType: string; + consumerTag: string; + deliveryTag: Uint8Array; + exchange: string; + queue: string; + redelivered: boolean; + routingKey: string; +} + +export interface Ack extends DeliveryInfo { + acknowledge(all: boolean): void; + reject(requeue: boolean): void; +} + +export interface ConnectionOptions { + host?: string; + url?: string; + port?: number; + login?: string; + passowrd?: string; + connectionTimeout?: number; + authMechanism?: string; + vhost?: string; + noDelay?: boolean; + ssl?: { + enabled: boolean; + keyFile?: string; + certFile?: string; + caFile?: string; + rejectUnauthorized?: boolean; + }; + + /** Default: 'node-amqp' */ + product?: string; + + /** Default: 'node-{NODE_VERSION}' */ + platform?: string; + + /** Default: node-amqp/package.json version */ + version?: string; + + defaultExchangeName?: string; + + /** Default: true */ + reconnect?: boolean; + + /** Default: 'linear' */ + reconnectBackoffStrategy?: string; + + /** Default: 120000 */ + reconnectExponentialLimit?: number; + + /** Default: 1000 */ + reconnectBackoffTime?: number; +} + +export interface QueueOptions { + /** + * Default: false + * + * If set, the server will not create the queue. + * + * The client can use this to check whether a queue exists without modifying the server state + */ + passive?: boolean; + + /** + * Default: false + * + * Durable queues remain active when a server restarts. + * + * Non-durable queues (transient queues) are purged if/when a server restarts. + * + * Note that durable queues do not necessarily hold persistent messages, + * although it does not make sense to send persistent messages to a transient queue + */ + durable?: boolean; + + /** + * Default: false + * + * Exclusive queues may only be consumed from by the current connection. + * + * Setting the 'exclusive' flag always implies 'autoDelete' + */ + exclusive?: boolean; + + /** + * Default: true + * + * If set, the queue is deleted when all consumers have finished using it. + * + * Last consumer can be cancelled either explicitly or because its channel is closed. + * + * If there was no consumer ever on the queue, it won't be deleted + */ + autoDelete?: boolean; + + /** + * Default: false + * + * If set, the queue will not be declared, this will allow a queue to be deleted if you don't know its previous options + */ + noDeclare?: boolean; + + /** + * a map of additional arguments to pass in when creating a queue + */ + arguments?: { [arg: string]: any }; + + /** + * Default: false + * + * when true the channel will close on unsubscribe + */ + closeChannelOnUnsubscribe?: boolean; +} + +export interface ExchangeOptions { + /** + * Default: 'topic' + */ + type?: 'direct' | 'fanout' | 'topic'; + + /** + * Default: false + * + * f set, the server will not create the exchange. The client can use this to check whether an exchange exists without modifying the server state + */ + passive?: boolean; + + /** + * Default: true + * + * If set when creating a new exchange, the exchange will be marked as durable. + * + * Durable exchanges remain active when a server restarts. + * + * Non-durable exchanges (transient exchanges) are purged if/when a server restarts + */ + durable?: boolean; + + /** + * Default: true + * + * If set, the exchange is deleted when there are no longer queues bound to it + */ + autoDelete?: boolean; + + /** + * Default: false + * + * If set, the exchange will not be declared, + * this will allow the exchange to be deleted if you dont know its previous options + */ + noDeclare?: boolean; + + /** + * Default: false + * + * If set, the exchange will be in confirm mode, and you will get a 'ack'|'error' event emitted on a publish, + * or the callback on the publish will be called + */ + confirm?: boolean; + + /** + * a map of additional arguments to pass in when creating an exchange + */ + arguments?: { [arg: string]: any }; +} + +export interface SubscribeOptions { + /** + * Default: false + * + * If set to true, only one subscriber is allowed at a time + */ + exclusive?: boolean; + + /** + * Default: false + * + * Make it so that the AMQP server only delivers single messages at a time. + * When you want the next message, call queue.shift() + * + * When false, you will receive messages as fast as they are emitted + */ + ack?: boolean; + + /** + * Default: 1 + * + * Will only send you N messages before you 'ack'. + * + * Setting to zero will widen that window to 'unlimited'. If this is set, queue.shift() should not be used + */ + prefetchCount?: number; + + /** + * Default: undefined + * + * Will inject the routingKey into the payload received + */ + routingKeyInPayload?: boolean; + + /** + * Default: undefined + * + * Will inject the routingKey into the payload received + */ + deliveryKeyInPayload?: boolean; +} + +export interface DestroyOptions { + /** + * Default: false + * + * Will only destroy the queue if it has no consumers + */ + ifUnused?: boolean; + + /** + * Default: false + * + * Will ony be deleted if the queue has no messages + */ + ifEmpty?: boolean; +} + +export type SubscribeCallback = ( + message: any, + headers: { [key: string]: any }, + deliveryInfo: DeliveryInfo, + ack: Ack +) => void; + +export interface QueueCallback { + name: string; + consumerTagListeners: { [tag: string]: any }; + consumerTagOptions: { [option: string]: any }; + options: QueueOptions; + state: string; + channel: number; +} + +export interface ExchangePublishOptions { + /** + * Default: false + * + * This flag tells the server how to react if the message cannot be routed to a queue. + * + * If this flag is set, the server will return an unroutable message with a Return method. + * + * If this flag is false, the server silently drops the message + */ + mandatory?: boolean; + + /** + * Default: false + * + * This flag tells the server how to react if the message cannot be routed to a queue consumer immediately. + * + * If this flag is set, the server will return an undeliverable message with a Return method. + * + * If this flag is false, the server will queue the message, but with no guarantee that it will ever be consumed + */ + immediate?: boolean; + + /** + * Default: 'application/octet-stream' + */ + contentType?: string; + + /** + * Default: null + */ + contentEncoding?: string; + + /** + * Default: {} + * + * Arbitrary application-specific message headers + */ + headers?: any; + + /** + * 1: Non-persistent + * 2: Persistent + */ + deliveryMode?: 1 | 2; + + priority?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; + + /** + * Application correlation identifier + */ + correlationId?: string; + + /** + * Usually used to name a reply queue for a request message + */ + replyTo?: string; + + /** + * Default: null + * + * Message expiration specification -- ISO date string? + */ + expiration?: string; + + /** + * Default: null + * + * Application message identifier + */ + messageId?: string; + + /** + * Default: null + * + * Message timestamp + * + * ISO date string? + */ + timestamp?: string; + + /** + * Default: null + * + * Message type name + */ + type?: string; + + /** + * Default: null + * + * Creating user id + */ + userId?: string; + + /** + * Default: null + * + * Creating application id + */ + appId?: string; +} diff --git a/types/amqp/tsconfig.json b/types/amqp/tsconfig.json new file mode 100644 index 0000000000..2b9b4d5ce9 --- /dev/null +++ b/types/amqp/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "amqp-tests.ts" + ] +} diff --git a/types/amqp/tslint.json b/types/amqp/tslint.json new file mode 100644 index 0000000000..9b00d57fef --- /dev/null +++ b/types/amqp/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": [ + "false" + ] + } +} \ No newline at end of file diff --git a/types/amqplib/callback_api.d.ts b/types/amqplib/callback_api.d.ts index 5d025bf314..d36a849873 100644 --- a/types/amqplib/callback_api.d.ts +++ b/types/amqplib/callback_api.d.ts @@ -34,7 +34,7 @@ export interface Channel extends events.EventEmitter { 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; + get(queue: string, options?: Options.Get, callback?: (err: any, ok: Message | false) => void): void; ack(message: Message, allUpTo?: boolean): void; ackAll(): void; diff --git a/types/amqplib/index.d.ts b/types/amqplib/index.d.ts index 6cd326cd67..a6e5aec204 100644 --- a/types/amqplib/index.d.ts +++ b/types/amqplib/index.d.ts @@ -42,7 +42,7 @@ export interface Channel extends events.EventEmitter { consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): Promise; cancel(consumerTag: string): Promise; - get(queue: string, options?: Options.Get): Promise; + get(queue: string, options?: Options.Get): Promise; ack(message: Message, allUpTo?: boolean): void; ackAll(): void; diff --git a/types/angular-loading-bar/index.d.ts b/types/angular-loading-bar/index.d.ts index 191fc043ed..464974631d 100644 --- a/types/angular-loading-bar/index.d.ts +++ b/types/angular-loading-bar/index.d.ts @@ -30,6 +30,10 @@ declare module 'angular' { * Latency Threshold */ latencyThreshold?: number; + /** + * HTML element selector of parent + */ + parentSelector?: string; } } diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index 10648c0012..93b92290e4 100644 --- a/types/angular-material/index.d.ts +++ b/types/angular-material/index.d.ts @@ -214,6 +214,7 @@ declare module 'angular' { contrastDefaultColor?: string; contrastDarkColors?: string | string[]; contrastLightColors?: string | string[]; + contrastStrongLightColors?: string|string[]; } interface IThemeHues { diff --git a/types/angular-tooltips/angular-tooltips-tests.ts b/types/angular-tooltips/angular-tooltips-tests.ts new file mode 100644 index 0000000000..5b89ec363f --- /dev/null +++ b/types/angular-tooltips/angular-tooltips-tests.ts @@ -0,0 +1,21 @@ +import * as angular from 'angular'; +import * as angularTooltips from 'angular-tooltips'; + +angular + .module('test.angular-tooltips', [ + angularTooltips + ]) + .config((tooltipsConfProvider: angularTooltips.TooltipsConfProvider) => { + tooltipsConfProvider.configure({ + side: 'left', + showTrigger: 'click', + hideTrigger: 'click', + class: 'class', + smart: true, + closeButton: false, + size: 'small', + speed: 'slow', + tooltipTemplateUrlCache: true, + show: false + }); + }); diff --git a/types/angular-tooltips/index.d.ts b/types/angular-tooltips/index.d.ts new file mode 100644 index 0000000000..d3cf83c1ec --- /dev/null +++ b/types/angular-tooltips/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for angular-tooltips 1.2 +// Project: http://720kb.github.io/angular-tooltips +// Definitions by: Leonard Thieu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare const AngularTooltips: '720kb.tooltips'; +export = AngularTooltips; + +declare namespace AngularTooltips { + interface TooltipsConfProvider { + configure(options: TooltipsConfProviderOptions): void; + } + + interface TooltipsConfProviderOptions { + side?: 'left' | 'right' | 'top' | 'bottom' | 'top left' | 'top right' | 'bottom left' | 'bottom right'; + showTrigger?: string; + hideTrigger?: string; + class?: string; + smart?: boolean; + closeButton?: boolean; + size?: 'small' | 'medium' | 'large'; + speed?: 'slow' | 'medium' | 'fast'; + tooltipTemplateUrlCache?: boolean; + show?: boolean; + } +} diff --git a/types/angular-tooltips/tsconfig.json b/types/angular-tooltips/tsconfig.json new file mode 100644 index 0000000000..945fa84c71 --- /dev/null +++ b/types/angular-tooltips/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "angular-tooltips-tests.ts" + ] +} diff --git a/types/angular-tooltips/tslint.json b/types/angular-tooltips/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/angular-tooltips/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/angular-ui-bootstrap/index.d.ts b/types/angular-ui-bootstrap/index.d.ts index 1e4d15d282..c09d8cfbb6 100644 --- a/types/angular-ui-bootstrap/index.d.ts +++ b/types/angular-ui-bootstrap/index.d.ts @@ -311,7 +311,7 @@ declare module 'angular' { openClass?: string; } - interface IModalProvider { + interface IModalProvider extends IServiceProvider { /** * Default options all modals will use. */ @@ -875,7 +875,7 @@ declare module 'angular' { useContentExp?: boolean; } - interface ITooltipProvider { + interface ITooltipProvider extends IServiceProvider { /** * Provide a set of defaults for certain tooltip and popover attributes. */ diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index d01dbd25b8..d77c18fa37 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -591,7 +591,7 @@ namespace TestPromise { assertPromiseType(promise.catch((err) => anyOf2(tresult, reject))); assertPromiseType(promise.catch((err) => anyOf3(tresult, tresultPromise, reject))); assertPromiseType(promise.catch((err) => tresultPromise)); - assertPromiseType>(promise.catch((err) => tresultHttpPromise)); + assertPromiseType>(promise.catch((err) => tresultHttpPromise)); assertPromiseType(promise.catch((err) => tother)); assertPromiseType(promise.catch((err) => totherPromise)); assertPromiseType>(promise.catch((err) => totherHttpPromise)); diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index 1d59854d9d..5913568fdc 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS 1.6 // Project: http://angularjs.org -// Definitions by: Diego Vilar , Georgii Dolzhykov +// Definitions by: Diego Vilar , Georgii Dolzhykov , Caleb St-Denis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -487,8 +487,8 @@ declare namespace angular { $eval(expression: (scope: IScope) => any, locals?: Object): any; $evalAsync(): void; - $evalAsync(expression: string): void; - $evalAsync(expression: (scope: IScope) => any): void; + $evalAsync(expression: string, locals?: Object): void; + $evalAsync(expression: (scope: IScope) => void, locals?: Object): void; // Defaults to false by the implementation checking strategy $new(isolate?: boolean, parent?: IScope): IScope; @@ -1847,6 +1847,77 @@ declare namespace angular { $postLink?(): void; } + /** + * Interface for the $onInit lifecycle hook + * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks + */ + interface IOnInit { + /** + * Called on each controller after all the controllers on an element have been constructed and had their bindings + * initialized (and before the pre & post linking functions for the directives on this element). This is a good + * place to put initialization code for your controller. + */ + $onInit(): void; + } + + /** + * Interface for the $doCheck lifecycle hook + * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks + */ + interface IDoCheck { + /** + * Called on each turn of the digest cycle. Provides an opportunity to detect and act on changes. + * Any actions that you wish to take in response to the changes that you detect must be invoked from this hook; + * implementing this has no effect on when `$onChanges` is called. For example, this hook could be useful if you wish + * to perform a deep equality check, or to check a `Dat`e object, changes to which would not be detected by Angular's + * change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments; if detecting changes, + * you must store the previous value(s) for comparison to the current values. + */ + $doCheck(): void; + } + + /** + * Interface for the $onChanges lifecycle hook + * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks + */ + interface IOnChanges { + /** + * Called whenever one-way bindings are updated. The onChangesObj is a hash whose keys are the names of the bound + * properties that have changed, and the values are an {@link IChangesObject} object of the form + * { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as + * cloning the bound value to prevent accidental mutation of the outer value. + */ + $onChanges(onChangesObj: IOnChangesObject): void; + } + + /** + * Interface for the $onDestroy lifecycle hook + * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks + */ + interface IOnDestroy { + /** + * Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources, + * watches and event handlers. + */ + $onDestroy(): void; + } + + /** + * Interface for the $postLink lifecycle hook + * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks + */ + interface IPostLink { + /** + * Called after this controller's element and its children have been linked. Similar to the post-link function this + * hook can be used to set up DOM event handlers and do direct DOM manipulation. Note that child elements that contain + * templateUrl directives will not have been compiled and linked since they are waiting for their template to load + * asynchronously and their own compilation and linking has been suspended until that occurs. This hook can be considered + * analogous to the ngAfterViewInit and ngAfterContentInit hooks in Angular 2. Since the compilation process is rather + * different in Angular 1 there is no direct mapping and care should be taken when upgrading. + */ + $postLink(): void; + } + interface IOnChangesObject { [property: string]: IChangesObject; } diff --git a/types/angular/tslint.json b/types/angular/tslint.json index 3ace427c86..50c4474b7c 100644 --- a/types/angular/tslint.json +++ b/types/angular/tslint.json @@ -17,4 +17,4 @@ "unified-signatures": false, "void-return": false } -} +} \ No newline at end of file diff --git a/types/angularlocalstorage/angularlocalstorage-tests.ts b/types/angularlocalstorage/angularlocalstorage-tests.ts index f62b38c897..22d71f8b5d 100644 --- a/types/angularlocalstorage/angularlocalstorage-tests.ts +++ b/types/angularlocalstorage/angularlocalstorage-tests.ts @@ -15,6 +15,8 @@ class TestController { storage.clearAll(); } + $onInit() { + } } var app = angular.module('angularLocalStorageTests', ['angularLocalStorage']); diff --git a/types/applicationinsights-js/applicationinsights-js-tests.ts b/types/applicationinsights-js/applicationinsights-js-tests.ts index 1a4d585795..ecefb6d41a 100644 --- a/types/applicationinsights-js/applicationinsights-js-tests.ts +++ b/types/applicationinsights-js/applicationinsights-js-tests.ts @@ -44,7 +44,7 @@ appInsights = { trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number) { return null; }, trackException(exception: Error, handledAt?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }, severityLevel?: AI.SeverityLevel) { return null; }, trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: { [name: string]: string; }) { return null; }, - trackTrace(message: string, properties?: { [name: string]: string; }) { return null; }, + trackTrace(message: string, properties?: { [name: string]: string; }, severityLevel?: AI.SeverityLevel) { return null; }, flush() { return null; }, setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string) { return null; }, clearAuthenticatedUserContext() { return null; }, @@ -77,6 +77,7 @@ appInsights.trackException(new Error("sample error"), "handledAt", null, null); // trackTrace appInsights.trackTrace("message"); appInsights.trackTrace("message", null); +appInsights.trackTrace("message", { a: '1', b: '2' }, AI.SeverityLevel.Error); // trackDependency appInsights.trackDependency("id", "POST", "http://example.com/test/abc", "/test/abc", null, true, null); @@ -117,7 +118,18 @@ const envelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(dat context.track(envelope); -context.addTelemetryInitializer(telemetryEnvelope => false); +context.addTelemetryInitializer(envelope => false); +context.addTelemetryInitializer(envelope => { }); + +// a sample from: https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#example +context.addTelemetryInitializer(envelope => { + let telemetryItem = envelope.data.baseData; + if (envelope.name === Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType) { + telemetryItem.url = "URL CENSORED"; + } + telemetryItem.properties = telemetryItem.properties || {}; + telemetryItem.properties["globalProperty"] = "boo"; +}); // track event const eventObj = new Microsoft.ApplicationInsights.Telemetry.Event("test", null, null); diff --git a/types/applicationinsights-js/index.d.ts b/types/applicationinsights-js/index.d.ts index cce53f5823..17137d67dd 100644 --- a/types/applicationinsights-js/index.d.ts +++ b/types/applicationinsights-js/index.d.ts @@ -572,6 +572,7 @@ declare module Microsoft.ApplicationInsights { isPerfAnalyzerEnabled?: boolean; url?: string; isStorageUseDisabled?: boolean; + isBeaconApiDisabled?: boolean; } /** @@ -611,6 +612,7 @@ declare module Microsoft.ApplicationInsights { tags: { [name: string]: any; }; + data: any; } interface ITelemetryContext { @@ -650,7 +652,7 @@ declare module Microsoft.ApplicationInsights { * Adds telemetry initializer to the collection. Telemetry initializers will be called one by one * before telemetry item is pushed for sending and in the order they were added. */ - addTelemetryInitializer(telemetryInitializer: (envelope: Microsoft.ApplicationInsights.IEnvelope) => boolean): any; + addTelemetryInitializer(telemetryInitializer: (envelope: Microsoft.ApplicationInsights.IEnvelope) => boolean | void): any; /** * Tracks telemetry object. */ @@ -763,7 +765,7 @@ declare module Microsoft.ApplicationInsights { * @param message A message string * @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty. */ - trackTrace(message: string, properties?: { [name: string]: string }): any; + trackTrace(message: string, properties?: { [name: string]: string }, severityLevel?: AI.SeverityLevel): any; /** * Immediately send all queued telemetry. */ diff --git a/types/archiver/archiver-tests.ts b/types/archiver/archiver-tests.ts index 57a569ab02..d4ea423a4f 100644 --- a/types/archiver/archiver-tests.ts +++ b/types/archiver/archiver-tests.ts @@ -1,26 +1,36 @@ -import Archiver = require('archiver'); -import FS = require('fs'); +import * as Archiver from 'archiver'; +import * as fs from 'fs'; const archiver = Archiver.create('zip'); -const writeStream = FS.createWriteStream('./archiver.d.ts'); -const readStream = FS.createReadStream('./archiver.d.ts'); +const writeStream = fs.createWriteStream('./archiver.d.ts'); +const readStream = fs.createReadStream('./archiver.d.ts'); archiver.abort(); + +archiver.pipe(writeStream); +archiver.append(readStream, { name: 'archiver.d.ts' }); + archiver.append(readStream, {name: 'archiver.d.ts'}) .append(readStream, {name: 'archiver.d.ts'}); archiver.bulk({ mappaing: {} }); archiver.directory('./path', './someOtherPath'); -archiver.directory('./path', { name: "testName"} ); - +archiver.directory('./path', { name: "testName" }); archiver.directory('./', "", {}); -archiver.directory('./', {name: 'test'}, {}); +archiver.directory('./', { name: 'test' }, {}); + +archiver.append(readStream, { + name: "sub/folder.xml" +}); + +archiver.glob("**", { + cwd: 'path/to/files', +}); +archiver.glob('./path', {}, {}); archiver.file('./path', { name: 'test' }); -archiver.glob('./path', {}, {}); -archiver.finalize(); archiver.setFormat('zip'); archiver.setModule(() => {}); @@ -28,4 +38,4 @@ archiver.setModule(() => {}); archiver.pointer(); archiver.use(() => {}); -archiver.pipe(writeStream); +archiver.finalize(); diff --git a/types/archiver/index.d.ts b/types/archiver/index.d.ts index 9c2b2ae509..2e4b1063ff 100644 --- a/types/archiver/index.d.ts +++ b/types/archiver/index.d.ts @@ -1,51 +1,67 @@ // Type definitions for archiver 1.3 // Project: https://github.com/archiverjs/node-archiver -// Definitions by: Esri +// Definitions by: Esri , Dolan Miu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* =================== USAGE =================== import Archiver = require('archiver); var archiver = Archiver.create('zip'); - archiver.pipe(FS.createWriteStream('xxx')); - archiver.append(FS.createReadStream('xxx')); + archiver.pipe(fs.createWriteStream('xxx')); + archiver.append(fs.createReadStream('xxx')); archiver.finalize(); =============================================== */ /// -import * as FS from 'fs'; -import * as STREAM from 'stream'; +import * as fs from 'fs'; +import * as stream from 'stream'; +import * as express from 'express'; +import * as glob from 'glob'; -declare function archiver(format: string, options?: {}): archiver.Archiver; +declare function archiver(format: archiver.Format, options?: archiver.ArchiverOptions): archiver.Archiver; declare namespace archiver { - function create(format: string, options?: {}): Archiver; + type Format = 'zip' | 'tar'; + + function create(format: string, options?: ArchiverOptions): Archiver; function registerFormat(format: string, module: Function): void; - interface nameInterface { + interface EntryData { name?: string; + prefix?: string; + stats?: string; } - interface Archiver extends STREAM.Transform { + interface Archiver extends stream.Transform { abort(): this; - append(source: STREAM.Readable | Buffer | string, name: nameInterface): this; + append(source: stream.Readable | Buffer | string, name?: EntryData): this; bulk(mappings: any): this; - directory(dirpath: string, destpath: nameInterface | string, data?: any | Function): this; + directory(dirpath: string, options: EntryData | string, data?: EntryData): this; - file(filepath: string, data: any): this; - glob(pattern: string, options: {}, data: any): this; + file(filename: string, data: EntryData): this; + glob(pattern: string, options?: glob.IOptions, data?: EntryData): this; finalize(): this; + pipe(stream: fs.WriteStream | express.Response): void; + setFormat(format: string): this; setModule(module: Function): this; pointer(): number; use(plugin: Function): this; } + + interface ArchiverOptions { + store?: boolean; + gzip?: boolean; + gzipOptions?: { + level: number, + }; + } } export = archiver; diff --git a/types/are-we-there-yet/are-we-there-yet-tests.ts b/types/are-we-there-yet/are-we-there-yet-tests.ts new file mode 100644 index 0000000000..1750cac0c2 --- /dev/null +++ b/types/are-we-there-yet/are-we-there-yet-tests.ts @@ -0,0 +1,25 @@ +import { Tracker, TrackerStream, TrackerGroup } from "are-we-there-yet"; + +let simple = new Tracker("simple"); +simple.addListener("change", (name, completed, tracker) => { + console.log(`name: ${name}, completed: ${completed}`); +}); +simple.addWork(10); +simple.completeWork(1); +console.log(simple.completed() < 1); + +let group = new TrackerGroup("group"); +group.addUnit(simple); + +let subgroup = group.newGroup("subgroup"); +console.log(group.completed()); + +let stream = new TrackerStream("stream", 100, { encoding: "utf8" }); +subgroup.addUnit(stream); + +stream.addListener("change", (name, completed, tracker) => { + console.log(`name: ${name}, completed: ${completed}`); +}); + +simple.finish(); +console.log(group.debug()); diff --git a/types/are-we-there-yet/index.d.ts b/types/are-we-there-yet/index.d.ts new file mode 100644 index 0000000000..4b70c7a012 --- /dev/null +++ b/types/are-we-there-yet/index.d.ts @@ -0,0 +1,90 @@ +// Type definitions for are-we-there-yet 1.1 +// Project: https://github.com/iarna/are-we-there-yet +// Definitions by: Brian J Brennan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { EventEmitter } from "events"; +import { Transform, TransformOptions } from "stream"; + +export type TrackerObject = Tracker | TrackerGroup | TrackerStream; +export type TrackerEventListener = (name: string, completed: number, tracker: TrackerObject) => void; +export type GenericEventListener = (...args: any[]) => void; + +export class TrackerBase extends EventEmitter { + constructor(name?: string); + addListener(event: "change", listener: TrackerEventListener): this; + addListener(event: string, listener: GenericEventListener): this; + on(event: "change", listener: TrackerEventListener): this; + on(event: string, listener: GenericEventListener): this; + once(event: "change", listener: TrackerEventListener): this; + once(event: string, listener: GenericEventListener): this; + prependListener(event: "change", listener: TrackerEventListener): this; + prependListener(event: string, listener: GenericEventListener): this; + prependOnceListener(event: "change", listener: TrackerEventListener): this; + prependOnceListener(event: string, listener: GenericEventListener): this; + removeListener(event: "change", listener: TrackerEventListener): this; + removeListener(event: string, listener: GenericEventListener): this; +} + +export class Tracker extends TrackerBase { + constructor(name?: string, todo?: number); + addWork(work: number): void; + completeWork(completed: number): void; + completed(): number; + finish(): void; +} + +export class TrackerGroup extends TrackerBase { + constructor(name?: string); + addUnit(tracker: TrackerBase, weight?: number): TrackerObject; + completed(): number; + debug(): string; + finish(): void; + newGroup(name?: string, weight?: number): TrackerGroup; + newItem(name?: string, todo?: number, weight?: number): Tracker; + newStream(name?: string, todo?: number, weight?: number): TrackerStream; +} + +export class TrackerStream extends Transform { + constructor(name?: string, size?: number, options?: TransformOptions); + addWork(work: number): void; + completed(): number; + + addListener(event: "change", listener: TrackerEventListener): this; + addListener(event: "data", listener: (chunk: Buffer | string) => void): this; + addListener(event: "readable" | "end" | "close", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: string, listener: GenericEventListener): this; + + on(event: "change", listener: TrackerEventListener): this; + on(event: "data", listener: (chunk: Buffer | string) => void): this; + on(event: "readable" | "end" | "close", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: string, listener: GenericEventListener): this; + + once(event: "change", listener: TrackerEventListener): this; + once(event: "data", listener: (chunk: Buffer | string) => void): this; + once(event: "readable" | "end" | "close", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: string, listener: GenericEventListener): this; + + prependListener(event: "change", listener: TrackerEventListener): this; + prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; + prependListener(event: "readable" | "end" | "close", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: string, listener: GenericEventListener): this; + + prependOnceListener(event: "change", listener: TrackerEventListener): this; + prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; + prependOnceListener(event: "readable" | "end" | "close", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: string, listener: GenericEventListener): this; + + removeListener(event: "change", listener: TrackerEventListener): this; + removeListener(event: "data", listener: (chunk: Buffer | string) => void): this; + removeListener(event: "readable" | "end" | "close", listener: () => void): this; + removeListener(event: "error", listener: (err: Error) => void): this; + removeListener(event: string, listener: GenericEventListener): this; +} diff --git a/types/redux-devtools-extension/tsconfig.json b/types/are-we-there-yet/tsconfig.json similarity index 90% rename from types/redux-devtools-extension/tsconfig.json rename to types/are-we-there-yet/tsconfig.json index 6d8d644ea6..e4dc1462ce 100644 --- a/types/redux-devtools-extension/tsconfig.json +++ b/types/are-we-there-yet/tsconfig.json @@ -17,6 +17,6 @@ }, "files": [ "index.d.ts", - "redux-devtools-extension-tests.ts" + "are-we-there-yet-tests.ts" ] } diff --git a/types/redux-devtools-extension/tslint.json b/types/are-we-there-yet/tslint.json similarity index 100% rename from types/redux-devtools-extension/tslint.json rename to types/are-we-there-yet/tslint.json diff --git a/types/auth0-js/auth0-js-tests.ts b/types/auth0-js/auth0-js-tests.ts index cd7789c62d..8b81e6f7b2 100644 --- a/types/auth0-js/auth0-js-tests.ts +++ b/types/auth0-js/auth0-js-tests.ts @@ -12,7 +12,64 @@ webAuth.authorize({ redirectUri: 'https://example.com/auth/callback' }); -webAuth.parseHash(window.location.hash, (err, authResult) => { +webAuth.parseHash((err, authResult) => { + if (err) { + return console.log(err); + } + + // The contents of authResult depend on which authentication parameters were used. + // It can include the following: + // authResult.accessToken - access token for the API specified by `audience` + // authResult.expiresIn - string with the access token's expiration time in seconds + // authResult.idToken - ID token JWT containing user profile information + + webAuth.client.userInfo(authResult.accessToken, (err, user) => { + // Now you have the user's information + }); +}); + +webAuth.parseHash((err, authResult) => { + if (err) { + return console.log(err); + } + + // The contents of authResult depend on which authentication parameters were used. + // It can include the following: + // authResult.accessToken - access token for the API specified by `audience` + // authResult.expiresIn - string with the access token's expiration time in seconds + // authResult.idToken - ID token JWT containing user profile information + + webAuth.client.userInfo(authResult.accessToken, (err, user) => { + // Now you have the user's information + }); +}); + +webAuth.parseHash( + { + nonce: 'asfd', + hash: '#access_token=VjubIMBmpgQ2W2&id_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IlF6RTROMFpCTTBWRFF6RTJSVVUwTnpJMVF6WTFNelE0UVRrMU16QXdNRUk0UkRneE56RTRSZyJ9.eyJpc3MiOiJodHRwczovL3dwdGVzdC5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8NTVkNDhjNTdkNWIwYWQwMjIzYzQwOGQ3IiwiYXVkIjoiZ1lTTmxVNFlDNFYxWVBkcXE4elBRY3VwNnJKdzFNYnQiLCJleHAiOjE0ODI5NjkwMzEsImlhdCI6MTQ4MjkzMzAzMSwibm9uY2UiOiJhc2ZkIn0.PPoh-pITcZ8qbF5l5rMZwXiwk5efbESuqZ0IfMUcamB6jdgLwTxq-HpOT_x5q6-sO1PBHchpSo1WHeDYMlRrOFd9bh741sUuBuXdPQZ3Zb0i2sNOAC2RFB1E11mZn7uNvVPGdPTg-Y5xppz30GSXoOJLbeBszfrVDCmPhpHKGGMPL1N6HV-3EEF77L34YNAi2JQ-b70nFK_dnYmmv0cYTGUxtGTHkl64UEDLi3u7bV-kbGky3iOOCzXKzDDY6BBKpCRTc2KlbrkO2A2PuDn27WVv1QCNEFHvJN7HxiDDzXOsaUmjrQ3sfrHhzD7S9BcCRkekRfD9g95SKD5J0Fj8NA&token_type=Bearer&state=theState&refresh_token=kajshdgfkasdjhgfas&scope=foo' + }, + (err, authResult) => { + if (err) { + return console.log(err); + } + + // The contents of authResult depend on which authentication parameters were used. + // It can include the following: + // authResult.accessToken - access token for the API specified by `audience` + // authResult.expiresIn - string with the access token's expiration time in seconds + // authResult.idToken - ID token JWT containing user profile information + + webAuth.client.userInfo(authResult.accessToken, (err, user) => { + // Now you have the user's information + }); +}); + +webAuth.parseHash( + { + nonce: 'asfd' + }, + (err, authResult) => { if (err) { return console.log(err); } @@ -29,14 +86,21 @@ webAuth.parseHash(window.location.hash, (err, authResult) => { }); webAuth.renewAuth({ - audience: 'https://mystore.com/api/v2', - scope: 'read:order write:order', - redirectUri: 'https://example.com/auth/silent-callback', +}, function (err, authResult) { + // Renewed tokens or error +}); - // this will use postMessage to comunicate between the silent callback - // and the SPA. When false the SDK will attempt to parse the url hash - // should ignore the url hash and no extra behaviour is needed. - usePostMessage: true +webAuth.renewAuth({ + nonce: '123', + state: '456' +}, function (err, authResult) { + // Renewed tokens or error +}); + +webAuth.renewAuth({ + nonce: '123', + state: '456', + postMessageDataType: 'auth0:silent-authentication' }, function (err, authResult) { // Renewed tokens or error }); @@ -90,6 +154,9 @@ webAuth.popup.signupAndLogin({}, (err, data) => { // do something with data }); +webAuth.login({username: 'bar', password: 'foo'}, (err, data) => {}); + +webAuth.crossOriginAuthenticationCallback(); let authentication = new auth0.Authentication({ domain: 'me.auth0.com', @@ -150,7 +217,7 @@ authentication.dbConnection.signup({connection: 'bla', email: 'blabla', password authentication.dbConnection.changePassword({connection: 'bla', email: 'blabla', password: '123456'}, () => {}); authentication.passwordless.start({ connection: 'bla', send: 'blabla' }, () => {}); -authentication.passwordless.verify({ connection: 'bla', send: 'link', verificationCode: 'asdfasd', email: 'me@example.com' }, () => {}); +authentication.passwordless.verify({ connection: 'bla', verificationCode: 'asdfasd', email: 'me@example.com' }, () => {}); authentication.loginWithResourceOwner({ username: 'the username', diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index d8d1e6f392..ff2e2e935d 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Auth0.js 8.3 +// Type definitions for Auth0.js 8.6 // Project: https://github.com/auth0/auth0.js // Definitions by: Adrian Chia // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -15,7 +15,6 @@ export class Authentication { /** * Builds and returns the `/authorize` url in order to initialize a new authN/authZ transaction * - * @method buildAuthorizeUrl * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db */ buildAuthorizeUrl(options: any): string; @@ -23,34 +22,32 @@ export class Authentication { /** * Builds and returns the Logout url in order to initialize a new authN/authZ transaction * - * @method buildLogoutUrl * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout */ - buildLogoutUrl(options?: any): string; + buildLogoutUrl(options?: LogoutOptions): string; /** * Makes a call to the `oauth/token` endpoint with `password` grant type * - * @method loginWithDefaultDirectory - * @param {Object} options: https://auth0.com/docs/api-auth/grant/password + * @param {DefaultDirectoryLoginOptions} options: https://auth0.com/docs/api-auth/grant/password * @param {Function} callback */ - loginWithDefaultDirectory(options: any, callback: Auth0Callback): void; + loginWithDefaultDirectory(options: DefaultDirectoryLoginOptions, callback: Auth0Callback): void; /** * Makes a call to the `/ro` endpoint - * @param {any} options + * @param {ResourceOwnerLoginOptions} options * @param {Function} callback * @deprecated `loginWithResourceOwner` will be soon deprecated, user `login` instead. */ - loginWithResourceOwner(options: any, callback: Auth0Callback): void; + loginWithResourceOwner(options: ResourceOwnerLoginOptions, callback: Auth0Callback): void; /** * Makes a call to the `oauth/token` endpoint with `password-realm` grant type - * @param {any} options + * @param {DefaultLoginOptions} options * @param {Function} callback */ - login(options: any, callback: Auth0Callback): void; + login(options: DefaultLoginOptions, callback: Auth0Callback): void; /** * Makes a call to the `oauth/token` endpoint @@ -62,7 +59,6 @@ export class Authentication { /** * Makes a call to the `/ssodata` endpoint * - * @method getSSOData * @param {Function} callback */ getSSOData(callback?: Auth0Callback): void; @@ -70,7 +66,6 @@ export class Authentication { /** * Makes a call to the `/ssodata` endpoint * - * @method getSSOData * @param {Boolean} withActiveDirectories * @param {Function} callback */ @@ -79,25 +74,22 @@ export class Authentication { /** * Makes a call to the `/userinfo` endpoint and returns the user profile * - * @method userInfo * @param {String} accessToken * @param {Function} callback */ - userInfo(token: string, callback: Auth0Callback): void; + userInfo(accessToken: string, callback: Auth0Callback): void; /** * Makes a call to the `/delegation` endpoint * - * @method delegation - * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--delegation + * @param {DelegationOptions} options: https://auth0.com/docs/api/authentication#!#post--delegation * @param {Function} callback */ - delegation(options: any, callback: Auth0Callback): any; + delegation(options: DelegationOptions, callback: Auth0Callback): any; /** * Fetches the user country based on the ip. * - * @method getUserCountry * @param {Function} callback */ getUserCountry(callback: Auth0Callback<{ countryCode: string }>): void; @@ -109,16 +101,14 @@ export class PasswordlessAuthentication { /** * Builds and returns the passwordless TOTP verify url in order to initialize a new authN/authZ transaction * - * @method buildVerifyUrl - * @param {Object} options + * @param {PasswordlessVerifyOptions} options * @param {Function} callback */ - buildVerifyUrl(options: any): string; + buildVerifyUrl(options: PasswordlessVerifyOptions): string; /** * Initializes a new passwordless authN/authZ transaction * - * @method start * @param {Object} options: https://auth0.com/docs/api/authentication#passwordless * @param {Function} callback */ @@ -127,11 +117,10 @@ export class PasswordlessAuthentication { /** * Verifies the passwordless TOTP and returns an error if any. * - * @method buildVerifyUrl - * @param {Object} options + * @param {PasswordlessVerifyOptions} options * @param {Function} callback */ - verify(options: any, callback: Auth0Callback): void; + verify(options: PasswordlessVerifyOptions, callback: Auth0Callback): void; } export class DBConnection { @@ -140,17 +129,15 @@ export class DBConnection { /** * Signup a new user * - * @method signup - * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup + * @param {DbSignUpOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup * @param {Function} calback */ - signup(options: any, callback: Auth0Callback): void; + signup(options: DbSignUpOptions, callback: Auth0Callback): void; /** * Initializes the change password flow * - * @method signup - * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password + * @param {ChangePasswordOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password * @param {Function} callback */ changePassword(options: ChangePasswordOptions, callback: Auth0Callback): void; @@ -162,7 +149,6 @@ export class Management { /** * Returns the user profile. https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id * - * @method getUser * @param {String} userId * @param {Function} callback */ @@ -172,7 +158,6 @@ export class Management { * Updates the user metdata. It will patch the user metdata with the attributes sent. * https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id * - * @method patchUserMetadata * @param {String} userId * @param {Object} userMetadata * @param {Function} callback @@ -182,7 +167,6 @@ export class Management { /** * Link two users. https://auth0.com/docs/api/management/v2#!/Users/post_identities * - * @method linkUser * @param {String} userId * @param {String} secondaryUserToken * @param {Function} callback @@ -195,14 +179,14 @@ export class WebAuth { client: Authentication; popup: Popup; redirect: Redirect; + crossOriginAuthentication: CrossOriginAuthentication; /** * Redirects to the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction * - * @method authorize - * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db + * @param {AuthorizeOptions} options: https://auth0.com/docs/api/authentication#!#get--authorize_db */ - authorize(options: any): void; + authorize(options: AuthorizeOptions): void; /** * Parse the url hash and extract the returned tokens depending on the transaction. @@ -211,82 +195,99 @@ export class WebAuth { * by the `/.well-known/jwks.json` endpoint. Id tokens signed with other algorithms will not be * accepted. * - * @method parseHash - * @param {Object} options: - * @param {String} options._idTokenVerification [OPTIONAL] Default: true - * @param {String} options.state [OPTIONAL] to verify the response - * @param {String} options.nonce [OPTIONAL] to verify the id_token - * @param {String} options.hash [OPTIONAL] the url hash. If not provided it will extract from window.location.hash + * @param {ParseHashOptions} options * @param {Function} callback: any(err, token_payload) */ - parseHash(options: any, callback: Auth0Callback): void; + parseHash(callback: Auth0Callback): void; + + /** + * Parse the url hash and extract the returned tokens depending on the transaction. + * + * Only validates id_tokens signed by Auth0 using the RS256 algorithm using the public key exposed + * by the `/.well-known/jwks.json` endpoint. Id tokens signed with other algorithms will not be + * accepted. + * + * @param {ParseHashOptions} options + * @param {Function} callback: any(err, token_payload) + */ + parseHash(options: ParseHashOptions, callback: Auth0Callback): void; /** * Decodes the id_token and verifies the nonce. * - * @method validateToken * @param {String} token - * @param {String} state * @param {String} nonce * @param {Function} callback: function(err, {payload, transaction}) */ - validateToken(token: string, state: string, nonce: string, callback: Auth0Callback): void; + validateToken(token: string, nonce: string, callback: Auth0Callback): void; /** - * Executes a silent authentication transaction under the hood in order to fetch a new token. + * Executes a silent authentication transaction under the hood in order to fetch a new tokens for the current session. + * This method requires that all Auth is performed with {@link authorize} + * Watch out! If you're not using the hosted login page to do social logins, you have to use your own [social connection keys](https://manage.auth0.com/#/connections/social). If you use Auth0's dev keys, you'll always get `login_required` as an error when calling this method. * - * @method renewAuth - * @param {Object} options: any valid oauth2 parameter to be sent to the `/authorize` endpoint + * @param {RenewAuthOptions} options: any valid oauth2 parameter to be sent to the `/authorize` endpoint * @param {Function} callback */ - renewAuth(options: any, callback: Auth0Callback): void; + renewAuth(options: RenewAuthOptions, callback: Auth0Callback): void; /** * Initialices a change password transaction * - * @method changePassword - * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password + * @param {ChangePasswordOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password * @param {Function} callback */ - changePassword(options: any, callback: Auth0Callback): void; + changePassword(options: ChangePasswordOptions, callback: Auth0Callback): void; /** * Signs up a new user * - * @method signup - * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup + * @param {DbSignUpOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup * @param {Function} callback */ - signup(options: any, callback: Auth0Callback): void; + signup(options: DbSignUpOptions, callback: Auth0Callback): void; /** * Signs up a new user, automatically logs the user in after the signup and returns the user token. * The login will be done using /oauth/token with password-realm grant type. * - * @method signupAndAuthorize - * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup + * @param {DbSignUpOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup * @param {Function} callback */ - signupAndAuthorize(options: any, callback: Auth0Callback): void; + signupAndAuthorize(options: DbSignUpOptions, callback: Auth0Callback): void; /** - * Redirects to the auth0 logout page + * Logs in the user with username and password using the cross origin authentication (/co/authenticate) flow. You can use either `username` or `email` to identify the user, but `username` will take precedence over `email`. + * This only works when 3rd party cookies are enabled in the browser. After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor. * - * @method logout - * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout + * @param {CrossOriginLoginOptions} options options used in the {@link authorize} call after the login_ticket is acquired + * @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the `redirectUri`. */ - logout(options: any): void; + login(options: CrossOriginLoginOptions, callback: Auth0Callback): void; + + /** + * Runs the callback code for the cross origin authentication call. This method is meant to be called by the cross origin authentication callback url. + * + */ + crossOriginAuthenticationCallback(): void; + + /** + * Redirects to the auth0 logout endpoint + * + * If you want to navigate the user to a specific URL after the logout, set that URL at the returnTo parameter. The URL should be included in any the appropriate Allowed Logout URLs list: + * + * - If the client_id parameter is included, the returnTo URL must be listed in the Allowed Logout URLs set at the client level (see Setting Allowed Logout URLs at the App Level). + * - If the client_id parameter is NOT included, the returnTo URL must be listed in the Allowed Logout URLs set at the account level (see Setting Allowed Logout URLs at the Account Level). + * + * @param {LogoutOptions} options + * @see {@link https://auth0.com/docs/api/authentication#logout} + */ + logout(options: LogoutOptions): void; /** * Initialices a passwordless authentication transaction * - * @method passwordlessStart - * @param {Object} options: https://auth0.com/docs/api/authentication#passwordless - * @param {Object} options.send: `link` or `code` - * @param {Object} options.phoneNumber: send should be code and email not set - * @param {Object} options.email: phoneNumber should be ignored - * @param {Object} options.connection - * @param {Object} options.authParams + * @param {PasswordlessStartOptions} options: https://auth0.com/docs/api/authentication#passwordless * @param {Function} callback */ passwordlessStart(options: PasswordlessStartOptions, callback: Auth0Callback): void; @@ -295,27 +296,28 @@ export class WebAuth { * Verifies the passwordless TOTP and redirects to finish the passwordless transaction * * @method passwordlessVerify - * @param {Object} options: - * @param {Object} options.type: `sms` or `email` - * @param {Object} options.phoneNumber: only if type = sms - * @param {Object} options.email: only if type = email - * @param {Object} options.connection: the connection name - * @param {Object} options.verificationCode: the TOTP code + * @param {PasswordlessVerifyOptions} options: * @param {Function} callback */ - passwordlessVerify(options: any, callback: Auth0Callback): void; + passwordlessVerify(options: PasswordlessVerifyOptions, callback: Auth0Callback): void; } export class Redirect { constructor(client: any, options: any); /** - * Initializes the legacy Lock login flow in a popup + * Performs authentication with username/email and password with a database connection + * + * This method is not compatible with API Auth so if you need to fetch API tokens with audience + * you should use {@link authorize} or {@link login}. * * @method loginWithCredentials * @param {Object} options - * @param {Function} callback - * @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead. + * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response + * @param {String} [options.responseType] type of the response used. It can be any of the values `code` and `token` + * @param {String} [options.responseMode] how the AuthN response is encoded and redirected back to the client. Supported values are `query` and `fragment` + * @param {String} [options.scope] scopes to be requested during AuthN. e.g. `openid email` + * @param {credentialsCallback} cb */ loginWithCredentials(options: any, callback: Auth0Callback): void; @@ -323,8 +325,11 @@ export class Redirect { * Signs up a new user and automatically logs the user in after the signup. * * @method signupAndLogin - * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup - * @param {Function} callback + * @param {Object} options + * @param {String} options.email user email address + * @param {String} options.password user password + * @param {String} options.connection name of the connection where the user will be created + * @param {credentialsCallback} cb */ signupAndLogin(options: any, callback: Auth0Callback): void; } @@ -348,21 +353,51 @@ export class Popup { preload(options: any): any; /** - * Opens in a popup the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction + * Handles the popup logic for the callback page. + * + * @method callback + * @param {Object} options + * @param {String} options.hash the url hash. If not provided it will extract from window.location.hash + * @param {String} [options.state] value originally sent in `state` parameter to {@link authorize} to mitigate XSRF + * @param {String} [options.nonce] value originally sent in `nonce` parameter to {@link authorize} to prevent replay attacks + * @param {String} [options._idTokenVerification] makes parseHash perform or skip `id_token` verification. We **strongly** recommend validating the `id_token` yourself if you disable the verification. + * @see {@link parseHash} + */ + callback(options: any): void; + + /** + * Shows inside a new window the hosted login page (`/authorize`) in order to start a new authN/authZ transaction and post its result using `postMessage`. * * @method authorize - * @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db - * @param {Function} callback + * @param {Object} options + * @param {String} [options.domain] your Auth0 domain + * @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard + * @param {String} options.redirectUri url that the Auth0 will redirect after Auth with the Authorization Response + * @param {String} options.responseType type of the response used by OAuth 2.0 flow. It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0} + * @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client. Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes} + * @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state} + * @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce} + * @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email` + * @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth + * @param {Boolean} [options.owp] determines if Auth0 should render the relay page or not and the caller is responsible of handling the response. + * @param {authorizeCallback} cb + * @see {@link https://auth0.com/docs/api/authentication#authorize-client} */ authorize(options: any, callback: Auth0Callback): void; /** - * Initializes the legacy Lock login flow in a popup + * Performs authentication with username/email and password with a database connection inside a new window + * + * This method is not compatible with API Auth so if you need to fetch API tokens with audience + * you should use {@link authorize} or {@link login}. * * @method loginWithCredentials * @param {Object} options - * @param {Function} callback - * @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead. + * @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response + * @param {String} [options.responseType] type of the response used. It can be any of the values `code` and `token` + * @param {String} [options.responseMode] how the AuthN response is encoded and redirected back to the client. Supported values are `query` and `fragment` + * @param {String} [options.scope] scopes to be requested during AuthN. e.g. `openid email` + * @param {credentialsCallback} cb */ loginWithCredentials(options: any, callback: Auth0Callback): void; @@ -383,13 +418,38 @@ export class Popup { /** * Signs up a new user and automatically logs the user in after the signup. * + * This method is not compatible with API Auth so if you need to fetch API tokens with audience + * you should use {@link authorize} or {@link signupAndAuthorize}. + * * @method signupAndLogin - * @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup - * @param {Function} callback + * @param {Object} options + * @param {String} options.email user email address + * @param {String} options.password user password + * @param {String} options.connection name of the connection where the user will be created + * @param {credentialsCallback} cb */ signupAndLogin(options: any, callback: Auth0Callback): void; } +export class CrossOriginAuthentication { + constructor(webAuth: any, options: any); + + /** + * Logs in the user with username and password using the cross origin authentication (/co/authenticate) flow. You can use either `username` or `email` to identify the user, but `username` will take precedence over `email`. + * This only works when 3rd party cookies are enabled in the browser. After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor. + * + * @param {CrossOriginLoginOptions} options options used in the {@link authorize} call after the login_ticket is acquired + * @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the `redirectUri`. + */ + login(options: CrossOriginLoginOptions, callback: Auth0Callback): void; + + /** + * Runs the callback code for the cross origin authentication call. This method is meant to be called by the cross origin authentication callback url. + * + */ + callback(): void; +} + type Auth0Callback = (error: null | Auth0Error, result: T) => void; interface ManagementOptions { @@ -472,6 +532,7 @@ interface PasswordlessVerifyOptions { verificationCode: string; phoneNumber?: string; email?: string; + send?: string; } interface Auth0UserProfile { @@ -514,3 +575,85 @@ interface Auth0Identity { provider: string; user_id: string; } + +interface LoginOptions { + username: string; + password: string; + scope?: string; +} + +interface DefaultLoginOptions extends LoginOptions { + audience?: string; + realm: string; +} + +interface DefaultDirectoryLoginOptions extends LoginOptions { + audience?: string; +} + +interface ResourceOwnerLoginOptions extends LoginOptions { + connection: string; + device?: string; +} + +interface CrossOriginLoginOptions { + username?: string; + email?: string; + password: string; + realm?: string; +} + +interface LogoutOptions { + clientID?: string; + returnTo?: string; + federated?: boolean; +} + +interface DelegationOptions { + client_id?: string; + grant_type: string; + id_token?: string; + refresh_token?: string; + target?: string; + scope?: string; + api_type?: string; +} + +interface DbSignUpOptions { + email: string; + password: string; + connection: string; + scope?: string; +} + +interface ParseHashOptions { + hash?: string; + state?: string; + nonce?: string; + _idTokenVerification?: boolean; +} + +interface RenewAuthOptions { + domain?: string; + clientID?: string; + redirectUri?: string; + responseType?: string; + responseMode?: string; + state?: string; + nonce?: string; + scope?: string; + audience?: string; + postMessageDataType?: string; +} + +interface AuthorizeOptions { + domain?: string; + clientID?: string; + redirectUri: string; + responseType: string; + responseMode?: string; + state?: string; + nonce?: string; + scope?: string; + audience?: string; +} diff --git a/types/auth0-lock/auth0-lock-tests.ts b/types/auth0-lock/auth0-lock-tests.ts index a241eb6d0c..3abe93a7c2 100644 --- a/types/auth0-lock/auth0-lock-tests.ts +++ b/types/auth0-lock/auth0-lock-tests.ts @@ -61,11 +61,22 @@ lock.on("authenticated", function(authResult : any) { }); }); - // test theme var themeOptions : Auth0LockConstructorOptions = { theme: { + authButtons: { + fooProvider: { + displayName: 'foo' + }, + barProvider: { + displayName: 'foo', + primaryColor: '#FF0000', + foregroundColor: '#00FF00', + icon: 'http://baz.com/icon.png' + } + }, + labeledSubmitButton: false, logo: "https://example.com/assets/logo.png", primaryColor: "green" } @@ -73,6 +84,14 @@ var themeOptions : Auth0LockConstructorOptions = { new Auth0Lock(CLIENT_ID, DOMAIN, themeOptions); +// test empty theme + +var themeOptionsEmpty : Auth0LockConstructorOptions = { + theme: { } +}; + +new Auth0Lock(CLIENT_ID, DOMAIN, themeOptions); + // test authentication var authOptions : Auth0LockConstructorOptions = { @@ -170,7 +189,7 @@ var selectFieldOptionsWithCallbacks : Auth0LockConstructorOptions = { cb(null, prefill); } }] -} +}; new Auth0Lock(CLIENT_ID, DOMAIN, selectFieldOptionsWithCallbacks); @@ -198,3 +217,17 @@ var avatarOptions : Auth0LockConstructorOptions = { }; new Auth0Lock(CLIENT_ID, DOMAIN, avatarOptions); + +var authResult : AuthResult = { + accessToken: 'fake_access_token', + idToken: 'fake_id_token', + idTokenPayload: { + aud: "EaQzyHt1Dy57l-r5iHcMeT-lh1fFZntg", + exp: 1494393724, + iat: 1494357724, + iss: "https://www.foo.com", + sub: "auth0|aksjfkladsf" + }, + refreshToken: undefined, + state: "923jf092j3.FFSDJFDSKLDF" +}; diff --git a/types/auth0-lock/index.d.ts b/types/auth0-lock/index.d.ts index 285ad25288..e49c23a308 100644 --- a/types/auth0-lock/index.d.ts +++ b/types/auth0-lock/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for auth0-lock 10.10 +// Type definitions for auth0-lock 10.16 // Project: http://auth0.com // Definitions by: Brian Caruso +// Dan Caddigan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -40,7 +41,19 @@ interface Auth0LockAvatarOptions { displayName: (email: string, callback: Auth0LockAvatarDisplayNameCallback) => void; } +interface Auth0LockThemeButton { + displayName: string; + primaryColor?: string; + foregroundColor?: string; + icon?: string; +} +interface Auth0LockThemeButtonOptions { + [provider: string]: Auth0LockThemeButton; +} + interface Auth0LockThemeOptions { + authButtons?: Auth0LockThemeButtonOptions; + labeledSubmitButton?: boolean; logo?: string; primaryColor?: string; } @@ -121,6 +134,20 @@ interface Auth0LockShowOptions { rememberLastLogin?: boolean; } +interface AuthResult { + accessToken: string; + idToken: string; + idTokenPayload: { + aud: string; + exp: number; + iat: number; + iss: string; + sub: string; + }; + refreshToken?: string; + state: string; +} + interface Auth0LockStatic { new (clientId: string, domain: string, options?: Auth0LockConstructorOptions): Auth0LockStatic; @@ -128,14 +155,14 @@ interface Auth0LockStatic { getProfile(token: string, callback: (error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) => void): void; getUserInfo(token: string, callback: (error: auth0.Auth0Error, profile: auth0.Auth0UserProfile) => void): void; // https://github.com/auth0/lock#resumeauthhash-callback - resumeAuth( hash: string, callback: (error: auth0.Auth0Error, authResult: any) => void): void; + resumeAuth( hash: string, callback: (error: auth0.Auth0Error, authResult: AuthResult) => void): void; show(options?: Auth0LockShowOptions): void; hide(): void; logout(query: any): void; on(event: "show" | "hide", callback: () => void): void; on(event: "unrecoverable_error" | "authorization_error", callback: (error: auth0.Auth0Error) => void): void; - on(event: "authenticated", callback: (authResult: any) => void): void; + on(event: "authenticated", callback: (authResult: AuthResult) => void): void; on(event: string, callback: (...args: any[]) => void): void; } diff --git a/types/auth0-lock/tslint.json b/types/auth0-lock/tslint.json new file mode 100644 index 0000000000..51b68d9fc6 --- /dev/null +++ b/types/auth0-lock/tslint.json @@ -0,0 +1,12 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "only-arrow-functions": false, + "no-misused-new": false, + "no-single-declare-module": false, + "prefer-method-signature": false, + "object-literal-shorthand": false, + "typedef-whitespace": false, + "no-var": false + } +} diff --git a/types/autobahn/index.d.ts b/types/autobahn/index.d.ts index 8a37bdf21b..6741bcccd1 100644 --- a/types/autobahn/index.d.ts +++ b/types/autobahn/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for AutobahnJS v0.9.7 // Project: http://autobahn.ws/js/ -// Definitions by: Elad Zelingher , Andy Hawkins +// Definitions by: Elad Zelingher , Andy Hawkins , Wladimir Totino // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -167,8 +167,14 @@ declare namespace autobahn { interface IPublishOptions { acknowledge?: boolean; exclude?: number[]; + exclude_authid?: string[]; + exclude_authrole?: string[]; eligible?: number[]; - disclose_me?: Boolean; + eligible_authid?: string[]; + eligible_authrole?: string[]; + retain?: boolean; + disclose_me?: boolean; + exclude_me?: boolean; } interface ISubscribeOptions { diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index e793442177..55a3d6b99f 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -60,7 +60,7 @@ var S3CreateEvent: AWSLambda.S3CreateEvent = { } ] }; - +var cognitoUserPoolEvent: AWSLambda.CognitoUserPoolEvent; /* API Gateway Event */ str = apiGwEvt.body; @@ -164,6 +164,55 @@ authResponse = { policyDocument: policyDocument }; +// CognitoUserPoolEvent +num = cognitoUserPoolEvent.version; +cognitoUserPoolEvent.triggerSource === "PreSignUp_SignUp"; +cognitoUserPoolEvent.triggerSource === "PostConfirmation_ConfirmSignUp"; +cognitoUserPoolEvent.triggerSource === "PreAuthentication_Authentication"; +cognitoUserPoolEvent.triggerSource === "PostAuthentication_Authentication"; +cognitoUserPoolEvent.triggerSource === "CustomMessage_SignUp"; +cognitoUserPoolEvent.triggerSource === "CustomMessage_AdminCreateUser"; +cognitoUserPoolEvent.triggerSource === "CustomMessage_ResendCode"; +cognitoUserPoolEvent.triggerSource === "CustomMessage_ForgotPassword"; +cognitoUserPoolEvent.triggerSource === "CustomMessage_UpdateUserAttribute"; +cognitoUserPoolEvent.triggerSource === "CustomMessage_VerifyUserAttribute"; +cognitoUserPoolEvent.triggerSource === "CustomMessage_Authentication"; +cognitoUserPoolEvent.triggerSource === "DefineAuthChallenge_Authentication"; +cognitoUserPoolEvent.triggerSource === "CreateAuthChallenge_Authentication"; +cognitoUserPoolEvent.triggerSource === "VerifyAuthChallengeResponse_Authentication"; +str = cognitoUserPoolEvent.region; +str = cognitoUserPoolEvent.userPoolId; +str = cognitoUserPoolEvent.userName; +str = cognitoUserPoolEvent.callerContext.awsSdkVersion; +str = cognitoUserPoolEvent.callerContext.clientId; +str = cognitoUserPoolEvent.request.userAttributes["email"]; +str = cognitoUserPoolEvent.request.validationData["k1"]; +str = cognitoUserPoolEvent.request.codeParameter; +str = cognitoUserPoolEvent.request.usernameParameter; +b = cognitoUserPoolEvent.request.newDeviceUsed; +cognitoUserPoolEvent.request.session[0].challengeName === "CUSTOM_CHALLENGE"; +cognitoUserPoolEvent.request.session[0].challengeName === "PASSWORD_VERIFIER"; +cognitoUserPoolEvent.request.session[0].challengeName === "SMS_MFA"; +cognitoUserPoolEvent.request.session[0].challengeName === "DEVICE_SRP_AUTH"; +cognitoUserPoolEvent.request.session[0].challengeName === "DEVICE_PASSWORD_VERIFIER"; +cognitoUserPoolEvent.request.session[0].challengeName === "ADMIN_NO_SRP_AUTH"; +b = cognitoUserPoolEvent.request.session[0].challengeResult; +str = cognitoUserPoolEvent.request.session[0].challengeMetaData; +str = cognitoUserPoolEvent.request.challengeName; +str = cognitoUserPoolEvent.request.privateChallengeParameters["answer"]; +str = cognitoUserPoolEvent.request.challengeAnswer["answer"]; +b = cognitoUserPoolEvent.response.answerCorrect; +str = cognitoUserPoolEvent.response.smsMessage; +str = cognitoUserPoolEvent.response.emailMessage; +str = cognitoUserPoolEvent.response.emailSubject; +str = cognitoUserPoolEvent.response.challengeName; +b = cognitoUserPoolEvent.response.issueTokens; +b = cognitoUserPoolEvent.response.failAuthentication; +str = cognitoUserPoolEvent.response.publicChallengeParameters["captchaUrl"]; +str = cognitoUserPoolEvent.response.privateChallengeParameters["answer"]; +str = cognitoUserPoolEvent.response.challengeMetaData; +b = cognitoUserPoolEvent.response.answerCorrect; + /* Context */ b = context.callbackWaitsForEmptyEventLoop; str = context.functionName; diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index a5fa271699..ca84cd350d 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for AWS Lambda // Project: http://docs.aws.amazon.com/lambda -// Definitions by: James Darbyshire , Michael Skarum , Stef Heyenrath , Toby Hede , Rich Buggy , Simon Ramsay +// Definitions by: James Darbyshire , Michael Skarum , Stef Heyenrath , Toby Hede , Rich Buggy , Simon Ramsay , Yoriki Yamaguchi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // API Gateway "event" @@ -124,6 +124,50 @@ interface S3CreateEvent { ]; } +/** + * Cognito User Pool event + * http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html + */ +interface CognitoUserPoolEvent { + version: number; + triggerSource: "PreSignUp_SignUp" | "PostConfirmation_ConfirmSignUp" | "PreAuthentication_Authentication" | "PostAuthentication_Authentication" | "CustomMessage_SignUp" | "CustomMessage_AdminCreateUser" | "CustomMessage_ResendCode" | "CustomMessage_ForgotPassword" | "CustomMessage_UpdateUserAttribute" | "CustomMessage_VerifyUserAttribute" | "CustomMessage_Authentication" | "DefineAuthChallenge_Authentication" | "CreateAuthChallenge_Authentication" | "VerifyAuthChallengeResponse_Authentication"; + region: string; + userPoolId: string; + userName?: string; + callerContext: { + awsSdkVersion: string; + clientId: string; + }; + request: { + userAttributes: {[key: string]: string}; + validationData?: {[key: string]: string}; + codeParameter?: string; + usernameParameter?: string; + newDeviceUsed?: boolean; + session?: { + challengeName: "CUSTOM_CHALLENGE" | "PASSWORD_VERIFIER" | "SMS_MFA" | "DEVICE_SRP_AUTH" | "DEVICE_PASSWORD_VERIFIER" | "ADMIN_NO_SRP_AUTH"; + challengeResult: boolean; + challengeMetaData?: string; + }[]; + challengeName?: string; + privateChallengeParameters?: {[key: string]: string}; + challengeAnswer?: {[key: string]: string}; + }; + response: { + autoConfirmUser?: boolean; + smsMessage?: string; + emailMessage?: string; + emailSubject?: string; + challengeName?: string; + issueTokens?: boolean; + failAuthentication?: boolean; + publicChallengeParameters?: {[key: string]: string}; + privateChallengeParameters?: {[key: string]: string}; + challengeMetaData?: string; + answerCorrect?: boolean; + }; +} + // Context // http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html interface Context { diff --git a/types/babel-traverse/babel-traverse-tests.ts b/types/babel-traverse/babel-traverse-tests.ts index 98afbbc0a7..5952faefd1 100644 --- a/types/babel-traverse/babel-traverse-tests.ts +++ b/types/babel-traverse/babel-traverse-tests.ts @@ -120,3 +120,15 @@ const BindingKindTest: Visitor = { // kind === 'anythingElse'; }, }; + +// https://github.com/babel/babel/blob/d33d02359474296402b1577ef53f20d94e9085c4/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/exec/scope-bindings.js#L15-L25 +const vScope: Visitor = { + Scope: { + enter(path) { + console.log(`Entering scope: ${path.node.type}`); + }, + exit(path) { + console.log(`Exiting scope: ${path.node.type}`); + } + } +}; diff --git a/types/babel-traverse/index.d.ts b/types/babel-traverse/index.d.ts index e307cd664d..8d34144d0a 100644 --- a/types/babel-traverse/index.d.ts +++ b/types/babel-traverse/index.d.ts @@ -305,6 +305,7 @@ export interface Visitor extends VisitNodeObject { FlowBaseAnnotation?: VisitNode; FlowDeclaration?: VisitNode; JSX?: VisitNode; + Scope?: VisitNode; } export type VisitNode = VisitNodeFunction | VisitNodeObject; diff --git a/types/babel-types/babel-types-tests.ts b/types/babel-types/babel-types-tests.ts index cb02d11ee1..5974a64885 100644 --- a/types/babel-types/babel-types-tests.ts +++ b/types/babel-types/babel-types-tests.ts @@ -14,6 +14,9 @@ traverse(ast, { if (t.isIdentifier(node, { name: "n" })) { node.name = "x"; } + if (t.isFunctionExpression(node)) { + node.params = [t.identifier('param')]; + } } }); @@ -24,3 +27,5 @@ if (t.isBinaryExpression(ast)) { } t.assertBinaryExpression(ast); t.assertBinaryExpression(ast, { operator: "*" }); + +var exp: t.Expression = t.nullLiteral(); diff --git a/types/babel-types/index.d.ts b/types/babel-types/index.d.ts index b3b0f966c6..77ea8b54de 100644 --- a/types/babel-types/index.d.ts +++ b/types/babel-types/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for babel-types v6.7 // Project: https://github.com/babel/babel/tree/master/packages/babel-types -// Definitions by: Troy Gerwien +// Definitions by: Troy Gerwien , Sam Baxter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export interface Comment { @@ -88,7 +88,7 @@ export interface CallExpression extends Node { export interface CatchClause extends Node { type: "CatchClause"; - param: Pattern; + param: Identifier; body: BlockStatement; } @@ -148,7 +148,7 @@ export interface ForStatement extends Node { export interface FunctionDeclaration extends Node { type: "FunctionDeclaration"; id: Identifier; - params: Pattern[]; + params: Array; body: BlockStatement; generator: boolean; async: boolean; @@ -159,7 +159,7 @@ export interface FunctionDeclaration extends Node { export interface FunctionExpression extends Node { type: "FunctionExpression"; id: Identifier; - params: Pattern[]; + params: Array; body: BlockStatement; generator: boolean; async: boolean; @@ -252,7 +252,7 @@ export interface ObjectMethod extends Node { value: Expression; decorators?: Decorator[]; id: Identifier; - params: Pattern[]; + params: Array; body: BlockStatement; generator: boolean; async: boolean; @@ -353,20 +353,20 @@ export interface WithStatement extends Node { export interface AssignmentPattern extends Node { type: "AssignmentPattern"; - left: Pattern; + left: Identifier; right: Expression; } export interface ArrayPattern extends Node { type: "ArrayPattern"; - elements: Array; + elements: Array; typeAnnotation?: TypeAnnotation; } export interface ArrowFunctionExpression extends Node { type: "ArrowFunctionExpression"; id: Identifier; - params: Pattern[]; + params: Array; body: BlockStatement | Expression; generator: boolean; async: boolean; @@ -472,7 +472,7 @@ export interface ClassMethod extends Node { static: boolean; decorators?: Decorator[]; id: Identifier; - params: Pattern[]; + params: Array; body: BlockStatement; generator: boolean; async: boolean; @@ -870,7 +870,7 @@ export interface SpreadProperty extends Node { argument: Expression; } -export type Expression = ArrayExpression | AssignmentExpression | BinaryExpression | CallExpression | ConditionalExpression | FunctionExpression | Identifier | StringLiteral | NumericLiteral | BooleanLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | ObjectExpression | SequenceExpression | ThisExpression | UnaryExpression | UpdateExpression | ArrowFunctionExpression | ClassExpression | MetaProperty | Super | TaggedTemplateExpression | TemplateLiteral | YieldExpression | TypeCastExpression | JSXElement | JSXEmptyExpression | JSXIdentifier | JSXMemberExpression | ParenthesizedExpression | AwaitExpression | BindExpression | DoExpression; +export type Expression = ArrayExpression | AssignmentExpression | BinaryExpression | CallExpression | ConditionalExpression | FunctionExpression | Identifier | StringLiteral | NumericLiteral | BooleanLiteral | NullLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | ObjectExpression | SequenceExpression | ThisExpression | UnaryExpression | UpdateExpression | ArrowFunctionExpression | ClassExpression | MetaProperty | Super | TaggedTemplateExpression | TemplateLiteral | YieldExpression | TypeCastExpression | JSXElement | JSXEmptyExpression | JSXIdentifier | JSXMemberExpression | ParenthesizedExpression | AwaitExpression | BindExpression | DoExpression; export type Binary = BinaryExpression | LogicalExpression; export type Scopable = BlockStatement | CatchClause | DoWhileStatement | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement | ArrowFunctionExpression | ClassDeclaration | ClassExpression | ForOfStatement | ClassMethod; export type BlockParent = BlockStatement | DoWhileStatement | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement | ArrowFunctionExpression | ForOfStatement | ClassMethod; @@ -886,11 +886,11 @@ export type For = ForInStatement | ForStatement | ForOfStatement; export type ForXStatement = ForInStatement | ForOfStatement; export type Function = FunctionDeclaration | FunctionExpression | ObjectMethod | ArrowFunctionExpression | ClassMethod; export type FunctionParent = FunctionDeclaration | FunctionExpression | Program | ObjectMethod | ArrowFunctionExpression | ClassMethod; -export type Pureish = FunctionDeclaration | FunctionExpression | StringLiteral | NumericLiteral | BooleanLiteral | ArrowFunctionExpression | ClassDeclaration | ClassExpression; +export type Pureish = FunctionDeclaration | FunctionExpression | StringLiteral | NumericLiteral | BooleanLiteral | NullLiteral | ArrowFunctionExpression | ClassDeclaration | ClassExpression; export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareTypeAlias | DeclareVariable | InterfaceDeclaration | TypeAlias; export type LVal = Identifier | MemberExpression | RestElement | AssignmentPattern | ArrayPattern | ObjectPattern; -export type Literal = StringLiteral | NumericLiteral | BooleanLiteral | RegExpLiteral | TemplateLiteral; -export type Immutable = StringLiteral | NumericLiteral | BooleanLiteral | JSXAttribute | JSXClosingElement | JSXElement | JSXExpressionContainer | JSXOpeningElement; +export type Literal = StringLiteral | NumericLiteral | BooleanLiteral | NullLiteral | RegExpLiteral | TemplateLiteral; +export type Immutable = StringLiteral | NumericLiteral | BooleanLiteral | NullLiteral | JSXAttribute | JSXClosingElement | JSXElement | JSXExpressionContainer | JSXOpeningElement; export type UserWhitespacable = ObjectMethod | ObjectProperty | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeProperty; export type Method = ObjectMethod | ClassMethod; export type ObjectMember = ObjectMethod | ObjectProperty; @@ -925,8 +925,8 @@ export function expressionStatement(expression?: Expression): ExpressionStatemen export function file(program?: Program, comments?: Comment[], tokens?: any[]): File; export function forInStatement(left?: VariableDeclaration | LVal, right?: Expression, body?: Statement): ForInStatement; export function forStatement(init?: VariableDeclaration | Expression, test?: Expression, update?: Expression, body?: Statement): ForStatement; -export function functionDeclaration(id?: Identifier, params?: Pattern[], body?: BlockStatement, generator?: boolean, async?: boolean): FunctionDeclaration; -export function functionExpression(id?: Identifier, params?: Pattern[], body?: BlockStatement, generator?: boolean, async?: boolean): FunctionExpression; +export function functionDeclaration(id?: Identifier, params?: Array, body?: BlockStatement, generator?: boolean, async?: boolean): FunctionDeclaration; +export function functionExpression(id?: Identifier, params?: Array, body?: BlockStatement, generator?: boolean, async?: boolean): FunctionExpression; export function identifier(name?: string): Identifier; export function ifStatement(test?: Expression, consequent?: Statement, alternate?: Statement): IfStatement; export function labeledStatement(label?: Identifier, body?: Statement): LabeledStatement; @@ -940,7 +940,7 @@ export function memberExpression(object?: Expression | Super, property?: Express export function newExpression(callee?: Expression | Super, _arguments?: Array): NewExpression; export function program(body?: Array, directives?: Directive[]): Program; export function objectExpression(properties?: Array): ObjectExpression; -export function objectMethod(kind?: "get" | "set" | "method", key?: Expression, params?: Pattern[], body?: BlockStatement, computed?: boolean): ObjectMethod; +export function objectMethod(kind?: "get" | "set" | "method", key?: Expression, params?: Array, body?: BlockStatement, computed?: boolean): ObjectMethod; export function objectProperty(key?: Expression, value?: Expression, computed?: boolean, shorthand?: boolean, decorators?: Decorator[]): ObjectProperty; export function restElement(argument?: LVal, typeAnnotation?: TypeAnnotation): RestElement; export function returnStatement(argument?: Expression): ReturnStatement; @@ -957,8 +957,8 @@ export function variableDeclarator(id?: LVal, init?: Expression): VariableDeclar export function whileStatement(test?: Expression, body?: BlockStatement | Statement): WhileStatement; export function withStatement(object?: Expression, body?: BlockStatement | Statement): WithStatement; export function assignmentPattern(left?: Identifier, right?: Expression): AssignmentPattern; -export function arrayPattern(elements?: Array, typeAnnotation?: TypeAnnotation): ArrayPattern; -export function arrowFunctionExpression(params?: Pattern[], body?: BlockStatement | Expression, async?: boolean): ArrowFunctionExpression; +export function arrayPattern(elements?: Array, typeAnnotation?: TypeAnnotation): ArrayPattern; +export function arrowFunctionExpression(params?: Array, body?: BlockStatement | Expression, async?: boolean): ArrowFunctionExpression; export function classBody(body?: Array): ClassBody; export function classDeclaration(id?: Identifier, superClass?: Expression, body?: ClassBody, decorators?: Decorator[]): ClassDeclaration; export function classExpression(id?: Identifier, superClass?: Expression, body?: ClassBody, decorators?: Decorator[]): ClassExpression; @@ -972,7 +972,7 @@ export function importDefaultSpecifier(local?: Identifier): ImportDefaultSpecifi export function importNamespaceSpecifier(local?: Identifier): ImportNamespaceSpecifier; export function importSpecifier(local?: Identifier, imported?: Identifier): ImportSpecifier; export function metaProperty(meta?: string, property?: string): MetaProperty; -export function classMethod(kind?: "constructor" | "method" | "get" | "set", key?: Expression, params?: Pattern[], body?: BlockStatement, computed?: boolean, _static?: boolean): ClassMethod; +export function classMethod(kind?: "constructor" | "method" | "get" | "set", key?: Expression, params?: Array, body?: BlockStatement, computed?: boolean, _static?: boolean): ClassMethod; export function objectPattern(properties?: Array, typeAnnotation?: TypeAnnotation): ObjectPattern; export function spreadElement(argument?: Expression): SpreadElement; export function taggedTemplateExpression(tag?: Expression, quasi?: TemplateLiteral): TaggedTemplateExpression; diff --git a/types/babylon/index.d.ts b/types/babylon/index.d.ts index 4400a8f1a0..eb35a5d799 100644 --- a/types/babylon/index.d.ts +++ b/types/babylon/index.d.ts @@ -5,10 +5,11 @@ /// -import * as t from 'babel-types'; -type Node = t.Node; +import { File, Expression } from 'babel-types'; -export function parse(code: string, opts?: BabylonOptions): Node; +export function parse(code: string, opts?: BabylonOptions): File; + +export function parseExpression(input: string, options?: BabylonOptions): Expression; export interface BabylonOptions { /** diff --git a/types/backbone.marionette/backbone.marionette-tests.ts b/types/backbone.marionette/backbone.marionette-tests.ts index 46f504e18e..a7da55495b 100644 --- a/types/backbone.marionette/backbone.marionette-tests.ts +++ b/types/backbone.marionette/backbone.marionette-tests.ts @@ -292,6 +292,14 @@ function RegionTests() { } +function ViewTests() { + const v = new MyView(new MyModel()); + const isDestroyed: boolean = v.isDestroyed(); + const isRendered: boolean = v.isRendered(); + const isAttached: boolean = v.isAttached(); + const vv: Marionette.View = v.delegateEntityEvents(); +} + function CollectionViewTests() { var cv = new MyCollectionView(); cv.collection.add(new MyModel()); diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index d24f9d64f9..93b82355db 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -856,7 +856,10 @@ declare namespace Marionette { /** * Internal properties extended in Marionette.View. */ - isDestroyed: boolean; + isDestroyed(): boolean; + isRendered(): boolean; + isAttached(): boolean; + delegateEntityEvents(): View; supportsRenderLifecycle: boolean; supportsDestroyLifecycle: boolean; diff --git a/types/backbone.paginator/backbone.paginator-tests.ts b/types/backbone.paginator/backbone.paginator-tests.ts index f4f5765988..f24e2855f5 100644 --- a/types/backbone.paginator/backbone.paginator-tests.ts +++ b/types/backbone.paginator/backbone.paginator-tests.ts @@ -107,60 +107,48 @@ namespace Paging { testCollection.getFirstPage(options); - // 'silent's type is boolean. (structural subtyping) - testCollection.getFirstPage({silent: 'aa'}); - // 'url's type is string. (structural subtyping) - testCollection.getFirstPage({url: true}); + testCollection.getFirstPage({silent: false}); + testCollection.getFirstPage({url: 'zombocom'}); result = testCollection.getLastPage(); testCollection.getLastPage(options); - // 'silent's type is boolean. (structural subtyping) - testCollection.getLastPage({silent: 'aa'}); - // 'url's type is string. (structural subtyping) - testCollection.getLastPage({url: true}); + testCollection.getLastPage({silent: true}); + testCollection.getLastPage({url: 'chickensnack'}); result = testCollection.getNextPage(); testCollection.getNextPage(options); - // 'silent's type is boolean. (structural subtyping) - testCollection.getNextPage({silent: 'aa'}); - // 'url's type is string. (structural subtyping) - testCollection.getNextPage({url: true}); + testCollection.getNextPage({silent: false}); + testCollection.getNextPage({url: 'hampsterdance'}); result = testCollection.getPage(1); testCollection.getPage("1", options); - // 'silent's type is boolean. (structural subtyping) - testCollection.getPage(1, {silent: 'aa'}); - // 'url's type is string. (structural subtyping) - testCollection.getPage(1, {url: true}); + testCollection.getPage(1, {silent: true}); + testCollection.getPage(1, {url: 'badcandy'}); result = testCollection.getPageByOffset(1); testCollection.getPageByOffset(1, options); - // 'silent's type is boolean. (structural subtyping) - testCollection.getPageByOffset(1, {silent: 'aa'}); - // 'url's type is string. (structural subtyping) - testCollection.getPageByOffset(1, {url: true}); + testCollection.getPageByOffset(1, {silent: false}); + testCollection.getPageByOffset(1, {url: 'oldmanmurray'}); result = testCollection.getPreviousPage(); testCollection.getPreviousPage(options); - // 'silent's type is boolean. (structural subtyping) - testCollection.getPreviousPage({silent: 'aa'}); - // 'url's type is string. (structural subtyping) - testCollection.getPreviousPage({url: true}); + testCollection.getPreviousPage({silent: false}); + testCollection.getPreviousPage({url: 'uncyclopedia'}); var hasPage:boolean = testCollection.hasNextPage(); @@ -231,7 +219,7 @@ namespace Setting { var result2:TestCollection - = testCollection.setSorting('id', 1, options); + = testCollection.setSorting('id', 1, { full: true}); result1 = testCollection.switchMode( 'server', diff --git a/types/baconjs/baconjs-tests.ts b/types/baconjs/baconjs-tests.ts index e948668dc7..75560d4e42 100644 --- a/types/baconjs/baconjs-tests.ts +++ b/types/baconjs/baconjs-tests.ts @@ -190,6 +190,11 @@ function CommonMethodsInEventStreamsAndProperties() { console.log(sum); // returns [-1, 2, 8] in an order }); } + + { + var src = Bacon.fromArray([1, 2, 3]); + src.doLog('element value'); + } } function EventStream() { diff --git a/types/baconjs/index.d.ts b/types/baconjs/index.d.ts index 8659ea9115..0550d6ec48 100644 --- a/types/baconjs/index.d.ts +++ b/types/baconjs/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Bacon.js 0.7.0 // Project: https://baconjs.github.io/ -// Definitions by: Alexander Matsievsky +// Definitions by: Alexander Matsievsky , Joonas Javanainen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -69,7 +69,7 @@ declare namespace Bacon { /** * @function * @description Creates an [EventStream]{@link Bacon.EventStream} from a `promise` Promise object such as JQuery Ajax. This stream will contain a single value or an error, followed immediately by stream end. You can use the optional `abort` flag (i.e. ´Bacon.fromPromise(p, true)´ to have the `abort` method of the given promise be called when all subscribers have been removed from the created stream. - * @param {Promise|JQueryXHR} promise + * @param {PromiseLike|JQueryXHR} promise * @param {boolean} [abort] * @returns {EventStream} * @example @@ -78,7 +78,7 @@ declare namespace Bacon { * Bacon.fromPromise($.ajax("https://baconjs.github.io/"), true); * Bacon.fromPromise(Promise.resolve(1), false); */ - function fromPromise(promise:Promise|JQueryXHR, abort?:boolean):EventStream; + function fromPromise(promise:PromiseLike|JQueryXHR, abort?:boolean):EventStream; /** * @callback Bacon.fromPromise~eventTransformer @@ -88,7 +88,7 @@ declare namespace Bacon { /** * @function Bacon.fromPromise * @description Creates an [EventStream]{@link Bacon.EventStream} from a `promise` Promise object such as JQuery Ajax. This stream will contain a single value or an error, followed immediately by stream end. You can use the `abort` flag (i.e. ´Bacon.fromPromise(p, true)´ to have the `abort` method of the given promise be called when all subscribers have been removed from the created stream, and also pass a function `eventTransformer` that transforms the promise value into Events. The default is to transform the value into `[new Bacon.Next(value), new Bacon.End()]`. - * @param {Promise|JQueryXHR} promise + * @param {PromiseLike|JQueryXHR} promise * @param {boolean} abort * @param {Bacon.fromPromise~eventTransformer} eventTransformer * @returns {EventStream} @@ -100,7 +100,7 @@ declare namespace Bacon { * return [new Bacon.Next(n), new Bacon.Next(() => n), new Bacon.End()]; * }); */ - function fromPromise(promise:Promise|JQueryXHR, abort:boolean, eventTransformer:(value:A) => (Initial|Next|End|Error)[]):EventStream; + function fromPromise(promise:PromiseLike|JQueryXHR, abort:boolean, eventTransformer:(value:A) => (Initial|Next|End|Error)[]):EventStream; /** * @function @@ -1026,9 +1026,10 @@ declare namespace Bacon { /** * @method EventStream#doLog * @description Logs each value of the [EventStream]{@link Bacon.EventStream} to the console. [doLog]{@link Bacon.EventStream#doLog} behaves like [log]{@link Bacon.EventStream#log} but does not subscribe to the EventStream. You can think of `doLog` as a logger function that – unlike `log` – is safe to use in production. `doLog` is safe, because it does not cause the same surprising side-effects as `log` does. + * @param {string} [label] * @returns {EventStream} */ - doLog():EventStream; + doLog(label?:string):EventStream; /** * @method @@ -1613,9 +1614,10 @@ declare namespace Bacon { /** * @method Property#doLog * @description Logs each value of the [Property]{@link Bacon.Property} to the console. [doLog]{@link Bacon.Property#doLog} behaves like [log]{@link Bacon.Property#log} but does not subscribe to the Property. You can think of `doLog` as a logger function that – unlike `log` – is safe to use in production. `doLog` is safe, because it does not cause the same surprising side-effects as `log` does. + * @param {string} [label] * @returns {Property} */ - doLog():Property; + doLog(label?:string):Property; /** * @method diff --git a/types/bagpipes/index.d.ts b/types/bagpipes/index.d.ts index 82a1fa32f4..ec1d0cceb7 100755 --- a/types/bagpipes/index.d.ts +++ b/types/bagpipes/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Michael Mrowetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface FittingContext { +export interface FittingContext { /** The input defined in the fitting definition * (string, number, object, array) */ @@ -17,9 +17,9 @@ interface FittingContext { * Fitting types has pre-defined fittings `system` and `user` * but can be any any string for custom types like `swagger` or `node-machine` */ -type FittingType = "system" | "user" | string; +export type FittingType = "system" | "user" | string; -interface FittingDef { +export interface FittingDef { /** * If type is omitted (as it must be for in-line usage), Bagpipes will * first check the user fittings then the system fittings for the name and @@ -46,8 +46,8 @@ interface FittingDef { * * Will be called called when the `Pipe` it is contained it gets 'played' */ -type Fitting = ( - context: FittingContext, +export type Fitting = ( + context: FittingContext, next: {(err: Error | null | undefined, res?: any): void}) => void; /** @@ -58,18 +58,18 @@ type Fitting = ( * * @param {Object} fittingDef Fitting Definition */ -type FittingFactory = (fittingDef: FittingDef, bagpipes: any) => Fitting; +export type FittingFactory = (fittingDef: FittingDef, bagpipes: any) => Fitting; /** * Hashmap of `fittingType`s (the name of a fitting) and the * `FittingFactory` functions used to create them */ -interface FittingTypesMap { +export interface FittingTypesMap { [fittingType: string]: FittingFactory; } /** The Pipe Definition */ -type PipeDef = any[] | string | FittingDef; +export type PipeDef = any[] | string | FittingDef; /** Hashmap of Pipe Definitons */ export interface PipeDefMap { @@ -143,10 +143,10 @@ export function create(pipesDefs: PipeDefMap, conf?: Config): Bagpipes; // Types for imports from `pipeworks` module -type Affinity = "hoist" | "sink"; +export type Affinity = "hoist" | "sink"; /** PipeDef used in `pipeworks` module */ -interface PipeworksOptions { +export interface PipeworksOptions { /** * Adds to the pre and post queues, respectively. * Ensures a pipe gets fitted before or after the main execution pipeline. diff --git a/types/bagpipes/tslint.json b/types/bagpipes/tslint.json index 3db14f85ea..a4bcc87748 100755 --- a/types/bagpipes/tslint.json +++ b/types/bagpipes/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "callable-types": false + } +} diff --git a/types/basic-auth/basic-auth-tests.ts b/types/basic-auth/basic-auth-tests.ts index 1fab9c10e2..e416afe352 100644 --- a/types/basic-auth/basic-auth-tests.ts +++ b/types/basic-auth/basic-auth-tests.ts @@ -1,4 +1,12 @@ - +import {IncomingMessage} from 'http'; import auth = require('basic-auth'); -auth(null); +const loginData = auth(undefined! as IncomingMessage); +if (loginData) { + const {name, pass} = loginData; +} + +const parsed = auth.parse('Basic QmFzaWM6QXV0aA=='); +if (parsed) { + const {name, pass} = parsed; +} diff --git a/types/basic-auth/index.d.ts b/types/basic-auth/index.d.ts index 51ada3b0c7..276b5b8af6 100644 --- a/types/basic-auth/index.d.ts +++ b/types/basic-auth/index.d.ts @@ -1,19 +1,25 @@ -// Type definitions for basic-auth +// Type definitions for basic-auth 1.1 // Project: https://github.com/jshttp/basic-auth -// Definitions by: Clément Bourgeois +// Definitions by: Clément Bourgeois , Vesa Poikajärvi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// import * as http from 'http'; -declare function auth(req: http.IncomingMessage): auth.BasicAuthResult; +// See https://github.com/jshttp/basic-auth/blob/v1.1.0/index.js#L49 +declare function auth(req: http.IncomingMessage): auth.BasicAuthResult | undefined; declare namespace auth { interface BasicAuthResult { name: string; pass: string; } + + /** + * Parse basic auth to object. + */ + function parse(authorizationHeader: string): auth.BasicAuthResult | undefined; } export = auth; diff --git a/types/basic-auth/tsconfig.json b/types/basic-auth/tsconfig.json index b9f77df9d2..8d9222de2c 100644 --- a/types/basic-auth/tsconfig.json +++ b/types/basic-auth/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/basic-auth/tslint.json b/types/basic-auth/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/basic-auth/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/big-integer/big-integer-tests.ts b/types/big-integer/big-integer-tests.ts deleted file mode 100644 index 62f234b371..0000000000 --- a/types/big-integer/big-integer-tests.ts +++ /dev/null @@ -1,118 +0,0 @@ - - -// constructor tests -var noArgument = bigInt(), - numberArgument = bigInt( 93 ), - stringArgument = bigInt( "75643564363473453456342378564387956906736546456235345" ), - baseArgumentInt = bigInt( "101010", 2 ), - baseArgumentStr = bigInt( "101010", "2" ), - baseArgumentBi = bigInt( "101010", bigInt( 2 ) ), - bigIntArgument = bigInt( noArgument ); - -// method tests -var x = bigInt(), - isBigInteger: BigInteger, - isNumber: number, - isBoolean: boolean, - isString: string, - isDivmod: { - quotient: BigInteger; - remainder: BigInteger; - }; - -isBigInteger = x.abs(); - -isBigInteger = x.add( 0 ); -isBigInteger = x.add( x ); -isBigInteger = x.add( "100" ); - -isNumber = x.compare( 0 ); -isNumber = x.compare( x ); -isNumber = x.compare( "100" ); - -isNumber = x.compareAbs( 0 ); -isNumber = x.compareAbs( x ); -isNumber = x.compareAbs( "100" ); - -isBigInteger = x.divide( 0 ); -isBigInteger = x.divide( x ); -isBigInteger = x.divide( "100" ); - -isDivmod = x.divmod( 0 ); -isDivmod = x.divmod( x ); -isDivmod = x.divmod( "100" ); - -isBoolean = x.equals( 0 ); -isBoolean = x.equals( x ); -isBoolean = x.equals( "100" ); - -isBoolean = x.greater( 0 ); -isBoolean = x.greater( x ); -isBoolean = x.greater( "100" ); - -isBoolean = x.greaterOrEquals( 0 ); -isBoolean = x.greaterOrEquals( x ); -isBoolean = x.greaterOrEquals( "100" ); - -isBoolean = x.isEven(); - -isBoolean = x.isNegative(); - -isBoolean = x.isOdd(); - -isBoolean = x.isPositive(); - -isBoolean = x.lesser( 0 ); -isBoolean = x.lesser( x ); -isBoolean = x.lesser( "100" ); - -isBoolean = x.lesserOrEquals( 0 ); -isBoolean = x.lesserOrEquals( x ); -isBoolean = x.lesserOrEquals( "100" ); - -isBigInteger = x.minus( 0 ); -isBigInteger = x.minus( x ); -isBigInteger = x.minus( "100" ); - -isBigInteger = x.mod( 0 ); -isBigInteger = x.mod( x ); -isBigInteger = x.mod( "100" ); - -isBigInteger = x.multiply( 0 ); -isBigInteger = x.multiply( x ); -isBigInteger = x.multiply( "100" ); - -isBigInteger = x.next(); - -isBoolean = x.notEquals( 0 ); -isBoolean = x.notEquals( x ); -isBoolean = x.notEquals( "100" ); - -isBigInteger = x.over( 0 ); -isBigInteger = x.over( x ); -isBigInteger = x.over( "100" ); - -isBigInteger = x.plus( 0 ); -isBigInteger = x.plus( x ); -isBigInteger = x.plus( "100" ); - -isBigInteger = x.pow( 0 ); -isBigInteger = x.pow( x ); -isBigInteger = x.pow( "100" ); - -isBigInteger = x.prev(); - -isBigInteger = x.subtract( 0 ); -isBigInteger = x.subtract( x ); -isBigInteger = x.subtract( "100" ); - -isBigInteger = x.times( 0 ); -isBigInteger = x.times( x ); -isBigInteger = x.times( "100" ); - -isNumber = x.toJSNumber(); - -isString = x.toString(); -isString = x.toString(36); - -isNumber = x.valueOf(); diff --git a/types/big-integer/index.d.ts b/types/big-integer/index.d.ts deleted file mode 100644 index f8ca2b488c..0000000000 --- a/types/big-integer/index.d.ts +++ /dev/null @@ -1,226 +0,0 @@ -// Type definitions for BigInteger.js -// Project: https://github.com/peterolson/BigInteger.js -// Definitions by: Ingo Bürk , Roel van Uden -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface BigInteger { - /** Returns the absolute value of a bigInt. */ - abs(): BigInteger; - - /** Performs addition */ - add( number: number ): BigInteger; - /** Performs addition */ - add( number: BigInteger ): BigInteger; - /** Performs addition */ - add( number: string ): BigInteger; - - /** Alias for the add method. */ - plus( number: number ): BigInteger; - /** Alias for the add method. */ - plus( number: BigInteger ): BigInteger; - /** Alias for the add method. */ - plus( number: string ): BigInteger; - - /** Alias for the subtract method. */ - minus( number: number ): BigInteger; - /** Alias for the subtract method. */ - minus( number: BigInteger ): BigInteger; - /** Alias for the subtract method. */ - minus( number: string ): BigInteger; - - /** Performs subtraction. */ - subtract( number: number ): BigInteger; - /** Performs subtraction. */ - subtract( number: BigInteger ): BigInteger; - /** Performs subtraction. */ - subtract( number: string ): BigInteger; - - /** Performs multiplication. */ - multiply( number: number ): BigInteger; - /** Performs multiplication. */ - multiply( number: BigInteger ): BigInteger; - /** Performs multiplication. */ - multiply( number: string ): BigInteger; - - /** Alias for the multiply method. */ - times( number: number ): BigInteger; - /** Alias for the multiply method. */ - times( number: BigInteger ): BigInteger; - /** Alias for the multiply method. */ - times( number: string ): BigInteger; - - /** Performs integer division, disregarding the remainder. */ - divide( number: number ): BigInteger; - /** Performs integer division, disregarding the remainder. */ - divide( number: BigInteger ): BigInteger; - /** Performs integer division, disregarding the remainder. */ - divide( number: string ): BigInteger; - - /** Alias for the divide method. */ - over( number: number ): BigInteger; - /** Alias for the divide method. */ - over( number: BigInteger ): BigInteger; - /** Alias for the divide method. */ - over( number: string ): BigInteger; - - /** Performs exponentiation. If the exponent is less than 0, pow returns 0. bigInt.zero.pow(0) returns 1. */ - pow( number: number ): BigInteger; - /** Performs exponentiation. If the exponent is less than 0, pow returns 0. bigInt.zero.pow(0) returns 1. */ - pow( number: BigInteger ): BigInteger; - /** Performs exponentiation. If the exponent is less than 0, pow returns 0. bigInt.zero.pow(0) returns 1. */ - pow( number: string ): BigInteger; - - /** Adds one to the number. */ - next(): BigInteger; - - /** Subtracts one from the number. */ - prev(): BigInteger; - - /** Performs division and returns the remainder, disregarding the quotient. The sign of the remainder will match the sign of the dividend. */ - mod( number: number ): BigInteger; - /** Performs division and returns the remainder, disregarding the quotient. The sign of the remainder will match the sign of the dividend. */ - mod( number: BigInteger ): BigInteger; - /** Performs division and returns the remainder, disregarding the quotient. The sign of the remainder will match the sign of the dividend. */ - mod( number: string ): BigInteger; - - /** Performs division and returns an object with two properties: quotient and remainder. The sign of the remainder will match the sign of the dividend. */ - divmod( number: number ): { quotient: BigInteger; remainder: BigInteger }; - /** Performs division and returns an object with two properties: quotient and remainder. The sign of the remainder will match the sign of the dividend. */ - divmod( number: BigInteger ): { quotient: BigInteger; remainder: BigInteger }; - /** Performs division and returns an object with two properties: quotient and remainder. The sign of the remainder will match the sign of the dividend. */ - divmod( number: string ): { quotient: BigInteger; remainder: BigInteger }; - - /** Checks if the first number is greater than the second. */ - greater( number: number ): boolean; - /** Checks if the first number is greater than the second. */ - greater( number: BigInteger ): boolean; - /** Checks if the first number is greater than the second. */ - greater( number: string ): boolean; - - /** Checks if the first number is greater than or equal to the second. */ - greaterOrEquals( number: number ): boolean; - /** Checks if the first number is greater than or equal to the second. */ - greaterOrEquals( number: BigInteger ): boolean; - /** Checks if the first number is greater than or equal to the second. */ - greaterOrEquals( number: string ): boolean; - - /** Checks if the first number is lesser than the second. */ - lesser( number: number ): boolean; - /** Checks if the first number is lesser than the second. */ - lesser( number: BigInteger ): boolean; - /** Checks if the first number is lesser than the second. */ - lesser( number: string ): boolean; - - /** Checks if the first number is less than or equal to the second. */ - lesserOrEquals( number: number ): boolean; - /** Checks if the first number is less than or equal to the second. */ - lesserOrEquals( number: BigInteger ): boolean; - /** Checks if the first number is less than or equal to the second. */ - lesserOrEquals( number: string ): boolean; - - /** Returns true if the number is even, false otherwise. */ - isEven(): boolean; - - /** Returns true if the number is odd, false otherwise. */ - isOdd(): boolean; - - /** Return true if the number is positive, false otherwise. Returns true for 0 and false for -0. */ - isPositive(): boolean; - - /** Returns true if the number is negative, false otherwise. Returns false for 0 and true for -0. */ - isNegative(): boolean; - - /** - * Performs a comparison between two numbers. If the numbers are equal, it returns 0. - * If the first number is greater, it returns 1. If the first number is lesser, it returns -1. - */ - compare( number: number ): number; - /** - * Performs a comparison between two numbers. If the numbers are equal, it returns 0. - * If the first number is greater, it returns 1. If the first number is lesser, it returns -1. - */ - compare( number: BigInteger ): number; - /** - * Performs a comparison between two numbers. If the numbers are equal, it returns 0. - * If the first number is greater, it returns 1. If the first number is lesser, it returns -1. - */ - compare( number: string ): number; - - /** Performs a comparison between the absolute value of two numbers. */ - compareAbs( number: number ): number; - /** Performs a comparison between the absolute value of two numbers. */ - compareAbs( number: BigInteger ): number; - /** Performs a comparison between the absolute value of two numbers. */ - compareAbs( number: string ): number; - - /** Checks if two numbers are equal. */ - equals( number: number ): boolean; - /** Checks if two numbers are equal. */ - equals( number: BigInteger ): boolean; - /** Checks if two numbers are equal. */ - equals( number: string ): boolean; - - /** Checks if two numbers are not equal. */ - notEquals( number: number ): boolean; - /** Checks if two numbers are not equal. */ - notEquals( number: BigInteger ): boolean; - /** Checks if two numbers are not equal. */ - notEquals( number: string ): boolean; - - /** Performs the bitwise AND operation. */ - and( number: number ): BigInteger; - /** Performs the bitwise AND operation. */ - and( number: BigInteger ): BigInteger; - /** Performs the bitwise AND operation. */ - and( number: string ): BigInteger; - - /** Performs the bitwise NOT operation. */ - not(): BigInteger; - - /** Performs the bitwise OR operation. */ - or( number: number ): BigInteger; - /** Performs the bitwise OR operation. */ - or( number: BigInteger ): BigInteger; - /** Performs the bitwise OR operation. */ - or( number: string ): BigInteger; - - /** Performs the bitwise XOR operation. */ - xor( number: number ): BigInteger; - /** Performs the bitwise XOR operation. */ - xor( number: BigInteger ): BigInteger; - /** Performs the bitwise XOR operation. */ - xor( number: string ): BigInteger; - - /** Converts a bigInt into a native Javascript number. Loses precision for numbers outside the range. */ - toJSNumber(): number; - - /** Converts a bigInt to a string. */ - toString( radix?: number ): string; - - /** Converts a bigInt to a native Javascript number. This override allows you to use native arithmetic operators without explicit conversion. */ - valueOf(): number; -} - -interface BigIntegerStatic { - /** Equivalent to bigInt(1) */ - one: BigInteger; - /** Equivalent to bigInt(0) */ - zero: BigInteger; - /** Equivalent to bigInt(-1) */ - minusOne: BigInteger; - - /** Equivalent to bigInt(0) */ - (): BigInteger; - /** Parse a Javascript number into a bigInt */ - ( number: number ): BigInteger; - /** Parse a string into a bigInt */ - ( string: string, base?: string | number | BigInteger): BigInteger; - /** no-op */ - ( bigInt: BigInteger ): BigInteger; -} - -declare var bigInt: BigIntegerStatic; - -declare module "big-integer" { - export = bigInt; -} diff --git a/types/bleno/bleno-tests.ts b/types/bleno/bleno-tests.ts new file mode 100644 index 0000000000..7dcb47ff35 --- /dev/null +++ b/types/bleno/bleno-tests.ts @@ -0,0 +1,56 @@ +import * as Bleno from 'bleno'; + +export class EchoCharacteristic extends Bleno.Characteristic { + _value: any; + _updateValueCallback: any; + + constructor() { + super({ + uuid: 'ec0e', + properties: ['read', 'write', 'notify'], + value: null + }); + this._value = new ArrayBuffer(0); + this._updateValueCallback = null; + } + + onReadRequest(offset: number, callback: any) { + callback(Bleno.Characteristic.RESULT_SUCCESS, this._value); + } + + onWriteRequest(data: any, offset: number, withoutResponse: boolean, callback: any) { + this._value = data; + + if (this._updateValueCallback) { + this._updateValueCallback(this._value); + } + + callback(Bleno.Characteristic.RESULT_SUCCESS); + } + + onSubscribe(maxValueSize: number, updateValueCallback: any) { + this._updateValueCallback = updateValueCallback; + } + + onUnsubscribefunction() { + this._updateValueCallback = null; + } +} + +Bleno.on('stateChange', (state: string) => { + if (state === 'poweredOn') { + Bleno.startAdvertising('echo', ['ec00'], () => {}); + } else { + Bleno.stopAdvertising(() => {}); + } +}); + +let characteristic = new EchoCharacteristic(); +Bleno.on('advertisingStart', (error: string) => { + if (!error) { + Bleno.setServices( + [new Bleno.PrimaryService({uuid: 'ec00', characteristics: [ characteristic ] })], + () => {} + ); + } +}); diff --git a/types/bleno/index.d.ts b/types/bleno/index.d.ts new file mode 100644 index 0000000000..a59e394a84 --- /dev/null +++ b/types/bleno/index.d.ts @@ -0,0 +1,128 @@ +// Type definitions for bleno 0.4 +// Project: https://github.com/sandeepmistry/bleno +// Definitions by: Manuel Francisco Naranjo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export class Characteristic { + uuid: any; + properties: any; + secure: any; + value: any; + descriptors: any; + + constructor(options: any); + + onIndicate(): void; + + onNotify(): void; + + onReadRequest(offset: any, callback: any): void; + + onSubscribe(maxValueSize: any, updateValueCallback: any): void; + + onUnsubscribe(): void; + + onWriteRequest(data: any, offset: any, withoutResponse: any, callback: any): void; + + toString(): any; + + static RESULT_ATTR_NOT_LONG: number; + + static RESULT_INVALID_ATTRIBUTE_LENGTH: number; + + static RESULT_INVALID_OFFSET: number; + + static RESULT_SUCCESS: number; + + static RESULT_UNLIKELY_ERROR: number; +} + +export class Descriptor { + uuid: any; + value: any; + + constructor(options: any); + + toString(): any; +} + +export class PrimaryService { + uuid: any; + characteristics: any; + + constructor(options: any); + + toString(): any; +} + +export const address: string; + +export const domain: any; + +export const mtu: number; + +export const platform: string; + +export const rssi: number; + +export const state: string; + +export function addListener(type: any, listener: any): any; + +export function disconnect(): void; + +export function emit(type: any, ...args: any[]): any; + +export function eventNames(): any; + +export function getMaxListeners(): any; + +export function listenerCount(type: any): any; + +export function listeners(type: any): any; + +export function on(type: any, listener: any): any; + +export function onAccept(clientAddress: any): void; + +export function onAddressChange(address: any): void; + +export function onAdvertisingStart(error: any): void; + +export function onAdvertisingStop(): void; + +export function onDisconnect(clientAddress: any): void; + +export function onMtuChange(mtu: any): void; + +export function onPlatform(platform: any): void; + +export function onRssiUpdate(rssi: any): void; + +export function onServicesSet(error: any): void; + +export function onStateChange(state: any): void; + +export function once(type: any, listener: any): any; + +export function prependListener(type: any, listener: any): any; + +export function prependOnceListener(type: any, listener: any): any; + +export function removeAllListeners(type: any, ...args: any[]): any; + +export function removeListener(type: any, listener: any): any; + +export function setMaxListeners(n: any): any; + +export function setServices(services: any, callback: any): void; + +export function startAdvertising(name: any, serviceUuids: any, callback: any): void; + +export function startAdvertisingIBeacon(uuid: any, major: any, minor: any, measuredPower: any, callback: any): void; + +export function startAdvertisingWithEIRData(advertisementData: any, scanData: any, callback: any): void; + +export function stopAdvertising(callback: any): void; + +export function updateRssi(callback: any): void; diff --git a/types/bleno/tsconfig.json b/types/bleno/tsconfig.json new file mode 100644 index 0000000000..44fa6c893f --- /dev/null +++ b/types/bleno/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bleno-tests.ts" + ] +} diff --git a/types/bleno/tslint.json b/types/bleno/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/types/bleno/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/types/blob-util/blob-util-tests.ts b/types/blob-util/blob-util-tests.ts new file mode 100644 index 0000000000..af860a7ee1 --- /dev/null +++ b/types/blob-util/blob-util-tests.ts @@ -0,0 +1,17 @@ +import * as blobUtil from 'blob-util'; + +const testBlob = new Blob(['abcd']); + +blobUtil.base64StringToBlob('abcd'); // $ExpectType Promise +blobUtil.createObjectURL(testBlob); // $ExpectType string +blobUtil.imgSrcToBlob('test.jpg'); // $ExpectType Promise +blobUtil.createBlob(['abcd']); // $ExpectType Blob +blobUtil.arrayBufferToBlob(new ArrayBuffer(0)); // $ExpectType Promise +blobUtil.binaryStringToBlob('0101'); // $ExpectType Promise +blobUtil.blobToArrayBuffer(testBlob); // $ExpectType Promise +blobUtil.blobToBase64String(testBlob); // $ExpectType Promise +blobUtil.blobToBinaryString(testBlob); // $ExpectType Promise +blobUtil.canvasToBlob(new HTMLCanvasElement()); // $ExpectType Promise +blobUtil.dataURLToBlob('data:abcd'); // $ExpectType Promise +blobUtil.imgSrcToDataURL('test.jpg'); // $ExpectType Promise +blobUtil.revokeObjectURL('blob:example'); // $ExpectType void diff --git a/types/blob-util/index.d.ts b/types/blob-util/index.d.ts new file mode 100644 index 0000000000..ce99c3d893 --- /dev/null +++ b/types/blob-util/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for blob-util 1.2 +// Project: https://github.com/nolanlawson/blob-util#readme +// Definitions by: Max Battcher +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export function createBlob(parts: any[], options?: { type: string }): Blob; +export function createObjectURL(blob: Blob): string; +export function revokeObjectURL(url: string): void; +export function blobToBinaryString(blob: Blob): Promise; +export function binaryStringToBlob(binary: string, type?: string): Promise; +export function blobToBase64String(blob: Blob): Promise; +export function base64StringToBlob(base64: string, type?: string): Promise; +export function dataURLToBlob(dataURL: string): Promise; +export function imgSrcToDataURL(src: string, type?: string, crossOrigin?: string): Promise; +export function canvasToBlob(canvas: HTMLCanvasElement, type?: string): Promise; +export function imgSrcToBlob(src: string, type?: string, crossOrigin?: string): Promise; +export function arrayBufferToBlob(arrayBuff: ArrayBuffer, type?: string): Promise; +export function blobToArrayBuffer(blob: Blob): Promise; diff --git a/types/blob-util/tsconfig.json b/types/blob-util/tsconfig.json new file mode 100644 index 0000000000..f34519775d --- /dev/null +++ b/types/blob-util/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "blob-util-tests.ts" + ] +} diff --git a/types/blob-util/tslint.json b/types/blob-util/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/blob-util/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/bluebird/bluebird-tests.ts b/types/bluebird/bluebird-tests.ts index b9fc8d0cef..c8fab7d57e 100644 --- a/types/bluebird/bluebird-tests.ts +++ b/types/bluebird/bluebird-tests.ts @@ -361,6 +361,22 @@ fooProm = fooProm.catch(CustomError, reason => { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +{ + class CustomError1 extends Error {} + class CustomError2 extends Error {} + class CustomError3 extends Error {} + class CustomError4 extends Error {} + class CustomError5 extends Error {} + + fooProm = fooProm.catch(CustomError1, error => {}); + fooProm = fooProm.catch(CustomError1, CustomError2, error => {}); + fooProm = fooProm.catch(CustomError1, CustomError2, CustomError3, error => {}); + fooProm = fooProm.catch(CustomError1, CustomError2, CustomError3, CustomError4, error => {}); + fooProm = fooProm.catch(CustomError1, CustomError2, CustomError3, CustomError4, CustomError5, error => {}); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + barProm = fooProm.error((reason: any) => { return bar; }); diff --git a/types/bluebird/index.d.ts b/types/bluebird/index.d.ts index cceb0ebc54..5d1d5cfc81 100644 --- a/types/bluebird/index.d.ts +++ b/types/bluebird/index.d.ts @@ -65,24 +65,133 @@ 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( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object, + filter5: (new (...args: any[]) => E5) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3 | E4 | E5) => R | Bluebird.Thenable | void | Bluebird.Thenable, + ): Bluebird; + caught( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object, + filter5: (new (...args: any[]) => E5) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3 | E4 | E5) => R | Bluebird.Thenable | void | Bluebird.Thenable, + ): Bluebird; + catch( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object, + filter5: (new (...args: any[]) => E5) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3 | E4 | E5) => U | Bluebird.Thenable, + ): Bluebird; + caught( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object, + filter5: (new (...args: any[]) => E5) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3 | E4 | E5) => U | 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( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3 | E4) => R | Bluebird.Thenable | void | Bluebird.Thenable, + ): Bluebird; + caught( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3 | E4) => R | Bluebird.Thenable | void | Bluebird.Thenable, + ): Bluebird; + catch( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3 | E4) => U | Bluebird.Thenable, + ): Bluebird; + caught( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3 | E4) => 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( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3) => R | Bluebird.Thenable | void | Bluebird.Thenable, + ): Bluebird; + caught( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3) => R | Bluebird.Thenable | void | Bluebird.Thenable, + ): Bluebird; + catch( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3) => U | Bluebird.Thenable, + ): Bluebird; + caught( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3) => U | 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( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2) => R | Bluebird.Thenable | void | Bluebird.Thenable, + ): Bluebird; + caught( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2) => R | Bluebird.Thenable | void | Bluebird.Thenable, + ): Bluebird; + catch( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2) => U | Bluebird.Thenable, + ): Bluebird; + caught( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2) => 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; + catch( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + onReject: (error: E1) => R | Bluebird.Thenable | void | Bluebird.Thenable, + ): Bluebird; + caught( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + onReject: (error: E1) => R | Bluebird.Thenable | void | Bluebird.Thenable, + ): Bluebird; + catch( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + onReject: (error: E1) => U | Bluebird.Thenable, + ): Bluebird; + caught( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + onReject: (error: E1) => U | Bluebird.Thenable, + ): Bluebird; /** * Like `.catch` but instead of catching all types of exceptions, it only catches those that don't originate from thrown errors but rather from explicit rejections. @@ -116,11 +225,40 @@ declare class Bluebird implements Bluebird.Thenable, Bluebird.Inspection(onReject: (error?: any) => U | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; - tapCatch(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => U | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; - tapCatch(predicate: (error?: any) => boolean, onReject: (error?: any) => U | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; + tapCatch(onReject: (error?: any) => U | Bluebird.Thenable): Bluebird; + tapCatch( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object, + filter5: (new (...args: any[]) => E5) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3 | E4 | E5) => U | Bluebird.Thenable, + ): Bluebird; + tapCatch( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3 | E4) => U | Bluebird.Thenable, + ): Bluebird; + tapCatch( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2 | E3) => U | Bluebird.Thenable, + ): Bluebird; + tapCatch( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + onReject: (error: E1 | E2) => U | Bluebird.Thenable, + ): Bluebird; + tapCatch( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + onReject: (error: E1) => U | Bluebird.Thenable, + ): Bluebird; /** * Same as calling `Promise.delay(ms, this)`. @@ -228,8 +366,8 @@ declare class Bluebird implements Bluebird.Thenable, Bluebird.Inspection; - thenReturn(): Bluebird; + return(): Bluebird; + thenReturn(): Bluebird; return(value: U): Bluebird; thenReturn(value: U): Bluebird; @@ -258,11 +396,40 @@ declare class Bluebird implements Bluebird.Thenable, Bluebird.Inspection * * in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.catchReturn()` + * TODO: disallow non-objects */ catchReturn(value: U): Bluebird; - catchReturn(predicate: (error: any) => boolean, value: U): Bluebird; - catchReturn(ErrorClass: new (...args: any[]) => E, value: U): Bluebird; - catchReturn(predicate: Object, value: U): Bluebird; + + catchReturn( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object, + filter5: (new (...args: any[]) => E5) | ((error: any) => boolean) | Object, + value: U, + ): Bluebird; + catchReturn( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object, + value: U, + ): Bluebird; + catchReturn( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + value: U, + ): Bluebird; + catchReturn( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + value: U, + ): Bluebird; + catchReturn( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + value: U, + ): Bluebird; /** * Convenience method for: @@ -273,11 +440,40 @@ declare class Bluebird implements Bluebird.Thenable, Bluebird.Inspection * Same limitations apply as with `.catchReturn()`. + * TODO: disallow non-objects */ catchThrow(reason: Error): Bluebird; - catchThrow(predicate: (error: any) => boolean, reason: Error): Bluebird; - catchThrow(ErrorClass: new (...args: any[]) => E, reason: Error): Bluebird; - catchThrow(predicate: Object, reason: Error): Bluebird; + + catchThrow( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object, + filter5: (new (...args: any[]) => E5) | ((error: any) => boolean) | Object, + reason: Error, + ): Bluebird; + catchThrow( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object, + reason: Error, + ): Bluebird; + catchThrow( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object, + reason: Error, + ): Bluebird; + catchThrow( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object, + reason: Error, + ): Bluebird; + catchThrow( + filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object, + reason: Error, + ): Bluebird; /** * Convert to String. diff --git a/types/bonjour/bonjour-tests.ts b/types/bonjour/bonjour-tests.ts index 1ae8a218fe..61e7373f01 100644 --- a/types/bonjour/bonjour-tests.ts +++ b/types/bonjour/bonjour-tests.ts @@ -1,20 +1,23 @@ import * as bonjour from 'bonjour'; -var bonjourOptions: bonjour.BonjourOptions; -var bonjourInstance: bonjour.Bonjour; +let bonjourOptions: bonjour.BonjourOptions; +let bonjourInstance: bonjour.Bonjour; -var serviceOptions: bonjour.ServiceOptions; -var service: bonjour.Service; +let serviceOptions: bonjour.ServiceOptions; +let service: bonjour.Service; -var browserOptions: bonjour.BrowserOptions; -var browser: bonjour.Browser; +let browserOptions: bonjour.BrowserOptions; +let browser: bonjour.Browser; -bonjourOptions = { interface: '192.168.1.1', port: 5353 }; -bonjourInstance = new bonjour.Bonjour(bonjourOptions); +bonjourOptions = {}; +bonjourInstance = bonjour(bonjourOptions); -serviceOptions = { name: 'My Web Server', type: 'http', port: 3000 }; +// Publish a dummy server under name 'My Website' type http port 3000 +serviceOptions = { name: 'My Website', type: 'http', port: 3000 }; service = bonjourInstance.publish(serviceOptions); browserOptions = { protocol: 'tcp', type: 'http' }; -browser = bonjour.find(browserOptions); - +// Look for the server +browser = bonjourInstance.findOne(browserOptions, (srv: bonjour.Service) => { + // You can test here if the found server (srv) name is 'My Website' +}); diff --git a/types/bonjour/index.d.ts b/types/bonjour/index.d.ts index 0eb5b584c0..0c2578121e 100644 --- a/types/bonjour/index.d.ts +++ b/types/bonjour/index.d.ts @@ -1,68 +1,83 @@ -// Type definitions for bonjour v3.5.0 +// Type definitions for bonjour 3.5 // Project: https://github.com/watson/bonjour -// Definitions by: Quentin Lampin +// Definitions by: Quentin Lampin , Nicolas Voigt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export interface BonjourOptions { - multicast?: boolean; - interface?: string; - port?: number; - ip?: string; - ttl?: number; - loopback?: boolean; - reuseAddr?: boolean; +/// + +declare function bonjour(opts?: bonjour.BonjourOptions): bonjour.Bonjour; +export = bonjour; +declare namespace bonjour { + /** + * Start a browser + * + * The browser listens for services by querying for PTR records of a given + * type, protocol and domain, e.g. _http._tcp.local. + * + * If no type is given, a wild card search is performed. + * + * An internal list of online services is kept which starts out empty. When + * ever a new service is discovered, it's added to the list and an "up" event + * is emitted with that service. When it's discovered that the service is no + * longer available, it is removed from the list and a "down" event is emitted + * with that service. + */ + interface Browser extends NodeJS.EventEmitter { + services: Service[]; + start(): void; + update(): void; + stop(): void; + on(event: 'up' | 'down', listener: (service: Service) => void): this; + once(event: 'up' | 'down', listener: (service: Service) => void): this; + removeListener(event: 'up' | 'down', listener: (service: Service) => void): this; + removeAllListeners(event: 'up' | 'down'): this; + } + interface BrowserOptions { + type?: string; + subtypes?: string[]; + protocol?: string; + txt?: Object; + } + + interface ServiceOptions { + name: string; + host?: string; + port: number; + type: string; + subtypes?: string[]; + protocol?: 'udp'|'tcp'; + txt?: Object; + } + + interface Service extends NodeJS.EventEmitter { + name: string; + type: string; + subtypes: string[]; + protocol: string; + host: string; + port: number; + fqdn: string; + txt: Object; + published: boolean; + + stop(cb: () => any): void; + start(): void; + } + interface BonjourOptions { + multicast?: boolean; + interface?: string; + port?: number; + ip?: string; + ttl?: number; + loopback?: boolean; + reuseAddr?: boolean; + } + interface Bonjour { + (opts?: BonjourOptions): Bonjour; + publish(options: ServiceOptions): Service; + unpublishAll(cb?: () => void): void; + find(options: BrowserOptions, onUp?: (service: Service) => void): Browser; + findOne(options: BrowserOptions, cb?: (service: Service) => void): Browser; + destroy(): void; + } } - -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/types/bonjour/tslint.json b/types/bonjour/tslint.json new file mode 100644 index 0000000000..a62d0d4e68 --- /dev/null +++ b/types/bonjour/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "ban-types": false + } +} diff --git a/types/bookshelf/bookshelf-tests.ts b/types/bookshelf/bookshelf-tests.ts index 61718a4274..f42a1bf784 100644 --- a/types/bookshelf/bookshelf-tests.ts +++ b/types/bookshelf/bookshelf-tests.ts @@ -481,6 +481,15 @@ new Book({'ISBN-13': '9780440180296'}) /* model.fetchAll(), see http://bookshelfjs.org/#Model-instance-fetchAll */ +{ + (new User).fetchAll({ + columns: ['id', 'name'], + withRelated: ['posts.tags'] + }).then((user: any) => { + console.log(user); + }) +} + /* model.format(), see http://bookshelfjs.org/#Model-instance-format */ /* model.get(), see http://bookshelfjs.org/#Model-instance-get */ @@ -637,6 +646,16 @@ customer.on('fetching', (model, columns) => { /* model.once(), see http://bookshelfjs.org/#Model-instance-once */ +/* model.orderBy(), see http://bookshelfjs.org/#Model-instance-orderBy */ +{ + (new User) + .orderBy('name', 'ASC') + .fetchAll() + .then((users: Bookshelf.Collection) => { + console.log(users) + }); +} + /* model.parse(), see http://bookshelfjs.org/#Model-instance-parse */ // Example of a "parse" to convert snake_case to camelCase, using `underscore.string` @@ -1096,6 +1115,16 @@ ships.on('fetched', (collection, response) => { /* collection.once(), see http://bookshelfjs.org/#Collection-instance-once */ +/* collection.orderBy(), see http://bookshelfjs.org/#Collection-instance-orderBy */ +{ + User.collection() + .orderBy('-name') + .fetch() + .then((users: Bookshelf.Collection) => { + console.log(users); + }) +} + /* collection.parse(), see http://bookshelfjs.org/#Collection-instance-parse */ /* collection.pluck(), see http://bookshelfjs.org/#Collection-instance-pluck */ @@ -1376,4 +1405,4 @@ new User({name: 'John'}).fetchAll({require: true}) new Country({id: 1}).capital().fetch().then(model => { // ... }); -} \ No newline at end of file +} diff --git a/types/bookshelf/index.d.ts b/types/bookshelf/index.d.ts index 398534806d..a7c0a90536 100644 --- a/types/bookshelf/index.d.ts +++ b/types/bookshelf/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for bookshelfjs v0.8.2 +// Type definitions for bookshelfjs v0.9.3 // Project: http://bookshelfjs.org/ -// Definitions by: Andrew Schurman +// Definitions by: Andrew Schurman , Vesa Poikajärvi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -23,6 +23,8 @@ interface Bookshelf extends Bookshelf.Events { declare function Bookshelf(knex: knex): Bookshelf; declare namespace Bookshelf { + type SortOrder = 'ASC'|'asc'|'DESC'|'desc'; + abstract class Events { on(event?: string, callback?: EventFunction, context?: any): void; off(event?: string): void; @@ -38,7 +40,8 @@ declare namespace Bookshelf { tableName?: string; } - abstract class ModelBase> extends Events> implements IModelBase { + interface ModelBase> extends IModelBase { } + abstract class ModelBase> extends Events> { /** If overriding, must use a getter instead of a plain property. */ idAttribute: string; @@ -105,6 +108,7 @@ declare namespace Bookshelf { morphOne>(target: { new (...args: any[]): R }, name?: string, columnNames?: string[], morphValue?: string): R; morphTo(name: string, columnNames?: string[], ...target: typeof Model[]): T; morphTo(name: string, ...target: typeof Model[]): T; + orderBy(column: string, order?: SortOrder): T; // Declaration order matters otherwise TypeScript gets confused between query() and query(...query: string[]) query(): Knex.QueryBuilder; @@ -242,6 +246,7 @@ declare namespace Bookshelf { detach(options?: SyncOptions): BlueBird; fetchOne(options?: CollectionFetchOneOptions): BlueBird; load(relations: string | string[], options?: SyncOptions): BlueBird>; + orderBy(column: string, order?: SortOrder): T; // Declaration order matters otherwise TypeScript gets confused between query() and query(...query: string[]) query(): Knex.QueryBuilder; @@ -278,8 +283,7 @@ declare namespace Bookshelf { [index: string]: (query: Knex.QueryBuilder) => Knex.QueryBuilder; } - interface FetchAllOptions extends SyncOptions { - require?: boolean; + interface FetchAllOptions extends FetchOptions { } interface SaveOptions extends SyncOptions { diff --git a/types/boom/boom-tests.ts b/types/boom/boom-tests.ts index e31e376dde..38dc39058f 100644 --- a/types/boom/boom-tests.ts +++ b/types/boom/boom-tests.ts @@ -1,44 +1,154 @@ - import Boom = require('boom'); +import * as Hapi from 'hapi'; -var bo = Boom.wrap(new Error('test'), 400, 'some message'); -var a: string = bo.output.headers['some header']; +// 4xx and data type -Boom.create(500, 'Internal server error', { timestamp: Date.now() }); +const badRequestError = Boom.badRequest('message', {some: 'data'}); +badRequestError.data.some; +const badRequestError2: Boom.BoomError = Boom.badImplementation('message'); -Boom.badRequest('message', {some: 'data'}); -Boom.unauthorized('message', 'scheme', {some: 'data'}); -Boom.unauthorized(null, 'scheme', 'data'); -Boom.paymentRequired('message', {some: 'data'}); -Boom.forbidden('message', {some: 'data'}); -Boom.notFound('message', {some: 'data'}); -Boom.methodNotAllowed('message', {some: 'data'}); -Boom.notAcceptable('message', {some: 'data'}); -Boom.proxyAuthRequired('message', {some: 'data'}); -Boom.clientTimeout('message', {some: 'data'}); -Boom.conflict('message', {some: 'data'}); -Boom.resourceGone('message', {some: 'data'}); -Boom.lengthRequired('message', {some: 'data'}); -Boom.preconditionFailed('message', {some: 'data'}); -Boom.entityTooLarge('message', {some: 'data'}); -Boom.uriTooLong('message', {some: 'data'}); -Boom.unsupportedMediaType('message', {some: 'data'}); -Boom.rangeNotSatisfiable('message', {some: 'data'}); -Boom.expectationFailed('message', {some: 'data'}); -Boom.teapot('message', {some: 'data'}); -Boom.badData('message', {some: 'data'}); -Boom.locked('message', {some: 'data'}); -Boom.preconditionRequired('message', {some: 'data'}); -Boom.tooManyRequests('message', {some: 'data'}); -Boom.illegal('message', {some: 'data'}); +const unauthorizedError1 = Boom.unauthorized('message', 'scheme', {some: 'attribute'}); +unauthorizedError1.output.payload.attributes === { some: 'attribute', error: 'message' }; +unauthorizedError1.output.headers === { 'WWW-Authenticate': 'scheme some="attribute", error="message"' }; -Boom.badImplementation('message', {some: 'data'}); -Boom.notImplemented('message', {some: 'data'}); -Boom.badGateway('message', {some: 'data'}); -Boom.serverUnavailable('message', {some: 'data'}); -Boom.gatewayTimeout('message', {some: 'data'}); +const unauthorizedError2 = Boom.unauthorized('message', ['scheme']); +unauthorizedError2.output.payload.attributes === undefined; +unauthorizedError2.output.headers === { 'WWW-Authenticate': 'scheme' }; -Boom.unauthorized() as Error; +const unauthorizedError3 = Boom.unauthorized(null, 'scheme', 'attribute'); +unauthorizedError3.output.payload.attributes === 'attribute'; +unauthorizedError3.output.headers === { 'WWW-Authenticate': 'scheme attribute' }; + +const unauthorizedError4 = Boom.unauthorized(null, 'scheme', {some: 'attribute'}); +unauthorizedError4.output.payload.attributes === { some: 'attribute' }; +unauthorizedError4.output.headers === { 'WWW-Authenticate': 'scheme some="attribute"' }; + +const paymentRequiredError = Boom.paymentRequired('message', {some: 'data'}); +paymentRequiredError.data.some; +const paymentRequiredError2: Boom.BoomError = Boom.paymentRequired('message'); + +const forbiddenError = Boom.forbidden('message', {some: 'data'}); +forbiddenError.data.some; +const forbiddenError2: Boom.BoomError = Boom.forbidden('message'); + +const notFoundError = Boom.notFound('message', {some: 'data'}); +notFoundError.data.some; +const notFoundError2: Boom.BoomError = Boom.notFound('message'); + +const methodNotAllowedError = Boom.methodNotAllowed('message', {some: 'data'}); +methodNotAllowedError.data.some; +const methodNotAllowedError2: Boom.BoomError = Boom.methodNotAllowed('message'); + +const notAcceptableError = Boom.notAcceptable('message', {some: 'data'}); +notAcceptableError.data.some; +const notAcceptableError2: Boom.BoomError = Boom.notAcceptable('message'); + +const proxyAuthRequiredError = Boom.proxyAuthRequired('message', {some: 'data'}); +proxyAuthRequiredError.data.some; +const proxyAuthRequiredError2: Boom.BoomError = Boom.proxyAuthRequired('message'); + +const clientTimeoutError = Boom.clientTimeout('message', {some: 'data'}); +clientTimeoutError.data.some; +const clientTimeoutError2: Boom.BoomError = Boom.clientTimeout('message'); + +const conflictError = Boom.conflict('message', {some: 'data'}); +conflictError.data.some; + +const resourceGoneError = Boom.resourceGone('message', {some: 'data'}); +resourceGoneError.data.some; +const resourceGoneError2: Boom.BoomError = Boom.resourceGone('message'); + +const lengthRequiredError = Boom.lengthRequired('message', {some: 'data'}); +lengthRequiredError.data.some; +const lengthRequiredError2: Boom.BoomError = Boom.lengthRequired('message'); + +const preconditionFailedError = Boom.preconditionFailed('message', {some: 'data'}); +preconditionFailedError.data.some; +const preconditionFailedError2: Boom.BoomError = Boom.preconditionFailed('message'); + +const entityTooLargeError = Boom.entityTooLarge('message', {some: 'data'}); +entityTooLargeError.data.some; +const entityTooLargeError2: Boom.BoomError = Boom.lengthRequired('message'); + +const uriTooLongError = Boom.uriTooLong('message', {some: 'data'}); +uriTooLongError.data.some; +const uriTooLongError2: Boom.BoomError = Boom.uriTooLong('message'); + +const unsupportedMediaTypeError = Boom.unsupportedMediaType('message', {some: 'data'}); +unsupportedMediaTypeError.data.some; +const unsupportedMediaTypeError2: Boom.BoomError = Boom.unsupportedMediaType('message'); + +const rangeNotSatisfiableError = Boom.rangeNotSatisfiable('message', {some: 'data'}); +rangeNotSatisfiableError.data.some; +const rangeNotSatisfiableError2: Boom.BoomError = Boom.rangeNotSatisfiable('message'); + +const expectationFailedError = Boom.expectationFailed('message', {some: 'data'}); +expectationFailedError.data.some; +const expectationFailedError2: Boom.BoomError = Boom.expectationFailed('message'); + +const teapotError = Boom.teapot('message', {some: 'data'}); +teapotError.data.some; +const teapotError2: Boom.BoomError = Boom.teapot('message'); + +const badDataError = Boom.badData('message', {some: 'data'}); +badDataError.data.some; +const badDataError2: Boom.BoomError = Boom.badData('message'); + +const lockedError = Boom.locked('message', {some: 'data'}); +lockedError.data.some; +const lockedError2: Boom.BoomError = Boom.locked('message'); + +const preconditionRequiredError = Boom.preconditionRequired('message', {some: 'data'}); +preconditionRequiredError.data.some; +const preconditionRequiredError2: Boom.BoomError = Boom.preconditionRequired('message'); + +const tooManyRequestsError = Boom.tooManyRequests('message', {some: 'data'}); +tooManyRequestsError.data.some; +const tooManyRequestsError2: Boom.BoomError = Boom.tooManyRequests('message'); + +const illegalError = Boom.illegal('message', {some: 'data'}); +illegalError.data.some; +const illegalError2: Boom.BoomError = Boom.illegal('message'); + +// 5xx and data type + +const badImplementationError = Boom.badImplementation('message', {some: 'data'}); +badImplementationError.data.some; +const badImplementationError2: Boom.BoomError = Boom.badImplementation('message'); + +const internalError = Boom.internal('message', {some: 'data'}); +internalError.data.some; +const internalError2: Boom.BoomError = Boom.internal('message'); + +const notImplementedError = Boom.notImplemented('message', {some: 'data'}); +notImplementedError.data.some; +const notImplementedError2: Boom.BoomError = Boom.notImplemented('message'); + +const badGatewayError = Boom.badGateway('message', {some: 'data'}); +badGatewayError.data.some; +const badGatewayError2: Boom.BoomError = Boom.badGateway('message'); + +const serverUnavailableError = Boom.serverUnavailable('message', {some: 'data'}); +serverUnavailableError.data.some; +const serverUnavailableError2: Boom.BoomError = Boom.serverUnavailable('message'); + +const gatewayTimeoutError = Boom.gatewayTimeout('message', {some: 'data'}); +gatewayTimeoutError.data.some; +const gatewayTimeoutError2: Boom.BoomError = Boom.gatewayTimeout('message'); + +// wrap and create + +const wrappedError = Boom.wrap(new Error('test'), 400, 'some message'); + +const error1 = Boom.create(500, 'Internal server error', { timestamp: Date.now() }); +error1.data.timestamp; +const error2: Boom.BoomError = Boom.create(500, 'Internal server error'); + +// type widen asserting + +const unauthorizedError = Boom.unauthorized() as Error; + +// status code and reformat const error = Boom.badRequest('Cannot feed after midnight'); error.output.statusCode = 499; // Assign a custom error code @@ -53,3 +163,30 @@ interface CustomPayload extends Boom.Payload { } (error.output.payload as CustomPayload).custom = 'abc_123'; + +/** + * Test assignment of custom error data: + */ +const errorWithData = Boom.badImplementation('', { custom1: 'test', customType: 'Custom1', isCustom: true } as CustomData1); +const errorWithNoExplicitDataType: Boom.BoomError = errorWithData; // can assign to error without explicit data type +const errorWithExplicitType: Boom.BoomError = errorWithData; // can assign to union data type +const errorWithConcreteCustomData: Boom.BoomError = errorWithData; // can assign to concrete data type +// assignment to CustomData2 would not be possible +// const errorWithConcreteCustomData2: Boom.BoomError = errorWithData; + +// Some complex error data types for testing purposes: +interface CustomDataBase { + isCustom: true; +} + +interface CustomData1 extends CustomDataBase { + customType: 'Custom1'; + custom1: string; +} + +interface CustomData2 extends CustomDataBase { + customType: 'Custom2'; + custom2: string; +} + +type CustomData = CustomData1 | CustomData2; diff --git a/types/boom/index.d.ts b/types/boom/index.d.ts index bb2f5e4bc0..b8f41a85be 100644 --- a/types/boom/index.d.ts +++ b/types/boom/index.d.ts @@ -2,8 +2,7 @@ // Project: http://github.com/hapijs/boom // Definitions by: Igor Rogatty , AJP // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// +// TypeScript Version: 2.3 export = Boom; @@ -13,7 +12,7 @@ declare namespace Boom { * boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: * @see {@link https://github.com/hapijs/boom#boom} */ - export interface BoomError extends Error { + export interface BoomError extends Error { /** isBoom - if true, indicates this is a Boom object instance. */ isBoom: boolean; /** isServer - convenience bool indicating status code >= 500. */ @@ -26,6 +25,8 @@ declare namespace Boom { reformat: () => string; /** "If message is unset, the 'error' segment of the header will not be present and isMissing will be true on the error object." mentioned in @see {@link https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes} */ isMissing?: boolean; + /** https://github.com/hapijs/boom#createstatuscode-message-data and https://github.com/hapijs/boom/blob/v4.3.0/lib/index.js#L99 */ + data: Data; } export interface Output { @@ -36,6 +37,7 @@ declare namespace Boom { /** payload - the formatted object used as the response payload (stringified). Can be directly manipulated but any changes will be lost if reformat() is called. Any content allowed and by default includes the following content: */ payload: Payload; } + export interface Payload { /** statusCode - the HTTP status code, derived from error.output.statusCode. */ statusCode: number; @@ -43,6 +45,11 @@ declare namespace Boom { error: string; /** message - the error message derived from error.message. */ message: string; + /** + * "Every key/value pair will be included ... in the response payload under the attributes key." + * [see docs](https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes) + */ + attributes?: any; // Excluded this to aid typing of the other values. See tests for example casting to a custom interface to manipulate the payload // [anyContent: string]: any; } @@ -54,7 +61,7 @@ declare namespace Boom { * @param message optional message string. If the error already has a message, it adds the message as a prefix. Defaults to no message. * @see {@link https://github.com/hapijs/boom#wraperror-statuscode-message} */ - export function wrap(error: Error, statusCode?: number, message?: string): BoomError; + export function wrap(error: Error, statusCode?: number, message?: string): BoomError; /** * Generates an Error object with the boom decorations @@ -63,7 +70,7 @@ declare namespace Boom { * @param data additional error data set to error.data property. * @see {@link https://github.com/hapijs/boom#createstatuscode-message-data} */ - export function create(statusCode: number, message?: string, data?: any): BoomError; + export function create(statusCode: number, message?: string, data?: Data): BoomError; // 4xx /** @@ -72,7 +79,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boombadrequestmessage-data} */ - export function badRequest(message?: string, data?: any): BoomError; + export function badRequest(message?: string, data?: Data): BoomError; /** * Returns a 401 Unauthorized error @@ -83,8 +90,10 @@ declare namespace Boom { * @param attributes an object of values to use while setting the 'WWW-Authenticate' header. This value is only used when scheme is a string, otherwise it is ignored. Every key/value pair will be included in the 'WWW-Authenticate' in the format of 'key="value"' as well as in the response payload under the attributes key. Alternatively value can be a string which is use to set the value of the scheme, for example setting the token value for negotiate header. If string is used message parameter must be null. null and undefined will be replaced with an empty string. If attributes is set, message will be used as the 'error' segment of the 'WWW-Authenticate' header. If message is unset, the 'error' segment of the header will not be present and isMissing will be true on the error object. * @see {@link https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes} */ - export function unauthorized(message?: string, scheme?: string | string[], attributes?: {[index: string]: string}): BoomError; - export function unauthorized(message?: null, scheme?: string | string[], attributes?: string): BoomError; + export function unauthorized(message?: string, scheme?: string, attributes?: {[index: string]: string}): BoomError; + export function unauthorized(message?: string, scheme?: string[]): BoomError; + export function unauthorized(message?: null, scheme?: string, attributes?: {[index: string]: string} | string): BoomError; + export function unauthorized(message?: null, scheme?: string[]): BoomError; /** * Returns a 402 Payment Required error @@ -92,7 +101,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boompaymentrequiredmessage-data} */ - export function paymentRequired(message?: string, data?: any): BoomError; + export function paymentRequired(message?: string, data?: Data): BoomError; /** * Returns a 403 Forbidden error @@ -100,7 +109,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomforbiddenmessage-data} */ - export function forbidden(message?: string, data?: any): BoomError; + export function forbidden(message?: string, data?: Data): BoomError; /** * Returns a 404 Not Found error @@ -108,7 +117,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomnotfoundmessage-data} */ - export function notFound(message?: string, data?: any): BoomError; + export function notFound(message?: string, data?: Data): BoomError; /** * Returns a 405 Method Not Allowed error @@ -117,7 +126,7 @@ declare namespace Boom { * @param allow optional string or array of strings (to be combined and separated by ', ') which is set to the 'Allow' header. * @see {@link https://github.com/hapijs/boom#boommethodnotallowedmessage-data-allow} */ - export function methodNotAllowed(message?: string, data?: any, allow?: string | string[]): BoomError; + export function methodNotAllowed(message?: string, data?: Data, allow?: string | string[]): BoomError; /** * Returns a 406 Not Acceptable error @@ -125,7 +134,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomnotacceptablemessage-data} */ - export function notAcceptable(message?: string, data?: any): BoomError; + export function notAcceptable(message?: string, data?: Data): BoomError; /** * Returns a 407 Proxy Authentication Required error @@ -133,7 +142,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomproxyauthrequiredmessage-data} */ - export function proxyAuthRequired(message?: string, data?: any): BoomError; + export function proxyAuthRequired(message?: string, data?: Data): BoomError; /** * Returns a 408 Request Time-out error @@ -141,7 +150,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomclienttimeoutmessage-data} */ - export function clientTimeout(message?: string, data?: any): BoomError; + export function clientTimeout(message?: string, data?: Data): BoomError; /** * Returns a 409 Conflict error @@ -149,7 +158,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomconflictmessage-data} */ - export function conflict(message?: string, data?: any): BoomError; + export function conflict(message?: string, data?: Data): BoomError; /** * Returns a 410 Gone error @@ -157,7 +166,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomresourcegonemessage-data} */ - export function resourceGone(message?: string, data?: any): BoomError; + export function resourceGone(message?: string, data?: Data): BoomError; /** * Returns a 411 Length Required error @@ -165,7 +174,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomlengthrequiredmessage-data} */ - export function lengthRequired(message?: string, data?: any): BoomError; + export function lengthRequired(message?: string, data?: Data): BoomError; /** * Returns a 412 Precondition Failed error @@ -173,7 +182,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boompreconditionfailedmessage-data} */ - export function preconditionFailed(message?: string, data?: any): BoomError; + export function preconditionFailed(message?: string, data?: Data): BoomError; /** * Returns a 413 Request Entity Too Large error @@ -181,7 +190,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomentitytoolargemessage-data} */ - export function entityTooLarge(message?: string, data?: any): BoomError; + export function entityTooLarge(message?: string, data?: Data): BoomError; /** * Returns a 414 Request-URI Too Large error @@ -189,7 +198,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomuritoolongmessage-data} */ - export function uriTooLong(message?: string, data?: any): BoomError; + export function uriTooLong(message?: string, data?: Data): BoomError; /** * Returns a 415 Unsupported Media Type error @@ -197,7 +206,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomunsupportedmediatypemessage-data} */ - export function unsupportedMediaType(message?: string, data?: any): BoomError; + export function unsupportedMediaType(message?: string, data?: Data): BoomError; /** * Returns a 416 Requested Range Not Satisfiable error @@ -205,7 +214,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomrangenotsatisfiablemessage-data} */ - export function rangeNotSatisfiable(message?: string, data?: any): BoomError; + export function rangeNotSatisfiable(message?: string, data?: Data): BoomError; /** * Returns a 417 Expectation Failed error @@ -213,7 +222,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomexpectationfailedmessage-data} */ - export function expectationFailed(message?: string, data?: any): BoomError; + export function expectationFailed(message?: string, data?: Data): BoomError; /** * Returns a 418 I'm a Teapot error @@ -221,7 +230,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomteapotmessage-data} */ - export function teapot(message?: string, data?: any): BoomError; + export function teapot(message?: string, data?: Data): BoomError; /** * Returns a 422 Unprocessable Entity error @@ -229,7 +238,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boombaddatamessage-data} */ - export function badData(message?: string, data?: any): BoomError; + export function badData(message?: string, data?: Data): BoomError; /** * Returns a 423 Locked error @@ -237,7 +246,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomlockedmessage-data} */ - export function locked(message?: string, data?: any): BoomError; + export function locked(message?: string, data?: Data): BoomError; /** * Returns a 428 Precondition Required error @@ -245,7 +254,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boompreconditionrequiredmessage-data} */ - export function preconditionRequired(message?: string, data?: any): BoomError; + export function preconditionRequired(message?: string, data?: Data): BoomError; /** * Returns a 429 Too Many Requests error @@ -253,7 +262,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomtoomanyrequestsmessage-data} */ - export function tooManyRequests(message?: string, data?: any): BoomError; + export function tooManyRequests(message?: string, data?: Data): BoomError; /** * Returns a 451 Unavailable For Legal Reasons error @@ -261,7 +270,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomillegalmessage-data} */ - export function illegal(message?: string, data?: any): BoomError; + export function illegal(message?: string, data?: Data): BoomError; // 5xx /** @@ -271,7 +280,16 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boombadimplementationmessage-data---alias-internal} */ - export function badImplementation(message?: string, data?: any): BoomError; + export function badImplementation(message?: string, data?: Data): BoomError; + + /** + * Returns a 500 Internal Server Error error + * Only 500 errors will hide your message from the end user. Your message is recorded in the server log. + * @param message optional message. + * @param data optional additional error data. + * @see {@link https://github.com/hapijs/boom#boombadimplementationmessage-data---alias-internal} + */ + export function internal(message?: string, data?: Data): BoomError; /** * Returns a 501 Not Implemented error with your error message to the user @@ -279,7 +297,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomnotimplementedmessage-data} */ - export function notImplemented(message?: string, data?: any): BoomError; + export function notImplemented(message?: string, data?: Data): BoomError; /** * Returns a 502 Bad Gateway error with your error message to the user @@ -287,7 +305,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boombadgatewaymessage-data} */ - export function badGateway(message?: string, data?: any): BoomError; + export function badGateway(message?: string, data?: Data): BoomError; /** * Returns a 503 Service Unavailable error with your error message to the user @@ -295,7 +313,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomserverunavailablemessage-data} */ - export function serverUnavailable(message?: string, data?: any): BoomError; + export function serverUnavailable(message?: string, data?: Data): BoomError; /** * Returns a 504 Gateway Time-out error with your error message to the user @@ -303,5 +321,5 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomgatewaytimeoutmessage-data} */ - export function gatewayTimeout(message?: string, data?: any): BoomError; + export function gatewayTimeout(message?: string, data?: Data): BoomError; } diff --git a/types/boom/tsconfig.json b/types/boom/tsconfig.json index d64d51130b..c3bee46396 100644 --- a/types/boom/tsconfig.json +++ b/types/boom/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/bootstrap-datepicker/index.d.ts b/types/bootstrap-datepicker/index.d.ts index 5a6e80f72e..61da347f24 100644 --- a/types/bootstrap-datepicker/index.d.ts +++ b/types/bootstrap-datepicker/index.d.ts @@ -17,25 +17,28 @@ interface DatepickerOptions { format?: string | DatepickerCustomFormatOptions; weekStart?: number; - startDate?: any; - endDate?: any; + startDate?: Date|string; + endDate?: Date|string; autoclose?: boolean; startView?: number; - todayBtn?: any; + todayBtn?: boolean|"linked"; todayHighlight?: boolean; keyboardNavigation?: boolean; language?: string; - beforeShowDay?: (date: any) => any; + beforeShowDay?: (date: Date) => undefined|string|boolean|DatepickerBeforeShowDayResponse; + beforeShowYear?: (date: Date) => undefined|string|boolean|DatepickerBeforeShowResponse; + beforeShowDecade?: (date: Date) => undefined|string|boolean|DatepickerBeforeShowResponse; + beforeShowCentury?: (date: Date) => undefined|string|boolean|DatepickerBeforeShowResponse; calendarWeeks?: boolean; clearBtn?: boolean; daysOfWeekDisabled?: number[]; forceParse?: boolean; inputs?: any[]; - minViewMode?: any; - multidate?: any; + minViewMode?: 0|"days"|1|"months"|2|"years"|3|"decades"|4|"centuries"|"millenium"; + multidate?: boolean|number; multidateSeparator?: string; - orientation?: string; - assumeNearbyYear?: any; + orientation?: "auto"|"left top"|"left bottom"|"right top"|"right bottom"; + assumeNearbyYear?: boolean|number; viewMode?: string; templates?: any; zIndexOffset?: number; @@ -43,6 +46,28 @@ interface DatepickerOptions { immediateUpdates?: boolean; title?: string; container?: string; + datesDisabled?:string|string[]; + daysOfWeekHighlighted?:string|number[]; + defaultViewDate?:Date|string|DatepickerViewDate; + updateViewDate?:boolean; +} + +interface DatepickerViewDate { + year:number; + /** Month starting with 0 */ + month:number; + /** Day of the month starting with 1 */ + day:number; +} + +interface DatepickerBeforeShowResponse { + enabled?:boolean; + classes?: string; + tooltip?: string; +} + +interface DatepickerBeforeShowDayResponse extends DatepickerBeforeShowResponse { + content?: string; } interface DatepickerCustomFormatOptions { @@ -52,7 +77,10 @@ interface DatepickerCustomFormatOptions { interface DatepickerEventObject extends JQueryEventObject { date: Date; + dates: Date[]; + format(ix?:number): string; format(format?: string): string; + format(ix?:number, format?: string): string; } interface JQuery { diff --git a/types/bootstrap.v3.datetimepicker/index.d.ts b/types/bootstrap.v3.datetimepicker/index.d.ts index 4686aa9680..f37a42b67d 100644 --- a/types/bootstrap.v3.datetimepicker/index.d.ts +++ b/types/bootstrap.v3.datetimepicker/index.d.ts @@ -337,16 +337,16 @@ export interface DatetimepickerOptions { /** Shows the week of the year to the left of first day of the week. * @default: false */ - calendarWeeks?: boolean; + calendarWeeks?: boolean; /** Using a Bootstraps collapse to switch between date/time pickers. * @default: true */ - collapse?: boolean; + collapse?: boolean; /** Disables the section of days of the week, e.g. weekends. * Accepts: array of numbers from 0-6 * @default: false */ - daysOfWeekDisabled?: number[] | boolean; + daysOfWeekDisabled?: number[] | boolean; /** Changes the heading of the datepicker when in "days" view. * @default: "MMMM YYYY" */ @@ -358,14 +358,14 @@ export interface DatetimepickerOptions { /** Sets the picker default date/time. Overrides useCurrent * @default: false */ - defaultDate?: boolean | moment.Moment | Date | string; + defaultDate?: boolean | moment.Moment | Date | string; /** Disables selection of dates in the array, e.g. holidays * @default: false * IMPORTANT! The getter returns an Object NOT an Array, with keys being the dates, values being true. * eg disabledDates = ["2010-10-10"]; -> disabledDated will be { "2010-01-01": true } * https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499 */ - disabledDates?: boolean | Array | any; + disabledDates?: boolean | Array | any; /** Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days * @default: false * IMPORTANT! The getter returns an Object NOT an Array, with keys being the hours, values being true. @@ -384,7 +384,7 @@ export interface DatetimepickerOptions { * eg enabledDates = ["2010-10-10"]; -> enabledDated will be { "2010-01-01": true } * https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499 */ - enabledDates?: boolean | Array | any; + enabledDates?: boolean | Array | any; /** Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days * @default: false * IMPORTANT! The getter returns an Object NOT an Array, with keys being the hours, values being true. @@ -403,17 +403,17 @@ export interface DatetimepickerOptions { /** See momentjs' docs for valid formats. Format also dictates what components are shown, e.g. MM/dd/YYYY will not display the time picker. * @default: false */ - format?: boolean | string | moment.MomentBuiltinFormat; + format?: boolean | string | moment.MomentBuiltinFormat; /** Change the default icons for the pickers functions. */ - icons?: Icons; + icons?: Icons; /** Allow date picker show event to fire even when the associated input element has the readonly="readonly"property. * @default: false */ - ignoreReadonly?: boolean; + ignoreReadonly?: boolean; /** Will display the picker inline without the need of a input field. This will also hide borders and shadows. * @default: false */ - inline?: boolean; + inline?: boolean; /** Allows for custom events to fire on keyboard press. * eg: keybinds: { * up: (widget) => console.log(widget), @@ -433,17 +433,17 @@ export interface DatetimepickerOptions { /** See momentjs for valid locales. You must include moment-with-locales.js or a local js file. * @default: moment.locale() */ - locale?: string; + locale?: string; /** Prevents date/time selections after this date. * maxDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected. * @default: false */ - maxDate?: boolean | moment.Moment | Date | string; + maxDate?: boolean | moment.Moment | Date | string; /** Prevents date/time selections before this date. * minDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected. * @default: false */ - minDate?: boolean | moment.Moment | Date | string; + minDate?: boolean | moment.Moment | Date | string; /** Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago". * {@link http://eonasdan.github.io/bootstrap-datetimepicker/Functions/#parseinputdate} */ @@ -452,7 +452,7 @@ export interface DatetimepickerOptions { * Clicking the "Clear" button will set the calendar to null. * @default: false */ - showClear?: boolean; + showClear?: boolean; /** Show the "Close" button in the icon toolbar. * Clicking the "Close" button will call hide() * @default: false @@ -462,11 +462,11 @@ export interface DatetimepickerOptions { * Clicking the "Today" button will set the calendar view and set the date to now. * @default: false */ - showTodayButton?: boolean; + showTodayButton?: boolean; /** Shows the picker side by side when using the time and date together. * @default: false */ - sideBySide?: boolean; + sideBySide?: boolean; /** Number of minutes the up/down arrow's will move the minutes value in the time picker * @default: 1 */ @@ -479,17 +479,17 @@ export interface DatetimepickerOptions { /** Changes the placement of the icon toolbar. * @default: "default" */ - toolbarPlacement?: "default" | "top" | "bottom"; + toolbarPlacement?: "default" | "top" | "bottom"; /** This will change the tooltips over each icon to a custom string */ tooltips?: Tooltips; /** On show, will set the picker to the current date/time * @default: true */ - useCurrent?: boolean; + useCurrent?: boolean; /** Defines if moment should use strict date parsing when considering a date to be valid * @default: false */ - useStrict?: boolean; + useStrict?: boolean; /** This will change the viewDate without changing or setting the selected date. * @default: false */ @@ -498,7 +498,7 @@ export interface DatetimepickerOptions { * Note: To limit the picker to selecting, for instance the year and month, use format: MM/YYYY * @default: "days" */ - viewMode?: "decades" | "years" | "months" | "days"; + viewMode?: "decades" | "years" | "months" | "days"; /** On picker show, places the widget at the identifier (string) or jQuery object if the element has css position: "relative" * @default: null */ @@ -520,7 +520,7 @@ export interface Icons { /** default: "glyphicon glyphicon-screenshot" */ previous?: string; /** default: "glyphicon glyphicon-chevron-right" */ - time?: string; + time?: string; /** default: "glyphicon glyphicon-chevron-down" */ today?: string; /** default: "glyphicon glyphicon-chevron-up" */ diff --git a/types/breeze/breeze-tests.ts b/types/breeze/breeze-tests.ts index 17653706ad..7f46780828 100644 --- a/types/breeze/breeze-tests.ts +++ b/types/breeze/breeze-tests.ts @@ -7,6 +7,11 @@ function test_dataType() { var typ = breeze.DataType.DateTime; var nm = typ.getName(); var dv = typ.defaultValue; + var isDate = typ.isDate; + var isFloat = typ.isFloat; + var isInteger = typ.isInteger; + var isNumeric = typ.isNumeric; + var qjod = typ.quoteJsonOData; var symbs = breeze.DataType.getSymbols(); var x = typ.parentEnum === breeze.DataType; var isFalse = breeze.DataType.contains(breeze.DataType.Double); diff --git a/types/breeze/index.d.ts b/types/breeze/index.d.ts index 323e9a8f87..bfd3479d3c 100644 --- a/types/breeze/index.d.ts +++ b/types/breeze/index.d.ts @@ -16,7 +16,7 @@ // Updated Jul 15 2016 - Added methods to JsonResultsAdapter - Steve Schmitt // Updated Sep 23 2016 - Added core methods // Updated March 5 2017 - Eliminate promises.IPromise and replace with Promise - +// Updated Apr 28 2017 - Fixed DataType declare namespace breeze.core { export interface ErrorCallback { @@ -266,9 +266,33 @@ declare namespace breeze { export class DataTypeSymbol extends breeze.core.EnumSymbol { defaultValue: any; - isNumeric: boolean; - isDate: boolean; + isDate?: boolean; + isFloat?: boolean; + isInteger?: boolean; + isNumeric?: boolean; + quoteJsonOData?: boolean; + + validatorCtor: (context: any) => Validator; + + /** Function to convert a value from string to this DataType. Note that this will be called each time a property is changed, so make it fast. */ + parse?: (val: any, sourceTypeName?: string) => any; + + /** Function to format this DataType for OData queries. */ + fmtOData: (val: any) => any; + + /** Optional function to get the next value for key generation, if this datatype is used as a key. Uses an internal table of previous values. */ + getNext?: () => any; + + /** Optional function to normalize a data value for comparison, if its value cannot be used directly. Note that this will be called each time a property is changed, so make it fast. */ + normalize?: (val: any) => any; + + /** Optional function to get the next value when the datatype is used as a concurrency property. */ + getConcurrencyValue?: (val: any) => any; + + /** Optional function to convert a raw (server) value from string to this DataType. */ + parseRawValue?: (val: any) => any; } + export interface DataType extends breeze.core.IEnum { Binary: DataTypeSymbol; Boolean: DataTypeSymbol; @@ -285,30 +309,16 @@ declare namespace breeze { String: DataTypeSymbol; Time: DataTypeSymbol; Undefined: DataTypeSymbol; - - toDataType(typeName: string): DataTypeSymbol; + + constants: { nextNumber: number, nextNumberIncrement: number, stringPrefix: string }; + + fromEdmDataType(typeName: string): DataTypeSymbol; + fromValue(val: any): DataTypeSymbol; + getComparableFn(dataType: DataTypeSymbol): (value: any) => any; + parseDateAsUTC(source: any): Date; parseDateFromServer(date: any): Date; - defaultValue: any; - isNumeric: boolean; - isInteger: boolean; - - /** Function to convert a value from string to this DataType. Note that this will be called each time a property is changed, so make it fast. */ - parse: (val: any, sourceTypeName: string) => any; - - /** Function to format this DataType for OData queries. */ - fmtOData: (val: any) => any; - - /** Optional function to get the next value for key generation, if this datatype is used as a key. Uses an internal table of previous values. */ - getNext?: () => any; - - /** Optional function to normalize a data value for comparison, if its value cannot be used directly. Note that this will be called each time a property is changed, so make it fast. */ - normalize?: (val: any) => any; - - /** Optional function to get the next value when the datatype is used as a concurrency property. */ - getConcurrencyValue?: (val: any) => any; - - /** Optional function to convert a raw (server) value from string to this DataType. */ - parseRawValue?: (val: any) => any; + parseRawValue(val: any, dataType?: DataTypeSymbol): any; + parseTimeFromServer(source: any): string; } export var DataType: DataType; diff --git a/types/browser-sync/index.d.ts b/types/browser-sync/index.d.ts index 84b604c993..449063192d 100644 --- a/types/browser-sync/index.d.ts +++ b/types/browser-sync/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for browser-sync // Project: http://www.browsersync.io/ // Definitions by: Asana , Joe Skeen +// Thomas "Thasmo" Deinhamer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -134,6 +135,12 @@ declare namespace browserSync { * Default: default */ browser?: string | string[]; + /** + * Add HTTP access control (CORS) headers to assets served by Browsersync. + * Default: false + * Note: requires at least version 2.16.0 + */ + cors?: boolean; /** * Requires an internet connection - useful for services such as Typekit as it allows you to configure * domains such as *.xip.io in your kit settings diff --git a/types/browserify/browserify-tests.ts b/types/browserify/browserify-tests.ts index 68ebb59c7f..2a1da315ed 100644 --- a/types/browserify/browserify-tests.ts +++ b/types/browserify/browserify-tests.ts @@ -1,6 +1,7 @@ import browserify = require("browserify"); import fs = require("fs"); import stream = require('stream'); +import insertGlobals = require("insert-module-globals"); var bNoArg = browserify(); @@ -47,4 +48,15 @@ var record_pipeline = b.pipeline.get('record'); b.bundle().pipe(process.stdout); +var argv = { igv: "__filename,__dirname" }; +var insertGlobalVars: insertGlobals.VarsOption = {}; +var wantedGlobalVars = argv.igv.split(','); +Object.keys(insertGlobals.vars).forEach((x) => { + if (wantedGlobalVars.indexOf(x) === -1) { + insertGlobalVars[x] = undefined; + } +}); +var b = browserify('./browser/main.js', { + insertGlobalVars: insertGlobalVars +}); diff --git a/types/browserify/index.d.ts b/types/browserify/index.d.ts index 8554025402..6d03c76efe 100644 --- a/types/browserify/index.d.ts +++ b/types/browserify/index.d.ts @@ -1,10 +1,12 @@ -// Type definitions for Browserify v12.0.1 +// Type definitions for Browserify 12.0 // Project: http://browserify.org/ -// Definitions by: Andrew Gaspar , John Vilk +// Definitions by: Andrew Gaspar , John Vilk , Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +import insertGlobals = require('insert-module-globals'); + declare var browserify: browserify.BrowserifyConstructor; export = browserify; @@ -74,7 +76,7 @@ interface Options { // The global export will be sanitized and camel cased. standalone?: string; // will be passed to insert-module-globals as the opts.vars parameter. - insertGlobalVars?: {[globalName: string]: (file: string, basedir: string) => any}; + insertGlobalVars?: insertGlobals.VarsOption; // defaults to 'require' in expose mode but you can use another name. externalRequireName?: string; } diff --git a/types/bufferstream/postbuffer.d.ts b/types/bufferstream/postbuffer.d.ts index f8591771cc..bd348b84db 100644 --- a/types/bufferstream/postbuffer.d.ts +++ b/types/bufferstream/postbuffer.d.ts @@ -8,5 +8,5 @@ declare class PostBuffer extends BufferStream { /** set a callback to get all post data from a http server request */ onEnd(callback: (data: any) => void): void; /** pumps data into another stream to allow incoming streams given options will be passed to Stream.pipe */ - pipe(stream: NodeJS.WritableStream, options?: BufferStream.Opts): NodeJS.ReadableStream; + pipe(stream: NodeJS.WritableStream, options?: { end?: boolean }): NodeJS.ReadableStream; } diff --git a/types/bunyan-winston-adapter/bunyan-winston-adapter-tests.ts b/types/bunyan-winston-adapter/bunyan-winston-adapter-tests.ts new file mode 100644 index 0000000000..fc4518fa29 --- /dev/null +++ b/types/bunyan-winston-adapter/bunyan-winston-adapter-tests.ts @@ -0,0 +1,9 @@ +import { createAdapter } from "bunyan-winston-adapter"; +import { Logger, LoggerInstance, transports } from "winston"; + +const logger = new Logger(); +const mapping = { + trace: 'silly' +}; +const adapterA = createAdapter(logger); +const adapterB = createAdapter(logger, mapping); diff --git a/types/bunyan-winston-adapter/index.d.ts b/types/bunyan-winston-adapter/index.d.ts new file mode 100644 index 0000000000..e0c4f835d9 --- /dev/null +++ b/types/bunyan-winston-adapter/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for bunyan-winston-adapter 0.2 +// Project: https://github.com/gluwer/bunyan-winston-adapter +// Definitions by: Steve Hipwell +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as bunyan from "bunyan"; +import { LoggerInstance } from "winston"; + +export function createAdapter(logger: LoggerInstance, mapping?: any): bunyan; diff --git a/types/bunyan-winston-adapter/tsconfig.json b/types/bunyan-winston-adapter/tsconfig.json new file mode 100644 index 0000000000..7185731caf --- /dev/null +++ b/types/bunyan-winston-adapter/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bunyan-winston-adapter-tests.ts" + ] +} diff --git a/types/bunyan-winston-adapter/tslint.json b/types/bunyan-winston-adapter/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/bunyan-winston-adapter/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/bunyan/bunyan-tests.ts b/types/bunyan/bunyan-tests.ts index acf382c7c2..657a59c3a8 100644 --- a/types/bunyan/bunyan-tests.ts +++ b/types/bunyan/bunyan-tests.ts @@ -1,16 +1,15 @@ - import Logger = require('bunyan'); -var ringBufferOptions: Logger.RingBufferOptions = { +let ringBufferOptions: Logger.RingBufferOptions = { limit: 100 }; -var ringBuffer: Logger.RingBuffer = new Logger.RingBuffer(ringBufferOptions); +let ringBuffer: Logger.RingBuffer = new Logger.RingBuffer(ringBufferOptions); ringBuffer.write("hello"); ringBuffer.end(); ringBuffer.destroy(); ringBuffer.destroySoon(); -var level: number; +let level: number; level = Logger.resolveLevel("trace"); level = Logger.resolveLevel("debug"); level = Logger.resolveLevel("info"); @@ -24,7 +23,7 @@ level = Logger.resolveLevel(Logger.WARN); level = Logger.resolveLevel(Logger.ERROR); level = Logger.resolveLevel(Logger.FATAL); -var options: Logger.LoggerOptions = { +let options: Logger.LoggerOptions = { name: 'test-logger', serializers: Logger.stdSerializers, streams: [{ @@ -54,13 +53,13 @@ var options: Logger.LoggerOptions = { }] }; -var log = Logger.createLogger(options); +let log = Logger.createLogger(options); -var customSerializer = function(anything: any) { - return { obj: anything}; +let customSerializer = (anything: any) => { + return { obj: anything }; }; -log.addSerializers({anything: customSerializer}); +log.addSerializers({ anything: customSerializer }); log.addSerializers(Logger.stdSerializers); log.addSerializers( { @@ -70,9 +69,9 @@ log.addSerializers( } ); -var child = log.child({name: 'child'}); +let child = log.child({ name: 'child' }); child.reopenFileStreams(); -log.addStream({path: '/dev/null'}); +log.addStream({ path: '/dev/null' }); child.level(Logger.DEBUG); child.level('debug'); child.levels(0, Logger.ERROR); @@ -80,9 +79,9 @@ child.levels(0, 'error'); child.levels('stream1', Logger.FATAL); child.levels('stream1', 'fatal'); -var buffer = new Buffer(0); -var error = new Error(''); -var object = { +let buffer = new Buffer(0); +let error = new Error(''); +let object = { test: 123 }; @@ -117,12 +116,11 @@ log.fatal(error); log.fatal(object); log.fatal('Hello, %s', 'world!'); -var recursive: any = { +let recursive: any = { hello: 'world', - whats: { - huh: recursive - } -} + whats: {} +}; +recursive.whats['huh'] = recursive; JSON.stringify(recursive, Logger.safeCycles()); diff --git a/types/bunyan/index.d.ts b/types/bunyan/index.d.ts index 060fa8eaa3..bc1dca298d 100644 --- a/types/bunyan/index.d.ts +++ b/types/bunyan/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for node-bunyan +// Type definitions for bunyan 1.8 // Project: https://github.com/trentm/node-bunyan // Definitions by: Alex Mikhalev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -10,21 +10,24 @@ import { EventEmitter } from 'events'; declare class Logger extends EventEmitter { constructor(options: Logger.LoggerOptions); addStream(stream: Logger.Stream): void; - addSerializers(serializers: Logger.Serializers | Logger.StdSerializers): void; - child(options: Logger.LoggerOptions, simple?: boolean): Logger; - child(obj: Object, simple?: boolean): Logger; + addSerializers(serializers: Logger.Serializers): void; + child(options: Object, simple?: boolean): Logger; reopenFileStreams(): void; - level(): string | number; - level(value: number | string): void; - levels(name: number | string, value: number | string): void; + level(): number; + level(value: Logger.LogLevel): void; + levels(): number[]; + levels(name: number | string): number; + levels(name: number | string, value: Logger.LogLevel): void; fields: any; src: boolean; + /* tslint:disable:unified-signatures */ + /** * Returns a boolean: is the `trace` level enabled? - * + * * This is equivalent to `log.isTraceEnabled()` or `log.isEnabledFor(TRACE)` in log4j. */ trace(): boolean; @@ -35,27 +38,25 @@ declare class Logger extends EventEmitter { * (including the stack) and sets `msg` to the exception * message or you can specify the `msg`. */ - trace(error: Error, format?: any, ...params: any[]): void; - - trace(buffer: Buffer, format?: any, ...params: any[]): void; - - /** - * Uses `util.format` for msg formatting. - */ - trace(format: string | number, ...params: any[]): void; + trace(error: Error, ...params: any[]): void; /** * The first field can optionally be a "fields" object, which * is merged into the log record. - * + * * To pass in an Error *and* other fields, use the `err` * field name for the Error instance. */ - trace(obj: Object, format?: any, ...params: any[]): void; + trace(obj: Object, ...params: any[]): void; + + /** + * Uses `util.format` for msg formatting. + */ + trace(format: any, ...params: any[]): void; /** * Returns a boolean: is the `debug` level enabled? - * + * * This is equivalent to `log.isDebugEnabled()` or `log.isEnabledFor(DEBUG)` in log4j. */ debug(): boolean; @@ -66,27 +67,25 @@ declare class Logger extends EventEmitter { * (including the stack) and sets `msg` to the exception * message or you can specify the `msg`. */ - debug(error: Error, format?: any, ...params: any[]): void; - - debug(buffer: Buffer, format?: any, ...params: any[]): void; - - /** - * Uses `util.format` for msg formatting. - */ - debug(format: string | number, ...params: any[]): void; + debug(error: Error, ...params: any[]): void; /** * The first field can optionally be a "fields" object, which * is merged into the log record. - * + * * To pass in an Error *and* other fields, use the `err` * field name for the Error instance. */ - debug(obj: Object, format?: any, ...params: any[]): void; + debug(obj: Object, ...params: any[]): void; + + /** + * Uses `util.format` for msg formatting. + */ + debug(format: any, ...params: any[]): void; /** * Returns a boolean: is the `info` level enabled? - * + * * This is equivalent to `log.isInfoEnabled()` or `log.isEnabledFor(INFO)` in log4j. */ info(): boolean; @@ -97,27 +96,25 @@ declare class Logger extends EventEmitter { * (including the stack) and sets `msg` to the exception * message or you can specify the `msg`. */ - info(error: Error, format?: any, ...params: any[]): void; - - info(buffer: Buffer, format?: any, ...params: any[]): void; - - /** - * Uses `util.format` for msg formatting. - */ - info(format: string | number, ...params: any[]): void; + info(error: Error, ...params: any[]): void; /** * The first field can optionally be a "fields" object, which * is merged into the log record. - * + * * To pass in an Error *and* other fields, use the `err` * field name for the Error instance. */ - info(obj: Object, format?: any, ...params: any[]): void; + info(obj: Object, ...params: any[]): void; + + /** + * Uses `util.format` for msg formatting. + */ + info(format: any, ...params: any[]): void; /** * Returns a boolean: is the `warn` level enabled? - * + * * This is equivalent to `log.isWarnEnabled()` or `log.isEnabledFor(WARN)` in log4j. */ warn(): boolean; @@ -128,27 +125,25 @@ declare class Logger extends EventEmitter { * (including the stack) and sets `msg` to the exception * message or you can specify the `msg`. */ - warn(error: Error, format?: any, ...params: any[]): void; - - warn(buffer: Buffer, format?: any, ...params: any[]): void; - - /** - * Uses `util.format` for msg formatting. - */ - warn(format: string | number, ...params: any[]): void; + warn(error: Error, ...params: any[]): void; /** * The first field can optionally be a "fields" object, which * is merged into the log record. - * + * * To pass in an Error *and* other fields, use the `err` * field name for the Error instance. */ - warn(obj: Object, format?: any, ...params: any[]): void; + warn(obj: Object, ...params: any[]): void; + + /** + * Uses `util.format` for msg formatting. + */ + warn(format: any, ...params: any[]): void; /** * Returns a boolean: is the `error` level enabled? - * + * * This is equivalent to `log.isErrorEnabled()` or `log.isEnabledFor(ERROR)` in log4j. */ error(): boolean; @@ -159,27 +154,25 @@ declare class Logger extends EventEmitter { * (including the stack) and sets `msg` to the exception * message or you can specify the `msg`. */ - error(error: Error, format?: any, ...params: any[]): void; - - error(buffer: Buffer, format?: any, ...params: any[]): void; - - /** - * Uses `util.format` for msg formatting. - */ - error(format: string | number, ...params: any[]): void; + error(error: Error, ...params: any[]): void; /** * The first field can optionally be a "fields" object, which * is merged into the log record. - * + * * To pass in an Error *and* other fields, use the `err` * field name for the Error instance. */ - error(obj: Object, format?: any, ...params: any[]): void; + error(obj: Object, ...params: any[]): void; + + /** + * Uses `util.format` for msg formatting. + */ + error(format: any, ...params: any[]): void; /** * Returns a boolean: is the `fatal` level enabled? - * + * * This is equivalent to `log.isFatalEnabled()` or `log.isEnabledFor(FATAL)` in log4j. */ fatal(): boolean; @@ -190,90 +183,90 @@ declare class Logger extends EventEmitter { * (including the stack) and sets `msg` to the exception * message or you can specify the `msg`. */ - fatal(error: Error, format?: any, ...params: any[]): void; - - fatal(buffer: Buffer, format?: any, ...params: any[]): void; - - /** - * Uses `util.format` for msg formatting. - */ - fatal(format: string | number, ...params: any[]): void; + fatal(error: Error, ...params: any[]): void; /** * The first field can optionally be a "fields" object, which * is merged into the log record. - * + * * To pass in an Error *and* other fields, use the `err` * field name for the Error instance. */ - fatal(obj: Object, format?: any, ...params: any[]): void; + fatal(obj: Object, ...params: any[]): void; + + /** + * Uses `util.format` for msg formatting. + */ + fatal(format: any, ...params: any[]): void; + + /* tslint:enable:unified-signatures */ } declare namespace Logger { - const TRACE: number; - const DEBUG: number; - const INFO: number; - const WARN: number; - const ERROR: number; - const FATAL: number; + const TRACE: number; + const DEBUG: number; + const INFO: number; + const WARN: number; + const ERROR: number; + const FATAL: number; - const stdSerializers: StdSerializers; + type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' | number; - function createLogger(options: LoggerOptions): Logger; + const stdSerializers: StdSerializers; - function safeCycles(): (key: string, value: any) => any; + function createLogger(options: LoggerOptions): Logger; - function resolveLevel(value: number | string): number; + function safeCycles(): (key: string, value: any) => any; - interface Stream { - type?: string; - level?: number | string; - path?: string; - stream?: NodeJS.WritableStream | Stream; - closeOnExit?: boolean; - period?: string; - count?: number; - } + function resolveLevel(value: LogLevel): number; - interface LoggerOptions { - name: string; - streams?: Stream[]; - level?: string | number; - stream?: NodeJS.WritableStream; - serializers?: Serializers | StdSerializers; - src?: boolean; - [custom: string]: any; - } + interface Stream { + type?: string; + level?: LogLevel; + path?: string; + stream?: NodeJS.WritableStream | Stream; + closeOnExit?: boolean; + period?: string; + count?: number; + } - interface Serializer { - (input:any): any; - } + interface LoggerOptions { + name: string; + streams?: Stream[]; + level?: LogLevel; + stream?: NodeJS.WritableStream; + serializers?: Serializers; + src?: boolean; + [custom: string]: any; + } - interface Serializers { - [key: string]: Serializer - } + type Serializer = (input: any) => any; - interface StdSerializers { - err: Serializer; - res: Serializer; - req: Serializer; - } + interface Serializers { + [key: string]: Serializer; + } - interface RingBufferOptions { - limit?: number; - } + interface StdSerializers extends Serializers { + err: Serializer; + res: Serializer; + req: Serializer; + } - class RingBuffer extends EventEmitter { - constructor(options: RingBufferOptions); + interface RingBufferOptions { + limit?: number; + } - writable: boolean; - records: any[]; + class RingBuffer extends EventEmitter implements NodeJS.WritableStream { + constructor(options: RingBufferOptions); - write(record: any): void; - end(record?: any): void; - destroy(): void; - destroySoon(): void; - } + writable: boolean; + records: any[]; + + write(record: any): boolean; + end(record?: any): void; + destroy(): void; + destroySoon(): void; + } } export = Logger; diff --git a/types/bunyan/tslint.json b/types/bunyan/tslint.json new file mode 100644 index 0000000000..09f94cd344 --- /dev/null +++ b/types/bunyan/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // ban-types needs to be disabled to support TypeScript <2.2 + "ban-types": false + } +} diff --git a/types/bytes/bytes-tests.ts b/types/bytes/bytes-tests.ts index 9c7f7abd5d..69bac3977d 100644 --- a/types/bytes/bytes-tests.ts +++ b/types/bytes/bytes-tests.ts @@ -9,8 +9,9 @@ console.log(bytes.format(104857, { thousandsSeparator: ' ' })); console.log(bytes.format(104857, { decimalPlaces: 2 })); console.log(bytes.format(104857, { fixedDecimals: true })); console.log(bytes.format(104857, { unitSeparator: '-' })); +console.log(bytes.format(104857, { unit: 'GB' })); console.log(bytes('1024kb')); console.log(bytes(1024)); console.log(bytes.parse('1024kb')); -console.log(bytes.parse(1024)); \ No newline at end of file +console.log(bytes.parse(1024)); diff --git a/types/bytes/index.d.ts b/types/bytes/index.d.ts index fd0a65c365..ae9e8f2d87 100644 --- a/types/bytes/index.d.ts +++ b/types/bytes/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for bytes v2.4.0 +// Type definitions for bytes v2.5.0 // Project: https://github.com/visionmedia/bytes.js // Definitions by: Zhiyuan Wang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -7,7 +7,8 @@ interface BytesOptions { decimalPlaces?: number, thousandsSeparator?: string, unitSeparator?: string, - fixedDecimals?: boolean + fixedDecimals?: boolean, + unit?: string } /** *Convert the given value in bytes into a string. diff --git a/types/c3/c3-tests.ts b/types/c3/c3-tests.ts index d9057eabb6..58f45d3df5 100644 --- a/types/c3/c3-tests.ts +++ b/types/c3/c3-tests.ts @@ -620,7 +620,8 @@ function chart_bar() { }, bar: { width: { - ratio: 0.5 // this makes bar width 50% of length between ticks + ratio: 0.5, // this makes bar width 50% of length between ticks + max: 50 // this limits maximum width of bar to 50px } // or //width: 100 // this makes bar width 100px diff --git a/types/c3/index.d.ts b/types/c3/index.d.ts index 748b19bfc5..47fc5c3986 100644 --- a/types/c3/index.d.ts +++ b/types/c3/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for C3js v0.4 // Project: http://c3js.org/ // Definitions by: Marc Climent +// Gerin Jacob // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as d3 from "d3"; @@ -161,7 +162,16 @@ declare namespace c3 { /** * Change the width of bar chart. If ratio is specified, change the width of bar chart by ratio. */ - width?: number | { ratio: number }; + width?: number | { + /** + * Set the width of each bar by ratio + */ + ratio: number, + /** + * Set max width of each bar + */ + max?: number + }; /** * Set if min or max value will be 0 on bar chart. */ diff --git a/types/catbox/index.d.ts b/types/catbox/index.d.ts new file mode 100644 index 0000000000..5dad5af29a --- /dev/null +++ b/types/catbox/index.d.ts @@ -0,0 +1,247 @@ +// Type definitions for catbox 7.1 +// Project: https://github.com/hapijs/catbox +// Definitions by: Jason Swearingen , AJP +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as Boom from 'boom'; + +export interface CallBackNoResult { + (err?: Boom.BoomError): void; +} +export interface CallBackWithResult { + (err: Boom.BoomError | null | undefined, result: T): void; +} + +/** + * Client + * The Client object provides a low-level cache abstraction. The object is constructed using new Client(engine, options) where: + * engine - is an object or a prototype function implementing the cache strategy: + * * function - a prototype function with the signature function(options). catbox will call new func(options). + * * object - a pre instantiated client implementation object. Does not support passing options. + * options - the strategy configuration object. Each strategy defines its own configuration options with the following common options: + * * partition - the partition name used to isolate the cached results across multiple clients. The partition name is used as the MongoDB database name, the Riak bucket, or as a key prefix in Redis and Memcached. To share the cache across multiple clients, use the same partition name. + * @see {@link https://github.com/hapijs/catbox#client} + */ +export interface Client extends ClientApi { + new(engine: EnginePrototypeOrObject, options: ClientOptions): Client; +} + +type EnginePrototypeOrObject = EnginePrototype | ClientApi; + +/** + * A prototype CatBox engine function + */ +export interface EnginePrototype { + new(settings: ClientOptions): ClientApi; +} + +/** + * Client API + * The Client object provides the following methods: + * @see {@link https://github.com/hapijs/catbox#api} + */ +export interface ClientApi { + /** start(callback) - creates a connection to the cache server. Must be called before any other method is available. The callback signature is function(err). */ + start(callback: CallBackNoResult): void; + /** stop() - terminates the connection to the cache server. */ + stop(): void; + /** + * get(key, callback) - retrieve an item from the cache engine if found where: + * * key - a cache key object (see [ICacheKey]). + * * callback - a function with the signature function(err, cached). If the item is not found, both err and cached are null. If found, the cached object is returned + */ + get(key: CacheKey, callback: CallBackWithResult): CacheItem; + /** + * set(key, value, ttl, callback) - store an item in the cache for a specified length of time, where: + * * key - a cache key object (see [ICacheKey]). + * * value - the string or object value to be stored. + * * ttl - a time-to-live value in milliseconds after which the item is automatically removed from the cache (or is marked invalid). + * * callback - a function with the signature function(err). + */ + set(key: CacheKey, value: CacheItem, ttl: number, callback: CallBackNoResult): void; + /** + * drop(key, callback) - remove an item from cache where: + * * key - a cache key object (see [ICacheKey]). + * * callback - a function with the signature function(err). + */ + drop(key: CacheKey, callback: CallBackNoResult): void; + /** isReady() - returns true if cache engine determines itself as ready, false if it is not ready. */ + isReady(): boolean; + /** validateSegmentName(segment) - returns null if the segment name is valid (see below), otherwise should return an instance of Error with an appropriate message. */ + validateSegmentName(segment: string): null | Boom.BoomError; +} + +/** + * Any method with a key argument takes an object with the following required properties: + */ +export interface CacheKey { + /** segment - a caching segment name string. Enables using a single cache server for storing different sets of items with overlapping ids. */ + segment: string; + /** id - a unique item identifier string (per segment). Can be an empty string. */ + id: string; +} + +/** Cached object contains the following: */ +export interface CachedObject { + /** item - the value stored in the cache using set(). */ + item: any; + /** stored - the timestamp when the item was stored in the cache (in milliseconds). */ + stored: number; + /** ttl - the remaining time-to-live (not the original value used when storing the object). */ + ttl: number; +} + +type CacheItem = any; + +export interface ClientOptions { + partition: string; +} + +/** + * The Policy object provides a convenient cache interface by setting a global policy which is automatically applied to every storage action. The object is constructed using new Policy(options, [cache, segment]) where: + * * options - an object with the IPolicyOptions structure + * * cache - a Client instance (which has already been started). + * * segment - required when cache is provided. The segment name used to isolate cached items within the cache partition. + * @see {@link https://github.com/hapijs/catbox#policy} + */ +export interface Policy extends PolicyAPI { + new(options: PolicyOptions, cache: Client, segment: string): Policy; +} + +/** + * Policy API + * The Policy object provides the following methods: + * @see {@link https://github.com/hapijs/catbox#api-1} + */ +export interface PolicyAPI { + /** + * get(id, callback) - retrieve an item from the cache. If the item is not found and the generateFunc method was provided, a new value is generated, stored in the cache, and returned. Multiple concurrent requests are queued and processed once. The method arguments are: + * * id - the unique item identifier (within the policy segment). Can be a string or an object with the required 'id' key. + * * callback - the return function. + */ + get(id: string | {id: string}, callback: PolicyGetCallback): CacheItem; + /** + * set(id, value, ttl, callback) - store an item in the cache where: + * * id - the unique item identifier (within the policy segment). + * * value - the string or object value to be stored. + * * ttl - a time-to-live override value in milliseconds after which the item is automatically removed from the cache (or is marked invalid). This should be set to 0 in order to use the caching rules configured when creating the Policy object. + * * callback - a function with the signature function(err). + */ + set(id: string | {id: string}, value: CacheItem, ttl: number | null, callback: CallBackNoResult): void; + /** + * drop(id, callback) - remove the item from cache where: + * * id - the unique item identifier (within the policy segment). + * * callback - a function with the signature function(err). + */ + drop(id: string | {id: string}, callback: CallBackNoResult): void; + /** ttl(created) - given a created timestamp in milliseconds, returns the time-to-live left based on the configured rules. */ + ttl(created: number): number; + /** rules(options) - changes the policy rules after construction (note that items already stored will not be affected) */ + rules(options: PolicyOptions): void; + /** isReady() - returns true if cache engine determines itself as ready, false if it is not ready or if there is no cache engine set. */ + isReady(): boolean; + /** stats - an object with cache statistics */ + stats(): CacheStatisticsObject; +} + +/** + * The return function. The function signature is function(err, value, cached, report) where: + * @param err - any errors encountered. + * @param value - the fetched or generated value. + * @param cached - null if a valid item was not found in the cache, or IPolicyGetCallbackCachedOptions + * @param report - an object with logging information about the generation operation + */ +export interface PolicyGetCallback{ + (err: null | Boom.BoomError, value: CacheItem, cached: PolicyGetCallbackCachedOptions, report: PolicyGetCallbackReportLog): void; +} + +export interface PolicyGetCallbackCachedOptions { + /** item - the cached value. */ + item: CacheItem; + /** stored - the timestamp when the item was stored in the cache. */ + stored: number; + /** ttl - the cache ttl value for the record. */ + ttl: number; + /** isStale - true if the item is stale. */ + isStale: boolean; +} + +/** + * @see {@link https://github.com/hapijs/catbox#policy} + */ +export interface PolicyOptions { + /** expiresIn - relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. */ + expiresIn?: number; + /** expiresAt - time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire. Uses local time. Cannot be used together with expiresIn. */ + expiresAt?: string; + /** generateFunc - a function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id, next) where: */ + generateFunc?: GenerateFunc; + /** + * staleIn - number of milliseconds to mark an item stored in cache as stale and attempt to regenerate it when generateFunc is provided. Must be less than expiresIn. Alternatively function that returns staleIn value in milliseconds. The function signature is function(stored, ttl) where: + * * stored - the timestamp when the item was stored in the cache (in milliseconds). + * * ttl - the remaining time-to-live (not the original value used when storing the object). + */ + staleIn?: number | ((stored: number, ttl: number) => number); + /** staleTimeout - number of milliseconds to wait before returning a stale value while generateFunc is generating a fresh value. */ + staleTimeout?: number; + /** generateTimeout - number of milliseconds to wait before returning a timeout error when the generateFunc function takes too long to return a value. When the value is eventually returned, it is stored in the cache for future requests. Required if generateFunc is present. Set to false to disable timeouts which may cause all get() requests to get stuck forever. */ + generateTimeout?: number | false; + /** dropOnError - if true, an error or timeout in the generateFunc causes the stale value to be evicted from the cache. Defaults to true. */ + dropOnError?: boolean; + /** generateOnReadError - if false, an upstream cache read error will stop the get() method from calling the generate function and will instead pass back the cache error. Defaults to true. */ + generateOnReadError?: boolean; + /** generateIgnoreWriteError - if false, an upstream cache write error will be passed back with the generated value when calling the get() method. Defaults to true. */ + generateIgnoreWriteError?: boolean; + /** pendingGenerateTimeout - number of milliseconds while generateFunc call is in progress for a given id, before a subsequent generateFunc call is allowed. Defaults to 0, no blocking of concurrent generateFunc calls beyond staleTimeout. */ + pendingGenerateTimeout?: number; +} + +/** + * generateFunc + * Is used in PolicyOptions + * A function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id, next) + * @param id - the id string or object provided to the get() method. + * @param next - the method called when the new item is returned with the signature function(err, value, ttl) where: + * * err - an error condition. + * * value - the new value generated. + * * ttl - the cache ttl value in milliseconds. Set to 0 to skip storing in the cache. Defaults to the cache global policy. + * @see {@link https://github.com/hapijs/catbox#policy} + */ +export interface GenerateFunc { + (id: string, next: ((err: null | Boom.BoomError, value: CacheItem, ttl?: number) => void)): void; +} + +/** + * An object with logging information about the generation operation containing the following keys (as relevant): + */ +export interface PolicyGetCallbackReportLog { + /** msec - the cache lookup time in milliseconds. */ + msec: number; + /** stored - the timestamp when the item was stored in the cache. */ + stored: number; + /** isStale - true if the item is stale. */ + isStale: boolean; + /** ttl - the cache ttl value for the record. */ + ttl: number; + /** error - lookup error. */ + error?: Boom.BoomError; +} + +/** + * an object with cache statistics where: + */ +export interface CacheStatisticsObject { + /** sets - number of cache writes. */ + sets: number; + /** gets - number of cache get() requests. */ + gets: number; + /** hits - number of cache get() requests in which the requested id was found in the cache (can be stale). */ + hits: number; + /** stales - number of cache reads with stale requests (only counts the first request in a queued get() operation). */ + stales: number; + /** generates - number of calls to the generate function. */ + generates: number; + /** errors - cache operations errors. TODO check this*/ + errors: number; +} diff --git a/types/catbox/tsconfig.json b/types/catbox/tsconfig.json new file mode 100644 index 0000000000..3bc13b0278 --- /dev/null +++ b/types/catbox/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "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/types/chai-arrays/chai-arrays-tests.ts b/types/chai-arrays/chai-arrays-tests.ts new file mode 100644 index 0000000000..7fabaacbca --- /dev/null +++ b/types/chai-arrays/chai-arrays-tests.ts @@ -0,0 +1,76 @@ +import { expect } from 'chai'; +import { assert } from 'chai'; + +import chai = require('chai'); +import ChaiArrays = require('chai-arrays'); + +chai.use(ChaiArrays); +chai.should(); + +const arr: any[] = [1, 2, 3]; +const str: string = 'abcdef'; + +const otherArr: number[] = [1, 2, 3]; +const anotherArr: number[] = [2, 4]; +const yetAnotherArr: number[] = [8, 5, 7]; + +arr.should.be.array(); +str.should.not.be.array(); + +expect(arr).to.be.array(); +expect(str).not.to.be.array(); + +assert.array(arr, 'is array'); + +arr.should.be.ofSize(3); +arr.should.not.be.ofSize(4); + +expect(arr).to.be.ofSize(3); +expect(str).not.to.be.ofSize(4); + +assert.ofSize(arr, 3, 'has 3 elements'); + +arr.should.be.equalTo(otherArr); +arr.should.not.be.equalTo(anotherArr); + +expect(arr).to.be.equalTo(otherArr); +expect(str).to.be.not.equalTo(anotherArr); + +assert.equalTo(arr, otherArr, 'is equal to'); + +arr.should.be.containing(1); +arr.should.not.be.containing(4); + +expect(arr).to.be.containing(1); +expect(str).to.be.not.containing(4); + +assert.containing(arr, 1, 'contains'); + +arr.should.be.containingAllOf(otherArr); +arr.should.not.be.containingAllOf(anotherArr); + +expect(arr).to.be.containingAllOf(otherArr); +expect(str).to.be.not.containingAllOf(anotherArr); + +assert.containingAllOf(arr, otherArr, 'contains all of'); + +arr.should.be.containingAnyOf(otherArr); +arr.should.be.containingAnyOf(anotherArr); +arr.should.not.be.containingAnyOf(yetAnotherArr); + +expect(arr).to.be.containingAnyOf(otherArr); +expect(str).to.be.containingAnyOf(anotherArr); +expect(str).to.be.not.containingAnyOf(yetAnotherArr); + +assert.containingAnyOf(arr, otherArr, 'contains any of'); +assert.containingAnyOf(arr, anotherArr, 'contains any of'); + +arr.should.be.sorted(); +anotherArr.should.be.sorted(); +yetAnotherArr.should.be.sorted(); + +expect(arr).to.be.sorted(); +expect(anotherArr).to.be.sorted(); +expect(yetAnotherArr).to.be.not.sorted(); + +assert.sorted(arr, 'sorted'); diff --git a/types/chai-arrays/index.d.ts b/types/chai-arrays/index.d.ts new file mode 100644 index 0000000000..d50be4f101 --- /dev/null +++ b/types/chai-arrays/index.d.ts @@ -0,0 +1,37 @@ +// Type definitions for chai-arrays 1.0 +// Project: https://github.com/GaneshSPatil/chai-arrays +// Definitions by: Clément Prévot +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare global { + namespace Chai { + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + array(): Assertion; + ofSize(size: number): Assertion; + equalTo(arr: any[]): Assertion; + containing(value: any): Assertion; + containingAllOf(values: any[]): Assertion; + containingAnyOf(values: any[]): Assertion; + sorted(): Assertion; + } + + interface Assert { + array(val: any[], msg?: string): void; + ofSize(val: any[], size: number, msg?: string): void; + equalTo(val: any[], array: any[], msg?: string): void; + containing(val: any[], value: any, msg?: string): void; + containingAllOf(val: any[], values: any[], msg?: string): void; + containingAnyOf(val: any[], values: any[], msg?: string): void; + sorted(val: any[], msg?: string): void; + } + } + + interface Array { + should: Chai.Assertion; + } +} + +declare function chaiArrays(chai: any, utils: any): void; +export = chaiArrays; diff --git a/types/chai-arrays/tsconfig.json b/types/chai-arrays/tsconfig.json new file mode 100644 index 0000000000..a555dfb8e2 --- /dev/null +++ b/types/chai-arrays/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "chai-arrays-tests.ts" + ] +} diff --git a/types/chai-arrays/tslint.json b/types/chai-arrays/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/chai-arrays/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/chai-as-promised/chai-as-promised-tests.ts b/types/chai-as-promised/chai-as-promised-tests.ts index 7dceef924a..7e422521aa 100644 --- a/types/chai-as-promised/chai-as-promised-tests.ts +++ b/types/chai-as-promised/chai-as-promised-tests.ts @@ -7,7 +7,7 @@ class TestClass {} // ReSharper disable WrongExpressionStatement // BDD API (expect) -var thenableNum: PromiseLike; +var thenableNum: PromiseLike = Promise.resolve(3); thenableNum = chai.expect(thenableNum).to.eventually.equal(3); thenableNum = chai.expect(thenableNum).to.eventually.have.property('foo'); thenableNum = chai.expect(thenableNum).to.become(3); @@ -40,8 +40,8 @@ thenableNum = thenableNum.should.eventually.equal(3).notify(() => console.log('d thenableNum = thenableNum.should.be.fulfilled.and.notify(() => console.log('done')); // Complex examples on https://github.com/domenic/chai-as-promised#working-with-non-promisefriendly-test-runners -thenableNum.should.be.fulfilled.then(function () { - thenableNum.should.equal("after"); +thenableNum.should.be.fulfilled.then(() => { + thenableNum.should.equal("after"); }).should.notify(() => console.log('done')); Promise.all([ @@ -63,3 +63,15 @@ thenableVoid = chai.assert.isRejected(thenableNum, /error message matcher/, "opt // Check that original chai assertions are not broken var undef: void; undef = chai.assert.equal(10, 4, 'Message'); + +chaiAsPromised.transferPromiseness = (assertion, promise) => { + assertion.then = promise.then.bind(promise); +}; + +chaiAsPromised.transformAsserterArgs = (args) => { + return args.map((x) => x + 1); +}; + +chaiAsPromised.transformAsserterArgs = (args) => { + return Promise.all(args); +}; diff --git a/types/chai-as-promised/index.d.ts b/types/chai-as-promised/index.d.ts index 4c36eccb61..0dde8837dd 100644 --- a/types/chai-as-promised/index.d.ts +++ b/types/chai-as-promised/index.d.ts @@ -1,13 +1,19 @@ // Type definitions for chai-as-promised // Project: https://github.com/domenic/chai-as-promised/ -// Definitions by: jt000 , Yuki Kokubun +// Definitions by: jt000 , Yuki Kokubun , Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// declare module 'chai-as-promised' { function chaiAsPromised(chai: any, utils: any): void; - namespace chaiAsPromised {} + + namespace chaiAsPromised { + function transferPromiseness(assertion: Chai.PromisedAssertion, promise: PromiseLike): void; + + function transformAsserterArgs(values: any[]): any; + } + export = chaiAsPromised; } @@ -59,7 +65,7 @@ declare namespace Chai { haveOwnProperty: PromisedOwnProperty; length: PromisedLength; lengthOf: PromisedLength; - match(regexp: RegExp|string, message?: string): PromisedAssertion; + match(regexp: RegExp | string, message?: string): PromisedAssertion; string(string: string, message?: string): PromisedAssertion; keys: PromisedKeys; key(string: string): PromisedAssertion; diff --git a/types/chai-as-promised/tsconfig.json b/types/chai-as-promised/tsconfig.json index cdca01dc50..71874931b3 100644 --- a/types/chai-as-promised/tsconfig.json +++ b/types/chai-as-promised/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,4 +20,4 @@ "index.d.ts", "chai-as-promised-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/chai/chai-tests.ts b/types/chai/chai-tests.ts index 756212995d..85e16c4f63 100644 --- a/types/chai/chai-tests.ts +++ b/types/chai/chai-tests.ts @@ -490,20 +490,20 @@ function property() { ({ foo: { bar: 'baz' } }).should.have.property('foo.bar'); } -function deepProperty() { +function nestedProperty() { expect({ 'foo.bar': 'baz' }) - .to.not.have.deep.property('foo.bar'); + .to.not.have.nested.property('foo.bar'); ({ 'foo.bar': 'baz' }).should - .not.have.deep.property('foo.bar'); + .not.have.nested.property('foo.bar'); expect({ foo: { bar: 'baz' } }) - .to.have.deep.property('foo.bar'); + .to.have.nested.property('foo.bar'); ({ foo: { bar: 'baz' } }).should - .have.deep.property('foo.bar'); + .have.nested.property('foo.bar'); expect({ 'foo.bar': 'baz' }) - .to.have.deep.property('foo.bar'); + .to.have.nested.property('foo.bar'); ({ 'foo.bar': 'baz' }).should - .have.deep.property('foo.bar'); + .have.nested.property('foo.bar'); } function property2() { @@ -525,24 +525,24 @@ function property2() { 'asd'.should.have.property('constructor', Number, 'blah'); } -function deepProperty2() { +function nestedProperty2() { expect({ foo: { bar: 'baz' } }) - .to.have.deep.property('foo.bar', 'baz'); + .to.have.nested.property('foo.bar', 'baz'); ({ foo: { bar: 'baz' } }).should - .have.deep.property('foo.bar', 'baz'); + .have.nested.property('foo.bar', 'baz'); expect({ foo: { bar: 'baz' } }) - .to.have.deep.property('foo.bar', 'quux', 'blah'); + .to.have.nested.property('foo.bar', 'quux', 'blah'); ({ foo: { bar: 'baz' } }).should - .have.deep.property('foo.bar', 'quux', 'blah'); + .have.nested.property('foo.bar', 'quux', 'blah'); expect({ foo: { bar: 'baz' } }) - .to.not.have.deep.property('foo.bar', 'baz', 'blah'); + .to.not.have.nested.property('foo.bar', 'baz', 'blah'); ({ foo: { bar: 'baz' } }).should - .not.have.deep.property('foo.bar', 'baz', 'blah'); + .not.have.nested.property('foo.bar', 'baz', 'blah'); expect({ foo: 5 }) - .to.not.have.deep.property('foo.bar', 'baz', 'blah'); + .to.not.have.nested.property('foo.bar', 'baz', 'blah'); ({ foo: 5 }).should - .not.have.deep.property('foo.bar', 'baz', 'blah'); + .not.have.nested.property('foo.bar', 'baz', 'blah'); } function ownProperty() { @@ -1659,4 +1659,4 @@ suite('assert', () => { assert.notFrozen(obj); assert.notFrozen(obj, 'message'); }); -}); \ No newline at end of file +}); diff --git a/types/chai/index.d.ts b/types/chai/index.d.ts index 73f62290f5..b9a079af86 100644 --- a/types/chai/index.d.ts +++ b/types/chai/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for chai 3.5.0 +// Type definitions for chai 4.0.0 // Project: http://chaijs.com/ // Definitions by: Jed Mao , // Bart van der Schoor , @@ -61,6 +61,7 @@ declare namespace Chai { interface Assertion extends LanguageChains, NumericComparison, TypeComparison { not: Assertion; deep: Deep; + nested: Nested; any: KeyFilter; all: KeyFilter; a: TypeComparison; @@ -167,6 +168,12 @@ declare namespace Chai { (expected: number, delta: number, message?: string): Assertion; } + interface Nested { + include: Include; + property: Property; + members: Members; + } + interface Deep { equal: Equal; equals: Equal; @@ -256,7 +263,7 @@ declare namespace Chai { /** * Throws a failure. - * + * * @type T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. @@ -268,7 +275,7 @@ declare namespace Chai { /** * Asserts that object is truthy. - * + * * @type T Type of object. * @param object Object to test. * @param message Message to display on error. @@ -277,7 +284,7 @@ declare namespace Chai { /** * Asserts that object is truthy. - * + * * @type T Type of object. * @param object Object to test. * @param message Message to display on error. @@ -286,7 +293,7 @@ declare namespace Chai { /** * Asserts that object is falsy. - * + * * @type T Type of object. * @param object Object to test. * @param message Message to display on error. @@ -295,7 +302,7 @@ declare namespace Chai { /** * Asserts that object is falsy. - * + * * @type T Type of object. * @param object Object to test. * @param message Message to display on error. @@ -304,7 +311,7 @@ declare namespace Chai { /** * Asserts non-strict equality (==) of actual and expected. - * + * * @type T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. @@ -314,7 +321,7 @@ declare namespace Chai { /** * Asserts non-strict inequality (==) of actual and expected. - * + * * @type T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. @@ -324,7 +331,7 @@ declare namespace Chai { /** * Asserts strict equality (===) of actual and expected. - * + * * @type T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. @@ -334,7 +341,7 @@ declare namespace Chai { /** * Asserts strict inequality (==) of actual and expected. - * + * * @type T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. @@ -344,7 +351,7 @@ declare namespace Chai { /** * Asserts that actual is deeply equal to expected. - * + * * @type T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. @@ -354,7 +361,7 @@ declare namespace Chai { /** * Asserts that actual is not deeply equal to expected. - * + * * @type T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. @@ -364,7 +371,7 @@ declare namespace Chai { /** * Asserts valueToCheck is strictly greater than (>) valueToBeAbove. - * + * * @param valueToCheck Actual value. * @param valueToBeAbove Minimum Potential expected value. * @param message Message to display on error. @@ -373,7 +380,7 @@ declare namespace Chai { /** * Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast. - * + * * @param valueToCheck Actual value. * @param valueToBeAtLeast Minimum Potential expected value. * @param message Message to display on error. @@ -382,7 +389,7 @@ declare namespace Chai { /** * Asserts valueToCheck is strictly less than (<) valueToBeBelow. - * + * * @param valueToCheck Actual value. * @param valueToBeBelow Minimum Potential expected value. * @param message Message to display on error. @@ -391,7 +398,7 @@ declare namespace Chai { /** * Asserts valueToCheck is greater than or equal to (>=) valueToBeAtMost. - * + * * @param valueToCheck Actual value. * @param valueToBeAtMost Minimum Potential expected value. * @param message Message to display on error. @@ -400,7 +407,7 @@ declare namespace Chai { /** * Asserts that value is true. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -409,7 +416,7 @@ declare namespace Chai { /** * Asserts that value is false. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -418,7 +425,7 @@ declare namespace Chai { /** * Asserts that value is not true. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -427,7 +434,7 @@ declare namespace Chai { /** * Asserts that value is not false. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -436,7 +443,7 @@ declare namespace Chai { /** * Asserts that value is null. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -445,7 +452,7 @@ declare namespace Chai { /** * Asserts that value is not null. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -454,7 +461,7 @@ declare namespace Chai { /** * Asserts that value is not null. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -463,7 +470,7 @@ declare namespace Chai { /** * Asserts that value is not null. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -472,7 +479,7 @@ declare namespace Chai { /** * Asserts that value is undefined. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -481,7 +488,7 @@ declare namespace Chai { /** * Asserts that value is not undefined. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -490,7 +497,7 @@ declare namespace Chai { /** * Asserts that value is a function. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -499,7 +506,7 @@ declare namespace Chai { /** * Asserts that value is not a function. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -509,7 +516,7 @@ declare namespace Chai { /** * Asserts that value is an object of type 'Object' * (as revealed by Object.prototype.toString). - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -520,7 +527,7 @@ declare namespace Chai { /** * Asserts that value is not an object of type 'Object' * (as revealed by Object.prototype.toString). - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -529,7 +536,7 @@ declare namespace Chai { /** * Asserts that value is an array. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -538,7 +545,7 @@ declare namespace Chai { /** * Asserts that value is not an array. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -547,7 +554,7 @@ declare namespace Chai { /** * Asserts that value is a string. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -556,7 +563,7 @@ declare namespace Chai { /** * Asserts that value is not a string. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -565,7 +572,7 @@ declare namespace Chai { /** * Asserts that value is a number. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -574,7 +581,7 @@ declare namespace Chai { /** * Asserts that value is not a number. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -583,7 +590,7 @@ declare namespace Chai { /** * Asserts that value is a boolean. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -592,7 +599,7 @@ declare namespace Chai { /** * Asserts that value is not a boolean. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -601,7 +608,7 @@ declare namespace Chai { /** * Asserts that value's type is name, as determined by Object.prototype.toString. - * + * * @type T Type of value. * @param value Actual value. * @param name Potential expected type name of value. @@ -611,7 +618,7 @@ declare namespace Chai { /** * Asserts that value's type is not name, as determined by Object.prototype.toString. - * + * * @type T Type of value. * @param value Actual value. * @param name Potential expected type name of value. @@ -621,7 +628,7 @@ declare namespace Chai { /** * Asserts that value is an instance of constructor. - * + * * @type T Type of value. * @param value Actual value. * @param constructor Potential expected contructor of value. @@ -631,7 +638,7 @@ declare namespace Chai { /** * Asserts that value is not an instance of constructor. - * + * * @type T Type of value. * @param value Actual value. * @param constructor Potential expected contructor of value. @@ -641,7 +648,7 @@ declare namespace Chai { /** * Asserts that haystack includes needle. - * + * * @param haystack Container string. * @param needle Potential expected substring of haystack. * @param message Message to display on error. @@ -650,7 +657,7 @@ declare namespace Chai { /** * Asserts that haystack includes needle. - * + * * @type T Type of values in haystack. * @param haystack Container array. * @param needle Potential value contained in haystack. @@ -660,7 +667,7 @@ declare namespace Chai { /** * Asserts that haystack does not include needle. - * + * * @param haystack Container string. * @param needle Potential expected substring of haystack. * @param message Message to display on error. @@ -669,7 +676,7 @@ declare namespace Chai { /** * Asserts that haystack does not include needle. - * + * * @type T Type of values in haystack. * @param haystack Container array. * @param needle Potential value contained in haystack. @@ -679,7 +686,7 @@ declare namespace Chai { /** * Asserts that value matches the regular expression regexp. - * + * * @param value Actual value. * @param regexp Potential match of value. * @param message Message to display on error. @@ -688,7 +695,7 @@ declare namespace Chai { /** * Asserts that value does not match the regular expression regexp. - * + * * @param value Actual value. * @param regexp Potential match of value. * @param message Message to display on error. @@ -697,7 +704,7 @@ declare namespace Chai { /** * Asserts that object has a property named by property. - * + * * @type T Type of object. * @param object Container object. * @param property Potential contained property of object. @@ -707,7 +714,7 @@ declare namespace Chai { /** * Asserts that object has a property named by property. - * + * * @type T Type of object. * @param object Container object. * @param property Potential contained property of object. @@ -718,7 +725,7 @@ declare namespace Chai { /** * Asserts that object has a property named by property, which can be a string * using dot- and bracket-notation for deep reference. - * + * * @type T Type of object. * @param object Container object. * @param property Potential contained property of object. @@ -729,7 +736,7 @@ declare namespace Chai { /** * Asserts that object does not have a property named by property, which can be a * string using dot- and bracket-notation for deep reference. - * + * * @type T Type of object. * @param object Container object. * @param property Potential contained property of object. @@ -739,7 +746,7 @@ declare namespace Chai { /** * Asserts that object has a property named by property with value given by value. - * + * * @type T Type of object. * @type V Type of value. * @param object Container object. @@ -751,7 +758,7 @@ declare namespace Chai { /** * Asserts that object has a property named by property with value given by value. - * + * * @type T Type of object. * @type V Type of value. * @param object Container object. @@ -764,7 +771,7 @@ declare namespace Chai { /** * Asserts that object has a property named by property, which can be a string * using dot- and bracket-notation for deep reference. - * + * * @type T Type of object. * @type V Type of value. * @param object Container object. @@ -777,7 +784,7 @@ declare namespace Chai { /** * Asserts that object does not have a property named by property, which can be a * string using dot- and bracket-notation for deep reference. - * + * * @type T Type of object. * @type V Type of value. * @param object Container object. @@ -789,7 +796,7 @@ declare namespace Chai { /** * Asserts that object has a length property with the expected value. - * + * * @type T Type of object. * @param object Container object. * @param length Potential expected length of object. @@ -799,7 +806,7 @@ declare namespace Chai { /** * Asserts that fn will throw an error. - * + * * @param fn Function that may throw. * @param message Message to display on error. */ @@ -807,7 +814,7 @@ declare namespace Chai { /** * Asserts that function will throw an error with message matching regexp. - * + * * @param fn Function that may throw. * @param regExp Potential expected message match. * @param message Message to display on error. @@ -816,7 +823,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -826,7 +833,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor * and an error with message matching regexp. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -835,7 +842,7 @@ declare namespace Chai { /** * Asserts that fn will throw an error. - * + * * @param fn Function that may throw. * @param message Message to display on error. */ @@ -843,16 +850,16 @@ declare namespace Chai { /** * Asserts that function will throw an error with message matching regexp. - * + * * @param fn Function that may throw. * @param regExp Potential expected message match. * @param message Message to display on error. */ - throws(fn: Function, regExp: RegExp): void; + throws(fn: Function, regExp: RegExp, message?: string): void; /** * Asserts that function will throw an error that is an instance of constructor. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -862,7 +869,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor * and an error with message matching regexp. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -871,7 +878,7 @@ declare namespace Chai { /** * Asserts that fn will throw an error. - * + * * @param fn Function that may throw. * @param message Message to display on error. */ @@ -879,7 +886,7 @@ declare namespace Chai { /** * Asserts that function will throw an error with message matching regexp. - * + * * @param fn Function that may throw. * @param regExp Potential expected message match. * @param message Message to display on error. @@ -888,7 +895,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -898,7 +905,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor * and an error with message matching regexp. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -907,7 +914,7 @@ declare namespace Chai { /** * Asserts that fn will not throw an error. - * + * * @param fn Function that may throw. * @param message Message to display on error. */ @@ -915,7 +922,7 @@ declare namespace Chai { /** * Asserts that function will throw an error with message matching regexp. - * + * * @param fn Function that may throw. * @param regExp Potential expected message match. * @param message Message to display on error. @@ -924,7 +931,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -934,7 +941,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor * and an error with message matching regexp. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -943,7 +950,7 @@ declare namespace Chai { /** * Compares two values using operator. - * + * * @param val1 Left value during comparison. * @param operator Comparison operator. * @param val2 Right value during comparison. @@ -953,7 +960,7 @@ declare namespace Chai { /** * Asserts that the target is equal to expected, to within a +/- delta range. - * + * * @param actual Actual value * @param expected Potential expected value. * @param delta Maximum differenced between values. @@ -963,7 +970,7 @@ declare namespace Chai { /** * Asserts that the target is equal to expected, to within a +/- delta range. - * + * * @param actual Actual value * @param expected Potential expected value. * @param delta Maximum differenced between values. @@ -973,7 +980,7 @@ declare namespace Chai { /** * Asserts that set1 and set2 have the same members. Order is not take into account. - * + * * @type T Type of set values. * @param set1 Actual set of values. * @param set2 Potential expected set of values. @@ -984,7 +991,7 @@ declare namespace Chai { /** * Asserts that set1 and set2 have the same members using deep equality checking. * Order is not take into account. - * + * * @type T Type of set values. * @param set1 Actual set of values. * @param set2 Potential expected set of values. @@ -994,7 +1001,7 @@ declare namespace Chai { /** * Asserts that subset is included in superset. Order is not take into account. - * + * * @type T Type of set values. * @param superset Actual set of values. * @param subset Potential contained set of values. @@ -1005,7 +1012,7 @@ declare namespace Chai { /** * Asserts that subset is included in superset using deep equality checking. * Order is not take into account. - * + * * @type T Type of set values. * @param superset Actual set of values. * @param subset Potential contained set of values. @@ -1015,7 +1022,7 @@ declare namespace Chai { /** * Asserts that non-object, non-array value inList appears in the flat array list. - * + * * @type T Type of list values. * @param inList Value expected to be in the list. * @param list List of values. @@ -1025,7 +1032,7 @@ declare namespace Chai { /** * Asserts that a function changes the value of a property. - * + * * @type T Type of object. * @param modifier Function to run. * @param object Container object. @@ -1036,7 +1043,7 @@ declare namespace Chai { /** * Asserts that a function does not change the value of a property. - * + * * @type T Type of object. * @param modifier Function to run. * @param object Container object. @@ -1047,7 +1054,7 @@ declare namespace Chai { /** * Asserts that a function increases an object property. - * + * * @type T Type of object. * @param modifier Function to run. * @param object Container object. @@ -1058,7 +1065,7 @@ declare namespace Chai { /** * Asserts that a function does not increase an object property. - * + * * @type T Type of object. * @param modifier Function to run. * @param object Container object. @@ -1069,7 +1076,7 @@ declare namespace Chai { /** * Asserts that a function decreases an object property. - * + * * @type T Type of object. * @param modifier Function to run. * @param object Container object. @@ -1080,7 +1087,7 @@ declare namespace Chai { /** * Asserts that a function does not decrease an object property. - * + * * @type T Type of object. * @param modifier Function to run. * @param object Container object. @@ -1091,7 +1098,7 @@ declare namespace Chai { /** * Asserts if value is not a false value, and throws if it is a true value. - * + * * @type T Type of object. * @param object Actual value. * @param message Message to display on error. @@ -1102,7 +1109,7 @@ declare namespace Chai { /** * Asserts that object is extensible (can have new properties added to it). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1111,7 +1118,7 @@ declare namespace Chai { /** * Asserts that object is extensible (can have new properties added to it). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1120,7 +1127,7 @@ declare namespace Chai { /** * Asserts that object is not extensible. - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1129,7 +1136,7 @@ declare namespace Chai { /** * Asserts that object is not extensible. - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1139,7 +1146,7 @@ declare namespace Chai { /** * Asserts that object is sealed (can have new properties added to it * and its existing properties cannot be removed). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1149,7 +1156,7 @@ declare namespace Chai { /** * Asserts that object is sealed (can have new properties added to it * and its existing properties cannot be removed). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1158,7 +1165,7 @@ declare namespace Chai { /** * Asserts that object is not sealed. - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1167,7 +1174,7 @@ declare namespace Chai { /** * Asserts that object is not sealed. - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1177,7 +1184,7 @@ declare namespace Chai { /** * Asserts that object is frozen (cannot have new properties added to it * and its existing properties cannot be removed). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1187,7 +1194,7 @@ declare namespace Chai { /** * Asserts that object is frozen (cannot have new properties added to it * and its existing properties cannot be removed). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1197,7 +1204,7 @@ declare namespace Chai { /** * Asserts that object is not frozen (cannot have new properties added to it * and its existing properties cannot be removed). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1207,7 +1214,7 @@ declare namespace Chai { /** * Asserts that object is not frozen (cannot have new properties added to it * and its existing properties cannot be removed). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index cad58a2aa8..ec8a7c0c03 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -24,11 +24,50 @@ declare class Chart { getElementAtEvent: (e: any) => {}; getElementsAtEvent: (e: any) => {}[]; getDatasetAtEvent: (e: any) => {}[]; + static pluginService: PluginServiceStatic; static defaults: { global: Chart.ChartOptions; } } +declare class PluginServiceStatic { + register(plugin?: PluginServiceRegistrationOptions): void; +} + +declare interface PluginServiceRegistrationOptions { + beforeInit?: (chartInstance: Chart) => void, + afterInit?: (chartInstance: Chart) => void, + + resize?: (chartInstance: Chart, newChartSize: Size) => void, + + beforeUpdate?: (chartInstance: Chart) => void, + afterScaleUpdate?: (chartInstance: Chart) => void, + beforeDatasetsUpdate?: (chartInstance: Chart) => void, + afterDatasetsUpdate?: (chartInstance: Chart) => void, + afterUpdate?: (chartInstance: Chart) => void, + + // This is called at the start of a render. It is only called once, even if the animation will run for a number of frames. Use beforeDraw or afterDraw + // to do something on each animation frame + beforeRender?: (chartInstance: Chart) => void, + + // Easing is for animation + beforeDraw?: (chartInstance: Chart, easing: string) => void, + afterDraw?: (chartInstance: Chart, easing: string) => void, + // Before the datasets are drawn but after scales are drawn + beforeDatasetsDraw?: (chartInstance: Chart, easing: string) => void, + afterDatasetsDraw?: (chartInstance: Chart, easing: string) => void, + + destroy?: (chartInstance: Chart) => void, + + // Called when an event occurs on the chart + beforeEvent?: (chartInstance: Chart, event: Event) => void, + afterEvent?: (chartInstance: Chart, event: Event) => void +} + +declare interface Size { + height: number; + width: number; +} declare namespace Chart { export type ChartType = 'line' | 'bar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble'; diff --git a/types/chartist/chartist-tests.ts b/types/chartist/chartist-tests.ts index 2a4a362e7e..13a7c7dd1c 100644 --- a/types/chartist/chartist-tests.ts +++ b/types/chartist/chartist-tests.ts @@ -401,3 +401,29 @@ var overlappingBarsResponsiveOptions: Array +// Definitions by: Matt Gibbs , Simon Pfeifer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Chartist { @@ -20,6 +20,7 @@ declare namespace Chartist { Pie: IChartistPieChart; Bar: IChartistBarChart; Line: IChartistLineChart; + Candle: IChartistCandleChart; FixedScaleAxis: IFixedScaleAxisStatic; AutoScaleAxis: IAutoScaleAxisStatic; @@ -138,6 +139,10 @@ declare namespace Chartist { new (target: any, data: IChartistData, options?: IBarChartOptions, responsiveOptions?: Array>): IChartistBarChart; } + interface IChartistCandleChart extends IChartistBase { + new (target: any, data: IChartistData, options?: ICandleChartOptions, responsiveOptions?: Array>): IChartistCandleChart; + } + interface IChartOptions { /** * If true the whole data is reversed including labels, the series order as well as the whole series data arrays. @@ -352,6 +357,124 @@ declare namespace Chartist { end?: string; } + interface ICandleChartOptions extends IChartOptions { + + /** + * Options for X-Axis + */ + axisX?: ICandleChartAxis; + + /** + * Options for Y-Axis + */ + axisY?: ICandleChartAxis; + + /** + * Specify a fixed width for the chart as a string (i.e. '100px' or '50%') + */ + width?: number | string; + + /** + * Specify a fixed height for the chart as a string (i.e. '100px' or '50%') + */ + height?: number | string; + + /** + * Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value + */ + hight?: number | string; + + /** + * Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value + */ + low?: number | string; + + /** + * Width of candle body in pixel (IMO is 2 px best minimum value) + */ + candleWidth?: number | string; + + /** + * Width of candle wick in pixel (IMO is 1 px best minimum value) + */ + candleWickWidth?: number | string; + + /** + * Use calculated x-axis step length, depending on the number of quotes to display, as candle width. Otherwise the candleWidth is being used. + */ + useStepLengthAsCandleWidth?: boolean | string; + + /** + * Use 1/3 of candle body width as width for the candle wick, otherwise the candleWickWidth is being used. + */ + useOneThirdAsCandleWickWidth?: boolean | string; + + /** + * Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5} + */ + chartPadding?: IChartPadding | number; + + /** + * When set to true, the last grid line on the x-axis is not drawn and the chart elements will expand to the full available width of the chart. For the last label to be drawn correctly you might need to add chart padding or offset the last label with a draw event handler. + */ + fullWidth?: boolean | string; + + /** + * Override the class names that get used to generate the SVG structure of the chart + */ + classNames?: ICandleChartClasses; + } + + interface ICandleChartAxis { + /** + * The offset of the chart drawing area to the border of the container + */ + offset?: number; + /** + * Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis. + */ + position?: string; + /** + * Allows you to correct label positioning on this axis by positive or negative x and y offset. + */ + labelOffset?: { + x?: number; + y?: number; + }; + /** + * If labels should be shown or not + */ + showLabel?: boolean; + /** + * If the axis grid should be drawn or not + */ + showGrid?: boolean; + /** + * Interpolation function that allows you to intercept the value from the axis label + */ + labelInterpolationFnc?: Function; + /** + * Set the axis type to be used to project values on this axis. If not defined, Chartist.StepAxis will be used for the X-Axis, where the ticks option will be set to the labels in the data and the stretch option will be set to the global fullWidth option. This type can be changed to any axis constructor available (e.g. Chartist.FixedScaleAxis), where all axis options should be present here. + */ + type?: any; + } + + interface ICandleChartClasses { + chart?: string; + label?: string; + labelGroup?: string; + series?: string; + candlePositive?: string; + candleNegative?: string, + grid?: string, + gridGroup?: string, + gridBackground?: string, + vertical?: string, + horizontal?: string, + start?: string, + end?: string, + } + interface ChartistSvgStatic { new (name: HTMLElement | string, attributes: Object, className?: string, parent?: Object, insertFirst?: boolean): IChartistSvg; diff --git a/types/chocolatechipjs/index.d.ts b/types/chocolatechipjs/index.d.ts index 0e33e087c3..4c1d49f6d1 100644 --- a/types/chocolatechipjs/index.d.ts +++ b/types/chocolatechipjs/index.d.ts @@ -438,7 +438,7 @@ interface ChocolateChipStatic { /** * Serialize */ - serialize(form: HTMLFormElement | ChocolateChipElementArray): string; + serialize(form: HTMLFormElement | ChocolateChipElementArray): string; /** * Grabs values from a form and converts them into a JSON object. @@ -862,7 +862,7 @@ interface ChocolateChipElementArray extends Array { * @param property The property to remove. * @return HTMLElement[] */ - removeProp(property: string): ChocolateChipElementArray; + removeProp(property: string): ChocolateChipElementArray; /** * Adds the specified class(es) to each of the set of matched elements. diff --git a/types/chokidar/index.d.ts b/types/chokidar/index.d.ts index dd0569656c..09e957aa05 100644 --- a/types/chokidar/index.d.ts +++ b/types/chokidar/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for chokidar 1.6.1 +// Type definitions for chokidar 1.7.0 // Project: https://github.com/paulmillr/chokidar // Definitions by: Stefan Steinhart , Felix Becker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -79,6 +79,12 @@ export interface WatchOptions { * be relative to this. */ cwd?: string; + + /** + * If set to true then the strings passed to .watch() and .add() are treated as literal path + * names, even if they look like globs. Default: false. + */ + disableGlobbing?: boolean; /** * Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU diff --git a/types/chroma-js/chroma-js-tests.ts b/types/chroma-js/chroma-js-tests.ts index 200d07615a..53a3e912b8 100644 --- a/types/chroma-js/chroma-js-tests.ts +++ b/types/chroma-js/chroma-js-tests.ts @@ -1,13 +1,9 @@ - - -import * as myChroma from "chroma-js"; - function test_chroma() { chroma('hotpink'); chroma('#ff3399'); chroma('F39'); chroma.hex("#fff"); - + chroma(0xff3399); chroma(0xff, 0x33, 0x99); chroma(255, 51, 153); @@ -37,15 +33,15 @@ function test_chroma() { chroma.contrast('pink', 'hotpink'); chroma.contrast('pink', 'purple'); chroma.brewer.OrRd; - var data = [3.0, 3.5, 3.6, 3.8, 3.8, 4.1, 4.3, 4.4, + const data = [3.0, 3.5, 3.6, 3.8, 3.8, 4.1, 4.3, 4.4, 4.6, 4.9, 5.2, 5.3, 5.4, 5.7, 5.8, 5.9, 6.2, 6.5, 6.8, 7.2, 9]; chroma.limits(data, 'e', 5); chroma.limits(data, 'q', 5); chroma.limits(data, 'k', 5); - myChroma(0xff3399); - myChroma.limits(data, 'k', 5); + chroma(0xff3399); + chroma.limits(data, 'k', 5); } function test_color() { @@ -105,13 +101,13 @@ function test_color() { chroma('#b3ccff').temperature(); chroma('33cc00').gl(); - myChroma('teal').alpha(0.5).css(); - myChroma('teal').css('hsl'); - myChroma('orange').rgb(); + chroma('teal').alpha(0.5).css(); + chroma('teal').css('hsl'); + chroma('orange').rgb(); } function test_scale() { - var f = chroma.scale(); + const f = chroma.scale(); f(0.25); f(0.5); f(0.75); @@ -173,7 +169,7 @@ function test_scale() { chroma.scale('OrRd').classes(5); chroma.scale('OrRd').classes(8); - myChroma.cubehelix() + chroma.cubehelix() .start(200) .rotations(-0.35) .gamma(0.7) @@ -183,6 +179,6 @@ function test_scale() { .correctLightness() .colors(5); - myChroma.scale('RdYlBu'); - myChroma.scale('RdYlBu').padding(0.15); + chroma.scale('RdYlBu'); + chroma.scale('RdYlBu').padding(0.15); } diff --git a/types/chroma-js/index.d.ts b/types/chroma-js/index.d.ts index e3f463d368..1b679b816a 100644 --- a/types/chroma-js/index.d.ts +++ b/types/chroma-js/index.d.ts @@ -1,29 +1,35 @@ -// Type definitions for Chroma.js v1.1.1 +// Type definitions for Chroma.js 1.3 // Project: https://github.com/gka/chroma.js // Definitions by: Sebastian Brückner , Marcin Pacholec // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /** * Chroma.js is a tiny library for all kinds of color conversions and color scales. */ declare namespace Chroma { - export interface ChromaStatic { + interface ColorSpaces { + rgb: [number, number, number]; + rgba: [number, number, number, number]; + hsl: [number, number, number]; + hsv: [number, number, number]; + hsi: [number, number, number]; + lab: [number, number, number]; + lch: [number, number, number]; + hcl: [number, number, number]; + cmyk: [number, number, number, number]; + gl: [number, number, number, number]; + } + interface ChromaStatic { /** * Creates a color from a string representation (as supported in CSS). + * Creates a color from a number representation [0; 16777215] * * @param color The string to convert to a color. * @return the color object. */ - (color: string): Color; - - /** - * Creates a color from a number representation [0; 16777215] - * - * @param color The number to convert to a color. - * @return the color object. - */ - (number: number): Color; + (color: string | number): Color; /** * Create a color in the specified color space using a, b and c as values. @@ -31,21 +37,21 @@ declare namespace Chroma { * @param a * @param b * @param c - * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb". + * @param colorSpace The color space to use. Defaults to "rgb". * @return the color object. - */ - (a: number, b: number, c: number, colorSpace?: string): Color; + */ + (a: number, b: number, c: number, colorSpace?: keyof ColorSpaces): Color; - (a: number, b: number, c: number, d: number, colorSpace?: string): Color; + (a: number, b: number, c: number, d: number, colorSpace?: keyof ColorSpaces): Color; /** - * Create a color in the specified color space using values. - * - * @param values An array of values (e.g. [r, g, b, a?]). - * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb". - * @return the color object. - */ - (values: number[], colorSpace?: string): Color; + * Create a color in the specified color space using values. + * + * @param values An array of values (e.g. [r, g, b, a?]). + * @param colorSpace The color space to use. Defaults to "rgb". + * @return the color object. + */ + (values: number[], colorSpace?: keyof ColorSpaces): Color; /** * Create a color from a hex or string representation (as supported in CSS). @@ -67,25 +73,43 @@ declare namespace Chroma { rgb(r: number, g: number, b: number): Color; - /** + /** * GL is a variant of RGB(A), with the only difference that the components are normalized to the range of 0..1. - */ + */ gl(red: number, green: number, blue: number, alpha?: number): Color; - /** - * light 2000K, bright sunlight 6000K. Based on Neil Bartlett's implementation. + /** + * Returns a color from the color temperature scale. + * light 2000K, bright sunlight 6000K. + * Based on Neil Bartlett's implementation. * https://github.com/neilbartlett/color-temperature - */ + */ temperature(t: number): Color; - mix(col1: string | Color, col2: string | Color, f?: number, colorSpace?: string): Color; - - interpolate(col1: string | Color, col2: string | Color, f?: number, colorSpace?: string): Color; + /** + * Mixes two colors. The mix ratio is a value between 0 and 1. + * The color mixing produces different results based the color space used for interpolation. + * @example chroma.mix('red', 'blue', 0.25) // => #bf0040 + * @example chroma.mix('red', 'blue', 0.5, 'hsl') // => #ff00ff + */ + mix(color1: string | Color, color2: string | Color, f?: number, colorSpace?: keyof ColorSpaces): Color; /** - * Blends two colors using RGB channel-wise blend functions. Valid blend modes are multiply, darken, lighten, screen, overlay, burn, and dogde. + * Alias for {@see mix}. */ - blend(col1: string, col2: string, blendMode: string): Color; + interpolate(color1: string | Color, color2: string | Color, f?: number, colorSpace?: keyof ColorSpaces): Color; + + /** + * Similar to {@link mix}, but accepts more than two colors. Simple averaging of R,G,B components and the alpha + * channel. + */ + average(colors: Array, colorSpace?: keyof ColorSpaces): Color; + + /** + * Blends two colors using RGB channel-wise blend functions. + */ + blend(color1: string | Color, color2: string | Color, + blendMode: 'multiply' | 'darken' | 'lighten' | 'screen' | 'overlay' | 'burn' | 'dogde'): Color; /** * Returns a random color. @@ -93,19 +117,29 @@ declare namespace Chroma { random(): Color; /** - * Computes the WCAG contrast ratio between two colors. - * A minimum contrast of 4.5:1 is recommended to ensure that text is still readable against a background color. - * - * @param color1 The first color. - * @param color2 The second color. - * @return the contrast ratio. + * Computes the WCAG contrast ratio between two colors. + * A minimum contrast of 4.5:1 is recommended {@link https://www.w3.org/TR/WCAG20-TECHS/G18.html} + * to ensure that text is still readable against a background color. */ - contrast(col1: string | Color, col2: string | Color): number; - - bezier(colors: string[]): Scale; + contrast(color1: string | Color, color2: string | Color): number; /** - * chroma.brewer is an map of ColorBrewer scales that are included in chroma.js for convenience. + * Computes the eucledian distance between two colors in a given color space (default is 'lab'). + * {@link https://en.wikipedia.org/wiki/Euclidean_distance#Three_dimensions} + */ + distance(color1: string | Color, color2: string | Color, colorSpace?: keyof ColorSpaces): Color; + + /** + * Computes color difference {@link https://en.wikipedia.org/wiki/Color_difference#CMC_l:c_.281984.29} as + * developed by the Colour Measurement Committee of the Society of Dyers and Colourists (CMC) in 1984. + * The implementation is adapted from Bruce Lindbloom. + * {@link https://web.archive.org/web/20160306044036/http://www.brucelindbloom.com/javascript/ColorDiff.js} + * The parameters L (default 1) and C (default 1) are weighting factors for lightness and chromacity. + */ + deltaE(color1: string | Color, color2: string | Color, L?: number, C?: number): Color; + + /** + * chroma.brewer is an map of ColorBrewer scales that are included in chroma.js for convenience. * chroma.scale uses the colors to construct. */ brewer: { @@ -147,123 +181,179 @@ declare namespace Chroma { }; /** - * Helper function that computes class breaks for you, based on actual data. - * Supports three different modes: equidistant breaks, quantiles breaks and breaks based on k-means clusting. + * Helper function that computes class breaks based on data. + * Mode: + *
  • equidistant 'e' breaks are computed by dividing the total range of the data into n groups + * of equal size. + *
  • quantile 'q' input domain is divided by quantile ranges. + *
  • logarithmic 'l' breaks are equidistant breaks but on a logarithmic scale. + *
  • k-means 'k' breaks use the 1-dimensional + * [k-means clustering algorithm]{@link https://en.wikipedia.org/wiki/K-means_clustering} to find (roughly) n + * groups of "similar" values. Note that this k-means implementation does not guarantee to find exactly n groups. */ - limits(data: number[], mode: string, c: number): number[]; + limits(data: number[], mode: 'e' | 'q' | 'l' | 'k', c: number): number[]; - scale(name: string): Scale; + /** + * Returns a function that + * [bezier-interpolates]{@link https://www.vis4.net/blog/posts/mastering-multi-hued-color-scales/} between + * colors in Lab space. The input range of the function is [0..1]. + * You can convert it to a scale instance by calling chroma.bezier(...).scale() + */ + bezier(colors: string[]): { (t: number): Color, scale(): Scale}; - scale(colors?: string[]): Scale; + scale(name: string | Color): Scale; + + scale(colors?: Array): Scale; cubehelix(): Cubehelix; cmyk(c: number, m: number, y: number, k: number): Color; - - /** - * Create a color from a hex or string representation (as supported in CSS). - * - * This is an alias of chroma.hex(). - * - * @param color The string to convert to a color. - * @return the color object. - */ - css(col: string, mode?: string): string; + + css(col: string): Color; } - export interface Color { + type Color = { + /** + * Get and set the color opacity. + */ alpha(a?: number): Color; darken(f?: number): Color; brighten(f?: number): Color; + /** + * Changes the saturation of a color by manipulating the Lch chromacity. + */ saturate(s?: number): Color; + /** + * Similar to saturate, but the opposite direction. + */ desaturate(s?: number): Color; + /** + * Changes a single channel and returns the result a new chroma object. + * @example + * // half Lab lightness + * chroma('orangered').set('lab.l', '*0.5') + * @example + * // double Lch saturation + * chroma('darkseagreen').set('lch.c', '*2') + */ set(modechan: string, v: number | string): Color; + /** + * Returns a single channel value. + * @see set + */ get(modechan: string): number; + /** + * Relative brightness, according to the + * [WCAG]{@link http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef} definition. Normalized to + * 0 for darkest black and 1 for lightest white. + */ luminance(): number; - luminance(l: number, mode?: string): Color; + /** + * Set luminance of color. The source color will be interpolated with black or white until the correct luminance is found. + * The color space used defaults to RGB. + */ + luminance(l: number, colorSpace?: keyof ColorSpaces): Color; + /** + * Get color as hexadecimal string. E.g. '#ffa500' + */ hex(): string; + /** + * Returns the named color. Falls back to hexadecimal RGB string, if the color isn't present. + */ name(): string; /** - * Create a color from a hex or string representation (as supported in CSS). - * - * This is an alias of chroma.hex(). - * - * @param color The string to convert to a color. - * @return the color object. + * Returns a RGB() or HSL() string representation that can be used as CSS-color definition. + * mode defaults to 'rgb' */ - css(mode?: string): string; - - rgb(): number[]; - - rgba(): number[]; - - hsl(): number[]; - - hsv(): number[]; - - hsi(): number[]; - - lab(): number[]; - - lch(): number[]; - - hcl(): number[]; + css(mode?: 'hsl'): string; + /** + * Estimate the temperature in Kelvin of any given color, though this makes the only sense for colors from the + * [temperature gradient]{@link ChromaStatic.temperature} above. + */ temperature(): number; + } & { + [K in keyof ColorSpaces]: () => ColorSpaces[K]; + }; - gl(): number[]; - } - - export interface Scale { + interface Scale { (c: string[]): Scale; - (value: number): any; + (value: number): OutType; - domain(d?: number[], n?: number, mode?: string): Scale; + domain(d?: number[], n?: number, mode?: string): this; - mode(mode: string): Scale; + mode(mode: keyof ColorSpaces): this; - correctLightness(enable?: boolean): Scale; + cache(use: boolean): boolean; - bezier(colors: string[]): Scale; + correctLightness(enable?: boolean): this; - padding(p: number | number[]): Scale; + padding(p: number | number[]): this; - colors(c?: number): string[]; + /** + * You can call scale.colors(n) to quickly grab `c` equi-distant colors from a color scale. If called with no + * arguments, scale.colors returns the original array of colors used to create the scale. + */ + colors(c?: number, format?: 'hex' | 'name'): string[]; + colors(c?: number, format?: null | 'alpha' | 'darken' | 'brighten' | 'saturate' | 'desaturate'): Color[]; + colors(c?: number, format?: 'luminance' | 'temperature'): number[]; + colors(c?: number, format?: K): Array; - classes(c: number | number[]): (t: number) => Color; + /** + * If you want the scale function to return a distinct set of colors instead of a continuous gradient, you can + * use scale.classes. If you pass a number the scale will broken into equi-distant classes. + * You can also define custom class breaks by passing them as array + */ + classes(c: number | number[]): this; - range(arg: string[]): Scale; - - scale(): Scale; - - out(mode: string): Scale; + /** + * Set out format for scale() call. Passing null will result in a scale which outputs colors. + */ + out(format: null): Scale; + out(format: K): Scale; } - export interface Cubehelix extends Scale { + interface Cubehelix { + /** + * Set start color for hue rotation, default=300 + */ start(s: number): Cubehelix; + /** + * number (and direction) of hue rotations (e.g. 1=360°, 1.5=`540°``), default=-1.5 + */ rotations(r: number): Cubehelix; + /** + * gamma factor can be used to emphasise low or high intensity values, default=1 + */ gamma(g: number): Cubehelix; + /** + * lightness range: default: [0,1] (black -> white) + */ lightness(l: number[]): Cubehelix; + + /** + * You can call cubehelix.scale() to use the cube-helix through the chroma.scale interface. + */ + scale(): Scale; } } declare var chroma: Chroma.ChromaStatic; -declare module "chroma-js" { - export = chroma; -} +export = chroma; +export as namespace chroma; diff --git a/types/chroma-js/tslint.json b/types/chroma-js/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/chroma-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/ckeditor/index.d.ts b/types/ckeditor/index.d.ts index 518c44ae2a..dc4d27871e 100644 --- a/types/ckeditor/index.d.ts +++ b/types/ckeditor/index.d.ts @@ -77,7 +77,7 @@ declare namespace CKEDITOR { function addCss(css: string): void; function addTemplate(name: string, source: string): template; function appendTo(element: string, config?: config, data?: string): editor; - function appendTo(element: HTMLTextAreaElement, config?: config, data?: string): editor; + function appendTo(element: HTMLElement, config?: config, data?: string): editor; function domReady(): void; function dialogCommand(dialogName: string): void; function editorConfig(config: config): void; diff --git a/types/classnames/classnames-tests.ts b/types/classnames/classnames-tests.ts index 5c99df82eb..1938acb4f9 100644 --- a/types/classnames/classnames-tests.ts +++ b/types/classnames/classnames-tests.ts @@ -1,6 +1,7 @@ -import classNames = require('classnames') +import classNames = require('classnames'); +import * as classNames2 from 'classnames'; -classNames('foo', 'bar'); // => 'foo bar' +classNames2('foo', 'bar'); // => 'foo bar' classNames('foo', 'bar'); // => 'foo bar' classNames('foo', { bar: true }); // => 'foo bar' @@ -21,4 +22,4 @@ classNames(["foo", ["bar", {baz: true}]]); // => 'foo bar baz' classNames(null, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1' // Supporting booleans is tricky since we should only support passing in false, which is ignored -//classNames(false, 'bar', 0, 1, { baz: null }, ''); // => 'bar 1' +// classNames(false, 'bar', 0, 1, { baz: null }, ''); // => 'bar 1' diff --git a/types/classnames/index.d.ts b/types/classnames/index.d.ts index 22d9803399..42352fc9b8 100644 --- a/types/classnames/index.d.ts +++ b/types/classnames/index.d.ts @@ -1,22 +1,25 @@ -// Type definitions for classnames +// Type definitions for classnames 2.2 // Project: https://github.com/JedWatson/classnames -// Definitions by: Dave Keen , Adi Dahiya , Jason Killian +// Definitions by: Dave Keen +// Adi Dahiya +// Jason Killian +// Sean Kelley +// Michal Adamczyk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | false; +type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | false; interface ClassDictionary { [id: string]: boolean | undefined | null; } -interface ClassArray extends Array { } +// This is the only way I found to break circular references between ClassArray and ClassValue +// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540 +interface ClassArray extends Array { } // tslint:disable-line no-empty-interface -interface ClassNamesFn { - (...classes: ClassValue[]): string; -} +type ClassNamesFn = (...classes: ClassValue[]) => string; -declare var classNames: ClassNamesFn; +declare const classNames: ClassNamesFn; -declare module "classnames" { - export = classNames -} +export = classNames; +export as namespace classNames; diff --git a/types/classnames/tslint.json b/types/classnames/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/classnames/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/cli-table2/cli-table2-tests.ts b/types/cli-table2/cli-table2-tests.ts new file mode 100644 index 0000000000..dfaed4ec33 --- /dev/null +++ b/types/cli-table2/cli-table2-tests.ts @@ -0,0 +1,232 @@ +import * as Table from "cli-table2"; + +// Code snippets from README.md + +// Horizontal table +const table1 = new Table({ head: ['TH 1 label', 'TH 2 label'], colWidths: [100, 200] }) as Table.HorizontalTable; +table1.push( + ['First value', 'Second value'], + ['First value', 'Second value'] +); + +// Vertical table +const table2 = new Table() as Table.VerticalTable; +table2.push( + { 'Some key': 'Some value' }, + { 'Another key': 'Another value' } +); + +// Cross table +const table3 = new Table({ head: ["", "Top Header 1", "Top Header 2"] }) as Table.CrossTable; +table3.push( + { 'Left Header 1': ['Value Row 1 Col 1', 'Value Row 1 Col 2'] }, + { 'Left Header 2': ['Value Row 2 Col 1', 'Value Row 2 Col 2'] } +); + +// Custom styles +const table4 = new Table({ + chars: { + top: '═', 'top-mid': '╤', 'top-left': '╔', 'top-right': '╗', + bottom: '═', 'bottom-mid': '╧', 'bottom-left': '╚', 'bottom-right': '╝', + left: '║', 'left-mid': '╟', mid: '─', 'mid-mid': '┼', + right: '║', 'right-mid': '╢', middle: '│' + } +}) as Table.HorizontalTable; +table4.push( + ['foo', 'bar', 'baz'], + ['frob', 'bar', 'quuz'] +); +const table5 = new Table({ chars: { mid: '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' } }) as Table.HorizontalTable; +table5.push( + ['foo', 'bar', 'baz'], + ['frobnicate', 'bar', 'quuz'] +); +const table6 = new Table({ + chars: { + top: '', 'top-mid': '', 'top-left': '', 'top-right': '', + bottom: '', 'bottom-mid': '', 'bottom-left': '', 'bottom-right': '', + left: '', 'left-mid': '', mid: '', 'mid-mid': '', + right: '', 'right-mid': '', middle: ' ' + }, + style: { 'padding-left': 0, 'padding-right': 0 } +}) as Table.HorizontalTable; +table6.push( + ['foo', 'bar', 'baz'], + ['frobnicate', 'bar', 'quuz'] +); + +// Code snippets from basic-usage.md + +// Basic Usage +const table7 = new Table({ head: ['a', 'b'] }) as Table.HorizontalTable; +table7.push(['c', 'd']); + +// Basic Usage - disable colors - (used often in the examples and tests) +const table8 = new Table({ + head: ['Rel', 'Change', 'By', 'When'], + style: { head: [], border: [] }, + colWidths: [6, 21, 25, 17] +}) as Table.HorizontalTable; +table8.push( + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago'], + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'] +); + +// Create vertical tables by adding objects a that specify key-value pairs +const table9 = new Table({ style: { 'padding-left': 0, 'padding-right': 0, head: [], border: [] } }) as Table.VerticalTable; +table9.push( + { 'v0.1': 'Testing something cool' }, + { 'v0.1': 'Testing something cool' } +); + +// Cross tables are similar to vertical tables, but include an empty string for the first header +const table10 = new Table({ + head: ["", "Header 1", "Header 2"], + style: { 'padding-left': 0, 'padding-right': 0, head: [], border: [] } +}) as Table.CrossTable; +table10.push( + { "Header 3": ['v0.1', 'Testing something cool'] }, + { "Header 4": ['v0.1', 'Testing something cool'] } +); + +// Stylize the table with custom border characters +const table11 = new Table({ + chars: { + top: '═', + 'top-mid': '╤', + 'top-left': '╔', + 'top-right': '╗', + bottom: '═', + 'bottom-mid': '╧', + 'bottom-left': '╚', + 'bottom-right': '╝', + left: '║', + 'left-mid': '╟', + right: '║', + 'right-mid': '╢' + }, + style: { head: [], border: [] } +}) as Table.HorizontalTable; +table11.push( + ['foo', 'bar', 'baz'], + ['frob', 'bar', 'quuz'] +); + +// Use ansi colors (i.e. colors.js) to style text within the cells at will, even across multiple lines +const table12 = new Table({ style: { border: [], head: [] } }) as Table.HorizontalTable; +table12.push([ + /*colors.red(*/'Hello\nhow\nare\nyou?'/*)*/, + /*colors.blue(*/'I\nam\nfine\nthanks!'/*)*/ +]); + +// Set wordWrap to true to make lines of text wrap instead of being truncated +const table13 = new Table({ + style: { border: [], head: [] }, + colWidths: [7, 9], + wordWrap: true +}) as Table.HorizontalTable; +table13.push([ + 'Hello how are you?', + 'I am fine thanks!' +]); + +// Code snippets from advanced-usage.md + +// use colSpan to span columns - (colSpan above normal cell) +const table14 = new Table({ style: { head: [], border: [] } }) as Table.HorizontalTable; +table14.push( + [{ colSpan: 2, content: 'greetings' }], + [{ colSpan: 2, content: 'greetings' }], + ['hello', 'howdy'] +); + +// use colSpan to span columns - (colSpan below normal cell) +const table15 = new Table({ style: { head: [], border: [] } }) as Table.HorizontalTable; +table15.push( + ['hello', 'howdy'], + [{ colSpan: 2, content: 'greetings' }], + [{ colSpan: 2, content: 'greetings' }] +); + +// use rowSpan to span rows - (rowSpan on the left side) +const table16 = new Table({ style: { head: [], border: [] } }) as Table.HorizontalTable; +table16.push( + [{ rowSpan: 2, content: 'greetings' }, { rowSpan: 2, content: 'greetings', vAlign: 'center' }, 'hello'], + ['howdy'] +); + +// use rowSpan to span rows - (rowSpan on the right side) +const table17 = new Table({ style: { head: [], border: [] } }) as Table.HorizontalTable; +table17.push( + ['hello', { rowSpan: 2, content: 'greetings' }, { rowSpan: 2, content: 'greetings', vAlign: 'bottom' }], + ['howdy'] +); + +// mix rowSpan and colSpan together for complex table layouts +const table18 = new Table({ style: { head: [], border: [] } }) as Table.HorizontalTable; +table18.push( + [{ content: 'hello', colSpan: 2 }, { rowSpan: 2, colSpan: 2, content: 'sup' }, { rowSpan: 3, content: 'hi' }], + [{ content: 'howdy', colSpan: 2 }], + ['o', 'k', '', ''] +); + +// multi-line content will flow across rows in rowSpan cells +const table19 = new Table({ style: { head: [], border: [] } }) as Table.HorizontalTable; +table19.push( + ['hello', { rowSpan: 2, content: 'greetings\nfriends' }, { rowSpan: 2, content: 'greetings\nfriends' }], + ['howdy'] +); + +// multi-line content will flow across rows in rowSpan cells - (complex layout) +const table20 = new Table({ style: { head: [], border: [] } }) as Table.HorizontalTable; +table20.push( + [{ content: 'hello', colSpan: 2 }, { rowSpan: 2, colSpan: 2, content: 'sup\nman\nhey' }, { rowSpan: 3, content: 'hi\nyo' }], + [{ content: 'howdy', colSpan: 2 }], + ['o', 'k', '', ''] +); + +// rowSpan cells can have a staggered layout +const table21 = new Table({ style: { head: [], border: [] } }) as Table.HorizontalTable; +table21.push( + [{ content: 'a', rowSpan: 2 }, 'b'], + [{ content: 'c', rowSpan: 2 }], + ['d'] +); + +// the layout manager automatically create empty cells to fill in the table +const table22 = new Table({ style: { head: [], border: [] } }) as Table.HorizontalTable; +table22.push( + [{ content: 'a', rowSpan: 3, colSpan: 2 }, 'b'], + [], + [{ content: 'c', rowSpan: 2, colSpan: 2 }], + [] +); + +// use table rowHeights option to fix row height. The truncation symbol will be shown on the last line. +const table23 = new Table({ rowHeights: [2], style: { head: [], border: [] } }) as Table.HorizontalTable; +table23.push(['hello\nhi\nsup']); + +// if colWidths is not specified, the layout manager will automatically widen rows to fit the content +const table24 = new Table({ style: { head: [], border: [] } }) as Table.HorizontalTable; +table24.push( + [{ colSpan: 2, content: 'hello there' }], + ['hi', 'hi'] +); + +// you can specify a column width for only the first row, other rows will be automatically widened to fit content +const table25 = new Table({ colWidths: [4], style: { head: [], border: [] } }) as Table.HorizontalTable; +table25.push( + [{ colSpan: 2, content: 'hello there' }], + ['hi', { hAlign: 'center', content: 'hi' }] +); + +// a column with a null column width will be automatically widened to fit content +const table26 = new Table({ colWidths: [null, 4], style: { head: [], border: [] } }) as Table.HorizontalTable; +table26.push( + [{ colSpan: 2, content: 'hello there' }], + [{ hAlign: 'right', content: 'hi' }, 'hi'] +); + +// feel free to use colors in your content strings, column widths will be calculated correctly +const table27 = new Table({ colWidths: [5], style: { head: [], border: [] } }) as Table.HorizontalTable; +table27.push([/*colors.red(*/'hello'/*)*/]); diff --git a/types/cli-table2/index.d.ts b/types/cli-table2/index.d.ts new file mode 100644 index 0000000000..46d4619162 --- /dev/null +++ b/types/cli-table2/index.d.ts @@ -0,0 +1,101 @@ +// Type definitions for cli-table2 0.2 +// Project: https://github.com/jamestalmage/cli-table2 +// Definitions by: Melvin Groenhoff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare namespace CliTable2 { + type CharName = + "top" | + "top-mid" | + "top-left" | + "top-right" | + "bottom" | + "bottom-mid" | + "bottom-left" | + "bottom-right" | + "left" | + "left-mid" | + "mid" | + "mid-mid" | + "right" | + "right-mid" | + "middle"; + + type HorizontalAlignment = "left" | "center" | "right"; + type VerticalAlignment = "top" | "center" | "bottom"; + + interface TableOptions { + truncate: string; + colWidths: Array; + rowHeights: Array; + colAligns: HorizontalAlignment[]; + rowAligns: VerticalAlignment[]; + head: string[]; + wordWrap: boolean; + } + + interface TableInstanceOptions extends TableOptions { + chars: Record; + style: { + "padding-left": number; + "padding-right": number; + head: string[]; + border: string[]; + compact: boolean; + }; + } + + interface TableConstructorOptions extends Partial { + chars?: Partial>; + style?: Partial; + } + + type CellValue = boolean | number | string | null | undefined; + + interface CellOptions { + content: CellValue; + chars?: Partial>; + truncate?: string; + colSpan?: number; + rowSpan?: number; + hAlign?: HorizontalAlignment; + vAlign?: VerticalAlignment; + style?: { + "padding-left"?: number; + "padding-right"?: number; + head?: string[]; + border?: string[]; + }; + } + + interface GenericTable extends Array { + options: CliTable2.TableInstanceOptions; + readonly width: number; + } + + type Table = HorizontalTable | VerticalTable | CrossTable; + type Cell = CellValue | CellOptions; + + type HorizontalTable = GenericTable; + type HorizontalTableRow = Cell[]; + + type VerticalTable = GenericTable; + interface VerticalTableRow { + [name: string]: Cell; + } + + type CrossTable = GenericTable; + interface CrossTableRow { + [name: string]: Cell[]; + } +} + +interface CliTable2 { + new (options?: CliTable2.TableConstructorOptions): CliTable2.Table; + readonly prototype: CliTable2.Table; +} + +declare const CliTable2: CliTable2; + +export = CliTable2; diff --git a/types/path-to-regexp/tsconfig.json b/types/cli-table2/tsconfig.json similarity index 84% rename from types/path-to-regexp/tsconfig.json rename to types/cli-table2/tsconfig.json index bee259111e..e816ba5105 100644 --- a/types/path-to-regexp/tsconfig.json +++ b/types/cli-table2/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -17,6 +17,6 @@ }, "files": [ "index.d.ts", - "path-to-regexp-tests.ts" + "cli-table2-tests.ts" ] } \ No newline at end of file diff --git a/types/cli-table2/tslint.json b/types/cli-table2/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/cli-table2/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/clipboard/clipboard-tests.ts b/types/clipboard/clipboard-tests.ts index 23de4c89e6..361ccddd93 100644 --- a/types/clipboard/clipboard-tests.ts +++ b/types/clipboard/clipboard-tests.ts @@ -16,6 +16,7 @@ const cb5 = new Clipboard('.btn', { }); cb1.destroy(); +cb1.isSupported(); cb2.on('success', e => { console.info('Action:', e.action); diff --git a/types/clipboard/index.d.ts b/types/clipboard/index.d.ts index 861d8c326b..0aa51518dd 100644 --- a/types/clipboard/index.d.ts +++ b/types/clipboard/index.d.ts @@ -18,6 +18,11 @@ declare class Clipboard { * Clears all event bindings. */ destroy(): void; + + /** + * Checks if clipboard.js is supported + */ + isSupported(): boolean; } declare namespace Clipboard { diff --git a/types/cloud-env/cloud-env-tests.ts b/types/cloud-env/cloud-env-tests.ts new file mode 100644 index 0000000000..64cbadd7f0 --- /dev/null +++ b/types/cloud-env/cloud-env-tests.ts @@ -0,0 +1,9 @@ +import * as cloudEnv from 'cloud-env'; + +if (cloudEnv.get('IP', '0.0.0.0') !== '0.0.0.0') { + throw new Error(`cloudEnv.get: expected value 0.0.0.0, but actually received value ${cloudEnv.get('IP', '0.0.0.0')}`); +} + +if (!(cloudEnv.defaults instanceof Object)) { + throw new Error(`cloudEnv.defaults: expected value of defaults be an instance of Object, but it was actually an instance of another class: ${typeof cloudEnv.defaults}`); +} diff --git a/types/cloud-env/index.d.ts b/types/cloud-env/index.d.ts new file mode 100644 index 0000000000..daec09022f --- /dev/null +++ b/types/cloud-env/index.d.ts @@ -0,0 +1,51 @@ +// Type definitions for cloud-env 0.2.2 +// Project: https://github.com/ryanj/cloud-env +// Definitions by: Ben Davies +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare interface DefaultSettings { + PORT?: number; + IP?: string; + HOSTNAME?: string; + APP_NAME?: string; + MONGODB_DB_URL?: string; + MONGODB_DB_HOST?: string; + MONGODB_DB_PORT?: number; + MONGODB_DB_USERNAME?: string; + MONGODB_DB_PASSWORD?: string; + POSTGRESQL_DB_URL?: string; + POSTGRESQL_DB_HOST?: string; + POSTGRESQL_DB_PORT?: number; + POSTGRESQL_DB_USERNAME?: string; + POSTGRESQL_DB_PASSWORD?: string; + MYSQL_DB_URL?: string; + MYSQL_DB_HOST?: string; + MYSQL_DB_PORT?: number; + MYSQL_DB_USERNAME?: string; + MYSQL_DB_PASSWORD?: string; +} + +declare type MaybeNum = number | void; +declare type MaybeStr = string | void; + +export const get: (key: string, default_key?: string) => MaybeStr; +export const defaults: { [key: string]: DefaultSettings; }; +export const PORT: MaybeNum; +export const IP: MaybeStr; +export const HOSTNAME: MaybeStr; +export const APP_NAME: MaybeStr; +export const MONGODB_DB_URL: MaybeStr; +export const MONGODB_DB_HOST: MaybeStr; +export const MONGODB_DB_PORT: MaybeNum; +export const MONGODB_DB_USERNAME: MaybeStr; +export const MONGODB_DB_PASSWORD: MaybeStr; +export const POSTGRESQL_DB_URL: MaybeStr; +export const POSTGRESQL_DB_HOST: MaybeStr; +export const POSTGRESQL_DB_PORT: MaybeNum; +export const POSTGRESQL_DB_USERNAME: MaybeStr; +export const POSTGRESQL_DB_PASSWORD: MaybeStr; +export const MYSQL_DB_URL: MaybeStr; +export const MYSQL_DB_HOST: MaybeStr; +export const MYSQL_DB_PORT: MaybeNum; +export const MYSQL_DB_USERNAME: MaybeStr; +export const MYSQL_DB_PASSWORD: MaybeStr; diff --git a/types/cloud-env/tsconfig.json b/types/cloud-env/tsconfig.json new file mode 100644 index 0000000000..e6a1323629 --- /dev/null +++ b/types/cloud-env/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cloud-env-tests.ts" + ] +} diff --git a/types/codemirror/index.d.ts b/types/codemirror/index.d.ts index d0b2dd6511..9a74dc1e53 100644 --- a/types/codemirror/index.d.ts +++ b/types/codemirror/index.d.ts @@ -178,7 +178,7 @@ declare namespace CodeMirror { /** Remove a CSS class from a line.line can be a line handle or number. where should be one of "text", "background", or "wrap"(see addLineClass). class can be left off to remove all classes for the specified node, or be a string to remove only a specific class. */ - removeLineClass(line: any, where: string, class_: string): CodeMirror.LineHandle; + removeLineClass(line: any, where: string, class_?: string): CodeMirror.LineHandle; /** * Compute the line at the given pixel height. @@ -439,7 +439,7 @@ declare namespace CodeMirror { /** Replace the part of the document between from and to with the given string. from and to must be {line, ch} objects. to can be left off to simply insert the string at position from. */ - replaceRange(replacement: string, from: CodeMirror.Position, to?: CodeMirror.Position): void; + replaceRange(replacement: string, from: CodeMirror.Position, to?: CodeMirror.Position, origin?: string): void; /** Get the content of line n. */ getLine(n: number): string; diff --git a/types/color/color-tests.ts b/types/color/color-tests.ts index fb561d4ad1..2d05e86f05 100644 --- a/types/color/color-tests.ts +++ b/types/color/color-tests.ts @@ -3,6 +3,7 @@ import * as Color from "color" var color: Color.Color = Color("white") var colorOther: Color.Color = Color("black") var colorRGB: Color.Color = Color({ r : 0, g : 0, b : 0 }, "rgb") +var colorInt: Color.Color = Color(0x000000) var hex: string = color.hex() var percent: string = color.percentString() @@ -59,3 +60,4 @@ var chain: Color.Color = color .opaquer(0) .rotate(0) .mix(colorOther, 0) + .hsl(); diff --git a/types/color/index.d.ts b/types/color/index.d.ts index 0b7b505c01..a9fc18f29a 100644 --- a/types/color/index.d.ts +++ b/types/color/index.d.ts @@ -5,7 +5,7 @@ declare namespace Color { - type ColorParam = string | { [param: string]: number }; + type ColorParam = string | { [param: string]: number } | number; type ColorModel = "rgb" | "hsl" | "hsv" | "hwb" | "hcg" | "cmyk" | "xyz" | "lab" | "hex" | "gray" | "keyword"; @@ -67,6 +67,13 @@ declare namespace Color { hex(color: string): Color; hex(): string; rgb(): Color; + hsl(): Color; + hsv(): Color; + hwb(): Color; + hcg(): Color; + cmyk(): Color; + xyz(): Color; + lab(): Color; rgbNumber(): number; luminosity(): number; contrast(color: Color): number; @@ -85,6 +92,7 @@ declare namespace Color { opaquer(value: number): Color; rotate(value: number): Color; mix(color: Color, value?: number): Color; + hsl(): Color; } } diff --git a/types/combine-source-map/combine-source-map-tests.ts b/types/combine-source-map/combine-source-map-tests.ts new file mode 100644 index 0000000000..70f426d7ce --- /dev/null +++ b/types/combine-source-map/combine-source-map-tests.ts @@ -0,0 +1,12 @@ +import combine = require("combine-source-map"); + +const sourcemap = combine.create(); + +sourcemap.addFile({ sourceFile: "file.js", source: "return 123" }) + .addFile({ sourceFile: "source.js", source: "return 'abc'" }); + +const res: string = sourcemap.base64(); + +const res2 = sourcemap.comment(); + +combine.removeComments("(123 | 'abc') // #sourceMappingURL=file.js.map"); diff --git a/types/combine-source-map/index.d.ts b/types/combine-source-map/index.d.ts new file mode 100644 index 0000000000..43f1c994b0 --- /dev/null +++ b/types/combine-source-map/index.d.ts @@ -0,0 +1,59 @@ +// Type definitions for combine-source-map 0.8 +// Project: https://github.com/thlorenz/combine-source-map +// Definitions by: TeamworkGuy2 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** Add source maps of multiple files, offset them and then combine them into one source map. + * (documentation based on project's README file) + */ +declare class Combiner { + constructor(file?: string, sourceRoot?: string); + + /** Adds map to underlying source map. + * If source contains a source map comment that has the source of the original file inlined it will offset these + * mappings and include them. + * If no source map comment is found or it has no source inlined, mappings for the file will be generated and included + * @param opts the 'sourceFile' path/name and the file's 'source' contents + * @param offset the source file 'line' number and 'column' number offsets + */ + addFile(opts: { sourceFile: string; source: string }, offset?: Combiner.Offset): Combiner; + + /** output the combined source map in base64 format + * @return base64 encoded combined source map + */ + base64(): string; + + /** generate a base64 encoded sourceMappingURL comment + * @return base64 encoded sourceMappingUrl comment of the combined source map + */ + comment(): string; + + _addGeneratedMap(sourceFile: string, source: string, offset?: Combiner.Offset): Combiner; + + _addExistingMap(sourceFile: string, source: string, existingMap: any, offset?: Combiner.Offset): Combiner; +} + +declare namespace Combiner { + /** An offset line and column number */ + interface Offset { + line?: number; + column?: number; + } + + /** Create a source map combiner that accepts multiple files, offsets them and then combines them into one source map. + * @param file optional name of the generated file + * @param sourceRoot optional sourceRoot of the map to be generated + * @return Combiner instance to which source maps can be added and later combined + */ + function create(file?: string, sourceRoot?: string): Combiner; + + /** removeComments + * @param src + * @return src with all sourceMappingUrl comments removed + */ + function removeComments(src: string): string; +} + +export = Combiner; + +export as namespace Combiner; diff --git a/types/express-validator/tsconfig.json b/types/combine-source-map/tsconfig.json similarity index 84% rename from types/express-validator/tsconfig.json rename to types/combine-source-map/tsconfig.json index cd9c9145d7..8ee6b85743 100644 --- a/types/express-validator/tsconfig.json +++ b/types/combine-source-map/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -17,6 +17,6 @@ }, "files": [ "index.d.ts", - "express-validator-tests.ts" + "combine-source-map-tests.ts" ] } \ No newline at end of file diff --git a/types/combine-source-map/tslint.json b/types/combine-source-map/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/combine-source-map/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/commander/commander-tests.ts b/types/commander/commander-tests.ts index fe09be7b34..259b107bbf 100644 --- a/types/commander/commander-tests.ts +++ b/types/commander/commander-tests.ts @@ -1,5 +1,11 @@ -// NOTE: import statement can not use in TypeScript 1.0.1 -import program = require('commander'); +import * as program from "commander"; + +interface ExtendedOptions extends program.CommandOptions { + isNew: any; +} + +const commandInstance = new program.Command("-f"); +const optionsInstance = new program.Option("-f"); program .version('0.0.1') @@ -54,7 +60,6 @@ console.log(' collect: %j', program['collect']); console.log(' verbosity: %j', program['verbose']); console.log(' args: %j', program['args']); - program .version('0.0.1') .option('-f, --foo', 'enable some foo') diff --git a/types/commander/index.d.ts b/types/commander/index.d.ts index 675ece0417..017495784a 100644 --- a/types/commander/index.d.ts +++ b/types/commander/index.d.ts @@ -5,6 +5,267 @@ /// +declare class Option { + flags: string; + required: boolean; + optional: boolean; + bool: boolean; + short?: string; + long: string; + description: string; + + /** + * Initialize a new `Option` with the given `flags` and `description`. + * + * @param {string} flags + * @param {string} [description] + */ + constructor(flags: string, description?: string); +} + +declare class Command extends NodeJS.EventEmitter { + [key: string]: any; + + args: string[]; + + /** + * Initialize a new `Command`. + * + * @param {string} [name] + */ + constructor(name?: string); + + /** + * Set the program version to `str`. + * + * This method auto-registers the "-V, --version" flag + * which will print the version number when passed. + * + * @param {string} str + * @param {string} [flags] + * @returns {Command} for chaining + */ + version(str: string, flags?: string): Command; + + /** + * Add command `name`. + * + * The `.action()` callback is invoked when the + * command `name` is specified via __ARGV__, + * and the remaining arguments are applied to the + * function for access. + * + * When the `name` is "*" an un-matched command + * will be passed as the first arg, followed by + * the rest of __ARGV__ remaining. + * + * @example + * program + * .version('0.0.1') + * .option('-C, --chdir ', 'change the working directory') + * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') + * .option('-T, --no-tests', 'ignore test hook') + * + * program + * .command('setup') + * .description('run remote setup commands') + * .action(function() { + * console.log('setup'); + * }); + * + * program + * .command('exec ') + * .description('run the given remote command') + * .action(function(cmd) { + * console.log('exec "%s"', cmd); + * }); + * + * program + * .command('teardown [otherDirs...]') + * .description('run teardown commands') + * .action(function(dir, otherDirs) { + * console.log('dir "%s"', dir); + * if (otherDirs) { + * otherDirs.forEach(function (oDir) { + * console.log('dir "%s"', oDir); + * }); + * } + * }); + * + * program + * .command('*') + * .description('deploy the given env') + * .action(function(env) { + * console.log('deploying "%s"', env); + * }); + * + * program.parse(process.argv); + * + * @param {string} name + * @param {string} [desc] for git-style sub-commands + * @param {CommandOptions} [opts] command options + * @returns {Command} the new command + */ + command(name: string, desc?: string, opts?: commander.CommandOptions): Command; + + /** + * Define argument syntax for the top-level command. + * + * @param {string} desc + * @returns {Command} for chaining + */ + arguments(desc: string): Command; + + /** + * Parse expected `args`. + * + * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. + * + * @param {string[]} args + * @returns {Command} for chaining + */ + parseExpectedArgs(args: string[]): Command; + /** + * Register callback `fn` for the command. + * + * @example + * program + * .command('help') + * .description('display verbose help') + * .action(function() { + * // output help here + * }); + * + * @param {(...args: any[]) => void} fn + * @returns {Command} for chaining + */ + action(fn: (...args: any[]) => void): Command; + + /** + * Define option with `flags`, `description` and optional + * coercion `fn`. + * + * The `flags` string should contain both the short and long flags, + * separated by comma, a pipe or space. The following are all valid + * all will output this way when `--help` is used. + * + * "-p, --pepper" + * "-p|--pepper" + * "-p --pepper" + * + * @example + * // simple boolean defaulting to false + * program.option('-p, --pepper', 'add pepper'); + * + * --pepper + * program.pepper + * // => Boolean + * + * // simple boolean defaulting to true + * program.option('-C, --no-cheese', 'remove cheese'); + * + * program.cheese + * // => true + * + * --no-cheese + * program.cheese + * // => false + * + * // required argument + * program.option('-C, --chdir ', 'change the working directory'); + * + * --chdir /tmp + * program.chdir + * // => "/tmp" + * + * // optional argument + * program.option('-c, --cheese [type]', 'add cheese [marble]'); + * + * @param {string} flags + * @param {string} [description] + * @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default + * @param {*} [defaultValue] + * @returns {Command} for chaining + */ + option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command; + option(flags: string, description?: string, defaultValue?: any): Command; + + /** + * Allow unknown options on the command line. + * + * @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options. + * @returns {Command} for chaining + */ + allowUnknownOption(arg?: boolean): Command; + + /** + * Parse `argv`, settings options and invoking commands when defined. + * + * @param {string[]} argv + * @returns {Command} for chaining + */ + parse(argv: string[]): Command; + + /** + * Parse options from `argv` returning `argv` void of these options. + * + * @param {string[]} argv + * @returns {ParseOptionsResult} + */ + parseOptions(argv: string[]): commander.ParseOptionsResult; + + /** + * Return an object containing options as key-value pairs + * + * @returns {{[key: string]: string}} + */ + opts(): { [key: string]: string }; + + /** + * Set the description to `str`. + * + * @param {string} str + * @return {(Command | string)} + */ + description(str: string): Command; + description(): string; + + /** + * Set an alias for the command. + * + * @param {string} alias + * @return {(Command | string)} + */ + alias(alias: string): Command; + alias(): string; + + /** + * Set or get the command usage. + * + * @param {string} str + * @return {(Command | string)} + */ + usage(str: string): Command; + usage(): string; + + /** + * Get the name of the command. + * + * @return {string} + */ + name(): string; + + /** + * Output help information for this command. + * + * @param {() => void} [cb] Callback method + */ + outputHelp(cb?: () => void): void; + + /** Output help information and exit. */ + help(): void; +} + declare namespace commander { interface CommandOptions { @@ -17,266 +278,14 @@ declare namespace commander { unknown: string[]; } - class Option { - flags: string; - required: boolean; - optional: boolean; - bool: boolean; - short?: string; - long: string; - description: string; - - /** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {string} flags - * @param {string} [description] - */ - constructor(flags: string, description?: string); + interface CommanderStatic extends Command { + Command: typeof Command; + Option: typeof Option; + CommandOptions: CommandOptions; + ParseOptionsResult: ParseOptionsResult; } - class Command extends NodeJS.EventEmitter { - args: string[]; - - /** - * Initialize a new `Command`. - * - * @param {string} [name] - */ - constructor(name?: string); - - /** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {string} str - * @param {string} [flags] - * @returns {Command} for chaining - */ - version(str: string, flags?: string): Command; - - /** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * @example - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function() { - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd) { - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('teardown [otherDirs...]') - * .description('run teardown commands') - * .action(function(dir, otherDirs) { - * console.log('dir "%s"', dir); - * if (otherDirs) { - * otherDirs.forEach(function (oDir) { - * console.log('dir "%s"', oDir); - * }); - * } - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env) { - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {string} name - * @param {string} [desc] for git-style sub-commands - * @param {CommandOptions} [opts] command options - * @returns {Command} the new command - */ - command(name: string, desc?: string, opts?: CommandOptions): Command; - - - /** - * Define argument syntax for the top-level command. - * - * @param {string} desc - * @returns {Command} for chaining - */ - arguments(desc: string): Command; - - /** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {string[]} args - * @returns {Command} for chaining - */ - parseExpectedArgs(args: string[]): Command; - /** - * Register callback `fn` for the command. - * - * @example - * program - * .command('help') - * .description('display verbose help') - * .action(function() { - * // output help here - * }); - * - * @param {(...args: any[]) => void} fn - * @returns {Command} for chaining - */ - action(fn: (...args: any[]) => void): Command; - - /** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - *@example - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to true - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => false - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {string} flags - * @param {string} [description] - * @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default - * @param {*} [defaultValue] - * @returns {Command} for chaining - */ - option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command; - option(flags: string, description?: string, defaultValue?: any): Command; - - /** - * Allow unknown options on the command line. - * - * @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options. - * @returns {Command} for chaining - */ - allowUnknownOption(arg?: boolean): Command; - - /** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {string[]} argv - * @returns {Command} for chaining - */ - parse(argv: string[]): Command; - - /** - * Parse options from `argv` returning `argv` void of these options. - * - * @param {string[]} argv - * @returns {ParseOptionsResult} - */ - parseOptions(argv: string[]): ParseOptionsResult; - - /** - * Return an object containing options as key-value pairs - * - * @returns {{[key: string]: string}} - */ - opts(): { [key: string]: string }; - - /** - * Set the description to `str`. - * - * @param {string} str - * @return {(Command | string)} - */ - description(str: string): Command; - description(): string; - - /** - * Set an alias for the command. - * - * @param {string} alias - * @return {(Command | string)} - */ - alias(alias: string): Command; - alias(): string; - - /** - * Set or get the command usage. - * - * @param {string} str - * @return {(Command | string)} - */ - usage(str: string): Command; - usage(): string; - - /** - * Get the name of the command. - * - * @return {string} - */ - name(): string; - - /** - * Output help information for this command. - * - * @param {() => void} [cb] Callback method - */ - outputHelp(cb?: () => void): void; - - /** Output help information and exit. */ - help(): void; - } } -declare var command: commander.Command & commander.Option & { [key: string]: any }; -export = command; +declare const commander: commander.CommanderStatic; +export = commander; diff --git a/types/connect-history-api-fallback/connect-history-api-fallback-tests.ts b/types/connect-history-api-fallback/connect-history-api-fallback-tests.ts new file mode 100644 index 0000000000..382e436366 --- /dev/null +++ b/types/connect-history-api-fallback/connect-history-api-fallback-tests.ts @@ -0,0 +1,64 @@ +import * as historyApiFallback from 'connect-history-api-fallback'; + +import * as express from "express"; + +const app = express(); +app.use(historyApiFallback()); + +historyApiFallback({ + verbose: true +}); + +historyApiFallback({ + logger: console.log.bind(console) +}); + +historyApiFallback({ + rewrites: [ + { from: /\/soccer/, to: '/soccer.html' } + ] +}); + +historyApiFallback({ + index: 'default.html' +}); + +historyApiFallback({ + htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'] +}); + +historyApiFallback({ + rewrites: [ + { + from: /^\/libs\/(.*)$/, + to(context) { + return './bower_components' + context.parsedUrl.pathname; + } + } + ] +}); + +historyApiFallback({ + rewrites: [ + { + from: /\/app\/login/, + to: function onMatch(ctx) { + if (ctx.parsedUrl.path && ctx.parsedUrl.path.indexOf('.js')) { + return ctx.parsedUrl.href || ''; + } + return '/app/login/index.html'; + } + } + ] +}); + +historyApiFallback({ + rewrites: [ + { + from: /^\/libs\/(.*)$/, + to(context) { + return '/' + context.match[2] + '/' + context.match[3]; + } + } + ] +}); diff --git a/types/connect-history-api-fallback/index.d.ts b/types/connect-history-api-fallback/index.d.ts new file mode 100644 index 0000000000..9cd77ac174 --- /dev/null +++ b/types/connect-history-api-fallback/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for connect-history-api-fallback 1.3 +// Project: https://github.com/bripkens/connect-history-api-fallback#readme +// Definitions by: Douglas Duteil +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { Url } from 'url'; + +import * as core from "express-serve-static-core"; + +declare function historyApiFallback(options?: Options): core.RequestHandler; +declare namespace historyApiFallback {} +export = historyApiFallback; + +interface Options { + disableDotRule?: true; + htmlAcceptHeaders?: string[]; + index?: string; + logger?: typeof console.log; + rewrites?: Rewrite[]; + verbose?: boolean; +} + +interface Context { + match: RegExpMatchArray; + parsedUrl: Url; +} +type RewriteTo = (context: Context) => string; + +interface Rewrite { + from: RegExp; + to: string | RegExp | RewriteTo; +} diff --git a/types/connect-history-api-fallback/tsconfig.json b/types/connect-history-api-fallback/tsconfig.json new file mode 100644 index 0000000000..124c7dc340 --- /dev/null +++ b/types/connect-history-api-fallback/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "connect-history-api-fallback-tests.ts" + ] +} diff --git a/types/connect-history-api-fallback/tslint.json b/types/connect-history-api-fallback/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/connect-history-api-fallback/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/connect-mongo/index.d.ts b/types/connect-mongo/index.d.ts index b469d08d00..0b7443f7e1 100644 --- a/types/connect-mongo/index.d.ts +++ b/types/connect-mongo/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/kcbanner/connect-mongo // Definitions by: Mizuki Yamamoto // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/consolidate/consolidate-tests.ts b/types/consolidate/consolidate-tests.ts index 06239710c0..c4bbe207c8 100644 --- a/types/consolidate/consolidate-tests.ts +++ b/types/consolidate/consolidate-tests.ts @@ -4,133 +4,136 @@ import cons = require('consolidate'); var path: string = 'test/path'; var options = {user: 'tobi'}; var fn = function(err: Error, html: string) {}; +(async () => { + let res: string; -cons.atpl(path); -cons.atpl(path, options); -cons.atpl(path, options, fn); + res = await cons.atpl(path); + res = await cons.atpl(path, options); + cons.atpl(path, options, fn); -cons.dot(path); -cons.dot(path, options); -cons.dot(path, options, fn); + res = await cons.dot(path); + res = await cons.dot(path, options); + cons.dot(path, options, fn); -cons.dust(path); -cons.dust(path, options); -cons.dust(path, options, fn); + res = await cons.dust(path); + res = await cons.dust(path, options); + cons.dust(path, options, fn); -cons.eco(path); -cons.eco(path, options); -cons.eco(path, options, fn); + res = await cons.eco(path); + res = await cons.eco(path, options); + cons.eco(path, options, fn); -cons.ect(path); -cons.ect(path, options); -cons.ect(path, options, fn); + res = await cons.ect(path); + res = await cons.ect(path, options); + cons.ect(path, options, fn); -cons.ejs(path); -cons.ejs(path, options); -cons.ejs(path, options, fn); + res = await cons.ejs(path); + res = await cons.ejs(path, options); + cons.ejs(path, options, fn); -cons.haml(path); -cons.haml(path, options); -cons.haml(path, options, fn); + res = await cons.haml(path); + res = await cons.haml(path, options); + cons.haml(path, options, fn); -// TODO figure out how to type haml-coffee -// cons['haml-coffee'](path, options, fn); + // TODO figure out how to type haml-coffee + // cons['haml-coffee'](path, options, fn); -cons.hamlet(path); -cons.hamlet(path, options); -cons.hamlet(path, options, fn); + res = await cons.hamlet(path); + res = await cons.hamlet(path, options); + cons.hamlet(path, options, fn); -cons.handlebars(path); -cons.handlebars(path, options); -cons.handlebars(path, options, fn); + res = await cons.handlebars(path); + res = await cons.handlebars(path, options); + cons.handlebars(path, options, fn); -cons.hogan(path); -cons.hogan(path, options); -cons.hogan(path, options, fn); + res = await cons.hogan(path); + res = await cons.hogan(path, options); + cons.hogan(path, options, fn); -cons.htmling(path); -cons.htmling(path, options); -cons.htmling(path, options, fn); + res = await cons.htmling(path); + res = await cons.htmling(path, options); + cons.htmling(path, options, fn); -cons.jade(path); -cons.jade(path, options); -cons.jade(path, options, fn); + res = await cons.jade(path); + res = await cons.jade(path, options); + cons.jade(path, options, fn); -cons.jazz(path); -cons.jazz(path, options); -cons.jazz(path, options, fn); + res = await cons.jazz(path); + res = await cons.jazz(path, options); + cons.jazz(path, options, fn); -cons.jqtpl(path); -cons.jqtpl(path, options); -cons.jqtpl(path, options, fn); + res = await cons.jqtpl(path); + res = await cons.jqtpl(path, options); + cons.jqtpl(path, options, fn); -cons.just(path); -cons.just(path, options); -cons.just(path, options, fn); + res = await cons.just(path); + res = await cons.just(path, options); + cons.just(path, options, fn); -cons.liquid(path); -cons.liquid(path, options); -cons.liquid(path, options, fn); + res = await cons.liquid(path); + res = await cons.liquid(path, options); + cons.liquid(path, options, fn); -cons.liquor(path); -cons.liquor(path, options); -cons.liquor(path, options, fn); + res = await cons.liquor(path); + res = await cons.liquor(path, options); + cons.liquor(path, options, fn); -cons.lodash(path); -cons.lodash(path, options); -cons.lodash(path, options, fn); + res = await cons.lodash(path); + res = await cons.lodash(path, options); + cons.lodash(path, options, fn); -cons.mote(path); -cons.mote(path, options); -cons.mote(path, options, fn); + res = await cons.mote(path); + res = await cons.mote(path, options); + cons.mote(path, options, fn); -cons.mustache(path); -cons.mustache(path, options); -cons.mustache(path, options, fn); + res = await cons.mustache(path); + res = await cons.mustache(path, options); + cons.mustache(path, options, fn); -cons.nunjucks(path); -cons.nunjucks(path, options); -cons.nunjucks(path, options, fn); + res = await cons.nunjucks(path); + res = await cons.nunjucks(path, options); + cons.nunjucks(path, options, fn); -cons.pug(path); -cons.pug(path, options); -cons.pug(path, options, fn); + res = await cons.pug(path); + res = await cons.pug(path, options); + cons.pug(path, options, fn); -cons.qejs(path); -cons.qejs(path, options); -cons.qejs(path, options, fn); + res = await cons.qejs(path); + res = await cons.qejs(path, options); + cons.qejs(path, options, fn); -cons.ractive(path); -cons.ractive(path, options); -cons.ractive(path, options, fn); + res = await cons.ractive(path); + res = await cons.ractive(path, options); + cons.ractive(path, options, fn); -cons.react(path); -cons.react(path, options); -cons.react(path, options, fn); + res = await cons.react(path); + res = await cons.react(path, options); + cons.react(path, options, fn); -cons.swig(path); -cons.swig(path, options); -cons.swig(path, options, fn); + res = await cons.swig(path); + res = await cons.swig(path, options); + cons.swig(path, options, fn); -cons.templayed(path); -cons.templayed(path, options); -cons.templayed(path, options, fn); + res = await cons.templayed(path); + res = await cons.templayed(path, options); + cons.templayed(path, options, fn); -cons.toffee(path); -cons.toffee(path, options); -cons.toffee(path, options, fn); + res = await cons.toffee(path); + res = await cons.toffee(path, options); + cons.toffee(path, options, fn); -cons.underscore(path); -cons.underscore(path, options); -cons.underscore(path, options, fn); + res = await cons.underscore(path); + res = await cons.underscore(path, options); + cons.underscore(path, options, fn); -cons.walrus(path); -cons.walrus(path, options); -cons.walrus(path, options, fn); + res = await cons.walrus(path); + res = await cons.walrus(path, options); + cons.walrus(path, options, fn); -cons.whiskers(path); -cons.whiskers(path, options); -cons.whiskers(path, options, fn); + res = await cons.whiskers(path); + res = await cons.whiskers(path, options); + cons.whiskers(path, options, fn); +})(); /** * Examples from documentation diff --git a/types/consolidate/index.d.ts b/types/consolidate/index.d.ts index 454d13263f..2a0adb1db9 100644 --- a/types/consolidate/index.d.ts +++ b/types/consolidate/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for consolidate // Project: https://github.com/visionmedia/consolidate.js -// Definitions by: Carlos Ballesteros Velasco , Theo Sherry +// Definitions by: Carlos Ballesteros Velasco , Theo Sherry , Nicolas Henry // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Imported from: https://github.com/soywiz/typescript-node-definitions/consolidate.d.ts @@ -61,15 +61,15 @@ interface Consolidate { } interface RendererInterface { - render(path: String, fn: (err: Error, html: String) => any): any; + render(path: string, fn: (err: Error, html: string) => any): any; - render(path: String, options: { cache?: boolean, [otherOptions: string]: any }, fn: (err: Error, html: String) => any): any; + render(path: string, options: { cache?: boolean, [otherOptions: string]: any }, fn: (err: Error, html: string) => any): any; - render(path: String, options?: { cache?: boolean, [otherOptions: string]: any }): Promise; + render(path: string, options?: { cache?: boolean, [otherOptions: string]: any }): Promise; - (path: String, fn: (err: Error, html: String) => any): any; + (path: string, fn: (err: Error, html: string) => any): any; - (path: String, options: { cache?: boolean, [otherOptions: string]: any }, fn: (err: Error, html: String) => any): any; + (path: string, options: { cache?: boolean, [otherOptions: string]: any }, fn: (err: Error, html: string) => any): any; - (path: String, options?: { cache?: boolean, [otherOptions: string]: any }): Promise; + (path: string, options?: { cache?: boolean, [otherOptions: string]: any }): Promise; } diff --git a/types/consolidate/tsconfig.json b/types/consolidate/tsconfig.json index a7ae476c88..c03c07a3a9 100644 --- a/types/consolidate/tsconfig.json +++ b/types/consolidate/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "module": "commonjs", + "target": "es6", "lib": [ "es6" ], @@ -19,4 +20,4 @@ "index.d.ts", "consolidate-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/convict/convict-tests.ts b/types/convict/convict-tests.ts index a61c27bdad..3bc0b4565f 100644 --- a/types/convict/convict-tests.ts +++ b/types/convict/convict-tests.ts @@ -105,6 +105,18 @@ conf.loadFile(['./configs/always.json', './configs/sometimes.json']); // perform validation conf.validate({ strict: true }); +conf.validate({ allowed: 'strict' }); +conf.validate({ allowed: 'warn' }); + +// Chaining + +conf + .loadFile(['./configs/always.json', './configs/sometimes.json']) + .loadFile('./config/' + env + '.json') + .load({ jsonKey: 'jsonValue' }) + .set('key', 'value') + .validate({ allowed: 'warn' }) + .toString(); var port: number = conf.default('port'); @@ -117,6 +129,7 @@ if (conf.has('key')) { }); } +conf.get(); conf.getSchema(); conf.getProperties(); conf.getSchemaString(); diff --git a/types/convict/index.d.ts b/types/convict/index.d.ts index 981bc8148b..82b22ba2db 100644 --- a/types/convict/index.d.ts +++ b/types/convict/index.d.ts @@ -1,11 +1,26 @@ -// Type definitions for node-convict v0.6.0 +// Type definitions for convict 3.0 // Project: https://github.com/mozilla/node-convict -// Definitions by: Wim Looman +// Definitions by: Wim Looman , Vesa Poikajärvi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace convict { + type ValidationMethod = 'strict' | 'warn'; + + interface ValidateOptions { + /** + * If set to warn, any properties specified in config files that are not declared in + * the schema will print a warning. This is the default behavior. If set to strict, + * any properties specified in config files that are not declared in the schema will + * throw errors. This is to ensure that the schema and the config files are in sync. + */ + allowed?: ValidationMethod; + + /** @deprecated use allowed instead */ + strict?: boolean; + } + interface Format { name?: string; validate?: (val: any) => void; @@ -34,14 +49,52 @@ declare namespace convict { } interface Config { - get(name: string): any; + /** + * @returns the current value of the name property. name can use dot + * notation to reference nested values + */ + get(name?: string): any; + /** + * @returns the default value of the name property. name can use dot + * notation to reference nested values + */ default(name: string): any; + /** + * @returns true if the property name is defined, or false otherwise + */ has(name: string): boolean; - set(name: string, value: any): void; - load(conf: Object): void; - loadFile(file: string): void; - loadFile(files: string[]): void; - validate(options?: { strict?: boolean }): void; + /** + * Sets the value of name to value. name can use dot notation to reference + * nested values, e.g. "database.port". If objects in the chain don't yet + * exist, they will be initialized to empty objects + * + * @return {Config} instance + */ + set(name: string, value: any): Config; + /** + * Loads and merges a JavaScript object into config + * + * @return {Config} instance + */ + load(conf: Object): Config; + /** + * Loads and merges one JSON configuration file into config + * + * @return {Config} instance + */ + loadFile(file: string): Config; + /** + * Loads and merges multiple JSON configuration files into config + * + * @return {Config} instance + */ + loadFile(files: string[]): Config; + /** + * Validates config against the schema used to initialize it + * + * @param options + */ + validate(options?: ValidateOptions): Config; /** * Exports all the properties (that is the keys and their current values) as a {JSON} {Object} * @returns {Object} A {JSON} compliant {Object} diff --git a/types/cookiejs/cookiejs-tests.ts b/types/cookie_js/cookie_js-tests.ts similarity index 82% rename from types/cookiejs/cookiejs-tests.ts rename to types/cookie_js/cookie_js-tests.ts index 43047f4fb6..51a71f4bab 100644 --- a/types/cookiejs/cookiejs-tests.ts +++ b/types/cookie_js/cookie_js-tests.ts @@ -1,8 +1,4 @@ - - -// Based on https://github.com/js-coder/cookie.js/blob/gh-pages/tests/spec.js - -import cookie = require("cookiejs"); +import cookie = require("cookie_js"); cookie.set({a: '1', b: '2', c: '3'}); diff --git a/types/cookiejs/index.d.ts b/types/cookie_js/index.d.ts similarity index 83% rename from types/cookiejs/index.d.ts rename to types/cookie_js/index.d.ts index ad769bcb0e..6e5a0813b6 100644 --- a/types/cookiejs/index.d.ts +++ b/types/cookie_js/index.d.ts @@ -1,13 +1,18 @@ -// Type definitions for cookie.js v1.2.2 +// Type definitions for cookie_js v1.2.2 // Project: https://github.com/florian/cookie.js -// Definitions by: Boltmade +// Definitions by: slawiko // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** - * Shortcut for cookie.get() - */ -export = cookie; -export as namespace cookie; +declare module 'cookie_js' { + export = cookie; +} + +/** + * https://github.com/DefinitelyTyped/DefinitelyTyped/pull/16025#issuecomment-295784660 + */ +declare module 'cookiejs' { + export = cookie; +} declare function cookie(key : string, fallback?: string) : string; declare function cookie(keys : string[], fallback?: string) : string; diff --git a/types/cookie_js/tsconfig.json b/types/cookie_js/tsconfig.json new file mode 100644 index 0000000000..146b1adc25 --- /dev/null +++ b/types/cookie_js/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cookie_js-tests.ts" + ] +} diff --git a/types/cordova-plugin-native-keyboard/cordova-plugin-native-keyboard-tests.ts b/types/cordova-plugin-native-keyboard/cordova-plugin-native-keyboard-tests.ts new file mode 100644 index 0000000000..4597e2c39a --- /dev/null +++ b/types/cordova-plugin-native-keyboard/cordova-plugin-native-keyboard-tests.ts @@ -0,0 +1,43 @@ +/** + * Display Messenger + */ +NativeKeyboard.showMessenger({ + onSubmit: (text) => {}, + onKeyboardDidHide: () => {}, + onKeyboardDidShow: () => {}, + onKeyboardWillShow: () => {}, + onTextChanged: (text) => {}, + onKeyboardWillHide: () => {}, +}); + +/** + * Display Messenger Keyboard + */ +NativeKeyboard.showMessengerKeyboard( + () => {}, + () => {}); + +/** + * Hide Messenger + */ +NativeKeyboard.hideMessenger( + { animated: true}, + () => {}, + () => {}); + +NativeKeyboard.hideMessenger(); + +/** + * Hide Messenger Keyboard + */ +NativeKeyboard.hideMessengerKeyboard( + () => {}, + () => {}); + +/** + * Update Messenger Keyboard + */ +NativeKeyboard.updateMessenger( + {text: 'FooBar'}, + () => {}, + () => {}); diff --git a/types/cordova-plugin-native-keyboard/index.d.ts b/types/cordova-plugin-native-keyboard/index.d.ts new file mode 100644 index 0000000000..0f64199bd1 --- /dev/null +++ b/types/cordova-plugin-native-keyboard/index.d.ts @@ -0,0 +1,303 @@ +// Type definitions for cordova-plugin-native-keyboard 1.3 +// Project: https://github.com/EddyVerbruggen/cordova-plugin-native-keyboard#readme +// Definitions by: Daniel Brolli +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +interface NativeKeyboard { + /** + * Show the messenger, the bare minimum which has to be passed to the function is + * the onSubmit callback + * @param options + */ + showMessenger( + options: NativeKeyboardShowOptions + ): void; + + /** + * It's likely your app only has 1 one page where you want to show the messenger, + * so you want to hide it when the user navigates away. You can choose to do this + * either animated (a quick slide down animation) or not. + * + * @param options + * @param onSuccess + * @param onError + */ + hideMessenger( + options?: NativeKeyboardHideOptions, + onSuccess?: () => void, + onError?: (err: any) => void + ): void; + + /** + * Show a previously hidden keyboard + * + * @param onSuccess + * @param onError + */ + showMessengerKeyboard( + onSuccess?: () => void, + onError?: (err: any) => void, + ): void; + + /** + * Hide the keyboard, but not the messenger bar + * + * @param onSuccess + * @param onError + */ + hideMessengerKeyboard( + onSuccess?: () => void, + onError?: (err: any) => void, + ): void; + + /** + * Manipulate the messenger while it's open. For instance if you want to + * update the text programmatically based on what the user typed (by responding to + * onTextChanged events). + * + * @param options + * @param onSuccess + * @param onError + */ + updateMessenger( + options: NativeKeyboardUpdateOptions, + onSuccess?: () => void, + onError?: (err: any) => void + ): void; +} + +interface NativeKeyboardUpdateOptions { + /** + * Replace the messenger's text by this. The current text remains if omitted. + */ + text?: string; + + /** + * Position the cursor anywhere in the text range. Defaults to the end of the text. + */ + caretIndex?: number; + + /** + * If false or omitted no changes to the keyboard state are made. + */ + showKeyboard?: boolean; +} + +interface NativeKeyboardHideOptions { + /** + * A boolean flag inidicating if the keyboard should be shown/hidden with an animation + */ + animated?: boolean; +} + +interface NativeKeyboardShowOptions { + /** + * Callback function, which is being called as soon as the user submits + * @param text + */ + onSubmit(text: string): void; + + /** + * Callback function which is being executed as soon as the keyboard will show + */ + onKeyboardWillShow?(): void; + + /** + * Callback function which is being executed as soon as the keyboard did show + */ + onKeyboardDidShow?(): void; + + /** + * Callback function which is being executed as soon as the keyboard will hide + */ + onKeyboardWillHide?(): void; + + /** + * Callback function which is being executed as soon as the keyboard did hide + */ + onKeyboardDidHide?(): void; + + /** + * Callback function which is being executed as soon as the entered text changes. Will + * return the new text + * + * @param text + */ + onTextChanged?(text: string): void; + + /** + * DOM element, which should be scrolled automatically + */ + autoscrollElement?: any; + + /** + * Boolean value indicating if the content should be scrolled to the end after the messenger is + * shown + */ + scrollToBottomAfterMessengerShows?: boolean; + + /** + * Boolean value indicating if the keyboard should be kept open after submitting the entered + * text + * + * Default: false + */ + keepOpenAfterSubmit?: boolean; + + /** + * Makes the messenger bar slide in from the bottom. + * + * Default: false + */ + animated?: boolean; + + /** + * Open the keyboard when showing the messenger. + * + * Default: false + */ + showKeyboard?: boolean; + + /** + * A text which will be in the messenger bar, when opening + */ + text?: string; + + /** + * The color of the typed text in HEX. + * + * Default: #444 + */ + textColor?: string; + + /** + * A placeholder which will be in the messenger bar, when opening and the input field is + * empty + */ + placeholder?: string; + + /** + * The color of the placeholder. + * + * Default: #ccc + */ + placeholderColor?: string; + + /** + * The background color of the messenger bar. + * + * Default: #F6F6F6 + */ + backgroundColor?: string; + + /** + * The background color of the textview. Looks nicest on Android + * if it's the same color as the backgroundColor property. + * + * Default: #F6F6F6 + */ + textViewBackgroundColor?: string; + + /** + * The border color of the textview. + * + * Default: #666666 + */ + textViewBorderColor?: string; + + /** + * Maximum amount of chars that can be entered + */ + maxChars?: number; + + /** + * Options are: "none", "split", "countdown", "countdownreversed". + * Note that if maxChars is set, "none" will still show a counter. + * + * Default: "none" + */ + counterStyle?: string; + + /** + * Options are: "default", "decimalpad", "phonepad", "numberpad", "namephonepad", + * "number", "email", "twitter", "url", "alphabet", "search", "ascii" + * + * Default: "default" + */ + type?: string; + + /** + * Options are: "light", "dark". + * + * Default: "default" + */ + appearance?: string; + + /** + * Disables things like the Emoji keyboard and the Predicive text entry bar + * + * Default: false + */ + secure?: boolean; + + /** + * The left button of the messenger bar + */ + leftButton?: LeftButtonOptions; + + /** + * The right button of the messenger bar + */ + rightButton?: ButtonOptions; +} + +interface ButtonOptions { + /** + * The type of the button. + * Either "text", "fontawesome" or "ionicon". + * + * Default: "text" + */ + type?: string; + + /** + * The value of the button. On "text" the string is used as label + * On fonatawesome or ionicon the icon name is used (e.g. fa-rocket) + * + * Default: "Send" + */ + value?: string; + + /** + * If type is "text" you can set this to either "normal", "bold" or "italic". + * + * Default: "normal" + */ + textStyle?: string; + + /** + * The color of the button in HEX + * + * Default: #000 + */ + color: string; + + /** + * A callback being executed as soon as the button is clicked + */ + onPress(): void; +} + +interface LeftButtonOptions extends ButtonOptions { + /** + * Set to true to disable the button once text has been entered. + * + * Default: false + */ + disabledWhenTextEntered?: boolean; +} + +/** NativeKeyboard instance */ +declare var NativeKeyboard: NativeKeyboard; +interface Window { + NativeKeyboard: NativeKeyboard; +} diff --git a/types/cordova-plugin-native-keyboard/tsconfig.json b/types/cordova-plugin-native-keyboard/tsconfig.json new file mode 100644 index 0000000000..4309b2406b --- /dev/null +++ b/types/cordova-plugin-native-keyboard/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cordova-plugin-native-keyboard-tests.ts" + ] +} diff --git a/types/cordova-plugin-native-keyboard/tslint.json b/types/cordova-plugin-native-keyboard/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cordova-plugin-native-keyboard/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/cordova-plugin-qrscanner/cordova-plugin-qrscanner-tests.ts b/types/cordova-plugin-qrscanner/cordova-plugin-qrscanner-tests.ts index 009b0b7d2b..fe14bae63c 100644 --- a/types/cordova-plugin-qrscanner/cordova-plugin-qrscanner-tests.ts +++ b/types/cordova-plugin-qrscanner/cordova-plugin-qrscanner-tests.ts @@ -3,7 +3,7 @@ var QRScanner: QRScanner = window.QRScanner; QRScanner.prepare(); QRScanner.prepare((err, status) => { var error: QRScannerError = err; var obj: QRScannerStatus = status; }); -QRScanner.scan((err, results) => { var error: QRScannerError = err; var contents: String = results; }); +QRScanner.scan((err, results) => { var error: QRScannerError = err; var contents: string = results; }); QRScanner.cancelScan(); QRScanner.cancelScan((status) => {var obj: QRScannerStatus = status; }); QRScanner.show(); @@ -31,12 +31,12 @@ QRScanner.destroy((status) => {var obj: QRScannerStatus = status; }); QRScanner.prepare((err, status) => { var error: QRScannerError = err; - var num: Number = error.code; - var str: String = error.name; + var num: number = error.code; + var str: string = error.name; str = error._message; var obj: QRScannerStatus = status; - var bool: Boolean = status.authorized; + var bool: boolean = status.authorized; bool = status.denied; bool = status.restricted; bool = status.prepared; @@ -46,5 +46,5 @@ QRScanner.prepare((err, status) => { bool = status.lightEnabled; bool = status.canOpenSettings; bool = status.canEnableLight; - var num: Number = status.currentCamera; + var num: number = status.currentCamera; }); diff --git a/types/cordova-plugin-qrscanner/index.d.ts b/types/cordova-plugin-qrscanner/index.d.ts index ed5f72f26f..0f2a498a9c 100644 --- a/types/cordova-plugin-qrscanner/index.d.ts +++ b/types/cordova-plugin-qrscanner/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for cordova-plugin-qrscanner v1.0.0 +// Type definitions for cordova-plugin-qrscanner v1.0.1 // Project: https://github.com/bitpay/cordova-plugin-qrscanner // Definitions by: Jason Dreyzehner +// Josh Bronson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** @@ -32,7 +33,7 @@ interface QRScanner { * not need to be visible for scanning to function. * @param {function} callback Callback that gets an error or the results string. */ - scan: (callback: (error: QRScannerError, result: String) => any) => void; + scan: (callback: (error: QRScannerError, result: string) => any) => void; /** * Cancels the current scan. If `QRScanner.prepare()` has not been called, @@ -82,7 +83,7 @@ interface QRScanner { * @param {number} index A number representing the index of the camera to use. * @param {function} [callback] Callback that gets an error or the QRScannerStatus object. */ - useCamera: (index: Number, callback?: (error: QRScannerError, status: QRScannerStatus) => any) => void; + useCamera: (index: number, callback?: (error: QRScannerError, status: QRScannerStatus) => any) => void; /** * Switch video capture to the device's front camera. If `QRScanner.prepare()` @@ -150,7 +151,7 @@ interface QRScannerStatus { * (`AVAuthorizationStatus.Authorized`). On platforms with permissions granted * at install (Android pre-6.0, Windows Phone) this property is always true. */ - authorized: Boolean, + authorized: boolean, /** * A boolean value which is true if the user permenantly denied camera access @@ -158,59 +159,59 @@ interface QRScannerStatus { * only be gained by requesting the user change their decision (consider * offering a link to the setting via `openSettings()`). */ - denied: Boolean, + denied: boolean, /** * A boolean value which is true if the user is unable to grant permissions due * to parental controls, organization security configuration profiles, or * similar reasons. */ - restricted: Boolean, + restricted: boolean, /** * A boolean value which is true if QRScanner is prepared to capture video and * render it to the view. */ - prepared: Boolean, + prepared: boolean, /** * A boolean value which is true if QRScanner is actively scanning for a QR code. */ - scanning: Boolean, + scanning: boolean, /** * A boolean value which is true if QRScanner is displaying a live preview * from the device's camera. Set to false when the preview is paused. */ - previewing: Boolean, + previewing: boolean, /** * A boolean value which is true when the native webview background is transparent. */ - webviewBackgroundIsTransparent: Boolean, + webviewBackgroundIsTransparent: boolean, /** * A boolean value which is true if the light is enabled. */ - lightEnabled: Boolean, + lightEnabled: boolean, /** * A boolean value which is true only if the users' operating system is able * to `QRScanner.openSettings()`. */ - canOpenSettings: Boolean, + canOpenSettings: boolean, /** * A boolean value which is true only if the users' device can enable a light * in the direction of the currentCamera. */ - canEnableLight: Boolean, + canEnableLight: boolean, /** * A number representing the index of the currentCamera. `0` is the back * camera, `1` is the front. */ - currentCamera: Number + currentCamera: number } /** @@ -218,8 +219,8 @@ interface QRScannerStatus { * * Many QRScanner functions accept a callback with an `error` parameter. When * QRScanner experiences errors, this parameter contains a QRScannerError object -* with properties `name` (_String_), `code` (_Number_), and `_message` -* (_String_). When handling errors, rely only on the `name` or `code` parameter, +* with properties `name` (_string_), `code` (_number_), and `_message` +* (_string_). When handling errors, rely only on the `name` or `code` parameter, *as the specific content of `_message` is not considered part of the plugin's * stable API. * @@ -242,17 +243,17 @@ interface QRScannerError { /** * The standard string identifying the type of this QRScannerError. */ - name: String, + name: string, /** * The standard number identifying the type of this QRScannerError. */ - code: Number, + code: number, /** * A simple message describing this QRScannerError. */ - _message: String + _message: string } declare var QRScanner: QRScanner; diff --git a/types/country-select-js/country-select-js-tests.ts b/types/country-select-js/country-select-js-tests.ts new file mode 100644 index 0000000000..a3bf640b69 --- /dev/null +++ b/types/country-select-js/country-select-js-tests.ts @@ -0,0 +1,7 @@ +$('#country').countrySelect(); + +$('#country').countrySelect({ + defaultCountry: 'gb' +}); + +$('#country').countrySelect('destroy'); diff --git a/types/country-select-js/index.d.ts b/types/country-select-js/index.d.ts new file mode 100644 index 0000000000..72c33489c2 --- /dev/null +++ b/types/country-select-js/index.d.ts @@ -0,0 +1,57 @@ +// Type definitions for country-select-js 1.0 +// Project: https://github.com/mrmarkfrench/country-select-js +// Definitions by: Humberto Rocha +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace CountrySelectJs { + interface Options { + /** + * Set the default country by it's country code. Otherwise it will just be + * the first country in the list. + */ + defaultCountry?: string; + + /** + * Display only the countries you specify. Takes an array of country codes. + */ + onlyCountries?: string[]; + + /** + * Specify the countries to appear at the top of the list. Defaults to + * ["us", "gb"] + */ + preferredCountries?: string[]; + + /** + * Set the dropdown's width to be the same as the input. This is + * automatically enabled for small screens. + */ + responsiveDropdown?: boolean; + } + + interface CountryData { + name: string; + iso2: string; + } +} + +interface JQuery { + /** + * Remove the plugin from the input, and unbind any event listeners. + */ + countrySelect(method: 'destroy'): void; + + /** + * Get the country data for the currently selected flag. + */ + countrySelect(method: 'getSelectedCountryData'): CountrySelectJs.CountryData; + + countrySelect(method: string, value: string): void; + + /** + * initialize the plugin with optional options. + */ + countrySelect(options?: CountrySelectJs.Options): JQueryDeferred; +} diff --git a/types/country-select-js/tsconfig.json b/types/country-select-js/tsconfig.json new file mode 100644 index 0000000000..749b1b3af1 --- /dev/null +++ b/types/country-select-js/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "country-select-js-tests.ts" + ] +} diff --git a/types/country-select-js/tslint.json b/types/country-select-js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/country-select-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/cropperjs/index.d.ts b/types/cropperjs/index.d.ts index 89d35ed998..ca957ccc3f 100644 --- a/types/cropperjs/index.d.ts +++ b/types/cropperjs/index.d.ts @@ -86,6 +86,15 @@ declare namespace cropperjs { */ checkCrossOrigin?: boolean; /** + * Check the current image's Exif Orientation information. + * More exactly, read the Orientation value for rotating or flipping the image, and then override the Orientation + * value with 1 (the default value) to avoid some issues (1, 2) on iOS devices. + * Requires to set both the rotatable and scalable options to true at the same time. + * Note: Don't trust this all the time as some JPG images have incorrect (not standard) Orientation values. + * @default true + */ + checkOrientation?: boolean; + /** * Show the black modal above the image and under the crop box. * @default true */ @@ -131,6 +140,11 @@ declare namespace cropperjs { */ rotatable?: boolean; /** + * Enable to restore the cropped area after resizing the window. + * @default true + */ + restore?: boolean; + /** * Enable to scale the image. * @default true */ diff --git a/types/csvtojson/csvtojson-tests.ts b/types/csvtojson/csvtojson-tests.ts index a4ee3d76d4..5b58451fac 100644 --- a/types/csvtojson/csvtojson-tests.ts +++ b/types/csvtojson/csvtojson-tests.ts @@ -9,6 +9,18 @@ const csvStr: string = `1,2,3 4,5,6 7,8,9`; +// Factory instantiation with options. +csv({ + noheader: true, + constructResult: false, + delimiter: 'auto', + checkType: false, + trim: true, + workerNum: 2, + checkColumn: true, + maxRowLength: 65535 +}); + // event emitter version using factory function csv({ noheader: true }) .fromString(csvStr) diff --git a/types/csvtojson/index.d.ts b/types/csvtojson/index.d.ts index 87e8286867..832a4acb6a 100644 --- a/types/csvtojson/index.d.ts +++ b/types/csvtojson/index.d.ts @@ -17,6 +17,12 @@ declare namespace csvtojson { * Converter options */ interface ConverterOptions { + /** + * Whether to construct final json object in memory which will be populated in "end_parsed" + * event. Set to false if deal with huge csv data. default: true. + */ + constructResult?: boolean; + /** * Delimiter used for seperating columns. Use "auto" if delimiter is unknown in advance, * in this case, delimiter will be auto-detected (by best attempt). Use an array to give diff --git a/types/cucumber/cucumber-tests.ts b/types/cucumber/cucumber-tests.ts index 379922d1a7..53ca726230 100644 --- a/types/cucumber/cucumber-tests.ts +++ b/types/cucumber/cucumber-tests.ts @@ -7,7 +7,7 @@ function StepSample() { type HookScenarioResult = cucumber.HookScenarioResult; cucumber.defineSupportCode(function ({setWorldConstructor, defineParameterType, After, Around, Before, registerHandler, Given, When, Then}) { - setWorldConstructor(function ({attach, parameters}) { + setWorldConstructor(function ({attach, parameters}: any) { this.attach = attach; this.parameters = parameters; this.visit = function (url: string, callback: Callback) { @@ -19,7 +19,7 @@ function StepSample() { console.log(scenarioResult.status === "failed"); callback(); }); - + Before({ timeout: 1000 }, function (scenarioResult: HookScenarioResult, callback: Callback) { console.log(scenarioResult.status === "failed"); callback(); @@ -35,7 +35,7 @@ function StepSample() { console.log("After"); callback(); }); - + After({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback?: Callback) => { console.log("After"); callback(); @@ -48,7 +48,7 @@ function StepSample() { Given(/^a variable set to (\d+)$/, (x: string) => { console.log("the number is: " + x); }); - + Given(/^a variable set to (\d+)$/, (x: number) => { console.log(typeof x); }); diff --git a/types/cwise-compiler/cwise-compiler-tests.ts b/types/cwise-compiler/cwise-compiler-tests.ts new file mode 100644 index 0000000000..38e19de886 --- /dev/null +++ b/types/cwise-compiler/cwise-compiler-tests.ts @@ -0,0 +1,76 @@ +/// + +import * as parse from 'cwise-parser'; +import * as ndarray from 'ndarray'; +import * as compile from 'cwise-compiler'; +import * as tape from 'tape'; + +tape("block tests", (t) => { + const ops = require('ndarray-ops'); + const body2 = parse((a: number, b: number[]) => { + a = b[0] + b[1] + 1; + }); + const body23 = parse((a: number, b: number[][]) => { + a = b[0][0] * b[1][0] + b[0][1] * b[1][1] + b[0][2] * b[1][2]; + }); + + // Test with block index at the front of the indices + const c1 = compile({ + args: ["array", { blockIndices: 1 }], + pre: parse(() => { }), + body: body2, + post: parse(() => { }), + debug: false, + funcName: "cwise", + blockSize: 64 + }); + + const a1 = ndarray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [3, 4]); + const b1 = ndarray([57, 17, 95, 78, 16, 96, 85, 93, 38, 42, 16, 66, 23, 77, 17, 36, 30, 52, 16, 18, 23, 69, 67, 27], [2, 3, 4]); + const ref1 = ndarray([81, 95, 113, 115, 47, 149, 102, 112, 62, 112, 84, 94], [3, 4]); + + c1(a1, b1); + + t.ok(ops.equals(a1, ref1), "front block"); + + // Test with block index at the back of the indices + const c2 = compile({ + args: ["array", { blockIndices: -1 }], + pre: parse(() => { }), + body: body2, + post: parse(() => { }), + debug: false, + funcName: "cwise", + blockSize: 64 + }); + + const a2 = ndarray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [3, 4]); + const b2 = ndarray([57, 17, 95, 78, 16, 96, 85, 93, 38, 42, 16, 66, 23, 77, 17, 36, 30, 52, 16, 18, 23, 69, 67, 27], [3, 4, 2]); + const ref2 = ndarray([75, 174, 113, 179, 81, 83, 101, 54, 83, 35, 93, 95], [3, 4]); + + c2(a2, b2); + + t.ok(ops.equals(a2, ref2), "back block"); + + // Multiple block indices + const c3 = compile({ + args: ["array", { blockIndices: -2 }], + pre: parse(() => { }), + body: body23, + post: parse(() => { }), + debug: false, + funcName: "cwise", + blockSize: 64 + }); + const a3 = ndarray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], [3, 4]); + const b3 = ndarray([48, 46, 89, 64, 72, 96, 38, 37, 79, 92, 89, 62, 84, 41, 13, 81, 53, 30, 68, 78, 34, 81, 90, 50, + 82, 97, 46, 18, 11, 79, 15, 68, 88, 58, 71, 84, 76, 35, 74, 82, 27, 47, 59, 25, 78, 61, 10, 43, + 96, 59, 21, 74, 41, 67, 11, 72, 38, 62, 95, 66, 57, 44, 93, 10, 51, 59, 50, 85, 71, 41, 79, 45], [3, 4, 2, 3]); + const ref = ndarray([14928, 11687, 9367, 14228, 6177, 13090, 10655, 7203, 10930, 10030, 8301, 11960], [3, 4]); + + c3(a3, b3); + + t.ok(ops.equals(a3, ref), "block with two indices"); + + t.end(); +}); diff --git a/types/cwise-compiler/index.d.ts b/types/cwise-compiler/index.d.ts new file mode 100644 index 0000000000..e661934a6a --- /dev/null +++ b/types/cwise-compiler/index.d.ts @@ -0,0 +1,49 @@ +// Type definitions for cwise-compiler 1.1 +// Project: https://github.com/scijs/cwise-compiler +// Definitions by: taoqf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { CompiledRoutine } from 'cwise-parser'; +import * as ndarray from 'ndarray'; + +declare namespace cwise_compiler { + interface BlockIndice { + blockIndices: number; + } + interface OffsetArg { + offset: number[]; + array: number; + } + type ArgType = 'array' | 'offset' | 'shape' | 'scalar' | 'index' | BlockIndice | OffsetArg; + interface UserArgs { + args: ArgType[]; + pre: CompiledRoutine; + body: CompiledRoutine; + post: CompiledRoutine; + debug: boolean; + funcName: string; + blockSize: number; + printCode?: boolean; + } + interface Procedure { + argTypes: ArgType[]; + shimArgs: string[]; + arrayArgs: number[]; + arrayBlockIndices: number[]; + scalarArgs: number[]; + offsetArgs: OffsetArg[]; + offsetArgIndex: number[]; + indexArgs: number[]; + shapeArgs: number[]; + funcName: string; + pre: CompiledRoutine; + body: CompiledRoutine; + post: CompiledRoutine; + debug: boolean; + blockSize?: number; + } +} + +declare function cwise_compiler(user_args: cwise_compiler.UserArgs): (a: ndarray, b: ndarray, ...args: ndarray[]) => ndarray; + +export = cwise_compiler; diff --git a/types/cwise-compiler/tsconfig.json b/types/cwise-compiler/tsconfig.json new file mode 100644 index 0000000000..a78923fa03 --- /dev/null +++ b/types/cwise-compiler/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cwise-compiler-tests.ts" + ] +} diff --git a/types/cwise-compiler/tslint.json b/types/cwise-compiler/tslint.json new file mode 100644 index 0000000000..531fb4ef87 --- /dev/null +++ b/types/cwise-compiler/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/cwise-parser/cwise-parser-tests.ts b/types/cwise-parser/cwise-parser-tests.ts new file mode 100644 index 0000000000..c50b9be06a --- /dev/null +++ b/types/cwise-parser/cwise-parser-tests.ts @@ -0,0 +1,26 @@ +import * as parser from "cwise-parser"; +// import parser = require("cwise-parser"); +import * as tape from "tape"; + +tape("basic tests", (t) => { + const parsed = parser((a: number, b: number, c: number) => { + a += b; + c = Math.cos(b); + }); + + t.equals(parsed.args.length, 3); + + t.equals(parsed.args[0].lvalue, true); + t.equals(parsed.args[0].rvalue, true); + t.equals(parsed.args[0].count, 1); + + t.equals(parsed.args[1].lvalue, false); + t.equals(parsed.args[1].rvalue, true); + t.equals(parsed.args[1].count, 2); + + t.equals(parsed.args[2].lvalue, true); + t.equals(parsed.args[2].rvalue, false); + t.equals(parsed.args[2].count, 1); + + t.end(); +}); diff --git a/types/cwise-parser/index.d.ts b/types/cwise-parser/index.d.ts new file mode 100644 index 0000000000..d2a06fd7f1 --- /dev/null +++ b/types/cwise-parser/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for cwise-parser 1.0 +// Project: https://github.com/scijs/cwise-parser#readme +// Definitions by: taoqf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace cwise_parser { + interface CompiledArgument { + name: string; + lvalue: boolean; + rvalue: boolean; + count: number; + } + interface CompiledRoutine { + body: string; + args: CompiledArgument[]; + thisVars: string[]; + localVars: string[]; + } +} + +declare function cwise_parser(func: (a: number, ...args: T[]) => any): cwise_parser.CompiledRoutine; +export = cwise_parser; diff --git a/types/cwise-parser/tsconfig.json b/types/cwise-parser/tsconfig.json new file mode 100644 index 0000000000..ce6c3c1355 --- /dev/null +++ b/types/cwise-parser/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cwise-parser-tests.ts" + ] +} diff --git a/types/cwise-parser/tslint.json b/types/cwise-parser/tslint.json new file mode 100644 index 0000000000..531fb4ef87 --- /dev/null +++ b/types/cwise-parser/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/cwise/cwise-tests.ts b/types/cwise/cwise-tests.ts new file mode 100644 index 0000000000..66843adfe2 --- /dev/null +++ b/types/cwise/cwise-tests.ts @@ -0,0 +1,366 @@ +import * as cwise from 'cwise'; +import * as ndarray from 'ndarray'; +import * as tape from 'tape'; + +// basic +tape("only allow same shape", (t) => { + const op1 = cwise({ + args: ["array"], + body: (a: number) => { a = 1; } + }); + const op2 = cwise({ + args: ["array", "array"], + body: (a: number, b: number) => { a = b; } + }); + const op3 = cwise({ + args: ["array", "array", "array"], + body: (a: number, b: number, c: number) => { a = b + c; } + }); + const op2block_pos = cwise({ + args: ["array", { blockIndices: 1 }], + body: (a: number, b: number[]) => { a = b[1]; } + }); + const op2block_neg = cwise({ + args: ["array", { blockIndices: -1 }], + body: (a: number, b: number[]) => { a = b[1]; } + }); + + t.doesNotThrow(() => { op1(ndarray([1, 2, 3], [3])); }); + t.doesNotThrow(() => { op2(ndarray([1, 2, 3], [3]), ndarray([1, 2, 3], [3])); }); + t.doesNotThrow(() => { op2(ndarray([1, 2, 3, 4, 5, 6], [3, 2]), ndarray([1, 2, 3, 4, 5, 6], [3, 2])); }); + t.doesNotThrow(() => { op3(ndarray([1, 2, 3], [3]), ndarray([1, 2, 3], [3]), ndarray([1, 2, 3], [3])); }); + t.doesNotThrow(() => { op2block_pos(ndarray([1, 2], [2]), ndarray([1, 2, 3, 4, 5, 6], [3, 2])); }); + t.doesNotThrow(() => { op2block_neg(ndarray([1, 2, 3], [3]), ndarray([1, 2, 3, 4, 5, 6], [3, 2])); }); + + t.throws(() => { op2(ndarray([1, 2, 3], [3]), ndarray([1, 2], [2])); }); + t.throws(() => { op2(ndarray([1, 2, 3, 4, 5, 6], [3, 2]), ndarray([1, 2, 3], [3, 1])); }); + t.throws(() => { op2(ndarray([1, 2, 3, 4, 5, 6], [3, 2]), ndarray([1, 2, 3, 4], [2, 2])); }); + t.throws(() => { op3(ndarray([1, 2, 3], [3]), ndarray([1, 2, 3], [3]), ndarray([1, 2], [2])); }); + t.throws(() => { op3(ndarray([1, 2, 3], [3]), ndarray([1, 2], [2]), ndarray([1, 2, 3], [3])); }); + t.throws(() => { op3(ndarray([1, 2], [2]), ndarray([1, 2, 3], [3]), ndarray([1, 2, 3], [3])); }); + t.throws(() => { op2block_pos(ndarray([1, 2, 3], [3]), ndarray([1, 2, 3, 4, 5, 6], [3, 2])); }); + t.throws(() => { op2block_neg(ndarray([1, 2], [2]), ndarray([1, 2, 3, 4, 5, 6], [3, 2])); }); + t.throws(() => { op2block_pos(ndarray([1, 2, 3, 4, 5, 6], [3, 2]), ndarray([1, 2, 3, 4], [2, 2])); }); + t.throws(() => { op2block_neg(ndarray([1, 2, 3, 4, 5, 6], [3, 2]), ndarray([1, 2, 3, 4], [2, 2])); }); + + t.end(); +}); + +// binarry +class DumbStorage { + data: Int32Array; + length: number; + constructor(n: number) { + this.data = new Int32Array(n); + this.length = n; + } + get(i: number) { + return this.data[i]; + } + set(i: number, v: number) { + return this.data[i] = v; + } +} + +tape("binary", (t) => { + const binary = cwise({ + args: ["array", "array", "scalar", "shape", "index"], + body(a: number, b: number, t: tape.Test, s: number[], idx: number) { + if (!(a === 0)) t.fail("idx:" + idx + ", shape:" + s + ",a:" + a); + a = b + 1001; + } + }); + + function testBinary1D(P: ndarray, Q: ndarray, testName: string) { + t.equals(P.shape[0], Q.shape[0], testName + "; shape"); + for (let i = 0; i < P.shape[0]; ++i) { + Q.set(i, i); + P.set(i, 0); + } + binary(P, Q, t); + for (let i = 0; i < P.shape[0]; ++i) { + if (!(P.get(i) === i + 1001)) { + t.fail(testName + "; encountered " + P.get(i) + " instead of " + (i + 1001) + " at " + i); + return; + } + } + t.pass(testName); + } + + const A1 = ndarray(new Int32Array(128)); + const B1 = ndarray(new Int32Array(128)); + + testBinary1D(ndarray(new Int32Array(0)), ndarray(new Int32Array(0)), "length==0"); + testBinary1D(ndarray(new Int32Array(1)), ndarray(new Int32Array(1)), "length==1"); + testBinary1D(A1, B1, "A, B"); + testBinary1D(A1.lo(32), B1.hi(128 - 32), "A.lo(32), B.hi(128-32)"); + testBinary1D(A1.step(-1), B1, "A.step(-1), B"); + testBinary1D(A1, B1.step(-1), "A, B.step(-1)"); + + const A2 = ndarray(new DumbStorage(128) as any); + const B2 = ndarray(new DumbStorage(128) as any); + testBinary1D(ndarray(new DumbStorage(0) as any), ndarray(new DumbStorage(0) as any), "DS; length==0"); + testBinary1D(ndarray(new DumbStorage(1) as any), ndarray(new DumbStorage(1) as any), "DS; length==0"); + testBinary1D(A2, B2, "DS; A, B"); + testBinary1D(A2.lo(32), B2.hi(128 - 32), "DS; A.lo(32), B.hi(128-32)"); + testBinary1D(A2.step(-1), B2, "DS; A.step(-1), B"); + testBinary1D(A2, B2.step(-1), "DS; A, B.step(-1)"); + + const X = ndarray(new Int32Array(64 * 64), [64, 64]); + const Y = ndarray(new Int32Array(64 * 64), [64, 64]); + + function testBinary2D(P: ndarray, Q: ndarray, testName: string) { + for (let i = 0; i < X.shape[0]; ++i) { + for (let j = 0; j < X.shape[1]; ++j) { + X.set(i, j, -10000); + Y.set(i, j, -256); + } + } + t.equals(P.shape[0], Q.shape[0], testName + "; shape[0]"); + t.equals(P.shape[1], Q.shape[1], testName + "; shape[1]"); + for (let i = 0; i < P.shape[0]; ++i) { + for (let j = 0; j < P.shape[1]; ++j) { + Q.set(i, j, i * 1000 + j); + P.set(i, j, 0); + } + } + binary(P, Q, t, P.shape); + for (let i = 0; i < P.shape[0]; ++i) { + for (let j = 0; j < P.shape[1]; ++j) { + if (!(P.get(i, j) === i * 1000 + j + 1001)) { + t.fail(testName + "; encountered " + P.get(i, j) + " instead of " + (i * 1000 + j + 1001) + " at (" + i + "," + j + ")"); + return; + } + } + } + t.pass(testName); + } + + testBinary2D(X, Y, "X, Y"); + testBinary2D(X.transpose(1, 0), Y.transpose(1, 0), "X.T, Y.T"); + testBinary2D(X.transpose(1, 0), Y, "X.T, Y"); + testBinary2D(X, Y.transpose(1, 0), "X, Y.T"); + testBinary2D(X.hi(32, 32), Y.hi(32, 32), "X.hi(32,32), Y.hi(32,32)"); + testBinary2D(X.hi(31, 31), Y.hi(31, 31), "X.hi(31,31), Y.hi(31,31)"); + testBinary2D(X.hi(0, 32), Y.hi(0, 32), "X.hi(0,32), Y.hi(0,32)"); + testBinary2D(X.transpose(1, 0).hi(0, 32), Y.hi(0, 32), "X.T.hi(0,32), Y.hi(0,32)"); + testBinary2D(X.transpose(1, 0).hi(33, 33), Y.hi(33, 33), "X.T.hi(33,33), Y.hi(33,33)"); + testBinary2D(X.transpose(1, 0).hi(31, 31), Y.hi(31, 31), "X.T.hi(31,31), Y.hi(31,31)"); + + t.end(); +}); + +// browserify +import * as browserify from "browserify"; +import * as vm from 'vm'; +import * as path from 'path'; + +const cases = ["unary", "binary", "offset", "fill"]; + +bundleCasesFrom(0); + +function bundleCasesFrom(i: number) { + if (i >= cases.length) return; + const b = browserify(); + b.ignore("tape"); + b.add(__dirname + "/" + cases[i] + ".js"); + b.transform(path.normalize(__dirname + "/../cwise.js")); + tape(cases[i], (t) => { // Without nested tests, the asynchronous nature of bundle causes issues with tape... + b.bundle((err, src) => { + if (err) { + throw new Error("failed to bundle!"); + } + vm.runInNewContext(src.toString(), { + test: t.test.bind(t), + Buffer, + Int8Array, + Int16Array, + Int32Array, + Float32Array, + Float64Array, + Uint8Array, + Uint16Array, + Uint32Array, + Uint8ClampedArray, + console: { log: console.log.bind(console) } + }); + t.end(); + }); + }); + bundleCasesFrom(i + 1); +} + +// fill +tape("fill", (t) => { + const fill = cwise({ + args: ["index", "array", "scalar"], + body(idx, out, f) { + out = f.apply(undefined, idx); + } + }); + + const xlen = 10; + const ylen = 5; + const array = ndarray(new Float32Array(xlen * ylen), [xlen, ylen]); + + fill(array, (row: number, col: number) => { + return 0; + }); + + for (let i = 0; i < xlen; i++) { + for (let j = 0; j < ylen; j++) { + t.equals(array.get(i, j), 0, 'fill (' + i + ',' + j + ')'); + } + } + + fill(array, (row: number, col: number) => { + return 10 * (row + col); + }); + + for (let i = 0; i < xlen; i++) { + for (let j = 0; j < ylen; j++) { + t.equals(array.get(i, j), 10 * (i + j), 'fill (' + i + ',' + j + ')'); + } + } + + t.end(); +}); + +// offset +tape("offset", (t) => { + const binary = cwise({ + args: ["array", "array", { offset: [1], array: 1 }, "scalar", "shape", "index"], + body(a, b, c, t, s, idx) { + if (!(a === 0)) t.fail("idx:" + idx + ", shape:" + s + ",a:" + a); + a = c + b + 1000; + } + }); + + function testBinary1D(P: ndarray, Q: ndarray, testName: string) { + t.equals(P.shape[0], Q.shape[0] - 1, testName + "; shape"); + for (let i = 0; i < P.shape[0]; ++i) { + Q.set(i, i); + P.set(i, 0); + } + Q.set(P.shape[0], P.shape[0]); + binary(P, Q.hi(Q.shape[0] - 1), t); + for (let i = 0; i < P.shape[0]; ++i) { + if (!(P.get(i) === 2 * i + 1001)) { + t.fail(testName + "; encountered " + P.get(i) + " instead of " + (2 * i + 1001) + " at " + i); + return; + } + } + t.pass(testName); + } + + const A1 = ndarray(new Int32Array(128)); + const B1 = ndarray(new Int32Array(129)); + + testBinary1D(ndarray(new Int32Array(0)), ndarray(new Int32Array(1)), "length==0"); + testBinary1D(ndarray(new Int32Array(1)), ndarray(new Int32Array(2)), "length==1"); + testBinary1D(A1, B1, "A, B"); + testBinary1D(A1.lo(32), B1.lo(32), "A.lo(32), B.lo(32)"); + testBinary1D(A1.step(-1), B1, "A.step(-1), B"); + testBinary1D(A1, B1.step(-1), "A, B.step(-1)"); + + const A2 = ndarray(new DumbStorage(128) as any); + const B2 = ndarray(new DumbStorage(129) as any); + testBinary1D(ndarray(new DumbStorage(0) as any), ndarray(new DumbStorage(1) as any), "DS; length==0"); + testBinary1D(ndarray(new DumbStorage(1) as any), ndarray(new DumbStorage(2) as any), "DS; length==1"); + testBinary1D(A2, B2, "DS; A, B"); + testBinary1D(A2.lo(32), B2.lo(32), "DS; A.lo(32), B.lo(32)"); + testBinary1D(A2.step(-1), B2, "DS; A.step(-1), B"); + testBinary1D(A2, B2.step(-1), "DS; A, B.step(-1)"); + + t.end(); +}); + +// unary + +tape("unary", (t) => { + const unary = cwise({ + args: ["array"], + body(a) { + ++a; + } + }); + + function testUnary1D(arr: ndarray, testName: string) { + for (let i = 0; i < arr.shape[0]; ++i) { + arr.set(i, i); + } + unary(arr); + for (let i = 0; i < arr.shape[0]; ++i) { + if (!(arr.get(i) === i + 1)) { + t.fail(testName + "; encountered " + arr.get(i) + " instead of " + (i + 1) + " at " + i); + return; + } + } + t.pass(testName); + } + const simple_zeros = ndarray(new Int32Array(4096)); + + testUnary1D(simple_zeros.hi(0), "simple_zeros.hi(0)"); + testUnary1D(simple_zeros.hi(1), "simple_zeros.hi(1)"); + testUnary1D(simple_zeros.hi(2), "simple_zeros.hi(2)"); + testUnary1D(simple_zeros, "simple_zeros"); + testUnary1D(simple_zeros.hi(31), "simple_zeros.hi(31)"); + testUnary1D(simple_zeros.hi(32), "simple_zeros.hi(32)"); + testUnary1D(simple_zeros.hi(33), "simple_zeros.hi(33)"); + testUnary1D(simple_zeros.step(-1), "simple_zeros.step(-1)"); + testUnary1D(simple_zeros.step(3), "simple_zeros.step(3)"); + testUnary1D(simple_zeros.step(4), "simple_zeros.step(4)"); + testUnary1D(simple_zeros.step(5).lo(10), "simple_zeros.step(5).lo(10)"); + + const custom_zeros = ndarray(new DumbStorage(4096) as any); + + testUnary1D(custom_zeros.hi(0), "custom_zeros.hi(0)"); + testUnary1D(custom_zeros.hi(1), "custom_zeros.hi(1)"); + testUnary1D(custom_zeros.hi(2), "custom_zeros.hi(2)"); + testUnary1D(custom_zeros, "custom_zeros"); + testUnary1D(custom_zeros.hi(31), "custom_zeros.hi(31)"); + testUnary1D(custom_zeros.hi(32), "custom_zeros.hi(32)"); + testUnary1D(custom_zeros.hi(33), "custom_zeros.hi(33)"); + testUnary1D(custom_zeros.step(-1), "custom_zeros.step(-1)"); + testUnary1D(custom_zeros.step(3), "custom_zeros.step(3)"); + testUnary1D(custom_zeros.step(4), "custom_zeros.step(4)"); + testUnary1D(custom_zeros.step(5).lo(10), "custom_zeros.step(5).lo(10)"); + + function testUnary2D(arr: ndarray, testName: string) { + for (let i = 0; i < arr.shape[0]; ++i) { + for (let j = 0; j < arr.shape[1]; ++j) { + arr.set(i, j, i + j * arr.shape[0]); + } + } + unary(arr); + for (let i = 0; i < arr.shape[0]; ++i) { + for (let j = 0; j < arr.shape[1]; ++j) { + if (!(arr.get(i, j) === 1 + i + j * arr.shape[0])) { + t.fail(testName + "; encountered " + arr.get(i, j) + " instead of " + (1 + i + j * arr.shape[0]) + " at (" + i + "," + j + ")"); + return; + } + } + } + t.pass(testName); + } + + const M1 = ndarray(new Int32Array(128 * 128), [128, 128]); + testUnary2D(M1, "M"); + testUnary2D(M1.hi(10, 10), "M.hi(10, 10)"); + testUnary2D(M1.lo(100, 1), "M.lo(100,1)"); + testUnary2D(M1.transpose(1, 0), "M.transpose(1,0)"); + testUnary2D(M1.step(-1, 1), "M.step(-1, 1)"); + testUnary2D(M1.step(-5, -2), "M.step(-5, -2)"); + testUnary2D(M1.step(16, 3), "M.step(16, 3)"); + + const M2 = ndarray(new DumbStorage(128 * 128) as any, [128, 128]); + testUnary2D(M2, "DS; M"); + testUnary2D(M2.hi(10, 10), "DS; M.hi(10, 10)"); + testUnary2D(M2.lo(100, 1), "DS; M.lo(100,1)"); + testUnary2D(M2.transpose(1, 0), "DS; M.transpose(1,0)"); + testUnary2D(M2.step(-1, 1), "DS; M.step(-1, 1)"); + testUnary2D(M2.step(-5, -2), "DS; M.step(-5, -2)"); + testUnary2D(M2.step(16, 3), "DS; M.step(16, 3)"); + + t.end(); +}); diff --git a/types/cwise/index.d.ts b/types/cwise/index.d.ts new file mode 100644 index 0000000000..d99d43ce59 --- /dev/null +++ b/types/cwise/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for cwise 1.0 +// Project: https://github.com/scijs/cwise#readme +// Definitions by: taoqf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { ArgType } from "cwise-compiler"; +import * as ndarray from "ndarray"; + +declare function cwise(a: string | cwise.UserArgs): cwise.Return; + +declare namespace cwise { + type Arg = ndarray | ((row: number, col: number) => number) | number[] | any; + type Return = (a: ndarray, ...b: Arg[]) => void; + interface UserArgs { + args: ArgType[]; + pre?(a: number, ...args: any[]): void; + body(a: number, ...args: any[]): void; + post?(a: number, ...args: any[]): void; + funcName?: string; + blockSize?: number; + printCode?: boolean; + } +} +export = cwise; diff --git a/types/cwise/tsconfig.json b/types/cwise/tsconfig.json new file mode 100644 index 0000000000..f4aaf9b1a3 --- /dev/null +++ b/types/cwise/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cwise-tests.ts" + ] +} \ No newline at end of file diff --git a/types/cwise/tslint.json b/types/cwise/tslint.json new file mode 100644 index 0000000000..531fb4ef87 --- /dev/null +++ b/types/cwise/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/cypress/cypress-tests.ts b/types/cypress/cypress-tests.ts new file mode 100644 index 0000000000..2a6b70b2a6 --- /dev/null +++ b/types/cypress/cypress-tests.ts @@ -0,0 +1,13 @@ +// Samples taken from the cypress kitchen sink example (https://github.com/cypress-io/cypress-example-kitchensink) +cy.title().should('include', 'Kitchen Sink'); + +cy + .get('.query-list') + .contains('bananas').should('have.class', 'third') + .contains(/^b\w+/).should('have.class', 'third') + .get('.query-list') + .contains('apples').should('have.class', 'first') + .get('#querying') + .contains('ul', 'oranges').should('have.class', 'query-list') + .get('.query-button') + .contains('Save Form').should('have.class', 'btn'); diff --git a/types/cypress/index.d.ts b/types/cypress/index.d.ts new file mode 100644 index 0000000000..a32c84b25d --- /dev/null +++ b/types/cypress/index.d.ts @@ -0,0 +1,543 @@ +// Type definitions for cypress 0.1 +// Project: https://cypress.io +// Definitions by: Gert Hengeveld +// Mike Woudenberg +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare namespace Cypress { + type FileContents = string | any[] | object; + type HistoryDirection = "back" | "forward"; + type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "OPTIONS" | "HEAD" | "TRACE" | "CONNECT"; + type RequestBody = string | object; + type ViewportOrientation = "portrait" | "landscape"; + + interface Core { + /** + * @see https://on.cypress.io/api/config + */ + config(): object; + config(key: string): any; + config(key: string, value: any): void; + config(Object: object): void; + + /** + * @see https://on.cypress.io/api/env + */ + env(): object; + env(key: string): any; + env(key: string, value: any): void; + env(Object: object): void; + + /** + * @see https://on.cypress.io/api/commands + */ + addChildCommand(name: string, fn: (args: any[]) => void): void; + addDualCommand(name: string, fn: (args: any[]) => void): void; + addParentCommand(name: string, fn: (args: any[]) => void): void; + + _: any; + $: any; + minimatch: any; + moment: any; + Blob: any; + Promise: any; + + /** + * @see https://on.cypress.io/api/cookies + */ + Cookies: { + debug(enabled: boolean, options?: DebugOptions): void; + preserveOnce(...names: string[]): void; + defaults(options: CookieDefaults): void; + }; + + /** + * @see https://on.cypress.io/api/dom + */ + Dom: { + isHidden(element: object): boolean; + }; + + /** + * @see https://on.cypress.io/api/api-server + */ + Server: { + defaults(options: ServerOptions): void; + }; + } + + interface Chainable { + /** + * @see https://on.cypress.io/api/and + */ + and(chainers: string, value?: any): Chainable; + and(chainers: string, method: string, value: any): Chainable; + and(fn: (args: any[]) => void): Chainable; + + /** + * @see https://on.cypress.io/api/as + */ + as(alias: string): Chainable; + + /** + * @see https://on.cypress.io/api/blur + */ + blur(options?: BlurOptions): Chainable; + + /** + * @see https://on.cypress.io/api/check + */ + check(options?: CheckOptions): Chainable; + check(value: string|string[]): Chainable; // no options + + /** + * @see https://on.cypress.io/api/children + */ + children(options?: LoggableTimeoutable): Chainable; + children(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/clear + */ + clear(options?: ClearOptions): Chainable; + + /** + * @see https://on.cypress.io/api/clearcookie + */ + clearCookie(name: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/clearcookies + */ + clearCookies(options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/clearlocalstorage + */ + clearLocalStorage(key?: string): Chainable; + clearLocalStorage(re: RegExp): Chainable; + + /** + * @see https://on.cypress.io/api/click + */ + click(options?: ClickOptions): Chainable; + click(position: string, options?: ClickOptions): Chainable; + click(x: number, y: number, options?: ClickOptions): Chainable; + + /** + * @see https://on.cypress.io/api/closest + */ + closest(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/contains + */ + contains(text: string, options?: LoggableTimeoutable): Chainable; + contains(num: number|RegExp): Chainable; + contains(selector: string, text: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/dblclick + */ + dblclick(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/debug + */ + debug(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/document + */ + document(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/each + */ + each(fn: (args: any[]) => void): Chainable; + + /** + * @see https://on.cypress.io/api/end + */ + end(): Chainable; + + /** + * @see https://on.cypress.io/api/eq + */ + eq(index: number, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/exec + */ + exec(command: string, options?: ExecOptions): Chainable; + + /** + * @see https://on.cypress.io/api/filter + */ + filter(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/find + */ + find(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/first + */ + first(options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/fixture + */ + fixture(path: string, options?: Timeoutable): Chainable; // no log? + fixture(path: string, encoding: string, options?: Timeoutable): Chainable; // no log? + + /** + * @see https://on.cypress.io/api/focus + */ + focus(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/focused + */ + focused(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/get + */ + get(selector: string, options?: LoggableTimeoutable): Chainable; + get(alias: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/getcookie + */ + getCookie(name: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/getcookies + */ + getCookies(options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/go + */ + go(direction: HistoryDirection|number, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/hash + */ + hash(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/invoke + */ + invoke(functionName: string, args: any[]): Chainable; + + /** + * @see https://on.cypress.io/api/its + */ + its(propertyName: string): Chainable; + + /** + * @see https://on.cypress.io/api/last + */ + last(options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/location + */ + location(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/log + */ + log(message: string, args: any): Chainable; + + /** + * @see https://on.cypress.io/api/next + */ + next(options?: LoggableTimeoutable): Chainable; + next(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/not + */ + not(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/parent + */ + parent(options?: LoggableTimeoutable): Chainable; + parent(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/parents + */ + parents(options?: LoggableTimeoutable): Chainable; + parents(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/pause + */ + pause(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/prev + */ + prev(options?: LoggableTimeoutable): Chainable; + prev(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/readfile + */ + readFile(filePath: string, options?: Timeoutable): Chainable; // no log? + readFile(filePath: string, encoding: string, options?: Timeoutable): Chainable; // no log? + + /** + * @see https://on.cypress.io/api/reload + */ + reload(options?: LoggableTimeoutable): Chainable; + reload(forceReload: boolean): Chainable; // no options? + + /** + * @see https://on.cypress.io/api/request + */ + request(url: string, body?: RequestBody): Chainable; + request(method: HttpMethod, url: string, body?: RequestBody): Chainable; + request(options: RequestOptions): Chainable; + + /** + * @see https://on.cypress.io/api/root + */ + root(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/route + */ + route(url: string, response?: any): Chainable; + route(method: string, url: string, response?: any): Chainable; + route(fn: (args: any[]) => void | RouteOptions): Chainable; + + /** + * @see https://on.cypress.io/api/screenshot + */ + screenshot(options?: LoggableTimeoutable): Chainable; + screenshot(fileName: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/select + */ + select(text: string|string[], options?: SelectOptions): Chainable; + select(value: string|string[], options?: SelectOptions): Chainable; + + /** + * @see https://on.cypress.io/api/server + */ + server(options?: ServerOptions): Chainable; + + /** + * @see https://on.cypress.io/api/setcookie + */ + setCookie(name: string, value: string, options?: SetCookieOptions): Chainable; + + /** + * @see https://on.cypress.io/api/should + */ + should(chainers: string, value?: any): Chainable; + should(chainers: string, method: string, value: any): Chainable; + should(fn: (args: any[]) => void): Chainable; + + /** + * @see https://on.cypress.io/api/siblings + */ + siblings(options?: LoggableTimeoutable): Chainable; + siblings(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/spread + */ + spread(fn: (args: any[]) => void): Chainable; + + /** + * @see https://on.cypress.io/api/submit + */ + submit(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/then + */ + then(fn: (args: any[]) => void): Chainable; + + /** + * @see https://on.cypress.io/api/title + */ + title(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/type + */ + type(text: string, options?: TypeOptions): Chainable; + + /** + * @see https://on.cypress.io/api/uncheck + */ + uncheck(options?: CheckOptions): Chainable; + uncheck(values: string[]): Chainable; // no options? missing single value variant + + /** + * @see https://on.cypress.io/api/url + */ + url(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/viewport + */ + viewport(width: number, height: number, options?: Loggable): Chainable; + viewport(preset: string, orientation: ViewportOrientation, options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/visit + */ + visit(url: string, options?: VisitOptions): Chainable; + + /** + * @see https://on.cypress.io/api/wait + */ + wait(ms: number|string[]): Chainable; // no options? + wait(alias: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/window + */ + window(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/within + */ + within(fn: (args: any[]) => void): Chainable; + within(options: Loggable, fn: (args: any[]) => void): Chainable; // inconsistent argument order + + /** + * @see https://on.cypress.io/api/wrap + */ + wrap(Object: object, options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/writefile + */ + writeFile(filePath: string, contents: FileContents, options?: Timeoutable): Chainable; + writeFile(filePath: string, contents: FileContents, encoding: string, options?: Timeoutable): Chainable; + } + + interface DebugOptions { + verbose?: boolean; + } + + interface CookieDefaults { + whitelist?: string | string[] | RegExp | ((args: any[]) => void); + } + + interface Loggable { + log?: boolean; + } + + interface Timeoutable { + timeout?: number; + } + + interface LoggableTimeoutable extends Loggable, Timeoutable {} + + interface BlurOptions extends Loggable { + force?: boolean; + } + + interface CheckOptions extends Loggable, Timeoutable { + interval?: number; + force?: boolean; + } + + interface ClearOptions extends Loggable, Timeoutable { + force?: boolean; + interval?: number; + } + + interface ClickOptions extends Loggable, Timeoutable { + force?: boolean; + multiple?: boolean; + interval?: number; + } + + interface ExecOptions extends Loggable, Timeoutable { + failOnNonZeroExit?: boolean; + env?: object; + } + + interface RequestOptions extends Loggable, Timeoutable { + auth?: object; + body?: RequestBody; + failOnStatusCode?: boolean; + followRedirect?: boolean; + form?: boolean; + gzip?: boolean; + headers?: object; + method?: HttpMethod; + qs?: string; + url: string; + } + + interface RouteOptions { + method?: HttpMethod; + url?: string | RegExp; + response?: any; + status?: number; + delay?: number; + headers?: object; + force404?: boolean; + onRequest?(args: any[]): void; + onResponse?(args: any[]): void; + onAbort?(args: any[]): void; + } + + interface SelectOptions extends Loggable, Timeoutable { + force?: boolean; + interval?: number; + } + + interface ServerOptions { + delay?: number; + method?: HttpMethod; + status?: number; + headers?: object; + response?: any; + onRequest?(args: any[]): void; + onResponse?(args: any[]): void; + onAbort?(args: any[]): void; + enable?: boolean; + force404?: boolean; + urlMatchingOptions?: object; + whitelist?(args: any[]): void; + } + + interface SetCookieOptions extends Loggable, Timeoutable { + path?: string; + domain?: string; + secure?: boolean; + httpOnly?: boolean; + expiry?: number; + } + + interface TypeOptions extends Loggable, Timeoutable { + delay?: number; + force?: boolean; + release?: boolean; + interval?: number; + } + + interface VisitOptions extends Loggable, Timeoutable { + onBeforeLoad?(args: any[]): void; + onLoad?(args: any[]): void; + } +} + +declare const cy: Cypress.Chainable; diff --git a/types/cypress/tsconfig.json b/types/cypress/tsconfig.json new file mode 100644 index 0000000000..6e61b09e60 --- /dev/null +++ b/types/cypress/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cypress-tests.ts" + ] +} diff --git a/types/cypress/tslint.json b/types/cypress/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cypress/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/d3-collection/d3-collection-tests.ts b/types/d3-collection/d3-collection-tests.ts index e862f9e601..af9bf8d075 100644 --- a/types/d3-collection/d3-collection-tests.ts +++ b/types/d3-collection/d3-collection-tests.ts @@ -23,11 +23,10 @@ let keyValueObj2 = { c: 'type' }; -let stringArray: string[], - anyArray: any[], - stringKVArray: Array<{ key: string, value: string }>, - anyKVArray: Array<{ key: string, value: any }>; - +let stringArray: string[]; +let anyArray: any[]; +let stringKVArray: Array<{ key: string, value: string }>; +let anyKVArray: Array<{ key: string, value: any }>; let num: number; let str: string; @@ -37,7 +36,6 @@ let booleanFlag: boolean; // Test Objects // --------------------------------------------------------------------- - // test keys(...) signatures ------------------------------------------------------ stringArray = d3Collection.keys(keyValueObj); @@ -74,7 +72,7 @@ interface TestObject { } let testObject: TestObject; -let testObjArray: Array; +let testObjArray: TestObject[]; let testObjKVArray: Array<{ key: string, value: TestObject }>; // Create Map ======================================================== @@ -87,7 +85,7 @@ basicMap = d3Collection.map(['foo', 'bar']); // map with key-value pairs { '0': // from array with accessor let testObjMap: d3Collection.Map; -testObjMap = d3Collection.map([{ name: 'foo', val: 10 }, { name: 'bar', val: 42 }], function (value, i, array) { +testObjMap = d3Collection.map([{ name: 'foo', val: 10 }, { name: 'bar', val: 42 }], (value, i, array) => { return value.name; }); @@ -102,7 +100,6 @@ objectMap = d3Collection.map(keyValueObj); let objectMap2: d3Collection.Map; objectMap2 = d3Collection.map(keyValueObj2); - // Use Map =========================================================== // has(...) ------------------------------------------------------------ @@ -133,14 +130,13 @@ stringArray = testObjMap.keys(); testObjArray = testObjMap.values(); - // entries() ----------------------------------------------------------- testObjKVArray = testObjMap.entries(); // each() -------------------------------------------------------------- -testObjMap.each(function (value, key, map) { +testObjMap.each((value, key, map) => { let v: TestObject = value; let k: string = key; let m: d3Collection.Map = map; @@ -172,10 +168,10 @@ basicSet = d3Collection.set(); // empty set basicSet = d3Collection.set(['foo', 'bar', 42]); // last element is coerced // from array without accessor -basicSet = d3Collection.set(testObjArray, function (value, index, array) { +basicSet = d3Collection.set(testObjArray, (value, index, array) => { let v: TestObject = value; let i: number = index; - let a: Array = array; + let a: TestObject[] = array; return v.name; }); @@ -211,7 +207,7 @@ stringArray = basicSet.values(); // each() -------------------------------------------------------------- -basicSet.each(function (value, valueRepeat, set) { +basicSet.each((value, valueRepeat, set) => { let v: string = value; let vr: string = valueRepeat; let s: d3Collection.Set = set; @@ -226,7 +222,6 @@ booleanFlag = basicSet.empty(); num = basicSet.size(); - // --------------------------------------------------------------------- // nest / Nest // --------------------------------------------------------------------- @@ -238,7 +233,7 @@ interface Yield { site: string; } -let raw: Array = [ +let raw: Yield[] = [ { yield: 27.00, variety: 'Manchuria', year: 1931, site: 'University Farm' }, { yield: 48.87, variety: 'Manchuria', year: 1931, site: 'Waseca' }, { yield: 27.43, variety: 'Manchuria', year: 1931, site: 'Morris' }, @@ -259,52 +254,49 @@ nestL2 = d3Collection.nest(); let nestL1Rollup: d3Collection.Nest; nestL1Rollup = d3Collection.nest(); - // Configure Nest ===================================================== // key(...) and sortKeys(...) ----------------------------------------- nestL2 = nestL2 - .key(function (d) { + .key(d => { return d.year.toString(); }); // with 2nd key with sortkey(...) nestL2 = nestL2 - .key(function (d) { + .key(d => { return d.variety; }) .sortKeys(ascending); nestL1Rollup = nestL1Rollup - .key(function (d) { + .key(d => { return d.year.toString(); }); // sortValues(...) ---------------------------------------------------- nestL2 = nestL2 - .sortValues(function (a, b) { + .sortValues((a, b) => { let val1: Yield = a; // data type Yield let val2: Yield = b; // data type Yield return a.yield - b.yield; }); - // rollup(...) -------------------------------------------------------- nestL1Rollup = nestL1Rollup - .rollup(function (values) { - let vs: Array = values; // correct data array type + .rollup(values => { + let vs: Yield[] = values; // correct data array type return vs.length; }); // Use Nest =========================================================== - // map(...) ----------------------------------------------------------- -type TestL2NestedMap = d3Collection.Map>>; +type TestL2NestedMap = d3Collection.Map>; type TestL1NestedMapRollup = d3Collection.Map; @@ -323,7 +315,7 @@ num = testL1NestedMapRollup.get('1931'); // get rollup value interface TestL2NestedObject { [keyL1: string]: { - [keyL2: string]: Array; + [keyL2: string]: Yield[]; }; } @@ -348,14 +340,14 @@ type TestL2NestedArray = Array<{ key: string; values: Array<{ key: string; - values: Array; + values: Yield[]; }> -}> +}>; type TestL1NestedArrayRollup = Array<{ key: string; value: number; -}> +}>; let testL2NestedArray: TestL2NestedArray; let testL1NestedArrayRollup: TestL1NestedArrayRollup; diff --git a/types/d3-collection/index.d.ts b/types/d3-collection/index.d.ts index 396d871767..e389862394 100644 --- a/types/d3-collection/index.d.ts +++ b/types/d3-collection/index.d.ts @@ -1,41 +1,45 @@ -// Type definitions for D3JS d3-collection module v1.0.1 +// Type definitions for D3JS d3-collection module 1.0 // Project: https://github.com/d3/d3-collection/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.1 + /** * Reference type things that can be coerced to string implicitely */ -type Stringifiable = { +export interface Stringifiable { toString(): string; -}; +} // --------------------------------------------------------------------- // Objects // --------------------------------------------------------------------- -export function keys(object: { [key: string]: any }): Array; -export function keys(object: Object): Array; +export function keys(object: { [key: string]: any }): string[]; +// TODO: When upgrading definitions to use TS 2.2+, use "object" data type in next line +export function keys(object: any): string[]; -export function values(object: { [key: string]: T }): Array; -export function values(object: Object): Array; +export function values(object: { [key: string]: T }): T[]; +// TODO: When upgrading definitions to use TS 2.2+, use "object" data type in next line +export function values(object: any): any[]; export function entries(object: { [key: string]: T }): Array<{ key: string, value: T }>; -export function entries(object: Object): Array<{ key: string, value: any }>; +// TODO: When upgrading definitions to use TS 2.2+, use "object" data type in next line +export function entries(object: any): Array<{ key: string, value: any }>; // --------------------------------------------------------------------- // map / Map // --------------------------------------------------------------------- - export interface Map { has(key: string): boolean; get(key: string): T | undefined; set(key: string, value: T): this; remove(key: string): boolean; clear(): void; - keys(): Array; - values(): Array; + keys(): string[]; + values(): T[]; entries(): Array<{ key: string, value: T }>; each(func: (value: T, key: string, map: Map) => void): void; empty(): boolean; @@ -46,20 +50,19 @@ export function map(): Map; export function map(d3Map: Map): Map; export function map(object: { [key: string]: T }): Map; export function map(object: { [key: number]: T }): Map; -export function map(array: Array, key?: (value: T, i?: number, array?: Array) => string): Map; -export function map(object: Object): Map; +export function map(array: T[], key?: (value: T, i?: number, array?: T[]) => string): Map; +export function map(object: any): Map; // TODO: When upgrading definitions to use TS 2.2+, use "object" data type for argument // --------------------------------------------------------------------- // set / Set // --------------------------------------------------------------------- - export interface Set { has(value: string | Stringifiable): boolean; add(value: string | Stringifiable): this; remove(value: string | Stringifiable): boolean; clear(): void; - values(): Array; + values(): string[]; /** * The first and second parameter of the function are both passed * the 'value' of the set entry for consistency with map.each(...) @@ -70,11 +73,10 @@ export interface Set { size(): number; } - export function set(): Set; export function set(d3Set: Set): Set; export function set(array: Array): Set; -export function set(array: Array, key: (value: T, index?: number, array?: Array) => string): Set; +export function set(array: T[], key: (value: T, index?: number, array?: T[]) => string): Set; // --------------------------------------------------------------------- // nest / Nest @@ -93,17 +95,19 @@ export function set(array: Array, key: (value: T, index?: number, array?: // Also note, that the below return types for Nest.entries(...), Nest.map(...) and Nest.object(...) strictly only work, // if AT LEAST ONE KEY was set. This seems a reasonable constraint in practice, given the intent of the nest operator. -// Otherwise, an additional '| Array | RollupType` would have to be added to the union type. This would cover +// Otherwise, an additional '| Datum[] | RollupType` would have to be added to the union type. This would cover // cases (a) without key or rollup (b) without key but with rollup. However, again, the union types make it cumbersome // without much gain. -export interface NestedArray extends Array<{ key: string, values: NestedArray | Array | undefined, value: RollupType | undefined }> { } -export interface NestedMap extends Map | Array | RollupType> { } +// tslint:disable-next-line:no-empty-interface +export interface NestedArray extends Array<{ key: string, values: NestedArray | Datum[] | undefined, value: RollupType | undefined }> { } +// tslint:disable-next-line:no-empty-interface +export interface NestedMap extends Map | Datum[] | RollupType> { } export interface NestedObject { - [key: string]: NestedObject | Array | RollupType; + [key: string]: NestedObject | Datum[] | RollupType; } -interface Nest { +export interface Nest { key(func: (datum: Datum) => string): this; sortKeys(comparator: (a: string, b: string) => number): this; sortValues(comparator: (a: Datum, b: Datum) => number): this; diff --git a/types/d3-collection/tslint.json b/types/d3-collection/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-collection/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-color/d3-color-tests.ts b/types/d3-color/d3-color-tests.ts index 29b9303a2b..c001080d36 100644 --- a/types/d3-color/d3-color-tests.ts +++ b/types/d3-color/d3-color-tests.ts @@ -20,11 +20,11 @@ function isHSL(color: d3Color.RGBColor | d3Color.HSLColor): color is d3Color.HSL // Signature tests for 'color', rgb and hsl -let c: d3Color.RGBColor | d3Color.HSLColor, - cRGB: d3Color.RGBColor, - cHSL: d3Color.HSLColor, - displayable: boolean, - cString: string; +let c: d3Color.RGBColor | d3Color.HSLColor; +let cRGB: d3Color.RGBColor; +let cHSL: d3Color.HSLColor; +let displayable: boolean; +let cString: string; // string signature c = d3Color.color('steelblue'); @@ -40,7 +40,6 @@ c = d3Color.color(cRGB); cRGB = d3Color.color('hsl(60, 100%, 20%, 0.5)').rgb(); - cRGB = d3Color.rgb(20, 100, 200); cRGB = d3Color.rgb(20, 100, 200, 0.5); cRGB = d3Color.rgb('steelblue'); @@ -90,7 +89,6 @@ cString = cLab.toString(); console.log('Channels = (l : %d, a: %d, b: %d)', cLab.l, cLab.a, cLab.b); console.log('Opacity = %d', cLab.opacity); - // Signature tests for HCL let cHcl: d3Color.HCLColor; diff --git a/types/d3-color/index.d.ts b/types/d3-color/index.d.ts index ed9c706667..96b24fd09e 100644 --- a/types/d3-color/index.d.ts +++ b/types/d3-color/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-color module v1.0.1 +// Type definitions for D3JS d3-color module 1.0 // Project: https://github.com/d3/d3-color/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.1 + // --------------------------------------------------------------------------- // Shared Type Definitions and Interfaces // --------------------------------------------------------------------------- @@ -127,14 +129,14 @@ export interface CubehelixColorFactory extends Function { // Color object factories // -------------------------------------------------------------------------- -export var color: ColorFactory; +export const color: ColorFactory; -export var rgb: RGBColorFactory; +export const rgb: RGBColorFactory; -export var hsl: HSLColorFactory; +export const hsl: HSLColorFactory; -export var lab: LabColorFactory; +export const lab: LabColorFactory; -export var hcl: HCLColorFactory; +export const hcl: HCLColorFactory; -export var cubehelix: CubehelixColorFactory; +export const cubehelix: CubehelixColorFactory; diff --git a/types/d3-color/tslint.json b/types/d3-color/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-color/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-contour/d3-contour-tests.ts b/types/d3-contour/d3-contour-tests.ts new file mode 100644 index 0000000000..751dfe99c9 --- /dev/null +++ b/types/d3-contour/d3-contour-tests.ts @@ -0,0 +1,189 @@ +/** + * Typescript definition tests for d3/d3-contour module + * + * Note: These tests are intended to test the definitions only + * in the sense of typing and call signature consistency. They + * are not intended as functional tests. + */ + +import * as d3Contour from 'd3-contour'; +import { + range, + thresholdSturges, + ThresholdArrayGenerator, + ThresholdCountGenerator +} from 'd3-array'; +import { geoPath } from 'd3-geo'; +import { randomNormal } from 'd3-random'; + +// ----------------------------------------------------------------------------- +// Preparatory Steps +// ----------------------------------------------------------------------------- + +// Some test setup is based on Contour Plot II Golstein-Price function at https://bl.ocks.org/mbostock/f48ff9c1af4d637c9a518727f5fdfef5 + +const n = 256; +const m = 256; +const values: number[] = new Array(n * m); +for (let j = 0.5, k = 0; j < m; ++j) { + for (let i = 0.5; i < n; ++i, ++k) { + values[k] = goldsteinPrice(i / n * 4 - 2, 1 - j / m * 3); + } +} + +function goldsteinPrice(x: number, y: number) { + return (1 + Math.pow(x + y + 1, 2) * (19 - 14 * x + 3 * x * x - 14 * y + 6 * x * x + 3 * y * y)) + * (30 + Math.pow(2 * x - 3 * y, 2) * (18 - 32 * x + 12 * x * x + 48 * y - 36 * x * y + 27 * y * y)); +} + +let size: [number, number]; +let boolFlag: boolean; +const thresholdArrayGen: ThresholdArrayGenerator = (values: number[], min: number, max: number) => { + let thresholds: number[]; + thresholds = [values[1], values[2], values[4]]; + return thresholds; +}; + +let thresholdGenerator: ThresholdArrayGenerator | ThresholdCountGenerator; +let pathStringMaybe: string | null; +let num: number; + +const pathSolo = geoPath(); + +// ----------------------------------------------------------------------------- +// Test Contour Generator +// ----------------------------------------------------------------------------- + +// Get contour generator ------------------------------------------------------- + +let contGen: d3Contour.Contours = d3Contour.contours(); + +// Configure contour generator ================================================= + +// size(...) ------------------------------------------------------------------- + +// set with chainability +contGen = contGen.size([n, m]); + +size = contGen.size(); + +// smooth(...) ----------------------------------------------------------------- + +// set with chainability +contGen = contGen.smooth(true); + +boolFlag = contGen.smooth(); + +// thresholds(...) ------------------------------------------------------------- + +// set with count +contGen = contGen.thresholds(10); + +// set with array +const thresholds1 = range(1, 21) + .map(p => Math.pow(2, p)); +contGen = contGen.thresholds(thresholds1); + +// set with threshold array generator + +contGen = contGen.thresholds(thresholdArrayGen); // mock + +// set with threshold count generator + +contGen = contGen.thresholds(thresholdSturges); + +// get +thresholdGenerator = contGen.thresholds(); + +// Use contour generator ======================================================= + +pathStringMaybe = pathSolo(contGen(values)[0]); + +// ----------------------------------------------------------------------------- +// Test Contour Generator for Density Estimates +// ----------------------------------------------------------------------------- + +interface CustomDatum { + x: number; + y: number; +} + +// Get contour generator ------------------------------------------------------- + +let contDensDefault: d3Contour.ContourDensity<[number, number]> = d3Contour.contourDensity(); +let contDensCustom: d3Contour.ContourDensity = d3Contour.contourDensity(); + +// Configure contour generator ================================================= + +// x(...) ---------------------------------------------------------------------- + +// set with chainability +contDensCustom = contDensCustom.x((datum) => { + const d: CustomDatum = datum; // check passed in argument type + return d.x; +}); + +// get +const xAcc: (d: CustomDatum) => number = contDensCustom.x(); + +// y(...) ---------------------------------------------------------------------- + +// set with chainability +contDensCustom = contDensCustom.y((datum) => { + const d: CustomDatum = datum; // check passed in argument type + return d.y; +}); + +// get +const yAcc: (d: CustomDatum) => number = contDensCustom.y(); + +// size(...) ------------------------------------------------------------------- + +// set with chainability +contDensCustom = contDensCustom.size([900, 600]); + +size = contDensCustom.size(); + +// cellSize(...) ----------------------------------------------------------------- + +// set with chainability +contDensCustom = contDensCustom.cellSize(3); + +num = contDensCustom.cellSize(); + +// thresholds(...) ------------------------------------------------------------- + +// set with count +contDensCustom = contDensCustom.thresholds(10); + +// set with array +contDensCustom = contDensCustom.thresholds([0.1, 0.25, 0.5, 0.75, 1]); + +// set with threshold array generator +contDensCustom = contDensCustom.thresholds(thresholdArrayGen); // mock + +// set with threshold count generator +contDensCustom = contDensCustom.thresholds(thresholdSturges); + +// get +thresholdGenerator = contDensCustom.thresholds(); + +// bandwidth(...) -------------------------------------------------------------- +// set with chainability +contDensCustom = contDensCustom.bandwidth(40); +// get +num = contDensCustom.bandwidth(); + +// Use contour generator ======================================================= + +const indNorm: CustomDatum[] = []; +const rX = randomNormal(); +const rY = randomNormal(1, 2); +for (let i = 0; i < 1000; i++) { + indNorm.push({ + x: rX(), + y: rY() + }); +} + +pathStringMaybe = pathSolo(contDensCustom(indNorm)[0]); diff --git a/types/d3-contour/index.d.ts b/types/d3-contour/index.d.ts new file mode 100644 index 0000000000..789ff32a5f --- /dev/null +++ b/types/d3-contour/index.d.ts @@ -0,0 +1,246 @@ +// Type definitions for d3-contour 1.1 +// Project: https://d3js.org/d3-contour/ +// Definitions by: Tom Wanzek , Hugues Stefanski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Last module patch version validated against: 1.1.0 + +import { MultiPolygon } from 'geojson'; +import { ThresholdArrayGenerator, ThresholdCountGenerator } from 'd3-array'; + +/** + * An extended GeoJSON MultiPolygon representing a contour. + */ +export interface ContourMultiPolygon extends MultiPolygon { + /** + * Threshold value of the contour. + */ + value: number; +} + +/** + * A contour generator which computes contour polygons by applying marching squares to a rectangular array of numeric values. + * + * For each threshold value, the contour generator constructs a GeoJSON MultiPolygon geometry object representing the area + * where the input values are greater than or equal to the threshold value. + * The geometry is in planar coordinates, where ⟨i + 0.5, j + 0.5⟩ corresponds to element i + jn in the input values array. + * + */ +export interface Contours { + /** + * Computes the contours for the given array of values, returning an array of GeoJSON MultiPolygon geometry objects. + * Each geometry object represents the area where the input values are greater than or equal to the corresponding threshold value; + * the threshold value for each geometry object is exposed as geometry.value. + * + * The returned geometry objects are typically passed to d3.geoPath to display, + * using null or d3.geoIdentity as the associated projection + * + * @param values Array of input values. The input values must be an array of length n×m where [n, m] is the contour generator’s size; + * furthermore, each values[i + jn] must represent the value at the position ⟨i, j⟩. + */ + (values: number[]): ContourMultiPolygon[]; + + /** + * Return the expected size of the input values grid, which defaults to [1,1]. + */ + size(): [number, number]; + /** + * Sets the expected size of the input values grid to the contour generator and returns the contour generator. + * + * @param size Size of the input values grid specified as an array [n, m] + * where n is the number of columns in the grid and m is the number of rows; n and m must be positive integers. + */ + size(size: [number, number]): this; + + /** + * Returns the current smoothing flag, which defaults to true. + */ + smooth(): boolean; + /** + * Sets whether or not the generated contour polygons are smoothed using linear interpolation and returns the contour generator. + * + * @param smooth Flag to enable linear interpolation. The default is "true". + */ + smooth(smooth: boolean): this; + + /** + * Returns the current threshold generator, which by default implements Sturges’ formula. + */ + thresholds(): ThresholdCountGenerator | ThresholdArrayGenerator; + /** + * Sets the threshold generator to use the specified count and returns this contour generator. + * The input values’ extent will be uniformly divided into approximately count bins. + * + * @param count Expected number of threshold bins. + */ + thresholds(count: number): this; + /** + * Sets the threshold generator to the specified array and returns this contour generator. + * + * Thresholds are defined as an array of values [x0, x1, …]. + * The first generated contour corresponds to the area where the input values are greater than or equal to x0; + * the second contour corresponds to the area where the input values are greater than or equal to x1, and so on. + * Thus, there is exactly one generated MultiPolygon geometry object for each specified threshold value; + * the threshold value is exposed as geometry.value. + * + * @param thresholds Array of thresholds to use. + */ + thresholds(thresholds: number[]): this; + /** + * Sets the threshold generator to the specified function and returns this contour generator. + * + * Thresholds are defined as an array of values [x0, x1, …]. + * The first generated contour corresponds to the area where the input values are greater than or equal to x0; + * the second contour corresponds to the area where the input values are greater than or equal to x1, and so on. + * Thus, there is exactly one generated MultiPolygon geometry object for each specified threshold value; + * the threshold value is exposed as geometry.value. + * + * @param thresholds A threshold generator function. The threshold generator function is passed the array of input values + * as its argument and returns either an array of calculated thresholds, or the count of thresholds to use. + */ + thresholds(thresholds: ThresholdCountGenerator | ThresholdArrayGenerator): this; +} + +/** + * Construct a new contour generator with the default settings. + */ +export function contours(): Contours; + +/** + * A contour generator for density estimates. + */ +export interface ContourDensity { + /** + * Estimates the density contours for the given array of data, returning an array of GeoJSON MultiPolygon geometry objects. + * Each geometry object represents the area where the estimated number of points per square pixel is greater than or equal to + * the corresponding threshold value; the threshold value for each geometry object is exposed as geometry.value. + * The returned geometry objects are typically passed to d3.geoPath to display, using null or d3.geoIdentity as the associated projection. + * See also d3.contours. + * + * The x- and y-coordinate for each data point are computed using density.x and density.y. + * The generated contours are only accurate within the estimator’s defined size. + * + * @param data Array of input data. + */ + (data: Datum[]): ContourMultiPolygon[]; + + /** + * Returns the current x-coordinate accessor. + * The default x-coordinate accessor is a functions which accepts as input a two-element array of numbers + * and returns the element at index 0. + */ + x(): (d: Datum) => number; + /** + * Sets the x-coordinate accessor and returns the density contour estimator. + * + * @param x An x-coordinate accessor function, which accepts as input an element of the input data array and returns the + * x-coordinate. + */ + x(x: (d: Datum) => number): this; + + /** + * Returns the current y-coordinate accessor. + * The default y-coordinate accessor is a functions which accepts as input a two-element array of numbers + * and returns the element at index 1. + */ + y(): (d: Datum) => number; + /** + * Sets the y-coordinate accessor and returns the density contour estimator. + * + * @param y An y-coordinate accessor function, which accepts as input an element of the input data array and returns the + * y-coordinate. + */ + y(y: (d: Datum) => number): this; + + /** + * Returns the current size, which defaults to [960, 500]. + */ + size(): [number, number]; + /** + * Sets the size of the density estimator to the specified bounds and returns the density contour estimator. + * + * @param size The size is specified as an array [width, height], where width is the maximum x-value and height is the maximum y-value. + */ + size(size: [number, number]): this; + + /** + * Returns the current cell size, which defaults to 4. + */ + cellSize(): number; + /** + * Sets the size of individual cells in the underlying bin grid to the specified positive integer and returns the density contour estimator. + * + * The cell size is rounded down to the nearest power of two. Smaller cells produce more detailed contour polygons, but are more expensive to compute. + * + * @param cellSize Cell size, a positive integer. + */ + cellSize(cellSize: number): this; + + /** + * Returns the current threshold generator, which by default generates about twenty nicely-rounded density thresholds. + */ + thresholds(): ThresholdCountGenerator | ThresholdArrayGenerator; + /** + * Sets the threshold generator to use the specified count and returns this density contour estimator. + * Approximately count uniformly-spaced nicely-rounded thresholds will be generated. + * + * @param count Expected number of thresholds. + */ + thresholds(count: number): this; + /** + * Sets the threshold generator to the specified array and returns this density contour estimator. + * + * Thresholds are defined as an array of values [x0, x1, …]. The first generated density contour corresponds to the area + * where the estimated density is greater than or equal to x0; the second contour corresponds to the area + * where the estimated density is greater than or equal to x1, and so on. + * Thus, there is exactly one generated MultiPolygon geometry object for each specified threshold value; + * the threshold value is exposed as geometry.value. The first value x0 should typically be greater than zero. + * + * @param thresholds Array of thresholds to use. + */ + thresholds(thresholds: number[]): this; + /** + * Sets the threshold generator to the specified function and returns this density contour estimator. + * + * Thresholds are defined as an array of values [x0, x1, …]. The first generated density contour corresponds to the area + * where the estimated density is greater than or equal to x0; the second contour corresponds to the area + * where the estimated density is greater than or equal to x1, and so on. + * Thus, there is exactly one generated MultiPolygon geometry object for each specified threshold value; + * the threshold value is exposed as geometry.value. The first value x0 should typically be greater than zero. + * + * @param thresholds A threshold generator function. The threshold generator function is passed the array of input values + * as its argument and returns either an array of calculated thresholds, or the count of thresholds to use. + */ + thresholds(thresholds: ThresholdCountGenerator | ThresholdArrayGenerator): this; + + /** + * Returns the current bandwidth, which defaults to 20.4939…. + */ + bandwidth(): number; + /** + * Sets the bandwidth (the standard deviation) of the Gaussian kernel and returns the density contour estimator. + * + * @param bandwidth Bandwidth (the standard deviation) of the Gaussian kernel. + * The specified bandwidth is currently rounded to the nearest supported value by this implementation, and must be nonnegative. + */ + bandwidth(bandwidth: number): this; +} + +/** + * Construct a new contour generator for density estimates with the default settings. + * + * The default settings assume that, the elements of the data array used + * with the density contour generator are two-element arrays. The first element + * corresponds to the x-dimension, the second to the y-dimension. + */ +export function contourDensity(): ContourDensity<[number, number]>; +/** + * Construct a new contour generator for density estimates. + * + * The generic refers to the data type of an element in the data array + * used with the density contour generator. + * + * Important: ensure that the x- and y-accessor functions are configured to + * match the data type used for the generic Datum. + */ +export function contourDensity(): ContourDensity; diff --git a/types/d3-contour/tsconfig.json b/types/d3-contour/tsconfig.json new file mode 100644 index 0000000000..4f9d0a8284 --- /dev/null +++ b/types/d3-contour/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-contour-tests.ts" + ] +} diff --git a/types/d3-contour/tslint.json b/types/d3-contour/tslint.json new file mode 100644 index 0000000000..08016de61a --- /dev/null +++ b/types/d3-contour/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-dispatch/d3-dispatch-tests.ts b/types/d3-dispatch/d3-dispatch-tests.ts index 6f358587f3..436bc3d6d4 100644 --- a/types/d3-dispatch/d3-dispatch-tests.ts +++ b/types/d3-dispatch/d3-dispatch-tests.ts @@ -15,25 +15,24 @@ interface Datum { b: string; } -let dispatch: d3Dispatch.Dispatch, - copy: d3Dispatch.Dispatch, - copy2: d3Dispatch.Dispatch; +let dispatch: d3Dispatch.Dispatch; +let copy: d3Dispatch.Dispatch; +let copy2: d3Dispatch.Dispatch; // Signature Tests ---------------------------------------- // create new dispatch object dispatch = d3Dispatch.dispatch('foo', 'bar'); - function cbFn(this: HTMLElement, d: Datum, i: number) { console.log(this.baseURI ? this.baseURI : 'nada'); console.log(d ? d.a : 'nada'); -}; +} function cbFn2(this: SVGElement, d: Datum, i: number) { console.log(this.baseURI ? this.baseURI : 'nada'); console.log(d ? d.a : 'nada'); -}; +} dispatch.on('foo', cbFn); // dispatch.on('foo', cbFn2); // test fails as 'this' context type is mismatched between dispatch and callback function diff --git a/types/d3-dispatch/index.d.ts b/types/d3-dispatch/index.d.ts index 71d77da9f7..1e6e82e06f 100644 --- a/types/d3-dispatch/index.d.ts +++ b/types/d3-dispatch/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-dispatch module v1.0.1 +// Type definitions for D3JS d3-dispatch module 1.0 // Project: https://github.com/d3/d3-dispatch/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.1 + export interface Dispatch { apply(type: string, that?: T, args?: any[]): void; call(type: string, that?: T, ...args: any[]): void; diff --git a/types/d3-dispatch/tslint.json b/types/d3-dispatch/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-dispatch/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-drag/d3-drag-tests.ts b/types/d3-drag/d3-drag-tests.ts index 4283cb259f..581b757717 100644 --- a/types/d3-drag/d3-drag-tests.ts +++ b/types/d3-drag/d3-drag-tests.ts @@ -88,6 +88,12 @@ circleDrag = circleDrag containerAccessor = circleDrag.container(); +// clickDistance(...) --------------------------------------------------------- + +circleDrag = circleDrag.clickDistance(5); + +const distance: number = circleDrag.clickDistance(); + // set and get filter --------------------------------------------------------- let filterFn: (this: SVGCircleElement, datum: CircleDatum, index: number, group: SVGCircleElement[] | NodeListOf) => boolean; diff --git a/types/d3-drag/index.d.ts b/types/d3-drag/index.d.ts index d3a65fb377..7105bd4e4d 100644 --- a/types/d3-drag/index.d.ts +++ b/types/d3-drag/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for D3JS d3-drag module 1.0 +// Type definitions for D3JS d3-drag module 1.1 // 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 +// Last module patch version validated against: 1.1.0 import { ArrayLike, Selection, ValueFn } from 'd3-selection'; @@ -164,6 +164,20 @@ export interface DragBehavior): this; + /** + * Return the current click distance threshold, which defaults to zero. + */ + clickDistance(): number; + /** + * Set the maximum distance that the mouse can move between mousedown and mouseup that will trigger + * a subsequent click event. If at any point between mousedown and mouseup the mouse is greater than or equal to + * distance from its position on mousedown, the click event follwing mouseup will be suppressed. + * + * @param distance The distance threshold between mousedown and mouseup measured in client coordinates (event.clientX and event.clientY). + * The default is zero. + */ + clickDistance(distance: number): this; + /** * Return the first currently-assigned listener matching the specified typenames, if any. * diff --git a/types/d3-ease/index.d.ts b/types/d3-ease/index.d.ts index 3de6fd2e87..1f2b5f4cdd 100644 --- a/types/d3-ease/index.d.ts +++ b/types/d3-ease/index.d.ts @@ -87,7 +87,7 @@ export interface PolynomialEasingFactory { * * @param e Exponent for polynomial easing. */ - exponent(e: number): PolynomialEasingFactory; + exponent(e: number): PolynomialEasingFactory; } /** @@ -240,7 +240,7 @@ export interface BackEasingFactory { * * @param s Overshoot parameter */ - overshoot(s: number): BackEasingFactory; + overshoot(s: number): BackEasingFactory; } /** @@ -282,14 +282,14 @@ export interface ElasticEasingFactory { * * @param a Amplitude for elastic easing. */ - amplitude(a: number): ElasticEasingFactory; - /** - * Returns a new elastic easing with the specified amplitude a. - * Defaults to 0.3,if not specified. - * - * @param p Period for elastic easing. - */ - period(p: number): ElasticEasingFactory; + amplitude(a: number): ElasticEasingFactory; + /** + * Returns a new elastic easing with the specified amplitude a. + * Defaults to 0.3,if not specified. + * + * @param p Period for elastic easing. + */ + period(p: number): ElasticEasingFactory; } /** diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts index f6e4fa150d..bff408ce6b 100644 --- a/types/d3-geo/index.d.ts +++ b/types/d3-geo/index.d.ts @@ -3,10 +3,10 @@ // Definitions by: Hugues Stefanski , Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - // Last module patch version validated against: 1.6.1 +import * as GeoJSON from 'geojson'; + // ---------------------------------------------------------------------- // Shared Interfaces and Types // ---------------------------------------------------------------------- @@ -926,7 +926,8 @@ export interface GeoPath { * * 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. + * IMPORTANT: If the rendering context of the geoPath generator is null, + * then the geoPath is returned as an SVG path data string. * * 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. @@ -935,7 +936,36 @@ export interface GeoPath { * * @param object An object to be rendered. */ - (this: This, object: DatumObject, ...args: any[]): string | undefined; + (this: This, object: DatumObject, ...args: any[]): string | null; + /** + * 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. + * + * IMPORTANT: If the geoPath generator has been configured with a rendering context, + * then the geoPath is rendered to this context as a sequence of path method calls and this function returns void. + * + * 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[]): void; /** * Returns the projected planar area (typically in square pixels) for the specified GeoJSON object. diff --git a/types/d3-hsv/d3-hsv-tests.ts b/types/d3-hsv/d3-hsv-tests.ts index fff2e55935..72e18145e6 100644 --- a/types/d3-hsv/d3-hsv-tests.ts +++ b/types/d3-hsv/d3-hsv-tests.ts @@ -9,10 +9,10 @@ import {hsv, HSVColor} from 'd3-hsv'; import {rgb, RGBColor} from 'd3-color'; -let c: RGBColor, - cHSV: HSVColor, - displayable: boolean, - cString: string; +let c: RGBColor; +let cHSV: HSVColor; +let displayable: boolean; +let cString: string; // hsv signature cHSV = hsv(120, 0.4, 0.5); diff --git a/types/d3-hsv/index.d.ts b/types/d3-hsv/index.d.ts index a7501b60c7..c10fa6ee44 100644 --- a/types/d3-hsv/index.d.ts +++ b/types/d3-hsv/index.d.ts @@ -1,11 +1,13 @@ -// Type definitions for D3JS d3-hsv module v0.0.3 +// Type definitions for D3JS d3-hsv module 0.0 // Project: https://github.com/d3/d3-hsv/ // Definitions by: Yuri Feldman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 0.0.3 + import {Color, RGBColor, ColorSpaceObject, ColorCommonInstance} from 'd3-color'; -type ColorSpaceObjectWithHSV = ColorSpaceObject | HSVColor; +export type ColorSpaceObjectWithHSV = ColorSpaceObject | HSVColor; export interface HSVColorFactory extends Function { (h: number, s: number, v: number, opacity?: number): HSVColor; @@ -23,4 +25,4 @@ export interface HSVColor extends Color { rgb(): RGBColor; } -export var hsv: HSVColorFactory; +export const hsv: HSVColorFactory; diff --git a/types/d3-hsv/tslint.json b/types/d3-hsv/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-hsv/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-interpolate/d3-interpolate-tests.ts b/types/d3-interpolate/d3-interpolate-tests.ts index 2ada5864cd..5cbb6fe3a0 100644 --- a/types/d3-interpolate/d3-interpolate-tests.ts +++ b/types/d3-interpolate/d3-interpolate-tests.ts @@ -17,54 +17,52 @@ interface Interpolator { } class NumCoercible { - public a: number; + a: number; constructor(a: number) { this.a = a; } - public valueOf() { + valueOf() { return this.a; } } class StringCoercible { - public a: string; + a: string; constructor(a: string) { this.a = a; } - public toString() { + toString() { return this.a; } } +let iNum: Interpolator; +let iString: Interpolator; +let iDate: Interpolator; +let iArrayNum: Interpolator; +let iArrayStr: Interpolator; +let iArrayDate: Interpolator; +let iArrayMixed: Interpolator<[Date, string]>; +let iKeyVal: Interpolator<{ [key: string]: any }>; +let iRGBColorObj: Interpolator; +let iZoom: d3Interpolate.ZoomInterpolator; -let iNum: Interpolator, - iString: Interpolator, - iDate: Interpolator, - iArrayNum: Interpolator>, - iArrayStr: Interpolator>, - iArrayDate: Interpolator>, - iArrayMixed: Interpolator<[Date, string]>, - iKeyVal: Interpolator<{ [key: string]: any }>, - iRGBColorObj: Interpolator, - iZoom: d3Interpolate.ZoomInterpolator; - -let num: number, - str: string, - arrNum: number[], - arrStr: string[], - objKeyVal: { [key: string]: any }, - objRGBColor: d3Color.RGBColor, - objHSVColor: d3Hsv.HSVColor, - zoom: [number, number, number]; +let num: number; +let str: string; +let arrNum: number[]; +let arrStr: string[]; +let objKeyVal: { [key: string]: any }; +let objRGBColor: d3Color.RGBColor; +let objHSVColor: d3Hsv.HSVColor; +let zoom: [number, number, number]; // test interpolate(a, b) signature ---------------------------------------------------- iNum = d3Interpolate.interpolate('1', 5); - // color interpolator returning a color string iString = d3Interpolate.interpolate('seagreen', d3Color.rgb(100, 100, 100)); iString = d3Interpolate.interpolate('seagreen', d3Hsv.hsv(60, 1, 0.2, 0.4)); @@ -118,13 +116,13 @@ iDate = d3Interpolate.interpolateDate(new Date(2016, 6, 1), new Date(2016, 6, 31 // test interpolateArray(a, b) signature ---------------------------------------------------- -iArrayNum = d3Interpolate.interpolateArray>([1, 2], [4, 8]); // explicit typing +iArrayNum = d3Interpolate.interpolateArray([1, 2], [4, 8]); // explicit typing arrNum = iArrayNum(0.5); iArrayNum = d3Interpolate.interpolateArray<[number, number]>(['1', '2'], [4, 8]); // explicit typing arrNum = iArrayNum(0.5); -iArrayStr = d3Interpolate.interpolateArray>(['1', '2'], ['4', '8']); // explicit typing +iArrayStr = d3Interpolate.interpolateArray(['1', '2'], ['4', '8']); // explicit typing arrStr = iArrayStr(0.5); iArrayStr = d3Interpolate.interpolateArray([1, 2], ['4', '8']); // infered typing @@ -151,7 +149,6 @@ str = iString(0.5); iString = d3Interpolate.interpolateTransformSvg('rotate(0)', 'rotate(60)'); str = iString(0.5); - // test interpolateZoom(a, b) signature ---------------------------------------------------- iZoom = d3Interpolate.interpolateZoom([50, 50, 300], [100, 100, 500]); @@ -229,9 +226,7 @@ str = iString(0.5); // with gamma correction iString = d3Interpolate.interpolateCubehelixLong.gamma(2.2)('purple', 'orange'); - - -// test interpolateBasis(splineNodes) and interpolateBasisClosed(splineNodes: Array) ---------------------------- +// test interpolateBasis(splineNodes) and interpolateBasisClosed(splineNodes: number[]) ---------------------------- iNum = d3Interpolate.interpolateBasis([1, 50, 30, 10]); diff --git a/types/d3-interpolate/index.d.ts b/types/d3-interpolate/index.d.ts index a4d145d2b8..e3fcfa21d8 100644 --- a/types/d3-interpolate/index.d.ts +++ b/types/d3-interpolate/index.d.ts @@ -1,16 +1,16 @@ -// Type definitions for D3JS d3-interpolate module v1.1.1 +// Type definitions for D3JS d3-interpolate module 1.1 // Project: https://github.com/d3/d3-interpolate/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { ColorCommonInstance } from 'd3-color'; +// Last module patch version validated against: 1.1.1 +import { ColorCommonInstance } from 'd3-color'; // -------------------------------------------------------------------------- // Shared Type Definitions and Interfaces // -------------------------------------------------------------------------- - export interface ZoomInterpolator extends Function { (t: number): ZoomView; /** @@ -42,12 +42,11 @@ export function interpolate(a: number | { valueOf(): number }, b: number): ((t: export function interpolate(a: any, b: ColorCommonInstance): ((t: number) => string); export function interpolate(a: Date, b: Date): ((t: number) => Date); export function interpolate(a: string | { toString(): string }, b: string): ((t: number) => string); -export function interpolate>(a: Array, b: U): ((t: number) => U); +export function interpolate(a: any[], b: U): ((t: number) => U); export function interpolate(a: number | { valueOf(): number }, b: { valueOf(): number }): ((t: number) => number); -export function interpolate(a: any, b: U): ((t: number) => U); +export function interpolate(a: any, b: U): ((t: number) => U); // TODO: extends 'any' should become 'object' with TS 2.2+ definitions export function interpolate(a: any, b: { [key: string]: any }): ((t: number) => { [key: string]: any }); - export function interpolateNumber(a: number | { valueOf(): number }, b: number | { valueOf(): number }): ((t: number) => number); export function interpolateRound(a: number | { valueOf(): number }, b: number | { valueOf(): number }): ((t: number) => number); @@ -56,13 +55,11 @@ export function interpolateString(a: string | { toString(): string }, b: string export function interpolateDate(a: Date, b: Date): ((t: number) => Date); -export function interpolateArray>(a: Array, b: A): ((t: number) => A); +export function interpolateArray(a: any[], b: A): ((t: number) => A); -export function interpolateObject(a: any, b: U): ((t: number) => U); +export function interpolateObject(a: any, b: U): ((t: number) => U); // TODO: extends 'any' should become 'object' with TS 2.2+ definitions export function interpolateObject(a: { [key: string]: any }, b: { [key: string]: any }): ((t: number) => { [key: string]: any }); - - export function interpolateTransformCss(a: string, b: string): ((t: number) => string); export function interpolateTransformSvg(a: string, b: string): ((t: number) => string); @@ -71,12 +68,11 @@ export function interpolateTransformSvg(a: string, b: string): ((t: number) => s */ export function interpolateZoom(a: ZoomView, b: ZoomView): ZoomInterpolator; - -export function quantize(interpolator: ((t: number) => T), n: number): Array; +export function quantize(interpolator: ((t: number) => T), n: number): T[]; // Color interpolation related -export var interpolateRgb: ColorGammaInterpolationFactory; +export const interpolateRgb: ColorGammaInterpolationFactory; export function interpolateRgbBasis(colors: Array): ((t: number) => string); export function interpolateRgbBasisClosed(colors: Array): ((t: number) => string); @@ -86,10 +82,10 @@ export function interpolateHslLong(a: string | ColorCommonInstance, b: string | export function interpolateLab(a: string | ColorCommonInstance, b: string | ColorCommonInstance): ((t: number) => string); export function interpolateHcl(a: string | ColorCommonInstance, b: string | ColorCommonInstance): ((t: number) => string); export function interpolateHclLong(a: string | ColorCommonInstance, b: string | ColorCommonInstance): ((t: number) => string); -export var interpolateCubehelix: ColorGammaInterpolationFactory; -export var interpolateCubehelixLong: ColorGammaInterpolationFactory; +export const interpolateCubehelix: ColorGammaInterpolationFactory; +export const interpolateCubehelixLong: ColorGammaInterpolationFactory; // Spline related -export function interpolateBasis(splineNodes: Array): ((t: number) => number); -export function interpolateBasisClosed(splineNodes: Array): ((t: number) => number); +export function interpolateBasis(splineNodes: number[]): ((t: number) => number); +export function interpolateBasisClosed(splineNodes: number[]): ((t: number) => number); diff --git a/types/d3-interpolate/tslint.json b/types/d3-interpolate/tslint.json new file mode 100644 index 0000000000..604d5950cf --- /dev/null +++ b/types/d3-interpolate/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false, + "callable-types": false + } +} diff --git a/types/d3-path/d3-path-tests.ts b/types/d3-path/d3-path-tests.ts index 4240a8f7be..b11a3405e3 100644 --- a/types/d3-path/d3-path-tests.ts +++ b/types/d3-path/d3-path-tests.ts @@ -8,19 +8,16 @@ import * as d3Path from 'd3-path'; - // ----------------------------------------------------------------------------------------- // Test create new path serializer // ----------------------------------------------------------------------------------------- let context: d3Path.Path = d3Path.path(); - // ----------------------------------------------------------------------------------------- // Test path serializer methods // ----------------------------------------------------------------------------------------- - context.moveTo(50, 50); context.lineTo(100, 100); diff --git a/types/d3-path/index.d.ts b/types/d3-path/index.d.ts index 7315ced2cb..7c0f662018 100644 --- a/types/d3-path/index.d.ts +++ b/types/d3-path/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.0.3 +// Last module patch version validated against: 1.0.5 /** * A D3 path serializer implementing CanvasPathMethods diff --git a/types/d3-path/tslint.json b/types/d3-path/tslint.json new file mode 100644 index 0000000000..604d5950cf --- /dev/null +++ b/types/d3-path/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false, + "callable-types": false + } +} diff --git a/types/d3-polygon/index.d.ts b/types/d3-polygon/index.d.ts index 40dbaa4f4f..64e1d2c9b9 100644 --- a/types/d3-polygon/index.d.ts +++ b/types/d3-polygon/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-polygon module v1.0.1 +// Type definitions for D3JS d3-polygon module 1.0 // Project: https://github.com/d3/d3-polygon/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.1 + /** * Returns the signed area of the specified polygon. If the vertices of the polygon are in counterclockwise order ( * assuming a coordinate system where the origin ⟨0,0⟩ is in the top-left corner), the returned area is positive; diff --git a/types/d3-polygon/tslint.json b/types/d3-polygon/tslint.json new file mode 100644 index 0000000000..604d5950cf --- /dev/null +++ b/types/d3-polygon/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false, + "callable-types": false + } +} diff --git a/types/d3-quadtree/d3-quadtree-tests.ts b/types/d3-quadtree/d3-quadtree-tests.ts index 9a285dc204..5fabc66961 100644 --- a/types/d3-quadtree/d3-quadtree-tests.ts +++ b/types/d3-quadtree/d3-quadtree-tests.ts @@ -27,7 +27,7 @@ interface TestDatum { let testDatum: TestDatum; -let testData: Array = [ +let testData: TestDatum[] = [ { x: 10, y: 20 }, { x: 30, y: 10 }, { x: 15, y: 80 }, @@ -39,7 +39,6 @@ let testData: Array = [ let node: d3Quadtree.QuadtreeInternalNode | d3Quadtree.QuadtreeLeaf; let numberAccessor: (d: TestDatum) => number; - let simpleTestData: Array<[number, number]> = [ [10, 20], [30, 10], @@ -76,8 +75,8 @@ quadtree = d3Quadtree.quadtree(testData); // explicitly typed to Test // test with data AND accessors passed in right away quadtree = d3Quadtree.quadtree( testData, // data type Array - function (d) { return d.x; }, // x accessor with d of type TestDatum - function (d) { return d.y; } // y accessor with d of type TestDatum + d => d.x, // x accessor with d of type TestDatum + d => d.y // y accessor with d of type TestDatum ); // inferred type underlying quadtree TestDatum quadtree = d3Quadtree.quadtree(testData); // explicitly typed to TestDatum @@ -86,26 +85,20 @@ quadtree = d3Quadtree.quadtree(testData); // explicitly typed to Test quadtree = d3Quadtree.quadtree(); // quadtree = d3Quadtree.quadtree(); fails, wrong underlying data type - // Configure Quadtree ======================================================== // x(...) -------------------------------------------------------------------- -quadtree = quadtree.x(function (d) { - return d.x; // d of type TestDatum -}); +quadtree = quadtree.x(d => d.x); // d of type TestDatum numberAccessor = quadtree.x(); // y(...) -------------------------------------------------------------------- -quadtree = quadtree.y(function (d) { - return d.y; // d of type TestDatum -}); +quadtree = quadtree.y(d => d.y); // d of type TestDatum numberAccessor = quadtree.y(); - // extent(...) --------------------------------------------------------------- quadtree = quadtree.extent([[0, 0], [80, 80]]); @@ -125,7 +118,6 @@ quadtree = quadtree.add({ x: 35, y: 35 }); quadtree = quadtree.addAll(testData); // quadtree = quadtree.addAll([{x: 35}, {x: 55, y: 13}]); // fails, incompatible data type - // remove(...) --------------------------------------------------------------- quadtree = quadtree.remove({ x: 35, y: 35 }); @@ -164,7 +156,7 @@ testDatum = quadtree.find(20, 30, 10); // visit() -------------------------------------------------------------------- -quadtree = quadtree.visit(function (node, x0, y0, x1, y1) { +quadtree = quadtree.visit((node, x0, y0, x1, y1) => { let bound: number; bound = x0; // number bound = y0; // number @@ -182,7 +174,7 @@ quadtree = quadtree.visit(function (node, x0, y0, x1, y1) { // void -> undefined return treated as falsey }); -quadtree = quadtree.visit(function (node, x0, y0, x1, y1) { +quadtree = quadtree.visit((node, x0, y0, x1, y1) => { let bound: number; bound = x0; // number bound = y0; // number @@ -203,10 +195,9 @@ quadtree = quadtree.visit(function (node, x0, y0, x1, y1) { // return 10; // fails wrong return type // }); - // visitAfter() --------------------------------------------------------------- -quadtree = quadtree.visitAfter(function (node, x0, y0, x1, y1) { +quadtree = quadtree.visitAfter((node, x0, y0, x1, y1) => { let bound: number; bound = x0; // number bound = y0; // number @@ -221,19 +212,17 @@ quadtree = quadtree.visitAfter(function (node, x0, y0, x1, y1) { } else { console.log('Top-Right Quadrant: ', node[0]); } - }); // Test QuadtreeLeaf ========================================================= -let leaf: d3Quadtree.QuadtreeLeaf, - nextLeaf: d3Quadtree.QuadtreeLeaf | undefined; +let leaf: d3Quadtree.QuadtreeLeaf; +let nextLeaf: d3Quadtree.QuadtreeLeaf | undefined; testDatum = leaf.data; nextLeaf = leaf.next ? leaf.next : undefined; - // Test QuadtreeInternalNode ================================================= let internalNode: d3Quadtree.QuadtreeInternalNode; diff --git a/types/d3-quadtree/index.d.ts b/types/d3-quadtree/index.d.ts index 5607060fd5..8128c9e306 100644 --- a/types/d3-quadtree/index.d.ts +++ b/types/d3-quadtree/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-quadtree module v1.0.1 +// Type definitions for D3JS d3-quadtree module 1.0 // Project: https://github.com/d3/d3-quadtree/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.1 + /** * Leaf node of the quadtree. */ @@ -31,20 +33,21 @@ export interface Quadtree { extent(extend: [[number, number], [number, number]]): this; cover(x: number, y: number): this; add(datum: T): this; - addAll(data: Array): this; + addAll(data: T[]): this; remove(datum: T): this; - removeAll(data: Array): this; + removeAll(data: T[]): this; copy(): Quadtree; root(): QuadtreeInternalNode | QuadtreeLeaf; - data(): Array; + data(): T[]; size(): number; find(x: number, y: number, radius?: number): T | undefined; + // TODO: Review below, when validating to strictNullChecks. + // tslint:disable-next-line:void-return visit(callback: (node: QuadtreeInternalNode | QuadtreeLeaf, x0: number, y0: number, x1: number, y1: number) => (void | boolean)): this; visitAfter(callback: (node: QuadtreeInternalNode | QuadtreeLeaf, x0: number, y0: number, x1: number, y1: number) => void): this; } - export function quadtree(): Quadtree<[number, number]>; export function quadtree(data: Array<[number, number]>): Quadtree<[number, number]>; export function quadtree(): Quadtree; -export function quadtree(data: Array, x?: (d: T) => number, y?: (d: T) => number): Quadtree; +export function quadtree(data: T[], x?: (d: T) => number, y?: (d: T) => number): Quadtree; diff --git a/types/d3-quadtree/tslint.json b/types/d3-quadtree/tslint.json new file mode 100644 index 0000000000..38aa3fb5b3 --- /dev/null +++ b/types/d3-quadtree/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false, + "no-empty-interface": false + } +} diff --git a/types/d3-queue/d3-queue-tests.ts b/types/d3-queue/d3-queue-tests.ts index 223978b355..312bb0c358 100644 --- a/types/d3-queue/d3-queue-tests.ts +++ b/types/d3-queue/d3-queue-tests.ts @@ -28,13 +28,12 @@ qWithResults = d3Queue.queue(3); // No Results Task --------------------------------------------------- function delayedHello(name: string, delay: number, callback: (error: any | null) => void) { - setTimeout(function () { + setTimeout(() => { console.log('Hello, ' + name + '!'); callback(null); }, delay); } - qNoResult = qNoResult.defer(delayedHello, 'Alice', 250); qNoResult.defer(delayedHello, 'Bob', 500); @@ -53,7 +52,7 @@ qWithResults // No Results Task --------------------------------------------------- -qNoResult = qNoResult.await(function (error) { +qNoResult = qNoResult.await((error) => { if (error) throw error; console.log('Goodbye!'); }); @@ -62,7 +61,7 @@ qNoResult = qNoResult.await(function (error) { // await qWithResults - .await(function (error, file1Stat, file2Stat) { + .await((error, file1Stat, file2Stat) => { if (error) throw error; console.log(file1Stat, file2Stat); }); @@ -72,12 +71,11 @@ qWithResults qWithResults = d3Queue.queue() .defer(getFileStats, './workingpath/file1.json') .defer(getFileStats, './yetanotherworkingpath/file2.json') - .awaitAll(function (error, fileStats) { + .awaitAll((error, fileStats) => { if (error) throw error; - console.log(fileStats[0], fileStats[1]); + console.log(fileStats[0], fileStats[1]); }); - // Abort Deferred Tasks ============================================== function requestDataFromInterWeb(url: string, callback: (error: any | null, data?: any) => void) { @@ -87,9 +85,9 @@ function requestDataFromInterWeb(url: string, callback: (error: any | null, data qWithResults = d3Queue.queue() .defer(requestDataFromInterWeb, 'http://www.google.com:81') .defer(requestDataFromInterWeb, 'http://www.google.com:81') - .awaitAll(function (error, results) { + .awaitAll((error, results) => { if (error) throw error; - console.log(results[0], results[1]); + console.log(results[0], results[1]); }); qWithResults.abort(); diff --git a/types/d3-queue/index.d.ts b/types/d3-queue/index.d.ts index 0ca41b698f..d672849622 100644 --- a/types/d3-queue/index.d.ts +++ b/types/d3-queue/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-queue module v3.0.2 +// Type definitions for D3JS d3-queue module 3.0 // Project: https://github.com/d3/d3-queue/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 3.0.2 + /** * A d3-queue queue object as returned by queue(...) */ @@ -17,7 +19,7 @@ export interface Queue { * To return multiple results from a single callback, wrap the results in an object or array. * @param args Additional, optional arguments to be passed into deferred task on invocation */ - defer(task: (...args: Array) => void, ...args: any[]): this; + defer(task: (...args: any[]) => void, ...args: any[]): this; /** * Aborts any active tasks, invoking each active task’s task.abort function, if any. * Also prevents any new tasks from starting, and immediately invokes the queue.await or @@ -32,7 +34,7 @@ export interface Queue { * If an error occurred, there are no additional arguments to the callback. Otherwise, * the callback is passed each result as an additional argument. */ - await(callback: (error: any | null, ...results: Array) => void): this; + await(callback: (error: any | null, ...results: any[]) => void): this; /** * Sets the callback to be invoked when all deferred tasks have finished (results array). * @@ -41,7 +43,7 @@ export interface Queue { * or null if no error occurred. If an error occurred, there are no additional arguments to the callback. * Otherwise, the callback is also passed an array of results as the second argument. */ - awaitAll(callback: (error: any | null, results?: Array) => void): this; + awaitAll(callback: (error: any | null, results?: any[]) => void): this; } /** diff --git a/types/d3-queue/tslint.json b/types/d3-queue/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-queue/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-random/d3-random-tests.ts b/types/d3-random/d3-random-tests.ts index 8cd72d9f0e..7385d3e984 100644 --- a/types/d3-random/d3-random-tests.ts +++ b/types/d3-random/d3-random-tests.ts @@ -7,7 +7,7 @@ */ import * as d3Random from 'd3-random'; - +import * as seedrandom from 'seedrandom'; // ------------------------------------------------------------ // Preparatory Steps @@ -19,40 +19,70 @@ let randomNumberGenerator: () => number; // randomUniform // ------------------------------------------------------------ -randomNumberGenerator = d3Random.randomUniform(); -randomNumberGenerator = d3Random.randomUniform(0.2); -randomNumberGenerator = d3Random.randomUniform(0.2, 5); +let prngUniform: d3Random.RandomUniform; + +prngUniform = d3Random.randomUniform; +prngUniform = d3Random.randomUniform.source(seedrandom("Schroedinger's flea.")); + +randomNumberGenerator = prngUniform(); +randomNumberGenerator = prngUniform(0.2); +randomNumberGenerator = prngUniform(0.2, 5); // ------------------------------------------------------------ // randomNormal // ------------------------------------------------------------ -randomNumberGenerator = d3Random.randomNormal(); -randomNumberGenerator = d3Random.randomNormal(3); -randomNumberGenerator = d3Random.randomNormal(3, 4); +let prngNormal: d3Random.RandomNormal; + +prngNormal = d3Random.randomNormal; +prngNormal = d3Random.randomNormal.source(seedrandom("Schroedinger's flea.")); + +randomNumberGenerator = prngNormal(); +randomNumberGenerator = prngNormal(3); +randomNumberGenerator = prngNormal(3, 4); // ------------------------------------------------------------ // randomLogNormal // ------------------------------------------------------------ -randomNumberGenerator = d3Random.randomLogNormal(); -randomNumberGenerator = d3Random.randomLogNormal(3); -randomNumberGenerator = d3Random.randomLogNormal(3, 4); +let prngLogNormal: d3Random.RandomLogNormal; + +prngLogNormal = d3Random.randomLogNormal; +prngLogNormal = d3Random.randomLogNormal.source(seedrandom("Schroedinger's flea.")); + +randomNumberGenerator = prngLogNormal(); +randomNumberGenerator = prngLogNormal(3); +randomNumberGenerator = prngLogNormal(3, 4); // ------------------------------------------------------------ // randomBates // ------------------------------------------------------------ -randomNumberGenerator = d3Random.randomBates(3); +let prngBates: d3Random.RandomBates; + +prngBates = d3Random.randomBates; +prngBates = d3Random.randomBates.source(seedrandom("Schroedinger's flea.")); + +randomNumberGenerator = prngBates(3); // ------------------------------------------------------------ // randomIrwinHall // ------------------------------------------------------------ -randomNumberGenerator = d3Random.randomIrwinHall(3); +let prngIrwinHall: d3Random.RandomIrwinHall; + +prngIrwinHall = d3Random.randomIrwinHall; +prngIrwinHall = d3Random.randomIrwinHall.source(seedrandom("Schroedinger's flea.")); + +randomNumberGenerator = prngIrwinHall(3); // ------------------------------------------------------------ // randomExponential // ------------------------------------------------------------ -randomNumberGenerator = d3Random.randomExponential(1 / 40); +let prngExponential: d3Random.RandomExponential; + +prngExponential = d3Random.randomExponential; +prngExponential = d3Random.randomExponential.source(seedrandom("Schroedinger's flea.")); + +randomNumberGenerator = prngExponential(1 / 40); diff --git a/types/d3-random/index.d.ts b/types/d3-random/index.d.ts index 48c9b245ed..41b6034215 100644 --- a/types/d3-random/index.d.ts +++ b/types/d3-random/index.d.ts @@ -1,55 +1,112 @@ -// Type definitions for D3JS d3-random module v1.0.1 +// Type definitions for D3JS d3-random module 1.1 // Project: https://github.com/d3/d3-random/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** - * Returns a function for generating random numbers with a uniform distribution). - * The minimum allowed value of a returned number is min, and the maximum is max. - * If min is not specified, it defaults to 0; if max is not specified, it defaults to 1. - * - * @param min The minimum allowed value of a returned number, defaults to 0. - * @param max The maximum allowed value of a returned number, defaults to 1. - */ -export function randomUniform(min?: number, max?: number): () => number; +// Last module patch version validated against: 1.1.0 + +export interface RandomNumberGenerationSource { + /** + * Returns the same type of function for generating random numbers but where the given random number + * generator source is used as the source of randomness instead of Math.random. + * This is useful when a seeded random number generator is preferable to Math.random. + * + * @param source Source (pseudo-)random number generator implementing the Math.random interface. + * The given random number generator must implement the same interface as Math.random and + * only return values in the range [0, 1). + */ + source(source: () => number): this; +} /** - * Returns a function for generating random numbers with a normal (Gaussian) distribution. - * The expected value of the generated numbers is mu, with the given standard deviation sigma. - * If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1. - * - * @param mu Expected value, defaults to 0. - * @param sigma Standard deviation, defaults to 1. + * A configurable random number generator for the uniform distribution. */ -export function randomNormal(mu?: number, sigma?: number): () => number; +export interface RandomUniform extends RandomNumberGenerationSource { + /** + * Returns a function for generating random numbers with a uniform distribution). + * The minimum allowed value of a returned number is min, and the maximum is max. + * If min is not specified, it defaults to 0; if max is not specified, it defaults to 1. + * + * @param min The minimum allowed value of a returned number, defaults to 0. + * @param max The maximum allowed value of a returned number, defaults to 1. + */ + (min?: number, max?: number): () => number; +} + +export const randomUniform: RandomUniform; /** - * Returns a function for generating random numbers with a log-normal distribution. The expected value of the random variable’s natural logrithm is mu, - * with the given standard deviation sigma. If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1. - * - * @param mu Expected value, defaults to 0. - * @param sigma Standard deviation, defaults to 1. + * A configurable random number generator for the normal (Gaussian) distribution. */ -export function randomLogNormal(mu?: number, sigma?: number): () => number; +export interface RandomNormal extends RandomNumberGenerationSource { + /** + * Returns a function for generating random numbers with a normal (Gaussian) distribution. + * The expected value of the generated numbers is mu, with the given standard deviation sigma. + * If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1. + * + * @param mu Expected value, defaults to 0. + * @param sigma Standard deviation, defaults to 1. + */ + (mu?: number, sigma?: number): () => number; +} + +export const randomNormal: RandomNormal; /** - * Returns a function for generating random numbers with a Bates distribution with n independent variables. - * - * @param n Number of independent random variables to use. + * A configurable random number generator for the log-normal distribution. */ -export function randomBates(n: number): () => number; +export interface RandomLogNormal extends RandomNumberGenerationSource { + /** + * Returns a function for generating random numbers with a log-normal distribution. The expected value of the random variable’s natural logrithm is mu, + * with the given standard deviation sigma. If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1. + * + * @param mu Expected value, defaults to 0. + * @param sigma Standard deviation, defaults to 1. + */ + (mu?: number, sigma?: number): () => number; +} + +export const randomLogNormal: RandomLogNormal; /** - * Returns a function for generating random numbers with an Irwin–Hall distribution with n independent variables. - * - * @param n Number of independent random variables to use. + * A configurable random number generator for the Bates distribution. */ -export function randomIrwinHall(n: number): () => number; +export interface RandomBates extends RandomNumberGenerationSource { + /** + * Returns a function for generating random numbers with a Bates distribution with n independent variables. + * + * @param n Number of independent random variables to use. + */ + (n: number): () => number; +} + +export const randomBates: RandomBates; /** - * Returns a function for generating random numbers with an exponential distribution with the rate lambda; - * equivalent to time between events in a Poisson process with a mean of 1 / lambda. - * - * @param lambda Expected time between events. + * A configurable random number generator for the Irwin–Hall distribution. */ -export function randomExponential(lambda: number): () => number; +export interface RandomIrwinHall extends RandomNumberGenerationSource { + /** + * Returns a function for generating random numbers with an Irwin–Hall distribution with n independent variables. + * + * @param n Number of independent random variables to use. + */ + (n: number): () => number; +} + +export const randomIrwinHall: RandomIrwinHall; + +/** + * A configurable random number generator for the exponential distribution. + */ +export interface RandomExponential extends RandomNumberGenerationSource { + /** + * Returns a function for generating random numbers with an exponential distribution with the rate lambda; + * equivalent to time between events in a Poisson process with a mean of 1 / lambda. + * + * @param lambda Expected time between events. + */ + (lambda: number): () => number; +} + +export const randomExponential: RandomExponential; diff --git a/types/d3-random/tsconfig.json b/types/d3-random/tsconfig.json index 20a20f04f1..f9544a0527 100644 --- a/types/d3-random/tsconfig.json +++ b/types/d3-random/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,4 +19,4 @@ "index.d.ts", "d3-random-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/d3-random/tslint.json b/types/d3-random/tslint.json new file mode 100644 index 0000000000..4ae99abce4 --- /dev/null +++ b/types/d3-random/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "max-line-length": [false, 140] + } +} diff --git a/types/d3-request/d3-request-tests.ts b/types/d3-request/d3-request-tests.ts index 798d200bd5..8d8061d76a 100644 --- a/types/d3-request/d3-request-tests.ts +++ b/types/d3-request/d3-request-tests.ts @@ -52,7 +52,7 @@ let listenerResult: (this: d3Request.Request, result: ResponseDatumGET[]) => voi let request: d3Request.Request = d3Request.request(url); // GET-request with callback, immediately sent -let requestWithCallback: d3Request.Request = d3Request.request(url, function (error, xhr) { +let requestWithCallback: d3Request.Request = d3Request.request(url, (error, xhr) => { let x: XMLHttpRequest; if (!error) { x = xhr; @@ -60,7 +60,6 @@ let requestWithCallback: d3Request.Request = d3Request.request(url, function (er } }); - // ------------------------------------------------------------------------------- // Request interface // ------------------------------------------------------------------------------- @@ -81,7 +80,7 @@ let r3: d3Request.Request = d3Request.request(url) // with callback for response handling let r4: d3Request.Request = d3Request.request(url) .response(xhr2Listing) - .get(function (error, response) { + .get((error, response) => { let r: ResponseDatumGET[]; if (!error) { r = response; @@ -92,7 +91,7 @@ let r4: d3Request.Request = d3Request.request(url) // with request datum and callback for response handling let r5: d3Request.Request = d3Request.request(url) .response(xhr2Listing) - .get({ kind: 'Listing' }, function (error, response) { + .get({ kind: 'Listing' }, (error, response) => { let r: ResponseDatumGET[]; if (!error) { r = response; @@ -124,54 +123,49 @@ let r10: d3Request.Request = d3Request.request(url); // beforesent -r10 = r10.on('beforesend', function (xhr) { +r10 = r10.on('beforesend', function(xhr) { let that: d3Request.Request = this; let x: XMLHttpRequest = xhr; // do something; }); - listenerXhr = r10.on('beforesend'); - // progress -r10 = r10.on('progress', function (progEvent) { +r10 = r10.on('progress', function(progEvent) { let that: d3Request.Request = this; let e: ProgressEvent = progEvent; // do something; }); - listenerProgress = r10.on('progress'); - // error -r10 = r10.on('error', function (error) { +r10 = r10.on('error', function(error) { let that: d3Request.Request = this; let err: any = error; // do something; }); - listenerError = r10.on('error'); // load -r10 = r10.on('load', function (result) { +r10 = r10.on('load', function(result) { let that: d3Request.Request = this; let res: ResponseDatumGET[] = result; // do something; }); -r10 = r10.on('load', function (result: ResponseDatumGET[]) { +r10 = r10.on('load', function(result: ResponseDatumGET[]) { let that: d3Request.Request = this; let res: ResponseDatumGET[] = result; // do something; }); -// r10 = r10.on('load', function (result: number) { // fails, wrong argument type for callback +// r10 = r10.on('load', function(result: number) { // fails, wrong argument type for callback // let that: d3Request.Request = this; // let res: number = result; // // do something; @@ -181,22 +175,20 @@ listenerResult = r10.on('load'); // general (for unknown type additional event listener e.g. 'beforesent.custom' or 'load.custom') -r10 = r10.on('progress.foo', function (progEvent: ProgressEvent) { +r10 = r10.on('progress.foo', function(progEvent: ProgressEvent) { let that: d3Request.Request = this; let e: any = ProgressEvent; // do something; }); - listenerProgress = r10.on('progress.foo'); -r10 = r10.on('error.foo', function (error) { +r10 = r10.on('error.foo', function(error) { let that: d3Request.Request = this; let err: any = error; // do something; }); - listenerError = r10.on('error.foo'); // Password --------------------------------------------------------------------- @@ -226,7 +218,7 @@ let r13: d3Request.Request = d3Request.request(url) // with callback for response handling let r14: d3Request.Request = d3Request.request(url).response(xhr2Success) - .post(function (error, response) { + .post(function(error, response) { let that: d3Request.Request = this; let err: any = error; let res: ResponseDatumPOST = response; @@ -234,7 +226,7 @@ let r14: d3Request.Request = d3Request.request(url).response(xhr2Success) }); let r15: d3Request.Request = d3Request.request(url).response(xhr2Success) - .post({ test: 'NewValue', value: 10 }, function (error, response) { + .post({ test: 'NewValue', value: 10 }, function(error, response) { let that: d3Request.Request = this; let err: any = error; let res: ResponseDatumPOST = response; @@ -252,7 +244,7 @@ function xhr2Listing(xhr: XMLHttpRequest): ResponseDatumGET[] { } let r16: d3Request.Request = d3Request.request(url) - .response>(xhr2Listing); + .response(xhr2Listing); // ResponseType ----------------------------------------------------------------- @@ -276,7 +268,7 @@ let r19: d3Request.Request = d3Request.request(url) // method and callback for response handling let r20: d3Request.Request = d3Request.request(url) .response(xhr2Listing) - .send('GET', function (error, response) { + .send('GET', (error, response) => { let r: ResponseDatumGET[]; if (!error) { r = response; @@ -287,7 +279,7 @@ let r20: d3Request.Request = d3Request.request(url) // method,request datum and callback for response handling let r21: d3Request.Request = d3Request.request(url) .response(xhr2Listing) - .send('GET', { kind: 'Listing' }, function (error, response) { + .send('GET', { kind: 'Listing' }, (error, response) => { let r: ResponseDatumGET[]; if (!error) { r = response; @@ -295,7 +287,6 @@ let r21: d3Request.Request = d3Request.request(url) } }); - // Timeout ----------------------------------------------------------------------- // get @@ -312,42 +303,36 @@ let user: string = request.user(); // set let r23: d3Request.Request = request.user('User'); - // ------------------------------------------------------------------------------- // HTML Request // ------------------------------------------------------------------------------- - let html: d3Request.Request = d3Request.html(url); -let htmlWithCallback: d3Request.Request = d3Request.html(url, function (error, data) { +let htmlWithCallback: d3Request.Request = d3Request.html(url, function(error, data) { let that: d3Request.Request = this; let err: any = error; let d: DocumentFragment = data; console.log(d); }); - // ------------------------------------------------------------------------------- // JSON Request // ------------------------------------------------------------------------------- - let json: d3Request.Request = d3Request.json(url); -let jsonWithCallback: d3Request.Request = d3Request.json(url, function (error, data) { +let jsonWithCallback: d3Request.Request = d3Request.json(url, function(error, data) { let that: d3Request.Request = this; let err: any = error; let d: ResponseDatumGET[] = data; console.log(d); }); - - // ------------------------------------------------------------------------------- // Text Request // ------------------------------------------------------------------------------- let text: d3Request.Request = d3Request.text(url); -let textWithCallback: d3Request.Request = d3Request.text(url, function (error, data) { +let textWithCallback: d3Request.Request = d3Request.text(url, function(error, data) { let that: d3Request.Request = this; let err: any = error; let d: string = data; @@ -359,15 +344,13 @@ let textWithCallback: d3Request.Request = d3Request.text(url, function (error, d // ------------------------------------------------------------------------------- let xml: d3Request.Request = d3Request.xml(url); -let xmlWithCallback: d3Request.Request = d3Request.xml(url, function (error, data) { +let xmlWithCallback: d3Request.Request = d3Request.xml(url, function(error, data) { let that: d3Request.Request = this; let err: any = error; let d: any = data; console.log(d); }); - - // ------------------------------------------------------------------------------- // CSV Request // ------------------------------------------------------------------------------- @@ -376,7 +359,7 @@ let xmlWithCallback: d3Request.Request = d3Request.xml(url, function (error, dat let csvRequest: d3Request.DsvRequest = d3Request.csv(url); // url and callback for response handling -let csvRequestWithCallback: d3Request.DsvRequest = d3Request.csv(url, function (error, data) { +let csvRequestWithCallback: d3Request.DsvRequest = d3Request.csv(url, function(error, data) { let that: d3Request.Request = this; let err: any = error; let d: DSVParsedArray = data; @@ -385,7 +368,7 @@ let csvRequestWithCallback: d3Request.DsvRequest = d3Request.csv(url, function ( // url, row mapping function and callback for response handling let csvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.csv(url, - function (rawRow, index, columns) { + (rawRow, index, columns) => { let rr: DSVRowString = rawRow; let i: number = index; let cols: string[] = columns; @@ -398,7 +381,7 @@ let csvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.csv = data; @@ -409,12 +392,11 @@ let csvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.csv = data; @@ -423,7 +405,7 @@ let tsvRequestWithCallback: d3Request.DsvRequest = d3Request.tsv(url, function ( // url, row mapping function and callback for response handling let tsvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.tsv(url, - function (rawRow, index, columns) { + (rawRow, index, columns) => { let rr: DSVRowString = rawRow; let i: number = index; let cols: string[] = columns; @@ -436,7 +418,7 @@ let tsvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.tsv = data; @@ -450,7 +432,7 @@ let tsvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.tsv(function (rawRow, index, columns) { + .row((rawRow, index, columns) => { let rr: DSVRowString = rawRow; let i: number = index; let cols: string[] = columns; diff --git a/types/d3-request/index.d.ts b/types/d3-request/index.d.ts index 2a0251a726..3b5ce96148 100644 --- a/types/d3-request/index.d.ts +++ b/types/d3-request/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-request module v1.0.2 +// Type definitions for D3JS d3-request module 1.0 // Project: https://github.com/d3/d3-request/ // Definitions by: Hugues Stefanski , Alex Ford , Boris Yankov , Tom Wanzek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.2 + import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv'; export interface Request { @@ -57,12 +59,16 @@ export interface Request { } export interface DsvRequest extends Request { - row(value: (rawRow: DSVRowString, index: number, columns: Array) => ParsedRow): DsvRequest; + row(value: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow): DsvRequest; } export function csv(url: string): DsvRequest; export function csv(url: string, callback: (this: DsvRequest, error: any, d: DSVParsedArray) => void): DsvRequest; -export function csv(url: string, row: (rawRow: DSVRowString, index: number, columns: Array) => ParsedRow, callback: (this: DsvRequest, error: any, d: DSVParsedArray) => void): DsvRequest; +export function csv( + url: string, + row: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow, + callback: (this: DsvRequest, error: any, d: DSVParsedArray) => void +): DsvRequest; export function html(url: string): Request; export function html(url: string, callback: (this: Request, error: any, d: DocumentFragment) => void): Request; @@ -78,7 +84,11 @@ export function text(url: string, callback: (this: Request, error: any, d: strin export function tsv(url: string): DsvRequest; export function tsv(url: string, callback: (this: DsvRequest, error: any, d: DSVParsedArray) => void): DsvRequest; -export function tsv(url: string, row: (rawRow: DSVRowString, index: number, columns: Array) => ParsedRow, callback: (this: DsvRequest, error: any, d: DSVParsedArray) => void): DsvRequest; +export function tsv( + url: string, + row: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow, + callback: (this: DsvRequest, error: any, d: DSVParsedArray) => void +): DsvRequest; export function xml(url: string): Request; export function xml(url: string, callback: (this: Request, error: any, d: any) => void): Request; diff --git a/types/d3-request/tslint.json b/types/d3-request/tslint.json new file mode 100644 index 0000000000..da66196eee --- /dev/null +++ b/types/d3-request/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false, + "max-line-length": [false, 145] + } +} diff --git a/types/d3-sankey/d3-sankey-tests.ts b/types/d3-sankey/d3-sankey-tests.ts new file mode 100644 index 0000000000..c270011528 --- /dev/null +++ b/types/d3-sankey/d3-sankey-tests.ts @@ -0,0 +1,303 @@ +/** + * Typescript definition tests for d3/d3-sankey module + * + * Note: These tests are intended to test the definitions only + * in the sense of typing and call signature consistency. They + * are not intended as functional tests. + */ + +import * as d3Sankey from 'd3-sankey'; +import {select, Selection} from 'd3-selection'; +import { Link } from 'd3-shape'; + +// --------------------------------------------------------------------------- +// Preparatory Steps +// --------------------------------------------------------------------------- + +// Create interfaces for the user-provided node/link attributes, which are NOT mandated or calculated by +// the Sankey layout generator. The latter are reflected in the SankeyNode and SankeyLink interfaces provided +// by the definitions file +interface SNodeExtra { + nodeId: number; + name: string; +} + +interface SLinkExtra { + uom: string; +} + +// For convenience +type SNode = d3Sankey.SankeyNode; +type SLink = d3Sankey.SankeyLink; + +interface DAG { + customNodes: SNode[]; + customLinks: SLink[]; +} + +const graph: DAG = { + customNodes: [{ + nodeId: 0, + name: "node0" + }, { + nodeId: 1, + name: "node1" + }, { + nodeId: 2, + name: "node2" + }, { + nodeId: 3, + name: "node3" + }, { + nodeId: 4, + name: "node4" + }], + customLinks: [{ + source: 0, + target: 2, + value: 2, + uom: 'Widget(s)' + }, { + source: 1, + target: 2, + value: 2, + uom: 'Widget(s)' + }, { + source: 1, + target: 3, + value: 2, + uom: 'Widget(s)' + }, { + source: 0, + target: 4, + value: 2, + uom: 'Widget(s)' + }, { + source: 2, + target: 3, + value: 2, + uom: 'Widget(s)' + }, { + source: 2, + target: 4, + value: 2, + uom: 'Widget(s)' + }, { + source: 3, + target: 4, + value: 4, + uom: 'Widget(s)' + }] +}; + +let sNodes: SNode[]; +let sLinks: SLink[]; + +let num: number; +let numMaybe: number | undefined; +let str: string; +let size: [number, number]; +let extent: [[number, number], [number, number]]; + +const svgLinkPaths = select('svg').selectAll('.linkPath'); // assume mock DOM + +let sGraph: d3Sankey.SankeyGraph; + +// --------------------------------------------------------------------------- +// Obtain SankeyLayout Generator +// --------------------------------------------------------------------------- + +let slgDefault: d3Sankey.SankeyLayout, {}, {}> = d3Sankey.sankey(); +let slgDAG: d3Sankey.SankeyLayout = d3Sankey.sankey(); + +// --------------------------------------------------------------------------- +// NodeWidth +// --------------------------------------------------------------------------- + +// Set ----------------------------------------------------------------------- + +// test return type for chainability +slgDAG = slgDAG.nodeWidth(32); + +// Get ----------------------------------------------------------------------- + +num = slgDAG.nodeWidth(); + +// --------------------------------------------------------------------------- +// NodePadding +// --------------------------------------------------------------------------- + +// Set ----------------------------------------------------------------------- + +// test return type for chainability +slgDAG = slgDAG.nodePadding(8); + +// Get ----------------------------------------------------------------------- + +num = slgDAG.nodePadding(); + +// --------------------------------------------------------------------------- +// Extent +// --------------------------------------------------------------------------- + +// Set ----------------------------------------------------------------------- + +// test return type for chainability +slgDAG = slgDAG.extent([[0, 0], [1200, 800]]); + +// Get ----------------------------------------------------------------------- + +extent = slgDAG.extent(); + +// --------------------------------------------------------------------------- +// Size +// --------------------------------------------------------------------------- + +// Set ----------------------------------------------------------------------- + +// test return type for chainability +slgDAG = slgDAG.size([1200, 800]); + +// Get ----------------------------------------------------------------------- + +size = slgDAG.size(); + +// --------------------------------------------------------------------------- +// Iterations +// --------------------------------------------------------------------------- + +// Set ----------------------------------------------------------------------- + +// test return type for chainability +slgDAG = slgDAG.iterations(40); + +// Get ----------------------------------------------------------------------- + +num = slgDAG.iterations(); + +// --------------------------------------------------------------------------- +// Nodes +// --------------------------------------------------------------------------- + +// Set ----------------------------------------------------------------------- + +// Use array and test return type for chainability +slgDAG = slgDAG.nodes(graph.customNodes); + +// Use accessor function and test return type for chainability +slgDAG = slgDAG.nodes(d => d.customNodes); + +// Get ----------------------------------------------------------------------- + +let nodesAccessor: (d: DAG) => SNode[] = slgDAG.nodes(); + +// --------------------------------------------------------------------------- +// Links +// --------------------------------------------------------------------------- + +// Set ----------------------------------------------------------------------- + +// test return type for chainability +slgDAG = slgDAG.links(graph.customLinks); + +// Use accessor function and test return type for chainability +slgDAG = slgDAG.links(d => d.customLinks); + +// Get ----------------------------------------------------------------------- + +let linksAccessor: (d: DAG) => SLink[] = slgDAG.links(); + +// --------------------------------------------------------------------------- +// Compute Initial Layout +// --------------------------------------------------------------------------- + +sGraph = slgDAG(graph); +// With additional arguments, although here unused. +sGraph = slgDAG(graph, "foo", 50); + +// --------------------------------------------------------------------------- +// Update Layout +// --------------------------------------------------------------------------- + +sGraph = slgDAG.update(sGraph); + +// --------------------------------------------------------------------------- +// Obtain and Use Horizontal Link Path Generator +// --------------------------------------------------------------------------- + +let defaultPathGen: Link, [number, number]>; +let pathGen: Link; + +defaultPathGen = d3Sankey.sankeyLinkHorizontal(); + +pathGen = d3Sankey.sankeyLinkHorizontal(); + +// Render to svg path + +let svgPathString: string | null = pathGen(sGraph.links[0]); +svgLinkPaths.attr('d', pathGen); + +// Render to canvas + +declare const ctx: CanvasRenderingContext2D; + +pathGen.context(ctx); +pathGen(sGraph.links[0]); + +// --------------------------------------------------------------------------- +// Shape test Node/Link related interfaces and types +// --------------------------------------------------------------------------- + +// Sankey Node -------------------------------------------------------------- + +sNodes = sGraph.nodes; +let sNode = sNodes[0]; + +// User-specified extra properties: + +num = sNode.nodeId; +str = sNode.name; + +// Sankey Layout calculated (if layout has been run, otherwise undefined): + +numMaybe = sNode.x0; +numMaybe = sNode.x1; +numMaybe = sNode.y0; +numMaybe = sNode.y1; +numMaybe = sNode.value; +numMaybe = sNode.index; +numMaybe = sNode.depth; + +let linksArrMaybe: SLink[] | undefined; + +linksArrMaybe = sNode.sourceLinks; +linksArrMaybe = sNode.targetLinks; + +// Sankey Link -------------------------------------------------------------- + +sLinks = sGraph.links; +let sLink = sLinks[0]; + +// User-specified extra properties: + +str = sLink.uom; + +// Sankey Layout mandated link properties: + +num = sLink.value; + +// Node depending on initialization strategy and whether +// layout(...) was invoked, the source and target nodes may be numbers +// objects without the Sankey layout coordinates, or objects with calculated +// information +let numOrSankeyNode: number | SNode; + +numOrSankeyNode = sLink.source; +numOrSankeyNode = sLink.target; + +// Sankey Layout calculated (if layout has been run, otherwise undefined): + +numMaybe = sLink.y0; +numMaybe = sLink.y1; +numMaybe = sLink.width; +numMaybe = sLink.index; diff --git a/types/d3-sankey/index.d.ts b/types/d3-sankey/index.d.ts new file mode 100644 index 0000000000..55c2934c13 --- /dev/null +++ b/types/d3-sankey/index.d.ts @@ -0,0 +1,368 @@ +// Type definitions for D3JS d3-sankey module 0.6 +// Project: https://github.com/d3/d3-sankey/ +// Definitions by: Tom Wanzek , Alex Ford +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Last module patch version validated against: 0.6 + +import { Link } from 'd3-shape'; + +/** + * A helper interface as an extension reference for user-provided properties of + * nodes and links in the graph, which are not required or calculated by + * the Sankey layout Generator + */ +export interface SankeyExtraProperties { [key: string]: any; } + +/** + * Helper interface to define the properties of Sankey Nodes. Calculated properties may only be defined, + * once the layout(...) method of the Sankey layout generator has been invoked. + * + * The first generic N refers to user-defined properties contained in the node data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyNodeMinimal interface. + * + * The second generic L refers to user-defined properties contained in the link data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyLinkMinimal interface. + */ +export interface SankeyNodeMinimal { + /** + * Array of outgoing links which have this node as their source. + * This property is calculated internally by the Sankey layout generator. + */ + sourceLinks?: Array>; + /** + * Array of incoming links which have this node as their target. + * This property is calculated internally by the Sankey layout generator. + */ + targetLinks?: Array>; + /** + * Node's value calculated by Sankey layout Generator; + * the sum of link.value for the node’s incoming links. + */ + value?: number; + /** + * Node’s zero-based index within the array of nodes calculated by Sankey layout generator. + */ + index?: number; + /** + * Node’s zero-based graph depth, derived from the graph topology calculated by Sankey layout generator. + */ + depth?: number; + /** + * Node's minimum horizontal position (derived from the node.depth) calculated by Sankey layout generator. + */ + x0?: number; + /** + * Node’s maximum horizontal position (node.x0 + sankey.nodeWidth) calculated by Sankey layout generator. + */ + x1?: number; + /** + * Node's minimum vertical position calculated by Sankey layout generator. + */ + y0?: number; + /** + * Node's maximum vertical position (node.y1 - node.y0 is proportional to node.value) calculated by Sankey layout generator. + */ + y1?: number; +} + +/** + * Sankey Node type including both user-defined node data elements as well as those + * calculated once the layout(...) method of the Sankey layout generators has been invoked. + * + * The first generic N refers to user-defined properties contained in the node data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyNodeMinimal interface. + * + * The second generic L refers to user-defined properties contained in the link data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyLinkMinimal interface. + */ +export type SankeyNode = N & SankeyNodeMinimal; + +/** + * Helper interface to define the properties of Sankey Links. Calculated properties may only be defined, + * once the layout(...) method of the Sankey layout generator has been invoked. + * + * The first generic N refers to user-defined properties contained in the node data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyNodeMinimal interface. + * + * The second generic L refers to user-defined properties contained in the link data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyLinkMinimal interface. + */ +export interface SankeyLinkMinimal { + /** + * Link's source node. For convenience, when initializing a Sankey layout, + * source may be the zero-based index of the corresponding node in the nodes array + * returned by the nodes accessor of the Sankey layout generator rather than object references. + * + * Once the Sankey generator is invoked to return the Sankey graph object, + * the numeric index will be replaced with the corresponding source node object. + */ + source: number | SankeyNode; + /** + * Link's target node. For convenience, when initializing a Sankey layout, + * target may be the zero-based index of the corresponding node in the nodes array + * returned by the nodes accessor of the Sankey layout generator rather than object references. + * + * Once the Sankey generator is invoked to return the Sankey graph object, + * the numeric index will be replaced with the corresponding target node object. + */ + target: number | SankeyNode; + /** + * Link's numeric value + */ + value: number; + /** + * Link's vertical starting position (at source node) calculated by Sankey layout generator. + */ + y0?: number; + /** + * Link's vertical end position (at target node) calculated by Sankey layout generator. + */ + y1?: number; + /** + * Link's width (proportional to its value) calculated by Sankey layout generator. + */ + width?: number; + /** + * Link's zero-based index within the array of links calculated by Sankey layout generator. + */ + index?: number; +} + +/** + * Sankey Link type including both user-defined link data elements, those required by the Sankey layout generator, + * as well as those calculated once the layout(...) method of the layout generator has been invoked. + * + * The first generic N refers to user-defined properties contained in the node data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyNodeMinimal interface. + * + * The second generic L refers to user-defined properties contained in the link data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyLinkMinimal interface. + */ +export type SankeyLink = L & SankeyLinkMinimal; + +/** + * A Sankey Graph Object which contains the computed layout information for nodes and links. + * + * The first generic N refers to user-defined properties contained in the node data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyNodeMinimal interface. + * + * The second generic L refers to user-defined properties contained in the link data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyLinkMinimal interface. + */ +export interface SankeyGraph { + /** + * Array of Sankey diagram nodes + */ + nodes: Array>; + /** + * Array of Sankey diagram links + */ + links: Array>; +} + +/** + * A Sankey layout generator. + * + * The first generic Data refers to the data type of the first argument passed in when invoking the + * Sankey layout generator and internally the configured nodes/links accessor functions. + * + * The second generic N refers to user-defined properties contained in the node data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyNodeMinimal interface. + * + * The third generic L refers to user-defined properties contained in the link data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyLinkMinimal interface. + */ +export interface SankeyLayout { + /** + * Computes the node and link positions for the given arguments, returning a graph representing the Sankey layout. + * + * @param data Data object being passed as the first argument to the nodes and links accessor functions. Additional arguments will also be passed + * to the accessor functions. + */ + (data: Data, ...args: any[]): SankeyGraph; + + /** + * Recomputes the specified graph’s links’ positions, updating the following properties of each link: + * + * - link.sy: the link’s vertical starting position (at source node) + * - link.ty: the link’s vertical end position (at target node) + * + * This method is intended to be called after computing the initial Sankey layout, for example when the diagram is repositioned interactively. + * + * @param graph + */ + update(graph: SankeyGraph): SankeyGraph; + + /** + * Return the current nodes accessor function, which defaults to a function returning the "nodes" property of the + * first argument it is invoked with. + */ + nodes(): (data: Data, ...args: any[]) => Array>; + /** + * Set the Sankey generator's nodes accessor to a function returning the specified array of objects and returns this Sankey layout generator. + * + * @param nodes Array of nodes. + */ + nodes(nodes: Array>): this; + /** + * Set the Sankey generator's nodes accessor to the specified function and returns this Sankey layout generator. + * + * @param nodes A nodes accessor function. The function is invoked when the Sankey layout is generated, being passed any arguments passed to the Sankey generator. + * This function must return an array of nodes. + */ + nodes(nodes: (data: Data, ...args: any[]) => Array>): this; + + /** + * Return the current links accessor function, which defaults to a function returning the "links" property of the + * first argument it is invoked with. + */ + links(): (data: Data, ...args: any[]) => Array>; + /** + * Set the Sankey generator's links accessor to a function returning the specified array of objects and returns this Sankey layout generator. + * + * @param links Array of links. + */ + links(links: Array>): this; + /** + * Set the Sankey generator's links accessor to the specified function and returns this Sankey layout generator. + * + * @param links A links accessor function. The function is invoked when the Sankey layout is generated, being passed any arguments passed to the Sankey generator. + * This function must return an array of links. + */ + links(links: (data: Data, ...args: any[]) => Array>): this; + + /** + * Return the current node width, which defaults to 24. + */ + nodeWidth(): number; + /** + * Set the node width to the specified number and return this Sankey layout generator. + * + * @param width Width of node in pixels, which defaults to 24. + */ + nodeWidth(width: number): this; + + /** + * Return the current node padding, which defaults to 8. + * + * Node padding refers to the vertical space between nodes which occupy the same horizontal space. + */ + nodePadding(): number; + /** + * Set the vertical separation between nodes at each column to the specified number and return this Sankey layout generator. + * + * @param padding Node padding, i.e. vertical separation between nodes at each column, in pixels, which defaults to 8. + */ + nodePadding(padding: number): this; + + /** + * Return the current extent which defaults to [[0, 0], [1, 1]]. + */ + extent(): [[number, number], [number, number]]; + /** + * Set the extent of the Sankey layout to the specified bounds and returns this Sankey layout generator. + * + * @param extent Extent bounds for the layout. 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. The default is [[0, 0], [1, 1]]. + */ + extent(extent: [[number, number], [number, number]]): this; + + /** + * Return the current layout size in pixels. The size is a two element array of [width, height] which defaults to [1, 1]. + */ + size(): [number, number]; + /** + * Set the size of the layout and return this Sankey layout generator. + * This convenience method is equivalent to using extent([[0, 0], [width, height]]). + * + * @param size A two element array of [width, height] in pixels which defaults to [1, 1]. + */ + size(size: [number, number]): this; + + /** + * Return the current number of relaxation iterations, which defaults to 32. + */ + iterations(): number; + /** + * Set the number of relaxation iterations when generating the layout and return this Sankey layout generator. + * + * @param iterations Number of relaxation iterations, which defaluts to 32. + */ + iterations(iterations: number): this; +} + +/** + * Get a Sankey layout generator. + * + * Invoking sankey() without generics, means the node type and link type assume no user-defined attributes, i.e. + * only the attributes internally used by the Sankey layout generator. + * + * Default nodes/links accessors are assumed. + */ +export function sankey(): SankeyLayout, {}, {}>; +/** + * Get a Sankey layout generator. + * + * Default nodes/links accessors are assumed. + * + * The first generic N refers to user-defined properties contained in the node data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyNodeMinimal interface. + * + * The second generic L refers to user-defined properties contained in the link data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyLinkMinimal interface. + */ +export function sankey(): SankeyLayout, N, L>; +/** + * Get a Sankey layout generator. + * + * The nodes/links accessors need to be configured to work with the data type of the first argument passed + * in when invoking the Sankey lyout generator. + * + * The first generic corresponds to the data type of the first argument passed in when invoking the Sankey layout generator, + * and its nodes/links accessors. + * + * The second generic N refers to user-defined properties contained in the node data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyNodeMinimal interface. + * + * The third generic L refers to user-defined properties contained in the link data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyLinkMinimal interface. + */ +export function sankey(): SankeyLayout; + +/** + * Get a horizontal link shape suitable for a Sankey diagram. + * Source and target accessors are pre-configured and work with the + * default x- and y- accessors of the link shape generator. + */ +export function sankeyLinkHorizontal(): Link, [number, number]>; +/** + * Get a horizontal link shape suitable for a Sankey diagram. + * Source and target accessors are pre-configured and work with the + * default x- and y- accessors of the link shape generator. + * + * The first generic N refers to user-defined properties contained in the node data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyNodeMinimal interface. + * + * The second generic L refers to user-defined properties contained in the link data passed into + * Sankey layout generator. These properties are IN EXCESS to the properties explicitly identified in the + * SankeyLinkMinimal interface. + */ +export function sankeyLinkHorizontal(): Link, [number, number]>; diff --git a/types/d3-sankey/tsconfig.json b/types/d3-sankey/tsconfig.json new file mode 100644 index 0000000000..bd11293dc2 --- /dev/null +++ b/types/d3-sankey/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-sankey-tests.ts" + ] +} diff --git a/types/d3-sankey/tslint.json b/types/d3-sankey/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-sankey/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-scale-chromatic/index.d.ts b/types/d3-scale-chromatic/index.d.ts index 8550b3b55c..450d103259 100644 --- a/types/d3-scale-chromatic/index.d.ts +++ b/types/d3-scale-chromatic/index.d.ts @@ -1,91 +1,217 @@ -// Type definitions for D3JS d3-scale-chromatic module v1.0.2 +// Type definitions for D3JS d3-scale-chromatic module 1.0 // Project: https://github.com/d3/d3-scale-chromatic/ // Definitions by: Hugues Stefanski , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.2 + // ----------------------------------------------------------------------- // Categorical // ----------------------------------------------------------------------- -/**An array of eight categorical colors represented as RGB hexadecimal strings. */ -export const schemeAccent: Array; -/**An array of eight categorical colors represented as RGB hexadecimal strings. */ -export const schemeDark2: Array; -/**An array of twelve categorical colors represented as RGB hexadecimal strings. */ -export const schemePaired: Array; -/**An array of nine categorical colors represented as RGB hexadecimal strings. */ -export const schemePastel1: Array; -/**An array of eight categorical colors represented as RGB hexadecimal strings. */ -export const schemePastel2: Array; -/**An array of nine categorical colors represented as RGB hexadecimal strings. */ -export const schemeSet1: Array; -/**An array of eight categorical colors represented as RGB hexadecimal strings. */ -export const schemeSet2: Array; -/**An array of twelve categorical colors represented as RGB hexadecimal strings. */ -export const schemeSet3: Array; +/** + * An array of eight categorical colors represented as RGB hexadecimal strings. + */ +export const schemeAccent: string[]; +/** + * An array of eight categorical colors represented as RGB hexadecimal strings. + */ +export const schemeDark2: string[]; +/** + * An array of twelve categorical colors represented as RGB hexadecimal strings. + */ +export const schemePaired: string[]; +/** + * An array of nine categorical colors represented as RGB hexadecimal strings. + */ +export const schemePastel1: string[]; +/** + * An array of eight categorical colors represented as RGB hexadecimal strings. + */ +export const schemePastel2: string[]; +/** + * An array of nine categorical colors represented as RGB hexadecimal strings. + */ +export const schemeSet1: string[]; +/** + * An array of eight categorical colors represented as RGB hexadecimal strings. + */ +export const schemeSet2: string[]; +/** + * An array of twelve categorical colors represented as RGB hexadecimal strings. + */ +export const schemeSet3: string[]; // ----------------------------------------------------------------------- // Diverging // ----------------------------------------------------------------------- -/**Given a number value in the range [0,1], returns the corresponding color from the “BrBG” diverging color scheme represented as an RGB string. */ +/** + * Given a number value in the range [0,1], returns the corresponding color from the “BrBG” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateBrBG(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “PRGn” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “PRGn” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolatePRGn(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “PiYG” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “PiYG” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolatePiYG(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “PuOr” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “PuOr” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolatePuOr(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “RdBu” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “RdBu” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateRdBu(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “RdGy” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “RdGy” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateRdGy(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “RdYlBu” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “RdYlBu” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateRdYlBu(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “RdYlGn” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “RdYlGn” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateRdYlGn(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “Spectral” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “Spectral” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateSpectral(value: number): string; // ----------------------------------------------------------------------- // Sequential // ----------------------------------------------------------------------- -/**Given a number t in the range [0,1], returns the corresponding color from the “Blues” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “Blues” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateBlues(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “Greens” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “Greens” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateGreens(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “Greys” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “Greys” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateGreys(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “Oranges” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “Oranges” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateOranges(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “Purples” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “Purples” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolatePurples(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “Reds” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “Reds” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateReds(value: number): string; // ----------------------------------------------------------------------- // Sequential(Multi-Hue) // ----------------------------------------------------------------------- -/**Given a number t in the range [0,1], returns the corresponding color from the “BuGn” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “BuGn” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateBuGn(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “BuPu” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “BuPu” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateBuPu(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “GnBu” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “GnBu” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateGnBu(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “OrRd” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “OrRd” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateOrRd(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “PuBuGn” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “PuBuGn” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolatePuBuGn(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “PuBu” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “PuBu” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolatePuBu(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “PuRd” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “PuRd” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolatePuRd(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “RdPu” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “RdPu” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateRdPu(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “YlGnBu” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “YlGnBu” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateYlGnBu(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “YlGn” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “YlGn” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateYlGn(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “YlOrBr” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “YlOrBr” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateYlOrBr(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “YlOrRd” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “YlOrRd” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateYlOrRd(value: number): string; diff --git a/types/d3-scale-chromatic/tslint.json b/types/d3-scale-chromatic/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-scale-chromatic/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-scale/index.d.ts b/types/d3-scale/index.d.ts index 8a114d90e1..38e204a6ea 100644 --- a/types/d3-scale/index.d.ts +++ b/types/d3-scale/index.d.ts @@ -17,8 +17,6 @@ import { CountableTimeInterval, TimeInterval } from 'd3-time'; * 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:callable-types export interface InterpolatorFactory { /** * Construct a new interpolator function, based on the provided interpolation boundaries. @@ -628,7 +626,7 @@ export interface ScaleIdentity { * * @param range Array of range values. */ - range(range: Array): this; + range(range: Array): this; /** * Returns approximately count representative values from the scale’s domain. @@ -1299,7 +1297,7 @@ export interface ScaleQuantile { * * @param domain Array of domain values. */ - domain(domain: Array): this; + domain(domain: Array): this; /** * Returns the current range. diff --git a/types/d3-scale/tslint.json b/types/d3-scale/tslint.json index 08b1465cd6..604d5950cf 100644 --- a/types/d3-scale/tslint.json +++ b/types/d3-scale/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "unified-signatures": false + "unified-signatures": false, + "callable-types": false } } diff --git a/types/d3-selection/d3-selection-tests.ts b/types/d3-selection/d3-selection-tests.ts index 0b2dec77c2..baae76bad2 100644 --- a/types/d3-selection/d3-selection-tests.ts +++ b/types/d3-selection/d3-selection-tests.ts @@ -1036,6 +1036,13 @@ positions = d3Selection.touches(svg, changedTouches); positions = d3Selection.touches(g, changedTouches); positions = d3Selection.touches(h, changedTouches); +// --------------------------------------------------------------------------------------- +// Tests of style +// --------------------------------------------------------------------------------------- + +declare let n: Element; +str = d3Selection.style(n, 'opacity'); + // --------------------------------------------------------------------------------------- // Tests of Local // --------------------------------------------------------------------------------------- diff --git a/types/d3-selection/index.d.ts b/types/d3-selection/index.d.ts index ef164164cf..abbb14db0f 100644 --- a/types/d3-selection/index.d.ts +++ b/types/d3-selection/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for D3JS d3-selection module 1.0 +// Type definitions for D3JS d3-selection module 1.1 // 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 +// Last module patch version validated against: 1.1 // -------------------------------------------------------------------------- // Shared Type Definitions and Interfaces @@ -194,7 +194,7 @@ export interface Selection(selector: ValueFn): Selection; @@ -241,7 +241,7 @@ export interface Selection(selector: ValueFn>): Selection; @@ -276,7 +276,7 @@ export interface Selection): this; @@ -304,16 +304,15 @@ export interface Selection): this; /** - * Returns the current computed value of the specified style for the first (non-null) element in the selection. - * This is generally useful only if you know that the selection contains exactly one element. - * The computed value may be different than the previously-set value, particularly if it was set using a - * shorthand property (such as the font style, which is shorthand for font-size, font-face, etc.). + * Returns the current value of the specified style property for the first (non-null) element in the selection. + * The current value is defined as the element’s inline value, if present, and otherwise its computed value. + * Accessing the current style value is generally useful only if you know the selection contains exactly one element. * * @param name Name of the style */ @@ -340,7 +339,7 @@ export interface Selection, priority?: null | 'important'): this; @@ -367,7 +366,7 @@ export interface Selection): this; /** @@ -423,7 +422,7 @@ export interface Selection): this; @@ -449,16 +448,17 @@ export interface Selection): this; /** - * Appends a new element of the specified type (tag name) as the last child of each selected element, or the next - * following sibling in the update selection if this is an enter selection. - * (The enter behavior allows you to insert elements into the DOM in an order consistent with bound data; - * however, the slower selection.order may still be required if updating elements change order.) + * Appends a new element of this type (tag name) as the last child of each selected element, + * or before the next following sibling in the update selection if this is an enter selection. + * The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data; + * however, note that selection.order may still be required if updating elements change order + * (i.e., if the order of new data is inconsistent with old data). * * This method returns a new selection containing the appended elements. * Each new element inherits the data of the current elements, if any. @@ -472,10 +472,11 @@ export interface Selection(type: string): Selection; /** - * Appends a new element of the type provided by the element creator function as the last child of each selected element, - * or the next following sibling in the update selection if this is an enter selection. - * (The enter behavior allows you to insert elements into the DOM in an order consistent with bound data; - * however, the slower selection.order may still be required if updating elements change order.) + * Appends a new element of the type provided by the element creator functionas the last child of each selected element, + * or before the next following sibling in the update selection if this is an enter selection. + * The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data; + * however, note that selection.order may still be required if updating elements change order + * (i.e., if the order of new data is inconsistent with old data). * * This method returns a new selection containing the appended elements. * Each new element inherits the data of the current elements, if any. @@ -483,14 +484,15 @@ export interface Selection(type: ValueFn): Selection; /** - * Inserts a new element of the specified type (tag name) before the element matching the specified "before" - * selector string for each selected element. + * Inserts a new element of the specified type (tag name) before the first element matching the specified + * before selector for each selected element. For example, a before selector :first-child will prepend nodes before the first child. + * If before is not specified, it defaults to null. (To append elements in an order consistent with bound data, use selection.append.) * * This method returns a new selection containing the appended elements. * Each new element inherits the data of the current elements, if any. @@ -503,12 +505,12 @@ export interface Selection( @@ -572,7 +574,7 @@ export interface Selection): Selection; @@ -584,7 +586,7 @@ export interface Selection(selector: ValueFn): Selection; @@ -639,7 +641,7 @@ export interface Selection(value: ValueFn): Selection; @@ -659,7 +661,7 @@ export interface Selection): this; @@ -810,11 +812,11 @@ export interface Selection): this; @@ -970,6 +972,20 @@ export function touch(container: ContainerElement, touches: TouchList, identifie */ export function touches(container: ContainerElement, touches?: TouchList): Array<[number, number]>; +// --------------------------------------------------------------------------- +// style +// --------------------------------------------------------------------------- + +/** + * Returns the value of the style property with the specified name for the specified node. + * If the node has an inline style with the specified name, its value is returned; otherwise, the computed property value is returned. + * See also selection.style. + * + * @param node A DOM node (e.g. HTMLElement, SVGElement) for which to retrieve the style property. + * @param name Style property name. + */ +export function style(node: Element, name: string): string; + // --------------------------------------------------------------------------- // local.js related // --------------------------------------------------------------------------- diff --git a/types/d3-shape/d3-shape-tests.ts b/types/d3-shape/d3-shape-tests.ts index 3ac854df2b..6e0fa97d96 100644 --- a/types/d3-shape/d3-shape-tests.ts +++ b/types/d3-shape/d3-shape-tests.ts @@ -7,8 +7,9 @@ */ import * as d3Shape from 'd3-shape'; -import { select, Selection } from 'd3-selection'; +import { select, Selection } from 'd3-selection'; import { path } from 'd3-path'; +import { HierarchyPointLink, HierarchyPointNode } from 'd3-hierarchy'; // ----------------------------------------------------------------------------------- // Preparatory Steps (General) @@ -357,14 +358,14 @@ interface LineDatum { let lineXYAccessorFn: (d: LineDatum, index?: number, data?: LineDatum[]) => number; let lineDefAccessorFn: (d: LineDatum, index?: number, data?: LineDatum[]) => boolean; -interface RadialLineDatum { +interface LineRadialDatum { angle: number; radius: number; missing: boolean; } -let radialLineAngRAccessorFn: (d: RadialLineDatum, index?: number, data?: RadialLineDatum[]) => number; -let radialLineDefAccessorFn: (d: RadialLineDatum, index?: number, data?: RadialLineDatum[]) => boolean; +let lineRadialAngRAccessorFn: (d: LineRadialDatum, index?: number, data?: LineRadialDatum[]) => number; +let lineRadialDefAccessorFn: (d: LineRadialDatum, index?: number, data?: LineRadialDatum[]) => boolean; // line(...) create Line generator ===================================================== @@ -439,77 +440,85 @@ const lineData: LineDatum[] = [ const linePathStringMaybe: string | null = line(lineData); -// radialLine(...) create Line generator ===================================================== +// lineRadial(...) create Line generator ===================================================== -let defaultRadialLine: d3Shape.RadialLine<[number, number]> = d3Shape.radialLine(); -let radialLine: d3Shape.RadialLine = d3Shape.radialLine(); +let defaultLineRadial: d3Shape.LineRadial<[number, number]> = d3Shape.lineRadial(); +let lineRadial: d3Shape.LineRadial = d3Shape.lineRadial(); -// configure RadialLine(...) generator ====================================================== +// DEPRECATED Naming conventions test (cross-testing with new naming conventions) + +let defaultRadialLine: d3Shape.RadialLine<[number, number]> = defaultLineRadial; +let radialLine: d3Shape.RadialLine = lineRadial; + +defaultLineRadial = d3Shape.radialLine(); +lineRadial = d3Shape.radialLine(); + +// configure LineRadial(...) generator ====================================================== // context(...) ---------------------------------------------------------------------- if (context !== null) { - defaultRadialLine = defaultRadialLine.context(context); // draw to canvas + defaultLineRadial = defaultLineRadial.context(context); // draw to canvas } -context = defaultRadialLine.context(); +context = defaultLineRadial.context(); -radialLine = radialLine.context(null); // use as path string generator for SVG +lineRadial = lineRadial.context(null); // use as path string generator for SVG // angle(...) ---------------------------------------------------------------------------- -defaultRadialLine = defaultRadialLine.angle(Math.PI); +defaultLineRadial = defaultLineRadial.angle(Math.PI); -radialLine = radialLine.angle((d, t, data) => { +lineRadial = lineRadial.angle((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Angle of first point: ', data[0].angle); // data type is Array - return d.angle; // d type is RadialLineDatum + console.log('Angle of first point: ', data[0].angle); // data type is Array + return d.angle; // d type is LineRadialDatum }); -radialLineAngRAccessorFn = radialLine.angle(); +lineRadialAngRAccessorFn = lineRadial.angle(); // radius(...) ---------------------------------------------------------------------------- -defaultRadialLine = defaultRadialLine.radius(30); +defaultLineRadial = defaultLineRadial.radius(30); -radialLine = radialLine.radius((d, t, data) => { +lineRadial = lineRadial.radius((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Angle of first point: ', data[0].angle); // data type is Array - return d.radius; // d type is RadialLineDatum + console.log('Angle of first point: ', data[0].angle); // data type is Array + return d.radius; // d type is LineRadialDatum }); -radialLineAngRAccessorFn = radialLine.radius(); +lineRadialAngRAccessorFn = lineRadial.radius(); // defined(...) ---------------------------------------------------------------------- -defaultRadialLine = defaultRadialLine.defined(true); +defaultLineRadial = defaultLineRadial.defined(true); -radialLine = radialLine.defined((d, t, data) => { +lineRadial = lineRadial.defined((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Angle of first point: ', data[0].angle); // data type is Array - return !d.missing; // d type is RadialLineDatum + console.log('Angle of first point: ', data[0].angle); // data type is Array + return !d.missing; // d type is LineRadialDatum }); -radialLineDefAccessorFn = radialLine.defined(); +lineRadialDefAccessorFn = lineRadial.defined(); // curve(...) ------------------------------------------------------------------------ -defaultRadialLine = defaultRadialLine.curve(d3Shape.curveLinear); +defaultLineRadial = defaultLineRadial.curve(d3Shape.curveLinear); -radialLine = radialLine.curve(d3Shape.curveBundle.beta(0.5)); +lineRadial = lineRadial.curve(d3Shape.curveBundle.beta(0.5)); -currentCurveFactory = radialLine.curve(); +currentCurveFactory = lineRadial.curve(); -// use RadialLine generator =============================================================== +// use LineRadial generator =============================================================== -defaultRadialLine([[10, 10], [20, 10], [20, 20]]); +defaultLineRadial([[10, 10], [20, 10], [20, 20]]); -const radialLineData: RadialLineDatum[] = [ +const lineRadialData: LineRadialDatum[] = [ { angle: 0, radius: 10, missing: false }, { angle: Math.PI / 2, radius: 20, missing: false }, { angle: 2 * Math.PI, radius: 10, missing: false } ]; -const radialLinePathStringMaybe: string | null = radialLine(radialLineData); +const lineRadialPathStringMaybe: string | null = lineRadial(lineRadialData); // ----------------------------------------------------------------------------------- // Test Area Generators @@ -527,7 +536,7 @@ let areaXYAccessorFn: (d: AreaDatum, index?: number, data?: AreaDatum[]) => numb let areaXYAccessorFnMaybe: null | ((d: AreaDatum, index?: number, data?: AreaDatum[]) => number); let areaDefAccessorFn: (d: AreaDatum, index?: number, data?: AreaDatum[]) => boolean; -interface RadialAreaDatum { +interface AreaRadialDatum { startAngle: number; endAngle: number; innerRadius: number; @@ -535,9 +544,9 @@ interface RadialAreaDatum { missing: 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; +let areaRadialAngRAccessorFn: (d: AreaRadialDatum, index?: number, data?: AreaRadialDatum[]) => number; +let areaRadialAngRAccessorFnMaybe: null | ((d: AreaRadialDatum, index?: number, data?: AreaRadialDatum[]) => number); +let areaRadialDefAccessorFn: (d: AreaRadialDatum, index?: number, data?: AreaRadialDatum[]) => boolean; // area(...) create Area generator ===================================================== @@ -669,135 +678,143 @@ areaLineGenerator = area.lineY0(); areaLineGenerator = area.lineX1(); areaLineGenerator = area.lineY1(); -// radialArea(...) create RadialArea generator ===================================================== +// areaRadial(...) create AreaRadial generator ===================================================== -let defaultRadialArea: d3Shape.RadialArea<[number, number]> = d3Shape.radialArea(); -let radialArea: d3Shape.RadialArea = d3Shape.radialArea(); +let defaultAreaRadial: d3Shape.AreaRadial<[number, number]> = d3Shape.areaRadial(); +let areaRadial: d3Shape.AreaRadial = d3Shape.areaRadial(); -// configure RadialArea(...) generator ====================================================== +// DEPRECATED Naming conventions test (cross-testing with new naming conventions) + +let defaultRadialArea: d3Shape.RadialArea<[number, number]> = defaultAreaRadial; +let radialArea: d3Shape.RadialArea = areaRadial; + +defaultAreaRadial = d3Shape.radialArea(); +areaRadial = d3Shape.radialArea(); + +// configure AreaRadial(...) generator ====================================================== // context(...) ---------------------------------------------------------------------- if (context !== null) { - defaultRadialArea = defaultRadialArea.context(context); // draw to canvas + defaultAreaRadial = defaultAreaRadial.context(context); // draw to canvas } -context = defaultRadialArea.context(); +context = defaultAreaRadial.context(); -radialArea = radialArea.context(null); // use as path string generator for SVG +areaRadial = areaRadial.context(null); // use as path string generator for SVG // angle(...) ---------------------------------------------------------------------------- -defaultRadialArea = defaultRadialArea.angle(Math.PI); +defaultAreaRadial = defaultAreaRadial.angle(Math.PI); -radialArea = radialArea.angle((d, t, data) => { +areaRadial = areaRadial.angle((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Start angle of first point: ', data[0].startAngle); // data type is Array - return d.startAngle; // d type is RadialAreaDatum + console.log('Start angle of first point: ', data[0].startAngle); // data type is Array + return d.startAngle; // d type is AreaRadialDatum }); -radialAreaAngRAccessorFn = radialArea.angle(); +areaRadialAngRAccessorFn = areaRadial.angle(); // startAngle(...) ---------------------------------------------------------------------------- -defaultRadialArea = defaultRadialArea.startAngle(Math.PI); +defaultAreaRadial = defaultAreaRadial.startAngle(Math.PI); -radialArea = radialArea.startAngle((d, t, data) => { +areaRadial = areaRadial.startAngle((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Start angle of first point: ', data[0].startAngle); // data type is Array - return d.startAngle; // d type is RadialAreaDatum + console.log('Start angle of first point: ', data[0].startAngle); // data type is Array + return d.startAngle; // d type is AreaRadialDatum }); -radialAreaAngRAccessorFn = radialArea.startAngle(); +areaRadialAngRAccessorFn = areaRadial.startAngle(); // endAngle(...) ---------------------------------------------------------------------------- -defaultRadialArea = defaultRadialArea.endAngle(Math.PI); +defaultAreaRadial = defaultAreaRadial.endAngle(Math.PI); -radialArea = radialArea.endAngle((d, t, data) => { +areaRadial = areaRadial.endAngle((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('End angle of first point: ', data[0].endAngle); // data type is Array - return d.endAngle; // d type is RadialAreaDatum + console.log('End angle of first point: ', data[0].endAngle); // data type is Array + return d.endAngle; // d type is AreaRadialDatum }); -radialAreaAngRAccessorFnMaybe = radialArea.endAngle(); +areaRadialAngRAccessorFnMaybe = areaRadial.endAngle(); // radius(...) ---------------------------------------------------------------------------- -defaultRadialArea = defaultRadialArea.radius(10); +defaultAreaRadial = defaultAreaRadial.radius(10); -radialArea = radialArea.radius((d, t, data) => { +areaRadial = areaRadial.radius((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Inner radius of first point: ', data[0].innerRadius); // data type is Array - return d.innerRadius; // d type is RadialAreaDatum + console.log('Inner radius of first point: ', data[0].innerRadius); // data type is Array + return d.innerRadius; // d type is AreaRadialDatum }); -radialAreaAngRAccessorFn = radialArea.radius(); +areaRadialAngRAccessorFn = areaRadial.radius(); // innerRadius(...) ---------------------------------------------------------------------------- -defaultRadialArea = defaultRadialArea.innerRadius(10); +defaultAreaRadial = defaultAreaRadial.innerRadius(10); -radialArea = radialArea.innerRadius((d, t, data) => { +areaRadial = areaRadial.innerRadius((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Inner radius of first point: ', data[0].innerRadius); // data type is Array - return d.innerRadius; // d type is RadialAreaDatum + console.log('Inner radius of first point: ', data[0].innerRadius); // data type is Array + return d.innerRadius; // d type is AreaRadialDatum }); -radialAreaAngRAccessorFn = radialArea.innerRadius(); +areaRadialAngRAccessorFn = areaRadial.innerRadius(); // outerRadius(...) ---------------------------------------------------------------------------- -defaultRadialArea = defaultRadialArea.outerRadius(20); +defaultAreaRadial = defaultAreaRadial.outerRadius(20); -radialArea = radialArea.outerRadius((d, t, data) => { +areaRadial = areaRadial.outerRadius((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Outer radius of first point: ', data[0].outerRadius); // data type is Array - return d.outerRadius; // d type is RadialAreaDatum + console.log('Outer radius of first point: ', data[0].outerRadius); // data type is Array + return d.outerRadius; // d type is AreaRadialDatum }); -radialAreaAngRAccessorFnMaybe = radialArea.outerRadius(); +areaRadialAngRAccessorFnMaybe = areaRadial.outerRadius(); // defined(...) ---------------------------------------------------------------------- -defaultRadialArea = defaultRadialArea.defined(true); +defaultAreaRadial = defaultAreaRadial.defined(true); -radialArea = radialArea.defined((d, t, data) => { +areaRadial = areaRadial.defined((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Inner radius of first point: ', data[0].innerRadius); // data type is Array - return !d.missing; // d type is RadialAreaDatum + console.log('Inner radius of first point: ', data[0].innerRadius); // data type is Array + return !d.missing; // d type is AreaRadialDatum }); -radialAreaDefAccessorFn = radialArea.defined(); +areaRadialDefAccessorFn = areaRadial.defined(); // curve(...) ------------------------------------------------------------------------ -defaultRadialArea = defaultRadialArea.curve(d3Shape.curveLinear); +defaultAreaRadial = defaultAreaRadial.curve(d3Shape.curveLinear); -radialArea = radialArea.curve(d3Shape.curveCardinal.tension(0.5)); -// radialArea = radialArea.curve(d3Shape.curveBundle.beta(0.5)); // fails, as curveBundle-based line generator does not support area-related methods +areaRadial = areaRadial.curve(d3Shape.curveCardinal.tension(0.5)); +// areaRadial = areaRadial.curve(d3Shape.curveBundle.beta(0.5)); // fails, as curveBundle-based line generator does not support area-related methods -currentCurveFactory = radialArea.curve(); +currentCurveFactory = areaRadial.curve(); -// use RadialArea generator =============================================================== +// use AreaRadial generator =============================================================== -defaultRadialArea([[10, 10], [20, 10], [20, 20]]); +defaultAreaRadial([[10, 10], [20, 10], [20, 20]]); -const radialAreaData: RadialAreaDatum[] = [ +const areaRadialData: AreaRadialDatum[] = [ { 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 } ]; -const radialAreaPathStringMaybe: string | null = radialArea(radialAreaData); +const areaRadialPathStringMaybe: string | null = areaRadial(areaRadialData); -// Get RadialLine Generators from RadialArea generator ======================================================== +// Get LineRadial Generators from AreaRadial generator ======================================================== -let areaRadialLineGenerator: d3Shape.RadialLine; +let areaLineRadialGenerator: d3Shape.LineRadial; -areaRadialLineGenerator = radialArea.lineStartAngle(); -areaRadialLineGenerator = radialArea.lineInnerRadius(); -areaRadialLineGenerator = radialArea.lineEndAngle(); -areaRadialLineGenerator = radialArea.lineOuterRadius(); +areaLineRadialGenerator = areaRadial.lineStartAngle(); +areaLineRadialGenerator = areaRadial.lineInnerRadius(); +areaLineRadialGenerator = areaRadial.lineEndAngle(); +areaLineRadialGenerator = areaRadial.lineOuterRadius(); // ----------------------------------------------------------------------------------- // Test Curve Factories @@ -900,6 +917,250 @@ curveFactory = d3Shape.curveStepAfter; curveFactory = d3Shape.curveStepBefore; +// ----------------------------------------------------------------------------------- +// Test Link/LinkRadial Generators +// ----------------------------------------------------------------------------------- + +// Preparatory steps ================================================================= + +interface TreeNodeDatum { + whatever: any; +} + +declare const linkDatum: HierarchyPointLink; + +declare const defaultLinkDatum: d3Shape.DefaultLinkObject; + +const pLink: Selection, any, any> = + select>('.link-paths'); // mock +const wrongLink1: Selection, any, any> = + select>('.link-paths'); // mock +const wrongLink2: Selection = + select('.link-paths'); // mock + +// Test DefaultLinkObject Interface ================================================== + +let coordinates: [number, number]; + +coordinates = defaultLinkDatum.source; +coordinates = defaultLinkDatum.target; + +// Test generator factories ========================================================== + +let defaultLink: d3Shape.Link; + +defaultLink = d3Shape.linkHorizontal(); +defaultLink = d3Shape.linkVertical(); + +let link: d3Shape.Link, HierarchyPointNode>; + +link = d3Shape.linkHorizontal, HierarchyPointNode>(); +link = d3Shape.linkVertical, HierarchyPointNode>(); + +let svgLink: d3Shape.Link, HierarchyPointNode>; + +svgLink = d3Shape.linkHorizontal, HierarchyPointNode>(); +svgLink = d3Shape.linkVertical, HierarchyPointNode>(); + +let defaultLinkRadial: d3Shape.LinkRadial; + +defaultLinkRadial = d3Shape.linkRadial(); + +let radialLink: d3Shape.LinkRadial, HierarchyPointNode>; + +radialLink = d3Shape.linkRadial, HierarchyPointNode>(); + +let svgLinkRadial: d3Shape.LinkRadial, HierarchyPointNode>; + +svgLinkRadial = d3Shape.linkRadial, HierarchyPointNode>(); + +// Configure link generators ======================================================== + +let defaultNodeAccessor: (d: d3Shape.DefaultLinkObject, ...args: any[]) => [number, number]; +let svgTreeNodeAccessor: (this: SVGPathElement, d: HierarchyPointLink, ...args: any[]) => HierarchyPointNode; + +let defaultCoordinateAccessor: (d: [number, number], ...args: any[]) => number; +let svgCoordinateAccessor: (this: SVGPathElement, d: HierarchyPointNode, ...args: any[]) => number; + +// source(...) ----------------------------------------------------------------------- + +// vertical/horizontal + +defaultLink = defaultLink.source(d => { + const datum: d3Shape.DefaultLinkObject = d; + return d.source; +}); + +defaultNodeAccessor = defaultLink.source(); + +svgLink = svgLink.source(function(d) { + const that: SVGPathElement = this; + const datum: HierarchyPointLink = d; + return d.source; +}); + +svgTreeNodeAccessor = svgLink.source(); + +// radial + +defaultLinkRadial = defaultLinkRadial.source(d => { + const datum: d3Shape.DefaultLinkObject = d; + return d.source; +}); + +defaultNodeAccessor = defaultLinkRadial.source(); + +svgLinkRadial = svgLinkRadial.source(function(d) { + const that: SVGPathElement = this; + const datum: HierarchyPointLink = d; + return d.source; +}); + +svgTreeNodeAccessor = svgLinkRadial.source(); + +// target(...) ----------------------------------------------------------------------- + +// vertical/horizontal + +defaultLink = defaultLink.target(d => { + const datum: d3Shape.DefaultLinkObject = d; + return d.target; +}); + +defaultNodeAccessor = defaultLink.target(); + +svgLink = svgLink.target(function(d) { + const that: SVGPathElement = this; + const datum: HierarchyPointLink = d; + return d.target; +}); + +svgTreeNodeAccessor = svgLink.target(); + +// radial + +defaultLinkRadial = defaultLinkRadial.target(d => { + const datum: d3Shape.DefaultLinkObject = d; + return d.target; +}); + +defaultNodeAccessor = defaultLinkRadial.target(); + +svgLinkRadial = svgLinkRadial.target(function(d) { + const that: SVGPathElement = this; + const datum: HierarchyPointLink = d; + return d.target; +}); + +svgTreeNodeAccessor = svgLinkRadial.target(); + +// x(...) ---------------------------------------------------------------------------- + +defaultLink = defaultLink.x(d => { + const datum: [number, number] = d; + return datum[0]; +}); + +defaultCoordinateAccessor = defaultLink.x(); + +svgLink = svgLink.x(function(d) { + const that: SVGPathElement = this; + const datum: HierarchyPointNode = d; + return datum.x; +}); + +svgCoordinateAccessor = svgLink.x(); + +// y(...) ---------------------------------------------------------------------------- + +defaultLink = defaultLink.y(d => { + const datum: [number, number] = d; + return datum[1]; +}); + +defaultCoordinateAccessor = defaultLink.y(); + +svgLink = svgLink.y(function(d) { + const that: SVGPathElement = this; + const datum: HierarchyPointNode = d; + return datum.y; +}); + +svgCoordinateAccessor = svgLink.y(); + +// angle(...) ------------------------------------------------------------------------ + +defaultLinkRadial = defaultLinkRadial.angle(d => { + const datum: [number, number] = d; + return datum[0]; +}); + +defaultCoordinateAccessor = defaultLinkRadial.angle(); + +svgLinkRadial = svgLinkRadial.angle(function(d) { + const that: SVGPathElement = this; + const datum: HierarchyPointNode = d; + return datum.x; +}); + +svgCoordinateAccessor = svgLinkRadial.angle(); + +// radius(...) ------------------------------------------------------------------------ + +defaultLinkRadial = defaultLinkRadial.radius(d => { + const datum: [number, number] = d; + return datum[1]; +}); + +defaultCoordinateAccessor = defaultLinkRadial.radius(); + +svgLinkRadial = svgLinkRadial.radius(function(d) { + const that: SVGPathElement = this; + const datum: HierarchyPointNode = d; + return datum.y; +}); + +svgCoordinateAccessor = svgLinkRadial.radius(); + +// context(...) ---------------------------------------------------------------------- + +if (context !== null) { + defaultArea = defaultArea.context(context); // draw to canvas +} +context = defaultArea.context(); + +area = area.context(null); // use as path string generator for SVG + +// Use link generators =============================================================== + +// Render to canvas ------------------------------------------------------------------ + +defaultLink(defaultLinkDatum); + +defaultLinkRadial(defaultLinkDatum); + +// Render to svg --------------------------------------------------------------------- + +// vertical/horizontal + +pLink.attr('d', svgLink); +// wrongLink1.attr('d', svgLink); // fails, incompatible this contexts +// wrongLink2.attr('d', svgLink); // fails, incompatible datum types + +pathStringMaybe = link(linkDatum); + +// pathStringMaybe = svgLink(linkDatum); // fails, wrong this type for invocation + +// radial + +pLink.attr('d', svgLinkRadial); +// wrongLink1.attr('d', svgLinkRadial); // fails, incompatible this contexts +// wrongLink2.attr('d', svgLinkRadial); // fails, incompatible datum types + +pathStringMaybe = radialLink(linkDatum); + +// pathStringMaybe = svgLinkRadial(linkDatum); // fails, wrong this type for invocation + // ----------------------------------------------------------------------------------- // Test Symbols // ----------------------------------------------------------------------------------- @@ -1057,6 +1318,12 @@ customSymbol = d3Shape.symbolStar; customSymbol = d3Shape.symbolTriangle; customSymbol = d3Shape.symbolWye; +// ----------------------------------------------------------------------------------- +// Test pointRadius +// ----------------------------------------------------------------------------------- + +let coordinatates: [number, number] = d3Shape.pointRadius(0, 12); + // ----------------------------------------------------------------------------------- // Test Stacks // ----------------------------------------------------------------------------------- @@ -1181,6 +1448,7 @@ order = d3Shape.stackOrderReverse(seriesAnyAny); // Test stack offsets =============================================================== d3Shape.stackOffsetExpand(seriesAnyAny, order); +d3Shape.stackOffsetDiverging(seriesAnyAny, order); d3Shape.stackOffsetNone(seriesAnyAny, order); d3Shape.stackOffsetSilhouette(seriesAnyAny, order); d3Shape.stackOffsetWiggle(seriesAnyAny, order); diff --git a/types/d3-shape/index.d.ts b/types/d3-shape/index.d.ts index 517f84e501..010c2108e9 100644 --- a/types/d3-shape/index.d.ts +++ b/types/d3-shape/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for D3JS d3-shape module 1.0 +// Type definitions for D3JS d3-shape module 1.2 // 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 +// Last module patch version validated against: 1.2.0 import { Path } from 'd3-path'; @@ -799,7 +799,7 @@ export function line(): Line; * * The generic refers to the data type of an element in the input array passed into the line generator. */ -export interface RadialLine { +export interface LineRadial { /** * 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. @@ -957,7 +957,7 @@ export interface RadialLine { * 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]>; +export function lineRadial(): LineRadial<[number, number]>; /** * Constructs a new radial line generator with the default settings. * @@ -966,6 +966,17 @@ export function radialLine(): RadialLine<[number, number]>; * * The generic refers to the data type of an element in the input array passed into the radial line generator. */ +export function lineRadial(): LineRadial; + +export type RadialLine = LineRadial; + +/** + * DEPRECATED: Use lineRadial() + */ +export function radialLine(): RadialLine<[number, number]>; +/** + * DEPRECATED: Use lineRadial() + */ export function radialLine(): RadialLine; // ----------------------------------------------------------------------------------- @@ -1283,7 +1294,7 @@ export function area(): Area; * * The generic refers to the data type of an element in the input array passed into the area generator. */ -export interface RadialArea { +export interface AreaRadial { /** * Generates a radial area for the given array of data. * @@ -1544,25 +1555,25 @@ export interface RadialArea { * 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; + lineStartAngle(): LineRadial; /** * 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; + lineInnerRadius(): LineRadial; /** * 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; + lineEndAngle(): LineRadial; /** * 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; + lineOuterRadius(): LineRadial; } /** @@ -1571,7 +1582,7 @@ export interface RadialArea { * 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]>; +export function areaRadial(): AreaRadial<[number, number]>; /** * Constructs a new radial area generator with the default settings. * @@ -1580,6 +1591,20 @@ export function radialArea(): RadialArea<[number, number]>; * * The generic refers to the data type of an element in the input array passed into the radial area generator. */ +export function areaRadial(): AreaRadial; + +/** + * DEPRECATED: Use AreaRadial interface + */ +export type RadialArea = AreaRadial; + +/** + * DEPRECATED: Use areaRadial() + */ +export function radialArea(): RadialArea<[number, number]>; +/** + * DEPRECATED: Use areaRadial() + */ export function radialArea(): RadialArea; // ----------------------------------------------------------------------------------- @@ -1864,6 +1889,368 @@ export const curveStepAfter: CurveFactory; */ export const curveStepBefore: CurveFactory; +// ----------------------------------------------------------------------------------- +// LINKS +// ----------------------------------------------------------------------------------- + +/** + * An interface describing the default Link Data structure expected + * by the Link and LinkRadial generators + */ +export interface DefaultLinkObject { + /** + * Source node of the link. + * + * For a link in a Cartesian coordinate system, the two element array contains + * the coordinates [x, y]. + * + * For a radial link, the two element array contains + * the coordinates [angle, radius]. The angle is stated in radians, with 0 at -y (12 o’clock). + * The radius measures the distance from the origin ⟨0,0⟩. + */ + source: [number, number]; + /** + * Target node of the link. + * + * For a link in a Cartesian coordinate system, the two element array contains + * the coordinates [x, y]. + * + * For a radial link, the two element array contains + * the coordinates [angle, radius]. The angle is stated in radians, with 0 at -y (12 o’clock). + * The radius measures the distance from the origin ⟨0,0⟩. + */ + target: [number, number]; +} + +/** + * A link generator for a Cartesian coordinate system. The link shape generates a smooth cubic Bézier curve from a + * source point to a target point. The tangents of the curve at the start and end are either vertical, horizontal. + * + * The first generic corresponds to the type of the "this" context within which the link generator and its accessor functions will be invoked. + * + * The second generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The third generic corresponds to the datum type of the source/target node contained in the link object. + */ +export interface Link { + /** + * Generates a link for the given arguments. + * + * IMPORTANT: If the rendering context of the link generator is null, + * then the link 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 link is to be generated. + */ + (this: This, d: LinkDatum, ...args: any[]): string | null; + /** + * Generates an link for the given arguments. + * + * IMPORTANT: If the link generator has been configured with a rendering context, + * then the link 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 link is to be generated. + */ + (this: This, d: LinkDatum, ...args: any[]): void; + + /** + * Returns the current source node accessor function. + * The default source accessor function returns a two element array [x, y]. + */ + source(): (this: This, d: LinkDatum, ...args: any[]) => NodeDatum; + /** + * Sets the source accessor to the specified function and returns this link generator. + * + * @param source Source node accessor function. 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 link generator. The default target accessor function returns a two element array [x, y]. + */ + source(source: (this: This, d: LinkDatum, ...args: any[]) => NodeDatum): this; + + /** + * Returns the current target node accessor function. + * The default target accessor function returns a two element array [x, y]. + */ + target(): (this: This, d: LinkDatum, ...args: any[]) => NodeDatum; + /** + * Sets the target accessor to the specified function and returns this link generator. + * + * @param target Target node accessor function. 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 link generator. The default target accessor function returns a two element array [x, y]. + */ + target(target: (this: This, d: LinkDatum, ...args: any[]) => NodeDatum): this; + + /** + * Returns the current x-accessor, which defaults to a function accepting an number array + * as its argument an returning the first element of the array. + */ + x(): (this: This, node: NodeDatum, ...args: any[]) => number; + /** + * Sets the x-accessor to the specified function and returns this link generator. + * + * @param x x-coordinate accessor function. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives as its first argument a node object followed by all additional arguments that were passed into the link generator. + */ + x(x: (this: This, node: NodeDatum, ...args: any[]) => number): this; + + /** + * Returns the current y-accessor, which defaults to a function accepting an number array + * as its argument an returning the second element of the array. + */ + y(): (this: This, node: NodeDatum, ...args: any[]) => number; + /** + * Sets the y-accessor to the specified function and returns this link generator. + * + * @param y y-coordinate accessor function. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives as its first argument a node object followed by all additional arguments that were passed into the link generator. + */ + y(y: (this: This, node: NodeDatum, ...args: any[]) => number): this; + + /** + * Returns the current rendering context, which defaults to null. + */ + context(): CanvasRenderingContext2D | null; + /** + * Sets the rendering context and returns this link generator. + * + * If the context is not null, then the generated link 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 link generator. + * + * A path data string representing the generated link will be returned when the generator is invoked with data. + * + * @param context null, to remove rendering context. + */ + context(context: null): this; +} + +/** + * Constructs a new default link generator with horizontal tangents, for example, to visualize links in a tree diagram + * rooted on the left edge of the display. + * + * With the default settings the link generator accepts a link object conforming to the DefaultLinkObject interface. + */ +export function linkHorizontal(): Link; +/** + * Constructs a new link generator with horizontal tangents, for example, to visualize links in a tree diagram + * rooted on the left edge of the display. + * + * Important: Ensure that the accessor functions are configured to work with the link and node datum types + * specified in the generics. + * + * The first generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The second generic corresponds to the datum type of the source/target node contained in the link object + */ +export function linkHorizontal(): Link; +/** + * Constructs a new link generator with horizontal tangents, for example, to visualize links in a tree diagram + * rooted on the left edge of the display. + * + * Important: Ensure that the accessor functions are configured to work with the link and node datum types + * specified in the generics. + * + * The first generic corresponds to the type of the "this" context within which the link generator and its accessor functions will be invoked. + * + * The second generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The third generic corresponds to the datum type of the source/target node contained in the link object + */ +export function linkHorizontal(): Link; + +/** + * Constructs a new default link generator with vertical tangents, for example, to visualize links in a tree diagram + * rooted on the top edge of the display. + * + * With the default settings the link generator accepts a link object conforming to the DefaultLinkObject interface. + */ +export function linkVertical(): Link; +/** + * Constructs a new link generator with vertical tangents, for example, to visualize links in a tree diagram + * rooted on the top edge of the display. + * + * Important: Ensure that the accessor functions are configured to work with the link and node datum types + * specified in the generics. + * + * The first generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The second generic corresponds to the datum type of the source/target node contained in the link object + */ +export function linkVertical(): Link; +/** + * Constructs a new link generator with vertical tangents, for example, to visualize links in a tree diagram + * rooted on the top edge of the display. + * + * Important: Ensure that the accessor functions are configured to work with the link and node datum types + * specified in the generics. + * + * The first generic corresponds to the type of the "this" context within which the link generator and its accessor functions will be invoked. + * + * The second generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The third generic corresponds to the datum type of the source/target node contained in the link object + */ +export function linkVertical(): Link; + +/** + * A link generator for a radial coordinate system. The link shape generates a smooth cubic Bézier curve from a + * source point to a target point. The tangents of the curve at the start and end are radial. + * + * The first generic corresponds to the type of the "this" context within which the radial link generator and its accessor functions will be invoked. + * + * The second generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The third generic corresponds to the datum type of the source/target node contained in the link object. + */ +export interface LinkRadial { + /** + * Generates a radial link for the given arguments. + * + * IMPORTANT: If the rendering context of the radial link generator is null, + * then the link 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 link is to be generated. + */ + (this: This, d: LinkDatum, ...args: any[]): string | null; + /** + * Generates an link for the given arguments. + * + * IMPORTANT: If the radial link generator has been configured with a rendering context, + * then the link 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 link is to be generated. + */ + (this: This, d: LinkDatum, ...args: any[]): void; + + /** + * Returns the current source node accessor function. + * The default source accessor function returns a two element array [x, y]. + */ + source(): (this: This, d: LinkDatum, ...args: any[]) => NodeDatum; + /** + * Sets the source accessor to the specified function and returns this radial link generator. + * + * @param source Source node accessor function. 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 radial link generator. The default target accessor function returns a two element array [x, y]. + */ + source(source: (this: This, d: LinkDatum, ...args: any[]) => NodeDatum): this; + + /** + * Returns the current target node accessor function. + * The default target accessor function returns a two element array [x, y]. + */ + target(): (this: This, d: LinkDatum, ...args: any[]) => NodeDatum; + /** + * Sets the target accessor to the specified function and returns this radial link generator. + * + * @param target Target node accessor function. 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 radial link generator. The default target accessor function returns a two element array [x, y]. + */ + target(target: (this: This, d: LinkDatum, ...args: any[]) => NodeDatum): this; + + /** + * Returns the current angle accessor, which defaults to a function accepting an number array + * as its argument an returning the first element of the array. + */ + angle(): (this: This, node: NodeDatum, ...args: any[]) => number; + /** + * Sets the angle accessor to the specified function and returns this radial link generator. + * The angle is stated in radians, with 0 at -y (12 o’clock). + * + * @param angle Angle accessor function. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives as its first argument a node object followed by all additional arguments that were passed into the radial link generator. + */ + angle(angle: (this: This, node: NodeDatum, ...args: any[]) => number): this; + + /** + * Returns the current radius accessor, which defaults to a function accepting an number array + * as its argument an returning the second element of the array. + */ + radius(): (this: This, node: NodeDatum, ...args: any[]) => number; + /** + * Sets the radius accessor to the specified function and returns this radial link generator. + * The radius is measured as the distance from the origin ⟨0,0⟩. + * + * @param radius Radius accessor function. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives as its first argument a node object followed by all additional arguments that were passed into the radial link generator. + */ + radius(radius: (this: This, node: NodeDatum, ...args: any[]) => number): this; + + /** + * Returns the current rendering context, which defaults to null. + */ + context(): CanvasRenderingContext2D | null; + /** + * Sets the rendering context and returns this radial link 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 link generator. + * + * A path data string representing the generated radial link will be returned when the generator is invoked with data. + * + * @param context null, to remove rendering context. + */ + context(context: null): this; +} + +/** + * DEPRECATED: Use LinkRadial interface + */ +export type RadialLink = LinkRadial; + +/** + * Constructs a new default link generator with radial tangents, for example, to visualize links in a tree diagram + * rooted in the center of the display. + * + * With the default settings the link generator accepts a link object conforming to the DefaultLinkObject interface. + */ +export function linkRadial(): LinkRadial; +/** + * Constructs a new link generator with radial tangents, for example, to visualize links in a tree diagram + * rooted in the center of the display. + * + * Important: Ensure that the accessor functions are configured to work with the link and node datum types + * specified in the generics. + * + * The first generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The second generic corresponds to the datum type of the source/target node contained in the link object + */ +export function linkRadial(): LinkRadial; +/** + * Constructs a new link generator with radial tangents, for example, to visualize links in a tree diagram + * rooted in the center of the display. + * + * Important: Ensure that the accessor functions are configured to work with the link and node datum types + * specified in the generics. + * + * The first generic corresponds to the type of the "this" context within which the link generator and its accessor functions will be invoked. + * + * The second generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The third generic corresponds to the datum type of the source/target node contained in the link object + */ +export function linkRadial(): LinkRadial; + // ----------------------------------------------------------------------------------- // SYMBOLS // ----------------------------------------------------------------------------------- @@ -1872,7 +2259,7 @@ export const curveStepBefore: CurveFactory; * 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. + * However, you can define your own symbol 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 { @@ -2048,6 +2435,17 @@ export const symbolTriangle: SymbolType; */ export const symbolWye: SymbolType; +// ----------------------------------------------------------------------------------- +// pointRadius +// ----------------------------------------------------------------------------------- + +/** + * Returns the point [x, y] for the given angle and the given radius. + * @param angle Angle in radians, with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + * @param radius Radius. + */ +export function pointRadius(angle: number, radius: number): [number, number]; + // ----------------------------------------------------------------------------------- // STACKS // ----------------------------------------------------------------------------------- @@ -2269,7 +2667,7 @@ export function stackOrderDescending(series: Series): number[]; /** * 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. + * This order is recommended for streamgraphs in conjunction with the wiggle offset. See Stacked Graphs—Geometry & Aesthetics by Byron & Wattenberg for more information. * * @param series A series generated by a stack generator */ @@ -2297,6 +2695,14 @@ export function stackOrderReverse(series: Series): number[]; */ export function stackOffsetExpand(series: Series, order: number[]): void; +/** + * Positive values are stacked above zero, while negative values are stacked below zero. + * + * @param series A series generated by a stack generator + * @param order An array of numeric indexes representing the stack order. + */ +export function stackOffsetDiverging(series: Series, order: number[]): void; + /** * Applies a zero baseline. * diff --git a/types/d3-shape/tslint.json b/types/d3-shape/tslint.json index 08b1465cd6..604d5950cf 100644 --- a/types/d3-shape/tslint.json +++ b/types/d3-shape/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "unified-signatures": false + "unified-signatures": false, + "callable-types": false } } diff --git a/types/d3-time-format/index.d.ts b/types/d3-time-format/index.d.ts index 4533d69dbb..3d1cecf221 100644 --- a/types/d3-time-format/index.d.ts +++ b/types/d3-time-format/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for d3JS d3-time-format module v2.0.2 +// Type definitions for d3JS d3-time-format module 2.0 // Project: https://github.com/d3/d3-time-format/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 2.0.2 + /** * Specification of time locale to use when creating a new TimeLocaleObject */ @@ -41,7 +43,6 @@ export interface TimeLocaleDefinition { shortMonths: [string, string, string, string, string, string, string, string, string, string, string, string]; } - export interface TimeLocaleObject { format(specifier: string): (date: Date) => string; parse(specifier: string): (dateString: string) => (Date | null); @@ -70,8 +71,6 @@ export function utcFormat(specifier: string): (date: Date) => string; export function utcParse(specifier: string): (dateString: string) => (Date | null); - - export function isoFormat(date: Date): string; export function isoParse(dateString: string): Date; diff --git a/types/d3-time-format/tslint.json b/types/d3-time-format/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-time-format/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-time/d3-time-tests.ts b/types/d3-time/d3-time-tests.ts index b16c3e40ea..a99cd818a0 100644 --- a/types/d3-time/d3-time-tests.ts +++ b/types/d3-time/d3-time-tests.ts @@ -8,14 +8,13 @@ import * as d3Time from 'd3-time'; - let countableI: d3Time.CountableTimeInterval; let simpleI: d3Time.TimeInterval; -let dateArray: Array; -let start: Date = new Date(2014, 1, 1, 6, 0, 0, 0), - end: Date = new Date(2016, 6, 13, 1, 25, 15, 500), - inBetween: Date = new Date(2015, 6, 13, 1, 30, 5, 700), - resultDate: Date; +let dateArray: Date[]; +let start: Date = new Date(2014, 1, 1, 6, 0, 0, 0); +let end: Date = new Date(2016, 6, 13, 1, 25, 15, 500); +let inBetween: Date = new Date(2015, 6, 13, 1, 30, 5, 700); +let resultDate: Date; let count: number; // Test custom factories' definitions ------------------------------------------ @@ -41,7 +40,7 @@ countableI = d3Time.timeInterval( // offset function (d: Date, step: number) => { d.setUTCHours(d.getUTCHours() + step); }, // count function - (start: Date, end: Date) => { return (end.valueOf() - start.valueOf()) / 36e5; } + (start: Date, end: Date) => (end.valueOf() - start.valueOf()) / 36e5 ); countableI = d3Time.timeInterval( @@ -50,9 +49,9 @@ countableI = d3Time.timeInterval( // offset function (d: Date, step: number) => { d.setUTCHours(d.getUTCHours() + step); }, // count function - (start: Date, end: Date) => { return (end.valueOf() - start.valueOf()) / 36e5; }, + (start: Date, end: Date) => (end.valueOf() - start.valueOf()) / 36e5, // field function - (d: Date) => { return d.valueOf() / 36e5; } + (d: Date) => d.valueOf() / 36e5 ); // Test signatures of (Countable)Interval methods ------------------------------ @@ -71,7 +70,7 @@ dateArray = countableI.range(new Date(), new Date()); // TODO: specify dates dateArray = countableI.range(new Date(), new Date(), 2); // TODO: specify dates // 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; }); +simpleI = countableI.filter((d: Date) => d.getMonth() === 2); count = countableI.count(start, end); @@ -84,7 +83,7 @@ resultDate = simpleI.ceil(inBetween); resultDate = simpleI.ceil(inBetween); resultDate = simpleI.offset(inBetween); resultDate = simpleI.offset(inBetween, 3); -simpleI = simpleI.filter((d: Date) => { return d.getMonth() === 2; }); +simpleI = simpleI.filter((d: Date) => d.getMonth() === 2); // count = simpleI.count(start, end); // Test fails, since .count(...) is not defined on Interval // simpleI = simpleI.every(10); // Test fails, since .every(...) is not defined on Interval @@ -151,7 +150,6 @@ countableI = d3Time.timeYear; dateArray = d3Time.timeYears(start, end); dateArray = d3Time.timeYears(start, end, 2); - countableI = d3Time.utcMillisecond; dateArray = d3Time.utcMilliseconds(start, end); dateArray = d3Time.utcMilliseconds(start, end, 60000); diff --git a/types/d3-time/index.d.ts b/types/d3-time/index.d.ts index 912d999ce4..5e2b66718f 100644 --- a/types/d3-time/index.d.ts +++ b/types/d3-time/index.d.ts @@ -19,10 +19,14 @@ export interface TimeInterval { * * 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. + * 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. + * 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. * @@ -35,10 +39,14 @@ export interface TimeInterval { * * 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. + * 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. + * 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. * @@ -63,8 +71,10 @@ export interface TimeInterval { * * 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. + * 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. */ @@ -79,7 +89,8 @@ export interface TimeInterval { * 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; + * @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; @@ -87,10 +98,12 @@ export interface TimeInterval { /** * 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 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. + * 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. @@ -104,7 +117,8 @@ export interface TimeInterval { /** * 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. + * @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; } @@ -129,7 +143,8 @@ export interface CountableTimeInterval extends TimeInterval { * 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; + * 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. @@ -151,7 +166,8 @@ export interface CountableTimeInterval extends TimeInterval { * 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. + * @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, @@ -165,13 +181,17 @@ export function timeInterval( * 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). + * @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, + * @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. + * 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, @@ -184,13 +204,12 @@ export function timeInterval( // Built-In Factories and Date Array Creators // --------------------------------------------------------------- - // local time ---------------------------------------------------------- /** * Milliseconds Interval in Local Time; the shortest available time unit. */ -export var timeMillisecond: CountableTimeInterval; +export const timeMillisecond: CountableTimeInterval; /** * This is a convenience alias for timeMillisecond.range(...). @@ -204,7 +223,7 @@ 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; +export const timeSecond: CountableTimeInterval; /** * This is a convenience alias for timeSecond.range(...). @@ -218,7 +237,7 @@ 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; +export const timeMinute: CountableTimeInterval; /** * This is a convenience alias for timeMinute.range(...). @@ -234,7 +253,7 @@ export function timeMinutes(start: Date, stop: Date, step?: number): Date[]; * * 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; +export const timeHour: CountableTimeInterval; /** * This is a convenience alias for timeHour.range(...). @@ -249,7 +268,7 @@ 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; +export const timeDay: CountableTimeInterval; /** * This is a convenience alias for timeDay.range(...). @@ -265,7 +284,7 @@ export function timeDays(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeWeek: CountableTimeInterval; +export const timeWeek: CountableTimeInterval; /** * This is a convenience alias for timeWeek.range(...). @@ -282,7 +301,7 @@ export function timeWeeks(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeSunday: CountableTimeInterval; +export const timeSunday: CountableTimeInterval; /** * This is a convenience alias for timeSunday.range(...). @@ -299,7 +318,7 @@ export function timeSundays(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeMonday: CountableTimeInterval; +export const timeMonday: CountableTimeInterval; /** * This is a convenience alias for timeMonday.range(...). @@ -316,7 +335,7 @@ export function timeMondays(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeTuesday: CountableTimeInterval; +export const timeTuesday: CountableTimeInterval; /** * This is a convenience alias for timeTuesday.range(...). @@ -333,7 +352,7 @@ export function timeTuesdays(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeWednesday: CountableTimeInterval; +export const timeWednesday: CountableTimeInterval; /** * This is a convenience alias for timeWednesday.range(...). @@ -350,7 +369,7 @@ export function timeWednesdays(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeThursday: CountableTimeInterval; +export const timeThursday: CountableTimeInterval; /** * This is a convenience alias for timeThursday.range(...). @@ -367,8 +386,7 @@ export function timeThursdays(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeFriday: CountableTimeInterval; - +export const timeFriday: CountableTimeInterval; /** * This is a convenience alias for timeFriday.range(...). @@ -385,7 +403,7 @@ export function timeFridays(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeSaturday: CountableTimeInterval; +export const timeSaturday: CountableTimeInterval; /** * This is a convenience alias for timeSaturday.range(...). @@ -399,7 +417,7 @@ 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; +export const timeMonth: CountableTimeInterval; /** * This is a convenience alias for timeMonth.range(...). @@ -413,7 +431,7 @@ 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; +export const timeYear: CountableTimeInterval; /** * This is a convenience alias for timeYear.range(...). @@ -424,13 +442,12 @@ export var timeYear: CountableTimeInterval; */ 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; +export const utcMillisecond: CountableTimeInterval; /** * This is a convenience alias for utcMilliesecond.range(...). @@ -444,7 +461,7 @@ 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; +export const utcSecond: CountableTimeInterval; /** * This is a convenience alias for utcSecond.range(...). @@ -456,9 +473,10 @@ export var utcSecond: CountableTimeInterval; 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. + * 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; +export const utcMinute: CountableTimeInterval; /** * This is a convenience alias for utcMinute.range(...). @@ -472,7 +490,7 @@ 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; +export const utcHour: CountableTimeInterval; /** * This is a convenience alias for utcHour.range(...). @@ -486,7 +504,7 @@ 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; +export const utcDay: CountableTimeInterval; /** * This is a convenience alias for utcDay.range(...). @@ -501,7 +519,7 @@ 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; +export const utcWeek: CountableTimeInterval; /** * This is a convenience alias for utcWeek.range(...). @@ -516,7 +534,7 @@ 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; +export const utcSunday: CountableTimeInterval; /** * This is a convenience alias for utcSunday.range(...). @@ -531,7 +549,7 @@ 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; +export const utcMonday: CountableTimeInterval; /** * This is a convenience alias for utcMonday.range(...). @@ -546,7 +564,7 @@ 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; +export const utcTuesday: CountableTimeInterval; /** * This is a convenience alias for utcTuesday.range(...). @@ -561,7 +579,7 @@ 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; +export const utcWednesday: CountableTimeInterval; /** * This is a convenience alias for utcWednesday.range(...). @@ -576,7 +594,7 @@ 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; +export const utcThursday: CountableTimeInterval; /** * This is a convenience alias for utcThursday.range(...). @@ -591,7 +609,7 @@ 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; +export const utcFriday: CountableTimeInterval; /** * This is a convenience alias for utcFriday.range(...). @@ -606,7 +624,7 @@ 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; +export const utcSaturday: CountableTimeInterval; /** * This is a convenience alias for utcSaturday.range(...). @@ -620,7 +638,7 @@ 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; +export const utcMonth: CountableTimeInterval; /** * This is a convenience alias for utcMonth.range(...). @@ -634,7 +652,7 @@ 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; +export const utcYear: CountableTimeInterval; /** * This is a convenience alias for utcYear.range(...). diff --git a/types/d3-time/tslint.json b/types/d3-time/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-time/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-timer/index.d.ts b/types/d3-timer/index.d.ts index ecb62c7610..08fee97696 100644 --- a/types/d3-timer/index.d.ts +++ b/types/d3-timer/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for d3JS d3-timer module v1.0.2 +// Type definitions for d3JS d3-timer module 1.0 // Project: https://github.com/d3/d3-timer/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.2 + /** * Returns the current time as defined by performance.now if available, and Date.now if not. * The current time is updated at the start of a frame; it is thus consistent during the frame, and any timers scheduled during the same frame will be synchronized. @@ -11,7 +13,6 @@ */ export function now(): number; - export interface Timer { /** * Restart a timer with the specified callback and optional delay and time. diff --git a/types/d3-timer/tslint.json b/types/d3-timer/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-timer/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-transition/index.d.ts b/types/d3-transition/index.d.ts index 58c8fd4063..1ff8d46d04 100644 --- a/types/d3-transition/index.d.ts +++ b/types/d3-transition/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for D3JS d3-transition module 1.0 +// Type definitions for D3JS d3-transition module 1.1 // Project: https://github.com/d3/d3-transition/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.0.3 +// Last module patch version validated against: 1.1 import { ArrayLike, BaseType, Selection, ValueFn } from 'd3-selection'; @@ -110,7 +110,7 @@ export interface Transition(selector: ValueFn): Transition; @@ -135,7 +135,7 @@ export interface Transition(selector: ValueFn>): Transition; @@ -194,7 +194,7 @@ export interface Transition): this; @@ -221,7 +221,7 @@ export interface Transition string>): this; @@ -234,8 +234,9 @@ export interface Transition): this; @@ -348,7 +350,7 @@ export interface Transition void>): this; @@ -397,7 +399,7 @@ export interface Transition): Transition; @@ -411,7 +413,7 @@ export interface Transition(filter: ValueFn): Transition; @@ -448,7 +450,7 @@ export interface Transition): this; @@ -457,11 +459,11 @@ export interface Transition): this; @@ -513,7 +515,7 @@ export interface Transition): this; @@ -535,7 +537,7 @@ export interface Transition): this; diff --git a/types/d3-voronoi/d3-voronoi-tests.ts b/types/d3-voronoi/d3-voronoi-tests.ts index 966ab622ec..7dea86241e 100644 --- a/types/d3-voronoi/d3-voronoi-tests.ts +++ b/types/d3-voronoi/d3-voronoi-tests.ts @@ -8,7 +8,6 @@ import * as d3Voronoi from 'd3-voronoi'; - // --------------------------------------------------------------------- // Preparatory Steps // --------------------------------------------------------------------- @@ -18,15 +17,14 @@ let size: [number, number]; let coordinates: [number, number]; let num: number; -let numArray: Array; - +let numArray: number[]; interface VoronoiTestDatum { x: number; y: number; } -let testData: Array = [ +let testData: VoronoiTestDatum[] = [ { x: 10, y: 10 }, { x: 20, y: 10 }, { x: 10, y: 20 }, @@ -44,7 +42,6 @@ let cells: Array>; let cell: d3Voronoi.VoronoiCell; let site: d3Voronoi.VoronoiSite; - let polygons: Array>; let polygon: d3Voronoi.VoronoiPolygon; @@ -116,17 +113,13 @@ voronoiLayout = d3Voronoi.voronoi(); // x(...) ------------------------------------------------------------- -voronoiLayout = voronoiLayout.x(function (d) { - return d.x; // data type of d is VoronoiTestDatum -}); +voronoiLayout = voronoiLayout.x(d => d.x); // data type of d is VoronoiTestDatum numberAccessor = voronoiLayout.x(); // y(...) ------------------------------------------------------------- -voronoiLayout = voronoiLayout.y(function (d) { - return d.y; // data type of d is VoronoiTestDatum -}); +voronoiLayout = voronoiLayout.y(d => d.y); // data type of d is VoronoiTestDatum numberAccessor = voronoiLayout.y(); @@ -161,13 +154,11 @@ polygons = voronoiLayout.polygons(testData); // generated from Layout triangles = voronoiLayout.triangles(testData); - // Links --------------------------------------------------------------- // generated from Layout links = voronoiLayout.links(testData); - // --------------------------------------------------------------------- // Use VoronoiDiagram // --------------------------------------------------------------------- @@ -235,7 +226,6 @@ link = links[0]; testDatum = link.source; testDatum = link.target; - // find() =============================================================== let nearestSite: d3Voronoi.VoronoiSite | null; diff --git a/types/d3-voronoi/index.d.ts b/types/d3-voronoi/index.d.ts index 9bd270d11d..1a529e4a71 100644 --- a/types/d3-voronoi/index.d.ts +++ b/types/d3-voronoi/index.d.ts @@ -1,13 +1,14 @@ -// Type definitions for D3JS d3-voronoi module v1.1.0 +// Type definitions for D3JS d3-voronoi module 1.1 // Project: https://github.com/d3/d3-voronoi/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.1.0 + // -------------------------------------------------------------------------- // Shared Type Definitions and Interfaces // -------------------------------------------------------------------------- - /** * The VoronoiPoint interface is defined as a cue that the array is strictly of type [number, number] with two elements * for x and y coordinates. However, it is used as a base for interface definitions, and [number, number] @@ -80,10 +81,9 @@ export interface VoronoiCell { /** * An array of indexes into diagram.edges representing the cell’s polygon. */ - halfEdges: Array; + halfEdges: number[]; } - /** * Voronoi Edge in the diagram is an array [[x0, y0], [x1, y1]] with two additional properties: * left and right. @@ -128,7 +128,7 @@ export interface VoronoiLayout { * Computes the Voronoi diagram for the specified data points. * @param data Array of data elements */ - (data: Array): VoronoiDiagram; + (data: T[]): VoronoiDiagram; /** * Return the current x-coordinate accessor, @@ -206,24 +206,23 @@ export interface VoronoiLayout { * * @param data Array of data points. */ - polygons(data: Array): Array>; + polygons(data: T[]): 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>; + triangles(data: T[]): 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>; + links(data: T[]): Array>; } - /** * Computed Voronoi diagram * @@ -276,7 +275,7 @@ export interface VoronoiDiagram { * @param y y-coordinate * @param radius Optional parameter for search radius around [x, y] */ - find(x: number, y:number, radius?:number): VoronoiSite | null; + find(x: number, y: number, radius?: number): VoronoiSite | null; } // -------------------------------------------------------------------------- diff --git a/types/d3-voronoi/tslint.json b/types/d3-voronoi/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-voronoi/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-zoom/d3-zoom-tests.ts b/types/d3-zoom/d3-zoom-tests.ts index b583bfc8b6..185b9fd45a 100644 --- a/types/d3-zoom/d3-zoom-tests.ts +++ b/types/d3-zoom/d3-zoom-tests.ts @@ -104,7 +104,7 @@ function zoomedCanvas(this: HTMLCanvasElement, d: CanvasDatum) { let canvasZoom: d3Zoom.ZoomBehavior; -canvasZoom = d3Zoom.zoom() +canvasZoom = d3Zoom.zoom() .scaleExtent([1 / 2, 4]) .on('zoom', zoomedCanvas); @@ -135,6 +135,23 @@ svgZoom = svgZoom.filter(function(d, i, group) { let filterFn: (this: SVGRectElement, d: SVGDatum, index: number, group: SVGRectElement[]) => boolean; filterFn = svgZoom.filter(); +// wheelDelta() ---------------------------------------------------------------- + +// chainable +svgZoom = svgZoom.wheelDelta(function(d, i, group) { + // Cast d3 event to D3ZoomEvent to be used in filter logic + const e = event; + const that: SVGRectElement = this; + const datum: SVGDatum = d; + const index: number = i; + const g: SVGRectElement[] | ArrayLike = group; + + return -e.deltaY * (e.deltaMode ? 100 : 1) / 600; +}); + +let wheelDeltaFn: (this: SVGRectElement, d: SVGDatum, index: number, group: SVGRectElement[]) => number; +wheelDeltaFn = svgZoom.wheelDelta(); + // extent() --------------------------------------------------------------- let extentAccessor: (this: SVGRectElement, d: SVGDatum, index: number, group: SVGRectElement[]) => [[number, number], [number, number]]; @@ -165,6 +182,12 @@ svgZoom = svgZoom.translateExtent([[-500, -500], [500, 500]]); let translateExtent: [[number, number], [number, number]]; translateExtent = svgZoom.translateExtent(); +// clickDistance() --------------------------------------------------------- + +svgZoom = svgZoom.clickDistance(5); + +const distance: number = svgZoom.clickDistance(); + // duration() -------------------------------------------------------------- // chainable diff --git a/types/d3-zoom/index.d.ts b/types/d3-zoom/index.d.ts index 62c49b977b..a0980344bb 100644 --- a/types/d3-zoom/index.d.ts +++ b/types/d3-zoom/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for d3JS d3-zoom module 1.1 +// Type definitions for d3JS d3-zoom module 1.3 // 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 +// Last module patch version validated against: 1.3.0 import { ArrayLike, Selection, TransitionLike, ValueFn } from 'd3-selection'; import { ZoomView, ZoomInterpolator } from 'd3-interpolate'; @@ -371,17 +371,34 @@ export interface ZoomBehavior; /** * Sets the filter to the specified filter function and returns the zoom behavior. + * The filter function is invoked in the zoom initiating event handlers of each element to which the zoom behavior was applied. * * If the filter returns falsey, the initiating event is ignored and no zoom gesture is started. * Thus, the filter determines which input events are ignored. The default filter ignores mousedown events on secondary buttons, * since those buttons are typically intended for other purposes, such as the context menu. * - * @param filterFn A filter function which is evaluated for each selected element, + * @param filterFn A filter function which is invoked in the zoom initiating event handlers of each element to which the zoom behavior was applied, * 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 function returns a boolean value. */ filter(filterFn: ValueFn): this; + /** + * Returns the current wheelDelta function. + */ + wheelDelta(): ValueFn; + /** + * Sets the wheel delta function to the specified function and returns the zoom behavior. The wheel delta function which is invoked in the wheel event handler + * of each element to which the zoom behavior was applied. + * The value Δ returned by the wheel delta function determines the amount of scaling applied in response to a WheelEvent. + * The scale factor transform.k is multiplied by 2Δ; for example, a Δ of +1 doubles the scale factor, Δ of -1 halves the scale factor. + * + * @param delta Wheel delta function which is invoked in the wheel event handler of each element to which the zoom behavior was applied, + * 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 function returns a numeric value. + */ + wheelDelta(delta: ValueFn): this; + /** * Return the current extent accessor, which defaults to [[0, 0], [width, height]] where width is the client width of the element and height is its client height; * for SVG elements, the nearest ancestor SVG element’s width and height is used. In this case, @@ -461,6 +478,20 @@ export interface ZoomBehavior, Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/dat-gui/index.d.ts b/types/dat-gui/index.d.ts index 32b2083542..3cf4883fd8 100644 --- a/types/dat-gui/index.d.ts +++ b/types/dat-gui/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for dat.GUI v0.6.1 +// Type definitions for dat.GUI 0.6 // Project: https://github.com/dataarts/dat.gui -// Definitions by: Satoru Kimura , ZongJing Lu +// Definitions by: Satoru Kimura , ZongJing Lu , Richard Roylance // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + export as namespace dat; export class GUI { @@ -57,6 +58,7 @@ export class GUI { export interface GUIParams{ autoPlace?: boolean; closed?: boolean; + closeOnTop?: boolean; load?: any; name?: string; preset?: string; diff --git a/types/dc/index.d.ts b/types/dc/index.d.ts index 9f9d7d3a57..7d893baf3e 100644 --- a/types/dc/index.d.ts +++ b/types/dc/index.d.ts @@ -44,6 +44,11 @@ declare namespace dc { (datum: T, index?: number): V; } + export interface Columns { + label: string; + format: Accessor; + } + export interface UnitFunction { (start: number, end: number, domain?: Array): number|Array; } @@ -117,6 +122,7 @@ declare namespace dc { itemHeight: IGetSet; horizontal: IGetSet; legendWidth: IGetSet; + legendText: IGetSet; itemWidth: IGetSet; autoItemWidth: IGetSet; render: () => void; @@ -139,6 +145,7 @@ declare namespace dc { svg: IGetSet, d3.Selection>; resetSvg(): void; filterPrinter: IGetSet<(filters: Array) => string, T>; + controlsUseVisibility: IGetSet; turnOnControls(): void; turnOffControls(): void; transitionDuration: IGetSet; @@ -299,7 +306,8 @@ declare namespace dc { export interface DataTableWidget extends BaseMixin { size: IGetSet; - columns: IGetSet|string|Array|string>>, DataTableWidget>; + showGroups: IGetSet; + columns: IGetSet|Columns>, DataTableWidget>; sortBy: IGetSet, DataTableWidget>; order: IGetSet<(a: any, b: any) => number, DataTableWidget>; } diff --git a/types/debessmann/debessmann-tests.ts b/types/debessmann/debessmann-tests.ts index 3e44ff8cd6..802257992e 100644 --- a/types/debessmann/debessmann-tests.ts +++ b/types/debessmann/debessmann-tests.ts @@ -1,7 +1,7 @@ import {DM, Event, EventId} from 'debessmann'; let eventId: EventId = {seq: 0, time: new Date()}; -let e: Event = {_id: eventId, headers: {'header1': 'header1Val'}}; +let e: Event = {_id: eventId, headers: {header1: 'header1Val'}}; let dm: DM = { init(endpoint: string, auth: string): void { diff --git a/types/deep-freeze/deep-freeze-tests.ts b/types/deep-freeze/deep-freeze-tests.ts index 4eeb1e9890..b8a6061859 100644 --- a/types/deep-freeze/deep-freeze-tests.ts +++ b/types/deep-freeze/deep-freeze-tests.ts @@ -1,8 +1,7 @@ - - import df = require('deep-freeze'); class Foo { - foo: string; + foo: string; } -var foo:Foo = df(new Foo()); +const foo = df(new Foo()); +const items = df([{id: 0, name: 'first'}]); diff --git a/types/deep-freeze/index.d.ts b/types/deep-freeze/index.d.ts index 92f6c8db2f..16e183d185 100644 --- a/types/deep-freeze/index.d.ts +++ b/types/deep-freeze/index.d.ts @@ -1,13 +1,17 @@ -// Type definitions for deep-freeze +// Type definitions for deep-freeze 0.1 // Project: https://github.com/substack/deep-freeze -// Definitions by: Bart van der Schoor +// Definitions by: Bart van der Schoor , Aluan Haddad // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 -declare var deepFreeze: DeepFreeze.DeepFreezeInterface; export = deepFreeze; -declare namespace DeepFreeze { - export interface DeepFreezeInterface { - (obj: T): T; - } +declare function deepFreeze(a: T[]): ReadonlyArray>; +declare function deepFreeze(f: T): T; +declare function deepFreeze(o: T): deepFreeze.DeepReadonly; + +declare namespace deepFreeze { + type DeepReadonly = { + readonly [P in keyof T]: DeepReadonly + }; } diff --git a/types/deep-freeze/tslint.json b/types/deep-freeze/tslint.json new file mode 100644 index 0000000000..1cd17c5dc4 --- /dev/null +++ b/types/deep-freeze/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // This package uses the Function type to align with lib.d.ts + "ban-types": false + } +} diff --git a/types/deepmerge/deepmerge-tests.ts b/types/deepmerge/deepmerge-tests.ts index 8c7988ba78..5467cb83f0 100644 --- a/types/deepmerge/deepmerge-tests.ts +++ b/types/deepmerge/deepmerge-tests.ts @@ -1,13 +1,19 @@ import * as deepmerge from "deepmerge"; -const x = { foo: { bar: 3 }, - array: [ { does: 'work', too: [ 1, 2, 3 ] } ] }; -const y = { foo: { baz: 4 }, +const x = { + foo: { bar: 3 }, + array: [{ does: 'work', too: [1, 2, 3] }] +}; +const y = { + foo: { baz: 4 }, quux: 5, - array: [ { does: 'work', too: [ 4, 5, 6 ] }, { really: 'yes' } ] }; + array: [{ does: 'work', too: [4, 5, 6] }, { really: 'yes' }] +}; -const expected = { foo: { bar: 3, baz: 4 }, - array: [ { does: 'work', too: [ 1, 2, 3, 4, 5, 6 ] }, { really: 'yes' } ], - quux: 5 }; +const expected = { + foo: { bar: 3, baz: 4 }, + array: [{ does: 'work', too: [1, 2, 3, 4, 5, 6] }, { really: 'yes' }], + quux: 5 +}; const result = deepmerge(x, y); diff --git a/types/devexpress-web/README.md b/types/devexpress-web/README.md index 341304e192..897ec236e1 100644 --- a/types/devexpress-web/README.md +++ b/types/devexpress-web/README.md @@ -2,8 +2,7 @@ DevExpress ASP.NET/MVC TypeScript definitions ============================================= You can use these TypeScript definitions for your web projects, which contain -DevExpress ASP.NET or MVC controls. For this, simply add at the top of your -code ``. +DevExpress ASP.NET or MVC controls. The API enclosed into the DevExpress ASP.NET/MVC TypeScript definition file fully corresponds to the API described in the DevExpress ASP.NET/MVC diff --git a/types/devexpress-web/devexpress-web-tests.ts b/types/devexpress-web/devexpress-web-tests.ts index 8a76a68f26..ef7eb8de37 100644 --- a/types/devexpress-web/devexpress-web-tests.ts +++ b/types/devexpress-web/devexpress-web-tests.ts @@ -1,5 +1,3 @@ -/// - declare var hiddenField: ASPxClientHiddenField; declare var mainCallbackPanel: ASPxClientCallbackPanel; declare var loginPopup: ASPxClientPopupControl; @@ -82,7 +80,6 @@ module DXDemo { export function onSearchComboBoxIndexChanged(s: ASPxClientComboBox, e: ASPxClientProcessingModeEventArgs): void { hideMenu(); - $("#IndexContent").addClass("search-extend"); searchButton.AdjustControl(); }; @@ -303,19 +300,14 @@ module DXDemo { } catch (e) { } ASPxClientUtils.AttachEventToElement(window, "resize", onWindowResize); if (ASPxClientUtils.iOSPlatform) { - $("form :input").blur(function () { - $('html, body').animate({ scrollTop: 0 }, 0); - }); + // animate } }; export function updateRatingLabels(ratingControl: ASPxClientTrackBar) { - $("#cpLeftLabelID").html(ratingControl.GetPositionStart().toString()); - $("#cpRightLabelID").html(ratingControl.GetPositionEnd().toString()); - }; - - export function onAboutWindowCloseUp(): void { - $(mainCallbackPanel.GetMainElement()).removeClass("show-about"); + var start = ratingControl.GetPositionStart().toString(); + var end = ratingControl.GetPositionEnd().toString(); + document.getElementById("cpLeftLabelID").innerHTML = start + " " + end; }; export function onRatingControlItemClick(s: ASPxClientRatingControl, e: ASPxClientRatingControlItemClickEventArgs): void { @@ -324,10 +316,8 @@ module DXDemo { export function onInputKeyDown(s: ASPxClientTextBox, e: ASPxClientEditKeyEventArgs): void { var keyCode = ASPxClientUtils.GetKeyCode(e.htmlEvent); - if (keyCode == 13) { - (jQuery).event.fix(e.htmlEvent).preventDefault(); + if (keyCode == 13) (s.GetInputElement()).blur(); - } }; function getCurrentPage(): string { @@ -339,7 +329,6 @@ module DXDemo { }; function showAboutWindow(): void { - $(mainCallbackPanel.GetMainElement()).addClass("show-about"); aboutWindow.ShowAtElementByID("MainCallbackPanel_ContentPane"); }; diff --git a/types/devexpress-web/index.d.ts b/types/devexpress-web/index.d.ts index b52c31759d..466f002f36 100644 --- a/types/devexpress-web/index.d.ts +++ b/types/devexpress-web/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for DevExpress ASP.NET 16.1 +// Type definitions for DevExpress ASP.NET v171.3 // Project: http://devexpress.com/ // Definitions by: DevExpress Inc. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -41,7 +41,7 @@ interface ASPxClientDashboardItemUnderlyingData { interface ASPxClientDashboardItemRequestUnderlyingDataParameters { /** * Gets or sets an array of data member identifiers used to obtain underlying data. - * Value: An array of String objects that specify data member identifiers. + * Value: An array of string values that specify data member identifiers. */ DataMembers: string[]; /** @@ -71,23 +71,23 @@ interface ASPxClientDashboardItemRequestUnderlyingDataCompleted { (data: ASPxClientDashboardItemUnderlyingData): void; } /** - * References a method that will handle the ItemClick event. + * References a method that will handle the ItemClick events. */ interface ASPxClientDashboardItemClickEventHandler { /** - * References a method that will handle the ItemClick event. + * References a method that will handle the ItemClick events. * @param source The event source. * @param e A ASPxClientDashboardItemClickEventArgs object that contains event data. */ (source: S, e: ASPxClientDashboardItemClickEventArgs): void; } /** - * Provides data for the ItemClick event. + * Provides data for the ItemClick events. */ interface ASPxClientDashboardItemClickEventArgs extends ASPxClientEventArgs { /** * Gets the name of the dashboard item for which the event has been raised. - * Value: A String that is the dashboard item name. + * Value: A string value that is the dashboard item name. */ ItemName: string; /** @@ -115,28 +115,28 @@ interface ASPxClientDashboardItemClickEventArgs extends ASPxClientEventArgs { /** * Requests underlying data corresponding to the clicked visual element. * @param onCompleted A ASPxClientDashboardItemRequestUnderlyingDataCompleted object that references a method executed after the request is completed. - * @param dataMembers An array of String values that specify data members used to obtain underlying data. + * @param dataMembers An array of string values that specify data members used to obtain underlying data. */ RequestUnderlyingData(onCompleted: ASPxClientDashboardItemRequestUnderlyingDataCompleted, dataMembers: string[]): void; } /** - * References a method that will handle the ItemVisualInteractivity event. + * References a method that will handle the ItemVisualInteractivity events. */ interface ASPxClientDashboardItemVisualInteractivityEventHandler { /** - * References a method that will handle the ItemVisualInteractivity event. + * References a method that will handle the ItemVisualInteractivity events. * @param source The event source. * @param e A ASPxClientDashboardItemVisualInteractivityEventArgs object containing event data. */ (source: S, e: ASPxClientDashboardItemVisualInteractivityEventArgs): void; } /** - * Provides data for the ItemVisualInteractivity event. + * Provides data for the ItemVisualInteractivity events. */ interface ASPxClientDashboardItemVisualInteractivityEventArgs extends ASPxClientEventArgs { /** * Gets the component name of the dashboard item for which the event was raised. - * Value: A String that is the component name of the dashboard item. + * Value: A string value that is the component name of the dashboard item. */ ItemName: string; /** @@ -177,23 +177,23 @@ interface ASPxClientDashboardItemVisualInteractivityEventArgs extends ASPxClient SetDefaultSelection(values: ASPxClientDashboardItemDataAxisPointTuple[]): void; } /** - * References a method that will handle the ItemSelectionChanged event. + * References a method that will handle the ItemSelectionChanged events. */ interface ASPxClientDashboardItemSelectionChangedEventHandler { /** - * References a method that will handle the ItemSelectionChanged event. + * References a method that will handle the ItemSelectionChanged events. * @param source The event source. * @param e A ASPxClientDashboardItemSelectionChangedEventArgs object containing event data. */ (source: S, e: ASPxClientDashboardItemSelectionChangedEventArgs): void; } /** - * Provides data for the ItemSelectionChanged event. + * Provides data for the ItemSelectionChanged events. */ interface ASPxClientDashboardItemSelectionChangedEventArgs extends ASPxClientEventArgs { /** * Gets the component name of the dashboard item for which the event was raised. - * Value: A String that is the component name of the dashboard item. + * Value: A string that is the component name of the dashboard item. */ ItemName: string; /** @@ -206,19 +206,19 @@ interface ASPxClientDashboardItemSelectionChangedEventArgs extends ASPxClientEve */ interface ASPxClientDashboardItemElementCustomColorEventHandler { /** - * References a method that will handle the ItemElementCustomColor event. + * References a method that will handle the ItemElementCustomColor events. * @param source The event source. * @param e An ASPxClientDashboardItemElementCustomColorEventArgs object that contains event data. */ (source: S, e: ASPxClientDashboardItemElementCustomColorEventArgs): void; } /** - * Provides data for the ItemElementCustomColor event. + * Provides data for the ItemElementCustomColor events. */ interface ASPxClientDashboardItemElementCustomColorEventArgs extends ASPxClientEventArgs { /** * Gets the component name of the dashboard item for which the event was raised. - * Value: A String that is the component name of the dashboard item for which the event was raised. + * Value: A string value that is the component name of the dashboard item for which the event was raised. */ ItemName: string; /** @@ -240,11 +240,11 @@ interface ASPxClientDashboardItemElementCustomColorEventArgs extends ASPxClientE GetMeasures(): ASPxClientDashboardItemDataMeasure[]; } /** - * References a method that will handle the ItemWidgetCreated event. + * References a method that will handle the ItemWidgetCreated events. */ interface ASPxClientDashboardItemWidgetCreatedEventHandler { /** - * References a method that will handle the ItemWidgetCreated event. + * References a method that will handle the ItemWidgetCreated events. * @param source The event source. * @param e A ASPxClientDashboardItemWidgetEventArgs object that contains event data. */ @@ -273,11 +273,11 @@ interface ASPxClientDashboardItemWidgetUpdatedEventHandler { (source: S, e: ASPxClientDashboardItemWidgetEventArgs): void; } /** - * References a method that will handle the ItemBeforeWidgetDisposed event. + * References a method that will handle the ItemBeforeWidgetDisposed events. */ interface ASPxClientDashboardItemBeforeWidgetDisposedEventHandler { /** - * References a method that will handle the ItemBeforeWidgetDisposed event. + * References a method that will handle the ItemBeforeWidgetDisposed events. * @param source The event source. * @param e A ASPxClientDashboardItemWidgetEventArgs object that contains event data. */ @@ -289,7 +289,7 @@ interface ASPxClientDashboardItemBeforeWidgetDisposedEventHandler { interface ASPxClientDashboardItemWidgetEventArgs extends ASPxClientEventArgs { /** * Gets the component name of the dashboard item for which the event was raised. - * Value: A String that is the component name of the dashboard item. + * Value: A string value that is the component name of the dashboard item. */ ItemName: string; /** @@ -391,27 +391,27 @@ interface ASPxClientDashboardItemDataAxis { interface ASPxClientDashboardItemDataDimension { /** * Gets the dimension identifier. - * Value: A String that is the dimension identifier. + * Value: A string value that is the dimension identifier. */ Id: string; /** * Gets or sets the name of the dimension. - * Value: A String that is the name of the dimension. + * Value: A string value that is the name of the dimension. */ Name: string; /** * Gets the data member identifier for the current dimension. - * Value: A String value that identifies a data member. + * Value: A string value that identifies a data member. */ DataMember: string; /** * Gets the group interval for date-time values for the current dimension. - * Value: A String value that represents how date-time values are grouped. + * Value: A string value that represents how date-time values are grouped. */ DateTimeGroupInterval: string; /** * Gets the group interval for string values. - * Value: A String value that specifies the group interval for string values. + * Value: A string value that specifies the group interval for string values. */ TextGroupInterval: string; /** @@ -426,22 +426,22 @@ interface ASPxClientDashboardItemDataDimension { interface ASPxClientDashboardItemDataMeasure { /** * Gets the measure identifier. - * Value: A String that is the measure identifier. + * Value: A string value that is the measure identifier. */ Id: string; /** * Gets the name of the measure. - * Value: A String that is the name of the measure. + * Value: A string value that is the name of the measure. */ Name: string; /** * Gets the data member that identifies the data source list used to provide data for the current measure. - * Value: A String value that identifies the data source list used to provide data for the current measure. + * Value: A string value that identifies the data source list used to provide data for the current measure. */ DataMember: string; /** * Gets the type of summary function calculated against the current measure. - * Value: A String value that identifies the type of summary function calculated against the current measure. + * Value: A string value that identifies the type of summary function calculated against the current measure. */ SummaryType: string; /** @@ -456,22 +456,22 @@ interface ASPxClientDashboardItemDataMeasure { interface ASPxClientDashboardItemDataDelta { /** * Gets the data item identifier. - * Value: A String that is the data item identifier. + * Value: A string that is the data item identifier. */ Id: string; /** * Gets the name of the data item container. - * Value: A String value that is the name of the data item container. + * Value: A string value that is the name of the data item container. */ Name: string; /** * Gets the identifier for the measure that provides actual values. - * Value: A String value that is the measure identifier. + * Value: A string value that is the measure identifier. */ ActualMeasureId: string; /** * Gets the identifier for the measure that provides target values. - * Value: A String value that is the measure identifier. + * Value: A string value that is the measure identifier. */ TargetMeasureId: string; } @@ -611,55 +611,1040 @@ interface ASPxClientDashboardItemDataAxisPointTuple { GetAxisPoint(axisName: string): ASPxClientDashboardItemDataAxisPoint; } /** - * A client-side equivalent of the ASPxDashboardDesigner control. + * A range in the Range Filter dashboard item. */ -interface ASPxClientDashboardDesigner extends ASPxClientControl { +interface ASPxClientDashboardRangeFilterSelection { /** - * Occurs after the state of the dashboard displayed in the ASPxClientDashboardDesigner is changed. + * Gets or sets a maximum value in the range of the Range Filter dashboard item. + * Value: A maximum value in the range of the Range Filter dashboard item. */ - DashboardStateChanged: ASPxClientEvent>; + Maximum: Object; /** - * Occurs after another dashboard is loaded to the ASPxClientDashboardDesigner. + * Gets or sets a minimum value in the range of the Range Filter dashboard item. + * Value: A minimum value in the range of the Range Filter dashboard item. */ - DashboardChanged: ASPxClientEvent>; + Minimum: Object; +} +/** + * A collection of ASPxClientDashboardParameter objects. + */ +interface ASPxClientDashboardParameters { + /** + * Returns an array of dashboard parameters from the ASPxClientDashboardParameters collection. + */ + GetParameterList(): ASPxClientDashboardParameter[]; + /** + * Returns a dashboard parameter by its name. + * @param name A String object that specifies the parameter name. + */ + GetParameterByName(name: string): ASPxClientDashboardParameter; + /** + * Returns a dashboard parameter by its index in the ASPxClientDashboardParameters collection. + * @param index An integer value that specifies the parameter index. + */ + GetParameterByIndex(index: number): ASPxClientDashboardParameter; +} +/** + * A client-side dashboard parameter. + */ +interface ASPxClientDashboardParameter { + /** + * Gets the dashboard parameter name on the client side. + * Value: A string value that is the dashboard parameter name on the client side. + */ + Name: string; + /** + * Gets the dashboard parameter value on the client side. + * Value: A string value that specifies the dashboard parameter value on the client side. + */ + Value: Object; + /** + * Returns a parameter name. + */ + GetName(): string; + /** + * Returns a current parameter value(s). + */ + GetValue(): Object; + /** + * Specifies the current parameter value(s). + * @param value The current parameter value(s). + */ + SetValue(value: Object): void; + /** + * Returns a default parameter value. + */ + GetDefaultValue(): Object; + /** + * Returns the parameter's description displayed to an end-user. + */ + GetDescription(): string; + /** + * Returns a parameter type. + */ + GetType(): string; + /** + * Returns possible parameter values. + */ + GetValues(): ASPxClientDashboardParameterValue[]; +} +/** + * Provides access to the parameter value and display text. + */ +interface ASPxClientDashboardParameterValue { + /** + * Returns the parameter display text. + */ + GetDisplayText(): string; + /** + * Returns a parameter value. + */ + GetValue(): Object; +} +/** + * Contains settings that specify parameters affecting how the dashboard or dashboard item is exported in Image format. + */ +interface ImageFormatOptions { + /** + * Gets or sets an image format in which the dashboard (dashboard item) is exported. + * Value: A value returned by the DashboardExportImageFormat class that specifies an image format in which the dashboard (dashboard item) is exported. + */ + Format: string; + /** + * Gets or sets the resolution (in dpi) used to export a dashboard (dashboard item) in Image format. + * Value: An integer value that specifies the resolution (in dpi) used to export a dashboard (dashboard item) in Image format. + */ + Resolution: number; +} +/** + * Contains options which define how the dashboard item is exported to Excel format. + */ +interface ExcelFormatOptions { + /** + * Gets or sets the Excel format in which the dashboard item is exported. + * Value: A value returned by the DashboardExportExcelFormat class that specifies the Excel format in which the dashboard item is exported. + */ + Format: string; + /** + * Gets or sets a character used to separate values in a CSV document. + * Value: A string value that specifies the character used to separate values in a CSV document. + */ + CsvValueSeparator: string; +} +/** + * Contains settings that specify parameters affecting how the Grid dashboard item is exported. + */ +interface GridExportOptions { + /** + * Gets or sets whether the size of the Grid dashboard item is changed according to the width of the exported page. + * Value: true, to change the size of the Grid dashboard item according to the width of the exported page; otherwise, false. + */ + FitToPageWidth: boolean; + /** + * Gets or sets whether to print column headers of the Grid dashboard item on every page. + * Value: true, to print column headers on every page; otherwise, false. + */ + PrintHeadersOnEveryPage: boolean; +} +/** + * Contains settings that specify parameters affecting how the Pivot dashboard item is exported. + */ +interface PivotExportOptions { + /** + * Gets or sets whether to print the column headers of the Pivot dashboard item on every page. + * Value: true, to print column headers on every page; otherwise, false. + */ + PrintHeadersOnEveryPage: boolean; +} +/** + * Contains settings that specify parameters affecting how the Pie dashboard item is exported. + */ +interface PieExportOptions { + /** + * Gets or sets whether dashboard item elements are arranged automatically on the exported page. + * Value: true, to arrange dashboard item elements automatically on the exported page; otherwise, false. + */ + AutoArrangeContent: boolean; +} +/** + * Contains settings that specify parameters affecting how the Gauge dashboard item is exported. + */ +interface GaugeExportOptions { + /** + * Gets or sets whether dashboard item elements are arranged automatically on the exported page. + * Value: true, to arrange dashboard item elements automatically on the exported page; otherwise, false. + */ + AutoArrangeContent: boolean; +} +/** + * Contains settings that specify parameters affecting how the Card dashboard item is exported. + */ +interface CardExportOptions { + /** + * Gets or sets whether dashboard item elements are arranged automatically on the exported page. + * Value: true, to arrange dashboard item elements automatically on the exported page; otherwise, false. + */ + AutoArrangeContent: boolean; +} +/** + * Contains settings that specify parameters affecting how the Range Filter dashboard item is exported. + */ +interface RangeFilterExportOptions { + /** + * Gets or sets whether the page orientation used to export a Range Filter dashboard item is selected automatically. + * Value: true, to automatically select the page orientation used to export a Range Filter dashboard item; otherwise, false. + */ + AutomaticPageLayout: boolean; + /** + * Gets or sets the export size mode for the Range Filter dashboard item. + * Value: A value returned by the RangeFilterExportSizeMode class that specifies the export size mode for the Range Filter dashboard item. + */ + SizeMode: string; +} +/** + * Contains settings that specify parameters affecting how Chart dashboard items are exported. + */ +interface ChartExportOptions { + /** + * Gets or sets whether the page orientation used to export a Chart dashboard item is selected automatically. + * Value: true, to automatically select the page orientation used to export a Chart dashboard item; otherwise, false. + */ + AutomaticPageLayout: boolean; + /** + * Gets or sets the export size mode for the Chart dashboard item. + * Value: A value returned by the ChartExportSizeMode class that specifies the export size mode for the Chart dashboard item. + */ + SizeMode: string; +} +/** + * Contains settings that specify parameters affecting how Map dashboard items are exported. + */ +interface MapExportOptions { + /** + * Gets or sets whether the page orientation used to export a map dashboard item is selected automatically. + * Value: true, to automatically select the page orientation used to export a map dashboard item; otherwise, false. + */ + AutomaticPageLayout: boolean; + /** + * Gets or sets the export size mode for the map dashboard item. + * Value: A value returned by the MapExportSizeMode class that specifies specifies the export size mode for the map dashboard item. + */ + SizeMode: string; +} +/** + * Contains settings that specify parameters affecting how the dashboard (dashboard item) is exported. + */ +interface ASPxClientDashboardExportOptions { + /** + * Gets or sets the standard paper size. + * Value: A string value returned by the DashboardExportPaperKind class that specifies the standard paper size. + */ + PaperKind: string; + /** + * Gets or sets the page orientation used to export a dashboard (dashboard item). + * Value: A string value returned by the DashboardExportPageLayout class that specifies the page orientation used to export a dashboard (dashboard item). + */ + PageLayout: string; + /** + * Gets or sets the mode for scaling when exporting a dashboard (dashboard item). + * Value: A string value returned by the DashboardExportScaleMode class that specifies the mode for scaling when exporting a dashboard (dashboard item). + */ + ScaleMode: string; + /** + * Gets or sets the scale factor (in fractions of 1) by which a dashboard (dashboard item) is scaled. + * Value: A Single value that specifies the scale factor by which a dashboard (dashboard item) is scaled. + */ + ScaleFactor: number; + /** + * Gets or sets the number of horizontal/vertical pages spanning the total width/height of a dashboard (dashboard item). + * Value: An integer value that specifies the number of horizontal/vertical pages spanning the total width/height of a dashboard (dashboard item). + */ + AutoFitPageCount: number; + /** + * Gets or sets the title of the exported document. + * Value: A string value that specifies the title of the exported document. + */ + Title: string; + /** + * Gets or sets whether a dashboard title (or dashboard item's caption) is included as the exported document title. + * Value: A boolean value that specifies whether a dashboard title (or dashboard item's caption) is included as the exported document title. + */ + ShowTitle: boolean; + /** + * Gets or sets the filter state's location on the exported document. + * Value: A string value returned by the DashboardExportFilterState class that specifies the filter state's location on the exported document. + */ + FilterState: string; + /** + * Provides access to options for exporting a dashboard or individual items in Image format. + * Value: An ImageFormatOptions object containing settings that specify parameters affecting how the dashboard or dashboard item is exported in Image format. + */ + ImageOptions: ImageFormatOptions; + /** + * Provides access to options for exporting individual dashboard items in Excel format. + * Value: An ExcelFormatOptions object containing settings that specify parameters affecting how the dashboard item is exported in Excel format. + */ + ExcelOptions: ExcelFormatOptions; + /** + * Provides access to options for exporting a Grid dashboard item. + * Value: A GridExportOptions object containing settings that specify parameters that affect how Grid dashboard items are exported. + */ + GridOptions: GridExportOptions; + /** + * Provides access to options for exporting a Pivot dashboard item. + * Value: A PivotExportOptions object containing settings that specify parameters that affect how Pivot dashboard items are exported. + */ + PivotOptions: PivotExportOptions; + /** + * Provides access to options for exporting a Pie dashboard item. + * Value: A PieExportOptions object containing settings that specify parameters that affect how Pie dashboard items are exported. + */ + PieOptions: PieExportOptions; + /** + * Provides access to options for exporting a Gauge dashboard item. + * Value: A GaugeExportOptions object containing settings that specify parameters that affect how Gauge dashboard items are exported. + */ + GaugeOptions: GaugeExportOptions; + /** + * Provides access to options for exporting a Card dashboard item. + * Value: A CardExportOptions object containing settings that specify parameters that affect how Card dashboard items are exported. + */ + CardOptions: CardExportOptions; + /** + * Provides access to options for exporting a Range Filter dashboard item. + * Value: A RangeFilterExportOptions object containing settings that specify parameters affecting how the Range Filter dashboard item is exported. + */ + RangeFilterOptions: RangeFilterExportOptions; + /** + * Provides access to options for exporting a Chart dashboard item. + * Value: A ChartExportOptions object containing settings that specify parameters that affect how Chart dashboard items are exported. + */ + ChartOptions: ChartExportOptions; + /** + * Provides access to options for exporting map dashboard items. + * Value: A MapExportOptions object containing settings that specify parameters that affect how map dashboard items are exported. + */ + MapOptions: MapExportOptions; +} +/** + * Contains options related to exporting a dashboard/dashboard item to the PDF format. + */ +interface DashboardPdfExportOptions { + /** + * Gets or sets the type of paper for the exported document. + * Value: A DashboardExportPaperKind value that specifies the type of paper for the exported document. + */ + PaperKind: string; + /** + * Gets or sets the page orientation used to export a dashboard/dashboard item. + * Value: A DashboardExportPageLayout value that specifies the page orientation used to export a dashboard/dashboard item. + */ + PageLayout: string; + /** + * Gets or sets the mode for scaling a dashboard/dashboard item in the exported document. + * Value: A DashboardExportScaleMode value that specifies the mode for scaling a dashboard/dashboard item in the exported document. + */ + ScaleMode: string; + /** + * Gets or sets the scale factor (in fractions of 1), by which a dashboard/dashboard item is scaled in the exported document. + * Value: A Single value that specifies the scale factor by which a dashboard/dashboard item is scaled in the exported document. + */ + ScaleFactor: number; + /** + * Gets or sets the number of horizontal/vertical pages spanning the total width/height of a dashboard/dashboard item. + * Value: An integer value that specifies the number of horizontal/vertical pages spanning the total width/height of a dashboard/dashboard item. + */ + AutoFitPageCount: number; + /** + * Gets or sets the title of the exported document. + * Value: A string value that specifies the title of the exported document. + */ + Title: string; + /** + * Gets or sets whether a dashboard title (or dashboard item's caption) is included as the exported document title. + * Value: A boolean value that specifies whether a dashboard title (or dashboard item's caption) is included as the exported document title. + */ + ShowTitle: boolean; + /** + * Gets or sets whether to add the state of master filter items to the exported document. + * Value: true, to add the state of master filter items to the exported document; otherwise, false. + */ + ExportFilters: boolean; + /** + * Gets or sets whether to add current parameter values to the exported document. + * Value: true, to add current parameter values to the exported document; otherwise, false. + */ + ExportParameters: boolean; + /** + * Gets or sets whether to add current values of a hidden parameter to the exported document. + * Value: true, to add current values of a hidden parameter to the exported document; otherwise, false. + */ + IncludeHiddenParameters: boolean; + /** + * Gets or sets a position of the dashboard state (such as master filter or current parameter values) in the exported document. + * Value: A DashboardStateExportPosition object that specifies the position of the dashboard state in the exported document. + */ + DashboardStatePosition: string; + /** + * Gets or sets whether cards within the Card dashboard item are arranged automatically on the exported page. + * Value: true, to arrange cards automatically on the exported page; otherwise, false. + */ + CardAutoArrangeContent: boolean; + /** + * Gets or sets whether the page orientation used to export the Chart dashboard item is selected automatically. + * Value: true, to automatically select the page orientation used to export the Chart dashboard item; otherwise, false. + */ + ChartAutomaticPageLayout: boolean; + /** + * Gets or sets the export size mode for the Chart dashboard item. + * Value: A ChartExportSizeMode value that specifies the export size mode for the Chart dashboard item. + */ + ChartSizeMode: string; + /** + * Gets or sets whether gauges within the Gauge dashboard item are arranged automatically on the exported page. + * Value: true, to arrange gauges automatically on the exported page; otherwise, false. + */ + GaugeAutoArrangeContent: boolean; + /** + * Gets or sets whether the size of the Grid dashboard item is changed according to the width of the exported page. + * Value: true, to change the size of the Grid dashboard item according to the width of the exported page; otherwise, false. + */ + GridFitToPageWidth: boolean; + /** + * Gets or sets whether to add column headers of the Grid dashboard item to every page. + * Value: true, to add column headers to every page; otherwise, false. + */ + GridPrintHeadersOnEveryPage: boolean; + /** + * Gets or sets whether the page orientation used to export the Map dashboard item is selected automatically. + * Value: true, to automatically select the page orientation used to export the Map dashboard item; otherwise, false. + */ + MapAutomaticPageLayout: boolean; + /** + * Gets or sets the export size mode for the Map dashboard item. + * Value: A MapExportSizeMode value that specifies the export size mode for the Map dashboard item. + */ + MapSizeMode: string; + /** + * Gets or sets whether pies within the Pie dashboard item are arranged automatically on the exported page. + * Value: true, to arrange pies automatically on the exported page; otherwise, false. + */ + PieAutoArrangeContent: boolean; + /** + * Gets or sets whether to add column headers of the Pivot dashboard item to every page. + * Value: true, to add column headers to every page; otherwise, false. + */ + PivotPrintHeadersOnEveryPage: boolean; + /** + * Gets or sets whether the page orientation used to export the Range Filter dashboard item is selected automatically. + * Value: true, to automatically select the page orientation used to export the Range Filter dashboard item; otherwise, false. + */ + RangeFilterAutomaticPageLayout: boolean; + /** + * Gets or sets the export size mode for the Range Filter dashboard item. + * Value: A RangeFilterExportSizeMode value that specifies the export size mode for the Range Filter dashboard item. + */ + RangeFilterSizeMode: string; + /** + * Gets or sets whether the page orientation used to export the Treemap dashboard item is selected automatically. + * Value: true, to automatically select the page orientation used to export the Treemap dashboard item; otherwise, false. + */ + TreemapAutomaticPageLayout: boolean; + /** + * Gets or sets the export size mode for the Treemap dashboard item. + * Value: A TreemapExportSizeMode value that specifies the export size mode for the Treemap dashboard item. + */ + TreemapSizeMode: string; +} +/** + * Contains options related to exporting a dashboard/dashboard item to an image. + */ +interface DashboardImageExportOptions { + /** + * Gets or sets a title of the exported document. + * Value: A string value that specifies the title of the exported document. + */ + Title: string; + /** + * Gets or sets whether a dashboard title (or dashboard item's caption) is included as the exported document title. + * Value: true, to include a dashboard title (or dashboard item's caption) as the exported document title; otherwise, false. + */ + ShowTitle: boolean; + /** + * Gets or sets whether to add the state of master filter items to the exported document. + * Value: true, to add the state of master filter items to the exported document; otherwise, false. + */ + ExportFilters: boolean; + /** + * Gets or sets whether to add current parameter values to the exported document. + * Value: true, to add current parameter values to the exported document; otherwise, false. + */ + ExportParameters: boolean; + /** + * Gets or sets whether to add current values of a hidden parameter to the exported document. + * Value: true, to add current values of a hidden parameter to the exported document; otherwise, false. + */ + IncludeHiddenParameters: boolean; + /** + * Gets or sets an image format in which the dashboard/dashboard item is exported. + * Value: A DashboardExportImageFormat value that specifies an image format in which the dashboard/dashboard item is exported. + */ + Format: string; + /** + * Gets or sets the resolution (in dpi) used to export a dashboard/dashboard item to an image. + * Value: An integer value that specifies the resolution (in dpi) used to export a dashboard/dashboard item to an image. + */ + Resolution: number; + /** + * Gets or sets the scale factor (in fractions of 1), by which a dashboard/dashboard item is scaled in the exported document. + * Value: A string value that specifies the scale factor by which a dashboard/dashboard item is scaled in the exported document. + */ + ScaleFactor: number; +} +/** + * Contains options related to exporting a dashboard/dashboard item to the Excel format. + */ +interface DashboardExcelExportOptions { + /** + * Gets or sets the Excel format in which the dashboard item is exported. + * Value: A DashboardExportExcelFormat value that specifies the Excel format in which the dashboard item is exported. + */ + Format: string; + /** + * Gets or sets a character used to separate values in a CSV document. + * Value: A string value that specifies the character used to separate values in a CSV document. + */ + CsvValueSeparator: string; + /** + * Gets or sets whether to add the state of master filter items to the exported document. + * Value: true, to add the state of master filter items to the exported document; otherwise, false. + */ + ExportFilters: boolean; + /** + * Gets or sets whether to add current parameter values to the exported document. + * Value: true, to add current parameter values to the exported document; otherwise, false. + */ + ExportParameters: boolean; + /** + * Gets or sets whether to add current values of a hidden parameter to the exported document. + * Value: true, to add current values of a hidden parameter to the exported document; otherwise, false. + */ + IncludeHiddenParameters: boolean; + /** + * Gets or sets the position of the dashboard state (such as master filter or current parameter values) in the exported document. + * Value: A DashboardStateExcelExportPosition object that specifies the position of the dashboard state in the exported document. + */ + DashboardStatePosition: string; +} +/** + * A client-side equivalent of the ASPxDashboard control. + */ +interface ASPxClientDashboard extends ASPxClientControl { + /** + * Fires when a round trip to the server has been initiated by a call to the client PerformDataCallback method. + */ + CustomDataCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs after the state of the dashboard displayed in the ASPxClientDashboard is changed. + */ + DashboardStateChanged: ASPxClientEvent>; + /** + * Occurs after a new dashboard is displayed in the ASPxClientDashboard. + */ + DashboardChanged: ASPxClientEvent>; /** * For internal use. */ - CustomizeMenuItems: ASPxClientEvent>; - BeforeRender: ASPxClientEvent>; + CustomizeMenuItems: ASPxClientEvent>; /** - * Switches the ASPxClientDashboardDesigner to the viewer mode. + * Occurs before any element in the Web Dashboard control has been rendered. + */ + BeforeRender: ASPxClientEvent>; + /** + * Occurs when an end-user clicks a dashboard item. + */ + ItemClick: ASPxClientEvent>; + /** + * Allows you to provide custom visual interactivity for data-bound dashboard items that support element selection and highlighting. + */ + ItemVisualInteractivity: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemWidgetCreated: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemWidgetUpdating: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemWidgetUpdated: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemBeforeWidgetDisposed: ASPxClientEvent>; + /** + * Occurs after the selection within the dashboard item is changed. + */ + ItemSelectionChanged: ASPxClientEvent>; + /** + * Allows you to color the required dashboard item elements using the specified colors. + */ + ItemElementCustomColor: ASPxClientEvent>; + /** + * Occurs when a master filter state is changed. + */ + ItemMasterFilterStateChanged: ASPxClientEvent>; + /** + * Occurs when a drill-down/drill-up is performed. + */ + ItemDrillDownStateChanged: ASPxClientEvent>; + /** + * Occurs after the available interactivity actions have changed for the specific dashboard item. + */ + ActionAvailabilityChanged: ASPxClientEvent>; + /** + * Occurs after parameter values provided using a Dynamic List are loaded. + */ + DynamicLookUpValuesLoaded: ASPxClientEvent>; + /** + * Occurs when a dashboard item update is initiated. + */ + ItemBeginUpdate: ASPxClientEvent>; + /** + * Occurs after the dashboard item update is performed. + */ + ItemEndUpdate: ASPxClientEvent>; + /** + * Occurs when a dashboard update is initiated. + */ + DashboardBeginUpdate: ASPxClientEvent>; + /** + * Occurs after the dashboard update is performed. + */ + DashboardEndUpdate: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback A ASPxClientDataCallback object that represents the JavaScript function which receives the callback data as a parameter. + */ + PerformDataCallback(parameter: string, onCallback: ASPxClientDataCallback): void; + /** + * Gets an inner part of the ASPxClientDashboard control. + */ + GetDashboardControl(): DashboardControl; + /** + * Switches the ASPxClientDashboard to the viewer mode. */ SwitchToViewer(): void; /** - * Switches the ASPxClientDashboardDesigner to the designer mode. + * Switches the ASPxClientDashboard to the designer mode. */ SwitchToDesigner(): void; /** - * Gets the current working mode of the Web Designer. + * Gets the current working mode of the Web Dashboard. */ GetWorkingMode(): string; /** - * Gets the identifier of the dashboard that is displayed in the ASPxClientDashboardDesigner. + * Gets the identifier of the dashboard that is displayed in the ASPxClientDashboard. */ GetDashboardId(): string; /** - * Gets the name of the dashboard that is displayed in the ASPxClientDashboardDesigner. + * Gets the name of the dashboard that is displayed in the ASPxClientDashboard. */ GetDashboardName(): string; /** - * Gets the state of the dashboard (for instance, the master filtering state) displayed in the ASPxClientDashboardDesigner. + * Gets the state of the dashboard displayed in the ASPxClientDashboard. */ GetDashboardState(): string; /** - * Loads a dashboard with the specified identifier. - * @param dashboardId A String value that specifies the dashboard identifier. + * Sets the state of the dashboard displayed in the ASPxClientDashboard. + * @param dashboardState A JSON object that specifies the dashboard state. + */ + SetDashboardState(dashboardState: Object): void; + /** + * Sets the state of the dashboard displayed in the ASPxClientDashboard. + * @param dashboardStateString A string value that specifies the state of the dashboard displayed in the ASPxClientDashboard. + */ + SetDashboardState(dashboardStateString: string): void; + /** + * Loads a dashboard with the specified identifier from the dashboard storage. + * @param dashboardId A string value that specifies the dashboard identifier. */ LoadDashboard(dashboardId: string): void; /** - * Saves a dashboard to the dashboard storage. + * Saves a current dashboard to the dashboard storage. */ SaveDashboard(): void; + /** + * Invokes the Dashboard Parameters dialog. + */ + ShowParametersDialog(): void; + /** + * Closes the Dashboard Parameters dialog. + */ + HideParametersDialog(): void; + /** + * Returns dashboard parameter settings and metadata. + */ + GetParameters(): ASPxClientDashboardParameters; + /** + * Invokes the dialog that allows end-users to export the entire dashboard to the specified format. + * @param format A string value that specifies the format. For instance, you can use 'PDF' or 'Image'. + */ + ShowExportDashboardDialog(format: string): void; + /** + * Invokes the dialog that allows end-users to export the dashboard item to the specified format. + * @param itemComponentName A string value that specifies the component name of the dashboard item to export. + * @param format A string value that specifies the format. For instance, you can use 'PDF, 'Image' or 'Excel'. Note that some items (i.e., ImageDashboardItem) do not support exporting to the 'Excel' format. + */ + ShowExportDashboardItemDialog(itemComponentName: string, format: string): void; + /** + * Hides the dialog that allows end-users to export the dashboard/dashboard item. + */ + HideExportDialog(): void; + /** + * Returns settings that specify parameters affecting how the dashboard is exported. + */ + GetExportOptions(): ASPxClientDashboardExportOptions; + /** + * Allows you to obtain options related to exporting a dashboard/dashboard item to the PDF format. + */ + GetPdfExportOptions(): DashboardPdfExportOptions; + /** + * Allows you to obtain options related to exporting a dashboard/dashboard item to an image. + */ + GetImageExportOptions(): DashboardImageExportOptions; + /** + * Allows you to obtain options related to exporting a dashboard/dashboard item to the Excel format. + */ + GetExcelExportOptions(): DashboardExcelExportOptions; + /** + * Specifies settings that specify parameters affecting how the dashboard is exported. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + */ + SetExportOptions(options: ASPxClientDashboardExportOptions): void; + /** + * Allows you to specify options related to exporting a dashboard/dashboard item to the PDF format. + * @param options A DashboardPdfExportOptions object containing options related to exporting a dashboard/dashboard item to the PDF format. + */ + SetPdfExportOptions(options: DashboardPdfExportOptions): void; + /** + * Allows you to specify options related to exporting a dashboard/dashboard item to an image. + * @param options A DashboardImageExportOptions object containing options related to exporting a dashboard/dashboard item to an image. + */ + SetImageExportOptions(options: DashboardImageExportOptions): void; + /** + * Allows you to specify options related to exporting a dashboard/dashboard item to the Excel format. + * @param options A DashboardExcelExportOptions object containing options related to exporting a dashboard item to the Excel format. + */ + SetExcelExportOptions(options: DashboardExcelExportOptions): void; + /** + * Exports a dashboard to a PDF file and writes it to the Response. + */ + ExportToPdf(): void; + /** + * Exports a dashboard to a PDF file with the specified export options and writes it to the Response. + * @param options A DashboardPdfExportOptions object containing PDF-specific export options. + */ + ExportToPdf(options: DashboardPdfExportOptions): void; + /** + * Exports a dashboard to a PDF file with the specified export options and writes it to the Response. + * @param options A DashboardPdfExportOptions object containing PDF-specific export options. + * @param fileName A string that specifies the name of the exported file. + */ + ExportToPdf(options: DashboardPdfExportOptions, fileName: string): void; + /** + * Exports a dashboard to a PDF file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + */ + ExportToPdf(options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard to a PDF file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + * @param fileName A string that specifies the name of the exported file. + */ + ExportToPdf(options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Exports a dashboard to an Image file and writes it to the Response. + */ + ExportToImage(): void; + /** + * Exports a dashboard to an Image file with the specified export options and writes it to the Response. + * @param options A DashboardImageExportOptions object containing image-specific export options. + */ + ExportToImage(options: DashboardImageExportOptions): void; + /** + * Exports a dashboard to an Image file with the specified export options and writes it to the Response. + * @param options A DashboardImageExportOptions object containing image-specific export options. + * @param fileName A string that specifies the name of the exported file. + */ + ExportToImage(options: DashboardImageExportOptions, fileName: string): void; + /** + * Exports a dashboard to an Image file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + */ + ExportToImage(options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard to an Image file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + * @param fileName A string that specifies the name of the exported file. + */ + ExportToImage(options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Exports dashboard data to the specified file in Excel format. + */ + ExportToExcel(): void; + /** + * Exports dashboard data to the specified file in Excel format. + * @param options A DashboardExcelExportOptions object containing Excel-specific options. + */ + ExportToExcel(options: DashboardExcelExportOptions): void; + /** + * Exports dashboard data to the specified file in Excel format. + * @param options A DashboardExcelExportOptions object containing Excel-specific options. + * @param fileName A string value that specifies the name of the exported file. + */ + ExportToExcel(options: DashboardExcelExportOptions, fileName: string): void; + /** + * Exports a dashboard item to a PDF file and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + */ + ExportDashboardItemToPdf(itemName: string): void; + /** + * Exports a dashboard item to a PDF file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options A DashboardPdfExportOptions object containing PDF-specific export options. + */ + ExportDashboardItemToPdf(itemName: string, options: DashboardPdfExportOptions): void; + /** + * Exports a dashboard item to a PDF file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options A DashboardPdfExportOptions object containing PDF-specific export options. + * @param fileName A string that specifies the name of the exported file. + */ + ExportDashboardItemToPdf(itemName: string, options: DashboardPdfExportOptions, fileName: string): void; + /** + * Exports a dashboard item to a PDF file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + */ + ExportDashboardItemToPdf(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to a PDF file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + * @param fileName A string that specifies the name of the exported file. + */ + ExportDashboardItemToPdf(itemName: string, options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Exports a dashboard item to an Image file and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + */ + ExportDashboardItemToImage(itemName: string): void; + /** + * Exports a dashboard item to an Image file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options A DashboardImageExportOptions object containing image-specific export options. + */ + ExportDashboardItemToImage(itemName: string, options: DashboardImageExportOptions): void; + /** + * Exports a dashboard item to an Image file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options A DashboardImageExportOptions object containing image-specific export options. + * @param fileName A string value that specifies the name of the exported file. + */ + ExportDashboardItemToImage(itemName: string, options: DashboardImageExportOptions, fileName: string): void; + /** + * Exports a dashboard item to an Image file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + */ + ExportDashboardItemToImage(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to an Image file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + * @param fileName A string value that specifies the name of the exported file. + */ + ExportDashboardItemToImage(itemName: string, options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Exports a dashboard item to an Excel file and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + */ + ExportDashboardItemToExcel(itemName: string): void; + /** + * Exports a dashboard item to an Excel file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options A DashboardExcelExportOptions object containing Excel export options. + */ + ExportDashboardItemToExcel(itemName: string, options: DashboardExcelExportOptions): void; + /** + * Exports a dashboard item to an Excel file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options A DashboardExcelExportOptions object containing Excel export options. + * @param fileName A string that specifies the name of the exported Excel file. + */ + ExportDashboardItemToExcel(itemName: string, options: DashboardExcelExportOptions, fileName: string): void; + /** + * Exports a dashboard item to an Excel file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + */ + ExportDashboardItemToExcel(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to an Excel file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + * @param fileName A string that specifies the name of the exported Excel file. + */ + ExportDashboardItemToExcel(itemName: string, options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Returns whether or not master filtering can be applied in the current state of the specified master filter item. + * @param itemName A string that specifies the component name of the master filter item. + */ + CanSetMasterFilter(itemName: string): boolean; + /** + * Returns whether or not the specified master filter can be cleared in the current state. + * @param itemName A string that specifies the component name of the master filter item. + */ + CanClearMasterFilter(itemName: string): boolean; + /** + * Returns whether or not drill down is possible in the current state of the specified dashboard item. + * @param itemName A string that specifies the component name of the dashboard item. + */ + CanPerformDrillDown(itemName: string): boolean; + /** + * Returns whether or not drill up is possible in the current state of the specified dashboard item. + * @param itemName A string that specifies the component name of the dashboard item. + */ + CanPerformDrillUp(itemName: string): boolean; + /** + * Selects required elements by their values in the specified master filter item. + * @param itemName A String that specifies the component name of the master filter item. + * @param values Values that will be used to select elements in the master filter item. + */ + SetMasterFilter(itemName: string, values: Object[][]): void; + /** + * Selects the required elements in the specified master filter item. + * @param itemName A String that species the component name of the master filter item. + * @param axisPointTuples An array of ASPxClientDashboardItemDataAxisPointTuple objects used to identify master filter elements. + */ + SetMasterFilter(itemName: string, axisPointTuples: ASPxClientDashboardItemDataAxisPointTuple[]): void; + /** + * Performs a drill-down into the required element by its value. + * @param itemName A String that species the component name of the dashboard item. + * @param value A value that will be used to perform a drill-down for the required element. + */ + PerformDrillDown(itemName: string, value: Object): void; + /** + * Performs a drill-down into the required element. + * @param itemName A String that specifies the component name of the dashboard item. + * @param axisPointTuple A ASPxClientDashboardItemDataAxisPointTuple object representing a set of axis points. + */ + PerformDrillDown(itemName: string, axisPointTuple: ASPxClientDashboardItemDataAxisPointTuple): void; + /** + * Clears the specified master filter item. + * @param itemName A string that specifies the component name of the master filter item. + */ + ClearMasterFilter(itemName: string): void; + /** + * Performs a drill-up for the specified dashboard item. + * @param itemName A String that specifies the component name of the dashboard item. + */ + PerformDrillUp(itemName: string): void; + /** + * Returns axis point tuples identifying elements that can be used to perform drill-down in the specified dashboard item. + * @param itemName A String that is the component name of the dashboard item. + */ + GetAvailableDrillDownValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Returns the axis point tuple identifying the current drill-down state. + * @param itemName A String that is the component name of the dashboard item. + */ + GetCurrentDrillDownValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple; + /** + * Returns axis point tuples identifying elements that can be selected in the current state of the master filter item. + * @param itemName A String that is the component name of the master filter item. + */ + GetAvailableFilterValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Returns axis point tuples identifying currently selected elements in the master filter item. + * @param itemName A String that is the component name of the master filter item. + */ + GetCurrentFilterValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Returns currently selected elements in the master filter item. + * @param itemName A String that specifies a component name of the master filter item. + */ + GetCurrentSelection(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Returns the client data for the specified dashboard item. + * @param itemName A string that specifies the component name of the dashboard item. + */ + GetItemData(itemName: string): ASPxClientDashboardItemData; + /** + * Refreshes an entire dashboard displayed in the Web Dashboard control. + */ + Refresh(): void; + /** + * Refreshes the specific item from the dashboard displayed in the Web Dashboard control. + * @param itemName A string value that specifies the component name of the dashboard item to be refreshed. + */ + Refresh(itemName: string): void; + /** + * Refreshes specific items from the dashboard displayed in the Web Dashboard control. + * @param itemName An array of string values that specify the component names of the dashboard items to be refreshed. + */ + Refresh(itemName: string[]): void; + /** + * Requests underlying data for the specified dashboard item. + * @param itemName A string that specifies the component name of the dashboard item. + * @param args A ASPxClientDashboardItemRequestUnderlyingDataParameters object containing parameters used to obtain the underlying data. + * @param onCompleted A ASPxClientDashboardItemRequestUnderlyingDataCompleted object that references a method executed after the request is completed. + */ + RequestUnderlyingData(itemName: string, args: ASPxClientDashboardItemRequestUnderlyingDataParameters, onCompleted: ASPxClientDashboardItemRequestUnderlyingDataCompleted): void; + /** + * Returns the currently selected range in the specified Range Filter dashboard item. + * @param itemName A String value that specifies the component name of the Range Filter dashboard item. + */ + GetCurrentRange(itemName: string): ASPxClientDashboardRangeFilterSelection; + /** + * Returns the visible range for the specified Range Filter dashboard item. + * @param itemName A String value that specifies the component name of the Range Filter dashboard item. + */ + GetEntireRange(itemName: string): ASPxClientDashboardRangeFilterSelection; + /** + * Selects the required range in the specified Range Filter dashboard item. + * @param itemName A String that specifies the component name of the Range Filter dashboard item. + * @param range A ASPxClientDashboardRangeFilterSelection object that specifies a range to be selected. + */ + SetRange(itemName: string, range: ASPxClientDashboardRangeFilterSelection): void; + /** + * Selects a predefined range in the Range Filter dashboard item. + * @param itemName A String value that specifies the component name of the Range Filter. + * @param dateTimePeriodName A String value that specifies the predefined range name. + */ + SetPredefinedRange(itemName: string, dateTimePeriodName: string): void; + /** + * Returns names of the predefined ranges available for the specified Range Filter. + * @param itemName A string value that specifies the component name of the Range Filter dashboard item. + */ + GetAvailablePredefinedRanges(itemName: string): string[]; + /** + * Returns the name of the currently selected predefined range. + * @param itemName A string value that specifies the component name of the Range Filter dashboard item. + */ + GetCurrentPredefinedRange(itemName: string): string; } /** * References a method that will handle the DashboardStateChanged event. @@ -678,7 +1663,7 @@ interface ASPxClientDashboardStateChangedEventHandler { interface ASPxClientDashboardStateChangedEventArgs extends ASPxClientEventArgs { /** * Gets the current state of the dashboard. - * Value: A String that is the current state of the dashboard. + * Value: A string value that is the current state of the dashboard. */ DashboardState: string; } @@ -699,19 +1684,19 @@ interface ASPxClientDashboardChangedEventHandler { interface ASPxClientDashboardChangedEventArgs extends ASPxClientEventArgs { /** * Gets the identifier of a newly opened dashboard. - * Value: A String values that is an identifier of newly opened dashboard. + * Value: A string value that is an identifier of newly opened dashboard. */ DashboardId: string; /** * Gets the name of a newly opened dashboard. - * Value: A String values that is the name of newly opened dashboard. + * Value: A string value that is the name of newly opened dashboard. */ DashboardName: string; } -interface ASPxClientDashboardDesignerCustomizeMenuItemsEventHandler { - (source: S, e: ASPxClientDashboardDesignerCustomizeMenuItemsEventArgs): void; +interface ASPxClientDashboardCustomizeMenuItemsEventHandler { + (source: S, e: ASPxClientDashboardCustomizeMenuItemsEventArgs): void; } -interface ASPxClientDashboardDesignerMenuItem { +interface ASPxClientDashboardMenuItem { id: string; title: string; template: string; @@ -721,13 +1706,214 @@ interface ASPxClientDashboardDesignerMenuItem { click: Function; hotKey: number; } -interface ASPxClientDashboardDesignerCustomizeMenuItemsEventArgs extends ASPxClientEventArgs { - Items: ASPxClientDashboardDesignerMenuItem[]; - FindById(itemId: string): ASPxClientDashboardDesignerMenuItem; +interface ASPxClientDashboardCustomizeMenuItemsEventArgs extends ASPxClientEventArgs { + Items: ASPxClientDashboardMenuItem[]; + FindById(itemId: string): ASPxClientDashboardMenuItem; } -interface ASPxClientDashboardDesignerBeforeRenderEventHandler { +/** + * References a method that will handle the BeforeRender event. + */ +interface ASPxClientDashboardBeforeRenderEventHandler { + /** + * References a method that will handle the BeforeRender event. + * @param source The event source. + * @param e An ASPxClientEventArgs object that contains event data. + */ (source: S, e: ASPxClientEventArgs): void; } +/** + * Serves as the base class for classes that provide data for client-side events related to dashboard items. + */ +interface ASPxClientDashboardItemEventArgs extends ASPxClientEventArgs { + /** + * Gets the component name of the dashboard item. + * Value: A string value that is the component name of the dashboard item. + */ + ItemName: string; + /** + * Returns whether or not the specified value is null. + * @param value The specified value. + */ + IsNullValue(value: Object): boolean; + /** + * Returns whether or not the specified value is 'others'. + * @param value The specified value. + */ + IsOthersValue(value: Object): boolean; +} +/** + * References a method that will handle the ItemMasterFilterStateChanged event. + */ +interface ASPxClientDashboardItemMasterFilterStateChangedEventHandler { + /** + * References a method that will handle the ItemMasterFilterStateChanged event. + * @param source The event source. + * @param e An ASPxClientDashboardItemMasterFilterStateChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemMasterFilterStateChangedEventArgs): void; +} +/** + * Provides data for the ItemMasterFilterStateChanged event. + */ +interface ASPxClientDashboardItemMasterFilterStateChangedEventArgs extends ASPxClientDashboardItemEventArgs { + /** + * Gets the currently selected values. + * Value: An array of objects that are the currently selected values. + */ + Values: Object[][]; +} +/** + * References a method that will handle the ItemDrillDownStateChanged event. + */ +interface ASPxClientDashboardItemDrillDownStateChangedEventHandler { + /** + * References a method that will handle the ItemDrillDownStateChanged event. + * @param source The event source. + * @param e An ASPxClientDashboardItemDrillDownStateChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemDrillDownStateChangedEventArgs): void; +} +/** + * Provides data for the ItemDrillDownStateChanged event. + */ +interface ASPxClientDashboardItemDrillDownStateChangedEventArgs extends ASPxClientDashboardItemEventArgs { + /** + * Gets the drill-down action performed in the dashboard item. + * Value: A string value that is the drill-down action performed in the dashboard item. + */ + Action: string; + /** + * Gets values from the current drill-down hierarchy. + * Value: An array of values from the current drill-down hierarchy. + */ + Values: Object[]; +} +/** + * References a method that will handle the ActionAvailabilityChanged event. + */ +interface ASPxClientActionAvailabilityChangedEventHandler { + /** + * References a method that will handle the ActionAvailabilityChanged event. + * @param source The event source. + * @param e A ASPxClientActionAvailabilityChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientActionAvailabilityChangedEventArgs): void; +} +/** + * Provides data for the ActionAvailabilityChanged event. + */ +interface ASPxClientActionAvailabilityChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the component name of the dashboard item. + * Value: A string value that is the component name of the dashboard item. + */ + ItemName: string; +} +/** + * References a method that will handle the DynamicLookUpValuesLoaded event. + */ +interface ASPxClientDynamicLookUpValuesLoadedEventHandler { + /** + * References a method that will handle the DynamicLookUpValuesLoaded event. + * @param source The event source. + * @param e A ASPxClientDynamicLookUpValuesLoadedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDynamicLookUpValuesLoadedEventArgs): void; +} +/** + * Provides data for the DynamicLookUpValuesLoaded event. + */ +interface ASPxClientDynamicLookUpValuesLoadedEventArgs extends ASPxClientEventArgs { + /** + * Gets the dashboard parameter name whose values have been loaded. + * Value: A string value that is the dashboard parameter name whose values have been loaded. + */ + ParameterName: string; +} +/** + * References a method that will handle the ItemBeginUpdate event. + */ +interface ASPxClientItemBeginUpdateEventHandler { + /** + * References a method that will handle the ItemBeginUpdate event. + * @param source The event source. + * @param e A ASPxClientItemBeginUpdateEventArgs object that contains event data. + */ + (source: S, e: ASPxClientItemBeginUpdateEventArgs): void; +} +/** + * Provides data for the ItemBeginUpdate event. + */ +interface ASPxClientItemBeginUpdateEventArgs extends ASPxClientEventArgs { + /** + * Gets the component name of the dashboard item. + * Value: A string value that is the component name of the dashboard item. + */ + ItemName: string; +} +/** + * References a method that will handle the ItemEndUpdate event. + */ +interface ASPxClientItemEndUpdateEventHandler { + /** + * References a method that will handle the ItemEndUpdate event. + * @param source The event source. + * @param e A ASPxClientItemEndUpdateEventArgs object that contains event data. + */ + (source: S, e: ASPxClientItemEndUpdateEventArgs): void; +} +/** + * Provides data for the ItemEndUpdate event. + */ +interface ASPxClientItemEndUpdateEventArgs extends ASPxClientEventArgs { + /** + * Gets the component name of the dashboard item. + * Value: A string value that is the component name of the dashboard item. + */ + ItemName: string; +} +/** + * References a method that will handle the DashboardBeginUpdate event. + */ +interface ASPxClientDashboardBeginUpdateEventHandler { + /** + * References a method that will handle the DashboardBeginUpdate event. + * @param source The event source. + * @param e A ASPxClientDashboardBeginUpdateEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardBeginUpdateEventArgs): void; +} +/** + * Provides data for the DashboardBeginUpdate event. + */ +interface ASPxClientDashboardBeginUpdateEventArgs extends ASPxClientEventArgs { + /** + * Gets the identifier of the dashboard for which the event was raised. + * Value: A string value that is the dashboard identifier. + */ + DashboardId: string; +} +/** + * References a method that will handle the DashboardEndUpdate event. + */ +interface ASPxClientDashboardEndUpdateEventHandler { + /** + * References a method that will handle the DashboardEndUpdate event. + * @param source The event source. + * @param e An ASPxClientDashboardEndUpdateEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardEndUpdateEventArgs): void; +} +/** + * Provides data for the DashboardEndUpdate event. + */ +interface ASPxClientDashboardEndUpdateEventArgs extends ASPxClientEventArgs { + /** + * Gets the identifier of the dashboard for which the event was raised. + * Value: A string value that is the dashboard identifier. + */ + DashboardId: string; +} /** * A client-side equivalent of the ASPxDashboardViewer control. */ @@ -773,7 +1959,7 @@ interface ASPxClientDashboardViewer extends ASPxClientControl { */ ItemClick: ASPxClientEvent>; /** - * Allows you to provide custom visual interactivity for data-bound dashboard items that support element selection and highlighting + * Allows you to provide custom visual interactivity for data-bound dashboard items that support element selection and highlighting. */ ItemVisualInteractivity: ASPxClientEvent>; /** @@ -834,15 +2020,25 @@ interface ASPxClientDashboardViewer extends ASPxClientControl { /** * Selects the required range in the specified Range Filter dashboard item. * @param itemName A String that specifies the component name of the Range Filter dashboard item. - * @param range A String value that specifies the component name of the Range Filter dashboard item. + * @param range A ASPxClientDashboardRangeFilterSelection object that specifies a range to be selected. */ SetRange(itemName: string, range: ASPxClientDashboardRangeFilterSelection): void; /** - * Selects the specified range in the specified Range Filter dashboard item. - * @param itemName A String that specifies the component name of the Range Filter dashboard item. - * @param dateTimePeriodName A String that specifies the name of the predefined range used to perform a selection. + * Selects a predefined range in the Range Filter dashboard item. + * @param itemName A String value that specifies the component name of the Range Filter. + * @param dateTimePeriodName A String value that specifies the predefined range name. */ - SetRange(itemName: string, dateTimePeriodName: string): void; + SetPredefinedRange(itemName: string, dateTimePeriodName: string): void; + /** + * Returns names of the predefined ranges available for the specified Range Filter. + * @param itemName A string value that specifies the component name of the Range Filter dashboard item. + */ + GetAvailablePredefinedRanges(itemName: string): string[]; + /** + * Returns the name of the currently selected predefined range. + * @param itemName A string value that specifies the component name of the Range Filter dashboard item. + */ + GetCurrentPredefinedRange(itemName: string): string; /** * Returns axis point tuples identifying elements that can be used to perform drill-down in the specified dashboard item. * @param itemName A String that is the component name of the dashboard item. @@ -870,7 +2066,7 @@ interface ASPxClientDashboardViewer extends ASPxClientControl { GetCurrentSelection(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; /** * Requests underlying data for the specified dashboard item. - * @param itemName A String that specifies the component name of the dashboard item. + * @param itemName A string that specifies the component name of the dashboard item. * @param args A ASPxClientDashboardItemRequestUnderlyingDataParameters object containing parameters used to obtain the underlying data. * @param onCompleted A ASPxClientDashboardItemRequestUnderlyingDataCompleted object that references a method executed after the request is completed. */ @@ -887,62 +2083,198 @@ interface ASPxClientDashboardViewer extends ASPxClientControl { * Returns settings that specify parameters affecting how the dashboard is exported. */ GetExportOptions(): ASPxClientDashboardExportOptions; + /** + * Allows you to obtain options related to exporting a dashboard/dashboard item to the PDF format. + */ + GetPdfExportOptions(): DashboardPdfExportOptions; + /** + * Allows you to obtain options related to exporting a dashboard/dashboard item to an image. + */ + GetImageExportOptions(): DashboardImageExportOptions; + /** + * Allows you to obtain options related to exporting a dashboard/dashboard item to the Excel format. + */ + GetExcelExportOptions(): DashboardExcelExportOptions; /** * Specifies settings that specify parameters affecting how the dashboard is exported. * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. */ SetExportOptions(options: ASPxClientDashboardExportOptions): void; + /** + * Allows you to specify options related to exporting a dashboard/dashboard item to the PDF format. + * @param options A DashboardPdfExportOptions object containing options related to exporting a dashboard/dashboard item to the PDF format. + */ + SetPdfExportOptions(options: DashboardPdfExportOptions): void; + /** + * Allows you to specify options related to exporting a dashboard/dashboard item to an image. + * @param options A DashboardImageExportOptions object containing options related to exporting a dashboard/dashboard item to an image. + */ + SetImageExportOptions(options: DashboardImageExportOptions): void; + /** + * Allows you to specify options related to exporting a dashboard/dashboard item to the Excel format. + * @param options A DashboardExcelExportOptions object containing options related to exporting a dashboard item to the Excel format. + */ + SetExcelExportOptions(options: DashboardExcelExportOptions): void; /** * Exports a dashboard to a PDF file and writes it to the Response. */ ExportToPdf(): void; + /** + * Exports a dashboard to a PDF file with the specified export options and writes it to the Response. + * @param options A DashboardPdfExportOptions object containing PDF-specific export options. + */ + ExportToPdf(options: DashboardPdfExportOptions): void; + /** + * Exports a dashboard to a PDF file with the specified export options and writes it to the Response. + * @param options A DashboardPdfExportOptions object containing PDF-specific export options. + * @param fileName A string that specifies the name of the exported file. + */ + ExportToPdf(options: DashboardPdfExportOptions, fileName: string): void; /** * Exports a dashboard to a PDF file with the specified export options and writes it to the Response. * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. */ ExportToPdf(options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard to a PDF file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + * @param fileName A string that specifies the name of the exported file. + */ + ExportToPdf(options: ASPxClientDashboardExportOptions, fileName: string): void; /** * Exports a dashboard to an Image file and writes it to the Response. */ ExportToImage(): void; + /** + * Exports a dashboard to an Image file with the specified export options and writes it to the Response. + * @param options A DashboardImageExportOptions object containing image-specific export options. + */ + ExportToImage(options: DashboardImageExportOptions): void; + /** + * Exports a dashboard to an Image file with the specified export options and writes it to the Response. + * @param options A DashboardImageExportOptions object containing image-specific export options. + * @param fileName A string that specifies the name of the exported file. + */ + ExportToImage(options: DashboardImageExportOptions, fileName: string): void; /** * Exports a dashboard to an Image file with the specified export options and writes it to the Response. * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. */ ExportToImage(options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard to an Image file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + * @param fileName A string that specifies the name of the exported file. + */ + ExportToImage(options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Exports dashboard data to the specified file in Excel format. + */ + ExportToExcel(): void; + /** + * Exports dashboard data to the specified file in Excel format. + * @param options A DashboardExcelExportOptions object containing Excel-specific options. + */ + ExportToExcel(options: DashboardImageExportOptions): void; + /** + * Exports dashboard data to the specified file in Excel format. + * @param options A DashboardExcelExportOptions object containing Excel-specific options. + * @param fileName A string value that specifies the name of the exported file. + */ + ExportToExcel(options: DashboardImageExportOptions, fileName: string): void; /** * Exports a dashboard item to a PDF file and writes it to the Response. * @param itemName A String that is the component name of the dashboard item to be exported. */ ExportDashboardItemToPdf(itemName: string): void; + /** + * Exports a dashboard item to a PDF file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options A DashboardPdfExportOptions object containing PDF-specific export options. + */ + ExportDashboardItemToPdf(itemName: string, options: DashboardPdfExportOptions): void; + /** + * Exports a dashboard item to a PDF file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options A DashboardPdfExportOptions object containing PDF-specific export options. + * @param fileName A string that specifies the name of the exported file. + */ + ExportDashboardItemToPdf(itemName: string, options: DashboardPdfExportOptions, fileName: string): void; /** * Exports a dashboard item to a PDF file with the specified export options and writes it to the Response. * @param itemName A String that is the component name of the dashboard item to be exported. * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. */ ExportDashboardItemToPdf(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to a PDF file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + * @param fileName A string that specifies the name of the exported file. + */ + ExportDashboardItemToPdf(itemName: string, options: ASPxClientDashboardExportOptions, fileName: string): void; /** * Exports a dashboard item to an Image file and writes it to the Response. * @param itemName A String that is the component name of the dashboard item to be exported. */ ExportDashboardItemToImage(itemName: string): void; + /** + * Exports a dashboard item to an Image file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options A DashboardImageExportOptions object containing image-specific export options. + */ + ExportDashboardItemToImage(itemName: string, options: DashboardImageExportOptions): void; + /** + * Exports a dashboard item to an Image file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options A DashboardImageExportOptions object containing image-specific export options. + * @param fileName A string value that specifies the name of the exported file. + */ + ExportDashboardItemToImage(itemName: string, options: DashboardImageExportOptions, fileName: string): void; /** * Exports a dashboard item to an Image file with the specified export options and writes it to the Response. * @param itemName A String that is the component name of the dashboard item to be exported. * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. */ ExportDashboardItemToImage(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to an Image file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + * @param fileName A string value that specifies the name of the exported file. + */ + ExportDashboardItemToImage(itemName: string, options: ASPxClientDashboardExportOptions, fileName: string): void; /** * Exports a dashboard item to an Excel file and writes it to the Response. * @param itemName A String that is the component name of the dashboard item to be exported. */ ExportDashboardItemToExcel(itemName: string): void; + /** + * Exports a dashboard item to an Excel file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options A DashboardExcelExportOptions object containing Excel export options. + */ + ExportDashboardItemToExcel(itemName: string, options: DashboardExcelExportOptions): void; + /** + * Exports a dashboard item to an Excel file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options A DashboardExcelExportOptions object containing Excel export options. + * @param fileName A string that specifies the name of the exported Excel file. + */ + ExportDashboardItemToExcel(itemName: string, options: DashboardExcelExportOptions, fileName: string): void; /** * Exports a dashboard item to an Excel file with the specified export options and writes it to the Response. * @param itemName A String that is the component name of the dashboard item to be exported. * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. */ ExportDashboardItemToExcel(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to an Excel file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options. + * @param fileName A string that specifies the name of the exported Excel file. + */ + ExportDashboardItemToExcel(itemName: string, options: ASPxClientDashboardExportOptions, fileName: string): void; /** * Returns the dashboard width. */ @@ -1023,326 +2355,10 @@ interface ASPxClientDashboardViewer extends ASPxClientControl { CanPerformDrillUp(itemName: string): boolean; /** * Returns the client data for the specified dashboard item. - * @param itemName A String that specifies the component name of the dashboard item. + * @param itemName A string that specifies the component name of the dashboard item. */ GetItemData(itemName: string): ASPxClientDashboardItemData; } -/** - * A range in the Range Filter dashboard item. - */ -interface ASPxClientDashboardRangeFilterSelection { - /** - * Gets or sets a maximum value in the range of the Range Filter dashboard item. - * Value: A maximum value in the range of the Range Filter dashboard item. - */ - Maximum: Object; - /** - * Gets or sets a minimum value in the range of the Range Filter dashboard item. - * Value: A minimum value in the range of the Range Filter dashboard item. - */ - Minimum: Object; -} -/** - * A collection of ASPxClientDashboardParameter objects. - */ -interface ASPxClientDashboardParameters { - /** - * Returns an array of dashboard parameters from the ASPxClientDashboardParameters collection. - */ - GetParameterList(): ASPxClientDashboardParameter[]; - /** - * Returns a dashboard parameter by its name. - * @param name A String object that specifies the parameter name. - */ - GetParameterByName(name: string): ASPxClientDashboardParameter; - /** - * Returns a dashboard parameter by its index in the ASPxClientDashboardParameters collection. - * @param index An integer value that specifies the parameter index. - */ - GetParameterByIndex(index: number): ASPxClientDashboardParameter; -} -/** - * A client-side dashboard parameter. - */ -interface ASPxClientDashboardParameter { - /** - * Gets the dashboard parameter name on the client side. - * Value: A String that is the dashboard parameter name on the client side. - */ - Name: string; - /** - * Gets the dashboard parameter value on the client side. - * Value: A String that specifies the dashboard parameter value on the client side. - */ - Value: Object; - /** - * Returns a parameter name. - */ - GetName(): string; - /** - * Returns a current parameter value. - */ - GetValue(): Object; - /** - * Specifies the current parameter value. - * @param value The current parameter value. - */ - SetValue(value: Object): void; - /** - * Returns a default parameter value. - */ - GetDefaultValue(): Object; - /** - * Returns the parameter's description displayed to an end-user. - */ - GetDescription(): string; - /** - * Returns a parameter type. - */ - GetType(): string; - /** - * Returns possible parameter values. - */ - GetValues(): ASPxClientDashboardParameterValue[]; -} -/** - * Provides access to the parameter value and display text. - */ -interface ASPxClientDashboardParameterValue { - /** - * Returns the parameter display text. - */ - GetDisplayText(): string; - /** - * Returns a parameter value. - */ - GetValue(): Object; -} -/** - * Contains settings that specify parameters affecting how the dashboard or dashboard item is exported in Image format. - */ -interface ImageFormatOptions { - /** - * Gets or sets an image format in which the dashboard (dashboard item) is exported. - * Value: A value returned by the DashboardExportImageFormat class that specifies an image format in which the dashboard (dashboard item) is exported. - */ - Format: string; - /** - * Gets or sets the resolution (in dpi) used to export a dashboard (dashboard item) in Image format. - * Value: An integer value that specifies the resolution (in dpi) used to export a dashboard (dashboard item) in Image format. - */ - Resolution: number; -} -/** - * Contains options which define how the dashboard item is exported to Excel format. - */ -interface ExcelFormatOptions { - /** - * Gets or sets the Excel format in which the dashboard item is exported. - * Value: A value returned by the DashboardExportExcelFormat class that specifies the Excel format in which the dashboard item is exported. - */ - Format: string; - /** - * Gets or sets a character used to separate values in a CSV document. - * Value: A String value that specifies the character used to separate values in a CSV document. - */ - CsvValueSeparator: string; -} -/** - * Contains settings that specify parameters affecting how the Grid dashboard item is exported. - */ -interface GridExportOptions { - /** - * Gets or sets whether the size of the Grid dashboard item is changed according to the width of the exported page. - * Value: true, to change the size of the Grid dashboard item according to the width of the exported page; otherwise, false. - */ - FitToPageWidth: boolean; - /** - * Gets or sets whether to print column headers of the Grid dashboard item on every page. - * Value: true, to print column headers on every page; otherwise, false. - */ - PrintHeadersOnEveryPage: boolean; -} -/** - * Contains settings that specify parameters affecting how the Pivot dashboard item is exported. - */ -interface PivotExportOptions { - /** - * Gets or sets whether to print the column headers of the pivot dashboard item on every page. - * Value: true, to print column headers on every page; otherwise, false. - */ - PrintHeadersOnEveryPage: boolean; -} -/** - * Contains settings that specify parameters affecting how the Pie dashboard item is exported. - */ -interface PieExportOptions { - /** - * Gets or sets whether dashboard item elements are arranged automatically on the exported page. - * Value: true, to arrange dashboard item elements automatically on the exported page; otherwise, false. - */ - AutoArrangeContent: boolean; -} -/** - * Contains settings that specify parameters affecting how the Gauge dashboard item is exported. - */ -interface GaugeExportOptions { - /** - * Gets or sets whether dashboard item elements are arranged automatically on the exported page. - * Value: true, to arrange dashboard item elements automatically on the exported page; otherwise, false. - */ - AutoArrangeContent: boolean; -} -/** - * Contains settings that specify parameters affecting how the Card dashboard item is exported. - */ -interface CardExportOptions { - /** - * Gets or sets whether dashboard item elements are arranged automatically on the exported page. - * Value: true, to arrange dashboard item elements automatically on the exported page; otherwise, false. - */ - AutoArrangeContent: boolean; -} -/** - * Contains settings that specify parameters affecting how the Range Filter dashboard item is exported. - */ -interface RangeFilterExportOptions { - /** - * Gets or sets whether the page orientation used to export a Range Filter dashboard item is selected automatically. - * Value: true, to automatically select the page orientation used to export a Range Filter dashboard item; otherwise, false. - */ - AutomaticPageLayout: boolean; - /** - * Gets or sets the export size mode for the Range Filter dashboard item. - * Value: A value returned by the RangeFilterExportSizeMode class that specifies the export size mode for the Range Filter dashboard item. - */ - SizeMode: string; -} -/** - * Contains settings that specify parameters affecting how Chart dashboard items are exported. - */ -interface ChartExportOptions { - /** - * Gets or sets whether the page orientation used to export a Chart dashboard item is selected automatically. - * Value: true, to automatically select the page orientation used to export a Chart dashboard item; otherwise, false. - */ - AutomaticPageLayout: boolean; - /** - * Gets or sets the export size mode for the Chart dashboard item. - * Value: A value returned by the ChartExportSizeMode class that specifies the export size mode for the Chart dashboard item. - */ - SizeMode: string; -} -/** - * Contains settings that specify parameters affecting how map dashboard items are exported. - */ -interface MapExportOptions { - /** - * Gets or sets whether the page orientation used to export a map dashboard item is selected automatically. - * Value: true, to automatically select the page orientation used to export a map dashboard item; otherwise, false. - */ - AutomaticPageLayout: boolean; - /** - * Gets or sets the export size mode for the map dashboard item. - * Value: A value returned by the MapExportSizeMode class that specifies specifies the export size mode for the map dashboard item. - */ - SizeMode: string; -} -/** - * Contains settings that specify parameters affecting how the dashboard (dashboard item) is exported. - */ -interface ASPxClientDashboardExportOptions { - /** - * Gets or sets the standard paper size. - * Value: A string value returned by the DashboardExportPaperKind class that specifies the standard paper size. - */ - PaperKind: string; - /** - * Gets or sets the page orientation used to export a dashboard (dashboard item). - * Value: A string value returned by the DashboardExportPageLayout class that specifies the page orientation used to export a dashboard (dashboard item). - */ - PageLayout: string; - /** - * Gets or sets the mode for scaling when exporting a dashboard (dashboard item). - * Value: A string value returned by the DashboardExportScaleMode class that specifies the mode for scaling when exporting a dashboard (dashboard item). - */ - ScaleMode: string; - /** - * Gets or sets the scale factor (in fractions of 1) by which a dashboard (dashboard item) is scaled. - * Value: A Single value that specifies the scale factor by which a dashboard (dashboard item) is scaled. - */ - ScaleFactor: number; - /** - * Gets or sets the number of horizontal/vertical pages spanning the total width/height of a dashboard (dashboard item). - * Value: An integer value that specifies the number of horizontal/vertical pages spanning the total width/height of a dashboard (dashboard item). - */ - AutoFitPageCount: number; - /** - * Gets or sets the title of the exported document. - * Value: A String value that specifies the title of the exported document. - */ - Title: string; - /** - * Gets or sets whether a dashboard title (or dashboard item's caption) is included as the exported document title. - * Value: A DefaultBoolean value that specifies whether a dashboard title (or dashboard item's caption) is included as the exported document title. - */ - ShowTitle: boolean; - /** - * Gets or sets the filter state's location on the exported document. - * Value: A string value returned by the DashboardExportFilterState class that specifies the filter state's location on the exported document. - */ - FilterState: string; - /** - * Provides access to options for exporting a dashboard or individual items in Image format. - * Value: An ImageFormatOptions object containing settings that specify parameters affecting how the dashboard or dashboard item is exported in Image format. - */ - ImageOptions: ImageFormatOptions; - /** - * Provides access to options for exporting individual dashboard items in Excel format. - * Value: An ExcelFormatOptions object containing settings that specify parameters affecting how the dashboard item is exported in Excel format. - */ - ExcelOptions: ExcelFormatOptions; - /** - * Provides access to options for exporting a Grid dashboard item. - * Value: A GridExportOptions object containing settings that specify parameters that affect how Grid dashboard items are exported. - */ - GridOptions: GridExportOptions; - /** - * Provides access to options for exporting a Pivot dashboard item. - * Value: A PivotExportOptions object containing settings that specify parameters that affect how Pivot dashboard items are exported. - */ - PivotOptions: PivotExportOptions; - /** - * Provides access to options for exporting a Pie dashboard item. - * Value: A PieExportOptions object containing settings that specify parameters that affect how Pie dashboard items are exported. - */ - PieOptions: PieExportOptions; - /** - * Provides access to options for exporting a Gauge dashboard item. - * Value: A GaugeExportOptions object containing settings that specify parameters that affect how Gauge dashboard items are exported. - */ - GaugeOptions: GaugeExportOptions; - /** - * Provides access to options for exporting a Card dashboard item. - * Value: A CardExportOptions object containing settings that specify parameters that affect how Card dashboard items are exported. - */ - CardOptions: CardExportOptions; - /** - * Provides access to options for exporting a Range Filter dashboard item. - * Value: A RangeFilterExportOptions object containing settings that specify parameters affecting how the Range Filter dashboard item is exported. - */ - RangeFilterOptions: RangeFilterExportOptions; - /** - * Provides access to options for exporting a Chart dashboard item. - * Value: A ChartExportOptions object containing settings that specify parameters that affect how Chart dashboard items are exported. - */ - ChartOptions: ChartExportOptions; - /** - * Provides access to options for exporting map dashboard items. - * Value: A MapExportOptions object containing settings that specify parameters that affect how map dashboard items are exported. - */ - MapOptions: MapExportOptions; -} /** * References a method that will handle the ActionAvailabilityChanged event. */ @@ -1409,7 +2425,7 @@ interface ASPxClientDashboardDataLoadingErrorEventArgs extends ASPxClientEventAr interface ASPxClientDashboardItemAction { /** * Gets the name of the dashboard item. - * Value: A String that specifies the name of the dashboard item. + * Value: A string that specifies the name of the dashboard item. */ ItemName: string; /** @@ -1441,7 +2457,7 @@ interface ASPxClientDashboardMasterFilterSetEventHandler { interface ASPxClientDashboardMasterFilterSetEventArgs extends ASPxClientEventArgs { /** * Gets the name of the dashboard item. - * Value: A String that specifies the name of the dashboard item. + * Value: A string value that specifies the component name of the dashboard item. */ ItemName: string; /** @@ -1477,7 +2493,7 @@ interface ASPxClientDashboardMasterFilterClearedEventHandler { interface ASPxClientDashboardMasterFilterClearedEventArgs extends ASPxClientEventArgs { /** * Gets the name of the dashboard item. - * Value: A String that is the name of the dashboard item. + * Value: A string value that is the component name of the dashboard item. */ ItemName: string; } @@ -1498,14 +2514,14 @@ interface ASPxClientDashboardDrillDownPerformedEventHandler { interface ASPxClientDashboardDrillDownPerformedEventArgs extends ASPxClientEventArgs { /** * Gets the name of the dashboard item. - * Value: A String that specifies the name of the dashboard item. + * Value: A string that specifies the name of the dashboard item. */ ItemName: string; /** - * Gets the bottommost value from the current drill-down hierarchy. - * Value: The bottommost value from the current drill-down hierarchy. + * Gets values from the current drill-down hierarchy. + * Value: An array of values from the current drill-down hierarchy. */ - Value: Object[]; + Values: Object[]; /** * Returns whether or not the specified value is NullValue. * @param value The specified value. @@ -1534,10 +2550,434 @@ interface ASPxClientDashboardDrillUpPerformedEventHandler { interface ASPxClientDashboardDrillUpPerformedEventArgs extends ASPxClientEventArgs { /** * Gets the name of the dashboard item. - * Value: A String that is the name of the dashboard item. + * Value: A string that is the name of the dashboard item. */ ItemName: string; } +/** + * When implemented, represents the Web Dashboard extension. + */ +interface IExtension { + /** + * A unique name of a Web Dashboard extension. + * Value: A string value that is a unique name of a Web Dashboard extension. + */ + name: string; + /** + * Contains code that will be invoked when you register the dashboard extension. + */ + start(): void; + /** + * Contains code that will be invoked when you unregister the dashboard extension. + */ + stop(): void; +} +/** + * An inner part of the ASPxClientDashboard control. + */ +interface DashboardControl { + /** + * Gets or sets knockout templates that you can used in the Web Dashboard. + * Value: A object that is a knockout template. + */ + customTemplates: KnockoutObservableArray; + /** + * Provide an access to the collection of registered dashboard extensions. + * Value: An array of IExtension objects that are dashboard extensions. + */ + extensions: IExtension[]; + /** + * Initializes a new dashboard with the specified name and JSON model. + * @param id A string value that is a unique name of the created dashboard. + * @param dashboardJson A dashboard model encoded in the specified JSON string. + */ + initializeDashboard(id: string, dashboardJson: string): void; + /** + * Initializes a new dashboard with the specified name, JSON model and initial state. + * @param id A string value that is a unique name of the created dashboard. + * @param dashboardJson A dashboard model encoded in the specified JSON string. + * @param initialState A JSON object that specifies the dashboard state. + */ + initializeDashboard(id: string, dashboardJson: string, initialState: Object): void; + /** + * Allows you to register a dashboard extension to add its functionality to the Web Dashboard. + * @param extension An IExtension object that is a dashboard extension. + */ + registerExtension(extension: IExtension): void; + /** + * Allows you to get access to the extension. + * @param extensionName A string value that is the dashboard extension name. + */ + findExtension(extensionName: string): IExtension; + /** + * Allows you to unregister a dashboard extension to disable its functionality in the Web Dashboard. + * @param extensionName A string value that is a dashboard extension name. + */ + unregisterExtension(extensionName: string): void; +} +interface DashboardParameterDialogExtension extends IExtension { +} +interface DashboardExportExtension extends IExtension { +} +interface DashboardClientApiExtension extends IExtension { +} +interface DashboardCurrencyEditorExtension extends IExtension { +} +interface DataSourceBrowserExtension extends IExtension { +} +interface DataSourceWizardExtension extends IExtension { +} +interface DashboadItemMenuExtension extends IExtension { +} +/** + * A Web Dashboard extension that allows you to keep track of all user actions, and cancel or repeat them. + */ +interface UndoRedoExtension extends IExtension { + /** + * Allows you to track whether the Web Dashboard has unsaved changes. + */ + isChanged(): boolean; +} +/** + * An extension that is the dashboard item's Binding menu allowing you to create and modify data binding. + */ +interface BindingPanelExtension extends IExtension { +} +/** + * A Web Dashboard extension that allows you to configure color schemes. + */ +interface DashboardColorSchemeEditorExtension extends IExtension { +} +/** + * An extension that is the dashboard item's Convert To menu allowing you to convert or duplicate the current item. + */ +interface ConversionPanelExtension extends IExtension { +} +/** + * A Web Dashboard extension that allows you to save the current dashboard. + */ +interface SaveDashboardExtension extends IExtension { + /** + * Allows you to save the current dashboard with a specified unique name and JSON model. + * @param dashboardId A string value that is a unique name of the created dashboard. + * @param dashboardJson A dashboard model encoded in the specified JSON string. + */ + performSaveDashboard(dashboardId: string, dashboardJson: string): void; + /** + * Allows you to invoke a custom function while you save a dashboard. + * @param action A custom function that is invoked when the dashboard is about to be saved. + */ + ensureDashboardSaved(action: Function): void; + /** + * Saves the opened dashboard. + */ + saveDashboard(): void; +} +/** + * A Web Dashboard extension that allows you to create a new dashboard. + */ +interface CreateDashboardExtension extends IExtension { + /** + * Creates a new dashboard with a specified name and JSON model. + * @param dashboardName A string value that is the name of the created dashboard. + * @param dashboardJson A dashboard model encoded in the specified JSON string. + */ + performCreateDashboard(dashboardName: string, dashboardJson: string): void; +} +/** + * A Web Dashboard extension that allows you to open the created dashboards. + */ +interface OpenDashboardExtension extends IExtension { + /** + * Loads a dashboard with the specified identifier from the dashboard storage. + * @param id A String value that specifies the unique dashboard name. + */ + loadDashboard(id: string): void; +} +/** + * An extension that is the dashboard item's Interactivity menu containing settings that affect on interaction between various dashboard items. + */ +interface InteractivityPanelExtension extends IExtension { +} +/** + * An extension that is the dashboard item's Options menu containing specific options and settings related to the current dashboard item. + */ +interface OptionsPanelExtension extends IExtension { +} +/** + * An extension that is the Web Dashboard title editor. + */ +interface DashboardTitleEditorExtension extends IExtension { +} +/** + * The Dashboard Panel extension that displays a list of available dashboards and lets you switch between the designer and viewer modes. + */ +interface DashboardPanelExtension extends IExtension { + /** + * Gets or sets the width of the Dashboard Panel extension. + * Value: An integer value that specifies the Dashboard Panel's width. + */ + panelWidth: number; + /** + * Allows you to control the Dashboard Panel's visibility. + * Value: true, to display the Dashboard Panel; otherwise, false. + */ + visible: KnockoutObservableBoolean; + /** + * Gets or sets whether you can switch into the designer mode. + * Value: true, to display the Edit in Designer button on the dashboard panel; otherwise, false. + */ + allowSwitchToDesigner: KnockoutObservableBoolean; +} +/** + * An extension that is a list of available data sources used to provide data to the Web Dashboard. + */ +interface AvailableDataSourcesExtension extends IExtension { +} +/** + * A dashboard menu item. + */ +interface DashboardMenuItem { + /** + * Gets or sets a unique id of a dashboard menu item. + * Value: A string value that is a menu item's unique name. + */ + id: string; + /** + * Gets or sets a dashboard menu item title. + * Value: A string value that is a dashboard menu item title. + */ + title: string; + /** + * Gets or sets a position of the dashboard menu item group within the dashboard menu. + * Value: A zero-based integer specifying the position of the current dashboard menu item. + */ + index: number; + /** + * Gets or sets a keyboard shortcut used to invoke the command. + * Value: An integer value that specifies a hotkey combination. + */ + hotKey: number; + /** + * Gets or sets a custom function that is invoked when a click occurs. + * Value: A custom function that is invoked when a click occurs. + */ + click: Function; + /** + * Gets or sets a knockout template for the extension. + * Value: A string value that is an id of the knockout template. + */ + template: string; + /** + * Gets or sets whether the dashboard menu item is selected. + * Value: true, if the dashboard menu item is selected; otherwise, false; + */ + selected: KnockoutObservableBoolean; + /** + * Gets or sets whether a dashboard menu item should be disabled. + * Value: true, if a dashboard menu item should be disabled; otherwise, false. + */ + disabled: KnockoutObservableBoolean; + /** + * Gets or sets whether a dashboard menu item has a separator. + * Value: true, if a dashboard menu item has a separator; otherwise, false. + */ + hasSeparator: boolean; + /** + * Gets or sets data that is used by a menu item. + * Value: An object that contains data used by a menu item. + */ + data: Object; +} +/** + * A toolbox item of the specified dashboard toolbox group. + */ +interface DashboardToolboxItem { + /** + * Gets or sets a dashboard item type. + * Value: A string value that is a dashboard item type. + */ + type: string; + /** + * Gets or sets an icon of the dashboard toolbox item. + * Value: A string value that is the icon id from the SVG definition. + */ + icon: string; + /** + * Gets or sets a unique name of the dashboard toolbox item. + * Value: A string value that is a toolbox item's unique name. + */ + name: string; + /** + * Gets or sets a dashboard toolbox item title. + * Value: A string value that is a dashboard toolbox item title. + */ + title: string; + /** + * Gets or sets whether a toolbox item should be disabled. + * Value: true, if a toolbox item should be disabled; otherwise, false. + */ + disabled: KnockoutObservableBoolean; + /** + * Gets or sets a custom function that is invoked when a click occurs. + * Value: A custom function that is invoked when a click occurs. + */ + click: Function; +} +/** + * A toolbar item of the specified dashboard toolbar group. + */ +interface DashboardToolbarItem { + /** + * Gets or sets an icon of the dashboard toolbar item. + * Value: A string value that is the icon id from the SVG definition. + */ + icon: string; + /** + * Gets or sets a unique name of the dashboard toolbar item. + * Value: A string value that is a unique toolbar item name. + */ + name: string; + /** + * Gets or sets a dashboard toolbar item title. + * Value: A string value that is a dashboard toolbar item title. + */ + title: string; + /** + * Gets or sets whether a toolbar item should be disabled. + * Value: true, if a toolbar item should be disabled; otherwise, false. + */ + disabled: KnockoutObservableBoolean; + /** + * Gets or sets a knockout extension template. + * Value: A string value that is an id of the knockout template. + */ + template: string; + /** + * Gets or sets a custom function that is invoked when a click occurs. + * Value: A custom function that is invoked when a click occurs. + */ + click: Function; +} +/** + * A toolbox group that contains dashboard toolbox items. + */ +interface DashboardToolboxGroup { + /** + * Gets or sets a unique name of the dashboard toolbox group. + * Value: A string value that is a unique toolbox group name. + */ + name: string; + /** + * Gets or sets a dashboard toolbox group title. + * Value: A string value that is a dashboard toolbox group title. + */ + title: string; + /** + * Gets or sets a position of the toolbox group within the Toolbox. + * Value: A zero-based integer specifying the position of the current toolbox group. + */ + index: number; + /** + * Provide an access to the collection of toolbox items obtained from the specified toolbox group. + * Value: A object that is an array of items obtained from the specified toolbox group. + */ + items: KnockoutObservableArray; +} +/** + * A toolbar group that contains dashboard toolbar items. + */ +interface DashboardToolbarGroup { + /** + * Gets or sets a unique name of the dashboard toolbar group. + * Value: A string value that is a unique toolbar group name. + */ + name: string; + /** + * Gets or sets a dashboard toolbar group title. + * Value: A string value that is a dashboard toolbar group title. + */ + title: string; + /** + * Gets or sets a position of the toolbar group within the Toolbox. + * Value: A zero-based integer specifying the position of the current toolbar group. + */ + index: number; + /** + * Provide an access to the collection of toolbox items obtained from the specified toolbar group. + * Value: A object that is an array of items obtained from the specified toolbar group. + */ + items: KnockoutObservableArray; +} +/** + * The Web Dashboard Toolbox extension that provides access to the dashboard menu and allows you to add dashboard items, as well as undo or repeat user actions. + */ +interface ToolboxExtension extends IExtension { + /** + * Gets or sets the visibility of the dashboard menu. + * Value: true, to display the dashboard menu; otherwise, false. + */ + menuVisible: KnockoutObservableBoolean; + /** + * Provide an access to the collection of menu items obtained from the dashboard menu. + * Value: A object that is a collection the dashboard menu items . + */ + menuItems: KnockoutObservableArray; + /** + * Provide an access to the collection of toolbox groups obtained from the Toolbox. + * Value: A object that is a collection the toolbox groups. + */ + toolboxGroups: KnockoutObservableArray; + /** + * Provide an access to the collection of toolbar groups obtained from the Toolbox. + * Value: A object that is a collection the toolbar groups. + */ + toolbarGroups: KnockoutObservableArray; + /** + * Allows you to add a specified menu item to the dashboard menu. + * @param menuItem A DashboardMenuItem object that is a dashboard menu item. + */ + addMenuItem(menuItem: DashboardMenuItem): void; + /** + * Removes the specified dashboard item from the dashboard menu. + * @param menuItemId A string value that is a unique dashboard item name. + */ + removeMenuItem(menuItemId: string): void; + /** + * Simulates a dashboard menu item selection. + * @param menuItem A DashboardMenuItem object that is a dashboard menu item. + */ + selectMenuItem(menuItem: DashboardMenuItem): void; + /** + * Allows you to add a specified toolbox item into a specified toolbox group. + * @param groupName A string value that is a toolbox group name. To get a toolbox group name, use the name property. + * @param toolboxItem A DashboardToolboxItem object that is a dashboard toolbox item. + */ + addToolboxItem(groupName: string, toolboxItem: DashboardToolboxItem): void; + /** + * Removes the specified toolbox item from the specified toolbox group. + * @param groupName A string value that is a unique toolbox group name. + * @param toolboxItemName A string value that is a unique toolbox item name. + */ + removeToolboxItem(groupName: string, toolboxItemName: string): void; + /** + * Allows you to add a specified toolbar item into a specified toolbar group. + * @param groupName A string value that is a toolbar group name. To get a toolbar group name, use the name property. + * @param toolbarItem A DashboardToolbarItem object that is a dashboard toolbar item. + */ + addToolbarItem(groupName: string, toolbarItem: DashboardToolbarItem): void; + /** + * Removes the specified toolbar item from the specified toolbar group. + * @param groupName A string value that is a unique toolbar group name. + * @param toolbarItemName A string value that is a unique toolbar item name. + */ + removeToolbarItem(groupName: string, toolbarItemName: string): void; +} +/** + * A Web Dashboard extension that allows you to create and edit dashboard parameters. + */ +interface DashboardParameterEditorExtension extends IExtension { +} /** * Serves as the base object for all the editors included in the client-side object model. */ @@ -2265,6 +3705,58 @@ interface ASPxClientComboBox extends ASPxClientDropDownEditBase { * @param callbackFunction An object that is the JavaScript function that receives the callback data as a parameter. The function is performed after the combo box content is loaded. */ EnsureDropDownLoaded(callbackFunction: Object): void; + /** + * Defines the HTML content for the specified combo box item. + * @param index An integer value specifying the zero-based index of the item. + * @param html A string value that is the HTML code defining the content of the combo box item. + */ + SetItemHtml(index: number, html: string): void; + /** + * Sets the tooltip text for the combo box editor's item specified by its index. + * @param index An integer value specifying the zero-based index of the item. + * @param tooltip A string value specifying the tooltip text. + */ + SetItemTooltip(index: number, tooltip: string): void; + /** + * Sets the CSS class for a combo box item specified by its index. + * @param index An integer value specifying the zero-based index of the item. + * @param className A string value specifying the CSS class name. + */ + AddItemCssClass(index: number, className: string): void; + /** + * Removes the CSS class from a combo box item specified by its index. + * @param index An integer value specifying the zero-based index of the item. + * @param className A string value specifying the CSS class name. + */ + RemoveItemCssClass(index: number, className: string): void; + /** + * Defines the HTML content for the specified combo box item's text cell. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param html A string value that is the HTML code defining the content of the combo box item. + */ + SetItemTextCellHtml(itemIndex: number, textCellIndex: number, html: string): void; + /** + * Sets the tooltip text for the text cell of the editor's item specified by its index. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param tooltip A string value specifying the tooltip text. + */ + SetItemTextCellTooltip(itemIndex: number, textCellIndex: number, tooltip: string): void; + /** + * Sets the CSS class for a combo box item's text cell specified by its index. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param className A string value specifying the CSS class name. + */ + AddItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + /** + * Removes the CSS class from a combo box item's text cell specified by its index. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param className A string value specifying the CSS class name. + */ + RemoveItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; } /** * Represents the client-side equivalent of the ASPxDateEdit control. @@ -2295,10 +3787,13 @@ interface ASPxClientDateEdit extends ASPxClientDropDownEditBase { */ GetTimeEdit(): ASPxClientTimeEdit; /** - * - * @param date + * Specifies the date for the editor. + * @param date A DateTime object that is the date. */ SetDate(date: Date): void; + /** + * Gets the date that is the editor's value. + */ GetDate(): Date; /** * Returns the number of days in a range selected within a date edit. @@ -2773,6 +4268,58 @@ interface ASPxClientListBox extends ASPxClientListEdit { * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. */ InsertItem(index: number, texts: string[]): void; + /** + * Defines the HTML content for the specified list box item. + * @param index An integer value specifying the zero-based index of the item. + * @param html A string value that is the HTML code defining the content of the list box item. + */ + SetItemHtml(index: number, html: string): void; + /** + * Sets the tooltip text for the list box editor's item specified by its index. + * @param index An integer value specifying the zero-based index of the item. + * @param tooltip A string value specifying the tooltip text. + */ + SetItemTooltip(index: number, tooltip: string): void; + /** + * Sets the CSS class for a list box item specified by its index. + * @param index An integer value specifying the zero-based index of the item. + * @param className A string value specifying the CSS class name. + */ + AddItemCssClass(index: number, className: string): void; + /** + * Removes the CSS class from a list box item specified by its index. + * @param index An integer value specifying the zero-based index of the item. + * @param className A string value specifying the CSS class name. + */ + RemoveItemCssClass(index: number, className: string): void; + /** + * Defines the HTML content for the specified list box item's text cell. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param html A string value that is the HTML code defining the content of the list box item. + */ + SetItemTextCellHtml(itemIndex: number, textCellIndex: number, html: string): void; + /** + * Sets the tooltip text for the text cell of the editor's item specified by its index. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param tooltip A string value specifying the tooltip text. + */ + SetItemTextCellTooltip(itemIndex: number, textCellIndex: number, tooltip: string): void; + /** + * Sets the CSS class for a list box item's text cell specified by its index. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param className A string value specifying the CSS class name. + */ + AddItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + /** + * Removes the CSS class from a list box item's text cell specified by its index. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param className A string value specifying the CSS class name. + */ + RemoveItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; } /** * Serves as the base type for the ASPxClientRadioButtonList objects. @@ -2997,10 +4544,13 @@ interface ASPxClientTimeEdit extends ASPxClientSpinEditBase { */ DateChanged: ASPxClientEvent>; /** - * - * @param date + * Specifies the date for the editor. + * @param date A DateTime object that is the date. */ SetDate(date: Date): void; + /** + * Gets the date that is the editor's value. + */ GetDate(): Date; } /** @@ -3407,16 +4957,82 @@ interface ASPxClientGaugeControl extends ASPxClientControl { */ PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } +/** + * Lists values that specify the position relative to the target column in which a moved column should be placed. + */ +interface ASPxClientGridColumnMovingTargetPosition { + /** + * A moved column should be placed to the right of the target column. + */ + Right: number; + /** + * A moved column should be placed to the left of the target column. + */ + Left: number; + /** + * A moved column should be placed at the top of the target column. + */ + Top: number; + /** + * A moved column should be placed at the bottom of the target column. + */ + Bottom: number; +} /** * Represents the client ASPxGridView. */ interface ASPxClientGridBase extends ASPxClientControl { + /** + * Fires after a toolbar item has been clicked. + */ + ToolbarItemClick: ASPxClientEvent>; + /** + * Returns a toolbar specified by its name. + * @param name A string value specifying the toolbar name. + */ + GetToolbarByName(name: string): ASPxClientMenu; + /** + * Returns a grid's toolbar specified by its index. + * @param index An integer value specifying the zero-based index of the toolbar object to retrieve. + */ + GetToolbar(index: number): ASPxClientMenu; } /** * Serves as a base object implementing the client column functionality. */ interface ASPxClientGridColumnBase { } +/** + * A method that will handle the ToolbarItemClick event. + */ +interface ASPxClientGridToolbarItemClickEventHandler { + /** + * A method that will handle the ToolbarItemClick event. + * @param source The event source. + * @param e An ASPxClientGridToolbarItemClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridToolbarItemClickEventArgs): void; +} +/** + * Provides data for the ToolbarItemClick event. + */ +interface ASPxClientGridToolbarItemClickEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the toolbar index. + * Value: An integer value that is the toolbar index. + */ + toolbarIndex: number; + /** + * Gets the clicked toolbar item. + * Value: A ASPxClientMenuItem object that is the toolbar item. + */ + item: ASPxClientMenuItem; + /** + * Specifies whether a postback or a callback is used to finally process the event on the server side. + * Value: true to perform the round trip to the server side via postback; false to perform the round trip to the server side via callback. + */ + usePostBack: boolean; +} /** * The client-side equivalent of the ASPxGridLookup control. */ @@ -3503,6 +5119,10 @@ interface ASPxClientCardView extends ASPxClientGridBase { * Occurs on the client side before a card is deleted in batch edit mode. */ BatchEditCardDeleting: ASPxClientEvent>; + /** + * Occurs on the client side when the focused cell is about to be changed. + */ + FocusedCellChanging: ASPxClientEvent>; /** * Fires on the client when a card is clicked. */ @@ -3531,6 +5151,21 @@ interface ASPxClientCardView extends ASPxClientGridBase { * Fires after the customization window has been closed. */ CustomizationWindowCloseUp: ASPxClientEvent>; + /** + * Returns the value of the specified edit cell. + * @param column An ASPxClientCardViewColumn object that represents the data column within the client grid. + */ + GetEditValue(column: ASPxClientCardViewColumn): string; + /** + * Returns the value of the specified edit cell. + * @param columnIndex An integer value that identifies the data column within the grid's column collection. + */ + GetEditValue(columnIndex: number): string; + /** + * Returns the value of the specified edit cell. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + GetEditValue(columnFieldNameOrId: string): string; /** * Moves focus to the specified edit cell within the edited card. * @param column An ASPxClientCardViewColumn object that represents the data column within the client grid. @@ -3911,6 +5546,12 @@ interface ASPxClientCardView extends ASPxClientGridBase { * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. */ PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing the specified argument to it. + * @param args A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** * Selects the specified page. * @param pageIndex An integer value that specifies the active page's index. @@ -4036,21 +5677,6 @@ interface ASPxClientCardView extends ASPxClientGridBase { * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). */ GetEditor(columnFieldNameOrId: string): ASPxClientEdit; - /** - * Returns the value of the specified edit cell. - * @param column An ASPxClientCardViewColumn object that represents the data column within the client grid. - */ - GetEditValue(column: ASPxClientCardViewColumn): string; - /** - * Returns the value of the specified edit cell. - * @param columnIndex An integer value that identifies the data column within the grid's column collection. - */ - GetEditValue(columnIndex: number): string; - /** - * Returns the value of the specified edit cell. - * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). - */ - GetEditValue(columnFieldNameOrId: string): string; } /** * Represents a client column. @@ -4435,6 +6061,27 @@ interface ASPxClientCardViewBatchEditCardDeletingEventArgs extends ASPxClientCan */ cardValues: Object; } +/** + * A method that will handle the FocusedCellChanging event. + */ +interface ASPxClientCardViewFocusedCellChangingEventHandler { + /** + * A method that will handle the FocusedCellChanging event. + * @param source The event source. + * @param e An ASPxClientCardViewFocusedCellChangingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewFocusedCellChangingEventArgs): void; +} +/** + * Provides data for the FocusedCellChanging event. + */ +interface ASPxClientCardViewFocusedCellChangingEventArgs extends ASPxClientCancelEventArgs { + /** + * Provides information of a card's cell currently being focused. + * Value: A ASPxClientCardViewCellInfo object that provides information about the card's cell. + */ + cellInfo: ASPxClientCardViewCellInfo; +} /** * Provides members related to Batch Edit Mode */ @@ -4503,6 +6150,12 @@ interface ASPxClientCardViewBatchEditApi { * @param initial true, to return the initial (server) value; false, to return a value currently contained on the client side (modified value). */ GetCellValue(visibleIndex: number, columnFieldNameOrId: string, initial?: boolean): Object; + /** + * Gets a container holding a data cell content. + * @param visibleIndex An integer value that is the visible index. + * @param columnFieldNameOrId A string value that is the column's Field Name or ID. + */ + GetCellTextContainer(visibleIndex: number, columnFieldNameOrId: string): Object; /** * Gets information about the cell currently being edited. */ @@ -4672,6 +6325,10 @@ interface ASPxClientGridView extends ASPxClientGridBase { * Occurs on the client side before a data row is deleted in batch edit mode. */ BatchEditRowDeleting: ASPxClientEvent>; + /** + * Occurs on the client side when the focused cell is about to be changed. + */ + FocusedCellChanging: ASPxClientEvent>; /** * Occurs when a callback for server-side processing is initiated. */ @@ -4688,6 +6345,55 @@ interface ASPxClientGridView extends ASPxClientGridBase { * Fires after the Customization Window has been closed. */ CustomizationWindowCloseUp: ASPxClientEvent>; + /** + * Selects or deselects the specified row displayed within the grid. + * @param key An object that uniquely identifies the row. + * @param selected true to select the specified row; false to deselect the row. + */ + SelectRowsByKey(key: Object, selected?: boolean): void; + /** + * Selects the specified rows displayed within the grid. + * @param keys An array of objects that uniquely identify the rows. + */ + SelectRowsByKey(keys: Object[]): void; + /** + * Selects a grid row by its key. + * @param key An object that uniquely identifies the row. + */ + SelectRowsByKey(key: Object): void; + /** + * Deselects the specified rows displayed within the grid. + * @param keys An array of objects that uniquely identify the rows. + */ + UnselectRowsByKey(keys: Object[]): void; + /** + * Deselects the specified row displayed within the grid. + * @param key An object that uniquely identifies the row. + */ + UnselectRowsByKey(key: Object): void; + /** + * Deselects all the selected rows within the grid. + */ + UnselectRows(): void; + /** + * Deselects the specified rows (if selected) within the grid. + * @param visibleIndices An array of zero-based indices that identify data rows within the grid. + */ + UnselectRows(visibleIndices: number[]): void; + /** + * Deselects the specified row (if selected) within the grid. + * @param visibleIndex A zero-based integer value that specifies the row's visible index. + */ + UnselectRows(visibleIndex: number): void; + /** + * Deselects all grid rows that match the filter criteria currently applied to the grid. + */ + UnselectFilteredRows(): void; + /** + * Selects the specified row displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the row's visible index. + */ + SelectRowOnPage(visibleIndex: number): void; /** * Selects or deselects the specified row displayed on the current page. * @param visibleIndex A zero-based integer value that specifies the row's visible index. @@ -4763,6 +6469,11 @@ interface ASPxClientGridView extends ASPxClientGridBase { * @param position An integer value specifying the horizontal scroll position. */ SetHorizontalScrollPosition(position: number): void; + /** + * Sets the scrollability of various types of grid rows when the grid displays fixed columns. + * @param scrollableRowSettings An object specifying which types of grid rows should or should not be scrollable. + */ + SetFixedColumnScrollableRows(scrollableRowSettings: Object): void; /** * Applies a filter specified in the filter row to the GridView. */ @@ -4827,6 +6538,12 @@ interface ASPxClientGridView extends ASPxClientGridBase { * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. */ PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing the specified argument to it. + * @param args A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** * Selects the specified page. * @param pageIndex An integer value that specifies the active page's index. @@ -5036,6 +6753,10 @@ interface ASPxClientGridView extends ASPxClientGridBase { * @param columnIndex A zero-based index that identifies the column in the column collection (the column's Index property value). */ SetFocusedCell(rowVisibleIndex: number, columnIndex: number): void; + /** + * Invokes the Customization Dialog and displays it over the grid. + */ + ShowCustomizationDialog(): void; /** * Sorts data by the specified data column's values. * @param column An ASPxClientGridViewColumn object that represents the data column. @@ -5219,6 +6940,38 @@ interface ASPxClientGridView extends ASPxClientGridBase { * @param moveFromGroup true to ungroup the grid's data by the column; otherwise, false. */ MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, moveBefore: boolean, moveToGroup: boolean, moveFromGroup: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the grid. + * @param targetPosition An ASPxClientGridColumnMovingTargetPosition enumeration value specifying the position relative to the target column in which to place the moved column. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number, targetPosition: ASPxClientGridColumnMovingTargetPosition): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param columnFieldNameOrId A String value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the grid. + * @param targetPosition An ASPxClientGridColumnMovingTargetPosition enumeration value specifying the position relative to the target column in which to place the moved column. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, targetPosition: ASPxClientGridColumnMovingTargetPosition): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups or ungroups the grid's data by this column. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param targetPosition An ASPxClientGridColumnMovingTargetPosition enumeration value specifying the position relative to the target column in which to place the moved column. + * @param moveToGroup true, to group the ASPxGridView's data by the column; otherwise, false. + * @param moveFromGroup true, to ungroup the grid's data by the column; otherwise, false. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number, targetPosition: ASPxClientGridColumnMovingTargetPosition, moveToGroup: boolean, moveFromGroup: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups or ungroups the grid's data by this column. + * @param columnFieldNameOrId A string value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param targetPosition An ASPxClientGridColumnMovingTargetPosition enumeration value specifying the position relative to the target column in which to place the moved column. + * @param moveToGroup true, to group the grid's data by the column; otherwise, false. + * @param moveFromGroup true, to ungroup the grid's data by the column; otherwise, false. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, targetPosition: ASPxClientGridColumnMovingTargetPosition, moveToGroup: boolean, moveFromGroup: boolean): void; /** * Groups data by the values of the specified column. * @param column An ASPxClientGridViewColumn object that represents the data column by whose values data is grouped. @@ -5288,6 +7041,21 @@ interface ASPxClientGridView extends ASPxClientGridBase { * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). */ UnGroup(columnFieldNameOrId: string): void; + /** + * Ungroups data by the values of a specified column. + * @param column A ASPxClientGridViewColumn object that is the grid column. + */ + Ungroup(column: ASPxClientGridViewColumn): void; + /** + * Ungroups data by the values of a specified column. + * @param columnIndex An integer value that is the column index. + */ + Ungroup(columnIndex: number): void; + /** + * Ungroups data by the values of a specified column. + * @param columnFieldNameOrId A string value that is the column's FieldName or ID. + */ + Ungroup(columnFieldNameOrId: string): void; /** * Expands all group rows. */ @@ -5415,55 +7183,6 @@ interface ASPxClientGridView extends ASPxClientGridBase { * @param selected true to select the specified rows; false to deselect the rows. */ SelectRowsByKey(keys: Object[], selected?: boolean): void; - /** - * Selects or deselects the specified row displayed within the grid. - * @param key An object that uniquely identifies the row. - * @param selected true to select the specified row; false to deselect the row. - */ - SelectRowsByKey(key: Object, selected?: boolean): void; - /** - * Selects the specified rows displayed within the grid. - * @param keys An array of objects that uniquely identify the rows. - */ - SelectRowsByKey(keys: Object[]): void; - /** - * Selects a grid row by its key. - * @param key An object that uniquely identifies the row. - */ - SelectRowsByKey(key: Object): void; - /** - * Deselects the specified rows displayed within the grid. - * @param keys An array of objects that uniquely identify the rows. - */ - UnselectRowsByKey(keys: Object[]): void; - /** - * Deselects the specified row displayed within the grid. - * @param key An object that uniquely identifies the row. - */ - UnselectRowsByKey(key: Object): void; - /** - * Deselects all the selected rows within the grid. - */ - UnselectRows(): void; - /** - * Deselects the specified rows (if selected) within the grid. - * @param visibleIndices An array of zero-based indices that identify data rows within the grid. - */ - UnselectRows(visibleIndices: number[]): void; - /** - * Deselects the specified row (if selected) within the grid. - * @param visibleIndex A zero-based integer value that specifies the row's visible index. - */ - UnselectRows(visibleIndex: number): void; - /** - * Deselects all grid rows that match the filter criteria currently applied to the grid. - */ - UnselectFilteredRows(): void; - /** - * Selects the specified row displayed on the current page. - * @param visibleIndex A zero-based integer value that specifies the row's visible index. - */ - SelectRowOnPage(visibleIndex: number): void; } /** * A client grid column. @@ -6013,6 +7732,27 @@ interface ASPxClientGridViewBatchEditRowDeletingEventArgs extends ASPxClientCanc */ rowValues: Object; } +/** + * A method that will handle the FocusedCellChanging event. + */ +interface ASPxClientGridViewFocusedCellChangingEventHandler { + /** + * A method that will handle the FocusedCellChanging event. + * @param source The event source. + * @param e An ASPxClientGridViewFocusedCellChangingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewFocusedCellChangingEventArgs): void; +} +/** + * Provides data for the FocusedCellChanging event. + */ +interface ASPxClientGridViewFocusedCellChangingEventArgs extends ASPxClientCancelEventArgs { + /** + * Provides information on a cell currently being focused. + * Value: A ASPxClientGridViewCellInfo object that is the cell information. + */ + cellInfo: ASPxClientGridViewCellInfo; +} /** * Contains information on a grid cell. */ @@ -6096,6 +7836,12 @@ interface ASPxClientGridViewBatchEditApi { * @param initial true, to return the initial (server) value; false, to return a value currently contained on the client side (modified value). */ GetCellValue(visibleIndex: number, columnFieldNameOrId: string, initial?: boolean): Object; + /** + * Gets a container holding a data cell content. + * @param visibleIndex An integer value that is the visible index. + * @param columnFieldNameOrId A string value that is the column's Field Name or ID. + */ + GetCellTextContainer(visibleIndex: number, columnFieldNameOrId: string): Object; /** * Gets information about the cell currently being edited. */ @@ -6190,6 +7936,10 @@ interface ASPxClientVerticalGrid extends ASPxClientGridBase { * Enables you to specify whether record data is valid and provide an error text. */ BatchEditRecordValidating: ASPxClientEvent>; + /** + * Occurs on the client side when the focused cell is about to be changed. + */ + FocusedCellChanging: ASPxClientEvent>; /** * Enables you to prevent rows from being sorted. */ @@ -6477,6 +8227,12 @@ interface ASPxClientVerticalGrid extends ASPxClientGridBase { * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. */ PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing the specified argument to it. + * @param args A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** * Selects the specified page. * @param pageIndex An integer value that specifies the active page's index. @@ -7050,6 +8806,27 @@ interface ASPxClientVerticalGridBatchEditRecordDeletingEventArgs extends ASPxCli */ recordValues: Object; } +/** + * A method that will handle the FocusedCellChanging event. + */ +interface ASPxClientVerticalGridFocusedCellChangingEventHandler { + /** + * A method that will handle the FocusedCellChanging event. + * @param source The event source. + * @param e An ASPxClientVerticalGridFocusedCellChangingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridFocusedCellChangingEventArgs): void; +} +/** + * Provides data for the FocusedCellChanging event. + */ +interface ASPxClientVerticalGridFocusedCellChangingEventArgs extends ASPxClientCancelEventArgs { + /** + * Provides information on a cell currently being focused. + * Value: A ASPxClientVerticalGridCellInfo object that is the cell information. + */ + cellInfo: ASPxClientVerticalGridCellInfo; +} /** * Contains information on a cell that is being edited. */ @@ -7133,6 +8910,12 @@ interface ASPxClientVerticalGridBatchEditApi { * @param initial true, to return the initial (server) value; false, to return a value currently contained on the client side (modified value). */ GetCellValue(visibleIndex: number, rowFieldNameOrId: string, initial?: boolean): Object; + /** + * Gets a container holding the data cell content. + * @param visibleIndex An integer value that is the visible index. + * @param columnFieldNameOrId A string value that is the column's Field Name or ID. + */ + GetCellTextContainer(visibleIndex: number, columnFieldNameOrId: string): Object; /** * Gets information about the cell currently being edited. */ @@ -7228,6 +9011,21 @@ interface ASPxClientHtmlEditorCommandStyleSettings { * Value: A string that specifies an element's left margin in any correct format. */ marginLeft: string; + /** + * Gets or sets a media element's background color. + * Value: A string that specifies a background color in any correct format. + */ + backgroundColor: string; + /** + * Gets or sets the element's text alignment. + * Value: A string value that specifies the element's text alignment in any correct format. + */ + textAlign: string; + /** + * Gets or sets the element's vertical alignment. + * Value: A string value that specifies the element's vertical alignment in any correct format. + */ + verticalAlign: string; } /** * The base class for parameters used in the ASPxHtmlEditor's client-side commands. @@ -7298,6 +9096,11 @@ interface ASPxClientHtmlEditorInsertLinkCommandArguments extends ASPxClientHtmlE * Value: A string value defining the title of the target link. */ title: string; + /** + * Contains the style settings defining the appearance of the target link element. + * Value: An object that contains the style settings defining the appearance of the target link element. + */ + styleSettings: ASPxClientHtmlEditorCommandStyleSettings; } /** * The base class for parameters related to inserting or changing media elements in the ASPxHtmlEditor. @@ -7443,6 +9246,101 @@ interface ASPxClientHtmlEditorInsertYouTubeVideoCommandArguments extends ASPxCli */ interface ASPxClientHtmlEditorChangeYouTubeVideoCommandArguments extends ASPxClientHtmlEditorInsertYouTubeVideoCommandArguments { } +/** + * Contains settings related to the TABLEPROPERTIES_DIALOG_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorTablePropertiesCommandArguments extends ASPxClientHtmlEditorCommandArguments { + /** + * Contains the style settings defining the appearance of the target table element. + * Value: An object that contains the style settings defining the appearance of the target table element. + */ + styleSettings: ASPxClientHtmlEditorCommandStyleSettings; + /** + * Determines the position of the target table element. + * Value: A string value indicating the position of the target table element. + */ + align: string; + /** + * Gets or sets a table cell padding. + * Value: An integer value that is the cell padding. + */ + cellPadding: number; + /** + * Gets or sets the table cell spacing. + * Value: An integer value that is the table cell spacing. + */ + cellSpacing: number; + /** + * Gets or sets a value that is the table caption. + * Value: A string value that is the caption. + */ + caption: string; + /** + * Gets or sets a value indicating whether the first row/column serves as the table's header. + * Value: A string value that specifies whether the first row/column serves as the table's header. + */ + headers: string; + /** + * Gets or sets the table's summary. + * Value: A string value that is the table's summary. + */ + summary: string; +} +/** + * Contains settings related to the INSERTTABLE_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorInsertTableCommandArguments extends ASPxClientHtmlEditorTablePropertiesCommandArguments { + /** + * Gets or sets the count of columns in the table. + * Value: An integer value that is the count of columns. + */ + columns: number; + /** + * Gets or sets the count of rows in the table. + * Value: An integer value that is the count of rows. + */ + rows: number; + /** + * Gets or sets a value indicating whether all table columns should have equal width. + * Value: true, to create equal widths for all columns; otherwise, false. + */ + isEqualColumnWidth: boolean; +} +/** + * Contains settings related to the TABLECELLPROPERTIES_DIALOG_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorTableCellPropertiesCommandArguments extends ASPxClientHtmlEditorCommandArguments { + /** + * Contains the style settings defining the appearance of the target cell element. + * Value: An object that contains the style settings defining the appearance of the target cell element. + */ + styleSettings: ASPxClientHtmlEditorCommandStyleSettings; + /** + * Gets or sets a value that indicates whether the cell settings should be applied to all cells in the table. + * Value: true, if the cell settings should be applied to all cells in the table; otherwise, false. + */ + applyForAll: boolean; +} +/** + * Contains settings related to the TABLEROWPROPERTIES_DIALOG_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorTableRowPropertiesCommandArguments extends ASPxClientHtmlEditorCommandArguments { + /** + * Contains the style settings specifying the appearance of the specified table row. + * Value: An object that contains the style settings specifying the appearance of the specified table row. + */ + styleSettings: ASPxClientHtmlEditorCommandStyleSettings; +} +/** + * Contains settings related to the TABLECOLUMNPROPERTIES_DIALOG_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorTableColumnPropertiesCommandArguments extends ASPxClientHtmlEditorCommandArguments { + /** + * Contains the style settings defining the appearance of the target column element. + * Value: An object that contains the style settings defining the appearance of the target column element. + */ + styleSettings: ASPxClientHtmlEditorCommandStyleSettings; +} /** * A method that will handle the DialogInitialized client event. */ @@ -7463,6 +9361,68 @@ interface ASPxClientHtmlEditorDialogInitializedEventArgs extends ASPxClientEvent * Value: A string value that is the name of the initialized dialog. */ dialogName: string; + /** + * Gets a dialog object related to the event. + * Value: A ASPxClientHtmlEditorDialogBase object that is the dialog. + */ + dialog: ASPxClientHtmlEditorDialogBase; +} +/** + * Provides data for the event that fires when the HTML Editor dialogs are closed or are going to be closed. + */ +interface ASPxClientHtmlEditorDialogCloseEventArgs extends ASPxClientEventArgs { + /** + * Gets the dialog name related to the event. + * Value: A string value that is the dialog name. + */ + dialogName: string; + /** + * Gets the dialog object related to the event. + * Value: An ASPxClientHtmlEditorDialogBase object that is the dialog. + */ + dialog: ASPxClientHtmlEditorDialogBase; + /** + * Gets a string that contains specific information (if any) passed from the client side for server-side processing. + * Value: A string value representing specific information passed from the client to the server side. + */ + parameter: Object; +} +/** + * A method that will handle the DialogClosing event. + */ +interface ASPxClientHtmlEditorDialogClosingEventHandler { + /** + * A method that will handle the DialogClosing event. + * @param source The event source. + * @param e An ASPxClientHtmlEditorDialogClosingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorDialogClosingEventArgs): void; +} +/** + * Provides data for the DialogClosing event. + */ +interface ASPxClientHtmlEditorDialogClosingEventArgs extends ASPxClientHtmlEditorDialogCloseEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true, if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the DialogClosed event. + */ +interface ASPxClientHtmlEditorDialogClosedEventHandler { + /** + * A method that will handle the DialogClosed event. + * @param source The event source. + * @param e An ASPxClientHtmlEditorDialogClosedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorDialogClosedEventArgs): void; +} +/** + * Provides data for the DialogClosed event. + */ +interface ASPxClientHtmlEditorDialogClosedEventArgs extends ASPxClientHtmlEditorDialogCloseEventArgs { } /** * A method that will handle the CommandExecuting event. @@ -7696,6 +9656,14 @@ interface ASPxClientHtmlEditor extends ASPxClientControl { * Occurs on the client side after a dialog has been initialized. */ DialogInitialized: ASPxClientEvent>; + /** + * Fires on the client side before a dialog is going to be closed. + */ + DialogClosing: ASPxClientEvent>; + /** + * Occurs on the client side after a dialog is closed. + */ + DialogClosed: ASPxClientEvent>; /** * Occurs before a default or custom command has been executed and allows you to cancel the action. */ @@ -7780,6 +9748,10 @@ interface ASPxClientHtmlEditor extends ASPxClientControl { * Returns the document object generated by an iframe element within a design view area. */ GetDesignViewDocument(): Object; + /** + * Provides access to the client ASPxPopupControl object that is a Html Editor's dialog. + */ + GetDialogPopupControl(): ASPxClientPopupControl; /** * Returns the document object generated by an iframe element within a preview area. */ @@ -7910,6 +9882,513 @@ interface ASPxClientHtmlEditor extends ASPxClientControl { */ PerformDataCallback(parameter: string, onCallback: ASPxClientDataCallback): void; } +/** + * Provides client functionality for dialogs within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorDialogBase { + /** + * Provides access to the client ASPxFormLayout object that arranges all editors in the Html Editor's dialogs. + */ + GetFormLayout(): ASPxClientFormLayout; + /** + * Provides access to the client object of the "OK" button in the Html Editor's dialogs. + */ + GetOkButton(): ASPxClientButton; + /** + * Provides access to the client object of the "Cancel" button in the Html Editor's dialogs. + */ + GetCancelButton(): ASPxClientButton; +} +/** + * Provides client functionality for Html Editor's dialogs operated with the elements. + */ +interface ASPxClientHtmlEditorEditElementDialog extends ASPxClientHtmlEditorDialogBase { + /** + * Provides access to the client object of the "Border style" combo box in the Html Editor's dialogs (Style Settings). + */ + GetBorderStyleComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the "Border width" spin editor in the Html Editor's dialogs (Style Settings). + */ + GetBorderWidthSpinEdit(): ASPxClientSpinEdit; + /** + * Provides access to the client object of the "Border color" color editor in the Html Editor's dialogs (Style Settings). + */ + GetBorderColorColorEdit(): ASPxClientColorEdit; + /** + * Provides access to the client object of the "Top margin" text box in the Html Editor's dialogs (Style Settings). + */ + GetTopMarginTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Bottom margin" text box in the Html Editor's dialogs (Style Settings). + */ + GetBottomMarginTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Left margin" text box in the Html Editor's dialogs (Style Settings). + */ + GetLeftMarginTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Right margin" text box in the Html Editor's dialogs (Style Settings). + */ + GetRightMarginTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "CSS class" combo box in the Html Editor's dialogs (Style Settings). + */ + GetCssClassNameComboBox(): ASPxClientComboBox; +} +/** + * Provides client functionality for the Change Element Properties dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorChangeElementPropertiesDialog extends ASPxClientHtmlEditorEditElementDialog { + /** + * Provides access to the client object of the "ID" text box in the Html Editor's "Change Element Properties" dialog. + */ + GetIdTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Title" text box in the Html Editor's "Change Element Properties" dialog. + */ + GetTitleTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Direction" combo box in the Html Editor's "Change Element Properties" dialog. + */ + GetDirectionComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the "Value" text box in the Html Editor's "Change Element Properties" dialog. + */ + GetValueTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Tab index" text box in the Html Editor's "Change Element Properties" dialog. + */ + GetTabIndexTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Disabled" check box in the Html Editor's "Change Element Properties" dialog. + */ + GetDisabledCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Input type" combo box in the Html Editor's "Change Element Properties" dialog. + */ + GetInputTypeComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the "For" text box in the Html Editor's "Change Element Properties" dialog. + */ + GetForTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Name" text box in the Html Editor's "Change Element Properties" dialog. + */ + GetNameTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Method" text box in the Html Editor's "Change Element Properties" dialog. + */ + GetMethodTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Action" text box in the Html Editor's "Change Element Properties" dialog. + */ + GetActionTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Checked" check box in the Html Editor's "Change Element Properties" dialog. + */ + GetCheckedCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Max length" text box in the Html Editor's "Change Element Properties" dialog. + */ + GetMaxLengthTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Size" text box in the Html Editor's "Change Element Properties" dialog. + */ + GetSizeTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Readonly" check box in the Html Editor's "Change Element Properties" dialog. + */ + GetReadonlyCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Src" text box in the Html Editor's "Change Element Properties" dialog. + */ + GetSrcTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Accept" text box in the Html Editor's "Change Element Properties" dialog. + */ + GetAcceptTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Alt" text box in the Html Editor's "Change Element Properties" dialog. + */ + GetAltTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Start" spin editor in the Html Editor's "Change Element Properties" dialog. + */ + GetStartSpinEdit(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Width" spin editor in the Html Editor's "Change Element Properties" dialog. + */ + GetWidthValueSpinEdit(): ASPxClientSpinEdit; + /** + * Provides access to the client ASPxComboBox object that allows you to specify the element width measurement unit in the Html Editor's "Change Element Properties" dialog. + */ + GetWidthValueTypeComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the "Height" spin editor in the Html Editor's "Change Element Properties" dialog. + */ + GetHeightValueSpinEdit(): ASPxClientSpinEdit; + /** + * Provides access to the client ASPxComboBox object that allows to specify the element height measurement unit in the Html Editor's "Change Element Properties" dialog. + */ + GetHeightValueTypeComboBox(): ASPxClientComboBox; +} +/** + * Provides client functionality for the Link dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorLinkDialog extends ASPxClientHtmlEditorDialogBase { + /** + * Provides access to the client object of the "E-mail to" text box in the Html Editor's Link dialog. + */ + GetEmailTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Text" text box in the Html Editor's Link dialog. + */ + GetTextTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "ToolTip" text box in the Html Editor's Link dialog. + */ + GetTooltipTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Subject" text box in the Html Editor's Link dialog. + */ + GetSubjectTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "URL" text box in the Html Editor's Link dialog. + */ + GetUrlTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the file manager used in the Link dialog's "Select Document" popup window. + */ + GetFileManager(): ASPxClientFileManager; + /** + * Provides access to the client object of the "Cancel" button in the Link dialog's "Select Document" popup window. + */ + GetSelectDocumentPopupCancelButton(): ASPxClientButton; + /** + * Provides access to the client object of the "Select" button in the Link dialog's "Select Document" popup window. + */ + GetSelectDocumentPopupSelectButton(): ASPxClientButton; + /** + * Provides access to the client popup control object that is the "Select Document" popup window in the Html Editor's Link dialog. + */ + GetSelectDocumentPopupControl(): ASPxClientPopupControl; + /** + * Provides access to the client object of the "Open in new window" check box in the Html Editor's Link dialog. + */ + GetOpenInNewWindowCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client radio button list object used to specify the link type in the Html Editor's Link dialog. + */ + GetLinkTypeRadioButtonList(): ASPxClientRadioButtonList; +} +/** + * Provides client functionality for the Placeholder dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorPlaceholderDialog extends ASPxClientHtmlEditorDialogBase { + /** + * Provides access to the ASPxListBox client object that lists placeholder names in the Html Editor's Placeholder dialog. + */ + GetPlaceholderNameListBox(): ASPxClientListBox; +} +/** + * Provides client functionality for the Paste From Word dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorPasteFromWordDialog extends ASPxClientHtmlEditorDialogBase { + /** + * Provides access to the client object of the "Remove font family" check box in the Html Editor's Flash dialog. + */ + GetRemoveFontFamilyCheckBox(): ASPxClientCheckBox; +} +/** + * Provides client functionality for the media dialogs within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorMediaDialogBase extends ASPxClientHtmlEditorEditElementDialog { + /** + * Provides access to the client object of the media file selector that allows you to insert/change media files in the Html Editor's Audio/Video/Flash dialogs. + */ + GetMediaFileSelector(): ASPxClientMediaFileSelector; + /** + * Provides access to the client object of the "More options" check box in the Html Editor's Audio/Video/Flash/Image dialogs. + */ + GetMoreOptionsCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Width" spin editor in the Html Editor's Audio/Video/Flash dialogs. + */ + GetWidthSpinEdit(): ASPxClientSpinEdit; + /** + * Provides access to the client object of the "Height" spin editor in the Html Editor's Audio/Video/Flash dialogs. + */ + GetHeightSpinEdit(): ASPxClientSpinEdit; + /** + * Provides access to the client object of the "Position" combo box in the Html Editor's Audio/Video/Flash/Image dialogs. + */ + GetPositionComboBox(): ASPxClientComboBox; +} +/** + * Provides client functionality for the Image dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorImageDialog extends ASPxClientHtmlEditorMediaDialogBase { + /** + * Provides access to the client object of the "Size" combo box in the Html Editor's Image dialog. + */ + GetSizeComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the "Create thumbnail" check box in the Html Editor's Image dialog. + */ + GetCreateThumbnailCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "New image name" text box in the Html Editor's Image dialog. + */ + GetThumbnailNameTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Wrap text around image" check box in the Html Editor's Image dialog. + */ + GetWrapTextCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Description" text box in the Html Editor's Image dialog. + */ + GetDescriptionTextBox(): ASPxClientTextBox; +} +/** + * Provides client functionality for the Flash dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorFlashDialog extends ASPxClientHtmlEditorMediaDialogBase { + /** + * Provides access to the client object of the "Quality" combo box in the Html Editor's Flash dialog. + */ + GetQualityComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the "Auto play" check box in the Html Editor's Flash dialog. + */ + GetAutoPlayCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Enable flash menu" check box in the Html Editor's Flash dialog. + */ + GetEnableFlashMenuCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Loop" check box in the Html Editor's Flash dialog. + */ + GetLoopCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Allow fullscreen" check box in the Html Editor's Flash dialog. + */ + GetAllowFullscreenCheckBox(): ASPxClientCheckBox; +} +/** + * Provides client functionality for the Audio dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorAudioDialog extends ASPxClientHtmlEditorMediaDialogBase { + /** + * Provides access to the client object of the "Auto play" check box in the Html Editor's Audio dialogs. + */ + GetAutoPlayCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Preload mode" combo box in the Html Editor's Audio dialogs. + */ + GetPreloadModeComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the "Loop" check box in the Html Editor's Audio dialogs. + */ + GetLoopCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Show player controls" check box in the Html Editor's Audio dialogs. + */ + GetShowPlayerControlsCheckBox(): ASPxClientCheckBox; +} +/** + * Provides client functionality for the Video dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorVideoDialog extends ASPxClientHtmlEditorMediaDialogBase { + /** + * Provides access to the client object of the "Auto play" check box in the Html Editor's Video dialog. + */ + GetAutoPlayCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Preload mode" combo box in the Html Editor's Video dialog. + */ + GetPreloadModeComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the "Loop" check box in the Html Editor's Video dialog. + */ + GetLoopCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Show player controls" check box in the Html Editor's Video dialog. + */ + GetShowPlayerControlsCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Poster URL" text box in the Html Editor's Video dialog. + */ + GetPosterTextBox(): ASPxClientTextBox; +} +/** + * Provides client functionality for the YouTube Video dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorYouTubeDialog extends ASPxClientHtmlEditorEditElementDialog { + /** + * Provides access to the client object of the "Enable privacy-enhanced mode" check box in the Html Editor's YouTube Video dialog. + */ + GetConfidentModeCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Show suggested videos when the video finishes" check box in the Html Editor's YouTube Video dialog. + */ + GetShowSameVideosCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Show video title and player actions" check box in the Html Editor's YouTube Video dialog. + */ + GetShowVideoNameCheckBox(): ASPxClientCheckBox; + /** + * Provides access to the client object of the "Show player controls" check box in the Html Editor's YouTube Video dialog. + */ + GetShowPlayerControlsCheckBox(): ASPxClientCheckBox; +} +/** + * Provides base client functionality for the Table dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorTableDialogBase extends ASPxClientHtmlEditorDialogBase { + /** + * Provides access to the client object of the "Background color" color editor in the Html Editor's Table dialogs. + */ + GetBackgroundColorColorEdit(): ASPxClientColorEdit; +} +/** + * Provides client functionality for the Table dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorTableDialog extends ASPxClientHtmlEditorTableDialogBase { + /** + * Provides access to the client object of the "Width" combo box in the Html Editor's Table dialogs. + */ + GetWidthTypeComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the spin editor in the Html Editor's Table dialogs that allows you to specify the table width value. + */ + GetWidthValueSpinEdit(): ASPxClientSpinEdit; + /** + * Provides access to the client object of the combo box in the Html Editor's Table dialogs that allows you to specify the table width measurement unit. + */ + GetWidthValueTypeComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the "Height" combo box in the Html Editor's Table dialogs. + */ + GetHeightTypeComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the spin editor in the Html Editor's Table dialogs that allows you specify the table height value. + */ + GetHeightValueSpinEdit(): ASPxClientSpinEdit; + /** + * Provides access to the client object of the combo box in the Html Editor's Table dialogs that allows you to specify the table height measurement unit. + */ + GetHeightValueTypeComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the "Cell padding" spin editor in the Html Editor's Table dialogs. + */ + GetCellPaddingSpinEdit(): ASPxClientSpinEdit; + /** + * Provides access to the client object of the "Cell spacing" spin editor in the Html Editor's Table dialogs. + */ + GetCellSpacingSpinEdit(): ASPxClientSpinEdit; + /** + * Provides access to the client object of the "Alignment" combo box in the Html Editor's Table dialogs. + */ + GetAlignmentComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the "Border Color" color editor in the Html Editor's Table dialogs. + */ + GetBorderColorColorEdit(): ASPxClientColorEdit; + /** + * Provides access to the client object of the "Border size" spin editor in the Html Editor's Table dialogs. + */ + GetBorderWidthSpinEdit(): ASPxClientSpinEdit; + /** + * Provides access to the client object of the "Headers" combo box in the Html Editor's Table dialogs. + */ + GetHeadersComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the "Caption" text box in the Html Editor's Table dialogs. + */ + GetCaptionTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Summary" text box in the Html Editor's Table dialogs. + */ + GetSummaryTextBox(): ASPxClientTextBox; + /** + * Provides access to the client object of the "Accessibility" check box related to the Html Editor's Table dialogs. + */ + GetAccessibilityCheckBox(): ASPxClientCheckBox; +} +/** + * Provides client functionality for the Insert Table dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorInsertTableDialog extends ASPxClientHtmlEditorTableDialog { + /** + * Provides access to the client object of the "Columns" spin editor in the Html Editor's Table dialogs. + */ + GetColumnCountSpinEdit(): ASPxClientSpinEdit; + /** + * Provides access to the client object of the "Rows" spin editor in the Html Editor's Table dialogs. + */ + GetRowCountSpinEdit(): ASPxClientSpinEdit; + /** + * Provides access to the client object of the "Equal column widths" check box in the Html Editor's Table dialogs. + */ + GetEqualWidthCheckBox(): ASPxClientCheckBox; +} +/** + * Provides client functionality for Table dialogs within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorTableElementPropertiesDialog extends ASPxClientHtmlEditorTableDialogBase { + /** + * Provides access to the client object of the "Horizontal" combo box in the Html Editor's Row/Column/Cell Properties dialog's Alignment group. + */ + GetHorizontalAlignmentComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the "Vertical" combo box in the Html Editor's Row/Column/Cell Properties dialog's Alignment group. + */ + GetVerticalAlignmentComboBox(): ASPxClientComboBox; +} +/** + * Provides client functionality for the Cell Properties dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorTableCellPropertiesDialog extends ASPxClientHtmlEditorTableElementPropertiesDialog { + /** + * Provides access to the client object of the "Apply to all cells in the table" check box in the Html Editor's Cell Properties dialog. + */ + GetApplyToAllCellsCheckBox(): ASPxClientCheckBox; +} +/** + * Provides client functionality for the Row Properties dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorTableRowPropertiesDialog extends ASPxClientHtmlEditorTableElementPropertiesDialog { + /** + * Provides access to the client object of the "Height" combo box in the Html Editor's "Row Properties" dialog. + */ + GetHeightTypeComboBox(): ASPxClientComboBox; + /** + * Provides access to the client ASPxSpinEdit object that allows you to specify the row height in the Html Editor's "Row Properties" dialog. + */ + GetHeightValueSpinEdit(): ASPxClientSpinEdit; + /** + * Provides access to the client ASPxComboBox object that allows you to specify the row height measurement unit in the Html Editor's "Row Properties" dialog. + */ + GetHeightValueTypeComboBox(): ASPxClientComboBox; +} +/** + * Provides client functionality for the Column Properties dialog within the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorTableColumnPropertiesDialog extends ASPxClientHtmlEditorTableElementPropertiesDialog { + /** + * Provides access to the client object of the "Width" combo box in the Html Editor's "Column Properties" dialog. + */ + GetWidthTypeComboBox(): ASPxClientComboBox; + /** + * Provides access to the client object of the spin editor that allows you to set the column width value in the Html Editor's "Column Properties" dialog. + */ + GetWidthValueSpinEdit(): ASPxClientSpinEdit; + /** + * Provides access to the client object of the combo box that allows you to specify the column width measurement unit in the Html Editor's "Column Properties" dialog. + */ + GetWidthValueTypeComboBox(): ASPxClientComboBox; +} /** * A selection in the ASPxHtmlEditor. */ @@ -7938,7 +10417,7 @@ interface ASPxClientHtmlEditorSelection { SetHtml(html: string, addToHistory: boolean): void; } /** - * A client-side equivalent of the ASPxPivotGrid control. + * The client-side equivalent of the ASPxPivotGrid control. */ interface ASPxClientPivotGrid extends ASPxClientControl { /** @@ -8246,6 +10725,10 @@ interface ASPxClientRichEdit extends ASPxClientControl { * Value: A object that lists methods to work with the selection. */ selection: RichEditSelection; + /** + * Gets a unit converter. + * Value: A object representing a unit converter. + */ unitConverter: RichEditUnitConverter; /** * Occurs after a custom command has been executed on the client side. @@ -8350,6 +10833,11 @@ interface RichEditCommands { * Value: A object that provides methods for executing the command and checking its state. */ fileSaveAs: FileSaveAsCommand; + /** + * Gets a command to open the file's Save As dialog. + * Value: A object that provides methods for executing the command and checking its state. + */ + fileSaveAsDialog: FileSaveAsDialogCommand; /** * Gets a command to invoke a browser-specific Print dialog allowing one to print the current document. * Value: A object that provides methods for executing the command and checking its state. @@ -8620,6 +11108,10 @@ interface RichEditCommands { * Value: A object that provides methods for executing the command and checking its state. */ deleteBookmark: DeleteBookmarkCommand; + /** + * Gets a command to navigate to the specified bookmark. + * Value: A object that provides methods for executing the command and checking its state. + */ goToBookmark: GoToBookmarkCommand; /** * Gets a command to invoke the Hyperlink dialog window. @@ -8671,6 +11163,10 @@ interface RichEditCommands { * Value: A object that provides methods for executing the command and checking its state. */ changePageOrientation: ChangePageOrientationCommand; + /** + * Gets a command to define the page size dialog's settings. + * Value: A object that provides methods for executing the command and checking its state. + */ setPageSizeDialog: SetPageSizeDialogCommand; /** * Gets a command to invoke the Paper tab of the Page Setup dialog window. @@ -8752,6 +11248,16 @@ interface RichEditCommands { * Value: A object that provides methods for executing the command and checking its state. */ delete: DeleteCommand; + /** + * Gets a command to remove the previous word. + * Value: A object that provides methods for executing the command and checking its state. + */ + removePrevWord: RemovePrevWordCommand; + /** + * Gets a command to remove the next word. + * Value: A object that provides methods for executing the command and checking its state. + */ + removeNextWord: RemoveNextWordCommand; /** * Gets a command to move the cursor backwards and erase the character in that space. * Value: A object that provides methods for executing the command and checking its state. @@ -9022,6 +11528,10 @@ interface RichEditCommands { * Value: A object that provides methods for executing the command and checking its state. */ changeTableCellPreferredWidth: ChangeTableCellPreferredWidthCommand; + /** + * Gets a command to toggle inside borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ toggleTableCellInsideBorders: ToggleTableCellInsideBordersCommand; /** * Gets a command to change the selected table columns' preferred width. @@ -9273,7 +11783,86 @@ interface RichEditCommands { * Value: A object that provides methods for executing the command and checking its state. */ openSpellingDialog: OpenSpellingDialogCommand; + /** + * Gets a command to assign a shortcut to the specified client command. + * Value: A object that provides methods for executing the command and checking its state. + */ assignShortcut: AssignShortcutCommand; + /** + * Gets a command to invoke the Layout dialog window to customize the settings of a floating object. + * Value: A object that provides methods for executing the command and checking its state. + */ + openLayoutOptionsDialog: OpenLayoutOptionsDialogCommand; + /** + * Gets a command to insert a floating text box. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertFloatingTextBox: InsertFloatingTextBoxCommand; + /** + * Gets a command to modify a floating object's alignment position. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFloatingObjectAlignmentPosition: ChangeFloatingObjectAlignmentPositionCommand; + /** + * Gets a command to change a floating object's absolute position. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFloatingObjectAbsolutePosition: ChangeFloatingObjectAbsolutePositionCommand; + /** + * Gets a command to modify a floating object's relative position. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFloatingObjectRelativePosition: ChangeFloatingObjectRelativePositionCommand; + /** + * Gets a command to lock a floating object's anchor. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFloatingObjectLockAnchor: ChangeFloatingObjectLockAnchorCommand; + /** + * Gets a command to modify a floating object's text wrapping settings. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFloatingObjectTextWrapping: ChangeFloatingObjectTextWrappingCommand; + /** + * Gets a command to change a floating object's absolute size. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFloatingObjectAbsoluteSize: ChangeFloatingObjectAbsoluteSizeCommand; + /** + * Gets a command to modify a text box' relative size settings. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTextBoxRelativeSize: ChangeTextBoxRelativeSizeCommand; + /** + * Gets a command to rotate a floating object. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFloatingObjectRotation: ChangeFloatingObjectRotationCommand; + /** + * Gets a command to lock a floating object's aspect ratio. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFloatingObjectLockAspectRatio: ChangeFloatingObjectLockAspectRatioCommand; + /** + * Gets a command to modify a floating object's background fill color. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFloatingObjectFillColor: ChangeFloatingObjectFillColorCommand; + /** + * Gets a command to modify a floating object's outline color. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFloatingObjectOutlineColor: ChangeFloatingObjectOutlineColorCommand; + /** + * Gets a command to modify a floating object's outline width. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFloatingObjectOutlineWidth: ChangeFloatingObjectOutlineWidthCommand; + /** + * Gets a command to modify a text box' content margins. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTextBoxContentMargins: ChangeTextBoxContentMarginsCommand; } /** * Serves as a base for objects that implement different client command functionalities. @@ -9303,7 +11892,7 @@ interface CommandWithBooleanStateBase extends CommandBase { */ interface SimpleCommandState { /** - * Gets a value indicating whether the command's UI element is enabled. + * Gets a value indicating whether the command's UI element is enabled (within the ribbon and context menu). * Value: true, if the command's related UI element is enabled; otherwise, false. */ enabled: boolean; @@ -9357,6 +11946,10 @@ interface RichEditDocument { * Value: An array of TableStyle objects storing information about table styles. */ tableStylesInfo: TableStyle[]; + /** + * Provides information about spell checking in the current document. + * Value: A object. + */ spellingInfo: SpellingInfo; } /** @@ -9379,6 +11972,10 @@ interface Paragraph { * Value: An integer value specifying the start position. */ start: number; + /** + * Gets the text buffer interval occupied by the current paragraph element. + * Value: An object specifying the interval settings. + */ interval: Interval; /** * Gets the name of the paragraph style applied to the current paragraph (see name). @@ -9391,7 +11988,7 @@ interface Paragraph { */ listIndex: number; /** - * Gets or sets the index of the list level applied to the current paragraph in the numbering list. + * Gets the index of the list level applied to the current paragraph in the numbering list. * Value: An integer that is the index of the list level of the current paragraph. */ listLevelIndex: number; @@ -9410,6 +12007,20 @@ interface Field { * Value: An integer value specifying the field length. */ length: number; + /** + * Gets the text buffer interval occupied by the field code element. + * Value: An object specifying the interval settings. + */ + codeInterval: Interval; + /** + * Gets the text buffer interval occupied by the field result element. + * Value: An object specifying the interval settings. + */ + resultInterval: Interval; + /** + * Gets the text buffer interval occupied by the current field element. + * Value: An object specifying the interval settings. + */ interval: Interval; /** * Gets or sets a URI to navigate to when the hyperlink (represented by the current field) is activated. @@ -9426,6 +12037,10 @@ interface Field { * Value: A string representing the bookmark's name. */ hyperlinkAnchor: string; + /** + * Gets a value specifying whether a field's code or result is dispalyed. + * Value: true, if the field code is displayed; false, if the field result is displayed. + */ showCode: boolean; } /** @@ -9442,6 +12057,10 @@ interface Bookmark { * Value: An integer value specifying the length of the bookmark. */ length: number; + /** + * Gets the text buffer interval occupied by the current bookmark element. + * Value: An object specifying the interval settings. + */ interval: Interval; /** * Gets the name of a bookmark in the document. @@ -9463,6 +12082,10 @@ interface Section { * Value: An integer value specifying the element length in characters. */ length: number; + /** + * Gets the text buffer interval occupied by the current section element. + * Value: An object specifying the interval settings. + */ interval: Interval; /** * Provides access to the section's headers. @@ -9490,15 +12113,50 @@ interface HeaderFooter { */ subDocument: SubDocument; } +/** + * Contains in-line picture settings. + */ interface InlinePictureInfo { + /** + * Gets the image identifier. + * Value: An integer value specifying the image identifier. + */ id: number; + /** + * Gets the image position. + * Value: An integer value specifying the image position. + */ position: number; + /** + * Gets the initial image width. + * Value: An integer value specifying the image width. + */ initialWidth: number; + /** + * Gets the initial image height. + * Value: An integer value specifying the image height. + */ initialHeight: number; + /** + * Gets the X-scaling factor of the inline image. + * Value: An integer value specifying the scaling factor for the X-axis. + */ scaleX: number; + /** + * Gets the Y-scaling factor of the inline image. + * Value: An integer value specifying the scaling factor for the Y-axis. + */ scaleY: number; + /** + * Gets the actual image width. + * Value: An integer value specifying the image width. + */ actualWidth: number; - actualHeigth: number; + /** + * Gets the actual image height. + * Value: An integer value specifying the image height. + */ + actualHeight: number; } declare enum HeaderFooterType { First=0, @@ -9506,6 +12164,26 @@ declare enum HeaderFooterType { Primary=1, Even=2 } +/** + * Contains the settings defining a file to save to. + */ +interface RichEditFileInfo { + /** + * Gets or sets the file's folder name. + * Value: A string value specifying the folder name. + */ + folderPath: string; + /** + * Gets or sets the file name. + * Value: A string value specifying the file name. + */ + fileName: string; + /** + * Gets or sets the file's document format. + * Value: A DocumentFormat enumeration value. + */ + documentFormat: any; +} declare enum DocumentFormat { Undefined=0, PlainText=1, @@ -9523,11 +12201,19 @@ declare enum DocumentFormat { */ interface RichEditSelection { /** - * Gets or sets an array of document interval in the selection. + * Gets or sets an array of document intervals in the selection. * Value: An array of Interval objects. */ intervals: Interval[]; + /** + * Gets or sets a value specifying whether the current selection is collapsed (and represents the cursor position). + * Value: true, if the selection is collapsed; otherwise, false. + */ collapsed: boolean; + /** + * Gets the maximum position of a document interval in the selection. + */ + getIntervalMaxPosition(): number; /** * Moves the cursor to the next line. */ @@ -9667,6 +12353,24 @@ interface RichEditSelection { * Selects the paragraph in which the cursor is located. */ selectParagraph(): void; + /** + * Moves the cursor to the next page break mark. + */ + goToStartNextPageCommand(): void; + /** + * Moves the cursor to the next page break mark and extends the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToStartNextPageCommand(extendSelection: boolean): void; + /** + * Moves the cursor to the previous page break mark. + */ + goToStartPrevPageCommand(): void; + /** + * Moves the cursor to the previous page break mark and extends the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToStartPrevPageCommand(extendSelection: boolean): void; /** * Selects the table cell in which the cursor is located. */ @@ -9699,17 +12403,17 @@ interface RichEditSelection { */ selectAll(): void; /** - * Moves the cursor to the main sub-document. + * Makes the main sub-document active and moves the cursor to its beginning. */ setMainSubDocumentAsActive(): void; /** - * Moves the cursor to the footer of the specified document page. - * @param pageIndex An integer value specifying the page index. + * Creates a footer sub-document (if it was not created before) and sets the footer as the active sub-document. Moves the cursor to the footer's start position. + * @param pageIndex An integer value specifying the active page's 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. + * Creates a header sub-document (if it was not created before) and sets the header as the active sub-document. Moves the cursor to the header's start position. + * @param pageIndex An integer value specifying the active page's index. */ setHeaderSubDocumentAsActiveByPageIndex(pageIndex: number): void; } @@ -9728,8 +12432,19 @@ interface Interval { */ length: number; } +/** + * Contains spell checking related settings. + */ interface SpellingInfo { + /** + * Gets a value specifying the spell checking state. + * Value: One of the enumeration values. + */ spellCheckerState: any; + /** + * Provides access to an array containing misspelled intervals. + * Value: An array of objects. + */ misspelledIntervals: MisspelledInterval[]; } declare enum SpellCheckerState { @@ -9737,12 +12452,39 @@ declare enum SpellCheckerState { InProgress=1, Done=2 } +/** + * Contains the settings defining a misspelled interval. + */ interface MisspelledInterval { + /** + * Gets the start position of the misspelled word in the interval. + * Value: An integer value specifying the misspelled word's start position. + */ start: number; + /** + * Gets the length of the misspelled interval. + * Value: An integer value specifying the misspelled interval's length. + */ length: number; + /** + * Gets the text buffer interval occupied by the current element. + * Value: An object specifying the interval settings. + */ interval: Interval; + /** + * Gets the spelling error type. + * Value: One of the enumeration values. + */ errorType: any; + /** + * Gets an erroneous word found during spell check. + * Value: A string that is the erroneous or misspelled word. + */ word: string; + /** + * Gets a list of suggested words to replace the misspelled word. + * Value: A string array containing suggested words. + */ suggestions: string[]; } declare enum SpellingErrorType { @@ -9823,7 +12565,15 @@ interface TableStyle extends StyleBase { * Exposes the settings providing the information about the essential document functionality. */ interface SubDocument { + /** + * Gets the sub-document identifier. + * Value: An integer value specifying the sub-document identifier. + */ id: number; + /** + * Gets a value specifying the sub-document type. + * Value: One of the enumeration values. + */ type: any; /** * Provides information about paragraphs contained in the document. @@ -9845,6 +12595,10 @@ interface SubDocument { * Value: An array of Bookmark objects storing information about document bookmarks. */ bookmarksInfo: Bookmark[]; + /** + * Provides access to an array of objects containing in-line picture settings. + * Value: An array of objects. + */ inlinePicturesInfo: InlinePictureInfo[]; /** * Gets the document's textual representation. @@ -9877,6 +12631,10 @@ interface Table { * Value: A integer value specifying the character length of the table. */ length: number; + /** + * Gets the text buffer interval occupied by the current table element. + * Value: An object specifying the interval settings. + */ interval: Interval; /** * Provides access to a collection of table rows. @@ -9903,6 +12661,10 @@ interface TableRow { * Value: An integer value specifying the element length in characters. */ length: number; + /** + * Gets the text buffer interval occupied by the current table row element. + * Value: An object specifying the interval settings. + */ interval: Interval; /** * Provides information about the table row's cells. @@ -9924,18 +12686,65 @@ interface TableCell { * Value: An integer value specifying the element length in characters. */ length: number; + /** + * Gets the text buffer interval occupied by the current table cell element. + * Value: An object specifying the interval settings. + */ interval: Interval; } +/** + * Contains the method to convert different units of measurement. + */ interface RichEditUnitConverter { + /** + * Converts a measurement from pixels to twips. + * @param value The pixels value to be converted. + */ pixelsToTwips(value: number): number; + /** + * Converts a measurement from inches to twips. + * @param value The inches value (floating) to be converted. + */ inchesToTwips(value: number): number; + /** + * Converts a measurement from points to twips. + * @param value The points value to be converted. + */ pointsToTwips(value: number): number; + /** + * Converts a value in centimeters to twips. + * @param value A floating value specifying the value in centimeters to convert. + */ centimetersToTwips(value: number): number; + /** + * Converts a measurement from twips to centimeters. + * @param value The twips value to be converted. + */ twipsToCentimeters(value: number): number; + /** + * Converts a measurement from pixels to centimeters. + * @param value The pixels value to be converted. + */ pixelsToCentimeters(value: number): number; + /** + * Converts a measurement from twips to inches. + * @param value The twips value to be converted. + */ twipsToInches(value: number): number; + /** + * Converts a measurement from pixels to inches. + * @param value The pixels value to be converted. + */ pixelsToInches(value: number): number; + /** + * Converts a measurement from pixels to points. + * @param value The pixels value to be converted. + */ pixelsToPoints(value: number): number; + /** + * Converts a measurement from twips to points. + * @param value The twips value to be converted. + */ twipsToPoints(value: number): number; } /** @@ -10097,9 +12906,19 @@ interface GoToDataRecordCommand extends CommandBase { * @param activeRecordIndex An integer value specifying index of the next data record. */ execute(activeRecordIndex: number): boolean; + /** + * Gets information about the command state. + */ getState(): any; } +/** + * Contains the settings defining a data record. + */ interface DataRecordOptions { + /** + * Gets or sets the index of the active data record. + * Value: An integer value specifying the data record index. + */ activeRecordIndex: number; recordCount: number; } @@ -10190,12 +13009,23 @@ interface MailMergeAndDownloadCommand extends CommandBase { * @param fileExtension A string value specifying the file extension of the resulting document. */ execute(fileExtension: string): boolean; + /** + * Executes the MailMergeAndDownloadCommand command by applying the specified setting. 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 documentFormat One of the DocumentFormat enumeration values. + */ + execute(documentFormat: any): boolean; /** * Executes the MailMergeAndDownloadCommand command by applying the specified settings. 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 fileExtension A string value specifying the file extension of the resulting document. * @param settings A MailMergeSettings object containing settings to set up mail merge operations. */ execute(fileExtension: string, settings: MailMergeSettings): boolean; + /** + * Executes the MailMergeAndDownloadCommand command by applying the specified settings. 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 documentFormat One of the DocumentFormat enumeration values. + * @param settings A MailMergeSettings object specifying the mail merge settings. + */ + execute(documentFormat: any, settings: MailMergeSettings): boolean; /** * Gets information about the command state. */ @@ -10212,10 +13042,10 @@ interface MailMergeAndSaveAsCommand extends CommandBase { execute(filePath: string): boolean; /** * Executes the MailMergeAndSaveAsCommand command by applying the specified settings. 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 filePath A string value specifying path to the saving file. - * @param settings A MailMergeSettings object specifying hyperlink settings. + * @param fileInfo A RichEditFileInfo object specifying a file to save to. + * @param settings A MailMergeSettings object specifying the mail merge settings. */ - execute(filePath: string, settings: MailMergeSettings): boolean; + execute(fileInfo: RichEditFileInfo, settings: MailMergeSettings): boolean; /** * Gets information about the command state. */ @@ -10311,6 +13141,11 @@ interface FileSaveAsCommand extends CommandWithSimpleStateBase { * @param path A string value specifying path to the saving file. */ execute(path: string): boolean; + /** + * Executes the FileSaveAsCommand command by applying the specified setting. 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 fileInfo A object specifying a file to save to. + */ + execute(fileInfo: RichEditFileInfo): boolean; } /** * A command to download the document file, specifying its extension. @@ -10321,6 +13156,20 @@ interface FileDownloadCommand extends CommandWithSimpleStateBase { * @param fileExtension A string value specifying the extension of the downloading file. */ execute(fileExtension: string): boolean; + /** + * Executes the FileDownloadCommand command by applying the specified setting. 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 documentFormat A DocumentFormat enumeration value. + */ + execute(documentFormat: any): boolean; +} +/** + * A command to open the file's Save As dialog. + */ +interface FileSaveAsDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the FileSaveAsDialogCommand 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. + */ + execute(): boolean; } /** * A command to invoke a browser-specific Print dialog allowing one to print the current document. @@ -10402,6 +13251,418 @@ interface ReplaceNextCommand extends CommandWithSimpleStateBase { */ execute(text: string, replaceText: string, matchCase: boolean): boolean; } +interface OpenLayoutOptionsDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenLayoutOptionsDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a floating text box. + */ +interface InsertFloatingTextBoxCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertFloatingTextBoxCommand 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. + */ + execute(): boolean; +} +/** + * A command to lock a floating object's anchor. + */ +interface ChangeFloatingObjectLockAnchorCommand extends CommandBase { + /** + * Executes the ChangeFloatingObjectLockAnchorCommand command by applying the specified setting. 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 lockAnchor true to lock the anchor; false, otherwise. + */ + execute(lockAnchor: boolean): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to modify a floating object's alignment position. + */ +interface ChangeFloatingObjectAlignmentPositionCommand extends CommandBase { + /** + * Executes the ChangeFloatingObjectAlignmentPositionCommand command by applying the specified setting. 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 settings A FloatingObjectAlignmentPositionSettings object specifying alignment position settings. + */ + execute(settings: FloatingObjectAlignmentPositionSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change a floating object's absolute position. + */ +interface ChangeFloatingObjectAbsolutePositionCommand extends CommandBase { + /** + * Executes the ChangeFloatingObjectAbsolutePositionCommand command by applying the specified setting. 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 settings A FloatingObjectAbsolutePositionSettings object specifying page margin settings. + */ + execute(settings: FloatingObjectAbsolutePositionSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to modify a floating object's relative position. + */ +interface ChangeFloatingObjectRelativePositionCommand extends CommandBase { + /** + * Executes the ChangeFloatingObjectRelativePositionCommand command by applying the specified setting. 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 settings A FloatingObjectRelativePositionSettings object specifying relative positioin settings. + */ + execute(settings: FloatingObjectRelativePositionSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to modify a floating object's text wrapping settings. + */ +interface ChangeFloatingObjectTextWrappingCommand extends CommandBase { + /** + * Executes the ChangeFloatingObjectTextWrappingCommand command by applying the specified setting. 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 settings A FloatingObjectTextWrappingSettings object specifying text wrapping settings. + */ + execute(settings: FloatingObjectTextWrappingSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change a floating object's absolute size. + */ +interface ChangeFloatingObjectAbsoluteSizeCommand extends CommandBase { + /** + * Executes the ChangeFloatingObjectAbsoluteSizeCommand command by applying the specified setting. 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 settings A FloatingObjectAbsoluteSizeSettings object specifying absolute size settings. + */ + execute(settings: FloatingObjectAbsoluteSizeSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to modify a text box' relative size settings. + */ +interface ChangeTextBoxRelativeSizeCommand extends CommandBase { + /** + * Executes the ChangeTextBoxRelativeSizeCommand command by applying the specified setting. 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 settings A TextBoxRelativeSizeSettings object specifying relative size settings. + */ + execute(settings: TextBoxRelativeSizeSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to rotate a floating object. + */ +interface ChangeFloatingObjectRotationCommand extends CommandBase { + /** + * Executes the ChangeFloatingObjectRotationCommand command by applying the specified setting. 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 rotation An integer value specifying the angle of rotation. + */ + execute(rotation: number): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to lock a floating object's aspect ratio. + */ +interface ChangeFloatingObjectLockAspectRatioCommand extends CommandBase { + /** + * Executes the ChangeFloatingObjectLockAspectRatioCommand command by applying the specified setting. 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 lockAspectRatio true to lock the aspect ratio and maintain the proportions; otherwise, false. + */ + execute(lockAspectRatio: boolean): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to modify a floating object's background fill color. + */ +interface ChangeFloatingObjectFillColorCommand extends CommandBase { + /** + * Executes the ChangeFloatingObjectFillColorCommand command by applying the specified setting. 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 color A string value specifying the color. + */ + execute(color: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to modify a floating object's outline color. + */ +interface ChangeFloatingObjectOutlineColorCommand extends CommandBase { + /** + * Executes the ChangeFloatingObjectOutlineColorCommand command by applying the specified setting. 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 color A string value specifying the color. + */ + execute(color: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to modify a floating object's outline width. + */ +interface ChangeFloatingObjectOutlineWidthCommand extends CommandBase { + /** + * Executes the ChangeFloatingObjectOutlineWidthCommand command by applying the specified setting. 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 width An integer value specifying the outline width. + */ + execute(width: number): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to modify a text box' content margins. + */ +interface ChangeTextBoxContentMarginsCommand extends CommandBase { + /** + * Executes the ChangeTextBoxContentMarginsCommand command by applying the specified setting. 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 settings A Margins object specifying margin settings. + */ + execute(settings: Margins): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * Contains alignment position settings for floating objects. + */ +interface FloatingObjectAlignmentPositionSettings { + /** + * Gets or sets a value specifying how a floating object is horizontally aligned relative to an element specified by the horizontalPositionAlignment property. + * Value: One of the enumeration values. + */ + horizontalPositionAlignment: any; + /** + * Gets or sets a value specifying to what element the horizontal alignment of a floating object is relative. + * Value: One of the enumeration values. + */ + horizontalPositionType: any; + /** + * Gets or sets a value specifying how a floating object is vertically aligned relative to an element specified by the verticalPositionAlignment property. + * Value: One of the enumeration values. + */ + verticalPositionAlignment: any; + /** + * Gets or sets a value specifying to what element the vertical alignment of a floating object is relative. + * Value: One of the enumeration values. + */ + verticalPositionType: any; +} +/** + * Contains page margin settings. + */ +interface FloatingObjectAbsolutePositionSettings { + /** + * Gets or sets a floating object's horizontal position relative to an element specified by the horizontalPositionType property. + * Value: An integer value specifying the position. + */ + horizontalAbsolutePosition: number; + /** + * Gets or sets a value specifying to what element the horizontal position of a floating object is relative. + * Value: One of the enumeration values. + */ + horizontalPositionType: any; + /** + * Gets or sets a floating object's vertical position relative to an element specified by the verticalPositionType property. + * Value: An integer value specifying the position. + */ + verticalAbsolutePosition: number; + /** + * Gets or sets a value specifying to what element the vertical position of a floating object is relative. + * Value: One of the enumeration values. + */ + verticalPositionType: any; +} +/** + * Contains relative position settings for floating objects. + */ +interface FloatingObjectRelativePositionSettings { + /** + * Gets or sets the horizontal distance between the edge of a floating object and the element specified by the horizontalRelativePosition property + * Value: An integer value specifying the horizontal position. + */ + horizontalRelativePosition: number; + /** + * Gets or sets a value specifying to what element the horizontal position of a floating object is relative. + * Value: One of the enumeration values. + */ + horizontalPositionType: any; + /** + * Gets or sets the horizontal distance between the edge of a floating object and the element specified by the verticalRelativePosition property + * Value: An integer value specifying the vertical position. + */ + verticalRelativePosition: number; + /** + * Gets or sets a value specifying to what element the vertical position of a floating object is relative. + * Value: One of the enumeration values. + */ + verticalPositionType: any; +} +/** + * Contains text wrapping settings for floating objects. + */ +interface FloatingObjectTextWrappingSettings { + /** + * Gets or sets a value specifying how text is wrapped around a floating object. + * Value: One of the enumeration values. + */ + floatingObjectTextWrapType: any; + /** + * Gets or sets a value specifying how text can wrap around a floating object's left and right sides. + * Value: One of the enumeration values. + */ + floatingObjectTextWrapSide: any; + /** + * Gets or sets the left offset of text wrapping. + * Value: An integer value specifying the left offset. + */ + leftDistance: number; + /** + * Gets or sets the right offset of text wrapping. + * Value: An integer value specifying the right offset. + */ + rightDistance: number; + /** + * Gets or sets the top offset of text wrapping. + * Value: An integer value specifying the top offset. + */ + topDistance: number; + /** + * Gets or sets the bottom offset of text wrapping. + * Value: An integer value specifying the bottom offset. + */ + bottomDistance: number; +} +/** + * Contains absolute size settings for floating objects. + */ +interface FloatingObjectAbsoluteSizeSettings { + /** + * Gets or sets a floating object's absolute width. + * Value: An integer value specifying the width. + */ + absoluteWidth: number; + /** + * Gets or sets a floating object's absolute height. + * Value: An integer value specifying the height. + */ + absoluteHeight: number; +} +/** + * Contains relative size settings for floating objects. + */ +interface TextBoxRelativeSizeSettings { + /** + * Gets or sets the percentage specifying a floating object's width relative to the element defined by the relativeWidthType property. + * Value: An integer value specifying the relative width, as a percentage. + */ + relativeWidth: number; + /** + * Gets or sets a value specifying to what element the floating object width is relative. + * Value: One of the enumeration values. + */ + relativeWidthType: any; + /** + * Gets or sets the percentage specifying a floating object's height relative to the element defined by the relativeHeightType property. + * Value: An integer value specifying the relative height, as a percentage. + */ + relativeHeight: number; + /** + * Gets or sets a value specifying to what element the floating object height is relative. + * Value: One of the enumeration values. + */ + relativeHeightType: any; +} +declare enum FloatingObjectRelativeWidthType { + Margin=0, + Page=1, + LeftMargin=2, + RightMargin=3, + InsideMargin=4, + OutsideMargin=5 +} +declare enum FloatingObjectRelativeHeightType { + Margin=0, + Page=1, + TopMargin=2, + BottomMargin=3, + InsideMargin=4, + OutsideMargin=5 +} +declare enum FloatingObjectTextWrapType { + None=0, + TopAndBottom=1, + Tight=2, + Through=3, + Square=4 +} +declare enum FloatingObjectTextWrapSide { + Both=0, + Left=1, + Right=2, + Largest=3 +} +declare enum FloatingObjectHorizontalPositionType { + Page=0, + Character=1, + Column=2, + Margin=3, + LeftMargin=4, + RightMargin=5, + InsideMargin=6, + OutsideMargin=7 +} +declare enum FloatingObjectHorizontalPositionAlignment { + None=0, + Left=1, + Center=2, + Right=3, + Inside=4, + Outside=5 +} +declare enum FloatingObjectVerticalPositionType { + Page=0, + Line=1, + Paragraph=2, + Margin=3, + TopMargin=4, + BottomMargin=5, + InsideMargin=6, + OutsideMargin=7 +} +declare enum FloatingObjectVerticalPositionAlignment { + None=0, + Top=1, + Center=2, + Bottom=3, + Inside=4, + Outside=5 +} /** * A command to cancel changes caused by the previous command. */ @@ -10696,6 +13957,10 @@ interface ListLevelSettings { * Value: One of the values. */ alignment: any; + /** + * Gets or sets the character inserted after the number for a numbered list item. + * Value: A string value that is the trailing character for the list level. + */ separator: string; /** * Gets or sets the left indent for text within the current list level's paragraph. @@ -10872,6 +14137,24 @@ interface DeleteCommand extends CommandWithSimpleStateBase { */ execute(): boolean; } +/** + * A command to remove the previous word. + */ +interface RemovePrevWordCommand extends CommandWithSimpleStateBase { + /** + * Executes the RemovePrevWordCommand 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. + */ + execute(): boolean; +} +/** + * A command to remove the next word. + */ +interface RemoveNextWordCommand extends CommandWithSimpleStateBase { + /** + * Executes the RemoveNextWordCommand 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. + */ + execute(): boolean; +} /** * A command to move the cursor backwards and erase the character in that space. */ @@ -10973,8 +14256,8 @@ interface OpenPageMarginsDialogCommand extends CommandWithSimpleStateBase { */ interface ChangePageOrientationCommand extends CommandBase { /** - * - * @param isPortrait + * Executes the ChangePageOrientationCommand command by applying the specified setting. 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 isPortrait One of the Orientation enumeration values. */ execute(isPortrait: any): boolean; /** @@ -11048,8 +14331,8 @@ interface OpenSectionColumnsDialogCommand extends CommandWithSimpleStateBase { */ interface ChangeSectionColumnsCommand extends CommandBase { /** - * - * @param columns + * Executes the ChangeSectionColumnsCommand command by applying the specified setting. 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 An array of SectionColumn objects. */ execute(columns: SectionColumn[]): boolean; /** @@ -11588,10 +14871,24 @@ declare enum ParagraphFirstLineIndent { Indented=1, Hanging=2 } +/** + * A command to assign a shortcut to the specified client command. + */ interface AssignShortcutCommand extends CommandWithSimpleStateBase { + /** + * Executes the AssignShortcutCommand command by applying the specified settings. 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 keyCode An integer value specifying the code uniquely identifying the key combination. + * @param callback A callback function to execute on pressing the shortcut. + */ execute(keyCode: number, callback: (arg1: string) => void): boolean; } +/** + * A command to invoke the Spelling dialog window. + */ interface OpenSpellingDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenSpellingDialogCommand 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. + */ execute(): boolean; } /** @@ -11991,7 +15288,13 @@ interface ToggleTableCellBottomBorderCommand extends CommandWithBooleanStateBase */ execute(): boolean; } +/** + * A command to toggle left borders for selected cells on/off. + */ interface ToggleTableCellLeftBorderCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellLeftBorderCommand 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. + */ execute(): boolean; } /** @@ -12522,6 +15825,10 @@ interface TableHeightUnit { * Value: An integer value specifying the table height. */ value: number; + /** + * Gets or sets the unit type for the table height. + * Value: One of the enumeration values. + */ type: any; } declare enum TableHeightUnitType { @@ -12851,6 +16158,10 @@ interface FontFormattingSettings { * Value: true, if characters are italicized; otherwise, false. */ italic: boolean; + /** + * Gets or sets a value specifying whether the strikeout formatting is applied to a character(s). + * Value: true if the strikeout formatting is applied; otherwise, false. + */ strikeout: boolean; /** * Gets or sets whether only word characters are underlined. @@ -13239,9 +16550,9 @@ interface ASPxClientRecurrenceInfo { GetPeriodicity(): number; /** * Sets the ordinal number of a day within a defined month. - * @param dayNubmer A positive integer value that specifies the day number within a month. + * @param dayNumber A positive integer value that specifies the day number within a month. */ - SetDayNumber(dayNubmer: number): void; + SetDayNumber(dayNumber: number): void; /** * Gets the ordinal number of a day within a defined month. */ @@ -13547,7 +16858,7 @@ interface DefaultRecurrenceRuleValuesAccessor { */ GetMonth(): number; /** - * Gets the days of the week to which a weekly recurrent appointment is scheduled. + * Gets the days of the week on which a weekly recurrent appointment is scheduled. */ GetWeekDays(): ASPxClientWeekDays; /** @@ -13577,7 +16888,7 @@ interface WeeklyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAcce */ GetPeriodicity(): number; /** - * Gets the days of the week to which a weekly recurrent appointment is scheduled. + * Gets the days of the week on which a weekly recurrent appointment is scheduled. */ GetWeekDays(): ASPxClientWeekDays; } @@ -13586,7 +16897,7 @@ interface WeeklyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAcce */ interface MonthlyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAccessor { /** - * Gets the number of the month's day in which the appointment is scheduled. + * Gets the day of the month on which the appointment is scheduled. */ GetDayNumber(): number; /** @@ -13594,7 +16905,7 @@ interface MonthlyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAcc */ GetPeriodicity(): number; /** - * Gets the days of the week to which a monthly recurrent appointment is scheduled. + * Gets the days of the week on which a monthly recurrent appointment is scheduled. */ GetWeekDays(): ASPxClientWeekDays; /** @@ -13607,7 +16918,7 @@ interface MonthlyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAcc */ interface YearlyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAccessor { /** - * Gets the number of the month's day in which the appointment is scheduled. + * Gets the day of the month on which the appointment is scheduled. */ GetDayNumber(): number; /** @@ -13615,7 +16926,7 @@ interface YearlyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAcce */ GetMonth(): number; /** - * Gets the days of the week to which a yearly recurrent appointment is scheduled. + * Gets the days of the week on which a yearly recurrent appointment is scheduled. */ GetWeekDays(): ASPxClientWeekDays; /** @@ -13789,6 +17100,10 @@ interface ASPxClientScheduler extends ASPxClientControl { * Client-side event. Occurs after the active view of the ASPxScheduler has been changed. */ ActiveViewChanged: ASPxClientEvent>; + /** + * Occurs when an end-user pressers a keyboard shortcut. + */ + Shortcut: ASPxClientEvent>; /** * Occurs when the end-user clicks an appointment. */ @@ -13797,6 +17112,14 @@ interface ASPxClientScheduler extends ASPxClientControl { * Occurs when the end-user double clicks on an appointment. */ AppointmentDoubleClick: ASPxClientEvent>; + /** + * Occurs when an end-user clicks a time cell. + */ + CellClick: ASPxClientEvent>; + /** + * Occurs when and end-user double-clicks a time cell. + */ + CellDoubleClick: ASPxClientEvent>; /** * Occurs on the client side when the user selects an appointment. */ @@ -13825,6 +17148,14 @@ interface ASPxClientScheduler extends ASPxClientControl { * Client-side event that occurs after an appointment has been dragged and dropped. */ AppointmentDrop: ASPxClientEvent>; + /** + * A client-side event that occurs when an appointment is being dragged. + */ + AppointmentDrag: ASPxClientEvent>; + /** + * A client-side event that occurs when an appointment is being resized. + */ + AppointmentResizing: ASPxClientEvent>; /** * Client-side event that occurs when an appointment is resized. */ @@ -13901,6 +17232,10 @@ interface ASPxClientScheduler extends ASPxClientControl { * Client-side function that returns the ResourceId of selected time cell's resource. */ GetSelectedResource(): string; + /** + * Gets a collection of visible appointments. + */ + GetVisibleAppointments(): ASPxClientAppointment[]; /** * Client-side function that returns an appointment with the specified ID. * @param id An appointment's identifier. @@ -14102,6 +17437,11 @@ interface ASPxSchedulerViewType { * Value: A string "FullWeek", indicating the FullWeekView. */ FullWeek: string; + /** + * Gets a string representation equivalent to the Agenda enumeration for use in client scripts. + * Value: A string "Agenda", indicating the AgendaView. + */ + Agenda: string; } /** * Represents a client-side equivalent of the SchedulerGroupType enumeration. @@ -14220,6 +17560,37 @@ interface AppointmentsSelectionEventArgs extends ASPxClientEventArgs { */ appointmentIds: string[]; } +/** + * A method that will handle the Shortcut event. + */ +interface ShortcutEventHandler { + /** + * A method that will handle the Shortcut event. + * @param source The event sender (typically an ASPxClientScheduler control). + * @param e A ShortcutEventArgs object that contains event data. + */ + (source: S, e: ShortcutEventArgs): void; +} +/** + * Provides data for the client-side Shortcut event. + */ +interface ShortcutEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of a command associated with the keyboard shortcut. + * Value: A string containing a command name. + */ + commandName: string; + /** + * Gets an object containing information about a keyboard shortcut event. + * Value: An object containing event data. + */ + htmlEvent: Object; + /** + * Gets or sets whether an event is handled, and that default actions are not required. + * Value: true, if no default processing is required; otherwise, false. + */ + handled: boolean; +} /** * A method that will handle the ActiveViewChanging event. */ @@ -14313,21 +17684,55 @@ interface MenuItemClickedEventArgs extends ASPxClientEventArgs { */ handled: boolean; } -interface AppointmentDropEventHandler { +/** + * A method that will handle the AppointmentDrag event. + */ +interface AppointmentDragEventHandler { /** - * A method that will handle the AppointmentDrop event. - * @param source The event sender (typically an ASPxClientScheduler control). + * A method that will handle the AppointmentDrag event. + * @param source The event sender (typically an ASPxClientScheduler object). * @param e A ASPxClientAppointmentDragEventArgs object that contains event data. */ (source: S, e: ASPxClientAppointmentDragEventArgs): void; } /** - * Provides data for the AppointmentDrop event. + * Provides data for the AppointmentDrag event. */ interface ASPxClientAppointmentDragEventArgs extends ASPxClientEventArgs { /** - * Gets or sets whether default event processing is required. - * Value: true to process an event using only custom code; otherwise, false. + * Specifies whether or not appointments can be dropped into the intervals over which they are currently dragged. + * Value: true to allow dropping appointments; otherwise, false. + */ + allow: boolean; + /** + * Gets a mouse event object related to the current drag operation. + * Value: An object providing event properties specific to mouse events. + */ + mouseEvent: Object; + /** + * Provides information about dragged appointments. + * Value: An array of ASPxClientAppointmentDragInfo objects storing information about dragged appointments. + */ + dragInformation: ASPxClientAppointmentDragInfo[]; +} +/** + * A method that will handle the AppointmentDrop event. + */ +interface AppointmentDropEventHandler { + /** + * A method that will handle the AppointmentDrop event. + * @param source The event sender (typically an ASPxClientScheduler object). + * @param e A ASPxClientAppointmentDropEventArgs object that contains event data. + */ + (source: S, e: ASPxClientAppointmentDropEventArgs): void; +} +/** + * Provides data for the AppointmentDrop event. + */ +interface ASPxClientAppointmentDropEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets a value that specifies whether the event is handled, and the default processing is not required. + * Value: true, if if the event is completely handled by custom code and no default processing is required; otherwise, false. */ handled: boolean; /** @@ -14336,8 +17741,8 @@ interface ASPxClientAppointmentDragEventArgs extends ASPxClientEventArgs { */ operation: ASPxClientAppointmentOperation; /** - * Provides information about dragged appointments. - * Value: An array of ASPxClientAppointmentDragInfo objects storing information about dragged appointments. + * Provides information about dropped appointments. + * Value: An array of ASPxClientAppointmentDragInfo objects storing information about dropped appointments. */ dragInformation: ASPxClientAppointmentDragInfo[]; } @@ -14379,6 +17784,47 @@ interface ASPxClientAppointmentResizeEventArgs extends ASPxClientEventArgs { */ newInterval: ASPxClientTimeInterval; } +/** + * A method that will handle the AppointmentResizing event. + */ +interface AppointmentResizingEventHandler { + /** + * A method that will handle the AppointmentResizing event. + * @param source The event sender (typically an ASPxClientScheduler object). + * @param e A ASPxClientAppointmentResizingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientAppointmentResizingEventArgs): void; +} +/** + * Provides data for the AppointmentResizing event. + */ +interface ASPxClientAppointmentResizingEventArgs extends ASPxClientEventArgs { + /** + * Specifies whether or not an appointment can be resized to the new time interval. + * Value: true to allow resizing the appointment; otherwise, false. + */ + allow: boolean; + /** + * Gets a mouse event object related to the current appointment resizing operation. + * Value: An object providing event properties specific to mouse events. + */ + mouseEvent: Object; + /** + * Gets the resized appointment's identifier. + * Value: A string containing an appointment identifier. + */ + appointmentId: string; + /** + * Gets the appointment's interval before resizing. + * Value: An object representing the interval assigned to the appointment. + */ + oldInterval: ASPxClientTimeInterval; + /** + * Gets the appointment's interval after resizing. + * Value: An object representing the interval assigned to the appointment. + */ + newInterval: ASPxClientTimeInterval; +} /** * Stores information about an appointment drag operation. */ @@ -14409,6 +17855,37 @@ interface ASPxClientAppointmentDragInfo { */ newResources: string[]; } +/** + * A method that will handle the CellDoubleClick events. + */ +interface CellClickEventHandler { + /** + * A method that will handle the CellClick event. + * @param source The event sender (typically an ASPxClientScheduler control). + * @param e A CellClickEventArgs object that contains event data. + */ + (source: S, e: CellClickEventArgs): void; +} +/** + * Provides data for the CellDoubleClick events. + */ +interface CellClickEventArgs extends ASPxClientEventArgs { + /** + * Provides access to an object containing information about an HTML element representing the clicked time cell. + * Value: An object containing information about an HTML element. + */ + htmlElement: Object; + /** + * Provides access to a time interval occupied by the clicked time cell. + * Value: An object. + */ + interval: ASPxClientTimeInterval; + /** + * Gets the name of a resource to which the clicked time cell belongs. + * Value: A string containing the name of a resource. + */ + resource: string; +} /** * Contains information about a client tooltip. */ @@ -14560,6 +18037,11 @@ interface ASPxClientSpellCheckerAfterCheckEventArgs extends ASPxClientEventArgs * Value: A string, containing checked text. */ checkedText: string; + /** + * Gets a value specifying whether spell checking is finished or stopped by the user. + * Value: A string value identifying the reason ("Default" or "User"). + */ + reason: string; } /** * Represents an object that will handle the client-side WordChanged event. @@ -14572,6 +18054,15 @@ interface ASPxClientWordChangedEventHandler { */ (source: S, e: ASPxClientSpellCheckerAfterCheckEventArgs): void; } +declare enum ASPxClientSpreadsheetPopupMenuType { + ColumnHeading=0, + RowHeading=1, + SheetTab=3, + Picture=4, + Chart=5, + Cell=7, + AutoFilter=8 +} /** * A method that will handle the CustomCommandExecuted event. */ @@ -14597,6 +18088,9 @@ interface ASPxClientSpreadsheetCustomCommandExecutedEventArgs extends ASPxClient * Value: A string value containing additional information about the processed command. */ parameter: string; + /** + * This property is now obsolete. Use the commandName property instead. + */ item: ASPxClientRibbonItem; } /** @@ -14667,6 +18161,32 @@ interface ASPxClientSpreadsheetHyperlinkClickEventArgs extends ASPxClientEventAr */ targetUri: string; } +/** + * A method that will handle the PopupMenuShowing event. + */ +interface ASPxClientSpreadsheetPopupMenuShowingEventHandler { + /** + * A method that will handle the PopupMenuShowing event. + * @param source The event sender (typically an ASPxClientSpreadsheet object). + * @param e A ASPxClientSpreadsheetPopupMenuShowingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSpreadsheetPopupMenuShowingEventArgs): void; +} +/** + * Provides data for the PopupMenuShowing event. + */ +interface ASPxClientSpreadsheetPopupMenuShowingEventArgs extends ASPxClientCancelEventArgs { + /** + * Provides access to a collection of menu items in the context menu being invoked. + * Value: A object representing the context menu's item collection. + */ + menuItems: ASPxClientSpreadsheetPopupMenuItemCollection; + /** + * Gets the currently displayed context menu's type. + * Value: One of the enumeration values. + */ + menuType: any; +} /** * A client-side equivalent of the ASPxSpreadsheet object. */ @@ -14707,6 +18227,10 @@ interface ASPxClientSpreadsheet extends ASPxClientControl { * Occurs on the client side after a hyperlink is clicked within the Spreadsheet's document. */ HyperlinkClick: ASPxClientEvent>; + /** + * Occurs before the context menu is displayed and allows menu customization. + */ + PopupMenuShowing: ASPxClientEvent>; /** * Sets input focus to the Spreadsheet. */ @@ -14734,6 +18258,12 @@ interface ASPxClientSpreadsheet extends ASPxClientControl { * @param rowModelIndex An integer value specifying the cell's row index. */ GetCellValue(colModelIndex: number, rowModelIndex: number): Object; + /** + * Returns the comment associated with the specified data cell. + * @param colModelIndex An integer value specifying the data cell's column index. + * @param rowModelIndex An integer value specifying the data cell's row index. + */ + GetCellComment(colModelIndex: number, rowModelIndex: number): Object; /** * Gets the value of the currently active cell. */ @@ -14815,6 +18345,123 @@ interface ASPxClientSpreadsheetSelection { */ bottomRowIndex: number; } +/** + * Represents an individual item of the Spreadsheet's context menu. + */ +interface ASPxClientSpreadsheetPopupMenuItem { + /** + * Gets the immediate parent menu item to which the current menu item belongs. + * Value: A ASPxClientSpreadsheetPopupMenuItem object representing the menu item's immediate parent. + */ + parent: ASPxClientSpreadsheetPopupMenuItem; + /** + * Gets or sets the unique identifier name for the current menu item. + * Value: A string value that specifies the item's unique identifier name. + */ + name: string; + /** + * Gets or sets the text content of the current menu item. + * Value: A string value that specifies the text content of the menu item. + */ + text: string; + /** + * Gets or sets a value that indicates whether the menu item is enabled, allowing the item to respond to end-user interactions. + * Value: true if the item is enabled; otherwise, false. + */ + enabled: boolean; + /** + * Gets or sets the CSS class name defining the menu item's image. + * Value: A string value specifying the class name. + */ + imageClassName: string; + /** + * Gets or sets an URL which defines the navigation location. + * Value: A string value which represents an URL where the client web browser will navigate. + */ + navigateUrl: string; + /** + * Gets or sets the URL of the menu item's image. + * Value: A string value that specifies the location of an image. + */ + imageUrl: string; + /** + * Gets or sets a value that specifies whether the current menu item starts a group. + * Value: true if the current menu item starts a group; otherwise, false. + */ + beginGroup: boolean; + /** + * Gets or sets the current menu item's tooltip text. + * Value: A string which specifies the text content of the current menu item's tooltip. + */ + tooltip: string; + /** + * Gets or sets the window or frame at which to target the contents of the URL associated with the current menu item. + * Value: A string which identifies the window or frame at which to target the URL content. + */ + target: string; + /** + * Gets a collection that contains the submenu items of the current menu item. + */ + GetSubItems(): ASPxClientSpreadsheetPopupMenuItemCollection; + /** + * Returns the menu item's sub-item with the specified index. + * @param index An integer value specifying the index of the sub-item within a collection of the current menu item's submenu items. + */ + GetItem(index: number): ASPxClientSpreadsheetPopupMenuItem; + /** + * Returns the menu item's sub-item with the specified name property value. + * @param name A string value specifying the name property value of the sub-item to find. + */ + GetItemByName(name: string): ASPxClientSpreadsheetPopupMenuItem; + /** + * Returns the total number of the menu item's child items (submenu items). + */ + GetItemCount(): number; +} +/** + * Represents a collection of items in the Spreadhseet's context menu. + */ +interface ASPxClientSpreadsheetPopupMenuItemCollection { + /** + * Adds the specified menu item to the end of the collection. + * @param item An ASPxClientSpreadsheetPopupMenuItem object specifying the item to be added to the collection. + */ + Add(item: ASPxClientSpreadsheetPopupMenuItem): void; + /** + * Removes a menu item specified by its index within the collection. + * @param index An integer value specifying the index of the menu item to remove. + */ + Remove(index: number): void; + /** + * Removes a menu item specified by its name. + * @param name A string value specifying the name property value of a menu item to remove from the collection. + */ + RemoveByName(name: string): void; + /** + * Adds the specified item to the specified position within the collection. + * @param index An integer value that specifies the zero-based index at which the specified item should be inserted. + * @param item An ASPxClientSpreadsheetPopupMenuItem object to insert. + */ + Insert(index: number, item: ASPxClientSpreadsheetPopupMenuItem): void; + /** + * Returns the total number of menu items in the collection. + */ + GetCount(): number; + /** + * Returns an item object with the specified name property value. + * @param name A string value representing the name property value of the required item. + */ + GetByName(name: string): ASPxClientSpreadsheetPopupMenuItem; + /** + * Returns a menu item specified by its index in the collection. + * @param index An integer value that is the zero-based index of the to retrieve from the ASPxClientSpreadsheetPopupMenuItemCollection. + */ + Get(index: number): ASPxClientSpreadsheetPopupMenuItem; + /** + * Removes all menu items from the collection. + */ + Clear(): void; +} /** * Represents the client ASPxTreeList. */ @@ -14839,6 +18486,10 @@ interface ASPxClientTreeList extends ASPxClientControl { * Occurs when a custom command button has been clicked. */ CustomButtonClick: ASPxClientEvent>; + /** + * Fires after a toolbar item has been clicked. + */ + ToolbarItemClick: ASPxClientEvent>; /** * Fires before the focused node has been changed. */ @@ -14899,6 +18550,16 @@ interface ASPxClientTreeList extends ASPxClientControl { * Gets the Popup Edit Form. */ GetPopupEditForm(): ASPxClientPopupControl; + /** + * Returns a toolbar specified by its name. + * @param name A string value specifying the toolbar name. + */ + GetToolbarByName(name: string): ASPxClientMenu; + /** + * Returns a toolbar specified by its index. + * @param index An integer value specifying the zero-based index of the toolbar object to retrieve. + */ + GetToolbar(index: number): ASPxClientMenu; /** * Returns the focused node's key value. */ @@ -15514,6 +19175,679 @@ interface ASPxClientTreeListColumnResizedEventHandler { */ (source: S, e: ASPxClientTreeListColumnResizedEventArgs): void; } +/** + * Provides data for the ToolbarItemClick event. + */ +interface ASPxClientTreeListToolbarItemClickEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the toolbar index related to the event. + * Value: An integer value that is the toolbar index. + */ + toolbarIndex: number; + /** + * Gets the toolbar item related to the event. + * Value: An ASPxClientMenuItem object that is the toolbar item. + */ + item: ASPxClientMenuItem; + /** + * Specifies whether a postback or a callback is used to finally process the event on the server side. + * Value: true to perform the round trip to the server side via postback; false to perform the round trip to the server side via callback. + */ + usePostBack: boolean; +} +/** + * A method that will handle the ToolbarItemClick event. + */ +interface ASPxClientTreeListToolbarItemClickEventHandler { + /** + * A method that will handle the ToolbarItemClick event. + * @param source The event source. + * @param e An ASPxClientTreeListToolbarItemClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListToolbarItemClickEventArgs): void; +} +/** + * Represents a client-side equivalent of the BootstrapAccordion control. + */ +interface BootstrapClientAccordion extends ASPxClientNavBar { +} +interface BootstrapClientBinaryImage extends ASPxClientHyperLink { +} +/** + * Represents a client-side equivalent of the BootstrapButton control. + */ +interface BootstrapClientButton extends ASPxClientButton { + /** + * Returns the text displayed within the button. + */ + GetText(): string; + /** + * Sets the text to be displayed within the button. + * @param value A string value specifying the text to be displayed within the button. + */ + SetText(value: string): void; +} +/** + * Represents a client-side equivalent of the BootstrapCalendar control. + */ +interface BootstrapClientCalendar extends ASPxClientCalendar { +} +/** + * Represents a client-side equivalent of the BootstrapCallbackPanel control. + */ +interface BootstrapClientCallbackPanel extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the BootstrapClientCallbackPanel. + */ + CallbackError: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Returns the HTML code that specifies the contents of the control's window. + */ + GetContentHtml(): string; + /** + * Sets the HTML markup specifying the contents of the control's window. + * @param html A string value that specifies the HTML markup. + */ + SetContentHtml(html: string): void; + /** + * Sets a value specifying whether the callback panel is enabled. + * @param enabled true, to enable the callback panel; false to disable it. + */ + SetEnabled(enabled: boolean): void; + /** + * Returns a value specifying whether a callback panel is enabled. + */ + GetEnabled(): boolean; +} +/** + * Serves as the base type for the BootstrapClientPieChart objects. + */ +interface BootstrapClientChartBase extends ASPxClientControl { + Done: ASPxClientEvent>; + LegendClick: ASPxClientEvent>; + PointClick: ASPxClientEvent>; + PointHoverChanged: ASPxClientEvent>; + PointSelectionChanged: ASPxClientEvent>; + TooltipHidden: ASPxClientEvent>; + TooltipShown: ASPxClientEvent>; + ArgumentAxisClick: ASPxClientEvent>; + SeriesClick: ASPxClientEvent>; + SeriesHoverChanged: ASPxClientEvent>; + SeriesSelectionChanged: ASPxClientEvent>; +} +/** + * Represents a client-side equivalent of the BootstrapChart control. + */ +interface BootstrapClientChart extends BootstrapClientChartBase { + ZoomStart: ASPxClientEvent>; + ZoomEnd: ASPxClientEvent>; +} +/** + * Represents a client-side equivalent of the BootstrapPolarChart control. + */ +interface BootstrapClientPolarChart extends BootstrapClientChartBase { +} +/** + * Represents a client-side equivalent of the BootstrapPieChart control. + */ +interface BootstrapClientPieChart extends BootstrapClientChartBase { +} +interface BootstrapClientChartBaseDoneEventHandler { + (source: S, e: BootstrapUIWidgetEventArgsBase): void; +} +interface BootstrapClientChartBaseLegendClickEventHandler { + (source: S, e: BootstrapUIWidgetElementClickEventArgs): void; +} +interface BootstrapClientCoordinateSystemChartArgumentAxisClickEventHandler { + (source: S, e: BootstrapUIWidgetElementClickEventArgs): void; +} +interface BootstrapClientChartBasePointClickEventHandler { + (source: S, e: BootstrapUIWidgetElementClickEventArgs): void; +} +interface BootstrapClientChartBasePointHoverChangedEventHandler { + (source: S, e: BootstrapUIWidgetElementActionEventArgs): void; +} +interface BootstrapClientChartBasePointSelectionChangedEventHandler { + (source: S, e: BootstrapUIWidgetElementActionEventArgs): void; +} +interface BootstrapClientChartBaseTooltipHiddenEventHandler { + (source: S, e: BootstrapUIWidgetElementActionEventArgs): void; +} +interface BootstrapClientChartBaseTooltipShownEventHandler { + (source: S, e: BootstrapUIWidgetElementActionEventArgs): void; +} +interface BootstrapClientCoordinateSystemChartSeriesClickEventHandler { + (source: S, e: BootstrapUIWidgetElementClickEventArgs): void; +} +interface BootstrapClientCoordinateSystemChartSeriesHoverChangedEventHandler { + (source: S, e: BootstrapUIWidgetElementActionEventArgs): void; +} +interface BootstrapClientCoordinateSystemChartSeriesSelectionChangedEventHandler { + (source: S, e: BootstrapUIWidgetElementActionEventArgs): void; +} +interface BootstrapClientChartZoomStartEventHandler { + (source: S, e: BootstrapUIWidgetEventArgsBase): void; +} +interface BootstrapClientChartZoomEndEventHandler { + (source: S, e: BootstrapClientChartZoomEndEventArgs): void; +} +interface BootstrapUIWidgetEventArgsBase extends ASPxClientEventArgs { + component: Object; + element: Object; +} +interface BootstrapClientChartZoomEndEventArgs extends BootstrapUIWidgetEventArgsBase { + rangeStart: Object; + rangeEnd: Object; +} +/** + * Represents a client-side equivalent of the BootstrapCheckBox control. + */ +interface BootstrapClientCheckBox extends ASPxClientEdit { + /** + * Occurs on the client side when the editor's checked state is changed. + */ + CheckedChanged: ASPxClientEvent>; + /** + * Returns a value indicating whether the check box editor is checked. + */ + GetChecked(): boolean; + /** + * Sets a value which specifies the checked status of the check box editor. + * @param isChecked + */ + SetChecked(isChecked: boolean): void; + /** + * Returns the text displayed within the editor. + */ + GetText(): string; + /** + * Returns a value which specifies a check box checked state. + */ + GetCheckState(): string; + /** + * Sets a value specifying the state of a check box. + * @param checkState + */ + SetCheckState(checkState: string): void; + /** + * Sets the text to be displayed within the editor. + * @param text + */ + SetText(text: string): void; +} +/** + * Represents a client-side equivalent of the BootstrapRadioButton control. + */ +interface BootstrapClientRadioButton extends BootstrapClientCheckBox { +} +/** + * Represents a client-side equivalent of the BootstrapComboBox control. + */ +interface BootstrapClientComboBox extends ASPxClientComboBox { + /** + * Returns the combo box editor's selected item. + */ + GetSelectedItem(): BootstrapClientListBoxItem; + /** + * Sets the combo box editor's selected item. + * @param item + */ + SetSelectedItem(item: BootstrapClientListBoxItem): void; + /** + * Returns an item specified by its index within the combo box editor's item collection. + * @param index + */ + GetItem(index: number): BootstrapClientListBoxItem; + /** + * Returns a combo box item by its text. + * @param text + */ + FindItemByText(text: string): BootstrapClientListBoxItem; + /** + * Returns a combo box item by its value. + * @param value + */ + FindItemByValue(value: Object): BootstrapClientListBoxItem; + /** + * Adds a new item to the editor, specifying the item's display text, and returns the index of the added item. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding fields within the editor's Fields collection. + */ + AddItem(texts: string[]): number; + /** + * Adds a new item to the end of the control's items collection. + * @param texts + * @param value + */ + AddItem(texts: string[], value: Object): number; + /** + * Adds a new item to the end of the control's items collection. + * @param texts + * @param value + * @param iconCssClass + */ + AddItem(texts: string[], value: Object, iconCssClass: string): number; + /** + * Adds a new item to the editor specifying the item's display text and returns the index of the added item. + * @param text + */ + AddItem(text: string): number; + /** + * Adds a new item to the editor specifying the item's display text and associated value, and returns the index of the added item. + * @param text + * @param value + */ + AddItem(text: string, value: Object): number; + /** + * Adds a new item to the editor specifying the item's display text, associated value and displayed image, and returns the index of the added item. + * @param text + * @param value + * @param iconCssClass + */ + AddItem(text: string, value: Object, iconCssClass: string): number; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index + * @param texts + * @param value + * @param iconCssClass + */ + InsertItem(index: number, texts: string[], value: Object, iconCssClass: string): void; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index + * @param texts + * @param value + */ + InsertItem(index: number, texts: string[], value: Object): void; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index + * @param texts + */ + InsertItem(index: number, texts: string[]): void; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index + * @param text + * @param value + * @param iconCssClass + */ + InsertItem(index: number, text: string, value: Object, iconCssClass: string): void; + /** + * Inserts a new item specified by its display text and associated value into the editor's item collection, at the position specified. + * @param index + * @param text + * @param value + */ + InsertItem(index: number, text: string, value: Object): void; + /** + * Inserts a new item specified by its display text into the editor's item collection, at the position specified. + * @param index + * @param text + */ + InsertItem(index: number, text: string): void; + /** + * Sets the list editor's selected item. + * @param item An ASPxClientListEditItem object that specifies the item to select. + */ + SetSelectedItem(item: ASPxClientListEditItem): void; +} +/** + * Represents a client-side equivalent of the BootstrapDateEdit control. + */ +interface BootstrapClientDateEdit extends ASPxClientDateEdit { +} +/** + * Represents a client-side equivalent of the BootstrapDropDownEdit control. + */ +interface BootstrapClientDropDownEdit extends ASPxClientDropDownEdit { +} +/** + * Represents a client-side equivalent of the BootstrapFormLayout control. + */ +interface BootstrapClientFormLayout extends ASPxClientFormLayout { +} +/** + * Represents a client-side equivalent of the BootstrapGridView control. + */ +interface BootstrapClientGridView extends ASPxClientGridView { +} +/** + * Represents a client-side equivalent of the BootstrapHyperLink control. + */ +interface BootstrapClientHyperLink extends ASPxClientHyperLink { +} +interface BootstrapClientImage extends ASPxClientImage { +} +/** + * Represents the client-side equivalent of the BootstrapListEditItem object. + */ +interface BootstrapClientListBoxItem extends ASPxClientListEditItem { + /** + * This member is not in effect for this class. It is overridden only for the purpose of preventing it from appearing in Microsoft Visual Studio designer tools. + */ + imageUrl: string; + iconCssClass: string; + /** + * + * @param columnIndex + */ + GetColumnText(columnIndex: number): string; + /** + * + * @param columnName + */ + GetColumnText(columnName: string): string; + /** + * + * @param fieldIndex + */ + GetFieldText(fieldIndex: number): string; + /** + * + * @param fieldName + */ + GetFieldText(fieldName: string): string; +} +/** + * Represents a client-side equivalent of the BootstrapListBox control. + */ +interface BootstrapClientListBox extends ASPxClientListBox { + /** + * Returns the list box editor's selected item. + */ + GetSelectedItem(): BootstrapClientListBoxItem; + /** + * Sets the list box editor's selected item. + * @param item + */ + SetSelectedItem(item: BootstrapClientListBoxItem): void; + /** + * Returns an item specified by its index within the list box editor's item collection. + * @param index + */ + GetItem(index: number): BootstrapClientListBoxItem; + /** + * Returns an array of the list editor's selected items. + */ + GetSelectedItems(): BootstrapClientListBoxItem[]; + /** + * Selects the specified items within a list box. + * @param items + */ + SelectItems(items: BootstrapClientListBoxItem[]): void; + /** + * Unselects an array of the specified list box items. + * @param items + */ + UnselectItems(items: BootstrapClientListBoxItem[]): void; + /** + * Returns a list box item by its text. + * @param text + */ + FindItemByText(text: string): BootstrapClientListBoxItem; + /** + * Returns a list box item by its value. + * @param value + */ + FindItemByValue(value: Object): BootstrapClientListBoxItem; + /** + * Adds a new item to the end of the editor's items collection, specifying the item's display text, and returns the index of the added item. + * @param texts + */ + AddItem(texts: string[]): number; + /** + * Adds a new item to the end of the control's items collection. + * @param texts + * @param value + */ + AddItem(texts: string[], value: Object): number; + /** + * Adds a new item to the end of the control's items collection. + * @param texts + * @param value + * @param iconCssClass + */ + AddItem(texts: string[], value: Object, iconCssClass: string): number; + /** + * Adds a new item to the editor, specifying the item's display text, and returns the index of the added item. + * @param text + */ + AddItem(text: string): number; + /** + * Adds a new item to the editor, specifying the item's display text and associated value, and returns the index of the added item. + * @param text + * @param value + */ + AddItem(text: string, value: Object): number; + /** + * Adds a new item to the editor, specifying the item's display text, associated value and displayed image, and returns the index of the added item. + * @param text + * @param value + * @param iconCssClass + */ + AddItem(text: string, value: Object, iconCssClass: string): number; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index + * @param texts + * @param value + * @param iconCssClass + */ + InsertItem(index: number, texts: string[], value: Object, iconCssClass: string): void; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index + * @param texts + * @param value + */ + InsertItem(index: number, texts: string[], value: Object): void; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index + * @param texts + */ + InsertItem(index: number, texts: string[]): void; + /** + * Inserts a new item specified by its display text, associated value and displayed image into the editor's item collection, at the position specified. + * @param index + * @param text + * @param value + * @param iconCssClass + */ + InsertItem(index: number, text: string, value: Object, iconCssClass: string): void; + /** + * Inserts a new item specified by its display text and associated value into the editor's item collection, at the position specified. + * @param index + * @param text + * @param value + */ + InsertItem(index: number, text: string, value: Object): void; + /** + * Inserts a new item specified by its display text into the editor's item collection, at the position specified. + * @param index + * @param text + */ + InsertItem(index: number, text: string): void; + /** + * Selects the specified items within a list box. + * @param items An array of ASPxClientListEditItem objects that represent the items. + */ + SelectItems(items: ASPxClientListEditItem[]): void; + /** + * Unselects an array of the specified list box items. + * @param items An array of ASPxClientListEditItem objects that represent the items. + */ + UnselectItems(items: ASPxClientListEditItem[]): void; + /** + * Sets the list editor's selected item. + * @param item An ASPxClientListEditItem object that specifies the item to select. + */ + SetSelectedItem(item: ASPxClientListEditItem): void; +} +/** + * Represents a client-side equivalent of the BootstrapCheckBoxList control. + */ +interface BootstrapClientCheckBoxList extends ASPxClientCheckBoxList { +} +/** + * Represents a client-side equivalent of the BootstrapRadioButtonList control. + */ +interface BootstrapClientRadioButtonList extends ASPxClientRadioButtonList { +} +/** + * Represents a client-side equivalent of the BootstrapMenu control. + */ +interface BootstrapClientMenu extends ASPxClientMenu { +} +/** + * Represents a client-side equivalent of the BootstrapPager control. + */ +interface BootstrapClientPager extends ASPxClientPager { +} +/** + * Represents a client-side equivalent of the BootstrapPopupControl control. + */ +interface BootstrapClientPopupControl extends ASPxClientPopupControl { + /** + * + * @param selector + */ + SetPopupElementCssSelector(selector: string): void; +} +/** + * Represents a client-side equivalent of the BootstrapPopupMenu control. + */ +interface BootstrapClientPopupMenu extends ASPxClientPopupMenu { + /** + * + * @param selector + */ + SetPopupElementCssSelector(selector: string): void; +} +/** + * Represents a client-side equivalent of the BootstrapProgressBar control. + */ +interface BootstrapClientProgressBar extends ASPxClientProgressBar { +} +/** + * Represents a client-side equivalent of the BootstrapSpinEdit control. + */ +interface BootstrapClientSpinEdit extends ASPxClientSpinEdit { +} +/** + * Represents a client-side equivalent of the BootstrapTabControl control. + */ +interface BootstrapClientTabControl extends ASPxClientTabControl { +} +/** + * Represents a client-side equivalent of the BootstrapPageControl control. + */ +interface BootstrapClientPageControl extends ASPxClientPageControl { +} +/** + * Represents a client-side equivalent of the BootstrapTextBox control. + */ +interface BootstrapClientTextBox extends ASPxClientTextBox { +} +/** + * Represents a client-side equivalent of the BootstrapMemo control. + */ +interface BootstrapClientMemo extends ASPxClientMemo { +} +/** + * Represents a client-side equivalent of the BootstrapButtonEdit control. + */ +interface BootstrapClientButtonEdit extends ASPxClientButtonEdit { +} +/** + * Represents a client-side equivalent of the BootstrapTreeView control. + */ +interface BootstrapClientTreeView extends ASPxClientTreeView { +} +interface BootstrapUIWidgetBase extends ASPxClientControl { + Init: ASPxClientEvent>; + Drawn: ASPxClientEvent>; + Disposing: ASPxClientEvent>; + OptionChanged: ASPxClientEvent>; + Exporting: ASPxClientEvent>; + Exported: ASPxClientEvent>; + FileSaving: ASPxClientEvent>; + IncidentOccurred: ASPxClientEvent>; + GetInstance(): Object; + SetOptions(options: Object): void; + ExportTo(format: string, fileName: string): void; + Print(): void; +} +interface BootstrapUIWidgetInitializedEventHandler { + (source: S, e: BootstrapUIWidgetEventArgsBase): void; +} +interface BootstrapUIWidgetDrawnEventHandler { + (source: S, e: BootstrapUIWidgetEventArgsBase): void; +} +interface BootstrapUIWidgetDisposingEventHandler { + (source: S, e: BootstrapUIWidgetEventArgsBase): void; +} +interface BootstrapUIWidgetExportedEventHandler { + (source: S, e: BootstrapUIWidgetEventArgsBase): void; +} +interface BootstrapUIWidgetOptionChangedEventHandler { + (source: S, e: BootstrapUIWidgetOptionChangedEventArgs): void; +} +interface BootstrapUIWidgetOptionChangedEventArgs extends BootstrapUIWidgetEventArgsBase { + fullName: string; + name: string; + previousValue: Object; + value: Object; +} +interface BootstrapUIWidgetExportingEventHandler { + (source: S, e: BootstrapUIWidgetExportEventArgs): void; +} +interface BootstrapUIWidgetFileSavingEventHandler { + (source: S, e: BootstrapUIWidgetExportEventArgs): void; +} +interface BootstrapUIWidgetExportEventArgs extends BootstrapUIWidgetEventArgsBase { + cancel: boolean; + data: Object; + fileName: string; + format: string; +} +interface BootstrapUIWidgetErrorEventHandler { + (source: S, e: BootstrapUIWidgetErrorEventArgs): void; +} +interface BootstrapUIWidgetErrorEventArgs extends BootstrapUIWidgetEventArgsBase { + target: Object; +} +interface BootstrapUIWidgetElementActionEventArgs extends BootstrapUIWidgetEventArgsBase { + target: Object; +} +interface BootstrapUIWidgetElementClickEventArgs extends BootstrapUIWidgetElementActionEventArgs { + jQueryEvent: Object; +} +/** + * Represents a client-side equivalent of the BootstrapUploadControl. + */ +interface BootstrapClientUploadControl extends ASPxClientUploadControl { +} /** * A client-side counterpart of the Calendar and CalendarFor extensions. */ @@ -15584,6 +19918,12 @@ interface MVCxClientCardView extends ASPxClientCardView { * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. */ PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing the specified argument to it. + * @param args A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side CustomDataCallback event. * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. @@ -15796,6 +20136,12 @@ interface MVCxClientGridView extends ASPxClientGridView { * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. */ PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing the specified argument to it. + * @param args A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side CustomDataCallback event. * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. @@ -16176,9 +20522,9 @@ interface MVCxClientSchedulerTemplateToolTip extends ASPxClientToolTipBase { */ interface MVCxClientSchedulerToolTipDisplayingEventHandler { /** - * - * @param source - * @param e + * A method that will handle the ToolTipDisplaying event. + * @param source An object which is the event source. Identifies the client object that raised the event. + * @param e A MVCxClientSchedulerToolTipDisplayingEventArgs object that contains the related arguments. */ (source: S, e: MVCxClientSchedulerToolTipDisplayingEventArgs): void; } @@ -16429,6 +20775,12 @@ interface MVCxClientVerticalGrid extends ASPxClientVerticalGrid { * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. */ PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing the specified argument to it. + * @param args A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side CustomDataCallback event. * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. @@ -16458,6 +20810,11 @@ interface ASPxClientControlBase { * Returns an HTML element that is the root of the control's hierarchy. */ GetMainElement(): Object; + /** + * Specifies the text that Assistive Technologies (screen readers or braille display, for example) will provide to a user. + * @param message A String value that specifies a text. + */ + SendMessageToAssistiveTechnology(message: string): void; /** * Returns a value specifying whether a control is displayed. */ @@ -16576,10 +20933,66 @@ interface ASPxClientCallbackCompleteEventArgs extends ASPxClientEventArgs { */ result: string; } +/** + * Serves as the base class for controls that implement panel functionality. + */ +interface ASPxClientPanelBase extends ASPxClientControl { + /** + * Returns the HTML code that is the content of the panel. + */ + GetContentHtml(): string; + /** + * Sets the HTML content for the panel. + * @param html A string value that is the HTML code defining the content of the panel. + */ + SetContentHtml(html: string): void; + /** + * Sets a value specifying whether the panel is enabled. + * @param enabled true to enable the panel; false to disable it. + */ + SetEnabled(enabled: boolean): void; + /** + * Returns a value specifying whether a panel is enabled. + */ + GetEnabled(): boolean; +} +/** + * Represents a client-side equivalent of the ASPxPanel control. + */ +interface ASPxClientPanel extends ASPxClientPanelBase { + /** + * Occurs when the expanded panel is closed. + */ + Collapsed: ASPxClientEvent>; + /** + * Occurs when an end-user opens the expand panel. + */ + Expanded: ASPxClientEvent>; + /** + * Expands or collapses the client panel. + */ + Toggle(): void; + /** + * Returns a value specifying whether the panel can be expanded. + */ + IsExpandable(): boolean; + /** + * Returns a value specifying whether the panel is expanded. + */ + IsExpanded(): boolean; + /** + * Expands the collapsed panel. + */ + Expand(): void; + /** + * Collapses the expanded panel. + */ + Collapse(): void; +} /** * Represents a client-side equivalent of the ASPxCallbackPanel control. */ -interface ASPxClientCallbackPanel extends ASPxClientControl { +interface ASPxClientCallbackPanel extends ASPxClientPanel { /** * Occurs when a callback for server-side processing is initiated. */ @@ -16721,6 +21134,16 @@ interface ASPxClientProcessingModeCancelEventArgs extends ASPxClientProcessingMo */ cancel: boolean; } +/** + * Provides access to an observable boolean, that allows you to detect and respond to changes. + */ +interface KnockoutObservableBoolean { +} +/** + * Provides access to observable arrays that allow you to detect and respond to changes in a collection of things. + */ +interface KnockoutObservableArray { +} /** * Represents a JavaScript function which receives callback data obtained via a call to a specific client method (such as the PerformDataCallback). */ @@ -16986,17 +21409,23 @@ interface ASPxClientControlsInitializedEventArgs extends ASPxClientEventArgs { */ isCallback: boolean; } +/** + * A JavaScript function which returns a value specifying whether an object meets the criteria defined within the method specified by this delegate. + */ interface ASPxClientControlPredicate { /** - * - * @param control + * A JavaScript function which returns a value specifying whether an object meets the criteria defined within the method specified by this delegate. + * @param control An object to compare against the criteria defined within the method. */ (control: Object): boolean; } +/** + * Represents a JavaScript function which receives the action to perform for a control when the client ForEachControl method is called. + */ interface ASPxClientControlAction { /** - * - * @param control + * Represents a JavaScript function which receives the action to perform for a control when the client ForEachControl method is called. + * @param control An object that specifies a control. */ (control: Object): void; } @@ -17585,7 +22014,7 @@ interface ASPxClientDockPanel extends ASPxClientPopupControlBase { */ MakeFloat(x: number, y: number): void; /** - * Gets or sets a value specifying the position of the current panel, amongst the visible panels within a zone. + * Gets a value specifying the position of the current panel, amongst the visible panels within a zone. */ GetVisibleIndex(): number; /** @@ -17855,6 +22284,10 @@ interface ASPxClientFileManager extends ASPxClientControl { * Occurs on the client side after upload of all selected files has been completed. */ FilesUploaded: ASPxClientEvent>; + /** + * Enables you to specify whether the selected file(s) are valid and provide an error text. + */ + FileUploadValidationErrorOccurred: ASPxClientEvent>; /** * Fires on the client side before a file download starts, and allows you to cancel the action. */ @@ -18892,6 +23325,229 @@ interface ASPxClientHiddenField extends ASPxClientControl { */ Contains(propertyName: string): boolean; } +/** + * Represents the client-side equivalent of the ASPxHint control. + */ +interface ASPxClientHint extends ASPxClientControl { + /** + * Occurs on the client side when a hint is about to be shown. + */ + Showing: ASPxClientEvent; + /** + * Occurs on the client side when a hint is about to be hidden. + */ + Hiding: ASPxClientEvent; + /** + * This method is not in effect for a ASPxClientHint object. + */ + GetMainElement(): Object; + /** + * Invokes a hint. + * @param targetElement A HTML DOM element near to which the hint is displayed in response to user interaction. + */ + Show(targetElement: Object): ASPxClientHintWindow; + /** + * Invokes a hint. + * @param targetSelector A string value that is the CSS selector used to specify for which UI elements on a web page a hint is displayed. + */ + Show(targetSelector: string): ASPxClientHintWindow; +} +/** + * Represents the client-side equivalent of the ASPxHint's window. + */ +interface ASPxClientHintWindow { + /** + * Forces the ASPxClientHint's window to recalculate its position. + */ + UpdatePosition(): void; +} +/** + * A method that will handle the Showing event. + */ +interface ASPxClientHintShowingEventHandler { + /** + * A method that will handle the Showing event. + * @param sender The event source. + * @param e A ASPxClientHintShowingEventArgs object that contains the required data. + */ + (sender: ASPxClientHintWindow, e: ASPxClientHintShowingEventArgs): void; +} +/** + * Provides data for the Showing event. + */ +interface ASPxClientHintShowingEventArgs extends ASPxClientEventArgs { + /** + * Gets the object that is the hint's target element. + * Value: An object representing the hint's target element related to the event. + */ + targetElement: Object; + /** + * Gets the object that is the hint. + * Value: An object representing the hint related to the event. + */ + hintElement: Object; + /** + * Gets the object that is the hint's content. + * Value: An object representing the hint's content element related to the event. + */ + contentElement: Object; + /** + * Gets the object that is the hint's title. + * Value: An object representing the hint's title element related to the event. + */ + titleElement: Object; +} +/** + * A method that will handle the Hiding event. + */ +interface ASPxClientHintHidingEventHandler { + /** + * A method that will handle the Hiding event. + * @param sender The event source. + * @param e A ASPxClientHintHidingEventArgs object that contains the required data. + */ + (sender: ASPxClientHintWindow, e: ASPxClientHintHidingEventArgs): void; +} +/** + * Provides data for the Hiding event. + */ +interface ASPxClientHintHidingEventArgs extends ASPxClientEventArgs { + /** + * Gets the object that is the hint's target element. + * Value: An object representing the hint's target element. + */ + targetElement: Object; + /** + * Gets the object that is the hint element. + * Value: An object representing the hint related to the event. + */ + hintElement: Object; + /** + * Gets the object that is the hint's content. + * Value: An object representing the hint's content element related to the event. + */ + contentElement: Object; + /** + * Gets the object that is the hint's title. + * Value: An object representing the hint's title element related to the event. + */ + titleElement: Object; + /** + * Gets or sets a value indicating whether the event should be canceled. + * Value: true, if the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * The hint control's options. + */ +interface ASPxClientHintOptions { + /** + * Gets or sets which user action triggers a hint. + * Value: A string value that is a user action. + */ + triggerAction: string; + /** + * Gets or sets the delay in displaying the hint. + * Value: An integer value that specifies the time interval, in milliseconds, after which a hint is displayed. + */ + appearAfter: number; + /** + * Gets or sets the duration after which a hint disappears when the mouse pointer is no longer positioned over the target element. + * Value: The length of time (in milliseconds) a hint is displayed after the mouse pointer is no longer positioned over the target element. + */ + disappearAfter: number; + /** + * Gets or sets a value that specifies whether a hint is displayed in a callout box. + * Value: true, to display a hint in a callout box; otherwise, false. + */ + showCallout: boolean; + /** + * Gets or sets where a hint should be positioned. + * Value: A string value that specifies a hint position. + */ + position: string; + /** + * Gets or sets a custom CSS class name that will be assigned to the root ASPxHint element. + * Value: A string value that is the CSS class name. + */ + className: string; + /** + * Gets or sets the attribute name. + * Value: A string value that is the attribute name. + */ + contentAttribute: string; + /** + * Gets or sets the attribute name. + * Value: A string value that is the attribute name. + */ + titleAttribute: string; + /** + * Gets or sets the hint's content. + * Value: A string value that is the hint's content. + */ + content: string; + /** + * Gets or sets a value that is the hint's title. + * Value: A string value that is the title text. + */ + title: string; + /** + * Gets or sets a value that is the HTML DOM-element. + * Value: A string that is the DOM-element. + */ + container: string; + /** + * A handler for the Showing event. + * Value: An delegate method allowing you to implement custom processing. + */ + onShowing: ASPxClientHintShowingEventHandler; + /** + * A handler for the Hiding event. + * Value: An delegate method allowing you to implement custom processing. + */ + onHiding: ASPxClientHintHidingEventHandler; + /** + * Gets or sets a value that is the hint's width. + * Value: A string value that is the hint's width. + */ + width: string; + /** + * Gets or sets a value that is the hint's height. + * Value: A string value that is the hint's height. + */ + height: string; + /** + * Gets or sets the X coordinate. + * Value: An integer value that is the X coordinate. + */ + x: number; + /** + * Gets or sets the Y coordinate. + * Value: An integer value that is the Y coordinate. + */ + y: number; + /** + * Gets or sets a value that specifies whether to flip the hint to the opposite position relative to the target element. + * Value: true, to flip the hint; otherwise, false. + */ + allowFlip: boolean; + /** + * Gets or sets a value that specifies whether to shift a hint if its content and title are hidden outside of the client area. + * Value: true, to shift the hint; otherwise, false. + */ + allowShift: boolean; + /** + * Gets or sets whether it should use animation effects when a hint appears. + * Value: true if animation is enabled; otherwise false. + */ + animation: any; + /** + * Gets the offset of a hint. + * Value: An integer value. + */ + offset: number; +} /** * The client-side equivalent of the ASPxImageGallery control. */ @@ -19163,6 +23819,20 @@ interface ASPxClientLoadingPanel extends ASPxClientControl { */ Hide(): void; } +/** + * Represents the client-side equivalent of the area that is used within the Html Editor's media dialogs. + */ +interface ASPxClientMediaFileSelector extends ASPxClientControl { + /** + * Returns a URL text from the URL text box in Html Editor's media dialogs. + */ + GetUrl(): string; + /** + * Sets a URL text in the Html Editor's media dialogs. + * @param url A string value that is the Url text. + */ + SetUrl(url: string): void; +} /** * Serves as the base type for the ASPxClientPopupMenu objects. */ @@ -19839,60 +24509,9 @@ interface ASPxClientFlashScriptCommandEventArgs extends ASPxClientEventArgs { interface ASPxClientOfficeDocumentLinkType { } /** - * Serves as the base class for controls that implement panel functionality. + * Represents the client-side equivalent of the ASPxPager control. */ -interface ASPxClientPanelBase extends ASPxClientControl { - /** - * Returns the HTML code that is the content of the panel. - */ - GetContentHtml(): string; - /** - * Sets the HTML content for the panel. - * @param html A string value that is the HTML code defining the content of the panel. - */ - SetContentHtml(html: string): void; - /** - * Sets a value specifying whether the panel is enabled. - * @param enabled true to enable the panel; false to disable it. - */ - SetEnabled(enabled: boolean): void; - /** - * Returns a value specifying whether a panel is enabled. - */ - GetEnabled(): boolean; -} -/** - * Represents a client-side equivalent of the ASPxPanel control. - */ -interface ASPxClientPanel extends ASPxClientPanelBase { - /** - * Occurs when the expanded panel is closed. - */ - Collapsed: ASPxClientEvent>; - /** - * Occurs when an end-user opens the expand panel. - */ - Expanded: ASPxClientEvent>; - /** - * Expands or collapses the client panel. - */ - Toggle(): void; - /** - * Returns a value specifying whether the panel can be expanded. - */ - IsExpandable(): boolean; - /** - * Returns a value specifying whether the panel is expanded. - */ - IsExpanded(): boolean; - /** - * Expands the collapsed panel. - */ - Expand(): void; - /** - * Collapses the expanded panel. - */ - Collapse(): void; +interface ASPxClientPager extends ASPxClientControl { } /** * Represents a client-side equivalent of the ASPxPopupControl control. @@ -21728,6 +26347,10 @@ interface ASPxClientUploadControl extends ASPxClientControl { * Occurs on the client side when the file input elements count is changed. */ FileInputCountChanged: ASPxClientEvent>; + /** + * Enables you to specify whether the selected file(s) are valid and provide an error text. + */ + ValidationErrorOccurred: ASPxClientEvent>; /** * Fires when the mouse enters a drop zone or an external drop zone element while dragging a file. */ @@ -21736,6 +26359,10 @@ interface ASPxClientUploadControl extends ASPxClientControl { * Fires when the mouse leaves a drop zone or an external drop zone element while dragging a file. */ DropZoneLeave: ASPxClientEvent>; + /** + * Specifies whether the upload control's Advanced mode is enabled. + */ + IsAdvancedModeEnabled(): boolean; /** * Initiates uploading of the specified file to the web server's memory. */ @@ -21754,6 +26381,16 @@ interface ASPxClientUploadControl extends ASPxClientControl { * @param fileIndex An integer value that is the zero-based index of an item in the file list. */ RemoveFileFromSelection(fileIndex: number): void; + /** + * Removes the specified file from the list of files selected for uploading in the upload control. + * @param file An ASPxClientUploadControl object that is the file to be removed from the list of files. + */ + RemoveFileFromSelection(file: ASPxClientUploadControlFile): void; + /** + * Returns files selected for uploading within the specified file input. + * @param inputIndex An integer value that specifies the index of a file input. Default value is "0". + */ + GetSelectedFiles(inputIndex: number): ASPxClientUploadControlFile[]; /** * Gets the text displayed within the edit box of the specified file input element. * @param index An integer value that specifies the required file input element's index. @@ -21973,6 +26610,112 @@ interface ASPxClientUploadControlUploadingProgressChangedEventArgs extends ASPxC */ progress: number; } +/** + * A method that will handle the ValidationErrorOccurred client event. + */ +interface ASPxClientUploadControlValidationErrorOccurredEventHandler { + /** + * A method that will handle the ValidationErrorOccurred event. + * @param source The event source. + * @param e An ASPxClientUploadControlValidationErrorOccurredEventArgs object that contains event data. + */ + (source: S, e: ASPxClientUploadControlValidationErrorOccurredEventArgs): void; +} +/** + * Provides data for the ValidationErrorOccurred event. + */ +interface ASPxClientUploadControlValidationErrorOccurredEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets the error text. + * Value: A string value that represents the error text. + */ + errorText: string; + /** + * Gets or sets a value specifying whether an alert message is displayed when the ValidationErrorOccurred event fires. + * Value: true, to display an alert message; otherwise, false. + */ + showAlert: boolean; + /** + * Gets the validation settings for the selected files. + * Value: An ASPxClientUploadControlValidationSettings object that provides validation settings. + */ + validationSettings: ASPxClientUploadControlValidationSettings; + /** + * Returns an array of invalid files. + * Value: An array of the ASPxClientUploadControlInvalidFileInfo objects. + */ + invalidFiles: ASPxClientUploadControlInvalidFileInfo[]; +} +/** + * Contains settings that relate to the ValidationErrorOccurred client event. + */ +interface ASPxClientUploadControlValidationSettings { + /** + * Gets the maximum file size. + * Value: An value that specifies the maximum file size, in bytes. + */ + maxFileSize: any; + /** + * Gets the maximum count of files that can be selected for uploading at once. + * Value: An integer value that specifies the maximum count of files. + */ + maxFileCount: number; + /** + * Gets the allowed file extensions. + * Value: An array of string values that contains file extensions that are allowed. + */ + allowedFileExtensions: string[]; + /** + * Gets which characters in a file name are not allowed. + * Value: An array of string values that contains characters that are not allowed. + */ + invalidFileNameCharacters: string[]; +} +/** + * Contains settings of the file that hasn't passed validation. + */ +interface ASPxClientUploadControlInvalidFileInfo { + /** + * Gets the name of the invalid file. + * Value: A string value that specifies the file name. + */ + fileName: string; + /** + * Gets the size of the invalid file. + * Value: An integer value that specifies the file size. + */ + fileSize: number; + /** + * Gets the error type. + * Value: An ASPxClientUploadControlValidationErrorTypeConsts object that provides possible types of errors. + */ + errorType: ASPxClientUploadControlValidationErrorTypeConsts; +} +/** + * Declares client constants containing codes of validation errors that can occur while selecting files for uploading. + */ +interface ASPxClientUploadControlValidationErrorTypeConsts { +} +/** + * Represents a client file that corresponds to a particular file selected for uploading in the upload control. + */ +interface ASPxClientUploadControlFile { + /** + * Gets the name of the file selected for uploading. + * Value: A string value that specifies the file's name. + */ + name: string; + /** + * Gets the size of the file selected for uploading. + * Value: An Int64 value specifying the file's size, in bytes. + */ + size: any; + /** + * Provides access to the file as a native Javascript object. + * Value: A JavaScript object that is the file selected for uploading. + */ + sourceFileObject: any; +} /** * A method that will handle the DropZoneEnter event. */ @@ -22919,6 +27662,12 @@ interface ASPxClientXYDiagram2D extends ASPxClientXYDiagramBase { * @param pane An ASPxClientXYDiagramPane object, representing the pane. */ DiagramToPoint(argument: Object, value: Object, axisX: ASPxClientAxis2D, axisY: ASPxClientAxis2D, pane: ASPxClientXYDiagramPane): ASPxClientControlCoordinates; + /** + * Shows the Crosshair Cursor at the point with the specified coordinates. + * @param screenX The horizontal coordinate that is related to the top-left angle of the chart. + * @param screenY The vertical coordinate that is related to the top-left angle of the chart. + */ + ShowCrosshair(screenX: number, screenY: number): void; } /** * Represents the client-side equivalent of the XYDiagram class. @@ -23941,6 +28690,16 @@ interface ASPxClientCrosshairOptions extends ASPxClientWebChartEmptyElement { * Value: A String, which represents the group header's pattern. */ groupHeaderPattern: string; + /** + * Gets a value that specifies whether the Crosshair cursor should show points that are out of visual range. + * Value: true if the out of visual range points should be shown in the Crosshair label; otherwise false. + */ + showOutOfRangePoints: boolean; + /** + * Gets the identifier specifying the behavior of the selection of points shown in the crosshair label. + * Value: The selection behavior identifier. + */ + valueSelectionMode: string; /** * Gets the color of a crosshair argument line. * Value: A String value, specifying the color of a crosshair argument line. @@ -24267,69 +29026,9 @@ interface ASPxClientQueryBuilderCustomizeToolbarActionsEventHandler { /** * A method that will handle the CustomizeToolbarActions event. * @param source The event sender. - * @param e An ASPxClientQueryBuilderCustomizeToolbarActionsEventArgs object that contains data related to the event. + * @param e An ASPxClientCustomizeMenuActionsEventArgs object that contains data related to the event. */ - (source: S, e: ASPxClientQueryBuilderCustomizeToolbarActionsEventArgs): void; -} -/** - * Provides settings to the actions listed in a Query Builder menu. - */ -interface ASPxClientQueryBuilderMenuAction { - /** - * Provides access to the text for the command. - * Value: A String value. - */ - text: string; - /** - * Provides access to the CSS class of the command's glyph. - * Value: A String value. - */ - imageClassName: string; - /** - * Provides access to the action performed when a Query Builder's button is clicked. - * Value: The specific action implementation. - */ - clickAction: Function; - /** - * Provides access to the value that specifies whether or not the command is disabled by default. - * Value: true, if the command is disabled by default; otherwise, false. - */ - disabled: boolean; - /** - * Provides access to the value that specifies whether or not the command is visible in the Query Builder user interface. - * Value: true if the command is visible; otherwise false. - */ - visible: boolean; - /** - * Provides access to the keyboard shortcut used to invoke the command. - * Value: A String value. - */ - hotKey: string; - /** - * Provides access to the value that specifies whether or not the command has a visual separator. - * Value: true, if the command has a visual separator; otherwise, false. - */ - hasSeparator: string; - /** - * Provides access to the location of the displayed command. - * Value: A String value. - */ - container: string; -} -/** - * Provides data for the CustomizeToolbarActions event. - */ -interface ASPxClientQueryBuilderCustomizeToolbarActionsEventArgs extends ASPxClientEventArgs { - /** - * Returns the collection of customized menu actions. - * Value: An ASPxClientQueryBuilderMenuAction array. - */ - Actions: ASPxClientQueryBuilderMenuAction[]; - /** - * Returns a menu action with the specified ID. - * @param actionId A String value, specifying the action ID. - */ - GetById(actionId: string): ASPxClientQueryBuilderMenuAction; + (source: S, e: ASPxClientCustomizeMenuActionsEventArgs): void; } /** * The client-side equivalent of the Web Report Designer control. @@ -24352,7 +29051,7 @@ interface ASPxClientReportDesigner extends ASPxClientControl { */ SaveCommandExecute: ASPxClientEvent>; /** - * Enables you to customize the menu actions of a Web Report Designer. + * Enables you to customize the menu actions of the Web Report Designer. */ CustomizeMenuActions: ASPxClientEvent>; /** @@ -24367,6 +29066,78 @@ interface ASPxClientReportDesigner extends ASPxClientControl { * Occurs on the client side when the Report Designer is being closed. */ ExitDesigner: ASPxClientEvent>; + /** + * Occurs when a report is about to be saved in the Web Report Designer. + */ + ReportSaving: ASPxClientEvent>; + /** + * Occurs when a report has been saved in the Web Report Designer. + */ + ReportSaved: ASPxClientEvent>; + /** + * Occurs when a report is about to be opened in the Web Report Designer. + */ + ReportOpening: ASPxClientEvent>; + /** + * Occurs when a report has been opened in the Web Report Designer. + */ + ReportOpened: ASPxClientEvent>; + /** + * Occurs on the client each time a server-side error raises. + */ + OnServerError: ASPxClientEvent>; + /** + * Occurs after a component has been added to the report currently being edited in the Web Report Designer. + */ + ComponentAdded: ASPxClientEvent>; + /** + * Enables you to customize UI elements of the Web Report Designer. + */ + CustomizeElements: ASPxClientEvent>; + /** + * Enables you to customize the Save dialog of the Web Report Designer. + */ + CustomizeSaveDialog: ASPxClientEvent>; + /** + * Enables you to customize the Save Report dialog of the Web Report Designer. + */ + CustomizeSaveAsDialog: ASPxClientEvent>; + /** + * Enables you to customize the Open Report dialog of the Web Report Designer. + */ + CustomizeOpenDialog: ASPxClientEvent>; + /** + * Enables you to customize the Toolbox of the Web Report Designer. + */ + CustomizeToolbox: ASPxClientEvent>; + /** + * Occurs after a report has been switched to Print Preview. + */ + PreviewDocumentReady: ASPxClientEvent>; + /** + * Occurs each time a value of an editing field changes in Print Preview. + */ + PreviewEditingFieldChanged: ASPxClientEvent>; + /** + * Enables you to customize UI elements of a Document Viewer built into a Web Report Designer. + */ + PreviewCustomizeElements: ASPxClientEvent>; + /** + * Enables you to customize the actions of a Document Viewer built into a Web Report Designer. + */ + PreviewCustomizeMenuActions: ASPxClientEvent>; + /** + * Occurs when the left mouse button has been clicked over a report document in Print Preview. + */ + PreviewClick: ASPxClientEvent>; + /** + * Occurs after report parameter values have been reset to their default values in Print Preview. + */ + PreviewParametersReset: ASPxClientEvent>; + /** + * Occurs after report parameter values have been submitted in Print Preview. + */ + PreviewParametersSubmitted: ASPxClientEvent>; /** * Sends a callback to the server with the specified argument. * @param arg A String value, specifying the callback argument. @@ -24387,16 +29158,30 @@ interface ASPxClientReportDesigner extends ASPxClientControl { * Returns the object model of a Web Report Designer. */ GetDesignerModel(): Object; + /** + * Provides access to the preview model of the ASPxClientReportDesigner. + */ + GetPreviewModel(): Object; + /** + * Returns information about the specified property of the specified control. + * @param controlType A string that specifies the control type. + * @param path A string that specifies the path to the property. + */ + GetPropertyInfo(controlType: string, path: string): ASPxDesignerElementSerializationInfo; + /** + * Returns information about the specified properties of the specified control. + * @param controlType A string that specifies the control type. + * @param path An array of strings that specify paths to properties. + */ + GetPropertyInfo(controlType: string, path: string[]): ASPxDesignerElementSerializationInfo; + /** + * Returns actions performed by buttons available in the menu and toolbar of the Web Report Designer. + */ + GetButtonStorage(): Object; /** * Gets a client-side model of the currently opened report serialized to Json. */ GetJsonReportModel(): string; - /** - * Returns serialization information for the specific property of the specific control type. - * @param controlType A string that identifies the name of the control type for which serialization information is to be returned. - * @param propertyDisplayName A string that identifies the name of the property for which serialization information is to be returned. - */ - GetPropertyInfo(controlType: string, propertyDisplayName: string): ASPxDesignerElementSerializationInfo; /** * Indicates whether or not the current ASPxClientReportDesigner instance has been modified. */ @@ -24405,6 +29190,76 @@ interface ASPxClientReportDesigner extends ASPxClientControl { * Resets the value returned by the IsModified method. */ ResetIsModified(): void; + /** + * Adds a custom property to the Properties Panel. + * @param groupName A string that specifies the name of group to which a property should be added. + * @param property An object that provides information required to serialize a property. + */ + AddToPropertyGrid(groupName: string, property: ASPxDesignerElementSerializationInfo): void; + /** + * Adds a custom parameter type to the Web End-User Report Designer. + * @param parameterInfo An object that provides information about a parameter type to be added. + * @param editorOptions An object that provides information about an editor used to specify parameter values in design mode. + */ + AddParameterType(parameterInfo: ASPxDesignerParameterType, editorOptions: ASPxDesignerEditorOptions): void; + /** + * Removes the specified parameter type from the Web End-User Report Designer. + * @param parameterType A string that specifies a parameter type to be deleted. + */ + RemoveParameterType(parameterType: string): void; + /** + * Returns an object that contains information on the specified parameter type. + * @param parameterType A string that specifies a parameter type. + */ + GetParameterInfo(parameterType: string): ASPxDesignerParameterType; + /** + * Returns a value editor associated with the specified parameter type. + * @param parameterType A string that specifies a parameter type. + */ + GetParameterEditor(parameterType: string): ASPxDesignerEditorOptions; + /** + * Returns the report layout stored in a report storage under the specified URL. + * @param url A string that specifies the report URL. + */ + ReportStorageGetData(url: string): any; + /** + * Stores the specified report to a report storage using the specified URL. + * @param reportLayout A string that specifies the report layout to be saved. + * @param url A string that specifies the URL used to save a report. + */ + ReportStorageSetData(reportLayout: string, url: string): any; + /** + * Stores the specified report to a report storage using a new URL. + * @param reportLayout A string that specifies the report layout to be saved. + * @param url A string that specifies the default report URL. + */ + ReportStorageSetNewData(reportLayout: string, url: string): any; + /** + * Saves the current report. + */ + SaveReport(): any; + /** + * Closes the report tab currently being opened in the Web Report Designer. + */ + CloseCurrentTab(): void; + /** + * Saves the current report under a new name. + * @param reportName A string that specifies the report name. + */ + SaveNewReport(reportName: string): any; + /** + * Returns the report URLs and display names existing in a report storage. + */ + ReportStorageGetUrls(): any; + /** + * Opens the specified report on the client side of the Web Report Designer. + * @param url A string that specifies the URL of a report to be opened. + */ + OpenReport(url: string): void; + /** + * Switches the Web Report Designer to the preview mode. + */ + ShowPreview(): void; } /** * A method that will handle the SaveCommandExecute event. @@ -24427,6 +29282,114 @@ interface ASPxClientReportDesignerSaveCommandExecuteEventArgs extends ASPxClient */ handled: boolean; } +/** + * Provides data for the ExitDesigner event. + */ +interface ASPxClientReportDesignerExitDesignerEventArgs extends ASPxClientEventArgs { +} +/** + * Provides data for the events related to opening and saving reports in the Web Report Designer. + */ +interface ASPxClientReportDesignerDialogEventArgs extends ASPxClientEventArgs { + /** + * Specifies the URL of the report currently being processed. + * Value: A string that specifies the URL of the report currently being processed. + */ + Url: string; + /** + * Specifies the report currently being processed. + * Value: An object that specifies the report currently being processed. + */ + Report: Object; + /** + * Specifies whether or not the operation performed with a report should be canceled. + * Value: true, if the operation should be canceled; otherwise, false. + */ + Cancel: boolean; +} +/** + * Provides data for the OnServerError event. + */ +interface ASPxClientReportDesignerErrorEventArgs extends ASPxClientEventArgs { + /** + * Provides access to information about a server-side error. + * Value: An object that provides information about an error. + */ + Error: Object; +} +/** + * Provides data for the ComponentAdded event. + */ +interface ASPxClientReportDesignerComponentAddedEventArgs extends ASPxClientEventArgs { + /** + * Gets the model of a component that has been added to a report. + * Value: An object that specifies the component model. + */ + Model: Object; + /** + * Gets the parent of a component that has been added to a report. + * Value: An object that specifies the component parent. + */ + Parent: Object; +} +/** + * Provides data for the CustomizeSaveDialog event. + */ +interface ASPxClientReportDesignerCustomizeSaveDialogEventArgs extends ASPxClientEventArgs { + /** + * Provides access to the Save dialog. + * Value: An object that specifies the Save dialog. + */ + Popup: ASPxDesignerSaveDialog; + /** + * Customizes the Save dialog based on the specified template and model. + * @param template A string that specifies the name of an HTML template for the dialog. + * @param model A model of the Save dialog. + */ + Customize(template: string, model: ASPxDesignerDialogModel): void; +} +/** + * Provides data for the CustomizeSaveAsDialog event. + */ +interface ASPxClientReportDesignerCustomizeSaveAsDialogEventArgs extends ASPxClientEventArgs { + /** + * Provides access to the Save Report dialog. + * Value: An object that specifies the Save Report dialog. + */ + Popup: ASPxDesignerSaveAsDialog; + /** + * Customizes the Save Report dialog based on the specified template and model. + * @param template A string that specifies the name of an HTML template for the dialog. + * @param model A model of the Save Report dialog. + */ + Customize(template: string, model: ASPxDesignerDialogModel): void; +} +/** + * Provides data for the CustomizeOpenDialog event. + */ +interface ASPxClientReportDesignerCustomizeOpenDialogEventArgs extends ASPxClientEventArgs { + /** + * Provides access to the Open Report dialog. + * Value: An object that specifies the Open Report dialog. + */ + Popup: ASPxDesignerOpenDialog; + /** + * Customizes the Open Report dialog based on the specified template and model. + * @param template A string that specifies the name of an HTML template for the dialog. + * @param model A model of the Open Report dialog. + */ + Customize(template: string, model: ASPxDesignerDialogModel): void; +} +/** + * Provides data for the CustomizeToolbox event. + */ +interface ASPxClientReportDesignerCustomizeToolboxEventArgs extends ASPxClientEventArgs { + /** + * Provides information about all controls available in the Toolbox. + * Value: An ASPxDesignerControlsFactory object that provides information about toolbox controls. + */ + ControlsFactory: ASPxDesignerControlsFactory; +} /** * A method that will handle the CustomizeMenuActions event. */ @@ -24434,76 +29397,19 @@ interface ASPxClientReportDesignerCustomizeMenuActionsEventHandler { /** * A method that will handle the CustomizeMenuActions event. * @param source The event sender. - * @param e An ASPxClientReportDesignerCustomizeMenuActionsEventArgs object that contains data related to the event. + * @param e An ASPxClientCustomizeMenuActionsEventArgs object that contains data related to the event. */ - (source: S, e: ASPxClientReportDesignerCustomizeMenuActionsEventArgs): void; + (source: S, e: ASPxClientCustomizeMenuActionsEventArgs): void; } /** - * Provides settings to the actions listed in a Web Report Designer menu. + * A method that will handle the CustomizeParameterLookUpSource event. */ -interface ASPxClientReportDesignerMenuAction { - /** - * Provides access to the text for the command. - * Value: A String value. - */ - text: string; - /** - * Provides access to the CSS class of the command's glyph. - * Value: A String value. - */ - imageClassName: string; - /** - * Provides access to the action performed when a Web Report Designer's button is clicked. - * Value: The specific action implementation. - */ - clickAction: Function; - /** - * Provides access to the value that specifies whether or not the command is disabled by default. - * Value: true, if the command is disabled by default; otherwise, false. - */ - disabled: boolean; - /** - * Provides access to the value that specifies whether or not the command is visible in the designer user interface. - * Value: true if the command is visible; otherwise false. - */ - visible: boolean; - /** - * Provides access to the keyboard shortcut used to invoke the command. - * Value: A String value. - */ - hotKey: string; - /** - * Provides access to the value that specifies whether or not the command has a visual separator. - * Value: true, if the command has a visual separator; otherwise, false. - */ - hasSeparator: string; - /** - * Provides access to the location of the displayed command. - * Value: A String value. - */ - container: string; -} -/** - * Provides data for the CustomizeMenuActions event. - */ -interface ASPxClientReportDesignerCustomizeMenuActionsEventArgs extends ASPxClientEventArgs { - /** - * Returns the collection of customized menu actions. - * Value: An ASPxClientReportDesignerMenuAction array. - */ - Actions: ASPxClientReportDesignerMenuAction[]; - /** - * Returns a menu action with the specified ID. - * @param actionId A String value, specifying the action ID. - */ - GetById(actionId: string): ASPxClientReportDesignerMenuAction; -} -/** - * Provides data for the ExitDesigner event. - */ -interface ASPxClientReportDesignerExitDesignerEventArgs extends ASPxClientEventArgs { -} interface ASPxClientReportDesignerCustomizeParameterLookUpSourceEventHandler { + /** + * A method that will handle the CustomizeParameterLookUpSource event. + * @param source The event sender. + * @param e An ASPxClientCustomizeParameterLookUpSourceEventArgs object that contains data related to the event. + */ (source: S, e: ASPxClientCustomizeParameterLookUpSourceEventArgs): void; } /** @@ -24517,6 +29423,17 @@ interface ASPxClientReportDesignerCustomizeParameterEditorsEventHandler { */ (source: S, e: ASPxClientCustomizeParameterEditorsEventArgs): void; } +/** + * A method that will handle the CustomizeElements event. + */ +interface ASPxClientReportDesignerCustomizeElementsEventHandler { + /** + * A method that will handle the CustomizeElements event. + * @param source The event sender. + * @param e An ASPxClientCustomizeElementsEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientCustomizeElementsEventArgs): void; +} /** * A method that will handle the ExitDesigner event. */ @@ -24528,6 +29445,422 @@ interface ASPxClientReportDesignerExitDesignerEventHandler { */ (source: S, e: ASPxClientReportDesignerExitDesignerEventArgs): void; } +/** + * A method that will handle the ReportSaving event. + */ +interface ASPxClientReportDesignerReportSavingEventHandler { + /** + * A method that will handle the ReportSaving event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerDialogEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerDialogEventArgs): void; +} +/** + * A method that will handle the ReportSaved event. + */ +interface ASPxClientReportDesignerReportSavedEventHandler { + /** + * A method that will handle the ReportSaved event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerDialogEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerDialogEventArgs): void; +} +/** + * A method that will handle the ReportOpening event. + */ +interface ASPxClientReportDesignerReportOpeningEventHandler { + /** + * A method that will handle the ReportOpening event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerDialogEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerDialogEventArgs): void; +} +/** + * A method that will handle the ReportOpened event. + */ +interface ASPxClientReportDesignerReportOpenedEventHandler { + /** + * A method that will handle the ReportOpened event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerDialogEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerDialogEventArgs): void; +} +/** + * A method that will handle the OnServerError event. + */ +interface ASPxClientReportDesignerErrorEventHandler { + /** + * A method that will handle the OnServerError event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerErrorEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerErrorEventArgs): void; +} +/** + * A method that will handle the ComponentAdded event. + */ +interface ASPxClientReportDesignerComponentAddedEventHandler { + /** + * A method that will handle the ComponentAdded event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerComponentAddedEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerComponentAddedEventArgs): void; +} +/** + * A method that will handle the CustomizeSaveDialog event. + */ +interface ASPxClientReportDesignerCustomizeSaveDialogEventHandler { + /** + * A method that will handle the CustomizeSaveDialog event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerCustomizeSaveDialogEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerCustomizeSaveDialogEventArgs): void; +} +/** + * A method that will handle the CustomizeSaveAsDialog event. + */ +interface ASPxClientReportDesignerCustomizeSaveAsDialogEventHandler { + /** + * A method that will handle the CustomizeSaveAsDialog event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerCustomizeSaveAsDialogEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerCustomizeSaveAsDialogEventArgs): void; +} +/** + * A method that will handle the CustomizeOpenDialog event. + */ +interface ASPxClientReportDesignerCustomizeOpenDialogEventHandler { + /** + * A method that will handle the CustomizeOpenDialog event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerCustomizeOpenDialogEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerCustomizeOpenDialogEventArgs): void; +} +/** + * A method that will handle the CustomizeToolbox event. + */ +interface ASPxClientReportDesignerCustomizeToolboxEventHandler { + /** + * A method that will handle the CustomizeToolbox event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerCustomizeToolboxEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerCustomizeToolboxEventArgs): void; +} +/** + * Provides information about a value editor used in the Property Grid. + */ +interface ASPxDesignerEditorOptions { + /** + * Provides access to the name of an HTML template specifying the editor and header of a complex object. + * Value: A string that specifies the HTML template. + */ + header: string; + /** + * Provides access to the name of an HTML template used by a complex object's editor. + * Value: A string that specifies the name of an HTML template. + */ + content: string; + /** + * Provides access to the type of the editor model. + * Value: An object that specifies the editor type. + */ + editorType: Object; +} +/** + * Provides functionality to an undo/redo engine in the Web Report Designer. + */ +interface ASPxDesignerUndoEngine { + /** + * Provides access to a value that specifies whether or not the redo action can currently be performed. + * Value: A knockout observable boolean object, whose value is true if the redo action can be performed, and false otherwise. + */ + redoEnabled: any; + /** + * Provides access to a value that specifies whether or not the undo action can currently be performed. + * Value: A knockout observable boolean object, whose value is true if the undo action can be performed, and false otherwise. + */ + undoEnabled: any; + /** + * Provides access to a value that specifies whether or not a report has been changed. + * Value: A knockout observable boolean object, whose value is true if the report has been modified, and false otherwise. + */ + isDirty: any; + /** + * Undoes all changes made to a report. + */ + undoAll(): void; + /** + * Clears information about edit operations made to a report, so they cannot not be undone. + */ + clearHistory(): void; + /** + * Undoes the last edit action in a report. + */ + undo(): void; + /** + * Reverses the results of the last undo action. + */ + redo(): void; +} +/** + * Provides functionality for a tab displayed a report in the Web Report Designer. + */ +interface ASPxDesignerNavigateTab { + /** + * Provides access to a value that specifies the display name of the current tab. + * Value: A knockout computed string that specifies the tab's display name. + */ + displayName: any; + /** + * Provides access to a value that specifies whether or not the report in the current tab has been changed. + * Value: A knockout computed boolean object, whose value is true if the report has been modified, and false otherwise. + */ + isDirty: any; + /** + * Provides access to a report opened in the current tab. + * Value: A knockout observable object that specifies a report opened in the current tab. + */ + report: any; + /** + * Provides access to an engine that manages undo and redo operations in the Web Report Designer. + * Value: An object that specifies an undo/redo engine. + */ + undoEngine: ASPxDesignerUndoEngine; + /** + * Provides access to the URL of a report opened in the current tab. + * Value: A knockout observable string that specifies the report URL. + */ + url: any; +} +/** + * A model of dialogs used to save and open reports in the Web Report Designer. + */ +interface ASPxDesignerDialogModel { + /** + * Provides access to the collection of buttons displayed in a dialog. + * Value: An array of objects that specify buttons displayed in a dialog. + */ + popupButtons: Object[]; + /** + * Specifies a function that gets the report URL. + */ + getUrl(): string; + /** + * Specifies a function that sets the report URL. + * @param url A string that specifies the report URL. + */ + setUrl(url: string): void; + /** + * Specifies a function to be executed when showing a dialog. + * @param tab An object that specifies the report tab for which a dialog is invoked. + */ + onShow(tab: ASPxDesignerNavigateTab): void; +} +/** + * Provides the base functionality for dialogs used to open and save reports on the client side of the Web Report Designer. + */ +interface ASPxDesignerReportDialogBase { + /** + * Provides access to a dialog's width. + * Value: A knockout observable object that specifies a dialog's width. + */ + width: any; + /** + * Provides access to a dialog's height. + * Value: A knockout observable object that specifies a dialog's height. + */ + height: any; + /** + * Provides access to the name of an HTML template used by a dialog. + * Value: A knockout observable string that specifies the name of the HTML template used by a dialog. + */ + template: any; + /** + * Provides access to buttons displayed in a dialog. + * Value: An array of objects that specify buttons displayed in the dialog. + */ + buttons: Object[]; + /** + * Provides access to a dialog's model. + * Value: A knockout observable object of the ASPxDesignerDialogModel type. + */ + model: any; + /** + * Provides access to a report tab for which a dialog appears. + * Value: A knockout observable object of the ASPxDesignerNavigateTab type. + */ + tab: any; + /** + * Provides access to a value that specifies a dialog's visibility state. + * Value: true, if the dialog is visible; otherwise, false; + */ + visible: any; + /** + * Provides access to a dialog's title. + * Value: A string that specifies a dialog's title. + */ + title: string; + /** + * Shows the dialog for the specified report tab. + * @param tab A report tab for which the dialog should be shown. + */ + show(tab: ASPxDesignerNavigateTab): void; + /** + * Customizes the dialog based on the specified template and model. + * @param template A string that specifies the name of an HTML template for the dialog. + * @param model An object that specifies the dialog model. + */ + customize(template: string, model: ASPxDesignerDialogModel): void; + /** + * Cancels the dialog. + */ + cancel(): void; +} +/** + * Provides functionality for the Save dialog on the client side of the Web Report Designer. + */ +interface ASPxDesignerSaveDialog extends ASPxDesignerReportDialogBase { + /** + * Provides access to the Save Report dialog that appears if a user selected to save changes in the Save dialog. + * Value: An object that specifies the Save As dialog. + */ + saveReportDialog: ASPxDesignerSaveAsDialog; + /** + * Saves the report with the specified URL. + * @param url A string that specifies an URL of the report to be saved. + */ + save(url: string): void; + /** + * Closes the dialog without saving the current report. + */ + notSave(): void; +} +/** + * Provides functionality for the Save Report dialog on the client side of the Web Report Designer. + */ +interface ASPxDesignerSaveAsDialog extends ASPxDesignerReportDialogBase { + /** + * Saves the report with the specified URL. + * @param url A string that specifies a URL of the report to be saved. + */ + save(url: string): void; +} +/** + * Provides functionality for the Open Report dialog on the client side of the Web Report Designer. + */ +interface ASPxDesignerOpenDialog extends ASPxDesignerReportDialogBase { + /** + * Opens the report with the specified URL. + * @param url A string that specifies an URL of the report to be opened. + */ + open(url: string): void; +} +/** + * Provides information about a toolbox control item. + */ +interface ASPxDesignerToolboxItem { + /** + * Provides access to information required to serialize a toolbox control. + * Value: An array of ASPxDesignerElementSerializationInfo objects that provide information required to serialize an element. + */ + info: ASPxDesignerElementSerializationInfo[]; + /** + * Provides access to a surface type of toolbox control. + * Value: A surface type of toolbox control. + */ + surfaceType: any; + /** + * Provides access to a toolbox control type. + * Value: A toolbox control type. + */ + type: any; + /** + * Provides access to a zero-based index of a control in the toolbox. + * Value: An integer value that specifies a control index in the toolbox. + */ + toolboxIndex: number; + /** + * Provides access to the default property values used for a toolbox control. + * Value: An object that specifies default propery values. + */ + defaultVal: Object; + /** + * Provides access to popular properties of a toolbox control. + * Value: An array of strings that specify names of popular properties. + */ + popularProperties: string[]; + /** + * Gets whether a control item is displayed in a toolbox. + * Value: true, if the control is available in the toolbox; otherwise, false. + */ + isToolboxItem: boolean; +} +/** + * Enables you to customize controls available in the Toolbox of the Web Report Designer. + */ +interface ASPxDesignerControlsFactory { + /** + * Returns information about the specified toolbox control. + * @param controlType A string that specifies the control type. + */ + getControlInfo(controlType: string): ASPxDesignerToolboxItem; + /** + * Returns a control type by the specified model. + * @param model An object that specifies the control model. + */ + getControlType(model: Object): string; + /** + * Registers the specified control in the Toolbox of the Web Report Designer. + * @param typeName A string that specifies the name of a custom control. + * @param metadata An ASPxDesignerToolboxItem object that provides information about a toolbox item. + */ + registerControl(typeName: string, metadata: ASPxDesignerToolboxItem): void; + /** + * Returns information about the specified property of the specified control. + * @param controlType A string that specifies the control type. + * @param propertyDisplayName A string that specifies the property display name. + */ + getPropertyInfo(controlType: string, propertyDisplayName: string): ASPxDesignerElementSerializationInfo; +} +/** + * Provides information about a report parameter type. + */ +interface ASPxDesignerParameterType { + /** + * Provides access to an actual parameter type. + * Value: A string that specifies the parameter type. + */ + value: string; + /** + * Provides access to a text displayed to end-users when creating parameters of the current type. + * Value: A string displayed to end-users. + */ + displayValue: string; + /** + * Provides access to the default value for parameters of the current type. + * Value: An object that specifies the default value. + */ + defaultVal: Object; + /** + * Provides access to the specifics of a current parameter type. + * Value: Parameter type specifics. + */ + specifics: string; + /** + * Converts the specified parameter value to the current parameter type. + * @param val An object that specifies the parameter value to be converted. + */ + valueConverter(val: Object): Object; +} /** * The client-side equivalent of the ASPxClientDocumentViewer control's Document Map. */ @@ -24562,8 +29895,19 @@ interface ASPxClientReportParametersPanel extends ASPxClientControl { */ GetEditorByParameterName(parameterName: string): ASPxClientControl; } +/** + * Provides information about a report parameter on the client side. + */ interface ASPxClientReportParameterInfo { + /** + * Specifies the parameter path, relative to its parent container (e.g., "subreport1.subreportParameter1" for a subreport's parameter, or "parameter1" for a report's parameter). + * Value: A String value, specifying the parameter path (e.g., "subreport1.subreportParameter1"). + */ Path: string; + /** + * Provides access to a parameter value on the client. + * Value: A Object value. + */ Value: Object; } /** @@ -24638,11 +29982,19 @@ interface ASPxClientReportViewer extends ASPxClientControl { */ IsSearchAllowed(): boolean; } +/** + * A method that will handle the PageLoad events. + */ interface ASPxClientReportViewerPageLoadEventHandler { + /** + * A method that will handle the PageLoad event. + * @param source The event sender. + * @param e An ASPxClientReportViewerPageLoadEventArgs object that contains data related to the event. + */ (source: S, e: ASPxClientReportViewerPageLoadEventArgs): void; } /** - * Provides data for a Report Viewer's PageLoad event on the client side. + * Provides data for the PageLoad events on the client side. */ interface ASPxClientReportViewerPageLoadEventArgs extends ASPxClientEventArgs { /** @@ -24679,11 +30031,116 @@ interface ASPxClientCustomizeParameterEditorsEventArgs extends ASPxClientEventAr */ info: ASPxDesignerElementSerializationInfo; } +/** + * Provides data for the CustomizeParameterLookUpSource events. + */ interface ASPxClientCustomizeParameterLookUpSourceEventArgs extends ASPxClientEventArgs { + /** + * Provides access to an object that stores information about a parameter. + * Value: An ASPxDesignerElementParameterDescriptor object that stores information about the parameter. + */ parameter: ASPxDesignerElementParameterDescriptor; + /** + * Provides access to the collection of look-up parameter values. + * Value: An array of ASPxDesignerElementEditorItem objects that store information about look-up parameter values. + */ items: ASPxDesignerElementEditorItem[]; + /** + * Specifies the data source that provides look-up values for the parameter editor. + * Value: An Object specifying the data source that provides look-up values to the parameter editor. + */ dataSource: Object; } +/** + * Provides information about a command available in the toolbar or menu. + */ +interface ASPxClientMenuAction { + /** + * Provides access to the text for the command. + * Value: A string that is the command text. + */ + text: string; + /** + * Provides access to the CSS class of the command's glyph. + * Value: A string that specifies the name of the CSS class. + */ + imageClassName: string; + /** + * Provides access to the action performed when a button is clicked. + * Value: The specific action implementation. + */ + clickAction: Function; + /** + * Provides access to the value that specifies whether or not the command is disabled by default. + * Value: true, if the command is disabled by default; otherwise, false. + */ + disabled: boolean; + /** + * Provides access to the value that specifies whether or not the command is visible in the user interface. + * Value: true if the command is visible; otherwise false. + */ + visible: boolean; + /** + * Provides access to the keyboard shortcut used to invoke the command. + * Value: An ASPxClientMenuActionHotKey object that specifies the keyboard shortcut. + */ + hotKey: ASPxClientMenuActionHotKey; + /** + * Provides access to the value that specifies whether or not the command has a visual separator. + * Value: true, if the command has a visual separator; otherwise, false. + */ + hasSeparator: string; + /** + * Provides access to a value that specifies the command location. + * Value: A string that specifies the command location. + */ + container: string; +} +/** + * Provides information about a hot key used to perform an action assigned to a menu item. + */ +interface ASPxClientMenuActionHotKey { + /** + * Provides access to a hot key code. + * Value: An integer value that specifies the hot key code. + */ + keyCode: number; + /** + * Provides access to a value that specifies whether the CTRL key is used in combination with a hot key. + * Value: true, if the CTRL key is included into the key combination; otherwise, false. + */ + ctrlKey: boolean; +} +/** + * Provides data for the CustomizeMenuActions. + */ +interface ASPxClientCustomizeMenuActionsEventArgs extends ASPxClientEventArgs { + /** + * Provides access to the collection of actions available in the toolbar and menu. + * Value: An array of ASPxClientMenuAction objects. + */ + Actions: ASPxClientMenuAction[]; + /** + * Returns a menu action with the specified ID. + * @param actionId A String value that specifies the action ID. + */ + GetById(actionId: string): ASPxClientMenuAction; +} +/** + * Provides data for the CustomizeElements events. + */ +interface ASPxClientCustomizeElementsEventArgs extends ASPxClientEventArgs { + /** + * Provides access to the collection of UI elements. + * Value: An array of the ASPxReportUIElement objects. + */ + Elements: ASPxReportUIElement[]; + /** + * Returns UI elements with the specified ID. + * @param templateId A string that specifies the element ID. + */ + GetById(templateId: string): ASPxReportUIElement[]; +} /** * Provides general information about a report parameter. */ @@ -24793,6 +30250,11 @@ interface ASPxDesignerElementEditor { * Value: A String value. */ content: string; + /** + * Gets additional options for DevExtreme UI widgets. + * Value: An object that provides editor options. + */ + extendedOptions: Object; /** * Gets a nullable value, specifying the type of the editor's model. * Value: A Object value. @@ -24814,10 +30276,251 @@ interface ASPxDesignerElementEditorItem { */ displayValue: string; } +/** + * Provides information about a UI element of the Web Report Designer or Web Document Viewer. + */ +interface ASPxReportUIElement { + /** + * Provides access to an element model. + * Value: An object that specifies the element model. + */ + model: Object; + /** + * Provides access to the name of an HTML template used by an element. + * Value: A string that specifies the name of the HTML template. + */ + templateName: string; +} +/** + * Provides data for the PreviewDocumentReady events. + */ +interface ASPxClientWebDocumentViewerDocumentReadyEventArgs extends ASPxClientEventArgs { + /** + * Specifies the report ID. + */ + ReportId: string; + /** + * Specifies the report document ID. + */ + DocumentId: string; + /** + * Specifies the total number of pages in a report document. + */ + PageCount: number; +} +/** + * Provides data for the PreviewEditingFieldChanged events. + */ +interface ASPxClientWebDocumentViewerEditingFieldChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets an editing field whose value has been changed. + * Value: An object that specifies an editing field whose content has been changed. + */ + Field: ASPxClientWebDocumentViewerEditingField; + /** + * Provides access to a previous value of an editing field. + * Value: An object that specifies an editing field's previous value. + */ + OldValue: Object; + /** + * Provides access to a new value of an editing field. + * Value: An object that specifies an editing field's new value. + */ + NewValue: Object; +} +/** + * Provides functionality for a field whose content can be edited in the Web Document Viewer. + */ +interface ASPxClientWebDocumentViewerEditingField { + /** + * Provides access to a value that specifies whether or not an editing field's content can be customized in Print Preview. + * Returns: true, if a field cannot be edited in Print Preview; otherwise, false. + */ + readOnly: any; + /** + * Provides access to the current value of an editing field. + * Returns: An object that specifies the current field value. + */ + editValue: any; + /** + * Returns the unique identifier of an editing field. + */ + id(): string; + /** + * Returns the ID of a logical group to which an editing field for a check box belongs. + */ + groupID(): string; + /** + * Returns the name of an editor used to change a field value in Print Preview. + */ + editorName(): string; + /** + * Returns the index of the page on which an editing field is located. + */ + pageIndex(): number; +} +/** + * Provides data for the PreviewParametersSubmitted events. + */ +interface ASPxClientParametersSubmittedEventArgs extends ASPxClientEventArgs { + /** + * Provides access to a View Model for report parameters. + * Value: A View Model object. + */ + ParametersViewModel: Object; + /** + * Provides access to report parameters and their submitted values. + * Value: A dictionary containing the parameter names along with their values. + */ + Parameters: { [key: string]: Object; }; +} +/** + * Provides data for the PreviewParametersReset events. + */ +interface ASPxClientParametersResetEventArgs extends ASPxClientEventArgs { + /** + * Provides access to a View Model for report parameters. + * Value: A View Model object. + */ + ParametersViewModel: Object; + /** + * Provides access to report parameters whose values have been reset. + * Value: An ASPxClientWebDocumentViewerParameter array. + */ + Parameters: ASPxClientWebDocumentViewerParameter[]; +} +/** + * Provides general information about a report parameter on the client-side of the Web Document Viewer. + */ +interface ASPxClientWebDocumentViewerParameter { + /** + * Provides access to the current value of a report parameter. + * Value: An object that specifies the report parameter's current value. + */ + value: Object; + /** + * Provides access to a report parameter's value type. + * Value: An object that specifies the report parameter type. + */ + type: Object; + /** + * Provides access to a value that specifies whether or not a parameter can have multiple values. + * Value: true, if a parameter can have multiple values; otherwise, false. + */ + isMultiValue: boolean; + /** + * Returns an object that provides general information about a report parameter. + */ + getParameterDescriptor(): ASPxDesignerElementParameterDescriptor; +} +/** + * Provides data for the PreviewClick events. + */ +interface ASPxClientPreviewClickEventArgs extends ASPxClientEventArgs { + /** + * Gets a value specifying the zero-based index of the page that has been clicked. + * Value: An integer value that specifies a page index. + */ + PageIndex: number; + /** + * Provides information on a visual brick representing content of a report control that has been clicked. + * Value: An object that provides information on a visual brick. + */ + Brick: ASPxClientWebDocumentViewerBrick; + /** + * Specifies whether or not the event was handled and no default processing is required. + * Value: true, if the event is completely handled by custom code and no default processing is required; otherwise, false. + */ + Handled: boolean; + /** + * Specifies the default function used to handle the PreviewClick event. + */ + DefaultHandler(): void; + /** + * Returns the text displayed by the Brick. + */ + GetBrickText(): string; + /** + * Returns a string providing additional information on the Brick. + */ + GetBrickValue(): string; +} +/** + * Provides information about a visual brick used to render a report control to construct a document in the Web Document Viewer. + */ +interface ASPxClientWebDocumentViewerBrick { + /** + * Provides access to a brick's content. + * Value: A dictionary that stores content keys along with the corresponding contents. + */ + content: { [key: string]: string; }; + /** + * Provides access to navigation settings of the current brick. + * Value: An object that provides a brick's navigation settings. + */ + navigation: ASPxClientWebDocumentViewerBrickNavigation; + /** + * Provides access to a brick's top vertical coordinate. + * Value: An integer value that specifies the brick's top coordinate. + */ + top: number; + /** + * Provides access to a brick's left horizontal coordinate. + * Value: An integer value that specifies the brick's left coordinate. + */ + left: number; + /** + * Provides access to a brick's width. + * Value: An integer value that specifies the brick width. + */ + width: number; + /** + * Provides access to a brick's height. + * Value: An integer value that specifies the brick height. + */ + height: number; + /** + * Provides access to a value that specifies whether or not the right-to-left feature is enabled for a brick. + * Value: true, if the right-to-left feature is enabled; otherwise, false. + */ + rtl: boolean; +} +/** + * Provides navigation settings for a brick used to construct a document in the Web Document Viewer. + */ +interface ASPxClientWebDocumentViewerBrickNavigation { + /** + * Provides access to the URL to navigate to when a brick is a clicked. + * Value: A string that specifies the URL. + */ + url: string; + /** + * Provides access to a value that specifies the target window or frame in which to display the linked Web page's content when the brick is clicked. + * Value: A string that specifies the window or frame to which to target the URL's content. + */ + target: string; + /** + * Provides access to a drill-down key. + * Value: A string that specifies a drill-down key. + */ + drillDownKey: string; +} /** * A client-side equivalent of the ASPxWebDocumentViewer class. */ interface ASPxClientWebDocumentViewer extends ASPxClientControl { + /** + * Occurs after a report document has been loaded to the Web Document Viewer. + */ + DocumentReady: ASPxClientEvent>; + /** + * Occurs each time a value of an editing field changes. + */ + EditingFieldChanged: ASPxClientEvent>; + /** + * Enables you to customize UI elements of the Web Document Viewer. + */ + CustomizeElements: ASPxClientEvent>; /** * Enables you to customize the menu actions of a Web Document Viewer. */ @@ -24830,14 +30533,31 @@ interface ASPxClientWebDocumentViewer extends ASPxClientControl { * Occurs each time a look-up editor is created for a report parameter. */ CustomizeParameterLookUpSource: ASPxClientEvent>; + /** + * Occurs when the left mouse button has been clicked over a report document. + */ + PreviewClick: ASPxClientEvent>; + /** + * Occurs after report parameter values have been reset to their default values. + */ + ParametersReset: ASPxClientEvent>; + /** + * Occurs after report parameter values have been submitted. + */ + ParametersSubmitted: ASPxClientEvent>; /** * Provides access to the preview model of the ASPxClientWebDocumentViewer. */ GetPreviewModel(): Object; /** - * Opens the specified report in the HTML5 Document Viewer. + * Returns a model for a report parameter. */ - OpenReport(): Object; + GetParametersModel(): Object; + /** + * Opens the specified report on the client side of the Web Document Viewer. + * @param url A string that specifies the URL of a report to be opened. + */ + OpenReport(url: string): any; /** * Prints the current document. */ @@ -24853,9 +30573,36 @@ interface ASPxClientWebDocumentViewer extends ASPxClientControl { ExportTo(): void; /** * Exports the document to a specified file format. - * @param format A String value, specifying the export format. The following formats are currently supported: 'csv', 'html', 'image', 'mht', 'pdf', 'rtf', 'txt', 'xls', and 'xlsx'. + * @param format A String value, specifying the export format. The following formats are currently supported: 'csv', 'html', 'image', 'mht', 'pdf', 'rtf', 'docx', 'txt', 'xls', and 'xlsx'. */ ExportTo(format: string): void; + /** + * Exports the document to a specified file format. + * @param format A String value that specifies the export format. The following formats are currently supported: 'csv', 'html', 'image', 'mht', 'pdf', 'rtf', 'docx', 'txt', 'xls', and 'xlsx'. + * @param inlineResult true, to try opening the result file in a new browser tab without a download; otherwise, false. + */ + ExportTo(format: string, inlineResult: boolean): void; + /** + * Returns the zero-based index of the currently displayed page. + */ + GetCurrentPageIndex(): number; + /** + * Displays the report page with the specified page index. + * @param pageIndex A zero-based integer value that specifies the index of a page to be displayed. + */ + GoToPage(pageIndex: number): void; + /** + * Closes the document currently being opened in the Web Document Viewer. + */ + Close(): void; + /** + * Resets the values of report parameters to their default values. + */ + ResetParameters(): void; + /** + * Starts building a report document. + */ + StartBuild(): void; /** * Updates the localization settings of the ASPxClientWebDocumentViewer properties. * @param localization A dictionary containing the property names, along with their localized equivalents. @@ -24863,64 +30610,37 @@ interface ASPxClientWebDocumentViewer extends ASPxClientControl { UpdateLocalization(localization: { [key: string]: string; }): void; } /** - * Provides settings to the actions listed in a Web Document Viewer menu. + * A method that will handle the EditingFieldChanged event. */ -interface ASPxClientWebDocumentViewerMenuAction { +interface ASPxClientWebDocumentViewerEditingFieldChangedEventHandler { /** - * Provides access to the text for the command. - * Value: A String value. + * A method that will handle the PreviewEditingFieldChanged event. + * @param source The event sender. + * @param e An ASPxClientWebDocumentViewerEditingFieldChangedEventArgs object that contains data related to the event. */ - text: string; - /** - * Provides access to the CSS class of the command's glyph. - * Value: A String value. - */ - imageClassName: string; - /** - * Provides access to the action performed when a Document Viewer's button is clicked. - * Value: The specific action implementation. - */ - clickAction: Function; - /** - * Provides access to the value that specifies whether or not the command is disabled by default. - * Value: true, if the command is disabled by default; otherwise, false. - */ - disabled: boolean; - /** - * Provides access to the value that specifies whether or not the command is visible in the Document Viewer user interface. - * Value: true if the command is visible; otherwise false. - */ - visible: boolean; - /** - * Provides access to the keyboard shortcut used to invoke the command. - * Value: A String value. - */ - hotKey: string; - /** - * Provides access to the value that specifies whether or not the command has a visual separator. - * Value: true, if the command has a visual separator; otherwise, false. - */ - hasSeparator: string; - /** - * Provides access to the location of the displayed command. - * Value: A String value. - */ - container: string; + (source: S, e: ASPxClientWebDocumentViewerEditingFieldChangedEventArgs): void; } /** - * Provides data for the CustomizeMenuActions event. + * A method that will handle the DocumentReady event. */ -interface ASPxClientWebDocumentViewerCustomizeMenuActionsEventArgs extends ASPxClientEventArgs { +interface ASPxClientWebDocumentViewerDocumentReadyEventHandler { /** - * Returns the collection of customized menu actions. - * Value: An ASPxClientWebDocumentViewerMenuAction array. + * A method that will handle the PreviewDocumentReady event. + * @param source The event sender. + * @param e An ASPxClientWebDocumentViewerDocumentReadyEventArgs object that contains data related to the event. */ - Actions: ASPxClientWebDocumentViewerMenuAction[]; + (source: S, e: ASPxClientWebDocumentViewerDocumentReadyEventArgs): void; +} +/** + * A method that will handle the CustomizeElements event. + */ +interface ASPxClientWebDocumentViewerCustomizeElementsEventHandler { /** - * Returns a menu action with the specified ID. - * @param actionId A String value, specifying the action ID. + * A method that will handle the PreviewCustomizeElements event. + * @param source The event sender. + * @param e An ASPxClientCustomizeElementsEventArgs object that contains data related to the event. */ - GetById(actionId: string): ASPxClientWebDocumentViewerMenuAction; + (source: S, e: ASPxClientCustomizeElementsEventArgs): void; } /** * A method that will handle the CustomizeMenuActions event. @@ -24929,9 +30649,9 @@ 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. + * @param e An ASPxClientCustomizeMenuActionsEventArgs object that contains data related to the event. */ - (source: S, e: ASPxClientWebDocumentViewerCustomizeMenuActionsEventArgs): void; + (source: S, e: ASPxClientCustomizeMenuActionsEventArgs): void; } /** * A method that will handle the CustomizeParameterEditors event. @@ -24944,8 +30664,49 @@ interface ASPxClientWebDocumentViewerCustomizeParameterEditorsEventHandler { */ (source: S, e: ASPxClientCustomizeParameterEditorsEventArgs): void; } +/** + * A method that will handle the CustomizeParameterLookUpSource event. + */ interface ASPxClientWebDocumentViewerCustomizeParameterLookUpSourceEventHandler { - (source: S, e: ASPxClientCustomizeParameterEditorsEventArgs): void; + /** + * A method that will handle the CustomizeParameterLookUpSource event. + * @param source The event sender. + * @param e An ASPxClientCustomizeParameterLookUpSourceEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientCustomizeParameterLookUpSourceEventArgs): void; +} +/** + * A method that will handle the PreviewClick event. + */ +interface ASPxClientWebDocumentViewerPreviewClickEventHandler { + /** + * A method that will handle the PreviewClick event. + * @param source The event sender. + * @param e An ASPxClientPreviewClickEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientPreviewClickEventArgs): void; +} +/** + * A method that will handle the ParametersReset event. + */ +interface ASPxClientWebDocumentViewerParametersResetEventHandler { + /** + * A method that will handle the PreviewParametersReset event. + * @param source The event sender. + * @param e An ASPxClientParametersResetEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientParametersResetEventArgs): void; +} +/** + * A method that will handle the ParametersSubmitted event. + */ +interface ASPxClientWebDocumentViewerParametersSubmittedEventHandler { + /** + * A method that will handle the PreviewParametersSubmitted event. + * @param source The event sender. + * @param e An ASPxClientParametersSubmittedEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientParametersSubmittedEventArgs): void; } interface MVCxClientDashboardViewerStatic extends ASPxClientDashboardViewerStatic { @@ -25014,15 +30775,6 @@ interface DashboardSpecialValuesStatic { */ IsErrorValue(value: Object): boolean; } -interface ASPxClientDashboardDesignerStatic extends ASPxClientControlStatic { -} -interface ASPxClientDashboardViewerStatic 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): ASPxClientDashboardViewer; -} interface DashboardExportPageLayoutStatic { /** * The page orientation used to export a dashboard (dashboard item) is portrait. @@ -25091,6 +30843,26 @@ interface DashboardExportFilterStateStatic { */ SeparatePage: string; } +interface DashboardStateExportPositionStatic { + /** + * The dashboard state is placed below the exported dashboard/dashboard item. + */ + Below: string; + /** + * The dashboard state is placed on a separate page. + */ + SeparatePage: string; +} +interface DashboardStateExcelExportPositionStatic { + /** + * The dashboard state is placed below the exported data. + */ + Below: string; + /** + * The dashboard state is placed on a separate sheet. + */ + SeparateSheet: string; +} interface DashboardExportImageFormatStatic { /** * The PNG image format. @@ -25105,6 +30877,11 @@ interface DashboardExportImageFormatStatic { */ Jpg: string; } +interface ExcelExportFilterStateStatic { + none: string; + below: string; + separatePage: string; +} interface DashboardExportExcelFormatStatic { /** * The Excel 97 - Excel 2003 (XLS) file format. @@ -25143,6 +30920,16 @@ interface MapExportSizeModeStatic { */ Zoom: string; } +interface TreemapExportSizeModeStatic { + /** + * For internal use. + */ + none: string; + /** + * For internal use. + */ + zoom: string; +} interface RangeFilterExportSizeModeStatic { /** * A Range Filter dashboard item is exported in a size identical to that shown on the dashboard. @@ -25162,6 +30949,15 @@ interface DashboardSelectionModeStatic { Single: string; Multiple: string; } +interface ASPxClientDashboardStatic extends ASPxClientControlStatic { +} +interface ASPxClientDashboardViewerStatic 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): ASPxClientDashboardViewer; +} interface ASPxClientEditBaseStatic extends ASPxClientControlStatic { } interface ASPxClientEditStatic extends ASPxClientEditBaseStatic { @@ -25605,6 +31401,10 @@ interface ASPxClientGridViewCallbackCommandStatic { * Default value: "APPLYSEARCHPANELFILTER" */ ApplySearchPanelFilter: string; + /** + * Default value: "APPLYCUSTOMIZATIONDIALOGCHANGES" + */ + ApplyCustomizationDialogChanges: string; /** * Default value: "FILTERROWMENU" */ @@ -25673,6 +31473,10 @@ interface ASPxClientGridViewCallbackCommandStatic { * Default value: "CONTEXTMENU" */ ContextMenu: string; + /** + * Default value: "TOOLBAR" + */ + Toolbar: string; /** * Default value: "CUSTOMVALUES" */ @@ -26284,9 +32088,9 @@ interface ASPxSchedulerDateTimeHelperStatic { */ ToDayTime(date: Date): any; /** - * - * @param date - * @param dayCount + * Adds the specified number of days to a DateTime object and returns the result. + * @param date A DateTime object to which to add days. + * @param dayCount The number of days to add. */ AddDays(date: Date, dayCount: number): Date; /** @@ -26340,6 +32144,16 @@ interface ASPxClientSpellCheckerStatic extends ASPxClientControlStatic { */ Cast(obj: Object): ASPxClientSpellChecker; } +interface ASPxClientSpellCheckerStopCheckingReasonStatic { + /** + * Spell checking is finished normally. + */ + Default: string; + /** + * The user stopped spell checking. + */ + User: string; +} 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. @@ -26354,6 +32168,76 @@ interface ASPxClientTreeListStatic extends ASPxClientControlStatic { */ Cast(obj: Object): ASPxClientTreeList; } +interface BootstrapClientAccordionStatic extends ASPxClientNavBarStatic { +} +interface BootstrapClientBinaryImageStatic extends ASPxClientHyperLinkStatic { +} +interface BootstrapClientButtonStatic extends ASPxClientButtonStatic { +} +interface BootstrapClientCalendarStatic extends ASPxClientCalendarStatic { +} +interface BootstrapClientCallbackPanelStatic extends ASPxClientControlStatic { +} +interface BootstrapClientChartBaseStatic extends ASPxClientControlStatic { +} +interface BootstrapClientChartStatic extends BootstrapClientChartBaseStatic { +} +interface BootstrapClientPolarChartStatic extends BootstrapClientChartBaseStatic { +} +interface BootstrapClientPieChartStatic extends BootstrapClientChartBaseStatic { +} +interface BootstrapClientCheckBoxStatic extends ASPxClientEditStatic { +} +interface BootstrapClientRadioButtonStatic extends BootstrapClientCheckBoxStatic { +} +interface BootstrapClientComboBoxStatic extends ASPxClientComboBoxStatic { +} +interface BootstrapClientDateEditStatic extends ASPxClientDateEditStatic { +} +interface BootstrapClientDropDownEditStatic extends ASPxClientDropDownEditStatic { +} +interface BootstrapClientFormLayoutStatic extends ASPxClientFormLayoutStatic { +} +interface BootstrapClientGridViewStatic extends ASPxClientGridViewStatic { +} +interface BootstrapClientHyperLinkStatic extends ASPxClientHyperLinkStatic { +} +interface BootstrapClientImageStatic extends ASPxClientImageStatic { +} +interface BootstrapClientListBoxStatic extends ASPxClientListBoxStatic { +} +interface BootstrapClientCheckBoxListStatic extends ASPxClientCheckBoxListStatic { +} +interface BootstrapClientRadioButtonListStatic extends ASPxClientRadioButtonListStatic { +} +interface BootstrapClientMenuStatic extends ASPxClientMenuStatic { +} +interface BootstrapClientPagerStatic extends ASPxClientPagerStatic { +} +interface BootstrapClientPopupControlStatic extends ASPxClientPopupControlStatic { +} +interface BootstrapClientPopupMenuStatic extends ASPxClientPopupMenuStatic { +} +interface BootstrapClientProgressBarStatic extends ASPxClientProgressBarStatic { +} +interface BootstrapClientSpinEditStatic extends ASPxClientSpinEditStatic { +} +interface BootstrapClientTabControlStatic extends ASPxClientTabControlStatic { +} +interface BootstrapClientPageControlStatic extends ASPxClientPageControlStatic { +} +interface BootstrapClientTextBoxStatic extends ASPxClientTextBoxStatic { +} +interface BootstrapClientMemoStatic extends ASPxClientMemoStatic { +} +interface BootstrapClientButtonEditStatic extends ASPxClientButtonEditStatic { +} +interface BootstrapClientTreeViewStatic extends ASPxClientTreeViewStatic { +} +interface BootstrapUIWidgetBaseStatic extends ASPxClientControlStatic { +} +interface BootstrapClientUploadControlStatic extends ASPxClientUploadControlStatic { +} interface MVCxClientCalendarStatic extends ASPxClientCalendarStatic { /** * 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. @@ -26501,8 +32385,17 @@ interface MVCxClientSchedulerStatic extends ASPxClientSchedulerStatic { Cast(obj: Object): MVCxClientScheduler; } interface MVCxSchedulerToolTipTypeStatic { + /** + * The tooltip is displayed for a selected appointment. + */ Appointment: number; + /** + * The tooltip is displayed for a dragged appointment. + */ AppointmentDrag: number; + /** + * The tooltip is displayed for a selected time interval. + */ Selection: number; } interface MVCxClientSpreadsheetStatic extends ASPxClientSpreadsheetStatic { @@ -26629,7 +32522,21 @@ interface ASPxClientCallbackStatic extends ASPxClientControlStatic { */ Cast(obj: Object): ASPxClientCallback; } -interface ASPxClientCallbackPanelStatic extends ASPxClientControlStatic { +interface ASPxClientPanelBaseStatic 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): ASPxClientPanelBase; +} +interface ASPxClientPanelStatic extends ASPxClientPanelBaseStatic { + /** + * 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): ASPxClientPanel; +} +interface ASPxClientCallbackPanelStatic extends ASPxClientPanelStatic { /** * 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. @@ -26774,6 +32681,82 @@ interface ASPxClientHiddenFieldStatic extends ASPxClientControlStatic { */ Cast(obj: Object): ASPxClientHiddenField; } +interface ASPxClientHintStatic extends ASPxClientControlStatic { + /** + * Forces the hint to reselect target UI elements according to the specified CSS selector. + */ + Update(): void; + /** + * Forces the hint to recalculate its position. + */ + UpdatePosition(): void; + /** + * Forces the hint to recalculate its position. + * @param hintElementOrTargetElement An object that is the hint element or the target element. + */ + UpdatePosition(hintElementOrTargetElement: Object): void; + /** + * Registers a hint's functionality with the specified settings. + * @param targetSelector A string value that is the CSS selector. Specifies to which UI elements the hint is displayed. + * @param options An ASPxClientHintOptions object that is the hint's options. + */ + Register(targetSelector: string, options: ASPxClientHintOptions): ASPxClientHint; + /** + * + * @param targetSelector + * @param contentAttribute + */ + Register(targetSelector: string, contentAttribute: string): ASPxClientHint; + /** + * + * @param targetSelector + * @param onShowing + */ + Register(targetSelector: string, onShowing: ASPxClientHintShowingEventHandler): ASPxClientHint; + /** + * Invokes a hint. + * @param targetSelector A string value that is the CSS selector. + * @param options An ASPxClientHintOptions object that is the hint's options. + */ + Show(targetSelector: string, options: ASPxClientHintOptions): void; + /** + * Invokes a hint. + * @param targetSelector A string value that is the CSS selector used to specify for which UI elements on a web page a hint is displayed. + * @param content A string value that is the hint's content. + */ + Show(targetSelector: string, content: string): void; + /** + * Invokes a hint. + * @param targetElement An object that is the target element. + * @param options An ASPxClientHintOptions object that is the hint's options. + */ + Show(targetElement: Object, options: ASPxClientHintOptions): void; + /** + * Invokes a hint. + * @param targetElement A HTML DOM element near to which the hint is displayed in response to user interaction. + * @param content A string value that is the hint's content. + */ + Show(targetElement: Object, content: string): void; + /** + * Invokes a hint. + * @param options An ASPxClientHintOptions object that is the hint's options. + */ + Show(options: ASPxClientHintOptions): void; + /** + * Hides a hint window. + * @param targetSelector A string value that is the CSS selector. + */ + Hide(targetSelector: string): void; + /** + * Hides a hint window. + * @param targetElementOrHintElement An object that is the target element or hint element. + */ + Hide(targetElementOrHintElement: Object): void; + /** + * Hides all hints. + */ + HideAll(): void; +} interface ASPxClientImageGalleryStatic extends ASPxClientDataViewStatic { /** * 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. @@ -26799,6 +32782,8 @@ interface ASPxClientLoadingPanelStatic extends ASPxClientControlStatic { */ Cast(obj: Object): ASPxClientLoadingPanel; } +interface ASPxClientMediaFileSelectorStatic extends ASPxClientControlStatic { +} interface ASPxClientMenuBaseStatic extends ASPxClientControlStatic { /** * Returns a collection of client menu objects. @@ -26857,19 +32842,7 @@ interface ASPxClientObjectContainerStatic extends ASPxClientControlStatic { */ Cast(obj: Object): ASPxClientObjectContainer; } -interface ASPxClientPanelBaseStatic 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): ASPxClientPanelBase; -} -interface ASPxClientPanelStatic extends ASPxClientPanelBaseStatic { - /** - * 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): ASPxClientPanel; +interface ASPxClientPagerStatic extends ASPxClientControlStatic { } interface ASPxClientPopupControlStatic extends ASPxClientPopupControlBaseStatic { /** @@ -27019,6 +32992,24 @@ interface ASPxClientUploadControlStatic extends ASPxClientControlStatic { */ Cast(obj: Object): ASPxClientUploadControl; } +interface ASPxClientUploadControlValidationErrorTypeConstsStatic { + /** + * The allowed maximum file size is exceeded. Return Value: 1 + */ + MaxFileSizeExceeded: number; + /** + * The file's extension is not allowed. Return Value: 2 + */ + NotAllowedFileExtension: number; + /** + * The allowed maximum count of the files is exceeded. Return Value: 3 + */ + MaxFileCountExceeded: number; + /** + * A file name contains invalid character.Return Value: 4 + */ + FileNameContainsInvalidCharacter: number; +} interface ASPxClientUtilsStatic { /** * Gets the user-agent string, which identifies the client browser and provides certain system details of the client computer. @@ -27363,6 +33354,11 @@ interface ASPxClientUtilsStatic { * @param str A string value representing the string for trimming. */ TrimEnd(str: string): string; + /** + * Specifies the text that Assistive Technologies (screen readers or braille display, for example) will provide to a user. + * @param message A String value that specifies a text. + */ + SendMessageToAssistiveTechnology(message: string): void; } interface ASPxClientChartDesignerStatic extends ASPxClientControlStatic { /** @@ -27428,18 +33424,22 @@ interface ASPxClientWebDocumentViewerStatic extends ASPxClientControlStatic { declare var MVCxClientDashboardViewer: MVCxClientDashboardViewerStatic; declare var DashboardDataAxisNames: DashboardDataAxisNamesStatic; declare var DashboardSpecialValues: DashboardSpecialValuesStatic; -declare var ASPxClientDashboardDesigner: ASPxClientDashboardDesignerStatic; -declare var ASPxClientDashboardViewer: ASPxClientDashboardViewerStatic; declare var DashboardExportPageLayout: DashboardExportPageLayoutStatic; declare var DashboardExportPaperKind: DashboardExportPaperKindStatic; declare var DashboardExportScaleMode: DashboardExportScaleModeStatic; declare var DashboardExportFilterState: DashboardExportFilterStateStatic; +declare var DashboardStateExportPosition: DashboardStateExportPositionStatic; +declare var DashboardStateExcelExportPosition: DashboardStateExcelExportPositionStatic; declare var DashboardExportImageFormat: DashboardExportImageFormatStatic; +declare var ExcelExportFilterState: ExcelExportFilterStateStatic; declare var DashboardExportExcelFormat: DashboardExportExcelFormatStatic; declare var ChartExportSizeMode: ChartExportSizeModeStatic; declare var MapExportSizeMode: MapExportSizeModeStatic; +declare var TreemapExportSizeMode: TreemapExportSizeModeStatic; declare var RangeFilterExportSizeMode: RangeFilterExportSizeModeStatic; declare var DashboardSelectionMode: DashboardSelectionModeStatic; +declare var ASPxClientDashboard: ASPxClientDashboardStatic; +declare var ASPxClientDashboardViewer: ASPxClientDashboardViewerStatic; declare var ASPxClientEditBase: ASPxClientEditBaseStatic; declare var ASPxClientEdit: ASPxClientEditStatic; declare var ASPxClientBinaryImage: ASPxClientBinaryImageStatic; @@ -27503,8 +33503,44 @@ declare var ASPxClientRecurrenceTypeEdit: ASPxClientRecurrenceTypeEditStatic; declare var ASPxClientTimeInterval: ASPxClientTimeIntervalStatic; declare var ASPxClientScheduler: ASPxClientSchedulerStatic; declare var ASPxClientSpellChecker: ASPxClientSpellCheckerStatic; +declare var ASPxClientSpellCheckerStopCheckingReason: ASPxClientSpellCheckerStopCheckingReasonStatic; declare var ASPxClientSpreadsheet: ASPxClientSpreadsheetStatic; declare var ASPxClientTreeList: ASPxClientTreeListStatic; +declare var BootstrapClientAccordion: BootstrapClientAccordionStatic; +declare var BootstrapClientBinaryImage: BootstrapClientBinaryImageStatic; +declare var BootstrapClientButton: BootstrapClientButtonStatic; +declare var BootstrapClientCalendar: BootstrapClientCalendarStatic; +declare var BootstrapClientCallbackPanel: BootstrapClientCallbackPanelStatic; +declare var BootstrapClientChartBase: BootstrapClientChartBaseStatic; +declare var BootstrapClientChart: BootstrapClientChartStatic; +declare var BootstrapClientPolarChart: BootstrapClientPolarChartStatic; +declare var BootstrapClientPieChart: BootstrapClientPieChartStatic; +declare var BootstrapClientCheckBox: BootstrapClientCheckBoxStatic; +declare var BootstrapClientRadioButton: BootstrapClientRadioButtonStatic; +declare var BootstrapClientComboBox: BootstrapClientComboBoxStatic; +declare var BootstrapClientDateEdit: BootstrapClientDateEditStatic; +declare var BootstrapClientDropDownEdit: BootstrapClientDropDownEditStatic; +declare var BootstrapClientFormLayout: BootstrapClientFormLayoutStatic; +declare var BootstrapClientGridView: BootstrapClientGridViewStatic; +declare var BootstrapClientHyperLink: BootstrapClientHyperLinkStatic; +declare var BootstrapClientImage: BootstrapClientImageStatic; +declare var BootstrapClientListBox: BootstrapClientListBoxStatic; +declare var BootstrapClientCheckBoxList: BootstrapClientCheckBoxListStatic; +declare var BootstrapClientRadioButtonList: BootstrapClientRadioButtonListStatic; +declare var BootstrapClientMenu: BootstrapClientMenuStatic; +declare var BootstrapClientPager: BootstrapClientPagerStatic; +declare var BootstrapClientPopupControl: BootstrapClientPopupControlStatic; +declare var BootstrapClientPopupMenu: BootstrapClientPopupMenuStatic; +declare var BootstrapClientProgressBar: BootstrapClientProgressBarStatic; +declare var BootstrapClientSpinEdit: BootstrapClientSpinEditStatic; +declare var BootstrapClientTabControl: BootstrapClientTabControlStatic; +declare var BootstrapClientPageControl: BootstrapClientPageControlStatic; +declare var BootstrapClientTextBox: BootstrapClientTextBoxStatic; +declare var BootstrapClientMemo: BootstrapClientMemoStatic; +declare var BootstrapClientButtonEdit: BootstrapClientButtonEditStatic; +declare var BootstrapClientTreeView: BootstrapClientTreeViewStatic; +declare var BootstrapUIWidgetBase: BootstrapUIWidgetBaseStatic; +declare var BootstrapClientUploadControl: BootstrapClientUploadControlStatic; declare var MVCxClientCalendar: MVCxClientCalendarStatic; declare var MVCxClientCallbackPanel: MVCxClientCallbackPanelStatic; declare var MVCxClientCardView: MVCxClientCardViewStatic; @@ -27542,6 +33578,8 @@ declare var MVCxClientWebDocumentViewer: MVCxClientWebDocumentViewerStatic; declare var ASPxClientControlBase: ASPxClientControlBaseStatic; declare var ASPxClientControl: ASPxClientControlStatic; declare var ASPxClientCallback: ASPxClientCallbackStatic; +declare var ASPxClientPanelBase: ASPxClientPanelBaseStatic; +declare var ASPxClientPanel: ASPxClientPanelStatic; declare var ASPxClientCallbackPanel: ASPxClientCallbackPanelStatic; declare var ASPxClientCloudControl: ASPxClientCloudControlStatic; declare var ASPxClientDataView: ASPxClientDataViewStatic; @@ -27554,19 +33592,20 @@ declare var ASPxClientFileManagerCommandConsts: ASPxClientFileManagerCommandCons declare var ASPxClientFileManagerErrorConsts: ASPxClientFileManagerErrorConstsStatic; declare var ASPxClientFormLayout: ASPxClientFormLayoutStatic; declare var ASPxClientHiddenField: ASPxClientHiddenFieldStatic; +declare var ASPxClientHint: ASPxClientHintStatic; declare var ASPxClientImageGallery: ASPxClientImageGalleryStatic; declare var ASPxClientImageSlider: ASPxClientImageSliderStatic; declare var ASPxClientImageZoomNavigator: ASPxClientImageZoomNavigatorStatic; declare var ASPxClientImageZoom: ASPxClientImageZoomStatic; declare var ASPxClientLoadingPanel: ASPxClientLoadingPanelStatic; +declare var ASPxClientMediaFileSelector: ASPxClientMediaFileSelectorStatic; declare var ASPxClientMenuBase: ASPxClientMenuBaseStatic; declare var ASPxClientMenu: ASPxClientMenuStatic; declare var ASPxClientTouchUI: ASPxClientTouchUIStatic; declare var ASPxClientNavBar: ASPxClientNavBarStatic; declare var ASPxClientNewsControl: ASPxClientNewsControlStatic; declare var ASPxClientObjectContainer: ASPxClientObjectContainerStatic; -declare var ASPxClientPanelBase: ASPxClientPanelBaseStatic; -declare var ASPxClientPanel: ASPxClientPanelStatic; +declare var ASPxClientPager: ASPxClientPagerStatic; declare var ASPxClientPopupControl: ASPxClientPopupControlStatic; declare var ASPxClientPopupControlResizeState: ASPxClientPopupControlResizeStateStatic; declare var ASPxClientPopupControlCloseReason: ASPxClientPopupControlCloseReasonStatic; @@ -27583,6 +33622,7 @@ declare var ASPxClientTimer: ASPxClientTimerStatic; declare var ASPxClientTitleIndex: ASPxClientTitleIndexStatic; declare var ASPxClientTreeView: ASPxClientTreeViewStatic; declare var ASPxClientUploadControl: ASPxClientUploadControlStatic; +declare var ASPxClientUploadControlValidationErrorTypeConsts: ASPxClientUploadControlValidationErrorTypeConstsStatic; declare var ASPxClientUtils: ASPxClientUtilsStatic; declare var ASPxClientChartDesigner: ASPxClientChartDesignerStatic; declare var ASPxClientWebChartControl: ASPxClientWebChartControlStatic; diff --git a/types/devexpress-web/v161/devexpress-web-tests.ts b/types/devexpress-web/v161/devexpress-web-tests.ts new file mode 100644 index 0000000000..ef7eb8de37 --- /dev/null +++ b/types/devexpress-web/v161/devexpress-web-tests.ts @@ -0,0 +1,418 @@ +declare var hiddenField: ASPxClientHiddenField; +declare var mainCallbackPanel: ASPxClientCallbackPanel; +declare var loginPopup: ASPxClientPopupControl; +declare var searchButton: ASPxClientButton; +declare var searchComboBox: ASPxClientComboBox; +declare var roomsNumberSpinEdit: ASPxClientSpinEdit; +declare var adultsNumberSpinEdit: ASPxClientSpinEdit; +declare var childrenNumberSpinEdit: ASPxClientSpinEdit; +declare var checkInDateEdit: ASPxClientDateEdit; +declare var checkOutDateEdit: ASPxClientDateEdit; +declare var backSlider: ASPxClientImageSlider; +declare var locationComboBox: ASPxClientComboBox; +declare var nightyRateTrackBar: ASPxClientTrackBar; +declare var customerRatingTrackBar: ASPxClientTrackBar; +declare var ourRatingCheckBoxList: ASPxClientCheckBoxList; +declare var startFilterPopupControl: ASPxClientPopupControl; +declare var imagePopupControl: ASPxClientPopupControl; +declare var emailTextBox: ASPxClientTextBox; +declare var creditCardEmailTextBox: ASPxClientTextBox; +declare var accountEmailTextBox: ASPxClientTextBox; +declare var bookingPageControl: ASPxClientPageControl; +declare var paymentTypePageControl: ASPxClientPageControl; +declare var offerFormPopup: ASPxClientPopupControl; +declare var roomsSpinEdit: ASPxClientSpinEdit; +declare var adultsSpinEdit: ASPxClientSpinEdit; +declare var childrenSpinEdit: ASPxClientSpinEdit; +declare var hotelDetailsCallbackPanel: ASPxClientCallbackPanel; +declare var leftPanel: ASPxClientPanel; +declare var menuButton: ASPxClientButton; +declare var aboutWindow: ASPxClientPopupControl; +declare var offersZone: ASPxClientDockZone; + +module DXDemo { + function showPage(page: string, params: { [key: string]: any }, skipHistory?: boolean): void { + var queryString = getQueryString(params || {}); + hiddenField.Set("page", page); + hiddenField.Set("parameters", queryString); + hideMenu(); + var uri = queryString.length ? (page + "?" + queryString) : page; + try { + if (!skipHistory && window.history && window.history.pushState) + window.history.pushState(uri, "", uri || "Default.aspx"); + } catch (e) { } + mainCallbackPanel.PerformCallback(uri); + }; + + export function onMainMenuItemClick(s: ASPxClientMenu, e: ASPxClientMenuItemClickEventArgs): void { + switch (e.item.name) { + case "login": + hideMenu(); + setTimeout(function () { loginPopup.ShowAtElementByID("MainCallbackPanel_ContentPane"); }, 300); + break; + case "offers": + showPage("SpecialOffers", {}); + break; + default: + hideMenu(); + setTimeout(function () { showAboutWindow(); }, 300); + break; + } + }; + + export function onLoginButtonClick(s: ASPxClientButton, e: ASPxClientButtonClickEventArgs): void { + loginPopup.Hide(); + showAboutWindow(); + }; + + export function onSearchButtonClick(): void { + if (ASPxClientEdit.ValidateGroup("DateEditors")) { + showPage("ShowHotels", { + location: searchComboBox.GetValue(), + checkin: getFormattedDate(checkInDateEdit.GetValue()), + checkout: getFormattedDate(checkOutDateEdit.GetValue()), + rooms: roomsNumberSpinEdit.GetValue() || 1, + adults: adultsNumberSpinEdit.GetValue() || 1, + children: childrenNumberSpinEdit.GetValue() || 0 + }); + } + }; + + export function onSearchComboBoxIndexChanged(s: ASPxClientComboBox, e: ASPxClientProcessingModeEventArgs): void { + hideMenu(); + searchButton.AdjustControl(); + }; + + export function onIndexOfferCloseClick(index: number): void { + var panel = ASPxClientControl.GetControlCollection().GetByName("OfferDockPanel" + index); + var sibPanel = ASPxClientControl.GetControlCollection().GetByName("OfferDockPanel" + (index == 1 ? 2 : 1)); + panel.Hide(); + sibPanel.MakeFloat(); + sibPanel.SetWidth(offersZone.GetWidth()); + sibPanel.Dock(offersZone); + }; + + export function onLogoClick(): void { + showPage("", null, false); + }; + + export function onMenuNavButtonCheckedChanged(s: ASPxClientCheckBox, e: ASPxClientProcessingModeEventArgs): void { + var mainContainer = mainCallbackPanel.GetMainElement(); + if (s.GetChecked()) { + backSlider.Pause(); + showMenu(); + } + else { + hideMenu(); + backSlider.Play(); + } + }; + + export function onBackNavButtonClick(s: ASPxClientButton, e: ASPxClientButtonClickEventArgs): void { + var params = getCurrentQueryParams(); + switch (getCurrentPage()) { + case "PrintInvoice": + showPage("Booking", params, false); + break; + case "Booking": + if (bookingPageControl.GetActiveTabIndex() > 0) + bookingPageControl.SetActiveTabIndex(bookingPageControl.GetActiveTabIndex() - 1); + else + showPage("ShowRooms", params, false); + break; + case "ShowRooms": + showPage("ShowHotels", params, false); + break; + case "ShowDetails": + showPage("ShowHotels", params, false); + break; + case "ShowHotels": + case "SpecialOffers": + showPage("", null, false); + break; + } + }; + + export function updateSearchResults(): void { + var params = getCurrentQueryParams(); + params["location"] = locationComboBox.GetValue(); + params["minprice"] = nightyRateTrackBar.GetPositionStart(); + params["maxprice"] = nightyRateTrackBar.GetPositionEnd(); + params["custrating"] = customerRatingTrackBar.GetPosition(); + params["ourrating"] = ourRatingCheckBoxList.GetSelectedValues().join(","); + showPage("ShowHotels", params); + }; + + export function onBookHotelButtonClick(hotelID: string): void { + var queryParams = getCurrentQueryParams(); + queryParams["hotelID"] = hotelID; + showPage("ShowRooms", queryParams); + }; + + export function onDetailsHotelButtonClick(hotelID: string): void { + var queryParams = getCurrentQueryParams(); + queryParams["hotelID"] = hotelID; + showPage("ShowDetails", queryParams); + }; + + export function onShowStartFilterButtonClick(s: ASPxClientButton, e: ASPxClientButtonClickEventArgs): void { + startFilterPopupControl.ShowAtElementByID("MainCallbackPanel_ContentPane"); + }; + + export function onChangeStartFilterButtonClick(s: ASPxClientButton, e: ASPxClientButtonClickEventArgs): void { + if (ASPxClientEdit.ValidateGroup("DateEditors")) { + var params = getCurrentQueryParams(); + params["checkin"] = getFormattedDate(checkInDateEdit.GetValue()); + params["checkout"] = getFormattedDate(checkOutDateEdit.GetValue()); + params["rooms"] = roomsNumberSpinEdit.GetValue() || 1; + params["adults"] = adultsNumberSpinEdit.GetValue() || 1; + params["children"] = childrenNumberSpinEdit.GetValue() || 0; + startFilterPopupControl.Hide(); + showPage(hiddenField.Get("page").toString(), params); + } + }; + + export function onBookRoomButtonClick(roomID: string): void { + var params = getCurrentQueryParams(); + params["roomID"] = roomID; + showPage("Booking", params); + }; + + export function onShowRoomsButtonClick(): void { + var queryParams = getCurrentQueryParams(); + showPage("ShowRooms", queryParams); + }; + + export function onShowDetailsButtonClick(): void { + var queryParams = getCurrentQueryParams(); + showPage("ShowDetails", queryParams); + }; + + export function onRoomImageNavItemClick(roomID: string, pictureName: string): void { + setTimeout(function () { + imagePopupControl.PerformCallback(roomID + "|" + pictureName); + imagePopupControl.ShowAtElementByID("MainCallbackPanel_ContentPane"); + }, 500); + }; + + export function onRoomsNavBarExpandedChanged(s: ASPxClientNavBar, e: ASPxClientNavBarGroupEventArgs): void { + ASPxClientControl.AdjustControls(s.GetMainElement()); + }; + + export function onNextBookingStepButtonClick(step: number): void { + var valid = true; + var validationGroup = ""; + if (step == 1) + validationGroup = "Account"; + if (step == 2) + validationGroup = "RoomDetails"; + if (step == 3) + validationGroup = "PaymentDetails"; + + switch (step) { + case 1: + valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "Account"); + if (valid) { + emailTextBox.SetValue(accountEmailTextBox.GetValue()); + creditCardEmailTextBox.SetValue(accountEmailTextBox.GetValue()); + showPage("Booking", getCurrentQueryParams()); + return; + } + break; + case 2: + valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "RoomDetails"); + emailTextBox.SetValue(accountEmailTextBox.GetValue()); + break; + case 3: + var paymentType = paymentTypePageControl.GetActiveTabIndex(); + if (paymentType == 0) + valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "CreditCard"); + else if (paymentType == 1) + valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "Cash"); + else if (paymentType == 2) + valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "PayPal"); + break; + } + if (valid) { + bookingPageControl.GetTab(step).SetEnabled(true); + bookingPageControl.SetActiveTabIndex(step); + } + }; + + export function onAccountCaptchaHiddenFieldInit(s: ASPxClientHiddenField, e: ASPxClientEventArgs): void { + if (s.Get("IsCaptchaValid")) { + bookingPageControl.GetTab(1).SetEnabled(true); + bookingPageControl.SetActiveTabIndex(1); + } + }; + + export function onFinishBookingStepButtonClick(): void { + showAboutWindow(); + }; + + export function OnPrintInvoiceButtonClick(): void { + showPage("PrintInvoice", getCurrentQueryParams()); + }; + + export function onOfferClick(offerID: string): void { + offerFormPopup.SetContentHtml(""); + offerFormPopup.PerformCallback(offerID); + var panel = ASPxClientControl.GetControlCollection().GetByName("DockPanel" + offerID); + var panelElement = panel.GetMainElement(); + if (panelElement.offsetWidth < 330 || panelElement.offsetHeight < 250) { + offerFormPopup.SetWidth(400); + offerFormPopup.SetHeight(280); + offerFormPopup.ShowAtElementByID("SpecialOffersContainer"); + } + else { + offerFormPopup.SetWidth(panelElement.offsetWidth); + offerFormPopup.SetHeight(panelElement.offsetHeight); + offerFormPopup.ShowAtElement(panelElement); + } + }; + + export function onSpecialOfferCheckButtonClick(hotelID: string, locationID: string): void { + if (ASPxClientEdit.ValidateGroup("DateEditors")) { + var queryParams: { [key: string]: any } = { + location: locationID, + hotelID: hotelID, + checkin: getFormattedDate(checkInDateEdit.GetValue()), + checkout: getFormattedDate(checkOutDateEdit.GetValue()), + rooms: roomsSpinEdit.GetValue() || 1, + adults: adultsSpinEdit.GetValue() || 1, + children: childrenSpinEdit.GetValue() || 0 + }; + showPage("ShowRooms", queryParams); + } + }; + + export function onIndexOfferClick(): void { + showPage("SpecialOffers", {}); + }; + + export function onControlsInit(): void { + ASPxClientUtils.AttachEventToElement(window, 'popstate', onHistoryPopState); + var pathParts = document.location.href.split("/"); + var url = pathParts[pathParts.length - 1]; + try { + if (window.history) + window.history.replaceState(url, ""); + } catch (e) { } + ASPxClientUtils.AttachEventToElement(window, "resize", onWindowResize); + if (ASPxClientUtils.iOSPlatform) { + // animate + } + }; + + export function updateRatingLabels(ratingControl: ASPxClientTrackBar) { + var start = ratingControl.GetPositionStart().toString(); + var end = ratingControl.GetPositionEnd().toString(); + document.getElementById("cpLeftLabelID").innerHTML = start + " " + end; + }; + + export function onRatingControlItemClick(s: ASPxClientRatingControl, e: ASPxClientRatingControlItemClickEventArgs): void { + hotelDetailsCallbackPanel.PerformCallback(s.GetValue().toString()); + }; + + export function onInputKeyDown(s: ASPxClientTextBox, e: ASPxClientEditKeyEventArgs): void { + var keyCode = ASPxClientUtils.GetKeyCode(e.htmlEvent); + if (keyCode == 13) + (s.GetInputElement()).blur(); + }; + + function getCurrentPage(): string { + var hfPage = hiddenField.Get("page"); + if (hfPage) + return hfPage; + var pathParts = document.location.pathname.split("/"); + return pathParts[pathParts.length - 1]; + }; + + function showAboutWindow(): void { + aboutWindow.ShowAtElementByID("MainCallbackPanel_ContentPane"); + }; + + function hideMenu(): void { + leftPanel.Collapse(); + if (menuButton.GetMainElement() && menuButton.GetChecked()) + menuButton.SetChecked(false); + }; + + function showMenu(): void { + leftPanel.Expand(); + }; + + var _resizeSpecialOffersTimeoutID = -1; + function onWindowResize(): void { + switch (hiddenField.Get("page")) { + case "SpecialOffers": + if (_resizeSpecialOffersTimeoutID == -1) + _resizeSpecialOffersTimeoutID = setTimeout(resizeSpecialOffers, 200); + break; + } + hidePopups("AboutWindow", "StartFilterPopupControl", "LoginPopup", "OfferFormPopup", "ImagePopupControl"); + }; + + function hidePopups(...names: string[]): void { + for (var i = 0; i < names.length; i++) { + var popupControl = ASPxClientControl.GetControlCollection().GetByName(names[i]); + popupControl.Hide(); + } + }; + + function resizeSpecialOffers(): void { + for (var i = 1; i <= 4; i++) { + var panel = ASPxClientControl.GetControlCollection().GetByName("DockPanel" + i); + if (panel && panel.IsVisible()) { + var zone = panel.GetOwnerZone(); + zone.SetWidth(((zone.GetMainElement()).parentNode).offsetWidth) + } + } + _resizeSpecialOffersTimeoutID = -1; + }; + + function getFormattedDate(date: Date): string { + return (date.getMonth() + 1) + "-" + date.getDate() + "-" + date.getFullYear(); + }; + + function getCurrentQueryParams(): { [key:string]: any } { + var hfParams = hiddenField.Get("parameters"); + if (hfParams) + return getParamsByQueryString(hfParams); + var query = document.location.search; + if (query[0] === "?") + query = query.substr(1); + return getParamsByQueryString(query); + }; + + function getQueryString(params: { [key:string]: any }): string { + var queryItems: any[] = []; + for (var key in params) { + if (!params.hasOwnProperty(key)) continue; + queryItems.push(key + "=" + params[key]); + } + if (queryItems.length > 0) + return queryItems.join("&"); + return ""; + }; + + function getParamsByQueryString(queryString: string): { [key: string]: string } { + var result: { [key: string]: any } = {}; + if (queryString) { + var queryStringArray = queryString.split("&"); + for (var i = 0; i < queryStringArray.length; i++) { + var part = queryStringArray[i].split('='); + if (part.length != 2) continue; + result[part[0]] = decodeURIComponent(part[1].replace(/\+/g, " ")); + } + } + return result; + }; + + function onHistoryPopState(evt: any): void { + if (evt.state !== null && evt.state !== undefined) { + var uriParts = evt.state.split("?"); + showPage(uriParts[0], getParamsByQueryString(uriParts[1]), true); + } + }; +} \ No newline at end of file diff --git a/types/devexpress-web/v161/index.d.ts b/types/devexpress-web/v161/index.d.ts new file mode 100644 index 0000000000..331718afb0 --- /dev/null +++ b/types/devexpress-web/v161/index.d.ts @@ -0,0 +1,27630 @@ +// Type definitions for DevExpress ASP.NET v161.12 +// Project: http://devexpress.com/ +// Definitions by: DevExpress Inc. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * A client-side counterpart of the DashboardViewer extension. + */ +interface MVCxClientDashboardViewer extends ASPxClientDashboardViewer { +} +/** + * Represents a list of records from the dashboard data source. + */ +interface ASPxClientDashboardItemUnderlyingData { + /** + * Gets the number of rows in the underlying data set. + */ + GetRowCount(): number; + /** + * Returns the value of the specified cell within the underlying data set. + * @param rowIndex An integer value that specifies the zero-based index of the required row. + * @param dataMember A String that specifies the required data member. + */ + GetRowValue(rowIndex: number, dataMember: string): Object; + /** + * Returns an array of data members available in a data source. + */ + GetDataMembers(): string[]; + /** + * Returns whether or not a request for underlying data was successful. + */ + IsDataReceived(): boolean; + /** + * Returns a callstack containing the error caused by an unsuccessful request for underlying data. + */ + GetRequestDataError(): string; +} +/** + * Contains parameters used to obtain the underlying data for the dashboard item. + */ +interface ASPxClientDashboardItemRequestUnderlyingDataParameters { + /** + * Gets or sets an array of data member identifiers used to obtain underlying data. + * Value: An array of String objects that specify data member identifiers. + */ + DataMembers: string[]; + /** + * Gets or sets axis points used to obtain the underlying data. + * Value: An array of ASPxClientDashboardItemDataAxisPoint objects that represent axis points. + */ + AxisPoints: ASPxClientDashboardItemDataAxisPoint[]; + /** + * Gets or sets the dimension value used to obtain the underlying data. + * Value: The dimension value. + */ + ValuesByAxisName: Object; + /** + * Gets or sets the unique dimension value used to obtain the underlying data. + * Value: The unique dimension value. + */ + UniqueValuesByAxisName: Object; +} +/** + * References a method executed after an asynchronous request is complete. + */ +interface ASPxClientDashboardItemRequestUnderlyingDataCompleted { + /** + * References a method executed after an asynchronous request is completed. + * @param data An ASPxClientDashboardItemUnderlyingData object that represents a list of records from the dashboard data source. + */ + (data: ASPxClientDashboardItemUnderlyingData): void; +} +/** + * References a method that will handle the ItemClick event. + */ +interface ASPxClientDashboardItemClickEventHandler { + /** + * References a method that will handle the ItemClick event. + * @param source The event source. + * @param e A ASPxClientDashboardItemClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemClickEventArgs): void; +} +/** + * Provides data for the ItemClick event. + */ +interface ASPxClientDashboardItemClickEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the dashboard item for which the event has been raised. + * Value: A String that is the dashboard item name. + */ + ItemName: string; + /** + * Gets the dashboard item's client data. + */ + GetData(): ASPxClientDashboardItemData; + /** + * Returns the axis point corresponding to the clicked visual element. + * @param axisName A string value returned by the DashboardDataAxisNames class that specifies the name of the data axis. + */ + GetAxisPoint(axisName: string): ASPxClientDashboardItemDataAxisPoint; + /** + * Gets measures corresponding to the clicked visual element. + */ + GetMeasures(): ASPxClientDashboardItemDataMeasure[]; + /** + * Gets deltas corresponding to the clicked visual element. + */ + GetDeltas(): ASPxClientDashboardItemDataDelta[]; + /** + * Gets the dimensions used to create a hierarchy of axis points for the specified axis. + * @param axisName A string value returned by the DashboardDataAxisNames class that specifies the name of the data axis. + */ + GetDimensions(axisName: string): ASPxClientDashboardItemDataDimension[]; + /** + * Requests underlying data corresponding to the clicked visual element. + * @param onCompleted A ASPxClientDashboardItemRequestUnderlyingDataCompleted object that references a method executed after the request is completed. + * @param dataMembers An array of String values that specify data members used to obtain underlying data. + */ + RequestUnderlyingData(onCompleted: ASPxClientDashboardItemRequestUnderlyingDataCompleted, dataMembers: string[]): void; +} +/** + * References a method that will handle the ItemVisualInteractivity event. + */ +interface ASPxClientDashboardItemVisualInteractivityEventHandler { + /** + * References a method that will handle the ItemVisualInteractivity event. + * @param source The event source. + * @param e A ASPxClientDashboardItemVisualInteractivityEventArgs object containing event data. + */ + (source: S, e: ASPxClientDashboardItemVisualInteractivityEventArgs): void; +} +/** + * Provides data for the ItemVisualInteractivity event. + */ +interface ASPxClientDashboardItemVisualInteractivityEventArgs extends ASPxClientEventArgs { + /** + * Gets the component name of the dashboard item for which the event was raised. + * Value: A String that is the component name of the dashboard item. + */ + ItemName: string; + /** + * Gets the selection mode for dashboard item elements. + */ + GetSelectionMode(): string; + /** + * Sets the selection mode for dashboard item elements. + * @param selectionMode A String that specifies the selection mode. + */ + SetSelectionMode(selectionMode: string): void; + /** + * Returns whether or not highlighting is enabled for the current dashboard item. + */ + IsHighlightingEnabled(): boolean; + /** + * Enables highlighting for the current dashboard item. + * @param enableHighlighting true, to enable highlighting; otherwise, false. + */ + EnableHighlighting(enableHighlighting: boolean): void; + /** + * Gets data axes used to perform custom interactivity actions. + */ + GetTargetAxes(): string[]; + /** + * Sets data axes used to perform custom interactivity actions. + * @param targetAxes An array of String objects that specify names of data axes. + */ + SetTargetAxes(targetAxes: string[]): void; + /** + * Gets the default selection for the current dashboard item. + */ + GetDefaultSelection(): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Sets the default selection for the current dashboard item. + * @param values An array of ASPxClientDashboardItemDataAxisPointTuple objects specifying axis point tuples used to select default elements. + */ + SetDefaultSelection(values: ASPxClientDashboardItemDataAxisPointTuple[]): void; +} +/** + * References a method that will handle the ItemSelectionChanged event. + */ +interface ASPxClientDashboardItemSelectionChangedEventHandler { + /** + * References a method that will handle the ItemSelectionChanged event. + * @param source The event source. + * @param e A ASPxClientDashboardItemSelectionChangedEventArgs object containing event data. + */ + (source: S, e: ASPxClientDashboardItemSelectionChangedEventArgs): void; +} +/** + * Provides data for the ItemSelectionChanged event. + */ +interface ASPxClientDashboardItemSelectionChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the component name of the dashboard item for which the event was raised. + * Value: A String that is the component name of the dashboard item. + */ + ItemName: string; + /** + * Gets currently selected elements. + */ + GetCurrentSelection(): ASPxClientDashboardItemDataAxisPointTuple[]; +} +/** + * References a method that will handle the ItemElementCustomColor event. + */ +interface ASPxClientDashboardItemElementCustomColorEventHandler { + /** + * References a method that will handle the ItemElementCustomColor event. + * @param source The event source. + * @param e An ASPxClientDashboardItemElementCustomColorEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemElementCustomColorEventArgs): void; +} +/** + * Provides data for the ItemElementCustomColor event. + */ +interface ASPxClientDashboardItemElementCustomColorEventArgs extends ASPxClientEventArgs { + /** + * Gets the component name of the dashboard item for which the event was raised. + * Value: A String that is the component name of the dashboard item for which the event was raised. + */ + ItemName: string; + /** + * Gets the axis point tuple that corresponds to the current dashboard item element. + */ + GetTargetElement(): ASPxClientDashboardItemDataAxisPointTuple; + /** + * Gets the color of the current dashboard item element. + */ + GetColor(): string; + /** + * Sets the color of the current dashboard item element. + * @param color A String that specifies the color of the current dashboard item element. + */ + SetColor(color: string): void; + /** + * Gets measures corresponding to the current dashboard item element. + */ + GetMeasures(): ASPxClientDashboardItemDataMeasure[]; +} +/** + * References a method that will handle the ItemWidgetCreated event. + */ +interface ASPxClientDashboardItemWidgetCreatedEventHandler { + /** + * References a method that will handle the ItemWidgetCreated event. + * @param source The event source. + * @param e A ASPxClientDashboardItemWidgetEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemWidgetEventArgs): void; +} +/** + * References a method that will handle the ItemWidgetUpdating event. + */ +interface ASPxClientDashboardItemWidgetUpdatingEventHandler { + /** + * References a method that will handle the ItemWidgetUpdating event. + * @param source The event source. + * @param e A ASPxClientDashboardItemWidgetEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemWidgetEventArgs): void; +} +/** + * References a method that will handle the ItemWidgetUpdated event. + */ +interface ASPxClientDashboardItemWidgetUpdatedEventHandler { + /** + * References a method that will handle the ItemWidgetUpdated event. + * @param source The event source. + * @param e A ASPxClientDashboardItemWidgetEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemWidgetEventArgs): void; +} +/** + * References a method that will handle the ItemBeforeWidgetDisposed event. + */ +interface ASPxClientDashboardItemBeforeWidgetDisposedEventHandler { + /** + * References a method that will handle the ItemBeforeWidgetDisposed event. + * @param source The event source. + * @param e A ASPxClientDashboardItemWidgetEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemWidgetEventArgs): void; +} +/** + * Provides data for events related to client widgets used to visualize data in dashboard items. + */ +interface ASPxClientDashboardItemWidgetEventArgs extends ASPxClientEventArgs { + /** + * Gets the component name of the dashboard item for which the event was raised. + * Value: A String that is the component name of the dashboard item. + */ + ItemName: string; + /** + * Returns an underlying widget corresponding to the current dashboard item. + */ + GetWidget(): Object; +} +/** + * Represents multidimensional data visualized in the dashboard item. + */ +interface ASPxClientDashboardItemData { + /** + * Gets the names of the axes that constitute the current ASPxClientDashboardItemData. + */ + GetAxisNames(): string[]; + /** + * Returns the specified data axis. + * @param axisName A string value returned by the DashboardDataAxisNames class that specifies the name of the data axis. + */ + GetAxis(axisName: string): ASPxClientDashboardItemDataAxis; + /** + * Gets the dimensions used to create a hierarchy of axis points for the specified axis. + * @param axisName A string value returned by the DashboardDataAxisNames class that specifies the name of the data axis. + */ + GetDimensions(axisName: string): ASPxClientDashboardItemDataDimension[]; + /** + * Gets the measures for the current ASPxClientDashboardItemData object. + */ + GetMeasures(): ASPxClientDashboardItemDataMeasure[]; + /** + * Gets the deltas for the current ASPxClientDashboardItemData object. + */ + GetDeltas(): ASPxClientDashboardItemDataDelta[]; + /** + * Gets the slice of the current ASPxClientDashboardItemData object by the specified axis point tuple. + * @param tuple A ASPxClientDashboardItemDataAxisPointTuple object that is a tuple of axis points. + */ + GetSlice(tuple: ASPxClientDashboardItemDataAxisPointTuple): ASPxClientDashboardItemData; + /** + * Gets the slice of the current ASPxClientDashboardItemData object by the specified axis point. + * @param axisPoint An ASPxClientDashboardItemDataAxisPoint object that is the data point in a multidimensional space. + */ + GetSlice(axisPoint: ASPxClientDashboardItemDataAxisPoint): ASPxClientDashboardItemData; + /** + * Returns a total summary value for the specified measure. + * @param measureId A String that is the measure identifier. + */ + GetMeasureValue(measureId: string): ASPxClientDashboardItemDataMeasureValue; + /** + * Gets the summary value for the specified delta. + * @param deltaId A String that is the data item identifier. + */ + GetDeltaValue(deltaId: string): ASPxClientDashboardItemDataDeltaValue; + /** + * Returns an array of data members available in a data source. + */ + GetDataMembers(): string[]; + /** + * Creates a tuple based on the specified axes names and corresponding values. + * @param values An array of name-value pairs containing the axis name and corresponding values. + */ + CreateTuple(values: Object[]): ASPxClientDashboardItemDataAxisPointTuple; + /** + * Creates a tuple based on the specified axis points. + * @param axisPoints An array of ASPxClientDashboardItemDataAxisPoint objects that specify axis points belonging to different data axes. + */ + CreateTuple(axisPoints: ASPxClientDashboardItemDataAxisPoint[]): ASPxClientDashboardItemDataAxisPointTuple; +} +/** + * An axis that contains data points corresponding to the specified value hierarchy. + */ +interface ASPxClientDashboardItemDataAxis { + /** + * Gets the dimensions used to create a hierarchy of axis points belonging to the current axis. + */ + GetDimensions(): ASPxClientDashboardItemDataDimension[]; + /** + * Gets the root axis point belonging to the current ASPxClientDashboardItemDataAxis. + */ + GetRootPoint(): ASPxClientDashboardItemDataAxisPoint; + /** + * Returns axis points corresponding to values of the last-level dimension. + */ + GetPoints(): ASPxClientDashboardItemDataAxisPoint[]; + /** + * Returns axis points corresponding to the specified dimension. + * @param dimensionId A String that is the dimension identifier. + */ + GetPointsByDimension(dimensionId: string): ASPxClientDashboardItemDataAxisPoint[]; + /** + * Returns the data point for the specified axis by unique values. + * @param uniqueValues A hierarchy of unique values identifying the required data point. + */ + GetPointByUniqueValues(uniqueValues: Object[]): ASPxClientDashboardItemDataAxisPoint; +} +/** + * Contains the dimension metadata. + */ +interface ASPxClientDashboardItemDataDimension { + /** + * Gets the dimension identifier. + * Value: A String that is the dimension identifier. + */ + Id: string; + /** + * Gets or sets the name of the dimension. + * Value: A String that is the name of the dimension. + */ + Name: string; + /** + * Gets the data member identifier for the current dimension. + * Value: A String value that identifies a data member. + */ + DataMember: string; + /** + * Gets the group interval for date-time values for the current dimension. + * Value: A String value that represents how date-time values are grouped. + */ + DateTimeGroupInterval: string; + /** + * Gets the group interval for string values. + * Value: A String value that specifies the group interval for string values. + */ + TextGroupInterval: string; + /** + * Formats the specified value using format settings of the current dimension. + * @param value A value to be formatted. + */ + Format(value: Object): string; +} +/** + * Contains the measure metadata. + */ +interface ASPxClientDashboardItemDataMeasure { + /** + * Gets the measure identifier. + * Value: A String that is the measure identifier. + */ + Id: string; + /** + * Gets the name of the measure. + * Value: A String that is the name of the measure. + */ + Name: string; + /** + * Gets the data member that identifies the data source list used to provide data for the current measure. + * Value: A String value that identifies the data source list used to provide data for the current measure. + */ + DataMember: string; + /** + * Gets the type of summary function calculated against the current measure. + * Value: A String value that identifies the type of summary function calculated against the current measure. + */ + SummaryType: string; + /** + * Formats the specified value using format settings of the current measure. + * @param value A value to be formatted. + */ + Format(value: Object): string; +} +/** + * Contains the delta metadata. + */ +interface ASPxClientDashboardItemDataDelta { + /** + * Gets the data item identifier. + * Value: A String that is the data item identifier. + */ + Id: string; + /** + * Gets the name of the data item container. + * Value: A String value that is the name of the data item container. + */ + Name: string; + /** + * Gets the identifier for the measure that provides actual values. + * Value: A String value that is the measure identifier. + */ + ActualMeasureId: string; + /** + * Gets the identifier for the measure that provides target values. + * Value: A String value that is the measure identifier. + */ + TargetMeasureId: string; +} +/** + * Provides dimension values at the specified axis point. + */ +interface ASPxClientDashboardItemDataDimensionValue { + /** + * Gets the current dimension value. + */ + GetValue(): Object; + /** + * Gets the unique value for the current dimension value. + */ + GetUniqueValue(): Object; + /** + * Gets the display text for the current dimension value. + */ + GetDisplayText(): string; +} +/** + * Provides the measure value and display text. + */ +interface ASPxClientDashboardItemDataMeasureValue { + /** + * Gets the measure value. + */ + GetValue(): Object; + /** + * Gets the measure display text. + */ + GetDisplayText(): string; +} +/** + * Provides delta element values. + */ +interface ASPxClientDashboardItemDataDeltaValue { + /** + * Provides access to the actual value displayed within the delta element. + */ + GetActualValue(): ASPxClientDashboardItemDataMeasureValue; + /** + * Provides access to the target value. + */ + GetTargetValue(): ASPxClientDashboardItemDataMeasureValue; + /** + * Provides access to the absolute difference between the actual and target values. + */ + GetAbsoluteVariation(): ASPxClientDashboardItemDataMeasureValue; + /** + * Provides access to the percent of variation between the actual and target values. + */ + GetPercentVariation(): ASPxClientDashboardItemDataMeasureValue; + /** + * Provides access to the percentage of the actual value in the target value. + */ + GetPercentOfTarget(): ASPxClientDashboardItemDataMeasureValue; + /** + * Provides access to the main delta value. + */ + GetDisplayValue(): ASPxClientDashboardItemDataMeasureValue; + /** + * Provides access to the first additional delta value. + */ + GetDisplaySubValue1(): ASPxClientDashboardItemDataMeasureValue; + /** + * Provides access to the second additional delta value. + */ + GetDisplaySubValue2(): ASPxClientDashboardItemDataMeasureValue; + /** + * Gets the value specifying the condition for displaying the delta indication. + */ + GetIsGood(): ASPxClientDashboardItemDataMeasureValue; + /** + * Gets the type of delta indicator. + */ + GetIndicatorType(): ASPxClientDashboardItemDataMeasureValue; +} +/** + * A point on the data axis. + */ +interface ASPxClientDashboardItemDataAxisPoint { + /** + * Gets the name of the axis to which the current axis point belongs. + */ + GetAxisName(): string; + /** + * Gets the last level dimension corresponding to the current axis point. + */ + GetDimension(): ASPxClientDashboardItemDataDimension; + /** + * Gets the collection of dimensions used to create a hierarchy of axis points from the root point to the current axis point. + */ + GetDimensions(): ASPxClientDashboardItemDataDimension[]; + /** + * Gets the value corresponding to the current axis point. + */ + GetValue(): Object; + /** + * Gets the display text corresponding to the current axis point. + */ + GetDisplayText(): string; + /** + * Gets the unique value corresponding to the current axis point. + */ + GetUniqueValue(): Object; + /** + * Gets the dimension values at the specified axis point. + */ + GetDimensionValue(): ASPxClientDashboardItemDataDimensionValue; + /** + * Gets the dimension value at the current axis point. + * @param dimensionId A String value that specifies the dimension identifier. + */ + GetDimensionValue(dimensionId: string): ASPxClientDashboardItemDataDimensionValue; + /** + * Gets the child axis points for the current axis point. + */ + GetChildren(): ASPxClientDashboardItemDataAxisPoint[]; + /** + * Gets the parent axis point for the current axis point. + */ + GetParent(): ASPxClientDashboardItemDataAxisPoint; +} +/** + * Represents a tuple of axis points. + */ +interface ASPxClientDashboardItemDataAxisPointTuple { + /** + * Returns the axis point belonging to the default data axis. + */ + GetAxisPoint(): ASPxClientDashboardItemDataAxisPoint; + /** + * Returns the axis point belonging to the specified data axis. + * @param axisName A string value returned by the DashboardDataAxisNames class that specifies the name of the data axis. + */ + GetAxisPoint(axisName: string): ASPxClientDashboardItemDataAxisPoint; +} +/** + * A client-side equivalent of the ASPxDashboardDesigner control. + */ +interface ASPxClientDashboardDesigner extends ASPxClientControl { + /** + * Occurs after the state of the dashboard displayed in the ASPxClientDashboardDesigner is changed. + */ + DashboardStateChanged: ASPxClientEvent>; + /** + * Occurs after another dashboard is loaded to the ASPxClientDashboardDesigner. + */ + DashboardChanged: ASPxClientEvent>; + /** + * For internal use. + */ + CustomizeMenuItems: ASPxClientEvent>; + BeforeRender: ASPxClientEvent>; + /** + * Switches the ASPxClientDashboardDesigner to the viewer mode. + */ + SwitchToViewer(): void; + /** + * Switches the ASPxClientDashboardDesigner to the designer mode. + */ + SwitchToDesigner(): void; + /** + * Gets the current working mode of the Web Designer. + */ + GetWorkingMode(): string; + /** + * Gets the identifier of the dashboard that is displayed in the ASPxClientDashboardDesigner. + */ + GetDashboardId(): string; + /** + * Gets the name of the dashboard that is displayed in the ASPxClientDashboardDesigner. + */ + GetDashboardName(): string; + /** + * Gets the state of the dashboard (for instance, the master filtering state) displayed in the ASPxClientDashboardDesigner. + */ + GetDashboardState(): string; + /** + * Loads a dashboard with the specified identifier. + * @param dashboardId A String value that specifies the dashboard identifier. + */ + LoadDashboard(dashboardId: string): void; + /** + * Saves a dashboard to the dashboard storage. + */ + SaveDashboard(): void; +} +/** + * References a method that will handle the DashboardStateChanged event. + */ +interface ASPxClientDashboardStateChangedEventHandler { + /** + * References a method that will handle the DashboardStateChanged event. + * @param source The event source. + * @param e A ASPxClientDashboardStateChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardStateChangedEventArgs): void; +} +/** + * Provides data for the DashboardStateChanged event. + */ +interface ASPxClientDashboardStateChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the current state of the dashboard. + * Value: A String that is the current state of the dashboard. + */ + DashboardState: string; +} +/** + * References a method that will handle the DashboardChanged event. + */ +interface ASPxClientDashboardChangedEventHandler { + /** + * References a method that will handle the DashboardChanged event. + * @param source The event source. + * @param e A ASPxClientDashboardChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardChangedEventArgs): void; +} +/** + * Provides data for the DashboardChanged event. + */ +interface ASPxClientDashboardChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the identifier of a newly opened dashboard. + * Value: A String values that is an identifier of newly opened dashboard. + */ + DashboardId: string; + /** + * Gets the name of a newly opened dashboard. + * Value: A String values that is the name of newly opened dashboard. + */ + DashboardName: string; +} +interface ASPxClientDashboardDesignerCustomizeMenuItemsEventHandler { + (source: S, e: ASPxClientDashboardDesignerCustomizeMenuItemsEventArgs): void; +} +interface ASPxClientDashboardDesignerMenuItem { + id: string; + title: string; + template: string; + selected: boolean; + disabled: boolean; + hasSeparator: boolean; + click: Function; + hotKey: number; +} +interface ASPxClientDashboardDesignerCustomizeMenuItemsEventArgs extends ASPxClientEventArgs { + Items: ASPxClientDashboardDesignerMenuItem[]; + FindById(itemId: string): ASPxClientDashboardDesignerMenuItem; +} +interface ASPxClientDashboardDesignerBeforeRenderEventHandler { + (source: S, e: ASPxClientEventArgs): void; +} +/** + * A client-side equivalent of the ASPxDashboardViewer control. + */ +interface ASPxClientDashboardViewer extends ASPxClientControl { + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs after the available interactivity actions have changed. + */ + ActionAvailabilityChanged: ASPxClientEvent>; + /** + * Occurs when an end-user changes the state of the master filter. + */ + MasterFilterSet: ASPxClientEvent>; + /** + * Occurs when an end-user clears the selection in the master filter item. + */ + MasterFilterCleared: ASPxClientEvent>; + /** + * Provides the capability to handle data loading errors in the ASPxClientDashboardViewer. + */ + DataLoadingError: ASPxClientEvent>; + /** + * Occurs after a drill-down is performed. + */ + DrillDownPerformed: ASPxClientEvent>; + /** + * Occurs after a drill-up is performed. + */ + DrillUpPerformed: ASPxClientEvent>; + /** + * Occurs after the ASPxClientDashboardViewer is loaded. + */ + Loaded: ASPxClientEvent>; + /** + * Occurs when an end-user clicks a dashboard item. + */ + ItemClick: ASPxClientEvent>; + /** + * Allows you to provide custom visual interactivity for data-bound dashboard items that support element selection and highlighting + */ + ItemVisualInteractivity: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemWidgetCreated: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemWidgetUpdating: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemWidgetUpdated: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemBeforeWidgetDisposed: ASPxClientEvent>; + /** + * Occurs after the selection within the dashboard item is changed. + */ + ItemSelectionChanged: ASPxClientEvent>; + /** + * Allows you to color the required dashboard item elements using the specified colors. + */ + ItemElementCustomColor: ASPxClientEvent>; + /** + * Reloads data in the data sources. + */ + ReloadData(): void; + /** + * Reloads data in the data sources. + * @param parameters An array of ASPxClientDashboardParameter objects that specify dashboard parameters on the client side. + */ + ReloadData(parameters: ASPxClientDashboardParameter[]): void; + /** + * Returns dashboard parameter settings and metadata. + */ + GetParameters(): ASPxClientDashboardParameters; + /** + * Locks the EndUpdateParameters method call. + */ + BeginUpdateParameters(): void; + /** + * Unlocks the BeginUpdateParameters method and applies changes made to the parameter settings. + */ + EndUpdateParameters(): void; + /** + * Returns the currently selected range in the specified Range Filter dashboard item. + * @param itemName A String value that specifies the component name of the Range Filter dashboard item. + */ + GetCurrentRange(itemName: string): ASPxClientDashboardRangeFilterSelection; + /** + * Returns the visible range for the specified Range Filter dashboard item. + * @param itemName A String value that specifies the component name of the Range Filter dashboard item. + */ + GetEntireRange(itemName: string): ASPxClientDashboardRangeFilterSelection; + /** + * Selects the required range in the specified Range Filter dashboard item. + * @param itemName A String that specifies the component name of the Range Filter dashboard item. + * @param range A String value that specifies the component name of the Range Filter dashboard item. + */ + SetRange(itemName: string, range: ASPxClientDashboardRangeFilterSelection): void; + /** + * Selects the specified range in the specified Range Filter dashboard item. + * @param itemName A String that specifies the component name of the Range Filter dashboard item. + * @param dateTimePeriodName A String that specifies the name of the predefined range used to perform a selection. + */ + SetRange(itemName: string, dateTimePeriodName: string): void; + /** + * Returns axis point tuples identifying elements that can be used to perform drill-down in the specified dashboard item. + * @param itemName A String that is the component name of the dashboard item. + */ + GetAvailableDrillDownValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Returns the axis point tuple identifying the current drill-down state. + * @param itemName A String that is the component name of the dashboard item. + */ + GetCurrentDrillDownValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple; + /** + * Returns axis point tuples identifying elements that can be selected in the current state of the master filter item. + * @param itemName A String that is the component name of the master filter item. + */ + GetAvailableFilterValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Returns axis point tuples identifying currently selected elements in the master filter item. + * @param itemName A String that is the component name of the master filter item. + */ + GetCurrentFilterValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Returns currently selected elements in the master filter item. + * @param itemName A String that specifies a component name of the master filter item. + */ + GetCurrentSelection(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Requests underlying data for the specified dashboard item. + * @param itemName A String that specifies the component name of the dashboard item. + * @param args A ASPxClientDashboardItemRequestUnderlyingDataParameters object containing parameters used to obtain the underlying data. + * @param onCompleted A ASPxClientDashboardItemRequestUnderlyingDataCompleted object that references a method executed after the request is completed. + */ + RequestUnderlyingData(itemName: string, args: ASPxClientDashboardItemRequestUnderlyingDataParameters, onCompleted: ASPxClientDashboardItemRequestUnderlyingDataCompleted): void; + /** + * Invokes the Dashboard Parameters dialog. + */ + ShowParametersDialog(): void; + /** + * Closes the Dashboard Parameters dialog. + */ + HideParametersDialog(): void; + /** + * Returns settings that specify parameters affecting how the dashboard is exported. + */ + GetExportOptions(): ASPxClientDashboardExportOptions; + /** + * Specifies settings that specify parameters affecting how the dashboard is exported. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + */ + SetExportOptions(options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard to a PDF file and writes it to the Response. + */ + ExportToPdf(): void; + /** + * Exports a dashboard to a PDF file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + */ + ExportToPdf(options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard to an Image file and writes it to the Response. + */ + ExportToImage(): void; + /** + * Exports a dashboard to an Image file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + */ + ExportToImage(options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to a PDF file and writes it to the Response. + * @param itemName A String that is the component name of the dashboard item to be exported. + */ + ExportDashboardItemToPdf(itemName: string): void; + /** + * Exports a dashboard item to a PDF file with the specified export options and writes it to the Response. + * @param itemName A String that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + */ + ExportDashboardItemToPdf(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to an Image file and writes it to the Response. + * @param itemName A String that is the component name of the dashboard item to be exported. + */ + ExportDashboardItemToImage(itemName: string): void; + /** + * Exports a dashboard item to an Image file with the specified export options and writes it to the Response. + * @param itemName A String that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + */ + ExportDashboardItemToImage(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to an Excel file and writes it to the Response. + * @param itemName A String that is the component name of the dashboard item to be exported. + */ + ExportDashboardItemToExcel(itemName: string): void; + /** + * Exports a dashboard item to an Excel file with the specified export options and writes it to the Response. + * @param itemName A String that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + */ + ExportDashboardItemToExcel(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Returns the dashboard width. + */ + GetWidth(): number; + /** + * Returns the dashboard height. + */ + GetHeight(): number; + /** + * Specifies the dashboard width. + * @param width An integer value that specifies the dashboard width. + */ + SetWidth(width: number): void; + /** + * Specifies the dashboard height. + * @param height An integer value that specifies the dashboard height. + */ + SetHeight(height: number): void; + /** + * Specifies the dashboard size. + * @param width An integer value that specifies the dashboard width. + * @param height An integer value that specifies the dashboard height. + */ + SetSize(width: number, height: number): void; + /** + * Selects required elements by their values in the specified master filter item. + * @param itemName A String that species the component name of the master filter item. + * @param values Values that will be used to select elements in the master filter item. + */ + SetMasterFilter(itemName: string, values: Object[][]): void; + /** + * Selects the required elements in the specified master filter item. + * @param itemName A String that specifies the component name of the master filter item. + * @param axisPointTuples An array of ASPxClientDashboardItemDataAxisPointTuple objects used to identify master filter elements. + */ + SetMasterFilter(itemName: string, axisPointTuples: ASPxClientDashboardItemDataAxisPointTuple[]): void; + /** + * Performs a drill-down for the required element by its value. + * @param itemName A String that species the component name of the dashboard item. + * @param value A value that will be used to perform a drill-down for the required element. + */ + PerformDrillDown(itemName: string, value: Object): void; + /** + * Performs a drill-down for the required element. + * @param itemName A String that specifies the component name of the dashboard item. + * @param axisPointTuple A ASPxClientDashboardItemDataAxisPointTuple object representing a set of axis points. + */ + PerformDrillDown(itemName: string, axisPointTuple: ASPxClientDashboardItemDataAxisPointTuple): void; + /** + * Clears the specified master filter item. + * @param itemName A String that specifies the component name of the master filter item. + */ + ClearMasterFilter(itemName: string): void; + /** + * Performs a drill-up for the specified dashboard item. + * @param itemName A String that specifies the component name of the dashboard item. + */ + PerformDrillUp(itemName: string): void; + /** + * Returns whether or not the specified master filter item allows selecting one or more elements. + * @param itemName A String that specifies the component name of the master filter item. + */ + CanSetMasterFilter(itemName: string): boolean; + /** + * Returns whether or not the specified master filter can be cleared in the current state. + * @param itemName A String that specifies the component name of the master filter item. + */ + CanClearMasterFilter(itemName: string): boolean; + /** + * Returns whether or not drill down is possible in the current state of the specified dashboard item. + * @param itemName A String that specifies the component name of the dashboard item. + */ + CanPerformDrillDown(itemName: string): boolean; + /** + * Returns whether or not drill up is possible in the current state of the specified dashboard item. + * @param itemName A String that specifies the component name of the dashboard item. + */ + CanPerformDrillUp(itemName: string): boolean; + /** + * Returns the client data for the specified dashboard item. + * @param itemName A String that specifies the component name of the dashboard item. + */ + GetItemData(itemName: string): ASPxClientDashboardItemData; +} +/** + * A range in the Range Filter dashboard item. + */ +interface ASPxClientDashboardRangeFilterSelection { + /** + * Gets or sets a maximum value in the range of the Range Filter dashboard item. + * Value: A maximum value in the range of the Range Filter dashboard item. + */ + Maximum: Object; + /** + * Gets or sets a minimum value in the range of the Range Filter dashboard item. + * Value: A minimum value in the range of the Range Filter dashboard item. + */ + Minimum: Object; +} +/** + * A collection of ASPxClientDashboardParameter objects. + */ +interface ASPxClientDashboardParameters { + /** + * Returns an array of dashboard parameters from the ASPxClientDashboardParameters collection. + */ + GetParameterList(): ASPxClientDashboardParameter[]; + /** + * Returns a dashboard parameter by its name. + * @param name A String object that specifies the parameter name. + */ + GetParameterByName(name: string): ASPxClientDashboardParameter; + /** + * Returns a dashboard parameter by its index in the ASPxClientDashboardParameters collection. + * @param index An integer value that specifies the parameter index. + */ + GetParameterByIndex(index: number): ASPxClientDashboardParameter; +} +/** + * A client-side dashboard parameter. + */ +interface ASPxClientDashboardParameter { + /** + * Gets the dashboard parameter name on the client side. + * Value: A String that is the dashboard parameter name on the client side. + */ + Name: string; + /** + * Gets the dashboard parameter value on the client side. + * Value: A String that specifies the dashboard parameter value on the client side. + */ + Value: Object; + /** + * Returns a parameter name. + */ + GetName(): string; + /** + * Returns a current parameter value. + */ + GetValue(): Object; + /** + * Specifies the current parameter value. + * @param value The current parameter value. + */ + SetValue(value: Object): void; + /** + * Returns a default parameter value. + */ + GetDefaultValue(): Object; + /** + * Returns the parameter's description displayed to an end-user. + */ + GetDescription(): string; + /** + * Returns a parameter type. + */ + GetType(): string; + /** + * Returns possible parameter values. + */ + GetValues(): ASPxClientDashboardParameterValue[]; +} +/** + * Provides access to the parameter value and display text. + */ +interface ASPxClientDashboardParameterValue { + /** + * Returns the parameter display text. + */ + GetDisplayText(): string; + /** + * Returns a parameter value. + */ + GetValue(): Object; +} +/** + * Contains settings that specify parameters affecting how the dashboard or dashboard item is exported in Image format. + */ +interface ImageFormatOptions { + /** + * Gets or sets an image format in which the dashboard (dashboard item) is exported. + * Value: A value returned by the DashboardExportImageFormat class that specifies an image format in which the dashboard (dashboard item) is exported. + */ + Format: string; + /** + * Gets or sets the resolution (in dpi) used to export a dashboard (dashboard item) in Image format. + * Value: An integer value that specifies the resolution (in dpi) used to export a dashboard (dashboard item) in Image format. + */ + Resolution: number; +} +/** + * Contains options which define how the dashboard item is exported to Excel format. + */ +interface ExcelFormatOptions { + /** + * Gets or sets the Excel format in which the dashboard item is exported. + * Value: A value returned by the DashboardExportExcelFormat class that specifies the Excel format in which the dashboard item is exported. + */ + Format: string; + /** + * Gets or sets a character used to separate values in a CSV document. + * Value: A String value that specifies the character used to separate values in a CSV document. + */ + CsvValueSeparator: string; +} +/** + * Contains settings that specify parameters affecting how the Grid dashboard item is exported. + */ +interface GridExportOptions { + /** + * Gets or sets whether the size of the Grid dashboard item is changed according to the width of the exported page. + * Value: true, to change the size of the Grid dashboard item according to the width of the exported page; otherwise, false. + */ + FitToPageWidth: boolean; + /** + * Gets or sets whether to print column headers of the Grid dashboard item on every page. + * Value: true, to print column headers on every page; otherwise, false. + */ + PrintHeadersOnEveryPage: boolean; +} +/** + * Contains settings that specify parameters affecting how the Pivot dashboard item is exported. + */ +interface PivotExportOptions { + /** + * Gets or sets whether to print the column headers of the pivot dashboard item on every page. + * Value: true, to print column headers on every page; otherwise, false. + */ + PrintHeadersOnEveryPage: boolean; +} +/** + * Contains settings that specify parameters affecting how the Pie dashboard item is exported. + */ +interface PieExportOptions { + /** + * Gets or sets whether dashboard item elements are arranged automatically on the exported page. + * Value: true, to arrange dashboard item elements automatically on the exported page; otherwise, false. + */ + AutoArrangeContent: boolean; +} +/** + * Contains settings that specify parameters affecting how the Gauge dashboard item is exported. + */ +interface GaugeExportOptions { + /** + * Gets or sets whether dashboard item elements are arranged automatically on the exported page. + * Value: true, to arrange dashboard item elements automatically on the exported page; otherwise, false. + */ + AutoArrangeContent: boolean; +} +/** + * Contains settings that specify parameters affecting how the Card dashboard item is exported. + */ +interface CardExportOptions { + /** + * Gets or sets whether dashboard item elements are arranged automatically on the exported page. + * Value: true, to arrange dashboard item elements automatically on the exported page; otherwise, false. + */ + AutoArrangeContent: boolean; +} +/** + * Contains settings that specify parameters affecting how the Range Filter dashboard item is exported. + */ +interface RangeFilterExportOptions { + /** + * Gets or sets whether the page orientation used to export a Range Filter dashboard item is selected automatically. + * Value: true, to automatically select the page orientation used to export a Range Filter dashboard item; otherwise, false. + */ + AutomaticPageLayout: boolean; + /** + * Gets or sets the export size mode for the Range Filter dashboard item. + * Value: A value returned by the RangeFilterExportSizeMode class that specifies the export size mode for the Range Filter dashboard item. + */ + SizeMode: string; +} +/** + * Contains settings that specify parameters affecting how Chart dashboard items are exported. + */ +interface ChartExportOptions { + /** + * Gets or sets whether the page orientation used to export a Chart dashboard item is selected automatically. + * Value: true, to automatically select the page orientation used to export a Chart dashboard item; otherwise, false. + */ + AutomaticPageLayout: boolean; + /** + * Gets or sets the export size mode for the Chart dashboard item. + * Value: A value returned by the ChartExportSizeMode class that specifies the export size mode for the Chart dashboard item. + */ + SizeMode: string; +} +/** + * Contains settings that specify parameters affecting how map dashboard items are exported. + */ +interface MapExportOptions { + /** + * Gets or sets whether the page orientation used to export a map dashboard item is selected automatically. + * Value: true, to automatically select the page orientation used to export a map dashboard item; otherwise, false. + */ + AutomaticPageLayout: boolean; + /** + * Gets or sets the export size mode for the map dashboard item. + * Value: A value returned by the MapExportSizeMode class that specifies specifies the export size mode for the map dashboard item. + */ + SizeMode: string; +} +/** + * Contains settings that specify parameters affecting how the dashboard (dashboard item) is exported. + */ +interface ASPxClientDashboardExportOptions { + /** + * Gets or sets the standard paper size. + * Value: A string value returned by the DashboardExportPaperKind class that specifies the standard paper size. + */ + PaperKind: string; + /** + * Gets or sets the page orientation used to export a dashboard (dashboard item). + * Value: A string value returned by the DashboardExportPageLayout class that specifies the page orientation used to export a dashboard (dashboard item). + */ + PageLayout: string; + /** + * Gets or sets the mode for scaling when exporting a dashboard (dashboard item). + * Value: A string value returned by the DashboardExportScaleMode class that specifies the mode for scaling when exporting a dashboard (dashboard item). + */ + ScaleMode: string; + /** + * Gets or sets the scale factor (in fractions of 1) by which a dashboard (dashboard item) is scaled. + * Value: A Single value that specifies the scale factor by which a dashboard (dashboard item) is scaled. + */ + ScaleFactor: number; + /** + * Gets or sets the number of horizontal/vertical pages spanning the total width/height of a dashboard (dashboard item). + * Value: An integer value that specifies the number of horizontal/vertical pages spanning the total width/height of a dashboard (dashboard item). + */ + AutoFitPageCount: number; + /** + * Gets or sets the title of the exported document. + * Value: A String value that specifies the title of the exported document. + */ + Title: string; + /** + * Gets or sets whether a dashboard title (or dashboard item's caption) is included as the exported document title. + * Value: A DefaultBoolean value that specifies whether a dashboard title (or dashboard item's caption) is included as the exported document title. + */ + ShowTitle: boolean; + /** + * Gets or sets the filter state's location on the exported document. + * Value: A string value returned by the DashboardExportFilterState class that specifies the filter state's location on the exported document. + */ + FilterState: string; + /** + * Provides access to options for exporting a dashboard or individual items in Image format. + * Value: An ImageFormatOptions object containing settings that specify parameters affecting how the dashboard or dashboard item is exported in Image format. + */ + ImageOptions: ImageFormatOptions; + /** + * Provides access to options for exporting individual dashboard items in Excel format. + * Value: An ExcelFormatOptions object containing settings that specify parameters affecting how the dashboard item is exported in Excel format. + */ + ExcelOptions: ExcelFormatOptions; + /** + * Provides access to options for exporting a Grid dashboard item. + * Value: A GridExportOptions object containing settings that specify parameters that affect how Grid dashboard items are exported. + */ + GridOptions: GridExportOptions; + /** + * Provides access to options for exporting a Pivot dashboard item. + * Value: A PivotExportOptions object containing settings that specify parameters that affect how Pivot dashboard items are exported. + */ + PivotOptions: PivotExportOptions; + /** + * Provides access to options for exporting a Pie dashboard item. + * Value: A PieExportOptions object containing settings that specify parameters that affect how Pie dashboard items are exported. + */ + PieOptions: PieExportOptions; + /** + * Provides access to options for exporting a Gauge dashboard item. + * Value: A GaugeExportOptions object containing settings that specify parameters that affect how Gauge dashboard items are exported. + */ + GaugeOptions: GaugeExportOptions; + /** + * Provides access to options for exporting a Card dashboard item. + * Value: A CardExportOptions object containing settings that specify parameters that affect how Card dashboard items are exported. + */ + CardOptions: CardExportOptions; + /** + * Provides access to options for exporting a Range Filter dashboard item. + * Value: A RangeFilterExportOptions object containing settings that specify parameters affecting how the Range Filter dashboard item is exported. + */ + RangeFilterOptions: RangeFilterExportOptions; + /** + * Provides access to options for exporting a Chart dashboard item. + * Value: A ChartExportOptions object containing settings that specify parameters that affect how Chart dashboard items are exported. + */ + ChartOptions: ChartExportOptions; + /** + * Provides access to options for exporting map dashboard items. + * Value: A MapExportOptions object containing settings that specify parameters that affect how map dashboard items are exported. + */ + MapOptions: MapExportOptions; +} +/** + * References a method that will handle the ActionAvailabilityChanged event. + */ +interface ASPxClientDashboardActionAvailabilityChangedEventHandler { + /** + * References a method that will handle the ActionAvailabilityChanged event. + * @param source The event source. + * @param e A ASPxClientDashboardActionAvailabilityChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardActionAvailabilityChangedEventArgs): void; +} +/** + * Provides data for the ActionAvailabilityChanged event. + */ +interface ASPxClientDashboardActionAvailabilityChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets whether or not data reloading is available in the current state of dashboard item. + * Value: true, if data reloading is available in the current state of dashboard item; otherwise, false. + */ + IsReloadDataAvailable: boolean; + /** + * Gets interactivity actions currently available for the dashboard item. + * Value: An array of ASPxClientDashboardItemAction objects that represent interactivity actions currently available for the dashboard item. + */ + ItemActions: ASPxClientDashboardItemAction[]; +} +/** + * References a method that will handle the DataLoadingError event. + */ +interface ASPxClientDashboardDataLoadingErrorEventHandler { + /** + * References a method that will handle the DataLoadingError event. + * @param source The event source. + * @param e A ASPxClientDashboardDataLoadingErrorEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardDataLoadingErrorEventArgs): void; +} +/** + * Provides data for the DataLoadingError event. + */ +interface ASPxClientDashboardDataLoadingErrorEventArgs extends ASPxClientEventArgs { + /** + * Allows you to determine whether or not the error message will be shown. + */ + IsErrorMessageShown(): boolean; + /** + * Allows you to specify whether to show the error message. + * @param value true, to show the error message; otherwise, false. + */ + ShowErrorMessage(value: boolean): void; + /** + * Allows you to obtain the displayed error message. + */ + GetError(): string; + /** + * Allows you to specify the displayed error message. + * @param value A string value that specifies the displayed error message. + */ + SetError(value: string): void; +} +/** + * Represents an interactivity action in the dashboard item. + */ +interface ASPxClientDashboardItemAction { + /** + * Gets the name of the dashboard item. + * Value: A String that specifies the name of the dashboard item. + */ + ItemName: string; + /** + * Gets interactivity actions performed on a dashboard item. + * Value: An array of ASPxClientDashboardAction values that specify interactivity actions performed on a dashboard item. + */ + Actions: any[]; +} +declare enum ASPxClientDashboardAction { + SetMasterFilter=0, + ClearMasterFilter=1, + DrillDown=2, + DrillUp=3 +} +/** + * References a method that will handle the MasterFilterSet event. + */ +interface ASPxClientDashboardMasterFilterSetEventHandler { + /** + * References a method that will handle the MasterFilterSet event. + * @param source The event source. + * @param e A ASPxClientDashboardMasterFilterSetEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardMasterFilterSetEventArgs): void; +} +/** + * Provides data for the MasterFilterSet event. + */ +interface ASPxClientDashboardMasterFilterSetEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the dashboard item. + * Value: A String that specifies the name of the dashboard item. + */ + ItemName: string; + /** + * Gets values of currently selected elements in the master filter item. + * Value: Values of currently selected elements in the master filter item. + */ + Values: Object[][]; + /** + * Returns whether or not the specified value is NullValue. + * @param value The specified value. + */ + IsNullValue(value: Object): boolean; + /** + * Returns whether or not the specified value is OthersValue. + * @param value The specified value. + */ + IsOthersValue(value: Object): boolean; +} +/** + * References a method that will handle the MasterFilterCleared event. + */ +interface ASPxClientDashboardMasterFilterClearedEventHandler { + /** + * References a method that will handle the MasterFilterCleared event. + * @param source The event source. + * @param e A ASPxClientDashboardMasterFilterClearedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardMasterFilterClearedEventArgs): void; +} +/** + * Provides data for the MasterFilterCleared event. + */ +interface ASPxClientDashboardMasterFilterClearedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the dashboard item. + * Value: A String that is the name of the dashboard item. + */ + ItemName: string; +} +/** + * References a method that will handle the DrillDownPerformed event. + */ +interface ASPxClientDashboardDrillDownPerformedEventHandler { + /** + * References a method that will handle the DrillDownPerformed event. + * @param source The event source. + * @param e A ASPxClientDashboardDrillDownPerformedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardDrillDownPerformedEventArgs): void; +} +/** + * Provides data for the DrillDownPerformed event. + */ +interface ASPxClientDashboardDrillDownPerformedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the dashboard item. + * Value: A String that specifies the name of the dashboard item. + */ + ItemName: string; + /** + * Gets the bottommost value from the current drill-down hierarchy. + * Value: The bottommost value from the current drill-down hierarchy. + */ + Value: Object[]; + /** + * Returns whether or not the specified value is NullValue. + * @param value The specified value. + */ + IsNullValue(value: Object): boolean; + /** + * Returns whether or not the specified value is OthersValue. + * @param value The specified value. + */ + IsOthersValue(value: Object): boolean; +} +/** + * References a method that will handle the DrillUpPerformed event. + */ +interface ASPxClientDashboardDrillUpPerformedEventHandler { + /** + * References a method that will handle the DrillUpPerformed event. + * @param source The event source. + * @param e A ASPxClientDashboardDrillUpPerformedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardDrillUpPerformedEventArgs): void; +} +/** + * Provides data for the DrillUpPerformed event. + */ +interface ASPxClientDashboardDrillUpPerformedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the dashboard item. + * Value: A String that is the name of the dashboard item. + */ + ItemName: string; +} +/** + * Serves as the base object for all the editors included in the client-side object model. + */ +interface ASPxClientEditBase extends ASPxClientControl { + /** + * Returns the editor's value. + */ + GetValue(): Object; + /** + * Changes the editor's value. + * @param value An object representing the data to be assigned to the editor's edit value. + */ + SetValue(value: Object): void; + /** + * Returns a value indicating whether an editor is enabled. + */ + GetEnabled(): boolean; + /** + * Specifies whether an editor is enabled. + * @param value true to enable the editor; otherwise, false. + */ + SetEnabled(value: boolean): void; + /** + * Returns the text displayed in the editor caption. + */ + GetCaption(): string; + /** + * Specifies the text displayed in the editor caption. + * @param caption A string value specifying the editor caption. + */ + SetCaption(caption: string): void; +} +/** + * Serves as the base object for all the editors that support validation. + */ +interface ASPxClientEdit extends ASPxClientEditBase { + /** + * Fires on the client side when the editor receives input focus. + */ + GotFocus: ASPxClientEvent>; + /** + * Fires on the client side when the editor loses input focus. + */ + LostFocus: ASPxClientEvent>; + /** + * Allows you to specify whether the value entered into the editor is valid, and whether the editor is allowed to lose focus. + */ + Validation: ASPxClientEvent>; + /** + * Fires after the editor's value has been changed by end-user interactions. + */ + ValueChanged: ASPxClientEvent>; + /** + * Returns an HTML element that represents the control's input element. + */ + GetInputElement(): Object; + /** + * Sets input focus to the editor. + */ + Focus(): void; + /** + * Gets a value that indicates whether the editor's value passes validation. + */ + GetIsValid(): boolean; + /** + * Gets the error text to be displayed within the editor's error frame if the editor's validation fails. + */ + GetErrorText(): string; + /** + * Sets a value that specifies whether the editor's value is valid. + * @param isValid True if the editor's value is valid; otherwise, False. + */ + SetIsValid(isValid: boolean): void; + /** + * Sets the error text to be displayed within the editor's error frame if the editor's validation fails. + * @param errorText A string value representing the error text. + */ + SetErrorText(errorText: string): void; + /** + * Performs the editor's validation. + */ + Validate(): void; +} +/** + * Represents the client-side equivalent of the ASPxBinaryImage control. + */ +interface ASPxClientBinaryImage extends ASPxClientEdit { + /** + * Occurs on the client side after an image is clicked. + */ + Click: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client side if any server error occurs during server-side processing of a callback sent by the ASPxClientBinaryImage. + */ + CallbackError: ASPxClientEvent>; + /** + * Sets the size of the image editor. + * @param width An integer value that specifies the control's width. + * @param height An integer value that specifies the control's height. + */ + SetSize(width: number, height: number): void; + /** + * For internal use only. + */ + GetValue(): Object; + /** + * For internal use only. + * @param value + */ + SetValue(value: Object): void; + /** + * Removes an image from the editor content. + */ + Clear(): void; + /** + * Returns a name of the last uploaded file. + */ + GetUploadedFileName(): string; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * Represents the client-side equivalent of the ASPxButton control. + */ +interface ASPxClientButton extends ASPxClientControl { + /** + * Occurs on the client side when the button's checked state is changed. + */ + CheckedChanged: ASPxClientEvent>; + /** + * Fires on the client side when the button receives input focus. + */ + GotFocus: ASPxClientEvent>; + /** + * Fires on the client side when the button loses input focus. + */ + LostFocus: ASPxClientEvent>; + /** + * Occurs on the client side after a button is clicked. + */ + Click: ASPxClientEvent>; + /** + * Simulates a mouse click action on the button control. + */ + DoClick(): void; + /** + * Returns a value indicating whether the button is checked. + */ + GetChecked(): boolean; + /** + * Sets a value that specifies the button's checked status. + * @param value true if the button is checked; otherwise, false. + */ + SetChecked(value: boolean): void; + /** + * Returns the text displayed within the button. + */ + GetText(): string; + /** + * Sets the text to be displayed within the button. + * @param value A string value specifying the text to be displayed within the button. + */ + SetText(value: string): void; + /** + * Returns the URL pointing to the image displayed within the button. + */ + GetImageUrl(): string; + /** + * Sets the URL pointing to the image displayed within the button. + * @param value A string value that is the URL to the image displayed within the button. + */ + SetImageUrl(value: string): void; + /** + * Sets a value specifying whether the button is enabled. + * @param value true to enable the button; false to disable it. + */ + SetEnabled(value: boolean): void; + /** + * Returns a value indicating whether the button is enabled. + */ + GetEnabled(): boolean; + /** + * Sets input focus to the button. + */ + Focus(): void; +} +/** + * A method that will handle the client Click event. + */ +interface ASPxClientButtonClickEventHandler { + /** + * A method that will handle the client Click event. + * @param source An object that is the event's source. + * @param e An ASPxClientButtonClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientButtonClickEventArgs): void; +} +/** + * Provides data for the Click event. + */ +interface ASPxClientButtonClickEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Specifies whether both the event's default action and the event's bubbling upon the hierarchy of event handlers should be canceled. + * Value: true to cancel the event's default action and the event's bubbling upon the hierarchy of event handlers; otherwise, false. + */ + cancelEventAndBubble: boolean; +} +/** + * Represents the client-side equivalent of the ASPxCalendar control. + */ +interface ASPxClientCalendar extends ASPxClientEdit { + /** + * Fires on the client side after the selected date has been changed within the calendar. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Occurs on the client side when the month displayed within the calendar is changed. + */ + VisibleMonthChanged: ASPxClientEvent>; + /** + * Allows you to disable the calendar's days. + */ + CustomDisabledDate: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user presses a key while the editor has focus. + */ + KeyDown: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user presses and releases a key while the editor has focus. + */ + KeyPress: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user releases a pressed key while the editor has focus. + */ + KeyUp: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after the callback server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientCalendar. + */ + CallbackError: ASPxClientEvent>; + /** + * Tests whether the specified date is selected. + * @param date A date-time value that specifies the date to test. + */ + IsDateSelected(date: Date): boolean; + /** + * Sets the date that specifies the month and year to be displayed in the calendar. + * @param date The date that specifies calendar's visible month and year. + */ + SetVisibleDate(date: Date): void; + /** + * Sets the calendar's selected date. + * @param date A date object that specifies the calendar's selected date. + */ + SetSelectedDate(date: Date): void; + /** + * Returns the calendar's selected date. + */ + GetSelectedDate(): Date; + /** + * Gets the date that determines the month and year that are currently displayed in the calendar. + */ + GetVisibleDate(): Date; + /** + * Selects the specified date within the calendar. + * @param date A date-time value that specifies the selected date. + */ + SelectDate(date: Date): void; + /** + * Selects the specified range of dates within the calendar. + * @param start A date-time value that specifies the range's first date. + * @param end A date-time value that specifies the range's last date. + */ + SelectRange(start: Date, end: Date): void; + /** + * Deselects the specified date within the calendar. + * @param date A date-time value that specifies the date to deselect. + */ + DeselectDate(date: Date): void; + /** + * Deselects the specified range of dates within the calendar. + * @param start A date-time value that specifies the range's first date. + * @param end A date-time value that specifies the range's last date. + */ + DeselectRange(start: Date, end: Date): void; + /** + * Deselects all the selected dates within the calendar. + */ + ClearSelection(): void; + /** + * Returns a list of dates which are selected within the calendar. + */ + GetSelectedDates(): Date[]; + /** + * Gets the minimum date on the calendar. + */ + GetMinDate(): Date; + /** + * Sets the minimum date of the calendar. + * @param date A DateTime object representing the minimum date. + */ + SetMinDate(date: Date): void; + /** + * Gets the maximum date on the calendar. + */ + GetMaxDate(): Date; + /** + * Sets the maximum date of the calendar. + * @param date A DateTime object representing the maximum date. + */ + SetMaxDate(date: Date): void; +} +/** + * Provides data for the CustomDisabledDate event. + */ +interface ASPxClientCalendarCustomDisabledDateEventArgs extends ASPxClientEventArgs { + /** + * Gets the date processed in the calendar. + * Value: A DateTime value containing processed data. + */ + date: Date; + /** + * Gets or sets a value specifying whether selection of the processed calendar date is disabled. + * Value: true, if the date is disabled; otherwise, false. + */ + isDisabled: boolean; +} +/** + * A method that will handle the client CustomDisabledDate event. + */ +interface ASPxClientCalendarCustomDisabledDateEventHandler { + /** + * A method that will handle the client CustomDisabledDate event. + * @param source The event source. + * @param e An ASPxClientCalendarCustomDisabledDateEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCalendarCustomDisabledDateEventArgs): void; +} +/** + * Represents the client-side equivalent of the ASPxCaptcha control. + */ +interface ASPxClientCaptcha extends ASPxClientControl { + /** + * Sets input focus to the control's text box. + */ + Focus(): void; + /** + * Refreshes the code displayed within the editor's challenge image. + */ + Refresh(): void; +} +/** + * Represents the client-side equivalent of the ASPxCheckBox control. + */ +interface ASPxClientCheckBox extends ASPxClientEdit { + /** + * Occurs on the client side when the editor's checked state is changed. + */ + CheckedChanged: ASPxClientEvent>; + /** + * Returns a value indicating whether the check box editor is checked. + */ + GetChecked(): boolean; + /** + * Sets a value which specifies the checked status of the check box editor. + * @param isChecked true if the check box editor is checked; otherwise, false. + */ + SetChecked(isChecked: boolean): void; + /** + * Returns the text displayed within the editor. + */ + GetText(): string; + /** + * Returns a value which specifies a check box checked state. + */ + GetCheckState(): string; + /** + * Sets a value specifying the state of a check box. + * @param checkState A string value matches one of the CheckState enumeration values. + */ + SetCheckState(checkState: string): void; + /** + * Sets the text to be displayed within the editor. + * @param text A string value specifying the text to be displayed within the editor. + */ + SetText(text: string): void; +} +/** + * Represents the client-side equivalent of the ASPxRadioButton control. + */ +interface ASPxClientRadioButton extends ASPxClientCheckBox { + /** + * Returns a value indicating whether the radio button is checked. + */ + GetChecked(): boolean; + /** + * Sets a value which specifies the radio button's checked status. + * @param isChecked true if the radio button is checked; otherwise, false. + */ + SetChecked(isChecked: boolean): void; +} +/** + * Represents a base for client-side objects which allow single-line text input. + */ +interface ASPxClientTextEdit extends ASPxClientEdit { + /** + * Occurs on the client-side when an end-user presses a key while the editor has focus. + */ + KeyDown: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user presses and releases a key while the editor has focus. + */ + KeyPress: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user releases a pressed key while the editor has focus. + */ + KeyUp: ASPxClientEvent>; + /** + * Fires on the client side when the editor's text is changed and focus moves out of the editor by end-user interactions. + */ + TextChanged: ASPxClientEvent>; + /** + * Returns the text displayed within the editor. + */ + GetText(): string; + /** + * Sets the text to be displayed within the editor. + * @param text A string value specifying the text to be displayed within the editor. + */ + SetText(text: string): void; + /** + * Selects all text in the text editor. + */ + SelectAll(): void; + /** + * Sets the caret position within the edited text. + * @param position An integer value that specifies the zero-based index of a text character that shall precede the caret. + */ + SetCaretPosition(position: number): void; + /** + * Selects the specified portion of the editor's text. + * @param startPos A zero-based integer value specifying the selection's starting position. + * @param endPos A zero-based integer value specifying the selection's ending position. + * @param scrollToSelection true to scroll the editor's contents to make the selection visible; otherwise, false. + */ + SetSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; +} +/** + * Represents a base for client-side editors which are capable of displaying and editing text data in their edit regions. + */ +interface ASPxClientTextBoxBase extends ASPxClientTextEdit { +} +/** + * Represents a base for client button editor objects. + */ +interface ASPxClientButtonEditBase extends ASPxClientTextBoxBase { + /** + * Occurs on the client side after an editor button is clicked. + */ + ButtonClick: ASPxClientEvent>; + /** + * Specifies whether the button is visible. + * @param number An integer value specifying the button's index within the Buttons collection. + * @param value true, to make the button visible; otherwise, false. + */ + SetButtonVisible(number: number, value: boolean): void; + /** + * Returns a value specifying whether a button is displayed. + * @param number An integer value specifying the button's index within the Buttons collection. + */ + GetButtonVisible(number: number): boolean; +} +/** + * Represents a base class for the editors that contain a drop down window. + */ +interface ASPxClientDropDownEditBase extends ASPxClientButtonEditBase { + /** + * Occurs on the client-side when the drop down window is opened. + */ + DropDown: ASPxClientEvent>; + /** + * Occurs on the client side when the drop down window is closed. + */ + CloseUp: ASPxClientEvent>; + /** + * Occurs on the client side before the drop down window is closed and allows you to cancel the operation. + */ + QueryCloseUp: ASPxClientEvent>; + /** + * Modifies the size of the drop down window in accordance with its content. + */ + AdjustDropDownWindow(): void; + /** + * Invokes the editor's drop down window. + */ + ShowDropDown(): void; + /** + * Closes the opened drop down window of the editor. + */ + HideDropDown(): void; +} +/** + * Represents the client-side equivalent of the ASPxColorEdit control. + */ +interface ASPxClientColorEdit extends ASPxClientDropDownEditBase { + /** + * Fires after the selected color has been changed within the color editor via end-user interaction. + */ + ColorChanged: ASPxClientEvent>; + /** + * This event is not in effect for the ASPxClientColorEdit. Use the ColorChanged event instead. + */ + TextChanged: ASPxClientEvent>; + /** + * Returns the color editor's value. + */ + GetColor(): string; + /** + * Specifies the color value for the color editor. + * @param value A string value specifying the editor color. + */ + SetColor(value: string): void; + /** + * Indicates whether the automatic color item is selected. + */ + IsAutomaticColorSelected(): boolean; +} +/** + * Represent the client-side equivalent of the ASPxComboBox control. + */ +interface ASPxClientComboBox extends ASPxClientDropDownEditBase { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientComboBox. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client side after a different item in the list has been selected (focus has been moved from one item to another). + */ + SelectedIndexChanged: ASPxClientEvent>; + /** + * Specifies the text displayed within the editor's edit box. + * @param text A string value specifying the editor's text. + */ + SetText(text: string): void; + /** + * Adds a new item to the editor specifying the item's display text and returns the index of the added item. + * @param text A string value specifying the item's display text. + */ + AddItem(text: string): number; + /** + * Adds a new item to the editor specifying the item's display text and associated value, and returns the index of the added item. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + */ + AddItem(text: string, value: Object): number; + /** + * Adds a new item to the editor specifying the item's display text, associated value and displayed image, and returns the index of the added item. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + * @param imageUrl A string value specifying the path to the image displayed by the item. + */ + AddItem(text: string, value: Object, imageUrl: string): number; + /** + * Inserts a new item specified by its display text, associated value and displayed image into the editor's item collection, at the position specified. + * @param index An integer value representing the zero-based index of the position where the item should be inserted. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + * @param imageUrl A string value specifying the path to the image displayed by the item. + */ + InsertItem(index: number, text: string, value: Object, imageUrl: string): void; + /** + * Inserts a new item specified by its display text and associated value into the editor's item collection, at the position specified. + * @param index An integer value representing the zero-based index of the position where the item should be inserted. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + */ + InsertItem(index: number, text: string, value: Object): void; + /** + * Inserts a new item specified by its display text into the editor's item collection, at the position specified. + * @param index An integer value representing the zero-based index of the position where the item should be inserted. + * @param text A string value specifying the item's display text. + */ + InsertItem(index: number, text: string): void; + /** + * Removes an item specified by its index from the client list editor. + * @param index An integer value representing the index of the list item to be removed. + */ + RemoveItem(index: number): void; + /** + * Removes all items from the client combo box editor. + */ + ClearItems(): void; + /** + * Prevents the client combobox editor from being rendered until the EndUpdate method is called. + */ + BeginUpdate(): void; + /** + * Re-enables editor render operations after a call to the BeginUpdate method and forces an immediate re-rendering. + */ + EndUpdate(): void; + /** + * Scrolls the editor's item list, so that the specified item becomes visible. + * @param index An integer value that specifies the item's index within the editor's client item list. + */ + MakeItemVisible(index: number): void; + /** + * Returns an item specified by its index within the combo box editor's item collection. + * @param index An integer value specifying the zero-based index of the item to search for. + */ + GetItem(index: number): ASPxClientListEditItem; + /** + * Returns a combo box item by its text. + * @param text A string that specifies the item's text. + */ + FindItemByText(text: string): ASPxClientListEditItem; + /** + * Returns a combo box item by its value. + * @param value An object that specifies the item's value. + */ + FindItemByValue(value: Object): ASPxClientListEditItem; + /** + * Gets the number of items contained in the editor's item collection. + */ + GetItemCount(): number; + /** + * Returns the index of the selected item within the combo box editor. + */ + GetSelectedIndex(): number; + /** + * Sets the combobox editor's selected item specified by its index. + * @param index An integer value specifying the zero-based index of the item to select. + */ + SetSelectedIndex(index: number): void; + /** + * Returns the combo box editor's selected item. + */ + GetSelectedItem(): ASPxClientListEditItem; + /** + * Sets the list editor's selected item. + * @param item An ASPxClientListEditItem object that specifies the item to select. + */ + SetSelectedItem(item: ASPxClientListEditItem): void; + /** + * Gets the text displayed in the editor's edit box. + */ + GetText(): string; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Adds a new item to the editor, specifying the item's display text, and returns the index of the added item. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + */ + AddItem(texts: string[]): number; + /** + * Adds a new item to the end of the control's items collection. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + */ + AddItem(texts: string[], value: Object): number; + /** + * Adds a new item to the end of the control's items collection. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + * @param imageUrl A string value specifying the path to the image displayed by the item. + */ + AddItem(texts: string[], value: Object, imageUrl: string): number; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index An integer value that represents the index position. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + * @param imageUrl A String value specifying the path to the image displayed by the item. + */ + InsertItem(index: number, texts: string[], value: Object, imageUrl: string): void; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index An integer value that represents the index position. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + */ + InsertItem(index: number, texts: string[], value: Object): void; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index An integer value that represents the index position. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + */ + InsertItem(index: number, texts: string[]): void; + /** + * Determines whether the drop-down content is loaded; if not - loads the content. + * @param callbackFunction An object that is the JavaScript function that receives the callback data as a parameter. The function is performed after the combo box content is loaded. + */ + EnsureDropDownLoaded(callbackFunction: Object): void; +} +/** + * Represents the client-side equivalent of the ASPxDateEdit control. + */ +interface ASPxClientDateEdit extends ASPxClientDropDownEditBase { + /** + * Fires after the selected date has been changed within the date editor. + */ + DateChanged: ASPxClientEvent>; + /** + * Enables you to convert the value entered by an end user into the value that will be stored by the date editor. + */ + ParseDate: ASPxClientEvent>; + /** + * Allows you to disable the calendar's days. + */ + CalendarCustomDisabledDate: ASPxClientEvent>; + /** + * This event is not in effect for the ASPxClientDateEdit. Use the DateChanged event instead. + */ + TextChanged: ASPxClientEvent>; + /** + * Returns the calendar of the date editor. + */ + GetCalendar(): ASPxClientCalendar; + /** + * Returns the built-in time edit control. + */ + GetTimeEdit(): ASPxClientTimeEdit; + /** + * + * @param date + */ + SetDate(date: Date): void; + GetDate(): Date; + /** + * Returns the number of days in a range selected within a date edit. + */ + GetRangeDayCount(): number; + /** + * Gets the minimum date of the editor. + */ + GetMinDate(): Date; + /** + * Sets the minimum date of the editor. + * @param date A DateTime object representing the minimum date. + */ + SetMinDate(date: Date): void; + /** + * Gets the maximum date of the editor. + */ + GetMaxDate(): Date; + /** + * Sets the maximum date of the editor. + * @param date A DateTime object representing the maximum date. + */ + SetMaxDate(date: Date): void; +} +/** + * Provides data for the ParseDate client-side event that parses a string entered into a date editor. + */ +interface ASPxClientParseDateEventArgs extends ASPxClientEventArgs { + /** + * Gets the value entered into the date editor by an end user. + * Value: The string value entered into the date editor by an end user. + */ + value: string; + /** + * Gets or sets the edit value of the date editor. + * Value: A date/time value representing the edit value of the date editor. + */ + date: Date; + /** + * Gets or sets a value specifying whether the event was handled. + * Value: true if the event was handled and default processing should not occur; false if the event should be handled using default processing. + */ + handled: boolean; +} +/** + * A method that will handle the client ParseDate event, that parses a date editor's value when entered. + */ +interface ASPxClientParseDateEventHandler { + /** + * A method that will handle the ParseDate event. + * @param source An object representing the event source. Identifies the button editor that raised the event. + * @param e An ASPxClientParseDateEventArgs object that contains event data. + */ + (source: S, e: ASPxClientParseDateEventArgs): void; +} +/** + * Represents a base for client editor objects realizing the dropdown editor functionality. + */ +interface ASPxClientDropDownEdit extends ASPxClientDropDownEditBase { + /** + * Obtains the key value associated with the text displayed within the editor's edit box. + */ + GetKeyValue(): string; + /** + * Specifies the key value associated with the text displayed within the editor's edit box. + * @param keyValue A string specifying the key value associated with the editor's value (displayed text). + */ + SetKeyValue(keyValue: string): void; +} +/** + * A method that will handle the client events involving a keyboard key being pressed or released. + */ +interface ASPxClientEditKeyEventHandler { + /** + * A method that will handle the client events concerning a keyboard key being pressed. + * @param source The event source. This parameter identifies the editor which raised the event. + * @param e An ASPxClientEditKeyEventArgs object that contains event data. + */ + (source: S, e: ASPxClientEditKeyEventArgs): void; +} +/** + * Provides data for the client events involved with a key being pressed or released. + */ +interface ASPxClientEditKeyEventArgs extends ASPxClientEventArgs { + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * A method that will handle client validation events. + */ +interface ASPxClientEditValidationEventHandler { + /** + * A method that will handle client validation events. + * @param source An object representing the event source. Identifies the button editor that raised the event. + * @param e An ASPxClientEditValidationEventArgs object that contains event data. + */ + (source: S, e: ASPxClientEditValidationEventArgs): void; +} +/** + * Provides data for the client events that are related to data validation (see Validate). + */ +interface ASPxClientEditValidationEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets the error description. + * Value: A string representing the error description. + */ + errorText: string; + /** + * Gets or sets a value specifying whether the validated value is valid. + * Value: true if the value is valid; otherwise, false. + */ + isValid: boolean; + /** + * Gets or sets the editor's value being validated. + * Value: An object that represents the validated value. + */ + value: string; +} +/** + * Represents the client ASPxFilterControl. + */ +interface ASPxClientFilterControl extends ASPxClientControl { + /** + * Occurs after a new filter expression has been applied. + */ + Applied: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientFilterControl. + */ + CallbackError: ASPxClientEvent>; + /** + * Returns the filter expression. + */ + GetFilterExpression(): string; + /** + * Returns the applied filter expression. + */ + GetAppliedFilterExpression(): string; + /** + * Returns the editor used to edit operand values for the specified filter column. + * @param editorIndex An integer value that identifies the filter column by its index within the collection. + */ + GetEditor(editorIndex: number): ASPxClientEditBase; + /** + * Returns a value indicating whether the filter expression being currently composed on the client side is valid - all expression conditions are filled. + */ + IsFilterExpressionValid(): boolean; + /** + * Applies a filter constructed by an end-user. + */ + Apply(): void; + /** + * Resets the current filter expression to a previously applied filter expression. + */ + Reset(): void; +} +/** + * A method that will handle the Applied event. + */ +interface ASPxClientFilterAppliedEventHandler { + /** + * A method that will handle the Applied event. + * @param source The event source. + * @param e An ASPxClientFilterAppliedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFilterAppliedEventArgs): void; +} +/** + * Provides data for the Applied event. + */ +interface ASPxClientFilterAppliedEventArgs extends ASPxClientEventArgs { + /** + * Gets the filter expression currently being applied. + * Value: A string value that specifies the filter expression currently being applied. + */ + filterExpression: string; +} +/** + * Represents a base for client editor objects that display a list of items. + */ +interface ASPxClientListEdit extends ASPxClientEdit { + /** + * Occurs on the client side after a different item in the list has been selected (focus has been moved from one item to another). + */ + SelectedIndexChanged: ASPxClientEvent>; + /** + * Returns the list editor's selected item. + */ + GetSelectedItem(): ASPxClientListEditItem; + /** + * Returns the index of the selected item within the list editor. + */ + GetSelectedIndex(): number; + /** + * Sets the list editor's selected item. + * @param item An ASPxClientListEditItem object that specifies the item to select. + */ + SetSelectedItem(item: ASPxClientListEditItem): void; + /** + * Sets the list editor's selected item specified by its index. + * @param index An integer value specifying the zero-based index of the item to select. + */ + SetSelectedIndex(index: number): void; +} +/** + * Represents the client-side equivalent of the ListEditItem object. + */ +interface ASPxClientListEditItem { + /** + * Gets a value that indicates whether a list edit item is selected. + * Value: true if a list edit item is selected; otherwise, false. + */ + selected: boolean; + /** + * Gets an editor to which the current item belongs. + * Value: An ASPxClientListEdit object that represents the item's owner editor. + */ + listEditBase: ASPxClientListEdit; + /** + * Gets the item's index. + * Value: An integer value that represents the item's index within the corresponding editor's item collection. + */ + index: number; + /** + * Gets the item's associated image. + * Value: A string value that represents the path to the image displayed by the item. + */ + imageUrl: string; + /** + * Gets the item's display text. + * Value: A string value that represents the item's display text. + */ + text: string; + /** + * Gets the item's associated value. + * Value: An object that represents the value associated with the item. + */ + value: Object; + /** + * Returns the list item's value that corresponds to a column specified by its index. + * @param columnIndex An integer value that specifies the column's index within the editor's Columns collection. + */ + GetColumnText(columnIndex: number): string; + /** + * Returns the list item's value that corresponds to a column specified by its field name. + * @param columnName A string value that specifies the column's field name defined via the FieldName property. + */ + GetColumnText(columnName: string): string; +} +/** + * Represents the client-side equivalent of the ASPxListBox control. + */ +interface ASPxClientListBox extends ASPxClientListEdit { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientListBox. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client side when an end-user presses a key while the editor has focus. + */ + KeyDown: ASPxClientEvent>; + /** + * Occurs on the client side when an end-user presses and releases a key while the editor has focus. + */ + KeyPress: ASPxClientEvent>; + /** + * Occurs on the client side when an end-user releases a pressed key while the editor has focus. + */ + KeyUp: ASPxClientEvent>; + /** + * Occurs on the client side after a different item in the list box has been selected (focus has been moved from one item to another). + */ + SelectedIndexChanged: ASPxClientEvent>; + /** + * Occurs on the client when the editor's item is double clicked. + */ + ItemDoubleClick: ASPxClientEvent>; + /** + * Gets the number of items contained in the editor's item collection. + */ + GetItemCount(): number; + /** + * Returns an item specified by its index within the list box editor's item collection. + * @param index An integer value specifying the zero-based index of the item to search for. + */ + GetItem(index: number): ASPxClientListEditItem; + /** + * Returns an array of the list editor's selected items indices. + */ + GetSelectedIndices(): number[]; + /** + * Returns an array of the list editor's selected items values. + */ + GetSelectedValues(): Object[]; + /** + * Returns an array of the list editor's selected items. + */ + GetSelectedItems(): ASPxClientListEditItem[]; + /** + * Selects all list box items. + */ + SelectAll(): void; + /** + * Unselects all list box items. + */ + UnselectAll(): void; + /** + * Selects the items with the specified indices within a list box. + * @param indices An array of integer values that represent the items indices. + */ + SelectIndices(indices: number[]): void; + /** + * Unselects an array of the list box items with the specified indices. + * @param indices An array of integer values that represent the indices. + */ + UnselectIndices(indices: number[]): void; + /** + * Selects the specified items within a list box. + * @param items An array of ASPxClientListEditItem objects that represent the items. + */ + SelectItems(items: ASPxClientListEditItem[]): void; + /** + * Unselects an array of the specified list box items. + * @param items An array of ASPxClientListEditItem objects that represent the items. + */ + UnselectItems(items: ASPxClientListEditItem[]): void; + /** + * Select the items with the specified values within a list box. + * @param values An array of Object[] objects that represent the item's values. + */ + SelectValues(values: Object[]): void; + /** + * Unselects an array of the list box items with the specified values. + * @param values An array of Object[] objects that represent the values. + */ + UnselectValues(values: Object[]): void; + /** + * Scrolls the editor's item list, so that the specified item becomes visible. + * @param index An integer value that specifies the item's index within the editor's client item list. + */ + MakeItemVisible(index: number): void; + /** + * Initializes the ASPxClientListBox client object when its parent container becomes visible dynamically, on the client side. + */ + InitOnContainerMadeVisible(): void; + /** + * Adds a new item to the editor, specifying the item's display text, and returns the index of the added item. + * @param text A string value specifying the item's display text. + */ + AddItem(text: string): number; + /** + * Adds a new item to the editor, specifying the item's display text and associated value, and returns the index of the added item. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + */ + AddItem(text: string, value: Object): number; + /** + * Adds a new item to the editor, specifying the item's display text, associated value and displayed image, and returns the index of the added item. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + * @param imageUrl A string value specifying the path to the image displayed by the item. + */ + AddItem(text: string, value: Object, imageUrl: string): number; + /** + * Inserts a new item specified by its display text, associated value and displayed image into the editor's item collection, at the position specified. + * @param index An integer value representing the zero-based index of the position where the item should be inserted. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + * @param imageUrl A string value specifying the path to the image displayed by the item. + */ + InsertItem(index: number, text: string, value: Object, imageUrl: string): void; + /** + * Inserts a new item specified by its display text and associated value into the editor's item collection, at the position specified. + * @param index An integer value representing the zero-based index of the position where the item should be inserted. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + */ + InsertItem(index: number, text: string, value: Object): void; + /** + * Inserts a new item specified by its display text into the editor's item collection, at the position specified. + * @param index An integer value representing the zero-based index of the position where the item should be inserted. + * @param text A string value specifying the item's display text. + */ + InsertItem(index: number, text: string): void; + /** + * Prevents the client list box editor from being rendered until the EndUpdate method is called. + */ + BeginUpdate(): void; + /** + * Re-enables editor render operations after a call to the BeginUpdate method, and forces an immediate re-rendering. + */ + EndUpdate(): void; + /** + * Removes all items from the client list box editor. + */ + ClearItems(): void; + /** + * Removes an item specified by its index from the client list editor. + * @param index An integer value representing the index of the list item to be removed. + */ + RemoveItem(index: number): void; + /** + * Returns a list box item by its text. + * @param text A string that specifies the item's text. + */ + FindItemByText(text: string): ASPxClientListEditItem; + /** + * Returns a list box item by its value. + * @param value An object that specifies the item's value. + */ + FindItemByValue(value: Object): ASPxClientListEditItem; + /** + * Sends a callback to the server, and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Adds a new item to the end of the editor's items collection, specifying the item's display text, and returns the index of the added item. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + */ + AddItem(texts: string[]): number; + /** + * Adds a new item to the end of the control's items collection. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + */ + AddItem(texts: string[], value: Object): number; + /** + * Adds a new item to the end of the editor's items collection, specifying the item's display text, associated value and displayed image, and returns the index of the added item. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + * @param imageUrl A String value specifying the path to the image displayed by the item. + */ + AddItem(texts: string[], value: Object, imageUrl: string): number; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index An integer value that represents the index position. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + * @param imageUrl A String value specifying the path to the image displayed by the item. + */ + InsertItem(index: number, texts: string[], value: Object, imageUrl: string): void; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index An integer value that represents the index position. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + */ + InsertItem(index: number, texts: string[], value: Object): void; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index An integer value that represents the index position. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + */ + InsertItem(index: number, texts: string[]): void; +} +/** + * Serves as the base type for the ASPxClientRadioButtonList objects. + */ +interface ASPxClientCheckListBase extends ASPxClientListEdit { + /** + * Gets the number of items contained in the editor's item collection. + */ + GetItemCount(): number; + /** + * Returns the editor's item specified by its index. + * @param index An integer value specifying the zero-based index of the item to be retrieved. + */ + GetItem(index: number): ASPxClientListEditItem; +} +/** + * Represents the client-side equivalent of the ASPxRadioButtonList control. + */ +interface ASPxClientRadioButtonList extends ASPxClientCheckListBase { +} +/** + * A client-side equivalent of the ASPxCheckBoxList object. + */ +interface ASPxClientCheckBoxList extends ASPxClientCheckListBase { + /** + * Occurs on the client side after a different item in the check box list has been selected (focus has been moved from one item to another). + */ + SelectedIndexChanged: ASPxClientEvent>; + /** + * Returns an array of the check box list editor's selected items indices. + */ + GetSelectedIndices(): number[]; + /** + * Returns an array of the check box list editor's selected items values. + */ + GetSelectedValues(): Object[]; + /** + * Returns an array of the check box list editor's selected items. + */ + GetSelectedItems(): ASPxClientListEditItem[]; + /** + * Selects all check box list items. + */ + SelectAll(): void; + /** + * Unselects all check box list items. + */ + UnselectAll(): void; + /** + * Selects items with the specified indices within a check box list. + * @param indices An array of integer values that are the item indices. + */ + SelectIndices(indices: number[]): void; + /** + * Selects the specified items within a check box list. + * @param items An array of ASPxClientListEditItem objects that are the items. + */ + SelectItems(items: ASPxClientListEditItem[]): void; + /** + * Selects items with the specified values within a check box list. + * @param values An array of Object[] objects that are the item values. + */ + SelectValues(values: Object[]): void; + /** + * Unselects items with the specified indices within a check box list. + * @param indices An array of integer values that are the item indices. + */ + UnselectIndices(indices: number[]): void; + /** + * Unselects the specified items within a check box list. + * @param items An array of ASPxClientListEditItem objects that are the items. + */ + UnselectItems(items: ASPxClientListEditItem[]): void; + /** + * Unselects items with the specified values within a check box list. + * @param values An array of Object[] objects that are the item values. + */ + UnselectValues(values: Object[]): void; +} +/** + * A method that will handle the SelectedIndexChanged event. + */ +interface ASPxClientListEditItemSelectedChangedEventHandler { + /** + * A method that will handle the SelectedIndexChanged event. + * @param source The event source. + * @param e An ASPxClientListEditItemSelectedChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientListEditItemSelectedChangedEventArgs): void; +} +/** + * Provides data for the SelectedIndexChanged event. + */ +interface ASPxClientListEditItemSelectedChangedEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the index of the item related to the event. + * Value: An integer value that represents the item's index within the corresponding editor's item collection. + */ + index: number; + /** + * Gets whether the item has been selected. + * Value: true if the item is selected; otherwise, false. + */ + isSelected: boolean; +} +/** + * Represents a client-side equivalent of the ASPxProgressBar control. + */ +interface ASPxClientProgressBar extends ASPxClientEditBase { + /** + * Sets the position of the operation's progress. + * @param position An integer value specifying the progress position. + */ + SetPosition(position: number): void; + /** + * Gets the position of the operation's progress. + */ + GetPosition(): number; + /** + * Sets the pattern used to format the displayed text for the progress bar. + * @param text A value that is the format pattern. + */ + SetCustomDisplayFormat(text: string): void; + /** + * Returns the text displayed within the progress bar. + */ + GetDisplayText(): string; + /** + * Sets the percentage representation of the progress position. + */ + GetPercent(): number; + /** + * Sets the minimum range value of the progress bar. + * @param min An integer value specifying the minimum value of the progress bar range. + */ + SetMinimum(min: number): void; + /** + * Sets the maximum range value of the progress bar. + * @param max An integer value specifying the maximum value of the progress bar range. + */ + SetMaximum(max: number): void; + /** + * Gets the minimum range value of the progress bar. + */ + GetMinimum(): number; + /** + * Gets the maximum range value of the progress bar. + */ + GetMaximum(): number; + /** + * Sets the minimum and maximum range values of the progress bar. + * @param minValue An integer value specifying the minimum value of the progress bar range. + * @param maxValue An integer value specifying the maximum value of the progress bar range. + */ + SetMinMaxValues(minValue: number, maxValue: number): void; +} +/** + * Represents a base class for the ASPxClientSpinEdit object. + */ +interface ASPxClientSpinEditBase extends ASPxClientButtonEditBase { + /** + * This event is not in effect for the ASPxClientSpinEditBase. Use the ASPxClientTimeEdit. + */ + TextChanged: ASPxClientEvent>; +} +/** + * Represents the client-side equivalent of the ASPxSpinEdit control. + */ +interface ASPxClientSpinEdit extends ASPxClientSpinEditBase { + /** + * Occurs on the client side when the editor's value is altered in any way. + */ + NumberChanged: ASPxClientEvent>; + /** + * Specifies the value of the spin edit control on the client side. + * @param number A Decimal value specifying the control value. + */ + SetValue(number: number): void; + /** + * Sets the spin editor's value. + * @param number A decimal number specifying the value to assign to the spin editor. + */ + SetNumber(number: number): void; + /** + * Gets a number which represents the spin editor's value. + */ + GetNumber(): number; + /** + * Returns the text displayed within the editor. + */ + GetText(): string; + /** + * Sets the minimum value of the editor. + * @param value A decimal value specifying the minimum value of the editor. + */ + SetMinValue(value: number): void; + /** + * Gets the minimum value of the editor. + */ + GetMinValue(): number; + /** + * Sets the maximum value of the editor. + * @param value A decimal value specifying the maximum value of the editor. + */ + SetMaxValue(value: number): void; + /** + * Gets the maximum value of the editor. + */ + GetMaxValue(): number; + /** + * Changes the editor's value. + * @param value An object representing the data to be assigned to the editor's edit value. + */ + SetValue(value: Object): void; +} +/** + * Represents the client-side equivalent of the ASPxTimeEdit control. + */ +interface ASPxClientTimeEdit extends ASPxClientSpinEditBase { + /** + * Fires after the selected date has been changed within the time editor. + */ + DateChanged: ASPxClientEvent>; + /** + * + * @param date + */ + SetDate(date: Date): void; + GetDate(): Date; +} +/** + * Represents a base for client-side static editors whose values cannot be visually changed by end users. + */ +interface ASPxClientStaticEdit extends ASPxClientEditBase { + /** + * Occurs on the client side after an end-user clicks within a static editor. + */ + Click: ASPxClientEvent>; +} +/** + * A method that will handle client-side events which concern clicking within editors. + */ +interface ASPxClientEditEventHandler { + /** + * A method that will handle client-side events which concern clicking within editors. + * @param source An object representing the event source. Identifies the editor that raised the event. + * @param e An ASPxClientEditClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientEditClickEventArgs): void; +} +/** + * Provides data for the client-side events which concern clicking within editors. + */ +interface ASPxClientEditClickEventArgs extends ASPxClientEventArgs { + /** + * Gets the HTML element related to the event. + * Value: An object that represents the clicked HTML element. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * Represents the client-side equivalent of the ASPxHyperLink control. + */ +interface ASPxClientHyperLink extends ASPxClientStaticEdit { + /** + * Gets an URL which defines the navigation location for the editor's hyperlink. + */ + GetNavigateUrl(): string; + /** + * Specifies an URL which defines the navigation location for the editor's hyperlink. + * @param url A string value which specifies an URL to where the client web browser will navigate when a hyperlink in the editor is clicked. + */ + SetNavigateUrl(url: string): void; + /** + * Gets the text caption displayed for the hyperlink in the hyperlink editor. + */ + GetText(): string; + /** + * Specifies the text caption displayed for the hyperlink in the hyperlink editor. + * @param text A string value specifying the text caption for the hyperlink in the editor. + */ + SetText(text: string): void; +} +/** + * Represents a base for client-side editors which are capable of displaying images. + */ +interface ASPxClientImageBase extends ASPxClientStaticEdit { + /** + * Sets the size of the image displayed within the image editor. + * @param width An integer value that specifies the image's width. + * @param height An integer value that specifies the image's height. + */ + SetSize(width: number, height: number): void; +} +/** + * Represents the client-side equivalent of the ASPxImage control. + */ +interface ASPxClientImage extends ASPxClientImageBase { + /** + * Returns the URL pointing to the image displayed within the image editor. + */ + GetImageUrl(): string; + /** + * Sets the URL which points to the image displayed within the image editor. + * @param url A string value specifying the URL to the image displayed within the editor. + */ + SetImageUrl(url: string): void; +} +/** + * Represents the client-side equivalent of the ASPxLabel control. + */ +interface ASPxClientLabel extends ASPxClientStaticEdit { + /** + * Returns the text displayed within the editor. + */ + GetText(): string; + /** + * Sets the text to be displayed within the editor. + * @param text A string value specifying the text to be displayed within the editor. + */ + SetText(text: string): void; +} +/** + * Represents the client-side equivalent of the ASPxTextBox control. + */ +interface ASPxClientTextBox extends ASPxClientTextBoxBase { +} +/** + * Represents the client-side equivalent of the ASPxMemo control. + */ +interface ASPxClientMemo extends ASPxClientTextEdit { +} +/** + * Represents the client-side equivalent of the ASPxButtonEdit control. + */ +interface ASPxClientButtonEdit extends ASPxClientButtonEditBase { +} +/** + * A method that will handle the ButtonClick event. + */ +interface ASPxClientButtonEditClickEventHandler { + /** + * A method that will handle the ButtonClick event. + * @param source An object representing the event source. Identifies the button editor that raised the event. + * @param e An ASPxClientButtonEditClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientButtonEditClickEventArgs): void; +} +/** + * Provides data for the ButtonClick event. + */ +interface ASPxClientButtonEditClickEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the index of the clicked button. + * Value: An integer value representing the index of the clicked button within the editor's Buttons collection. + */ + buttonIndex: number; +} +/** + * A client-side equivalent of the ASPxTokenBox object. + */ +interface ASPxClientTokenBox extends ASPxClientComboBox { + /** + * Fires on the client side after the token collection has been changed. + */ + TokensChanged: ASPxClientEvent>; + /** + * Adds a new token with the specified text to the end of the control's token collection. + * @param text A string value specifying the token's text. + */ + AddToken(text: string): void; + /** + * Removes a token specified by its text from the client token box. + * @param text A string value that is the text of the token to be removed. + */ + RemoveTokenByText(text: string): void; + /** + * Removes a token specified by its index from the client token box. + * @param index An integer value that is the index of the token to be removed. + */ + RemoveToken(index: number): void; + /** + * Returns an HTML span element that corresponds to the specified token. + * @param index An integer value that is the token index. + */ + GetTokenHtmlElement(index: number): Object; + /** + * Returns an HTML span element that corresponds to the specified token's text. + * @param index An integer value that is the token index. + */ + GetTokenTextHtmlElement(index: number): Object; + /** + * Returns an HTML span element that corresponds to the specified token's remove button. + * @param index An integer value that is the token index. + */ + GetTokenRemoveButtonHtmlElement(index: number): Object; + /** + * Returns a collection of tokens. + */ + GetTokenCollection(): string[]; + /** + * Sets a collection of tokens. + * @param collection A object that is the collection of tokens. + */ + SetTokenCollection(collection: string[]): void; + /** + * Removes all tokens contained in the token box. + */ + ClearTokenCollection(): void; + /** + * Returns the index of a token specified by its text. + * @param text A string value that specifies the text of the token. + */ + GetTokenIndexByText(text: string): number; + /** + * Gets the token texts, separated with a sign, specified by the TextSeparator property. + */ + GetText(): string; + /** + * Sets the token texts, separated with a sign, specified by the TextSeparator property. + * @param text A string value that is the token texts separated with a text separator. + */ + SetText(text: string): void; + /** + * Gets the editor value. + */ + GetValue(): string; + /** + * Sets the editor value. + * @param value A string that is the editor value. + */ + SetValue(value: string): void; + /** + * Returns a value that indicates if the specified token (string) is a custom token. + * @param text A string value that is a token. + * @param caseSensitive true, if tokens are case sensitive; otherwise, false. + */ + IsCustomToken(text: string, caseSensitive: boolean): boolean; + /** + * Changes the editor's value. + * @param value An object representing the data to be assigned to the editor's edit value. + */ + SetValue(value: Object): void; +} +/** + * The client-side equivalent of the ASPxTrackBar control. + */ +interface ASPxClientTrackBar extends ASPxClientEdit { + /** + * Fires on the client side before a track bar position is changed and allows you to cancel the action. + */ + PositionChanging: ASPxClientEvent>; + /** + * Fires after the editor's position has been changed. + */ + PositionChanged: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user moves a cursor while the drag handle is held down. + */ + Track: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user presses a drag handle and moves it. + */ + TrackStart: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user releases a drag handle after moving it. + */ + TrackEnd: ASPxClientEvent>; + /** + * Returns a track bar item index by the item's value. + * @param value An object that specifies the item's value. + */ + GetItemIndexByValue(value: Object): number; + /** + * Returns a track bar item's associated value. + * @param index An integer value that specifies the required item's index. + */ + GetItemValue(index: number): Object; + /** + * Returns a track bar item text. + * @param index An integer value that specifies the required item's index. + */ + GetItemText(index: number): string; + /** + * Returns a track bar item's tooltip text. + * @param index An integer value that specifies the required item's index. + */ + GetItemToolTip(index: number): string; + /** + * Returns the number of the track bar items that are maintained by the item collection. + */ + GetItemCount(): number; + /** + * Specifies the secondary drag handle position. + * @param position A value that specifies the position. + */ + SetPositionEnd(position: number): void; + /** + * Specifies the main drag handle position. + * @param position A value that specifies the position. + */ + SetPositionStart(position: number): void; + /** + * Returns the secondary drag handle position. + */ + GetPositionEnd(): number; + /** + * Returns the main drag handle position. + */ + GetPositionStart(): number; + /** + * Gets a drag handle position. + */ + GetPosition(): number; + /** + * Specifies a drag handle position. + * @param position A value that specifies the position. + */ + SetPosition(position: number): void; +} +/** + * A method that will handle the client PositionChanging event. + */ +interface ASPxClientTrackBarPositionChangingEventHandler { + /** + * A method that will handle the PositionChanging event. + * @param source The event source. Identifies the ASPxTrackBar control that raised the event. + * @param e A ASPxClientTrackBarPositionChangingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTrackBarPositionChangingEventArgs): void; +} +/** + * Provides data for the PositionChanging event. + */ +interface ASPxClientTrackBarPositionChangingEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; + /** + * Gets the current drag handle position. + * Value: A value that is the drag handle position. + */ + currentPosition: number; + /** + * Gets the current secondary drag handle position. + * Value: A value that is the drag handle position. + */ + currentPositionEnd: number; + /** + * Gets the current main drag handle position. + * Value: A value that is the drag handle position. + */ + currentPositionStart: number; + /** + * Gets a position where the drag handle is being moved. + * Value: A value that is the drag handle position. + */ + newPosition: number; + /** + * Gets a position where the secondary drag handle is being moved. + * Value: A value that is the drag handle position. + */ + newPositionEnd: number; + /** + * Gets a position where the main drag handle is being moved. + * Value: A value that is the drag handle position. + */ + newPositionStart: number; +} +/** + * Represents the client-side equivalent of the ASPxValidationSummary control. + */ +interface ASPxClientValidationSummary extends ASPxClientControl { + /** + * Occurs on the client side when the validation summary's visibility is changed. + */ + VisibilityChanged: ASPxClientEvent>; +} +/** + * A method that will handle the VisibilityChanged event. + */ +interface ASPxClientValidationSummaryVisibilityChangedEventHandler { + /** + * A method that will handle the VisibilityChanged client event. + * @param source An object representing the event source. + * @param e A ASPxClientValidationSummaryVisibilityChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientValidationSummaryVisibilityChangedEventArgs): void; +} +/** + * Provides data for the VisibilityChanged event. + */ +interface ASPxClientValidationSummaryVisibilityChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets whether the editor is visible on the client. + * Value: true if the editor is visible; otherwise, false. + */ + visible: boolean; +} +/** + * Represents the client ASPxGaugeControl. + */ +interface ASPxClientGaugeControl extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires when errors have occurred during callback processing. + */ + CallbackError: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * Represents the client ASPxGridView. + */ +interface ASPxClientGridBase extends ASPxClientControl { +} +/** + * Serves as a base object implementing the client column functionality. + */ +interface ASPxClientGridColumnBase { +} +/** + * The client-side equivalent of the ASPxGridLookup control. + */ +interface ASPxClientGridLookup extends ASPxClientDropDownEditBase { + /** + * Fires on the client when a data row is clicked within the built-in dropdown grid. + */ + RowClick: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Returns a client object representing the built-in dropdown grid. + */ + GetGridView(): ASPxClientGridView; + /** + * Confirms the current selection made by an end-user within the editor's dropdown grid. + */ + ConfirmCurrentSelection(): void; + /** + * Cancels the current selection made by an end-user within the editor's dropdown grid and rolls back to the last confirmed selection. The selection can be confirmed by either pressing the Enter key or calling the ConfirmCurrentSelection method. + */ + RollbackToLastConfirmedSelection(): void; +} +/** + * Represents the client ASPxCardView. + */ +interface ASPxClientCardView extends ASPxClientGridBase { + /** + * Provides access to the batch editing client API. + * Value: A object that exposes the batch editing client API methods. + */ + batchEditApi: ASPxClientCardViewBatchEditApi; + /** + * Occurs when a custom command button has been clicked. + */ + CustomButtonClick: ASPxClientEvent>; + /** + * Fires after the selection has been changed. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Enables you to prevent columns from being sorted. + */ + ColumnSorting: ASPxClientEvent>; + /** + * Occurs when a grid switches to batch edit mode. + */ + BatchEditStartEditing: ASPxClientEvent>; + /** + * Occurs when a grid leaves batch edit mode. + */ + BatchEditEndEditing: ASPxClientEvent>; + /** + * Enables you to prevent a batch edit confirmation message from being displayed. + */ + BatchEditConfirmShowing: ASPxClientEvent>; + /** + * Enables you to provide navigation for editors contained in a templated cell in Batch Edit mode. + */ + BatchEditTemplateCellFocused: ASPxClientEvent>; + /** + * Enables you to specify whether card data is valid and provide an error text. + */ + BatchEditCardValidating: ASPxClientEvent>; + /** + * Occurs on the client side before data changes are saved in batch edit mode. + */ + BatchEditChangesSaving: ASPxClientEvent>; + /** + * Occurs on the client side before data changes are canceled in batch edit mode. + */ + BatchEditChangesCanceling: ASPxClientEvent>; + /** + * Occurs on the client side before a card is inserted in batch edit mode. + */ + BatchEditCardInserting: ASPxClientEvent>; + /** + * Occurs on the client side before a card is deleted in batch edit mode. + */ + BatchEditCardDeleting: ASPxClientEvent>; + /** + * Fires on the client when a card is clicked. + */ + CardClick: ASPxClientEvent>; + /** + * Fires on the client when a card is double clicked. + */ + CardDblClick: ASPxClientEvent>; + /** + * Fires in response to changing card focus. + */ + FocusedCardChanged: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any unhandled server error occurs during server-side processing of a callback sent by the ASPxClientCardView. + */ + CallbackError: ASPxClientEvent>; + /** + * Fires after the customization window has been closed. + */ + CustomizationWindowCloseUp: ASPxClientEvent>; + /** + * Moves focus to the specified edit cell within the edited card. + * @param column An ASPxClientCardViewColumn object that represents the data column within the client grid. + */ + FocusEditor(column: ASPxClientCardViewColumn): void; + /** + * Moves focus to the specified edit cell within the edited card. + * @param columnIndex An integer value that specifies the column's position within the columns collection. + */ + FocusEditor(columnIndex: number): void; + /** + * Moves focus to the specified edit cell within the edited card. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + FocusEditor(columnFieldNameOrId: string): void; + /** + * Sets the value of the specified edit cell. + * @param column An ASPxClientCardViewColumn object that represents the data column within the client grid. + * @param value A string value that specifies the edit cell's new value. + */ + SetEditValue(column: ASPxClientCardViewColumn, value: string): void; + /** + * Sets the value of the specified edit cell. + * @param columnIndex An integer value that identifies the data column within the grid's column collection. + * @param value A string value that specifies the edit cell's new value. + */ + SetEditValue(columnIndex: number, value: string): void; + /** + * Sets the value of the specified edit cell. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param value A string value that specifies the edit cell's new value. + */ + SetEditValue(columnFieldNameOrId: string, value: string): void; + /** + * Displays the Filter Control. + */ + ShowFilterControl(): void; + /** + * Hides the Filter Control. + */ + CloseFilterControl(): void; + /** + * Enables or disables the current filter. + * @param isFilterEnabled true to enable the current filter; otherwise, false. + */ + SetFilterEnabled(isFilterEnabled: boolean): void; + /** + * Returns the current vertical scroll position of the grid's content. + */ + GetVerticalScrollPosition(): number; + /** + * Specifies the vertical scroll position for the grid's content. + * @param position An integer value specifying the vertical scroll position. + */ + SetVerticalScrollPosition(position: number): void; + /** + * Gets information about a focused cell. + */ + GetFocusedCell(): ASPxClientCardViewCellInfo; + /** + * Focuses the specified cell. + * @param cardVisibleIndex An value that specifies the visible index of the card. + * @param columnIndex A zero-based index that identifies the column in the column collection (the column's Index property value). + */ + SetFocusedCell(cardVisibleIndex: number, columnIndex: number): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientCardViewColumn object that represents the data column. + */ + SortBy(column: ASPxClientCardViewColumn): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + */ + SortBy(columnIndex: number): void; + /** + * Sorts data by the specified data column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + SortBy(columnFieldNameOrId: string): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientCardViewColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(column: ASPxClientCardViewColumn, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(columnIndex: number, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(columnFieldNameOrId: string, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientCardViewColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(column: ASPxClientCardViewColumn, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(columnIndex: number, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values, and places the column to the specified position among the sorted columns. + * @param column An ASPxClientCardViewColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex + */ + SortBy(column: ASPxClientCardViewColumn, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Sorts data by the specified data column's values, and places the column to the specified position among the sorted columns. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex An integer value that specifies the zero-based column's index among the sorted columns. -1 if data is not sorted by this column. + */ + SortBy(columnIndex: number, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Sorts data by the specified data column's values, and places the column to the specified position among the sorted columns. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex An integer value that specifies the zero-based column's index among the sorted columns. -1 if data is not sorted by this column. + */ + SortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Hides the specified column. + * @param column An ASPxClientCardViewColumn object that represents the column to hide. + */ + MoveColumn(column: ASPxClientCardViewColumn): void; + /** + * Hides the specified column. + * @param columnIndex An integer value that specifies the absolute index of the column to hide. + */ + MoveColumn(columnIndex: number): void; + /** + * Hides the specified column. + * @param columnFieldNameOrId A string value that identifies the column to be hidden by the name of the data source field to which the column is bound, or by the column's name. + */ + MoveColumn(columnFieldNameOrId: string): void; + /** + * Moves the specified column to the specified visual position within the ASPxCardView. + * @param column An ASPxClientCardViewColumn object that represents the column to move. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the ASPxCardView. + */ + MoveColumn(column: ASPxClientCardViewColumn, moveToColumnVisibleIndex: number): void; + /** + * Moves the specified column to the specified visual position within the ASPxCardView. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the grid. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number): void; + /** + * Moves the specified column to the specified visual position within the ASPxCardView. + * @param columnFieldNameOrId A string value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the ASPxCardView. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number): void; + /** + * Moves the specified column to the specified visual position within the ASPxCardView. + * @param column An ASPxClientCardViewColumn object that represents the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the CardView. + * @param moveBefore true, to move the column before the target column; otherwise, false. + */ + MoveColumn(column: ASPxClientCardViewColumn, moveToColumnVisibleIndex: number, moveBefore: boolean): void; + /** + * Moves the specified column to the specified visual position within the ASPxCardView. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number, moveBefore: boolean): void; + /** + * Moves the specified column to the specified visual position within the ASPxCardView. + * @param columnFieldNameOrId A string value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, moveBefore: boolean): void; + /** + * Returns the key value of the specified card. + * @param visibleIndex An integer value that specifies the card's visible index. + */ + GetCardKey(visibleIndex: number): string; + /** + * Switches the CardView to edit mode. + * @param visibleIndex A zero-based integer that identifies a card to be edited. + */ + StartEditCard(visibleIndex: number): void; + /** + * Switches the ASPxCardView to edit mode. + * @param key An object that uniquely identifies a card to be edited. + */ + StartEditCardByKey(key: Object): void; + /** + * Indicates whether or not a new card is being edited. + */ + IsNewCardEditing(): boolean; + /** + * Adds a new record. + */ + AddNewCard(): void; + /** + * Deletes the specified card. + * @param visibleIndex An integer value that identifies the card. + */ + DeleteCard(visibleIndex: number): void; + /** + * Deletes a card with the specified key value. + * @param key An object that uniquely identifies the card. + */ + DeleteCardByKey(key: Object): void; + /** + * Returns the focused card's index. + */ + GetFocusedCardIndex(): number; + /** + * Moves focus to the specified card. + * @param visibleIndex An integer value that specifies the focused card's index. + */ + SetFocusedCardIndex(visibleIndex: number): void; + /** + * Selects all the unselected cards within the CardView. + */ + SelectCards(): void; + /** + * Selects the specified card displayed within the CardView. + * @param visibleIndex A zero-based integer value that specifies the card's visible index. + */ + SelectCards(visibleIndex: number): void; + /** + * Selects the specified cards within the CardView. + * @param visibleIndices An array of zero-based indices that identify data cards within the grid. + */ + SelectCards(visibleIndices: number[]): void; + /** + * Selects or deselects the specified cards within the CardView. + * @param visibleIndices An array of zero-based indices that identify data cards within the grid. + * @param selected true to select the specified cards; false to deselect the cards. + */ + SelectCards(visibleIndices: number[], selected: boolean): void; + /** + * Selects or deselects the specified card within the GridView. + * @param visibleIndex An integer zero-based index that identifies the data card within the grid. + * @param selected true to select the specified card; false to deselect the card. + */ + SelectCards(visibleIndex: number, selected?: boolean): void; + /** + * Selects or deselects the specified cards displayed within the CardView. + * @param keys An array of objects that uniquely identify the cards. + * @param selected true to select the specified cards; false to deselect the cards. + */ + SelectCardsByKey(keys: Object[], selected?: boolean): void; + /** + * Selects or deselects the specified card displayed within the CardView. + * @param key An object that uniquely identifies the card. + * @param selected true to select the specified card; false to deselect the card. + */ + SelectCardsByKey(key: Object, selected?: boolean): void; + /** + * Selects the specified cards displayed within the CardView. + * @param keys An array of objects that uniquely identify the cards. + */ + SelectCardsByKey(keys: Object[]): void; + /** + * Selects a card displayed within the CardView by its key. + * @param key An object that uniquely identifies the card. + */ + SelectCardsByKey(key: Object): void; + /** + * Deselects the specified cards displayed within the ASPxCardView. + * @param keys An array of objects that uniquely identify the cards. + */ + UnselectCardsByKey(keys: Object[]): void; + /** + * Deselects the specified card displayed within the ASPxCardView. + * @param key An object that uniquely identifies the card. + */ + UnselectCardsByKey(key: Object): void; + /** + * Deselects all the selected cards within the ASPxCardView. + */ + UnselectCards(): void; + /** + * Deselects the specified cards (if selected) within the ASPxCardView. + * @param visibleIndices An array of zero-based indices that identify data cards within the grid. + */ + UnselectCards(visibleIndices: number[]): void; + /** + * Deselects the specified cards (if selected) within the ASPxCardView. + * @param visibleIndex A zero-based integer value that specifies the card's visible index. + */ + UnselectCards(visibleIndex: number): void; + /** + * Deselects all grid cards that match the filter criteria currently applied to the CardView. + */ + UnselectFilteredCards(): void; + /** + * Selects the specified card displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the card's visible index. + */ + SelectCardOnPage(visibleIndex: number): void; + /** + * Selects or deselects the specified card displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the card's visible index. + * @param selected true to select the specified card; false to deselect the card. + */ + SelectCardOnPage(visibleIndex: number, selected?: boolean): void; + /** + * Deselects the specified cards (if selected) displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the card's visible index. + */ + UnselectCardOnPage(visibleIndex: number): void; + /** + * Selects all unselected cards displayed on the current page. + */ + SelectAllCardsOnPage(): void; + /** + * Allows you to select or deselect all cards displayed on the current page based on the parameter passed. + * @param selected true to select all unselected cards displayed on the current page; false to deselect all selected cards on the page. + */ + SelectAllCardsOnPage(selected: boolean): void; + /** + * Deselects all selected cards displayed on the current page. + */ + UnselectAllCardsOnPage(): void; + /** + * Returns the number of selected cards. + */ + GetSelectedCardCount(): number; + /** + * Indicates whether or not the specified card is selected within the current page. + * @param visibleIndex An integer value that identifies the card by its visible index. + */ + IsCardSelectedOnPage(visibleIndex: number): boolean; + /** + * Applies the specified search panel filter criterion to grid data. + * @param value A string value that specifies the filter criterion. + */ + ApplySearchPanelFilter(value: string): void; + /** + * Applies the specified filter expression to the grid. + * @param filterExpression A string value that specifies the filter expression. + */ + ApplyFilter(filterExpression: string): void; + /** + * Clears the filter expression applied to a client CardView. + */ + ClearFilter(): void; + /** + * Gets the Popup Edit Form. + */ + GetPopupEditForm(): ASPxClientPopupControl; + /** + * Sets input focus to the grid. + */ + Focus(): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Selects the specified page. + * @param pageIndex An integer value that specifies the active page's index. + */ + GotoPage(pageIndex: number): void; + /** + * Gets the index of the page currently being selected. + */ + GetPageIndex(): number; + /** + * Gets the number of pages to which the grid's data is divided. + */ + GetPageCount(): number; + /** + * Activates the next page. + */ + NextPage(): void; + /** + * Activates the previous page. + */ + PrevPage(): void; + /** + * Returns the index of the first card displayed within the grid's active page. + */ + GetTopVisibleIndex(): number; + /** + * Indicates whether the grid is in edit mode. + */ + IsEditing(): boolean; + /** + * Saves all the changes made and switches the grid to browse mode. + */ + UpdateEdit(): void; + /** + * Cancels all the changes made and switches the CardView to browse mode. + */ + CancelEdit(): void; + /** + * Updates data displayed within the grid. + */ + Refresh(): void; + /** + * Indicates whether the customization window is displayed. + */ + IsCustomizationWindowVisible(): boolean; + /** + * Invokes the customization window. + */ + ShowCustomizationWindow(): void; + /** + * Invokes the customization window and displays it over the specified HTML element. + * @param showAtElement An object that specifies the HTML element relative to whose position the customization window is invoked. + */ + ShowCustomizationWindow(showAtElement?: Object): void; + /** + * Closes the customization window. + */ + HideCustomizationWindow(): void; + /** + * Returns the number of columns within the client grid. + */ + GetColumnCount(): number; + /** + * Returns the card values displayed within all selected cards. + * @param fieldNames The names of data source fields separated via a semicolon, whose values within the selected cards are returned. + * @param onCallback An ASPxClientCardViewValuesCallback object that represents the JavaScript function which receives the list of card values as a parameter. + */ + GetSelectedFieldValues(fieldNames: string, onCallback: ASPxClientCardViewValuesCallback): void; + /** + * Returns key values of selected cards displayed within the current page. + */ + GetSelectedKeysOnPage(): Object[]; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event. + * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback An ASPxClientCardViewValuesCallback object that is the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(args: string, onCallback: ASPxClientCardViewValuesCallback): void; + /** + * Returns the values of the specified data source fields within the specified card. + * @param visibleIndex An integer value that identifies the data card. + * @param fieldNames The names of data source fields separated via a semicolon, whose values within the specified card are returned. + * @param onCallback An ASPxClientCardViewValuesCallback object that represents the JavaScript function which receives the list of card values as a parameter. + */ + GetCardValues(visibleIndex: number, fieldNames: string, onCallback: ASPxClientCardViewValuesCallback): void; + /** + * Returns the card values displayed within the current page. + * @param fieldNames The names of data source fields whose values are returned. + * @param onCallback An ASPxClientCardViewValuesCallback object that represents the JavaScript function which receives the list of card values as a parameter. + */ + GetPageCardValues(fieldNames: string, onCallback: ASPxClientCardViewValuesCallback): void; + /** + * Returns the number of cards actually displayed within the active page. + */ + GetVisibleCardsOnPage(): number; + /** + * Returns the client column that resides at the specified position within the column collection. + * @param columnIndex A zero-based index that identifies the column within the column collection (the column's Index property value). + */ + GetColumn(columnIndex: number): ASPxClientCardViewColumn; + /** + * Returns the column with the specified unique identifier. + * @param columnId A string value that specifies the column's unique identifier (the column's Name property value). + */ + GetColumnById(columnId: string): ASPxClientCardViewColumn; + /** + * Returns the client column which is bound to the specified data source field. + * @param columnFieldName A string value that specifies the name of the data source field to which the column is bound (the column's FieldName property value). + */ + GetColumnByField(columnFieldName: string): ASPxClientCardViewColumn; + /** + * Returns the editor used to edit the specified column's values. + * @param column An ASPxClientCardViewColumn object that specifies the required column within the client grid. + */ + GetEditor(column: ASPxClientCardViewColumn): ASPxClientEdit; + /** + * Returns the editor used to edit the specified column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + */ + GetEditor(columnIndex: number): ASPxClientEdit; + /** + * Returns the editor used to edit the specified column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + GetEditor(columnFieldNameOrId: string): ASPxClientEdit; + /** + * Returns the value of the specified edit cell. + * @param column An ASPxClientCardViewColumn object that represents the data column within the client grid. + */ + GetEditValue(column: ASPxClientCardViewColumn): string; + /** + * Returns the value of the specified edit cell. + * @param columnIndex An integer value that identifies the data column within the grid's column collection. + */ + GetEditValue(columnIndex: number): string; + /** + * Returns the value of the specified edit cell. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + GetEditValue(columnFieldNameOrId: string): string; +} +/** + * Represents a client column. + */ +interface ASPxClientCardViewColumn extends ASPxClientGridColumnBase { + /** + * Gets the name that uniquely identifies the column. + * Value: A string value assigned to the column's Name property. + */ + name: string; + /** + * Gets the column's position within the collection. + * Value: An integer zero-bazed index that specifies the column's position within the collection. + */ + index: number; + /** + * Gets the name of the database field assigned to the current column. + * Value: A string value that specifies the name of a data field. + */ + fieldName: string; + /** + * Gets whether the column is visible. + * Value: true to display the column; otherwise, false. + */ + visible: boolean; +} +/** + * Represents a JavaScript function which receives the list of card values when the client GetSelectedFieldValues method is called. + */ +interface ASPxClientCardViewValuesCallback { + /** + * Represents a JavaScript function which receives the list of card values when the client GetSelectedFieldValues method is called. + * @param result An object that represents the list of card values received from the server. + */ + (result: Object): void; +} +/** + * A method that will handle the cancelable events of a client ASPxCardView column. + */ +interface ASPxClientCardViewColumnCancelEventHandler { + /** + * A method that will handle the cancelable events of a client ASPxCardView column. + * @param source The event source. This parameter identifies the ASPxClientCardView object that raised the event. + * @param e An ASPxClientCardViewColumnCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewColumnCancelEventArgs): void; +} +/** + * Provides data for the cancelable events of a client ASPxCardView column. + */ +interface ASPxClientCardViewColumnCancelEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed client column. + * Value: An ASPxClientCardViewColumn object that represents the processed column. + */ + column: ASPxClientCardViewColumn; +} +/** + * A method that will handle the CardClick event. + */ +interface ASPxClientCardViewCardClickEventHandler { + /** + * A method that will handle the CardClick event. + * @param source The event source. This parameter identifies the ASPxClientCardView object that raised the event. + * @param e An ASPxClientCardViewCardClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewCardClickEventArgs): void; +} +/** + * Provides data for the CardClick event. + */ +interface ASPxClientCardViewCardClickEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed card's visible index. + * Value: An integer zero-based index that identifies the processed record. + */ + visibleIndex: number; + /** + * Provides access to the parameters associated with the CardClick event. + * Value: An object that contains parameters associated with the event. + */ + htmlEvent: Object; +} +/** + * A method that will handle the CustomButtonClick event. + */ +interface ASPxClientCardViewCustomButtonEventHandler { + /** + * A method that will handle the CustomButtonClick event. + * @param source The event source. This parameter identifies the ASPxClientCardView object that raised the event. + * @param e An ASPxClientCardViewCustomButtonEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewCustomButtonEventArgs): void; +} +/** + * Provides data for the CustomButtonClick event. + */ +interface ASPxClientCardViewCustomButtonEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the value which identifies the card whose custom button has been clicked. + * Value: An integer value that identifies the card whose custom button has been clicked. + */ + visibleIndex: number; + /** + * Gets the value which identifies the custom button. + * Value: A string value that identifies the clicked custom button. + */ + buttonID: string; +} +/** + * A method that will handle the SelectionChanged event. + */ +interface ASPxClientCardViewSelectionEventHandler { + /** + * A method that will handle the SelectionChanged event. + * @param source The event source. + * @param e An ASPxClientCardViewSelectionEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewSelectionEventArgs): void; +} +/** + * Provides data for the SelectionChanged event. + */ +interface ASPxClientCardViewSelectionEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the visible index of the card whose selected state has been changed. + * Value: An value that specifies the visible index of the card. + */ + visibleIndex: number; + /** + * Gets whether the card has been selected. + * Value: true if the card has been selected; otherwise, false. + */ + isSelected: boolean; + /** + * Gets whether all cards displayed within a page have been selected or unselected. + * Value: true if all cards displayed within a page have been selected or unselected; otherwise, false. + */ + isAllRecordsOnPage: boolean; + /** + * Gets whether a selection has been changed on the server. + * Value: true if a selection has been changed on the server; otherwise, false. + */ + isChangedOnServer: boolean; +} +/** + * A method that will handle the client BatchEditStartEditing event. + */ +interface ASPxClientCardViewBatchEditStartEditingEventHandler { + /** + * A method that will handle the BatchEditStartEditing event. + * @param source The event source. + * @param e An ASPxClientCardViewBatchEditStartEditingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditStartEditingEventArgs): void; +} +/** + * Provides data for the BatchEditStartEditing event. + */ +interface ASPxClientCardViewBatchEditStartEditingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the visible index of the card whose cells are about to be edited. + * Value: An value that specifies the visible index of the card. + */ + visibleIndex: number; + /** + * Gets the CardView column that owns a cell that is about to be edited. + * Value: An object that is the focused CardView column. + */ + focusedColumn: ASPxClientCardViewColumn; + /** + * Gets a hashtable that maintains information about editable cells. + * Value: A hashtable that stores information about editable cells. + */ + cardValues: Object; +} +/** + * A method that will handle the client BatchEditEndEditing event. + */ +interface ASPxClientCardViewBatchEditEndEditingEventHandler { + /** + * A method that will handle the BatchEditEndEditing event. + * @param source The event source. + * @param e An ASPxClientCardViewBatchEditEndEditingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditEndEditingEventArgs): void; +} +/** + * Provides data for the BatchEditEndEditing event. + */ +interface ASPxClientCardViewBatchEditEndEditingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the visible index of the card whose cells have been edited. + * Value: An value that specifies the visible index of the card. + */ + visibleIndex: number; + /** + * Gets a hashtable that maintains information about editable cells. + * Value: A hashtable that stores information about editable cells. + */ + cardValues: Object; +} +/** + * A method that will handle the client BatchEditCardValidating event. + */ +interface ASPxClientCardViewBatchEditCardValidatingEventHandler { + /** + * A method that will handle the BatchEditCardValidating event. + * @param source The event source. + * @param e An ASPxClientCardViewBatchEditCardValidatingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditCardValidatingEventArgs): void; +} +/** + * Provides data for the BatchEditCardValidating event. + */ +interface ASPxClientCardViewBatchEditCardValidatingEventArgs extends ASPxClientEventArgs { + /** + * Gets the processed card's visible index. + * Value: An integer value that specifies the processed card's visible index. + */ + visibleIndex: number; + /** + * Provides validation information of a card currently being validated. + * Value: An object that is a hashtable containing validation information. + */ + validationInfo: Object; +} +/** + * Represents an object that will handle the client-side BatchEditConfirmShowing event. + */ +interface ASPxClientCardViewBatchEditConfirmShowingEventHandler { + /** + * A method that will handle the BatchEditConfirmShowing client event. + * @param source The event source. + * @param e An ASPxClientCardViewBatchEditConfirmShowingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditConfirmShowingEventArgs): void; +} +/** + * Provides data for the BatchEditConfirmShowing event. + */ +interface ASPxClientCardViewBatchEditConfirmShowingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the client identifier of an object that initiates a send request. + * Value: A string value that specifies the object client identifier. + */ + requestTriggerID: string; +} +/** + * A method that will handle the client BatchEditTemplateCellFocused event. + */ +interface ASPxClientCardViewBatchEditTemplateCellFocusedEventHandler { + /** + * A method that will handle the BatchEditTemplateCellFocused event. + * @param source An object representing the event source. Identifies the button editor that raised the event. + * @param e An ASPxClientCardViewBatchEditTemplateCellFocusedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditTemplateCellFocusedEventArgs): void; +} +/** + * Provides data for the BatchEditTemplateCellFocused event. + */ +interface ASPxClientCardViewBatchEditTemplateCellFocusedEventArgs extends ASPxClientEventArgs { + /** + * Gets the currently processed column. + * Value: An object that is the client-side column object. + */ + column: ASPxClientCardViewColumn; + /** + * Gets or sets a value specifying whether the event was handled. + * Value: true if the event was handled and default processing should not occur; false if the event should be handled using default processing. + */ + handled: boolean; +} +/** + * A method that will handle the BatchEditChangesSaving event. + */ +interface ASPxClientCardViewBatchEditChangesSavingEventHandler { + /** + * A method that will handle the BatchEditChangesSaving event. + * @param source The event source. This parameter identifies the card view object which raised the event. + * @param e An ASPxClientCardViewBatchEditChangesSavingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditChangesSavingEventArgs): void; +} +/** + * Provides data for the BatchEditChangesSaving event. + */ +interface ASPxClientCardViewBatchEditChangesSavingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets a hashtable that maintains information about inserted cells. + * Value: A hashtable that stores information about inserted cells. + */ + insertedValues: Object; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + deletedValues: Object; + /** + * Gets a hashtable that maintains information about updated cells. + * Value: A hashtable that stores information about updated cells. + */ + updatedValues: Object; +} +/** + * A method that will handle the BatchEditChangesCanceling event. + */ +interface ASPxClientCardViewBatchEditChangesCancelingEventHandler { + /** + * A method that will handle the BatchEditChangesCanceling event. + * @param source The event source. This parameter identifies the card view object which raised the event. + * @param e An ASPxClientCardViewBatchEditChangesCancelingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditChangesCancelingEventArgs): void; +} +/** + * Provides data for the BatchEditChangesCanceling event. + */ +interface ASPxClientCardViewBatchEditChangesCancelingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets a hashtable that maintains information about inserted cells. + * Value: A hashtable that stores information about inserted cells. + */ + insertedValues: Object; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + deletedValues: Object; + /** + * Gets a hashtable that maintains information about updated cells. + * Value: A hashtable that stores information about updated cells. + */ + updatedValues: Object; +} +/** + * A method that will handle the BatchEditCardInserting event. + */ +interface ASPxClientCardViewBatchEditCardInsertingEventHandler { + /** + * A method that will handle the BatchEditCardInserting event. + * @param source The event source. This parameter identifies the card view object which raised the event. + * @param e An ASPxClientCardViewBatchEditCardInsertingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditCardInsertingEventArgs): void; +} +/** + * Provides data for the BatchEditCardInserting event. + */ +interface ASPxClientCardViewBatchEditCardInsertingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed card visible index. + * Value: An integer value that specifies the processed card visible index. + */ + visibleIndex: number; +} +/** + * A method that will handle the BatchEditCardDeleting event. + */ +interface ASPxClientCardViewBatchEditCardDeletingEventHandler { + /** + * A method that will handle the BatchEditCardDeleting event. + * @param source The event source. This parameter identifies the card view object which raised the event. + * @param e An ASPxClientCardViewBatchEditCardDeletingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditCardDeletingEventArgs): void; +} +/** + * Provides data for the BatchEditCardDeleting event. + */ +interface ASPxClientCardViewBatchEditCardDeletingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed card visible index. + * Value: An integer value that specifies the processed card visible index. + */ + visibleIndex: number; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + cardValues: Object; +} +/** + * Provides members related to Batch Edit Mode + */ +interface ASPxClientCardViewBatchEditApi { + /** + * 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(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. + */ + ValidateCard(visibleIndex: number): boolean; + /** + * Returns an array of card visible indices. + * @param includeDeleted true, to include visible indices of deleted cards to the returned array; otherwise, false. + */ + GetCardVisibleIndices(includeDeleted: boolean): number[]; + /** + * Returns an array of the deleted card visible indices. + */ + GetDeletedCardIndices(): number[]; + /** + * Returns an array of the inserted card visible indices. + */ + GetInsertedCardIndices(): number[]; + /** + * Indicates if the card with the specified visible index is deleted. + * @param visibleIndex An integer value that identifies the card by its visible index. + */ + IsDeletedCard(visibleIndex: number): boolean; + /** + * Indicates if the card with the specified visible index is newly created. + * @param visibleIndex An integer value that identifies the card by its visible index. + */ + IsNewCard(visibleIndex: number): boolean; + /** + * Programmatically moves the focus to the previous cell in the card + */ + MoveFocusBackward(): boolean; + /** + * Programmatically moves the focus to the next cell in the card. + */ + MoveFocusForward(): boolean; + /** + * Sets the value of the specified cell. + * @param visibleIndex An integer zero-based index that identifies the card containing the processed cell. + * @param columnFieldNameOrId A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + * @param value An object that contains the new cell value. + */ + SetCellValue(visibleIndex: number, columnFieldNameOrId: string, value: Object): void; + /** + * Sets the value of the specified cell. + * @param visibleIndex An integer zero-based index that identifies the card containing the processed cell. + * @param columnFieldNameOrId A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + * @param value An object that contains the new cell value. + * @param displayText A string value that specifies the cell display text. + * @param cancelCellHighlighting true to cancel highlighting of the modified cell, false to highlight the modified cell. + */ + SetCellValue(visibleIndex: number, columnFieldNameOrId: string, value: Object, displayText: string, cancelCellHighlighting?: boolean): void; + /** + * Gets the value of the specified cell. + * @param visibleIndex A zero-based integer value that specifies the visible index of a card containing the processed cell. + * @param columnFieldNameOrId A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + * @param initial true, to return the initial (server) value; false, to return a value currently contained on the client side (modified value). + */ + GetCellValue(visibleIndex: number, columnFieldNameOrId: string, initial?: boolean): Object; + /** + * Gets information about the cell currently being edited. + */ + GetEditCellInfo(): ASPxClientCardViewCellInfo; + /** + * Returns a value that indicates whether the card view has changed data. + */ + HasChanges(): boolean; + /** + * Returns a value that indicates whether the specified card has changed data. + * @param visibleIndex An integer value that specifies the visible index of a card. + */ + HasChanges(visibleIndex: number): boolean; + /** + * Returns a value that indicates whether the specified cell's data has been changed. + * @param visibleIndex An integer value that specifies the visible index of a card. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + HasChanges(visibleIndex: number, columnFieldNameOrId: string): boolean; + /** + * Resets changes in the specified card. + * @param visibleIndex An integer value that specifies the visible index of a card. + */ + ResetChanges(visibleIndex: number): void; + /** + * Resets changes in the specified cell. + * @param visibleIndex An integer value that specifies the visible index of a card containing the processed cell. + * @param columnIndex A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + */ + ResetChanges(visibleIndex: number, columnIndex: number): void; + /** + * Switches the specified cell to edit mode. + * @param visibleIndex A zero-based integer value that specifies the visible index of a card containing the processed cell. + * @param columnIndex A zero-based integer value that identifies the column which contains the processed cell in the column collection. + */ + StartEdit(visibleIndex: number, columnIndex: number): void; + /** + * Ends cell or card editing. + */ + EndEdit(): void; +} +/** + * Contains information on a grid cell. + */ +interface ASPxClientCardViewCellInfo { + /** + * Gets the visible index of the card that contains the cell currently being processed. + * Value: An value that specifies the visible index of the card. + */ + cardVisibleIndex: number; + /** + * Gets the data column that contains the cell currently being processed. + * Value: An object that is the data column which contains the processed cell. + */ + column: ASPxClientCardViewColumn; +} +/** + * A client-side equivalent of the ASPxGridView object. + */ +interface ASPxClientGridView extends ASPxClientGridBase { + /** + * Provides access to the batch editing client API. + * Value: A object that exposes the batch editing client API methods. + */ + batchEditApi: ASPxClientGridViewBatchEditApi; + /** + * Occurs when a custom command button has been clicked. + */ + CustomButtonClick: ASPxClientEvent>; + /** + * Fires after the selection has been changed. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Enables you to prevent columns from being sorted. + */ + ColumnSorting: ASPxClientEvent>; + /** + * Fires in response to changing row focus. + */ + FocusedRowChanged: ASPxClientEvent>; + /** + * Enables you to cancel data grouping. + */ + ColumnGrouping: ASPxClientEvent>; + /** + * Fires when an end-user starts dragging the column's header and enables you to cancel this operation. + */ + ColumnStartDragging: ASPxClientEvent>; + /** + * Enables you to prevent columns from being resized. + */ + ColumnResizing: ASPxClientEvent>; + /** + * Occurs after a column's width has been changed by an end-user. + */ + ColumnResized: ASPxClientEvent>; + /** + * Enables you to control column movement. + */ + ColumnMoving: ASPxClientEvent>; + /** + * Fires before a group row is expanded. + */ + RowExpanding: ASPxClientEvent>; + /** + * Fires before a group row is collapsed. + */ + RowCollapsing: ASPxClientEvent>; + /** + * Fires before a detail row is expanded. + */ + DetailRowExpanding: ASPxClientEvent>; + /** + * Fires before a detail row is collapsed. + */ + DetailRowCollapsing: ASPxClientEvent>; + /** + * Fires on the client when a data row is clicked. + */ + RowClick: ASPxClientEvent>; + /** + * Fires on the client when a data row is double clicked. + */ + RowDblClick: ASPxClientEvent>; + /** + * Occurs after an end-user right clicks in the GridView, and enables you to provide a custom context menu. + */ + ContextMenu: ASPxClientEvent>; + /** + * Fires on the client side when a context menu item has been clicked. + */ + ContextMenuItemClick: ASPxClientEvent>; + /** + * Enables you to specify whether row data is valid and provide an error text. + */ + BatchEditRowValidating: ASPxClientEvent>; + /** + * Enables you to prevent a batch edit confirmation message from being displayed. + */ + BatchEditConfirmShowing: ASPxClientEvent>; + /** + * Occurs when a grid switches to batch edit mode. + */ + BatchEditStartEditing: ASPxClientEvent>; + /** + * Occurs when a grid leaves the batch edit mode. + */ + BatchEditEndEditing: ASPxClientEvent>; + /** + * Enables you to provide navigation for editors contained in a templated cell in Batch Edit mode. + */ + BatchEditTemplateCellFocused: ASPxClientEvent>; + /** + * Occurs on the client side before data changes are saved in batch edit mode. + */ + BatchEditChangesSaving: ASPxClientEvent>; + /** + * Occurs on the client side before data changes are canceled in batch edit mode. + */ + BatchEditChangesCanceling: ASPxClientEvent>; + /** + * Occurs on the client side before a data row is inserted in batch edit mode. + */ + BatchEditRowInserting: ASPxClientEvent>; + /** + * Occurs on the client side before a data row is deleted in batch edit mode. + */ + BatchEditRowDeleting: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any unhandled server error occurs during server-side processing of a callback sent by the ASPxClientGridView. + */ + CallbackError: ASPxClientEvent>; + /** + * Fires after the Customization Window has been closed. + */ + CustomizationWindowCloseUp: ASPxClientEvent>; + /** + * Selects or deselects the specified row displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the row's visible index. + * @param selected true to select the specified row; false to deselect the row. + */ + SelectRowOnPage(visibleIndex: number, selected?: boolean): void; + /** + * Deselects the specified row (if selected) displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the row's visible index. + */ + UnselectRowOnPage(visibleIndex: number): void; + /** + * Selects all unselected rows displayed on the current page. + */ + SelectAllRowsOnPage(): void; + /** + * Allows you to select or deselect all rows displayed on the current page based on the parameter passed. + * @param selected true to select all unselected rows displayed on the current page; false to deselect all selected rows on the page. + */ + SelectAllRowsOnPage(selected: boolean): void; + /** + * Deselects all selected rows displayed on the current page. + */ + UnselectAllRowsOnPage(): void; + /** + * Returns the number of selected rows. + */ + GetSelectedRowCount(): number; + /** + * Indicates whether or not the specified row is selected within the current page. + * @param visibleIndex An integer value that identifies the row by its visible index. + */ + IsRowSelectedOnPage(visibleIndex: number): boolean; + /** + * Indicates whether the specified row is a group row. + * @param visibleIndex An integer value that identifies the row by its visible index. + */ + IsGroupRow(visibleIndex: number): boolean; + /** + * Indicates whether the specified row is a data row. + * @param visibleIndex An integer value that identifies the row by its visible index. + */ + IsDataRow(visibleIndex: number): boolean; + /** + * Indicates whether the specified group row is expanded. + * @param visibleIndex An integer value that identifies the group row by its visible index. + */ + IsGroupRowExpanded(visibleIndex: number): boolean; + /** + * Returns the current vertical scroll position of the grid's content. + */ + GetVertScrollPos(): number; + /** + * Returns the current horizontal scroll position of the grid's content. + */ + GetHorzScrollPos(): number; + /** + * Returns the current horizontal scroll position of the grid's content. + */ + GetHorizontalScrollPosition(): number; + /** + * Specifies the vertical scroll position for the grid's content. + * @param position An integer value specifying the vertical scroll position. + */ + SetVertScrollPos(position: number): void; + /** + * Specifies the horizontal scroll position for the grid's content. + * @param position An integer value specifying the horizontal scroll position. + */ + SetHorzScrollPos(position: number): void; + /** + * Specifies the horizontal scroll position for the grid's content. + * @param position An integer value specifying the horizontal scroll position. + */ + SetHorizontalScrollPosition(position: number): void; + /** + * Applies a filter specified in the filter row to the GridView. + */ + ApplyOnClickRowFilter(): void; + /** + * Returns the editor used to edit the value in the auto filter row for the specified data column. + * @param column An ASPxClientGridViewColumn object that represents the data colum within the ASPxGridView. + */ + GetAutoFilterEditor(column: ASPxClientGridViewColumn): Object; + /** + * Returns the editor used to edit the value in the auto filter row for the specified data column. + * @param columnIndex An integer value that identifies the data column by its index. + */ + GetAutoFilterEditor(columnIndex: number): Object; + /** + * Returns the editor used to edit the value in the auto filter row for the specified data column. + * @param columnFieldNameOrId A string value that specifies the column's name or its data base field name. + */ + GetAutoFilterEditor(columnFieldNameOrId: string): Object; + /** + * Applies a filter to the specified data column. + * @param column An ASPxClientGridViewColumn object that represents the data column within the client GridView. + * @param val A string value that specifies the filter expression. + */ + AutoFilterByColumn(column: ASPxClientGridViewColumn, val: string): void; + /** + * Applies a filter to the specified data column. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param val A string value that specifies the filter expression. + */ + AutoFilterByColumn(columnIndex: number, val: string): void; + /** + * Applies a filter to the specified data column. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param val A string value that specifies the filter expression. + */ + AutoFilterByColumn(columnFieldNameOrId: string, val: string): void; + /** + * Applies the specified search panel filter criterion to grid data. + * @param value A string value that specifies the filter criterion. + */ + ApplySearchPanelFilter(value: string): void; + /** + * Applies the specified filter expression to the GridView. + * @param filterExpression A string value that specifies the filter expression. + */ + ApplyFilter(filterExpression: string): void; + /** + * Clears the filter expression applied to a client GridView. + */ + ClearFilter(): void; + /** + * Gets the Popup Edit Form. + */ + GetPopupEditForm(): ASPxClientPopupControl; + /** + * Sets input focus to the grid. + */ + Focus(): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Selects the specified page. + * @param pageIndex An integer value that specifies the active page's index. + */ + GotoPage(pageIndex: number): void; + /** + * Gets the index of the page currently being selected. + */ + GetPageIndex(): number; + /** + * Gets the number of pages to which the grid's data is divided. + */ + GetPageCount(): number; + /** + * Activates the next page. + */ + NextPage(): void; + /** + * Activates the previous page. + */ + PrevPage(): void; + /** + * Returns the index of the first data row displayed within the GridView's active page. + */ + GetTopVisibleIndex(): number; + /** + * Indicates whether the grid is in edit mode. + */ + IsEditing(): boolean; + /** + * Saves all the changes made and switches the grid to browse mode. + */ + UpdateEdit(): void; + /** + * Cancels all the changes made and switches the GridView to browse mode. + */ + CancelEdit(): void; + /** + * Updates data displayed within the grid. + */ + Refresh(): void; + /** + * Indicates whether the Customization Window is displayed. + */ + IsCustomizationWindowVisible(): boolean; + /** + * Invokes the Customization Window. + */ + ShowCustomizationWindow(): void; + /** + * Invokes the Customization Window and displays it over the specified HTML element. + * @param showAtElement An object that specifies the HTML element relative to whose position the customization window is invoked. + */ + ShowCustomizationWindow(showAtElement?: Object): void; + /** + * Closes the Customization Window. + */ + HideCustomizationWindow(): void; + /** + * Returns the number of columns within the client GridView. + */ + GetColumnsCount(): number; + /** + * Returns the number of columns within the client GridView. + */ + GetColumnCount(): number; + /** + * Returns the row values displayed within all selected rows. + * @param fieldNames The names of data source fields separated via a semicolon, whose values within the selected rows are returned. + * @param onCallback A ASPxClientGridViewValuesCallback object that represents the JavaScript function which receives the list of row values as a parameter. + */ + GetSelectedFieldValues(fieldNames: string, onCallback: ASPxClientGridViewValuesCallback): void; + /** + * Returns key values of selected rows displayed within the current page. + */ + GetSelectedKeysOnPage(): Object[]; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event. + * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback A ASPxClientGridViewValuesCallback object that is the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(args: string, onCallback: ASPxClientGridViewValuesCallback): void; + /** + * Returns the values of the specified data source fields within the specified row. + * @param visibleIndex An integer value that identifies the data row. + * @param fieldNames The names of data source fields separated via a semicolon, whose values within the specified row are returned. + * @param onCallback An ASPxClientGridViewValuesCallback object that represents the JavaScript function which receives the list of row values as a parameter. + */ + GetRowValues(visibleIndex: number, fieldNames: string, onCallback: ASPxClientGridViewValuesCallback): void; + /** + * Returns the row values displayed within the current page. + * @param fieldNames The names of data source fields whose values are returned. + * @param onCallback A ASPxClientGridViewValuesCallback object that represents the JavaScript function which receives the list of row values as a parameter. + */ + GetPageRowValues(fieldNames: string, onCallback: ASPxClientGridViewValuesCallback): void; + /** + * Returns the number of rows actually displayed within the active page. + */ + GetVisibleRowsOnPage(): number; + /** + * Returns the client column that resides at the specified position within the column collection. + * @param columnIndex A zero-based index that identifies the column within the column collection (the column's Index property value). + */ + GetColumn(columnIndex: number): ASPxClientGridViewColumn; + /** + * Returns the column with the specified unique identifier. + * @param columnId A string value that specifies the column's unique identifier (the column's Name property value). + */ + GetColumnById(columnId: string): ASPxClientGridViewColumn; + /** + * Returns the client column which is bound to the specified data source field. + * @param columnFieldName A string value that specifies the name of the data source field to which the column is bound (the column's FieldName property value). + */ + GetColumnByField(columnFieldName: string): ASPxClientGridViewColumn; + /** + * Returns the editor used to edit the specified column's values. + * @param column An ASPxClientGridViewColumn object that specifies the required column within the client grid. + */ + GetEditor(column: ASPxClientGridViewColumn): ASPxClientEdit; + /** + * Returns the editor used to edit the specified column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + */ + GetEditor(columnIndex: number): ASPxClientEdit; + /** + * Returns the editor used to edit the specified column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + GetEditor(columnFieldNameOrId: string): ASPxClientEdit; + /** + * Returns the value of the specified edit cell. + * @param column An ASPxClientGridViewColumn object that represents the data column within the client grid. + */ + GetEditValue(column: ASPxClientGridViewColumn): string; + /** + * Returns the value of the specified edit cell. + * @param columnIndex An integer value that identifies the data column within the grid's column collection. + */ + GetEditValue(columnIndex: number): string; + /** + * Returns the value of the specified edit cell. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + GetEditValue(columnFieldNameOrId: string): string; + /** + * Moves focus to the specified edit cell within the edited row. + * @param column An ASPxClientGridViewColumn object that represents the data column within the client grid. + */ + FocusEditor(column: ASPxClientGridViewColumn): void; + /** + * Moves focus to the specified edit cell within the edited row. + * @param columnIndex An integer value that specifies the column's position within the columns collection. + */ + FocusEditor(columnIndex: number): void; + /** + * Moves focus to the specified edit cell within the edited row. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + FocusEditor(columnFieldNameOrId: string): void; + /** + * Sets the value of the specified edit cell. + * @param column An ASPxClientGridViewColumn object that represents the data column within the client grid. + * @param value A string value that specifies the edit cell's new value. + */ + SetEditValue(column: ASPxClientGridViewColumn, value: string): void; + /** + * Sets the value of the specified edit cell. + * @param columnIndex An integer value that identifies the data column within the grid's column collection. + * @param value A string value that specifies the edit cell's new value. + */ + SetEditValue(columnIndex: number, value: string): void; + /** + * Sets the value of the specified edit cell. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param value A string value that specifies the edit cell's new value. + */ + SetEditValue(columnFieldNameOrId: string, value: string): void; + /** + * Displays the Filter Control. + */ + ShowFilterControl(): void; + /** + * Hides the Filter Control. + */ + CloseFilterControl(): void; + /** + * Enables or disables the current filter. + * @param isFilterEnabled true to enable the current filter; otherwise, false. + */ + SetFilterEnabled(isFilterEnabled: boolean): void; + /** + * Returns the current vertical scroll position of the grid's content. + */ + GetVerticalScrollPosition(): number; + /** + * Specifies the vertical scroll position for the grid's content. + * @param position An integer value specifying the vertical scroll position. + */ + SetVerticalScrollPosition(position: number): void; + /** + * Gets information about a focused cell. + */ + GetFocusedCell(): ASPxClientGridViewCellInfo; + /** + * Focuses the specified cell. + * @param rowVisibleIndex An integer value that specifies the visible index of the row. + * @param columnIndex A zero-based index that identifies the column in the column collection (the column's Index property value). + */ + SetFocusedCell(rowVisibleIndex: number, columnIndex: number): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientGridViewColumn object that represents the data column. + */ + SortBy(column: ASPxClientGridViewColumn): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + */ + SortBy(columnIndex: number): void; + /** + * Sorts data by the specified data column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + SortBy(columnFieldNameOrId: string): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientGridViewColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(column: ASPxClientGridViewColumn, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(columnIndex: number, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(columnFieldNameOrId: string, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientGridViewColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(column: ASPxClientGridViewColumn, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(columnIndex: number, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values, and places the column to the specified position among the sorted columns. + * @param column An ASPxClientGridViewColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex An integer value that specifies the zero-based column's index among the sorted columns. -1 if data is not sorted by this column. + */ + SortBy(column: ASPxClientGridViewColumn, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Sorts data by the specified data column's values, and places the column to the specified position among the sorted columns. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex An integer value that specifies the zero-based column's index among the sorted columns. -1 if data is not sorted by this column. + */ + SortBy(columnIndex: number, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Sorts data by the specified data column's values, and places the column to the specified position among the sorted columns. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex An integer value that specifies the zero-based column's index among the sorted columns. -1 if data is not sorted by this column. + */ + SortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Hides the specified column. + * @param column An ASPxClientGridViewColumn object that represents the column to hide. + */ + MoveColumn(column: ASPxClientGridViewColumn): void; + /** + * Hides the specified column. + * @param columnIndex An integer value that specifies the absolute index of the column to hide. + */ + MoveColumn(columnIndex: number): void; + /** + * Hides the specified column. + * @param columnFieldNameOrId A String value that identifies the column to be hidden by the name of the data source field to which the column is bound, or by the column's name. + */ + MoveColumn(columnFieldNameOrId: string): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param column An ASPxClientGridViewColumn object that represents the column to move. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the grid. + */ + MoveColumn(column: ASPxClientGridViewColumn, moveToColumnVisibleIndex: number): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the grid. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param columnFieldNameOrId A String value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the grid. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param column An ASPxClientGridViewColumn object that represents the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + */ + MoveColumn(column: ASPxClientGridViewColumn, moveToColumnVisibleIndex: number, moveBefore: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number, moveBefore: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param columnFieldNameOrId A string value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, moveBefore: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups the grid's data by this column. + * @param column An ASPxClientGridViewColumn object that represents the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + * @param moveToGroup true to group the grid's data by the column; otherwise, false. + */ + MoveColumn(column: ASPxClientGridViewColumn, moveToColumnVisibleIndex: number, moveBefore: boolean, moveToGroup: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups the grid's data by this column. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + * @param moveToGroup true to group the ASPxGridView's data by the column; otherwise, false. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number, moveBefore: boolean, moveToGroup: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups the grid's data by this column. + * @param columnFieldNameOrId A string value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + * @param moveToGroup true to group the grid's data by the column; otherwise, false. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, moveBefore: boolean, moveToGroup: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups or ungroups the grid's data by this column. + * @param column An ASPxClientGridViewColumn object that represents the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + * @param moveToGroup true to group the grid's data by the column; otherwise, false. + * @param moveFromGroup true to ungroup the grid's data by the column; otherwise, false. + */ + MoveColumn(column: ASPxClientGridViewColumn, moveToColumnVisibleIndex: number, moveBefore: boolean, moveToGroup: boolean, moveFromGroup: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups or ungroups the grid's data by this column. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + * @param moveToGroup true to group the grid's data by the column; otherwise, false. + * @param moveFromGroup true to ungroup the grid's data by the column; otherwise, false. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number, moveBefore: boolean, moveToGroup: boolean, moveFromGroup: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups or ungroups the grid's data by this column. + * @param columnFieldNameOrId A string value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + * @param moveToGroup true to group the grid's data by the column; otherwise, false. + * @param moveFromGroup true to ungroup the grid's data by the column; otherwise, false. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, moveBefore: boolean, moveToGroup: boolean, moveFromGroup: boolean): void; + /** + * Groups data by the values of the specified column. + * @param column An ASPxClientGridViewColumn object that represents the data column by whose values data is grouped. + */ + GroupBy(column: ASPxClientGridViewColumn): void; + /** + * Groups data by the values of the specified column. + * @param columnIndex An integer value that specifies the column's position within the column collection. + */ + GroupBy(columnIndex: number): void; + /** + * Groups data by the values of the specified column. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + GroupBy(columnFieldNameOrId: string): void; + /** + * Groups data by the values of the specified data column. If several columns are involved in grouping, the specified column will reside at the specified grouping level. + * @param column An ASPxClientGridViewColumn object that represents the data column by whose values data is grouped. + * @param groupIndex An integer value that specifies the grouping level. -1 to cancel grouping by the column's values. + */ + GroupBy(column: ASPxClientGridViewColumn, groupIndex: number): void; + /** + * Groups data by the values of the specified data column. If several columns are involved in grouping, the specified column will reside at the specified grouping level. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param groupIndex An integer value that specifies the grouping level. -1 to cancel grouping by the column's values. + */ + GroupBy(columnIndex: number, groupIndex: number): void; + /** + * Groups data by the values of the specified data column. If several columns are involved in grouping, the specified column will reside at the specified grouping level. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param groupIndex An integer value that specifies the grouping level. -1 to cancel grouping by the column's values. + */ + GroupBy(columnFieldNameOrId: string, groupIndex: number): void; + /** + * Groups data by the values of the specified data column with the specified sort order. If several columns are involved in grouping, the specified column will reside at the specified grouping level. + * @param column An ASPxClientGridViewColumn object that represents the data column by whose values data is grouped. + * @param groupIndex An integer value that specifies the grouping level. -1 to cancel grouping by the column's values. + * @param sortOrder A string value that specifies the column's sort order. + */ + GroupBy(column: ASPxClientGridViewColumn, groupIndex: number, sortOrder: string): void; + /** + * Groups data by the values of the specified data column with the specified sort order. If several columns are involved in grouping, the specified column will reside at the specified grouping level. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param groupIndex An integer value that specifies the grouping level. -1 to cancel grouping by the column's values. + * @param sortOrder A string value that specifies the column's sort order. + */ + GroupBy(columnIndex: number, groupIndex: number, sortOrder: string): void; + /** + * Groups data by the values of the specified data column with the specified sort order. If several columns are involved in grouping, the specified column will reside at the specified grouping level. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param groupIndex An integer value that specifies the grouping level. -1 to cancel grouping by the column's values. + * @param sortOrder A string value that specifies the column's sort order. + */ + GroupBy(columnFieldNameOrId: string, groupIndex: number, sortOrder: string): void; + /** + * Ungroups data by the values of the specified column. + * @param column An ASPxClientGridViewColumn object that represents the data column within the ASPxGridView. + */ + UnGroup(column: ASPxClientGridViewColumn): void; + /** + * Ungroups data by the values of the specified column. + * @param columnIndex An integer value that specifies the column's position within the column collection. + */ + UnGroup(columnIndex: number): void; + /** + * Ungroups data by the values of the specified column. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + UnGroup(columnFieldNameOrId: string): void; + /** + * Expands all group rows. + */ + ExpandAll(): void; + /** + * Collapses all group rows. + */ + CollapseAll(): void; + /** + * Expands all detail rows. + */ + ExpandAllDetailRows(): void; + /** + * Collapses all detail rows. + */ + CollapseAllDetailRows(): void; + /** + * Expands the specified group row preserving the collapsed state of any child group row. + * @param visibleIndex An integer value that identifies the group row. + */ + ExpandRow(visibleIndex: number): void; + /** + * Expands the specified group row and optionally child group rows at all nesting levels. + * @param visibleIndex An integer value that identifies the group row. + * @param recursive true to expand any child group rows at all nesting levels; false to preserve the collapsed state of any child group rows. + */ + ExpandRow(visibleIndex: number, recursive?: boolean): void; + /** + * Collapses the specified group row preserving the expanded state of child group rows. + * @param visibleIndex An integer value that identifies the group row by its visible index. + */ + CollapseRow(visibleIndex: number): void; + /** + * Collapses the specified group row and optionally child group rows at all nesting levels. + * @param visibleIndex An integer value that identifies the group row by its visible index. + * @param recursive true to collapse child group rows at all nesting levels; false to preserve the expanded state of any child group row. + */ + CollapseRow(visibleIndex: number, recursive?: boolean): void; + /** + * Scrolls the view to the specified row. + * @param visibleIndex An integer value that identifies a row by its visible index. + */ + MakeRowVisible(visibleIndex: number): void; + /** + * Expands the specified detail row. + * @param visibleIndex A zero-based integer index that identifies the detail row. + */ + ExpandDetailRow(visibleIndex: number): void; + /** + * Collapses the specified detail row. + * @param visibleIndex A zero-based integer index that identifies the detail row. + */ + CollapseDetailRow(visibleIndex: number): void; + /** + * Returns the key value of the specified data row. + * @param visibleIndex An integer value that specifies the row's visible index. + */ + GetRowKey(visibleIndex: number): string; + /** + * Switches the grid to edit mode. + * @param visibleIndex A zero-based integer that identifies a data row to be edited. + */ + StartEditRow(visibleIndex: number): void; + /** + * Switches the grid to edit mode. + * @param key An object that uniquely identifies a data row to be edited. + */ + StartEditRowByKey(key: Object): void; + /** + * Indicates whether or not a new row is being edited. + */ + IsNewRowEditing(): boolean; + /** + * Adds a new record. + */ + AddNewRow(): void; + /** + * Deletes the specified row. + * @param visibleIndex An integer value that identifies the row. + */ + DeleteRow(visibleIndex: number): void; + /** + * Deletes a row with the specified key value. + * @param key An object that uniquely identifies the row. + */ + DeleteRowByKey(key: Object): void; + /** + * Returns the focused row's index. + */ + GetFocusedRowIndex(): number; + /** + * Moves focus to the specified row. + * @param visibleIndex An integer value that specifies the focused row's index. + */ + SetFocusedRowIndex(visibleIndex: number): void; + /** + * Selects all the unselected rows within the grid. + */ + SelectRows(): void; + /** + * Selects the specified row displayed within the grid. + * @param visibleIndex A zero-based integer value that specifies the row's visible index. + */ + SelectRows(visibleIndex: number): void; + /** + * Selects the specified rows within the grid. + * @param visibleIndices An array of zero-based indices that identify data rows within the grid. + */ + SelectRows(visibleIndices: number[]): void; + /** + * Selects or deselects the specified rows within the grid. + * @param visibleIndices An array of zero-based indices that identify data rows within the grid. + * @param selected true to select the specified rows; false to deselect the rows. + */ + SelectRows(visibleIndices: number[], selected: boolean): void; + /** + * Selects or deselects the specified row within the grid. + * @param visibleIndex An integer zero-based index that identifies the data row within the grid. + * @param selected true to select the specified row; false to deselect the row. + */ + SelectRows(visibleIndex: number, selected?: boolean): void; + /** + * Selects or deselects the specified rows displayed within the grid. + * @param keys An array of objects that uniquely identify the rows. + * @param selected true to select the specified rows; false to deselect the rows. + */ + SelectRowsByKey(keys: Object[], selected?: boolean): void; + /** + * Selects or deselects the specified row displayed within the grid. + * @param key An object that uniquely identifies the row. + * @param selected true to select the specified row; false to deselect the row. + */ + SelectRowsByKey(key: Object, selected?: boolean): void; + /** + * Selects the specified rows displayed within the grid. + * @param keys An array of objects that uniquely identify the rows. + */ + SelectRowsByKey(keys: Object[]): void; + /** + * Selects a grid row by its key. + * @param key An object that uniquely identifies the row. + */ + SelectRowsByKey(key: Object): void; + /** + * Deselects the specified rows displayed within the grid. + * @param keys An array of objects that uniquely identify the rows. + */ + UnselectRowsByKey(keys: Object[]): void; + /** + * Deselects the specified row displayed within the grid. + * @param key An object that uniquely identifies the row. + */ + UnselectRowsByKey(key: Object): void; + /** + * Deselects all the selected rows within the grid. + */ + UnselectRows(): void; + /** + * Deselects the specified rows (if selected) within the grid. + * @param visibleIndices An array of zero-based indices that identify data rows within the grid. + */ + UnselectRows(visibleIndices: number[]): void; + /** + * Deselects the specified row (if selected) within the grid. + * @param visibleIndex A zero-based integer value that specifies the row's visible index. + */ + UnselectRows(visibleIndex: number): void; + /** + * Deselects all grid rows that match the filter criteria currently applied to the grid. + */ + UnselectFilteredRows(): void; + /** + * Selects the specified row displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the row's visible index. + */ + SelectRowOnPage(visibleIndex: number): void; +} +/** + * A client grid column. + */ +interface ASPxClientGridViewColumn extends ASPxClientGridColumnBase { + /** + * Gets the column's unique identifier. + * Value: A string value that specifies the column's unique identifier. + */ + id: string; + /** + * Gets the name that uniquely identifies the column. + * Value: A string value assigned to the column's Name property. + */ + name: string; + /** + * Gets the column's position within the collection. + * Value: An integer zero-bazed index that specifies the column's position within the collection. + */ + index: number; + /** + * Gets the name of the database field assigned to the current column. + * Value: A string value that specifies the name of a data field. + */ + fieldName: string; + /** + * Gets whether the column is visible. + * Value: true to display the column; otherwise, false. + */ + visible: boolean; +} +/** + * Represents a JavaScript function which receives the list of row values when the client GetSelectedFieldValues method is called. + */ +interface ASPxClientGridViewValuesCallback { + /** + * Represents a JavaScript function which receives the list of row values when the client GetSelectedFieldValues method is called. + * @param result An object that represents the list of row values received from the server. + */ + (result: Object): void; +} +/** + * A method that will handle the cancelable events of a client ASPxGridView column. + */ +interface ASPxClientGridViewColumnCancelEventHandler { + /** + * A method that will handle the cancelable events of a client ASPxGridView column. + * @param source The event source. + * @param e An ASPxClientGridViewColumnCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewColumnCancelEventArgs): void; +} +/** + * Provides data for the cancelable events of a client ASPxGridView column. + */ +interface ASPxClientGridViewColumnCancelEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed client column. + * Value: An ASPxClientGridViewColumn object that represents the processed column. + */ + column: ASPxClientGridViewColumn; +} +/** + * A method that will handle the client events concerned with column processing. + */ +interface ASPxClientGridViewColumnProcessingModeEventHandler { + /** + * A method that will handle the client events concerned with column processing. + * @param source The event source. + * @param e A ASPxClientGridViewColumnProcessingModeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewColumnProcessingModeEventArgs): void; +} +/** + * Provides data for the client events concerned with column processing, and that allow the event's processing to be passed to the server side. + */ +interface ASPxClientGridViewColumnProcessingModeEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets a grid column related to the event. + * Value: An ASPxClientGridViewColumn object representing the column related to the event. + */ + column: ASPxClientGridViewColumn; +} +/** + * A method that will handle the RowExpanding events. + */ +interface ASPxClientGridViewRowCancelEventHandler { + /** + * A method that will handle the RowExpanding events. + * @param source The event source. + * @param e An ASPxClientGridViewRowCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewRowCancelEventArgs): void; +} +/** + * Provides data for the RowExpanding events. + */ +interface ASPxClientGridViewRowCancelEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed row's visible index. + * Value: An integer zero-based index that identifies the processed row. + */ + visibleIndex: number; +} +/** + * A method that will handle the SelectionChanged event. + */ +interface ASPxClientGridViewSelectionEventHandler { + /** + * A method that will handle the SelectionChanged event. + * @param source The event source. + * @param e An ASPxClientGridViewSelectionEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewSelectionEventArgs): void; +} +/** + * Provides data for the SelectionChanged event. + */ +interface ASPxClientGridViewSelectionEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the visible index of the row whose selected state has been changed. + * Value: An value that specifies the visible index of the row. + */ + visibleIndex: number; + /** + * Gets whether the row has been selected. + * Value: true if the row has been selected; otherwise, false. + */ + isSelected: boolean; + /** + * Gets whether all rows displayed within a page have been selected or unselected. + * Value: true if all rows displayed within a page have been selected or unselected; otherwise, false. + */ + isAllRecordsOnPage: boolean; + /** + * Gets whether a selection has been changed on the server. + * Value: true if a selection has been changed on the server; otherwise, false. + */ + isChangedOnServer: boolean; +} +/** + * A method that will handle the RowClick events. + */ +interface ASPxClientGridViewRowClickEventHandler { + /** + * A method that will handle the RowClick event. + * @param source The event source. This parameter identifies the ASPxClientGridView object that raised the event. + * @param e An ASPxClientGridViewRowClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewRowClickEventArgs): void; +} +/** + * Provides data for the RowClick event. + */ +interface ASPxClientGridViewRowClickEventArgs extends ASPxClientGridViewRowCancelEventArgs { + /** + * Provides access to the parameters associated with the RowClick event. + * Value: An object that contains parameters associated with the event. + */ + htmlEvent: Object; +} +/** + * A method that will handle the ContextMenu event. + */ +interface ASPxClientGridViewContextMenuEventHandler { + /** + * A method that will handle the ContextMenu event. + * @param source The event source. + * @param e An ASPxClientGridViewContextMenuEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewContextMenuEventArgs): void; +} +/** + * Provides data for the ContextMenu event. + */ +interface ASPxClientGridViewContextMenuEventArgs extends ASPxClientEventArgs { + /** + * Gets which grid element has been right clicked by the user. + * Value: A String value that specifies grid element. + */ + objectType: string; + /** + * Identifies the grid element being right clicked by the user. + * Value: A zero-based integer index that identifies the grid element being clicked by the user. + */ + index: number; + /** + * Provides access to the parameters associated with the ContextMenu event. + * Value: An object that contains parameters associated with the event. + */ + htmlEvent: Object; + /** + * Gets the currently processed menu object. + * Value: An object that is the currently processed menu. + */ + menu: Object; + /** + * Specifies whether a browser context menu should be displayed. + * Value: true, to display a browser context menu; otherwise, false. The default is false. + */ + showBrowserMenu: boolean; +} +/** + * A method that will handle the client ContextMenuItemClick event. + */ +interface ASPxClientGridViewContextMenuItemClickEventHandler { + /** + * A method that will handle the ContextMenuItemClick event. + * @param source The event source. + * @param e An ASPxClientGridViewContextMenuItemClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewContextMenuItemClickEventArgs): void; +} +/** + * Provides data for the ContextMenuItemClick event. + */ +interface ASPxClientGridViewContextMenuItemClickEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the clicked context menu item. + * Value: An object, manipulations on which forced the event to be raised. + */ + item: ASPxClientMenuItem; + /** + * Gets which grid element has been right clicked by the user. + * Value: A String value that specifies the grid element. + */ + objectType: string; + /** + * Returns the processed element index. + * Value: An integer value that specifies the processed element index. + */ + elementIndex: number; + /** + * Specifies whether a postback or a callback is used to finally process the event on the server side. + * Value: true to perform the round trip to the server side via postback; false to perform the round trip to the server side via callback. + */ + usePostBack: boolean; + /** + * Specifies whether default context menu item click is handled manually, so no default processing is required. + * Value: true if no default processing is required; otherwise false. + */ + handled: boolean; +} +/** + * A method that will handle the CustomButtonClick event. + */ +interface ASPxClientGridViewCustomButtonEventHandler { + /** + * A method that will handle the CustomButtonClick event. + * @param source The event source. This parameter identifies the ASPxClientGridView object that raised the event. + * @param e An ASPxClientGridViewCustomButtonEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewCustomButtonEventArgs): void; +} +/** + * Provides data for the CustomButtonClick event. + */ +interface ASPxClientGridViewCustomButtonEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the value which identifies the row whose custom button has been clicked. + * Value: An integer value that identifies the row whose custom button has been clicked. + */ + visibleIndex: number; + /** + * Gets the value which identifies the custom button. + * Value: A string value that identifies the clicked custom button. + */ + buttonID: string; +} +/** + * A method that will handle the ColumnMoving event. + */ +interface ASPxClientGridViewColumnMovingEventHandler { + /** + * A method that will handle the ColumnMoving event. + * @param source The event source. + * @param e An ASPxClientGridViewColumnMovingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewColumnMovingEventArgs): void; +} +/** + * Provides data for the ColumnMoving event. + */ +interface ASPxClientGridViewColumnMovingEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets whether a column is allowed to be moved. + * Value: true to allow column moving; otherwise, false. + */ + allow: boolean; + /** + * Gets the column currently being dragged by an end-user. + * Value: An ASPxClientGridViewColumn object that represents the column currently being dragged by an end-user. + */ + sourceColumn: ASPxClientGridViewColumn; + /** + * Gets the target column, before or after which the source column will be inserted (if dropped). + * Value: An ASPxClientGridViewColumn object that represents the target column. null (Nothing in Visual Basic) if the source column isn't over the column header panel. + */ + destinationColumn: ASPxClientGridViewColumn; + /** + * Gets whether the source column will be inserted before the target column (if dropped). + * Value: true if the source column will be inserted before the target column (if dropped); otherwise, false. + */ + isDropBefore: boolean; + /** + * Gets whether the source column is currently over the Group Panel. + * Value: true if the source column is currently over the Group Panel; otherwise, false. + */ + isGroupPanel: boolean; +} +/** + * Represents an object that will handle the client-side BatchEditConfirmShowing event. + */ +interface ASPxClientGridViewBatchEditConfirmShowingEventHandler { + /** + * A method that will handle the BatchEditConfirmShowing client event. + * @param source The event source. + * @param e An ASPxClientGridViewBatchEditConfirmShowingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditConfirmShowingEventArgs): void; +} +/** + * Provides data for the BatchEditConfirmShowing event. + */ +interface ASPxClientGridViewBatchEditConfirmShowingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the client identifier of an object that initiates a send request. + * Value: A string value that specifies the object client identifier. + */ + requestTriggerID: string; +} +/** + * A method that will handle the client BatchEditStartEditing event. + */ +interface ASPxClientGridViewBatchEditStartEditingEventHandler { + /** + * A method that will handle the BatchEditStartEditing event. + * @param source The event source. + * @param e An ASPxClientGridViewBatchEditStartEditingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditStartEditingEventArgs): void; +} +/** + * Provides data for the BatchEditStartEditing event. + */ +interface ASPxClientGridViewBatchEditStartEditingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the visible index of the row whose cells are about to be edited. + * Value: An value that specifies the visible index of the row. + */ + visibleIndex: number; + /** + * Gets the grid column that owns a cell that is about to be edited. + * Value: An object that is the focused grid column. + */ + focusedColumn: ASPxClientGridViewColumn; + /** + * Gets a hashtable that maintains information about editable cells. + * Value: A hashtable that stores information about editable cells. + */ + rowValues: Object; +} +/** + * A method that will handle the client BatchEditEndEditing event. + */ +interface ASPxClientGridViewBatchEditEndEditingEventHandler { + /** + * A method that will handle the BatchEditEndEditing event. + * @param source The event source. + * @param e An ASPxClientGridViewBatchEditEndEditingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditEndEditingEventArgs): void; +} +/** + * Provides data for the BatchEditEndEditing event. + */ +interface ASPxClientGridViewBatchEditEndEditingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the visible index of the row whose cells has been edited. + * Value: An value that specifies the visible index of the row. + */ + visibleIndex: number; + /** + * Gets a hashtable that maintains information about editable cells. + * Value: A hashtable that stores information about editable cells. + */ + rowValues: Object; +} +/** + * A method that will handle the client BatchEditRowValidating event. + */ +interface ASPxClientGridViewBatchEditRowValidatingEventHandler { + /** + * A method that will handle the BatchEditRowValidating event. + * @param source The event source. + * @param e An ASPxClientGridViewBatchEditRowValidatingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditRowValidatingEventArgs): void; +} +/** + * Provides data for the BatchEditRowValidating event. + */ +interface ASPxClientGridViewBatchEditRowValidatingEventArgs extends ASPxClientEventArgs { + /** + * Gets the processed row's visible index. + * Value: An integer value that specifies the processed row's visible index. + */ + visibleIndex: number; + /** + * Provides validation information of a row currently being validated. + * Value: An object that is a hashtable containing validation information. + */ + validationInfo: Object; +} +/** + * A method that will handle the client BatchEditTemplateCellFocused event. + */ +interface ASPxClientGridViewBatchEditTemplateCellFocusedEventHandler { + /** + * A method that will handle the BatchEditTemplateCellFocused event. + * @param source An object representing the event source. Identifies the button editor that raised the event. + * @param e An ASPxClientGridViewBatchEditTemplateCellFocusedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditTemplateCellFocusedEventArgs): void; +} +/** + * Provides data for the BatchEditTemplateCellFocused event. + */ +interface ASPxClientGridViewBatchEditTemplateCellFocusedEventArgs extends ASPxClientEventArgs { + /** + * Gets the currently processed column. + * Value: A object that is the client-side column object. + */ + column: ASPxClientGridViewColumn; + /** + * Gets or sets a value specifying whether the event was handled. + * Value: true if the event was handled and default processing should not occur; false if the event should be handled using default processing. + */ + handled: boolean; +} +/** + * A method that will handle the BatchEditChangesSaving event. + */ +interface ASPxClientGridViewBatchEditChangesSavingEventHandler { + /** + * A method that will handle the BatchEditChangesSaving event. + * @param source The event source. This parameter identifies the grid view object which raised the event. + * @param e An ASPxClientGridViewBatchEditChangesSavingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditChangesSavingEventArgs): void; +} +/** + * Provides data for the BatchEditChangesSaving event. + */ +interface ASPxClientGridViewBatchEditChangesSavingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets a hashtable that maintains information about inserted cells. + * Value: A hashtable that stores information about inserted cells. + */ + insertedValues: Object; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + deletedValues: Object; + /** + * Gets a hashtable that maintains information about updated cells. + * Value: A hashtable that stores information about updated cells. + */ + updatedValues: Object; +} +/** + * A method that will handle the BatchEditChangesCanceling event. + */ +interface ASPxClientGridViewBatchEditChangesCancelingEventHandler { + /** + * A method that will handle the BatchEditChangesCanceling event. + * @param source The event source. This parameter identifies the grid view object which raised the event. + * @param e An ASPxClientGridViewBatchEditChangesCancelingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditChangesCancelingEventArgs): void; +} +/** + * Provides data for the BatchEditChangesCanceling event. + */ +interface ASPxClientGridViewBatchEditChangesCancelingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets a hashtable that maintains information about inserted cells. + * Value: A hashtable that stores information about inserted cells. + */ + insertedValues: Object; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + deletedValues: Object; + /** + * Gets a hashtable that maintains information about updated cells. + * Value: A hashtable that stores information about updated cells. + */ + updatedValues: Object; +} +/** + * A method that will handle the BatchEditRowInserting event. + */ +interface ASPxClientGridViewBatchEditRowInsertingEventHandler { + /** + * A method that will handle the BatchEditRowInserting event. + * @param source The event source. This parameter identifies the card view object which raised the event. + * @param e An ASPxClientGridViewBatchEditRowInsertingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditRowInsertingEventArgs): void; +} +/** + * Provides data for the BatchEditRowInserting event. + */ +interface ASPxClientGridViewBatchEditRowInsertingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed row's visible index. + * Value: An integer value that specifies the processed row's visible index. + */ + visibleIndex: number; +} +/** + * A method that will handle the BatchEditRowDeleting event. + */ +interface ASPxClientGridViewBatchEditRowDeletingEventHandler { + /** + * A method that will handle the BatchEditRowDeleting event. + * @param source The event source. This parameter identifies the grid view object which raised the event. + * @param e An ASPxClientGridViewBatchEditRowDeletingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditRowDeletingEventArgs): void; +} +/** + * Provides data for the BatchEditRowDeleting event. + */ +interface ASPxClientGridViewBatchEditRowDeletingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed row's visible index. + * Value: An integer value that specifies the processed row's visible index. + */ + visibleIndex: number; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + rowValues: Object; +} +/** + * Contains information on a grid cell. + */ +interface ASPxClientGridViewCellInfo { + /** + * Gets the visible index of the row that contains the cell currently being processed. + * Value: An value that specifies the visible index of the row. + */ + rowVisibleIndex: number; + /** + * Gets the data column that contains the cell currently being processed. + * Value: An object that is the data column which contains the processed cell. + */ + column: ASPxClientGridViewColumn; +} +/** + * Provides members related to Batch Edit Mode + */ +interface ASPxClientGridViewBatchEditApi { + /** + * 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(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. + */ + ValidateRow(visibleIndex: number): boolean; + /** + * Returns an array of row visible indices. + * @param includeDeleted true, to include visible indices of deleted rows to the returned array; otherwise, false. + */ + GetRowVisibleIndices(includeDeleted: boolean): number[]; + /** + * Returns an array of the deleted row visible indices. + */ + GetDeletedRowIndices(): number[]; + /** + * Returns an array of the inserted row visible indices. + */ + GetInsertedRowIndices(): number[]; + /** + * Indicates if the row with specified visible index is deleted. + * @param visibleIndex An integer value that identifies the row by its visible index. + */ + IsDeletedRow(visibleIndex: number): boolean; + /** + * Indicates if the row with specified visible index is newly created. + * @param visibleIndex An integer value that identifies the row by its visible index. + */ + IsNewRow(visibleIndex: number): boolean; + /** + * Programmatically moves the focus to the previous cell in the row. + */ + MoveFocusBackward(): boolean; + /** + * Programmatically moves the focus to the next cell in the row. + */ + MoveFocusForward(): boolean; + /** + * Sets a value of the specified cell. + * @param visibleIndex An integer zero-based index that identifies the row containing the processed cell. + * @param columnFieldNameOrId A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + * @param value An object that contains the new cell value. + */ + SetCellValue(visibleIndex: number, columnFieldNameOrId: string, value: Object): void; + /** + * Sets the value of the specified cell. + * @param visibleIndex An integer zero-based index that identifies the row containing the processed cell. + * @param columnFieldNameOrId A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + * @param value An object that contains the new cell value. + * @param displayText A string value that specifies the cell display text. + * @param cancelCellHighlighting true to cancel highlighting of the modified cell, false to highlight the modified cell. + */ + SetCellValue(visibleIndex: number, columnFieldNameOrId: string, value: Object, displayText: string, cancelCellHighlighting?: boolean): void; + /** + * Gets the value of the specified cell. + * @param visibleIndex A zero-based integer value that specifies a visible index of a row containing the processed cell. + * @param columnFieldNameOrId A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + * @param initial true, to return the initial (server) value; false, to return a value currently contained on the client side (modified value). + */ + GetCellValue(visibleIndex: number, columnFieldNameOrId: string, initial?: boolean): Object; + /** + * Gets information about the cell currently being edited. + */ + GetEditCellInfo(): ASPxClientGridViewCellInfo; + /** + * Returns a value that indicates whether the grid has changed data. + */ + HasChanges(): boolean; + /** + * Returns a value that indicates whether the specified row has changed data. + * @param visibleIndex An integer value that specifies the visible index of a row. + */ + HasChanges(visibleIndex: number): boolean; + /** + * Returns a value that indicates whether the specified data cell's data has been changed. + * @param visibleIndex An integer value that specifies the visible index of a row. + * @param columnFieldNameOrId A string value that identifies the column by the name of the data source field to which the column is bound, or by the column's name. + */ + HasChanges(visibleIndex: number, columnFieldNameOrId: string): boolean; + /** + * Resets changes in the specified row. + * @param visibleIndex An integer value that specifies the visible index of a row. + */ + ResetChanges(visibleIndex: number): void; + /** + * Resets changes in the specified cell. + * @param visibleIndex An integer value that specifies the visible index of a row containing the processed cell. + * @param columnIndex A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + */ + ResetChanges(visibleIndex: number, columnIndex: number): void; + /** + * Switches the specified cell to edit mode. + * @param visibleIndex A zero-based integer value that specifies the visible index of a row containing the processed cell. + * @param columnIndex A zero-based integer value that identifies the column which contains the processed cell in the column collection. + */ + StartEdit(visibleIndex: number, columnIndex: number): void; + /** + * Ends cell or row editing. + */ + EndEdit(): void; +} +/** + * A client-side equivalent of the ASPxVerticalGrid object. + */ +interface ASPxClientVerticalGrid extends ASPxClientGridBase { + /** + * Provides access to the batch editing client API. + * Value: A object that exposes the batch editing client API methods. + */ + batchEditApi: ASPxClientVerticalGridBatchEditApi; + /** + * Occurs when a custom command button has been clicked. + */ + CustomButtonClick: ASPxClientEvent>; + /** + * Fires after the selection has been changed. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Occurs when a grid switches to batch edit mode. + */ + BatchEditStartEditing: ASPxClientEvent>; + /** + * Occurs when a grid leaves the batch edit mode. + */ + BatchEditEndEditing: ASPxClientEvent>; + /** + * Enables you to prevent a batch edit confirmation message from being displayed. + */ + BatchEditConfirmShowing: ASPxClientEvent>; + /** + * Enables you to provide navigation for editors contained in a templated cell in Batch Edit mode. + */ + BatchEditTemplateCellFocused: ASPxClientEvent>; + /** + * Occurs on the client side before data changes are saved in batch edit mode. + */ + BatchEditChangesSaving: ASPxClientEvent>; + /** + * Occurs on the client side before data changes are canceled in batch edit mode. + */ + BatchEditChangesCanceling: ASPxClientEvent>; + /** + * Occurs on the client side before a record is inserted in batch edit mode. + */ + BatchEditRecordInserting: ASPxClientEvent>; + /** + * Occurs on the client side before a record is deleted in batch edit mode. + */ + BatchEditRecordDeleting: ASPxClientEvent>; + /** + * Enables you to specify whether record data is valid and provide an error text. + */ + BatchEditRecordValidating: ASPxClientEvent>; + /** + * Enables you to prevent rows from being sorted. + */ + RowSorting: ASPxClientEvent>; + /** + * Fires on the client side before the expansion state of a row is changed by end-user interaction. + */ + RowExpandedChanging: ASPxClientEvent>; + /** + * Fires on the client side after a row's expansion state has been changed by end-user interaction. + */ + RowExpandedChanged: ASPxClientEvent>; + /** + * Fires on the client when a record is clicked. + */ + RecordClick: ASPxClientEvent>; + /** + * Fires on the client when a record is double clicked. + */ + RecordDblClick: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any unhandled server error occurs during server-side processing of a callback sent by the ASPxClientVerticalGrid. + */ + CallbackError: ASPxClientEvent>; + /** + * Sorts data by the specified data row's values. + * @param row An ASPxClientVerticalGridRow object that represents the data row. + */ + SortBy(row: ASPxClientVerticalGridRow): void; + /** + * Sorts data by the specified data row's values. + * @param rowIndex An integer value that specifies the row's position within the row collection. + */ + SortBy(rowIndex: number): void; + /** + * Sorts data by the specified data row's values. + * @param rowFieldNameOrId A string value that specifies the row's field name or unique identifier (the row's Name property value). + */ + SortBy(rowFieldNameOrId: string): void; + /** + * Sorts data by the specified data row's values. + * @param row An ASPxClientVerticalGridRow object that represents the data row. + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(row: ASPxClientVerticalGridRow, sortOrder: string): void; + /** + * Sorts data by the specified data row's values. + * @param rowIndex An integer value that specifies the row's position within the row collection. + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(rowIndex: number, sortOrder: string): void; + /** + * Sorts data by the specified data row's values. + * @param rowFieldNameOrId A string value that specifies the row's field name or unique identifier (the row's Name property value). + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(rowFieldNameOrId: string, sortOrder: string): void; + /** + * Sorts data by the specified data row's values. + * @param row An ASPxClientVerticalGridRow object that represents the data row. + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(row: ASPxClientVerticalGridRow, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data row's values. + * @param rowIndex An integer value that specifies the row's position within the row collection. + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true, to clear any previous sorting; otherwise, false. + */ + SortBy(rowIndex: number, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data row's values. + * @param rowFieldNameOrId A string value that specifies the row's field name or unique identifier (the row's Name property value). + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(rowFieldNameOrId: string, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data row's values, and places the row to the specified position among the sorted rows. + * @param row An ASPxClientGridViewColumn object that represents the data column. + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex An integer value that specifies the zero-based row's index among the sorted rows. -1 if data is not sorted by this row. + */ + SortBy(row: ASPxClientVerticalGridRow, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Sorts data by the specified data row's values, and places the row to the specified position among the sorted rows. + * @param rowIndex An integer value that specifies the row's position within the row collection. + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex + */ + SortBy(rowIndex: number, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Sorts data by the specified data row's values, and places the row to the specified position among the sorted rows. + * @param rowFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex An integer value that specifies the zero-based row's index among the sorted rows. -1 if data is not sorted by this row. + */ + SortBy(rowFieldNameOrId: string, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Returns the key value of the specified data row (record in the vertical grid). + * @param visibleIndex An integer value that specifies the record's visible index. + */ + GetRecordKey(visibleIndex: number): string; + /** + * Adds a new record. + */ + AddNewRecord(): void; + /** + * Deletes the specified record. + * @param visibleIndex An integer value that identifies the record. + */ + DeleteRecord(visibleIndex: number): void; + /** + * Deletes a record with the specified key value. + * @param key An object that uniquely identifies the record. + */ + DeleteRecordByKey(key: Object): void; + /** + * Selects all the unselected records within the grid. + */ + SelectRecords(): void; + /** + * Selects the specified record displayed within the grid. + * @param visibleIndex A zero-based integer value that specifies the record's visible index. + */ + SelectRecords(visibleIndex: number): void; + /** + * Selects the specified rercords within the grid. + * @param visibleIndices An array of zero-based indices that identify records within the grid. + */ + SelectRecords(visibleIndices: number[]): void; + /** + * Selects or deselects the specified records within the grid. + * @param visibleIndices An array of zero-based indices that identify records within the grid. + * @param selected true to select the specified records; false to deselect the records. + */ + SelectRecords(visibleIndices: number[], selected: boolean): void; + /** + * Selects or deselects the specified record within the grid. + * @param visibleIndex An integer zero-based index that identifies the record within the grid. + * @param selected true to select the specified record; false to deselect the record. + */ + SelectRecords(visibleIndex: number, selected?: boolean): void; + /** + * Selects or deselects the specified records displayed within the grid. + * @param keys An array of objects that uniquely identify the records. + * @param selected true to select the specified records; false to deselect the records. + */ + SelectRecordsByKey(keys: Object[], selected?: boolean): void; + /** + * Selects or deselects the specified record displayed within the grid. + * @param key An object that uniquely identifies the record. + * @param selected true to select the specified record; false to deselect the record. + */ + SelectRecordsByKey(key: Object, selected?: boolean): void; + /** + * Selects the specified records displayed within the grid. + * @param keys An array of objects that uniquely identify the records. + */ + SelectRecordsByKey(keys: Object[]): void; + /** + * Selects a grid record by its key. + * @param key An object that uniquely identifies the record. + */ + SelectRecordsByKey(key: Object): void; + /** + * Deselects all the selected records within the grid. + */ + UnselectRecords(): void; + /** + * Deselects the specified records (if selected) within the grid. + * @param visibleIndices An array of zero-based indices that identify records within the grid. + */ + UnselectRecords(visibleIndices: number[]): void; + /** + * Deselects the specified record (if selected) within the grid. + * @param visibleIndex A zero-based integer value that specifies the record's visible index. + */ + UnselectRecords(visibleIndex: number): void; + /** + * Deselects the specified records displayed within the grid. + * @param keys An array of objects that uniquely identify the records. + */ + UnselectRecordsByKey(keys: Object[]): void; + /** + * Deselects the specified record displayed within the grid. + * @param key An object that uniquely identifies the record. + */ + UnselectRecordsByKey(key: Object): void; + /** + * Deselects all grid records that match the filter criteria currently applied to the grid. + */ + UnselectFilteredRecords(): void; + /** + * Selects the specified record displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the record's visible index. + */ + SelectRecordOnPage(visibleIndex: number): void; + /** + * Selects or deselects the specified record displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the record's visible index. + * @param selected true to select the specified record; false to deselect the record. + */ + SelectRecordOnPage(visibleIndex: number, selected?: boolean): void; + /** + * Deselects the specified record (if selected) displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the record's visible index. + */ + UnselectRecordOnPage(visibleIndex: number): void; + /** + * Selects all unselected records displayed on the current page. + */ + SelectAllRecordsOnPage(): void; + /** + * Allows you to select or deselect all records displayed on the current page based on the parameter passed. + * @param selected true to select all unselected records displayed on the current page; false to deselect all selected records on the page. + */ + SelectAllRecordsOnPage(selected: boolean): void; + /** + * Deselects all selected records displayed on the current page. + */ + UnselectAllRecordsOnPage(): void; + /** + * Returns the number of selected records. + */ + GetSelectedRecordCount(): number; + /** + * Indicates whether or not the specified record is selected within the current page. + * @param visibleIndex An integer value that identifies the record by its visible index. + */ + IsRecordSelectedOnPage(visibleIndex: number): boolean; + /** + * Returns the values of the specified data source fields within the specified record. + * @param visibleIndex An integer value that identifies the record. + * @param fieldNames The names of data source fields separated using a semicolon, whose values within the specified record are returned. + * @param onCallback An ASPxClientVerticalGridValuesCallback object that represents the JavaScript function which receives the list of record values as a parameter. + */ + GetRecordValues(visibleIndex: number, fieldNames: string, onCallback: ASPxClientVerticalGridValuesCallback): void; + /** + * Returns the record values displayed within the current page. + * @param fieldNames The names of data source fields whose values are returned. + * @param onCallback A ASPxClientVerticalGridValuesCallback object that represents the JavaScript function which receives the list of record values as a parameter. + */ + GetPageRecordValues(fieldNames: string, onCallback: ASPxClientVerticalGridValuesCallback): void; + /** + * Returns the number of records actually displayed within the active page. + */ + GetVisibleRecordsOnPage(): number; + /** + * Returns the number of rows within the client vertical grid. + */ + GetRowCount(): number; + /** + * Applies the specified search panel filter criterion to grid data. + * @param value A string value that specifies the filter criterion. + */ + ApplySearchPanelFilter(value: string): void; + /** + * Applies the specified filter expression to the ASPxVerticalGrid. + * @param filterExpression A string value that specifies the filter expression. + */ + ApplyFilter(filterExpression: string): void; + /** + * Clears the filter expression applied to a client vertical grid. + */ + ClearFilter(): void; + /** + * Sets input focus to the grid. + */ + Focus(): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Selects the specified page. + * @param pageIndex An integer value that specifies the active page's index. + */ + GotoPage(pageIndex: number): void; + /** + * Gets the index of the page currently being selected. + */ + GetPageIndex(): number; + /** + * Gets the number of pages to which the grid's data is divided. + */ + GetPageCount(): number; + /** + * Activates the next page. + */ + NextPage(): void; + /** + * Activates the previous page. + */ + PrevPage(): void; + /** + * Returns the index of the first record displayed within the vertical grid's active page. + */ + GetTopVisibleIndex(): number; + /** + * Saves all the changes made and switches the grid to browse mode. + */ + UpdateEdit(): void; + /** + * Cancels all the changes made and switches the ASPxVerticalGrid to browse mode. + */ + CancelEdit(): void; + /** + * Updates data displayed within the grid. + */ + Refresh(): void; + /** + * Returns the record values displayed within all selected records. + * @param fieldNames The names of data source fields separated by a semicolon, whose values within the selected records are returned. + * @param onCallback A ASPxClientVerticalGridValuesCallback object that represents the JavaScript function which receives the list of record values as a parameter. + */ + GetSelectedFieldValues(fieldNames: string, onCallback: ASPxClientVerticalGridValuesCallback): void; + /** + * Returns key values of selected records displayed within the current page. + */ + GetSelectedKeysOnPage(): Object[]; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event. + * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback A ASPxClientVerticalGridValuesCallback object that is the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(args: string, onCallback: ASPxClientVerticalGridValuesCallback): void; + /** + * Returns the editor used to edit the specified row's values. + * @param row An ASPxClientVerticalGridRowobject that specifies the required row within the client grid. + */ + GetEditor(row: ASPxClientVerticalGridRow): ASPxClientEdit; + /** + * Returns the editor used to edit the specified row's values. + * @param rowIndex An integer value that specifies the row's position within the rows collection. + */ + GetEditor(rowIndex: number): ASPxClientEdit; + /** + * Returns the editor used to edit the specified row's values. + * @param rowFieldNameOrId A string value that specifies the row's field name or unique identifier (the row's Name property value). + */ + GetEditor(rowFieldNameOrId: string): ASPxClientEdit; + /** + * Displays the Filter Control. + */ + ShowFilterControl(): void; + /** + * Hides the Filter Control. + */ + CloseFilterControl(): void; + /** + * Enables or disables the current filter. + * @param isFilterEnabled true to enable the current filter; otherwise, false. + */ + SetFilterEnabled(isFilterEnabled: boolean): void; + /** + * Returns the client row that resides at the specified position within the row collection. + * @param rowIndex A zero-based index that identifies the row within the row collection (the row's Index property value). + */ + GetRow(rowIndex: number): ASPxClientVerticalGridRow; + /** + * Returns the row with the specified unique identifier. + * @param rowId A string value that specifies the row's unique identifier (the row's Name property value). + */ + GetRowById(rowId: string): ASPxClientVerticalGridRow; + /** + * Returns the client row which is bound to the specified data source field. + * @param rowFieldName A string value that specifies the name of the data source field to which the row is bound (the row's fieldName property value). + */ + GetRowByField(rowFieldName: string): ASPxClientVerticalGridRow; + /** + * Returns the current vertical scroll position of the grid's content. + */ + GetVerticalScrollPosition(): number; + /** + * Returns the current horizontal scroll position of the grid's content. + */ + GetHorizontalScrollPosition(): number; + /** + * Specifies the vertical scroll position for the grid's content. + * @param position An integer value specifying the vertical scroll position. + */ + SetVerticalScrollPosition(position: number): void; + /** + * Specifies the horizontal scroll position for the grid's content. + * @param position An integer value specifying the horizontal scroll position. + */ + SetHorizontalScrollPosition(position: number): void; + /** + * Gets the value that specifies whether the required row is expanded. + * @param row An ASPxClientVerticalGridRowobject that specifies the row. + */ + GetRowExpanded(row: ASPxClientVerticalGridRow): boolean; + /** + * Gets the value that specifies whether the row with the specified index is expanded. + * @param rowIndex An integer value specifying the row's index. + */ + GetRowExpanded(rowIndex: number): boolean; + /** + * Gets the value that specifies whether the row with the specified field name or ID is expanded. + * @param rowFieldNameOrId A string value specifying the row's field name or ID. + */ + GetRowExpanded(rowFieldNameOrId: string): boolean; + /** + * Sets a value indicating whether the row is expanded. + * @param row An ASPxClientVerticalGridRowobject that specifies the required row within the client grid. + * @param value true, to expand the row; otherwise, false. + */ + SetRowExpanded(row: ASPxClientVerticalGridRow, value: boolean): void; + /** + * Sets a value indicating whether the row is expanded. + * @param rowIndex An integer value specifying the index of the row. + * @param value true, to expand the row; otherwise, false. + */ + SetRowExpanded(rowIndex: number, value: boolean): void; + /** + * Sets a value indicating whether the row is expanded. + * @param rowFieldNameOrId A string value that specifies the row's field name or unique identifier (the row's Name property value). + * @param value true, to expand the row; otherwise, false. + */ + SetRowExpanded(rowFieldNameOrId: string, value: boolean): void; +} +/** + * A client grid row. + */ +interface ASPxClientVerticalGridRow extends ASPxClientGridColumnBase { + /** + * Gets the name that uniquely identifies the row. + * Value: A string value assigned to the row's Name property. + */ + name: string; + /** + * Gets the row's position within the collection. + * Value: An integer zero-bazed index that specifies the row's position within the collection. + */ + index: number; + /** + * Gets the name of the database field assigned to the current row. + * Value: A string value that specifies the name of a data field. + */ + fieldName: string; + /** + * Gets whether the row is visible. + * Value: true, to display the row; otherwise, false. + */ + visible: boolean; +} +/** + * Represents a JavaScript function which receives the list of record values when the client GetSelectedFieldValues method is called. + */ +interface ASPxClientVerticalGridValuesCallback { + /** + * Represents a JavaScript function which receives the list of record values when the client GetSelectedFieldValues method is called. + * @param result An object that represents the list of record values received from the server. + */ + (result: Object): void; +} +/** + * A method that will handle the CustomButtonClick event. + */ +interface ASPxClientVerticalGridRowCancelEventHandler { + /** + * A method that will handle the cancelable events of a client ASPxVerticalGrid row. + * @param source The event source. + * @param e An ASPxClientVerticalGridRowCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridRowCancelEventArgs): void; +} +/** + * Provides data for the cancelable events of a client ASPxVerticalGrid row. + */ +interface ASPxClientVerticalGridRowCancelEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed client row. + * Value: An ASPxClientVerticalGridRow object that represents the processed row. + */ + row: ASPxClientVerticalGridRow; +} +/** + * A method that will handle the RecordClick event. + */ +interface ASPxClientVerticalGridRecordClickEventHandler { + /** + * A method that will handle the RecordClick event. + * @param source The event source. This parameter identifies the ASPxClientVerticalGrid object that raised the event. + * @param e An ASPxClientVerticalGridRecordClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridRecordClickEventArgs): void; +} +/** + * Provides data for the RecordClick event. + */ +interface ASPxClientVerticalGridRecordClickEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed record's visible index. + * Value: An integer zero-based index that identifies the processed record. + */ + visibleIndex: number; + /** + * Provides access to the parameters associated with the RecordClick event. + * Value: An object that contains parameters associated with the event. + */ + htmlEvent: Object; +} +/** + * A method that will handle the CustomButtonClick event. + */ +interface ASPxClientVerticalGridCustomButtonEventHandler { + /** + * A method that will handle the CustomButtonClick event. + * @param source The event source. This parameter identifies the ASPxClientVerticalGrid object that raised the event. + * @param e An ASPxClientVerticalGridCustomButtonEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridCustomButtonEventArgs): void; +} +/** + * Provides data for the CustomButtonClick event. + */ +interface ASPxClientVerticalGridCustomButtonEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the value which identifies the record whose custom button has been clicked. + * Value: An integer value that identifies the record whose custom button has been clicked. + */ + visibleIndex: number; + /** + * Gets the value which identifies the custom button. + * Value: A string value that identifies the clicked custom button. + */ + buttonID: string; +} +/** + * A method that will handle the SelectionChanged event. + */ +interface ASPxClientVerticalGridSelectionEventHandler { + /** + * A method that will handle the SelectionChanged event. + * @param source The event source. + * @param e An ASPxClientVerticalGridSelectionEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridSelectionEventArgs): void; +} +/** + * Provides data for the SelectionChanged event. + */ +interface ASPxClientVerticalGridSelectionEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the visible index of the record whose selected state has been changed. + * Value: An value that specifies the visible index of the record. + */ + visibleIndex: number; + /** + * Gets whether the record has been selected. + * Value: true, if the record has been selected; otherwise, false. + */ + isSelected: boolean; + /** + * Gets whether all records displayed within a page have been selected or unselected. + * Value: true if all records displayed within a page have been selected or unselected; otherwise, false. + */ + isAllRecordsOnPage: boolean; + /** + * Gets whether a selection has been changed on the server. + * Value: true if a selection has been changed on the server; otherwise, false. + */ + isChangedOnServer: boolean; +} +/** + * A method that will handle the RowExpandedChanged event. + */ +interface ASPxClientVerticalGridRowExpandedEventHandler { + /** + * A method that will handle the RowExpandedChanged event. + * @param source The event source. + * @param e An ASPxClientVerticalGridRowExpandedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridRowExpandedEventArgs): void; +} +/** + * Provides data for the RowExpandedChanged event. + */ +interface ASPxClientVerticalGridRowExpandedEventArgs extends ASPxClientEventArgs { + /** + * Gets the expanded row. + * Value: An ASPxClientVerticalGridRow object that represents the expanded row. + */ + row: ASPxClientVerticalGridRow; +} +/** + * A method that will handle the RowExpandedChanging event. + */ +interface ASPxClientVerticalGridRowExpandingEventHandler { + /** + * A method that will handle the RowExpandedChanging event. + * @param source The event source. + * @param e An ASPxClientVerticalGridRowExpandedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridRowExpandingEventArgs): void; +} +/** + * Provides data for the RowExpandedChanging event. + */ +interface ASPxClientVerticalGridRowExpandingEventArgs extends ASPxClientVerticalGridRowExpandedEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true, if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * Represents an object that will handle the client-side BatchEditStartEditing event. + */ +interface ASPxClientVerticalGridBatchEditStartEditingEventHandler { + /** + * A method that will handle the BatchEditStartEditing event. + * @param source The event source. + * @param e An ASPxClientVerticalGridBatchEditStartEditingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditStartEditingEventArgs): void; +} +/** + * Provides data for the BatchEditStartEditing event. + */ +interface ASPxClientVerticalGridBatchEditStartEditingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the visible index of the record whose cells are about to be edited. + * Value: An value that specifies the visible index of the record. + */ + visibleIndex: number; + /** + * Gets the grid row that owns a cell that is about to be edited. + * Value: An object that is the focused grid row. + */ + focusedRow: ASPxClientVerticalGridRow; + /** + * Gets a hashtable that maintains information about editable cells. + * Value: A hashtable that stores information about editable cells. + */ + recordValues: Object; +} +/** + * Represents an object that will handle the client-side BatchEditEndEditing event. + */ +interface ASPxClientVerticalGridBatchEditEndEditingEventHandler { + /** + * A method that will handle the BatchEditEndEditing event. + * @param source The event source. + * @param e An ASPxClientVerticalGridBatchEditEndEditingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditEndEditingEventArgs): void; +} +/** + * Provides data for the BatchEditEndEditing event. + */ +interface ASPxClientVerticalGridBatchEditEndEditingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the visible index of the record whose cells have been edited. + * Value: An value that specifies the visible index of the record. + */ + visibleIndex: number; + /** + * Gets a hashtable that maintains information about editable cells. + * Value: Gets a hashtable that maintains information about editable cells. + */ + recordValues: Object; +} +/** + * Represents an object that will handle the client-side BatchEditRecordValidating event. + */ +interface ASPxClientVerticalGridBatchEditRecordValidatingEventHandler { + /** + * A method that will handle the BatchEditRecordValidating event. + * @param source The event source. + * @param e An ASPxClientVerticalGridBatchEditRecordValidatingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditRecordValidatingEventArgs): void; +} +/** + * Provides data for the BatchEditRecordValidating event. + */ +interface ASPxClientVerticalGridBatchEditRecordValidatingEventArgs extends ASPxClientEventArgs { + /** + * Gets the processed record's visible index. + * Value: An integer value that specifies the processed record's visible index. + */ + visibleIndex: number; + /** + * Provides validation information on the record currently being validated. + * Value: An object that is a hashtable containing validation information. + */ + validationInfo: Object; +} +/** + * Represents an object that will handle the client-side BatchEditConfirmShowing event. + */ +interface ASPxClientVerticalGridBatchEditConfirmShowingEventHandler { + /** + * A method that will handle the BatchEditConfirmShowing client event. + * @param source The event source. + * @param e An ASPxClientVerticalGridBatchEditConfirmShowingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditConfirmShowingEventArgs): void; +} +/** + * Provides data for the BatchEditConfirmShowing event. + */ +interface ASPxClientVerticalGridBatchEditConfirmShowingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the client identifier of an object that initiates a send request. + * Value: A string value that specifies the object client identifier. + */ + requestTriggerID: string; +} +/** + * Represents an object that will handle the client-side BatchEditTemplateCellFocused event. + */ +interface ASPxClientVerticalGridBatchEditTemplateCellFocusedEventHandler { + /** + * A method that will handle the BatchEditTemplateCellFocused event. + * @param source An object representing the event source. Identifies the button editor that raised the event. + * @param e An ASPxClientVerticalGridBatchEditTemplateCellFocusedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditTemplateCellFocusedEventArgs): void; +} +/** + * Provides data for the BatchEditTemplateCellFocused event. + */ +interface ASPxClientVerticalGridBatchEditTemplateCellFocusedEventArgs extends ASPxClientEventArgs { + /** + * Gets the currently processed row. + * Value: A object that is the client-side row object. + */ + row: ASPxClientVerticalGridRow; + /** + * Gets or sets a value specifying whether the event was handled. + * Value: true if the event was handled and default processing should not occur; false if the event should be handled using default processing. + */ + handled: boolean; +} +/** + * Represents an object that will handle the client-side BatchEditChangesSaving event. + */ +interface ASPxClientVerticalGridBatchEditChangesSavingEventHandler { + /** + * A method that will handle the BatchEditChangesSaving event. + * @param source The event source. This parameter identifies the vertical grid object which raised the event. + * @param e An ASPxClientVerticalGridBatchEditChangesSavingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditChangesSavingEventArgs): void; +} +/** + * Provides data for the BatchEditChangesSaving event. + */ +interface ASPxClientVerticalGridBatchEditChangesSavingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets a hashtable that maintains information about inserted cells. + * Value: A hashtable that stores information about inserted cells. + */ + insertedValues: Object; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + deletedValues: Object; + /** + * Gets a hashtable that maintains information about updated cells. + * Value: A hashtable that stores information about updated cells. + */ + updatedValues: Object; +} +/** + * Represents an object that will handle the client-side BatchEditChangesCanceling event. + */ +interface ASPxClientVerticalGridBatchEditChangesCancelingEventHandler { + /** + * A method that will handle the BatchEditChangesCanceling event. + * @param source The event source. This parameter identifies the vertical grid object which raised the event. + * @param e An ASPxClientVerticalGridBatchEditChangesCancelingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditChangesCancelingEventArgs): void; +} +/** + * Provides data for the BatchEditChangesCanceling event. + */ +interface ASPxClientVerticalGridBatchEditChangesCancelingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets a hashtable that maintains information about inserted cells. + * Value: A hashtable that stores information about inserted cells. + */ + insertedValues: Object; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + deletedValues: Object; + /** + * Gets a hashtable that maintains information about updated cells. + * Value: A hashtable that stores information about updated cells. + */ + updatedValues: Object; +} +/** + * Represents an object that will handle the client-side BatchEditRecordInserting event. + */ +interface ASPxClientVerticalGridBatchEditRecordInsertingEventHandler { + /** + * A method that will handle the BatchEditRecordInserting event. + * @param source The event source. This parameter identifies the vertical grid object which raised the event. + * @param e An ASPxClientVerticalGridBatchEditRecordInsertingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditRecordInsertingEventArgs): void; +} +/** + * Provides data for the BatchEditRecordInserting event. + */ +interface ASPxClientVerticalGridBatchEditRecordInsertingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed record's visible index. + * Value: An integer value that specifies the processed record's visible index. + */ + visibleIndex: number; +} +/** + * Represents an object that will handle the client-side BatchEditRecordDeleting event. + */ +interface ASPxClientVerticalGridBatchEditRecordDeletingEventHandler { + /** + * A method that will handle the BatchEditRecordDeleting event. + * @param source The event source. This parameter identifies the vertical grid object which raised the event. + * @param e An ASPxClientVerticalGridBatchEditRecordDeletingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditRecordDeletingEventArgs): void; +} +/** + * Provides data for the BatchEditRecordDeleting event. + */ +interface ASPxClientVerticalGridBatchEditRecordDeletingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed record's visible index. + * Value: An integer value that specifies the processed record's visible index. + */ + visibleIndex: number; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + recordValues: Object; +} +/** + * Contains information on a cell that is being edited. + */ +interface ASPxClientVerticalGridCellInfo { + /** + * Gets the row that contains the cell currently being processed. + * Value: An object that is the row which contains the processed cell. + */ + row: ASPxClientVerticalGridRow; + /** + * Gets the visible index of the record that contains the cell currently being processed. + * Value: An value that specifies the visible index of the record. + */ + recordVisibleIndex: number; +} +/** + * Provides members related to Batch Edit Mode + */ +interface ASPxClientVerticalGridBatchEditApi { + /** + * 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(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. + */ + ValidateRecord(visibleIndex: number): boolean; + /** + * Returns an array of record visible indices. + * @param includeDeleted true, to include visible indices of deleted records to the returned array; otherwise, false. + */ + GetRecordVisibleIndices(includeDeleted: boolean): number[]; + /** + * Returns an array of the deleted record visible indices. + */ + GetDeletedRecordIndices(): number[]; + /** + * Returns an array of the inserted record visible indices. + */ + GetInsertedRecordIndices(): number[]; + /** + * Indicates if the record with the specified visible index is deleted. + * @param visibleIndex An integer value that identifies the record by its visible index. + */ + IsDeletedRecord(visibleIndex: number): boolean; + /** + * Indicates if the record with specified visible index is newly created. + * @param visibleIndex An integer value that identifies the record by its visible index. + */ + IsNewRecord(visibleIndex: number): boolean; + /** + * Programmatically moves the focus to the previous cell in the record. + */ + MoveFocusBackward(): boolean; + /** + * Programmatically moves the focus to the next cell in the record. + */ + MoveFocusForward(): boolean; + /** + * Sets a value of the specified cell. + * @param visibleIndex An integer zero-based index that identifies the record containing the processed cell. + * @param rowFieldNameOrId A string value that specifies the field name or unique identifier (the row's Name property value) of a row containing the processed cell. + * @param value An object that contains the new cell value. + */ + SetCellValue(visibleIndex: number, rowFieldNameOrId: string, value: Object): void; + /** + * Sets the value of the specified cell. + * @param visibleIndex An integer zero-based index that identifies the row containing the processed cell. + * @param rowFieldNameOrId A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + * @param value An object that contains the new cell value. + * @param displayText A string value that specifies the cell display text. + * @param cancelCellHighlighting true to cancel highlighting of the modified cell, false to highlight the modified cell. + */ + SetCellValue(visibleIndex: number, rowFieldNameOrId: string, value: Object, displayText: string, cancelCellHighlighting?: boolean): void; + /** + * Gets the value of the specified cell. + * @param visibleIndex A zero-based integer value that specifies a visible index of a record containing the processed cell. + * @param rowFieldNameOrId A string value that specifies the field name or unique identifier (the row's Name property value) of a row containing the processed cell. + * @param initial true, to return the initial (server) value; false, to return a value currently contained on the client side (modified value). + */ + GetCellValue(visibleIndex: number, rowFieldNameOrId: string, initial?: boolean): Object; + /** + * Gets information about the cell currently being edited. + */ + GetEditCellInfo(): ASPxClientVerticalGridCellInfo; + /** + * Returns a value that indicates whether the vertical grid has changed data. + */ + HasChanges(): boolean; + /** + * Returns a value that indicates whether the specified record has changed data. + * @param visibleIndex An integer value that specifies the visible index of a record. + */ + HasChanges(visibleIndex: number): boolean; + /** + * Returns a value that indicates whether the specified data cell's data has been changed. + * @param visibleIndex An integer value that specifies the visible index of a record. + * @param rowFieldNameOrId A string value that identifies the row by the name of the data source field to which the row is bound, or by the row's name. + */ + HasChanges(visibleIndex: number, rowFieldNameOrId: string): boolean; + /** + * Resets changes in the specified record. + * @param visibleIndex An integer value that specifies the visible index of a record. + */ + ResetChanges(visibleIndex: number): void; + /** + * Resets changes in the specified cell. + * @param visibleIndex An integer value that specifies the visible index of a record containing the processed cell. + * @param rowIndex A string value that specifies the field name or unique identifier (the row's Name property value) of a row containing the processed cell. + */ + ResetChanges(visibleIndex: number, rowIndex: number): void; + /** + * Switches the specified cell to batch edit mode. + * @param visibleIndex A zero-based integer value that specifies the visible index of a record containing the processed cell. + * @param rowIndex A zero-based integer value that identifies the row which contains the processed cell in the rows collection. + */ + StartEdit(visibleIndex: number, rowIndex: number): void; + /** + * Ends the cell(s) editing. + */ + EndEdit(): void; +} +/** + * Contains style settings related to media elements in ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorCommandStyleSettings { + /** + * Gets or sets a media element's CSS class name. + * Value: A string that specifies a class name. + */ + className: string; + /** + * Gets or sets an element's width. + * Value: A string that specifies an element's width in any correct format. + */ + width: string; + /** + * Gets or sets an element's height. + * Value: A string that specifies an element's height in any correct format. + */ + height: string; + /** + * Gets or sets a media element's border width. + * Value: A string that specifies a border width in any correct format. + */ + borderWidth: string; + /** + * Gets or sets a media element's border color. + * Value: A string that specifies a border color in any correct format. + */ + borderColor: string; + /** + * Gets or sets a media element's border style. + * Value: A string that specifies a border style in any correct format. + */ + borderStyle: string; + /** + * Gets or sets an element's top margin. + * Value: A string that specifies an element's top margin in any correct format. + */ + marginTop: string; + /** + * Gets or sets an element's right margin. + * Value: A string that specifies an element's right margin in any correct format. + */ + marginRight: string; + /** + * Gets or sets an element's bottom margin. + * Value: A string that specifies an element's bottom margin in any correct format. + */ + marginBottom: string; + /** + * Gets or sets an element's left margin. + * Value: A string that specifies an element's left margin in any correct format. + */ + marginLeft: string; +} +/** + * The base class for parameters used in the ASPxHtmlEditor's client-side commands. + */ +interface ASPxClientHtmlEditorCommandArguments { + /** + * Gets the currently selected element in the ASPxHtmlEditor. + * Value: An HTML object which is the currently selected element. + */ + selectedElement: Object; +} +/** + * Contains settings related to the INSERTIMAGE_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorInsertImageCommandArguments extends ASPxClientHtmlEditorCommandArguments { + /** + * Specifies the source of the target image. + * Value: A string specifying the source of the target image. + */ + src: string; + /** + * Creates an alternate text for the target image. + * Value: A string that specifies an alternate text for the target image. + */ + alt: string; + /** + * Determines if the target image is wrapped with text. + * Value: true, if the target image is wrapped with text; otherwise, false. + */ + useFloat: boolean; + /** + * Determines the position of the target image. + * Value: A string value defining the position of the target image. + */ + align: string; + /** + * Contains the style settings specifying the appearance of the target image. + * Value: An object that contains the style settings specifying the appearance of the target image. + */ + styleSettings: ASPxClientHtmlEditorCommandStyleSettings; +} +/** + * Contains settings related to the CHANGEIMAGE_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorChangeImageCommandArguments extends ASPxClientHtmlEditorInsertImageCommandArguments { +} +/** + * Contains settings related to the INSERTLINK_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorInsertLinkCommandArguments extends ASPxClientHtmlEditorCommandArguments { + /** + * Specifies the url of the page the target link goes to. + * Value: A string value specifying the target link url. + */ + url: string; + /** + * Specifiies the text of the target link. + * Value: A string value specifying the text of the target link. + */ + text: string; + /** + * Determines where to open the target link. + * Value: A string that specifies where to open the target link in any correct format. + */ + target: string; + /** + * Defines the title of the target link. + * Value: A string value defining the title of the target link. + */ + title: string; +} +/** + * The base class for parameters related to inserting or changing media elements in the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorChangeMediaElementCommandArguments extends ASPxClientHtmlEditorCommandArguments { + /** + * Defines the HTML "id" attribute of the target media element. + * Value: A string value which is a unique identifier for the element. + */ + id: string; + /** + * Defines the source of the target media element. + * Value: A string defining the source of the target media element. + */ + src: string; + /** + * Determines the position of the target media element. + * Value: A string value indicating the position of the target media element. + */ + align: string; + /** + * Contains the style settings defining the appearance of the target media element. + * Value: An object that contains the style settings defining the appearance of the target media element. + */ + styleSettings: ASPxClientHtmlEditorCommandStyleSettings; + /** + * Returns the name of the client-side command corresponding to the parameter. + */ + GetCommandName(): string; +} +/** + * The base class for parameters related to inserting or changing HTML5 media elements (Audio and Video) in the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorChangeHtml5MediaElementCommandArguments extends ASPxClientHtmlEditorChangeMediaElementCommandArguments { + /** + * Determines if a media file will start playing automatically. + * Value: true, if autoplay is enabled; otherwise, false. + */ + autoPlay: boolean; + /** + * Determines if a media file repeats indefinitely, or stops when it reaches the last frame. + * Value: true, to loop playback; otherwise, false. + */ + loop: boolean; + /** + * Determines if the media player controls should be displayed. + * Value: true, if media player controls are displayed; otherwise, false. + */ + showPlayerControls: boolean; + /** + * Determines how a media file should be loaded when the page loads. + * Value: One of the ASPxClientHtmlEditorMediaPreloadMode enumeration values. + */ + preloadMode: string; +} +/** + * Contains settings related to the INSERTAUDIO_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorInsertAudioCommandArguments extends ASPxClientHtmlEditorChangeHtml5MediaElementCommandArguments { +} +/** + * Contains settings related to the CHANGEAUDIO_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorChangeAudioCommandArguments extends ASPxClientHtmlEditorInsertAudioCommandArguments { +} +/** + * Contains settings related to the INSERTVIDEO_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorInsertVideoCommandArguments extends ASPxClientHtmlEditorChangeHtml5MediaElementCommandArguments { + /** + * Defines the URL of an image that is shown while the video file is downloading, or until an end-user clicks the play button. + * Value: A string value that specifies the poster image URL. + */ + posterUrl: string; +} +/** + * Contains settings related to the CHANGEVIDEO_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorChangeVideoCommandArguments extends ASPxClientHtmlEditorInsertVideoCommandArguments { +} +/** + * Contains settings related to the INSERTFLASH_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorInsertFlashCommandArguments extends ASPxClientHtmlEditorChangeMediaElementCommandArguments { + /** + * Determines if the target flash element will start playing automatically. + * Value: true, if autoplay is enabled; otherwise, false. + */ + autoPlay: boolean; + /** + * Defines if the target flash element repeats indefinitely, or stops when it reaches the last frame. + * Value: true, to loop playback; otherwise, false. + */ + loop: boolean; + /** + * Determines if the flash related items are displayed in the context menu of the target flash element. + * Value: true, if the specific context menu items are displayed; otherwise, false + */ + enableFlashMenu: boolean; + /** + * Determines if the target flash element can be displayed in the fullscreen mode. + * Value: true, if the fullscreen mode is allowed; otherwise, false. + */ + allowFullscreen: boolean; + /** + * Defines the rendering quality level used for the target flash element. + * Value: A string value that specifies the target flash element rendering quality. + */ + quality: string; +} +/** + * Contains settings related to the CHANGEFLASH_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorChangeFlashCommandArguments extends ASPxClientHtmlEditorInsertFlashCommandArguments { +} +/** + * Contains settings related to the INSERTYOUTUBEVIDEO_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorInsertYouTubeVideoCommandArguments extends ASPxClientHtmlEditorChangeMediaElementCommandArguments { + /** + * Determines if suggested videos are shown after the target YouTube video finishes. + * Value: true, to show suggested videos; otherwise, false + */ + showRelatedVideos: boolean; + /** + * Determines if the target YouTube video title and player actions (Watch later, Share) are shown. + * Value: true, to display the title and player actions; otherwise, false. + */ + showVideoInfo: boolean; + /** + * Determines if the privacy-enhanced mode is enabled for the target YouTube video. + * Value: true, if the privace-enhanced mode is enabled; otherwise, false + */ + enablePrivacyEnhancedMode: boolean; + /** + * Determines if the player controls are displayed for the target YouTube video. + * Value: true, if the player controls are displayed; otherwise, false. + */ + showPlayerControls: boolean; +} +/** + * Contains settings related to the CHANGEYOUTUBEVIDEO_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorChangeYouTubeVideoCommandArguments extends ASPxClientHtmlEditorInsertYouTubeVideoCommandArguments { +} +/** + * A method that will handle the DialogInitialized client event. + */ +interface ASPxClientHtmlEditorDialogInitializedEventHandler { + /** + * A method that will handle the client DialogInitialized event. + * @param source An object representing the event's source. + * @param e An ASPxClientHtmlEditorDialogInitializedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorDialogInitializedEventArgs): void; +} +/** + * Provides data for the DialogInitialized client event. + */ +interface ASPxClientHtmlEditorDialogInitializedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the dialog that has been initialized. + * Value: A string value that is the name of the initialized dialog. + */ + dialogName: string; +} +/** + * A method that will handle the CommandExecuting event. + */ +interface ASPxClientHtmlEditorCommandExecutingEventHandler { + /** + * A method that will handle the client CommandExecuted event. + * @param source The event's source. + * @param e An ASPxClientHtmlEditorCommandExecutingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorCommandExecutingEventArgs): void; +} +/** + * Provides data for the CommandExecuting event. + */ +interface ASPxClientHtmlEditorCommandExecutingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value specifying the processed command's name. + */ + commandName: string; + /** + * Gets an optional parameter that complements the processed command. + * Value: An object containing additional information about the processed command. + */ + parameter: Object; +} +/** + * A method that will handle the client events related to command processing. + */ +interface ASPxClientHtmlEditorCommandEventHandler { + /** + * A method that will handle the corresponding client event. + * @param source The event source. This parameter identifies the editor which raised the event. + * @param e An ASPxClientHtmlEditorCommandEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorCommandEventArgs): void; +} +/** + * Provides data for client events that relate to command processing (CustomCommand). + */ +interface ASPxClientHtmlEditorCommandEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value representing the processed command's name. + */ + commandName: string; + /** + * Gets an optional parameter that complements the processed command. + * Value: A string value containing additional information about the processed command. + */ + parameter: Object; +} +/** + * A method that will handle the client events that relate to custom dialog operations. + */ +interface ASPxClientHtmlEditorCustomDialogEventHandler { + /** + * A method that will handle the client CustomDialogOpened event. + * @param source An object representing the event's source. + * @param e An ASPxClientHtmlEditorCustomDialogEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorCustomDialogEventArgs): void; +} +/** + * Provides data for client events that relate to custom dialog operations. + */ +interface ASPxClientHtmlEditorCustomDialogEventArgs extends ASPxClientEventArgs { + /** + * Gets the name that uniquely identifies the processed custom dialog. + * Value: A string value that represents the value assigned to the processed custom dialog's Name property. + */ + name: string; +} +/** + * Provides data for client events that relate to closing a custom dialog. + */ +interface ASPxClientHtmlEditorCustomDialogCloseEventArgsBase extends ASPxClientHtmlEditorCustomDialogEventArgs { + /** + * Gets the status of the closed custom dialog. + * Value: An object representing a custom dialog's closing status. By default, it's the "cancel" string if the dialog operation is canceled, or the "ok" string if a dialog is closed by submitting a file. You can also provide your custom status, if your dialog contains additional buttons. + */ + status: Object; +} +/** + * A method that will handle the CustomDialogClosing client event. + */ +interface ASPxClientHtmlEditorCustomDialogClosingEventHandler { + /** + * A method that will handle the client CustomDialogClosing event. + * @param source An object representing the event's source. + * @param e An ASPxClientHtmlEditorCustomDialogClosingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorCustomDialogClosingEventArgs): void; +} +/** + * Provides data for the CustomDialogClosing client event. + */ +interface ASPxClientHtmlEditorCustomDialogClosingEventArgs extends ASPxClientHtmlEditorCustomDialogCloseEventArgsBase { + /** + * Gets or sets a value specifying whether the event was handled. + * Value: true if the event was handled and default processing should not occur; false if the event should be handled using default processing. + */ + handled: boolean; +} +/** + * A method that will handle the CustomDialogClosed client event. + */ +interface ASPxClientHtmlEditorCustomDialogClosedEventHandler { + /** + * A method that will handle the client CustomDialogClosed event. + * @param source An object representing the event's source. + * @param e An ASPxClientHtmlEditorCustomDialogClosedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorCustomDialogClosedEventArgs): void; +} +/** + * Provides data for the CustomDialogClosed client event. + */ +interface ASPxClientHtmlEditorCustomDialogClosedEventArgs extends ASPxClientHtmlEditorCustomDialogCloseEventArgsBase { + /** + * Gets an object associated with the closed dialog. + * Value: An object containing custom data associated with dialog closing. + */ + data: Object; +} +/** + * A method that will handle the Validation client event. + */ +interface ASPxClientHtmlEditorValidationEventHandler { + /** + * A method that will handle the client Validation event. + * @param source An object representing the event's source. + * @param e An ASPxClientHtmlEditorValidationEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorValidationEventArgs): void; +} +/** + * Provides data for the Validation client event. + */ +interface ASPxClientHtmlEditorValidationEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets the HTML markup that is the ASPxHtmlEditor's content. + * Value: A string value that specifies the HTML content to validate. + */ + html: string; + /** + * Gets or sets a value specifying whether the validated value is valid. + * Value: true if the validation has been completed successfully; otherwise, false. + */ + isValid: boolean; + /** + * Gets or sets the error text to be displayed within the editor's error frame if the editor's validation fails. + * Value: A string value specifying the error description. + */ + errorText: string; +} +/** + * A method that will handle the ActiveTabChanged event. + */ +interface ASPxClientHtmlEditorTabEventHandler { + /** + * A method that will handle the client ActiveTabChanged event. + * @param source The event's source. + * @param e An ASPxClientHtmlEditorTabEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorTabEventArgs): void; +} +/** + * Provides data for the ActiveTabChanged event that concerns manipulations on tabs. + */ +interface ASPxClientHtmlEditorTabEventArgs extends ASPxClientEventArgs { + /** + * Gets the name that uniquely identifies an editor tab. + * Value: A string value that is the tab name. + */ + name: string; +} +/** + * A method that will handle the ActiveTabChanging event. + */ +interface ASPxClientHtmlEditorTabCancelEventHandler { + /** + * A method that will handle the client ActiveTabChanging event. + * @param source The event's source. + * @param e An ASPxClientHtmlEditorTabCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorTabCancelEventArgs): void; +} +/** + * Provides data for the cancellable ActiveTabChanging event that concerns manipulations on tabs. + */ +interface ASPxClientHtmlEditorTabCancelEventArgs extends ASPxClientHtmlEditorTabEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event, should be canceled. + * Value: true, if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the BeforePaste event. + */ +interface ASPxClientHtmlEditorBeforePasteEventHandler { + /** + * A method that will handle the BeforePaste event. + * @param source The event source. This parameter identifies the HTML editor object that raised the event. + * @param e An ASPxClientHtmlEditorBeforePasteEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorBeforePasteEventArgs): void; +} +/** + * Provides data for the BeforePaste event. + */ +interface ASPxClientHtmlEditorBeforePasteEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value identifying the command's name. + */ + commandName: string; + /** + * Gets or sets the HTML markup that is about to be pasted to the ASPxHtmlEditor's content. + * Value: A string value that specifies the HTML content to paste. + */ + html: string; +} +/** + * Represents a client-side equivalent of the ASPxHtmlEditor control. + */ +interface ASPxClientHtmlEditor extends ASPxClientControl { + /** + * Occurs on the client side after a dialog has been initialized. + */ + DialogInitialized: ASPxClientEvent>; + /** + * Occurs before a default or custom command has been executed and allows you to cancel the action. + */ + CommandExecuting: ASPxClientEvent>; + /** + * Enables you to implement a custom command's logic. + */ + CustomCommand: ASPxClientEvent>; + /** + * Occurs after a default or custom command has been executed on the client side. + */ + CommandExecuted: ASPxClientEvent>; + /** + * Fires on the client side when the editor's Design View Area receives input focus. + */ + GotFocus: ASPxClientEvent>; + /** + * Fires on the client side when the editor's Design View Area loses input focus. + */ + LostFocus: ASPxClientEvent>; + /** + * Occurs on the client when a selection is changed within the ASPxHtmlEditor. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Occurs on the client side when the content of the editor changes. + */ + HtmlChanged: ASPxClientEvent>; + /** + * Occurs on the client side after a custom dialog is opened. + */ + CustomDialogOpened: ASPxClientEvent>; + /** + * Fires on the client side before a custom dialog is closed. + */ + CustomDialogClosing: ASPxClientEvent>; + /** + * Occurs on the client side after a custom dialog is closed. + */ + CustomDialogClosed: ASPxClientEvent>; + /** + * Allows you to specify whether the value entered into the ASPxHtmlEditor is valid. + */ + Validation: ASPxClientEvent>; + /** + * Occurs on the client side before a context menu is shown. + */ + ContextMenuShowing: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientHtmlEditor. + */ + CallbackError: ASPxClientEvent>; + /** + * Fires after a callback, sent by the CustomDataCallback event handler. + */ + CustomDataCallback: ASPxClientEvent>; + /** + * Occurs on the client side after the editor content is spell checked. + */ + SpellingChecked: ASPxClientEvent>; + /** + * Fires on the client side after the active tab has been changed within a control. + */ + ActiveTabChanged: ASPxClientEvent>; + /** + * Fires on the client side before the active tab is changed within a control. + */ + ActiveTabChanging: ASPxClientEvent>; + /** + * Occurs before an HTML code is pasted to editor content, and allows you to modify it. + */ + BeforePaste: ASPxClientEvent>; + /** + * Returns the document object generated by an iframe element within a design view area. + */ + GetDesignViewDocument(): Object; + /** + * Returns the document object generated by an iframe element within a preview area. + */ + GetPreviewDocument(): Object; + /** + * Returns a collection of client context menu objects. + */ + GetContextMenu(): ASPxClientPopupMenu; + /** + * Returns a value indicating whether an editor is enabled. + */ + GetEnabled(): boolean; + /** + * Specifies whether an editor is enabled. + * @param value true to enable the editor; false to disable it. + */ + SetEnabled(value: boolean): void; + /** + * Sets input focus to the ASPxHtmlEditor's edit region. + */ + Focus(): void; + /** + * Gets the HTML markup that represents the editor's content. + */ + GetHtml(): string; + /** + * Specifies the HTML markup that represents the editor's content. + * @param html A string value that specifies the HTML markup. + */ + SetHtml(html: string): void; + /** + * Sets the HTML markup that represents the editor's content. + * @param html A string value that specifies the HTML markup. + * @param clearUndoHistory true to clear the undo stack; otherwise, false. + */ + SetHtml(html: string, clearUndoHistory: boolean): void; + /** + * Replaces placeholders with the specified values. + * @param html A string value that specifies the HTML code to process. + * @param placeholders An array of objects that specify the placeholders and values to replace them. + */ + ReplacePlaceholders(html: string, placeholders: Object[]): string; + /** + * Creates a parameter for ASPxHtmlEditor's client-side commands related to changing media elements. + * @param element An element that is being changed. + */ + CreateChangeMediaElementCommandArguments(element: Object): ASPxClientHtmlEditorChangeMediaElementCommandArguments; + /** + * Executes the specified command. + * @param commandName A string value that specifies the command to perform. + * @param parameter A string value specifying additional information about the command to perform. + * @param addToUndoHistory true, to add the specified command to the undo stack; otherwise, false. + */ + ExecuteCommand(commandName: string, parameter: Object, addToUndoHistory: boolean): boolean; + /** + * Adds the current editor state to the undo/redo history. + */ + SaveToUndoHistory(): void; + /** + * Returns the selection in the ASPxHtmlEditor. + */ + GetSelection(): ASPxClientHtmlEditorSelection; + /** + * Restores the selection within the ASPxHtmlEditor. + */ + RestoreSelection(): boolean; + /** + * Sets the value of the combo box within the HtmlEditor on the client side. + * @param commandName A string value that identifies the combo box's command name within the HtmlEditor's control collection. + * @param value A string value that specifies the combo box's new value. + */ + SetToolbarComboBoxValue(commandName: string, value: string): void; + /** + * Sets the value of the dropdown item picker in the HtmlEditor on the client side. + * @param commandName A string value that identifies the dropdown item picker by its command name. This value is contained in the CommandName property. + * @param value A string value that specifies the dropdown item picker's new value, i.e., the ToolbarItemPickerItem object. + */ + SetToolbarDropDownItemPickerValue(commandName: string, value: string): void; + /** + * Specifies the visibility of a ribbon context tab category specified by its name. + * @param categoryName A Name property value of the required category. + * @param active true to make a category visible; false to make it hidden. + */ + SetRibbonContextTabCategoryVisible(categoryName: string, active: string): void; + /** + * Provides access to an object implementing the HtmlEditor's ribbon UI. + */ + GetRibbon(): ASPxClientRibbon; + /** + * Gets a value that indicates whether the editor's value passes validation. + */ + GetIsValid(): boolean; + /** + * Gets the error text to be displayed within the editor's error frame if the editor's validation fails. + */ + GetErrorText(): string; + /** + * Sets a value that specifies whether the editor's value passes validation. + * @param isValid true if the editor's value passes validation; otherwise, false. + */ + SetIsValid(isValid: boolean): void; + /** + * Sets the error text to be displayed within the editor's error frame if the editor's validation fails. + * @param errorText A string value representing the error text. + */ + SetErrorText(errorText: string): void; + /** + * Performs validation of the editor's content. + */ + Validate(): void; + /** + * Set an active tab specified by its name. + * @param name A string value that is the name of the tab. + */ + SetActiveTabByName(name: string): void; + /** + * Returns the name of the active HTML editor tab. + */ + GetActiveTabName(): string; + /** + * Reconnect the control to an external ribbon. + */ + ReconnectToExternalRibbon(): void; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback A ASPxClientDataCallback object that represents the JavaScript function which receives the callback data as a parameter. + */ + PerformDataCallback(parameter: string, onCallback: ASPxClientDataCallback): void; +} +/** + * A selection in the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorSelection { + /** + * Returns a DOM element that relates to the current selection. + */ + GetSelectedElement(): Object; + /** + * Returns the HTML markup specifying the currently selected ASPxHtmlEditor content. + */ + GetHtml(): string; + /** + * Returns the text within the currently selected ASPxHtmlEditor content. + */ + GetText(): string; + /** + * Returns an array of the currently selected elements. + */ + GetElements(): Object[]; + /** + * Sets the new HTML markup in place of the currently selected within ASPxHtmlEditor content. + * @param html A string value specifying the new HTML markup. + * @param addToHistory true to add this operation to the history; otherwise, false. + */ + SetHtml(html: string, addToHistory: boolean): void; +} +/** + * A client-side equivalent of the ASPxPivotGrid control. + */ +interface ASPxClientPivotGrid extends ASPxClientControl { + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientPivotGrid. + */ + CallbackError: ASPxClientEvent>; + /** + * Fires after a callback that has been processed on the server returns back to the client. + */ + AfterCallback: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Fires before a callback is sent to the server for server-side processing. + */ + BeforeCallback: ASPxClientEvent>; + /** + * Fires on the client side after the customization form's visible state has been changed. + */ + CustomizationFieldsVisibleChanged: ASPxClientEvent>; + /** + * Occurs when a cell is clicked. + */ + CellClick: ASPxClientEvent>; + /** + * Occurs when a cell is double clicked. + */ + CellDblClick: ASPxClientEvent>; + /** + * Occurs when a custom menu item has been clicked. + */ + PopupMenuItemClick: ASPxClientEvent>; + /** + * Indicates whether the Defer Layout Update check box is enabled. + */ + IsDeferUpdatesChecked(): boolean; + /** + * Indicates whether the Filter Editor (Prefilter) is visible. + */ + IsPrefilterVisible(): boolean; + /** + * Shows the Filter Editor. + */ + ShowPrefilter(): void; + /** + * Hides the Filter Editor. + */ + HidePrefilter(): void; + /** + * Clears the filter expression applied using the Prefilter (Filter Editor). + */ + ClearPrefilter(): void; + /** + * Enables or disables the current filter applied by the Filter Editor (Prefilter). + */ + ChangePrefilterEnabled(): void; + /** + * Returns a value that specifies whether the customization form is visible. + */ + GetCustomizationFieldsVisibility(): boolean; + /** + * Specifies the visibility of the customization form. + * @param value true to display the customization form; false to hide the customization form. + */ + SetCustomizationFieldsVisibility(value: boolean): void; + /** + * Switches the customization form's visible state. + */ + ChangeCustomizationFieldsVisibility(): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; +} +/** + * A method that will handle the CellDblClick event. + */ +interface ASPxClientClickEventHandler { + /** + * A method that will handle the CellDblClick event. + * @param source The event source. + * @param e An ASPxClientClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientClickEventArgs): void; +} +/** + * Provides data for the CellDblClick client events. + */ +interface ASPxClientClickEventArgs extends ASPxClientEventArgs { + /** + * Provides access to the parameters associated with the CellDblClick events. + * Value: An object that contains parameters associated with the CellDblClick events. + */ + HtmlEvent: Object; + /** + * Gets the processed cell's value. + * Value: An object that represents the processed cell's value. + */ + Value: Object; + /** + * Gets the index of a column that owns the processed cell. + * Value: An integer value that identifies a column. + */ + ColumnIndex: number; + /** + * Gets the index of a row that owns the processed cell. + * Value: An integer value that identifies a row. + */ + RowIndex: number; + /** + * Gets a column field value. + * Value: An object that represents a column field value. + */ + ColumnValue: Object; + /** + * Gets a row field value. + * Value: An object that represents a row field value. + */ + RowValue: Object; + /** + * Gets a column field name. + * Value: A String value that represents a column field name. + */ + ColumnFieldName: string; + /** + * Gets a row field name. + * Value: A String value that represents a row field name. + */ + RowFieldName: string; + /** + * Gets a column value type. + * Value: A String value that represents a column value type. + */ + ColumnValueType: string; + /** + * Gets a row value type. + * Value: A String value that represents a row value type. + */ + RowValueType: string; + /** + * Gets the index of the data field which corresponds to the clicked summary value. + * Value: An integer value that identifies the data field. + */ + DataIndex: number; +} +/** + * A method that will handle the PopupMenuItemClick event. + */ +interface ASPxClientPivotMenuItemClickEventHandler { + /** + * A method that will handle the PopupMenuItemClick event. + * @param source The event source. + * @param e An ASPxClientPivotMenuItemClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientPivotMenuItemClickEventArgs): void; +} +/** + * Provides data for the PopupMenuItemClick event. + */ +interface ASPxClientPivotMenuItemClickEventArgs extends ASPxClientEventArgs { + /** + * Gets the context menu's type. + * Value: A PivotGridPopupMenuType enumeration value that identifies the context menu. + */ + MenuType: string; + /** + * Gets the name of the menu item currently being clicked. + * Value: A String value that identifies the clicked item by its name. + */ + MenuItemName: string; + /** + * Gets the field's unique indentifier. + * Value: A string which specifies the field's unique indentifier. + */ + FieldID: string; + /** + * Gets the index of the field value for which the popup menu has been invoked. + * Value: An integer value that identifies the field value. + */ + FieldValueIndex: number; +} +/** + * A client-side equivalent of the ASPxPivotCustomizationControl control. + */ +interface ASPxClientPivotCustomization extends ASPxClientControl { + /** + * Returns an HTML element that represents the root of the control's hierarchy. + */ + GetMainContainer(): Object; + /** + * Returns a client-side equivalent of the owner Pivot Grid Control. + */ + GetPivotGrid(): ASPxClientPivotGrid; + /** + * Specifies the Customization Control's height. + * @param value An integer value that specifies the Customization Control's height. + */ + SetHeight(value: number): void; + /** + * Specifies the Customization Control's width. + * @param value An integer value that specifies the Customization Control's width. + */ + SetWidth(value: number): void; + /** + * Recalculates the Customization Control height. + */ + UpdateHeight(): void; + /** + * Specifies the Customization Control's layout. + * @param layout A string that specifies the Customization Control's layout. + */ + SetLayout(layout: string): void; +} +/** + * A method that will handle the CustomCommandExecuted event. + */ +interface ASPxClientRichEditCustomCommandExecutedEventHandler { + /** + * A method that will handle the CustomCommandExecuted event. + * @param source An object representing the event source. Identifies the RichEdit that raised the event. + * @param e A ASPxClientRichEditCustomCommandExecutedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRichEditCustomCommandExecutedEventArgs): void; +} +/** + * Provides data for the CustomCommandExecuted event. + */ +interface ASPxClientRichEditCustomCommandExecutedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value representing the processed command's name. + */ + commandName: string; + /** + * Gets an optional parameter that complements the processed command. + * Value: A string value containing additional information about the processed command. + */ + parameter: Object; +} +/** + * A method that will handle the HyperlinkClick event. + */ +interface ASPxClientRichEditHyperlinkClickEventHandler { + /** + * A method that will handle the HyperlinkClick event. + * @param source The event source. + * @param e An ASPxClientRichEditHyperlinkClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRichEditHyperlinkClickEventArgs): void; +} +/** + * Provides data for the HyperlinkClick event. + */ +interface ASPxClientRichEditHyperlinkClickEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets whether the event is handled manually, so no default processing is required. + * Value: true if the event is handled and no default processing is required; otherwise false. + */ + handled: boolean; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; + /** + * Gets a value identifying the clicked hyperlink type. + * Value: One of the values. + */ + hyperlinkType: ASPxClientOfficeDocumentLinkType; + /** + * Gets the clicked link's URI. + * Value: A sting value specifying the link's URI. + */ + targetUri: string; +} +/** + * A client-side equivalent of the ASPxRichEdit object. + */ +interface ASPxClientRichEdit extends ASPxClientControl { + /** + * Provides access to document structural elements. + * Value: A object that lists RichEdit's document structural elements. + */ + document: RichEditDocument; + /** + * Provides access to RichEdit's client-side commands. + * Value: A object that lists RichEdit's client-side commands. + */ + commands: RichEditCommands; + /** + * Provides access to the client methods that changes the selection. + * 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. + */ + CustomCommandExecuted: ASPxClientEvent>; + /** + * Fires after a client change has been made to the document and the client-server synchronization starts to apply the change on the server. + */ + BeginSynchronization: ASPxClientEvent>; + /** + * Fires after a document change has been applied to the server and server and client document models have been synchronized. + */ + EndSynchronization: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the RichEdit. + */ + CallbackError: ASPxClientEvent>; + /** + * Fires if any change is made to the RichEdit's document on the client. + */ + DocumentChanged: ASPxClientEvent>; + /** + * Occurs when a hyperlink is clicked within the document. + */ + HyperlinkClick: ASPxClientEvent>; + /** + * Occurs when the selection is changed within the document. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Enables you to switch the full-screen mode of the Rich Text Editor. + * @param fullscreen true to activate full-screen mode; false to deactivate full-screen mode. + */ + SetFullscreenMode(fullscreen: boolean): void; + /** + * Provides access to an object implementing the RichEdit's ribbon UI. + */ + GetRibbon(): ASPxClientRibbon; + /** + * Sets input focus to the RichEdit. + */ + Focus(): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Indicates whether any unsaved changes are contained in the current document. + */ + HasUnsavedChanges(): boolean; + /** + * Reconnects the RichEdit to an external ribbon. + */ + ReconnectToExternalRibbon(): void; +} +/** + * Contains a set of the available client commands. + */ +interface RichEditCommands { + /** + * Gets a command to create a new empty document. + * Value: A object that provides methods for executing the command and checking its state. + */ + fileNew: FileNewCommand; + /** + * Gets a command to open the file, specifying its path. + * Value: A object that provides methods for executing the command and checking its state. + */ + fileOpen: FileOpenCommand; + /** + * Gets a command to invoke the File Open dialog allowing one to select and load a document file into RichEdit. + * Value: A object that provides methods for executing the command and checking its state. + */ + fileOpenDialog: FileOpenDialogCommand; + /** + * Gets a command to save the document to a file. + * Value: A object that provides methods for executing the command and checking its state. + */ + fileSave: FileSaveCommand; + /** + * Gets a command to download the document file, specifying its extension. + * Value: A object that provides methods for executing the command and checking its state. + */ + fileDownload: FileDownloadCommand; + /** + * Gets a command to invoke the Save As dialog that prompts for a file name and saves the current document in a file with the specified path. + * Value: A object that provides methods for executing the command and checking its state. + */ + fileSaveAs: FileSaveAsCommand; + fileSaveAsDialog: FileSaveAsDialogCommand; + /** + * Gets a command to invoke a browser-specific Print dialog allowing one to print the current document. + * Value: A object that provides methods for executing the command and checking its state. + */ + filePrint: FilePrintCommand; + /** + * Gets a command to cancel changes caused by the previous command. + * Value: A object that provides methods for executing the command and checking its state. + */ + undo: UndoCommand; + /** + * Gets a command to reverse actions of the previous undo command. + * Value: A object that provides methods for executing the command and checking its state. + */ + redo: RedoCommand; + /** + * Gets a command to copy the selected text and place it to the clipboard. + * Value: A object that provides methods for executing the command and checking its state. + */ + copy: CopyCommand; + /** + * Gets a command to paste the text from the clipboard over the selection. + * Value: A object that provides methods for executing the command and checking its state. + */ + paste: PasteCommand; + /** + * Gets a command to cut the selected text and place it to the clipboard. + * Value: A object that provides methods for executing the command and checking its state. + */ + cut: CutCommand; + /** + * Gets a command to change the font name of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontName: ChangeFontNameCommand; + /** + * Gets a command to change the font size of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontSize: ChangeFontSizeCommand; + /** + * Gets a command to increase the font size of characters in a selected range to the closest larger predefined value. + * Value: A object that provides methods for executing the command and checking its state. + */ + increaseFontSize: IncreaseFontSizeCommand; + /** + * Gets a command to decrease the selected range's font size to the closest smaller predefined value. + * Value: A object that provides methods for executing the command and checking its state. + */ + decreaseFontSize: DecreaseFontSizeCommand; + /** + * Gets a command to convert selected text to upper case. + * Value: A object that provides methods for executing the command and checking its state. + */ + makeTextUpperCase: MakeTextUpperCaseCommand; + /** + * Gets a command to convert selected text to lower case. + * Value: A object that provides methods for executing the command and checking its state. + */ + makeTextLowerCase: MakeTextLowerCaseCommand; + /** + * Gets a command to capitalize each word in the selected sentence. + * Value: A object that provides methods for executing the command and checking its state. + */ + capitalizeEachWordTextCase: CapitalizeEachWordTextCaseCommand; + /** + * Gets a command to toggle case for each character - upper case becomes lower, lower case becomes upper. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTextCase: ToggleTextCaseCommand; + /** + * Gets a command to change the bold formatting of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontBold: ChangeFontBoldCommand; + /** + * Gets a command to change the italic formatting of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontItalic: ChangeFontItalicCommand; + /** + * Gets a command to change the underline formatting of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontUnderline: ChangeFontUnderlineCommand; + /** + * Gets a command to change the strikeout formatting of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontStrikeout: ChangeFontStrikeoutCommand; + /** + * Gets a command to change the superscript formatting of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontSuperscript: ChangeFontSuperscriptCommand; + /** + * Gets a command to change the subscript formatting of characters in the selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontSubscript: ChangeFontSubscriptCommand; + /** + * Gets a command to change the font color of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontForeColor: ChangeFontForeColorCommand; + /** + * Gets a command to change the background color of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontBackColor: ChangeFontBackColorCommand; + /** + * Gets a command to reset the selected text's formatting to default. + * Value: A object that provides methods for executing the command and checking its state. + */ + clearFormatting: ClearFormattingCommand; + /** + * Gets a command to change the selected range's style. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeStyle: ChangeStyleCommand; + /** + * Gets a command to toggle between the bulleted paragraph and normal text. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleBulletedList: ToggleBulletedListCommand; + /** + * Gets a command to toggle between the numbered paragraph and normal text. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleNumberingList: ToggleNumberingListCommand; + /** + * Gets a command to toggle between the multilevel list style and normal text. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleMultilevelList: ToggleMultilevelListCommand; + /** + * Gets a command to increment the indent level of paragraphs in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + increaseIndent: IncreaseIndentCommand; + /** + * Gets a command to decrement the indent level of paragraphs in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + decreaseIndent: DecreaseIndentCommand; + /** + * Gets a command to toggle hidden symbol visibility. + * Value: A object that provides methods for executing the command and checking its state. + */ + showHiddenSymbols: ShowHiddenSymbolsCommand; + /** + * Gets a command to toggle left paragraph alignment on and off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleParagraphAlignmentLeft: ToggleParagraphAlignmentLeftCommand; + /** + * Gets a command to toggle centered paragraph alignment on and off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleParagraphAlignmentCenter: ToggleParagraphAlignmentCenterCommand; + /** + * Gets a command to toggle right paragraph alignment on and off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleParagraphAlignmentRight: ToggleParagraphAlignmentRightCommand; + /** + * Gets a command to toggle justified paragraph alignment on and off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleParagraphAlignmentJustify: ToggleParagraphAlignmentJustifyCommand; + /** + * Gets a command to format a current paragraph with single line spacing. + * Value: A object that provides methods for executing the command and checking its state. + */ + setSingleParagraphSpacing: SetSingleParagraphSpacingCommand; + /** + * Gets a command to format a current paragraph with one and a half line spacing. + * Value: A object that provides methods for executing the command and checking its state. + */ + setSesquialteralParagraphSpacing: SetSesquialteralParagraphSpacingCommand; + /** + * Gets a command to format a selected paragraph with double line spacing. + * Value: A object that provides methods for executing the command and checking its state. + */ + setDoubleParagraphSpacing: SetDoubleParagraphSpacingCommand; + /** + * Gets a command to add spacing before a paragraph. + * Value: A object that provides methods for executing the command and checking its state. + */ + addSpacingBeforeParagraph: AddSpacingBeforeParagraphCommand; + /** + * Gets a command to add spacing after a paragraph. + * Value: A object that provides methods for executing the command and checking its state. + */ + addSpacingAfterParagraph: AddSpacingAfterParagraphCommand; + /** + * Gets a command to remove spacing before the selected paragraph. + * Value: A object that provides methods for executing the command and checking its state. + */ + removeSpacingBeforeParagraph: RemoveSpacingBeforeParagraphCommand; + /** + * Gets a command to remove spacing after the selected paragraph. + * Value: A object that provides methods for executing the command and checking its state. + */ + removeSpacingAfterParagraph: RemoveSpacingAfterParagraphCommand; + /** + * Gets a command to change the background color of paragraphs in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeParagraphBackColor: ChangeParagraphBackColorCommand; + /** + * Gets a command to invoke the Font dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openFontFormattingDialog: OpenFontFormattingDialogCommand; + /** + * Gets a command to change the font formatting of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontFormatting: ChangeFontFormattingCommand; + /** + * Gets a command to invoke the Indents And Spacing tab of the Paragraph dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openParagraphFormattingDialog: OpenParagraphFormattingDialogCommand; + /** + * Gets a command to change the formatting of paragraphs in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeParagraphFormatting: ChangeParagraphFormattingCommand; + /** + * Gets a command to insert a page break at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertPageBreak: InsertPageBreakCommand; + /** + * Gets a command to invoke the Insert Table dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openInsertTableDialog: OpenInsertTableDialogCommand; + /** + * Gets a command to invoke the Insert Table dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTable: InsertTableCommand; + /** + * Gets a command to invoke the Insert Image dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openInsertPictureDialog: OpenInsertPictureDialogCommand; + /** + * Gets a command to insert a picture from a file. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertPicture: InsertPictureCommand; + /** + * Gets a command to invoke the Bookmark dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openInsertBookmarkDialog: OpenInsertBookmarkDialogCommand; + /** + * Gets a command to insert a new bookmark that references the current selection. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertBookmark: InsertBookmarkCommand; + /** + * A command to delete a specific bookmark. + * 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. + */ + openInsertHyperlinkDialog: OpenInsertHyperlinkDialogCommand; + /** + * Gets a command to insert a hyperlink at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertHyperlink: InsertHyperlinkCommand; + /** + * Gets a command to delete the selected hyperlink. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteHyperlink: DeleteHyperlinkCommand; + /** + * Gets a command to delete all hyperlinks in the selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteHyperlinks: DeleteHyperlinksCommand; + /** + * Gets a command to navigate to the document bookmark or URI (uniform resource identifier) specified for the hyperlink. + * Value: A object that provides methods for executing the command and checking its state. + */ + openHyperlink: OpenHyperlinkCommand; + /** + * Gets a command to invoke the Symbols dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openInsertSymbolDialog: OpenInsertSymbolDialogCommand; + /** + * Gets a command to insert a character into a document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertSymbol: InsertSymbolCommand; + /** + * Gets a command to change page margin settings. + * Value: A object that provides methods for executing the command and checking its state. + */ + changePageMargins: ChangePageMarginsCommand; + /** + * Gets a command to invoke the Margins tab of the Page Setup dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openPageMarginsDialog: OpenPageMarginsDialogCommand; + /** + * Gets a command to change the page orientation. + * 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. + */ + openPagePaperSizeDialog: OpenPagePaperSizeDialogCommand; + /** + * Gets a command to change the page size. + * Value: A object that provides methods for executing the command and checking its state. + */ + changePageSize: ChangePageSizeCommand; + /** + * Gets a command to change the number of section columns having the same width. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeSectionEqualColumnCount: ChangeSectionEqualColumnCountCommand; + /** + * Gets a command to invoke the Columns dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openSectionColumnsDialog: OpenSectionColumnsDialogCommand; + /** + * Gets a command to change the settings of individual section columns. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeSectionColumns: ChangeSectionColumnsCommand; + /** + * Gets a command to insert a column break at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertColumnBreak: InsertColumnBreakCommand; + /** + * Gets a command to insert a section break and starts a new section on the next page. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertSectionBreakNextPage: InsertSectionBreakNextPageCommand; + /** + * Gets a command to insert a section break and starts a new section on the next even-numbered page. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertSectionBreakEvenPage: InsertSectionBreakEvenPageCommand; + /** + * Gets a command to insert a section break and starts a new section on the next odd-numbered page. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertSectionBreakOddPage: InsertSectionBreakOddPageCommand; + /** + * Gets a command to set the background color of the page. + * Value: A object that provides methods for executing the command and checking its state. + */ + changePageColor: ChangePageColorCommand; + /** + * Gets a command to toggle the horizontal ruler's visibility. + * Value: A object that provides methods for executing the command and checking its state. + */ + showHorizontalRuler: ShowHorizontalRulerCommand; + /** + * Gets a command to toggle the fullscreen mode. + * Value: A object that provides methods for executing the command and checking its state. + */ + setFullscreen: SetFullscreenCommand; + /** + * Gets a command to invoke the Bulleted and Numbering dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openNumberingListDialog: OpenNumberingListDialogCommand; + /** + * Gets a command to insert a paragraph break at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertParagraph: InsertParagraphCommand; + /** + * Gets a command to insert text at the current position in a document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertText: InsertTextCommand; + /** + * Gets a command to delete the text in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + delete: DeleteCommand; + /** + * Gets a command to move the cursor backwards and erase the character in that space. + * Value: A object that provides methods for executing the command and checking its state. + */ + backspace: BackspaceCommand; + /** + * Gets a command to insert the line break at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertLineBreak: InsertLineBreakCommand; + /** + * Gets a command to scale pictures in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changePictureScale: ChangePictureScaleCommand; + /** + * Gets a command to increment the left indentation of paragraphs in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + incrementParagraphLeftIndent: IncrementParagraphLeftIndentCommand; + /** + * Gets a command to decrement the paragraph's left indent position. + * Value: A object that provides methods for executing the command and checking its state. + */ + decrementParagraphLeftIndent: DecrementParagraphLeftIndentCommand; + /** + * Gets a command to move the selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + moveContent: MoveContentCommand; + /** + * Gets a command to copy the selected text and place it to the specified position. + * Value: A object that provides methods for executing the command and checking its state. + */ + copyContent: CopyContentCommand; + /** + * Gets a command to insert a tab character at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTab: InsertTabCommand; + /** + * Gets a command to invoke the Tabs dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openTabsDialog: OpenTabsDialogCommand; + /** + * Gets a command to change paragraph tab stops. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTabs: ChangeTabsCommand; + /** + * Gets a command to invoke the Customize Numbered List dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openCustomNumberingListDialog: OpenCustomNumberingListDialogCommand; + /** + * Gets a command to customize the numbered list parameters. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeCustomNumberingList: ChangeCustomNumberingListCommand; + /** + * Gets a command to restart the numbering list. + * Value: A object that provides methods for executing the command and checking its state. + */ + restartNumberingList: RestartNumberingListCommand; + /** + * Gets a command to increment the indent level of paragraphs in a selected numbered list. + * Value: A object that provides methods for executing the command and checking its state. + */ + incrementNumberingIndent: IncrementNumberingIndentCommand; + /** + * Gets a command to decrement the indent level of paragraphs in a selected numbered list. + * Value: A object that provides methods for executing the command and checking its state. + */ + decrementNumberingIndent: DecrementNumberingIndentCommand; + /** + * Gets a command to create an empty field in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + createField: CreateFieldCommand; + /** + * Gets a command to update the field's result. + * Value: A object that provides methods for executing the command and checking its state. + */ + updateField: UpdateFieldCommand; + /** + * Gets a command to display the selected field's codes. + * Value: A object that provides methods for executing the command and checking its state. + */ + showFieldCodes: ShowFieldCodesCommand; + /** + * Get a command to display all field codes in place of the fields in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + showAllFieldCodes: ShowAllFieldCodesCommand; + /** + * Gets a command to continue the list's numbering. + * Value: A object that provides methods for executing the command and checking its state. + */ + continueNumberingList: ContinueNumberingListCommand; + /** + * Gets a command to insert numeration to a paragraph making it a numbering list item. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertNumeration: InsertNumerationCommand; + /** + * Gets a command to remove the selected numeration. + * Value: A object that provides methods for executing the command and checking its state. + */ + removeNumeration: RemoveNumerationCommand; + /** + * Gets a command to update all fields in the selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + updateAllFields: UpdateAllFieldsCommand; + /** + * Gets a command to insert a DATE field displaying the current date. + * Value: A object that provides methods for executing the command and checking its state. + */ + createDateField: CreateDateFieldCommand; + /** + * Gets a command to insert a TIME field displaying the current time. + * Value: A object that provides methods for executing the command and checking its state. + */ + createTimeField: CreateTimeFieldCommand; + /** + * A command to insert a PAGE field displaying the current page number. + * Value: A object that provides methods for executing the command and checking its state. + */ + createPageField: CreatePageFieldCommand; + /** + * Gets a command to convert the text of all selected sentences to sentence case. + * Value: A object that provides methods for executing the command and checking its state. + */ + makeTextSentenceCase: MakeTextSentenceCaseCommand; + /** + * Gets a command to switch the text case at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + switchTextCase: SwitchTextCaseCommand; + /** + * Gets a command to navigate to the first data record. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToFirstDataRecord: GoToFirstDataRecordCommand; + /** + * Gets a command to navigate to the previous data record of the bound data source. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToPreviousDataRecord: GoToPreviousDataRecordCommand; + /** + * Gets a command to navigate to the next data record of the bound data source. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToNextDataRecord: GoToNextDataRecordCommand; + /** + * Gets a command to navigate to the next data record. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToDataRecord: GoToDataRecordCommand; + /** + * Gets a command to navigate to the last data record of the bound data source. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToLastDataRecord: GoToLastDataRecordCommand; + /** + * Gets a command to display or hide actual data in MERGEFIELD fields. + * Value: A object that provides methods for executing the command and checking its state. + */ + showMergedData: ShowMergedDataCommand; + /** + * Gets a command to invoke the Insert Merge Field dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + mergeFieldDialog: MergeFieldDialogCommand; + /** + * Gets a command to insert a MERGEFIELD field (with a data source column name) at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + createMergeField: CreateMergeFieldCommand; + /** + * Gets a command to invoke the Export Range dialog window to start a mail merge. + * Value: A object that provides methods for executing the command and checking its state. + */ + mailMergeDialog: MailMergeDialogCommand; + /** + * Gets a command to perform a mail merge and download the merged document. + * Value: A object that provides methods for executing the command and checking its state. + */ + mailMergeAndDownload: MailMergeAndDownloadCommand; + /** + * Gets a command to perform a mail merge and save the merged document to the server. + * Value: A object that provides methods for executing the command and checking its state. + */ + mailMergeAndSaveAs: MailMergeAndSaveAsCommand; + /** + * Gets a command to activate the page header and begin editing. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertHeader: InsertHeaderCommand; + /** + * Gets a command to activate the page footer and begin editing. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertFooter: InsertFooterCommand; + /** + * Gets a command to link a header/footer to the previous section, so it has the same content. + * Value: A object that provides methods for executing the command and checking its state. + */ + linkHeaderFooterToPrevious: LinkHeaderFooterToPreviousCommand; + /** + * Gets a command to navigate to the page footer from the page header in the header/footer editing mode. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToFooter: GoToFooterCommand; + /** + * Gets a command to navigate to the page header from the page footer in the header/footer editing mode. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToHeader: GoToHeaderCommand; + /** + * Gets a command to navigate to the next page header or footer in the header/footer editing mode. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToNextHeaderFooter: GoToNextHeaderFooterCommand; + /** + * Gets a command to navigate to the previous page header or footer in the header/footer editing mode. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToPreviousHeaderFooter: GoToPreviousHeaderFooterCommand; + /** + * Gets a command to change the header/footer edit mode, so it allows creation of a different header or footer for the first page of a document or section. + * Value: A object that provides methods for executing the command and checking its state. + */ + setDifferentFirstPageHeaderFooter: SetDifferentFirstPageHeaderFooterCommand; + /** + * Gets a command to change the header/footer edit mode so it allows creation of a different header or footer for odd and even pages of a document or section. + * Value: A object that provides methods for executing the command and checking its state. + */ + setDifferentOddAndEvenPagesHeaderFooter: SetDifferentOddAndEvenPagesHeaderFooterCommand; + /** + * Gets a command to finish header/footer editing. + * Value: A object that provides methods for executing the command and checking its state. + */ + closeHeaderFooter: CloseHeaderFooterCommand; + /** + * Gets a command to insert a NUMPAGES field displaying the total number of pages. + * Value: A object that provides methods for executing the command and checking its state. + */ + createPageCountField: CreatePageCountFieldCommand; + /** + * Gets a command to invoke the Table tab of the Table Properties dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openTableFormattingDialog: OpenTableFormattingDialogCommand; + /** + * Gets a command to change the selected table's formatting. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableFormatting: ChangeTableFormattingCommand; + /** + * Gets a command to change the selected table rows' preferred height. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableRowPreferredHeight: ChangeTableRowPreferredHeightCommand; + /** + * Gets a command to change the preferred cell width of the selected table rows. + * 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. + */ + changeTableColumnPreferredWidth: ChangeTableColumnPreferredWidthCommand; + /** + * Gets a command to change the cell formatting of the selected table elements. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableCellFormatting: ChangeTableCellFormattingCommand; + /** + * Gets a command to insert a table column to the left of the current position in the table. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTableColumnToTheLeft: InsertTableColumnToTheLeftCommand; + /** + * Gets a command to insert a table column to the right of the current position in the table. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTableColumnToTheRight: InsertTableColumnToTheRightCommand; + /** + * Gets a command to insert a row in the table below the selected row. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTableRowBelow: InsertTableRowBelowCommand; + /** + * Gets a command to insert a row in the table above the selected row. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTableRowAbove: InsertTableRowAboveCommand; + /** + * Gets a command to delete the selected rows in the table. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteTableRows: DeleteTableRowsCommand; + /** + * Gets a command to delete the selected columns in the table. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteTableColumns: DeleteTableColumnsCommand; + /** + * Gets a command to insert table cells with a horizontal shift into the selected table. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTableCellWithShiftToTheLeft: InsertTableCellWithShiftToTheLeftCommand; + /** + * Gets a command to delete the selected table cells with a horizontal shift. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteTableCellsWithShiftHorizontally: DeleteTableCellsWithShiftHorizontallyCommand; + /** + * Gets a command to delete the selected table cells with a vertical shift. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteTableCellsWithShiftVertically: DeleteTableCellsWithShiftVerticallyCommand; + /** + * Gets a command to delete the selected table. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteTable: DeleteTableCommand; + /** + * Gets a command to invoke the Insert Cells dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTableCellsDialog: InsertTableCellsDialogCommand; + /** + * Gets a command to invoke the Delete Cells dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteTableCellsDialog: DeleteTableCellsDialogCommand; + /** + * Gets a command to merge the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + mergeTableCells: MergeTableCellsCommand; + /** + * Gets a command to invoke the Split Cells dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + splitTableCellsDialog: SplitTableCellsDialogCommand; + /** + * Gets a command to split the selected table cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + splitTableCells: SplitTableCellsCommand; + /** + * Gets a command to insert table cells with a vertical shift into the selected table. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTableCellsWithShiftToTheVertically: InsertTableCellsWithShiftToTheVerticallyCommand; + /** + * Gets a command to invoke the Borders tab of the Borders and Shading dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openTableBordersAndShadingDialog: OpenTableBordersAndShadingDialogCommand; + /** + * Gets a command to change the selected table's borders and shading. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableBordersAndShading: ChangeTableBordersAndShadingCommand; + /** + * Gets a command to apply top-left alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignTopLeft: ToggleTableCellAlignTopLeftCommand; + /** + * Gets a command to apply top-center alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignTopCenter: ToggleTableCellAlignTopCenterCommand; + /** + * Gets a command to apply top-right alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignTopRight: ToggleTableCellAlignTopRightCommand; + /** + * Gets a command to apply middle-left alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignMiddleLeft: ToggleTableCellAlignMiddleLeftCommand; + /** + * Gets a command to apply middle-center alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignMiddleCenter: ToggleTableCellAlignMiddleCenterCommand; + /** + * Gets a command to apply middle-right alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignMiddleRight: ToggleTableCellAlignMiddleRightCommand; + /** + * Gets a command to apply bottom-left alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignBottomLeft: ToggleTableCellAlignBottomLeftCommand; + /** + * Gets a command to apply bottom-center alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignBottomCenter: ToggleTableCellAlignBottomCenterCommand; + /** + * Gets a command to apply bottom-right alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignBottomRight: ToggleTableCellAlignBottomRightCommand; + /** + * Gets a command to change the selected table's style. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableStyle: ChangeTableStyleCommand; + /** + * Gets a command to toggle top borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellTopBorder: ToggleTableCellTopBorderCommand; + /** + * Gets a command to toggle right borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellRightBorder: ToggleTableCellRightBorderCommand; + /** + * Gets a command to toggle bottom borders for selected cells on/off. + * 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. + * Value: A object that provides methods for executing the command and checking its state. + */ + removeTableCellBorders: RemoveTableCellBordersCommand; + /** + * Gets a command to toggle all borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAllBorders: ToggleTableCellAllBordersCommand; + /** + * Gets a command to toggle inner horizontal borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellInsideHorizontalBorders: ToggleTableCellInsideHorizontalBordersCommand; + /** + * Gets a command to toggle inner vertical borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellInsideVerticalBorders: ToggleTableCellInsideVerticalBordersCommand; + /** + * Gets a command to toggle outer borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellOutsideBorders: ToggleTableCellOutsideBordersCommand; + /** + * Gets a command to change the selected table's style options. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableLook: ChangeTableLookCommand; + /** + * Gets a command to change the repository item's table border style. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableBorderRepositoryItem: ChangeTableBorderRepositoryItemCommand; + /** + * Gets a command to change cell shading in the selected table elements. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableCellShading: ChangeTableCellShadingCommand; + /** + * Gets a command to toggle the display of grid lines for a table with no borders applied - on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + showTableGridLines: ShowTableGridLinesCommand; + /** + * Gets a command to invoke the Search Panel allowing end-users to search text and navigate through search results. + * Value: A object that provides methods for executing the command and checking its state. + */ + openFindPanel: OpenFindPanelCommand; + /** + * Gets a command to invoke the Find and Replace dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openFindAndReplaceDialog: OpenFindAndReplaceDialogCommand; + /** + * Gets a command to find all matches of the specified text in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + findAll: FindAllCommand; + /** + * Gets a command to hide the results of the search. + * Value: A object that provides methods for executing the command and checking its state. + */ + hideFindResults: HideFindResultsCommand; + /** + * Gets a command to search for a specific text and replace all matches in the document with the specified string. + * Value: A object that provides methods for executing the command and checking its state. + */ + replaceAll: ReplaceAllCommand; + /** + * Gets a command to search for a specific text and replace the next match in the document with the specified string. + * 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. + */ +interface CommandBase { +} +/** + * Serves as a base for commands with a simple common command state. + */ +interface CommandWithSimpleStateBase extends CommandBase { + /** + * Gets information about the command state. + */ + getState(): SimpleCommandState; +} +/** + * Serves as a base for commands with the Boolean state. + */ +interface CommandWithBooleanStateBase extends CommandBase { + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * Defines a simple state common to most of the client commands. + */ +interface SimpleCommandState { + /** + * Gets a value indicating whether the command's UI element is enabled. + * Value: true, if the command's related UI element is enabled; otherwise, false. + */ + enabled: boolean; + /** + * Gets a value indicating whether the command's UI element is visible. + * Value: true, if the command's related UI element is visible; otherwise, false. + */ + visible: boolean; +} +/** + * Defines the state of a command. + */ +interface CommandState extends SimpleCommandState { + /** + * Gets the command state value. + * Value: A T object specifying the command state value. + */ + value: T; +} +/** + * Contains a set properties providing the current information about certain document structural elements. + */ +interface RichEditDocument { + /** + * Provides the information about the active sub-document. + * Value: A object storing information about the essential document functionality. + */ + activeSubDocument: SubDocument; + /** + * Provides information about sections in the current document. + * Value: An array of Section objects storing information about sections. + */ + sectionsInfo: Section[]; + /** + * Provides information about paragraph styles in the current document. + * Value: An array of ParagraphStyle objects storing information about paragraph styles. + */ + paragraphStylesInfo: ParagraphStyle[]; + /** + * Provides information about character styles in the current document. + * Value: An array of CharacterStyle objects storing information about character styles. + */ + characterStylesInfo: CharacterStyle[]; + /** + * Provides information about numbered paragraphs in the document. + * Value: An array of AbstractNumberingList objects storing the information about numbered paragraphs. + */ + abstractNumberingListsInfo: AbstractNumberingList[]; + /** + * Provides information about table styles in the current document. + * 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. + */ +interface AbstractNumberingList { + deleted: boolean; +} +/** + * Defines a paragraph in the document. + */ +interface Paragraph { + /** + * Gets the paragraph's character length. + * Value: An integer value specifying the element length in characters. + */ + length: number; + /** + * Gets the paragraph's start position in the document. + * 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. + */ + styleName: string; + /** + * Gets the index of a list applied to the paragraph. + * Value: An integer that is the index of a list to which the paragraph belongs. + */ + listIndex: number; + /** + * Gets or sets the index of the list level applied to the current paragraph in the numbering list. + * Value: An integer that is the index of the list level of the current paragraph. + */ + listLevelIndex: number; +} +/** + * Defines a field in the document. + */ +interface Field { + /** + * Gets the field's start position in a document. + * Value: An integer value specifying the start position. + */ + start: number; + /** + * Gets the field length in a document. + * Value: An integer value specifying the field length. + */ + length: number; + codeInterval: Interval; + resultInterval: Interval; + 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. + */ + hyperlinkUri: string; + /** + * Gets or sets the text for the tooltip displayed when the mouse hovers over a hyperlink field. + * Value: A string containing the tooltip text. + */ + hyperlinkTip: string; + /** + * Gets or sets the name of a bookmark (or a hyperlink) in the current document which shall be the target of the hyperlink field. + * Value: A string representing the bookmark's name. + */ + hyperlinkAnchor: string; + showCode: boolean; +} +/** + * Defines a bookmark in the document. + */ +interface Bookmark { + /** + * Gets the bookmark's start position in a document. + * Value: An integer value specifying the start position. + */ + start: number; + /** + * Gets the bookmark's length. + * 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. + */ + name: string; +} +/** + * Defines a section in the document. + */ +interface Section { + /** + * Gets the section's start position in the document. + * Value: An integer value specifying the start position. + */ + start: number; + /** + * Gets the section's character length. + * 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. + */ + headers: HeaderFooter[]; + /** + * Provides access to the section's footers. + * Value: An array of HeaderFooter objects storing information about the section's footers. + */ + footers: HeaderFooter[]; +} +/** + * Contains settings defining a header or footer in a document. + */ +interface HeaderFooter { + /** + * Gets the type of the header (footer). + * Value: One of the values. + */ + type: any; + /** + * Provides access to an object implementing the basic document functionality that is common to the header, footer and the main document body. + * Value: A object exposing the basic document functionality. + */ + subDocument: SubDocument; +} +interface InlinePictureInfo { + id: number; + position: number; + initialWidth: number; + initialHeight: number; + scaleX: number; + scaleY: number; + actualWidth: number; + actualHeight: number; +} +declare enum HeaderFooterType { + First=0, + Odd=1, + Primary=1, + Even=2 +} +interface RichEditFileInfo { + folderPath: string; + fileName: string; + documentFormat: any; +} +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. + */ +interface RichEditSelection { + /** + * Gets or sets an array of document interval in the selection. + * Value: An array of Interval objects. + */ + intervals: Interval[]; + collapsed: boolean; + getIntervalMaxPosition(): number; + /** + * Moves the cursor to the next line. + */ + goToNextLine(): void; + /** + * Moves the cursor to the next line and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToNextLine(extendSelection: boolean): void; + /** + * Moves the cursor to the end of the line in which the cursor is located. + */ + goToLineEnd(): void; + /** + * Moves the cursor to the end of the line in which the cursor is located and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToLineEnd(extendSelection: boolean): void; + /** + * Moves the cursor to the start of the line in which the cursor is located. + */ + goToLineStart(): void; + /** + * Moves the cursor to the start of the line in which the cursor is located and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToLineStart(extendSelection: boolean): void; + /** + * Moves the cursor to the previous line. + */ + goToPreviousLine(): void; + /** + * Moves the cursor to the previous line and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToPreviousLine(extendSelection: boolean): void; + /** + * Moves the cursor to the next character. + */ + goToNextCharacter(): void; + /** + * Moves the cursor to the next character and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToNextCharacter(extendSelection: boolean): void; + /** + * Moves the cursor to the previous character. + */ + goToPreviousCharacter(): void; + /** + * Moves the cursor to the previous character and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToPreviousCharacter(extendSelection: boolean): void; + /** + * Selects the line in which the cursor is located. + */ + selectLine(): void; + /** + * Selects the line in which the cursor is located and allows you to extend the entire selection with the currently existing selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + selectLine(extendSelection: boolean): void; + /** + * Moves the cursor to the beginning of the next page. + */ + goToNextPage(): void; + /** + * Moves the cursor to the beginning of the next page and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToNextPage(extendSelection: boolean): void; + /** + * Moves the cursor to the beginning of the previous page. + */ + goToPreviousPage(): void; + /** + * Moves the cursor to the beginning of the previous page and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToPreviousPage(extendSelection: boolean): void; + /** + * Moves the cursor to the start of the document. + */ + goToDocumentStart(): void; + /** + * Moves the cursor to the start of the document and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToDocumentStart(extendSelection: boolean): void; + /** + * Moves the cursor to the end of the document. + */ + goToDocumentEnd(): void; + /** + * Moves the cursor to the end of the document and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToDocumentEnd(extendSelection: boolean): void; + /** + * Moves the cursor to the next word. + */ + goToNextWord(): void; + /** + * Moves the cursor to the next word and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToNextWord(extendSelection: boolean): void; + /** + * Moves the cursor to the previous word. + */ + goToPrevWord(): void; + /** + * Moves the cursor to the previous word and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToPrevWord(extendSelection: boolean): void; + /** + * Moves the cursor to the start of the paragraph in which the cursor is located. + */ + goToParagraphStart(): void; + /** + * Moves the cursor to the start of the paragraph in which the cursor is located and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToParagraphStart(extendSelection: boolean): void; + /** + * Moves the cursor to the end of the paragraph in which the cursor is located. + */ + goToParagraphEnd(): void; + /** + * Moves the cursor to the end of the paragraph in which the cursor is located and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToParagraphEnd(extendSelection: boolean): void; + /** + * Selects the paragraph in which the cursor is located. + */ + selectParagraph(): void; + /** + * Selects the table cell in which the cursor is located. + */ + selectTableCell(): void; + /** + * Selects the table cell in which the cursor is located and allows you to extend the entire selection with the currently existing selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + selectTableCell(extendSelection: boolean): void; + /** + * Selects the table row in which the cursor is located. + */ + selectTableRow(): void; + /** + * Selects the table row in which the cursor is located and allows you to extend the entire selection with the currently existing selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + selectTableRow(extendSelection: boolean): void; + /** + * Selects the entire table in which the cursor is located. + */ + selectTable(): void; + /** + * Selects the entire table in which the cursor is located and allows you to extend the entire selection with the currently existing selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + selectTable(extendSelection: boolean): void; + /** + * 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; +} +/** + * Defines a document's interval. + */ +interface Interval { + /** + * Gets the interval's start position in the document. + * Value: An integer value specifying the start position. + */ + start: number; + /** + * Gets the interval's character length. + * Value: An integer value specifying the element length in characters. + */ + 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. + */ +interface OpenInsertBookmarkDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenInsertBookmarkDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a new bookmark that references the current selection. + */ +interface InsertBookmarkCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertBookmarkCommand command by applying the specified settings. 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 name A string value specifying name of creating bookmark. + * @param start An integer value specifying the start position of bookmark's range. + * @param length An integer value specifying the length of bookmark's range. + */ + execute(name: string, start: number, length: number): boolean; +} +/** + * A command to delete a specific bookmark. + */ +interface DeleteBookmarkCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteBookmarkCommand command by applying the specified setting. 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 name A string value specifying name of the deleted bookmark. + */ + execute(name: string): boolean; +} +/** + * Gets a command to navigate to the specified bookmark in the document. + */ +interface GoToBookmarkCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToBookmarkCommand command by applying the specified setting. 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 name + */ + execute(name: string): boolean; +} +/** + * A command to paste the text from the clipboard over the selection. + */ +interface PasteCommand extends CommandWithSimpleStateBase { + /** + * Executes the PasteCommand 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. + */ + execute(): boolean; +} +/** + * A command to copy the selected text and place it to the clipboard. + */ +interface CopyCommand extends CommandWithSimpleStateBase { + /** + * Executes the CopyCommand 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. + */ + execute(): boolean; +} +/** + * A command to cut the selected text and place it to the clipboard. + */ +interface CutCommand extends CommandWithSimpleStateBase { + /** + * Executes the CutCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert an empty document field at the current position in the document. + */ +interface CreateFieldCommand extends CommandWithSimpleStateBase { + /** + * Executes the CreateFieldCommand 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. + */ + execute(): boolean; +} +/** + * A command to update the field's result. + */ +interface UpdateFieldCommand extends CommandWithSimpleStateBase { + /** + * Executes the UpdateFieldCommand 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. + */ + execute(): boolean; +} +/** + * A command to display the selected field's field codes. + */ +interface ShowFieldCodesCommand extends CommandWithSimpleStateBase { + /** + * Executes the ShowFieldCodesCommand command by applying the specified setting. 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 showFieldCodes true to display field codes, false to hide field codes. + */ + execute(showFieldCodes: boolean): boolean; + /** + * Executes the ShowFieldCodesCommand 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. + */ + execute(): boolean; +} +/** + * A command to display all field codes in place of the fields in the document. + */ +interface ShowAllFieldCodesCommand extends CommandWithSimpleStateBase { + /** + * Executes the ShowAllFieldCodesCommand command by applying the specified setting. 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 showFieldCodes true to display field codes, false to hide field codes. + */ + execute(showFieldCodes: boolean): boolean; + /** + * Executes the ShowAllFieldCodesCommand 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. + */ + execute(): boolean; +} +/** + * A command to update all fields in the selected range. + */ +interface UpdateAllFieldsCommand extends CommandWithSimpleStateBase { + /** + * Executes the UpdateAllFieldsCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a DATE field displaying the current date. + */ +interface CreateDateFieldCommand extends CommandWithSimpleStateBase { + /** + * Executes the CreateDateFieldCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a TIME field displaying the current time. + */ +interface CreateTimeFieldCommand extends CommandWithSimpleStateBase { + /** + * Executes the CreateTimeFieldCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a PAGE field displaying the current page number. + */ +interface CreatePageFieldCommand extends CommandWithSimpleStateBase { + /** + * Executes the CreatePageFieldCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the next data record of the bound data source. + */ +interface GoToDataRecordCommand extends CommandBase { + /** + * Executes the GoToDataRecordCommand command by applying the specified setting. 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 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. + */ +interface GoToFirstDataRecordCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToFirstDataRecordCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the previous data record of the bound data source. + */ +interface GoToPreviousDataRecordCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToPreviousDataRecordCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the next data record of the bound data source. + */ +interface GoToNextDataRecordCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToNextDataRecordCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the last data record of the bound data source. + */ +interface GoToLastDataRecordCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToLastDataRecordCommand 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. + */ + execute(): boolean; +} +/** + * A command to display or hide actual data in MERGEFIELD fields. + */ +interface ShowMergedDataCommand extends CommandWithBooleanStateBase { + /** + * Executes the ShowMergedDataCommand 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. + */ + execute(): boolean; + /** + * Executes the ShowMergedDataCommand command by applying the specified setting. 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 showMergedData true to display merged data, false to hide merged data. + */ + execute(showMergedData: boolean): boolean; +} +/** + * A command to invoke the Insert Merge Field dialog. + */ +interface MergeFieldDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the MergeFieldDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a MERGEFIELD field (with a data source column name) at the current position in the document. + */ +interface CreateMergeFieldCommand extends CommandWithSimpleStateBase { + /** + * Executes the CreateMergeFieldCommand command by applying the specified setting. 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 fieldName A string value specifying the name of the merge field. + */ + execute(fieldName: string): boolean; +} +/** + * Gets a command to invoke the Export Range dialog to start a mail merge. + */ +interface MailMergeDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the MailMergeDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to start the mail merge process and download the resulting document containing the merged information. + */ +interface MailMergeAndDownloadCommand extends CommandBase { + /** + * Executes the MailMergeAndDownloadCommand command by applying the specified setting. 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 fileExtension A string value specifying the file extension of the resulting document. + */ + execute(fileExtension: string): boolean; + /** + * + * @param documentFormat + */ + execute(documentFormat: any): boolean; + /** + * Executes the MailMergeAndDownloadCommand command by applying the specified settings. 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 fileExtension A string value specifying the file extension of the resulting document. + * @param settings A MailMergeSettings object containing settings to set up mail merge operations. + */ + execute(fileExtension: string, settings: MailMergeSettings): boolean; + /** + * + * @param documentFormat + * @param settings + */ + execute(documentFormat: any, settings: MailMergeSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to start the mail merge process and save the resulting merged document to the server. + */ +interface MailMergeAndSaveAsCommand extends CommandBase { + /** + * Executes the MailMergeAndSaveAsCommand command by applying the specified setting. 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 filePath A string value specifying path to the saving file on the server. + */ + execute(filePath: string): boolean; + /** + * + * @param fileInfo + * @param settings + */ + execute(fileInfo: RichEditFileInfo, settings: MailMergeSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to insert a NUMPAGES field displaying the total number of pages. + */ +interface CreatePageCountFieldCommand extends CommandWithSimpleStateBase { + /** + * Executes the CreatePageCountFieldCommand 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. + */ + execute(): boolean; +} +/** + * Contains settings to set up mail merge operations. + */ +interface MailMergeSettings { + /** + * Gets or sets a value specifying which data rows should be exported into a merged document. + * Value: One of the values. + */ + range: any; + /** + * Gets or sets the index of the row from which the exported range starts. + * Value: An integer value specifying the row index. + */ + exportFrom: number; + /** + * Gets or sets the number of data rows in the exported mail-merge range. + * Value: An integer value specifying the row count. + */ + exportRecordsCount: number; + /** + * Gets or sets the merge mode. + * Value: One of the values. + */ + mergeMode: any; +} +declare enum MergeMode { + NewParagraph=0, + NewSection=1, + JoinTables=2 +} +declare enum MailMergeExportRange { + AllRecords=0, + CurrentRecord=1, + Range=2 +} +/** + * A command to create a new empty document. + */ +interface FileNewCommand extends CommandWithSimpleStateBase { + /** + * Executes the FileNewCommand 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. + */ + execute(): boolean; +} +/** + * A command to open the file, specifying its path. + */ +interface FileOpenCommand extends CommandWithSimpleStateBase { + /** + * Executes the FileOpenCommand command by applying the specified setting. 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 path A string value specifying path to the opening file. + */ + execute(path: string): boolean; +} +/** + * A command to invoke the File Open dialog allowing one to select and load a document file into RichEdit. + */ +interface FileOpenDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the FileOpenDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to save the document to a file. + */ +interface FileSaveCommand extends CommandWithSimpleStateBase { + /** + * Executes the FileSaveCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Save As dialog that prompts for a file name and saves the current document in a file with the specified path. + */ +interface FileSaveAsCommand extends CommandWithSimpleStateBase { + /** + * Executes the FileSaveAsCommand command by applying the specified setting. 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 path A string value specifying path to the saving file. + */ + execute(path: string): boolean; + /** + * + * @param fileInfo + */ + execute(fileInfo: RichEditFileInfo): boolean; +} +interface FileSaveAsDialogCommand extends CommandWithSimpleStateBase { + execute(): boolean; +} +/** + * A command to download the document file, specifying its extension. + */ +interface FileDownloadCommand extends CommandWithSimpleStateBase { + /** + * Executes the FileDownloadCommand command by applying the specified setting. 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 fileExtension A string value specifying the extension of the downloading file. + */ + execute(fileExtension: string): boolean; + /** + * + * @param documentFormat + */ + execute(documentFormat: any): boolean; +} +/** + * A command to invoke a browser-specific Print dialog allowing one to print the current document. + */ +interface FilePrintCommand extends CommandWithSimpleStateBase { + /** + * Executes the FilePrintCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Search Panel allowing end-users to search text and navigate through search results. + */ +interface OpenFindPanelCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenFindPanelCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Find and Replace dialog. + */ +interface OpenFindAndReplaceDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenFindAndReplaceDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to find all matches of the specified text in the document. + */ +interface FindAllCommand extends CommandWithSimpleStateBase { + /** + * Executes the FindAllCommand command by applying the specified settings. 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 text A string value specifying finding text. + * @param matchCase true, to perform a case-sensitive search; otherwise, false. + * @param highlightResults true, to highlight result of search; otherwise, false. + */ + execute(text: string, matchCase: boolean, highlightResults: boolean): boolean; + /** + * Executes the FindAllCommand command by applying the specified settings. 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 text A string value specifying text to find. + * @param matchCase true, to perform a case-sensitive search; otherwise, false. + * @param highlightResults true, to highlight result of search; otherwise, false. + * @param results An array of Interval objects containing the results of search. + */ + execute(text: string, matchCase: boolean, highlightResults: boolean, results: Interval[]): boolean; +} +/** + * A command to hide the search results. + */ +interface HideFindResultsCommand extends CommandWithSimpleStateBase { + /** + * Executes the HideFindResultsCommand 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. + */ + execute(): boolean; +} +/** + * A command to search for a specific text and replace all matches in the document with the specified string. + */ +interface ReplaceAllCommand extends CommandWithSimpleStateBase { + /** + * Executes the ReplaceAllCommand command by applying the specified settings. 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 text A string value specifying text to replace. + * @param replaceText A string value specifying replacing text. + * @param matchCase true, to perform a case-sensitive search; otherwise, false. + */ + execute(text: string, replaceText: string, matchCase: boolean): boolean; +} +/** + * A command to search for a specific text and replace the next match in the document with the specified string. + */ +interface ReplaceNextCommand extends CommandWithSimpleStateBase { + /** + * Executes the ReplaceNextCommand command by applying the specified settings. 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 text A string value specifying text to replace. + * @param replaceText A string value specifying replacing text. + * @param matchCase true, to perform a case-sensitive search; otherwise, false. + */ + execute(text: string, replaceText: string, matchCase: boolean): boolean; +} +/** + * A command to cancel changes caused by the previous command. + */ +interface UndoCommand extends CommandWithSimpleStateBase { + /** + * Executes the UndoCommand 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. + */ + execute(): boolean; +} +/** + * A command to reverse actions of the previous undo command. + */ +interface RedoCommand extends CommandWithSimpleStateBase { + /** + * Executes the RedoCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Hyperlink dialog. + */ +interface OpenInsertHyperlinkDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenInsertHyperlinkDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a hyperlink at the current position in the document. + */ +interface InsertHyperlinkCommand extends CommandBase { + /** + * Executes the InsertHyperlinkCommand command by applying the specified setting. 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 settings A HyperLinkSettings object specifying hyperlink settings. + */ + execute(settings: HyperlinkSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to delete the selected hyperlink. + */ +interface DeleteHyperlinkCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteHyperlinkCommand 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. + */ + execute(): boolean; +} +/** + * A command to delete all hyperlinks in a selected range. + */ +interface DeleteHyperlinksCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteHyperlinksCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the document bookmark or URI (uniform resource identifier) specified for the hyperlink. + */ +interface OpenHyperlinkCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenHyperlinkCommand 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. + */ + execute(): boolean; +} +/** + * Contains settings to define hyperlinks. + */ +interface HyperlinkSettings { + /** + * Gets or sets a text displayed for a hyperlink. + * Value: A string value specifying the hyperlink display text. + */ + text: string; + /** + * Gets or sets a text for the tooltip displayed when the mouse hovers over a hyperlink. + * Value: A string containing the tooltip text. + */ + tooltip: string; + /** + * Gets or sets the hyperlink destination. + * Value: A string value that specifies the destination to which a hyperlink refers. + */ + url: string; + /** + * Gets or sets the associated bookmak. + * Value: A string value specifying the bookmark name. + */ + bookmark: string; +} +/** + * A command to insert a page break at the current position in the document. + */ +interface InsertPageBreakCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertPageBreakCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a column break at the current position in the document. + */ +interface InsertColumnBreakCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertColumnBreakCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a section break and start a new section on the next page. + */ +interface InsertSectionBreakNextPageCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertSectionBreakNextPageCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a section break and start a new section on the next even-numbered page. + */ +interface InsertSectionBreakEvenPageCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertSectionBreakEvenPageCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a section break and start a new section on the next odd-numbered page. + */ +interface InsertSectionBreakOddPageCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertSectionBreakOddPageCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert the line break at the current position in the document. + */ +interface InsertLineBreakCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertLineBreakCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle between the bulleted paragraph and normal text. + */ +interface ToggleBulletedListCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleBulletedListCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle between the numbered paragraph and normal text. + */ +interface ToggleNumberingListCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleNumberingListCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle between the multilevel list style and normal text. + */ +interface ToggleMultilevelListCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleMultilevelListCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Bulleted and Numbering dialog. + */ +interface OpenNumberingListDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenNumberingListDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Customize Numbered List dialog. + */ +interface OpenCustomNumberingListDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenCustomNumberingListDialogCommand command by applying the specified setting. 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 abstractNumberingListIndex An integer value specifying index of abstract numbering list. + */ + execute(abstractNumberingListIndex: number): boolean; +} +/** + * A command to customize the numbered list parameters. + */ +interface ChangeCustomNumberingListCommand extends CommandBase { + /** + * Executes the ChangeCustomNumberingListCommand command by applying the specified settings. 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 abstractNumberingListIndex An integer value specifying the numbering list index. + * @param listLevelSettings An array of ListLevelSettings objects defining settings for list levels. + */ + execute(abstractNumberingListIndex: number, listLevelSettings: ListLevelSettings[]): boolean; + /** + * Gets information about the command state. + * @param abstractNumberingListIndex An integer value specifying the index of the abstract numbering list item whose state to return. + */ + getState(abstractNumberingListIndex: number): any; +} +/** + * A command to restart the numbering list. + */ +interface RestartNumberingListCommand extends CommandWithSimpleStateBase { + /** + * Executes the RestartNumberingListCommand 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. + */ + execute(): boolean; +} +/** + * A command to increment the indent level of paragraphs in a selected numbered list. + */ +interface IncrementNumberingIndentCommand extends CommandWithSimpleStateBase { + /** + * Executes the IncrementNumberingIndentCommand 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. + */ + execute(): boolean; +} +/** + * A command to decrement the indent level of paragraphs in a selected numbered list. + */ +interface DecrementNumberingIndentCommand extends CommandWithSimpleStateBase { + /** + * Executes the DecrementNumberingIndentCommand 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. + */ + execute(): boolean; +} +/** + * A command to continue the list's numbering. + */ +interface ContinueNumberingListCommand extends CommandWithSimpleStateBase { + /** + * Executes the ContinueNumberingListCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert numeration to a paragraph making it a numbering list item. + */ +interface InsertNumerationCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertNumerationCommand command by applying the specified setting. 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 abstractNumberingListIndex An integer value specifying index of abstract numbering list. + */ + execute(abstractNumberingListIndex: number): boolean; + /** + * Executes the InsertNumerationCommand command by applying the specified settings. 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 numberingListIndex An integer value specifying index of numbering list. + * @param isAbstractNumberingList true, to insert an abstract numbering list; otherwise, false. + */ + execute(numberingListIndex: number, isAbstractNumberingList: boolean): boolean; +} +/** + * A command to remove the selected numeration. + */ +interface RemoveNumerationCommand extends CommandWithSimpleStateBase { + /** + * Executes the RemoveNumerationCommand 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. + */ + execute(): boolean; +} +/** + * Contains settings to define individual bulleted or numbered list levels. + */ +interface ListLevelSettings { + /** + * Gets or sets the pattern used to format the list level for display purposes. + * Value: A string value specifying the format pattern. + */ + displayFormatString: string; + /** + * Gets or sets the numbering format used for the current list level's paragraph. + * Value: One of the values. + */ + format: any; + /** + * Gets the list level item's start position in the document. + * Value: An integer value specifying the start position. + */ + start: number; + /** + * Gets or sets the paragraph text alignment within numbered list levels. + * Value: One of the values. + */ + alignment: any; + separator: string; + /** + * Gets or sets the left indent for text within the current list level's paragraph. + * Value: An integer value specifying the left indent. + */ + leftIndent: number; + /** + * Gets or sets a value specifying the indent of the first line of the current list level's paragraph. + * Value: An integer value specifying the indent. + */ + firstLineIndent: number; + /** + * Gets or sets a value specifying whether and how the first line of the current list level's paragraph is indented. + * Value: One of the values. + */ + firstLineIndentType: any; + /** + * Gets or sets the font name of the current list level's paragraph. + * Value: A string value specifying the font name. + */ + fontName: string; + /** + * Gets or sets the font color of the current list level's paragraph. + * Value: A string value specifying the font color. + */ + fontColor: string; + /** + * Gets or sets the font size of the current list level's paragraph. + * Value: An integer value specifying the font size. + */ + fontSize: number; + /** + * Gets or sets whether the font formatting of the current list level's paragraph is bold. + * Value: true, if the font formatting is bold; otherwise, false. + */ + fontBold: boolean; + /** + * Gets or sets whether the font formatting of the current list level's paragraph is italic. + * Value: true, if the font formatting is italic; otherwise, false. + */ + fontItalic: boolean; +} +declare enum ListLevelFormat { + Decimal=0, + AIUEOHiragana=1, + AIUEOFullWidthHiragana=2, + ArabicAbjad=3, + ArabicAlpha=4, + Bullet=5, + CardinalText=6, + Chicago=7, + ChineseCounting=8, + ChineseCountingThousand=9, + ChineseLegalSimplified=10, + Chosung=11, + DecimalEnclosedCircle=12, + DecimalEnclosedCircleChinese=13, + DecimalEnclosedFullstop=14, + DecimalEnclosedParentheses=15, + DecimalFullWidth=16, + DecimalFullWidth2=17, + DecimalHalfWidth=18, + DecimalZero=19, + Ganada=20, + Hebrew1=21, + Hebrew2=22, + Hex=23, + HindiConsonants=24, + HindiDescriptive=25, + HindiNumbers=26, + HindiVowels=27, + IdeographDigital=28, + IdeographEnclosedCircle=29, + IdeographLegalTraditional=30, + IdeographTraditional=31, + IdeographZodiac=32, + IdeographZodiacTraditional=33, + Iroha=34, + IrohaFullWidth=35, + JapaneseCounting=36, + JapaneseDigitalTenThousand=37, + JapaneseLegal=38, + KoreanCounting=39, + KoreanDigital=40, + KoreanDigital2=41, + KoreanLegal=42, + LowerLetter=43, + LowerRoman=44, + None=45, + NumberInDash=46, + Ordinal=47, + OrdinalText=48, + RussianLower=49, + RussianUpper=50, + TaiwaneseCounting=51, + TaiwaneseCountingThousand=52, + TaiwaneseDigital=53, + ThaiDescriptive=54, + ThaiLetters=55, + ThaiNumbers=56, + UpperLetter=57, + UpperRoman=58, + VietnameseDescriptive=59 +} +declare enum ListLevelNumberAlignment { + Left=0, + Center=1, + Right=2 +} +/** + * A command to invoke the Insert Image dialog. + */ +interface OpenInsertPictureDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenInsertPictureDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a picture from a file. + */ +interface InsertPictureCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertPictureCommand command by applying the specified setting. 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 imageUrl A string value specifying picture's Url. + */ + execute(imageUrl: string): boolean; +} +/** + * A command to invoke the Symbols dialog. + */ +interface OpenInsertSymbolDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenInsertSymbolDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a character into the document. + */ +interface InsertSymbolCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertSymbolCommand command by applying the specified settings. 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 symbol A string value specifying symbols to insert. + * @param fontName A string value specifying font of symbols to insert. + */ + execute(symbol: string, fontName: string): boolean; +} +/** + * A command to insert a paragraph break at the current position in the document. + */ +interface InsertParagraphCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertParagraphCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert text at the current position in the document. + */ +interface InsertTextCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTextCommand command by applying the specified setting. 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 text A string value specifying text to insert. + */ + execute(text: string): boolean; +} +/** + * A command to delete the text in a selected range. + */ +interface DeleteCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteCommand 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. + */ + execute(): boolean; +} +/** + * A command to move the cursor backwards and erase the character in that space. + */ +interface BackspaceCommand extends CommandWithSimpleStateBase { + /** + * Executes the BackspaceCommand 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. + */ + execute(): boolean; +} +/** + * A command to scale pictures in a selected range. + */ +interface ChangePictureScaleCommand extends CommandBase { + /** + * Executes the ChangePictureScaleCommand command by applying the specified setting. 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 scale A Scale object specifying scaling of the picture. + */ + execute(scale: Scale): boolean; + /** + * Executes the ChangePictureScaleCommand command by applying the specified settings. 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 x An interger number specifying width of the picture + * @param y An interger number specifying height of the picture + */ + execute(x: number, y: number): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to move the selected range to a specific position in the document. + */ +interface MoveContentCommand extends CommandWithSimpleStateBase { + /** + * Executes the MoveContentCommand command by applying the specified setting. 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 position An integer value specifying position to insert selected text. + */ + execute(position: number): boolean; +} +/** + * A command to copy the selected text and place it to the specified position. + */ +interface CopyContentCommand extends CommandWithSimpleStateBase { + /** + * Executes the CopyContentCommand command by applying the specified setting. 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 position An integer number value specifying position for pasting selected text. + */ + execute(position: number): boolean; +} +/** + * A command to insert a tab character at the current position in the document. + */ +interface InsertTabCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTabCommand 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. + */ + execute(): boolean; +} +/** + * Defines the scaling settings. + */ +interface Scale { + x: number; + y: number; +} +/** + * A command to change page margin settings. + */ +interface ChangePageMarginsCommand extends CommandBase { + /** + * Executes the ChangePageMarginsCommand command by applying the specified settings. 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 left An integer number specifying left margin of the page. + * @param top An integer number specifying top margin of the page. + * @param right An integer number specifying right margin of the page. + * @param bottom An integer number specifying bottom margin of the page. + */ + execute(left: number, top: number, right: number, bottom: number): boolean; + /** + * Executes the ChangePageMarginsCommand command by applying the specified setting. 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 margins A Margins object specifying page margin settings. + */ + execute(margins: Margins): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to invoke the Margins tab of the Page Setup dialog. + */ +interface OpenPageMarginsDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenPageMarginsDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the page orientation. + */ +interface ChangePageOrientationCommand extends CommandBase { + /** + * + * @param isPortrait + */ + execute(isPortrait: any): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to invoke the Paper tab of the Page Setup dialog. + */ +interface OpenPagePaperSizeDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenPagePaperSizeDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to set the page size. + */ +interface SetPageSizeDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the SetPageSizeDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the page size. + */ +interface ChangePageSizeCommand extends CommandBase { + /** + * Executes the ChangePageSizeCommand command by applying the specified settings. 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 width An integer number specifying width of the page. + * @param height An integer number specifying height of the page. + */ + execute(width: number, height: number): boolean; + /** + * Executes the ChangePageSizeCommand command by applying the specified setting. 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 size A Size object specifying the page size settings. + */ + execute(size: Size): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the number of section columns having the same width. + */ +interface ChangeSectionEqualColumnCountCommand extends CommandBase { + /** + * Executes the ChangeSectionEqualColumnCountCommand command by applying the specified setting. 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 columnCount An interger number specifying the number of section columns having the same width. + */ + execute(columnCount: number): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to invoke the Columns dialog. + */ +interface OpenSectionColumnsDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenSectionColumnsDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the settings of individual section columns. + */ +interface ChangeSectionColumnsCommand extends CommandBase { + /** + * + * @param columns + */ + execute(columns: SectionColumn[]): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the background color of the page. + */ +interface ChangePageColorCommand extends CommandBase { + /** + * Executes the ChangePageColorCommand command by applying the specified setting. 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 color A string specifying background color of the page. May be specified as color name or hex color value. + */ + execute(color: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to activate the page header and begin editing. + */ +interface InsertHeaderCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertHeaderCommand 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. + */ + execute(): boolean; +} +/** + * A command to activate the page footer and begin editing. + */ +interface InsertFooterCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertFooterCommand 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. + */ + execute(): boolean; +} +/** + * A command to link a header/footer to the previous section, so it has the same content. + */ +interface LinkHeaderFooterToPreviousCommand extends CommandWithSimpleStateBase { + /** + * Executes the LinkHeaderFooterToPreviousCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the page footer from the page header in the header/footer editing mode. + */ +interface GoToFooterCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToFooterCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the page header from the page footer in the header/footer editing mode. + */ +interface GoToHeaderCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToHeaderCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the next page header or footer in the header/footer editing mode. + */ +interface GoToNextHeaderFooterCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToNextHeaderFooterCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the previous page header or footer in the header/footer editing mode. + */ +interface GoToPreviousHeaderFooterCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToPreviousHeaderFooterCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the header/footer edit mode, so it allows creation of a different header or footer for the first page of a document or section. + */ +interface SetDifferentFirstPageHeaderFooterCommand extends CommandWithBooleanStateBase { + /** + * Executes the SetDifferentFirstPageHeaderFooterCommand 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. + */ + execute(): boolean; + /** + * Executes the SetDifferentFirstPageHeaderFooterCommand command by applying the specified setting. 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 differentFirstPage true to apply different text for first page's header and footer, false to remove difference. + */ + execute(differentFirstPage: boolean): boolean; +} +/** + * A command to change the header/footer edit mode so it allows creation of a different header or footer for odd and even pages of a document or section. + */ +interface SetDifferentOddAndEvenPagesHeaderFooterCommand extends CommandWithBooleanStateBase { + /** + * Executes the SetDifferentOddAndEvenPagesHeaderFooterCommand 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. + */ + execute(): boolean; + /** + * Executes the SetDifferentOddAndEvenPagesHeaderFooterCommand command by applying the specified setting. 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 differentOddAndEvenPages true to apply different text for odd and even pages' header and footer, false to remove difference. + */ + execute(differentOddAndEvenPages: boolean): boolean; +} +/** + * A command to finish header/footer editing. + */ +interface CloseHeaderFooterCommand extends CommandWithSimpleStateBase { + /** + * Executes the CloseHeaderFooterCommand 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. + */ + execute(): boolean; +} +/** + * Defines a section column in the document. + */ +interface SectionColumn { + /** + * Gets or sets the width of the section column. + * Value: An integer value specifying the section column width. + */ + width: number; + /** + * Gets or sets the amount of space between adjacent section columns. + * Value: An integer value specifying the spacing between section columns. + */ + spacing: number; +} +/** + * Defines the size settings. + */ +interface Size { + /** + * Gets or sets the width value. + * Value: An integer value specifying the width. + */ + width: number; + /** + * Gets or sets the height value. + * Value: An integer value specifying the height. + */ + height: number; +} +/** + * Defines the margin settings. + */ +interface Margins { + /** + * Gets or sets the left margin. + * Value: An integer value specifying the left margin. + */ + left: number; + /** + * Gets or sets the top margin. + * Value: An integer value specifying the top margin. + */ + top: number; + /** + * Gets or sets the right margin. + * Value: An integer value specifying the right margin. + */ + right: number; + /** + * Gets or sets the bottom margin. + * Value: An integer value specifying the bottom margin. + */ + bottom: number; +} +declare enum Orientation { + Landscape=0, + Portrait=1 +} +/** + * A command to increment the indent level of paragraphs in a selected range. + */ +interface IncreaseIndentCommand extends CommandWithSimpleStateBase { + /** + * Executes the IncreaseIndentCommand 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. + */ + execute(): boolean; +} +/** + * A command to decrement the indent level of paragraphs in a selected range. + */ +interface DecreaseIndentCommand extends CommandWithSimpleStateBase { + /** + * Executes the DecreaseIndentCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle the visibility of hidden symbols. + */ +interface ShowHiddenSymbolsCommand extends CommandWithBooleanStateBase { + /** + * Executes the ShowHiddenSymbolsCommand 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. + */ + execute(): boolean; + /** + * Executes the ShowHiddenSymbolsCommand command by applying the specified setting. 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 show true to display hidden symbols; otherwise, false. + */ + execute(show: boolean): boolean; +} +/** + * A command to toggle left paragraph alignment on and off. + */ +interface ToggleParagraphAlignmentLeftCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleParagraphAlignmentLeftCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle centered paragraph alignment on and off. + */ +interface ToggleParagraphAlignmentCenterCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleParagraphAlignmentCenterCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle right paragraph alignment on and off. + */ +interface ToggleParagraphAlignmentRightCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleParagraphAlignmentRightCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle justified paragraph alignment on and off. + */ +interface ToggleParagraphAlignmentJustifyCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleParagraphAlignmentJustifyCommand 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. + */ + execute(): boolean; +} +/** + * A command to format a current paragraph with single line spacing. + */ +interface SetSingleParagraphSpacingCommand extends CommandWithBooleanStateBase { + /** + * Executes the SetSingleParagraphSpacingCommand 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. + */ + execute(): boolean; +} +/** + * A command to format a current paragraph with one and a half line spacing. + */ +interface SetSesquialteralParagraphSpacingCommand extends CommandWithBooleanStateBase { + /** + * Executes the SetSesquialteralParagraphSpacingCommand 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. + */ + execute(): boolean; +} +/** + * A command to format a current paragraph with double line spacing. + */ +interface SetDoubleParagraphSpacingCommand extends CommandWithBooleanStateBase { + /** + * Executes the SetDoubleParagraphSpacingCommand 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. + */ + execute(): boolean; +} +/** + * A command to add spacing before a paragraph. + */ +interface AddSpacingBeforeParagraphCommand extends CommandWithSimpleStateBase { + /** + * Executes the AddSpacingBeforeParagraphCommand 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. + */ + execute(): boolean; +} +/** + * A command to add spacing after a paragraph. + */ +interface AddSpacingAfterParagraphCommand extends CommandWithSimpleStateBase { + /** + * Executes the AddSpacingAfterParagraphCommand 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. + */ + execute(): boolean; +} +/** + * A command to remove spacing before the selected paragraph. + */ +interface RemoveSpacingBeforeParagraphCommand extends CommandWithSimpleStateBase { + /** + * Executes the RemoveSpacingBeforeParagraphCommand 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. + */ + execute(): boolean; +} +/** + * A command to remove spacing after the selected paragraph. + */ +interface RemoveSpacingAfterParagraphCommand extends CommandWithSimpleStateBase { + /** + * Executes the RemoveSpacingAfterParagraphCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the background color of paragraphs in a selected range. + */ +interface ChangeParagraphBackColorCommand extends CommandBase { + /** + * Executes the ChangeParagraphBackColorCommand command by applying the specified setting. 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 color A string specifying highlighting color of the paragraphs in a selected range. May be specified as color name or hex color value. + */ + execute(color: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to invoke the Paragraph dialog allowing end-users to set paragraph formatting. + */ +interface OpenParagraphFormattingDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenParagraphFormattingDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the formatting of paragraphs in a selected range. + */ +interface ChangeParagraphFormattingCommand extends CommandBase { + /** + * Executes the ChangeParagraphFormattingCommand command by applying the specified setting. 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 settings A ParagraphFormattingSettings object specifying paragraph formatting settings. + */ + execute(settings: ParagraphFormattingSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to increment the left indentation of paragraphs in a selected range. + */ +interface IncrementParagraphLeftIndentCommand extends CommandWithSimpleStateBase { + /** + * Executes the IncrementParagraphLeftIndentCommand 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. + */ + execute(): boolean; +} +/** + * A command to decrement the left indentation of paragraphs in a selected range. + */ +interface DecrementParagraphLeftIndentCommand extends CommandWithSimpleStateBase { + /** + * Executes the DecrementParagraphLeftIndentCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Tabs paragraph dialog. + */ +interface OpenTabsDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenTabsDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to change paragraph tab stops. + */ +interface ChangeTabsCommand extends CommandBase { + /** + * Executes the ChangeTabsCommand command by applying the specified setting. 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 settings A TabsSettings object maintaining the information about tab stops. + */ + execute(settings: TabsSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * Contains the information about tab stops. + */ +interface TabsSettings { + /** + * Gets or sets the default tab stop value. + * Value: An integer value specifying the default tab stop. + */ + defaultTabStop: number; + /** + * Gets or sets a list of tab stops. + * Value: An array of TabSettings objects containing individual tab stop settings. + */ + tabs: TabSettings[]; +} +/** + * Contains settings of a tab stop. + */ +interface TabSettings { + /** + * Gets or sets the alignment type, specifying how any text after the tab will be lined up. + * Value: One of the values. + */ + alignment: any; + /** + * Gets or sets the tab leader style, i.e., the symbol used as a tab leader. + * Value: One of the values. + */ + leader: any; + /** + * Gets or sets the position of the tab stop. + * Value: A number representing the distance from the left edge of the text area. + */ + position: number; + /** + * Gets or sets whether the individual tab stop is in effect. + * Value: true to switch off this tab stop; otherwise, false. + */ + deleted: boolean; +} +declare enum TabAlign { + Left=0, + Center=1, + Right=2, + Decimal=3 +} +declare enum TabLeaderType { + None=0, + Dots=1, + MiddleDots=2, + Hyphens=3, + Underline=4, + ThickLine=5, + EqualSign=6 +} +/** + * Contains settings to define the paragraph formatting. + */ +interface ParagraphFormattingSettings { + /** + * Gets or sets the paragraph alignment. + * Value: One of the values. + */ + alignment: any; + /** + * Gets or sets the outline level of a paragraph. + * Value: An integer specifying the level number. + */ + outlineLevel: number; + /** + * Gets or sets the right indent value for the specified paragraph. + * Value: An integer value specifying the right indent. + */ + rightIndent: number; + /** + * Gets or sets the spacing before the current paragraph. + * Value: An integer value specifying the spacing before the paragraph. + */ + spacingBefore: number; + /** + * Gets or sets the spacing after the current paragraph. + * Value: An integer value specifying the spacing after the paragraph. + */ + spacingAfter: number; + /** + * Gets or sets a value which determines the spacing between lines in a paragraph. + * Value: One of the values. + */ + lineSpacingType: any; + /** + * Gets or sets a value specifying whether and how the first line of a paragraph is indented. + * Value: One of the values. + */ + firstLineIndentType: any; + /** + * Gets or sets a value specifying the indent of the first line of a paragraph. + * Value: An integer value specifying the indent of the first line. + */ + firstLineIndent: number; + /** + * Gets or sets whether to suppress addition of additional space (contextual spacing) between paragraphs of the same style. + * Value: true to remove extra spacing between paragraphs, false to add extra space. + */ + contextualSpacing: boolean; + /** + * Gets or sets whether to prevent all page breaks that interrupt a paragraph. + * Value: true, to keep paragraph lines together; otherwise, false. + */ + keepLinesTogether: boolean; + /** + * Gets or sets whether a page break is inserted automatically before a specified paragraph(s). + * Value: true, if a page break is inserted automatically before a paragraph(s); otherwise, false. + */ + pageBreakBefore: boolean; + /** + * Gets or sets the left indent for text within a paragraph. + * Value: An integer value specifying the left indent. + */ + leftIndent: number; + /** + * Gets or sets a line spacing value. + * Value: An integer value specifying the line spacing. + */ + lineSpacing: number; + /** + * Gets or sets the paragraph background color. + * Value: A string value specifying the background color. + */ + backColor: string; +} +declare enum ParagraphAlignment { + Left=0, + Right=1, + Center=2, + Justify=3 +} +declare enum ParagraphLineSpacingType { + Single=0, + Sesquialteral=1, + Double=2, + Multiple=3, + Exactly=4, + AtLeast=5 +} +declare enum ParagraphFirstLineIndent { + None=0, + Indented=1, + Hanging=2 +} +interface AssignShortcutCommand extends CommandWithSimpleStateBase { + execute(keyCode: number, callback: (arg1: string) => void): boolean; +} +interface OpenSpellingDialogCommand extends CommandWithSimpleStateBase { + execute(): boolean; +} +/** + * A command to invoke the Insert Table dialog. + */ +interface OpenInsertTableDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenInsertTableDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Insert Table dialog. + */ +interface InsertTableCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableCommand command by applying the specified settings. 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 columnCount An integer value specifying number of columns in a generated table. + * @param rowCount An integer value specifying number of rows in a generated table. + */ + execute(columnCount: number, rowCount: number): boolean; +} +/** + * A command to invoke the Table Properties dialog. + */ +interface OpenTableFormattingDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenTableFormattingDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the selected table's formatting. + */ +interface ChangeTableFormattingCommand extends CommandBase { + /** + * Executes the ChangeTableFormattingCommand command by applying the specified setting. 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 settings A TableFormattingSettings object containing the settings to format a table. + */ + execute(settings: TableFormattingSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the selected table's preferred row height. + */ +interface ChangeTableRowPreferredHeightCommand extends CommandBase { + /** + * Executes the ChangeTableRowPreferredHeightCommand command by applying the specified setting. 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 preferredHeight A TableHeightUnit object specifying preferred height of the selected table rows. + */ + execute(preferredHeight: TableHeightUnit): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the preferred cell width of the selected table rows. + */ +interface ChangeTableCellPreferredWidthCommand extends CommandBase { + /** + * Executes the ChangeTableCellPreferredWidthCommand command by applying the specified setting. 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 preferredWidth A TableWidthUnit object specifying preferred width of the selected table rows. + */ + execute(preferredWidth: TableWidthUnit): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the selected table's preferred column width. + */ +interface ChangeTableColumnPreferredWidthCommand extends CommandBase { + /** + * Executes the ChangeTableColumnPreferredWidthCommand command by applying the specified setting. 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 preferredWidth A TableWidthUnit object specifying preferred width of the selected table columns. + */ + execute(preferredWidth: TableWidthUnit): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the cell formatting of the selected table elements. + */ +interface ChangeTableCellFormattingCommand extends CommandBase { + /** + * Executes the ChangeTableCellFormattingCommand command by applying the specified setting. 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 settings A TableFormattingSettings object specifying cell formatting of the selected table elements. + */ + execute(settings: TableCellFormattingSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to insert a table column to the left of the current position in the table. + */ +interface InsertTableColumnToTheLeftCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableColumnToTheLeftCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a table column to the right of the current position in the table. + */ +interface InsertTableColumnToTheRightCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableColumnToTheRightCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a row in a table below the selected row. + */ +interface InsertTableRowBelowCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableRowBelowCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a row in a table above the selected row. + */ +interface InsertTableRowAboveCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableRowAboveCommand 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. + */ + execute(): boolean; +} +/** + * A command to delete the selected table rows. + */ +interface DeleteTableRowsCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteTableRowsCommand 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. + */ + execute(): boolean; +} +/** + * A command to delete the selected table columns. + */ +interface DeleteTableColumnsCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteTableColumnsCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert table cells with a horizontal shift into the selected table. + */ +interface InsertTableCellWithShiftToTheLeftCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableCellWithShiftToTheLeftCommand 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. + */ + execute(): boolean; +} +/** + * A command to delete the selected table cells with a horizontal shift. + */ +interface DeleteTableCellsWithShiftHorizontallyCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteTableCellsWithShiftHorizontallyCommand 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. + */ + execute(): boolean; +} +/** + * A command to delete the selected table cells with a vertical shift. + */ +interface DeleteTableCellsWithShiftVerticallyCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteTableCellsWithShiftVerticallyCommand 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. + */ + execute(): boolean; +} +/** + * A command to delete the selected table. + */ +interface DeleteTableCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteTableCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Insert Cells dialog. + */ +interface InsertTableCellsDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableCellsDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Delete Cells dialog. + */ +interface DeleteTableCellsDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteTableCellsDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to merge the selected table cells. + */ +interface MergeTableCellsCommand extends CommandWithSimpleStateBase { + /** + * Executes the MergeTableCellsCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Split Cells dialog. + */ +interface SplitTableCellsDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the SplitTableCellsDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to split the selected table cells based on the specified options. + */ +interface SplitTableCellsCommand extends CommandWithSimpleStateBase { + /** + * Executes the SplitTableCellsCommand command by applying the specified settings. 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 rowCount An integer value specifying number of rows in the splitted table cells. + * @param columnCount An integer value specifying number of columns in the splitted table cells. + * @param mergeBeforeSplit true to merge the selected cells before splitting; otherwise, false. + */ + execute(rowCount: number, columnCount: number, mergeBeforeSplit: boolean): boolean; +} +/** + * A command to insert table cells with a vertical shift into the selected table. + */ +interface InsertTableCellsWithShiftToTheVerticallyCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableCellsWithShiftToTheVerticallyCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Borders and Shading table dialog. + */ +interface OpenTableBordersAndShadingDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenTableBordersAndShadingDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to change borders and shading of the selected table elements. + */ +interface ChangeTableBordersAndShadingCommand extends CommandBase { + /** + * Executes the ChangeTableBordersAndShadingCommand command by applying the specified settings. 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 settings A TableBorderSettings object with settings specifying table borders. + * @param applyToWholeTable true to apply the border settings to the whole table, false to apply the border settings to the selected cells. + */ + execute(settings: TableBordersSettings, applyToWholeTable: boolean): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to apply top-left alignment for the selected table cells. + */ +interface ToggleTableCellAlignTopLeftCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignTopLeftCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply top-center alignment for the selected table cells. + */ +interface ToggleTableCellAlignTopCenterCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignTopCenterCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply top-right alignment for the selected table cells. + */ +interface ToggleTableCellAlignTopRightCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignTopRightCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply middle-left alignment for the selected table cells. + */ +interface ToggleTableCellAlignMiddleLeftCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignMiddleLeftCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply middle-center alignment for the selected table cells. + */ +interface ToggleTableCellAlignMiddleCenterCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignMiddleCenterCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply middle-right alignment for the selected table cells. + */ +interface ToggleTableCellAlignMiddleRightCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignMiddleRightCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply bottom-left alignment for the selected table cells. + */ +interface ToggleTableCellAlignBottomLeftCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignBottomLeftCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply bottom-center alignment for the selected table cells. + */ +interface ToggleTableCellAlignBottomCenterCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignBottomCenterCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply bottom-right alignment for the selected table cells. + */ +interface ToggleTableCellAlignBottomRightCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignBottomRightCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the selected table's style. + */ +interface ChangeTableStyleCommand extends CommandBase { + /** + * Executes the ChangeTableStyleCommand command by applying the specified setting. 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 style A TableStyle object specifying the style applying to the table. + */ + execute(style: TableStyle): boolean; + /** + * Executes the ChangeTableStyleCommand command by applying the specified setting. 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 styleName A string specifying the name of style applying to the table. + */ + execute(styleName: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to toggle top borders for selected cells on/off. + */ +interface ToggleTableCellTopBorderCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellTopBorderCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle right borders for selected cells on/off. + */ +interface ToggleTableCellRightBorderCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellRightBorderCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle bottom borders for selected cells on/off. + */ +interface ToggleTableCellBottomBorderCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellBottomBorderCommand 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. + */ + execute(): boolean; +} +interface ToggleTableCellLeftBorderCommand extends CommandWithBooleanStateBase { + execute(): boolean; +} +/** + * A command to remove the borders of the selected table cells. + */ +interface RemoveTableCellBordersCommand extends CommandWithSimpleStateBase { + /** + * Executes the RemoveTableCellBordersCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle all borders for selected cells on/off. + */ +interface ToggleTableCellAllBordersCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAllBordersCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle inner borders for selected cells on/off. + */ +interface ToggleTableCellInsideBordersCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellInsideBordersCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle inner horizontal borders for selected cells on/off. + */ +interface ToggleTableCellInsideHorizontalBordersCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellInsideHorizontalBordersCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle inner vertical borders for selected cells on/off. + */ +interface ToggleTableCellInsideVerticalBordersCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellInsideVerticalBordersCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle outer borders for selected cells on/off. + */ +interface ToggleTableCellOutsideBordersCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellOutsideBordersCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the selected table's style options. + */ +interface ChangeTableLookCommand extends CommandBase { + /** + * Executes the ChangeTableLookCommand command by applying the specified setting. 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 settings A TableLookSettings object containing the settings that modify the table appearance. + */ + execute(settings: TableLookSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the repository item's table border style. + */ +interface ChangeTableBorderRepositoryItemCommand extends CommandBase { + /** + * Executes the ChangeTableBorderRepositoryItemCommand command by applying the specified setting. 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 settings A TableBorderSettings object specifying the repository item's table border style. + */ + execute(settings: TableBorderSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change cell shading in the selected table elements. + */ +interface ChangeTableCellShadingCommand extends CommandBase { + /** + * Executes the ChangeTableCellShadingCommand command by applying the specified setting. 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 color A string specifying color of the selected cells' shading. May be specified as color name or hex color value. + */ + execute(color: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to toggle the display of grid lines for a table with no borders applied - on/off. + */ +interface ShowTableGridLinesCommand extends CommandWithBooleanStateBase { + /** + * Executes the ShowTableGridLinesCommand 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. + */ + execute(): boolean; + /** + * Executes the ShowTableGridLinesCommand command by applying the specified setting. 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 showTableGridLines true to display grid lines of the table, false to hide grid lines of the table. + */ + execute(showTableGridLines: boolean): boolean; +} +/** + * Contains the table style settings that modify the table appearance. + */ +interface TableLookSettings { + /** + * Gets or sets a value specifying whether special formatting is applied to the first row of the table. + * Value: true, to apply the formatting; otherwise, false. + */ + applyFirstRow: boolean; + /** + * Gets or sets a value specifying whether special formatting is applied to the last row of the table. + * Value: true, to apply the formatting; otherwise, false. + */ + applyLastRow: boolean; + /** + * Gets or sets a value specifying whether special formatting is applied to the first column of the table. + * Value: true, to apply the formatting; otherwise, false. + */ + applyFirstColumn: boolean; + /** + * Gets or sets a value specifying whether special formatting is applied to the last column of the table. + * Value: true, to apply the formatting; otherwise, false. + */ + applyLastColumn: boolean; + /** + * Gets or sets a value specifying whether row banding formatting is not applied to the table. + * Value: true, to apply the formatting; otherwise, false. + */ + doNotApplyRowBanding: boolean; + /** + * Gets or sets a value specifying whether column banding formatting is not applied to the table. + * Value: true, to apply the formatting; otherwise, false. + */ + doNotApplyColumnBanding: boolean; +} +/** + * Contains settings to define table borders. + */ +interface TableBordersSettings { + /** + * Gets or sets the top border's settings. + * Value: A TableBorderSettings object containing the table border settings. + */ + top: TableBorderSettings; + /** + * Gets or sets the right border's settings. + * Value: A TableBorderSettings object containing the table border settings. + */ + right: TableBorderSettings; + /** + * Gets or sets the bottom border's settings. + * Value: A TableBorderSettings object containing the table border settings. + */ + bottom: TableBorderSettings; + /** + * Gets or sets the left border's settings. + * Value: A TableBorderSettings object containing the table border settings. + */ + left: TableBorderSettings; + /** + * Gets or sets the inside horizontal border's settings. + * Value: A TableBorderSettings object containing the table border settings. + */ + insideHorizontal: TableBorderSettings; + /** + * Gets or sets the inside vertical border's settings. + * Value: A TableBorderSettings object containing the table border settings. + */ + insideVertical: TableBorderSettings; + /** + * Gets or sets the background color of table borders. + * Value: A string value specifying the background color. + */ + backgroundColor: string; +} +/** + * Contains settings to define a table border. + */ +interface TableBorderSettings { + /** + * Gets or sets the border color. + * Value: A string value specifying the border color. + */ + color: string; + /** + * Gets or sets the border line width. + * Value: An integer value defining the border line width. + */ + width: number; + /** + * Gets or sets the border line style. + * Value: A object defining the border line style. + */ + style: any; +} +declare enum BorderLineStyle { + None=0, + Single=1, + Thick=2, + Double=3, + Dotted=4, + Dashed=5, + DotDash=6, + DotDotDash=7, + Triple=8, + ThinThickSmallGap=9, + ThickThinSmallGap=10, + ThinThickThinSmallGap=11, + ThinThickMediumGap=12, + ThickThinMediumGap=13, + ThinThickThinMediumGap=14, + ThinThickLargeGap=15, + ThickThinLargeGap=16, + ThinThickThinLargeGap=17, + Wave=18, + DoubleWave=19, + DashSmallGap=20, + DashDotStroked=21, + ThreeDEmboss=22, + ThreeDEngrave=23, + Outset=24, + Inset=25, + Apples=26, + ArchedScallops=27, + BabyPacifier=28, + BabyRattle=29, + Balloons3Colors=30, + BalloonsHotAir=31, + BasicBlackDashes=32, + BasicBlackDots=33, + BasicBlackSquares=34, + BasicThinLines=35, + BasicWhiteDashes=36, + BasicWhiteDots=37, + BasicWhiteSquares=38, + BasicWideInline=39, + BasicWideMidline=40, + BasicWideOutline=41, + Bats=42, + Birds=43, + BirdsFlight=44, + Cabins=45, + CakeSlice=46, + CandyCorn=47, + CelticKnotwork=48, + CertificateBanner=49, + ChainLink=50, + ChampagneBottle=51, + CheckedBarBlack=52, + CheckedBarColor=53, + Checkered=54, + ChristmasTree=55, + CirclesLines=56, + CirclesRectangles=57, + ClassicalWave=58, + Clocks=59, + Compass=60, + Confetti=61, + ConfettiGrays=62, + ConfettiOutline=63, + ConfettiStreamers=64, + ConfettiWhite=65, + CornerTriangles=66, + CouponCutoutDashes=67, + CouponCutoutDots=68, + CrazyMaze=69, + CreaturesButterfly=70, + CreaturesFish=71, + CreaturesInsects=72, + CreaturesLadyBug=73, + CrossStitch=74, + Cup=75, + DecoArch=76, + DecoArchColor=77, + DecoBlocks=78, + DiamondsGray=79, + DoubleD=80, + DoubleDiamonds=81, + Earth1=82, + Earth2=83, + EclipsingSquares1=84, + EclipsingSquares2=85, + EggsBlack=86, + Fans=87, + Film=88, + Firecrackers=89, + FlowersBlockPrint=90, + FlowersDaisies=91, + FlowersModern1=92, + FlowersModern2=93, + FlowersPansy=94, + FlowersRedRose=95, + FlowersRoses=96, + FlowersTeacup=97, + FlowersTiny=98, + Gems=99, + GingerbreadMan=100, + Gradient=101, + Handmade1=102, + Handmade2=103, + HeartBalloon=104, + HeartGray=105, + Hearts=106, + HeebieJeebies=107, + Holly=108, + HouseFunky=109, + Hypnotic=110, + IceCreamCones=111, + LightBulb=112, + Lightning1=113, + Lightning2=114, + MapleLeaf=115, + MapleMuffins=116, + MapPins=117, + Marquee=118, + MarqueeToothed=119, + Moons=120, + Mosaic=121, + MusicNotes=122, + Northwest=123, + Ovals=124, + Packages=125, + PalmsBlack=126, + PalmsColor=127, + PaperClips=128, + Papyrus=129, + PartyFavor=130, + PartyGlass=131, + Pencils=132, + People=133, + PeopleHats=134, + PeopleWaving=135, + Poinsettias=136, + PostageStamp=137, + Pumpkin1=138, + PushPinNote1=139, + PushPinNote2=140, + Pyramids=141, + PyramidsAbove=142, + Quadrants=143, + Rings=144, + Safari=145, + Sawtooth=146, + SawtoothGray=147, + ScaredCat=148, + Seattle=149, + ShadowedSquares=150, + SharksTeeth=151, + ShorebirdTracks=152, + Skyrocket=153, + SnowflakeFancy=154, + Snowflakes=155, + Sombrero=156, + Southwest=157, + Stars=158, + Stars3d=159, + StarsBlack=160, + StarsShadowed=161, + StarsTop=162, + Sun=163, + Swirligig=164, + TornPaper=165, + TornPaperBlack=166, + Trees=167, + TriangleParty=168, + Triangles=169, + Tribal1=170, + Tribal2=171, + Tribal3=172, + Tribal4=173, + Tribal5=174, + Tribal6=175, + TwistedLines1=176, + TwistedLines2=177, + Vine=178, + Waveline=179, + WeavingAngles=180, + WeavingBraid=181, + WeavingRibbon=182, + WeavingStrips=183, + WhiteFlowers=184, + Woodwork=185, + XIllusions=186, + ZanyTriangles=187, + ZigZag=188, + ZigZagStitch=189, + Nil=-1 +} +/** + * Contains the settings to define the table cell formatting. + */ +interface TableCellFormattingSettings { + /** + * Gets or sets a table cell's preferred width. + * Value: A object specifying the preferred cell width. + */ + preferredWidth: TableWidthUnit; + /** + * Gets or sets the vertical alignment of a table cell's content. + * Value: One the values. + */ + verticalAlignment: any; + /** + * Gets or sets a value specifying whether text is wrapped in a table cell. + * Value: true if text is wrapped; false if text is not wrapped. + */ + noWrap: boolean; + /** + * Gets or sets a table cell's left margin. + * Value: An integer value specifying the left margin. + */ + marginLeft: number; + /** + * Gets or sets a table cell's right margin. + * Value: An integer value specifying the right margin. + */ + marginRight: number; + /** + * Gets or sets a table cell's top margin. + * Value: An integer value specifying the top margin. + */ + marginTop: number; + /** + * Gets or sets a table cell's bottom margin. + * Value: An integer value specifying the bottom margin. + */ + marginBottom: number; + /** + * Gets or sets a value specifying whether a table cell's margins are inherited from the table level settings. + * Value: true to inherit table level margins; false to use a table cell's own margin settings. + */ + marginsSameAsTable: boolean; +} +declare enum TableCellVerticalAlignment { + Top=0, + Both=1, + Center=2, + Bottom=3 +} +/** + * Contains the settings to format a table. + */ +interface TableFormattingSettings { + /** + * Gets or sets the preferred width of cells in the table. + * Value: A object specifying the width. + */ + preferredWidth: TableWidthUnit; + /** + * Gets or sets the alignment of table rows. + * Value: One of the values. + */ + alignment: any; + /** + * Gets or sets the table's left indent. + * Value: An integer value specifying the indent. + */ + indent: number; + /** + * Gets or sets the spacing between table cells. + * Value: An integer value specifying the spacing. + */ + spacingBetweenCells: number; + /** + * Gets or sets a value specifying whether spacing is allowed between table cells. + * Value: true, to allow spacing; otherwise, false. + */ + allowSpacingBetweenCells: boolean; + /** + * Gets or sets a value that specifying whether to allow automatic resizing of table cells to fit their contents. + * Value: true, to allow automatic resizing; otherwise, false. + */ + resizeToFitContent: boolean; + /** + * Gets or sets the default left margin for cells in the table. + * Value: An integer value specifying the margin value. + */ + defaultCellMarginLeft: number; + /** + * Gets or sets the default right margin for cells in the table. + * Value: An integer value specifying the margin value. + */ + defaultCellMarginRight: number; + /** + * Gets or sets the default top margin for cells in the table. + * Value: An integer value specifying the margin value. + */ + defaultCellMarginTop: number; + /** + * Gets or sets the default bottom margin for cells in the table. + * Value: An integer value specifying the margin value. + */ + defaultCellMarginBottom: number; +} +/** + * Contains settings defining the table width's measurement units and value. + */ +interface TableWidthUnit { + /** + * Gets or sets the table width value. + * Value: An integer value specifying the table width. + */ + value: number; + /** + * Gets or sets the unit type for the table width. + * Value: One of the values. + */ + type: any; +} +/** + * Contains settings defining the table height's measurement units and value. + */ +interface TableHeightUnit { + /** + * Gets or sets the table height value. + * Value: An integer value specifying the table height. + */ + value: number; + type: any; +} +declare enum TableHeightUnitType { + Minimum=0, + Auto=1, + Exact=2 +} +declare enum TableRowAlignment { + Both=0, + Center=1, + Distribute=2, + Left=3, + NumTab=4, + Right=5 +} +declare enum TableWidthUnitType { + Nil=0, + Auto=1, + FiftiethsOfPercent=2, + ModelUnits=3 +} +/** + * A command to change the font name of characters in a selected range. + */ +interface ChangeFontNameCommand extends CommandBase { + /** + * Executes the ChangeFontNameCommand command by applying the specified setting. 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 fontName A string specifying font name. + */ + execute(fontName: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the font size of characters in a selected range. + */ +interface ChangeFontSizeCommand extends CommandBase { + /** + * Executes the ChangeFontSizeCommand command by applying the specified setting. 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 fontSize An integer number specifying font size. + */ + execute(fontSize: number): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to increase the font size of characters in a selected range to the closest larger predefined value. + */ +interface IncreaseFontSizeCommand extends CommandWithSimpleStateBase { + /** + * Executes the IncreaseFontSizeCommand 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. + */ + execute(): boolean; +} +/** + * A command to decrease the font size of characters in a selected range to the closest smaller predefined value. + */ +interface DecreaseFontSizeCommand extends CommandWithSimpleStateBase { + /** + * Executes the DecreaseFontSizeCommand 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. + */ + execute(): boolean; +} +/** + * A command to convert the selected text to upper case. + */ +interface MakeTextUpperCaseCommand extends CommandWithSimpleStateBase { + /** + * Executes the MakeTextUpperCaseCommand 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. + */ + execute(): boolean; +} +/** + * A command to convert the selected text to lower case. + */ +interface MakeTextLowerCaseCommand extends CommandWithSimpleStateBase { + /** + * Executes the MakeTextLowerCaseCommand 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. + */ + execute(): boolean; +} +/** + * A command to capitalize each word in the selected sentence. + */ +interface CapitalizeEachWordTextCaseCommand extends CommandWithSimpleStateBase { + /** + * Executes the CapitalizeEachWordTextCaseCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle the case for each character - upper case becomes lower, lower case becomes upper. + */ +interface ToggleTextCaseCommand extends CommandWithSimpleStateBase { + /** + * Executes the ToggleTextCaseCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the bold formatting of characters in a selected range. + */ +interface ChangeFontBoldCommand extends CommandWithBooleanStateBase { + /** + * Executes the ChangeFontBoldCommand 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. + */ + execute(): boolean; + /** + * Executes the ChangeFontBoldCommand command by applying the specified setting. 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 fontBold true to apply bold formatting to the text, false to remove bold formatting. + */ + execute(fontBold: boolean): boolean; +} +/** + * A command to change the italic formatting of characters in a selected range. + */ +interface ChangeFontItalicCommand extends CommandWithBooleanStateBase { + /** + * Executes the ChangeFontItalicCommand 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. + */ + execute(): boolean; + /** + * Executes the ChangeFontItalicCommand command by applying the specified setting. 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 fontItalic true to apply italic formatting to the text, false to remove italic formatting. + */ + execute(fontItalic: boolean): boolean; +} +/** + * A command to change the underline formatting of characters in a selected range. + */ +interface ChangeFontUnderlineCommand extends CommandWithBooleanStateBase { + /** + * Executes the ChangeFontUnderlineCommand 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. + */ + execute(): boolean; + /** + * Executes the ChangeFontUnderlineCommand command by applying the specified setting. 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 fontUnderline true to apply underline formatting to the text, false to remove underline formatting. + */ + execute(fontUnderline: boolean): boolean; +} +/** + * A command to change the strikeout formatting of characters in a selected range. + */ +interface ChangeFontStrikeoutCommand extends CommandWithBooleanStateBase { + /** + * Executes the ChangeFontStrikeoutCommand 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. + */ + execute(): boolean; + /** + * Executes the ChangeFontStrikeoutCommand command by applying the specified setting. 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 fontStrikeout true to apply strikeout formatting to the text, false to remove strikeout formatting. + */ + execute(fontStrikeout: boolean): boolean; +} +/** + * A command to change the superscript formatting of characters in a selected range. + */ +interface ChangeFontSuperscriptCommand extends CommandWithBooleanStateBase { + /** + * Executes the ChangeFontSuperscriptCommand 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. + */ + execute(): boolean; + /** + * Executes the ChangeFontSuperscriptCommand command by applying the specified setting. 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 fontSuperscript true to apply superscript formatting to the text, false to remove superscript formatting. + */ + execute(fontSuperscript: boolean): boolean; +} +/** + * A command to change the subscript formatting of characters in the selected range. + */ +interface ChangeFontSubscriptCommand extends CommandWithBooleanStateBase { + /** + * Executes the ChangeFontSubscriptCommand 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. + */ + execute(): boolean; + /** + * Executes the ChangeFontSubscriptCommand command by applying the specified setting. 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 fontSubscript true to apply subscript formatting to the text, false to remove subscript formatting. + */ + execute(fontSubscript: boolean): boolean; +} +/** + * A command to change the font color of characters in a selected range. + */ +interface ChangeFontForeColorCommand extends CommandBase { + /** + * Executes the ChangeFontForeColorCommand command by applying the specified setting. 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 color A string specifying font color. May be specified as color name or hex color value. + */ + execute(color: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the background color of characters in a selected range. + */ +interface ChangeFontBackColorCommand extends CommandBase { + /** + * Executes the ChangeFontBackColorCommand command by applying the specified setting. 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 color A string specifying highlighting color. May be specified as color name or hex color value. + */ + execute(color: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to reset the selected text's formatting to default. + */ +interface ClearFormattingCommand extends CommandWithSimpleStateBase { + /** + * Executes the ClearFormattingCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the selected range's style. + */ +interface ChangeStyleCommand extends CommandBase { + /** + * Executes the ChangeStyleCommand command by applying the specified setting. 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 style A StyleBase object specifying the selected range's style. + */ + execute(style: StyleBase): boolean; + /** + * Executes the ChangeStyleCommand command by applying the specified settings. 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 styleName A string specifying the name of applying style. + * @param isParagraphStyle true to apply style to paragraph, false to apply style to character. + */ + execute(styleName: string, isParagraphStyle: boolean): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to invoke the Font dialog allowing end-users to change the font, size and style of the selected text. + */ +interface OpenFontFormattingDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenFontFormattingDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to convert the text of all selected sentences to sentence case. + */ +interface MakeTextSentenceCaseCommand extends CommandWithSimpleStateBase { + /** + * Executes the MakeTextSentenceCaseCommand 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. + */ + execute(): boolean; +} +/** + * A command to switch the text case at the current position in the document. + */ +interface SwitchTextCaseCommand extends CommandWithSimpleStateBase { + /** + * Executes the SwitchTextCaseCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the font formatting of characters in a selected range. + */ +interface ChangeFontFormattingCommand extends CommandBase { + /** + * Executes the ChangeFontFormattingCommand command by applying the specified setting. 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 settings A FontFormattingSettings object specifying font formatting settings. + */ + execute(settings: FontFormattingSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * Contains settings to define the font formatting. + */ +interface FontFormattingSettings { + /** + * Gets or sets the character(s) font name. + * Value: A string value specifying the font name. + */ + fontName: string; + /** + * Gets or sets the character(s) font size. + * Value: An integer value specifying the font size. + */ + size: number; + /** + * Gets or sets the foreground color of characters. + * Value: A string value specifying the foreground color. + */ + foreColor: string; + /** + * Gets or sets the character background color. + * Value: A string value specifying the background color. + */ + backColor: string; + /** + * Gets or sets the type of underline applied to the character(s). + * Value: true, if characters are underlined; otherwise, false. + */ + underline: boolean; + /** + * Gets or sets the color of the underline for the specified characters. + * Value: A string value specifying the underline color. + */ + underlineColor: string; + /** + * Gets or sets whether the character formatting is bold. + * Value: true, if characters are bold; otherwise, false. + */ + bold: boolean; + /** + * Gets or sets a value indicating whether a character(s) is italicized. + * Value: true, if characters are italicized; otherwise, false. + */ + italic: 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. + */ + underlineWordsOnly: boolean; + /** + * Gets or sets a value specifying character script formatting. + * Value: One of the values. + */ + script: any; + /** + * Gets or sets a value indicating whether all characters are capital letters. + * Value: true, if all characters are capitalized; otherwise, false. + */ + allCaps: boolean; + /** + * Gets or sets a value indicating whether a character(s) is hidden. + * Value: true, if characters are hidden; otherwise, false. + */ + hidden: boolean; +} +declare enum CharacterFormattingScript { + Normal=0, + Subscript=1, + Superscript=2 +} +/** + * A command to toggle the horizontal ruler's visibility. + */ +interface ShowHorizontalRulerCommand extends CommandWithBooleanStateBase { + /** + * Executes the ShowHorizontalRulerCommand 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. + */ + execute(): boolean; + /** + * Executes the ShowHorizontalRulerCommand command by applying the specified setting. 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 show true to display the horizontal ruler, false to hide the horizontal ruler. + */ + execute(show: boolean): boolean; +} +/** + * A command to toggle the fullscreen mode. + */ +interface SetFullscreenCommand extends CommandWithBooleanStateBase { + /** + * Executes the SetFullscreenCommand 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. + */ + execute(): boolean; + /** + * Executes the SetFullscreenCommand command by applying the specified setting. 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 fullscreen true to apply fullscreen mode, false to remove fullscreen mode. + */ + execute(fullscreen: boolean): boolean; +} +/** + * Holds the information that determines what action types can be performed for appointments. + */ +interface ASPxClientAppointmentFlags { + /** + * Gets a value that specifies whether an end-user is allowed to delete appointments. + * Value: true if an end-user can delete appointments; otherwise, false. Default is true. + */ + allowDelete: boolean; + /** + * Gets a value that specifies whether an end-user is allowed to edit appointments. + * Value: true if the end-user can edit appointments; otherwise, false. + */ + allowEdit: boolean; + /** + * Gets a value that specifies whether an end-user is allowed to change the time boundaries of appointments. + * Value: true if appointment resizing is allowed; otherwise, false. Default is true. + */ + allowResize: boolean; + /** + * Gets a value that specifies whether an end-user is allowed to copy appointments. + * Value: true if a user can copy appointments; otherwise, false. Default is true. + */ + allowCopy: boolean; + /** + * Gets a value that specifies whether an end-user is allowed to drag and drop appointments to another time slot or date. + * Value: true if the user can drag and drop appointments; otherwise, false. + */ + allowDrag: boolean; + /** + * Gets a value that specifies whether an end-user is allowed to drag and drop appointments between resources. + * Value: true if the end-user can drag appointment from one resource to another; otherwise, false. + */ + allowDragBetweenResources: boolean; + /** + * Gets a value that specifies whether an inplace editor can be activated for an appointment. + * Value: true if an inplace editor is activated; otherwise, false. Default is true. + */ + allowInplaceEditor: boolean; + /** + * Gets a value that specifies whether an end-user is allowed to share the schedule time between two or more appointments. + * Value: true if appointments with the same schedule time are allowed; otherwise, false. Default is true. + */ + allowConflicts: boolean; +} +/** + * Represents a client-side equivalent of the Appointment class. + */ +interface ASPxClientAppointment { + /** + * Gets the time interval of the appointment for client-side scripting. + * Value: An ASPxClientTimeInterval object, representing the interval assigned to an appointment. + */ + interval: ASPxClientTimeInterval; + /** + * Gets the identifiers of resources associated with the appointment for client-side scripting. + * Value: An array of string representations for resource identifiers. + */ + resources: string[]; + /** + * Gets the ID of an appointment for use in client-side scripts. + * Value: A string representation of the appointment ID. + */ + appointmentId: string; + /** + * Gets the type of appointment for use in client-side scripts. + * Value: An ASPxAppointmentType enumeration member, representing the appointment's type. + */ + appointmentType: ASPxAppointmentType; + /** + * Gets the index of the availability status object associated with the appointment. + * Value: An integer value that specifies the index of the corresponding Statuses collection. + */ + statusIndex: number; + /** + * Gets the index of the label object associated with the appointment for client-side scripting. + * Value: An integer value that specifies the index of the corresponding Labels collection. + */ + labelIndex: number; + /** + * Gets the client appointment value that is equivalent in meaning to the Subject property. + * Value: A string representing the appointment subject. + */ + subject: string; + /** + * Gets the client appointment value that is equivalent in meaning to the Description property. + * Value: A string, representing the description for an appointment. + */ + description: string; + /** + * Gets the client appointment value that is equivalent in meaning to the Location property. + * Value: A string representing the appointment location. + */ + location: string; + /** + * Gets the client appointment value that is equivalent in meaning to the AllDay property. + * Value: true indicates the all-day appointment; otherwise, false. + */ + allDay: boolean; + /** + * Adds a resource to the collection of resources associated with the client appointment. + * @param resourceId An object, representing the resource id. + */ + AddResource(resourceId: Object): void; + /** + * Gets the resource associated with the client-side appointment by its index. + * @param index An integer, representing an index of a resource in a resource collection associated with the current appointment. + */ + GetResource(index: number): Object; + /** + * Sets the property value of the client appointment, corresponding to the Start appointment property. + * @param start A JavaScript Date object representing the appointment start. + */ + SetStart(start: Date): void; + /** + * Gets the property value of the client appointment corresponding to the Start appointment property. + */ + GetStart(): Date; + /** + * Sets the property value of the client appointment, corresponding to the End appointment property. + * @param end A JavaScript Date object representing the end of the appointment. + */ + SetEnd(end: Date): void; + /** + * Gets the property value of the client appointment corresponding to the End appointment property. + */ + GetEnd(): Date; + /** + * Sets the property value of the client appointment, corresponding to the Duration appointment property. + * @param duration A TimeSpan object representing the appointment duration. + */ + SetDuration(duration: any): void; + /** + * Gets the property value of the client appointment corresponding to the Duration appointment property. + */ + GetDuration(): number; + /** + * Sets the ID of the client appointment. + * @param id An object representing the appointment identifier. + */ + SetId(id: Object): void; + /** + * Gets the ID of the client appointment. + */ + GetId(): Object; + /** + * Specifies the type of the current client appointment. + * @param type An ASPxAppointmentType enumeration value indicating the appointment type. + */ + SetAppointmentType(type: ASPxAppointmentType): void; + /** + * Gets the type of the client appointment. + */ + GetAppointmentType(): ASPxAppointmentType; + /** + * Sets the property value of the client appointment, corresponding to the StatusId appointment property. + * @param statusId An integer representing the index in the AppointmentStatusCollection. + */ + SetStatusId(statusId: number): void; + /** + * Gets the property value of the client appointment corresponding to the StatusId appointment property. + */ + GetStatusId(): number; + /** + * Sets the property value of the client appointment, corresponding to the LabelId appointment property. + * @param statusId An integer representing the index of the label in the Labels label collection. + */ + SetLabelId(statusId: number): void; + /** + * Gets the property value of the client appointment corresponding to the LabelId appointment property. + */ + GetLabelId(): number; + /** + * Sets the property value of the client appointment, corresponding to the Subject appointment property. + * @param subject A string containing the appointment subject. + */ + SetSubject(subject: string): void; + /** + * Gets the property value of the client appointment corresponding to the Subject appointment property. + */ + GetSubject(): string; + /** + * Sets the property value of the client appointment, corresponding to the Description appointment property. + * @param description A string representing the appointment description. + */ + SetDescription(description: string): void; + /** + * Gets the property value of the client appointment corresponding to the Description appointment property. + */ + GetDescription(): string; + /** + * Sets the property value of the client appointment, corresponding to the Location appointment property. + * @param location A string representing the appointment location. + */ + SetLocation(location: string): void; + /** + * Gets the property value of the client appointment corresponding to the Location appointment property. + */ + GetLocation(): string; + /** + * Specifies the property value of the client appointment corresponding to the AllDay appointment property. + * @param allDay true to indicate the all-day appointment; otherwise, false. + */ + SetAllDay(allDay: boolean): void; + /** + * Gets the property value of the client appointment corresponding to the AllDay appointment property. + */ + GetAllDay(): boolean; + /** + * Gets the appointment that is the RecurrencePattern for the current appointment. + */ + GetRecurrencePattern(): ASPxClientAppointment; + /** + * Sets the property value of the client appointment, corresponding to the RecurrenceInfo appointment property. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object representing the recurrence information. + */ + SetRecurrenceInfo(recurrenceInfo: ASPxClientRecurrenceInfo): void; + /** + * Gets the property value of the client appointment corresponding to the RecurrenceInfo appointment property. + */ + GetRecurrenceInfo(): ASPxClientRecurrenceInfo; +} +/** + * A client point object. + */ +interface ASPxClientPoint { + /** + * Gets the point's X-coordinate. + */ + GetX(): number; + /** + * Gets the point's Y-coordinate. + */ + GetY(): number; +} +/** + * A client rectangle object. + */ +interface ASPxClientRect { + /** + * Gets the X-coordinate of the rectangle's left edge. + */ + GetLeft(): number; + /** + * Gets the X-coordinate of the rectangle's right edge. + */ + GetRight(): number; + /** + * Gets the Y-coordinate of the rectangle's top edge. + */ + GetTop(): number; + /** + * Gets the Y-coordinate of the rectangle's bottom edge. + */ + GetBottom(): number; + /** + * Gets the rectangle's width. + */ + GetWidth(): number; + /** + * Gets the rectangle's height. + */ + GetHeight(): number; +} +/** + * Contains information defining the occurrences of a recurring client appointment. + */ +interface ASPxClientRecurrenceInfo { + /** + * Sets the recurrence start date. + * @param start A JavaScript date object value that specifies the start date for the recurrence. + */ + SetStart(start: Date): void; + /** + * Gets the recurrence start date. + */ + GetStart(): Date; + /** + * Sets the recurrence end date. + * @param end A JavaScript Date object that specifies the end date for the recurrence. + */ + SetEnd(end: Date): void; + /** + * Gets the recurrence end date. + */ + GetEnd(): Date; + /** + * Sets the duration of the recurrence. + * @param duration A TimeSpan object representing the duration. + */ + SetDuration(duration: any): void; + /** + * Gets the duration of the recurrence. + */ + GetDuration(): number; + /** + * Sets the time base for the frequency of the corresponding appointment occurrences. + * @param type An ASPxClientRecurrenceType enumeration value that specifies the recurrence's frequency type. + */ + SetRecurrenceType(type: ASPxClientRecurrenceType): void; + /** + * Gets the time base for the frequency of the corresponding appointment reoccurrence. + */ + GetRecurrenceType(): ASPxClientRecurrenceType; + /** + * Sets the day/days in a week that the corresponding appointment recurs on. + * @param weekDays The ASPxClientWeekDays enumeration value specifying the day/days in a week. + */ + SetWeekDays(weekDays: ASPxClientWeekDays): void; + /** + * Gets the day/days in a week on which the corresponding appointment occurs. + */ + GetWeekDays(): ASPxClientWeekDays; + /** + * Sets how many times the appointment occurs. + * @param occurrenceCount An integer value that specifies how many times the appointment occurs. + */ + SetOccurrenceCount(occurrenceCount: number): void; + /** + * Gets how many times the appointment occurs. + */ + GetOccurrenceCount(): number; + /** + * Sets the frequency with which the corresponding appointment occurs (dependent on the recurrence Type). + * @param periodicity An integer value that specifies the frequency with which the corresponding appointment occurs. + */ + SetPeriodicity(periodicity: number): void; + /** + * Gets the frequency with which the corresponding appointment reoccurs (dependent on the recurrence Type). + */ + GetPeriodicity(): number; + /** + * Sets the ordinal number of a day within a defined month. + * @param dayNumber A positive integer value that specifies the day number within a month. + */ + SetDayNumber(dayNumber: number): void; + /** + * Gets the ordinal number of a day within a defined month. + */ + GetDayNumber(): number; + /** + * Sets the occurrence number of the week in a month for the recurrence pattern. + * @param weekOfMonth A ASPxClientWeekOfMonth enumeration value that specifies a particular week in every month. + */ + SetWeekOfMonth(weekOfMonth: ASPxClientWeekOfMonth): void; + /** + * Gets the occurrence number of the week in a month for the recurrence pattern. + */ + GetWeekOfMonth(): ASPxClientWeekOfMonth; + /** + * Sets the month (as a number) on which the corresponding appointment occurs. + * @param month A positive integer value that specifies the month's number. + */ + SetMonth(month: number): void; + /** + * Gets the month (as a number) on which the corresponding appointment recurs. + */ + GetMonth(): number; + /** + * Gets the type of the recurrence range. + */ + GetRange(): ASPxClientRecurrenceRange; + /** + * Sets the type of the recurrence range. + * @param range An ASPxClientRecurrenceRangeenumeration value that specifies the recurrence range type. + */ + SetRange(range: ASPxClientRecurrenceRange): void; +} +/** + * Contains types of the recurrence range. + */ +interface ASPxClientRecurrenceRange { + /** + * A recurring appointment will not have an end date, i.e. infinite recurrence + * Value: The "NoEndDate" string. + */ + NoEndDate: string; + /** + * A recurring appointment will end after its recurrence count exceeds the value specified by the SetOccurrenceCount method. + * Value: The "OccurrenceCount" string. + */ + OccurrenceCount: string; + /** + * A recurring appointment will end after the date specified by the SetEnd method. + * Value: The "EndByDate" string. + */ + EndByDate: string; +} +/** + * Contains recurrence types. + */ +interface ASPxClientRecurrenceType { + /** + * The recurring appointment occurs on a daily basis. + * Value: The "Daily" string. + */ + Daily: string; + /** + * The recurring appointment reoccurs on a weekly basis. + * Value: The "Weekly" string. + */ + Weekly: string; + /** + * The recurring appointment reoccurs on a monthly basis. + * Value: The "Monthly" string. + */ + Monthly: string; + /** + * The recurring appointment reoccurs on an yearly basis. + * Value: The "Yearly" string. + */ + Yearly: string; + /** + * The recurring appointment occurs on an hourly base. + * Value: The "Hourly" string. + */ + Hourly: string; +} +/** + * Contains days and groups of days for use in recurrence patterns. + */ +interface ASPxClientWeekDays { + /** + * Specifies Sunday. + * Value: The integer 1 value. + */ + Sunday: number; + /** + * Specifies Monday. + * Value: The integer 2 value. + */ + Monday: number; + /** + * Specifies Tuesday. + * Value: The integer 4 value. + */ + Tuesday: number; + /** + * Specifies Wednesday. + * Value: The integer 8 value. + */ + Wednesday: number; + /** + * Specifies Thursday. + * Value: The integer 16 value. + */ + Thursday: number; + /** + * Specifies Friday. + * Value: The integer 32 value. + */ + Friday: number; + /** + * Specifies Saturday. + * Value: The integer 64 value. + */ + Saturday: number; + /** + * Specifies Saturday and Sunday. + * Value: The integer 65 value. + */ + WeekendDays: number; + /** + * Specifies work days (Monday, Tuesday, Wednesday, Thursday and Friday). + * Value: The integer 62 value. + */ + WorkDays: number; + /** + * Specifies every day of the week. + * Value: The integer 127 value. + */ + EveryDay: number; +} +/** + * Contains number of weeks in a month in which the event occurs. + */ +interface ASPxClientWeekOfMonth { + /** + * There isn't any recurrence rule based on the weeks in a month. + * Value: The integer 0 value. + */ + None: number; + /** + * The recurring event will occur once a month, on the specified day or days of the first week in the month. + * Value: The integer 1 value. + */ + First: number; + /** + * The recurring event will occur once a month, on the specified day or days of the second week in the month. + * Value: The integer 2 value. + */ + Second: number; + /** + * The recurring event will occur once a month, on the specified day or days of the third week in the month. + * Value: The integer 3 value. + */ + Third: number; + /** + * The recurring event will occur once a month, on the specified day or days of the fourth week in the month. + * Value: The integer 4 value; + */ + Fourth: number; + /** + * The recurring event will occur once a month, on the specified day or days of the last week in the month. + * Value: The integer 5 value; + */ + Last: number; +} +/** + * Represents a client-side equivalent of the WeekDaysCheckEdit control. + */ +interface ASPxClientWeekDaysCheckEdit extends ASPxClientControl { + /** + * Gets the selection state of the week day check boxes. + */ + GetValue(): ASPxClientWeekDays; + /** + * Gets the selection state of the week day check boxes. + * @param value An ASPxClientWeekDays object specifying the selection state of the week day check boxes. + */ + SetValue(value: ASPxClientWeekDays): void; +} +/** + * Represents a client-side equivalent of the RecurrenceRangeControl. + */ +interface ASPxClientRecurrenceRangeControl extends ASPxClientControl { + /** + * Gets the type of the recurrence range. + */ + GetRange(): ASPxClientRecurrenceRange; + /** + * Gets how many times the appointment occurs. + */ + GetOccurrenceCount(): number; + /** + * Gets the recurrence end date. + */ + GetEndDate(): Date; + /** + * Sets the type of the recurrence range. + * @param range An ASPxClientRecurrenceRangeenumeration value that specifies the recurrence range type. + */ + SetRange(range: ASPxClientRecurrenceRange): void; + /** + * Sets how many times the appointment occurs. + * @param occurrenceCount An integer value that specifies how many times the appointment occurs. + */ + SetOccurrenceCount(occurrenceCount: number): void; + /** + * Sets the recurrence end date. + * @param date A JavaScript Date object that specifies the end date for the recurrence. + */ + SetEndDate(date: Date): void; +} +/** + * A base for client equivalents of recurrence controls available in the XtraScheduler library. + */ +interface ASPxClientRecurrenceControlBase extends ASPxClientControl { + /** + * Returns an object providing access to the ASPxClientRecurrenceControlBase control's editor values. + */ + CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; + /** + * Updates values of editors displayed by the ASPxClientRecurrenceControlBase control. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. + */ + Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; +} +/** + * Represents a client-side equivalent of the DailyRecurrenceControl - a control for specifying the daily recurrence. + */ +interface ASPxClientDailyRecurrenceControl extends ASPxClientRecurrenceControlBase { + /** + * Returns an object providing access to the ASPxClientDailyRecurrenceControl's editor values. + */ + CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; + /** + * Updates values of editors displayed by the ASPxClientDailyRecurrenceControl. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. + */ + Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; +} +/** + * Represents a client-side equivalent of the WeeklyRecurrenceControl. + */ +interface ASPxClientWeeklyRecurrenceControl extends ASPxClientRecurrenceControlBase { + /** + * Returns an object providing access to the ASPxClientWeeklyRecurrenceControl's editor values. + */ + CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; + /** + * Updates values of editors displayed by the ASPxClientWeeklyRecurrenceControl. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. + */ + Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; +} +/** + * Represents a client-side equivalent of the MonthlyRecurrenceControl. + */ +interface ASPxClientMonthlyRecurrenceControl extends ASPxClientRecurrenceControlBase { + /** + * Returns an object providing access to the ASPxClientMonthlyRecurrenceControl's editor values. + */ + CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; + /** + * Updates values of editors displayed by the ASPxClientMonthlyRecurrenceControll. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. + */ + Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; +} +/** + * Represents a client-side equivalent of the YearlyRecurrenceControl. + */ +interface ASPxClientYearlyRecurrenceControl extends ASPxClientRecurrenceControlBase { + /** + * Returns an object providing access to the ASPxClientYearlyRecurrenceControl's editor values. + */ + CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; + /** + * Updates values of editors displayed by the ASPxClientYearlyRecurrenceControl. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. + */ + Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; +} +/** + * An object providing access to an ASPxClientRecurrenceControlBase control's editor values. + */ +interface DefaultRecurrenceRuleValuesAccessor { + /** + * Get the frequency with which the appointment occurs with respect to the appointment's recurrence type. + */ + GetPeriodicity(): number; + /** + * Gets the number of the month's day in which the appointment is scheduled. + */ + GetDayNumber(): number; + /** + * Gets or sets the month's number. + */ + GetMonth(): number; + /** + * Gets the days of the week to which a weekly recurrent appointment is scheduled. + */ + GetWeekDays(): ASPxClientWeekDays; + /** + * Gets the number of the week in a month when an appointment is scheduled. + */ + GetWeekOfMonth(): ASPxClientWeekOfMonth; +} +/** + * An object providing access to an ASPxClientDailyRecurrenceControl's editor values. + */ +interface DailyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAccessor { + /** + * Gets the number of days between appointment occurrences. + */ + GetPeriodicity(): number; + /** + * Gets the days of the week to which a daily recurrent appointment is scheduled. + */ + GetWeekDays(): ASPxClientWeekDays; +} +/** + * An object providing access to an ASPxClientWeeklyRecurrenceControl's editor values. + */ +interface WeeklyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAccessor { + /** + * Gets the number of weeks between appointment occurrences. + */ + GetPeriodicity(): number; + /** + * Gets the days of the week to which a weekly recurrent appointment is scheduled. + */ + GetWeekDays(): ASPxClientWeekDays; +} +/** + * An object providing access to an ASPxClientMonthlyRecurrenceControl's editor values. + */ +interface MonthlyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAccessor { + /** + * Gets the number of the month's day in which the appointment is scheduled. + */ + GetDayNumber(): number; + /** + * Gets the number of months between appointment occurrences. + */ + GetPeriodicity(): number; + /** + * Gets the days of the week to which a monthly recurrent appointment is scheduled. + */ + GetWeekDays(): ASPxClientWeekDays; + /** + * Gets the number of the week in a month when an appointment is scheduled. + */ + GetWeekOfMonth(): ASPxClientWeekOfMonth; +} +/** + * An object providing access to an ASPxClientYearlyRecurrenceControl's editor values. + */ +interface YearlyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAccessor { + /** + * Gets the number of the month's day in which the appointment is scheduled. + */ + GetDayNumber(): number; + /** + * Gets or sets the month's number. + */ + GetMonth(): number; + /** + * Gets the days of the week to which a yearly recurrent appointment is scheduled. + */ + GetWeekDays(): ASPxClientWeekDays; + /** + * Gets or sets the number of a week in a month when an appointment is scheduled. + */ + GetWeekOfMonth(): ASPxClientWeekOfMonth; +} +/** + * Provides base functionality for ASPxClientScheduler's forms. + */ +interface ASPxClientFormBase { + /** + * Occurs when the form has been closed. + */ + FormClosed: ASPxClientEvent>; + /** + * Closes the form. + */ + Close(): void; + /** + * Sets the visibility state of the specified form element. + * @param element An object specifying the element whose visibility state should be changed. + * @param isVisible true to display the element; false to hide the element. + */ + SetVisibleCore(element: Object, isVisible: boolean): void; +} +/** + * Represents a client-side equivalent of the RecurrenceTypeEdit. + */ +interface ASPxClientRecurrenceTypeEdit extends ASPxClientRadioButtonList { + /** + * Gets the selected recurrence type. + */ + GetRecurrenceType(): ASPxClientRecurrenceType; + /** + * Sets the selected recurrence type. + * @param recurrenceType An ASPxClientRecurrenceType enumeration value. + */ + SetRecurrenceType(recurrenceType: ASPxClientRecurrenceType): void; +} +/** + * Contains lists of property names for different appointment types. + */ +interface AppointmentPropertyNames { + /** + * Gets the list of properties characteristic for appointments of the Normal type. + * Value: A string array which is composed of the appointment property names. + */ + Normal: string; + /** + * Gets the list of properties characteristic for appointments of the Pattern type. + * Value: A string array which is composed of the appointment property names. + */ + Pattern: string; +} +/** + * Represents the client-side equivalent of the TimeInterval class. + */ +interface ASPxClientTimeInterval { + /** + * Gets a value indicating if the time interval is All-Day. + */ + GetAllDay(): boolean; + /** + * Sets a value specifying if the time interval is All-Day. + * @param allDayValue true, if this is an all-day time interval; otherwise, false. + */ + SetAllDay(allDayValue: boolean): void; + /** + * Client-side function that returns the start time of the interval. + */ + GetStart(): Date; + /** + * Client-side function that returns the duration of the specified time interval. + */ + GetDuration(): number; + /** + * Client-side function that returns the end time of the interval. + */ + GetEnd(): Date; + /** + * Client-side function that sets the start time of the interval. + * @param value A DateTime value, representing the beginning of the interval. + */ + SetStart(value: Date): void; + /** + * Client-side function that returns the duration of the specified time interval. + * @param value A TimeSpan object, representing the duration of the time period. + */ + SetDuration(value: any): void; + /** + * Client-side function that sets the end time of the interval. + * @param value A DateTime value, representing the end of the interval. + */ + SetEnd(value: Date): void; + /** + * Determines whether the specified object is equal to the current ASPxClientTimeInterval instance. + * @param interval The object to compare with the current object. + */ + Equals(interval: ASPxClientTimeInterval): boolean; + /** + * Checks if the current time interval intersects with the specified time interval. + * @param interval A ASPxClientTimeInterval object which represents the time interval to be checked. + */ + IntersectsWith(interval: ASPxClientTimeInterval): boolean; + /** + * Checks if the current time interval intersects with the specified time interval. The boundaries of the time intervals are excluded from the check. + * @param interval A ASPxClientTimeInterval object which represents the time interval to be checked. + */ + IntersectsWithExcludingBounds(interval: ASPxClientTimeInterval): boolean; + /** + * Client-side function that determines whether the specified interval is contained within the current one. + * @param interval An ASPxClientTimeInterval object, representing the time interval to check. + */ + Contains(interval: ASPxClientTimeInterval): boolean; +} +/** + * Holds action types for the client-side Refresh method. + */ +interface ASPxClientSchedulerRefreshAction { + /** + * Gets the value of the action parameter which initiates a simple reload of the control. + * Value: An integer representing the action parameter value. + */ + None: number; + /** + * Gets the value of the action parameter which initiates reloading of the main ASPxScheduler control and its data-dependent satellites. + * Value: An integer representing the action parameter value. + */ + VisibleIntervalChanged: number; + /** + * Gets the value of the action parameter which initiates reloading of the main ASPxScheduler control and its satellite View controls. + * Value: An integer representing the action parameter value. + */ + ActiveViewTypeChanged: number; +} +/** + * Contains methods allowing you to perform or cancel an operation. + */ +interface ASPxClientAppointmentOperation { + /** + * Passes parameters to the corresponding callback function to accomplish the operation. + */ + Apply(): void; + /** + * Cancels the operation. + */ + Cancel(): void; +} +/** + * Represents the client-side equivalent of the ASPxScheduler control. + */ +interface ASPxClientScheduler extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientScheduler. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client side when the Scheduler control is about to change its active view. + */ + ActiveViewChanging: ASPxClientEvent>; + /** + * Client-side event. Occurs after the active view of the ASPxScheduler has been changed. + */ + ActiveViewChanged: ASPxClientEvent>; + /** + * Occurs when the end-user clicks an appointment. + */ + AppointmentClick: ASPxClientEvent>; + /** + * Occurs when the end-user double clicks on an appointment. + */ + AppointmentDoubleClick: ASPxClientEvent>; + /** + * Occurs on the client side when the user selects an appointment. + */ + AppointmentsSelectionChanged: ASPxClientEvent>; + /** + * Fires on the client side when the time cell selection is changed. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Occurs on the client side when the time cell selection is about to change. + */ + SelectionChanging: ASPxClientEvent>; + /** + * Fires on the client side when the time interval of the scheduling area is changed. + */ + VisibleIntervalChanged: ASPxClientEvent>; + /** + * Occurs when one of More Buttons is clicked. + */ + MoreButtonClicked: ASPxClientEvent>; + /** + * Client-side event that occurs when a popup menu item is clicked. + */ + MenuItemClicked: ASPxClientEvent>; + /** + * Client-side event that occurs after an appointment has been dragged and dropped. + */ + AppointmentDrop: ASPxClientEvent>; + /** + * Client-side event that occurs when an appointment is resized. + */ + AppointmentResize: ASPxClientEvent>; + /** + * Client-side event that fires before an appointment is deleted. + */ + AppointmentDeleting: ASPxClientEvent>; + /** + * Client-side scripting method that gets the active View. + */ + GetActiveViewType(): ASPxSchedulerViewType; + /** + * Client-side scripting method to change the ASPxScheduler's active View. + * @param value A ASPxSchedulerViewType enumeration value, representing a view type to set. + */ + SetActiveViewType(value: ASPxSchedulerViewType): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Client-side scripting method which initiates a round trip to the server so that the current page will be reloaded. + */ + Refresh(): void; + /** + * Client-side scripting method which initiates a round trip to the server, so that the control will be reloaded using the specified refresh action. + * @param refreshAction An ASPxClientSchedulerRefreshAction enumeration value, specifying the refresh action. + */ + Refresh(refreshAction: ASPxClientSchedulerRefreshAction): void; + /** + * Client-side function that returns the type of grouping applied to the appointments displayed in the scheduler. + */ + GetGroupType(): ASPxSchedulerGroupType; + /** + * Client-side scripting method which raises the callback command to set the GroupType. + * @param value An ASPxSchedulerGroupType enumeration value, which specifies how appointments are grouped. + */ + SetGroupType(value: ASPxSchedulerGroupType): void; + /** + * Client-side method that navigates the scheduler to the current system date. + */ + GotoToday(): void; + /** + * Client-side scripting method which raises the GotoDate callback command. + * @param date A DateTime value specifying the destination time. + */ + GotoDate(date: Date): void; + /** + * Client-side function which slides the visible interval one time span back. + */ + NavigateBackward(): void; + /** + * Client-side function which slides the visible interval one time span forward. + */ + NavigateForward(): void; + /** + * Client-side method which raises the callback command to change the ClientTimeZoneId of the scheduler. + * @param timeZoneId A string, a time zone identifier which is valid for the System.TimeZoneInfo.Id property. + */ + ChangeTimeZoneId(timeZoneId: string): void; + /** + * Displays a Selection ToolTip on a position given by the specified coordinates. + * @param x An integer representing the X-coordinate. + * @param y An integer representing the Y-coordinate. + */ + ShowSelectionToolTip(x: number, y: number): void; + /** + * Client-side function that returns the time interval, selected in the scheduler. + */ + GetSelectedInterval(): ASPxClientTimeInterval; + /** + * Client-side function that returns the ResourceId of selected time cell's resource. + */ + GetSelectedResource(): string; + /** + * Client-side function that returns an appointment with the specified ID. + * @param id An appointment's identifier. + */ + GetAppointmentById(id: Object): ASPxClientAppointment; + /** + * Client-side function that returns the id's of selected appointments. + */ + GetSelectedAppointmentIds(): string[]; + /** + * Client-side function that removes the appointment specified by its client ID from a collection of selected appointments. + * @param aptId An appointment's identifier. + */ + DeselectAppointmentById(aptId: Object): void; + /** + * Client-side function that selects an appointment with the specified ID. + * @param aptId An appointment's identifier. + */ + SelectAppointmentById(aptId: Object): void; + /** + * Enables obtaining appointment property values in a client-side script. Executes the callback command with the AppointmentData identifier. + * @param aptId An integer, representing the appointment ID. + * @param propertyNames An array of strings, representing the appointment properties to query. + * @param onCallBack A handler of a function which will receive and process the properties' values. + */ + GetAppointmentProperties(aptId: number, propertyNames: string[], onCallBack: Object): string[]; + /** + * Initiates a callback to retrieve and apply the values for the specified list of properties to the specified appointment, and transfer control to the specified function. + * @param clientAppointment An ASPxClientAppointment object that is the client appointment for which the data is retrieved. + * @param propertyNames An array of strings, that are the names of appointment properties to query. + * @param onCallBack A handler of a function executed after a callback. + */ + RefreshClientAppointmentProperties(clientAppointment: ASPxClientAppointment, propertyNames: string[], onCallBack: Object): void; + /** + * Client-side function that invokes the editing form for the appointment specified by its client ID. + * @param aptClientId A string, representing the appointment client identifier. + */ + ShowAppointmentFormByClientId(aptClientId: string): void; + /** + * Client-side function that invokes the editing form for the appointment specified by its storage identifier. + * @param aptServerId A string, representing the appointment identifier. + */ + ShowAppointmentFormByServerId(aptServerId: string): void; + /** + * Sets the time of the day corresponding to the start of the topmost displayed time cell row. + * @param duration An integer, representing the number of milliseconds passed since the start of the day. + * @param viewType An ASPxSchedulerViewType enumeration member, representing the scheduler's View. It can be either 'Day' or 'WorkWeek'. + */ + SetTopRowTime(duration: number, viewType: ASPxSchedulerViewType): void; + /** + * Sets the time of the day corresponding to the start of the topmost displayed time cell row. + * @param duration An integer, representing the number of milliseconds passed since the start of the day. + */ + SetTopRowTime(duration: number): void; + /** + * Gets the time of the day corresponding to the start of the topmost displayed time cell row. + * @param viewType An ASPxSchedulerViewType enumeration member, representing the scheduler's View. It can be either "Day" or "WorkWeek", otherwise the result is undefined. + */ + GetTopRowTime(viewType: ASPxSchedulerViewType): number; + /** + * Gets the time of day corresponding to the start of the topmost displayed time cell row. + */ + GetTopRowTime(): number; + /** + * Client-side scripting method which displays the Loading Panel. + */ + ShowLoadingPanel(): void; + /** + * Client-side scripting method which hides the Loading Panel from view. + */ + HideLoadingPanel(): void; + /** + * Client-side method that invokes the inplace editor form to create a new appointment. + * @param start A date object, representing the start of the new appointment. + * @param end A date object, representing the end of the new appointment. + */ + ShowInplaceEditor(start: Date, end: Date): void; + /** + * Client-side method that invokes the inplace editor form to create a new appointment. + * @param start A date object, representing the start of the new appointment. + * @param end A date object, representing the end of the new appointment. + * @param resourceId An object representing the identifier of a resource associated with the new appointment. + */ + ShowInplaceEditor(start: Date, end: Date, resourceId: string): void; + /** + * Client-side scripting method to insert the specified appointment. + * @param apt An ASPxClientAppointment object representing the client-side appointment. + */ + InsertAppointment(apt: ASPxClientAppointment): void; + /** + * Client-side scripting method to update the specified appointment. + * @param apt An ASPxClientAppointment object representing the client-side appointment. + */ + UpdateAppointment(apt: ASPxClientAppointment): void; + /** + * Client-side scripting method to delete the specified appointment. + * @param apt An ASPxClientAppointment object representing the client-side appointment. + */ + DeleteAppointment(apt: ASPxClientAppointment): void; + /** + * Client-side method that allows retrieving a collection of time intervals displayed by the ASPxScheduler. + */ + GetVisibleIntervals(): ASPxClientTimeInterval[]; + /** + * Changes the container that the ASPxScheduler tooltip belongs to. + * @param container An object that serves as the new container for the pop-up menu. + */ + ChangeToolTipContainer(container: Object): void; + /** + * Changes the container that the ASPxScheduler pop-up menu belongs to. + * @param container An object that serves as the new container for the pop-up menu. + */ + ChangePopupMenuContainer(container: Object): void; + /** + * Returns focus to the form if the ASPxScheduler control is not visible when the reminder fires. + * @param container A DIV object that is located in such a way that it is visible on the page in situations when the ASPxScheduler control is hidden. + */ + ChangeFormContainer(container: Object): void; + /** + * Client-side scripting method that saves appointment modifications and closes the form. + */ + AppointmentFormSave(): void; + /** + * Client-side scripting method that deletes the appointment being edited. + */ + AppointmentFormDelete(): void; + /** + * Client-side scripting method that cancels changes and closes the appointment editing form. + */ + AppointmentFormCancel(): void; + /** + * Client-side scripting method that navigates the scheduler to the date selected in the GotoDate form and closes the form. + */ + GoToDateFormApply(): void; + /** + * Client-side scripting method that cancels changes and closes the GotoDate form. + */ + GoToDateFormCancel(): void; + /** + * Client-side scripting method that cancels changes and closes the form. + */ + InplaceEditFormSave(): void; + /** + * Client-side scripting method that cancels changes and closes the form. + */ + InplaceEditFormCancel(): void; + /** + * Client-side scripting method that invokes the appointment editing form for the appointment being edited in the inplace editor. + */ + InplaceEditFormShowMore(): void; + /** + * Client-side scripting method that closes the Reminder form. + */ + ReminderFormCancel(): void; + /** + * Client-side scripting method that calls the Dismiss method for the selected reminder. + */ + ReminderFormDismiss(): void; + /** + * Client-side scripting method that dismisses all reminders shown in the Reminder form. + */ + ReminderFormDismissAll(): void; + /** + * Client-side scripting method that changes the alert time for the selected reminder to the specified interval. + */ + ReminderFormSnooze(): void; +} +/** + * Represents a client-side equivalent of the SchedulerViewType object. + */ +interface ASPxSchedulerViewType { + /** + * Gets a string representation equivalent of Day enumeration for use in client scripts. + * Value: A string "Day", indicating the DayView. + */ + Day: string; + /** + * Gets a string representation equivalent of WorkWeek enumeration for use in client scripts. + * Value: A string "WorkWeek", indicating the WorkWeekView. + */ + WorkWeek: string; + /** + * Gets a string representation equivalent of Week enumeration for use in client scripts. + * Value: A string "Week", indicating the WeekView. + */ + Week: string; + /** + * Gets a string representation equivalent of Month enumeration for use in client scripts. + * Value: A string "Month", indicating the MonthView. + */ + Month: string; + /** + * Gets a string representation equivalent of Timeline enumeration for use in client scripts. + * Value: A string "Timeline", indicating the TimelineView. + */ + Timeline: string; + /** + * Gets a string representation equivalent of FullWeek enumeration for use in client scripts. + * Value: A string "FullWeek", indicating the FullWeekView. + */ + FullWeek: string; +} +/** + * Represents a client-side equivalent of the SchedulerGroupType enumeration. + */ +interface ASPxSchedulerGroupType { + /** + * Gets a string representation equivalent of None enumeration for use in client scripts. + * Value: A "None" string value. + */ + None: string; + /** + * Gets a string representation equivalent of Date enumeration for use in client scripts. + * Value: A "Date" string value. + */ + Date: string; + /** + * Gets a string representation equivalent of Resource enumeration for use in client scripts. + * Value: A "Resource" string value. + */ + Resource: string; +} +/** + * Represents a client-side equivalent of the AppointmentType enumeration. + */ +interface ASPxAppointmentType { + /** + * Gets a string representation equivalent of Normal enumeration for use in client scripts. + * Value: A "Normal" string value. + */ + Normal: string; + /** + * Gets a string representation equivalent of Pattern enumeration for use in client scripts. + * Value: A "Pattern" string value. + */ + Pattern: string; + /** + * Gets a string representation equivalent of Occurrence enumeration for use in client scripts. + * Value: An "Occurrence" string value. + */ + Occurrence: string; + /** + * Gets a string representation equivalent of ChangedOccurrence enumeration for use in client scripts. + * Value: A "ChangedOccurrence" string value. + */ + ChangedOccurrence: string; + /** + * Gets a string representation equivalent of DeletedOccurrence enumeration for use in client scripts. + * Value: A "DeletedOccurrence" string value. + */ + DeletedOccurrence: string; +} +interface ASPxClientAppointmentDeletingEventHandler { + /** + * A method that will handle the AppointmentDeleting event. + * @param source The event sender (typically an ASPxClientScheduler control). + * @param e A ASPxClientAppointmentDeletingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientAppointmentDeletingEventArgs): void; +} +/** + * Provides data for the AppointmentDeleting event. + */ +interface ASPxClientAppointmentDeletingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets client IDs of the appointments that are intended to be removed. + * Value: An array of client appointment identifiers, representing appointments passed for deletion. + */ + appointmentIds: Object[]; +} +interface AppointmentClickEventHandler { + /** + * A method that will handle the AppointmentClick event. + * @param source The event sender (typically an ASPxClientScheduler control). + * @param e A AppointmentClickEventArgs object that contains event data. + */ + (source: S, e: AppointmentClickEventArgs): void; +} +/** + * Provides data for the AppointmentDoubleClick events. + */ +interface AppointmentClickEventArgs extends ASPxClientEventArgs { + /** + * Gets the client appointment ID for the appointment being clicked. + * Value: A string, representing the client ID of the appointment. + */ + appointmentId: string; + /** + * Gets the HTML element that the event was triggered on. + * Value: An object containing event data. + */ + htmlElement: Object; + /** + * Gets or sets whether an event is handled, and that default actions are not required. + * Value: true if no default processing is required; otherwise, false. + */ + handled: boolean; +} +/** + * A method that will handle the AppointmentsSelectionChanged event. + */ +interface AppointmentsSelectionEventHandler { + /** + * A method that will handle the AppointmentsSelectionChanged event. + * @param source The ASPxScheduler control which fires the event. + * @param e A AppointmentsSelectionEventArgs object that contains event data. + */ + (source: S, e: AppointmentsSelectionEventArgs): void; +} +/** + * Provides data for the AppointmentsSelectionChanged event. + */ +interface AppointmentsSelectionEventArgs extends ASPxClientEventArgs { + /** + * Gets identifiers of the selected appointments. + * Value: A comma separated list of string values, representing appointment IDs. + */ + appointmentIds: string[]; +} +/** + * A method that will handle the ActiveViewChanging event. + */ +interface ActiveViewChangingEventHandler { + /** + * A method that will handle the ActiveViewChanging event. + * @param source The ASPxClientScheduler control which fires the event. + * @param e An ActiveViewChangingEventArgs object that contains event data + */ + (source: S, e: ActiveViewChangingEventArgs): void; +} +/** + * Provides data for the client-side ActiveViewChanging event. + */ +interface ActiveViewChangingEventArgs extends ASPxClientEventArgs { + /** + * Gets the value of the ActiveView property before modification. + * Value: A SchedulerViewType enumeration. + */ + oldView: ASPxSchedulerViewType; + /** + * Gets the new value of the ActiveView property. + * Value: A string, which is the SchedulerViewType enumeration value. + */ + newView: ASPxSchedulerViewType; + /** + * Gets or sets whether the change of active view should be canceled. + * Value: true to cancel the operation; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the MoreButtonClicked event. + */ +interface MoreButtonClickedEventHandler { + /** + * A method that will handle MoreButtonClicked event. + * @param source The ASPxClientScheduler control which fires the event. + * @param e A MoreButtonClickedEventArgs object that contains event data. + */ + (source: S, e: MoreButtonClickedEventArgs): void; +} +/** + * Provides data for the MoreButtonClicked client-side event. + */ +interface MoreButtonClickedEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the Start or End values of the target appointment. + * Value: A DateTime value representing the target appointment's boundary. + */ + targetDateTime: Date; + /** + * Gets the time interval of the cell where the button is located. + * Value: An ASPxClientTimeInterval object representing the time interval of the cell which holds the button. + */ + interval: ASPxClientTimeInterval; + /** + * Gets the resource identifier associated with the cell where the button is located. + * Value: A string, corresponding to ResourceId. + */ + resource: string; + /** + * Gets or sets whether an event is handled. If it is handled, default actions are not required. + * Value: true if no default processing is required; otherwise, false. + */ + handled: boolean; +} +/** + * A method that will handle the MenuItemClicked event. + */ +interface MenuItemClickedEventHandler { + /** + * A method that will handle the MenuItemClicked event. + * @param source The ASPxClientScheduler control which fires the event. + * @param e A MenuItemClickedEventArgs object that contains event data. + */ + (source: S, e: MenuItemClickedEventArgs): void; +} +/** + * Provides data for the MenuItemClicked event. + */ +interface MenuItemClickedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the menu item which is clicked. + * Value: A string, containing the menu item name. + */ + itemName: string; + /** + * Gets or sets whether an event is handled, and that default actions are not required. + * Value: true if no default processing is required; otherwise, false. + */ + handled: boolean; +} +interface AppointmentDropEventHandler { + /** + * A method that will handle the AppointmentDrop event. + * @param source The event sender (typically an ASPxClientScheduler control). + * @param e A ASPxClientAppointmentDragEventArgs object that contains event data. + */ + (source: S, e: ASPxClientAppointmentDragEventArgs): void; +} +/** + * Provides data for the AppointmentDrop event. + */ +interface ASPxClientAppointmentDragEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets whether default event processing is required. + * Value: true to process an event using only custom code; otherwise, false. + */ + handled: boolean; + /** + * Provides access to an object that enables you to choose an operation to perform. + * Value: An ASPxClientAppointmentOperation object providing methods to perform the required operation. + */ + operation: ASPxClientAppointmentOperation; + /** + * Provides information about dragged appointments. + * Value: An array of ASPxClientAppointmentDragInfo objects storing information about dragged appointments. + */ + dragInformation: ASPxClientAppointmentDragInfo[]; +} +interface AppointmentResizeEventHandler { + /** + * A method that will handle the AppointmentResize event. + * @param source The event sender (typically an ASPxClientScheduler control). + * @param e A ASPxClientAppointmentResizeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientAppointmentResizeEventArgs): void; +} +/** + * Provides data for the AppointmentResize event. + */ +interface ASPxClientAppointmentResizeEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets whether default event processing is required. + * Value: true to process an event using only custom code; otherwise, false. + */ + handled: boolean; + /** + * Provides access to an object that enables you to choose an operation to perform. + * Value: An ASPxClientAppointmentOperation object providing methods to perform the required operation. + */ + operation: ASPxClientAppointmentOperation; + /** + * Gets the resized appointment's identifier. + * Value: A string containing an appointment identifier. + */ + appointmentId: string; + /** + * Gets the appointment's interval before resizing. + * Value: An object representing the interval assigned to the appointment. + */ + oldInterval: ASPxClientTimeInterval; + /** + * Gets the appointment's interval after resizing. + * Value: An object representing the interval assigned to the appointment. + */ + newInterval: ASPxClientTimeInterval; +} +/** + * Stores information about an appointment drag operation. + */ +interface ASPxClientAppointmentDragInfo { + /** + * Gets the dragged appointment's identifier. + * Value: A string containing an appointment identifier. + */ + appointmentId: string; + /** + * Gets the appointment's interval before the drag operation. + * Value: An object representing the interval assigned to the appointment. + */ + oldInterval: ASPxClientTimeInterval; + /** + * Gets resources that were associated with the appointment before the drag operation. + * Value: A array of strings containing resource identifiers. + */ + oldResources: string[]; + /** + * Gets the appointment's interval after the drag operation. + * Value: An object representing the interval assigned to the appointment. + */ + newInterval: ASPxClientTimeInterval; + /** + * Gets resources associated with the appointment after the drag operation. + * Value: An array of strings containing resource identifiers. + */ + newResources: string[]; +} +/** + * Contains information about a client tooltip. + */ +interface ASPxClientSchedulerToolTipData { + /** + * Returns the client appointment for which the tooltip is displayed. + */ + GetAppointment(): ASPxClientAppointment; + /** + * Returns the client time interval for which the tooltip is displayed. + */ + GetInterval(): ASPxClientTimeInterval; + /** + * Returns the resources associated with the appointment for which the tooltip is displayed. + */ + GetResources(): Object[]; +} +/** + * A client-side equivalent of the ASPxSchedulerToolTipBase control. + */ +interface ASPxClientToolTipBase { + /** + * Returns the value that indicates whether or not the tooltip can be displayed. + */ + CanShowToolTip(): boolean; + /** + * Ends updating the tooltip content. + * @param toolTipData An ASPxClientSchedulerToolTipData object providing data required to update the tooltip content. + */ + FinalizeUpdate(toolTipData: ASPxClientSchedulerToolTipData): void; + /** + * Updates the tooltip content. + * @param toolTipData An ASPxClientSchedulerToolTipData object providing data required to update the tooltip content. + */ + Update(toolTipData: ASPxClientSchedulerToolTipData): void; + /** + * Closes the tooltip. + */ + Close(): void; + /** + * + * @param bounds + */ + CalculatePosition(bounds: Object): ASPxClientPoint; + /** + * Displays the Appointment Menu in the position of the tooltip. + * @param eventObject An object containing information about the event on which the menu is displayed. + */ + ShowAppointmentMenu(eventObject: Object): void; + /** + * Displays the View Menu in the position of the tooltip. + * @param eventObject An object containing information about the event on which the menu is displayed. + */ + ShowViewMenu(eventObject: Object): void; + /** + * Returns the string representation of the specified interval. + * @param interval An ASPxClientTimeInterval object to convert. + */ + ConvertIntervalToString(interval: ASPxClientTimeInterval): string; +} +/** + * Represents the client-side equivalent of the ASPxSpellChecker class. + */ +interface ASPxClientSpellChecker extends ASPxClientControl { + /** + * Client-side event that occurs before the spell check starts. + */ + BeforeCheck: ASPxClientEvent>; + /** + * Client-side event that occurs before a message box informing about process completion is shown. + */ + CheckCompleteFormShowing: ASPxClientEvent>; + /** + * Client-side event that occurs when a spell check is finished. + */ + AfterCheck: ASPxClientEvent>; + /** + * Occurs after a word is changed in a checked text. + */ + WordChanged: ASPxClientEvent>; + /** + * Starts the spelling check of the text contained within the element specified by the CheckedElementID value. + */ + Check(): void; + /** + * Starts checking contents of the specified element. + * @param element An object representing the element being checked. + */ + CheckElement(element: Object): void; + /** + * Starts checking contents of the specified element. + * @param id A string representing the identifier of the element being checked. + */ + CheckElementById(id: string): void; + /** + * Starts checking the contents of controls in the specified container. + * @param containerElement An object representing a control which contains elements being checked. + */ + CheckElementsInContainer(containerElement: Object): void; + /** + * Starts checking the contents of controls in the specified container. + * @param containerId A string, specifying the control's identifier. + */ + CheckElementsInContainerById(containerId: string): void; +} +/** + * Represents an object that will handle the client-side BeforeCheck event. + */ +interface ASPxClientBeforeCheckEventHandler { + /** + * A method that will handle the BeforeCheck event. + * @param source The ASPxClientSpellChecker control which fires the event. + * @param e A ASPxClientSpellCheckerBeforeCheckEventArgs object that contains event data + */ + (source: S, e: ASPxClientSpellCheckerBeforeCheckEventArgs): void; +} +/** + * Provides data for an event that occurs before a spelling check is started. Represents the client-side equivalent of the BeforeCheckEventArgs class. + */ +interface ASPxClientSpellCheckerBeforeCheckEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the programmatic identifier assigned to the control which is going to be checked. + * Value: A string, containing the control's identifier. + */ + controlId: string; +} +/** + * Represents an object that will handle the client-side AfterCheck event. + */ +interface ASPxClientAfterCheckEventHandler { + /** + * A method that will handle the AfterCheck event. + * @param source The ASPxClientSpellChecker control which fires the event. + * @param e A ASPxClientSpellCheckerAfterCheckEventArgs object that contains event data + */ + (source: S, e: ASPxClientSpellCheckerAfterCheckEventArgs): void; +} +/** + * Provides data for the client event that occurs after a spelling check is complete. + */ +interface ASPxClientSpellCheckerAfterCheckEventArgs extends ASPxClientEventArgs { + /** + * Gets the programmatic identifier assigned to the control which has been checked. + * Value: A string, containing the control's identifier. + */ + controlId: string; + /** + * Gets the text that has been checked. + * Value: A string, containing checked text. + */ + checkedText: string; +} +/** + * Represents an object that will handle the client-side WordChanged event. + */ +interface ASPxClientWordChangedEventHandler { + /** + * A method that will handle the AfterCheck event. + * @param source The event source. + * @param e An ASPxClientSpellCheckerAfterCheckEventArgs object which contains event data. + */ + (source: S, e: ASPxClientSpellCheckerAfterCheckEventArgs): void; +} +/** + * A method that will handle the CustomCommandExecuted event. + */ +interface ASPxClientSpreadsheetCustomCommandExecutedEventHandler { + /** + * A method that will handle the CustomCommandExecuted event. + * @param source An object representing the event source. Identifies the Spreadsheet that raised the event. + * @param e A ASPxClientSpreadsheetCustomCommandExecutedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSpreadsheetCustomCommandExecutedEventArgs): void; +} +/** + * Provides data for the CustomCommandExecuted event. + */ +interface ASPxClientSpreadsheetCustomCommandExecutedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value representing the processed command's name. + */ + commandName: string; + /** + * Gets an optional parameter that complements the processed command. + * Value: A string value containing additional information about the processed command. + */ + parameter: string; + item: ASPxClientRibbonItem; +} +/** + * A method that will handle the DocumentChanged event. + */ +interface ASPxClientSpreadsheetDocumentChangedEventHandler { + /** + * A method that will handle the DocumentChanged event. + * @param source An object representing the event source. Identifies the Spreadsheet that raised the event. + * @param e A ASPxClientSpreadsheetDocumentChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSpreadsheetDocumentChangedEventArgs): void; +} +/** + * Provides data for the DocumentChanged event. + */ +interface ASPxClientSpreadsheetDocumentChangedEventArgs extends ASPxClientEventArgs { +} +/** + * A method that will handle the EndSynchronization events. + */ +interface ASPxClientSpreadsheetSynchronizationEventHandler { + /** + * A method that will handle the EndSynchronization events. + * @param source An object representing the event source. Identifies the Spreadsheet that raised the event. + * @param e A ASPxClientSpreadsheetSynchronizationEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSpreadsheetSynchronizationEventArgs): void; +} +/** + * Provides data for the EndSynchronization events. + */ +interface ASPxClientSpreadsheetSynchronizationEventArgs extends ASPxClientEventArgs { +} +/** + * A method that will handle the HyperlinkClick event. + */ +interface ASPxClientSpreadsheetHyperlinkClickEventHandler { + /** + * A method that will handle the HyperlinkClick event. + * @param source An object representing the event source. Identifies the Spreadsheet that raised the event. + * @param e An ASPxClientSpreadsheetHyperlinkClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSpreadsheetHyperlinkClickEventArgs): void; +} +/** + * Provides data for the HyperlinkClick event. + */ +interface ASPxClientSpreadsheetHyperlinkClickEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets a value that specifies whether the event is handled, and the default processing is not required. + * Value: true, if if the event is completely handled by custom code and no default processing is required; otherwise, false. + */ + handled: boolean; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; + /** + * Gets a value identifying the clicked hyperlink type. + * Value: One of the values. + */ + hyperlinkType: ASPxClientOfficeDocumentLinkType; + /** + * Gets the clicked link's URI. + * Value: A sting value specifying the link's URI. + */ + targetUri: string; +} +/** + * A client-side equivalent of the ASPxSpreadsheet object. + */ +interface ASPxClientSpreadsheet extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientSpreadsheet. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client when a selection is changed in the ASPxSpreadsheet. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Occurs after a custom command has been executed on the client side. + */ + CustomCommandExecuted: ASPxClientEvent>; + /** + * Fires if any change is made to the Spreadsheet's document on the client. + */ + DocumentChanged: ASPxClientEvent>; + /** + * Fires after a client change has been made to the document and the client-server synchronization starts to apply the change on the server. + */ + BeginSynchronization: ASPxClientEvent>; + /** + * Fires after a document change has been applied to the server and server and client document models have been synchronized. + */ + EndSynchronization: ASPxClientEvent>; + /** + * Occurs on the client side after a hyperlink is clicked within the Spreadsheet's document. + */ + HyperlinkClick: ASPxClientEvent>; + /** + * Sets input focus to the Spreadsheet. + */ + Focus(): void; + /** + * Gets access to the client ribbon object. + */ + GetRibbon(): ASPxClientRibbon; + /** + * Enables you to switch the full-screen mode of the Spreadsheet. + * @param fullscreen true to activate full-screen mode; false to deactivate full-screen mode. + */ + SetFullscreenMode(fullscreen: boolean): void; + /** + * Returns the current selection made in a Spreadsheet. + */ + GetSelection(): ASPxClientSpreadsheetSelection; + /** + * Indicates whether any unsaved changes are contained in the current document. + */ + HasUnsavedChanges(): boolean; + /** + * Gets the value of the specified cell. + * @param colModelIndex An integer value specifying the cell's column index. + * @param rowModelIndex An integer value specifying the cell's row index. + */ + GetCellValue(colModelIndex: number, rowModelIndex: number): Object; + /** + * Gets the value of the currently active cell. + */ + GetActiveCellValue(): Object; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side DocumentCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side DocumentCallback event. + */ + PerformDocumentCallback(parameter: string): void; + /** + * Reconnects the Spreadsheet to an external ribbon. + */ + ReconnectToExternalRibbon(): void; +} +/** + * A method that will handle the client SelectionChanged event. + */ +interface ASPxClientSpreadsheetSelectionChangedEventHandler { + /** + * A method that will handle the SelectionChanged event. + * @param source An object representing the event source. Identifies the button editor that raised the event. + * @param e An ASPxClientSpreadsheetSelectionChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSpreadsheetSelectionChangedEventArgs): void; +} +/** + * Provides data for the SelectionChanged event. + */ +interface ASPxClientSpreadsheetSelectionChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets an object that determines the currently selected region within the Spreadsheet. + * Value: A object defining the current selection. + */ + selection: ASPxClientSpreadsheetSelection; +} +/** + * Represents the selection in the Spreadsheet. + */ +interface ASPxClientSpreadsheetSelection { + /** + * Gets the column index of the active cell. + * Value: An integer value specifying the active cell column index. + */ + activeCellColumnIndex: number; + /** + * Gets the row index of the active cell. + * Value: An integer value specifying the active cell row index. + */ + activeCellRowIndex: number; + /** + * Gets the index of the selection's left column. + * Value: An integer value specifying the index of the left column within the selection. + */ + leftColumnIndex: number; + /** + * Gets the index of the selection's top row. + * Value: An integer value specifying the index of the top row within the selection. + */ + topRowIndex: number; + /** + * Gets the index of the selection's right column. + * Value: An integer value specifying the index of the right column within the selection. + */ + rightColumnIndex: number; + /** + * Gets the index of the selection's bottom row. + * Value: An integer value specifying the index of the bottom row within the selection. + */ + bottomRowIndex: number; +} +/** + * Represents the client ASPxTreeList. + */ +interface ASPxClientTreeList extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any unhandled server error occurs during server-side processing of a callback sent by the ASPxClientTreeList. + */ + CallbackError: ASPxClientEvent>; + /** + * Enables you to display a context menu. + */ + ContextMenu: ASPxClientEvent>; + /** + * Occurs when a custom command button has been clicked. + */ + CustomButtonClick: ASPxClientEvent>; + /** + * Fires before the focused node has been changed. + */ + NodeFocusing: ASPxClientEvent>; + /** + * Fires in response to changing node focus. + */ + FocusedNodeChanged: ASPxClientEvent>; + /** + * Fires after the selection has been changed via end-user interaction. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Fires after the Customization Window has been closed. + */ + CustomizationWindowCloseUp: ASPxClientEvent>; + /** + * Fires after the callback has been processed in the CustomDataCallback event handler. + */ + CustomDataCallback: ASPxClientEvent>; + /** + * Fires on the client when a node is clicked. + */ + NodeClick: ASPxClientEvent>; + /** + * Fires on the client when a node is double clicked. + */ + NodeDblClick: ASPxClientEvent>; + /** + * Fires before a node is expanded. + */ + NodeExpanding: ASPxClientEvent>; + /** + * Fires before a node is collapsed. + */ + NodeCollapsing: ASPxClientEvent>; + /** + * Occurs before a node is dragged by an end-user. + */ + StartDragNode: ASPxClientEvent>; + /** + * Occurs after a node drag and drop operation is completed. + */ + EndDragNode: ASPxClientEvent>; + /** + * Enables you to prevent columns from being resized. + */ + ColumnResizing: ASPxClientEvent>; + /** + * Occurs after a column's width has been changed by an end-user. + */ + ColumnResized: ASPxClientEvent>; + /** + * Sets input focus to the ASPxTreeList. + */ + Focus(): void; + /** + * Gets the Popup Edit Form. + */ + GetPopupEditForm(): ASPxClientPopupControl; + /** + * Returns the focused node's key value. + */ + GetFocusedNodeKey(): string; + /** + * Moves focus to the specified node. + * @param key A String value that uniquely identifies the node. + */ + SetFocusedNodeKey(key: string): void; + /** + * Indicates whether the specified node is selected. + * @param nodeKey A String value that identifies the node by its key value. + */ + IsNodeSelected(nodeKey: string): any; + /** + * Selects the specified node. + * @param nodeKey A string value that identifies the node. + */ + SelectNode(nodeKey: string): void; + /** + * Selects or deselects the specified node. + * @param nodeKey A string value that identifies the node. + * @param state true to select the node; otherwise, false. + */ + SelectNode(nodeKey: string, state: boolean): void; + /** + * Obtains key values of selected nodes that are displayed within the current page. + */ + GetVisibleSelectedNodeKeys(): string[]; + /** + * Indicates whether the Customization Window is displayed. + */ + IsCustomizationWindowVisible(): boolean; + /** + * Invokes the Customization Window. + */ + ShowCustomizationWindow(): void; + /** + * Invokes the Customization Window and displays it over the specified HTML element. + * @param htmlElement An object that specifies the HTML element relative to whose position the customization window is invoked. + */ + ShowCustomizationWindow(htmlElement: Object): void; + /** + * Closes the Customization Window. + */ + HideCustomizationWindow(): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCustomCallback(arg: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side CustomDataCallback event. + */ + PerformCustomDataCallback(arg: string): void; + /** + * Obtains specified data source field values within a specified node, and submits them to the specified JavaScript function. + * @param nodeKey A string value that identifies the node. + * @param fieldNames A string value that contains the names of data source fields whose values within the specified node are returned. The field names should be separated by ';'. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + */ + GetNodeValues(nodeKey: string, fieldNames: string, onCallback: ASPxClientTreeListValuesCallback): void; + /** + * Obtains specified data source field values within a specified node, and submits them to the specified JavaScript function. + * @param nodeKey A string value that identifies the node. + * @param fieldNames The names of data source fields whose values within the specified node are returned. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + */ + GetNodeValues(nodeKey: string, fieldNames: string[], onCallback: ASPxClientTreeListValuesCallback): void; + /** + * Obtains specified data source field values within nodes that are displayed within the current page, and submits them to the specified JavaScript function. + * @param fieldNames A string value that contains the names of data source fields whose values within visible nodes are returned. The field names should be separated by ';'. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + */ + GetVisibleNodeValues(fieldNames: string, onCallback: ASPxClientTreeListValuesCallback): void; + /** + * Obtains specified data source field values within nodes that are displayed within the current page, and submits them to the specified JavaScript function. + * @param fieldNames The names of data source fields whose values within visible nodes are returned. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + */ + GetVisibleNodeValues(fieldNames: string[], onCallback: ASPxClientTreeListValuesCallback): void; + /** + * Obtains specified data source field values within selected nodes, and submits them to the specified JavaScript function. + * @param fieldNames A string value that contains the names of data source fields whose values within selected nodes are returned. The field names should be separated by ';'. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + */ + GetSelectedNodeValues(fieldNames: string, onCallback: ASPxClientTreeListValuesCallback): void; + /** + * Obtains specified data source field values within selected nodes, and submits them to the specified JavaScript function. + * @param fieldNames The names of data source fields whose values within selected nodes are returned. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + */ + GetSelectedNodeValues(fieldNames: string[], onCallback: ASPxClientTreeListValuesCallback): void; + /** + * Obtains specified data source field values within selected nodes, and submits them to the specified JavaScript function. + * @param fieldNames A string value that contains the names of data source fields whose values within selected nodes are returned. The field names should be separated by ';'. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + * @param visibleOnly true to return values within selected nodes that are displayed within the current page; false to return values within all selected nodes. + */ + GetSelectedNodeValues(fieldNames: string, onCallback: ASPxClientTreeListValuesCallback, visibleOnly: boolean): void; + /** + * Obtains specified data source field values within selected nodes, and submits them to the specified JavaScript function. + * @param fieldNames The names of data source fields whose values within selected nodes are returned. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + * @param visibleOnly true to return values within selected nodes that are displayed within the current page; false to return values within all selected nodes. + */ + GetSelectedNodeValues(fieldNames: string[], onCallback: ASPxClientTreeListValuesCallback, visibleOnly: boolean): void; + /** + * Selects the specified page. + * @param index An integer value that specifies the active page's index. + */ + GoToPage(index: number): void; + /** + * Activates the previous page. + */ + PrevPage(): void; + /** + * Activates the next page. + */ + NextPage(): void; + /** + * Gets the index of the page currently being selected. + */ + GetPageIndex(): number; + /** + * Gets the number of pages to which the ASPxTreeList's data is divided. + */ + GetPageCount(): number; + /** + * Returns the specified node's state. + * @param nodeKey A String value that identifies the node. + */ + GetNodeState(nodeKey: string): string; + /** + * Expands all nodes. + */ + ExpandAll(): void; + /** + * Collapses all Node. + */ + CollapseAll(): void; + /** + * Expands the specified node preserving the collapsed state of child nodes. + * @param key A String value that uniquely identifies the node. + */ + ExpandNode(key: string): void; + /** + * Collapses the specified node preserving the expanded state of child nodes. + * @param key A String value that uniquely identifies the node. + */ + CollapseNode(key: string): void; + /** + * Obtains key values of nodes that are displayed within the current page. + */ + GetVisibleNodeKeys(): string[]; + /** + * Returns an HTML table row that represents the specified node. + * @param nodeKey A string value that identifies the node. + */ + GetNodeHtmlElement(nodeKey: string): Object; + /** + * Returns the number of visible columns within the client ASPxTreeList. + */ + GetVisibleColumnCount(): number; + /** + * Returns the number of columns within the client ASPxTreeList. + */ + GetColumnCount(): number; + /** + * Returns the column located at the specified position within the Columns collection. + * @param index An integer value that identifies the column within the collection (the column's Index property value). + */ + GetColumnByIndex(index: number): ASPxClientTreeListColumn; + /** + * Returns the column with the specified name. + * @param name A string value that specifies the column's name (the column's Name property value). + */ + GetColumnByName(name: string): ASPxClientTreeListColumn; + /** + * Returns the client column which is bound to the specified data source field. + * @param fieldName A string value that specifies the name of the data source field to which the column is bound (the column's FieldName property value). + */ + GetColumnByFieldName(fieldName: string): ASPxClientTreeListColumn; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + */ + SortBy(columnIndex: number): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DESC' or 'NONE'). + */ + SortBy(columnIndex: number, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DESC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(columnIndex: number, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values. + * @param nameOrFieldName A String value that specifies the column's name or field name. + */ + SortBy(nameOrFieldName: string): void; + /** + * Sorts data by the specified data column's values. + * @param nameOrFieldName A String value that specifies the column's name or field name. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DESC' or 'NONE'). + */ + SortBy(nameOrFieldName: string, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param nameOrFieldName A String value that specifies the column's name or field name. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DESC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(nameOrFieldName: string, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientTreeListColumn object that represents the data column. + */ + SortBy(column: ASPxClientTreeListColumn): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientTreeListColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DESC' or 'NONE'). + */ + SortBy(column: ASPxClientTreeListColumn, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientTreeListColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DESC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(column: ASPxClientTreeListColumn, sortOrder: string, reset: boolean): void; + /** + * Switches the ASPxTreeList to edit mode. + * @param nodeKey A string value that identifies the node by its key value. + */ + StartEdit(nodeKey: string): void; + /** + * Saves all the changes made and switches the ASPxTreeList to browse mode. + */ + UpdateEdit(): void; + /** + * Cancels all the changes made and switches the ASPxTreeList to browse mode. + */ + CancelEdit(): void; + /** + * Indicates whether the ASPxTreeList is in edit mode. + */ + IsEditing(): boolean; + /** + * Gets the key value of the node currently being edited. + */ + GetEditingNodeKey(): string; + /** + * Moves the specified node to a new position. + * @param nodeKey A string value that identifies the target node by its key value. + * @param parentNodeKey A string value that identifies the node to whose child collection the target node is moved. An empty string to display the target node within the root. + */ + MoveNode(nodeKey: string, parentNodeKey: string): void; + /** + * Deletes the specified node. + * @param nodeKey A string value that identifies the node. + */ + DeleteNode(nodeKey: string): void; + /** + * Switches the ASPxTreeList to edit mode and allows new root node values to be edited. + */ + StartEditNewNode(): void; + /** + * Switches the ASPxTreeList to edit mode and allows new node values to be edited. + * @param parentNodeKey A String value that identifies the parent node, which owns a new node. + */ + StartEditNewNode(parentNodeKey: string): void; + /** + * Returns the editor used to edit the specified column's values. + * @param column An ASPxClientTreeListColumn object that represents the data column within the client ASPxTreeList. + */ + GetEditor(column: ASPxClientTreeListColumn): Object; + /** + * Returns the editor used to edit the specified column's values. + * @param columnIndex An integer value that identifies the column by its position within the column collection. + */ + GetEditor(columnIndex: number): Object; + /** + * Returns the editor used to edit the specified column's values. + * @param columnNameOrFieldName A String value that identifies the column by its name or field name. + */ + GetEditor(columnNameOrFieldName: string): Object; + /** + * Returns the value of the specified edit cell. + * @param column An ASPxClientTreeListColumn object that represents the data column within the client ASPxTreeList. + */ + GetEditValue(column: ASPxClientTreeListColumn): Object; + /** + * Returns the value of the specified edit cell. + * @param columnIndex An integer value that identifies the data column by its index within the ASPxTreeList's column collection. + */ + GetEditValue(columnIndex: number): Object; + /** + * Returns the value of the specified edit cell. + * @param columnNameOrFieldName A String value that identifies the column by its name or field name. + */ + GetEditValue(columnNameOrFieldName: string): Object; + /** + * Sets the value of the specified edit cell. + * @param column An ASPxClientTreeListColumn object that represents the data column within the client ASPxTreeList. + * @param value An object that specifies the edit cell's new value. + */ + SetEditValue(column: ASPxClientTreeListColumn, value: Object): void; + /** + * Sets the value of the specified edit cell. + * @param columnIndex An integer value that identifies the data column by its index within the ASPxTreeList's column collection. + * @param value An object that specifies the edit cell's new value. + */ + SetEditValue(columnIndex: number, value: Object): void; + /** + * Sets the value of the specified edit cell. + * @param columnNameOrFieldName A String value that identifies the column by its name or field name. + * @param value An object that specifies the edit cell's new value. + */ + SetEditValue(columnNameOrFieldName: string, value: Object): void; + /** + * Moves focus to the specified editor within the edited node. + * @param column A ASPxClientTreeListColumn object that represents the data column within the client ASPxTreeList. + */ + FocusEditor(column: ASPxClientTreeListColumn): void; + /** + * Moves focus to the specified editor within the edited node. + * @param columnIndex An integer value that identifies the data column. + */ + FocusEditor(columnIndex: number): void; + /** + * Moves focus to the specified editor within the edited node. + * @param columnNameOrFieldName A String value that specifies the column's name or field name. + */ + FocusEditor(columnNameOrFieldName: string): void; + /** + * Scrolls the tree list so that the specified node becomes visible. + * @param nodeKey An integer value that specifies the node index within the tree list's client item list. + */ + MakeNodeVisible(nodeKey: string): void; + /** + * Returns the current vertical scroll position of the tree list's content. + */ + GetVerticalScrollPosition(): number; + /** + * Returns the current horizontal scroll position of the tree list's content. + */ + GetHorizontalScrollPosition(): number; + /** + * Specifies the vertical scroll position for the tree list's content. + * @param position An integer value specifying the vertical scroll position. + */ + SetVerticalScrollPosition(position: number): void; + /** + * Specifies the horizontal scroll position for the tree list's content. + * @param position An integer value specifying the horizontal scroll position. + */ + SetHorizontalScrollPosition(position: number): void; +} +/** + * Represents a client column. + */ +interface ASPxClientTreeListColumn { + /** + * Gets the column's position within the collection. + * Value: An integer zero-bazed index that specifies the column's position within the collection. + */ + index: number; + /** + * Gets the name that uniquely identifies the column. + * Value: A string value assigned to the column's Name property. + */ + name: string; + /** + * Gets the name of the database field assigned to the current column. + * Value: A String value that specifies the name of a data field. + */ + fieldName: string; +} +/** + * Provides data for the CustomDataCallback event. + */ +interface ASPxClientTreeListCustomDataCallbackEventArgs extends ASPxClientEventArgs { + /** + * Gets the information that has been collected on the client-side and sent to the server-side CustomDataCallback event. + * Value: A string value that represents the information that has been collected on the client-side and sent to the server-side CustomDataCallback event. + */ + arg: string; + /** + * Gets the information passed from the server-side CustomDataCallback event. + * Value: An object that represents the information passed from the server-side CustomDataCallback event. + */ + result: Object; +} +/** + * A method that will handle the CustomDataCallback event. + */ +interface ASPxClientTreeListCustomDataCallbackEventHandler { + /** + * A method that will handle the CustomDataCallback event. + * @param source The event source. + * @param e An ASPxClientTreeListCustomDataCallbackEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListCustomDataCallbackEventArgs): void; +} +/** + * Provides data for the NodeDblClick events. + */ +interface ASPxClientTreeListNodeEventArgs extends ASPxClientEventArgs { + /** + * Gets the processed node's key value. + * Value: A String value that identifies the processed node. + */ + nodeKey: string; + /** + * Provides access to the parameters associated with the NodeDblClick events. + * Value: An object that contains parameters associated with the event. + */ + htmlEvent: Object; + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the NodeDblClick event. + */ +interface ASPxClientTreeListNodeEventHandler { + /** + * A method that will handle the NodeDblClick event. + * @param source The event source. + * @param e An ASPxClientTreeListNodeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListNodeEventArgs): void; +} +/** + * Provides data for the ContextMenu event. + */ +interface ASPxClientTreeListContextMenuEventArgs extends ASPxClientEventArgs { + /** + * Identifies which tree list element has been right-clicked. + * Value: A string value that identifies which tree list element ('Header' or 'Node') has been right-clicked. + */ + objectType: string; + /** + * Gets a value that identifies the right-clicked object. + * Value: The right-clicked object's identifier. + */ + objectKey: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that relates to the processed event. + */ + htmlEvent: Object; + /** + * Gets or sets whether to invoke the browser's context menu. + * Value: true to hide the browser's context menu; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the ContextMenu event. + */ +interface ASPxClientTreeListContextMenuEventHandler { + /** + * A method that will handle the ContextMenu event. + * @param source The event sender. + * @param e An ASPxClientTreeListContextMenuEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListContextMenuEventArgs): void; +} +/** + * Provides data for the StartDragNode event. + */ +interface ASPxClientTreeListStartDragNodeEventArgs extends ASPxClientTreeListNodeEventArgs { + /** + * Gets an array of targets where a node can be dragged. + * Value: An array of objects that represent targets for the dragged node. + */ + targets: Object[]; +} +/** + * A method that will handle the StartDragNode event. + */ +interface ASPxClientTreeListStartDragNodeEventHandler { + /** + * A method that will handle the StartDragNode event. + * @param source The event source. + * @param e An ASPxClientTreeListStartDragNodeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListStartDragNodeEventArgs): void; +} +/** + * Provides data for the EndDragNode event. + */ +interface ASPxClientTreeListEndDragNodeEventArgs extends ASPxClientTreeListNodeEventArgs { + /** + * Gets the target element. + * Value: An object that represents the target element to which the dragged node has been dropped. + */ + targetElement: Object; +} +/** + * A method that will handle the EndDragNode event. + */ +interface ASPxClientTreeListEndDragNodeEventHandler { + /** + * A method that will handle the EndDragNode event. + * @param source The event source. + * @param e An ASPxClientTreeListEndDragNodeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListEndDragNodeEventArgs): void; +} +/** + * Provides data for the CustomButtonClick event. + */ +interface ASPxClientTreeListCustomButtonEventArgs extends ASPxClientEventArgs { + /** + * Gets the key value of the node whose custom button has been clicked. + * Value: A string value that uniquely identifies the node whose custom button has been clicked. + */ + nodeKey: string; + /** + * Gets the button's index. + * Value: An integer value that specifies the button's position within the CustomButtons collection. + */ + buttonIndex: number; + /** + * Gets the value which identifies the custom button. + * Value: A String value that identifies the clicked custom button. + */ + buttonID: string; +} +/** + * A method that will handle the CustomButtonClick event. + */ +interface ASPxClientTreeListCustomButtonEventHandler { + /** + * A method that will handle the CustomButtonClick event. + * @param source The event source. + * @param e An ASPxClientTreeListCustomButtonEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListCustomButtonEventArgs): void; +} +/** + * Represents a JavaScript function which receives the list of row values when a specific client method (such as the GetSelectedNodeValues) is called. + */ +interface ASPxClientTreeListValuesCallback { + /** + * A JavaScript function which receives the list of row values when a specific client method (such as the GetSelectedNodeValues) is called. + * @param result An object that represents the list of row values received from the server. + */ + (result: Object): void; +} +/** + * Provides data for the ColumnResizing event. + */ +interface ASPxClientTreeListColumnResizingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed client column. + * Value: An object that is the processed column. + */ + column: ASPxClientTreeListColumn; +} +/** + * A method that will handle the client ColumnResizing event. + */ +interface ASPxClientTreeListColumnResizingEventHandler { + /** + * A method that will handle the ColumnResizing event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientTreeListColumnResizingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListColumnResizingEventArgs): void; +} +/** + * Provides data for the ColumnResized event. + */ +interface ASPxClientTreeListColumnResizedEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the processed client column. + * Value: An object that is the processed column. + */ + column: ASPxClientTreeListColumn; +} +/** + * A method that will handle the client ColumnResized event. + */ +interface ASPxClientTreeListColumnResizedEventHandler { + /** + * A method that will handle the ColumnResized event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientTreeListColumnResizedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListColumnResizedEventArgs): void; +} +/** + * A client-side counterpart of the Calendar and CalendarFor extensions. + */ +interface MVCxClientCalendar extends ASPxClientCalendar { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; +} +/** + * A client-side counterpart of the CallbackPanel extension. + */ +interface MVCxClientCallbackPanel extends ASPxClientCallbackPanel { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the Callback Panel by processing the passed information on the server, in an Action specified by the Callback Panel's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the Callback Panel by processing the passed information on the server, in an Action specified by the Callback Panel's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the CardView extension. + */ +interface MVCxClientCardView extends ASPxClientCardView { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the CardView by processing the passed information on the server, in an Action specified via the CardView's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CardView's CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the CardView by processing the passed information on the server, in an Action specified via the CardView's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CardView's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the CardView's CustomDataActionRouteValues property, and then process the returned result in the specified client function. This method does not update the CardView. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. + * @param onCallback A ASPxClientCardViewValuesCallback object that represents the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(data: Object, onCallback: ASPxClientCardViewValuesCallback): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event. + * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback An ASPxClientCardViewValuesCallback object that is the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(args: string, onCallback: ASPxClientCardViewValuesCallback): void; +} +/** + * A client-side counterpart of the Chart extension. + */ +interface MVCxClientChart extends ASPxClientWebChartControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update a Chart by processing the passed information on the server, in an Action specified via the Chart's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update a Chart by processing the passed information on the server, in an Action specified via the Chart's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the ComboBox and ComboBoxFor extensions. + */ +interface MVCxClientComboBox extends ASPxClientComboBox { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the ComboBox by processing the passed information on the server, in an Action specified by the ComboBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the ComboBox by processing the passed information on the server, in an Action specified by the ComboBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; +} +/** + * A client-side counterpart of the DataView extension. + */ +interface MVCxClientDataView extends ASPxClientDataView { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the DataView by processing the passed information on the server, in an Action specified via the DataView's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the DataView by processing the passed information on the server, in an Action specified via the DataView's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the DateEdit extension. + */ +interface MVCxClientDateEdit extends ASPxClientDateEdit { +} +/** + * A client-side counterpart of the DockManager extension. + */ +interface MVCxClientDockManager extends ASPxClientDockManager { + /** + * Sends a callback with a parameter to update the DockManager by processing the passed information on the server, in an Action specified by the DockManager's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the DockManager by processing the passed information on the server, in an Action specified by the DockManager's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the DockPanel extension. + */ +interface MVCxClientDockPanel extends ASPxClientDockPanel { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the DockPanel by processing the passed information on the server, in an Action specified by the DockPanel's DockPanelSettings.CallbackRouteValues) property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the DockPanel by processing the passed information on the server, in an Action specified by the DockPanel's DockPanelSettings.CallbackRouteValues) property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side WindowCallback event, passing the specified argument to it. + * @param parameter A string value that is any information that needs to be sent to the server-side WindowCallback event. + */ + PerformCallback(parameter: string): void; +} +/** + * A client-side counterpart of the FileManager extension. + */ +interface MVCxClientFileManager extends ASPxClientFileManager { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the FileManager by processing the passed information on the server, in an Action specified via the extension's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the file manager's CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param data A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the GridView extension. + */ +interface MVCxClientGridView extends ASPxClientGridView { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the GridView by processing the passed information on the server, in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the GridView by processing the passed information on the server, in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the GridView's CustomDataActionRouteValues property, and then process the returned result in the specified client function. This method does not update the GridView. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. + * @param onCallback A ASPxClientGridViewValuesCallback object that represents the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(data: Object, onCallback: ASPxClientGridViewValuesCallback): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event. + * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback A ASPxClientGridViewValuesCallback object that is the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(args: string, onCallback: ASPxClientGridViewValuesCallback): void; +} +/** + * A client-side counterpart of the HtmlEditor extension. + */ +interface MVCxClientHtmlEditor extends ASPxClientHtmlEditor { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the HtmlEditor's CustomDataCallback event on the client. This method does not update the HtmlEditor. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. + */ + PerformDataCallback(data: Object): void; + /** + * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the HtmlEditor's CustomDataCallback event on the client. This method does not update the HtmlEditor. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. + * @param onCallback An ASPxClientDataCallback object that is the JavaScript function which receives the callback data as a parameter. + */ + PerformDataCallback(data: Object, onCallback: ASPxClientDataCallback): void; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback A ASPxClientDataCallback object that represents the JavaScript function which receives the callback data as a parameter. + */ + PerformDataCallback(parameter: string, onCallback: ASPxClientDataCallback): void; +} +/** + * A client-side counterpart of the ImageGallery extension. + */ +interface MVCxClientImageGallery extends ASPxClientImageGallery { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the ImageGallery by processing the passed information on the server, in an Action specified via the ImageGallery's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the ImageGallery by processing the passed information on the server, in an Action specified via the ImageGallery's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the ListBox and ListBoxFor extensions. + */ +interface MVCxClientListBox extends ASPxClientListBox { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the ListBox by processing the passed information on the server, in an Action specified by the ListBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the ListBox by processing the passed information on the server, in an Action specified by the ListBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server, and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; +} +/** + * A client-side counterpart of the NavBar extension. + */ +interface MVCxClientNavBar extends ASPxClientNavBar { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; +} +/** + * A client-side counterpart of the PivotGrid extension. + */ +interface MVCxClientPivotGrid extends ASPxClientPivotGrid { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the PivotGrid by processing the passed information on the server, in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the PivotGrid by processing the passed information on the server, in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Passes PivotGrid callback parameters to the specified object. + * @param obj An object that receives PivotGrid callback parameters. + */ + FillStateObject(obj: Object): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the PopupControl extension. + */ +interface MVCxClientPopupControl extends ASPxClientPopupControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the PopupControl by processing the passed information on the server, in an Action specified via the PopupControl's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the PopupControl by processing the passed information on the server, in an Action specified via the PopupControl's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback with a parameters to update the popup window by processing the related popup window and the passed information on the server, in an Action specified by the PopupControl's CallbackRouteValues property. + * @param window A ASPxClientPopupWindow object identifying the processed popup window. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformWindowCallback(window: ASPxClientPopupWindow, data: Object): void; + /** + * + * @param window + * @param parameter + */ + PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string): void; + /** + * Sends a callback with parameters to update the popup window by processing the related popup window and the passed information on the server. + * @param window A ASPxClientPopupWindow object identifying the processed popup window. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side WindowCallback event, passing the specified argument to it. + * @param parameter A string value that is any information that needs to be sent to the server-side WindowCallback event. + */ + PerformCallback(parameter: string): void; +} +/** + * A client-side equivalent of the MVCxDocumentViewer class. + */ +interface MVCxClientDocumentViewer extends ASPxClientDocumentViewer { + /** + * Occurs before performing a document export request. + */ + BeforeExportRequest: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; +} +/** + * Obsolete. Use the MVCxClientDocumentViewer class instead. + */ +interface MVCxClientReportViewer extends ASPxClientReportViewer { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs before performing a document export request. + */ + BeforeExportRequest: ASPxClientEvent>; +} +/** + * A method that will handle the BeforeExportRequest event. + */ +interface MVCxClientBeforeExportRequestEventHandler { + /** + * A method that will handle the BeforeExportRequest event. + * @param source An object which is the event source. Identifies the client object that raised the event. + * @param e A MVCxClientBeforeExportRequestEventArgs object that contains event data. + */ + (source: S, e: MVCxClientBeforeExportRequestEventArgs): void; +} +/** + * Provides data for client BeforeExportRequest events. + */ +interface MVCxClientBeforeExportRequestEventArgs extends ASPxClientEventArgs { + /** + * Gets an object containing specific information (if any, as name/value pairs) that should be passed as a request parameter from the client to the server side for further processing. + * Value: A hash table object containing named values to be passed from the client to the server side via request parameters. + */ + customArgs: Object; +} +/** + * A client-side equivalent of the MVCxReportDesigner class. + */ +interface MVCxClientReportDesigner extends ASPxClientReportDesigner { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs after executing the Save command on the client. + */ + SaveCommandExecuted: ASPxClientEvent>; + /** + * Sends a callback to the server with the specified argument. + * @param arg A Object value, specifying the callback argument. + */ + PerformCallback(arg: Object): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(arg: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server with the specified argument. + * @param arg A String value, specifying the callback argument. + */ + PerformCallback(arg: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; +} +/** + * A method that will handle the SaveCommandExecuted event. + */ +interface MVCxClientReportDesignerSaveCommandExecutedEventHandler { + /** + * A method that will handle the SaveCommandExecuted event. + * @param source An object which is the event source. Identifies the client object that raised the event. + * @param e A MVCxClientBeforeExportRequestEventArgs object that contains event data. + */ + (source: S, e: MVCxClientReportDesignerSaveCommandExecutedEventArgs): void; +} +/** + * Provides data for the SaveCommandExecuted event. + */ +interface MVCxClientReportDesignerSaveCommandExecutedEventArgs extends ASPxClientEventArgs { + /** + * Returns the operation result. + * Value: A String value, specifying the operation result. + */ + Result: string; +} +/** + * A client-side counterpart of the RichEdit extension. + */ +interface MVCxClientRichEdit extends ASPxClientRichEdit { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the RichEdit by processing the passed information on the server, in an Action specified via the CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the RichEdit by processing the passed information on the server, in an Action specified via the CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the RoundPanel extension. + */ +interface MVCxClientRoundPanel extends ASPxClientRoundPanel { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the Round Panel by processing the passed information on the server, in an Action specified by the Round Panel's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the Round Panel by processing the passed information on the server, in an Action specified by the Round Panel's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. + * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. + * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the Scheduler extension. + */ +interface MVCxClientScheduler extends ASPxClientScheduler { + ToolTipDisplaying: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the Scheduler by processing the passed information on the server, in an Action specified via the Scheduler's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the Scheduler by processing the passed information on the server, in an Action specified via the Scheduler's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; +} +/** + * A template that is rendered to display a tooltip. + */ +interface MVCxClientSchedulerTemplateToolTip extends ASPxClientToolTipBase { + type: MVCxSchedulerToolTipType; +} +/** + * A delegate method that enables you to adjust the tooltip content before displaying. + */ +interface MVCxClientSchedulerToolTipDisplayingEventHandler { + /** + * + * @param source + * @param e + */ + (source: S, e: MVCxClientSchedulerToolTipDisplayingEventArgs): void; +} +/** + * Provides data for the ToolTipDisplaying event. + */ +interface MVCxClientSchedulerToolTipDisplayingEventArgs extends ASPxClientEventArgs { + toolTip: MVCxClientSchedulerTemplateToolTip; + data: ASPxClientSchedulerToolTipData; +} +/** + * Lists available tooltip types. + */ +interface MVCxSchedulerToolTipType { +} +/** + * A client-side counterpart of the Spreadsheet extension. + */ +interface MVCxClientSpreadsheet extends ASPxClientSpreadsheet { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the Spreadsheet by processing the passed information on the server, in an Action specified via the CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the Spreadsheet by processing the passed information on the server, in an Action specified via the CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the PageControl extension. + */ +interface MVCxClientPageControl extends ASPxClientPageControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the PageControl by processing the passed information on the server, in an Action specified by the PageControl's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the PageControl by processing the passed information on the server, in an Action specified by the PageControl's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the TokenBox and TokenBoxFor extensions. + */ +interface MVCxClientTokenBox extends ASPxClientTokenBox { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the TokenBox by processing the passed information on the server, in an Action specified by the TokenBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the TokenBox by processing the passed information on the server, in an Action specified by the TokenBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; +} +/** + * A client-side counterpart of the TreeList extension. + */ +interface MVCxClientTreeList extends ASPxClientTreeList { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the TreeList by processing the passed information on the server, in an Action specified via the TreeList's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the TreeList by processing the passed information on the server, in an Action specified via the TreeList's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the TreeList's CustomDataCallback event. This method does not update the TreeList. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. + */ + PerformCustomDataCallback(data: Object): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side CustomDataCallback event. + */ + PerformCustomDataCallback(arg: string): void; +} +/** + * A client-side counterpart of the TreeView extension. + */ +interface MVCxClientTreeView extends ASPxClientTreeView { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; +} +/** + * A client-side counterpart of the UploadControl extension. + */ +interface MVCxClientUploadControl extends ASPxClientUploadControl { +} +/** + * A method that will handle client BeginCallback events. + */ +interface MVCxClientBeginCallbackEventHandler { + /** + * A method that will handle client BeginCallback events. + * @param source An object which is the event source. Identifies the client object that raised the event. + * @param e A MVCxClientBeginCallbackEventArgs object that contains event data. + */ + (source: S, e: MVCxClientBeginCallbackEventArgs): void; +} +/** + * Provides data for client BeginCallback events. + */ +interface MVCxClientBeginCallbackEventArgs extends ASPxClientBeginCallbackEventArgs { + /** + * Gets an object containing specific information (if any, as name/value pairs) that should be passed as a request parameter from the client to the server side for further processing. + * Value: A hash table object containing named values to be passed from the client to the server side via request parameters. + */ + customArgs: Object; +} +/** + * A method that will handle the BeginCallback event. + */ +interface MVCxClientGlobalBeginCallbackEventHandler { + /** + * A method that will handle the BeginCallback event. + * @param source An object which is the event source. Identifies the client object that raised the event. + * @param e A MVCxClientGlobalBeginCallbackEventArgs object that contains event data. + */ + (source: S, e: MVCxClientGlobalBeginCallbackEventArgs): void; +} +/** + * Provides data for the BeginCallback event. + */ +interface MVCxClientGlobalBeginCallbackEventArgs extends ASPxClientGlobalBeginCallbackEventArgs { + /** + * Gets an object containing specific information (if any, as name/value pairs) that should be passed as a request parameter from the client to the server side for further processing. + * Value: A hash table object containing named values to be passed from the client to the server side via request parameters. + */ + customArgs: Object; +} +/** + * An ASP.NET MVC equivalent of the client ASPxClientGlobalEvents component. + */ +interface MVCxClientGlobalEvents { + /** + * Occurs on the client side after client object models of all DevExpress MVC extensions contained within the page have been initialized. + */ + ControlsInitialized: ASPxClientEvent>; + /** + * Occurs on the client when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by a DevExpress MVC extension. + */ + CallbackError: ASPxClientEvent>; +} +/** + * A client-side counterpart of the VerticalGrid extension. + */ +interface MVCxClientVerticalGrid extends ASPxClientVerticalGrid { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the VerticalGrid by processing the passed information on the server in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the VerticalGrid by processing the passed information on the server in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the VerticalGrid's CustomDataActionRouteValues property, and then process the returned result in the specified client function. This method does not update the VerticalGrid. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. + * @param onCallback A ASPxClientGridViewValuesCallback object that represents the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(data: Object, onCallback: ASPxClientGridViewValuesCallback): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event. + * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback A ASPxClientVerticalGridValuesCallback object that is the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(args: string, onCallback: ASPxClientVerticalGridValuesCallback): void; +} +/** + * A client-side equivalent of the MVCxWebDocumentViewer class. + */ +interface MVCxClientWebDocumentViewer extends ASPxClientWebDocumentViewer { +} +/** + * Serves as the base type for all the objects included in the client-side object model. + */ +interface ASPxClientControlBase { + /** + * Gets the unique, hierarchically-qualified identifier for the control. + * Value: The fully-qualified identifier for the control. + */ + name: string; + /** + * Occurs on the client side after the control has been initialized. + */ + Init: ASPxClientEvent>; + /** + * Returns an HTML element that is the root of the control's hierarchy. + */ + GetMainElement(): Object; + /** + * Returns a value specifying whether a control is displayed. + */ + GetClientVisible(): boolean; + /** + * Specifies whether a control is displayed. + * @param visible + */ + SetClientVisible(visible: boolean): void; + /** + * Returns a value specifying whether a control is displayed. + */ + GetVisible(): boolean; + /** + * Specifies whether a control is displayed. + * @param visible true to make a control visible; false to make it hidden. + */ + SetVisible(visible: boolean): void; + /** + * Returns a value that determines whether a callback request sent by a web control is being currently processed on the server side. + */ + InCallback(): boolean; +} +/** + * Serves as the base type for all the objects included in the client-side object model. + */ +interface ASPxClientControl extends ASPxClientControlBase { + /** + * Returns the control's width. + */ + GetWidth(): number; + /** + * Returns the control's height. + */ + GetHeight(): number; + /** + * Specifies the control's width. + * @param width An integer value that specifies the control's width. + */ + SetWidth(width: number): void; + /** + * Specifies the control's height. Note that this method is not in effect for some controls. + * @param height An integer value that specifies the control's height. + */ + SetHeight(height: number): void; + /** + * Modifies the control's size against the control's container. + */ + AdjustControl(): void; +} +/** + * Represents a client-side equivalent of the ASPxCallback control. + */ +interface ASPxClientCallback extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientCallback. + */ + CallbackError: ASPxClientEvent>; + /** + * Fires on the client side when a callback initiated by the client Callback event's handler returns back to the client. + */ + CallbackComplete: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side Callback event passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + SendCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A method that will handle the client events related to completion of callback server-side processing. + */ +interface ASPxClientCallbackCompleteEventHandler { + /** + * A method that will handle the client events related to completion of callback server-side processing. + * @param source An object representing the event source. Identifies the web control that raised the event. + * @param e An ASPxClientCallbackCompleteEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCallbackCompleteEventArgs): void; +} +/** + * Serves as the base class for arguments of the web controls' client-side events. + */ +interface ASPxClientEventArgs { +} +/** + * Provides data for events concerning the final processing of a callback. + */ +interface ASPxClientCallbackCompleteEventArgs extends ASPxClientEventArgs { + /** + * Gets a string that contains specific information (if any) passed from the client side for server-side processing. + * Value: A string value representing specific information passed from the client to the server side. + */ + parameter: string; + /** + * Gets a string that contains specific information (if any) that has been passed from the server to the client side for further processing. + * Value: A string value representing specific information passed from the server back to the client side. + */ + result: string; +} +/** + * Represents a client-side equivalent of the ASPxCallbackPanel control. + */ +interface ASPxClientCallbackPanel extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientCallbackPanel. + */ + CallbackError: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Returns the text displayed within the control's loading panel. + */ + GetLoadingPanelText(): string; + /** + * Sets the text to be displayed within the control's loading panel. + * @param loadingPanelText A string value specifying the text to be displayed within the loading panel. + */ + SetLoadingPanelText(loadingPanelText: string): void; + /** + * Sets a value specifying whether the callback panel is enabled. + * @param enabled true, to enable the callback panel; false to disable it. + */ + SetEnabled(enabled: boolean): void; + /** + * Returns a value specifying whether a callback panel is enabled. + */ + GetEnabled(): boolean; +} +/** + * Represents the event object used for client-side events. + */ +interface ASPxClientEvent { + /** + * Dynamically connects the event with an appropriate event handler function. + * @param handler An object representing the event handling function's content. + */ + AddHandler(handler: T): void; + /** + * Dynamically disconnects the event from the associated event handler function. + * @param handler An object representing the event handling function's content. + */ + RemoveHandler(handler: T): void; + /** + * Dynamically disconnects the event from all the associated event handler functions. + */ + ClearHandlers(): void; + /** + * For internal use only. + * @param source + * @param e + */ + FireEvent(source: Object, e: ASPxClientEventArgs): void; +} +/** + * A method that will handle the client-side events of a web control's client-side equivalent. + */ +interface ASPxClientEventHandler { + /** + * A method that will handle the client-side events of a web control's client-side equivalent. + * @param source An object representing the event source. Identifies the control that raised the event. + * @param e An ASPxClientEventArgs object that contains event data. + */ + (source: S, e: ASPxClientEventArgs): void; +} +/** + * A method that will handle the cancelable events of a web control's client-side equivalent. + */ +interface ASPxClientCancelEventHandler { + /** + * A method that will handle the cancelable events of a web control's client-side equivalent. + * @param source An object representing the event source. Identifies the web control that raised the event. + * @param e An ASPxClientCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCancelEventArgs): void; +} +/** + * Provides data for cancelable client events. + */ +interface ASPxClientCancelEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the client events which can't be cancelled and allow the event's processing to be passed to the server side. + */ +interface ASPxClientProcessingModeEventHandler { + /** + * A method that will handle the client events which can't be cancelled and allow the event's processing to be passed to the server side. + * @param source An object representing the event source. Identifies the web control that raised the event. + * @param e An ASPxClientProcessingModeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientProcessingModeEventArgs): void; +} +/** + * Provides data for the client events which can't be cancelled and allow the event's processing to be passed to the server side. + */ +interface ASPxClientProcessingModeEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets a value that specifies whether the event should be finally processed on the server side. + * Value: true to process the event on the server side; false to completely handle it on the client side. + */ + processOnServer: boolean; +} +/** + * A method that will handle the cancelable client-side events which allow the event's processing to be passed to the server side. + */ +interface ASPxClientProcessingModeCancelEventHandler { + /** + * A method that will handle the cancelable client-side events which allow the event's processing to be passed to the server side. + * @param source An object representing the event source. Identifies the web control that raised the event. + * @param e An ASPxClientProcessingModeCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientProcessingModeCancelEventArgs): void; +} +/** + * Provides data for the cancelable client-side events which allow the event's processing to be passed to the server side. + */ +interface ASPxClientProcessingModeCancelEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * Represents a JavaScript function which receives callback data obtained via a call to a specific client method (such as the PerformDataCallback). + */ +interface ASPxClientDataCallback { + /** + * A JavaScript function which receives a callback data obtained via a call to a specific client method (such as the PerformDataCallback). + * @param sender An object whose client method generated a callback. + * @param result A string value that represents the result of server-side callback processing. + */ + (sender: Object, result: string): void; +} +/** + * Represents a client-side equivalent of the ASPxCloudControl control. + */ +interface ASPxClientCloudControl extends ASPxClientControl { + /** + * Fires after an item has been clicked. + */ + ItemClick: ASPxClientEvent>; +} +/** + * A method that will handle client events involving manipulations with the control's items. + */ +interface ASPxClientCloudControlItemEventHandler { + /** + * A method that will handle client events concerning manipulations with items. + * @param source The event source. This parameter identifies the cloud control object which raised the event. + * @param e An ASPxClientCloudControlItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCloudControlItemEventArgs): void; +} +/** + * Provides data for events which involve clicking on the control's items. + */ +interface ASPxClientCloudControlItemEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the name that uniquely identifies the processed item. + * Value: A string value that represents the value assigned to the item's Name property. + */ + name: Object; + /** + * Gets the HTML object that contains the processed item. + * Value: An object representing a container for the item related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * A method that will handle the client events related to the begining of a callback processing round trip. + */ +interface ASPxClientBeginCallbackEventHandler { + /** + * A method that will handle client BeginCallback events. + * @param source An object representing the event source. Identifies the web control that raised the event. + * @param e An ASPxClientBeginCallbackEventArgs object that contains event data. + */ + (source: S, e: ASPxClientBeginCallbackEventArgs): void; +} +/** + * Provides data for client events related to the beginning of a callback processing round trip. + */ +interface ASPxClientBeginCallbackEventArgs extends ASPxClientEventArgs { + /** + * Gets a command name that identifies which client action forced a callback to be occurred. + * Value: A string value that represents the name of the command which initiated a callback. + */ + command: string; +} +/** + * A method that will handle the BeginCallback event. + */ +interface ASPxClientGlobalBeginCallbackEventHandler { + /** + * A method that will handle the BeginCallback event. + * @param source The event source. + * @param e An ASPxDataValidationEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGlobalBeginCallbackEventArgs): void; +} +/** + * Provides data for the BeginCallback event. + */ +interface ASPxClientGlobalBeginCallbackEventArgs extends ASPxClientBeginCallbackEventArgs { + /** + * Gets an object that initiated a callback. + * Value: An class descendant object that is the control that initiated a callback. + */ + control: ASPxClientControl; +} +/** + * A method that will handle the client events related to the completion of a callback processing round trip. + */ +interface ASPxClientEndCallbackEventHandler { + /** + * A method that will handle client EndCallback events. + * @param source An object representing the event source. + * @param e A MenuItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientEndCallbackEventArgs): void; +} +/** + * Provides data for client events related to the completion of a callback processing round trip. + */ +interface ASPxClientEndCallbackEventArgs extends ASPxClientEventArgs { +} +/** + * A method that will handle the EndCallback event. + */ +interface ASPxClientGlobalEndCallbackEventHandler { + /** + * A method that will handle the EndCallback event. + * @param source The event source. + * @param e An ASPxDataValidationEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGlobalEndCallbackEventArgs): void; +} +/** + * Provides data for the EndCallback event. + */ +interface ASPxClientGlobalEndCallbackEventArgs extends ASPxClientEndCallbackEventArgs { + /** + * Gets an object that initiated a callback. + * Value: An class descendant object that is the control that initiated a callback. + */ + control: ASPxClientControl; +} +/** + * A method that will handle a CustomCallback client event exposed by some DevExpress web controls. + */ +interface ASPxClientCustomDataCallbackEventHandler { + /** + * A method that will handle the client CustomCallback event of some controls. + * @param source An object representing the event source. + * @param e An ASPxClientCustomDataCallbackEventHandler object that contains event data. + */ + (source: S, e: ASPxClientCustomDataCallbackEventArgs): void; +} +/** + * Provides data for the CustomCallback event. + */ +interface ASPxClientCustomDataCallbackEventArgs extends ASPxClientEventArgs { + /** + * Gets a string that contains specific information (if any) that has been passed from the server to the client side for further processing, related to the CustomCallback event. + * Value: A string value representing specific information passed from the server back to the client side. + */ + result: string; +} +/** + * A method that will handle client events related to server-side errors that occured during callback processing. + */ +interface ASPxClientCallbackErrorEventHandler { + /** + * A method that will handle client CallbackError events. + * @param source An object representing the event source. + * @param e A ASPxClientCallbackErrorEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCallbackErrorEventArgs): void; +} +/** + * Provides data for client events related to server-side errors that occured during callback processing. + */ +interface ASPxClientCallbackErrorEventArgs extends ASPxClientEventArgs { + /** + * Gets the error message that describes the server error that occurred. + * Value: A string value that represents the error message. + */ + message: string; + /** + * Gets or sets whether the event is handled and the default error handling actions are not required. + * Value: true if the error is handled and no default processing is required; otherwise false. + */ + handled: boolean; +} +/** + * A method that will handle the CallbackError event. + */ +interface ASPxClientGlobalCallbackErrorEventHandler { + /** + * A method that will handle the CallbackError event. + * @param source The event source. + * @param e An ASPxDataValidationEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGlobalCallbackErrorEventArgs): void; +} +/** + * Provides data for the CallbackError event. + */ +interface ASPxClientGlobalCallbackErrorEventArgs extends ASPxClientCallbackErrorEventArgs { + /** + * Gets an object that initiated a callback. + * Value: An class descendant object that is the control that initiated a callback. + */ + control: ASPxClientControl; +} +/** + * A method that will handle the ValidationCompleted client event. + */ +interface ASPxClientValidationCompletedEventHandler { + /** + * A method that will handle the ValidationCompleted event. + * @param source An object representing the event source. Identifies the ASPxClientGlobalEvents object that raised the event. + * @param e An ASPxClientValidationCompletedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientValidationCompletedEventArgs): void; +} +/** + * Provides data for the ValidationCompleted client event that allows you to centrally validate user input within all DevExpress web controls to which validation is applied. + */ +interface ASPxClientValidationCompletedEventArgs extends ASPxClientEventArgs { + /** + * Gets a container object that holds the validated control(s). + * Value: An object that represents a container of the validated control(s). + */ + container: Object; + /** + * Gets the name of the validation group name to which validation has been applied. + * Value: A string value that represents the name of the validation group that has been validated. + */ + validationGroup: string; + /** + * Gets a value that indicates whether validation has been applied to both visible and invisible controls. + * Value: true if validation has been applied to both visible and invisible controls; false if only visible controls have been validated. + */ + invisibleControlsValidated: boolean; + /** + * Gets a value specifying whether the validation has been completed successfully. + * Value: true if the validation has been completed successfully; otherwise, false. + */ + isValid: boolean; + /** + * Gets the first control (either visible or invisible) that hasn't passed the validation applied. + * Value: An ASPxClientControl object that represents the first invalid control. + */ + firstInvalidControl: ASPxClientControl; + /** + * Gets the first visible control that hasn't passed the validation applied. + * Value: An ASPxClientControl object that represents the first visible invalid control. + */ + firstVisibleInvalidControl: ASPxClientControl; +} +/** + * A method that will handle the client ControlsInitialized event. + */ +interface ASPxClientControlsInitializedEventHandler { + /** + * A method that will handle the client ControlsInitialized event. + * @param source An object representing the event source. + * @param e An ASPxClientControlsInitializedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientControlsInitializedEventArgs): void; +} +/** + * Provides data for the client ControlsInitialized event. + */ +interface ASPxClientControlsInitializedEventArgs extends ASPxClientEventArgs { + /** + * Gets a value that specifies whether a callback is sent during a controls initialization. + * Value: true if a callback is sent; otherwise, false. + */ + isCallback: boolean; +} +interface ASPxClientControlPredicate { + /** + * + * @param control + */ + (control: Object): boolean; +} +interface ASPxClientControlAction { + /** + * + * @param control + */ + (control: Object): void; +} +/** + * A collection object used on the client side to maintain particular client control objects + */ +interface ASPxClientControlCollection { + /** + * Occurs on the client side after client object models of all DevExpress web controls contained within the page have been initialized. + */ + ControlsInitialized: ASPxClientEvent>; + /** + * Occurs when the browser window is being resized. + */ + BrowserWindowResized: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated by any DevExpress control. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side, after server-side processing of a callback initiated by any DevExpress web control, has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by any DevExpress web control. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs after the validation initiated for a DevExpress web control (or a group of DevExpress web controls) has been completed. + */ + ValidationCompleted: ASPxClientEvent>; + /** + * Returns a collection item identified by its unique hierarchically-qualified identifier. + * @param name A string value representing the hierarchically-qualified identifier of the required control. + */ + Get(name: Object): Object; + /** + * Returns a DevExpress client control object identified by its unique hierarchically-qualified identifier (either ClientInstanceName or ClientID property value). + * @param name A string value that is the hierarchically-qualified identifier of the required DevExpress control. + */ + GetByName(name: string): Object; + /** + * 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[]; + /** + * Returns all controls of the specified type. + * @param type The object specifying the client control type. + */ + GetControlsByType(type: Object): Object[]; + /** + * Performs the specified action for each control in the collection. + * @param action An ASPxClientControlAction object specifying an action to perform. + */ + ForEachControl(action: ASPxClientControlAction): void; +} +/** + * Represents a client-side equivalent of the ASPxDataView object. + */ +interface ASPxClientDataView extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientDataView. + */ + CallbackError: ASPxClientEvent>; + /** + * Activates the specified page. + * @param pageIndex An integer value that specifies the active page's index. + */ + GotoPage(pageIndex: number): void; + /** + * Gets the index of the page that is currently active. + */ + GetPageIndex(): number; + /** + * Gets the size of a single ASPxDataView's page. + */ + GetPageSize(): number; + /** + * Sets the size of a single ASPxDataView's page. + * @param pageSize An integer value that specifies the page size. + */ + SetPageSize(pageSize: number): void; + /** + * Gets the number of pages into which the ASPxDataView's data is divided. + */ + GetPageCount(): number; + /** + * Activates the next page. + */ + NextPage(): void; + /** + * Activates the previous page. + */ + PrevPage(): void; + /** + * Activates the first page. + */ + FirstPage(): void; + /** + * Activates the last page. + */ + LastPage(): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A JavaScript function which returns a value specifying whether an object meets the criteria defined within the method specified by this delegate. + */ +interface ASPxClientDockingFilterPredicate { + /** + * A JavaScript function which returns a value specifying whether an object meets the criteria defined within the method specified by this delegate. + * @param item An object to compare against the criteria defined within the method. + */ + (item: Object): boolean; +} +/** + * A client-side equivalent of the ASPxDockManager object. + */ +interface ASPxClientDockManager extends ASPxClientControl { + /** + * Fires on the client side before a panel is docked in a zone and allows you to cancel the action. + */ + BeforeDock: ASPxClientEvent>; + /** + * Fires on the client side after a panel is docked in a zone. + */ + AfterDock: ASPxClientEvent>; + /** + * Fires on the client side before a panel is made floating (undocked from a zone) and allows you to cancel the action. + */ + BeforeFloat: ASPxClientEvent>; + /** + * Fires on the client side after a panel is undocked from a zone. + */ + AfterFloat: ASPxClientEvent>; + /** + * Occurs when a panel dragging operation is started. + */ + StartPanelDragging: ASPxClientEvent>; + /** + * Occurs after a panel dragging operation is complete. + */ + EndPanelDragging: ASPxClientEvent>; + /** + * Occurs on the client side before a panel is closed, and allows you to cancel the action. + */ + PanelClosing: ASPxClientEvent>; + /** + * Occurs on the client side when a panel is closed. + */ + PanelCloseUp: ASPxClientEvent>; + /** + * Occurs on the client side when a panel pops up. + */ + PanelPopUp: ASPxClientEvent>; + /** + * Occurs on the client side after a panel has been invoked. + */ + PanelShown: ASPxClientEvent>; + /** + * Occurs on the client side after a panel has been resized. + */ + PanelResize: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Returns a zone specified by its unique identifier (zoneUID). + * @param zoneUID A string value specifying the unique identifier of the zone. + */ + GetZoneByUID(zoneUID: string): ASPxClientDockZone; + /** + * Returns a panel specified by its unique identifier (panelUID). + * @param panelUID A string value specifying the unique identifier of the panel. + */ + GetPanelByUID(panelUID: string): ASPxClientDockPanel; + /** + * Returns an array of panels contained in a page. + */ + GetPanels(): ASPxClientDockPanel[]; + /** + * Returns an array of panels that are contained in a page and meet a specified criteria. + * @param filterPredicate An ASPxClientDockingFilterPredicate delegate that defines a set of criteria and determines whether a panel meets those criteria. + */ + GetPanels(filterPredicate: ASPxClientDockingFilterPredicate): ASPxClientDockPanel[]; + /** + * Returns an array of zones contained in a page. + */ + GetZones(): ASPxClientDockZone[]; + /** + * Returns an array of zones that are contained in a page and meet a specified criteria. + * @param filterPredicate An ASPxClientDockingFilterPredicate delegate that defines a set of criteria and determines whether a zone meets those criteria. + */ + GetZones(filterPredicate: ASPxClientDockingFilterPredicate): ASPxClientDockZone[]; +} +/** + * A method that will handle the client BeforeDock event. + */ +interface ASPxClientDockManagerProcessingModeCancelEventHandler { + /** + * A method that will handle the BeforeDock event. + * @param source The event source. This parameter identifies the dock manager object which raised the event. + * @param e An ASPxClientDockManagerProcessingModeCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockManagerProcessingModeCancelEventArgs): void; +} +/** + * Provides data for the BeforeDock event. + */ +interface ASPxClientDockManagerProcessingModeCancelEventArgs extends ASPxClientProcessingModeCancelEventArgs { + /** + * Gets the panel currently being processed. + * Value: An ASPxClientDockPanel object that is the processed panel. + */ + panel: ASPxClientDockPanel; + /** + * Gets the zone currently being processed. + * Value: An ASPxClientDockZone object that is the processed zone. + */ + zone: ASPxClientDockZone; +} +/** + * A method that will handle the client AfterDock event. + */ +interface ASPxClientDockManagerProcessingModeEventHandler { + /** + * A method that will handle the AfterDock event. + * @param source The event source. This parameter identifies the dock manager object which raised the event. + * @param e An ASPxClientDockManagerProcessingModeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockManagerProcessingModeEventArgs): void; +} +/** + * Provides data for the AfterDock event. + */ +interface ASPxClientDockManagerProcessingModeEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the panel currently being processed. + * Value: An ASPxClientDockPanel object that is the processed panel. + */ + panel: ASPxClientDockPanel; + /** + * Gets the zone currently being processed. + * Value: An ASPxClientDockZone object that is the processed zone. + */ + zone: ASPxClientDockZone; +} +/** + * A method that will handle client-side events concerning manipulations with panels. + */ +interface ASPxClientDockManagerEventHandler { + /** + * A method that will handle client-side events concerning manipulations with panels. + * @param source The event source. This parameter identifies the dock manager object which raised the event. + * @param e An ASPxClientDockManagerEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockManagerEventArgs): void; +} +/** + * Provides data for events which concern manipulations on panels. + */ +interface ASPxClientDockManagerEventArgs extends ASPxClientEventArgs { + /** + * Gets the panel currently being processed. + * Value: An ASPxClientDockPanel object that is the processed panel. + */ + panel: ASPxClientDockPanel; +} +/** + * A method that will handle the client BeforeDock event. + */ +interface ASPxClientDockManagerCancelEventHandler { + /** + * A method that will handle the PanelClosing event. + * @param source The event source. This parameter identifies the dock manager object which raised the event. + * @param e An ASPxClientDockManagerCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockManagerCancelEventArgs): void; +} +/** + * Provides data for the BeforeDock event. + */ +interface ASPxClientDockManagerCancelEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the panel currently being processed. + * Value: An ASPxClientDockPanel object that is the processed panel. + */ + panel: ASPxClientDockPanel; +} +/** + * Serves as a base class for the ASPxClientPopupControl classes. + */ +interface ASPxClientPopupControlBase extends ASPxClientControl { + /** + * Occurs on the client side when window resizing initiates. + */ + BeforeResizing: ASPxClientEvent>; + /** + * Occurs on the client side when window resizing completes. + */ + AfterResizing: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the control. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client side when a control's window closes or hides. + */ + CloseUp: ASPxClientEvent>; + /** + * Enables you to cancel window closing on the client side. + */ + Closing: ASPxClientEvent>; + /** + * Occurs on the client side when a control's window is invoked. + */ + PopUp: ASPxClientEvent>; + /** + * Occurs on the client side after a window has been resized. + */ + Resize: ASPxClientEvent>; + /** + * Occurs on the client side after a control's window has been invoked. + */ + Shown: ASPxClientEvent>; + /** + * Occurs on the client side when the window pin state is changed. + */ + PinnedChanged: ASPxClientEvent>; + /** + * Modifies a control's window size in accordance with the content. + */ + AdjustSize(): void; + /** + * Brings the window to the front of the z-order. + */ + BringToFront(): void; + /** + * Returns a value indicating whether the window is collapsed. + */ + GetCollapsed(): boolean; + /** + * Returns the HTML code that specifies the contents of the control's window. + */ + GetContentHtml(): string; + /** + * Returns an iframe object containing a web page specified via the control's SetContentUrl client method). + */ + GetContentIFrame(): Object; + /** + * Returns an iframe object containing a web page specified via the control's SetContentUrl client method). + */ + GetContentIFrameWindow(): Object; + /** + * Returns the URL pointing to the web page displayed within the control's window. + */ + GetContentUrl(): string; + /** + * Returns the URL pointing to the image displayed within the window footer by default. + */ + GetFooterImageUrl(): string; + /** + * Returns the URL where the web browser will navigate when the text or image is clicked within a window's footer. + */ + GetFooterNavigateUrl(): string; + /** + * Returns the text displayed within a window's footer. + */ + GetFooterText(): string; + /** + * Returns the URL pointing to the image displayed within the window header. + */ + GetHeaderImageUrl(): string; + /** + * Returns the URL where the web browser will navigate when the text or image is clicked within a window's header. + */ + GetHeaderNavigateUrl(): string; + /** + * Returns the text displayed within a window's header. + */ + GetHeaderText(): string; + /** + * Gets the width of the default window's (for ASPxPopupControl) or panel's (for ASPxDockPanel) content region. + */ + GetContentWidth(): number; + /** + * Gets the height of the default window's (for ASPxPopupControl) or panel's (for ASPxDockPanel) content region. + */ + GetContentHeight(): number; + /** + * Returns a value indicating whether the window is maximized. + */ + GetMaximized(): boolean; + /** + * Returns a value indicating whether the window is pinned. + */ + GetPinned(): boolean; + /** + * Sends a callback to the server and generates the server-side WindowCallback event, passing the specified argument to it. + * @param parameter A string value that is any information that needs to be sent to the server-side WindowCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Refreshes the content of the web page displayed within the control's window. + */ + RefreshContentUrl(): void; + /** + * Sets a value indicating whether the window is collapsed. + * @param value true, to collapse the window; otherwise, false. + */ + SetCollapsed(value: boolean): void; + /** + * Sets the HTML markup specifying the contents of the control's window. + * @param html A string value that specifies the HTML markup. + */ + SetContentHtml(html: string): void; + /** + * Sets the URL to point to the web page that should be loaded into, and displayed within the control's window. + * @param url A string value specifying the URL to the web page displayed within the control's window. + */ + SetContentUrl(url: string): void; + /** + * Specifies the URL which points to the image displayed within the window footer by default. + * @param value A string value that is the URL for the image displayed within the window footer. + */ + SetFooterImageUrl(value: string): void; + /** + * Specifies the URL where the web browser will navigate when the text or image is clicked within a window's footer. + * @param value A string value which specifies the required navigation location. + */ + SetFooterNavigateUrl(value: string): void; + /** + * Specifies the text displayed within a window's footer. + * @param value A string value that specifies a window's footer text. + */ + SetFooterText(value: string): void; + /** + * Specifies the URL which points to the image displayed within the window header. + * @param value A string value that is the URL to the image displayed within the header. + */ + SetHeaderImageUrl(value: string): void; + /** + * Specifies the URL where the web browser will navigate when the text or image is clicked within a window's header. + * @param value A string value which specifies the required navigation location. + */ + SetHeaderNavigateUrl(value: string): void; + /** + * Specifies the text displayed within a window's header. + * @param value A string value that specifies a window's header text. + */ + SetHeaderText(value: string): void; + /** + * Sets a value indicating whether the window is maximized. + * @param value true. to maximize the window; otherwise, false. + */ + SetMaximized(value: boolean): void; + /** + * Sets a value indicating whether the window is pinned. + * @param value true, to pin the window; otherwise, false. + */ + SetPinned(value: boolean): void; + /** + * Invokes the control's window. + */ + Show(): void; + /** + * Invokes the control's window at the popup element with the specified index. + * @param popupElementIndex An integer value specifying the zero-based index of the popup element. + */ + Show(popupElementIndex: number): void; + /** + * Invokes the control's window and displays it over the specified HTML element. + * @param htmlElement An object specifying the HTML element relative to whose position the window is invoked. + */ + ShowAtElement(htmlElement: Object): void; + /** + * Invokes the control's window and displays it over an HTML element specified by its unique identifier. + * @param id A string value that specifies the hierarchically qualified identifier of an HTML element relative to whose position the window is invoked. + */ + ShowAtElementByID(id: string): void; + /** + * Invokes the control's window at the specified position. + * @param x A integer value specifying the x-coordinate of the window's display position. + * @param y A integer value specifying the y-coordinate of the window's display position. + */ + ShowAtPos(x: number, y: number): void; + /** + * Closes the control's window. + */ + Hide(): void; + /** + * Returns a value that specifies whether the control's window is displayed. + */ + IsVisible(): boolean; +} +/** + * A client-side equivalent of the ASPxDockPanel object. + */ +interface ASPxClientDockPanel extends ASPxClientPopupControlBase { + /** + * Gets or sets the unique identifier of a panel on a page. + * Value: A string that is the unique identifier of a panel. + */ + panelUID: string; + /** + * Fires on the client side before a panel is docked in a zone and allows you to cancel the action. + */ + BeforeDock: ASPxClientEvent>; + /** + * Fires on the client side after a panel is docked in a zone. + */ + AfterDock: ASPxClientEvent>; + /** + * Fires on the client side before a panel is made floating (undocked from a zone) and allows you to cancel the action. + */ + BeforeFloat: ASPxClientEvent>; + /** + * Fires on the client side after a panel is undocked from a zone. + */ + AfterFloat: ASPxClientEvent>; + /** + * Occurs when a panel dragging operation is started. + */ + StartDragging: ASPxClientEvent>; + /** + * Occurs after a panel dragging operation is complete. + */ + EndDragging: ASPxClientEvent>; + /** + * Retrieves a zone that owns the current panel. + */ + GetOwnerZone(): ASPxClientDockZone; + /** + * Docks the current panel in the specified zone. + * @param zone An ASPxClientDockZone object specifying the zone. + */ + Dock(zone: ASPxClientDockZone): void; + /** + * Docks the current panel in a zone at the specified position. + * @param zone An ASPxClientDockZone object specifying the zone, where the panel is docked + * @param visibleIndex An integer value specifying the visible index position. + */ + Dock(zone: ASPxClientDockZone, visibleIndex: number): void; + /** + * Undocks the current panel. + */ + MakeFloat(): void; + /** + * Undocks the current panel and place it at the specified position. + * @param x An integer value that specifies the X-coordinate of the panel's display position. + * @param y An integer value that specifies the Y-coordinate of the panel's display position. + */ + MakeFloat(x: number, y: number): void; + /** + * Gets or sets a value specifying the position of the current panel, amongst the visible panels within a zone. + */ + GetVisibleIndex(): number; + /** + * Sets a value specifying the position of the current panel, amongst the visible panels in a zone. + * @param visibleIndex An integer value specifying the zero-based index of the panel amongst visible panels in the zone. + */ + SetVisibleIndex(visibleIndex: number): void; + /** + * Returns a value indicating whether the panel is docked. + */ + IsDocked(): boolean; +} +/** + * A method that will handle the client BeforeDock event. + */ +interface ASPxClientDockPanelProcessingModeCancelEventHandler { + /** + * A method that will handle the BeforeDock event. + * @param source A ASPxClientDockPanel object that raised the event. + * @param e A ASPxClientDockPanelProcessingModeCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockPanelProcessingModeCancelEventArgs): void; +} +/** + * Provides data for the BeforeDock event. + */ +interface ASPxClientDockPanelProcessingModeCancelEventArgs extends ASPxClientProcessingModeCancelEventArgs { + /** + * Gets the zone currently being processed. + * Value: An ASPxClientDockZone object that is the processed zone. + */ + zone: ASPxClientDockZone; +} +/** + * A method that will handle the client BeforeDock event. + */ +interface ASPxClientDockPanelProcessingModeEventHandler { + /** + * A method that will handle the AfterFloat event. + * @param source A ASPxClientDockPanel object that raised the event. + * @param e A ASPxClientDockPanelProcessingModeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockPanelProcessingModeEventArgs): void; +} +/** + * Provides data for the AfterFloat event. + */ +interface ASPxClientDockPanelProcessingModeEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the zone currently being processed. + * Value: An ASPxClientDockZone object that is the processed zone. + */ + zone: ASPxClientDockZone; +} +/** + * A client-side equivalent of the ASPxDockZone object. + */ +interface ASPxClientDockZone extends ASPxClientControl { + /** + * Gets or sets the unique identifier of a zone on a page. + * Value: A string that is the unique identifier of a zone. + */ + zoneUID: string; + /** + * Fires on the client side before a panel is docked in a zone and allows you to cancel the action. + */ + BeforeDock: ASPxClientEvent>; + /** + * Fires on the client side after a panel is docked in a zone. + */ + AfterDock: ASPxClientEvent>; + /** + * Returns a value that indicates the orientation in which panels are stacked in the current zone. + */ + IsVertical(): boolean; + /** + * Gets a value that indicates whether the zone can enlarge its size. + */ + GetAllowGrowing(): boolean; + /** + * Gets the number of panels contained in the zone. + */ + GetPanelCount(): number; + /** + * Returns a panel specified by its unique identifier (panelUID). + * @param panelUID A string value specifying the unique identifier of the panel. + */ + GetPanelByUID(panelUID: string): ASPxClientDockPanel; + /** + * Returns a panel specified by its visible index. + * @param visibleIndex An integer value specifying the panel's position among the visible panels within the current zone. + */ + GetPanelByVisibleIndex(visibleIndex: number): ASPxClientDockPanel; + /** + * Returns an array of panels docked in the current zone. + */ + GetPanels(): ASPxClientDockPanel[]; + /** + * Returns an array of panels that are docked in the current zone and meet a specified criteria. + * @param filterPredicate An ASPxClientDockingFilterPredicate delegate that defines a set of criteria and determines whether a panel meets those criteria. + */ + GetPanels(filterPredicate: ASPxClientDockingFilterPredicate): ASPxClientDockPanel[]; +} +/** + * A method that will handle the client BeforeDock event. + */ +interface ASPxClientDockZoneCancelEventHandler { + /** + * A method that will handle the BeforeDock event. + * @param source The event source. This parameter identifies the zone object which raised the event. + * @param e A ASPxClientDockZoneCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockZoneCancelEventArgs): void; +} +/** + * Provides data for the BeforeDock event. + */ +interface ASPxClientDockZoneCancelEventArgs extends ASPxClientProcessingModeCancelEventArgs { + /** + * Gets the panel currently being processed. + * Value: An ASPxClientDockPanel object that is the processed panel. + */ + panel: ASPxClientDockPanel; +} +/** + * A method that will handle the client AfterDock event. + */ +interface ASPxClientDockZoneProcessingModeEventHandler { + /** + * A method that will handle the AfterDock event. + * @param source The event source. This parameter identifies the zone object which raised the event. + * @param e An ASPxClientDockZoneProcessingModeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockZoneProcessingModeEventArgs): void; +} +/** + * Provides data for the AfterDock event. + */ +interface ASPxClientDockZoneProcessingModeEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the panel currently being processed. + * Value: An ASPxClientDockPanel object that is the processed panel. + */ + panel: ASPxClientDockPanel; +} +/** + * Represents the client-side equivalent of the ASPxFileManager control. + */ +interface ASPxClientFileManager extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientFileManager. + */ + CallbackError: ASPxClientEvent>; + /** + * Fires on the client side after the selected file has been changed. + */ + SelectedFileChanged: ASPxClientEvent>; + /** + * Fires on the client side when an end-user opens a file by double-clicking it or pressing the Enter key. + */ + SelectedFileOpened: ASPxClientEvent>; + /** + * Fires after the focused item has been changed. + */ + FocusedItemChanged: ASPxClientEvent>; + /** + * Fires after the selection has been changed. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Fires on the client side after the current folder has been changed within a file manager. + */ + CurrentFolderChanged: ASPxClientEvent>; + /** + * Fires on the client side before the folder is created, and allows you to cancel the action. + */ + FolderCreating: ASPxClientEvent>; + /** + * Occurs on the client side after a folder has been created. + */ + FolderCreated: ASPxClientEvent>; + /** + * Fires on the client side before an item is renamed and allows you to cancel the action. + */ + ItemRenaming: ASPxClientEvent>; + /** + * Occurs on the client side after a file manager's item has been renamed. + */ + ItemRenamed: ASPxClientEvent>; + /** + * Fires on the client side before an item is deleted and allows you to cancel the action. + */ + ItemDeleting: ASPxClientEvent>; + /** + * Occurs on the client side after a file manager's item has been deleted. + */ + ItemDeleted: ASPxClientEvent>; + /** + * Occurs on the client side after all the selected items have been deleted. + */ + ItemsDeleted: ASPxClientEvent>; + /** + * Fires on the client side before an item is moved and allows you to cancel the action. + */ + ItemMoving: ASPxClientEvent>; + /** + * Occurs on the client side after a file manager's item has been moved. + */ + ItemMoved: ASPxClientEvent>; + /** + * Occurs on the client side after all the selected items have been moved . + */ + ItemsMoved: ASPxClientEvent>; + /** + * Fires on the client side before an item is copied and allows you to cancel the action. + */ + ItemCopying: ASPxClientEvent>; + /** + * Occurs on the client side after a file manager item has been copied. + */ + ItemCopied: ASPxClientEvent>; + /** + * Occurs on the client side after all the selected items have been copied. + */ + ItemsCopied: ASPxClientEvent>; + /** + * Fires on the client if any error occurs while editing an item. + */ + ErrorOccurred: ASPxClientEvent>; + /** + * Enables you to display the alert with the result error description. + */ + ErrorAlertDisplaying: ASPxClientEvent>; + /** + * Fires when a custom item is clicked, allowing you to perform custom actions. + */ + CustomCommand: ASPxClientEvent>; + /** + * Fires on the client side when the file manager updates the state of toolbar or context menu items. + */ + ToolbarUpdating: ASPxClientEvent>; + /** + * Enables you to highlight the search text, which is specified using the filter box, in templates. + */ + HighlightItemTemplate: ASPxClientEvent>; + /** + * Fires on the client side before a file upload starts, and allows you to cancel the action. + */ + FileUploading: ASPxClientEvent>; + /** + * Fires on the client side before the selected items are uploaded and allows you to cancel the action. + */ + FilesUploading: ASPxClientEvent>; + /** + * Occurs on the client side after a file has been uploaded. + */ + FileUploaded: ASPxClientEvent>; + /** + * Occurs on the client side after upload of all selected files has been completed. + */ + FilesUploaded: ASPxClientEvent>; + /** + * Fires on the client side before a file download starts, and allows you to cancel the action. + */ + FileDownloading: ASPxClientEvent>; + /** + * Gets the name of the currently active file manager area. + */ + GetActiveAreaName(): string; + /** + * Client-side scripting method which initiates a round trip to the server, so that the current page will be reloaded. + */ + Refresh(): void; + /** + * Executes the specified command. + * @param commandName A string value that specifies the command to perform. + */ + ExecuteCommand(commandName: string): boolean; + /** + * Returns the selected file within the ASPxFileManager control's file container. + */ + GetSelectedFile(): ASPxClientFileManagerFile; + /** + * Returns an array of the file manager's selected items. + */ + GetSelectedItems(): ASPxClientFileManagerFile[]; + /** + * Returns a list of files that are loaded on the current page. + */ + GetItems(): ASPxClientFileManagerFile[]; + /** + * Sends a callback to the server and returns a list of files that are contained within the current folder. + * @param onCallback A object that represents the JavaScript function which receives the list of row values as a parameter. + */ + GetAllItems(onCallback: ASPxClientFileManagerAllItemsCallback): void; + /** + * Returns a toolbar item specified by its command name. + * @param commandName A string value specifying the command name of the item. + */ + GetToolbarItemByCommandName(commandName: string): ASPxClientFileManagerToolbarItem; + /** + * Returns a context menu item specified by its command name. + * @param commandName A string value specifying the command name of the item. + */ + GetContextMenuItemByCommandName(commandName: string): ASPxClientFileManagerToolbarItem; + /** + * Gets the current folder's path. + */ + GetCurrentFolderPath(): string; + /** + * Gets the current folder's path with the specified separator. + * @param separator A string value that specifies the separator between the folder's name within a path. + */ + GetCurrentFolderPath(separator: string): string; + /** + * Gets the current folder's path with the specified settings. + * @param separator A string value that specifies the separator between the folder's name within the path. + * @param skipRootFolder true to skip the root folder; otherwise, false. + */ + GetCurrentFolderPath(separator: string, skipRootFolder: boolean): string; + /** + * Sets the current folder's path. + * @param path A String value that is the relative path to the folder (without the root folder). + * @param onCallback A ASPxClientFileManagerCallback object that is the JavaScript function that receives the callback data as a parameter. + */ + SetCurrentFolderPath(path: string, onCallback: ASPxClientFileManagerCallback): void; + /** + * Gets the current folder's ID. + */ + GetCurrentFolderId(): string; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; +} +/** + * A JavaScript function which receives callback data obtained via a call to the client SetCurrentFolderPath method. + */ +interface ASPxClientFileManagerCallback { + /** + * A JavaScript function that receives callback data obtained via a call to the SetCurrentFolderPath method. + * @param result An object that contains a callback data. + */ + (result: Object): void; +} +/** + * A client-side equivalent of the file manager's FileManagerItem object and serves as a base class for client file and folder objects. + */ +interface ASPxClientFileManagerItem { + /** + * Gets the name of the current item. + * Value: A string value that is the item's name. + */ + name: string; + /** + * Gets the item's unique identifier. + * Value: A String value that specifies the item's unique identifier. + */ + id: string; + /** + * Gets a value that indicates if the current file manager item is a folder. + * Value: true if the current item is a folder or parent folder; false if the current item is a file. + */ + isFolder: boolean; + /** + * Specifies whether the file manager item is selected. + * @param selected true, to select the item; otherwise, false. + */ + SetSelected(selected: boolean): void; + /** + * Gets a value indicating whether the item is selected in the file manager. + */ + IsSelected(): boolean; + /** + * Gets the current item's full name. + */ + GetFullName(): string; + /** + * Gets the current item's full name with the specified separator. + * @param separator A string value that specifies the separator between the folder name inside the item's full name. + */ + GetFullName(separator: string): string; + /** + * Gets the current item's full name with the specified settings. + * @param separator A string value that specifies the separator between the folder name inside the item's full name. + * @param skipRootFolder true, to skip the root folder; otherwise, false. + */ + GetFullName(separator: string, skipRootFolder: boolean): string; +} +/** + * Represents the client-side equivalent of the FileManagerFile object. + */ +interface ASPxClientFileManagerFile extends ASPxClientFileManagerItem { + /** + * Downloads a file from a file manager. + */ + Download(): void; +} +/** + * 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; +} +/** + * A JavaScript function which receives callback data obtained by a call to the client GetAllItems method. + */ +interface ASPxClientFileManagerAllItemsCallback { + /** + * A JavaScript function which receives callback data obtained by a call to the client GetAllItems method. + * @param items An array of ASPxClientFileManagerItem objects that are items contained in the current folder. + */ + (items: ASPxClientFileManagerItem[]): void; +} +/** + * A method that will handle the client SelectedFileOpened events. + */ +interface ASPxClientFileManagerFileEventHandler { + /** + * A method that will handle the SelectedFileOpened events. + * @param source An object representing the event's source. + * @param e An ASPxClientFileManagerFileEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFileEventArgs): void; +} +/** + * Provides data for the SelectedFileOpened events. + */ +interface ASPxClientFileManagerFileEventArgs extends ASPxClientEventArgs { + /** + * Gets a file related to the event. + * Value: An ASPxClientFileManagerFile object that represents a file currently being processed. + */ + file: ASPxClientFileManagerFile; +} +/** + * A method that will handle the client SelectedFileOpened event. + */ +interface ASPxClientFileManagerFileOpenedEventHandler { + /** + * A method that will handle the SelectedFileOpened event. + * @param source The event source. This parameter identifies the file manager object which raised the event. + * @param e An ASPxClientFileManagerFileOpenedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFileOpenedEventArgs): void; +} +/** + * Provides data for the SelectedFileOpened event. + */ +interface ASPxClientFileManagerFileOpenedEventArgs extends ASPxClientFileManagerFileEventArgs { + /** + * Gets or sets a value that specifies whether the event should be finally processed on the server side. + * Value: true to process the event on the server side; false to completely handle it on the client side. + */ + processOnServer: boolean; +} +/** + * Serves as a base for classes that are used as arguments for events generated on the client side. + */ +interface ASPxClientFileManagerActionEventArgsBase extends ASPxClientEventArgs { + /** + * Gets the full name of the item currently being processed. + * Value: A string value that is the item's full name. + */ + fullName: string; + /** + * Gets the name of the currently processed item. + * Value: A string value that specifies the item's name. + */ + name: string; + /** + * Gets a value specifying whether the current processed item is a folder. + * Value: true if the processed item is a folder; false if the processed item is a file. + */ + isFolder: boolean; +} +/** + * A method that will handle the client ItemRenaming events. + */ +interface ASPxClientFileManagerItemEditingEventHandler { + /** + * A method that will handle the ItemRenaming events. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemEditingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemEditingEventArgs): void; +} +/** + * Provides data for the item editing event. + */ +interface ASPxClientFileManagerItemEditingEventArgs extends ASPxClientFileManagerActionEventArgsBase { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the client ItemRenamed event. + */ +interface ASPxClientFileManagerItemRenamedEventHandler { + /** + * A method that will handle the ItemRenamed event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemRenamedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemRenamedEventArgs): void; +} +/** + * Provides data for the ItemRenamed event. + */ +interface ASPxClientFileManagerItemRenamedEventArgs extends ASPxClientFileManagerActionEventArgsBase { + /** + * Gets the previous name of the renamed item. + * Value: A string value that specifies the item name. + */ + oldName: string; +} +/** + * A method that will handle the client ItemDeleted event. + */ +interface ASPxClientFileManagerItemDeletedEventHandler { + /** + * A method that will handle the ItemDeleted event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemDeletedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemDeletedEventArgs): void; +} +/** + * Provides data for the ItemDeleted event. + */ +interface ASPxClientFileManagerItemDeletedEventArgs extends ASPxClientFileManagerActionEventArgsBase { +} +/** + * A method that will handle the client ItemsDeleted event. + */ +interface ASPxClientFileManagerItemsDeletedEventHandler { + /** + * A method that will handle the ItemsDeleted event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemsDeletedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemsDeletedEventArgs): void; +} +/** + * Provides data for the ItemsDeleted event. + */ +interface ASPxClientFileManagerItemsDeletedEventArgs extends ASPxClientEventArgs { + /** + * Gets an array of the currently processed items. + * Value: An array of ASPxClientFileManagerItem objects that are items currently being processed. + */ + items: ASPxClientFileManagerItem[]; +} +/** + * A method that will handle the client ItemMoved event. + */ +interface ASPxClientFileManagerItemMovedEventHandler { + /** + * A method that will handle the ItemMoved event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemMovedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemMovedEventArgs): void; +} +/** + * Provides data for the ItemMoved event. + */ +interface ASPxClientFileManagerItemMovedEventArgs extends ASPxClientFileManagerActionEventArgsBase { + /** + * Gets the full name of the folder from which an item is moved. + * Value: A string value that specifies the folder's full name. + */ + oldFolderFullName: string; +} +/** + * A method that will handle the client ItemsMoved event. + */ +interface ASPxClientFileManagerItemsMovedEventHandler { + /** + * A method that will handle the ItemsMoved event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemsMovedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemsMovedEventArgs): void; +} +/** + * Provides data for the ItemsMoved event. + */ +interface ASPxClientFileManagerItemsMovedEventArgs extends ASPxClientEventArgs { + /** + * Gets an array of the currently processed items. + * Value: An array of ASPxClientFileManagerItem objects that are items currently being processed. + */ + items: ASPxClientFileManagerItem[]; + /** + * Gets the full name of the folder from which items are moved. + * Value: A string value that specifies the folder's full name. + */ + oldFolderFullName: string; +} +/** + * A method that will handle the client ItemCopied event. + */ +interface ASPxClientFileManagerItemCopiedEventHandler { + /** + * A method that will handle the ItemCopied event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemCopiedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemCopiedEventArgs): void; +} +/** + * Provides data for the ItemCopied event. + */ +interface ASPxClientFileManagerItemCopiedEventArgs extends ASPxClientFileManagerActionEventArgsBase { + /** + * Gets the full name of the folder from which an item is copied. + * Value: A string value that specifies the folder's full name. + */ + oldFolderFullName: string; +} +/** + * A method that will handle the client ItemsCopied event. + */ +interface ASPxClientFileManagerItemsCopiedEventHandler { + /** + * A method that will handle the ItemsCopied event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemsCopiedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemsCopiedEventArgs): void; +} +/** + * Provides data for the ItemsCopied event. + */ +interface ASPxClientFileManagerItemsCopiedEventArgs extends ASPxClientEventArgs { + /** + * Gets an array of the currently processed items. + * Value: An array of ASPxClientFileManagerItem objects that are items currently being processed. + */ + items: ASPxClientFileManagerItem[]; + /** + * Gets the full name of the folder from which items are copied. + * Value: A string value that specifies the folder's full name. + */ + oldFolderFullName: string; +} +/** + * A method that will handle the client FolderCreated event. + */ +interface ASPxClientFileManagerItemCreatedEventHandler { + /** + * A method that will handle the FolderCreated event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemCreatedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemCreatedEventArgs): void; +} +/** + * Provides data for the FolderCreated event. + */ +interface ASPxClientFileManagerItemCreatedEventArgs extends ASPxClientFileManagerActionEventArgsBase { +} +/** + * A method that will handle the client ErrorOccurred event. + */ +interface ASPxClientFileManagerErrorEventHandler { + /** + * A method that will handle the client ErrorOccurred event. + * @param source An object representing the event's source. + * @param e An ASPxClientFileManagerErrorEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerErrorEventArgs): void; +} +/** + * Provides data for the ErrorOccurred event. + */ +interface ASPxClientFileManagerErrorEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value representing the processed command's name. + */ + commandName: string; + /** + * Gets or sets the error description. + * Value: A string value specifying the error description. + */ + errorText: string; + /** + * Gets or sets a value specifying whether an event error message is sent to the ErrorAlertDisplaying event. + * Value: true to sent an error message; otherwise, false. + */ + showAlert: boolean; + /** + * Gets a specifically generated code that uniquely identifies an error, which occurs while editing an item. + * Value: An integer value that specifies the code uniquely identifying an error. + */ + errorCode: number; +} +/** + * A method that will handle the client ErrorAlertDisplaying event. + */ +interface ASPxClientFileManagerErrorAlertDisplayingEventHandler { + /** + * A method that will handle the ErrorAlertDisplaying event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerErrorAlertDisplayingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerErrorAlertDisplayingEventArgs): void; +} +/** + * Provides data for the ErrorAlertDisplaying event. + */ +interface ASPxClientFileManagerErrorAlertDisplayingEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value that is the processed command's name. + */ + commandName: string; + /** + * Gets or sets the errors description. + * Value: A string that is the errors description. + */ + errorText: string; + /** + * Gets or sets a value specifying whether an alert message is displayed when the event fires. + * Value: true to display an alert message; otherwise, false. + */ + showAlert: boolean; +} +/** + * A method that will handle the client FileUploading event. + */ +interface ASPxClientFileManagerFileUploadingEventHandler { + /** + * A method that will handle the FileUploading event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerFileUploadingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFileUploadingEventArgs): void; +} +/** + * Provides data for the FileUploading event. + */ +interface ASPxClientFileManagerFileUploadingEventArgs extends ASPxClientEventArgs { + /** + * Gets the path to the folder where a file is being uploaded. + * Value: A string value specifying the path where a file is being uploaded. + */ + folder: string; + /** + * Gets the name of a file selected for upload. + * Value: A string value that specifies the file name. + */ + fileName: string; + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the client FilesUploading event. + */ +interface ASPxClientFileManagerFilesUploadingEventHandler { + /** + * A method that will handle the FilesUploading event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerFilesUploadingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFilesUploadingEventArgs): void; +} +/** + * Provides data for the FilesUploading event. + */ +interface ASPxClientFileManagerFilesUploadingEventArgs extends ASPxClientEventArgs { + /** + * Gets the path to the folder where files are being uploaded. + * Value: A string value specifying the folder path. + */ + folder: string; + /** + * Gets the names of files selected for upload. + * Value: An array of string values that are the file names. + */ + fileNames: string[]; + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the client FileUploaded event. + */ +interface ASPxClientFileManagerFileUploadedEventHandler { + /** + * A method that will handle the FileUploaded event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerFileUploadedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFileUploadedEventArgs): void; +} +/** + * Provides data for the FileUploaded event. + */ +interface ASPxClientFileManagerFileUploadedEventArgs extends ASPxClientEventArgs { + /** + * Gets the path to the folder where a file is uploaded. + * Value: A string value specifying the uploaded file path. + */ + folder: string; + /** + * Gets the name of the uploaded file. + * Value: A string value that specifies the file name. + */ + fileName: string; +} +/** + * A method that will handle the client FilesUploaded event. + */ +interface ASPxClientFileManagerFilesUploadedEventHandler { + /** + * A method that will handle the FilesUploaded event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerFilesUploadedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFilesUploadedEventArgs): void; +} +/** + * Provides data for the FilesUploaded event. + */ +interface ASPxClientFileManagerFilesUploadedEventArgs extends ASPxClientEventArgs { + /** + * Gets the path to the folder where files are uploaded. + * Value: A string value specifying the uploaded files path. + */ + folder: string; + /** + * Gets an array of uploaded file names. + * Value: An array of string values that are the file names. + */ + fileNames: string[]; +} +/** + * A method that will handle the client FileDownloading event. + */ +interface ASPxClientFileManagerFileDownloadingEventHandler { + /** + * A method that will handle the FileDownloading event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerFileDownloadingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFileDownloadingEventArgs): void; +} +/** + * Provides data for the FileDownloading event. + */ +interface ASPxClientFileManagerFileDownloadingEventArgs extends ASPxClientFileManagerFileEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event, should be canceled. + * Value: true, if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the client FocusedItemChanged event. + */ +interface ASPxClientFileManagerFocusedItemChangedEventHandler { + /** + * A method that will handle the FocusedItemChanged event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerFocusedItemChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFocusedItemChangedEventArgs): void; +} +/** + * Provides data for the FocusedItemChanged event. + */ +interface ASPxClientFileManagerFocusedItemChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the file manager item object related to the event. + * Value: An object, manipulations on which forced the event to be raised. + */ + item: ASPxClientFileManagerItem; + /** + * Gets the name of the focused item. + * Value: A string value that specifies the item's name. + */ + name: string; + /** + * Gets the full name of the item currently being processed. + * Value: A string value that is the item's full name. + */ + fullName: string; +} +/** + * A method that will handle the client CurrentFolderChanged event. + */ +interface ASPxClientFileManagerCurrentFolderChangedEventHandler { + /** + * A method that will handle the CurrentFolderChanged event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerCurrentFolderChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerCurrentFolderChangedEventArgs): void; +} +/** + * Provides data for the CurrentFolderChanged event. + */ +interface ASPxClientFileManagerCurrentFolderChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the currently processed folder. + * Value: A string value that specifies the folder's name. + */ + name: string; + /** + * Gets the full name of the folder currently being processed. + * Value: A string value that is the folder's full name. + */ + fullName: string; +} +/** + * A method that will handle the client SelectionChanged event. + */ +interface ASPxClientFileManagerSelectionChangedEventHandler { + /** + * A method that will handle the SelectionChanged event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerSelectionChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerSelectionChangedEventArgs): void; +} +/** + * Provides data for the SelectionChanged event. + */ +interface ASPxClientFileManagerSelectionChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the file manager item object related to the event. + * Value: An object, manipulations on which forced the event to be raised. + */ + item: ASPxClientFileManagerItem; + /** + * Gets the name of the currently processed file. + * Value: A string value that specifies the file's name. + */ + name: string; + /** + * Gets the full name of the file currently being processed. + * Value: A string value that is the file's full name. + */ + fullName: string; + /** + * Gets whether the item has been selected. + * Value: true if the file has been selected; otherwise, false. + */ + isSelected: boolean; +} +/** + * A method that will handle the CustomCommand event. + */ +interface ASPxClientFileManagerCustomCommandEventHandler { + /** + * A method that will handle the CustomCommand event. + * @param source The event source. + * @param e An ASPxClientFileManagerCustomCommandEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerCustomCommandEventArgs): void; +} +/** + * Provides data for the CustomCommand event. + */ +interface ASPxClientFileManagerCustomCommandEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value that is the processed command's name. + */ + commandName: string; +} +/** + * A method that will handle the ToolbarUpdating event. + */ +interface ASPxClientFileManagerToolbarUpdatingEventHandler { + /** + * A method that will handle the ToolbarUpdating event. + * @param source The event source. + * @param e An ASPxClientFileManagerToolbarUpdatingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerToolbarUpdatingEventArgs): void; +} +/** + * Provides data for the ToolbarUpdating event. + */ +interface ASPxClientFileManagerToolbarUpdatingEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the currently active file manager area. + * Value: A string value that identifies the active area. + */ + activeAreaName: string; +} +/** + * A method that will handle the client HighlightItemTemplate event. + */ +interface ASPxClientFileManagerHighlightItemTemplateEventHandler { + /** + * A method that will handle the HighlightItemTemplate event. + * @param source The event source. This parameter identifies the file manager object that raised the event. + * @param e An ASPxClientFileManagerHighlightItemTemplateEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerHighlightItemTemplateEventArgs): void; +} +/** + * Provides data for the HighlightItemTemplate event. + */ +interface ASPxClientFileManagerHighlightItemTemplateEventArgs extends ASPxClientEventArgs { + /** + * Gets a string that is a filter value specified by the filter box. + * Value: A string that is a filter value. + */ + filterValue: string; + /** + * Gets the name of the item currently being processed. + * Value: A string that is the item name. + */ + itemName: string; + /** + * Gets an element containing the item template. + * Value: An object that is an element containing the item template. + */ + templateElement: string; + /** + * Get the name of the cascading style sheet (CSS) class associated with an item in the highlighted state. + * Value: A string that is the name of a CSS class. + */ + highlightCssClassName: string; +} +/** + * Represents a client-side equivalent of the menu's MenuItem object. + */ +interface ASPxClientMenuItem { + /** + * Gets the menu object to which the current item belongs. + * Value: An ASPxClientMenuBase object representing the menu to which the item belongs. + */ + menu: ASPxClientMenuBase; + /** + * Gets the immediate parent item to which the current item belongs. + * Value: An ASPxClientMenuItem object representing the item's immediate parent. + */ + parent: ASPxClientMenuItem; + /** + * Gets the item's index within the parent's collection of items. + * Value: An integer value representing the item's zero-based index within the Items collection of the parent object (a menu or item) to which the item belongs. + */ + index: number; + /** + * Gets the name that uniquely identifies the menu item. + * Value: A string value that represents the value assigned to the item's Name property. + */ + name: string; + /** + * For internal use only. + */ + indexPath: string; + /** + * Returns the number of the current menu item's immediate child items. + */ + GetItemCount(): number; + /** + * Returns the current menu item's immediate subitem specified by its index. + * @param index An integer value specifying the zero-based index of the submenu item to be retrieved. + */ + GetItem(index: number): ASPxClientMenuItem; + /** + * Returns the current menu item's subitem specified by its name. + * @param name A string value specifying the name of the menu item. + */ + GetItemByName(name: string): ASPxClientMenuItem; + /** + * Indicates whether the menu item is checked. + */ + GetChecked(): boolean; + /** + * Specifies whether the menu item is checked. + * @param value true if the menu item is checked; otherwise, false. + */ + SetChecked(value: boolean): void; + /** + * Returns a value specifying whether a menu item is enabled. + */ + GetEnabled(): boolean; + /** + * Specifies whether the menu item is enabled. + * @param value true to enable the menu item; otherwise, false. + */ + SetEnabled(value: boolean): void; + /** + * Returns the URL pointing to the image displayed within the menu item. + */ + GetImageUrl(): string; + /** + * Sets the URL which points to the image displayed within the menu item. + * @param value A string value specifying the URL to the image displayed within the menu item. + */ + SetImageUrl(value: string): void; + /** + * Gets a URL which defines the navigation location for the menu item. + */ + GetNavigateUrl(): string; + /** + * Specifies a URL which defines the navigation location for the menu item. + * @param value A string value which specifies a URL to where the client web browser will navigate when the menu item is clicked. + */ + SetNavigateUrl(value: string): void; + /** + * Returns text displayed within the menu item. + */ + GetText(): string; + /** + * Sets the text to be displayed within the menu item. + * @param value A string value specifying the text to be displayed within the menu item. + */ + SetText(value: string): void; + /** + * Returns a value specifying whether a menu item is displayed. + */ + GetVisible(): boolean; + /** + * Specifies the menu item's visibility. + * @param value true if the menu item is visible; otherwise, false. + */ + SetVisible(value: boolean): void; +} +/** + * A client-side equivalent of the file manager's FileManagerToolbarItemBase object. + */ +interface ASPxClientFileManagerToolbarItem extends ASPxClientMenuItem { + /** + * This property is not in effect for the ASPxClientFileManagerToolbarItem class. + */ + menu: ASPxClientMenuBase; + /** + * This property is not in effect for the ASPxClientFileManagerToolbarItem class. + */ + parent: ASPxClientMenuItem; + /** + * This property is not in effect for the ASPxClientFileManagerToolbarItem class. + */ + index: number; +} +/** + * A client-side equivalent of the ASPxFormLayout's LayoutItem object. + */ +interface ASPxClientLayoutItem { + /** + * Gets the form layout object to which the current item belongs. + * Value: An object representing the form layout to which the item belongs. + */ + formLayout: ASPxClientFormLayout; + /** + * Gets the name that uniquely identifies the layout item. + * Value: A string value that represents the value assigned to the layout item's Name property. + */ + name: string; + /** + * Gets the immediate parent layout item to which the current layout item belongs. + * Value: An object representing the item's immediate parent. + */ + parent: ASPxClientLayoutItem; + /** + * Returns the current layout item's subitem specified by its name. + * @param name A string value specifying the name of the layout item. + */ + GetItemByName(name: string): ASPxClientLayoutItem; + /** + * Returns a value specifying whether a layout item is displayed. + */ + GetVisible(): boolean; + /** + * Specifies the layout item's visibility. + * @param value true, if the layout item is visible; otherwise, false. + */ + SetVisible(value: boolean): void; + /** + * Specifies the text displayed in the layout item caption. + * @param caption A string value specifying the item caption. + */ + SetCaption(caption: string): void; + /** + * Returns the text displayed in the layout item caption. + */ + GetCaption(): string; +} +/** + * Represents a client-side equivalent of the ASPxFormLayout object. + */ +interface ASPxClientFormLayout extends ASPxClientControl { + /** + * Returns an item specified by its name. + * @param name A string value specifying the name of the item. + */ + GetItemByName(name: string): ASPxClientLayoutItem; +} +/** + * Represents a client-side equivalent of the ASPxGlobalEvents component. + */ +interface ASPxClientGlobalEvents { + /** + * Occurs on the client side after client object models of all DevExpress web controls contained within the page have been initialized. + */ + ControlsInitialized: ASPxClientEvent>; + /** + * Occurs when the browser window is being resized. + */ + BrowserWindowResized: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated by any DevExpress control. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side, after server-side processing of a callback initiated by any DevExpress web control, has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by any of DevExpress web controls. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client side after the validation initiated for a DevExpress web control (or a group of DevExpress web controls) has been completed. + */ + ValidationCompleted: ASPxClientEvent>; +} +/** + * Represents a client-side equivalent of the ASPxHiddenField control. + */ +interface ASPxClientHiddenField extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientHiddenField. + */ + CallbackError: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Adds a new value to the control's collection of property name/value pairs, on the client side. + * @param propertyName A string value that specifies the property name. It can contain letters, digits, underline characters, and dollar signs. It cannot begin with a digit character. + * @param propertyValue An object that represents the value of the specified property. + */ + Add(propertyName: string, propertyValue: Object): void; + /** + * Returns the value with the specified property name. + * @param propertyName A string value that specifies the property name. + */ + Get(propertyName: string): Object; + /** + * Adds a new value to the control's collection of property name/value pairs, on the client side. + * @param propertyName A string value that specifies the property name. It can contain letters, digits, underline characters, and dollar signs. It cannot begin with a digit character. + * @param propertyValue An object that represents the property value. + */ + Set(propertyName: string, propertyValue: Object): void; + /** + * Removes the specified value from the ASPxHiddenField collection. + * @param propertyName A string value representing the property name. + */ + Remove(propertyName: string): void; + /** + * Clears the ASPxHiddenField's value collection. + */ + Clear(): void; + /** + * Returns a value indicating whether the value with the specified property name is contained within the ASPxHiddenField control's value collection. + * @param propertyName A string value that specifies the property name. + */ + Contains(propertyName: string): boolean; +} +/** + * The client-side equivalent of the ASPxImageGallery control. + */ +interface ASPxClientImageGallery extends ASPxClientDataView { + /** + * Fires on the client side before the fullscreen viewer is shown and allows you to cancel the action. + */ + FullscreenViewerShowing: ASPxClientEvent>; + /** + * Occurs on the client side after an active item has been changed within the fullscreen viewer. + */ + FullscreenViewerActiveItemIndexChanged: ASPxClientEvent>; + /** + * Shows the fullscreen viewer with the specified active item. + * @param index An Int32 value that is an index of the active item. + */ + ShowFullscreenViewer(index: number): void; + /** + * Hides the fullscreen viewer. + */ + HideFullscreenViewer(): void; + /** + * Makes the specified item active within the fullscreen viewer on the client side. + * @param index An integer value specifying the index of the item to select. + * @param preventAnimation true to prevent the animation effect; false to change images using animation. + */ + SetFullscreenViewerActiveItemIndex(index: number, preventAnimation: boolean): void; + /** + * Gets the number of items contained in the control's item collection. + */ + GetFullscreenViewerItemCount(): number; + /** + * Returns the index of the active item within the fullscreen viewer. + */ + GetFullscreenViewerActiveItemIndex(): number; + /** + * Plays a slide show within a fullscreen viewer. + */ + PlaySlideShow(): void; + /** + * Pauses a slide show within a fullscreen viewer. + */ + PauseSlideShow(): void; +} +/** + * A method that will handle the client FullscreenViewerShowing event. + */ +interface ASPxClientImageGalleryCancelEventHandler { + /** + * A method that will handle the FullscreenViewerShowing event. + * @param source The event source. Identifies the ASPxImageGallery control that raised the event. + * @param e An ASPxClientImageGalleryCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientImageGalleryCancelEventArgs): void; +} +/** + * Provides data for the FullscreenViewerShowing event. + */ +interface ASPxClientImageGalleryCancelEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the index of the item related to the event. + * Value: An value that is the related item's index. + */ + index: number; + /** + * Gets the unique identifier name of the item related to the event. + * Value: A string value that specifies the item's unique identifier name. + */ + name: string; +} +/** + * A method that will handle the client FullscreenViewerActiveItemIndexChanged event. + */ +interface ASPxClientImageGalleryFullscreenViewerEventHandler { + /** + * A method that will handle the FullscreenViewerActiveItemIndexChanged event. + * @param source The event source. Identifies the ASPxImageGallery control that raised the event. + * @param e An ASPxClientImageGalleryFullscreenViewerEventArgs object that contains event data. + */ + (source: S, e: ASPxClientImageGalleryFullscreenViewerEventArgs): void; +} +/** + * Provides data for the FullscreenViewerActiveItemIndexChanged event. + */ +interface ASPxClientImageGalleryFullscreenViewerEventArgs extends ASPxClientEventArgs { + /** + * Gets the index of the item related to the event. + * Value: An value that is the related item's index. + */ + index: number; + /** + * Gets the unique identifier name of the item related to the event. + * Value: A string value that specifies the item's unique identifier name. + */ + name: string; +} +/** + * A client-side equivalent of the ASPxImageSlider object. + */ +interface ASPxClientImageSlider extends ASPxClientControl { + /** + * Occurs after the active image, displayed within the image area, is changed. + */ + ActiveItemChanged: ASPxClientEvent>; + /** + * Fires after an image item has been clicked within the image area. + */ + ItemClick: ASPxClientEvent>; + /** + * Occurs on the client side when a thumbnail is clicked. + */ + ThumbnailItemClick: ASPxClientEvent>; + /** + * Returns an item specified by its index within the image slider's item collection. + * @param index An integer value specifying the zero-based index of the item to be retrieved. + */ + GetItem(index: number): ASPxClientImageSliderItem; + /** + * Returns an item specified by its name. + * @param name A string value specifying the name of the item. + */ + GetItemByName(name: string): ASPxClientImageSliderItem; + /** + * Returns the index of the active item within the image slider control. + */ + GetActiveItemIndex(): number; + /** + * Makes the specified item active within the image slider control on the client side. + * @param index An integer value specifying the index of the item to select. + * @param preventAnimation true to prevent the animation effect; false to change images using animation. + */ + SetActiveItemIndex(index: number, preventAnimation: boolean): void; + /** + * Returns the active item within the ASPxImageSlider control. + */ + GetActiveItem(): ASPxClientImageSliderItem; + /** + * Makes the specified item active within the image slider control on the client side. + * @param item An ASPxClientImageSliderItem object specifying the item to select. + * @param preventAnimation true to prevent animation effect; false to enable animation. + */ + SetActiveItem(item: ASPxClientImageSliderItem, preventAnimation: boolean): void; + /** + * Gets the number of items contained in the control's item collection. + */ + GetItemCount(): number; + /** + * Sets input focus to the ASPxImageSlider control. + */ + Focus(): void; + /** + * Plays a slide show within an image slider. + */ + Play(): void; + /** + * Pauses a slide show within image slider. + */ + Pause(): void; + /** + * Gets a value indicating whether the slide show is playing. + */ + IsSlideShowPlaying(): boolean; +} +/** + * A method that will handle the ItemClick events. + */ +interface ASPxClientImageSliderItemEventHandler { + /** + * A method that will handle the ItemClick events. + * @param source The event source. Identifies the ASPxImageSlider control that raised the event. + * @param e An ASPxClientImageSliderItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientImageSliderItemEventArgs): void; +} +/** + * Provides data for the ItemClick events. + */ +interface ASPxClientImageSliderItemEventArgs extends ASPxClientEventArgs { + /** + * Gets an item object related to the event. + * Value: An object, manipulations on which forced the event to be raised. + */ + item: ASPxClientImageSliderItem; +} +/** + * A client-side equivalent of the image slider's ImageSliderItem object. + */ +interface ASPxClientImageSliderItem { + /** + * Gets an image slider to which the current item belongs. + * Value: An object that is the item's owner. + */ + imageSlider: ASPxClientImageSlider; + /** + * Gets the item's index within an items collection. + * Value: An integer value is the item's zero-based index within the Items collection. + */ + index: number; + /** + * Gets the name that uniquely identifies the image slider item. + * Value: A string value that is the value assigned to the item's Name property. + */ + name: string; + /** + * Gets or sets the path to the image displayed within the ASPxClientImageSliderItem. + * Value: A value specifying the path to the image. + */ + imageUrl: string; + /** + * Gets the item's display text. + * Value: A string value that is the item's display text. + */ + text: string; +} +/** + * The client-side equivalent of the ASPxImageZoomNavigator object. + */ +interface ASPxClientImageZoomNavigator extends ASPxClientImageSlider { +} +/** + * A client-side equivalent of the ASPxImageZoom object. + */ +interface ASPxClientImageZoom extends ASPxClientControl { + /** + * Sets the properties on an image displayed in the image zoom control. + * @param imageUrl A string value specifying the path to the preview image displayed in the preview image. + * @param largeImageUrl A string value specifying the path to the preview image displayed in the zoom window and the expand window. + * @param zoomWindowText A string value specifying the text displayed in the zoom window. + * @param expandWindowText A string value specifying the text displayed in the expand window. + * @param alternateText A string value that specifies the alternate text displayed instead of the image. + */ + SetImageProperties(imageUrl: string, largeImageUrl: string, zoomWindowText: string, expandWindowText: string, alternateText: string): void; +} +/** + * Represents a client-side equivalent of the ASPxLoadingPanel control. + */ +interface ASPxClientLoadingPanel extends ASPxClientControl { + /** + * Invokes the loading panel. + */ + Show(): void; + /** + * Invokes the loading panel, displaying it over the specified HTML element. + * @param htmlElement An object that specifies the required HTML element. + */ + ShowInElement(htmlElement: Object): void; + /** + * Invokes the loading panel, displaying it over the specified element. + * @param id A string that specifies the required element's identifier. + */ + ShowInElementByID(id: string): void; + /** + * Invokes the loading panel at the specified position. + * @param x An integer value specifying the x-coordinate of the loading panel's display position. + * @param y An integer value specifying the y-coordinate of the loaidng panel's display position. + */ + ShowAtPos(x: number, y: number): void; + /** + * Sets the text to be displayed within the ASPxLoadingPanel. + * @param text A string value specifying the text to be displayed within the ASPxLoadingPanel. + */ + SetText(text: string): void; + /** + * Gets the text displayed within the ASPxLoadingPanel. + */ + GetText(): string; + /** + * Hides the loading panel. + */ + Hide(): void; +} +/** + * Serves as the base type for the ASPxClientPopupMenu objects. + */ +interface ASPxClientMenuBase extends ASPxClientControl { + /** + * Fires after a menu item has been clicked. + */ + ItemClick: ASPxClientEvent>; + /** + * Occurs on the client side when the mouse cursor is moved into a menu item. + */ + ItemMouseOver: ASPxClientEvent>; + /** + * Occurs on the client side when the mouse cursor moves outside a menu item. + */ + ItemMouseOut: ASPxClientEvent>; + /** + * Occurs on the client side when a submenu pops up. + */ + PopUp: ASPxClientEvent>; + /** + * Occurs on the client side when a submenu closes. + */ + CloseUp: ASPxClientEvent>; + /** + * Returns the number of menu items at the root menu level. + */ + GetItemCount(): number; + /** + * Returns the menu's root menu item specified by its index. + * @param index An integer value specifying the zero-based index of the root menu item to be retrieved. + */ + GetItem(index: number): ASPxClientMenuItem; + /** + * Returns a menu item specified by its name. + * @param name A string value specifying the name of the menu item. + */ + GetItemByName(name: string): ASPxClientMenuItem; + /** + * Returns the selected item within the menu control. + */ + GetSelectedItem(): ASPxClientMenuItem; + /** + * Selects the specified menu item within a menu control on the client side. + * @param item An ASPxClientMenuItem object specifying the menu item to select. + */ + SetSelectedItem(item: ASPxClientMenuItem): void; + /** + * Returns a root menu item. + */ + GetRootItem(): ASPxClientMenuItem; +} +/** + * Represents a client collection that maintains client menu objects. + */ +interface ASPxClientMenuCollection extends ASPxClientControlCollection { + /** + * Recalculates the position of visible sub menus. + */ + RecalculateAll(): void; + /** + * Hides all menus maitained by the collection. + */ + HideAll(): void; +} +/** + * Represents a client-side equivalent of the ASPxMenu object. + */ +interface ASPxClientMenu extends ASPxClientMenuBase { + /** + * Gets a value specifying the menu orientation. + */ + GetOrientation(): string; + /** + * Sets the menu orientation. + * @param orientation 'Vertical' to orient the menu vertically; 'Horizontal' to orient the menu horizontally. + */ + SetOrientation(orientation: string): void; +} +/** + * A method that will handle the menu's client events concerning manipulations with an item. + */ +interface ASPxClientMenuItemEventHandler { + /** + * A method that will handle the menu's client events concerning manipulations with an item. + * @param source The event source. This parameter identifies the menu object which raised the event. + * @param e An ASPxClientMenuItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientMenuItemEventArgs): void; +} +/** + * Provides data for events which concern manipulations on menu items. + */ +interface ASPxClientMenuItemEventArgs extends ASPxClientEventArgs { + /** + * Gets the menu item object related to the event. + * Value: An ASPxClientMenuItem object, manipulations on which forced the event to be raised. + */ + item: ASPxClientMenuItem; +} +/** + * A method that will handle client events which relate to mouse hovering (such as entering or leaving) over menu items. + */ +interface ASPxClientMenuItemMouseEventHandler { + /** + * A method that will handle the ItemMouseOver events. + * @param source An object representing the event source. + * @param e A MenuItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientMenuItemMouseEventArgs): void; +} +/** + * Provides data for client events which relate to mouse hovering (such as entering or leaving) over menu items. + */ +interface ASPxClientMenuItemMouseEventArgs extends ASPxClientMenuItemEventArgs { + /** + * Gets the HTML object that contains the processed item. + * Value: An HTML object representing a container for the item related to the event. + */ + htmlElement: Object; +} +/** + * A method that will handle client events concerning clicks on the control's items. + */ +interface ASPxClientMenuItemClickEventHandler { + /** + * A method that will handle client ItemClick events. + * @param source An object representing the event source. + * @param e A MenuItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientMenuItemClickEventArgs): void; +} +/** + * Provides data for events which concern clicking on the control's items. + */ +interface ASPxClientMenuItemClickEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the menu item object related to the event. + * Value: An ASPxClientMenuItem object, manipulations on which forced the event to be raised. + */ + item: ASPxClientMenuItem; + /** + * Gets the HTML object that contains the processed item. + * Value: An object representing a container for the item related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * Contains options affecting the touch scrolling functionality. + */ +interface ASPxClientTouchUIOptions { + /** + * Gets or sets a value that specifies whether or not the horizontal scroll bar should be displayed. + * Value: true to display the horizontal scroll bar; otherwise, false. The default value is true. + */ + showHorizontalScrollbar: boolean; + /** + * Gets or sets a value that specifies whether or not the vertical scroll bar should be displayed. + * Value: true to display the vertical scroll bar; otherwise, false. The default value is true. + */ + showVerticalScrollbar: boolean; + /** + * Gets or sets the name of the CSS class defining the vertical scroll bar's appearance. + * Value: A string value specifying the class name. + */ + vScrollClassName: string; + /** + * Gets or sets the name of the CSS class defining the horizontal scroll bar's appearance. + * Value: A string value specifying the class name. + */ + hScrollClassName: string; +} +/** + * Contains a method allowing you to apply the current scroll extender to a specific element. + */ +interface ScrollExtender { + /** + * Applies the current scroll extender to the element specified by the ID. + * @param id A string value specifying the element's ID. + */ + ChangeElement(id: string): void; + /** + * Applies the current scroll extender to the specified DOM element. + * @param element An object specifying the required DOM element. + */ + ChangeElement(element: Object): void; +} +/** + * Represents a client-side equivalent of the ASPxNavBar control. + */ +interface ASPxClientNavBar extends ASPxClientControl { + /** + * Fires after an item has been clicked. + */ + ItemClick: ASPxClientEvent>; + /** + * Fires on the client side after a group's expansion state has been changed. + */ + ExpandedChanged: ASPxClientEvent>; + /** + * Fires on the client side before the expansion state of a group is changed. + */ + ExpandedChanging: ASPxClientEvent>; + /** + * Fires when a group header is clicked. + */ + HeaderClick: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientNavBar. + */ + CallbackError: ASPxClientEvent>; + /** + * Returns the number of groups in the navbar. + */ + GetGroupCount(): number; + /** + * Returns a group specified by its index. + * @param index An integer value specifying the zero-based index of the group object to retrieve. + */ + GetGroup(index: number): ASPxClientNavBarGroup; + /** + * Returns a group specified by its name. + * @param name A string value specifying the name of the group. + */ + GetGroupByName(name: string): ASPxClientNavBarGroup; + /** + * Returns the navbar's active group. + */ + GetActiveGroup(): ASPxClientNavBarGroup; + /** + * Makes the specified group active. + * @param group A ASPxClientNavBarGroup object that specifies the active group. + */ + SetActiveGroup(group: ASPxClientNavBarGroup): void; + /** + * Returns an item specified by its name. + * @param name A string value specifying the name of the item. + */ + GetItemByName(name: string): ASPxClientNavBarItem; + /** + * Returns the selected item within the navbar control. + */ + GetSelectedItem(): ASPxClientNavBarItem; + /** + * Selects the specified item within the navbar control on the client side. + * @param item An ASPxClientNavBarItem object specifying the item to select. + */ + SetSelectedItem(item: ASPxClientNavBarItem): void; + /** + * Collapses all groups of the navbar. + */ + CollapseAll(): void; + /** + * Expands all groups of the navbar. + */ + ExpandAll(): void; +} +/** + * Represents a client-side equivalent of the navbar's NavBarGroup object. + */ +interface ASPxClientNavBarGroup { + /** + * Gets the navbar to which the current group belongs. + * Value: An ASPxClientNavBar object representing the navbar to which the group belongs. + */ + navBar: ASPxClientNavBar; + /** + * Gets the group's index within a collection of a navbar's groups. + * Value: An integer value representing the group's zero-based index within the Groups collection of the navbar to which the group belongs. + */ + index: number; + /** + * Gets the name that uniquely identifies the group. + * Value: A string value that represents the value assigned to the group's Name property. + */ + name: string; + /** + * Returns a value specifying whether a group is enabled. + */ + GetEnabled(): boolean; + /** + * Returns a value specifying whether the group is expanded. + */ + GetExpanded(): boolean; + /** + * Sets the group's expansion state. + * @param value true to expand the group; false to collapse the group. + */ + SetExpanded(value: boolean): void; + /** + * Returns a value specifying whether a group is displayed. + */ + GetVisible(): boolean; + /** + * Returns text displayed within a group. + */ + GetText(): string; + /** + * Specifies the text displayed within a group. + * @param text A string value that is the text displayed within the navbar group. + */ + SetText(text: string): void; + /** + * Specifies whether the group is visible. + * @param value true if the group is visible; otherwise, false. + */ + SetVisible(value: boolean): void; + /** + * Returns the number of items in the group. + */ + GetItemCount(): number; + /** + * Returns the group's item specified by its index. + * @param index An integer value specifying the zero-based index of the item to be retrieved. + */ + GetItem(index: number): ASPxClientNavBarItem; + /** + * Returns a group item specified by its name. + * @param name A string value specifying the name of the item. + */ + GetItemByName(name: string): ASPxClientNavBarItem; +} +/** + * Represents a client-side equivalent of the navbar's NavBarItem object. + */ +interface ASPxClientNavBarItem { + /** + * Gets the navbar to which the current item belongs. + * Value: An ASPxClientNavBar object representing the navbar to which the item belongs. + */ + navBar: ASPxClientNavBar; + /** + * Gets the group to which the current item belongs. + * Value: An ASPxClientNavBarGroup object representing the group to which the item belongs. + */ + group: ASPxClientNavBarGroup; + /** + * Gets the item's index within a collection of a group's items. + * Value: An integer value representing the item's zero-based index within the Items collection of the group to which the item belongs. + */ + index: number; + /** + * Gets the name that uniquely identifies the item. + * Value: A string value that represents the value assigned to the item's Name property. + */ + name: string; + /** + * Returns a value indicating whether an item is enabled. + */ + GetEnabled(): boolean; + /** + * Specifies whether the item is enabled. + * @param value true if the item is enabled; otherwise, false. + */ + SetEnabled(value: boolean): void; + /** + * Returns the URL which points to the image displayed within the item. + */ + GetImageUrl(): string; + /** + * Specifies the URL which points to the image displayed within the item. + * @param value A string value that specifies the URL to the image displayed within the item. + */ + SetImageUrl(value: string): void; + /** + * Gets an URL which defines the item's navigation location. + */ + GetNavigateUrl(): string; + /** + * Specifies a URL which defines the item's navigation location. + * @param value A string value which represents the URL to where the client web browser will navigate when the item is clicked. + */ + SetNavigateUrl(value: string): void; + /** + * Returns text displayed within the item. + */ + GetText(): string; + /** + * Specifies the text displayed within the item. + * @param value A string value that represents the text displayed within the item. + */ + SetText(value: string): void; + /** + * Returns a value specifying whether an item is displayed. + */ + GetVisible(): boolean; + /** + * Specifies whether the item is visible. + * @param value true is the item is visible; otherwise, false. + */ + SetVisible(value: boolean): void; +} +/** + * A method that will handle the navbar's client events concerning manipulations with an item. + */ +interface ASPxClientNavBarItemEventHandler { + /** + * A method that will handle the navbar's client events concerning manipulations with an item. + * @param source An object representing the event's source. Identifies the navbar object that raised the event. + * @param e An ASPxClientNavBarItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientNavBarItemEventArgs): void; +} +/** + * Provides data for events which concern manipulations on items. + */ +interface ASPxClientNavBarItemEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the item object related to the event. + * Value: An ASPxClientNavBarItem object, manipulations on which forced the event to be raised. + */ + item: ASPxClientNavBarItem; + /** + * Gets the HTML object that contains the processed navbar item. + * Value: An object representing a container for the navbar item related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * A method that will handle the navbar's client events concerning manipulations with a group. + */ +interface ASPxClientNavBarGroupEventHandler { + /** + * A method that will handle the navbar's client events concerning manipulations with a group. + * @param source An object representing the event's source. Identifies the navbar object that raised the event. + * @param e An ASPxClientNavBarGroupEventArgs object that contains event data. + */ + (source: S, e: ASPxClientNavBarGroupEventArgs): void; +} +/** + * Provides data for events which concern manipulations on groups. + */ +interface ASPxClientNavBarGroupEventArgs extends ASPxClientEventArgs { + /** + * Gets the group object related to the event. + * Value: An ASPxClientNavBarGroup object, manipulations on which forced the event to be raised. + */ + group: ASPxClientNavBarGroup; +} +/** + * A method that will handle the navbar's cancelable client events concerning manipulations with a group. + */ +interface ASPxClientNavBarGroupCancelEventHandler { + /** + * A method that will handle the navbar's cancelable client events concerning manipulations with a group. + * @param source An object representing the event's source. Identifies the navbar object that raised the event. + * @param e An ASPxClientNavBarGroupCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientNavBarGroupCancelEventArgs): void; +} +/** + * Provides data for cancellable events which concern manipulations on groups. + */ +interface ASPxClientNavBarGroupCancelEventArgs extends ASPxClientProcessingModeCancelEventArgs { + /** + * Gets the group object related to the event. + * Value: An ASPxClientNavBarGroup object representing the group manipulations on which forced the navbar to raise the event. + */ + group: ASPxClientNavBarGroup; +} +/** + * A method that will handle client events concerning clicks on the control's group headers. + */ +interface ASPxClientNavBarGroupClickEventHandler { + /** + * A method that will handle the navbar's client events concerning clicks on groups. + * @param source The event source. This parameter identifies the navbar object which raised the event. + * @param e An ASPxClientNavBarGroupClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientNavBarGroupClickEventArgs): void; +} +/** + * Provides data for events which concern clicking on the control's group headers. + */ +interface ASPxClientNavBarGroupClickEventArgs extends ASPxClientNavBarGroupCancelEventArgs { + /** + * Gets the HTML object that contains the processed group. + * Value: An object representing a container for the group related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * Represents a client-side equivalent of the ASPxNewsControl object. + */ +interface ASPxClientNewsControl extends ASPxClientDataView { + /** + * Fires after an item's tail has been clicked. + */ + TailClick: ASPxClientEvent>; +} +/** + * A method that will handle client events concerning manipulations with an item. + */ +interface ASPxClientNewsControlItemEventHandler { + /** + * A method that will handle the news control's client events concerning manipulations with an item. + * @param source An object representing the event's source. Identifies the news control object that raised the event. + * @param e An ASPxClientNewsControlItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientNewsControlItemEventArgs): void; +} +/** + * Provides data for events which concern tail clicking within the control's items. + */ +interface ASPxClientNewsControlItemEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the name that uniquely identifies the processed item. + * Value: A string value that represents the value assigned to the processed item's Name property. + */ + name: Object; + /** + * Gets the HTML object that contains the processed item. + * Value: An object representing a container for the item related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * Represents a client-side equivalent of the ASPxObjectContainer control. + */ +interface ASPxClientObjectContainer extends ASPxClientControl { + /** + * Occurs on the client side when the FSCommand action is called within the associated flash object's action script. + */ + FlashScriptCommand: ASPxClientEvent>; + /** + * Play the Flash movie backwards. + */ + Back(): void; + /** + * Returns the value of the Flash variable specified. + * @param name A string value that specifies the Flash variable. + */ + GetVariable(name: string): string; + /** + * Play the Flash movie forwards. + */ + Forward(): void; + /** + * Activates the specified frame in the Flash movie. + * @param frameNumber An integer value that specifies the requested frame. + */ + GotoFrame(frameNumber: number): void; + /** + * Indicates whether the Flash movie is currently playing. + */ + IsPlaying(): boolean; + /** + * Loads the Flash movie to the specified layer. + * @param layerNumber An integer value that identifies a layer in which to load the movie. + * @param url A string value that specifies the movie's URL. + */ + LoadMovie(layerNumber: number, url: string): void; + /** + * Pans a zoomed-in Flash movie to the specified coordinates. + * @param x An integer value that specifies the X-coordinate. + * @param y An integer value that specifies the Y-coordinate. + * @param mode 0 the coordinates are pixels; 1 the coordinates are a percentage of the window. + */ + Pan(x: number, y: number, mode: number): void; + /** + * Returns the percent of the Flash Player movie that has streamed into the browser so far. + */ + PercentLoaded(): string; + /** + * Starts playing the Flash movie. + */ + Play(): void; + /** + * Rewinds the Flash movie to the first frame. + */ + Rewind(): void; + /** + * Sets the value of the specified Flash variable. + * @param name A string value that specifies the Flash variable. + * @param value A string value that represents a new value. + */ + SetVariable(name: string, value: string): void; + /** + * Zooms in on the specified rectangular area of the Flash movie. + * @param left An integer value that specifies the x-coordinate of the rectangle's left side, in twips. + * @param top An integer value that specifies the y-coordinate of the rectangle's top side, in twips. + * @param right An integer value that specifies the x-coordinate of the rectangle's right side, in twips. + * @param bottom An integer value that specifies the y-coordinate of the rectangle's bottom side, in twips. + */ + SetZoomRect(left: number, top: number, right: number, bottom: number): void; + /** + * Stops playing the Flash movie. + */ + StopPlay(): void; + /** + * Returns the total number of frames in the Flash movie. + */ + TotalFrames(): number; + /** + * Zooms the Flash view by a relative scale factor. + * @param percent An integer value that specifies the relative scale factor, as a percentage. + */ + Zoom(percent: number): void; + /** + * Starts playing a Quick Time movie. + */ + QTPlay(): void; + /** + * Stops playing a Quick Time movie. + */ + QTStopPlay(): void; + /** + * Rewinds a Quick Time movie to the first frame. + */ + QTRewind(): void; + /** + * Steps through a Quick Time video stream by a specified number of frames. + * @param count An integer value that specifies the number of frames to step. + */ + QTStep(count: number): void; +} +/** + * A method that will handle the FlashScriptCommand event. + */ +interface ASPxClientFlashScriptCommandEventHandler { + /** + * A method that will handle the FlashScriptCommand event. + * @param source The event source. + * @param e A ASPxClientFlashScriptCommandEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFlashScriptCommandEventArgs): void; +} +/** + * Provides data for the FlashScriptCommand client event. + */ +interface ASPxClientFlashScriptCommandEventArgs extends ASPxClientEventArgs { + /** + * Gets a command passed via the FSCommand action of the flash object. + * Value: A string that represents the value of the FSCommand action's command parameter. + */ + command: string; + /** + * Gets arguments passed via the FSCommand action of the flash object. + * Value: A string that represents the value of the FSCommand action's args parameter. + */ + args: string; +} +/** + * Lists the available link types within office documents. + */ +interface ASPxClientOfficeDocumentLinkType { +} +/** + * Serves as the base class for controls that implement panel functionality. + */ +interface ASPxClientPanelBase extends ASPxClientControl { + /** + * Returns the HTML code that is the content of the panel. + */ + GetContentHtml(): string; + /** + * Sets the HTML content for the panel. + * @param html A string value that is the HTML code defining the content of the panel. + */ + SetContentHtml(html: string): void; + /** + * Sets a value specifying whether the panel is enabled. + * @param enabled true to enable the panel; false to disable it. + */ + SetEnabled(enabled: boolean): void; + /** + * Returns a value specifying whether a panel is enabled. + */ + GetEnabled(): boolean; +} +/** + * Represents a client-side equivalent of the ASPxPanel control. + */ +interface ASPxClientPanel extends ASPxClientPanelBase { + /** + * Occurs when the expanded panel is closed. + */ + Collapsed: ASPxClientEvent>; + /** + * Occurs when an end-user opens the expand panel. + */ + Expanded: ASPxClientEvent>; + /** + * Expands or collapses the client panel. + */ + Toggle(): void; + /** + * Returns a value specifying whether the panel can be expanded. + */ + IsExpandable(): boolean; + /** + * Returns a value specifying whether the panel is expanded. + */ + IsExpanded(): boolean; + /** + * Expands the collapsed panel. + */ + Expand(): void; + /** + * Collapses the expanded panel. + */ + Collapse(): void; +} +/** + * Represents a client-side equivalent of the ASPxPopupControl control. + */ +interface ASPxClientPopupControl extends ASPxClientPopupControlBase { + /** + * Occurs when a popup window's close button is clicked. + */ + CloseButtonClick: ASPxClientEvent>; + /** + * This method is not in effect for a ASPxClientPopupControl object. + */ + GetMainElement(): Object; + /** + * Returns an object containing the information about a mouse event that invoked a default popup window. + */ + GetPopUpReasonMouseEvent(): Object; + /** + * Returns an object containing the information about a mouse event that invoked the specified popup window. + * @param window A ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowPopUpReasonMouseEvent(window: ASPxClientPopupWindow): Object; + /** + * + * @param window + * @param parameter + */ + PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string): void; + /** + * Sends a callback with parameters to update the popup window by processing the related popup window and the passed information on the server. + * @param window A ASPxClientPopupWindow object identifying the processed popup window. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Specifies the default popup window's size. + * @param width An integer value that specifies the default popup window's width. + * @param height An integer value that specifies the default popup window's height. + */ + SetSize(width: number, height: number): void; + /** + * Gets the width of the specified popup window's content region. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowContentWidth(window: ASPxClientPopupWindow): number; + /** + * Gets the height of the specified popup window's content region. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowContentHeight(window: ASPxClientPopupWindow): number; + /** + * Returns the height of a specific popup window. + * @param window A ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowHeight(window: ASPxClientPopupWindow): number; + /** + * Returns the width of a specific popup window. + * @param window A ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowWidth(window: ASPxClientPopupWindow): number; + /** + * Specifies the size of a specific popup window. + * @param window A ASPxClientPopupWindow object that specifies the required popup window. + * @param width An integer value that specifies the required popup window's width. + * @param height An integer value that specifies the required popup window's height. + */ + SetWindowSize(window: ASPxClientPopupWindow, width: number, height: number): void; + /** + * Returns the HTML code that is the content of the popup control's default popup window. + */ + GetContentHTML(): string; + /** + * Defines the HTML content for the popup control's default popup window. + * @param html A string value that is the HTML code defining the content of the popup window. + */ + SetContentHTML(html: string): void; + /** + * Sets the ID of a web control or HTML element (or a list of IDs) with which the current popup control's window is associated. + * @param window An ASPxClientPopupWindow object representing a popup control's window. + * @param popupElementId A string value specifying the ID (or a list of IDs) of the web control or HTML element with which the popup control's window is associated. + */ + SetWindowPopupElementID(window: ASPxClientPopupWindow, popupElementId: string): void; + /** + * Sets the ID of a web control or HTML element (or a list of IDs) with which the current popup control is associated. + * @param popupElementId A string value specifying the ID (or a list of IDs) of the web control or HTML element to which the popup control is associated. + */ + SetPopupElementID(popupElementId: string): void; + /** + * Returns an index of the object that invoked the default window within the PopupElementID list. + */ + GetCurrentPopupElementIndex(): number; + /** + * Returns an index of the object that invoked the specified popup window, within the window's PopupElementID list. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowCurrentPopupElementIndex(window: ASPxClientPopupWindow): number; + /** + * Returns an object that invoked the default window. + */ + GetCurrentPopupElement(): Object; + /** + * Returns an object that invoked the specified popup window. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowCurrentPopupElement(window: ASPxClientPopupWindow): Object; + /** + * Returns a value that specifies whether the popup control's specific window is displayed. + * @param window A ASPxClientPopupWindow object representing the popup window whose visibility is checked. + */ + IsWindowVisible(window: ASPxClientPopupWindow): boolean; + /** + * Returns a popup window specified by its index. + * @param index An integer value specifying the zero-based index of the popup window object to be retrieved. + */ + GetWindow(index: number): ASPxClientPopupWindow; + /** + * Returns a popup window specified by its name. + * @param name A string value specifying the name of the popup window. + */ + GetWindowByName(name: string): ASPxClientPopupWindow; + /** + * Returns the number of popup windows in the popup control. + */ + GetWindowCount(): number; + /** + * Invokes the popup control's specific window. + * @param window A ASPxClientPopupWindow object representing the popup window to display. + */ + ShowWindow(window: ASPxClientPopupWindow): void; + /** + * Invokes the specified popup window at the popup element with the specified index. + * @param window A ASPxClientPopupWindow object that specifies the required popup window. + * @param popupElementIndex An integer value specifying the zero-based index of the popup element within the window's PopupElementID list. + */ + ShowWindow(window: ASPxClientPopupWindow, popupElementIndex: number): void; + /** + * Invokes the popup control's specific window and displays it over the specified HTML element. + * @param window A ASPxClientPopupWindow object representing the popup window to display. + * @param htmlElement An object specifying the HTML element relative to whose position the default popup window is invoked. + */ + ShowWindowAtElement(window: ASPxClientPopupWindow, htmlElement: Object): void; + /** + * Invokes the popup control's specific window and displays it over an HTML element specified by its unique identifier. + * @param window A ASPxClientPopupWindow object representing the popup window to display. + * @param id A string value that specifies the hierarchically qualified identifier of an HTML element relative to whose position the default popup window is invoked. + */ + ShowWindowAtElementByID(window: ASPxClientPopupWindow, id: string): void; + /** + * Invokes the popup control's specific popup window at the specified position. + * @param window A ASPxClientPopupWindow object representing the popup window to display. + * @param x A integer value specifying the x-coordinate of the popup window's display position. + * @param y A integer value specifying the y-coordinate of the popup window's display position. + */ + ShowWindowAtPos(window: ASPxClientPopupWindow, x: number, y: number): void; + /** + * Brings the specified popup window to the front of the z-order. + * @param window A ASPxClientPopupWindow object representing the popup window. + */ + BringWindowToFront(window: ASPxClientPopupWindow): void; + /** + * Closes the popup control's specified window. + * @param window A ASPxClientPopupWindow object representing the popup window to close. + */ + HideWindow(window: ASPxClientPopupWindow): void; + /** + * Returns the HTML code that represents the contents of the specified popup window. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowContentHtml(window: ASPxClientPopupWindow): string; + /** + * Defines the HTML content for a specific popup window within the popup control. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + * @param html A string value that represents the HTML code defining the content of the specified popup window. + */ + SetWindowContentHtml(window: ASPxClientPopupWindow, html: string): void; + /** + * Returns an iframe object containing a web page specified via the specified popup window's SetWindowContentUrl client method). + * @param window A ASPxClientPopupWindow object representing the required popup window. + */ + GetWindowContentIFrame(window: ASPxClientPopupWindow): Object; + /** + * Returns the URL pointing to the web page displayed within the control's specific popup window. + * @param window A ASPxClientPopupWindow object representing the required popup window. + */ + GetWindowContentUrl(window: ASPxClientPopupWindow): string; + /** + * Sets the URL pointing to the web page that should be loaded into and displayed within the control's specific popup window. + * @param window A ASPxClientPopupWindow object representing the required popup window. + * @param url A string value specifying the URL to the web page to be displayed within the specified popup window. + */ + SetWindowContentUrl(window: ASPxClientPopupWindow, url: string): void; + /** + * Returns a value indicating whether the specified window is pinned. + * @param window An ASPxClientPopupWindow object specifying the popup window. + */ + GetWindowPinned(window: ASPxClientPopupWindow): boolean; + /** + * Sets a value indicating whether the specified window is pinned. + * @param window An ASPxClientPopupWindow object specifying the popup window. + * @param value true to pin the window; otherwise, false. + */ + SetWindowPinned(window: ASPxClientPopupWindow, value: boolean): void; + /** + * Returns a value indicating whether the specified window is maximized. + * @param window An ASPxClientPopupWindow object specifying the popup window. + */ + GetWindowMaximized(window: ASPxClientPopupWindow): boolean; + /** + * Sets a value indicating whether the specified window is maximized. + * @param window An ASPxClientPopupWindow object specifying the popup window. + * @param value true to maximize the window; otherwise, false. + */ + SetWindowMaximized(window: ASPxClientPopupWindow, value: boolean): void; + /** + * Returns a value indicating whether the specified window is collapsed. + * @param window An ASPxClientPopupWindow object specifying the popup window. + */ + GetWindowCollapsed(window: ASPxClientPopupWindow): boolean; + /** + * Sets a value indicating whether the specified window is collapsed. + * @param window An ASPxClientPopupWindow object specifying the popup window. + * @param value true to collapse the window; otherwise, false. + */ + SetWindowCollapsed(window: ASPxClientPopupWindow, value: boolean): void; + /** + * Refreshes the content of the web page displayed within the control's specific popup window. + * @param window A ASPxClientPopupWindow object representing the required popup window. + */ + RefreshWindowContentUrl(window: ASPxClientPopupWindow): void; + /** + * Updates the default popup window's position, to correctly align it at either the specified element, or the center of the browser's window. + */ + UpdatePosition(): void; + /** + * Updates the default popup window's position, to correctly align it at the specified HTML element. + * @param htmlElement An object specifying the HTML element to which the default popup window is aligned using the PopupVerticalAlign properties. + */ + UpdatePositionAtElement(htmlElement: Object): void; + /** + * Updates the specified popup window's position, to correctly align it at either the specified element, or the center of the browser's window. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + */ + UpdateWindowPosition(window: ASPxClientPopupWindow): void; + /** + * Updates the specified popup window's position, to correctly align it at the specified HTML element. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + * @param htmlElement An object specifying the HTML element to which the specified popup window is aligned using the PopupVerticalAlign properties. + */ + UpdateWindowPositionAtElement(window: ASPxClientPopupWindow, htmlElement: Object): void; + /** + * Refreshes the connection between the ASPxPopupControl and the popup element. + */ + RefreshPopupElementConnection(): void; +} +/** + * Represents a client-side equivalent of a popup control's PopupWindow object. + */ +interface ASPxClientPopupWindow { + /** + * Gets the popup control to which the current popup window belongs. + * Value: An ASPxClientPopupControl object representing the popup control to which the window belongs. + */ + popupControl: ASPxClientPopupControl; + /** + * Gets the index of the current popup window within the popup control's Windows collection. + * Value: An integer value representing the zero-based index of the current popup window within the Windows collection of the popup control to which the window belongs. + */ + index: number; + /** + * Gets the name that uniquely identifies the current popup window. + * Value: A string value that represents a value assigned to the popup window's Name property. + */ + name: string; + /** + * Returns the URL pointing to the image displayed within the window header. + */ + GetHeaderImageUrl(): string; + /** + * Specifies the URL which points to the image displayed within the window header. + * @param value A string value that is the URL to the image displayed within the header. + */ + SetHeaderImageUrl(value: string): void; + /** + * Returns the URL pointing to the image displayed within the window footer. + */ + GetFooterImageUrl(): string; + /** + * Specifies the URL which points to the image displayed within the window footer. + * @param value A string value that is the URL to the image displayed within the window footer. + */ + SetFooterImageUrl(value: string): void; + /** + * Returns the URL where the web browser will navigate when the text or image is clicked within the popup window's header. + */ + GetHeaderNavigateUrl(): string; + /** + * Returns the URL where the web browser will navigate when the text or image is clicked within the popup window's header. + * @param value A string value which specifies the required navigation location. + */ + SetHeaderNavigateUrl(value: string): void; + /** + * Returns the URL where the web browser will navigate when the text or image is clicked within the popup window's footer. + */ + GetFooterNavigateUrl(): string; + /** + * Specifies the URL where the web browser will navigate when the text or image is clicked within the popup window's footer. + * @param value A string value which specifies the required navigation location. + */ + SetFooterNavigateUrl(value: string): void; + /** + * Returns the text displayed within the window's header. + */ + GetHeaderText(): string; + /** + * Specifies the text displayed within the window's header. + * @param value A string value that specifies the window's header text. + */ + SetHeaderText(value: string): void; + /** + * Returns the text displayed within the popup window's footer. + */ + GetFooterText(): string; + /** + * Specifies the text displayed within the window's footer. + * @param value A string value that specifies the window's footer text. + */ + SetFooterText(value: string): void; +} +/** + * A method that will handle the popup control's client events invoked in response to manipulating a popup window. + */ +interface ASPxClientPopupWindowEventHandler { + /** + * A method that will handle the popup control's client events when a popup window is manipulated. + * @param source An object representing the event's source. Identifies the popup control object (ASPxClientPopupControl) that raised the event. + * @param e An ASPxClientPopupWindowEventArgs object that contains event data. + */ + (source: S, e: ASPxClientPopupWindowEventArgs): void; +} +/** + * Provides data for events concerning client manipulations on popup windows. + */ +interface ASPxClientPopupWindowEventArgs extends ASPxClientEventArgs { + /** + * Gets the popup window object related to the event. + * Value: An ASPxClientPopupWindow object representing the popup window that was manipulated, causing the popup control to raise the event. + */ + window: ASPxClientPopupWindow; +} +/** + * A method that will handle the popup window's cancellable client events, such as the Closing. + */ +interface ASPxClientPopupWindowCancelEventHandler { + /** + * A method that will handle the popup window's cancelable client events. + * @param source An object representing the event's source. Identifies the popup window object that raised the event. + * @param e An ASPxClientPopupWindowCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientPopupWindowCancelEventArgs): void; +} +/** + * Provides data for the popup control's cancellable client events, such as the Closing. + */ +interface ASPxClientPopupWindowCancelEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the popup window object related to the event. + * Value: An ASPxClientPopupWindow object representing the popup window that was manipulated, causing the popup control to raise the event. + */ + window: ASPxClientPopupWindow; + /** + * Gets the value that identifies the reason the popup window is about to close. + * Value: One of the ASPxClientPopupControlCloseReason enumeration values. + */ + closeReason: ASPxClientPopupControlCloseReason; +} +/** + * A method that will handle the CloseUp event. + */ +interface ASPxClientPopupWindowCloseUpEventHandler { + /** + * A method that will handle the CloseUp event. + * @param source The event source. + * @param e An ASPxClientPopupWindowCloseUpEventArgs object that contains event data. + */ + (source: S, e: ASPxClientPopupWindowCloseUpEventArgs): void; +} +/** + * Provides data for the CloseUp event. + */ +interface ASPxClientPopupWindowCloseUpEventArgs extends ASPxClientPopupWindowEventArgs { + /** + * Gets the value that identifies the reason the popup window closes. + * Value: One of the ASPxClientPopupControlCloseReason enumeration values. + */ + closeReason: ASPxClientPopupControlCloseReason; +} +/** + * A method that will handle the Resize event. + */ +interface ASPxClientPopupWindowResizeEventHandler { + /** + * A method that will handle the Resize event. + * @param source The event source. + * @param e A ASPxClientPopupWindowResizeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientPopupWindowResizeEventArgs): void; +} +/** + * Provides data for the Resize event. + */ +interface ASPxClientPopupWindowResizeEventArgs extends ASPxClientPopupWindowEventArgs { + /** + * Returns the value indicating the window state after resizing. + * Value: The integer value indicating the window resize state. + */ + resizeState: number; +} +/** + * A method that will handle the PinnedChanged event. + */ +interface ASPxClientPopupWindowPinnedChangedEventHandler { + /** + * A method that will handle the PinnedChanged event. + * @param source The event source. + * @param e A ASPxClientPopupWindowPinnedChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientPopupWindowPinnedChangedEventArgs): void; +} +/** + * Provides data for the PinnedChanged event. + */ +interface ASPxClientPopupWindowPinnedChangedEventArgs extends ASPxClientPopupWindowEventArgs { + /** + * Gets a value indicating whether the processed popup window has been pinned. + * Value: true, if the window has been pinned; otherwise, false. + */ + pinned: boolean; +} +/** + * Represents a client collection that maintains client popup control objects. + */ +interface ASPxClientPopupControlCollection extends ASPxClientControlCollection { + /** + * Hides all popup windows maintained by the collection. + */ + HideAllWindows(): void; +} +/** + * Declares client constants that identify the reason the popup window closes. + */ +interface ASPxClientPopupControlCloseReason { +} +/** + * Represents a client-side equivalent of the ASPxPopupMenu object. + */ +interface ASPxClientPopupMenu extends ASPxClientMenuBase { + /** + * Sets the ID of a web control or HTML element (or a list of IDs) with which the current popup menu is associated. + * @param popupElementId A string value specifying the ID (or a list of IDs) of the web control or HTML element with which the popup menu is associated. + */ + SetPopupElementID(popupElementId: string): void; + /** + * Returns an index of the object that invoked the popup menu within the PopupElementID list. + */ + GetCurrentPopupElementIndex(): number; + /** + * Returns an object that invoked the popup menu. + */ + GetCurrentPopupElement(): Object; + /** + * Refreshes the connection between the ASPxPopupMenu and the popup element. + */ + RefreshPopupElementConnection(): void; + /** + * Hides the popup menu. + */ + Hide(): void; + /** + * Invokes the popup menu. + */ + Show(): void; + /** + * Invokes the popup menu at the popup element with the specified index. + * @param popupElementIndex An integer value specifying the zero-based index of the popup element. + */ + Show(popupElementIndex: number): void; + /** + * Invokes the popup menu and displays it over the specified HTML element. + * @param htmlElement An object specifying the HTML element relative to which position the popup menu is invoked. + */ + ShowAtElement(htmlElement: Object): void; + /** + * Invokes the popup menu and displays it over an HTML element specified by its unique identifier. + * @param id A string value that specifies the hierarchically qualified identifier of an HTML element relative to which position the popup menu is invoked. + */ + ShowAtElementByID(id: string): void; + /** + * Invokes the popup menu at the specified position. + * @param x An integer value specifying the x-coordinate of the popup menu's display position. + * @param y An integer value specifying the y-coordinate of the popup menu's display position. + */ + ShowAtPos(x: number, y: number): void; +} +/** + * Represents the client-side equivalent of the ASPxRatingControl control. + */ +interface ASPxClientRatingControl extends ASPxClientControl { + /** + * Fires on the server after an item has been clicked. + */ + ItemClick: ASPxClientEvent>; + /** + * Occurs on the client side when the mouse cursor is moved into a rating control item. + */ + ItemMouseOver: ASPxClientEvent>; + /** + * Occurs on the client side when the mouse cursor moves outside a rating control item. + */ + ItemMouseOut: ASPxClientEvent>; + /** + * Gets the item tooltip title specified by the item index. + * @param index An integer value specifying the item index. + */ + GetTitle(index: number): string; + /** + * Returns a value indicating whether the control's status is read-only. + */ + GetReadOnly(): boolean; + /** + * Specifies whether the control's status is read-only. + * @param value true to make the control read-only; otherwise, false. + */ + SetReadOnly(value: boolean): void; + /** + * Returns the value of the ASPxRatingControl. + */ + GetValue(): number; + /** + * Modifies the value of the ASPxRatingControl on the client side. + * @param value A decimal value representing the value of the control. + */ + SetValue(value: number): void; +} +/** + * A method that will handle the client ItemClick event. + */ +interface ASPxClientRatingControlItemClickEventHandler { + /** + * A method that will handle the client ItemClick event. + * @param source An object representing the event source. + * @param e A ASPxClientRatingControlItemClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRatingControlItemClickEventArgs): void; +} +/** + * Provides data for the ItemClick event. + */ +interface ASPxClientRatingControlItemClickEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the index of the item related to the event. + * Value: An integer value that represents the clicked item's index. + */ + index: number; +} +/** + * A method that will handle the rating control's ItemMouseOver and ItemMouseOut client events (such as ItemMouseOut). + */ +interface ASPxClientRatingControlItemMouseEventHandler { + /** + * A method that will handle the ItemMouseOver events. + * @param source The event source. + * @param e An ASPxClientRatingControlItemMouseEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRatingControlItemMouseEventArgs): void; +} +/** + * Provides data for the rating control's ItemMouseOver and ItemMouseOut client events (such as ItemMouseOut). + */ +interface ASPxClientRatingControlItemMouseEventArgs extends ASPxClientEventArgs { + /** + * Gets the index of the item related to the event. + * Value: An integer value that represents the related item's index. + */ + index: number; +} +/** + * Represents the client-side equivalent of the ASPxRibbon control. + */ +interface ASPxClientRibbon extends ASPxClientControl { + /** + * Occurs after an end-user executes an action on a ribbon item. + */ + CommandExecuted: ASPxClientEvent>; + /** + * Fires on the client side after the active tab has been changed within a ribbon control. + */ + ActiveTabChanged: ASPxClientEvent>; + /** + * Occurs on the client side when the ribbon minimization state is changed by end-user actions. + */ + MinimizationStateChanged: ASPxClientEvent>; + /** + * Occurs when the file tab is clicked. + */ + FileTabClicked: ASPxClientEvent>; + /** + * Fires on the client side after a dialog box launcher has been clicked. + */ + DialogBoxLauncherClicked: ASPxClientEvent>; + /** + * Fires after key tips are closed by pressing Esc. + */ + KeyTipsClosedOnEscape: ASPxClientEvent>; + /** + * Specifies whether the ribbon control is enabled. + * @param enabled true to enable the ribbon; false to disable it. + */ + SetEnabled(enabled: boolean): void; + /** + * Returns a value indicating whether the ribbon is enabled. + */ + GetEnabled(): boolean; + /** + * Returns a tab specified by its index. + * @param index An integer value specifying the zero-based index of the tab object to retrieve. + */ + GetTab(index: number): ASPxClientRibbonTab; + /** + * Returns a tab specified by its name. + * @param name A string value specifying the name of the tab. + */ + GetTabByName(name: string): ASPxClientRibbonTab; + /** + * Returns the number of tabs in the ribbon Tabs collection. + */ + GetTabCount(): number; + /** + * Returns the active tab within the ribbon control. + */ + GetActiveTab(): ASPxClientRibbonTab; + /** + * Makes the specified tab active in the ribbon control on the client side. + * @param tab A ASPxClientRibbonTab object specifying the tab selection. + */ + SetActiveTab(tab: ASPxClientRibbonTab): void; + /** + * Makes a tab active within the ribbon control, specifying the tab's index. + * @param index An integer value specifying the index of the tab to select. + */ + SetActiveTabIndex(index: number): void; + /** + * Returns a ribbon item specified by its name. + * @param name A string value specifying the name of the item. + */ + GetItemByName(name: string): ASPxClientRibbonItem; + /** + * Returns a value of item with the specified name. + * @param name A string value specifying the name of the item. + */ + GetItemValueByName(name: string): Object; + /** + * Sets the value of the item with the specified name. + * @param name A string value specifying the name of the item. + * @param value An object that is the new item value. + */ + SetItemValueByName(name: string, value: Object): void; + /** + * Specifies whether the ribbon is minimized. + * @param minimized true to set the ribbon state to minimized; false to set the ribbon state to normal. + */ + SetMinimized(minimized: boolean): void; + /** + * Gets a value specifying whether the ribbon is minimized. + */ + GetMinimized(): boolean; + /** + * Specifies the visibility of a context tab category specified by its name. + * @param categoryName A Name property value of the required category. + * @param visible true to make a category visible; false to make it hidden. + */ + SetContextTabCategoryVisible(categoryName: string, visible: boolean): void; + /** + * Shows ribbon key tips. + */ + ShowKeyTips(): void; +} +/** + * A client-side equivalent of the ribbon's RibbonTab object. + */ +interface ASPxClientRibbonTab { + /** + * Gets the client ribbon object to which the current tab belongs. + * Value: An object to which the tab belongs. + */ + ribbon: ASPxClientRibbon; + /** + * Gets or sets the tab's index within the collection. + * Value: An integer value that is the zero-based index of the tab within the collection. + */ + index: number; + /** + * Gets the name of the current ribbon tab. + * Value: A string value that is the tab's name. + */ + name: string; + /** + * Returns the text displayed in the tab. + */ + GetText(): string; + /** + * Sets a value specifying whether the tab is enabled. + * @param enabled true to enable the tab; false to disable it. + */ + SetEnabled(enabled: boolean): void; + /** + * Returns a value indicating whether a ribbon tab is enabled. + */ + GetEnabled(): boolean; + /** + * Returns a value specifying whether a ribbon tab is displayed. + */ + GetVisible(): boolean; +} +/** + * A client-side equivalent of the ribbon's RibbonGroup object. + */ +interface ASPxClientRibbonGroup { + /** + * Gets the client ribbon object to which the current group belongs. + * Value: An object to which the group belongs. + */ + ribbon: ASPxClientRibbon; + /** + * Gets the client tab object to which the current group belongs. + * Value: An object to which the group belongs. + */ + tab: ASPxClientRibbonTab; + /** + * Gets or sets the group's index within the collection. + * Value: An integer value that is the zero-based index of the group within the collection. + */ + index: number; + /** + * Gets the name of the current ribbon group. + * Value: A string value that is the group's name. + */ + name: string; + /** + * Returns a value specifying whether a ribbon group is displayed. + */ + GetVisible(): boolean; +} +/** + * A client-side equivalent of the ribbon's RibbonItemBase object. + */ +interface ASPxClientRibbonItem { + /** + * Gets the client group object to which the current item belongs. + * Value: An object to which the item belongs. + */ + group: ASPxClientRibbonGroup; + /** + * Gets or sets the item's index within the collection. + * Value: An integer value that is the zero-based index of the item within the collection. + */ + index: number; + /** + * Gets the name of the current ribbon item. + * Value: A string value that is the item's name. + */ + name: string; + /** + * Gets the client ribbon object to which the current item belongs. + * Value: An object to which the item belongs. + */ + ribbon: ASPxClientRibbon; + /** + * Returns a value indicating whether a ribbon item is enabled. + */ + GetEnabled(): boolean; + /** + * Sets a value specifying whether the item is enabled. + * @param enabled true to enable the item; false to disable it. + */ + SetEnabled(enabled: boolean): void; + /** + * Returns the item value. + */ + GetValue(): Object; + /** + * Sets the item value. + * @param value An that specifies the item value. + */ + SetValue(value: Object): void; + /** + * Returns a value specifying whether a ribbon item is displayed. + */ + GetVisible(): boolean; +} +/** + * A method that will handle the CommandExecuted event. + */ +interface ASPxClientRibbonCommandExecutedEventHandler { + /** + * A method that will handle the CommandExecuted event. + * @param source The event source. Identifies the ASPxRibbon control that raised the event. + * @param e An ASPxClientRibbonCommandExecutedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRibbonCommandExecutedEventArgs): void; +} +/** + * Provides data for the CommandExecuted event. + */ +interface ASPxClientRibbonCommandExecutedEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets an item object related to the event. + * Value: An object, manipulations on which forced the event to be raised. + */ + item: ASPxClientRibbonItem; + /** + * Gets an optional parameter that complements the processed command. + * Value: A string value containing additional information about the processed command. + */ + parameter: string; +} +/** + * A method that will handle the ActiveTabChanged event. + */ +interface ASPxClientRibbonTabEventHandler { + /** + * A method that will handle the ActiveTabChanged event. + * @param source The event source. Identifies the ASPxRibbon control that raised the event. + * @param e A ASPxClientRibbonTabEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRibbonTabEventArgs): void; +} +/** + * Provides data for the ActiveTabChanged event. + */ +interface ASPxClientRibbonTabEventArgs extends ASPxClientEventArgs { + /** + * Gets the tab object related to the event. + * Value: An object that is the tab, manipulations on which forced the ribbon control to raise the event. + */ + tab: ASPxClientRibbonTab; +} +/** + * A method that will handle the MinimizationStateChanged event. + */ +interface ASPxClientRibbonMinimizationStateEventHandler { + /** + * A method that will handle the MinimizationStateChanged event. + * @param source The event source. Identifies the ASPxRibbon control that raised the event. + * @param e An ASPxClientRibbonMinimizationStateEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRibbonMinimizationStateEventArgs): void; +} +/** + * Provides data for the MinimizationStateChanged event. + */ +interface ASPxClientRibbonMinimizationStateEventArgs extends ASPxClientEventArgs { + /** + * Returns the value indicating the new ribbon state. + * Value: The integer value indicating the ribbon minimization state. + */ + ribbonState: number; +} +/** + * A method that will handle the DialogBoxLauncherClicked event. + */ +interface ASPxClientRibbonDialogBoxLauncherClickedEventHandler { + /** + * A method that will handle the DialogBoxLauncherClicked event. + * @param source The event source. This parameter identifies the ribbon object which raised the event. + * @param e An ASPxClientRibbonDialogBoxLauncherClickedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRibbonDialogBoxLauncherClickedEventArgs): void; +} +/** + * Provides data for the DialogBoxLauncherClicked event. + */ +interface ASPxClientRibbonDialogBoxLauncherClickedEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the client group object to which the clicked dialog box launcher belongs. + * Value: An object to which the dialog box launcher belongs. + */ + group: ASPxClientRibbonGroup; +} +/** + * Represents a client-side equivalent of the ASPxRoundPanel control. + */ +interface ASPxClientRoundPanel extends ASPxClientPanelBase { + /** + * Fires on the client side after a panel has been expanded or collapsed via end-user interactions, i.e., by clicking a panel header or collapse button. + */ + CollapsedChanged: ASPxClientEvent>; + /** + * Fires on the client side before a panel is expanded or collapsed by end-user interactions, i.e., by clicking a panel header or collapse button. + */ + CollapsedChanging: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientRoundPanel. + */ + CallbackError: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. + * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. + * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Returns the text displayed within the panel's header. + */ + GetHeaderText(): string; + /** + * Specifies the text displayed in the panel's header. + * @param text A string value that specifies the panel header's text. + */ + SetHeaderText(text: string): void; + /** + * Returns a value indicating whether the panel is collapsed. + */ + GetCollapsed(): boolean; + /** + * Sets a value indicating whether the panel is collapsed. + * @param collapsed true, to collapse the panel; otherwise, false. + */ + SetCollapsed(collapsed: boolean): void; +} +/** + * Represents a client-side equivalent of the ASPxSplitter object. + */ +interface ASPxClientSplitter extends ASPxClientControl { + /** + * Fires before a pane is resized. + */ + PaneResizing: ASPxClientEvent>; + /** + * Fires after a pane has been resized. + */ + PaneResized: ASPxClientEvent>; + /** + * Fires before a pane is collapsed. + */ + PaneCollapsing: ASPxClientEvent>; + /** + * Fires after a pane has been collapsed. + */ + PaneCollapsed: ASPxClientEvent>; + /** + * Fires before a pane is expanded. + */ + PaneExpanding: ASPxClientEvent>; + /** + * Fires after a pane has been expanded. + */ + PaneExpanded: ASPxClientEvent>; + /** + * Occurs when a pane resize operation has been completed. + */ + PaneResizeCompleted: ASPxClientEvent>; + /** + * Fires after a specific web page has been loaded into a pane. + */ + PaneContentUrlLoaded: ASPxClientEvent>; + /** + * Returns the number of panes at the root level of a splitter. + */ + GetPaneCount(): number; + /** + * Returns the splitter's root pane specified by its index within the Panes collection. + * @param index An integer value specifying the zero-based index of the root pane to be retrieved. + */ + GetPane(index: number): ASPxClientSplitterPane; + /** + * Returns a pane specified by its name. + * @param name A string value specifying the name of the pane. + */ + GetPaneByName(name: string): ASPxClientSplitterPane; + /** + * Specifies whether the control's panes can be resized by end-users on the client side. + * @param allowResize true if pane resizing is allowed; otherwise, false. + */ + SetAllowResize(allowResize: boolean): void; + /** + * Returns a string value that represents the client state of splitter panes. + */ + GetLayoutData(): string; +} +/** + * Represents a client-side equivalent of the splitter's SplitterPane object. + */ +interface ASPxClientSplitterPane { + /** + * Gets the index of the current pane within the pane collection to which it belongs. + * Value: An integer value representing the zero-based index of the current pane within the SplitterPaneCollection collection. + */ + index: number; + /** + * Gets the name that uniquely identifies the current splitter pane. + * Value: A string value that represents the value assigned to the pane's Name property. + */ + name: string; + /** + * Returns a client splitter object that contains the current pane. + */ + GetSplitter(): ASPxClientSplitter; + /** + * Returns the immediate parent of the current pane. + */ + GetParentPane(): ASPxClientSplitterPane; + /** + * Returns the previous sibling pane of the current pane. + */ + GetPrevPane(): ASPxClientSplitterPane; + /** + * Returns the next sibling pane of the current pane. + */ + GetNextPane(): ASPxClientSplitterPane; + /** + * Determines whether the current pane is the first pane within the SplitterPaneCollection. + */ + IsFirstPane(): boolean; + /** + * Determines whether the current pane is the last pane within the SplitterPaneCollection. + */ + IsLastPane(): boolean; + /** + * Returns a value that indicates the orientation in which the current pane and its sibling panes are stacked. + */ + IsVertical(): boolean; + /** + * Returns the number of the current pane's immediate child panes. + */ + GetPaneCount(): number; + /** + * Returns the current pane's immediate child pane specified by its index. + * @param index An integer value specifying the zero-based index of the child pane to be retrieved. + */ + GetPane(index: number): ASPxClientSplitterPane; + /** + * Returns the current pane's child pane specified by its name. + * @param name A string value specifying the name of the pane. + */ + GetPaneByName(name: string): ASPxClientSplitterPane; + /** + * Gets the width of the pane's content area. + */ + GetClientWidth(): number; + /** + * Gets the height of the pane's content area. + */ + GetClientHeight(): number; + /** + * Collapses the current pane and occupies its space by maximizing the specified pane. + * @param maximizedPane A ASPxClientSplitterPane object specifying the pane to be maximized to occupy the freed space. + */ + Collapse(maximizedPane: ASPxClientSplitterPane): boolean; + /** + * Collapses the current pane in a forward direction and occupies its space by maximizing the previous adjacent pane. + */ + CollapseForward(): boolean; + /** + * Collapses the current pane in a backward direction, and occupies its space by maximizing the next adjacent pane. + */ + CollapseBackward(): boolean; + /** + * Expands the current pane object on the client side. + */ + Expand(): boolean; + /** + * Returns whether the pane is collapsed. + */ + IsCollapsed(): boolean; + /** + * Returns whether the pane's content is loaded from an external web page. + */ + IsContentUrlPane(): boolean; + /** + * Gets the URL of a web page displayed as a pane's content. + */ + GetContentUrl(): string; + /** + * Sets the URL to point to a web page that should be loaded into, and displayed within the current pane. + * @param url A string value specifying the URL to a web page displayed within the pane. + */ + SetContentUrl(url: string): void; + /** + * Sets the URL to point to a web page that should be loaded into, and displayed within the current pane, but should not be cached by a client browser. + * @param url A string value specifying the URL to a web page displayed within the pane. + * @param preventBrowserCaching true to prevent the browser to cache the loaded content; false to allow browser caching. + */ + SetContentUrl(url: string, preventBrowserCaching: boolean): void; + /** + * Refreshes the content of the web page displayed within the current pane. + */ + RefreshContentUrl(): void; + /** + * Returns an iframe object containing a web page specified via the pane's SetContentUrl client method). + */ + GetContentIFrame(): Object; + /** + * Specifies whether the current pane can be resized by end-users on the client side. + * @param allowResize true if pane resizing is allowed; otherwise, false. + */ + SetAllowResize(allowResize: boolean): void; + /** + * Forces the client PaneResized event to be generated. + */ + RaiseResizedEvent(): void; + /** + * Returns an HTML element representing a splitter pane object. + */ + GetElement(): Object; + /** + * Specifies the splitter pane's size in pixels. + * @param size An integer value that specifies the splitter pane's size. + */ + SetSize(size: number): void; + /** + * Specifies the splitter pane's size, in pixels or percents. + * @param size A string value that specifies the splitter pane's size, in pixels or percents. + */ + SetSize(size: string): void; + /** + * Returns the splitter pane's size, in pixels or percents. + */ + GetSize(): string; + /** + * Returns the distance between the top edge of the pane content and the topmost portion of the content currently visible in the pane. + */ + GetScrollTop(): number; + /** + * Specifies the distance between the top edge of the pane content and the topmost portion of the content currently visible in the pane. + * @param value An integer value that is the distance (in pixels). + */ + SetScrollTop(value: number): void; + /** + * Returns the distance between the left edge of the pane content and the leftmost portion of the content currently visible in the pane. + */ + GetScrollLeft(): number; + /** + * Specifies the distance between the left edge of the pane content and the leftmost portion of the content currently visible in the pane. + * @param value An integer value that is the distance (in pixels). + */ + SetScrollLeft(value: number): void; +} +/** + * A method that will handle the splitter's client events concerning manipulations with a pane. + */ +interface ASPxClientSplitterPaneEventHandler { + /** + * A method that will handle the splitter's client events concerning pane manipulations. + * @param source An object representing the event's source. Identifies the splitter object that raised the event. + * @param e An ASPxClientSplitterPaneEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSplitterPaneEventArgs): void; +} +/** + * A method that will handle the splitter's client events concerning manipulations with a pane. + */ +interface ASPxClientSplitterPaneEventArgs extends ASPxClientEventArgs { + /** + * Gets the pane object related to the event. + * Value: An ASPxClientSplitterPane object, manipulations on which forced the event to be raised. + */ + pane: ASPxClientSplitterPane; +} +/** + * A method that will handle a splitter control's cancelable client events concerning manipulations with a pane. + */ +interface ASPxClientSplitterPaneCancelEventHandler { + /** + * A method that will handle a splitter control's cancelable client events concerning pane manipulations. + * @param source An object representing the event's source. Identifies the splitter control object that raised the event. + * @param e An ASPxClientSplitterPaneCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSplitterPaneCancelEventArgs): void; +} +/** + * Provides data for a splitter control's cancelable client events concerning manipulations with a pane. + */ +interface ASPxClientSplitterPaneCancelEventArgs extends ASPxClientSplitterPaneEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * Represents a base for the ASPxClientPageControl objects. + */ +interface ASPxClientTabControlBase extends ASPxClientControl { + /** + * Fires when a tab is clicked. + */ + TabClick: ASPxClientEvent>; + /** + * Fires on the client side after the active tab has been changed within a tab control. + */ + ActiveTabChanged: ASPxClientEvent>; + /** + * Fires on the client side before the active tab is changed within a tab control. + */ + ActiveTabChanging: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by a client tab control. + */ + CallbackError: ASPxClientEvent>; + /** + * Modifies a tab page's size in accordance with the content. + */ + AdjustSize(): void; + /** + * Returns the active tab within the tab control. + */ + GetActiveTab(): ASPxClientTab; + /** + * Makes the specified tab active within the tab control on the client side. + * @param tab An ASPxClientTab object specifying the tab to select. + */ + SetActiveTab(tab: ASPxClientTab): void; + /** + * Returns the index of the active tab within the tab control. + */ + GetActiveTabIndex(): number; + /** + * Makes a tab active within the tab control, specifying the tab's index. + * @param index An integer value specifying the index of the tab to select. + */ + SetActiveTabIndex(index: number): void; + /** + * Returns the number of tabs in the ASPxTabControl. + */ + GetTabCount(): number; + /** + * Returns a tab specified by its index. + * @param index An integer value specifying the zero-based index of the tab object to retrieve. + */ + GetTab(index: number): ASPxClientTab; + /** + * Returns a tab specified by its name. + * @param name A string value specifying the name of the tab. + */ + GetTabByName(name: string): ASPxClientTab; +} +/** + * Represents a client-side equivalent of the ASPxTabControl object. + */ +interface ASPxClientTabControl extends ASPxClientTabControlBase { +} +/** + * Represents a client-side equivalent of the ASPxPageControl object. + */ +interface ASPxClientPageControl extends ASPxClientTabControlBase { + /** + * Returns the HTML code that represents the contents of the specified page within the page control. + * @param tab An ASPxClientTab object that specifies the required page. + */ + GetTabContentHTML(tab: ASPxClientTab): string; + /** + * Defines the HTML content for a specific tab page within the page control. + * @param tab An ASPxClientTab object that specifies the required tab page. + * @param html A string value that represents the HTML code defining the content of the specified page. + */ + SetTabContentHTML(tab: ASPxClientTab, html: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * Represents a client-side equivalent of a tab control's TabPage object. + */ +interface ASPxClientTab { + /** + * Gets the tab control to which the current tab belongs. + * Value: An ASPxClientTabControlBase object representing the control to which the tab belongs. + */ + tabControl: ASPxClientTabControlBase; + /** + * Gets the index of the current tab (tabbed page) within the control's collection of tabs (tabbed pages). + * Value: An integer value representing the zero-based index of the current tab (tabbed page) within the TabPages) collection of the control to which the tab belongs. + */ + index: number; + /** + * Gets the name that uniquely identifies the current tab. + * Value: A string value that represents the value assigned to the tab's Name property. + */ + name: string; + /** + * Returns a value specifying whether a tab is enabled. + */ + GetEnabled(): boolean; + /** + * Specifies whether the tab is enabled. + * @param value true to enable the tab; otherwise, false. + */ + SetEnabled(value: boolean): void; + /** + * Returns the URL pointing to the image displayed within the tab. + */ + GetImageUrl(): string; + /** + * Specifies the URL which points to the image displayed within the tab. + * @param value A string value that is the URL to the image displayed within the tab. + */ + SetImageUrl(value: string): void; + /** + * Returns the URL pointing to the image displayed within the active tab. + */ + GetActiveImageUrl(): string; + /** + * Specifies the URL which points to the image displayed within the active tab. + * @param value A string value that is the URL to the image displayed within the active tab. + */ + SetActiveImageUrl(value: string): void; + /** + * Gets an URL which defines the navigation location for the tab. + */ + GetNavigateUrl(): string; + /** + * Specifies a URL which defines the navigation location for the tab. + * @param value A string value which is a URL to where the client web browser will navigate when the tab is clicked. + */ + SetNavigateUrl(value: string): void; + /** + * Returns text displayed within the tab. + */ + GetText(): string; + /** + * Specifies the text displayed within the tab. + * @param value A string value that is the text displayed within the tab. + */ + SetText(value: string): void; + /** + * Returns a value specifying whether a tab is displayed. + */ + GetVisible(): boolean; + /** + * Specifies whether the tab is visible. + * @param value true is the tab is visible; otherwise, false. + */ + SetVisible(value: boolean): void; +} +/** + * A method that will handle a tab control's client events concerning manipulations with a tab. + */ +interface ASPxClientTabControlTabEventHandler { + /** + * A method that will handle a tab control's client events concerning manipulations with a tab. + * @param source An object representing the event's source. Identifies the tab control object that raised the event. + * @param e An ASPxClientTabControlTabEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTabControlTabEventArgs): void; +} +/** + * Provides data for events which concern manipulations on tabs. + */ +interface ASPxClientTabControlTabEventArgs extends ASPxClientEventArgs { + /** + * Gets the tab object related to the event. + * Value: An ASPxClientTab object, manipulations on which forced the event to be raised. + */ + tab: ASPxClientTab; +} +/** + * A method that will handle a tab control's cancelable client events concerning manipulations with a tab. + */ +interface ASPxClientTabControlTabCancelEventHandler { + /** + * A method that will handle a tab control's cancelable client events concerning manipulations with a tab. + * @param source An object representing the event's source. Identifies the tab control object that raised the event. + * @param e An ASPxClientTabControlTabCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTabControlTabCancelEventArgs): void; +} +/** + * Provides data for cancellable events which concern manipulations on tabs. + */ +interface ASPxClientTabControlTabCancelEventArgs extends ASPxClientProcessingModeCancelEventArgs { + /** + * Gets the tab object related to the event. + * Value: An ASPxClientTab object representing the tab manipulations on which forced the tab control to raise the event. + */ + tab: ASPxClientTab; + /** + * Gets or sets a value specifying whether a callback should be sent to the server to reload the content of the page being activated. + * Value: true to reload the page's content; otherwise, false. + */ + reloadContentOnCallback: boolean; +} +/** + * A method that will handle client events concerning clicks on the control's tabs. + */ +interface ASPxClientTabControlTabClickEventHandler { + /** + * A method that will handle client events concerning clicks on tabs. + * @param source The event source. This parameter identifies the tab control object which raised the event. + * @param e An ASPxClientTabControlTabClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTabControlTabClickEventArgs): void; +} +/** + * Provides data for events which concern clicking on the control's tabs. + */ +interface ASPxClientTabControlTabClickEventArgs extends ASPxClientTabControlTabCancelEventArgs { + /** + * Gets the HTML object that contains the processed tab. + * Value: An object representing a container for the tab related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * Represents a client-side equivalent of the ASPxTimer object. + */ +interface ASPxClientTimer extends ASPxClientControl { + /** + * Fires on the client side when the specified timer interval has elapsed, and the timer is enabled. + */ + Tick: ASPxClientEvent>; + /** + * Returns a value indicating whether the timer is enabled. + */ + GetEnabled(): boolean; + /** + * Enables the timer. + * @param enabled true to turn the timer on; false, to turn the timer off. + */ + SetEnabled(enabled: boolean): void; + /** + * Gets the time before the Tick event. + */ + GetInterval(): number; + /** + * Specifies the time before the Tick event. + * @param interval An integer value that specifies the number of milliseconds before the Tick event is raised relative to the last occurrence of the Tick event. The value cannot be less than one. + */ + SetInterval(interval: number): void; +} +/** + * Represents a client-side equivalent of the ASPxTitleIndex object. + */ +interface ASPxClientTitleIndex extends ASPxClientControl { + /** + * Fires after an item has been clicked. + */ + ItemClick: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientTitleIndex. + */ + CallbackError: ASPxClientEvent>; +} +/** + * A method that will handle client events concerning manipulations with an item. + */ +interface ASPxClientTitleIndexItemEventHandler { + /** + * A method that will handle the title index control's client events concerning manipulations with an item. + * @param source An object representing the event's source. Identifies the title index control object that raised the event. + * @param e An ASPxClientTitleIndexItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTitleIndexItemEventArgs): void; +} +/** + * Provides data for events which concern manipulations on the control's items. + */ +interface ASPxClientTitleIndexItemEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the name that uniquely identifies the processed item. + * Value: A string value that represents the value assigned to the processed item's Name property. + */ + name: Object; + /** + * Gets the HTML object that contains the processed item. + * Value: An object representing a container for the item related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * Represents a client-side equivalent of the ASPxTreeView object. + */ +interface ASPxClientTreeView extends ASPxClientControl { + /** + * Fires on the client side after a node has been clicked. + */ + NodeClick: ASPxClientEvent>; + /** + * Fires on the client side after a node's expansion state has been changed by end-user interaction. + */ + ExpandedChanged: ASPxClientEvent>; + /** + * Fires on the client side before the expansion state of a node is changed via end-user interaction. + */ + ExpandedChanging: ASPxClientEvent>; + /** + * Occurs on the client side when the node's checked state is changed by clicking on a check box. + */ + CheckedChanged: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientTreeView. + */ + CallbackError: ASPxClientEvent>; + /** + * Returns a node specified by its index within the ASPxTreeView's node collection. + * @param index An integer value specifying the zero-based index of the node to be retrieved. + */ + GetNode(index: number): ASPxClientTreeViewNode; + /** + * Returns a node specified by its name. + * @param name A string value specifying the name of the node. + */ + GetNodeByName(name: string): ASPxClientTreeViewNode; + /** + * Returns a node specified by its text. + * @param text A string value specifying the text content of the node. + */ + GetNodeByText(text: string): ASPxClientTreeViewNode; + /** + * Returns the number of nodes at the ASPxTreeView's zero level. + */ + GetNodeCount(): number; + /** + * Returns the selected node within the ASPxTreeView control on the client side. + */ + GetSelectedNode(): ASPxClientTreeViewNode; + /** + * Selects the specified node within the ASPxTreeView control on the client side. + * @param node An ASPxClientTreeViewNode object specifying the node to select. + */ + SetSelectedNode(node: ASPxClientTreeViewNode): void; + /** + * Gets the root node of the ASPxTreeView object. + */ + GetRootNode(): ASPxClientTreeViewNode; + /** + * Collapses all nodes in the ASPxTreeView on the client side. + */ + CollapseAll(): void; + /** + * Expands all nodes in the ASPxTreeView on the client side. + */ + ExpandAll(): void; +} +/** + * Represents a client-side equivalent of the ASPxTreeView's TreeViewNode object. + */ +interface ASPxClientTreeViewNode { + /** + * Gets the client representation of the ASPxTreeView control to which the current node belongs. + * Value: An ASPxClientTreeView object representing the control to which the node belongs. + */ + treeView: ASPxClientTreeView; + /** + * Gets the current node's parent node. + * Value: An ASPxClientTreeViewNode object representing the node's immediate parent. + */ + parent: ASPxClientTreeViewNode; + /** + * Gets the node's index within the parent's collection of nodes. + * Value: An integer value representing the node's zero-based index within the Nodes collection of the node to which the node belongs. + */ + index: number; + /** + * Gets the name that uniquely identifies the node. + * Value: A string value that represents the value assigned to the node's Name property. + */ + name: string; + /** + * Returns the number of the current node's immediate child nodes. + */ + GetNodeCount(): number; + /** + * Returns the current node's immediate child node specified by its index. + * @param index An integer value specifying the zero-based index of the node to be retrieved. + */ + GetNode(index: number): ASPxClientTreeViewNode; + /** + * Returns the current node's child node specified by its name. + * @param name A string value specifying the name of the node. + */ + GetNodeByName(name: string): ASPxClientTreeViewNode; + /** + * Returns the current node's child node specified by its text. + * @param text A string value specifying the text content of the node. + */ + GetNodeByText(text: string): ASPxClientTreeViewNode; + /** + * Returns a value indicating whether the node is expanded. + */ + GetExpanded(): boolean; + /** + * Sets a value which specifies the node's expansion state. + * @param value true if the node is expanded; otherwise, false. + */ + SetExpanded(value: boolean): void; + /** + * Returns a value indicating whether the node is checked. + */ + GetChecked(): boolean; + /** + * Sets a value indicating whether the node is checked. + * @param value true if the node is checked; otherwise, false. + */ + SetChecked(value: boolean): void; + /** + * Returns a value which specifies the node's check state. + */ + GetCheckState(): string; + /** + * Returns a value specifying whether the node is enabled. + */ + GetEnabled(): boolean; + /** + * Sets a value specifying whether the node is enabled. + * @param value true to make the node enabled; false to disable it. + */ + SetEnabled(value: boolean): void; + /** + * Returns the URL pointing to the image displayed within the node. + */ + GetImageUrl(): string; + /** + * Sets the URL which points to the image displayed within the node. + * @param value A string value specifying the URL to the image displayed within the node. + */ + SetImageUrl(value: string): void; + /** + * Gets an URL which defines the navigation location for the node's hyperlink. + */ + GetNavigateUrl(): string; + /** + * Specifies a URL which defines the node's navigate URL. + * @param value A string value which specifies a URL to where the client web browser will navigate when the node is clicked. + */ + SetNavigateUrl(value: string): void; + /** + * Gets the text, displayed within the node. + */ + GetText(): string; + /** + * Specifies the text, displayed within the node. + * @param value A string value that represents the text displayed within the node. + */ + SetText(value: string): void; + /** + * Returns a value specifying whether a node is displayed. + */ + GetVisible(): boolean; + /** + * Specifies whether the node is visible. + * @param value true if the node is visible; otherwise, false. + */ + SetVisible(value: boolean): void; + /** + * Gets the HTML object that contains the current node. + */ + GetHtmlElement(): Object; +} +/** + * A method that will handle the client events concerned with node processing. + */ +interface ASPxClientTreeViewNodeProcessingModeEventHandler { + /** + * A method that will handle the client events concerned with node processing. + * @param source An object representing the event source. Identifies the ASPxClientTreeView control that raised the event. + * @param e An ASPxClientTreeViewNodeProcessingModeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeViewNodeProcessingModeEventArgs): void; +} +/** + * Provides data for the client events concerned with node processing, and that allow the event's processing to be passed to the server side. + */ +interface ASPxClientTreeViewNodeProcessingModeEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets a node object related to the event. + * Value: An ASPxClientTreeViewNode object, manipulations on which forced the event to be raised. + */ + node: ASPxClientTreeViewNode; +} +/** + * A method that will handle the ASPxClientTreeView.ItemClick event. + */ +interface ASPxClientTreeViewNodeClickEventHandler { + /** + * A method that will handle the NodeClick event. + * @param source The ASPxClientTreeView control which fires the event. + * @param e An ASPxClientTreeViewNodeClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeViewNodeClickEventArgs): void; +} +/** + * Provides data for the NodeClick event. + */ +interface ASPxClientTreeViewNodeClickEventArgs extends ASPxClientTreeViewNodeProcessingModeEventArgs { + /** + * Gets the HTML object that contains the processed node. + * Value: An object representing a container for the node related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * A method that will handle the ASPxTreeView control's client events concerning manipulations with a node. + */ +interface ASPxClientTreeViewNodeEventHandler { + /** + * A method that will handle the ASPxTreeView control's client events, concerning manipulations with a node. + * @param source An object representing the event's source. Identifies the ASPxClientTreeView control object that raised the event. + * @param e An ASPxClientTreeViewNodeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeViewNodeEventArgs): void; +} +/** + * Provides data for the ExpandedChanged events. + */ +interface ASPxClientTreeViewNodeEventArgs extends ASPxClientEventArgs { + /** + * Gets a node object related to the event. + * Value: An ASPxClientTreeViewNode object, manipulations on which forced the event to be raised. + */ + node: ASPxClientTreeViewNode; +} +/** + * A method that will handle the ASPxTreeView's cancelable client events, concerning manipulations with nodes. + */ +interface ASPxClientTreeViewNodeCancelEventHandler { + /** + * A method that will handle the ASPxTreeView's cancelable client events, concerning manipulations with nodes. + * @param source An object representing the event's source. Identifies the ASPxClientTreeView object that raised the event. + * @param e An ASPxClientTreeViewNodeCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeViewNodeCancelEventArgs): void; +} +/** + * Provides data for the ExpandedChanging event. + */ +interface ASPxClientTreeViewNodeCancelEventArgs extends ASPxClientProcessingModeCancelEventArgs { + /** + * Gets a node object related to the event. + * Value: An ASPxClientTreeViewNode object, manipulations on which forced the event to be raised. + */ + node: ASPxClientTreeViewNode; +} +/** + * Represents a client-side equivalent of the ASPxUploadControl control. + */ +interface ASPxClientUploadControl extends ASPxClientControl { + /** + * Occurs on the client after a file has been uploaded. + */ + FileUploadComplete: ASPxClientEvent>; + /** + * Occurs on the client after upload of all selected files has been completed. + */ + FilesUploadComplete: ASPxClientEvent>; + /** + * Occurs on the client side before upload of the specified files starts. + */ + FileUploadStart: ASPxClientEvent>; + /** + * Occurs on the client side before file upload is started. + */ + FilesUploadStart: ASPxClientEvent>; + /** + * Fires on the client side when the text within the control's edit box is changed while the control has focus. + */ + TextChanged: ASPxClientEvent>; + /** + * Occurs on the client side when the progress bar indicator position is changed. + */ + UploadingProgressChanged: ASPxClientEvent>; + /** + * Occurs on the client side when the file input elements count is changed. + */ + FileInputCountChanged: ASPxClientEvent>; + /** + * Fires when the mouse enters a drop zone or an external drop zone element while dragging a file. + */ + DropZoneEnter: ASPxClientEvent>; + /** + * Fires when the mouse leaves a drop zone or an external drop zone element while dragging a file. + */ + DropZoneLeave: ASPxClientEvent>; + /** + * Initiates uploading of the specified file to the web server's memory. + */ + UploadFile(): void; + /** + * Adds a new file input element to the ASPxUploadControl. + */ + AddFileInput(): void; + /** + * Removes a file input element from the ASPxUploadControl. + * @param index An integer value that represents a file input element's index. + */ + RemoveFileInput(index: number): void; + /** + * Removes a file with the specified index from the selected file list. + * @param fileIndex An integer value that is the zero-based index of an item in the file list. + */ + RemoveFileFromSelection(fileIndex: number): void; + /** + * Gets the text displayed within the edit box of the specified file input element. + * @param index An integer value that specifies the required file input element's index. + */ + GetText(index: number): string; + /** + * Gets the number of file input elements contained within the ASPxUploadControl. + */ + GetFileInputCount(): number; + /** + * Specifies the count of the file input elements within the upload control. + * @param count An integer value that specifies the file input elements count. + */ + SetFileInputCount(count: number): void; + /** + * Specifies whether the upload control is enabled. + * @param enabled true, to enable the upload control; otherwise, false. + */ + SetEnabled(enabled: boolean): void; + /** + * Returns a value indicating whether the upload control is enabled. + */ + GetEnabled(): boolean; + /** + * Initiates uploading of the specified file(s) to the web server's memory. + */ + Upload(): void; + /** + * Cancels the initiated file uploading process. + */ + Cancel(): void; + /** + * Clears the file selection in the upload control. + */ + ClearText(): void; + /** + * Sets the text to be displayed within the add button. + * @param text A string value specifying the text to be displayed within the button. + */ + SetAddButtonText(text: string): void; + /** + * Sets the text to be displayed within the upload button. + * @param text A string value specifying the text to be displayed within the button. + */ + SetUploadButtonText(text: string): void; + /** + * Returns the text displayed within the add button. + */ + GetAddButtonText(): string; + /** + * Returns the text displayed within the upload button. + */ + GetUploadButtonText(): string; + /** + * Sets the ID of a web control or HTML element (or a list of IDs), a click on which invokes file upload dialog. + * @param ids A string value specifying the ID or a list of IDs separated by the semicolon (;). + */ + SetDialogTriggerID(ids: string): void; +} +/** + * A method that will handle the client FilesUploadStart event. + */ +interface ASPxClientUploadControlFilesUploadStartEventHandler { + /** + * A method that will handle the FilesUploadStart event. + * @param source The event source. Identifies the ASPxUploadControl control that raised the event. + * @param e A ASPxClientUploadControlFilesUploadStartEventArgs object that contains event data. + */ + (source: S, e: ASPxClientUploadControlFilesUploadStartEventArgs): void; +} +/** + * Provides data for the FilesUploadStart event. + */ +interface ASPxClientUploadControlFilesUploadStartEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that handles the FileUploadComplete client event. + */ +interface ASPxClientUploadControlFileUploadCompleteEventHandler { + /** + * A method that will handle the corresponding client event. + * @param source The event source. This parameter identifies the upload control which raised the event. + * @param e An ASPxClientUploadControlFileUploadCompleteEventArgs object that contains event data. + */ + (source: S, e: ASPxClientUploadControlFileUploadCompleteEventArgs): void; +} +/** + * Provides data for the FileUploadComplete event. + */ +interface ASPxClientUploadControlFileUploadCompleteEventArgs extends ASPxClientEventArgs { + /** + * Gets the index of a file input element within the ASPxUploadControl. + * Value: An integer value that specifies the file input element's index. + */ + inputIndex: number; + /** + * Gets or sets a value indicating whether the uploaded file passes validation. + * Value: true if the file is valid; otherwise, false. + */ + isValid: boolean; + /** + * Gets the error text to be displayed within the ASPxUploadControl's error frame. + * Value: A string value that represents the error text. + */ + errorText: string; + /** + * Gets a string that contains specific information (if any) passed from the server side for further client processing. + * Value: A string value representing callback data passed from the server. + */ + callbackData: string; +} +/** + * A method that will handle the FilesUploadComplete client event. + */ +interface ASPxClientUploadControlFilesUploadCompleteEventHandler { + /** + * A method that will handle the client FilesUploadComplete event. + * @param source The event source. This parameter identifies the upload control which raised the event. + * @param e A object that contains event data. + */ + (source: S, e: ASPxClientUploadControlFilesUploadCompleteEventArgs): void; +} +/** + * Provides data for the FilesUploadComplete client event, which enables you to perform specific actions after all selected files have been uploaded. + */ +interface ASPxClientUploadControlFilesUploadCompleteEventArgs extends ASPxClientEventArgs { + /** + * Gets the error text to be displayed within the upload control's error frame. + * Value: A string value that is the error text. + */ + errorText: string; + /** + * Gets a string that contains specific information (if any) passed from the server side for further client processing. + * Value: A string value that is the callback data passed from the server. + */ + callbackData: string; +} +/** + * A method that will handle the TextChanged client event. + */ +interface ASPxClientUploadControlTextChangedEventHandler { + /** + * A method that will handle the TextChanged client event. + * @param source The event source. This parameter identifies the upload control which raised the event. + * @param e An ASPxClientUploadControlTextChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientUploadControlTextChangedEventArgs): void; +} +/** + * Provides data for the TextChanged client event that allows you to respond to an end-user changing an edit box's text. + */ +interface ASPxClientUploadControlTextChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the index of a file input element within the ASPxUploadControl. + * Value: An integer value that specifies the file input element's index. + */ + inputIndex: number; +} +/** + * A method that will handle the ASPxUploadControl's client event, concerned with changes in upload progress. + */ +interface ASPxClientUploadControlUploadingProgressChangedEventHandler { + /** + * A method that will handle the ASPxUploadControl's client event concerning the uploading process being changed. + * @param source An object representing the event's source. Identifies the ASPxUploadControl object that raised the event. + * @param e An ASPxClientUploadControlUploadingProgressChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientUploadControlUploadingProgressChangedEventArgs): void; +} +/** + * Provides data for the UploadingProgressChanged event. + */ +interface ASPxClientUploadControlUploadingProgressChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the number of the files selected for upload. + * Value: An integer value that represents the total number of selected files. + */ + fileCount: number; + /** + * Gets the name of the file being currently uploaded. + * Value: A string value that represents the file name. + */ + currentFileName: string; + /** + * Gets the content length of the currently uploaded file. + * Value: An integer value specifying the content length. + */ + currentFileContentLength: number; + /** + * Gets the content length of the current file already uploaded to the server. + * Value: An integer value that is the content length. + */ + currentFileUploadedContentLength: number; + /** + * Gets the position of the current file upload progress. + * Value: An value specifying the upload progress position. + */ + currentFileProgress: number; + /** + * Gets the content length of the files selected for upload. + * Value: An integer value specifying the total content length of the selected files. + */ + totalContentLength: number; + /** + * Gets the content length of the files already uploaded to the server. + * Value: An integer value that represents the content length. + */ + uploadedContentLength: number; + /** + * Gets the current position of total upload progress. + * Value: An value specifying the total upload progress position. + */ + progress: number; +} +/** + * A method that will handle the DropZoneEnter event. + */ +interface ASPxClientUploadControlDropZoneEnterEventHandler { + /** + * A method that will handle the DropZoneEnter event. + * @param source The event source. This parameter identifies the upload control object which raised the event. + * @param e An ASPxClientUploadControlDropZoneEnterEventArgs object that contains event data. + */ + (source: S, e: ASPxClientUploadControlDropZoneEnterEventArgs): void; +} +/** + * Provides data for the DropZoneEnter event. + */ +interface ASPxClientUploadControlDropZoneEnterEventArgs extends ASPxClientEventArgs { + /** + * Gets a drop zone object related to the processed event. + * Value: An object that is a drop zone related to the processed event. + */ + dropZone: Object; +} +/** + * A method that will handle the DropZoneLeave event. + */ +interface ASPxClientUploadControlDropZoneLeaveEventHandler { + /** + * A method that will handle the DropZoneLeave event. + * @param source The event source. Identifies the upload control object that raised the event. + * @param e A ASPxClientUploadControlDropZoneLeaveEventArgs object that contains event data. + */ + (source: S, e: ASPxClientUploadControlDropZoneLeaveEventArgs): void; +} +/** + * Provides data for the DropZoneLeave event. + */ +interface ASPxClientUploadControlDropZoneLeaveEventArgs extends ASPxClientEventArgs { + /** + * Gets a drop zone object related to the processed event. + * Value: An object that is a drop zone related to the processed event. + */ + dropZone: Object; +} +/** + * The JavaScript equivalent of the ASPxChartDesigner class. + */ +interface ASPxClientChartDesigner extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientChartDesigner. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs when executing the Save command on the client. + */ + SaveCommandExecute: ASPxClientEvent>; + /** + * Enables you to customize the menu actions of a Client Chart Designer. + */ + CustomizeMenuActions: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + */ + PerformCallback(arg: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; + /** + * Updates the localization settings of the ASPxClientChartDesigner properties. + * @param localization A dictionary containing the property names, along with their localized equivalents. + */ + UpdateLocalization(localization: { [key: string]: string; }): void; + /** + * Returns the model of the Client Chart Designer. + */ + GetDesignerModel(): Object; + /** + * For internal use. + */ + GetJsonChartModel(): string; +} +/** + * A method that will handle the SaveCommandExecute event. + */ +interface ASPxClientChartDesignerSaveCommandExecuteEventHandler { + /** + * Represents a method that will handle the SaveCommandExecute event. + * @param source The event source. This parameter identifies the ASPxChartDesigner which raised the event. + * @param e A ASPxClientChartDesignerSaveCommandExecuteEventArgs object which contains event data. + */ + (source: S, e: ASPxClientChartDesignerSaveCommandExecuteEventArgs): void; +} +/** + * Provides data for a chart control's SaveCommandExecute event. + */ +interface ASPxClientChartDesignerSaveCommandExecuteEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets a value specifying whether an event has been handled. + * Value: true, if the event hasn't been handled by a control; otherwise, false. + */ + handled: boolean; +} +/** + * Represents a method that will handle the CustomizeMenuActions events. + */ +interface ASPxClientChartDesignerCustomizeMenuActionsEventHandler { + /** + * Represents a method that will handle the CustomizeMenuActions event. + * @param source The event source. This parameter identifies the ASPxChartDesigner which raised the event. + * @param e An ASPxClientChartDesignerCustomizeMenuActionsEventArgs object which contains event data. + */ + (source: S, e: ASPxClientChartDesignerCustomizeMenuActionsEventArgs): void; +} +/** + * An action of the Client Chart Designer's menu. + */ +interface ASPxClientChartDesignerMenuAction { + /** + * Provides access to the text for the command. + * Value: A String value. + */ + text: string; + /** + * Provides access to the CSS class of the command's glyph. + * Value: A String value. + */ + imageClassName: string; + /** + * Provides access to the action performed when the Client Chart Designer's button is clicked. + * Value: The specific action implementation. + */ + clickAction: Function; + /** + * Provides access to the value that specifies whether or not the command is disabled by default. + * Value: true, if the command is disabled by default; otherwise, false. + */ + disabled: boolean; + /** + * Provides access to the value that specifies whether or not the command is visible in the designer user interface. + * Value: true if the command is visible; otherwise false. + */ + visible: boolean; + /** + * Provides access to the keyboard shortcut used to invoke the command. + * Value: A String value. + */ + hotKey: string; + /** + * Provides access to the value that specifies whether or not the command has a visual separator. + * Value: true, if the command has a visual separator; otherwise, false. + */ + hasSeparator: string; + /** + * Provides access to the location of the displayed command. + * Value: A String value. + */ + container: string; +} +/** + * Provides data for a chart control's CustomizeMenuActions event on the client side. + */ +interface ASPxClientChartDesignerCustomizeMenuActionsEventArgs extends ASPxClientEventArgs { + /** + * Returns an array of the Client Chart Designer's menu actions. + * Value: An array of the ASPxClientChartDesignerMenuAction objects. + */ + actions: ASPxClientChartDesignerMenuAction[]; +} +/** + * A class which provides access to the entire hierarchy of chart elements on the client side. + */ +interface ASPxClientWebChartControl extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientWebChartControl. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client side when any chart element is hot-tracked. + */ + ObjectHotTracked: ASPxClientEvent>; + /** + * Occurs before crosshair items are drawn when the chart's contents are being drawn. + */ + CustomDrawCrosshair: ASPxClientEvent>; + /** + * Occurs on the client side when any chart element is selected. + */ + ObjectSelected: ASPxClientEvent>; + /** + * Returns an ASPxClientWebChart object, which contains information about the hierarchy of a chart control, and provides access to the main properties of chart elements on the client side. + */ + GetChart(): ASPxClientWebChart; + /** + * Returns the printing options of the chart control. + */ + GetPrintOptions(): ASPxClientChartPrintOptions; + /** + * Changes the mouse pointer, which is shown when the mouse is over the chart control, to the pointer with the specified name. + * @param cursor A string value representing the name of the desired cursor. + */ + SetCursor(cursor: string): void; + /** + * Returns the specific chart element which is located under the test point. + * @param x An integer value that specifies the x coordinate of the test point. + * @param y An integer value that specifies the y coordinate of the test point. + */ + HitTest(x: number, y: number): ASPxClientHitObject[]; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; + /** + * Prints the current chart on the client side. + */ + Print(): void; + /** + * Loads a chart which should be customized from its object model. + * @param serializedChartObjectModel A String object representing the chart model. + */ + LoadFromObjectModel(serializedChartObjectModel: string): void; + /** + * Exports a chart to the file of the specified format, and saves it to the disk. + * @param format A string value specifying the format, to which a chart should be exported. + */ + SaveToDisk(format: string): void; + /** + * Exports a chart to a file in the specified format, and saves it to disk, using the specified file name. + * @param format A string value specifying the format, to which a chart should be exported. + * @param filename A string value specifying the file name, to which a chart should be exported. If this parameter is missing or set to an empty string, then the created file will be named using the client-side name of a chart. + */ + SaveToDisk(format: string, filename: string): void; + /** + * Exports a report to the file of the specified format, and shows it in a new Web Browser window. + * @param format A string value specifying a format in which a report should be exported. + */ + SaveToWindow(format: string): void; + /** + * Gets the main DOM (Document Object Model) element on a Web Page representing this ASPxClientWebChartControl object. + */ + GetMainDOMElement(): Object; +} +/** + * A method that will handle the CustomDrawCrosshair event. + */ +interface ASPxClientWebChartControlCustomDrawCrosshairEventHandler { + /** + * A method that will handle the CustomDrawCrosshair event. + * @param source The event source. This parameter identifies the chartControl which raised the event. + * @param e An ASPxClientWebChartControlCustomDrawCrosshairEventArgs object which contains event data. + */ + (source: S, e: ASPxClientWebChartControlCustomDrawCrosshairEventArgs): void; +} +/** + * Provides data for a chart control's CustomDrawCrosshair event. + */ +interface ASPxClientWebChartControlCustomDrawCrosshairEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets crosshair elements settings to custom draw a crosshair cursor. + * Value: An ASPxClientCrosshairElement object. + */ + crosshairElements: ASPxClientCrosshairElement; + /** + * Gets the settings of crosshair axis label elements to customize their appearance. + * Value: An ASPxClientCrosshairAxisLabelElement object. + */ + cursorCrosshairAxisLabelElements: ASPxClientCrosshairAxisLabelElement; + /** + * Gets crosshair line element settings that are used to custom draw a crosshair cursor. + * Value: An ASPxClientCrosshairLineElement object that contains crosshair line element settings. + */ + cursorCrosshairLineElement: ASPxClientCrosshairLineElement; + /** + * Gets the settings of crosshair group header elements to customize their appearance. + * Value: An ASPxClientCrosshairGroupHeaderElement object. + */ + crosshairGroupHeaderElements: ASPxClientCrosshairGroupHeaderElement; + /** + * Provides access to the settings of crosshair elements and crosshair group header elements to customize their appearance. + * Value: An ASPxClientCrosshairElementGroup object. + */ + crosshairElementGroups: ASPxClientCrosshairElementGroup; +} +/** + * Represents the client-side equivalent of the CrosshairElement class. + */ +interface ASPxClientCrosshairElement { + /** + * Gets a series that a crosshair element hovers over when implementing a custom draw. + * Value: An ASPxClientSeries object which represents the series currently being painted. + */ + Series: ASPxClientSeries; + /** + * Gets the series point that a crosshair element hovers over when implementing a custom draw. + * Value: An ASPxClientSeriesPoint object, representing the series point that a crosshair element hovers over. + */ + Point: ASPxClientSeriesPoint; + /** + * Gets or sets the crosshair line element to custom draw a crosshair cursor. + * Value: An ASPxClientCrosshairLineElement object, representing the crosshair line element. + */ + LineElement: ASPxClientCrosshairLineElement; + /** + * Provides access to the crosshair axis label element. + * Value: An ASPxClientCrosshairAxisLabelElement object, representing the crosshair axis label element. + */ + AxisLabelElement: ASPxClientCrosshairAxisLabelElement; + /** + * Gets the crosshair label element. + * Value: An ASPxClientCrosshairSeriesLabelElement object, representing the crosshair label element. + */ + LabelElement: ASPxClientCrosshairSeriesLabelElement; + /** + * Specifies whether the crosshair element is visible when implementing custom drawing in the crosshair cursor. + * Value: true, if the crosshair element is visible; otherwise, false. + */ + visible: boolean; +} +/** + * Represents the client-side equivalent of the CrosshairLineElement class. + */ +interface ASPxClientCrosshairLineElement { +} +/** + * Represents the client-side equivalent of the CrosshairAxisLabelElement class. + */ +interface ASPxClientCrosshairAxisLabelElement { +} +/** + * The client-side equivalent of the CrosshairGroupHeaderElement class. + */ +interface ASPxClientCrosshairGroupHeaderElement { +} +/** + * The client-side equivalent of the CrosshairLabelElement class. + */ +interface ASPxClientCrosshairSeriesLabelElement { +} +/** + * Represents the client-side equivalent of the CrosshairElementGroup class. + */ +interface ASPxClientCrosshairElementGroup { +} +/** + * Represents a method that will handle the ObjectSelected events. + */ +interface ASPxClientWebChartControlHotTrackEventHandler { + /** + * Represents a method that will handle the ObjectSelected events. + * @param source The event source. This parameter identifies the ASPxClientWebChartControl which raised the event. + * @param e An ASPxClientWebChartControlHotTrackEventArgs object which contains event data. + */ + (source: S, e: ASPxClientWebChartControlHotTrackEventArgs): void; +} +/** + * Provides data for a chart control's ObjectSelected events on the client side. + */ +interface ASPxClientWebChartControlHotTrackEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Provides access on the client side to the chart element, for which the event was raised. + * Value: An ASPxClientWebChartElement object, which represents the chart element for which the event was raised. + */ + hitObject: ASPxClientWebChartElement; + /** + * Provides access on the client side to the object, which is in some way related to the object being hit. The returned value depends on the hitObject type and hit point location. + * Value: An ASPxClientWebChartElement object representing an additional object that relates to the one being hit. + */ + additionalHitObject: ASPxClientWebChartElement; + /** + * Gets details on the chart elements located at the point where an end-user has clicked when hot-tracking or selecting a chart element on the client side. + * Value: An ASPxClientWebChartHitInfo object, which contains information about the chart elements located at the point where an end-user has clicked. + */ + hitInfo: ASPxClientWebChartHitInfo; + /** + * Provides access on the client side to the chart and all its elements. + * Value: An ASPxClientWebChart object, which provides access to chart properties. + */ + chart: ASPxClientWebChart; + /** + * Gets the HTML object that contains the processed item. + * Value: An object representing a container for the item related to the event. + */ + htmlElement: Object; + /** + * Gets the X-coordinate of the hit test point, relative to the top left corner of the chart. + * Value: An integer value specifying X-coordinate of the hit test point (in pixels). + */ + x: number; + /** + * Gets the Y-coordinate of the hit test point, relative to the top left corner of the chart. + * Value: An integer value specifying Y-coordinate of the hit test point (in pixels). + */ + y: number; + /** + * Gets the X-coordinate of the hit test point, relative to the top left corner of the Web Page containing this chart. + * Value: An integer value specifying X-coordinate of the hit test point (in pixels). + */ + absoluteX: number; + /** + * Gets the Y-coordinate of the hit test point, relative to the top left corner of the Web Page containing this chart. + * Value: An integer value specifying Y-coordinate of the hit test point (in pixels). + */ + absoluteY: number; + /** + * Gets a value indicating whether the hot-tracking or object selection should be canceled. + * Value: true to cancel the hot-tracking or selection of an object; otherwise, false. + */ + cancel: boolean; +} +/** + * Represents an object under the hit test point within a chart control, on the client side. + */ +interface ASPxClientHitObject { + /** + * Gets the chart element for which the event was raised. + * Value: An ASPxClientWebChartElement object, representing the chart element for which the event was raised. + */ + Object: ASPxClientWebChartElement; + /** + * Provides access to an object, which is in some way related to the object being hit. The returned value depends on the Object type and hit point location. + * Value: An ASPxClientWebChartElement object that represents an additional object related to the one being hit. + */ + AdditionalObject: ASPxClientWebChartElement; +} +/** + * Contains information about a specific test point within a chart control, on the client side. + */ +interface ASPxClientWebChartHitInfo { + /** + * Gets a value indicating whether the test point is within the chart. + * Value: true if the test point is within a chart; otherwise, false. + */ + inChart: boolean; + /** + * Gets a value indicating whether the test point is within the chart title. + * Value: true if the test point is within a chart title; otherwise, false. + */ + inChartTitle: boolean; + /** + * 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; + /** + * Gets a value indicating whether the test point is within the axis label item. + * Value: true if the test point is within an axis label item; otherwise, false. + */ + inAxisLabelItem: boolean; + /** + * Gets a value indicating whether the test point is within the axis title. + * Value: true if the test point is within an axis title; otherwise, false. + */ + inAxisTitle: boolean; + /** + * Gets a value indicating whether the test point is within the constant line. + * Value: true if the test point is within a constant line; otherwise, false. + */ + inConstantLine: boolean; + /** + * Gets a value indicating whether the test point is within the diagram. + * Value: true if the test point is within a diagram; otherwise, false. + */ + inDiagram: boolean; + /** + * Gets a value indicating whether the test point is within the non-default pane. + * Value: true if the test point is within a non-default pane; otherwise, false. + */ + inNonDefaultPane: boolean; + /** + * Gets a value indicating whether the test point is within the legend. + * Value: true if the test point is within a legend; otherwise, false. + */ + inLegend: boolean; + /** + * Gets the value indicating whether or not the test point is within a custom legend item. + * Value: true if the test point is within a custom legend item; otherwise, false. + */ + inCustomLegendItem: boolean; + /** + * Gets a value indicating whether the test point is within the series. + * Value: true if the test point is within a series; otherwise, false. + */ + inSeries: boolean; + /** + * Gets a value indicating whether the test point is within the series label. + * Value: true if the test point is within a series label; otherwise, false. + */ + inSeriesLabel: boolean; + /** + * Gets a value indicating whether the test point is within the series point. + * Value: true if the test point is within a series point; otherwise, false. + */ + inSeriesPoint: boolean; + /** + * Gets a value indicating whether the test point is within the series title. + * Value: true if the test point is within a series title; otherwise, false. + */ + inSeriesTitle: boolean; + /** + * Gets a value indicating whether the test point is within the trendline. + * Value: true if the test point is within a trendline; otherwise, false. + */ + inTrendLine: boolean; + /** + * Gets a value indicating whether the test point is within the Fibonacci Indicator. + * Value: true if the test point is within a Fibonacci Indicator; otherwise, false. + */ + inFibonacciIndicator: boolean; + /** + * Gets a value indicating whether the test point is within the regression line. + * Value: true if the test point is within a regression line; otherwise, false. + */ + inRegressionLine: boolean; + /** + * Gets a value specifying whether the test point is within an indicator. + * Value: true if the test point is within an indicator; otherwise, false. + */ + inIndicator: boolean; + /** + * Gets a value indicating whether the test point is within an annotation. + * Value: true if the test point is within an annotation; otherwise, false. + */ + inAnnotation: boolean; + /** + * Gets a value indicating whether the test point is within a hyperlink. + * Value: true, if the test point is within a hyperlink; otherwise, false. + */ + inHyperlink: boolean; + /** + * Gets the client-side chart instance from under the test point. + * Value: An ASPxClientWebChart object. + */ + chart: ASPxClientWebChart; + /** + * Gets the client-side chart title instance from under the test point. + * Value: An ASPxClientChartTitle object. + */ + chartTitle: ASPxClientChartTitle; + /** + * Gets the client-side axis instance from under the test point. + * Value: An ASPxClientAxisBase descendant. + */ + axis: ASPxClientAxisBase; + /** + * Gets the client-side constant line instance from under the test point. + * Value: An ASPxClientConstantLine object. + */ + constantLine: ASPxClientConstantLine; + /** + * Gets the client-side diagram instance from under the test point. + * Value: An ASPxClientXYDiagramBase descendant. + */ + diagram: ASPxClientXYDiagramBase; + /** + * Gets the client-side non-default pane instance from under the test point. + * Value: An ASPxClientXYDiagramPane object. + */ + nonDefaultPane: ASPxClientXYDiagramPane; + /** + * Gets the client-side legend instance from under the test point. + * Value: An ASPxClientLegend object. + */ + legend: ASPxClientLegend; + /** + * Gets a custom legend item which is located under the test point. + * Value: An ASPxClientCustomLegendItem object which represents the item located under the test point. + */ + customLegendItem: ASPxClientCustomLegendItem; + /** + * Gets the client-side series instance from under the test point. + * Value: An ASPxClientSeries object. + */ + series: ASPxClientSeries; + /** + * Gets the client-side series label instance from under the test point. + * Value: An ASPxClientSeriesLabel object. + */ + seriesLabel: ASPxClientSeriesLabel; + /** + * Gets the client-side series title instance from under the test point. + * Value: An ASPxClientSeriesTitle object. + */ + seriesTitle: ASPxClientSeriesTitle; + /** + * Gets the client-side trendline instance from under the test point. + * Value: An ASPxClientTrendLine object. + */ + trendLine: ASPxClientTrendLine; + /** + * Gets the client-side Fibonacci indicator instance from under the test point. + * Value: An ASPxClientFibonacciIndicator object. + */ + fibonacciIndicator: ASPxClientFibonacciIndicator; + /** + * Gets the client-side regression line instance from under the test point. + * Value: An ASPxClientRegressionLine object. + */ + regressionLine: ASPxClientRegressionLine; + /** + * Gets the client-side indicator instance from under the test point. + * Value: An ASPxClientIndicator descendant. + */ + indicator: ASPxClientIndicator; + /** + * Gets the client-side annotation instance from under the test point. + * Value: An ASPxClientAnnotation object. + */ + annotation: ASPxClientAnnotation; + /** + * Gets the client-side series point instance from under the test point. + * Value: An ASPxClientSeriesPoint object. + */ + seriesPoint: ASPxClientSeriesPoint; + /** + * Gets the client-side axis label item instance from under the test point. + * Value: An ASPxClientAxisLabelItem object. + */ + axisLabelItem: ASPxClientAxisLabelItem; + /** + * Gets the client-side axis title instance from under the test point. + * Value: An ASPxClientAxisTitle object. + */ + axisTitle: ASPxClientAxisTitle; + /** + * Returns a hyperlink which is located under the test point. + * Value: A String object representing a hyperlink. + */ + hyperlink: string; +} +/** + * Represents the client-side equivalent of the DiagramCoordinates class. + */ +interface ASPxClientDiagramCoordinates { + /** + * Gets the type of the argument scale. + * Value: A string object which contains the current scale type. + */ + argumentScaleType: string; + /** + * Gets the type of the value scale. + * Value: A string object which contains the current scale type. + */ + valueScaleType: string; + /** + * Gets the argument of the data point as a text string. + * Value: A string object, representing a data point's argument. + */ + qualitativeArgument: string; + /** + * Gets the numerical representation of the data point's argument. + * Value: A Double value, representing the data point's argument. + */ + numericalArgument: number; + /** + * Gets the date-time representation of the data point's argument. + * Value: A date object, representing the point's argument. + */ + dateTimeArgument: Date; + /** + * Gets the numerical representation of the data point's value. + * Value: A Double value, representing the data point's value. + */ + numericalValue: number; + /** + * Gets the date-time representation of the data point's value. + * Value: A date object, representing the point's value. + */ + dateTimeValue: Date; + /** + * Gets the X-axis of the diagram point. + * Value: An ASPxClientAxisBase descendant, representing the axis of arguments (X-axis). + */ + axisX: ASPxClientAxisBase; + /** + * Gets the Y-axis of the diagram point. + * Value: An ASPxClientAxisBase descendant, representing the axis of values (Y-axis). + */ + axisY: ASPxClientAxisBase; + /** + * Gets the pane of the diagram point. + * Value: An ASPxClientXYDiagramPane descendant, representing the pane. + */ + pane: ASPxClientXYDiagramPane; + /** + * Checks whether the current object represents a point outside the diagram area. + */ + IsEmpty(): boolean; + /** + * Gets the value of the client-side axis instance. + * @param axis An ASPxClientAxisBase class descendant, representing the axis that contains the requested value. + */ + GetAxisValue(axis: ASPxClientAxisBase): ASPxClientAxisValue; +} +/** + * Contains the information about an axis value. + */ +interface ASPxClientAxisValue { + /** + * Gets the axis scale type. + * Value: A String value, specifying the axis scale type. + */ + scaleType: string; + /** + * Gets the axis value, if the axis scale type is qualitative. + * Value: A String value, specifying the axis value. + */ + qualitativeValue: string; + /** + * Gets the axis value, if the axis scale type is numerical. + * Value: A Double value, specifying the axis value. + */ + numericalValue: number; + /** + * Gets the axis value, if the axis scale type is date-time. + * Value: A DateTime value, specifying the axis value. + */ + dateTimeValue: Date; +} +/** + * Represents the client-side equivalent of the ControlCoordinates class. + */ +interface ASPxClientControlCoordinates { + /** + * Gets the point's pane. + * Value: An ASPxClientXYDiagramPane object. + */ + pane: ASPxClientXYDiagramPane; + /** + * Gets the point's X-coordinate, in pixels. + * Value: An integer value, specifying the X-coordinate (in pixels). + */ + x: number; + /** + * Gets the point's Y-coordinate, in pixels. + * Value: An integer value, specifying the Y-coordinate (in pixels). + */ + y: number; + /** + * Gets the point's visibility state. + * Value: "Visible", "Hidden", or "Undefined". + */ + visibility: string; +} +/** + * Represents the client-side equivalent of the ChartElement class. + */ +interface ASPxClientWebChartElement { + /** + * Gets the chart that owns the current chart element. + * Value: An ASPxClientWebChart object, to which the chart element belongs. + */ + chart: ASPxClientWebChart; +} +/** + * Represents a base class for chart elements, which are not necessarily required to be present on the client side. + */ +interface ASPxClientWebChartEmptyElement extends ASPxClientWebChartElement { +} +/** + * Represents a base class for chart elements, which are required to be present on the client side. + */ +interface ASPxClientWebChartRequiredElement extends ASPxClientWebChartElement { +} +/** + * Represents the client-side equivalent of the ChartElementNamed class. + */ +interface ASPxClientWebChartElementNamed extends ASPxClientWebChartRequiredElement { + /** + * Gets the name of the chart element. + * Value: A string object representing the name of the chart element. + */ + name: string; +} +/** + * Represents the client-side equivalent of the WebChartControl control. + */ +interface ASPxClientWebChart extends ASPxClientWebChartRequiredElement { + /** + * Gets the client-side Chart Control that owns the current chart. + * Value: An ASPxClientWebChartControl object, to which the chart belongs. + */ + chartControl: ASPxClientWebChartControl; + /** + * Gets the chart's diagram and provides access to its settings. + * Value: An ASPxClientRadarDiagram), that represents the chart's diagram. + */ + diagram: ASPxClientWebChartElement; + /** + * Provides access to the chart's collection of series. + * Value: An array of ASPxClientSeries objects that represent the collection of series. + */ + series: ASPxClientSeries[]; + /** + * Provides access to the collection of chart titles. + * Value: An array of ASPxClientChartTitle objects, that represent the collection of chart titles. + */ + titles: ASPxClientChartTitle[]; + /** + * Provides access to the chart's collection of annotations. + * Value: An array of ASPxClientAnnotation objects, representing the collection of annotations. + */ + annotations: ASPxClientAnnotation[]; + /** + * Gets the chart's legend and provides access to its settings. + * Value: An ASPxClientLegend object that represents the chart's legend. + */ + legend: ASPxClientLegend; + /** + * Returns the collection of legends. + * Value: An array of ASPxClientLegend objects. + */ + legends: ASPxClientLegend[]; + /** + * Gets the name of the appearance, which is currently used to draw the chart's elements. + * Value: A string value that represents the appearance name. + */ + appearanceName: string; + /** + * Gets the name of the palette currently used to draw the chart's series. + * Value: A string value that represents the palette name. + */ + paletteName: string; + /** + * Gets a value indicating whether series tooltips should be shown. + * Value: true to show tooltips for series; otherwise, false. + */ + showSeriesToolTip: boolean; + /** + * Gets a value indicating whether point tooltips should be shown. + * Value: true to show tooltips for series points; otherwise, false. + */ + showPointToolTip: boolean; + /** + * Gets a value indicating whether a crosshair cursor should be shown. + * Value: true to show a crosshair cursor; otherwise, false. + */ + showCrosshair: boolean; + /** + * Gets a value that contains information on how the tooltip position is defined, for example, relative to a mouse pointer or chart element. + * Value: An ASPxClientToolTipPosition class descendant that defines the tooltip position type. + */ + toolTipPosition: ASPxClientToolTipPosition; + /** + * Returns the tooltip controller that shows tooltips for chart elements. + * Value: An ASPxClientToolTipController object. + */ + toolTipController: ASPxClientToolTipController; + /** + * Gets the settings for a crosshair cursor concerning its position and appearance on a diagram. + * Value: An ASPxClientCrosshairOptions object descendant which provides access to crosshair cursor options on a diagram. + */ + crosshairOptions: ASPxClientCrosshairOptions; + /** + * Gets a css postfix for a chart. + * Value: A string value. + */ + cssPostfix: string; + /** + * Gets or sets a value which specifies how the chart elements are selected. + * Value: A String object representing the name of the selection mode. + */ + selectionMode: string; +} +/** + * Represents the client-side equivalent of the SimpleDiagram class. + */ +interface ASPxClientSimpleDiagram extends ASPxClientWebChartEmptyElement { +} +/** + * Represents the base class for all diagram classes, which have X and Y axes. + */ +interface ASPxClientXYDiagramBase extends ASPxClientWebChartRequiredElement { + /** + * Gets the X-axis. + * Value: An ASPxClientAxisBase object which represents the X-axis. + */ + axisX: ASPxClientAxisBase; + /** + * Gets the Y-axis. + * Value: An ASPxClientAxisBase object which represents the Y-axis. + */ + axisY: ASPxClientAxisBase; +} +/** + * Represents the client-side equivalent of the XYDiagram2D class. + */ +interface ASPxClientXYDiagram2D extends ASPxClientXYDiagramBase { + /** + * Provides access to a collection of secondary X-axes for a given 2D XY-diagram. + * Value: An array of ASPxClientAxis objects, that is a collection of secondary X-axes. + */ + secondaryAxesX: ASPxClientAxis[]; + /** + * Provides access to a collection of secondary Y-axes for a given 2D XY-diagram. + * Value: An array of ASPxClientAxis objects, that is a collection of secondary X-axes. + */ + secondaryAxesY: ASPxClientAxis[]; + /** + * 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 panes. + * Value: An array of ASPxClientXYDiagramPane objects. + */ + panes: ASPxClientXYDiagramPane[]; + /** + * Converts the display coordinates into a diagram coordinates object. + * @param x An integer value, representing the X-coordinate of a point (measured in pixels relative to the top left corner of a chart). + * @param y An integer value, representing the Y-coordinate of a point (measured in pixels relative to the top left corner of a chart). + */ + PointToDiagram(x: number, y: number): ASPxClientDiagramCoordinates; + /** + * Converts the diagram coordinates of a point into screen coordinates. + * @param argument An object, representing the point's argument. + * @param value An object, representing the point's value. + * @param axisX An ASPxClientAxis2D descendant, representing the X-axis. + * @param axisY An ASPxClientAxis2D descendant, representing the Y-axis. + * @param pane An ASPxClientXYDiagramPane object, representing the pane. + */ + DiagramToPoint(argument: Object, value: Object, axisX: ASPxClientAxis2D, axisY: ASPxClientAxis2D, pane: ASPxClientXYDiagramPane): ASPxClientControlCoordinates; +} +/** + * Represents the client-side equivalent of the XYDiagram class. + */ +interface ASPxClientXYDiagram extends ASPxClientXYDiagram2D { + /** + * Gets a value indicating whether the diagram is rotated. + * Value: true if the diagram is rotated; otherwise, false. + */ + rotated: boolean; +} +/** + * Represents the client-side equivalent of the SwiftPlotDiagram class. + */ +interface ASPxClientSwiftPlotDiagram extends ASPxClientXYDiagram2D { +} +/** + * Represents the client-side equivalent of the XYDiagramPane class. + */ +interface ASPxClientXYDiagramPane extends ASPxClientWebChartElementNamed { + /** + * Gets the diagram that owns the current pane object. + * Value: An ASPxClientXYDiagram object, to which the pane belongs. + */ + diagram: ASPxClientXYDiagram; +} +/** + * Represents the client-side equivalent of the XYDiagram3D class. + */ +interface ASPxClientXYDiagram3D extends ASPxClientXYDiagramBase { +} +/** + * Represents the client-side equivalent of the RadarDiagram class. + */ +interface ASPxClientRadarDiagram extends ASPxClientXYDiagramBase { + /** + * Converts the display coordinates into a diagram coordinates object. + * @param x An integer value, representing the X-coordinate of a point (measured in pixels relative to the top left corner of a chart). + * @param y An integer value, representing the Y-coordinate of a point (measured in pixels relative to the top left corner of a chart). + */ + PointToDiagram(x: number, y: number): ASPxClientDiagramCoordinates; + /** + * Converts the diagram coordinates of a point into screen coordinates. + * @param argument An object, representing the point's argument. + * @param value An object, representing the point's value. + */ + DiagramToPoint(argument: Object, value: Object): ASPxClientControlCoordinates; +} +/** + * Represents the client-side equivalent of the AxisBase class. + */ +interface ASPxClientAxisBase extends ASPxClientWebChartElementNamed { + /** + * Provides access to the XY-diagram which contains the current axis. + * Value: An ASPxClientXYDiagramBase class descendant. + */ + diagram: ASPxClientXYDiagramBase; + /** + * Provides acess to the range of the axis coordinates. + * Value: An ASPxClientAxisRange object, which contains the common range settings of the axis coordinates. + */ + range: ASPxClientAxisRange; +} +/** + * Represents the client-side equivalent of the Axis2D class. + */ +interface ASPxClientAxis2D extends ASPxClientAxisBase { + /** + * Provides access to an axis title object. + * Value: An ASPxClientAxisTitle object which represents the axis title. + */ + axisTitle: ASPxClientAxisTitle; + /** + * Provides access to the axis strips collection. + * Value: An array of ASPxClientStrip objects. + */ + strips: ASPxClientStrip[]; + /** + * Provides access to the collection of the axis constant lines. + * Value: An array of ASPxClientConstantLine objects which represent constant lines that belong to this axis. + */ + constantLines: ASPxClientConstantLine[]; +} +/** + * Represents the client-side equivalent of the Axis class. + */ +interface ASPxClientAxis extends ASPxClientAxis2D { + /** + * Gets a value indicating whether the axis is reversed. + * Value: true if the axis is reversed; otherwise, false. + */ + reverse: boolean; +} +/** + * Represents the client-side equivalent of the SwiftPlotDiagramAxis class. + */ +interface ASPxClientSwiftPlotDiagramAxis extends ASPxClientAxis2D { +} +/** + * Represents the client-side equivalent of the Axis3D class. + */ +interface ASPxClientAxis3D extends ASPxClientAxisBase { +} +/** + * Represents the client-side equivalent of the RadarAxis class. + */ +interface ASPxClientRadarAxis extends ASPxClientAxisBase { +} +/** + * Represents the client-side equivalent of the AxisTitle class. + */ +interface ASPxClientAxisTitle extends ASPxClientWebChartRequiredElement { + /** + * Gets the axis to which the axis title belongs. + * Value: An ASPxClientAxisBase descendant, which identifies the axis. + */ + axis: ASPxClientAxisBase; + /** + * Gets the text of the axis title. + * Value: A string object which contains the axis title's text. + */ + text: string; +} +/** + * Represents the client-side equivalent of the AxisLabelItem class. + */ +interface ASPxClientAxisLabelItem extends ASPxClientWebChartRequiredElement { + /** + * Gets the axis to which an axis label item belongs. + * Value: An ASPxClientAxisBase descendant, which identifies the axis. + */ + axis: ASPxClientAxisBase; + /** + * Gets the text of an axis label item. + * Value: A string object which contains the axis label item's text. + */ + text: string; + /** + * Gets the axis value to which an axis label item corresponds. + * Value: An object that specifies the axis value. + */ + axisValue: Object; + /** + * Gets the internal representation of the axis value to which an axis label item corresponds. + * Value: A Double value which specifies the internal representation of the axis value. + */ + axisValueInternal: number; +} +/** + * Represents the client-side equivalent of the AxisRange class. + */ +interface ASPxClientAxisRange extends ASPxClientWebChartRequiredElement { + /** + * Gets the axis that owns the current axis range object. + * Value: An ASPxClientAxisBase object, to which the axis range belongs. + */ + axis: ASPxClientAxisBase; + /** + * Gets the minimum value to display on an axis. + * Value: An object representing the minimum value of the axis range. + */ + minValue: Object; + /** + * Gets the maximum value to display on an axis. + * Value: An object representing the maximum value of the axis range. + */ + maxValue: Object; + /** + * Gets the internal float representation of the range minimum value. + * Value: A Double value which specifies the internal representation of the range minimum value. + */ + minValueInternal: number; + /** + * Gets the internal float representation of the range maximum value. + * Value: A Double value which specifies the internal representation of the range maximum value. + */ + maxValueInternal: number; +} +/** + * Represents the client-side equivalent of the Strip class. + */ +interface ASPxClientStrip extends ASPxClientWebChartElementNamed { + /** + * Gets the axis that owns the current strip object. + * Value: An ASPxClientAxis object, to which the strip belongs. + */ + axis: ASPxClientAxis; + /** + * Gets the minimum value of the strip's range. + * Value: An object that represents the minimum value of the strip's range. + */ + minValue: Object; + /** + * Gets the maximum value of the strip's range. + * Value: An object that represents the maximum value of the strip's range. + */ + maxValue: Object; +} +/** + * Represents the client-side equivalent of the ConstantLine class. + */ +interface ASPxClientConstantLine extends ASPxClientWebChartElementNamed { + /** + * Gets the axis that owns the current constant line object. + * Value: An ASPxClientAxis object, to which the constant line belongs. + */ + axis: ASPxClientAxis; + /** + * Gets the constant line's position along the axis. + * Value: An object that specifies the constant line's position. + */ + value: Object; + /** + * Gets the constant line title. + * Value: A string object, representing the title's text. + */ + title: string; +} +/** + * Represents the client-side equivalent of the Series class. + */ +interface ASPxClientSeries extends ASPxClientWebChartElementNamed { + /** + * Gets a value that specifies the view type of the series. + * Value: A string object which contains the current view type. + */ + viewType: string; + /** + * Gets a value that specifies the scale type for the argument data of the series' data points. + * Value: A string object which contains the current scale type. + */ + argumentScaleType: string; + /** + * Gets a value that specifies the scale type for the value data of the series' data points. + * Value: A string object which contains the current scale type. + */ + valueScaleType: string; + /** + * Gets the X-Axis that is used to plot the current series on the XY-diagram. + * Value: A string object, which represents the X-axis name. + */ + axisX: string; + /** + * Gets the Y-Axis that is used to plot the current series on the XY-diagram. + * Value: A string object, which represents the Y-axis name. + */ + axisY: string; + /** + * Gets the pane that is used to plot the current series on the XY-diagram. + * Value: A string object, which represents the pane's name. + */ + pane: string; + /** + * Gets a value indicating whether the series is visible. + * Value: true if the series is visible; otherwise, false. + */ + visible: boolean; + /** + * Gets a value that specifies whether or not a tooltip is enabled for a chart. + * Value: true - a tooltip is enabled for a chart; false - a tooltip is disabled. + */ + toolTipEnabled: boolean; + /** + * Gets the text to be displayed within series tooltips. + * Value: A string value. + */ + toolTipText: string; + /** + * Gets an image to be displayed within series tooltips. + * Value: A string value. + */ + toolTipImage: string; + /** + * Gets the settings of series labels. + * Value: An ASPxClientSeriesLabel object, which provides the series label settings. + */ + label: ASPxClientSeriesLabel; + /** + * Gets the series' collection of data points. + * Value: An array of ASPxClientSeriesPoint objects, that represent the series' data points. + */ + points: ASPxClientSeriesPoint[]; + /** + * Provides access to the collection of series titles. + * Value: An array of ASPxClientSeriesTitle objects, that represent the collection of series titles. + */ + titles: ASPxClientSeriesTitle[]; + /** + * Gets the series' collection of indicators. + * Value: An array of ASPxClientIndicator objects, that belong to the series. + */ + indicators: ASPxClientIndicator[]; + /** + * Provides access to the collection of regression lines. + * Value: An array of ASPxClientRegressionLine objects which represent regression lines available for the series. + */ + regressionLines: ASPxClientRegressionLine[]; + /** + * Provides access to the collection of trendlines. + * Value: An array of ASPxClientTrendLine objects, that represent the collection of trendlines. + */ + trendLines: ASPxClientTrendLine[]; + /** + * Provides access to the collection of Fibonacci Indicators. + * Value: An array of ASPxClientFibonacciIndicator objects, that represent the collection of Fibonacci Indicators. + */ + fibonacciIndicators: ASPxClientFibonacciIndicator[]; + /** + * Gets the color of a series. + * Value: A string value. + */ + color: string; + /** + * Gets a value that defines a group for stacked series. + * Value: A string value. + */ + stackedGroup: string; + /** + * Gets a string which represents the pattern specifying the text to be displayed within a crosshair label for the current Series type. + * Value: A Empty. + */ + crosshairLabelPattern: string; + /** + * This property is intended for internal use only. + * Value: A String value. + */ + groupedElementsPattern: string; + /** + * Returns a collection of crosshair value items. + * Value: An array of ASPxClientCrosshairValueItem objects. + */ + crosshairValueItems: ASPxClientCrosshairValueItem[]; + /** + * Gets a value indicating whether a crosshair cursor is enabled. + * Value: true if a crosshair cursor is enabled; otherwise, false. + */ + actualCrosshairEnabled: boolean; + /** + * Gets a value indicating whether a crosshair label should be shown for this series. + * Value: true if crosshair labels are visible; otherwise, false. + */ + actualCrosshairLabelVisibility: boolean; +} +/** + * Represents the client-side equivalent of the SeriesLabelBase class. + */ +interface ASPxClientSeriesLabel extends ASPxClientWebChartElement { + /** + * Gets the series that owns the current series label object. + * Value: An ASPxClientSeries object, to which the series label belongs. + */ + series: ASPxClientSeries; + /** + * Gets the common text for all series point labels. + * Value: Returns an empty string object. + */ + text: string; +} +/** + * Represents the client-side equivalent of the SeriesPoint class. + */ +interface ASPxClientSeriesPoint extends ASPxClientWebChartRequiredElement { + /** + * Gets the series that owns the current series point object. + * Value: An ASPxClientSeries object, to which the series point belongs. + */ + series: ASPxClientSeries; + /** + * Gets the data point's argument. + * Value: An object that specifies the data point's argument. + */ + argument: Object; + /** + * Gets the point's data value(s). + * Value: An array of objects that represent the data value(s) of the series data point. + */ + values: Object[]; + /** + * Gets the text to be displayed within series points tooltips. + * Value: A string value. + */ + toolTipText: string; + /** + * Gets the color of a series point. + * Value: A string value. + */ + color: string; + /** + * Gets the percent value of a series point. + * Value: A float value. + */ + percentValue: number; + /** + * Gets a hint that is shown in series points tooltips. + * Value: A string value. + */ + toolTipHint: string; +} +/** + * Represents the client-side equivalent of the Legend class. + */ +interface ASPxClientLegend extends ASPxClientWebChartEmptyElement { + /** + * Returns a value which determines whether to use checkboxes instead of markers on a chart legend for all legend items. + * Value: true, if legend checkboxes are shown instead of markers for all legend items; otherwise, false. + */ + useCheckBoxes: boolean; + /** + * Returns a collection of custom legend items of the legend. + * Value: A collection of ASPxClientCustomLegendItem objects. + */ + customItems: ASPxClientCustomLegendItem[]; + /** + * Returns the name of the legend. + * Value: The string value representing the name of the legend. + */ + name: string; +} +/** + * Represents the base for ASPxClientSeriesTitle classes. + */ +interface ASPxClientTitleBase extends ASPxClientWebChartRequiredElement { + /** + * Gets the lines of text within a title. + * Value: An array of string values containing the text of a title. + */ + lines: string[]; + /** + * Gets the alignment of the title. + * Value: A string value containing the text, which specifies the alignment of a title. + */ + alignment: string; + /** + * Gets a value that specifies to which edges of a parent element the title should be docked. + * Value: A string value. + */ + dock: string; +} +/** + * Represents the client-side equivalent of the ChartTitle class. + */ +interface ASPxClientChartTitle extends ASPxClientTitleBase { +} +/** + * Represents the client-side equivalent of the SeriesTitle class. + */ +interface ASPxClientSeriesTitle extends ASPxClientTitleBase { + /** + * Gets the series that owns the current title object. + * Value: An ASPxClientSeries object, to which the series title belongs. + */ + series: ASPxClientSeries; +} +/** + * Represents the client-side equivalent of the Indicator class. + */ +interface ASPxClientIndicator extends ASPxClientWebChartElementNamed { + /** + * Gets the indicator's associated series. + * Value: An ASPxClientSeries object. + */ + series: ASPxClientSeries; +} +/** + * Represents the client-side equivalent of the FinancialIndicator class. + */ +interface ASPxClientFinancialIndicator extends ASPxClientIndicator { + /** + * Gets the first point of the financial indicator. + * Value: An ASPxClientFinancialIndicatorPoint object, which represents a financial indicator's first point. + */ + point1: ASPxClientFinancialIndicatorPoint; + /** + * Gets the second point of the financial indicator. + * Value: An ASPxClientFinancialIndicatorPoint object, which represents a financial indicator's second point. + */ + point2: ASPxClientFinancialIndicatorPoint; +} +/** + * Represents the client-side equivalent of the TrendLine class. + */ +interface ASPxClientTrendLine extends ASPxClientFinancialIndicator { +} +/** + * Represents the client-side equivalent of the FibonacciIndicator class. + */ +interface ASPxClientFibonacciIndicator extends ASPxClientFinancialIndicator { +} +/** + * Represents the client-side equivalent of the FinancialIndicatorPoint class. + */ +interface ASPxClientFinancialIndicatorPoint extends ASPxClientWebChartRequiredElement { + /** + * Gets the financial indicator that owns the current financial indicator point. + * Value: An ASPxClientFinancialIndicator object, to which the point belongs. + */ + financialIndicator: ASPxClientFinancialIndicator; + /** + * Gets the argument of the financial indicator's point. + * Value: An object that specifies the point argument. + */ + argument: Object; + /** + * Gets a value, indicating how the value of a financial indicator's point is obtained. + * Value: A string value, which indicates how to obtain a financial indicator point's value. + */ + valueLevel: string; +} +/** + * The client-side equivalent of the SingleLevelIndicator class. + */ +interface ASPxClientSingleLevelIndicator extends ASPxClientIndicator { + /** + * Gets a value specifying the value level to which the single-level indicator corresponds. + * Value: A string value. + */ + valueLevel: string; +} +/** + * Represents the client-side equivalent of the RegressionLine class. + */ +interface ASPxClientRegressionLine extends ASPxClientSingleLevelIndicator { +} +/** + * The client-side equivalent of the MovingAverage class. + */ +interface ASPxClientMovingAverage extends ASPxClientSingleLevelIndicator { + /** + * Gets the number of data points used to calculate the moving average. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; + /** + * Gets a value specifying whether to display a Moving Average, Envelope, or both. + * Value: A string value. + */ + kind: string; + /** + * Gets a value specifying the Envelope percent. + * Value: A double value which specifies the Envelope percent. + */ + envelopePercent: number; +} +/** + * The client-side equivalent of the SimpleMovingAverage class. + */ +interface ASPxClientSimpleMovingAverage extends ASPxClientMovingAverage { +} +/** + * The client-side equivalent of the ExponentialMovingAverage class. + */ +interface ASPxClientExponentialMovingAverage extends ASPxClientMovingAverage { +} +/** + * The client-side equivalent of the WeightedMovingAverage class. + */ +interface ASPxClientWeightedMovingAverage extends ASPxClientMovingAverage { +} +/** + * The client-side equivalent of the TriangularMovingAverage class. + */ +interface ASPxClientTriangularMovingAverage extends ASPxClientMovingAverage { +} +/** + * Represents the client-side equivalent of the TripleExponentialMovingAverageTema class. + */ +interface ASPxClientTripleExponentialMovingAverageTema extends ASPxClientMovingAverage { +} +/** + * Represents the client-side equivalent of the BollingerBands class. + */ +interface ASPxClientBollingerBands extends ASPxClientIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; + /** + * Gets a value, indicating whose series point values are used to calculate the indicator's values. + * Value: A string value, which indicates which series point value should be used to calculate indicator values. + */ + valueLevel: string; +} +/** + * Represents the client-side equivalent of the MedianPrice class. + */ +interface ASPxClientMedianPrice extends ASPxClientIndicator { +} +/** + * Represents the client-side equivalent of the TypicalPrice class. + */ +interface ASPxClientTypicalPrice extends ASPxClientIndicator { +} +/** + * Represents the client-side equivalent of the WeightedClose class. + */ +interface ASPxClientWeightedClose extends ASPxClientIndicator { +} +/** + * Represents the client-side equivalent of the SeparatePaneIndicator class. + */ +interface ASPxSeparatePaneIndicator extends ASPxClientIndicator { + /** + * Returns the name of the Y-axis that is used to plot the current indicator on a ASPxClientXYDiagram. + * Value: A string value specifying the Y-axis name. + */ + axisY: string; + /** + * Returns the name of a pane, used to plot the separate pane indicator on an XYDiagram. + * Value: A string that is the name of a pane. + */ + pane: string; +} +/** + * Represents the client-side equivalent of the AverageTrueRange class. + */ +interface ASPxClientAverageTrueRange extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; +} +/** + * Represents the client-side equivalent of the ChaikinsVolatility class. + */ +interface ASPxClientChaikinsVolatility extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; +} +/** + * Represents the client-side equivalent of the CommodityChannelIndex class. + */ +interface ASPxClientCommodityChannelIndex extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; +} +/** + * Represents the client-side equivalent of the DetrendedPriceOscillator class. + */ +interface ASPxClientDetrendedPriceOscillator extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; + /** + * Gets a value, indicating whose series point values are used to calculate the indicator's values. + * Value: A string value, which indicates which series point value should be used to calculate indicator values. + */ + valueLevel: string; +} +/** + * Represents the client-side equivalent of the MassIndex class. + */ +interface ASPxClientMassIndex extends ASPxSeparatePaneIndicator { + /** + * Returns the count of points used to calculate the exponential moving average (EMA). + * Value: An integer value, specifying the count of points used to calculate EMA. + */ + movingAveragePointsCount: number; + /** + * Returns the count of summable values. + * Value: An integer value specifying the count of summable ratios. + */ + sumPointsCount: number; +} +/** + * Represents the client-side equivalent of the MovingAverageConvergenceDivergence class. + */ +interface ASPxClientMovingAverageConvergenceDivergence extends ASPxSeparatePaneIndicator { + /** + * Returns the short period value required to calculate the indicator. + * Value: An integer value specifying the short period value. + */ + shortPeriod: number; + /** + * Returns the long period value required to calculate the indicator. + * Value: An integer value specifying the long period. + */ + longPeriod: number; + /** + * Returns the smoothing period value required to calculate the indicator. + * Value: An integer value specifying the smoothing period value. + */ + signalSmoothingPeriod: number; +} +/** + * Represents the client-side equivalent of the RateOfChange class. + */ +interface ASPxClientRateOfChange extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; + /** + * Gets a value, indicating whose series point values are used to calculate the indicator's values. + * Value: A string value, which indicates which series point value should be used to calculate indicator values. + */ + valueLevel: string; +} +/** + * Represents the client-side equivalent of the RelativeStrengthIndex class. + */ +interface ASPxClientRelativeStrengthIndex extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; + /** + * Gets a value, indicating whose series point values are used to calculate the indicator's values. + * Value: A string value, which indicates which series point value should be used to calculate indicator values. + */ + valueLevel: string; +} +/** + * Represents the client-side equivalent of the StandardDeviation class. + */ +interface ASPxClientStandardDeviation extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; + /** + * Gets a value, indicating whose series point values are used to calculate the indicator's values. + * Value: A string value, which indicates which series point value should be used to calculate indicator values. + */ + valueLevel: string; +} +/** + * Represents the client-side equivalent of the TripleExponentialMovingAverageTrix class. + */ +interface ASPxClientTripleExponentialMovingAverageTrix extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; + /** + * Gets a value, indicating whose series point values are used to calculate the indicator's values. + * Value: A string value, which indicates which series point value should be used to calculate indicator values. + */ + valueLevel: string; +} +/** + * Represents the client-side equivalent of the WilliamsR class. + */ +interface ASPxClientWilliamsR extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; +} +/** + * Represents the client-side equivalent of the FixedValueErrorBars class. + */ +interface ASPxClientFixedValueErrorBars extends ASPxClientIndicator { + /** + * Gets or sets the fixed positive error value. + * Value: A double value specifying the positive error value. + */ + positiveError: number; + /** + * Returns the fixed negative error value. + * Value: A double value specifying the negative error value. + */ + negativeError: number; +} +/** + * Represents the client-side equivalent of the PercentageErrorBars class. + */ +interface ASPxClientPercentageErrorBars extends ASPxClientIndicator { + /** + * Returns the value specifying the percentage of error values of series point values. + * Value: A double value specifying the percentage. Values less than or equal to 0 are not allowed. + */ + percent: number; +} +/** + * Represents the client-side equivalent of the StandardDeviationErrorBars class. + */ +interface ASPxClientStandardDeviationErrorBars extends ASPxClientIndicator { + /** + * Returns the multiplier on which the standard deviation value is multiplied before display. + * Value: A double value specifying the multiplier. Values less than 0 are not allowed. + */ + multiplier: number; +} +/** + * Represents the client-side equivalent of the StandardErrorBars class. + */ +interface ASPxClientStandardErrorBars extends ASPxClientIndicator { +} +/** + * Represents the client-side equivalent of the DataSourceBasedErrorBars class. + */ +interface ASPxClientDataSourceBasedErrorBars extends ASPxClientIndicator { +} +/** + * Represents the client-side equivalent of the Annotation class. + */ +interface ASPxClientAnnotation extends ASPxClientWebChartElementNamed { +} +/** + * Represents the client-side equivalent of the TextAnnotation class. + */ +interface ASPxClientTextAnnotation extends ASPxClientAnnotation { + /** + * Gets the lines of text within an annotation. + * Value: An array of string values containing the text of a title. + */ + lines: string[]; +} +/** + * Represents the client-side equivalent of the ImageAnnotation class. + */ +interface ASPxClientImageAnnotation extends ASPxClientAnnotation { +} +/** + * The client-side equivalent of the CrosshairValueItem class. + */ +interface ASPxClientCrosshairValueItem { + /** + * Gets the value that is displayed in a crosshair label. + * Value: A float value. + */ + value: number; + /** + * Gets an index of a point for which this crosshair value item is displayed. + * Value: An integer value. + */ + pointIndex: number; +} +/** + * The client-side equivalent of the ChartToolTipController class. + */ +interface ASPxClientToolTipController extends ASPxClientWebChartEmptyElement { + /** + * Gets a value indicating whether an image should be shown in tooltips. + * Value: true to show an image in tooltips; otherwise, false. + */ + showImage: boolean; + /** + * Gets a value indicating whether it is necessary to show text in tooltips. + * Value: true to show text in tooltips; otherwise, false. + */ + showText: boolean; + /** + * Gets a value that defines the position of an image within a tooltip. + * Value: A string value. + */ + imagePosition: string; + /** + * Gets a value that defines when tooltips should be invoked. + * Value: A string value. + */ + openMode: string; +} +/** + * The client-side equivalent of the ToolTipPosition class. + */ +interface ASPxClientToolTipPosition { +} +/** + * The client-side equivalent of the ToolTipRelativePosition class. + */ +interface ASPxClientToolTipRelativePosition extends ASPxClientToolTipPosition { + /** + * Gets the horizontal offset of a tooltip. + * Value: An integer value. + */ + offsetX: number; + /** + * Gets the vertical offset of a tooltip. + * Value: An integer value. + */ + offsetY: number; +} +/** + * The client-side equivalent of the ToolTipFreePosition class. + */ +interface ASPxClientToolTipFreePosition extends ASPxClientToolTipPosition { + /** + * Gets the horizontal offset of a tooltip. + * Value: An integer value. + */ + offsetX: number; + /** + * Gets the vertical offset of a tooltip. + * Value: An integer value. + */ + offsetY: number; + /** + * Gets the ID of a pane. + * Value: An integer value. + */ + paneID: number; + /** + * Gets an object containing settings that define how a tooltip should be docked. + * Value: A string value. + */ + dockPosition: string; +} +/** + * The client-side equivalent of the CrosshairLabelPosition class. + */ +interface ASPxClientCrosshairPosition { + /** + * Gets the horizontal offset of a crosshair cursor. + * Value: An integer value that is the X-offset. + */ + offsetX: number; + /** + * Gets the vertical offset of a crosshair cursor. + * Value: An integer value that is the Y-offset. + */ + offsetY: number; +} +/** + * The client-side equivalent of the CrosshairMousePosition class. + */ +interface ASPxClientCrosshairMousePosition extends ASPxClientCrosshairPosition { +} +/** + * The client-side equivalent of the CrosshairFreePosition class. + */ +interface ASPxClientCrosshairFreePosition extends ASPxClientCrosshairPosition { + /** + * Gets a Pane's ID when the crosshair cursor is in the free position mode. + * Value: An integer value that is the pane's ID. + */ + paneID: number; + /** + * Gets a string containing information on a crosshair label's dock position when the crosshair cursor is in the free position mode. + * Value: A string value containing information on a crosshair label's dock position. + */ + dockPosition: string; +} +/** + * Defines line style settings. + */ +interface ASPxClientLineStyle extends ASPxClientWebChartElement { + /** + * Gets the dash style used to paint the line. + * Value: A string value that contains information about the style used to paint the line. + */ + dashStyle: string; + /** + * Gets the thickness that corresponds to the value of the current ASPxClientLineStyle object. + * Value: An integer value which specifies the thickness, in pixels. + */ + thickness: number; + /** + * Returns the join style for the ends of consecutive lines. + * Value: A string representing the name of the line join type. + */ + lineJoin: string; +} +/** + * The client-side equivalent of the CrosshairOptions class. + */ +interface ASPxClientCrosshairOptions extends ASPxClientWebChartEmptyElement { + /** + * Gets a value indicating whether it is necessary to show a crosshair label for the X-axis. + * Value: true to show a crosshair label for the X-axis; otherwise, false. + */ + showAxisXLabels: boolean; + /** + * Gets a value indicating whether it is necessary to show a crosshair label for the Y-axis. + * Value: true to show the crosshair label for the Y-axis; otherwise, false. + */ + showAxisYLabels: boolean; + /** + * Gets a value that defines whether a crosshair label of a series point indicated by a crosshair cursor is shown on a diagram. + * Value: true if a crosshair label indicated by a crosshair cursor is shown on a diagram; otherwise, false. + */ + showCrosshairLabels: boolean; + /** + * Gets a value that indicates whether a crosshair cursor argument line is shown for a series point on a diagram. + * Value: true if a crosshair cursor argument line is displayed on a diagram; otherwise, false. + */ + showArgumentLine: boolean; + /** + * Specifies whether to show a value line of a series point indicated by a crosshair cursor on a diagram. + * Value: true to display a value line indicated by a crosshair cursor on a diagram; otherwise, false. + */ + showValueLine: boolean; + /** + * Gets a value that specifies whether to show a crosshair cursor in a focused pane only. + * Value: true to display a crosshair cursor in a focused pane; otherwise, false. + */ + showOnlyInFocusedPane: boolean; + /** + * Specifies the current snap mode of a crosshair cursor. + * Value: A string value. + */ + snapMode: string; + /** + * Specifies the way in which the crosshair label is shown for a series on a diagram. + * Value: A string value that specifies how the crosshair label is shown for a series. + */ + crosshairLabelMode: string; + /** + * Gets a value that indicates whether to show a header for each series group in crosshair cursor labels. + * Value: true, to show a group header in crosshair cursor labels; otherwise, false. + */ + showGroupHeaders: boolean; + /** + * Gets a string which represents the pattern specifying the group header text to be displayed within the crosshair label. + * Value: A String, which represents the group header's pattern. + */ + groupHeaderPattern: string; + /** + * Gets the color of a crosshair argument line. + * Value: A String value, specifying the color of a crosshair argument line. + */ + argumentLineColor: string; + /** + * Gets the color of a crosshair value line. + * Value: A String value, specifying the color of a crosshair value line. + */ + valueLineColor: string; +} +/** + * The chart print options storage. + */ +interface ASPxClientChartPrintOptions { + /** + * Gets the size mode used to print a chart. + */ + GetSizeMode(): string; + /** + * Sets the size mode used to print a chart. + * @param sizeMode A System.String object, specifying the name of the size mode. + */ + SetSizeMode(sizeMode: string): void; + /** + * Gets a value indicating that the landscape orientation will be used to print a chart. + */ + GetLandscape(): boolean; + /** + * Sets a value indicating that the landscape orientation will be used to print a chart. + * @param landscape A Boolean value, specifying that the landscape orientation will be used to print a chart. + */ + SetLandscape(landscape: boolean): void; + /** + * Gets the left margin which will be used to print a chart. + */ + GetMarginLeft(): number; + /** + * Sets the left margin which will be used to print a chart. + * @param marginLeft A System.Int32 value, specifying the margin in hundredths of an inch. + */ + SetMarginLeft(marginLeft: number): void; + /** + * Gets the top margin which will be used to print a chart. + */ + GetMarginTop(): number; + /** + * Sets the top margin which will be used to print a chart. + * @param marginTop A System.Int32 value, specifying the margin in hundredths of an inch. + */ + SetMarginTop(marginTop: number): void; + /** + * Gets the right margin which will be used to print a chart. + */ + GetMarginRight(): number; + /** + * Sets the right margin which will be used to print a chart. + * @param marginRight A System.Int32 value, specifying the margin in hundredths of an inch. + */ + SetMarginRight(marginRight: number): void; + /** + * Gets the bottom margin which will be used to print a chart. + */ + GetMarginBottom(): number; + /** + * Sets the bottom margin which will be used to print a chart. + * @param marginBottom A System.Int32 value, specifying the margin in hundredths of an inch. + */ + SetMarginBottom(marginBottom: number): void; + /** + * Gets the predefined size ratio of the paper which will be used to print a chart. + */ + GetPaperKind(): string; + /** + * Sets the predefined size ratio of the paper which will be used to print a chart. + * @param paperKind A System.String object, specifying the name of a size ratio. + */ + SetPaperKind(paperKind: string): void; + /** + * Gets the custom paper width which will be used to print a chart. + */ + GetCustomPaperWidth(): number; + /** + * Sets the custom paper width which will be used to print a chart. + * @param customPaperWidth A System.Int32 object, specifying the width in hundredths of an inch. + */ + SetCustomPaperWidth(customPaperWidth: number): void; + /** + * Gets the custom paper height which will be used to print a chart. + */ + GetCustomPaperHeight(): number; + /** + * Sets the custom paper height which will be used to print a chart. + * @param customPaperHeight A System.Int32 object, specifying the height in hundredths of an inch. + */ + SetCustomPaperHeight(customPaperHeight: number): void; + /** + * Gets the name of the custom paper width-height ratio used to print the chart. + */ + GetCustomPaperName(): string; + /** + * Sets the name of the custom paper width-height ratio used to print a chart. + * @param customPaperName A String object, specifying the name of the custom paper width-height ratio. + */ + SetCustomPaperName(customPaperName: string): void; +} +/** + * Represents the client-side equivalent of the CustomLegendItem class. + */ +interface ASPxClientCustomLegendItem extends ASPxClientWebChartElementNamed { + /** + * Returns the text displayed by the custom legend item. + * Value: A string value that specifies legend item text. + */ + text: string; +} +/** + * The client-side equivalent of the ASPxDocumentViewer control. + */ +interface ASPxClientDocumentViewer extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientDocumentViewer. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs when the value of an item within the Document Viewer's report toolbar is changed. + */ + ToolbarItemValueChanged: ASPxClientEvent>; + /** + * Occurs when an item within the Document Viewer's report toolbar is clicked. + */ + ToolbarItemClick: ASPxClientEvent>; + /** + * Occurs on the client side when a report page is loaded into this ASPxClientDocumentViewer instance. + */ + PageLoad: ASPxClientEvent>; + /** + * Provides access to the Splitter of the ASPxClientDocumentViewer. + */ + GetSplitter(): ASPxClientSplitter; + /** + * Provides access to the ASPxClientDocumentViewer's preview that exposes methods to print and export the document. + */ + GetViewer(): ASPxClientReportViewer; + /** + * Provides access to the Document Viewer toolbar on the client. + */ + GetToolbar(): ASPxClientReportToolbar; + /** + * Provides access to the Ribbon of the ASPxClientDocumentViewer. + */ + GetRibbonToolbar(): ASPxClientRibbon; + /** + * Provides access to the parameters panel of the ASPxClientDocumentViewer. + */ + GetParametersPanel(): ASPxClientReportParametersPanel; + /** + * Provides access to the document of the ASPxClientDocumentViewer. + */ + GetDocumentMap(): ASPxClientReportDocumentMap; + /** + * Sets focus on the report control specified by its bookmark. + * @param pageIndex An integer value, specifying the page index. + * @param bookmarkPath A String value, specifying the path to the bookmark. + */ + GotoBookmark(pageIndex: number, bookmarkPath: string): void; + /** + * Initiates a round trip to the server so that the current page will be reloaded. + */ + Refresh(): void; + /** + * Prints the current document. + */ + Print(): void; + /** + * Prints the document's page with the specified page index. + * @param pageIndex A Int32 representing the index of the page to be printed. + */ + Print(pageIndex: number): void; + /** + * Displays the specified report page. + * @param pageIndex An integer value, identifying the report page. + */ + GotoPage(pageIndex: number): void; + /** + * Invokes the Search dialog, which allows end-users to search for specific text in a report. + */ + Search(): void; + /** + * Gets a value indicating whether or not searching text across a report is permitted in the web browser. + */ + IsSearchAllowed(): boolean; + /** + * Exports a report to a file of the specified format, and shows it in a new Web Browser window. + * @param format A string specifying the format to which a report should be exported. + */ + SaveToWindow(format: string): void; + /** + * Exports a report to a file of the specified format, and saves it to the disk. + * @param format A string specifying the format to which a report should be exported. + */ + SaveToDisk(format: string): void; +} +/** + * A method that will handle the ItemValueChanged event. + */ +interface ASPxClientToolbarItemValueChangedEventHandler { + /** + * A method that will handle the ToolbarItemValueChanged event. + * @param source A Object that is the event source. + * @param e An ASPxClientToolbarItemValueChangedEventArgs object, containing the event arguments. + */ + (source: S, e: ASPxClientToolbarItemValueChangedEventArgs): void; +} +/** + * Provides data for the ItemValueChanged event. + */ +interface ASPxClientToolbarItemValueChangedEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the menu item object related to the event. + * Value: An ASPxClientMenuItem object, manipulations on which forced the event to be raised. + */ + item: ASPxClientMenuItem; + /** + * Provides access to the toolbar's value editor on the client. + * Value: An ASPxClientControl descendant. + */ + editor: ASPxClientControl; +} +/** + * The client-side equivalent of the ASPxQueryBuilder control. + */ +interface ASPxClientQueryBuilder extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientQueryBuilder. + */ + CallbackError: ASPxClientEvent>; + /** + * Enables you to customize the menu actions of a Query Builder. + */ + CustomizeToolbarActions: ASPxClientEvent>; + /** + * Occurs when executing the Save command on the client. + */ + SaveCommandExecute: ASPxClientEvent>; + /** + * Sends a callback to the server with the specified argument. + * @param arg A String value, specifying the callback argument. + */ + PerformCallback(arg: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; + /** + * Updates the localization settings of the ASPxClientQueryBuilder properties. + * @param localization A dictionary containing the property names, along with their localized equivalents. + */ + UpdateLocalization(localization: { [key: string]: string; }): void; + /** + * Returns the object model of a Query Builder. + */ + GetDesignerModel(): Object; + /** + * Gets a client-side model of the currently opened query serialized to Json. + */ + GetJsonQueryModel(): string; + /** + * Saves the current query. + */ + Save(): void; + /** + * Invokes a Data Preview for the current query. + */ + ShowPreview(): void; + /** + * Specifies whether or not the current query is a valid SQL string. + */ + IsQueryValid(): boolean; +} +/** + * A method that will handle the SaveCommandExecute event. + */ +interface ASPxClientQueryBuilderSaveCommandExecuteEventHandler { + /** + * A method that will handle the SaveCommandExecute event. + * @param source The event sender. + * @param e An ASPxClientQueryBuilderSaveCommandExecuteEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientQueryBuilderSaveCommandExecuteEventArgs): void; +} +/** + * Provides data for the SaveCommandExecute event. + */ +interface ASPxClientQueryBuilderSaveCommandExecuteEventArgs extends ASPxClientEventArgs { + /** + * Specifies whether or not the event was handled. + * Value: true if the event was handled and default processing should not occur; false if the event should be handled using default processing. + */ + handled: boolean; +} +/** + * A method that will handle the CustomizeToolbarActions event. + */ +interface ASPxClientQueryBuilderCustomizeToolbarActionsEventHandler { + /** + * A method that will handle the CustomizeToolbarActions event. + * @param source The event sender. + * @param e An ASPxClientQueryBuilderCustomizeToolbarActionsEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientQueryBuilderCustomizeToolbarActionsEventArgs): void; +} +/** + * Provides settings to the actions listed in a Query Builder menu. + */ +interface ASPxClientQueryBuilderMenuAction { + /** + * Provides access to the text for the command. + * Value: A String value. + */ + text: string; + /** + * Provides access to the CSS class of the command's glyph. + * Value: A String value. + */ + imageClassName: string; + /** + * Provides access to the action performed when a Query Builder's button is clicked. + * Value: The specific action implementation. + */ + clickAction: Function; + /** + * Provides access to the value that specifies whether or not the command is disabled by default. + * Value: true, if the command is disabled by default; otherwise, false. + */ + disabled: boolean; + /** + * Provides access to the value that specifies whether or not the command is visible in the Query Builder user interface. + * Value: true if the command is visible; otherwise false. + */ + visible: boolean; + /** + * Provides access to the keyboard shortcut used to invoke the command. + * Value: A String value. + */ + hotKey: string; + /** + * Provides access to the value that specifies whether or not the command has a visual separator. + * Value: true, if the command has a visual separator; otherwise, false. + */ + hasSeparator: string; + /** + * Provides access to the location of the displayed command. + * Value: A String value. + */ + container: string; +} +/** + * Provides data for the CustomizeToolbarActions event. + */ +interface ASPxClientQueryBuilderCustomizeToolbarActionsEventArgs extends ASPxClientEventArgs { + /** + * Returns the collection of customized menu actions. + * Value: An ASPxClientQueryBuilderMenuAction array. + */ + Actions: ASPxClientQueryBuilderMenuAction[]; + /** + * Returns a menu action with the specified ID. + * @param actionId A String value, specifying the action ID. + */ + GetById(actionId: string): ASPxClientQueryBuilderMenuAction; +} +/** + * The client-side equivalent of the Web Report Designer control. + */ +interface ASPxClientReportDesigner extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientReportDesigner. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs when executing the Save command on the client. + */ + SaveCommandExecute: ASPxClientEvent>; + /** + * Enables you to customize the menu actions of a Web Report Designer. + */ + CustomizeMenuActions: ASPxClientEvent>; + /** + * 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. + */ + ExitDesigner: ASPxClientEvent>; + /** + * Sends a callback to the server with the specified argument. + * @param arg A String value, specifying the callback argument. + */ + PerformCallback(arg: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; + /** + * Updates the localization settings of the ASPxClientReportDesigner properties. + * @param localization A dictionary containing the property names, along with their localized equivalents. + */ + UpdateLocalization(localization: { [key: string]: string; }): void; + /** + * Returns the object model of a Web Report Designer. + */ + GetDesignerModel(): Object; + /** + * Gets a client-side model of the currently opened report serialized to Json. + */ + GetJsonReportModel(): string; + /** + * Returns serialization information for the specific property of the specific control type. + * @param controlType A string that identifies the name of the control type for which serialization information is to be returned. + * @param propertyDisplayName A string that identifies the name of the property for which serialization information is to be returned. + */ + GetPropertyInfo(controlType: string, propertyDisplayName: string): ASPxDesignerElementSerializationInfo; + /** + * Indicates whether or not the current ASPxClientReportDesigner instance has been modified. + */ + IsModified(): boolean; + /** + * Resets the value returned by the IsModified method. + */ + ResetIsModified(): void; +} +/** + * A method that will handle the SaveCommandExecute event. + */ +interface ASPxClientReportDesignerSaveCommandExecuteEventHandler { + /** + * A method that will handle the SaveCommandExecute event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerSaveCommandExecuteEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerSaveCommandExecuteEventArgs): void; +} +/** + * Provides data for the SaveCommandExecute event. + */ +interface ASPxClientReportDesignerSaveCommandExecuteEventArgs extends ASPxClientEventArgs { + /** + * Specifies whether or not the event was handled. + * Value: true if the event was handled and default processing should not occur; false if the event should be handled using default processing. + */ + handled: boolean; +} +/** + * A method that will handle the CustomizeMenuActions event. + */ +interface ASPxClientReportDesignerCustomizeMenuActionsEventHandler { + /** + * A method that will handle the CustomizeMenuActions event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerCustomizeMenuActionsEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerCustomizeMenuActionsEventArgs): void; +} +/** + * Provides settings to the actions listed in a Web Report Designer menu. + */ +interface ASPxClientReportDesignerMenuAction { + /** + * Provides access to the text for the command. + * Value: A String value. + */ + text: string; + /** + * Provides access to the CSS class of the command's glyph. + * Value: A String value. + */ + imageClassName: string; + /** + * Provides access to the action performed when a Web Report Designer's button is clicked. + * Value: The specific action implementation. + */ + clickAction: Function; + /** + * Provides access to the value that specifies whether or not the command is disabled by default. + * Value: true, if the command is disabled by default; otherwise, false. + */ + disabled: boolean; + /** + * Provides access to the value that specifies whether or not the command is visible in the designer user interface. + * Value: true if the command is visible; otherwise false. + */ + visible: boolean; + /** + * Provides access to the keyboard shortcut used to invoke the command. + * Value: A String value. + */ + hotKey: string; + /** + * Provides access to the value that specifies whether or not the command has a visual separator. + * Value: true, if the command has a visual separator; otherwise, false. + */ + hasSeparator: string; + /** + * Provides access to the location of the displayed command. + * Value: A String value. + */ + container: string; +} +/** + * Provides data for the CustomizeMenuActions event. + */ +interface ASPxClientReportDesignerCustomizeMenuActionsEventArgs extends ASPxClientEventArgs { + /** + * Returns the collection of customized menu actions. + * Value: An ASPxClientReportDesignerMenuAction array. + */ + Actions: ASPxClientReportDesignerMenuAction[]; + /** + * Returns a menu action with the specified ID. + * @param actionId A String value, specifying the action ID. + */ + GetById(actionId: string): ASPxClientReportDesignerMenuAction; +} +/** + * Provides data for the ExitDesigner event. + */ +interface ASPxClientReportDesignerExitDesignerEventArgs extends ASPxClientEventArgs { +} +interface ASPxClientReportDesignerCustomizeParameterLookUpSourceEventHandler { + (source: S, e: ASPxClientCustomizeParameterLookUpSourceEventArgs): void; +} +/** + * A method that will handle the CustomizeParameterEditors event. + */ +interface ASPxClientReportDesignerCustomizeParameterEditorsEventHandler { + /** + * A method that will handle the CustomizeParameterEditors event. + * @param source The event sender. + * @param e An ASPxClientCustomizeParameterEditorsEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientCustomizeParameterEditorsEventArgs): void; +} +/** + * A method that will handle the ExitDesigner event. + */ +interface ASPxClientReportDesignerExitDesignerEventHandler { + /** + * A method that will handle the ExitDesigner event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerExitDesignerEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerExitDesignerEventArgs): void; +} +/** + * The client-side equivalent of the ASPxClientDocumentViewer control's Document Map. + */ +interface ASPxClientReportDocumentMap extends ASPxClientControl { + /** + * Occurs after the content of the Document Viewer's document map is updated. + */ + ContentChanged: ASPxClientEvent>; +} +/** + * The client-side equivalent of the ASPxClientDocumentViewer control's Parameters Panel. + */ +interface ASPxClientReportParametersPanel extends ASPxClientControl { + /** + * Assigns a value to a parameter of the report displayed in the document viewer. + * @param parametersInfo An array of ASPxClientReportParameterInfo values specifying parameters and values to assign. + */ + AssignParameters(parametersInfo: ASPxClientReportParameterInfo[]): void; + /** + * Assigns a value to a parameter of the report displayed in the document viewer. + * @param path A System.String specifying the parameter's path. + * @param value An object specifying the parameter value. + */ + AssignParameter(path: string, value: Object): void; + /** + * Returns an array storing the names of parameters available in a report. + */ + GetParameterNames(): string[]; + /** + * Returns a value editor that is associated with a parameter with the specified name. + * @param parameterName A String value, specifying the parameter name. + */ + GetEditorByParameterName(parameterName: string): ASPxClientControl; +} +interface ASPxClientReportParameterInfo { + Path: string; + Value: Object; +} +/** + * The client-side equivalent of the ASPxClientDocumentViewer control's toolbar. + */ +interface ASPxClientReportToolbar extends ASPxClientControl { + /** + * Provides access to the control template assigned for the specified menu item. + * @param name A String value, specifying the menu item name. + */ + GetItemTemplateControl(name: string): ASPxClientControl; +} +/** + * The client-side equivalent of the ReportViewer. + */ +interface ASPxClientReportViewer extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientReportViewer. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client side when another report page is loaded into this ASPxClientReportViewer instance. + */ + PageLoad: ASPxClientEvent>; + /** + * Submits the values of the specified parameters. + * @param parameters A dictionary containing the parameter names, along with their Object values. + */ + SubmitParameters(parameters: { [key: string]: Object; }): void; + /** + * Prints a report shown in the ReportViewer. + */ + Print(): void; + /** + * Prints a report page with the specified page index. + * @param pageIndex An integer value which specifies an index of the page to be printed. + */ + Print(pageIndex: number): void; + /** + * Displays a report page with the specified page index in the ReportViewer. + * @param pageIndex An integer value which specifies the index of a page to be displayed. + */ + GotoPage(pageIndex: number): void; + /** + * Initiates a round trip to the server so that the current page will be reloaded. + */ + Refresh(): void; + /** + * Invokes the Search dialog, which allows end-users to search for specific text in a report. + */ + Search(): void; + /** + * Exports a report to a file of the specified format, and shows it in a new Web Browser window. + * @param format A string specifying the format, to which a report should be exported. + */ + SaveToWindow(format: string): void; + /** + * Exports a report to a file of the specified format, and saves it to the disk. + * @param format A string specifying the format, to which a report should be exported. + */ + SaveToDisk(format: string): void; + /** + * Gets a value indicating whether or not searching text across a report is permitted in the web browser. + */ + IsSearchAllowed(): boolean; +} +interface ASPxClientReportViewerPageLoadEventHandler { + (source: S, e: ASPxClientReportViewerPageLoadEventArgs): void; +} +/** + * Provides data for a Report Viewer's PageLoad event on the client side. + */ +interface ASPxClientReportViewerPageLoadEventArgs extends ASPxClientEventArgs { + /** + * Gets a value specifying a zero-based index of a page to be displayed in a report viewer. + * Returns: $ + */ + PageIndex: number; + /** + * Gets a value specifying the total number of pages displayed in a report viewer. + * Returns: $ + */ + PageCount: number; + /** + * Gets a value indicating whether a report page, which is currently loaded into the ASPxClientReportViewer, is the first page of a report. + */ + IsFirstPage(): boolean; + /** + * Gets a value indicating whether a report page, which is currently loaded into the ASPxClientReportViewer, is the last page of a report. + */ + IsLastPage(): boolean; +} +/** + * Provides data for the CustomizeParameterEditors events. + */ +interface ASPxClientCustomizeParameterEditorsEventArgs extends ASPxClientEventArgs { + /** + * Provides access to an object that stores information about a parameter. + * Value: An ASPxDesignerElementParameterDescriptor object. + */ + parameter: ASPxDesignerElementParameterDescriptor; + /** + * Provides access to an object that stores information required to serialize a parameter editor. + * Value: An ASPxDesignerElementSerializationInfo object. + */ + info: ASPxDesignerElementSerializationInfo; +} +interface ASPxClientCustomizeParameterLookUpSourceEventArgs extends ASPxClientEventArgs { + parameter: ASPxDesignerElementParameterDescriptor; + items: ASPxDesignerElementEditorItem[]; + dataSource: Object; +} +/** + * Provides general information about a report parameter. + */ +interface ASPxDesignerElementParameterDescriptor { + /** + * Provides access to the parameter description. + * Value: A String value, specifying the parameter description. + */ + description: string; + /** + * Provides access to the parameter name. + * Value: A String value, specifying the parameter name. + */ + name: string; + /** + * Provides access to the parameter type. + * Value: A String value, specifying the parameter type. + */ + type: string; + /** + * Provides access to the parameter value. + * Value: A Object, specifying the parameter value. + */ + value: Object; + /** + * Provides access to the parameter visibility state. + * Value: true if the parameter is visible; otherwise false. + */ + visible: boolean; +} +/** + * Provides information required to serialize an element. + */ +interface ASPxDesignerElementSerializationInfo { + /** + * Gets the property name that will be used in the model to store the property value. + * Value: A String value. + */ + propertyName: string; + /** + * Gets the property name in the model that is displayed in the Property grid. + * Value: A String value. + */ + displayName: string; + /** + * Gets the property name that will be used during serialization to store the property value. + * Value: A String value. + */ + modelName: string; + /** + * Gets the default property value used for serialization. + * Value: A Object value. + */ + defaultVal: Object; + /** + * Gets the information about a complex object's content. + * Value: An array of ASPxDesignerElementSerializationInfo objects. + */ + info: ASPxDesignerElementSerializationInfo[]; + /** + * Gets a value indicating whether or not the property returns an array. + * Value: true if the property returns an array; otherwise false. + */ + array: boolean; + /** + * Gets a value indicating whether an object should be serialized to the ComponentStorage property. + * Value: true to serialize an object to the ObjectStorage; otherwise false. + */ + link: boolean; + /** + * Gets a value specifying the type of value editor for the Property Grid. + * Value: An ASPxDesignerElementEditor object. + */ + editor: ASPxDesignerElementEditor; + /** + * Gets the collection of values displayed in the Property grid. + * Value: An array of ASPxDesignerElementEditorItem objects. + */ + valuesArray: ASPxDesignerElementEditorItem[]; + /** + * Gets the rules for validating the property value entered into its editor. + * Value: An array of Object values. + */ + validationRules: Object[]; + /** + * Gets the visibility state of the value editor in the Property Grid. + * Value: A Object value. + */ + visible: Object; + /** + * Gets a value, indicating whether or not the property value can be edited. + * Value: true to disable the property editing; otherwise false. + */ + disabled: Object; +} +/** + * Provides information about a serialized property's value editor used in the Property Grid. + */ +interface ASPxDesignerElementEditor { + /** + * Gets the name of an HTML template specifying the editor and header of a complex object (i.e., an object having its content properties specified). + * Value: A String value. + */ + header: string; + /** + * Gets a nullable value, specifying the name of an HTML template used by a complex object's editor. + * Value: A String value. + */ + content: string; + /** + * Gets a nullable value, specifying the type of the editor's model. + * Value: A Object value. + */ + editorType: Object; +} +/** + * Provides information about property values. + */ +interface ASPxDesignerElementEditorItem { + /** + * Gets an actual property value. + * Value: A Object value. + */ + value: Object; + /** + * Gets a value displayed by a property editor. + * Value: A String value. + */ + displayValue: string; +} +/** + * A client-side equivalent of the ASPxWebDocumentViewer class. + */ +interface ASPxClientWebDocumentViewer extends ASPxClientControl { + /** + * Enables you to customize the menu actions of a Web Document Viewer. + */ + CustomizeMenuActions: ASPxClientEvent>; + /** + * 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. + */ + GetPreviewModel(): Object; + /** + * Opens the specified report in the HTML5 Document Viewer. + */ + OpenReport(): Object; + /** + * Prints the current document. + */ + Print(): void; + /** + * Prints the document's page with the specified index. + * @param pageIndex An index of the page to be printed. + */ + Print(pageIndex: number): void; + /** + * Exports the document to a PDF file. + */ + ExportTo(): void; + /** + * Exports the document to a specified file format. + * @param format A String value, specifying the export format. The following formats are currently supported: 'csv', 'html', 'image', 'mht', 'pdf', 'rtf', 'txt', 'xls', and 'xlsx'. + */ + ExportTo(format: string): void; + /** + * Updates the localization settings of the ASPxClientWebDocumentViewer properties. + * @param localization A dictionary containing the property names, along with their localized equivalents. + */ + UpdateLocalization(localization: { [key: string]: string; }): void; +} +/** + * Provides settings to the actions listed in a Web Document Viewer menu. + */ +interface ASPxClientWebDocumentViewerMenuAction { + /** + * Provides access to the text for the command. + * Value: A String value. + */ + text: string; + /** + * Provides access to the CSS class of the command's glyph. + * Value: A String value. + */ + imageClassName: string; + /** + * Provides access to the action performed when a Document Viewer's button is clicked. + * Value: The specific action implementation. + */ + clickAction: Function; + /** + * Provides access to the value that specifies whether or not the command is disabled by default. + * Value: true, if the command is disabled by default; otherwise, false. + */ + disabled: boolean; + /** + * Provides access to the value that specifies whether or not the command is visible in the Document Viewer user interface. + * Value: true if the command is visible; otherwise false. + */ + visible: boolean; + /** + * Provides access to the keyboard shortcut used to invoke the command. + * Value: A String value. + */ + hotKey: string; + /** + * Provides access to the value that specifies whether or not the command has a visual separator. + * Value: true, if the command has a visual separator; otherwise, false. + */ + hasSeparator: string; + /** + * Provides access to the location of the displayed command. + * Value: A String value. + */ + container: string; +} +/** + * Provides data for the CustomizeMenuActions event. + */ +interface ASPxClientWebDocumentViewerCustomizeMenuActionsEventArgs extends ASPxClientEventArgs { + /** + * Returns the collection of customized menu actions. + * Value: An ASPxClientWebDocumentViewerMenuAction array. + */ + Actions: ASPxClientWebDocumentViewerMenuAction[]; + /** + * Returns a menu action with the specified ID. + * @param actionId A String value, specifying the action ID. + */ + 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. + */ +interface ASPxClientWebDocumentViewerCustomizeParameterEditorsEventHandler { + /** + * A method that will handle the CustomizeParameterEditors event. + * @param source The event sender. + * @param e An ASPxClientCustomizeParameterEditorsEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientCustomizeParameterEditorsEventArgs): void; +} +interface ASPxClientWebDocumentViewerCustomizeParameterLookUpSourceEventHandler { + (source: S, e: ASPxClientCustomizeParameterEditorsEventArgs): void; +} + +interface MVCxClientDashboardViewerStatic extends ASPxClientDashboardViewerStatic { +} +interface DashboardDataAxisNamesStatic { + /** + * Identifies a default axis in all data-bound dashboard items. + */ + DefaultAxis: string; + /** + * Identifies a series axis in a chart and pie. + */ + ChartSeriesAxis: string; + /** + * Identifies an argument axis in a chart, scatter chart and pie. + */ + ChartArgumentAxis: string; + /** + * Identifies a sparkline axis in a grid and cards. + */ + SparklineAxis: string; + /** + * Identifies a pivot column axis. + */ + PivotColumnAxis: string; + /** + * Identifies a pivot row axis. + */ + PivotRowAxis: string; +} +interface DashboardSpecialValuesStatic { + /** + * Represents a null value. + */ + NullValue: string; + /** + * Represents a null value in OLAP mode. + */ + OlapNullValue: string; + /** + * Represents an Others value. + */ + OthersValue: string; + /** + * Represents an error value for calculated fields. + */ + ErrorValue: string; + /** + * Returns whether or not the specified value is an NullValue. + * @param value The specified value. + */ + IsNullValue(value: Object): boolean; + /** + * Returns whether or not the specified value is an OlapNullValue. + * @param value The specified value. + */ + IsOlapNullValue(value: Object): boolean; + /** + * Returns whether or not the specified value is an OthersValue. + * @param value The specified value. + */ + IsOthersValue(value: Object): boolean; + /** + * Returns whether or not the specified value is an ErrorValue. + * @param value The specified value. + */ + IsErrorValue(value: Object): boolean; +} +interface ASPxClientDashboardDesignerStatic extends ASPxClientControlStatic { +} +interface ASPxClientDashboardViewerStatic 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): ASPxClientDashboardViewer; +} +interface DashboardExportPageLayoutStatic { + /** + * The page orientation used to export a dashboard (dashboard item) is portrait. + */ + Portrait: string; + /** + * The page orientation used to export a dashboard (dashboard item) is landscape. + */ + Landscape: string; +} +interface DashboardExportPaperKindStatic { + /** + * Letter paper (8.5 in. by 11 in.). + */ + Letter: string; + /** + * Legal paper (8.5 in. by 14 in.). + */ + Legal: string; + /** + * Executive paper (7.25 in. by 10.5 in.). + */ + Executive: string; + /** + * A5 paper (148 mm by 210 mm). + */ + A5: string; + /** + * A4 paper (210 mm by 297 mm). + */ + A4: string; + /** + * A3 paper (297 mm by 420 mm). + */ + A3: string; +} +interface DashboardExportScaleModeStatic { + /** + * The dashboard (dashboard item) on the exported page retains its original size. + */ + None: string; + /** + * The size of the dashboard (dashboard item) on the exported page is changed according to the scale factor value. + */ + UseScaleFactor: string; + /** + * The size of the dashboard (dashboard item) is changed according to the width of the exported page. + */ + AutoFitToPageWidth: string; + /** + * The size of the dashboard (dashboard item) is changed to fit its content on a single page. + */ + AutoFitWithinOnePage: string; +} +interface DashboardExportFilterStateStatic { + /** + * The filter state is not included in the exported document. + */ + None: string; + /** + * The filter state is placed below the dashboard (dashboard item) in the exported document. + */ + Below: string; + /** + * The filter state is placed on a separate page in the exported document. + */ + SeparatePage: string; +} +interface DashboardExportImageFormatStatic { + /** + * The PNG image format. + */ + Png: string; + /** + * The GIF image format. + */ + Gif: string; + /** + * The JPG image format. + */ + Jpg: string; +} +interface DashboardExportExcelFormatStatic { + /** + * The Excel 97 - Excel 2003 (XLS) file format. + */ + Xls: string; + /** + * The Office Excel 2007 XML-based (XLSX) file format. + */ + Xlsx: string; + /** + * A comma-separated values (CSV) file format. + */ + Csv: string; +} +interface ChartExportSizeModeStatic { + /** + * A chart dashboard item is exported in a size identical to that shown on the dashboard. + */ + None: string; + /** + * A chart dashboard item is stretched or shrunk to fit the page to which it is exported. + */ + Stretch: string; + /** + * A chart dashboard item is resized proportionally to best fit the exported page. + */ + Zoom: string; +} +interface MapExportSizeModeStatic { + /** + * A map dashboard item is exported in a size identical to that shown on the dashboard + */ + None: string; + /** + * A map dashboard item is resized proportionally to best fit the exported page. + */ + Zoom: string; +} +interface RangeFilterExportSizeModeStatic { + /** + * A Range Filter dashboard item is exported in a size identical to that shown on the dashboard. + */ + None: string; + /** + * A Range Filter dashboard item is stretched or shrunk to fit the page to which it is exported. + */ + Stretch: string; + /** + * A Range Filter dashboard item is resized proportionally to best fit the printed page. + */ + Zoom: string; +} +interface DashboardSelectionModeStatic { + None: string; + Single: string; + Multiple: string; +} +interface ASPxClientEditBaseStatic extends ASPxClientControlStatic { +} +interface ASPxClientEditStatic extends ASPxClientEditBaseStatic { + /** + * Assigns a null value to all editors in a specified visibility state, which are located within a specified container and belong to a specific validation group. + * @param container An HTML element specifying the container of editors to be validated. + * @param validationGroup A string value specifying the validation group's name. + * @param clearInvisibleEditors true to clear both visible and invisible editors that belong to the specified container and group; false to clear only visible editors. + */ + ClearEditorsInContainer(container: Object, validationGroup: string, clearInvisibleEditors: boolean): void; + /** + * Assigns a null value to all visible editors located within a specified container, and belonging to a specific validation group. + * @param container An HTML element specifying the container of editors to be validated. + * @param validationGroup A string value specifying the validation group's name. + */ + ClearEditorsInContainer(container: Object, validationGroup: string): void; + /** + * Assigns a null value to all visible editors located within a specified container. + * @param container An HTML element specifying the container of editors to be validated. + */ + ClearEditorsInContainer(container: Object): void; + /** + * Assigns a null value to all editors which are located within the specified container object, and belonging to a specific validation group, dependent on the visibility state specified. + * @param containerId A string value specifying the editor container's identifier. + * @param validationGroup A string value specifying the validatiion group's name. + * @param clearInvisibleEditors true to clear both visible and invisible editors that belong to the specified container and group; false to clear only visible editors. + */ + ClearEditorsInContainerById(containerId: string, validationGroup: string, clearInvisibleEditors: boolean): void; + /** + * Assigns a null value to all visible editors that are located within the specified container object, and belonging to a specific validation group. + * @param containerId A string value specifying the editor container's identifier. + * @param validationGroup A string value specifying the validatiion group's name. + */ + ClearEditorsInContainerById(containerId: string, validationGroup: string): void; + /** + * Assigns a null value to all visible editors that are located within the specified container object. + * @param containerId A string value specifying the editor container's identifier. + */ + ClearEditorsInContainerById(containerId: string): void; + /** + * Assigns a null value to all editors which belong to a specific validation group, dependent on the visibility state specified. + * @param validationGroup A string value specifying the validation group's name. + * @param clearInvisibleEditors true to clear both visible and invisible editors that belong to the specified validation group; false to clear only visible editors. + */ + ClearGroup(validationGroup: string, clearInvisibleEditors: boolean): void; + /** + * Assigns a null value to all visible editors which belong to a specific validation group. + * @param validationGroup A string value specifying the validation group's name. + */ + ClearGroup(validationGroup: string): void; + /** + * Performs validation of all editors in a specified visibility state, which are located within a specified container and belong to a specific validation group. + * @param container An HTML element specifying the container of editors to be validated. + * @param validationGroup A string value that specifies the validation group's name. + * @param validateInvisibleEditors true to validate both visible and invisible editors that belong to the specified container and group; false to validate only visible editors. + */ + ValidateEditorsInContainer(container: Object, validationGroup: string, validateInvisibleEditors: boolean): boolean; + /** + * Performs validation of visible editors that are located within the specified container and belong to a specific validation group. + * @param container An HTML element specifying the container of editors to be validated. + * @param validationGroup A string value that specifies the validation group's name. + */ + ValidateEditorsInContainer(container: Object, validationGroup: string): boolean; + /** + * Performs validation of visible editors that are located within the specified container. + * @param container An HTML element specifying the container of editors to be validated. + */ + ValidateEditorsInContainer(container: Object): boolean; + /** + * Performs validation of the editors which are located within the specified container and belong to a specific validation group, dependent on the visibility state specified. + * @param containerId A string value specifying the editor container's identifier. + * @param validationGroup A string value that specifies the validation group's name. + * @param validateInvisibleEditors true to validate both visible and invisible editors that belong to the specified container and group; false to validate only visible editors. + */ + ValidateEditorsInContainerById(containerId: string, validationGroup: string, validateInvisibleEditors: boolean): boolean; + /** + * Performs validation of visible editors that are located within the specified container and belong to a specific validation group. + * @param containerId A string value that specifies the container's unique identifier. + * @param validationGroup A string value that specifies the validation group's name. + */ + ValidateEditorsInContainerById(containerId: string, validationGroup: string): boolean; + /** + * Performs validation of visible editors which are located within the specified container. + * @param containerId A string value that specifies the container's unique identifier. + */ + ValidateEditorsInContainerById(containerId: string): boolean; + /** + * Performs validation of editors contained within the specified validation group, dependent on the editor visibility state specified. + * @param validationGroup A string value specifying the validation group's name. + * @param validateInvisibleEditors true to validate both visible and invisible editors that belong to the specified validation group; false to validate only visible editors. + */ + ValidateGroup(validationGroup: string, validateInvisibleEditors: boolean): boolean; + /** + * Performs validation of visible editors contained within the specified validation group. + * @param validationGroup A string value specifying the validation group's name. + */ + ValidateGroup(validationGroup: string): boolean; + /** + * Verifies whether the editors in a specified visibility state, which are located within a specified container and belong to a specific validation group, are valid. + * @param container An HTML element specifying the container of editors to be validated. + * @param validationGroup A string value that specifies the validation group's name. + * @param checkInvisibleEditors true to check both visible and invisible editors that belong to the specified container; false to check only visible editors. + */ + AreEditorsValid(container: Object, validationGroup: string, checkInvisibleEditors: boolean): boolean; + /** + * Verifies whether visible editors, which are located within a specified container and belong to a specific validation group, are valid. + * @param container An HTML element specifying the container of editors to be validated. + * @param validationGroup A string value that specifies the validation group's name. + */ + AreEditorsValid(container: Object, validationGroup: string): boolean; + /** + * Verifies whether visible editors located in a specified container are valid. + * @param container An HTML element specifying the container of editors to be validated. + */ + AreEditorsValid(container: Object): boolean; + /** + * Verifies whether the editors with the specified settings are valid. + * @param containerId A string value that specifies the container's unique identifier. + * @param validationGroup A string value that specifies the validation group's name. + * @param checkInvisibleEditors true to check both visible and invisible editors that belong to the specified container; false to check only visible editors. + */ + AreEditorsValid(containerId: string, validationGroup: string, checkInvisibleEditors: boolean): boolean; + /** + * Verifies whether visible editors with the specified settings are valid. + * @param containerId A string value that specifies the container's unique identifier. + * @param validationGroup A string value that specifies the validation group's name. + */ + AreEditorsValid(containerId: string, validationGroup: string): boolean; + /** + * Verifies whether visible editors with the specified settings are valid. + * @param containerId A string value that specifies the container's unique identifier. + */ + AreEditorsValid(containerId: string): boolean; + /** + * Verifies whether visible editors on a page are valid. + */ + AreEditorsValid(): boolean; +} +interface ASPxClientBinaryImageStatic extends ASPxClientEditStatic { + /** + * 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): ASPxClientBinaryImage; +} +interface ASPxClientButtonStatic 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): ASPxClientButton; +} +interface ASPxClientCalendarStatic extends ASPxClientEditStatic { + /** + * 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): ASPxClientCalendar; +} +interface ASPxClientCaptchaStatic 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): ASPxClientCaptcha; +} +interface ASPxClientCheckBoxStatic extends ASPxClientEditStatic { + /** + * 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): ASPxClientCheckBox; +} +interface ASPxClientRadioButtonStatic extends ASPxClientCheckBoxStatic { + /** + * 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): ASPxClientRadioButton; +} +interface ASPxClientTextEditStatic extends ASPxClientEditStatic { +} +interface ASPxClientTextBoxBaseStatic extends ASPxClientTextEditStatic { +} +interface ASPxClientButtonEditBaseStatic extends ASPxClientTextBoxBaseStatic { +} +interface ASPxClientDropDownEditBaseStatic extends ASPxClientButtonEditBaseStatic { +} +interface ASPxClientColorEditStatic extends ASPxClientDropDownEditBaseStatic { + /** + * 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): ASPxClientColorEdit; +} +interface ASPxClientComboBoxStatic extends ASPxClientDropDownEditBaseStatic { + /** + * 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): ASPxClientComboBox; +} +interface ASPxClientDateEditStatic extends ASPxClientDropDownEditBaseStatic { + /** + * 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): ASPxClientDateEdit; +} +interface ASPxClientDropDownEditStatic extends ASPxClientDropDownEditBaseStatic { + /** + * 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): ASPxClientDropDownEdit; +} +interface ASPxClientFilterControlStatic 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): ASPxClientFilterControl; +} +interface ASPxClientListEditStatic extends ASPxClientEditStatic { +} +interface ASPxClientListBoxStatic extends ASPxClientListEditStatic { + /** + * 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): ASPxClientListBox; +} +interface ASPxClientCheckListBaseStatic extends ASPxClientListEditStatic { +} +interface ASPxClientRadioButtonListStatic extends ASPxClientCheckListBaseStatic { + /** + * 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): ASPxClientRadioButtonList; +} +interface ASPxClientCheckBoxListStatic extends ASPxClientCheckListBaseStatic { + /** + * 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): ASPxClientCheckBoxList; +} +interface ASPxClientProgressBarStatic extends ASPxClientEditBaseStatic { + /** + * 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): ASPxClientProgressBar; +} +interface ASPxClientSpinEditBaseStatic extends ASPxClientButtonEditBaseStatic { +} +interface ASPxClientSpinEditStatic extends ASPxClientSpinEditBaseStatic { + /** + * 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): ASPxClientSpinEdit; +} +interface ASPxClientTimeEditStatic extends ASPxClientSpinEditBaseStatic { + /** + * 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): ASPxClientTimeEdit; +} +interface ASPxClientStaticEditStatic extends ASPxClientEditBaseStatic { +} +interface ASPxClientHyperLinkStatic extends ASPxClientStaticEditStatic { + /** + * 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): ASPxClientHyperLink; +} +interface ASPxClientImageBaseStatic extends ASPxClientStaticEditStatic { +} +interface ASPxClientImageStatic extends ASPxClientImageBaseStatic { + /** + * 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): ASPxClientImage; +} +interface ASPxClientLabelStatic extends ASPxClientStaticEditStatic { + /** + * 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): ASPxClientLabel; +} +interface ASPxClientTextBoxStatic extends ASPxClientTextBoxBaseStatic { + /** + * 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): ASPxClientTextBox; +} +interface ASPxClientMemoStatic extends ASPxClientTextEditStatic { + /** + * 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): ASPxClientMemo; +} +interface ASPxClientButtonEditStatic extends ASPxClientButtonEditBaseStatic { + /** + * 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): 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 { + /** + * 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): ASPxClientTrackBar; +} +interface ASPxClientValidationSummaryStatic extends ASPxClientControlStatic { +} +interface ASPxClientGaugeControlStatic 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): ASPxClientGaugeControl; +} +interface ASPxClientGridBaseStatic extends ASPxClientControlStatic { +} +interface ASPxClientGridViewCallbackCommandStatic { + /** + * Default value: "NEXTPAGE" + */ + NextPage: string; + /** + * Default value: "PREVPAGE" + */ + PreviousPage: string; + /** + * Default value: "GOTOPAGE" + */ + GotoPage: string; + /** + * Default value: "SELECTROWS" + */ + SelectRows: string; + /** + * Default value: "SELECTROWSKEY" + */ + SelectRowsKey: string; + /** + * Default value: "SELECTION" + */ + Selection: string; + /** + * Default value: "FOCUSEDROW" + */ + FocusedRow: string; + /** + * Default value: "GROUP" + */ + Group: string; + /** + * Default value: "UNGROUP" + */ + UnGroup: string; + /** + * Default value: "SORT" + */ + Sort: string; + /** + * Default value: "COLUMNMOVE" + */ + ColumnMove: string; + /** + * Default value: "COLLAPSEALL" + */ + CollapseAll: string; + /** + * Default value: "EXPANDALL" + */ + ExpandAll: string; + /** + * Default value: "EXPANDROW" + */ + ExpandRow: string; + /** + * Default value: "COLLAPSEROW" + */ + CollapseRow: string; + /** + * Default value: "HIDEALLDETAIL" + */ + HideAllDetail: string; + /** + * Default value: "SHOWALLDETAIL" + */ + ShowAllDetail: string; + /** + * Default value: "SHOWDETAILROW" + */ + ShowDetailRow: string; + /** + * Default value: "HIDEDETAILROW" + */ + HideDetailRow: string; + /** + * Default value: "PAGERONCLICK" + */ + PagerOnClick: string; + /** + * Default value: "APPLYFILTER" + */ + ApplyFilter: string; + /** + * Default value: "APPLYCOLUMNFILTER" + */ + ApplyColumnFilter: string; + /** + * Default value: "APPLYMULTICOLUMNFILTER" + */ + ApplyMultiColumnFilter: string; + /** + * Default value: "APPLYHEADERCOLUMNFILTER" + */ + ApplyHeaderColumnFilter: string; + /** + * Default value: "APPLYSEARCHPANELFILTER" + */ + ApplySearchPanelFilter: string; + /** + * Default value: "FILTERROWMENU" + */ + FilterRowMenu: string; + /** + * Default value: "STARTEDIT" + */ + StartEdit: string; + /** + * Default value: "CANCELEDIT" + */ + CancelEdit: string; + /** + * Default value: "UPDATEEDIT" + */ + UpdateEdit: string; + /** + * Default value: "ADDNEWROW" + */ + AddNewRow: string; + /** + * Default value: "DELETEROW" + */ + DeleteRow: string; + /** + * Default value: "CUSTOMBUTTON" + */ + CustomButton: string; + /** + * Default value: "CUSTOMCALLBACK" + */ + CustomCallback: string; + /** + * Default value: "SHOWFILTERCONTROL" + */ + ShowFilterControl: string; + /** + * Default value: "CLOSEFILTERCONTROL" + */ + CloseFilterControl: string; + /** + * Default value: "SETFILTERENABLED" + */ + SetFilterEnabled: string; + /** + * Default value: "REFRESH" + */ + Refresh: string; + /** + * Default value: "SELFIELDVALUES" + */ + SelFieldValues: string; + /** + * Default value: "ROWVALUES" + */ + RowValues: string; + /** + * Default value: "PAGEROWVALUES" + */ + PageRowValues: string; + /** + * Default value: "FILTERPOPUP" + */ + FilterPopup: string; + /** + * Default value: "CONTEXTMENU" + */ + ContextMenu: string; + /** + * Default value: "CUSTOMVALUES" + */ + CustomValues: string; +} +interface ASPxClientGridLookupStatic extends ASPxClientDropDownEditBaseStatic { + /** + * 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): ASPxClientGridLookup; +} +interface ASPxClientCardViewStatic extends ASPxClientGridBaseStatic { + /** + * 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): ASPxClientCardView; +} +interface ASPxClientGridViewStatic extends ASPxClientGridBaseStatic { + /** + * 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): ASPxClientGridView; +} +interface ASPxClientVerticalGridStatic extends ASPxClientGridBaseStatic { + /** + * 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): ASPxClientVerticalGrid; +} +interface ASPxClientVerticalGridCallbackCommandStatic { + /** + * Default value: "EXPANDROW" + */ + ExpandRow: string; +} +interface ASPxClientCommandConstsStatic { + /** + * Identifies a command that shows a search panel. + * Value: "showsearchpanel" + */ + SHOWSEARCHPANEL_COMMAND: string; + /** + * Identifies a command that invokes the Find and Replace dialog. + * Value: "findandreplacedialog" + */ + FINDANDREPLACE_DIALOG_COMMAND: string; + /** + * Identifies a command that applies the bold text formatting to the selected text. If it's already applied, cancels it. + * Value: "bold" + */ + BOLD_COMMAND: string; + /** + * Identifies a command that makes the selected text italic or regular type depending on the current state. + * Value: "italic" + */ + ITALIC_COMMAND: string; + /** + * Identifies a command that applies the underline text formatting to the selected text. If it's already applied, cancels it. + * Value: "underline" + */ + UNDERLINE_COMMAND: string; + /** + * Identifies a command that applies the strike through text formatting to the selected text. If it's already applied, cancels it. + * Value: "strikethrough" + */ + STRIKETHROUGH_COMMAND: string; + /** + * Identifies a command that applies the superscript text formatting to the selected text. If it's already applied, cancels it. + * Value: "superscript" + */ + SUPERSCRIPT_COMMAND: string; + /** + * Identifies a command that applies the subscript text formatting to the selected text. If it's already applied, cancels it. + * Value: "subscript" + */ + SUBSCRIPT_COMMAND: string; + /** + * Identifies a command that centers the content of the currently focused paragraph. + * Value: "justifycenter" + */ + JUSTIFYCENTER_COMMAND: string; + /** + * Identifies a command that left justifies the content of the currently focused paragraph. + * Value: "justifyleft" + */ + JUSTIFYLEFT_COMMAND: string; + /** + * Identifies a command that creates an indent for the selected paragarph. + * Value: "indent" + */ + INDENT_COMMAND: string; + /** + * Identifies a command that creates an outdent for the focused paragarph. + * Value: "outdent" + */ + OUTDENT_COMMAND: string; + /** + * Identifies a command that right justifies the content of the currently focused paragraph. + * Value: "justifyright" + */ + JUSTIFYRIGHT_COMMAND: string; + /** + * Identifies a command that fully justifies the content of the currently focused paragraph (aligned with both the left and right margines). + * Value: "justifyfull" + */ + JUSTIFYFULL_COMMAND: string; + /** + * Identifies a command that changes the size of the selected text. + * Value: "fontsize" + */ + FONTSIZE_COMMAND: string; + /** + * Identifies a command that changes the font of the selected text. + * Value: "fontname" + */ + FONTNAME_COMMAND: string; + /** + * Identifies a command that changes the color of a fore color pickers and sets the selected text fore color. + * Value: "forecolor" + */ + FONTCOLOR_COMMAND: string; + /** + * Identifies a command that changes the color of a back color pickers and sets the selected text back color. + * Value: "backcolor" + */ + BACKCOLOR_COMMAND: string; + /** + * Identifies a command that wraps the selected paragraph in the specified html tag. + * Value: "formatblock" + */ + FORMATBLOCK_COMMAND: string; + /** + * Identifies a command that wraps the currently selected text content in a specific html tag with a css class assigned to it. + * Value: "applycss" + */ + APPLYCSS_COMMAND: string; + /** + * Identifies a command that removes all formatting from the selected content. + * Value: "removeformat" + */ + REMOVEFORMAT_COMMAND: string; + /** + * Identifies a command that cancels the last action. + * Value: "undo" + */ + UNDO_COMMAND: string; + /** + * Identifies a command that returns a previously canceled action. + * Value: "redo" + */ + REDO_COMMAND: string; + /** + * Identifies a command that copies the selected content. + * Value: "copy" + */ + COPY_COMMAND: string; + /** + * Identifies a command that pastes the content of the clipboard at the current cursor position. + * Value: "paste" + */ + PASTE_COMMAND: string; + /** + * Identifies a command that pastes a specified content taking into account that it was copied from Word. + * Value: "pastefromword" + */ + PASTEFROMWORD_COMMAND: string; + /** + * Identifies a command that invokes the Paste from Word dialog. + * Value: "pastefromworddialog" + */ + PASTEFROMWORDDIALOG_COMMAND: string; + /** + * Identifies a command that cuts the selected content. + * Value: "cut" + */ + CUT_COMMAND: string; + /** + * Identifies a command that selects all content inside the html editor. + * Value: "selectall" + */ + SELECT_ALL: string; + /** + * Identifies a command that deletes the selected content. + * Value: "delete" + */ + DELETE_COMMAND: string; + /** + * Identifies a command that can be used to correctly insert HTML code into the editor. + * Value: "pastehtml" + */ + PASTEHTML_COMMAND: string; + /** + * Identifies a command that inserts a new ordered list. + * Value: "insertorderedlist" + */ + INSERTORDEREDLIST_COMMAND: string; + /** + * Identifies a command that inserts a new unordered list. + * Value: "insertunorderedlist" + */ + INSERTUNORDEREDLIST_COMMAND: string; + /** + * Identifies a command that restarts the current ordered list. + * Value: "restartorderedlist" + */ + RESTARTORDEREDLIST_COMMAND: string; + /** + * Identifies a command that continues a disrupted ordered list. + * Value: "continueorderedlist" + */ + CONTINUEORDEREDLIST_COMMAND: string; + /** + * Identifies a command that removes a hyperlink from the selected text or image. + * Value: "unlink" + */ + UNLINK_COMMAND: string; + /** + * Identifies a command that inserts a new hyperlink. + * Value: "insertlink" + */ + INSERTLINK_COMMAND: string; + /** + * Identifies a command that inserts a new image. + * Value: "insertimage" + */ + INSERTIMAGE_COMMAND: string; + /** + * Identifies a command that changes the selected image. + * Value: "changeimage" + */ + CHANGEIMAGE_COMMAND: string; + /** + * Identifies a command that initiates spell checking. + * Value: "checkspelling" + */ + CHECKSPELLING_COMMAND: string; + /** + * Identifies a command that invokes the Insert Image dialog. + * Value: "insertimagedialog" + */ + INSERTIMAGE_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Change Image dialog. + * Value: "changeimagedialog" + */ + CHANGEIMAGE_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Insert Link dialog. + * Value: "insertlinkdialog" + */ + INSERTLINK_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Change Link dialog. + * Value: "changelinkdialog" + */ + CHANGELINK_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Insert Table dialog. + * Value: "inserttabledialog" + */ + INSERTTABLE_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Table Properties dialog. + * Value: "tablepropertiesdialog" + */ + TABLEPROPERTIES_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Cell Properties dialog. + * Value: "tablecellpropertiesdialog" + */ + TABLECELLPROPERTIES_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Column Properties dialog. + * Value: "tablecolumnpropertiesdialog" + */ + TABLECOLUMNPROPERTIES_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Row Properties dialog. + * Value: "tablerowpropertiesdialog" + */ + TABLEROWPROPERTIES_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes a default browser Print dialog, allowing an end-user to print the content of the html editor. + * Value: "print" + */ + PRINT_COMMAND: string; + /** + * Identifies a command that toggles the full-screen mode. + * Value: "fullscreen" + */ + FULLSCREEN_COMMAND: string; + /** + * Identifies a command that inserts a new table. + * Value: "inserttable" + */ + INSERTTABLE_COMMAND: string; + /** + * Identifies a command that changes the selected table. + * Value: "changetable" + */ + CHANGETABLE_COMMAND: string; + /** + * Identifies a command that changes the selected table cell. + * Value: "changetablecell" + */ + CHANGETABLECELL_COMMAND: string; + /** + * Identifies a command that changes the selected table row. + * Value: "changetablerow" + */ + CHANGETABLEROW_COMMAND: string; + /** + * Identifies a command that changes the selected table column. + * Value: "changetablecolumn" + */ + CHANGETABLECOLUMN_COMMAND: string; + /** + * Identifies a command that deletes the currently selected table. + * Value: "deletetable" + */ + DELETETABLE_COMMAND: string; + /** + * Identifies a command that deletes the currently selected table row. + * Value: "deletetablerow" + */ + DELETETABLEROW_COMMAND: string; + /** + * Identifies a command that deletes the currently selected table column. + * Value: "deletetablecolumn" + */ + DELETETABLECOLUMN_COMMAND: string; + /** + * Identifies a command that inserts a new column to the left from the currently focused one. + * Value: "inserttablecolumntoleft" + */ + INSERTTABLECOLUMNTOLEFT_COMMAND: string; + /** + * Identifies a command that inserts a new column to the right from the currently focused one. + * Value: "inserttablecolumntoright" + */ + INSERTTABLECOLUMNTORIGHT_COMMAND: string; + /** + * Identifies a command that inserts a new row below the currently focused one. + * Value: "inserttablerowbelow" + */ + INSERTTABLEROWBELOW_COMMAND: string; + /** + * Identifies a command that inserts a new row above the currently focused one. + * Value: "inserttablerowabove" + */ + INSERTTABLEROWABOVE_COMMAND: string; + /** + * Identifies a command that splits the current table cell horizontally. + * Value: "splittablecellhorizontally" + */ + SPLITTABLECELLHORIZONTALLY_COMMAND: string; + /** + * Identifies a command that splits the current table cell vertically. + * Value: "splittablecellvertically" + */ + SPLITTABLECELLVERTICALLY_COMMAND: string; + /** + * Identifies a command that merges the focused table cell with the one to the right. + * Value: "mergetablecellright" + */ + MERGETABLECELLRIGHT_COMMAND: string; + /** + * Identifies a command that merges the focused table cell with the one below. + * Value: "mergetablecelldown" + */ + MERGETABLECELLDOWN_COMMAND: string; + /** + * Identifies a command that invokes a custom dialog. + * Value: "customdialog" + */ + CUSTOMDIALOG_COMMAND: string; + /** + * Identifies a command that exports the html editor content. + * Value: "export" + */ + EXPORT_COMMAND: string; + /** + * Identifies a command that inserts a new audio element. + * Value: "insertaudio" + */ + INSERTAUDIO_COMMAND: string; + /** + * Identifies a command that inserts a new video. + * Value: "insertvideo" + */ + INSERTVIDEO_COMMAND: string; + /** + * Identifies a command that inserts a new flash element. + * Value: "insertflash" + */ + INSERTFLASH_COMMAND: string; + /** + * Identifies a command that inserts a new YouTube video. + * Value: "insertyoutubevideo" + */ + INSERTYOUTUBEVIDEO_COMMAND: string; + /** + * Identifies a command that changes the selected audio element. + * Value: "changeaudio" + */ + CHANGEAUDIO_COMMAND: string; + /** + * Identifies a command that changes the selected video element. + * Value: "changevideo" + */ + CHANGEVIDEO_COMMAND: string; + /** + * Identifies a command that changes the selected flash element. + * Value: "changeflash" + */ + CHANGEFLASH_COMMAND: string; + /** + * Identifies a command that changes the selected YouTube video element. + * Value: "changeyoutubevideo" + */ + CHANGEYOUTUBEVIDEO_COMMAND: string; + /** + * Identifies a command that invokes the Insert Audio dialog. + * Value: "insertaudiodialog" + */ + INSERTAUDIO_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Insert Video dialog. + * Value: "insertvideodialog" + */ + INSERTVIDEO_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Insert Flash dialog. + * Value: "insertflashdialog" + */ + INSERTFLASH_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Insert YouTube Video dialog. + * Value: "insertyoutubevideodialog" + */ + INSERTYOUTUBEVIDEO_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Change Audio dialog. + * Value: "changeaudiodialog" + */ + CHANGEAUDIO_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Change Video dialog. + * Value: "changevideodialog" + */ + CHANGEVIDEO_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Change Flash dialog. + * Value: "changeflash" + */ + CHANGEFLASH_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Change YouTube Video dialog. + * Value: "changeyoutubevideodialog" + */ + CHANGEYOUTUBEVIDEO_DIALOG_COMMAND: string; + /** + * Identifies a command that pastes the content of the clipboard to the current cursor position, taking into account that the PasteMode property is set to SourceFormatting. + * Value: "pastehtmlsourceformatting" + */ + PASTEHTMLSOURCEFORMATTING_COMMAND: string; + /** + * Identifies a command that pastes the content of the clipboard to the current cursor position, taking into account that the PasteMode property is set to PlainText. + * Value: "pastehtmlplaintext" + */ + PASTEHTMLPLAINTEXT_COMMAND: string; + /** + * Identifies a command that pastes the content of the clipboard to the current cursor position, taking into account that the PasteMode property is set to MergeFormatting. + * Value: "pastehtmlmergeformatting" + */ + PASTEHTMLMERGEFORMATTING_COMMAND: string; + /** + * Identifies a command that inserts a new placeholder. + * Value: "insertplaceholder" + */ + INSERTPLACEHOLDER_COMMAND: string; + /** + * Identifies a command that changes the selected placeholder. + * Value: "changeplaceholder" + */ + CHANGEPLACEHOLDER_COMMAND: string; + /** + * Identifies a command that invokes the Insert Placeholder dialog. + * Value: "insertplaceholderdialog" + */ + INSERTPLACEHOLDER_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Change Placeholder dialog. + * Value: "changeplaceholderdialog" + */ + CHANGEPLACEHOLDER_DIALOG_COMMAND: string; + /** + * Identifies a command that updates the editor content. + * Value: "updatedocument" + */ + UPDATEDOCUMENT_COMMAND: string; + /** + * Identifies a command that changes properties of the element selected in the tag inspector. + * Value: "changeelementproperties" + */ + CHANGEELEMENTPROPERTIES_COMMAND: string; + /** + * Identifies a command that invokes the Change Element Properties dialog. + * Value: "changeelementpropertiesdialog" + */ + CHANGEELEMENTPROPERTIES_DIALOG_COMMAND: string; + /** + * Identifies a command that comments the selected HTML code. If no code is selected, it comments the focused tag. + * Value: "comment" + */ + COMMENT_COMMAND: string; + /** + * Identifies a command that uncomments the selected HTML code. If no code is selected, the command uncomments the currently focused tag. + * Value: "uncomment" + */ + UNCOMMENTHTML_COMMAND: string; + /** + * Identifies a command that formats the current HTML document. + * Value: "formatdocument" + */ + FORMATDOCUMENT_COMMAND: string; + /** + * Identifies a command that applies the indent formatting to the selected content. + * Value: "indent" + */ + INDENTLINE_COMMAND: string; + /** + * Identifies a command that applies the outdent formatting to the focused content. + * Value: "outdent" + */ + OUTDENTLINE_COMMAND: string; + /** + * Identifies a command that collapses the selected HTML tag. + * Value: "collapsetag" + */ + COLLAPSETAG_COMMAND: string; + /** + * Identifies a command that expands the selected HTML tag. + * Value: "expandtag" + */ + EXPANDTAG_COMMAND: string; + /** + * Identifies a command that shows intellisense for the HTML code editor. + * Value: "showintellisense" + */ + SHOWINTELLISENSE_COMMAND: string; +} +interface ASPxClientHtmlEditorStatic 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): ASPxClientHtmlEditor; + /** + * Programmatically closes a custom dialog, supplying it with specific parameters. + * @param status An object representing a custom dialog's closing status. + * @param data An object representing custom data associated with a custom dialog. + */ + CustomDialogComplete(status: Object, data: Object): void; +} +interface ASPxClientHtmlEditorMediaPreloadModeStatic { + /** + * The browser does not load a media file when the page loads. + */ + None: string; + /** + * The browser loads the entire video when the page loads. + */ + Auto: string; + /** + * The browser loads only metadata when the page loads. + */ + Metadata: string; +} +interface ASPxClientPivotGridStatic 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): ASPxClientPivotGrid; +} +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 { + /** + * Returns the date part of the specified DateTime value. + * @param date A DateTime object from which to extract the date. + */ + TruncToDate(date: Date): Date; + /** + * Returns the day time part of the specified DateTime value. + * @param date A DateTime object from which to extract the day time. + */ + ToDayTime(date: Date): any; + /** + * + * @param date + * @param dayCount + */ + AddDays(date: Date, dayCount: number): Date; + /** + * Adds the specified timespan to a DateTime object and returns the result. + * @param date A DateTime object to which to add a timespan. + * @param timeSpan A TimeSpan object specifying the timespan to add. + */ + AddTimeSpan(date: Date, timeSpan: any): Date; + /** + * Rounds a DateTime value up to the nearest interval. + * @param date A DateTime object containing a value to round. + * @param spanInMs A TimeSpan object specifying an interval to which to round. + */ + CeilDateTime(date: Date, spanInMs: any): Date; +} +interface ASPxClientWeekDaysCheckEditStatic extends ASPxClientControlStatic { +} +interface ASPxClientRecurrenceRangeControlStatic extends ASPxClientControlStatic { +} +interface ASPxClientRecurrenceControlBaseStatic extends ASPxClientControlStatic { +} +interface ASPxClientDailyRecurrenceControlStatic extends ASPxClientRecurrenceControlBaseStatic { +} +interface ASPxClientWeeklyRecurrenceControlStatic extends ASPxClientRecurrenceControlBaseStatic { +} +interface ASPxClientMonthlyRecurrenceControlStatic extends ASPxClientRecurrenceControlBaseStatic { +} +interface ASPxClientYearlyRecurrenceControlStatic extends ASPxClientRecurrenceControlBaseStatic { +} +interface ASPxClientRecurrenceTypeEditStatic extends ASPxClientRadioButtonListStatic { +} +interface ASPxClientTimeIntervalStatic { + /** + * Gets the duration of a time interval between two points in time. + * @param start A DateTime object specifying the starting point of the time interval. + * @param end A DateTime object specifying the ending point of the time interval. + */ + CalculateDuration(start: Date, end: Date): number; +} +interface ASPxClientSchedulerStatic 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): ASPxClientScheduler; +} +interface ASPxClientSpellCheckerStatic 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): 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 { + /** + * 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): ASPxClientTreeList; +} +interface MVCxClientCalendarStatic extends ASPxClientCalendarStatic { + /** + * 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): MVCxClientCalendar; +} +interface MVCxClientCallbackPanelStatic extends ASPxClientCallbackPanelStatic { + /** + * 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): MVCxClientCallbackPanel; +} +interface MVCxClientCardViewStatic extends ASPxClientCardViewStatic { + /** + * 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): MVCxClientCardView; +} +interface MVCxClientChartStatic extends ASPxClientWebChartControlStatic { + /** + * 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): MVCxClientChart; +} +interface MVCxClientComboBoxStatic 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): MVCxClientComboBox; +} +interface MVCxClientDataViewStatic extends ASPxClientDataViewStatic { + /** + * 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): MVCxClientDataView; +} +interface MVCxClientDateEditStatic extends ASPxClientDateEditStatic { + /** + * 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): MVCxClientDateEdit; +} +interface MVCxClientDockManagerStatic extends ASPxClientDockManagerStatic { + /** + * 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): MVCxClientDockManager; +} +interface MVCxClientDockPanelStatic extends ASPxClientDockPanelStatic { + /** + * 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): MVCxClientDockPanel; +} +interface MVCxClientFileManagerStatic extends ASPxClientFileManagerStatic { + /** + * 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): MVCxClientFileManager; +} +interface MVCxClientGridViewStatic extends ASPxClientGridViewStatic { + /** + * 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): MVCxClientGridView; +} +interface MVCxClientHtmlEditorStatic extends ASPxClientHtmlEditorStatic { + /** + * 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): MVCxClientHtmlEditor; +} +interface MVCxClientImageGalleryStatic extends ASPxClientImageGalleryStatic { + /** + * 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): MVCxClientImageGallery; +} +interface MVCxClientListBoxStatic extends ASPxClientListBoxStatic { + /** + * 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): MVCxClientListBox; +} +interface MVCxClientNavBarStatic extends ASPxClientNavBarStatic { + /** + * 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): MVCxClientNavBar; +} +interface MVCxClientPivotGridStatic extends ASPxClientPivotGridStatic { + /** + * 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): MVCxClientPivotGrid; +} +interface MVCxClientPopupControlStatic extends ASPxClientPopupControlStatic { + /** + * 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): MVCxClientPopupControl; +} +interface MVCxClientDocumentViewerStatic extends ASPxClientDocumentViewerStatic { +} +interface MVCxClientReportViewerStatic extends ASPxClientReportViewerStatic { +} +interface MVCxClientReportDesignerStatic extends ASPxClientReportDesignerStatic { +} +interface MVCxClientRichEditStatic extends ASPxClientRichEditStatic { + /** + * 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): MVCxClientRichEdit; +} +interface MVCxClientRoundPanelStatic extends ASPxClientRoundPanelStatic { + /** + * 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): MVCxClientRoundPanel; +} +interface MVCxClientSchedulerStatic extends ASPxClientSchedulerStatic { + /** + * 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): MVCxClientScheduler; +} +interface MVCxSchedulerToolTipTypeStatic { + Appointment: number; + AppointmentDrag: number; + Selection: number; +} +interface MVCxClientSpreadsheetStatic extends ASPxClientSpreadsheetStatic { + /** + * 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): MVCxClientSpreadsheet; +} +interface MVCxClientPageControlStatic extends ASPxClientPageControlStatic { + /** + * 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): MVCxClientPageControl; +} +interface MVCxClientTokenBoxStatic extends ASPxClientTokenBoxStatic { + /** + * 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): MVCxClientTokenBox; +} +interface MVCxClientTreeListStatic extends ASPxClientTreeListStatic { + /** + * 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): MVCxClientTreeList; +} +interface MVCxClientTreeViewStatic extends ASPxClientTreeViewStatic { + /** + * 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): MVCxClientTreeView; +} +interface MVCxClientUploadControlStatic extends ASPxClientUploadControlStatic { + /** + * 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): MVCxClientUploadControl; +} +interface MVCxClientUtilsStatic { + /** + * Loads service resources (such as scripts, CSS files, etc.) required for DevExpress functionality to work properly after a non DevExpress callback has been processed on the server and returned back to the client. + */ + FinalizeCallback(): void; + /** + * Returns values of editors placed in the specified container. + * @param containerOrId A container of editors, or its ID. + */ + GetSerializedEditorValuesInContainer(containerOrId: Object): Object; + /** + * Returns values of editors placed in the specified container. + * @param containerOrId A container of editors, or its ID. + * @param processInvisibleEditors true to process both visible and invisible editors that belong to the specified container; false to process only visible editors. + */ + GetSerializedEditorValuesInContainer(containerOrId: Object, processInvisibleEditors: boolean): Object; +} +interface MVCxClientGlobalEventsStatic { + /** + * Dynamically connects the ControlsInitialized client event with an appropriate event handler function. + * @param handler A object representing the event handling function's content. + */ + AddControlsInitializedEventHandler(handler: ASPxClientControlsInitializedEventHandler): void; + /** + * Dynamically connects the BeginCallback client event with an appropriate event handler function. + * @param handler A object containing the event handling function's content. + */ + AddBeginCallbackEventHandler(handler: MVCxClientBeginCallbackEventHandler): void; + /** + * Dynamically connects the EndCallback client event with an appropriate event handler function. + * @param handler A object containing the event handling function's content. + */ + AddEndCallbackEventHandler(handler: ASPxClientEndCallbackEventHandler): void; + /** + * Dynamically connects the CallbackError client event with an appropriate event handler function. + * @param handler A object containing the event handling function's content. + */ + AddCallbackErrorHandler(handler: ASPxClientCallbackErrorEventHandler): void; +} +interface MVCxClientVerticalGridStatic extends ASPxClientVerticalGridStatic { + /** + * 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): MVCxClientVerticalGrid; +} +interface MVCxClientWebDocumentViewerStatic extends ASPxClientWebDocumentViewerStatic { +} +interface ASPxClientControlBaseStatic { + /** + * 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): ASPxClientControlBase; +} +interface ASPxClientControlStatic extends ASPxClientControlBaseStatic { + /** + * 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): ASPxClientControl; + /** + * Modifies the controls size on the page. + */ + AdjustControls(): void; + /** + * Modifies the controls size within the specified container. + * @param container An HTML element that is the container of the controls. + */ + AdjustControls(container: Object): void; + /** + * Returns a collection of client web control objects. + */ + GetControlCollection(): ASPxClientControlCollection; +} +interface ASPxClientCallbackStatic 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): ASPxClientCallback; +} +interface ASPxClientCallbackPanelStatic 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): ASPxClientCallbackPanel; +} +interface ASPxClientCloudControlStatic 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): ASPxClientCloudControl; +} +interface ASPxClientDataViewStatic 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): ASPxClientDataView; +} +interface ASPxClientDockManagerStatic 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): ASPxClientDockManager; +} +interface ASPxClientPopupControlBaseStatic extends ASPxClientControlStatic { +} +interface ASPxClientDockPanelStatic extends ASPxClientPopupControlBaseStatic { + /** + * 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): ASPxClientDockPanel; +} +interface ASPxClientDockZoneStatic 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): ASPxClientDockZone; +} +interface ASPxClientFileManagerStatic 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): ASPxClientFileManager; +} +interface ASPxClientFileManagerCommandConstsStatic { + /** + * The name of a command that is executed when an end-user renames an item. + */ + Rename: string; + /** + * The name of a command that is executed when an end-user moves an item. + */ + Move: string; + /** + * The name of a command that is executed when an end-user deletes an item. + */ + Delete: string; + /** + * The name of a command that is executed when an end-user creates a folder. + */ + Create: string; + /** + * The name of a command that is executed when an end-user uploads a file. + */ + Upload: string; + /** + * The name of a command that is executed when an end-user downloads an item. + */ + Download: string; + /** + * The name of a command that is executed when an end-user copies an item. + */ + Copy: string; + /** + * The name of a command that is executed when an end-user opens an item. + */ + Open: string; +} +interface ASPxClientFileManagerErrorConstsStatic { + /** + * The specified file is not found. Return Value: 0 + */ + FileNotFound: number; + /** + * The specified folder is not found. Return Value: 1 + */ + FolderNotFound: number; + /** + * Access is denied. Return Value: 2 + */ + AccessDenied: number; + /** + * Unspecified IO error occurs. Return Value: 3 + */ + UnspecifiedIO: number; + /** + * Unspecified error occurs. Return Value: 4 + */ + Unspecified: number; + /** + * The file/folder name is empty. Return Value: 5 + */ + EmptyName: number; + /** + * The operation was canceled. Return Value: 6 + */ + CanceledOperation: number; + /** + * The specified name contains invalid characters. Return Value: 7 + */ + InvalidSymbols: number; + /** + * The specified file extension is not allowed. Return Value: 8 + */ + WrongExtension: number; + /** + * The file/folder is being used by another process. Return Value: 9 + */ + UsedByAnotherProcess: number; + /** + * The specified file/folder already exists. Return Value: 10 + */ + AlreadyExists: number; +} +interface ASPxClientFormLayoutStatic 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): ASPxClientFormLayout; +} +interface ASPxClientHiddenFieldStatic 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): ASPxClientHiddenField; +} +interface ASPxClientImageGalleryStatic extends ASPxClientDataViewStatic { + /** + * 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): ASPxClientImageGallery; +} +interface ASPxClientImageSliderStatic 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): ASPxClientImageSlider; +} +interface ASPxClientImageZoomNavigatorStatic extends ASPxClientImageSliderStatic { +} +interface ASPxClientImageZoomStatic extends ASPxClientControlStatic { +} +interface ASPxClientLoadingPanelStatic 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): ASPxClientLoadingPanel; +} +interface ASPxClientMenuBaseStatic extends ASPxClientControlStatic { + /** + * Returns a collection of client menu objects. + */ + GetMenuCollection(): ASPxClientMenuCollection; +} +interface ASPxClientMenuStatic extends ASPxClientMenuBaseStatic { + /** + * 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): ASPxClientMenu; +} +interface ASPxClientTouchUIStatic { + /** + * Extends the specified element's functionality with scrolling via touch behavior (one finger) and the ability to display vertical and horizontal scroll bars. + * @param id A string value specifying the element's ID. + */ + MakeScrollable(id: string): ScrollExtender; + /** + * Extends the specified element's functionality with scrolling via touch behavior (one finger) and the ability to display vertical and horizontal scroll bars. + * @param element An object that specifies the required DOM element. + */ + MakeScrollable(element: Object): ScrollExtender; + /** + * Extends the specified element's functionality with scrolling via touch behavior (one finger) and customized scrollbar-related options. + * @param id A string value specifying the name of a DOM element that should be extended with the touch scrolling functionality. + * @param options An ASPxClientTouchUIOptions object that provides options affecting the touch scrolling functionality. + */ + MakeScrollable(id: string, options: ASPxClientTouchUIOptions): ScrollExtender; + /** + * Extends the specified element's functionality with scrolling via touch behavior (one finger) and customized scrollbar-related options. + * @param element An object specifying the DOM element to extend with the touch scrolling functionality. + * @param options An ASPxClientTouchUIOptions object that provides options affecting the touch scrolling functionality. + */ + MakeScrollable(element: Object, options: ASPxClientTouchUIOptions): ScrollExtender; +} +interface ASPxClientNavBarStatic 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): ASPxClientNavBar; +} +interface ASPxClientNewsControlStatic extends ASPxClientDataViewStatic { + /** + * 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): ASPxClientNewsControl; +} +interface ASPxClientObjectContainerStatic 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): ASPxClientObjectContainer; +} +interface ASPxClientPanelBaseStatic 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): ASPxClientPanelBase; +} +interface ASPxClientPanelStatic extends ASPxClientPanelBaseStatic { + /** + * 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): ASPxClientPanel; +} +interface ASPxClientPopupControlStatic extends ASPxClientPopupControlBaseStatic { + /** + * 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): ASPxClientPopupControl; + /** + * Returns a collection of client popup control objects. + */ + GetPopupControlCollection(): ASPxClientPopupControlCollection; +} +interface ASPxClientPopupControlResizeStateStatic { + /** + * A window has been resized. Returns 0. + */ + Resized: number; + /** + * A window has been collapsed. Returns 1. + */ + Collapsed: number; + /** + * A window has been expanded. Returns 2. + */ + Expanded: number; + /** + * A window has been maximized. Returns 3. + */ + Maximized: number; + /** + * A window has been restored after maximizing. Returns 4. + */ + RestoredAfterMaximized: number; +} +interface ASPxClientPopupControlCloseReasonStatic { + /** + * The window has been closed by an API. + */ + API: string; + /** + * An end-user clicks the close header button. + */ + CloseButton: string; + /** + * An end-user clicks outside the window's region + */ + OuterMouseClick: string; + /** + * An end-user moves the mouse pointer out of the window region. + */ + MouseOut: string; + /** + * An end-user presses the ESC key. + */ + Escape: string; +} +interface ASPxClientPopupMenuStatic extends ASPxClientMenuBaseStatic { + /** + * 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): ASPxClientPopupMenu; +} +interface ASPxClientRatingControlStatic 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): ASPxClientRatingControl; +} +interface ASPxClientRibbonStatic 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): ASPxClientRibbon; +} +interface ASPxClientRibbonStateStatic { + /** + * A ribbon is in the normal state. Returns 0 + */ + Normal: number; + /** + * A ribbon is minimized. Returns 1 + */ + Minimized: number; + /** + * A ribbon is temporarily shown. Returns 2 + */ + TemporaryShown: number; +} +interface ASPxClientRoundPanelStatic extends ASPxClientPanelBaseStatic { + /** + * 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): ASPxClientRoundPanel; +} +interface ASPxClientSplitterStatic 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): ASPxClientSplitter; +} +interface ASPxClientTabControlBaseStatic extends ASPxClientControlStatic { +} +interface ASPxClientTabControlStatic extends ASPxClientTabControlBaseStatic { + /** + * 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): ASPxClientTabControl; +} +interface ASPxClientPageControlStatic extends ASPxClientTabControlBaseStatic { + /** + * 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): ASPxClientPageControl; +} +interface ASPxClientTimerStatic 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): ASPxClientTimer; +} +interface ASPxClientTitleIndexStatic 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): ASPxClientTitleIndex; +} +interface ASPxClientTreeViewStatic 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): ASPxClientTreeView; +} +interface ASPxClientUploadControlStatic 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): ASPxClientUploadControl; +} +interface ASPxClientUtilsStatic { + /** + * Gets the user-agent string, which identifies the client browser and provides certain system details of the client computer. + * Value: A string value representing the browser's user-agent string. + */ + agent: string; + /** + * Gets a value that specifies whether the client browser is Opera. + * Value: true if the client browser is Opera; otherwise, false. + */ + opera: boolean; + /** + * Gets a value that specifies whether the client browser is Opera version 9. + * Value: true if the client browser is Opera version 9; otherwise, false. + */ + opera9: boolean; + /** + * Gets a value that specifies whether the client browser is Safari. + * Value: true if the client browser is Safari; otherwise, false. + */ + safari: boolean; + /** + * Gets a value that specifies whether the client browser is Safari version 3. + * Value: true if the client browser is Safari version 3; otherwise, false. + */ + safari3: boolean; + /** + * Gets a value that specifies whether the client browser is Safari, running under a MacOS operating system. + * Value: true if the client browser is Safari, running under a MacOS operating system; otherwise, false. + */ + safariMacOS: boolean; + /** + * Gets a value that specifies whether the client browser is Google Chrome. + * Value: true if the client browser is Google Chrome; otherwise, false. + */ + chrome: boolean; + /** + * Gets a value that specifies whether the client browser is Internet Explorer. + * Value: true if the client browser is Intenet Explorer; otherwise, false. + */ + ie: boolean; + /** + * Gets a value that specifies whether the client browser is Internet Explorer version 7. + * Value: true if the client browser is Intenet Explorer version 7; otherwise, false. + */ + ie7: boolean; + /** + * Gets a value that specifies whether the client browser is Firefox. + * Value: true if the client browser is Firefox; otherwise, false. + */ + firefox: boolean; + /** + * Gets a value that specifies whether the client browser is Firefox version 3. + * Value: true if the client browser is Firefox version 3; otherwise, false. + */ + firefox3: boolean; + /** + * Gets a value that specifies whether the client browser is Mozilla. + * Value: true if the client browser is Mozilla; otherwise, false. + */ + mozilla: boolean; + /** + * Gets a value that specifies whether the client browser is Netscape. + * Value: true if the client browser is Netscape; otherwise, false. + */ + netscape: boolean; + /** + * Gets a value that specifies a client browser's full version. + * Value: A double precision floating-point value that specifies a client browser's version. + */ + browserVersion: number; + /** + * Gets a value that specifies a client browser's major version. + * Value: An integer value that specifies a client browser's major version. + */ + browserMajorVersion: number; + /** + * Gets a value that specifies whether the application is run under a MacOS platform. + * Value: true if the application is run under the MacOS platform; otherwise, false. + */ + macOSPlatform: boolean; + /** + * Gets a value that specifies whether the application is run under the Windows platform. + * Value: true if the application is run under the Windows platform; otherwise, false. + */ + windowsPlatform: boolean; + /** + * Gets a value that specifies whether a client browser is based on WebKit. + * Value: true if the client browser is based on WebKit; otherwise, false. + */ + webKitFamily: boolean; + /** + * Gets a value that specifies whether a client browser is based on Netscape. + * Value: true if client browser is based on Netscape; otherwise, false. + */ + netscapeFamily: boolean; + /** + * Gets a value that specifies whether the client browser supports touch. + * Value: true if the client browser supports touch; otherwise, false. + */ + touchUI: boolean; + /** + * Gets a value that specifies whether the client browser supports the WebKit touch user interface. + * Value: true if the client browser supports the WebKit touch user interface; otherwise, false. + */ + webKitTouchUI: boolean; + /** + * Gets a value that specifies whether the client browser supports the Microsoft touch user interface. + * Value: true if the client browser supports the Microsoft touch user interface; otherwise, false. + */ + msTouchUI: boolean; + /** + * Gets a value that specifies whether the application is run under an iOS platform. + * Value: true if the application is run under the iOS platform; otherwise, false. + */ + iOSPlatform: boolean; + /** + * Gets a value that specifies whether the application is run under the Android platform. + * Value: true if the application is run under the Android platform; otherwise, false. + */ + androidPlatform: boolean; + /** + * Inserts the specified item into the specified array object. + * @param array An object that specifies the array to manipulate. + * @param element An object that specifies the array item to insert. + */ + ArrayInsert(array: Object[], element: Object): void; + /** + * Removes the specified item from the specified array object. + * @param array An object that specifies the array to manipulate. + * @param element An object that specifies the array item to remove. + */ + ArrayRemove(array: Object[], element: Object): void; + /** + * Removes an item at the specified index location from the specified array object. + * @param array An object that specifies the array to manipulate. + * @param index The zero-based index location of the array item to remove. + */ + ArrayRemoveAt(array: Object[], index: number): void; + /** + * Removes all items from the specified array object. + * @param array An object that specifies the array to manipulate. + */ + ArrayClear(array: Object[]): void; + /** + * Searches for the specified array item and returns the zero-based index of its first occurrence within the specified array object. + * @param array An object that specifies the array to manipulate. + * @param element An object that specifies the array item to locate. + */ + ArrayIndexOf(array: Object[], element: Object): number; + /** + * Binds the specified function to a specific element's event, so that the function gets called whenever the event fires on the element. + * @param element An object specifying the required element. + * @param eventName A string value that specifies the required event name without the "on" prefix. + * @param method An object that specifies the event's handling function. + */ + AttachEventToElement(element: Object, eventName: string, method: Object): void; + /** + * Unbinds the specified function from a specific element's event, so that the function stops receiving notifications when the event fires. + * @param element An object specifying the required element. + * @param eventName A string value that specifies the required event name. + * @param method An object that specifies the event's handling function. + */ + DetachEventFromElement(element: Object, eventName: string, method: Object): void; + /** + * Returns the object that fired the event. + * @param htmlEvent An object that represents the current event. + */ + GetEventSource(htmlEvent: Object): Object; + /** + * Gets the x-coordinate of the event-related mouse pointer position relative to an end-user's screen. + * @param htmlEvent An object specifying the required HTML event. + */ + GetEventX(htmlEvent: Object): number; + /** + * Gets the y-coordinate of the event-related mouse pointer position relative to an end-user's screen. + * @param htmlEvent An object specifying the required HTML event. + */ + GetEventY(htmlEvent: Object): number; + /** + * Gets the keyboard code for the specified event. + * @param htmlEvent An object specifying the required HTML event. + */ + GetKeyCode(htmlEvent: Object): number; + /** + * Cancels the default action of the specified event. + * @param htmlEvent An object that specifies the required HTML event. + */ + PreventEvent(htmlEvent: Object): boolean; + /** + * Cancels both the specified event's default action and the event's bubbling upon the hierarchy of event handlers. + * @param htmlEvent An object that specifies the required HTML event. + */ + PreventEventAndBubble(htmlEvent: Object): boolean; + /** + * Removes mouse capture from the specified event's source object. + * @param htmlEvent An object that specifies the required HTML event. + */ + PreventDragStart(htmlEvent: Object): boolean; + /** + * Clears any text selection made within the window's client region. + */ + ClearSelection(): void; + /** + * Gets a value that indicates whether the specified object exists on the client side. + * @param obj The object to test. + */ + IsExists(obj: Object): boolean; + /** + * Gets a value that indicates whether the specified object is a function. + * @param obj The object to test. + */ + IsFunction(obj: Object): boolean; + /** + * Gets the x-coordinate of the specified element's top left corner relative to the client area of the window, excluding scroll bars. + * @param element An object identifying the HTML element whose position should be obtained. + */ + GetAbsoluteX(element: Object): number; + /** + * Gets the y-coordinate of the specified element's top left corner relative to the client area of the window, excluding scroll bars. + * @param element An object identifying the HTML element whose position should be obtained. + */ + GetAbsoluteY(element: Object): number; + /** + * Sets the x-coordinate of the specified element's top left corner relative to the client area of the window, excluding scroll bars. + * @param element An object identifying the HTML element whose position should be defined. + * @param x An integer value specifying the required element's x-coordinate, in pixels. + */ + SetAbsoluteX(element: Object, x: number): void; + /** + * Sets the y-coordinate of the specified element's top left corner relative to the client area of the window, excluding scroll bars. + * @param element An object identifying the HTML element whose position should be defined. + * @param y An integer value specifying the required element's y-coordinate, in pixels. + */ + SetAbsoluteY(element: Object, y: number): void; + /** + * Returns the distance between the top edge of the document and the topmost portion of the content currently visible in the window. + */ + GetDocumentScrollTop(): number; + /** + * Returns the distance between the left edge of the document and the leftmost portion of the content currently visible in the window. + */ + GetDocumentScrollLeft(): number; + /** + * Gets the width of the window's client region. + */ + GetDocumentClientWidth(): number; + /** + * Gets the height of the window's client region. + */ + GetDocumentClientHeight(): number; + /** + * Gets a value indicating whether the object passed via the parentElement parameter is a parent of the object passed via the element parameter. + * @param parentElement An object specifying the parent HTML element. + * @param element An object specifying the child HTML element. + */ + GetIsParent(parentElement: Object, element: Object): boolean; + /** + * Returns a reference to the specified HTML element's first parent object which has an ID that matches the specified value. + * @param element An object specifying the child HTML element whose parent elements are searched. + * @param id A string specifying the required parent's ID. + */ + GetParentById(element: Object, id: string): Object; + /** + * Returns a reference to the specified HTML element's first parent object whose element name matches the specified value. + * @param element An object specifying the child HTML element whose parent elements are searched. + * @param tagName A string value specifying the element name (tag name) of the desired HTML element. + */ + GetParentByTagName(element: Object, tagName: string): Object; + /** + * Returns a reference to the specified HTML element's first parent object whose class name matches the specified value. + * @param element An object specifying the child HTML element whose parent elements are searched. + * @param className A string value specifying the class name of the desired HTML element. + */ + GetParentByClassName(element: Object, className: string): Object; + /** + * Returns a reference to the first element that has the specified ID in the parent HTML element specified. + * @param element An object identifying the parent HTML element to search. + * @param id A string specifying the ID attribute value of the desired child element. + */ + GetChildById(element: Object, id: string): Object; + /** + * Returns a reference to the particular element that has the specified element name and is contained within the specified parent HTML element. + * @param element An object specifying the parent HTML element to search. + * @param tagName A string value specifying the element name (tag name) of the desired HTML element. + * @param index An integer value specifying the zero-based index of the desired element amongst all the matching elements found. + */ + GetChildByTagName(element: Object, tagName: string, index: number): Object; + /** + * Creates or updates the HTTP cookie for the response. + * @param name A string value that represents the name of a cookie. + * @param value A string representing the cookie value. + */ + SetCookie(name: string, value: string): void; + /** + * Creates or updates the HTTP cookie for the response. + * @param name A string value that represents the name of a cookie. + * @param value A string representing the cookie value. + * @param expirationDate A date-time object that represents the expiration date and time for the cookie. + */ + SetCookie(name: string, value: string, expirationDate: Date): void; + /** + * Retrieves a cookie with the specified name. + * @param name A string value that represents the name of a cookie. + */ + GetCookie(name: string): string; + /** + * Deletes a cookie with the specified name. + * @param name A string value that represents the name of a cookie. + */ + DeleteCookie(name: string): void; + /** + * Returns a specifically generated code that uniquely identifies the combination of keys specified via the parameters. + * @param keyCode An integer value that specifies the code of the key. + * @param isCtrlKey true if the CTRL key should be included into the key combination; otherwise, false. + * @param isShiftKey true if the SHIFT key should be included into the key combination; otherwise, false. + * @param isAltKey true if the ALT key should be included into the key combination; otherwise, false. + */ + GetShortcutCode(keyCode: number, isCtrlKey: boolean, isShiftKey: boolean, isAltKey: boolean): number; + /** + * Returns a specifically generated code that uniquely identifies the pressed key combination, which is specified by the related HTML event. + * @param htmlEvent A DHTML event object that relates to a key combination being pressed. + */ + GetShortcutCodeByEvent(htmlEvent: Object): number; + /** + * Returns a specifically generated code that uniquely identifies the combination of keys specified via the parameter. + * @param shortcutString A string value that specifies the key combination. + */ + StringToShortcutCode(shortcutString: string): number; + /** + * Trims all leading and trailing whitespaces from the string. + * @param str A string value representing the string for trimming. + */ + Trim(str: string): string; + /** + * Trims all leading whitespaces from the string. + * @param str A string value representing the string for trimming. + */ + TrimStart(str: string): string; + /** + * Trims all trailing whitespaces from the string. + * @param str A string value representing the string for trimming. + */ + TrimEnd(str: string): string; +} +interface ASPxClientChartDesignerStatic 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): ASPxClientChartDesigner; +} +interface ASPxClientWebChartControlStatic 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): ASPxClientWebChartControl; +} +interface ASPxClientDocumentViewerStatic 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): ASPxClientDocumentViewer; +} +interface ASPxClientQueryBuilderStatic 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): ASPxClientQueryBuilder; +} +interface ASPxClientReportDesignerStatic 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): ASPxClientReportDesigner; +} +interface ASPxClientReportDocumentMapStatic extends ASPxClientControlStatic { +} +interface ASPxClientReportParametersPanelStatic extends ASPxClientControlStatic { +} +interface ASPxClientReportToolbarStatic 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): ASPxClientReportToolbar; +} +interface ASPxClientReportViewerStatic 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): ASPxClientReportViewer; +} +interface ASPxClientWebDocumentViewerStatic 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): ASPxClientWebDocumentViewer; +} + +declare var MVCxClientDashboardViewer: MVCxClientDashboardViewerStatic; +declare var DashboardDataAxisNames: DashboardDataAxisNamesStatic; +declare var DashboardSpecialValues: DashboardSpecialValuesStatic; +declare var ASPxClientDashboardDesigner: ASPxClientDashboardDesignerStatic; +declare var ASPxClientDashboardViewer: ASPxClientDashboardViewerStatic; +declare var DashboardExportPageLayout: DashboardExportPageLayoutStatic; +declare var DashboardExportPaperKind: DashboardExportPaperKindStatic; +declare var DashboardExportScaleMode: DashboardExportScaleModeStatic; +declare var DashboardExportFilterState: DashboardExportFilterStateStatic; +declare var DashboardExportImageFormat: DashboardExportImageFormatStatic; +declare var DashboardExportExcelFormat: DashboardExportExcelFormatStatic; +declare var ChartExportSizeMode: ChartExportSizeModeStatic; +declare var MapExportSizeMode: MapExportSizeModeStatic; +declare var RangeFilterExportSizeMode: RangeFilterExportSizeModeStatic; +declare var DashboardSelectionMode: DashboardSelectionModeStatic; +declare var ASPxClientEditBase: ASPxClientEditBaseStatic; +declare var ASPxClientEdit: ASPxClientEditStatic; +declare var ASPxClientBinaryImage: ASPxClientBinaryImageStatic; +declare var ASPxClientButton: ASPxClientButtonStatic; +declare var ASPxClientCalendar: ASPxClientCalendarStatic; +declare var ASPxClientCaptcha: ASPxClientCaptchaStatic; +declare var ASPxClientCheckBox: ASPxClientCheckBoxStatic; +declare var ASPxClientRadioButton: ASPxClientRadioButtonStatic; +declare var ASPxClientTextEdit: ASPxClientTextEditStatic; +declare var ASPxClientTextBoxBase: ASPxClientTextBoxBaseStatic; +declare var ASPxClientButtonEditBase: ASPxClientButtonEditBaseStatic; +declare var ASPxClientDropDownEditBase: ASPxClientDropDownEditBaseStatic; +declare var ASPxClientColorEdit: ASPxClientColorEditStatic; +declare var ASPxClientComboBox: ASPxClientComboBoxStatic; +declare var ASPxClientDateEdit: ASPxClientDateEditStatic; +declare var ASPxClientDropDownEdit: ASPxClientDropDownEditStatic; +declare var ASPxClientFilterControl: ASPxClientFilterControlStatic; +declare var ASPxClientListEdit: ASPxClientListEditStatic; +declare var ASPxClientListBox: ASPxClientListBoxStatic; +declare var ASPxClientCheckListBase: ASPxClientCheckListBaseStatic; +declare var ASPxClientRadioButtonList: ASPxClientRadioButtonListStatic; +declare var ASPxClientCheckBoxList: ASPxClientCheckBoxListStatic; +declare var ASPxClientProgressBar: ASPxClientProgressBarStatic; +declare var ASPxClientSpinEditBase: ASPxClientSpinEditBaseStatic; +declare var ASPxClientSpinEdit: ASPxClientSpinEditStatic; +declare var ASPxClientTimeEdit: ASPxClientTimeEditStatic; +declare var ASPxClientStaticEdit: ASPxClientStaticEditStatic; +declare var ASPxClientHyperLink: ASPxClientHyperLinkStatic; +declare var ASPxClientImageBase: ASPxClientImageBaseStatic; +declare var ASPxClientImage: ASPxClientImageStatic; +declare var ASPxClientLabel: ASPxClientLabelStatic; +declare var ASPxClientTextBox: ASPxClientTextBoxStatic; +declare var ASPxClientMemo: ASPxClientMemoStatic; +declare var ASPxClientButtonEdit: ASPxClientButtonEditStatic; +declare var ASPxClientTokenBox: ASPxClientTokenBoxStatic; +declare var ASPxClientTrackBar: ASPxClientTrackBarStatic; +declare var ASPxClientValidationSummary: ASPxClientValidationSummaryStatic; +declare var ASPxClientGaugeControl: ASPxClientGaugeControlStatic; +declare var ASPxClientGridBase: ASPxClientGridBaseStatic; +declare var ASPxClientGridViewCallbackCommand: ASPxClientGridViewCallbackCommandStatic; +declare var ASPxClientGridLookup: ASPxClientGridLookupStatic; +declare var ASPxClientCardView: ASPxClientCardViewStatic; +declare var ASPxClientGridView: ASPxClientGridViewStatic; +declare var ASPxClientVerticalGrid: ASPxClientVerticalGridStatic; +declare var ASPxClientVerticalGridCallbackCommand: ASPxClientVerticalGridCallbackCommandStatic; +declare var ASPxClientCommandConsts: ASPxClientCommandConstsStatic; +declare var ASPxClientHtmlEditor: ASPxClientHtmlEditorStatic; +declare var ASPxClientHtmlEditorMediaPreloadMode: ASPxClientHtmlEditorMediaPreloadModeStatic; +declare var ASPxClientPivotGrid: ASPxClientPivotGridStatic; +declare var ASPxClientPivotCustomization: ASPxClientPivotCustomizationStatic; +declare var ASPxClientRichEdit: ASPxClientRichEditStatic; +declare var ASPxSchedulerDateTimeHelper: ASPxSchedulerDateTimeHelperStatic; +declare var ASPxClientWeekDaysCheckEdit: ASPxClientWeekDaysCheckEditStatic; +declare var ASPxClientRecurrenceRangeControl: ASPxClientRecurrenceRangeControlStatic; +declare var ASPxClientRecurrenceControlBase: ASPxClientRecurrenceControlBaseStatic; +declare var ASPxClientDailyRecurrenceControl: ASPxClientDailyRecurrenceControlStatic; +declare var ASPxClientWeeklyRecurrenceControl: ASPxClientWeeklyRecurrenceControlStatic; +declare var ASPxClientMonthlyRecurrenceControl: ASPxClientMonthlyRecurrenceControlStatic; +declare var ASPxClientYearlyRecurrenceControl: ASPxClientYearlyRecurrenceControlStatic; +declare var ASPxClientRecurrenceTypeEdit: ASPxClientRecurrenceTypeEditStatic; +declare var ASPxClientTimeInterval: ASPxClientTimeIntervalStatic; +declare var ASPxClientScheduler: ASPxClientSchedulerStatic; +declare var ASPxClientSpellChecker: ASPxClientSpellCheckerStatic; +declare var ASPxClientSpreadsheet: ASPxClientSpreadsheetStatic; +declare var ASPxClientTreeList: ASPxClientTreeListStatic; +declare var MVCxClientCalendar: MVCxClientCalendarStatic; +declare var MVCxClientCallbackPanel: MVCxClientCallbackPanelStatic; +declare var MVCxClientCardView: MVCxClientCardViewStatic; +declare var MVCxClientChart: MVCxClientChartStatic; +declare var MVCxClientComboBox: MVCxClientComboBoxStatic; +declare var MVCxClientDataView: MVCxClientDataViewStatic; +declare var MVCxClientDateEdit: MVCxClientDateEditStatic; +declare var MVCxClientDockManager: MVCxClientDockManagerStatic; +declare var MVCxClientDockPanel: MVCxClientDockPanelStatic; +declare var MVCxClientFileManager: MVCxClientFileManagerStatic; +declare var MVCxClientGridView: MVCxClientGridViewStatic; +declare var MVCxClientHtmlEditor: MVCxClientHtmlEditorStatic; +declare var MVCxClientImageGallery: MVCxClientImageGalleryStatic; +declare var MVCxClientListBox: MVCxClientListBoxStatic; +declare var MVCxClientNavBar: MVCxClientNavBarStatic; +declare var MVCxClientPivotGrid: MVCxClientPivotGridStatic; +declare var MVCxClientPopupControl: MVCxClientPopupControlStatic; +declare var MVCxClientDocumentViewer: MVCxClientDocumentViewerStatic; +declare var MVCxClientReportViewer: MVCxClientReportViewerStatic; +declare var MVCxClientReportDesigner: MVCxClientReportDesignerStatic; +declare var MVCxClientRichEdit: MVCxClientRichEditStatic; +declare var MVCxClientRoundPanel: MVCxClientRoundPanelStatic; +declare var MVCxClientScheduler: MVCxClientSchedulerStatic; +declare var MVCxSchedulerToolTipType: MVCxSchedulerToolTipTypeStatic; +declare var MVCxClientSpreadsheet: MVCxClientSpreadsheetStatic; +declare var MVCxClientPageControl: MVCxClientPageControlStatic; +declare var MVCxClientTokenBox: MVCxClientTokenBoxStatic; +declare var MVCxClientTreeList: MVCxClientTreeListStatic; +declare var MVCxClientTreeView: MVCxClientTreeViewStatic; +declare var MVCxClientUploadControl: MVCxClientUploadControlStatic; +declare var MVCxClientUtils: MVCxClientUtilsStatic; +declare var MVCxClientGlobalEvents: MVCxClientGlobalEventsStatic; +declare var MVCxClientVerticalGrid: MVCxClientVerticalGridStatic; +declare var MVCxClientWebDocumentViewer: MVCxClientWebDocumentViewerStatic; +declare var ASPxClientControlBase: ASPxClientControlBaseStatic; +declare var ASPxClientControl: ASPxClientControlStatic; +declare var ASPxClientCallback: ASPxClientCallbackStatic; +declare var ASPxClientCallbackPanel: ASPxClientCallbackPanelStatic; +declare var ASPxClientCloudControl: ASPxClientCloudControlStatic; +declare var ASPxClientDataView: ASPxClientDataViewStatic; +declare var ASPxClientDockManager: ASPxClientDockManagerStatic; +declare var ASPxClientPopupControlBase: ASPxClientPopupControlBaseStatic; +declare var ASPxClientDockPanel: ASPxClientDockPanelStatic; +declare var ASPxClientDockZone: ASPxClientDockZoneStatic; +declare var ASPxClientFileManager: ASPxClientFileManagerStatic; +declare var ASPxClientFileManagerCommandConsts: ASPxClientFileManagerCommandConstsStatic; +declare var ASPxClientFileManagerErrorConsts: ASPxClientFileManagerErrorConstsStatic; +declare var ASPxClientFormLayout: ASPxClientFormLayoutStatic; +declare var ASPxClientHiddenField: ASPxClientHiddenFieldStatic; +declare var ASPxClientImageGallery: ASPxClientImageGalleryStatic; +declare var ASPxClientImageSlider: ASPxClientImageSliderStatic; +declare var ASPxClientImageZoomNavigator: ASPxClientImageZoomNavigatorStatic; +declare var ASPxClientImageZoom: ASPxClientImageZoomStatic; +declare var ASPxClientLoadingPanel: ASPxClientLoadingPanelStatic; +declare var ASPxClientMenuBase: ASPxClientMenuBaseStatic; +declare var ASPxClientMenu: ASPxClientMenuStatic; +declare var ASPxClientTouchUI: ASPxClientTouchUIStatic; +declare var ASPxClientNavBar: ASPxClientNavBarStatic; +declare var ASPxClientNewsControl: ASPxClientNewsControlStatic; +declare var ASPxClientObjectContainer: ASPxClientObjectContainerStatic; +declare var ASPxClientPanelBase: ASPxClientPanelBaseStatic; +declare var ASPxClientPanel: ASPxClientPanelStatic; +declare var ASPxClientPopupControl: ASPxClientPopupControlStatic; +declare var ASPxClientPopupControlResizeState: ASPxClientPopupControlResizeStateStatic; +declare var ASPxClientPopupControlCloseReason: ASPxClientPopupControlCloseReasonStatic; +declare var ASPxClientPopupMenu: ASPxClientPopupMenuStatic; +declare var ASPxClientRatingControl: ASPxClientRatingControlStatic; +declare var ASPxClientRibbon: ASPxClientRibbonStatic; +declare var ASPxClientRibbonState: ASPxClientRibbonStateStatic; +declare var ASPxClientRoundPanel: ASPxClientRoundPanelStatic; +declare var ASPxClientSplitter: ASPxClientSplitterStatic; +declare var ASPxClientTabControlBase: ASPxClientTabControlBaseStatic; +declare var ASPxClientTabControl: ASPxClientTabControlStatic; +declare var ASPxClientPageControl: ASPxClientPageControlStatic; +declare var ASPxClientTimer: ASPxClientTimerStatic; +declare var ASPxClientTitleIndex: ASPxClientTitleIndexStatic; +declare var ASPxClientTreeView: ASPxClientTreeViewStatic; +declare var ASPxClientUploadControl: ASPxClientUploadControlStatic; +declare var ASPxClientUtils: ASPxClientUtilsStatic; +declare var ASPxClientChartDesigner: ASPxClientChartDesignerStatic; +declare var ASPxClientWebChartControl: ASPxClientWebChartControlStatic; +declare var ASPxClientDocumentViewer: ASPxClientDocumentViewerStatic; +declare var ASPxClientQueryBuilder: ASPxClientQueryBuilderStatic; +declare var ASPxClientReportDesigner: ASPxClientReportDesignerStatic; +declare var ASPxClientReportDocumentMap: ASPxClientReportDocumentMapStatic; +declare var ASPxClientReportParametersPanel: ASPxClientReportParametersPanelStatic; +declare var ASPxClientReportToolbar: ASPxClientReportToolbarStatic; +declare var ASPxClientReportViewer: ASPxClientReportViewerStatic; +declare var ASPxClientWebDocumentViewer: ASPxClientWebDocumentViewerStatic; + diff --git a/types/devexpress-web/v161/tsconfig.json b/types/devexpress-web/v161/tsconfig.json new file mode 100644 index 0000000000..a64418f9b0 --- /dev/null +++ b/types/devexpress-web/v161/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "devexpress-web": ["devexpress-web/v161"], + "devexpress-web/*": ["devexpress-web/v161/*"] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "devexpress-web-tests.ts" + ] +} \ No newline at end of file diff --git a/types/devexpress-web/v162/devexpress-web-tests.ts b/types/devexpress-web/v162/devexpress-web-tests.ts new file mode 100644 index 0000000000..ef7eb8de37 --- /dev/null +++ b/types/devexpress-web/v162/devexpress-web-tests.ts @@ -0,0 +1,418 @@ +declare var hiddenField: ASPxClientHiddenField; +declare var mainCallbackPanel: ASPxClientCallbackPanel; +declare var loginPopup: ASPxClientPopupControl; +declare var searchButton: ASPxClientButton; +declare var searchComboBox: ASPxClientComboBox; +declare var roomsNumberSpinEdit: ASPxClientSpinEdit; +declare var adultsNumberSpinEdit: ASPxClientSpinEdit; +declare var childrenNumberSpinEdit: ASPxClientSpinEdit; +declare var checkInDateEdit: ASPxClientDateEdit; +declare var checkOutDateEdit: ASPxClientDateEdit; +declare var backSlider: ASPxClientImageSlider; +declare var locationComboBox: ASPxClientComboBox; +declare var nightyRateTrackBar: ASPxClientTrackBar; +declare var customerRatingTrackBar: ASPxClientTrackBar; +declare var ourRatingCheckBoxList: ASPxClientCheckBoxList; +declare var startFilterPopupControl: ASPxClientPopupControl; +declare var imagePopupControl: ASPxClientPopupControl; +declare var emailTextBox: ASPxClientTextBox; +declare var creditCardEmailTextBox: ASPxClientTextBox; +declare var accountEmailTextBox: ASPxClientTextBox; +declare var bookingPageControl: ASPxClientPageControl; +declare var paymentTypePageControl: ASPxClientPageControl; +declare var offerFormPopup: ASPxClientPopupControl; +declare var roomsSpinEdit: ASPxClientSpinEdit; +declare var adultsSpinEdit: ASPxClientSpinEdit; +declare var childrenSpinEdit: ASPxClientSpinEdit; +declare var hotelDetailsCallbackPanel: ASPxClientCallbackPanel; +declare var leftPanel: ASPxClientPanel; +declare var menuButton: ASPxClientButton; +declare var aboutWindow: ASPxClientPopupControl; +declare var offersZone: ASPxClientDockZone; + +module DXDemo { + function showPage(page: string, params: { [key: string]: any }, skipHistory?: boolean): void { + var queryString = getQueryString(params || {}); + hiddenField.Set("page", page); + hiddenField.Set("parameters", queryString); + hideMenu(); + var uri = queryString.length ? (page + "?" + queryString) : page; + try { + if (!skipHistory && window.history && window.history.pushState) + window.history.pushState(uri, "", uri || "Default.aspx"); + } catch (e) { } + mainCallbackPanel.PerformCallback(uri); + }; + + export function onMainMenuItemClick(s: ASPxClientMenu, e: ASPxClientMenuItemClickEventArgs): void { + switch (e.item.name) { + case "login": + hideMenu(); + setTimeout(function () { loginPopup.ShowAtElementByID("MainCallbackPanel_ContentPane"); }, 300); + break; + case "offers": + showPage("SpecialOffers", {}); + break; + default: + hideMenu(); + setTimeout(function () { showAboutWindow(); }, 300); + break; + } + }; + + export function onLoginButtonClick(s: ASPxClientButton, e: ASPxClientButtonClickEventArgs): void { + loginPopup.Hide(); + showAboutWindow(); + }; + + export function onSearchButtonClick(): void { + if (ASPxClientEdit.ValidateGroup("DateEditors")) { + showPage("ShowHotels", { + location: searchComboBox.GetValue(), + checkin: getFormattedDate(checkInDateEdit.GetValue()), + checkout: getFormattedDate(checkOutDateEdit.GetValue()), + rooms: roomsNumberSpinEdit.GetValue() || 1, + adults: adultsNumberSpinEdit.GetValue() || 1, + children: childrenNumberSpinEdit.GetValue() || 0 + }); + } + }; + + export function onSearchComboBoxIndexChanged(s: ASPxClientComboBox, e: ASPxClientProcessingModeEventArgs): void { + hideMenu(); + searchButton.AdjustControl(); + }; + + export function onIndexOfferCloseClick(index: number): void { + var panel = ASPxClientControl.GetControlCollection().GetByName("OfferDockPanel" + index); + var sibPanel = ASPxClientControl.GetControlCollection().GetByName("OfferDockPanel" + (index == 1 ? 2 : 1)); + panel.Hide(); + sibPanel.MakeFloat(); + sibPanel.SetWidth(offersZone.GetWidth()); + sibPanel.Dock(offersZone); + }; + + export function onLogoClick(): void { + showPage("", null, false); + }; + + export function onMenuNavButtonCheckedChanged(s: ASPxClientCheckBox, e: ASPxClientProcessingModeEventArgs): void { + var mainContainer = mainCallbackPanel.GetMainElement(); + if (s.GetChecked()) { + backSlider.Pause(); + showMenu(); + } + else { + hideMenu(); + backSlider.Play(); + } + }; + + export function onBackNavButtonClick(s: ASPxClientButton, e: ASPxClientButtonClickEventArgs): void { + var params = getCurrentQueryParams(); + switch (getCurrentPage()) { + case "PrintInvoice": + showPage("Booking", params, false); + break; + case "Booking": + if (bookingPageControl.GetActiveTabIndex() > 0) + bookingPageControl.SetActiveTabIndex(bookingPageControl.GetActiveTabIndex() - 1); + else + showPage("ShowRooms", params, false); + break; + case "ShowRooms": + showPage("ShowHotels", params, false); + break; + case "ShowDetails": + showPage("ShowHotels", params, false); + break; + case "ShowHotels": + case "SpecialOffers": + showPage("", null, false); + break; + } + }; + + export function updateSearchResults(): void { + var params = getCurrentQueryParams(); + params["location"] = locationComboBox.GetValue(); + params["minprice"] = nightyRateTrackBar.GetPositionStart(); + params["maxprice"] = nightyRateTrackBar.GetPositionEnd(); + params["custrating"] = customerRatingTrackBar.GetPosition(); + params["ourrating"] = ourRatingCheckBoxList.GetSelectedValues().join(","); + showPage("ShowHotels", params); + }; + + export function onBookHotelButtonClick(hotelID: string): void { + var queryParams = getCurrentQueryParams(); + queryParams["hotelID"] = hotelID; + showPage("ShowRooms", queryParams); + }; + + export function onDetailsHotelButtonClick(hotelID: string): void { + var queryParams = getCurrentQueryParams(); + queryParams["hotelID"] = hotelID; + showPage("ShowDetails", queryParams); + }; + + export function onShowStartFilterButtonClick(s: ASPxClientButton, e: ASPxClientButtonClickEventArgs): void { + startFilterPopupControl.ShowAtElementByID("MainCallbackPanel_ContentPane"); + }; + + export function onChangeStartFilterButtonClick(s: ASPxClientButton, e: ASPxClientButtonClickEventArgs): void { + if (ASPxClientEdit.ValidateGroup("DateEditors")) { + var params = getCurrentQueryParams(); + params["checkin"] = getFormattedDate(checkInDateEdit.GetValue()); + params["checkout"] = getFormattedDate(checkOutDateEdit.GetValue()); + params["rooms"] = roomsNumberSpinEdit.GetValue() || 1; + params["adults"] = adultsNumberSpinEdit.GetValue() || 1; + params["children"] = childrenNumberSpinEdit.GetValue() || 0; + startFilterPopupControl.Hide(); + showPage(hiddenField.Get("page").toString(), params); + } + }; + + export function onBookRoomButtonClick(roomID: string): void { + var params = getCurrentQueryParams(); + params["roomID"] = roomID; + showPage("Booking", params); + }; + + export function onShowRoomsButtonClick(): void { + var queryParams = getCurrentQueryParams(); + showPage("ShowRooms", queryParams); + }; + + export function onShowDetailsButtonClick(): void { + var queryParams = getCurrentQueryParams(); + showPage("ShowDetails", queryParams); + }; + + export function onRoomImageNavItemClick(roomID: string, pictureName: string): void { + setTimeout(function () { + imagePopupControl.PerformCallback(roomID + "|" + pictureName); + imagePopupControl.ShowAtElementByID("MainCallbackPanel_ContentPane"); + }, 500); + }; + + export function onRoomsNavBarExpandedChanged(s: ASPxClientNavBar, e: ASPxClientNavBarGroupEventArgs): void { + ASPxClientControl.AdjustControls(s.GetMainElement()); + }; + + export function onNextBookingStepButtonClick(step: number): void { + var valid = true; + var validationGroup = ""; + if (step == 1) + validationGroup = "Account"; + if (step == 2) + validationGroup = "RoomDetails"; + if (step == 3) + validationGroup = "PaymentDetails"; + + switch (step) { + case 1: + valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "Account"); + if (valid) { + emailTextBox.SetValue(accountEmailTextBox.GetValue()); + creditCardEmailTextBox.SetValue(accountEmailTextBox.GetValue()); + showPage("Booking", getCurrentQueryParams()); + return; + } + break; + case 2: + valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "RoomDetails"); + emailTextBox.SetValue(accountEmailTextBox.GetValue()); + break; + case 3: + var paymentType = paymentTypePageControl.GetActiveTabIndex(); + if (paymentType == 0) + valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "CreditCard"); + else if (paymentType == 1) + valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "Cash"); + else if (paymentType == 2) + valid = ASPxClientEdit.ValidateEditorsInContainer(bookingPageControl.GetMainElement(), "PayPal"); + break; + } + if (valid) { + bookingPageControl.GetTab(step).SetEnabled(true); + bookingPageControl.SetActiveTabIndex(step); + } + }; + + export function onAccountCaptchaHiddenFieldInit(s: ASPxClientHiddenField, e: ASPxClientEventArgs): void { + if (s.Get("IsCaptchaValid")) { + bookingPageControl.GetTab(1).SetEnabled(true); + bookingPageControl.SetActiveTabIndex(1); + } + }; + + export function onFinishBookingStepButtonClick(): void { + showAboutWindow(); + }; + + export function OnPrintInvoiceButtonClick(): void { + showPage("PrintInvoice", getCurrentQueryParams()); + }; + + export function onOfferClick(offerID: string): void { + offerFormPopup.SetContentHtml(""); + offerFormPopup.PerformCallback(offerID); + var panel = ASPxClientControl.GetControlCollection().GetByName("DockPanel" + offerID); + var panelElement = panel.GetMainElement(); + if (panelElement.offsetWidth < 330 || panelElement.offsetHeight < 250) { + offerFormPopup.SetWidth(400); + offerFormPopup.SetHeight(280); + offerFormPopup.ShowAtElementByID("SpecialOffersContainer"); + } + else { + offerFormPopup.SetWidth(panelElement.offsetWidth); + offerFormPopup.SetHeight(panelElement.offsetHeight); + offerFormPopup.ShowAtElement(panelElement); + } + }; + + export function onSpecialOfferCheckButtonClick(hotelID: string, locationID: string): void { + if (ASPxClientEdit.ValidateGroup("DateEditors")) { + var queryParams: { [key: string]: any } = { + location: locationID, + hotelID: hotelID, + checkin: getFormattedDate(checkInDateEdit.GetValue()), + checkout: getFormattedDate(checkOutDateEdit.GetValue()), + rooms: roomsSpinEdit.GetValue() || 1, + adults: adultsSpinEdit.GetValue() || 1, + children: childrenSpinEdit.GetValue() || 0 + }; + showPage("ShowRooms", queryParams); + } + }; + + export function onIndexOfferClick(): void { + showPage("SpecialOffers", {}); + }; + + export function onControlsInit(): void { + ASPxClientUtils.AttachEventToElement(window, 'popstate', onHistoryPopState); + var pathParts = document.location.href.split("/"); + var url = pathParts[pathParts.length - 1]; + try { + if (window.history) + window.history.replaceState(url, ""); + } catch (e) { } + ASPxClientUtils.AttachEventToElement(window, "resize", onWindowResize); + if (ASPxClientUtils.iOSPlatform) { + // animate + } + }; + + export function updateRatingLabels(ratingControl: ASPxClientTrackBar) { + var start = ratingControl.GetPositionStart().toString(); + var end = ratingControl.GetPositionEnd().toString(); + document.getElementById("cpLeftLabelID").innerHTML = start + " " + end; + }; + + export function onRatingControlItemClick(s: ASPxClientRatingControl, e: ASPxClientRatingControlItemClickEventArgs): void { + hotelDetailsCallbackPanel.PerformCallback(s.GetValue().toString()); + }; + + export function onInputKeyDown(s: ASPxClientTextBox, e: ASPxClientEditKeyEventArgs): void { + var keyCode = ASPxClientUtils.GetKeyCode(e.htmlEvent); + if (keyCode == 13) + (s.GetInputElement()).blur(); + }; + + function getCurrentPage(): string { + var hfPage = hiddenField.Get("page"); + if (hfPage) + return hfPage; + var pathParts = document.location.pathname.split("/"); + return pathParts[pathParts.length - 1]; + }; + + function showAboutWindow(): void { + aboutWindow.ShowAtElementByID("MainCallbackPanel_ContentPane"); + }; + + function hideMenu(): void { + leftPanel.Collapse(); + if (menuButton.GetMainElement() && menuButton.GetChecked()) + menuButton.SetChecked(false); + }; + + function showMenu(): void { + leftPanel.Expand(); + }; + + var _resizeSpecialOffersTimeoutID = -1; + function onWindowResize(): void { + switch (hiddenField.Get("page")) { + case "SpecialOffers": + if (_resizeSpecialOffersTimeoutID == -1) + _resizeSpecialOffersTimeoutID = setTimeout(resizeSpecialOffers, 200); + break; + } + hidePopups("AboutWindow", "StartFilterPopupControl", "LoginPopup", "OfferFormPopup", "ImagePopupControl"); + }; + + function hidePopups(...names: string[]): void { + for (var i = 0; i < names.length; i++) { + var popupControl = ASPxClientControl.GetControlCollection().GetByName(names[i]); + popupControl.Hide(); + } + }; + + function resizeSpecialOffers(): void { + for (var i = 1; i <= 4; i++) { + var panel = ASPxClientControl.GetControlCollection().GetByName("DockPanel" + i); + if (panel && panel.IsVisible()) { + var zone = panel.GetOwnerZone(); + zone.SetWidth(((zone.GetMainElement()).parentNode).offsetWidth) + } + } + _resizeSpecialOffersTimeoutID = -1; + }; + + function getFormattedDate(date: Date): string { + return (date.getMonth() + 1) + "-" + date.getDate() + "-" + date.getFullYear(); + }; + + function getCurrentQueryParams(): { [key:string]: any } { + var hfParams = hiddenField.Get("parameters"); + if (hfParams) + return getParamsByQueryString(hfParams); + var query = document.location.search; + if (query[0] === "?") + query = query.substr(1); + return getParamsByQueryString(query); + }; + + function getQueryString(params: { [key:string]: any }): string { + var queryItems: any[] = []; + for (var key in params) { + if (!params.hasOwnProperty(key)) continue; + queryItems.push(key + "=" + params[key]); + } + if (queryItems.length > 0) + return queryItems.join("&"); + return ""; + }; + + function getParamsByQueryString(queryString: string): { [key: string]: string } { + var result: { [key: string]: any } = {}; + if (queryString) { + var queryStringArray = queryString.split("&"); + for (var i = 0; i < queryStringArray.length; i++) { + var part = queryStringArray[i].split('='); + if (part.length != 2) continue; + result[part[0]] = decodeURIComponent(part[1].replace(/\+/g, " ")); + } + } + return result; + }; + + function onHistoryPopState(evt: any): void { + if (evt.state !== null && evt.state !== undefined) { + var uriParts = evt.state.split("?"); + showPage(uriParts[0], getParamsByQueryString(uriParts[1]), true); + } + }; +} \ No newline at end of file diff --git a/types/devexpress-web/v162/index.d.ts b/types/devexpress-web/v162/index.d.ts new file mode 100644 index 0000000000..89d0b0d657 --- /dev/null +++ b/types/devexpress-web/v162/index.d.ts @@ -0,0 +1,28635 @@ +// Type definitions for DevExpress ASP.NET v162.7 +// Project: http://devexpress.com/ +// Definitions by: DevExpress Inc. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * A client-side counterpart of the DashboardViewer extension. + */ +interface MVCxClientDashboardViewer extends ASPxClientDashboardViewer { +} +/** + * Represents a list of records from the dashboard data source. + */ +interface ASPxClientDashboardItemUnderlyingData { + /** + * Gets the number of rows in the underlying data set. + */ + GetRowCount(): number; + /** + * Returns the value of the specified cell within the underlying data set. + * @param rowIndex An integer value that specifies the zero-based index of the required row. + * @param dataMember A String that specifies the required data member. + */ + GetRowValue(rowIndex: number, dataMember: string): Object; + /** + * Returns an array of data members available in a data source. + */ + GetDataMembers(): string[]; + /** + * Returns whether or not a request for underlying data was successful. + */ + IsDataReceived(): boolean; + /** + * Returns a callstack containing the error caused by an unsuccessful request for underlying data. + */ + GetRequestDataError(): string; +} +/** + * Contains parameters used to obtain the underlying data for the dashboard item. + */ +interface ASPxClientDashboardItemRequestUnderlyingDataParameters { + /** + * Gets or sets an array of data member identifiers used to obtain underlying data. + * Value: An array of String objects that specify data member identifiers. + */ + DataMembers: string[]; + /** + * Gets or sets axis points used to obtain the underlying data. + * Value: An array of ASPxClientDashboardItemDataAxisPoint objects that represent axis points. + */ + AxisPoints: ASPxClientDashboardItemDataAxisPoint[]; + /** + * Gets or sets the dimension value used to obtain the underlying data. + * Value: The dimension value. + */ + ValuesByAxisName: Object; + /** + * Gets or sets the unique dimension value used to obtain the underlying data. + * Value: The unique dimension value. + */ + UniqueValuesByAxisName: Object; +} +/** + * References a method executed after an asynchronous request is complete. + */ +interface ASPxClientDashboardItemRequestUnderlyingDataCompleted { + /** + * References a method executed after an asynchronous request is completed. + * @param data An ASPxClientDashboardItemUnderlyingData object that represents a list of records from the dashboard data source. + */ + (data: ASPxClientDashboardItemUnderlyingData): void; +} +/** + * References a method that will handle the ItemClick events. + */ +interface ASPxClientDashboardItemClickEventHandler { + /** + * References a method that will handle the ItemClick events. + * @param source The event source. + * @param e A ASPxClientDashboardItemClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemClickEventArgs): void; +} +/** + * Provides data for the ItemClick events. + */ +interface ASPxClientDashboardItemClickEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the dashboard item for which the event has been raised. + * Value: A String that is the dashboard item name. + */ + ItemName: string; + /** + * Gets the dashboard item's client data. + */ + GetData(): ASPxClientDashboardItemData; + /** + * Returns the axis point corresponding to the clicked visual element. + * @param axisName A string value returned by the DashboardDataAxisNames class that specifies the name of the data axis. + */ + GetAxisPoint(axisName: string): ASPxClientDashboardItemDataAxisPoint; + /** + * Gets measures corresponding to the clicked visual element. + */ + GetMeasures(): ASPxClientDashboardItemDataMeasure[]; + /** + * Gets deltas corresponding to the clicked visual element. + */ + GetDeltas(): ASPxClientDashboardItemDataDelta[]; + /** + * Gets the dimensions used to create a hierarchy of axis points for the specified axis. + * @param axisName A string value returned by the DashboardDataAxisNames class that specifies the name of the data axis. + */ + GetDimensions(axisName: string): ASPxClientDashboardItemDataDimension[]; + /** + * Requests underlying data corresponding to the clicked visual element. + * @param onCompleted A ASPxClientDashboardItemRequestUnderlyingDataCompleted object that references a method executed after the request is completed. + * @param dataMembers An array of String values that specify data members used to obtain underlying data. + */ + RequestUnderlyingData(onCompleted: ASPxClientDashboardItemRequestUnderlyingDataCompleted, dataMembers: string[]): void; +} +/** + * References a method that will handle the ItemVisualInteractivity events. + */ +interface ASPxClientDashboardItemVisualInteractivityEventHandler { + /** + * References a method that will handle the ItemVisualInteractivity events. + * @param source The event source. + * @param e A ASPxClientDashboardItemVisualInteractivityEventArgs object containing event data. + */ + (source: S, e: ASPxClientDashboardItemVisualInteractivityEventArgs): void; +} +/** + * Provides data for the ItemVisualInteractivity events. + */ +interface ASPxClientDashboardItemVisualInteractivityEventArgs extends ASPxClientEventArgs { + /** + * Gets the component name of the dashboard item for which the event was raised. + * Value: A String that is the component name of the dashboard item. + */ + ItemName: string; + /** + * Gets the selection mode for dashboard item elements. + */ + GetSelectionMode(): string; + /** + * Sets the selection mode for dashboard item elements. + * @param selectionMode A String that specifies the selection mode. + */ + SetSelectionMode(selectionMode: string): void; + /** + * Returns whether or not highlighting is enabled for the current dashboard item. + */ + IsHighlightingEnabled(): boolean; + /** + * Enables highlighting for the current dashboard item. + * @param enableHighlighting true, to enable highlighting; otherwise, false. + */ + EnableHighlighting(enableHighlighting: boolean): void; + /** + * Gets data axes used to perform custom interactivity actions. + */ + GetTargetAxes(): string[]; + /** + * Sets data axes used to perform custom interactivity actions. + * @param targetAxes An array of String objects that specify names of data axes. + */ + SetTargetAxes(targetAxes: string[]): void; + /** + * Gets the default selection for the current dashboard item. + */ + GetDefaultSelection(): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Sets the default selection for the current dashboard item. + * @param values An array of ASPxClientDashboardItemDataAxisPointTuple objects specifying axis point tuples used to select default elements. + */ + SetDefaultSelection(values: ASPxClientDashboardItemDataAxisPointTuple[]): void; +} +/** + * References a method that will handle the ItemSelectionChanged events. + */ +interface ASPxClientDashboardItemSelectionChangedEventHandler { + /** + * References a method that will handle the ItemSelectionChanged events. + * @param source The event source. + * @param e A ASPxClientDashboardItemSelectionChangedEventArgs object containing event data. + */ + (source: S, e: ASPxClientDashboardItemSelectionChangedEventArgs): void; +} +/** + * Provides data for the ItemSelectionChanged events. + */ +interface ASPxClientDashboardItemSelectionChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the component name of the dashboard item for which the event was raised. + * Value: A String that is the component name of the dashboard item. + */ + ItemName: string; + /** + * Gets currently selected elements. + */ + GetCurrentSelection(): ASPxClientDashboardItemDataAxisPointTuple[]; +} +/** + * References a method that will handle the ItemElementCustomColor event. + */ +interface ASPxClientDashboardItemElementCustomColorEventHandler { + /** + * References a method that will handle the ItemElementCustomColor events. + * @param source The event source. + * @param e An ASPxClientDashboardItemElementCustomColorEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemElementCustomColorEventArgs): void; +} +/** + * Provides data for the ItemElementCustomColor events. + */ +interface ASPxClientDashboardItemElementCustomColorEventArgs extends ASPxClientEventArgs { + /** + * Gets the component name of the dashboard item for which the event was raised. + * Value: A String that is the component name of the dashboard item for which the event was raised. + */ + ItemName: string; + /** + * Gets the axis point tuple that corresponds to the current dashboard item element. + */ + GetTargetElement(): ASPxClientDashboardItemDataAxisPointTuple; + /** + * Gets the color of the current dashboard item element. + */ + GetColor(): string; + /** + * Sets the color of the current dashboard item element. + * @param color A String that specifies the color of the current dashboard item element. + */ + SetColor(color: string): void; + /** + * Gets measures corresponding to the current dashboard item element. + */ + GetMeasures(): ASPxClientDashboardItemDataMeasure[]; +} +/** + * References a method that will handle the ItemWidgetCreated events. + */ +interface ASPxClientDashboardItemWidgetCreatedEventHandler { + /** + * References a method that will handle the ItemWidgetCreated events. + * @param source The event source. + * @param e A ASPxClientDashboardItemWidgetEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemWidgetEventArgs): void; +} +/** + * References a method that will handle the ItemWidgetUpdating event. + */ +interface ASPxClientDashboardItemWidgetUpdatingEventHandler { + /** + * References a method that will handle the ItemWidgetUpdating event. + * @param source The event source. + * @param e A ASPxClientDashboardItemWidgetEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemWidgetEventArgs): void; +} +/** + * References a method that will handle the ItemWidgetUpdated event. + */ +interface ASPxClientDashboardItemWidgetUpdatedEventHandler { + /** + * References a method that will handle the ItemWidgetUpdated event. + * @param source The event source. + * @param e A ASPxClientDashboardItemWidgetEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemWidgetEventArgs): void; +} +/** + * References a method that will handle the ItemBeforeWidgetDisposed events. + */ +interface ASPxClientDashboardItemBeforeWidgetDisposedEventHandler { + /** + * References a method that will handle the ItemBeforeWidgetDisposed events. + * @param source The event source. + * @param e A ASPxClientDashboardItemWidgetEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemWidgetEventArgs): void; +} +/** + * Provides data for events related to client widgets used to visualize data in dashboard items. + */ +interface ASPxClientDashboardItemWidgetEventArgs extends ASPxClientEventArgs { + /** + * Gets the component name of the dashboard item for which the event was raised. + * Value: A String that is the component name of the dashboard item. + */ + ItemName: string; + /** + * Returns an underlying widget corresponding to the current dashboard item. + */ + GetWidget(): Object; +} +/** + * Represents multidimensional data visualized in the dashboard item. + */ +interface ASPxClientDashboardItemData { + /** + * Gets the names of the axes that constitute the current ASPxClientDashboardItemData. + */ + GetAxisNames(): string[]; + /** + * Returns the specified data axis. + * @param axisName A string value returned by the DashboardDataAxisNames class that specifies the name of the data axis. + */ + GetAxis(axisName: string): ASPxClientDashboardItemDataAxis; + /** + * Gets the dimensions used to create a hierarchy of axis points for the specified axis. + * @param axisName A string value returned by the DashboardDataAxisNames class that specifies the name of the data axis. + */ + GetDimensions(axisName: string): ASPxClientDashboardItemDataDimension[]; + /** + * Gets the measures for the current ASPxClientDashboardItemData object. + */ + GetMeasures(): ASPxClientDashboardItemDataMeasure[]; + /** + * Gets the deltas for the current ASPxClientDashboardItemData object. + */ + GetDeltas(): ASPxClientDashboardItemDataDelta[]; + /** + * Gets the slice of the current ASPxClientDashboardItemData object by the specified axis point tuple. + * @param tuple A ASPxClientDashboardItemDataAxisPointTuple object that is a tuple of axis points. + */ + GetSlice(tuple: ASPxClientDashboardItemDataAxisPointTuple): ASPxClientDashboardItemData; + /** + * Gets the slice of the current ASPxClientDashboardItemData object by the specified axis point. + * @param axisPoint An ASPxClientDashboardItemDataAxisPoint object that is the data point in a multidimensional space. + */ + GetSlice(axisPoint: ASPxClientDashboardItemDataAxisPoint): ASPxClientDashboardItemData; + /** + * Returns a total summary value for the specified measure. + * @param measureId A String that is the measure identifier. + */ + GetMeasureValue(measureId: string): ASPxClientDashboardItemDataMeasureValue; + /** + * Gets the summary value for the specified delta. + * @param deltaId A String that is the data item identifier. + */ + GetDeltaValue(deltaId: string): ASPxClientDashboardItemDataDeltaValue; + /** + * Returns an array of data members available in a data source. + */ + GetDataMembers(): string[]; + /** + * Creates a tuple based on the specified axes names and corresponding values. + * @param values An array of name-value pairs containing the axis name and corresponding values. + */ + CreateTuple(values: Object[]): ASPxClientDashboardItemDataAxisPointTuple; + /** + * Creates a tuple based on the specified axis points. + * @param axisPoints An array of ASPxClientDashboardItemDataAxisPoint objects that specify axis points belonging to different data axes. + */ + CreateTuple(axisPoints: ASPxClientDashboardItemDataAxisPoint[]): ASPxClientDashboardItemDataAxisPointTuple; +} +/** + * An axis that contains data points corresponding to the specified value hierarchy. + */ +interface ASPxClientDashboardItemDataAxis { + /** + * Gets the dimensions used to create a hierarchy of axis points belonging to the current axis. + */ + GetDimensions(): ASPxClientDashboardItemDataDimension[]; + /** + * Gets the root axis point belonging to the current ASPxClientDashboardItemDataAxis. + */ + GetRootPoint(): ASPxClientDashboardItemDataAxisPoint; + /** + * Returns axis points corresponding to values of the last-level dimension. + */ + GetPoints(): ASPxClientDashboardItemDataAxisPoint[]; + /** + * Returns axis points corresponding to the specified dimension. + * @param dimensionId A String that is the dimension identifier. + */ + GetPointsByDimension(dimensionId: string): ASPxClientDashboardItemDataAxisPoint[]; + /** + * Returns the data point for the specified axis by unique values. + * @param uniqueValues A hierarchy of unique values identifying the required data point. + */ + GetPointByUniqueValues(uniqueValues: Object[]): ASPxClientDashboardItemDataAxisPoint; +} +/** + * Contains the dimension metadata. + */ +interface ASPxClientDashboardItemDataDimension { + /** + * Gets the dimension identifier. + * Value: A String that is the dimension identifier. + */ + Id: string; + /** + * Gets or sets the name of the dimension. + * Value: A String that is the name of the dimension. + */ + Name: string; + /** + * Gets the data member identifier for the current dimension. + * Value: A String value that identifies a data member. + */ + DataMember: string; + /** + * Gets the group interval for date-time values for the current dimension. + * Value: A String value that represents how date-time values are grouped. + */ + DateTimeGroupInterval: string; + /** + * Gets the group interval for string values. + * Value: A String value that specifies the group interval for string values. + */ + TextGroupInterval: string; + /** + * Formats the specified value using format settings of the current dimension. + * @param value A value to be formatted. + */ + Format(value: Object): string; +} +/** + * Contains the measure metadata. + */ +interface ASPxClientDashboardItemDataMeasure { + /** + * Gets the measure identifier. + * Value: A String that is the measure identifier. + */ + Id: string; + /** + * Gets the name of the measure. + * Value: A String that is the name of the measure. + */ + Name: string; + /** + * Gets the data member that identifies the data source list used to provide data for the current measure. + * Value: A String value that identifies the data source list used to provide data for the current measure. + */ + DataMember: string; + /** + * Gets the type of summary function calculated against the current measure. + * Value: A String value that identifies the type of summary function calculated against the current measure. + */ + SummaryType: string; + /** + * Formats the specified value using format settings of the current measure. + * @param value A value to be formatted. + */ + Format(value: Object): string; +} +/** + * Contains the delta metadata. + */ +interface ASPxClientDashboardItemDataDelta { + /** + * Gets the data item identifier. + * Value: A String that is the data item identifier. + */ + Id: string; + /** + * Gets the name of the data item container. + * Value: A String value that is the name of the data item container. + */ + Name: string; + /** + * Gets the identifier for the measure that provides actual values. + * Value: A String value that is the measure identifier. + */ + ActualMeasureId: string; + /** + * Gets the identifier for the measure that provides target values. + * Value: A String value that is the measure identifier. + */ + TargetMeasureId: string; +} +/** + * Provides dimension values at the specified axis point. + */ +interface ASPxClientDashboardItemDataDimensionValue { + /** + * Gets the current dimension value. + */ + GetValue(): Object; + /** + * Gets the unique value for the current dimension value. + */ + GetUniqueValue(): Object; + /** + * Gets the display text for the current dimension value. + */ + GetDisplayText(): string; +} +/** + * Provides the measure value and display text. + */ +interface ASPxClientDashboardItemDataMeasureValue { + /** + * Gets the measure value. + */ + GetValue(): Object; + /** + * Gets the measure display text. + */ + GetDisplayText(): string; +} +/** + * Provides delta element values. + */ +interface ASPxClientDashboardItemDataDeltaValue { + /** + * Provides access to the actual value displayed within the delta element. + */ + GetActualValue(): ASPxClientDashboardItemDataMeasureValue; + /** + * Provides access to the target value. + */ + GetTargetValue(): ASPxClientDashboardItemDataMeasureValue; + /** + * Provides access to the absolute difference between the actual and target values. + */ + GetAbsoluteVariation(): ASPxClientDashboardItemDataMeasureValue; + /** + * Provides access to the percent of variation between the actual and target values. + */ + GetPercentVariation(): ASPxClientDashboardItemDataMeasureValue; + /** + * Provides access to the percentage of the actual value in the target value. + */ + GetPercentOfTarget(): ASPxClientDashboardItemDataMeasureValue; + /** + * Provides access to the main delta value. + */ + GetDisplayValue(): ASPxClientDashboardItemDataMeasureValue; + /** + * Provides access to the first additional delta value. + */ + GetDisplaySubValue1(): ASPxClientDashboardItemDataMeasureValue; + /** + * Provides access to the second additional delta value. + */ + GetDisplaySubValue2(): ASPxClientDashboardItemDataMeasureValue; + /** + * Gets the value specifying the condition for displaying the delta indication. + */ + GetIsGood(): ASPxClientDashboardItemDataMeasureValue; + /** + * Gets the type of delta indicator. + */ + GetIndicatorType(): ASPxClientDashboardItemDataMeasureValue; +} +/** + * A point on the data axis. + */ +interface ASPxClientDashboardItemDataAxisPoint { + /** + * Gets the name of the axis to which the current axis point belongs. + */ + GetAxisName(): string; + /** + * Gets the last level dimension corresponding to the current axis point. + */ + GetDimension(): ASPxClientDashboardItemDataDimension; + /** + * Gets the collection of dimensions used to create a hierarchy of axis points from the root point to the current axis point. + */ + GetDimensions(): ASPxClientDashboardItemDataDimension[]; + /** + * Gets the value corresponding to the current axis point. + */ + GetValue(): Object; + /** + * Gets the display text corresponding to the current axis point. + */ + GetDisplayText(): string; + /** + * Gets the unique value corresponding to the current axis point. + */ + GetUniqueValue(): Object; + /** + * Gets the dimension values at the specified axis point. + */ + GetDimensionValue(): ASPxClientDashboardItemDataDimensionValue; + /** + * Gets the dimension value at the current axis point. + * @param dimensionId A String value that specifies the dimension identifier. + */ + GetDimensionValue(dimensionId: string): ASPxClientDashboardItemDataDimensionValue; + /** + * Gets the child axis points for the current axis point. + */ + GetChildren(): ASPxClientDashboardItemDataAxisPoint[]; + /** + * Gets the parent axis point for the current axis point. + */ + GetParent(): ASPxClientDashboardItemDataAxisPoint; +} +/** + * Represents a tuple of axis points. + */ +interface ASPxClientDashboardItemDataAxisPointTuple { + /** + * Returns the axis point belonging to the default data axis. + */ + GetAxisPoint(): ASPxClientDashboardItemDataAxisPoint; + /** + * Returns the axis point belonging to the specified data axis. + * @param axisName A string value returned by the DashboardDataAxisNames class that specifies the name of the data axis. + */ + GetAxisPoint(axisName: string): ASPxClientDashboardItemDataAxisPoint; +} +/** + * A range in the Range Filter dashboard item. + */ +interface ASPxClientDashboardRangeFilterSelection { + /** + * Gets or sets a maximum value in the range of the Range Filter dashboard item. + * Value: A maximum value in the range of the Range Filter dashboard item. + */ + Maximum: Object; + /** + * Gets or sets a minimum value in the range of the Range Filter dashboard item. + * Value: A minimum value in the range of the Range Filter dashboard item. + */ + Minimum: Object; +} +/** + * A collection of ASPxClientDashboardParameter objects. + */ +interface ASPxClientDashboardParameters { + /** + * Returns an array of dashboard parameters from the ASPxClientDashboardParameters collection. + */ + GetParameterList(): ASPxClientDashboardParameter[]; + /** + * Returns a dashboard parameter by its name. + * @param name A String object that specifies the parameter name. + */ + GetParameterByName(name: string): ASPxClientDashboardParameter; + /** + * Returns a dashboard parameter by its index in the ASPxClientDashboardParameters collection. + * @param index An integer value that specifies the parameter index. + */ + GetParameterByIndex(index: number): ASPxClientDashboardParameter; +} +/** + * A client-side dashboard parameter. + */ +interface ASPxClientDashboardParameter { + /** + * Gets the dashboard parameter name on the client side. + * Value: A String that is the dashboard parameter name on the client side. + */ + Name: string; + /** + * Gets the dashboard parameter value on the client side. + * Value: A String that specifies the dashboard parameter value on the client side. + */ + Value: Object; + /** + * Returns a parameter name. + */ + GetName(): string; + /** + * Returns a current parameter value(s). + */ + GetValue(): Object; + /** + * Specifies the current parameter value(s). + * @param value The current parameter value(s). + */ + SetValue(value: Object): void; + /** + * Returns a default parameter value. + */ + GetDefaultValue(): Object; + /** + * Returns the parameter's description displayed to an end-user. + */ + GetDescription(): string; + /** + * Returns a parameter type. + */ + GetType(): string; + /** + * Returns possible parameter values. + */ + GetValues(): ASPxClientDashboardParameterValue[]; +} +/** + * Provides access to the parameter value and display text. + */ +interface ASPxClientDashboardParameterValue { + /** + * Returns the parameter display text. + */ + GetDisplayText(): string; + /** + * Returns a parameter value. + */ + GetValue(): Object; +} +/** + * Contains settings that specify parameters affecting how the dashboard or dashboard item is exported in Image format. + */ +interface ImageFormatOptions { + /** + * Gets or sets an image format in which the dashboard (dashboard item) is exported. + * Value: A value returned by the DashboardExportImageFormat class that specifies an image format in which the dashboard (dashboard item) is exported. + */ + Format: string; + /** + * Gets or sets the resolution (in dpi) used to export a dashboard (dashboard item) in Image format. + * Value: An integer value that specifies the resolution (in dpi) used to export a dashboard (dashboard item) in Image format. + */ + Resolution: number; +} +/** + * Contains options which define how the dashboard item is exported to Excel format. + */ +interface ExcelFormatOptions { + /** + * Gets or sets the Excel format in which the dashboard item is exported. + * Value: A value returned by the DashboardExportExcelFormat class that specifies the Excel format in which the dashboard item is exported. + */ + Format: string; + /** + * Gets or sets a character used to separate values in a CSV document. + * Value: A String value that specifies the character used to separate values in a CSV document. + */ + CsvValueSeparator: string; +} +/** + * Contains settings that specify parameters affecting how the Grid dashboard item is exported. + */ +interface GridExportOptions { + /** + * Gets or sets whether the size of the Grid dashboard item is changed according to the width of the exported page. + * Value: true, to change the size of the Grid dashboard item according to the width of the exported page; otherwise, false. + */ + FitToPageWidth: boolean; + /** + * Gets or sets whether to print column headers of the Grid dashboard item on every page. + * Value: true, to print column headers on every page; otherwise, false. + */ + PrintHeadersOnEveryPage: boolean; +} +/** + * Contains settings that specify parameters affecting how the Pivot dashboard item is exported. + */ +interface PivotExportOptions { + /** + * Gets or sets whether to print the column headers of the Pivot dashboard item on every page. + * Value: true, to print column headers on every page; otherwise, false. + */ + PrintHeadersOnEveryPage: boolean; +} +/** + * Contains settings that specify parameters affecting how the Pie dashboard item is exported. + */ +interface PieExportOptions { + /** + * Gets or sets whether dashboard item elements are arranged automatically on the exported page. + * Value: true, to arrange dashboard item elements automatically on the exported page; otherwise, false. + */ + AutoArrangeContent: boolean; +} +/** + * Contains settings that specify parameters affecting how the Gauge dashboard item is exported. + */ +interface GaugeExportOptions { + /** + * Gets or sets whether dashboard item elements are arranged automatically on the exported page. + * Value: true, to arrange dashboard item elements automatically on the exported page; otherwise, false. + */ + AutoArrangeContent: boolean; +} +/** + * Contains settings that specify parameters affecting how the Card dashboard item is exported. + */ +interface CardExportOptions { + /** + * Gets or sets whether dashboard item elements are arranged automatically on the exported page. + * Value: true, to arrange dashboard item elements automatically on the exported page; otherwise, false. + */ + AutoArrangeContent: boolean; +} +/** + * Contains settings that specify parameters affecting how the Range Filter dashboard item is exported. + */ +interface RangeFilterExportOptions { + /** + * Gets or sets whether the page orientation used to export a Range Filter dashboard item is selected automatically. + * Value: true, to automatically select the page orientation used to export a Range Filter dashboard item; otherwise, false. + */ + AutomaticPageLayout: boolean; + /** + * Gets or sets the export size mode for the Range Filter dashboard item. + * Value: A value returned by the RangeFilterExportSizeMode class that specifies the export size mode for the Range Filter dashboard item. + */ + SizeMode: string; +} +/** + * Contains settings that specify parameters affecting how Chart dashboard items are exported. + */ +interface ChartExportOptions { + /** + * Gets or sets whether the page orientation used to export a Chart dashboard item is selected automatically. + * Value: true, to automatically select the page orientation used to export a Chart dashboard item; otherwise, false. + */ + AutomaticPageLayout: boolean; + /** + * Gets or sets the export size mode for the Chart dashboard item. + * Value: A value returned by the ChartExportSizeMode class that specifies the export size mode for the Chart dashboard item. + */ + SizeMode: string; +} +/** + * Contains settings that specify parameters affecting how Map dashboard items are exported. + */ +interface MapExportOptions { + /** + * Gets or sets whether the page orientation used to export a map dashboard item is selected automatically. + * Value: true, to automatically select the page orientation used to export a map dashboard item; otherwise, false. + */ + AutomaticPageLayout: boolean; + /** + * Gets or sets the export size mode for the map dashboard item. + * Value: A value returned by the MapExportSizeMode class that specifies specifies the export size mode for the map dashboard item. + */ + SizeMode: string; +} +/** + * Contains settings that specify parameters affecting how the dashboard (dashboard item) is exported. + */ +interface ASPxClientDashboardExportOptions { + /** + * Gets or sets the standard paper size. + * Value: A string value returned by the DashboardExportPaperKind class that specifies the standard paper size. + */ + PaperKind: string; + /** + * Gets or sets the page orientation used to export a dashboard (dashboard item). + * Value: A string value returned by the DashboardExportPageLayout class that specifies the page orientation used to export a dashboard (dashboard item). + */ + PageLayout: string; + /** + * Gets or sets the mode for scaling when exporting a dashboard (dashboard item). + * Value: A string value returned by the DashboardExportScaleMode class that specifies the mode for scaling when exporting a dashboard (dashboard item). + */ + ScaleMode: string; + /** + * Gets or sets the scale factor (in fractions of 1) by which a dashboard (dashboard item) is scaled. + * Value: A Single value that specifies the scale factor by which a dashboard (dashboard item) is scaled. + */ + ScaleFactor: number; + /** + * Gets or sets the number of horizontal/vertical pages spanning the total width/height of a dashboard (dashboard item). + * Value: An integer value that specifies the number of horizontal/vertical pages spanning the total width/height of a dashboard (dashboard item). + */ + AutoFitPageCount: number; + /** + * Gets or sets the title of the exported document. + * Value: A String value that specifies the title of the exported document. + */ + Title: string; + /** + * Gets or sets whether a dashboard title (or dashboard item's caption) is included as the exported document title. + * Value: A DefaultBoolean value that specifies whether a dashboard title (or dashboard item's caption) is included as the exported document title. + */ + ShowTitle: boolean; + /** + * Gets or sets the filter state's location on the exported document. + * Value: A string value returned by the DashboardExportFilterState class that specifies the filter state's location on the exported document. + */ + FilterState: string; + /** + * Provides access to options for exporting a dashboard or individual items in Image format. + * Value: An ImageFormatOptions object containing settings that specify parameters affecting how the dashboard or dashboard item is exported in Image format. + */ + ImageOptions: ImageFormatOptions; + /** + * Provides access to options for exporting individual dashboard items in Excel format. + * Value: An ExcelFormatOptions object containing settings that specify parameters affecting how the dashboard item is exported in Excel format. + */ + ExcelOptions: ExcelFormatOptions; + /** + * Provides access to options for exporting a Grid dashboard item. + * Value: A GridExportOptions object containing settings that specify parameters that affect how Grid dashboard items are exported. + */ + GridOptions: GridExportOptions; + /** + * Provides access to options for exporting a Pivot dashboard item. + * Value: A PivotExportOptions object containing settings that specify parameters that affect how Pivot dashboard items are exported. + */ + PivotOptions: PivotExportOptions; + /** + * Provides access to options for exporting a Pie dashboard item. + * Value: A PieExportOptions object containing settings that specify parameters that affect how Pie dashboard items are exported. + */ + PieOptions: PieExportOptions; + /** + * Provides access to options for exporting a Gauge dashboard item. + * Value: A GaugeExportOptions object containing settings that specify parameters that affect how Gauge dashboard items are exported. + */ + GaugeOptions: GaugeExportOptions; + /** + * Provides access to options for exporting a Card dashboard item. + * Value: A CardExportOptions object containing settings that specify parameters that affect how Card dashboard items are exported. + */ + CardOptions: CardExportOptions; + /** + * Provides access to options for exporting a Range Filter dashboard item. + * Value: A RangeFilterExportOptions object containing settings that specify parameters affecting how the Range Filter dashboard item is exported. + */ + RangeFilterOptions: RangeFilterExportOptions; + /** + * Provides access to options for exporting a Chart dashboard item. + * Value: A ChartExportOptions object containing settings that specify parameters that affect how Chart dashboard items are exported. + */ + ChartOptions: ChartExportOptions; + /** + * Provides access to options for exporting map dashboard items. + * Value: A MapExportOptions object containing settings that specify parameters that affect how map dashboard items are exported. + */ + MapOptions: MapExportOptions; +} +/** + * A client-side equivalent of the ASPxDashboard control. + */ +interface ASPxClientDashboard extends ASPxClientControl { + /** + * Fires when a round trip to the server has been initiated by a call to the client PerformDataCallback method. + */ + CustomDataCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs after the state of the dashboard displayed in the ASPxClientDashboard is changed. + */ + DashboardStateChanged: ASPxClientEvent>; + /** + * Occurs after a new dashboard is displayed in the ASPxClientDashboard. + */ + DashboardChanged: ASPxClientEvent>; + /** + * For internal use. + */ + CustomizeMenuItems: ASPxClientEvent>; + /** + * For internal use. + */ + BeforeRender: ASPxClientEvent>; + /** + * Occurs when an end-user clicks a dashboard item. + */ + ItemClick: ASPxClientEvent>; + /** + * Allows you to provide custom visual interactivity for data-bound dashboard items that support element selection and highlighting + */ + ItemVisualInteractivity: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemWidgetCreated: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemWidgetUpdating: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemWidgetUpdated: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemBeforeWidgetDisposed: ASPxClientEvent>; + /** + * Occurs after the selection within the dashboard item is changed. + */ + ItemSelectionChanged: ASPxClientEvent>; + /** + * Allows you to color the required dashboard item elements using the specified colors. + */ + ItemElementCustomColor: ASPxClientEvent>; + /** + * Occurs when a master filter state is changed. + */ + ItemMasterFilterStateChanged: ASPxClientEvent>; + /** + * Occurs when a drill-down/drill-up is performed. + */ + ItemDrillDownStateChanged: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback A ASPxClientDataCallback object that represents the JavaScript function which receives the callback data as a parameter. + */ + PerformDataCallback(parameter: string, onCallback: ASPxClientDataCallback): void; + /** + * Switches the ASPxClientDashboard to the viewer mode. + */ + SwitchToViewer(): void; + /** + * Switches the ASPxClientDashboard to the designer mode. + */ + SwitchToDesigner(): void; + /** + * Gets the current working mode of the Web Dashboard. + */ + GetWorkingMode(): string; + /** + * Gets the identifier of the dashboard that is displayed in the ASPxClientDashboard. + */ + GetDashboardId(): string; + /** + * Gets the name of the dashboard that is displayed in the ASPxClientDashboard. + */ + GetDashboardName(): string; + /** + * Gets the state of the dashboard displayed in the ASPxClientDashboard. + */ + GetDashboardState(): string; + /** + * Loads a dashboard with the specified identifier. + * @param dashboardId A String value that specifies the dashboard identifier. + */ + LoadDashboard(dashboardId: string): void; + /** + * Saves a current dashboard to the dashboard storage. + */ + SaveDashboard(): void; + /** + * Invokes the Dashboard Parameters dialog. + */ + ShowParametersDialog(): void; + /** + * Closes the Dashboard Parameters dialog. + */ + HideParametersDialog(): void; + /** + * Returns dashboard parameter settings and metadata. + */ + GetParameters(): ASPxClientDashboardParameters; + /** + * Invokes the dialog that allows end-users to export the entire dashboard to the specified format. + * @param format A string value that specifies the format. For instance, you can use 'PDF' or 'Image'. + */ + ShowExportDashboardDialog(format: string): void; + /** + * Invokes the dialog that allows end-users to export the dashboard item to the specified format. + * @param itemComponentName A string value that specifies the component name of the dashboard item to export. + * @param format A string value that specifies the format. For instance, you can use 'PDF, 'Image' or 'Excel'. + */ + ShowExportDashboardItemDialog(itemComponentName: string, format: string): void; + /** + * Hides the dialog that allows end-users to export the dashboard/dashboard item. + */ + HideExportDialog(): void; + /** + * Returns settings that specify parameters affecting how the dashboard is exported. + */ + GetExportOptions(): ASPxClientDashboardExportOptions; + /** + * Specifies settings that specify parameters affecting how the dashboard is exported. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + */ + SetExportOptions(options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard to a PDF file and writes it to the Response. + */ + ExportToPdf(): void; + /** + * Exports a dashboard to a PDF file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + */ + ExportToPdf(options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard to a PDF file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + * @param fileName A string that specifies the name of the exported file. + */ + ExportToPdf(options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Exports a dashboard to an Image file and writes it to the Response. + */ + ExportToImage(): void; + /** + * Exports a dashboard to an Image file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + */ + ExportToImage(options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard to an Image file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + * @param fileName A string that specifies the name of the exported file. + */ + ExportToImage(options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Exports a dashboard item to a PDF file and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + */ + ExportDashboardItemToPdf(itemName: string): void; + /** + * Exports a dashboard item to a PDF file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + */ + ExportDashboardItemToPdf(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to a PDF file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + * @param fileName A string that specifies the name of the exported file. + */ + ExportDashboardItemToPdf(itemName: string, options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Exports a dashboard item to an Image file and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + */ + ExportDashboardItemToImage(itemName: string): void; + /** + * Exports a dashboard item to an Image file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + */ + ExportDashboardItemToImage(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to an Image file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + * @param fileName A string value that specifies the name of the exported file. + */ + ExportDashboardItemToImage(itemName: string, options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Exports a dashboard item to an Excel file and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + */ + ExportDashboardItemToExcel(itemName: string): void; + /** + * Exports a dashboard item to an Excel file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + */ + ExportDashboardItemToExcel(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to an Excel file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + * @param fileName A string that specifies the name of the exported Excel file. + */ + ExportDashboardItemToExcel(itemName: string, options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Returns whether or not master filtering can be applied in the current state of the specified master filter item. + * @param itemName A string that specifies the component name of the master filter item. + */ + CanSetMasterFilter(itemName: string): boolean; + /** + * Returns whether or not the specified master filter can be cleared in the current state. + * @param itemName A string that specifies the component name of the master filter item. + */ + CanClearMasterFilter(itemName: string): boolean; + /** + * Returns whether or not drill down is possible in the current state of the specified dashboard item. + * @param itemName A string that specifies the component name of the dashboard item. + */ + CanPerformDrillDown(itemName: string): boolean; + /** + * Returns whether or not drill up is possible in the current state of the specified dashboard item. + * @param itemName A string that specifies the component name of the dashboard item. + */ + CanPerformDrillUp(itemName: string): boolean; + /** + * Selects required elements by their values in the specified master filter item. + * @param itemName A String that specifies the component name of the master filter item. + * @param values Values that will be used to select elements in the master filter item. + */ + SetMasterFilter(itemName: string, values: Object[][]): void; + /** + * Selects the required elements in the specified master filter item. + * @param itemName A String that species the component name of the master filter item. + * @param axisPointTuples An array of ASPxClientDashboardItemDataAxisPointTuple objects used to identify master filter elements. + */ + SetMasterFilter(itemName: string, axisPointTuples: ASPxClientDashboardItemDataAxisPointTuple[]): void; + /** + * Performs a drill-down into the required element by its value. + * @param itemName A String that species the component name of the dashboard item. + * @param value A value that will be used to perform a drill-down for the required element. + */ + PerformDrillDown(itemName: string, value: Object): void; + /** + * Performs a drill-down into the required element. + * @param itemName A String that specifies the component name of the dashboard item. + * @param axisPointTuple A ASPxClientDashboardItemDataAxisPointTuple object representing a set of axis points. + */ + PerformDrillDown(itemName: string, axisPointTuple: ASPxClientDashboardItemDataAxisPointTuple): void; + /** + * Clears the specified master filter item. + * @param itemName A string that specifies the component name of the master filter item. + */ + ClearMasterFilter(itemName: string): void; + /** + * Performs a drill-up for the specified dashboard item. + * @param itemName A String that specifies the component name of the dashboard item. + */ + PerformDrillUp(itemName: string): void; + /** + * Returns axis point tuples identifying elements that can be used to perform drill-down in the specified dashboard item. + * @param itemName A String that is the component name of the dashboard item. + */ + GetAvailableDrillDownValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Returns the axis point tuple identifying the current drill-down state. + * @param itemName A String that is the component name of the dashboard item. + */ + GetCurrentDrillDownValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple; + /** + * Returns axis point tuples identifying elements that can be selected in the current state of the master filter item. + * @param itemName A String that is the component name of the master filter item. + */ + GetAvailableFilterValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Returns axis point tuples identifying currently selected elements in the master filter item. + * @param itemName A String that is the component name of the master filter item. + */ + GetCurrentFilterValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Returns currently selected elements in the master filter item. + * @param itemName A String that specifies a component name of the master filter item. + */ + GetCurrentSelection(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Returns the client data for the specified dashboard item. + * @param itemName A String that specifies the component name of the dashboard item. + */ + GetItemData(itemName: string): ASPxClientDashboardItemData; + /** + * Refreshes an entire dashboard displayed in the Web Dashboard control. + */ + Refresh(): void; + /** + * Refreshes the specific item from the dashboard displayed in the Web Dashboard control. + * @param itemName A string value that specifies the component name of the dashboard item to be refreshed. + */ + Refresh(itemName: string): void; + /** + * Refreshes specific items from the dashboard displayed in the Web Dashboard control. + * @param itemName An array of string values that specify the component names of the dashboard items to be refreshed. + */ + Refresh(itemName: string[]): void; + /** + * Requests underlying data for the specified dashboard item. + * @param itemName A String that specifies the component name of the dashboard item. + * @param args A ASPxClientDashboardItemRequestUnderlyingDataParameters object containing parameters used to obtain the underlying data. + * @param onCompleted A ASPxClientDashboardItemRequestUnderlyingDataCompleted object that references a method executed after the request is completed. + */ + RequestUnderlyingData(itemName: string, args: ASPxClientDashboardItemRequestUnderlyingDataParameters, onCompleted: ASPxClientDashboardItemRequestUnderlyingDataCompleted): void; + /** + * Returns the currently selected range in the specified Range Filter dashboard item. + * @param itemName A String value that specifies the component name of the Range Filter dashboard item. + */ + GetCurrentRange(itemName: string): ASPxClientDashboardRangeFilterSelection; + /** + * Returns the visible range for the specified Range Filter dashboard item. + * @param itemName A String value that specifies the component name of the Range Filter dashboard item. + */ + GetEntireRange(itemName: string): ASPxClientDashboardRangeFilterSelection; + /** + * Selects the required range in the specified Range Filter dashboard item. + * @param itemName A String that specifies the component name of the Range Filter dashboard item. + * @param range A String value that specifies the component name of the Range Filter dashboard item. + */ + SetRange(itemName: string, range: ASPxClientDashboardRangeFilterSelection): void; + /** + * Selects a predefined range in the Range Filter dashboard item. + * @param itemName A String value that specifies the component name of the Range Filter. + * @param dateTimePeriodName A String value that specifies the predefined range name. + */ + SetPredefinedRange(itemName: string, dateTimePeriodName: string): void; +} +/** + * References a method that will handle the DashboardStateChanged event. + */ +interface ASPxClientDashboardStateChangedEventHandler { + /** + * References a method that will handle the DashboardStateChanged event. + * @param source The event source. + * @param e A ASPxClientDashboardStateChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardStateChangedEventArgs): void; +} +/** + * Provides data for the DashboardStateChanged event. + */ +interface ASPxClientDashboardStateChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the current state of the dashboard. + * Value: A String that is the current state of the dashboard. + */ + DashboardState: string; +} +/** + * References a method that will handle the DashboardChanged event. + */ +interface ASPxClientDashboardChangedEventHandler { + /** + * References a method that will handle the DashboardChanged event. + * @param source The event source. + * @param e A ASPxClientDashboardChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardChangedEventArgs): void; +} +/** + * Provides data for the DashboardChanged event. + */ +interface ASPxClientDashboardChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the identifier of a newly opened dashboard. + * Value: A String values that is an identifier of newly opened dashboard. + */ + DashboardId: string; + /** + * Gets the name of a newly opened dashboard. + * Value: A string value that is the name of newly opened dashboard. + */ + DashboardName: string; +} +interface ASPxClientDashboardCustomizeMenuItemsEventHandler { + (source: S, e: ASPxClientDashboardCustomizeMenuItemsEventArgs): void; +} +interface ASPxClientDashboardMenuItem { + id: string; + title: string; + template: string; + selected: boolean; + disabled: boolean; + hasSeparator: boolean; + click: Function; + hotKey: number; +} +interface ASPxClientDashboardCustomizeMenuItemsEventArgs extends ASPxClientEventArgs { + Items: ASPxClientDashboardMenuItem[]; + FindById(itemId: string): ASPxClientDashboardMenuItem; +} +interface ASPxClientDashboardBeforeRenderEventHandler { + (source: S, e: ASPxClientEventArgs): void; +} +/** + * Serves as the base class for classes that provide data for client-side events related to dashboard items. + */ +interface ASPxClientDashboardItemEventArgs extends ASPxClientEventArgs { + /** + * Gets the component name of the dashboard item. + * Value: A string value that is the component name of the dashboard item. + */ + ItemName: string; + /** + * Returns whether or not the specified value is null. + * @param value The specified value. + */ + IsNullValue(value: Object): boolean; + /** + * Returns whether or not the specified value is 'others'. + * @param value The specified value. + */ + IsOthersValue(value: Object): boolean; +} +/** + * References a method that will handle the ItemMasterFilterStateChanged event. + */ +interface ASPxClientDashboardItemMasterFilterStateChangedEventHandler { + /** + * References a method that will handle the ItemMasterFilterStateChanged event. + * @param source The event source. + * @param e An ASPxClientDashboardItemMasterFilterStateChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemMasterFilterStateChangedEventArgs): void; +} +/** + * Provides data for the ItemMasterFilterStateChanged event. + */ +interface ASPxClientDashboardItemMasterFilterStateChangedEventArgs extends ASPxClientDashboardItemEventArgs { + /** + * Gets the currently selected values. + * Value: An array of objects that are the currently selected values. + */ + Values: Object[][]; +} +/** + * References a method that will handle the ItemDrillDownStateChanged event. + */ +interface ASPxClientDashboardItemDrillDownStateChangedEventHandler { + /** + * References a method that will handle the ItemDrillDownStateChanged event. + * @param source The event source. + * @param e An ASPxClientDashboardItemDrillDownStateChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardItemDrillDownStateChangedEventArgs): void; +} +/** + * Provides data for the ItemDrillDownStateChanged event. + */ +interface ASPxClientDashboardItemDrillDownStateChangedEventArgs extends ASPxClientDashboardItemEventArgs { + /** + * Gets the drill-down action performed in the dashboard item. + * Value: A string value that is the drill-down action performed in the dashboard item. + */ + Action: string; + /** + * Gets values from the current drill-down hierarchy. + * Value: An array of values from the current drill-down hierarchy. + */ + Values: Object[]; +} +/** + * A client-side equivalent of the ASPxDashboardViewer control. + */ +interface ASPxClientDashboardViewer extends ASPxClientControl { + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs after the available interactivity actions have changed. + */ + ActionAvailabilityChanged: ASPxClientEvent>; + /** + * Occurs when an end-user changes the state of the master filter. + */ + MasterFilterSet: ASPxClientEvent>; + /** + * Occurs when an end-user clears the selection in the master filter item. + */ + MasterFilterCleared: ASPxClientEvent>; + /** + * Provides the capability to handle data loading errors in the ASPxClientDashboardViewer. + */ + DataLoadingError: ASPxClientEvent>; + /** + * Occurs after a drill-down is performed. + */ + DrillDownPerformed: ASPxClientEvent>; + /** + * Occurs after a drill-up is performed. + */ + DrillUpPerformed: ASPxClientEvent>; + /** + * Occurs after the ASPxClientDashboardViewer is loaded. + */ + Loaded: ASPxClientEvent>; + /** + * Occurs when an end-user clicks a dashboard item. + */ + ItemClick: ASPxClientEvent>; + /** + * Allows you to provide custom visual interactivity for data-bound dashboard items that support element selection and highlighting + */ + ItemVisualInteractivity: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemWidgetCreated: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemWidgetUpdating: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemWidgetUpdated: ASPxClientEvent>; + /** + * Allows you to access underlying UI/Data Visualization widgets. + */ + ItemBeforeWidgetDisposed: ASPxClientEvent>; + /** + * Occurs after the selection within the dashboard item is changed. + */ + ItemSelectionChanged: ASPxClientEvent>; + /** + * Allows you to color the required dashboard item elements using the specified colors. + */ + ItemElementCustomColor: ASPxClientEvent>; + /** + * Reloads data in the data sources. + */ + ReloadData(): void; + /** + * Reloads data in the data sources. + * @param parameters An array of ASPxClientDashboardParameter objects that specify dashboard parameters on the client side. + */ + ReloadData(parameters: ASPxClientDashboardParameter[]): void; + /** + * Returns dashboard parameter settings and metadata. + */ + GetParameters(): ASPxClientDashboardParameters; + /** + * Locks the EndUpdateParameters method call. + */ + BeginUpdateParameters(): void; + /** + * Unlocks the BeginUpdateParameters method and applies changes made to the parameter settings. + */ + EndUpdateParameters(): void; + /** + * Returns the currently selected range in the specified Range Filter dashboard item. + * @param itemName A String value that specifies the component name of the Range Filter dashboard item. + */ + GetCurrentRange(itemName: string): ASPxClientDashboardRangeFilterSelection; + /** + * Returns the visible range for the specified Range Filter dashboard item. + * @param itemName A String value that specifies the component name of the Range Filter dashboard item. + */ + GetEntireRange(itemName: string): ASPxClientDashboardRangeFilterSelection; + /** + * Selects the required range in the specified Range Filter dashboard item. + * @param itemName A String that specifies the component name of the Range Filter dashboard item. + * @param range A String value that specifies the component name of the Range Filter dashboard item. + */ + SetRange(itemName: string, range: ASPxClientDashboardRangeFilterSelection): void; + /** + * Selects a predefined range in the Range Filter dashboard item. + * @param itemName A String value that specifies the component name of the Range Filter. + * @param dateTimePeriodName A String value that specifies the predefined range name. + */ + SetPredefinedRange(itemName: string, dateTimePeriodName: string): void; + /** + * Returns axis point tuples identifying elements that can be used to perform drill-down in the specified dashboard item. + * @param itemName A String that is the component name of the dashboard item. + */ + GetAvailableDrillDownValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Returns the axis point tuple identifying the current drill-down state. + * @param itemName A String that is the component name of the dashboard item. + */ + GetCurrentDrillDownValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple; + /** + * Returns axis point tuples identifying elements that can be selected in the current state of the master filter item. + * @param itemName A String that is the component name of the master filter item. + */ + GetAvailableFilterValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Returns axis point tuples identifying currently selected elements in the master filter item. + * @param itemName A String that is the component name of the master filter item. + */ + GetCurrentFilterValues(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Returns currently selected elements in the master filter item. + * @param itemName A String that specifies a component name of the master filter item. + */ + GetCurrentSelection(itemName: string): ASPxClientDashboardItemDataAxisPointTuple[]; + /** + * Requests underlying data for the specified dashboard item. + * @param itemName A String that specifies the component name of the dashboard item. + * @param args A ASPxClientDashboardItemRequestUnderlyingDataParameters object containing parameters used to obtain the underlying data. + * @param onCompleted A ASPxClientDashboardItemRequestUnderlyingDataCompleted object that references a method executed after the request is completed. + */ + RequestUnderlyingData(itemName: string, args: ASPxClientDashboardItemRequestUnderlyingDataParameters, onCompleted: ASPxClientDashboardItemRequestUnderlyingDataCompleted): void; + /** + * Invokes the Dashboard Parameters dialog. + */ + ShowParametersDialog(): void; + /** + * Closes the Dashboard Parameters dialog. + */ + HideParametersDialog(): void; + /** + * Returns settings that specify parameters affecting how the dashboard is exported. + */ + GetExportOptions(): ASPxClientDashboardExportOptions; + /** + * Specifies settings that specify parameters affecting how the dashboard is exported. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + */ + SetExportOptions(options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard to a PDF file and writes it to the Response. + */ + ExportToPdf(): void; + /** + * Exports a dashboard to a PDF file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + */ + ExportToPdf(options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard to a PDF file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + * @param fileName A string that specifies the name of the exported file. + */ + ExportToPdf(options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Exports a dashboard to an Image file and writes it to the Response. + */ + ExportToImage(): void; + /** + * Exports a dashboard to an Image file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + */ + ExportToImage(options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard to an Image file with the specified export options and writes it to the Response. + * @param options A ASPxClientDashboardExportOptions object containing settings that specify parameters affecting how the dashboard is exported. + * @param fileName A string that specifies the name of the exported file. + */ + ExportToImage(options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Exports a dashboard item to a PDF file and writes it to the Response. + * @param itemName A String that is the component name of the dashboard item to be exported. + */ + ExportDashboardItemToPdf(itemName: string): void; + /** + * Exports a dashboard item to a PDF file with the specified export options and writes it to the Response. + * @param itemName A String that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + */ + ExportDashboardItemToPdf(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to a PDF file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + * @param fileName A string that specifies the name of the exported file. + */ + ExportDashboardItemToPdf(itemName: string, options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Exports a dashboard item to an Image file and writes it to the Response. + * @param itemName A String that is the component name of the dashboard item to be exported. + */ + ExportDashboardItemToImage(itemName: string): void; + /** + * Exports a dashboard item to an Image file with the specified export options and writes it to the Response. + * @param itemName A String that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + */ + ExportDashboardItemToImage(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to an Image file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + * @param fileName A string value that specifies the name of the exported file. + */ + ExportDashboardItemToImage(itemName: string, options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Exports a dashboard item to an Excel file and writes it to the Response. + * @param itemName A String that is the component name of the dashboard item to be exported. + */ + ExportDashboardItemToExcel(itemName: string): void; + /** + * Exports a dashboard item to an Excel file with the specified export options and writes it to the Response. + * @param itemName A String that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options to be applied to the exported dashboard item. + */ + ExportDashboardItemToExcel(itemName: string, options: ASPxClientDashboardExportOptions): void; + /** + * Exports a dashboard item to an Excel file with the specified export options and writes it to the Response. + * @param itemName A string that is the component name of the dashboard item to be exported. + * @param options An ASPxClientDashboardExportOptions object containing export options. + * @param fileName A string that specifies the name of the exported Excel file. + */ + ExportDashboardItemToExcel(itemName: string, options: ASPxClientDashboardExportOptions, fileName: string): void; + /** + * Returns the dashboard width. + */ + GetWidth(): number; + /** + * Returns the dashboard height. + */ + GetHeight(): number; + /** + * Specifies the dashboard width. + * @param width An integer value that specifies the dashboard width. + */ + SetWidth(width: number): void; + /** + * Specifies the dashboard height. + * @param height An integer value that specifies the dashboard height. + */ + SetHeight(height: number): void; + /** + * Specifies the dashboard size. + * @param width An integer value that specifies the dashboard width. + * @param height An integer value that specifies the dashboard height. + */ + SetSize(width: number, height: number): void; + /** + * Selects required elements by their values in the specified master filter item. + * @param itemName A String that species the component name of the master filter item. + * @param values Values that will be used to select elements in the master filter item. + */ + SetMasterFilter(itemName: string, values: Object[][]): void; + /** + * Selects the required elements in the specified master filter item. + * @param itemName A String that specifies the component name of the master filter item. + * @param axisPointTuples An array of ASPxClientDashboardItemDataAxisPointTuple objects used to identify master filter elements. + */ + SetMasterFilter(itemName: string, axisPointTuples: ASPxClientDashboardItemDataAxisPointTuple[]): void; + /** + * Performs a drill-down for the required element by its value. + * @param itemName A String that species the component name of the dashboard item. + * @param value A value that will be used to perform a drill-down for the required element. + */ + PerformDrillDown(itemName: string, value: Object): void; + /** + * Performs a drill-down for the required element. + * @param itemName A String that specifies the component name of the dashboard item. + * @param axisPointTuple A ASPxClientDashboardItemDataAxisPointTuple object representing a set of axis points. + */ + PerformDrillDown(itemName: string, axisPointTuple: ASPxClientDashboardItemDataAxisPointTuple): void; + /** + * Clears the specified master filter item. + * @param itemName A String that specifies the component name of the master filter item. + */ + ClearMasterFilter(itemName: string): void; + /** + * Performs a drill-up for the specified dashboard item. + * @param itemName A String that specifies the component name of the dashboard item. + */ + PerformDrillUp(itemName: string): void; + /** + * Returns whether or not the specified master filter item allows selecting one or more elements. + * @param itemName A String that specifies the component name of the master filter item. + */ + CanSetMasterFilter(itemName: string): boolean; + /** + * Returns whether or not the specified master filter can be cleared in the current state. + * @param itemName A String that specifies the component name of the master filter item. + */ + CanClearMasterFilter(itemName: string): boolean; + /** + * Returns whether or not drill down is possible in the current state of the specified dashboard item. + * @param itemName A String that specifies the component name of the dashboard item. + */ + CanPerformDrillDown(itemName: string): boolean; + /** + * Returns whether or not drill up is possible in the current state of the specified dashboard item. + * @param itemName A String that specifies the component name of the dashboard item. + */ + CanPerformDrillUp(itemName: string): boolean; + /** + * Returns the client data for the specified dashboard item. + * @param itemName A String that specifies the component name of the dashboard item. + */ + GetItemData(itemName: string): ASPxClientDashboardItemData; +} +/** + * References a method that will handle the ActionAvailabilityChanged event. + */ +interface ASPxClientDashboardActionAvailabilityChangedEventHandler { + /** + * References a method that will handle the ActionAvailabilityChanged event. + * @param source The event source. + * @param e A ASPxClientDashboardActionAvailabilityChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardActionAvailabilityChangedEventArgs): void; +} +/** + * Provides data for the ActionAvailabilityChanged event. + */ +interface ASPxClientDashboardActionAvailabilityChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets whether or not data reloading is available in the current state of dashboard item. + * Value: true, if data reloading is available in the current state of dashboard item; otherwise, false. + */ + IsReloadDataAvailable: boolean; + /** + * Gets interactivity actions currently available for the dashboard item. + * Value: An array of ASPxClientDashboardItemAction objects that represent interactivity actions currently available for the dashboard item. + */ + ItemActions: ASPxClientDashboardItemAction[]; +} +/** + * References a method that will handle the DataLoadingError event. + */ +interface ASPxClientDashboardDataLoadingErrorEventHandler { + /** + * References a method that will handle the DataLoadingError event. + * @param source The event source. + * @param e A ASPxClientDashboardDataLoadingErrorEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardDataLoadingErrorEventArgs): void; +} +/** + * Provides data for the DataLoadingError event. + */ +interface ASPxClientDashboardDataLoadingErrorEventArgs extends ASPxClientEventArgs { + /** + * Allows you to determine whether or not the error message will be shown. + */ + IsErrorMessageShown(): boolean; + /** + * Allows you to specify whether to show the error message. + * @param value true, to show the error message; otherwise, false. + */ + ShowErrorMessage(value: boolean): void; + /** + * Allows you to obtain the displayed error message. + */ + GetError(): string; + /** + * Allows you to specify the displayed error message. + * @param value A string value that specifies the displayed error message. + */ + SetError(value: string): void; +} +/** + * Represents an interactivity action in the dashboard item. + */ +interface ASPxClientDashboardItemAction { + /** + * Gets the name of the dashboard item. + * Value: A string that specifies the name of the dashboard item. + */ + ItemName: string; + /** + * Gets interactivity actions performed on a dashboard item. + * Value: An array of ASPxClientDashboardAction values that specify interactivity actions performed on a dashboard item. + */ + Actions: any[]; +} +declare enum ASPxClientDashboardAction { + SetMasterFilter=0, + ClearMasterFilter=1, + DrillDown=2, + DrillUp=3 +} +/** + * References a method that will handle the MasterFilterSet event. + */ +interface ASPxClientDashboardMasterFilterSetEventHandler { + /** + * References a method that will handle the MasterFilterSet event. + * @param source The event source. + * @param e A ASPxClientDashboardMasterFilterSetEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardMasterFilterSetEventArgs): void; +} +/** + * Provides data for the MasterFilterSet event. + */ +interface ASPxClientDashboardMasterFilterSetEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the dashboard item. + * Value: A String that specifies the name of the dashboard item. + */ + ItemName: string; + /** + * Gets values of currently selected elements in the master filter item. + * Value: Values of currently selected elements in the master filter item. + */ + Values: Object[][]; + /** + * Returns whether or not the specified value is NullValue. + * @param value The specified value. + */ + IsNullValue(value: Object): boolean; + /** + * Returns whether or not the specified value is OthersValue. + * @param value The specified value. + */ + IsOthersValue(value: Object): boolean; +} +/** + * References a method that will handle the MasterFilterCleared event. + */ +interface ASPxClientDashboardMasterFilterClearedEventHandler { + /** + * References a method that will handle the MasterFilterCleared event. + * @param source The event source. + * @param e A ASPxClientDashboardMasterFilterClearedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardMasterFilterClearedEventArgs): void; +} +/** + * Provides data for the MasterFilterCleared event. + */ +interface ASPxClientDashboardMasterFilterClearedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the dashboard item. + * Value: A String that is the name of the dashboard item. + */ + ItemName: string; +} +/** + * References a method that will handle the DrillDownPerformed event. + */ +interface ASPxClientDashboardDrillDownPerformedEventHandler { + /** + * References a method that will handle the DrillDownPerformed event. + * @param source The event source. + * @param e A ASPxClientDashboardDrillDownPerformedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardDrillDownPerformedEventArgs): void; +} +/** + * Provides data for the DrillDownPerformed event. + */ +interface ASPxClientDashboardDrillDownPerformedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the dashboard item. + * Value: A string that specifies the name of the dashboard item. + */ + ItemName: string; + /** + * Gets values from the current drill-down hierarchy. + * Value: An array of values from the current drill-down hierarchy. + */ + Values: Object[]; + /** + * Returns whether or not the specified value is NullValue. + * @param value The specified value. + */ + IsNullValue(value: Object): boolean; + /** + * Returns whether or not the specified value is OthersValue. + * @param value The specified value. + */ + IsOthersValue(value: Object): boolean; +} +/** + * References a method that will handle the DrillUpPerformed event. + */ +interface ASPxClientDashboardDrillUpPerformedEventHandler { + /** + * References a method that will handle the DrillUpPerformed event. + * @param source The event source. + * @param e A ASPxClientDashboardDrillUpPerformedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDashboardDrillUpPerformedEventArgs): void; +} +/** + * Provides data for the DrillUpPerformed event. + */ +interface ASPxClientDashboardDrillUpPerformedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the dashboard item. + * Value: A string that is the name of the dashboard item. + */ + ItemName: string; +} +/** + * Serves as the base object for all the editors included in the client-side object model. + */ +interface ASPxClientEditBase extends ASPxClientControl { + /** + * Returns the editor's value. + */ + GetValue(): Object; + /** + * Changes the editor's value. + * @param value An object representing the data to be assigned to the editor's edit value. + */ + SetValue(value: Object): void; + /** + * Returns a value indicating whether an editor is enabled. + */ + GetEnabled(): boolean; + /** + * Specifies whether an editor is enabled. + * @param value true to enable the editor; otherwise, false. + */ + SetEnabled(value: boolean): void; + /** + * Returns the text displayed in the editor caption. + */ + GetCaption(): string; + /** + * Specifies the text displayed in the editor caption. + * @param caption A string value specifying the editor caption. + */ + SetCaption(caption: string): void; +} +/** + * Serves as the base object for all the editors that support validation. + */ +interface ASPxClientEdit extends ASPxClientEditBase { + /** + * Fires on the client side when the editor receives input focus. + */ + GotFocus: ASPxClientEvent>; + /** + * Fires on the client side when the editor loses input focus. + */ + LostFocus: ASPxClientEvent>; + /** + * Allows you to specify whether the value entered into the editor is valid, and whether the editor is allowed to lose focus. + */ + Validation: ASPxClientEvent>; + /** + * Fires after the editor's value has been changed by end-user interactions. + */ + ValueChanged: ASPxClientEvent>; + /** + * Returns an HTML element that represents the control's input element. + */ + GetInputElement(): Object; + /** + * Sets input focus to the editor. + */ + Focus(): void; + /** + * Gets a value that indicates whether the editor's value passes validation. + */ + GetIsValid(): boolean; + /** + * Gets the error text to be displayed within the editor's error frame if the editor's validation fails. + */ + GetErrorText(): string; + /** + * Sets a value that specifies whether the editor's value is valid. + * @param isValid True if the editor's value is valid; otherwise, False. + */ + SetIsValid(isValid: boolean): void; + /** + * Sets the error text to be displayed within the editor's error frame if the editor's validation fails. + * @param errorText A string value representing the error text. + */ + SetErrorText(errorText: string): void; + /** + * Performs the editor's validation. + */ + Validate(): void; +} +/** + * Represents the client-side equivalent of the ASPxBinaryImage control. + */ +interface ASPxClientBinaryImage extends ASPxClientEdit { + /** + * Occurs on the client side after an image is clicked. + */ + Click: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client side if any server error occurs during server-side processing of a callback sent by the ASPxClientBinaryImage. + */ + CallbackError: ASPxClientEvent>; + /** + * Sets the size of the image editor. + * @param width An integer value that specifies the control's width. + * @param height An integer value that specifies the control's height. + */ + SetSize(width: number, height: number): void; + /** + * For internal use only. + */ + GetValue(): Object; + /** + * For internal use only. + * @param value + */ + SetValue(value: Object): void; + /** + * Removes an image from the editor content. + */ + Clear(): void; + /** + * Returns a name of the last uploaded file. + */ + GetUploadedFileName(): string; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * Represents the client-side equivalent of the ASPxButton control. + */ +interface ASPxClientButton extends ASPxClientControl { + /** + * Occurs on the client side when the button's checked state is changed. + */ + CheckedChanged: ASPxClientEvent>; + /** + * Fires on the client side when the button receives input focus. + */ + GotFocus: ASPxClientEvent>; + /** + * Fires on the client side when the button loses input focus. + */ + LostFocus: ASPxClientEvent>; + /** + * Occurs on the client side after a button is clicked. + */ + Click: ASPxClientEvent>; + /** + * Simulates a mouse click action on the button control. + */ + DoClick(): void; + /** + * Returns a value indicating whether the button is checked. + */ + GetChecked(): boolean; + /** + * Sets a value that specifies the button's checked status. + * @param value true if the button is checked; otherwise, false. + */ + SetChecked(value: boolean): void; + /** + * Returns the text displayed within the button. + */ + GetText(): string; + /** + * Sets the text to be displayed within the button. + * @param value A string value specifying the text to be displayed within the button. + */ + SetText(value: string): void; + /** + * Returns the URL pointing to the image displayed within the button. + */ + GetImageUrl(): string; + /** + * Sets the URL pointing to the image displayed within the button. + * @param value A string value that is the URL to the image displayed within the button. + */ + SetImageUrl(value: string): void; + /** + * Sets a value specifying whether the button is enabled. + * @param value true to enable the button; false to disable it. + */ + SetEnabled(value: boolean): void; + /** + * Returns a value indicating whether the button is enabled. + */ + GetEnabled(): boolean; + /** + * Sets input focus to the button. + */ + Focus(): void; +} +/** + * A method that will handle the client Click event. + */ +interface ASPxClientButtonClickEventHandler { + /** + * A method that will handle the client Click event. + * @param source An object that is the event's source. + * @param e An ASPxClientButtonClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientButtonClickEventArgs): void; +} +/** + * Provides data for the Click event. + */ +interface ASPxClientButtonClickEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Specifies whether both the event's default action and the event's bubbling upon the hierarchy of event handlers should be canceled. + * Value: true to cancel the event's default action and the event's bubbling upon the hierarchy of event handlers; otherwise, false. + */ + cancelEventAndBubble: boolean; +} +/** + * Represents the client-side equivalent of the ASPxCalendar control. + */ +interface ASPxClientCalendar extends ASPxClientEdit { + /** + * Fires on the client side after the selected date has been changed within the calendar. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Occurs on the client side when the month displayed within the calendar is changed. + */ + VisibleMonthChanged: ASPxClientEvent>; + /** + * Allows you to disable the calendar's days. + */ + CustomDisabledDate: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user presses a key while the editor has focus. + */ + KeyDown: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user presses and releases a key while the editor has focus. + */ + KeyPress: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user releases a pressed key while the editor has focus. + */ + KeyUp: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after the callback server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientCalendar. + */ + CallbackError: ASPxClientEvent>; + /** + * Tests whether the specified date is selected. + * @param date A date-time value that specifies the date to test. + */ + IsDateSelected(date: Date): boolean; + /** + * Sets the date that specifies the month and year to be displayed in the calendar. + * @param date The date that specifies calendar's visible month and year. + */ + SetVisibleDate(date: Date): void; + /** + * Sets the calendar's selected date. + * @param date A date object that specifies the calendar's selected date. + */ + SetSelectedDate(date: Date): void; + /** + * Returns the calendar's selected date. + */ + GetSelectedDate(): Date; + /** + * Gets the date that determines the month and year that are currently displayed in the calendar. + */ + GetVisibleDate(): Date; + /** + * Selects the specified date within the calendar. + * @param date A date-time value that specifies the selected date. + */ + SelectDate(date: Date): void; + /** + * Selects the specified range of dates within the calendar. + * @param start A date-time value that specifies the range's first date. + * @param end A date-time value that specifies the range's last date. + */ + SelectRange(start: Date, end: Date): void; + /** + * Deselects the specified date within the calendar. + * @param date A date-time value that specifies the date to deselect. + */ + DeselectDate(date: Date): void; + /** + * Deselects the specified range of dates within the calendar. + * @param start A date-time value that specifies the range's first date. + * @param end A date-time value that specifies the range's last date. + */ + DeselectRange(start: Date, end: Date): void; + /** + * Deselects all the selected dates within the calendar. + */ + ClearSelection(): void; + /** + * Returns a list of dates which are selected within the calendar. + */ + GetSelectedDates(): Date[]; + /** + * Gets the minimum date on the calendar. + */ + GetMinDate(): Date; + /** + * Sets the minimum date of the calendar. + * @param date A DateTime object representing the minimum date. + */ + SetMinDate(date: Date): void; + /** + * Gets the maximum date on the calendar. + */ + GetMaxDate(): Date; + /** + * Sets the maximum date of the calendar. + * @param date A DateTime object representing the maximum date. + */ + SetMaxDate(date: Date): void; +} +/** + * Provides data for the CustomDisabledDate event. + */ +interface ASPxClientCalendarCustomDisabledDateEventArgs extends ASPxClientEventArgs { + /** + * Gets the date processed in the calendar. + * Value: A DateTime value containing processed data. + */ + date: Date; + /** + * Gets or sets a value specifying whether selection of the processed calendar date is disabled. + * Value: true, if the date is disabled; otherwise, false. + */ + isDisabled: boolean; +} +/** + * A method that will handle the client CustomDisabledDate event. + */ +interface ASPxClientCalendarCustomDisabledDateEventHandler { + /** + * A method that will handle the client CustomDisabledDate event. + * @param source The event source. + * @param e An ASPxClientCalendarCustomDisabledDateEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCalendarCustomDisabledDateEventArgs): void; +} +/** + * Represents the client-side equivalent of the ASPxCaptcha control. + */ +interface ASPxClientCaptcha extends ASPxClientControl { + /** + * Sets input focus to the control's text box. + */ + Focus(): void; + /** + * Refreshes the code displayed within the editor's challenge image. + */ + Refresh(): void; +} +/** + * Represents the client-side equivalent of the ASPxCheckBox control. + */ +interface ASPxClientCheckBox extends ASPxClientEdit { + /** + * Occurs on the client side when the editor's checked state is changed. + */ + CheckedChanged: ASPxClientEvent>; + /** + * Returns a value indicating whether the check box editor is checked. + */ + GetChecked(): boolean; + /** + * Sets a value which specifies the checked status of the check box editor. + * @param isChecked true if the check box editor is checked; otherwise, false. + */ + SetChecked(isChecked: boolean): void; + /** + * Returns the text displayed within the editor. + */ + GetText(): string; + /** + * Returns a value which specifies a check box checked state. + */ + GetCheckState(): string; + /** + * Sets a value specifying the state of a check box. + * @param checkState A string value matches one of the CheckState enumeration values. + */ + SetCheckState(checkState: string): void; + /** + * Sets the text to be displayed within the editor. + * @param text A string value specifying the text to be displayed within the editor. + */ + SetText(text: string): void; +} +/** + * Represents the client-side equivalent of the ASPxRadioButton control. + */ +interface ASPxClientRadioButton extends ASPxClientCheckBox { + /** + * Returns a value indicating whether the radio button is checked. + */ + GetChecked(): boolean; + /** + * Sets a value which specifies the radio button's checked status. + * @param isChecked true if the radio button is checked; otherwise, false. + */ + SetChecked(isChecked: boolean): void; +} +/** + * Represents a base for client-side objects which allow single-line text input. + */ +interface ASPxClientTextEdit extends ASPxClientEdit { + /** + * Occurs on the client-side when an end-user presses a key while the editor has focus. + */ + KeyDown: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user presses and releases a key while the editor has focus. + */ + KeyPress: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user releases a pressed key while the editor has focus. + */ + KeyUp: ASPxClientEvent>; + /** + * Fires on the client side when the editor's text is changed and focus moves out of the editor by end-user interactions. + */ + TextChanged: ASPxClientEvent>; + /** + * Returns the text displayed within the editor. + */ + GetText(): string; + /** + * Sets the text to be displayed within the editor. + * @param text A string value specifying the text to be displayed within the editor. + */ + SetText(text: string): void; + /** + * Selects all text in the text editor. + */ + SelectAll(): void; + /** + * Sets the caret position within the edited text. + * @param position An integer value that specifies the zero-based index of a text character that shall precede the caret. + */ + SetCaretPosition(position: number): void; + /** + * Selects the specified portion of the editor's text. + * @param startPos A zero-based integer value specifying the selection's starting position. + * @param endPos A zero-based integer value specifying the selection's ending position. + * @param scrollToSelection true to scroll the editor's contents to make the selection visible; otherwise, false. + */ + SetSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; +} +/** + * Represents a base for client-side editors which are capable of displaying and editing text data in their edit regions. + */ +interface ASPxClientTextBoxBase extends ASPxClientTextEdit { +} +/** + * Represents a base for client button editor objects. + */ +interface ASPxClientButtonEditBase extends ASPxClientTextBoxBase { + /** + * Occurs on the client side after an editor button is clicked. + */ + ButtonClick: ASPxClientEvent>; + /** + * Specifies whether the button is visible. + * @param number An integer value specifying the button's index within the Buttons collection. + * @param value true, to make the button visible; otherwise, false. + */ + SetButtonVisible(number: number, value: boolean): void; + /** + * Returns a value specifying whether a button is displayed. + * @param number An integer value specifying the button's index within the Buttons collection. + */ + GetButtonVisible(number: number): boolean; +} +/** + * Represents a base class for the editors that contain a drop down window. + */ +interface ASPxClientDropDownEditBase extends ASPxClientButtonEditBase { + /** + * Occurs on the client-side when the drop down window is opened. + */ + DropDown: ASPxClientEvent>; + /** + * Occurs on the client side when the drop down window is closed. + */ + CloseUp: ASPxClientEvent>; + /** + * Occurs on the client side before the drop down window is closed and allows you to cancel the operation. + */ + QueryCloseUp: ASPxClientEvent>; + /** + * Modifies the size of the drop down window in accordance with its content. + */ + AdjustDropDownWindow(): void; + /** + * Invokes the editor's drop down window. + */ + ShowDropDown(): void; + /** + * Closes the opened drop down window of the editor. + */ + HideDropDown(): void; +} +/** + * Represents the client-side equivalent of the ASPxColorEdit control. + */ +interface ASPxClientColorEdit extends ASPxClientDropDownEditBase { + /** + * Fires after the selected color has been changed within the color editor via end-user interaction. + */ + ColorChanged: ASPxClientEvent>; + /** + * This event is not in effect for the ASPxClientColorEdit. Use the ColorChanged event instead. + */ + TextChanged: ASPxClientEvent>; + /** + * Returns the color editor's value. + */ + GetColor(): string; + /** + * Specifies the color value for the color editor. + * @param value A string value specifying the editor color. + */ + SetColor(value: string): void; + /** + * Indicates whether the automatic color item is selected. + */ + IsAutomaticColorSelected(): boolean; +} +/** + * Represent the client-side equivalent of the ASPxComboBox control. + */ +interface ASPxClientComboBox extends ASPxClientDropDownEditBase { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientComboBox. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client side after a different item in the list has been selected (focus has been moved from one item to another). + */ + SelectedIndexChanged: ASPxClientEvent>; + /** + * Specifies the text displayed within the editor's edit box. + * @param text A string value specifying the editor's text. + */ + SetText(text: string): void; + /** + * Adds a new item to the editor specifying the item's display text and returns the index of the added item. + * @param text A string value specifying the item's display text. + */ + AddItem(text: string): number; + /** + * Adds a new item to the editor specifying the item's display text and associated value, and returns the index of the added item. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + */ + AddItem(text: string, value: Object): number; + /** + * Adds a new item to the editor specifying the item's display text, associated value and displayed image, and returns the index of the added item. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + * @param imageUrl A string value specifying the path to the image displayed by the item. + */ + AddItem(text: string, value: Object, imageUrl: string): number; + /** + * Inserts a new item specified by its display text, associated value and displayed image into the editor's item collection, at the position specified. + * @param index An integer value representing the zero-based index of the position where the item should be inserted. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + * @param imageUrl A string value specifying the path to the image displayed by the item. + */ + InsertItem(index: number, text: string, value: Object, imageUrl: string): void; + /** + * Inserts a new item specified by its display text and associated value into the editor's item collection, at the position specified. + * @param index An integer value representing the zero-based index of the position where the item should be inserted. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + */ + InsertItem(index: number, text: string, value: Object): void; + /** + * Inserts a new item specified by its display text into the editor's item collection, at the position specified. + * @param index An integer value representing the zero-based index of the position where the item should be inserted. + * @param text A string value specifying the item's display text. + */ + InsertItem(index: number, text: string): void; + /** + * Removes an item specified by its index from the client list editor. + * @param index An integer value representing the index of the list item to be removed. + */ + RemoveItem(index: number): void; + /** + * Removes all items from the client combo box editor. + */ + ClearItems(): void; + /** + * Prevents the client combobox editor from being rendered until the EndUpdate method is called. + */ + BeginUpdate(): void; + /** + * Re-enables editor render operations after a call to the BeginUpdate method and forces an immediate re-rendering. + */ + EndUpdate(): void; + /** + * Scrolls the editor's item list, so that the specified item becomes visible. + * @param index An integer value that specifies the item's index within the editor's client item list. + */ + MakeItemVisible(index: number): void; + /** + * Returns an item specified by its index within the combo box editor's item collection. + * @param index An integer value specifying the zero-based index of the item to search for. + */ + GetItem(index: number): ASPxClientListEditItem; + /** + * Returns a combo box item by its text. + * @param text A string that specifies the item's text. + */ + FindItemByText(text: string): ASPxClientListEditItem; + /** + * Returns a combo box item by its value. + * @param value An object that specifies the item's value. + */ + FindItemByValue(value: Object): ASPxClientListEditItem; + /** + * Gets the number of items contained in the editor's item collection. + */ + GetItemCount(): number; + /** + * Returns the index of the selected item within the combo box editor. + */ + GetSelectedIndex(): number; + /** + * Sets the combobox editor's selected item specified by its index. + * @param index An integer value specifying the zero-based index of the item to select. + */ + SetSelectedIndex(index: number): void; + /** + * Returns the combo box editor's selected item. + */ + GetSelectedItem(): ASPxClientListEditItem; + /** + * Sets the list editor's selected item. + * @param item An ASPxClientListEditItem object that specifies the item to select. + */ + SetSelectedItem(item: ASPxClientListEditItem): void; + /** + * Gets the text displayed in the editor's edit box. + */ + GetText(): string; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Adds a new item to the editor, specifying the item's display text, and returns the index of the added item. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + */ + AddItem(texts: string[]): number; + /** + * Adds a new item to the end of the control's items collection. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + */ + AddItem(texts: string[], value: Object): number; + /** + * Adds a new item to the end of the control's items collection. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + * @param imageUrl A string value specifying the path to the image displayed by the item. + */ + AddItem(texts: string[], value: Object, imageUrl: string): number; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index An integer value that represents the index position. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + * @param imageUrl A String value specifying the path to the image displayed by the item. + */ + InsertItem(index: number, texts: string[], value: Object, imageUrl: string): void; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index An integer value that represents the index position. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + */ + InsertItem(index: number, texts: string[], value: Object): void; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index An integer value that represents the index position. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + */ + InsertItem(index: number, texts: string[]): void; + /** + * Determines whether the drop-down content is loaded; if not - loads the content. + * @param callbackFunction An object that is the JavaScript function that receives the callback data as a parameter. The function is performed after the combo box content is loaded. + */ + EnsureDropDownLoaded(callbackFunction: Object): void; + /** + * Defines the HTML content for the specified combo box item. + * @param index An integer value specifying the zero-based index of the item. + * @param html A string value that is the HTML code defining the content of the combo box item. + */ + SetItemHtml(index: number, html: string): void; + /** + * Sets the tooltip text for the combo box editor's item specified by its index. + * @param index An integer value specifying the zero-based index of the item. + * @param tooltip A string value specifying the tooltip text. + */ + SetItemTooltip(index: number, tooltip: string): void; + /** + * Sets the CSS class for a combo box item specified by its index. + * @param index An integer value specifying the zero-based index of the item. + * @param className A string value specifying the CSS class name. + */ + AddItemCssClass(index: number, className: string): void; + /** + * Removes the CSS class from a combo box item specified by its index. + * @param index An integer value specifying the zero-based index of the item. + * @param className A string value specifying the CSS class name. + */ + RemoveItemCssClass(index: number, className: string): void; + /** + * Defines the HTML content for the specified combo box item's text cell. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param html A string value that is the HTML code defining the content of the combo box item. + */ + SetItemTextCellHtml(itemIndex: number, textCellIndex: number, html: string): void; + /** + * Sets the tooltip text for the text cell of the editor's item specified by its index. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param tooltip A string value specifying the tooltip text. + */ + SetItemTextCellTooltip(itemIndex: number, textCellIndex: number, tooltip: string): void; + /** + * Sets the CSS class for a combo box item's text cell specified by its index. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param className A string value specifying the CSS class name. + */ + AddItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + /** + * Removes the CSS class from a combo box item's text cell specified by its index. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param className A string value specifying the CSS class name. + */ + RemoveItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; +} +/** + * Represents the client-side equivalent of the ASPxDateEdit control. + */ +interface ASPxClientDateEdit extends ASPxClientDropDownEditBase { + /** + * Fires after the selected date has been changed within the date editor. + */ + DateChanged: ASPxClientEvent>; + /** + * Enables you to convert the value entered by an end user into the value that will be stored by the date editor. + */ + ParseDate: ASPxClientEvent>; + /** + * Allows you to disable the calendar's days. + */ + CalendarCustomDisabledDate: ASPxClientEvent>; + /** + * This event is not in effect for the ASPxClientDateEdit. Use the DateChanged event instead. + */ + TextChanged: ASPxClientEvent>; + /** + * Returns the calendar of the date editor. + */ + GetCalendar(): ASPxClientCalendar; + /** + * Returns the built-in time edit control. + */ + GetTimeEdit(): ASPxClientTimeEdit; + /** + * Specifies the date for the editor. + * @param date A DateTime object that is the date. + */ + SetDate(date: Date): void; + /** + * Gets the date that is the editor's value. + */ + GetDate(): Date; + /** + * Returns the number of days in a range selected within a date edit. + */ + GetRangeDayCount(): number; + /** + * Gets the minimum date of the editor. + */ + GetMinDate(): Date; + /** + * Sets the minimum date of the editor. + * @param date A DateTime object representing the minimum date. + */ + SetMinDate(date: Date): void; + /** + * Gets the maximum date of the editor. + */ + GetMaxDate(): Date; + /** + * Sets the maximum date of the editor. + * @param date A DateTime object representing the maximum date. + */ + SetMaxDate(date: Date): void; +} +/** + * Provides data for the ParseDate client-side event that parses a string entered into a date editor. + */ +interface ASPxClientParseDateEventArgs extends ASPxClientEventArgs { + /** + * Gets the value entered into the date editor by an end user. + * Value: The string value entered into the date editor by an end user. + */ + value: string; + /** + * Gets or sets the edit value of the date editor. + * Value: A date/time value representing the edit value of the date editor. + */ + date: Date; + /** + * Gets or sets a value specifying whether the event was handled. + * Value: true if the event was handled and default processing should not occur; false if the event should be handled using default processing. + */ + handled: boolean; +} +/** + * A method that will handle the client ParseDate event, that parses a date editor's value when entered. + */ +interface ASPxClientParseDateEventHandler { + /** + * A method that will handle the ParseDate event. + * @param source An object representing the event source. Identifies the button editor that raised the event. + * @param e An ASPxClientParseDateEventArgs object that contains event data. + */ + (source: S, e: ASPxClientParseDateEventArgs): void; +} +/** + * Represents a base for client editor objects realizing the dropdown editor functionality. + */ +interface ASPxClientDropDownEdit extends ASPxClientDropDownEditBase { + /** + * Obtains the key value associated with the text displayed within the editor's edit box. + */ + GetKeyValue(): string; + /** + * Specifies the key value associated with the text displayed within the editor's edit box. + * @param keyValue A string specifying the key value associated with the editor's value (displayed text). + */ + SetKeyValue(keyValue: string): void; +} +/** + * A method that will handle the client events involving a keyboard key being pressed or released. + */ +interface ASPxClientEditKeyEventHandler { + /** + * A method that will handle the client events concerning a keyboard key being pressed. + * @param source The event source. This parameter identifies the editor which raised the event. + * @param e An ASPxClientEditKeyEventArgs object that contains event data. + */ + (source: S, e: ASPxClientEditKeyEventArgs): void; +} +/** + * Provides data for the client events involved with a key being pressed or released. + */ +interface ASPxClientEditKeyEventArgs extends ASPxClientEventArgs { + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * A method that will handle client validation events. + */ +interface ASPxClientEditValidationEventHandler { + /** + * A method that will handle client validation events. + * @param source An object representing the event source. Identifies the button editor that raised the event. + * @param e An ASPxClientEditValidationEventArgs object that contains event data. + */ + (source: S, e: ASPxClientEditValidationEventArgs): void; +} +/** + * Provides data for the client events that are related to data validation (see Validate). + */ +interface ASPxClientEditValidationEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets the error description. + * Value: A string representing the error description. + */ + errorText: string; + /** + * Gets or sets a value specifying whether the validated value is valid. + * Value: true if the value is valid; otherwise, false. + */ + isValid: boolean; + /** + * Gets or sets the editor's value being validated. + * Value: An object that represents the validated value. + */ + value: string; +} +/** + * Represents the client ASPxFilterControl. + */ +interface ASPxClientFilterControl extends ASPxClientControl { + /** + * Occurs after a new filter expression has been applied. + */ + Applied: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientFilterControl. + */ + CallbackError: ASPxClientEvent>; + /** + * Returns the filter expression. + */ + GetFilterExpression(): string; + /** + * Returns the applied filter expression. + */ + GetAppliedFilterExpression(): string; + /** + * Returns the editor used to edit operand values for the specified filter column. + * @param editorIndex An integer value that identifies the filter column by its index within the collection. + */ + GetEditor(editorIndex: number): ASPxClientEditBase; + /** + * Returns a value indicating whether the filter expression being currently composed on the client side is valid - all expression conditions are filled. + */ + IsFilterExpressionValid(): boolean; + /** + * Applies a filter constructed by an end-user. + */ + Apply(): void; + /** + * Resets the current filter expression to a previously applied filter expression. + */ + Reset(): void; +} +/** + * A method that will handle the Applied event. + */ +interface ASPxClientFilterAppliedEventHandler { + /** + * A method that will handle the Applied event. + * @param source The event source. + * @param e An ASPxClientFilterAppliedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFilterAppliedEventArgs): void; +} +/** + * Provides data for the Applied event. + */ +interface ASPxClientFilterAppliedEventArgs extends ASPxClientEventArgs { + /** + * Gets the filter expression currently being applied. + * Value: A string value that specifies the filter expression currently being applied. + */ + filterExpression: string; +} +/** + * Represents a base for client editor objects that display a list of items. + */ +interface ASPxClientListEdit extends ASPxClientEdit { + /** + * Occurs on the client side after a different item in the list has been selected (focus has been moved from one item to another). + */ + SelectedIndexChanged: ASPxClientEvent>; + /** + * Returns the list editor's selected item. + */ + GetSelectedItem(): ASPxClientListEditItem; + /** + * Returns the index of the selected item within the list editor. + */ + GetSelectedIndex(): number; + /** + * Sets the list editor's selected item. + * @param item An ASPxClientListEditItem object that specifies the item to select. + */ + SetSelectedItem(item: ASPxClientListEditItem): void; + /** + * Sets the list editor's selected item specified by its index. + * @param index An integer value specifying the zero-based index of the item to select. + */ + SetSelectedIndex(index: number): void; +} +/** + * Represents the client-side equivalent of the ListEditItem object. + */ +interface ASPxClientListEditItem { + /** + * Gets a value that indicates whether a list edit item is selected. + * Value: true if a list edit item is selected; otherwise, false. + */ + selected: boolean; + /** + * Gets an editor to which the current item belongs. + * Value: An ASPxClientListEdit object that represents the item's owner editor. + */ + listEditBase: ASPxClientListEdit; + /** + * Gets the item's index. + * Value: An integer value that represents the item's index within the corresponding editor's item collection. + */ + index: number; + /** + * Gets the item's associated image. + * Value: A string value that represents the path to the image displayed by the item. + */ + imageUrl: string; + /** + * Gets the item's display text. + * Value: A string value that represents the item's display text. + */ + text: string; + /** + * Gets the item's associated value. + * Value: An object that represents the value associated with the item. + */ + value: Object; + /** + * Returns the list item's value that corresponds to a column specified by its index. + * @param columnIndex An integer value that specifies the column's index within the editor's Columns collection. + */ + GetColumnText(columnIndex: number): string; + /** + * Returns the list item's value that corresponds to a column specified by its field name. + * @param columnName A string value that specifies the column's field name defined via the FieldName property. + */ + GetColumnText(columnName: string): string; +} +/** + * Represents the client-side equivalent of the ASPxListBox control. + */ +interface ASPxClientListBox extends ASPxClientListEdit { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientListBox. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client side when an end-user presses a key while the editor has focus. + */ + KeyDown: ASPxClientEvent>; + /** + * Occurs on the client side when an end-user presses and releases a key while the editor has focus. + */ + KeyPress: ASPxClientEvent>; + /** + * Occurs on the client side when an end-user releases a pressed key while the editor has focus. + */ + KeyUp: ASPxClientEvent>; + /** + * Occurs on the client side after a different item in the list box has been selected (focus has been moved from one item to another). + */ + SelectedIndexChanged: ASPxClientEvent>; + /** + * Occurs on the client when the editor's item is double clicked. + */ + ItemDoubleClick: ASPxClientEvent>; + /** + * Gets the number of items contained in the editor's item collection. + */ + GetItemCount(): number; + /** + * Returns an item specified by its index within the list box editor's item collection. + * @param index An integer value specifying the zero-based index of the item to search for. + */ + GetItem(index: number): ASPxClientListEditItem; + /** + * Returns an array of the list editor's selected items indices. + */ + GetSelectedIndices(): number[]; + /** + * Returns an array of the list editor's selected items values. + */ + GetSelectedValues(): Object[]; + /** + * Returns an array of the list editor's selected items. + */ + GetSelectedItems(): ASPxClientListEditItem[]; + /** + * Selects all list box items. + */ + SelectAll(): void; + /** + * Unselects all list box items. + */ + UnselectAll(): void; + /** + * Selects the items with the specified indices within a list box. + * @param indices An array of integer values that represent the items indices. + */ + SelectIndices(indices: number[]): void; + /** + * Unselects an array of the list box items with the specified indices. + * @param indices An array of integer values that represent the indices. + */ + UnselectIndices(indices: number[]): void; + /** + * Selects the specified items within a list box. + * @param items An array of ASPxClientListEditItem objects that represent the items. + */ + SelectItems(items: ASPxClientListEditItem[]): void; + /** + * Unselects an array of the specified list box items. + * @param items An array of ASPxClientListEditItem objects that represent the items. + */ + UnselectItems(items: ASPxClientListEditItem[]): void; + /** + * Select the items with the specified values within a list box. + * @param values An array of Object[] objects that represent the item's values. + */ + SelectValues(values: Object[]): void; + /** + * Unselects an array of the list box items with the specified values. + * @param values An array of Object[] objects that represent the values. + */ + UnselectValues(values: Object[]): void; + /** + * Scrolls the editor's item list, so that the specified item becomes visible. + * @param index An integer value that specifies the item's index within the editor's client item list. + */ + MakeItemVisible(index: number): void; + /** + * Initializes the ASPxClientListBox client object when its parent container becomes visible dynamically, on the client side. + */ + InitOnContainerMadeVisible(): void; + /** + * Adds a new item to the editor, specifying the item's display text, and returns the index of the added item. + * @param text A string value specifying the item's display text. + */ + AddItem(text: string): number; + /** + * Adds a new item to the editor, specifying the item's display text and associated value, and returns the index of the added item. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + */ + AddItem(text: string, value: Object): number; + /** + * Adds a new item to the editor, specifying the item's display text, associated value and displayed image, and returns the index of the added item. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + * @param imageUrl A string value specifying the path to the image displayed by the item. + */ + AddItem(text: string, value: Object, imageUrl: string): number; + /** + * Inserts a new item specified by its display text, associated value and displayed image into the editor's item collection, at the position specified. + * @param index An integer value representing the zero-based index of the position where the item should be inserted. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + * @param imageUrl A string value specifying the path to the image displayed by the item. + */ + InsertItem(index: number, text: string, value: Object, imageUrl: string): void; + /** + * Inserts a new item specified by its display text and associated value into the editor's item collection, at the position specified. + * @param index An integer value representing the zero-based index of the position where the item should be inserted. + * @param text A string value specifying the item's display text. + * @param value An object specifying the value associated with the item. + */ + InsertItem(index: number, text: string, value: Object): void; + /** + * Inserts a new item specified by its display text into the editor's item collection, at the position specified. + * @param index An integer value representing the zero-based index of the position where the item should be inserted. + * @param text A string value specifying the item's display text. + */ + InsertItem(index: number, text: string): void; + /** + * Prevents the client list box editor from being rendered until the EndUpdate method is called. + */ + BeginUpdate(): void; + /** + * Re-enables editor render operations after a call to the BeginUpdate method, and forces an immediate re-rendering. + */ + EndUpdate(): void; + /** + * Removes all items from the client list box editor. + */ + ClearItems(): void; + /** + * Removes an item specified by its index from the client list editor. + * @param index An integer value representing the index of the list item to be removed. + */ + RemoveItem(index: number): void; + /** + * Returns a list box item by its text. + * @param text A string that specifies the item's text. + */ + FindItemByText(text: string): ASPxClientListEditItem; + /** + * Returns a list box item by its value. + * @param value An object that specifies the item's value. + */ + FindItemByValue(value: Object): ASPxClientListEditItem; + /** + * Sends a callback to the server, and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Adds a new item to the end of the editor's items collection, specifying the item's display text, and returns the index of the added item. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + */ + AddItem(texts: string[]): number; + /** + * Adds a new item to the end of the control's items collection. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + */ + AddItem(texts: string[], value: Object): number; + /** + * Adds a new item to the end of the editor's items collection, specifying the item's display text, associated value and displayed image, and returns the index of the added item. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + * @param imageUrl A String value specifying the path to the image displayed by the item. + */ + AddItem(texts: string[], value: Object, imageUrl: string): number; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index An integer value that represents the index position. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + * @param imageUrl A String value specifying the path to the image displayed by the item. + */ + InsertItem(index: number, texts: string[], value: Object, imageUrl: string): void; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index An integer value that represents the index position. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + * @param value An object that represents the item's associated value. + */ + InsertItem(index: number, texts: string[], value: Object): void; + /** + * Adds a new item to the control's items collection at the specified index. + * @param index An integer value that represents the index position. + * @param texts An array of strings that specifies the item's display text. Array element positions relate to the positions of the corresponding columns within the editor's Columns collection. + */ + InsertItem(index: number, texts: string[]): void; + /** + * Defines the HTML content for the specified list box item. + * @param index An integer value specifying the zero-based index of the item. + * @param html A string value that is the HTML code defining the content of the list box item. + */ + SetItemHtml(index: number, html: string): void; + /** + * Sets the tooltip text for the list box editor's item specified by its index. + * @param index An integer value specifying the zero-based index of the item. + * @param tooltip A string value specifying the tooltip text. + */ + SetItemTooltip(index: number, tooltip: string): void; + /** + * Sets the CSS class for a list box item specified by its index. + * @param index An integer value specifying the zero-based index of the item. + * @param className A string value specifying the CSS class name. + */ + AddItemCssClass(index: number, className: string): void; + /** + * Removes the CSS class from a list box item specified by its index. + * @param index An integer value specifying the zero-based index of the item. + * @param className A string value specifying the CSS class name. + */ + RemoveItemCssClass(index: number, className: string): void; + /** + * Defines the HTML content for the specified list box item's text cell. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param html A string value that is the HTML code defining the content of the list box item. + */ + SetItemTextCellHtml(itemIndex: number, textCellIndex: number, html: string): void; + /** + * Sets the tooltip text for the text cell of the editor's item specified by its index. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param tooltip A string value specifying the tooltip text. + */ + SetItemTextCellTooltip(itemIndex: number, textCellIndex: number, tooltip: string): void; + /** + * Sets the CSS class for a list box item's text cell specified by its index. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param className A string value specifying the CSS class name. + */ + AddItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + /** + * Removes the CSS class from a list box item's text cell specified by its index. + * @param itemIndex An integer value specifying the zero-based index of the item. + * @param textCellIndex An integer value specifying the zero-based index of the item's text cell. + * @param className A string value specifying the CSS class name. + */ + RemoveItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; +} +/** + * Serves as the base type for the ASPxClientRadioButtonList objects. + */ +interface ASPxClientCheckListBase extends ASPxClientListEdit { + /** + * Gets the number of items contained in the editor's item collection. + */ + GetItemCount(): number; + /** + * Returns the editor's item specified by its index. + * @param index An integer value specifying the zero-based index of the item to be retrieved. + */ + GetItem(index: number): ASPxClientListEditItem; +} +/** + * Represents the client-side equivalent of the ASPxRadioButtonList control. + */ +interface ASPxClientRadioButtonList extends ASPxClientCheckListBase { +} +/** + * A client-side equivalent of the ASPxCheckBoxList object. + */ +interface ASPxClientCheckBoxList extends ASPxClientCheckListBase { + /** + * Occurs on the client side after a different item in the check box list has been selected (focus has been moved from one item to another). + */ + SelectedIndexChanged: ASPxClientEvent>; + /** + * Returns an array of the check box list editor's selected items indices. + */ + GetSelectedIndices(): number[]; + /** + * Returns an array of the check box list editor's selected items values. + */ + GetSelectedValues(): Object[]; + /** + * Returns an array of the check box list editor's selected items. + */ + GetSelectedItems(): ASPxClientListEditItem[]; + /** + * Selects all check box list items. + */ + SelectAll(): void; + /** + * Unselects all check box list items. + */ + UnselectAll(): void; + /** + * Selects items with the specified indices within a check box list. + * @param indices An array of integer values that are the item indices. + */ + SelectIndices(indices: number[]): void; + /** + * Selects the specified items within a check box list. + * @param items An array of ASPxClientListEditItem objects that are the items. + */ + SelectItems(items: ASPxClientListEditItem[]): void; + /** + * Selects items with the specified values within a check box list. + * @param values An array of Object[] objects that are the item values. + */ + SelectValues(values: Object[]): void; + /** + * Unselects items with the specified indices within a check box list. + * @param indices An array of integer values that are the item indices. + */ + UnselectIndices(indices: number[]): void; + /** + * Unselects the specified items within a check box list. + * @param items An array of ASPxClientListEditItem objects that are the items. + */ + UnselectItems(items: ASPxClientListEditItem[]): void; + /** + * Unselects items with the specified values within a check box list. + * @param values An array of Object[] objects that are the item values. + */ + UnselectValues(values: Object[]): void; +} +/** + * A method that will handle the SelectedIndexChanged event. + */ +interface ASPxClientListEditItemSelectedChangedEventHandler { + /** + * A method that will handle the SelectedIndexChanged event. + * @param source The event source. + * @param e An ASPxClientListEditItemSelectedChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientListEditItemSelectedChangedEventArgs): void; +} +/** + * Provides data for the SelectedIndexChanged event. + */ +interface ASPxClientListEditItemSelectedChangedEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the index of the item related to the event. + * Value: An integer value that represents the item's index within the corresponding editor's item collection. + */ + index: number; + /** + * Gets whether the item has been selected. + * Value: true if the item is selected; otherwise, false. + */ + isSelected: boolean; +} +/** + * Represents a client-side equivalent of the ASPxProgressBar control. + */ +interface ASPxClientProgressBar extends ASPxClientEditBase { + /** + * Sets the position of the operation's progress. + * @param position An integer value specifying the progress position. + */ + SetPosition(position: number): void; + /** + * Gets the position of the operation's progress. + */ + GetPosition(): number; + /** + * Sets the pattern used to format the displayed text for the progress bar. + * @param text A value that is the format pattern. + */ + SetCustomDisplayFormat(text: string): void; + /** + * Returns the text displayed within the progress bar. + */ + GetDisplayText(): string; + /** + * Sets the percentage representation of the progress position. + */ + GetPercent(): number; + /** + * Sets the minimum range value of the progress bar. + * @param min An integer value specifying the minimum value of the progress bar range. + */ + SetMinimum(min: number): void; + /** + * Sets the maximum range value of the progress bar. + * @param max An integer value specifying the maximum value of the progress bar range. + */ + SetMaximum(max: number): void; + /** + * Gets the minimum range value of the progress bar. + */ + GetMinimum(): number; + /** + * Gets the maximum range value of the progress bar. + */ + GetMaximum(): number; + /** + * Sets the minimum and maximum range values of the progress bar. + * @param minValue An integer value specifying the minimum value of the progress bar range. + * @param maxValue An integer value specifying the maximum value of the progress bar range. + */ + SetMinMaxValues(minValue: number, maxValue: number): void; +} +/** + * Represents a base class for the ASPxClientSpinEdit object. + */ +interface ASPxClientSpinEditBase extends ASPxClientButtonEditBase { + /** + * This event is not in effect for the ASPxClientSpinEditBase. Use the ASPxClientTimeEdit. + */ + TextChanged: ASPxClientEvent>; +} +/** + * Represents the client-side equivalent of the ASPxSpinEdit control. + */ +interface ASPxClientSpinEdit extends ASPxClientSpinEditBase { + /** + * Occurs on the client side when the editor's value is altered in any way. + */ + NumberChanged: ASPxClientEvent>; + /** + * Specifies the value of the spin edit control on the client side. + * @param number A Decimal value specifying the control value. + */ + SetValue(number: number): void; + /** + * Sets the spin editor's value. + * @param number A decimal number specifying the value to assign to the spin editor. + */ + SetNumber(number: number): void; + /** + * Gets a number which represents the spin editor's value. + */ + GetNumber(): number; + /** + * Returns the text displayed within the editor. + */ + GetText(): string; + /** + * Sets the minimum value of the editor. + * @param value A decimal value specifying the minimum value of the editor. + */ + SetMinValue(value: number): void; + /** + * Gets the minimum value of the editor. + */ + GetMinValue(): number; + /** + * Sets the maximum value of the editor. + * @param value A decimal value specifying the maximum value of the editor. + */ + SetMaxValue(value: number): void; + /** + * Gets the maximum value of the editor. + */ + GetMaxValue(): number; + /** + * Changes the editor's value. + * @param value An object representing the data to be assigned to the editor's edit value. + */ + SetValue(value: Object): void; +} +/** + * Represents the client-side equivalent of the ASPxTimeEdit control. + */ +interface ASPxClientTimeEdit extends ASPxClientSpinEditBase { + /** + * Fires after the selected date has been changed within the time editor. + */ + DateChanged: ASPxClientEvent>; + /** + * Specifies the date for the editor. + * @param date A DateTime object that is the date. + */ + SetDate(date: Date): void; + /** + * Gets the date that is the editor's value. + */ + GetDate(): Date; +} +/** + * Represents a base for client-side static editors whose values cannot be visually changed by end users. + */ +interface ASPxClientStaticEdit extends ASPxClientEditBase { + /** + * Occurs on the client side after an end-user clicks within a static editor. + */ + Click: ASPxClientEvent>; +} +/** + * A method that will handle client-side events which concern clicking within editors. + */ +interface ASPxClientEditEventHandler { + /** + * A method that will handle client-side events which concern clicking within editors. + * @param source An object representing the event source. Identifies the editor that raised the event. + * @param e An ASPxClientEditClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientEditClickEventArgs): void; +} +/** + * Provides data for the client-side events which concern clicking within editors. + */ +interface ASPxClientEditClickEventArgs extends ASPxClientEventArgs { + /** + * Gets the HTML element related to the event. + * Value: An object that represents the clicked HTML element. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * Represents the client-side equivalent of the ASPxHyperLink control. + */ +interface ASPxClientHyperLink extends ASPxClientStaticEdit { + /** + * Gets an URL which defines the navigation location for the editor's hyperlink. + */ + GetNavigateUrl(): string; + /** + * Specifies an URL which defines the navigation location for the editor's hyperlink. + * @param url A string value which specifies an URL to where the client web browser will navigate when a hyperlink in the editor is clicked. + */ + SetNavigateUrl(url: string): void; + /** + * Gets the text caption displayed for the hyperlink in the hyperlink editor. + */ + GetText(): string; + /** + * Specifies the text caption displayed for the hyperlink in the hyperlink editor. + * @param text A string value specifying the text caption for the hyperlink in the editor. + */ + SetText(text: string): void; +} +/** + * Represents a base for client-side editors which are capable of displaying images. + */ +interface ASPxClientImageBase extends ASPxClientStaticEdit { + /** + * Sets the size of the image displayed within the image editor. + * @param width An integer value that specifies the image's width. + * @param height An integer value that specifies the image's height. + */ + SetSize(width: number, height: number): void; +} +/** + * Represents the client-side equivalent of the ASPxImage control. + */ +interface ASPxClientImage extends ASPxClientImageBase { + /** + * Returns the URL pointing to the image displayed within the image editor. + */ + GetImageUrl(): string; + /** + * Sets the URL which points to the image displayed within the image editor. + * @param url A string value specifying the URL to the image displayed within the editor. + */ + SetImageUrl(url: string): void; +} +/** + * Represents the client-side equivalent of the ASPxLabel control. + */ +interface ASPxClientLabel extends ASPxClientStaticEdit { + /** + * Returns the text displayed within the editor. + */ + GetText(): string; + /** + * Sets the text to be displayed within the editor. + * @param text A string value specifying the text to be displayed within the editor. + */ + SetText(text: string): void; +} +/** + * Represents the client-side equivalent of the ASPxTextBox control. + */ +interface ASPxClientTextBox extends ASPxClientTextBoxBase { +} +/** + * Represents the client-side equivalent of the ASPxMemo control. + */ +interface ASPxClientMemo extends ASPxClientTextEdit { +} +/** + * Represents the client-side equivalent of the ASPxButtonEdit control. + */ +interface ASPxClientButtonEdit extends ASPxClientButtonEditBase { +} +/** + * A method that will handle the ButtonClick event. + */ +interface ASPxClientButtonEditClickEventHandler { + /** + * A method that will handle the ButtonClick event. + * @param source An object representing the event source. Identifies the button editor that raised the event. + * @param e An ASPxClientButtonEditClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientButtonEditClickEventArgs): void; +} +/** + * Provides data for the ButtonClick event. + */ +interface ASPxClientButtonEditClickEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the index of the clicked button. + * Value: An integer value representing the index of the clicked button within the editor's Buttons collection. + */ + buttonIndex: number; +} +/** + * A client-side equivalent of the ASPxTokenBox object. + */ +interface ASPxClientTokenBox extends ASPxClientComboBox { + /** + * Fires on the client side after the token collection has been changed. + */ + TokensChanged: ASPxClientEvent>; + /** + * Adds a new token with the specified text to the end of the control's token collection. + * @param text A string value specifying the token's text. + */ + AddToken(text: string): void; + /** + * Removes a token specified by its text from the client token box. + * @param text A string value that is the text of the token to be removed. + */ + RemoveTokenByText(text: string): void; + /** + * Removes a token specified by its index from the client token box. + * @param index An integer value that is the index of the token to be removed. + */ + RemoveToken(index: number): void; + /** + * Returns an HTML span element that corresponds to the specified token. + * @param index An integer value that is the token index. + */ + GetTokenHtmlElement(index: number): Object; + /** + * Returns an HTML span element that corresponds to the specified token's text. + * @param index An integer value that is the token index. + */ + GetTokenTextHtmlElement(index: number): Object; + /** + * Returns an HTML span element that corresponds to the specified token's remove button. + * @param index An integer value that is the token index. + */ + GetTokenRemoveButtonHtmlElement(index: number): Object; + /** + * Returns a collection of tokens. + */ + GetTokenCollection(): string[]; + /** + * Sets a collection of tokens. + * @param collection A object that is the collection of tokens. + */ + SetTokenCollection(collection: string[]): void; + /** + * Removes all tokens contained in the token box. + */ + ClearTokenCollection(): void; + /** + * Returns the index of a token specified by its text. + * @param text A string value that specifies the text of the token. + */ + GetTokenIndexByText(text: string): number; + /** + * Gets the token texts, separated with a sign, specified by the TextSeparator property. + */ + GetText(): string; + /** + * Sets the token texts, separated with a sign, specified by the TextSeparator property. + * @param text A string value that is the token texts separated with a text separator. + */ + SetText(text: string): void; + /** + * Gets the editor value. + */ + GetValue(): string; + /** + * Sets the editor value. + * @param value A string that is the editor value. + */ + SetValue(value: string): void; + /** + * Returns a value that indicates if the specified token (string) is a custom token. + * @param text A string value that is a token. + * @param caseSensitive true, if tokens are case sensitive; otherwise, false. + */ + IsCustomToken(text: string, caseSensitive: boolean): boolean; + /** + * Changes the editor's value. + * @param value An object representing the data to be assigned to the editor's edit value. + */ + SetValue(value: Object): void; +} +/** + * The client-side equivalent of the ASPxTrackBar control. + */ +interface ASPxClientTrackBar extends ASPxClientEdit { + /** + * Fires on the client side before a track bar position is changed and allows you to cancel the action. + */ + PositionChanging: ASPxClientEvent>; + /** + * Fires after the editor's position has been changed. + */ + PositionChanged: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user moves a cursor while the drag handle is held down. + */ + Track: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user presses a drag handle and moves it. + */ + TrackStart: ASPxClientEvent>; + /** + * Occurs on the client-side when an end-user releases a drag handle after moving it. + */ + TrackEnd: ASPxClientEvent>; + /** + * Returns a track bar item index by the item's value. + * @param value An object that specifies the item's value. + */ + GetItemIndexByValue(value: Object): number; + /** + * Returns a track bar item's associated value. + * @param index An integer value that specifies the required item's index. + */ + GetItemValue(index: number): Object; + /** + * Returns a track bar item text. + * @param index An integer value that specifies the required item's index. + */ + GetItemText(index: number): string; + /** + * Returns a track bar item's tooltip text. + * @param index An integer value that specifies the required item's index. + */ + GetItemToolTip(index: number): string; + /** + * Returns the number of the track bar items that are maintained by the item collection. + */ + GetItemCount(): number; + /** + * Specifies the secondary drag handle position. + * @param position A value that specifies the position. + */ + SetPositionEnd(position: number): void; + /** + * Specifies the main drag handle position. + * @param position A value that specifies the position. + */ + SetPositionStart(position: number): void; + /** + * Returns the secondary drag handle position. + */ + GetPositionEnd(): number; + /** + * Returns the main drag handle position. + */ + GetPositionStart(): number; + /** + * Gets a drag handle position. + */ + GetPosition(): number; + /** + * Specifies a drag handle position. + * @param position A value that specifies the position. + */ + SetPosition(position: number): void; +} +/** + * A method that will handle the client PositionChanging event. + */ +interface ASPxClientTrackBarPositionChangingEventHandler { + /** + * A method that will handle the PositionChanging event. + * @param source The event source. Identifies the ASPxTrackBar control that raised the event. + * @param e A ASPxClientTrackBarPositionChangingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTrackBarPositionChangingEventArgs): void; +} +/** + * Provides data for the PositionChanging event. + */ +interface ASPxClientTrackBarPositionChangingEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; + /** + * Gets the current drag handle position. + * Value: A value that is the drag handle position. + */ + currentPosition: number; + /** + * Gets the current secondary drag handle position. + * Value: A value that is the drag handle position. + */ + currentPositionEnd: number; + /** + * Gets the current main drag handle position. + * Value: A value that is the drag handle position. + */ + currentPositionStart: number; + /** + * Gets a position where the drag handle is being moved. + * Value: A value that is the drag handle position. + */ + newPosition: number; + /** + * Gets a position where the secondary drag handle is being moved. + * Value: A value that is the drag handle position. + */ + newPositionEnd: number; + /** + * Gets a position where the main drag handle is being moved. + * Value: A value that is the drag handle position. + */ + newPositionStart: number; +} +/** + * Represents the client-side equivalent of the ASPxValidationSummary control. + */ +interface ASPxClientValidationSummary extends ASPxClientControl { + /** + * Occurs on the client side when the validation summary's visibility is changed. + */ + VisibilityChanged: ASPxClientEvent>; +} +/** + * A method that will handle the VisibilityChanged event. + */ +interface ASPxClientValidationSummaryVisibilityChangedEventHandler { + /** + * A method that will handle the VisibilityChanged client event. + * @param source An object representing the event source. + * @param e A ASPxClientValidationSummaryVisibilityChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientValidationSummaryVisibilityChangedEventArgs): void; +} +/** + * Provides data for the VisibilityChanged event. + */ +interface ASPxClientValidationSummaryVisibilityChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets whether the editor is visible on the client. + * Value: true if the editor is visible; otherwise, false. + */ + visible: boolean; +} +/** + * Represents the client ASPxGaugeControl. + */ +interface ASPxClientGaugeControl extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires when errors have occurred during callback processing. + */ + CallbackError: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * Lists values that specify the position relative to the target column in which a moved column should be placed. + */ +interface ASPxClientGridColumnMovingTargetPosition { + /** + * A moved column should be placed to the right of the target column. + */ + Right: number; + /** + * A moved column should be placed to the left of the target column. + */ + Left: number; + /** + * A moved column should be placed at the top of the target column. + */ + Top: number; + /** + * A moved column should be placed at the bottom of the target column. + */ + Bottom: number; +} +/** + * Represents the client ASPxGridView. + */ +interface ASPxClientGridBase extends ASPxClientControl { +} +/** + * Serves as a base object implementing the client column functionality. + */ +interface ASPxClientGridColumnBase { +} +/** + * The client-side equivalent of the ASPxGridLookup control. + */ +interface ASPxClientGridLookup extends ASPxClientDropDownEditBase { + /** + * Fires on the client when a data row is clicked within the built-in dropdown grid. + */ + RowClick: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Returns a client object representing the built-in dropdown grid. + */ + GetGridView(): ASPxClientGridView; + /** + * Confirms the current selection made by an end-user within the editor's dropdown grid. + */ + ConfirmCurrentSelection(): void; + /** + * Cancels the current selection made by an end-user within the editor's dropdown grid and rolls back to the last confirmed selection. The selection can be confirmed by either pressing the Enter key or calling the ConfirmCurrentSelection method. + */ + RollbackToLastConfirmedSelection(): void; +} +/** + * Represents the client ASPxCardView. + */ +interface ASPxClientCardView extends ASPxClientGridBase { + /** + * Provides access to the batch editing client API. + * Value: A object that exposes the batch editing client API methods. + */ + batchEditApi: ASPxClientCardViewBatchEditApi; + /** + * Occurs when a custom command button has been clicked. + */ + CustomButtonClick: ASPxClientEvent>; + /** + * Fires after the selection has been changed. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Enables you to prevent columns from being sorted. + */ + ColumnSorting: ASPxClientEvent>; + /** + * Occurs when a grid switches to batch edit mode. + */ + BatchEditStartEditing: ASPxClientEvent>; + /** + * Occurs when a grid leaves batch edit mode. + */ + BatchEditEndEditing: ASPxClientEvent>; + /** + * Enables you to prevent a batch edit confirmation message from being displayed. + */ + BatchEditConfirmShowing: ASPxClientEvent>; + /** + * Enables you to provide navigation for editors contained in a templated cell in Batch Edit mode. + */ + BatchEditTemplateCellFocused: ASPxClientEvent>; + /** + * Enables you to specify whether card data is valid and provide an error text. + */ + BatchEditCardValidating: ASPxClientEvent>; + /** + * Occurs on the client side before data changes are saved in batch edit mode. + */ + BatchEditChangesSaving: ASPxClientEvent>; + /** + * Occurs on the client side before data changes are canceled in batch edit mode. + */ + BatchEditChangesCanceling: ASPxClientEvent>; + /** + * Occurs on the client side before a card is inserted in batch edit mode. + */ + BatchEditCardInserting: ASPxClientEvent>; + /** + * Occurs on the client side before a card is deleted in batch edit mode. + */ + BatchEditCardDeleting: ASPxClientEvent>; + /** + * Fires on the client when a card is clicked. + */ + CardClick: ASPxClientEvent>; + /** + * Fires on the client when a card is double clicked. + */ + CardDblClick: ASPxClientEvent>; + /** + * Fires in response to changing card focus. + */ + FocusedCardChanged: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any unhandled server error occurs during server-side processing of a callback sent by the ASPxClientCardView. + */ + CallbackError: ASPxClientEvent>; + /** + * Fires after the customization window has been closed. + */ + CustomizationWindowCloseUp: ASPxClientEvent>; + /** + * Returns the value of the specified edit cell. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + GetEditValue(columnFieldNameOrId: string): string; + /** + * Moves focus to the specified edit cell within the edited card. + * @param column An ASPxClientCardViewColumn object that represents the data column within the client grid. + */ + FocusEditor(column: ASPxClientCardViewColumn): void; + /** + * Moves focus to the specified edit cell within the edited card. + * @param columnIndex An integer value that specifies the column's position within the columns collection. + */ + FocusEditor(columnIndex: number): void; + /** + * Moves focus to the specified edit cell within the edited card. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + FocusEditor(columnFieldNameOrId: string): void; + /** + * Sets the value of the specified edit cell. + * @param column An ASPxClientCardViewColumn object that represents the data column within the client grid. + * @param value A string value that specifies the edit cell's new value. + */ + SetEditValue(column: ASPxClientCardViewColumn, value: string): void; + /** + * Sets the value of the specified edit cell. + * @param columnIndex An integer value that identifies the data column within the grid's column collection. + * @param value A string value that specifies the edit cell's new value. + */ + SetEditValue(columnIndex: number, value: string): void; + /** + * Sets the value of the specified edit cell. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param value A string value that specifies the edit cell's new value. + */ + SetEditValue(columnFieldNameOrId: string, value: string): void; + /** + * Displays the Filter Control. + */ + ShowFilterControl(): void; + /** + * Hides the Filter Control. + */ + CloseFilterControl(): void; + /** + * Enables or disables the current filter. + * @param isFilterEnabled true to enable the current filter; otherwise, false. + */ + SetFilterEnabled(isFilterEnabled: boolean): void; + /** + * Returns the current vertical scroll position of the grid's content. + */ + GetVerticalScrollPosition(): number; + /** + * Specifies the vertical scroll position for the grid's content. + * @param position An integer value specifying the vertical scroll position. + */ + SetVerticalScrollPosition(position: number): void; + /** + * Gets information about a focused cell. + */ + GetFocusedCell(): ASPxClientCardViewCellInfo; + /** + * Focuses the specified cell. + * @param cardVisibleIndex An value that specifies the visible index of the card. + * @param columnIndex A zero-based index that identifies the column in the column collection (the column's Index property value). + */ + SetFocusedCell(cardVisibleIndex: number, columnIndex: number): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientCardViewColumn object that represents the data column. + */ + SortBy(column: ASPxClientCardViewColumn): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + */ + SortBy(columnIndex: number): void; + /** + * Sorts data by the specified data column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + SortBy(columnFieldNameOrId: string): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientCardViewColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(column: ASPxClientCardViewColumn, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(columnIndex: number, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(columnFieldNameOrId: string, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientCardViewColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(column: ASPxClientCardViewColumn, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(columnIndex: number, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values, and places the column to the specified position among the sorted columns. + * @param column An ASPxClientCardViewColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex + */ + SortBy(column: ASPxClientCardViewColumn, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Sorts data by the specified data column's values, and places the column to the specified position among the sorted columns. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex An integer value that specifies the zero-based column's index among the sorted columns. -1 if data is not sorted by this column. + */ + SortBy(columnIndex: number, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Sorts data by the specified data column's values, and places the column to the specified position among the sorted columns. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex An integer value that specifies the zero-based column's index among the sorted columns. -1 if data is not sorted by this column. + */ + SortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Hides the specified column. + * @param column An ASPxClientCardViewColumn object that represents the column to hide. + */ + MoveColumn(column: ASPxClientCardViewColumn): void; + /** + * Hides the specified column. + * @param columnIndex An integer value that specifies the absolute index of the column to hide. + */ + MoveColumn(columnIndex: number): void; + /** + * Hides the specified column. + * @param columnFieldNameOrId A string value that identifies the column to be hidden by the name of the data source field to which the column is bound, or by the column's name. + */ + MoveColumn(columnFieldNameOrId: string): void; + /** + * Moves the specified column to the specified visual position within the ASPxCardView. + * @param column An ASPxClientCardViewColumn object that represents the column to move. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the ASPxCardView. + */ + MoveColumn(column: ASPxClientCardViewColumn, moveToColumnVisibleIndex: number): void; + /** + * Moves the specified column to the specified visual position within the ASPxCardView. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the grid. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number): void; + /** + * Moves the specified column to the specified visual position within the ASPxCardView. + * @param columnFieldNameOrId A string value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the ASPxCardView. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number): void; + /** + * Moves the specified column to the specified visual position within the ASPxCardView. + * @param column An ASPxClientCardViewColumn object that represents the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the CardView. + * @param moveBefore true, to move the column before the target column; otherwise, false. + */ + MoveColumn(column: ASPxClientCardViewColumn, moveToColumnVisibleIndex: number, moveBefore: boolean): void; + /** + * Moves the specified column to the specified visual position within the ASPxCardView. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number, moveBefore: boolean): void; + /** + * Moves the specified column to the specified visual position within the ASPxCardView. + * @param columnFieldNameOrId A string value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, moveBefore: boolean): void; + /** + * Returns the key value of the specified card. + * @param visibleIndex An integer value that specifies the card's visible index. + */ + GetCardKey(visibleIndex: number): string; + /** + * Switches the CardView to edit mode. + * @param visibleIndex A zero-based integer that identifies a card to be edited. + */ + StartEditCard(visibleIndex: number): void; + /** + * Switches the ASPxCardView to edit mode. + * @param key An object that uniquely identifies a card to be edited. + */ + StartEditCardByKey(key: Object): void; + /** + * Indicates whether or not a new card is being edited. + */ + IsNewCardEditing(): boolean; + /** + * Adds a new record. + */ + AddNewCard(): void; + /** + * Deletes the specified card. + * @param visibleIndex An integer value that identifies the card. + */ + DeleteCard(visibleIndex: number): void; + /** + * Deletes a card with the specified key value. + * @param key An object that uniquely identifies the card. + */ + DeleteCardByKey(key: Object): void; + /** + * Returns the focused card's index. + */ + GetFocusedCardIndex(): number; + /** + * Moves focus to the specified card. + * @param visibleIndex An integer value that specifies the focused card's index. + */ + SetFocusedCardIndex(visibleIndex: number): void; + /** + * Selects all the unselected cards within the CardView. + */ + SelectCards(): void; + /** + * Selects the specified card displayed within the CardView. + * @param visibleIndex A zero-based integer value that specifies the card's visible index. + */ + SelectCards(visibleIndex: number): void; + /** + * Selects the specified cards within the CardView. + * @param visibleIndices An array of zero-based indices that identify data cards within the grid. + */ + SelectCards(visibleIndices: number[]): void; + /** + * Selects or deselects the specified cards within the CardView. + * @param visibleIndices An array of zero-based indices that identify data cards within the grid. + * @param selected true to select the specified cards; false to deselect the cards. + */ + SelectCards(visibleIndices: number[], selected: boolean): void; + /** + * Selects or deselects the specified card within the GridView. + * @param visibleIndex An integer zero-based index that identifies the data card within the grid. + * @param selected true to select the specified card; false to deselect the card. + */ + SelectCards(visibleIndex: number, selected?: boolean): void; + /** + * Selects or deselects the specified cards displayed within the CardView. + * @param keys An array of objects that uniquely identify the cards. + * @param selected true to select the specified cards; false to deselect the cards. + */ + SelectCardsByKey(keys: Object[], selected?: boolean): void; + /** + * Selects or deselects the specified card displayed within the CardView. + * @param key An object that uniquely identifies the card. + * @param selected true to select the specified card; false to deselect the card. + */ + SelectCardsByKey(key: Object, selected?: boolean): void; + /** + * Selects the specified cards displayed within the CardView. + * @param keys An array of objects that uniquely identify the cards. + */ + SelectCardsByKey(keys: Object[]): void; + /** + * Selects a card displayed within the CardView by its key. + * @param key An object that uniquely identifies the card. + */ + SelectCardsByKey(key: Object): void; + /** + * Deselects the specified cards displayed within the ASPxCardView. + * @param keys An array of objects that uniquely identify the cards. + */ + UnselectCardsByKey(keys: Object[]): void; + /** + * Deselects the specified card displayed within the ASPxCardView. + * @param key An object that uniquely identifies the card. + */ + UnselectCardsByKey(key: Object): void; + /** + * Deselects all the selected cards within the ASPxCardView. + */ + UnselectCards(): void; + /** + * Deselects the specified cards (if selected) within the ASPxCardView. + * @param visibleIndices An array of zero-based indices that identify data cards within the grid. + */ + UnselectCards(visibleIndices: number[]): void; + /** + * Deselects the specified cards (if selected) within the ASPxCardView. + * @param visibleIndex A zero-based integer value that specifies the card's visible index. + */ + UnselectCards(visibleIndex: number): void; + /** + * Deselects all grid cards that match the filter criteria currently applied to the CardView. + */ + UnselectFilteredCards(): void; + /** + * Selects the specified card displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the card's visible index. + */ + SelectCardOnPage(visibleIndex: number): void; + /** + * Selects or deselects the specified card displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the card's visible index. + * @param selected true to select the specified card; false to deselect the card. + */ + SelectCardOnPage(visibleIndex: number, selected?: boolean): void; + /** + * Deselects the specified cards (if selected) displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the card's visible index. + */ + UnselectCardOnPage(visibleIndex: number): void; + /** + * Selects all unselected cards displayed on the current page. + */ + SelectAllCardsOnPage(): void; + /** + * Allows you to select or deselect all cards displayed on the current page based on the parameter passed. + * @param selected true to select all unselected cards displayed on the current page; false to deselect all selected cards on the page. + */ + SelectAllCardsOnPage(selected: boolean): void; + /** + * Deselects all selected cards displayed on the current page. + */ + UnselectAllCardsOnPage(): void; + /** + * Returns the number of selected cards. + */ + GetSelectedCardCount(): number; + /** + * Indicates whether or not the specified card is selected within the current page. + * @param visibleIndex An integer value that identifies the card by its visible index. + */ + IsCardSelectedOnPage(visibleIndex: number): boolean; + /** + * Applies the specified search panel filter criterion to grid data. + * @param value A string value that specifies the filter criterion. + */ + ApplySearchPanelFilter(value: string): void; + /** + * Applies the specified filter expression to the grid. + * @param filterExpression A string value that specifies the filter expression. + */ + ApplyFilter(filterExpression: string): void; + /** + * Clears the filter expression applied to a client CardView. + */ + ClearFilter(): void; + /** + * Gets the Popup Edit Form. + */ + GetPopupEditForm(): ASPxClientPopupControl; + /** + * Sets input focus to the grid. + */ + Focus(): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * + * @param args + * @param onSuccess + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; + /** + * Selects the specified page. + * @param pageIndex An integer value that specifies the active page's index. + */ + GotoPage(pageIndex: number): void; + /** + * Gets the index of the page currently being selected. + */ + GetPageIndex(): number; + /** + * Gets the number of pages to which the grid's data is divided. + */ + GetPageCount(): number; + /** + * Activates the next page. + */ + NextPage(): void; + /** + * Activates the previous page. + */ + PrevPage(): void; + /** + * Returns the index of the first card displayed within the grid's active page. + */ + GetTopVisibleIndex(): number; + /** + * Indicates whether the grid is in edit mode. + */ + IsEditing(): boolean; + /** + * Saves all the changes made and switches the grid to browse mode. + */ + UpdateEdit(): void; + /** + * Cancels all the changes made and switches the CardView to browse mode. + */ + CancelEdit(): void; + /** + * Updates data displayed within the grid. + */ + Refresh(): void; + /** + * Indicates whether the customization window is displayed. + */ + IsCustomizationWindowVisible(): boolean; + /** + * Invokes the customization window. + */ + ShowCustomizationWindow(): void; + /** + * Invokes the customization window and displays it over the specified HTML element. + * @param showAtElement An object that specifies the HTML element relative to whose position the customization window is invoked. + */ + ShowCustomizationWindow(showAtElement?: Object): void; + /** + * Closes the customization window. + */ + HideCustomizationWindow(): void; + /** + * Returns the number of columns within the client grid. + */ + GetColumnCount(): number; + /** + * Returns the card values displayed within all selected cards. + * @param fieldNames The names of data source fields separated via a semicolon, whose values within the selected cards are returned. + * @param onCallback An ASPxClientCardViewValuesCallback object that represents the JavaScript function which receives the list of card values as a parameter. + */ + GetSelectedFieldValues(fieldNames: string, onCallback: ASPxClientCardViewValuesCallback): void; + /** + * Returns key values of selected cards displayed within the current page. + */ + GetSelectedKeysOnPage(): Object[]; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event. + * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback An ASPxClientCardViewValuesCallback object that is the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(args: string, onCallback: ASPxClientCardViewValuesCallback): void; + /** + * Returns the values of the specified data source fields within the specified card. + * @param visibleIndex An integer value that identifies the data card. + * @param fieldNames The names of data source fields separated via a semicolon, whose values within the specified card are returned. + * @param onCallback An ASPxClientCardViewValuesCallback object that represents the JavaScript function which receives the list of card values as a parameter. + */ + GetCardValues(visibleIndex: number, fieldNames: string, onCallback: ASPxClientCardViewValuesCallback): void; + /** + * Returns the card values displayed within the current page. + * @param fieldNames The names of data source fields whose values are returned. + * @param onCallback An ASPxClientCardViewValuesCallback object that represents the JavaScript function which receives the list of card values as a parameter. + */ + GetPageCardValues(fieldNames: string, onCallback: ASPxClientCardViewValuesCallback): void; + /** + * Returns the number of cards actually displayed within the active page. + */ + GetVisibleCardsOnPage(): number; + /** + * Returns the client column that resides at the specified position within the column collection. + * @param columnIndex A zero-based index that identifies the column within the column collection (the column's Index property value). + */ + GetColumn(columnIndex: number): ASPxClientCardViewColumn; + /** + * Returns the column with the specified unique identifier. + * @param columnId A string value that specifies the column's unique identifier (the column's Name property value). + */ + GetColumnById(columnId: string): ASPxClientCardViewColumn; + /** + * Returns the client column which is bound to the specified data source field. + * @param columnFieldName A string value that specifies the name of the data source field to which the column is bound (the column's FieldName property value). + */ + GetColumnByField(columnFieldName: string): ASPxClientCardViewColumn; + /** + * Returns the editor used to edit the specified column's values. + * @param column An ASPxClientCardViewColumn object that specifies the required column within the client grid. + */ + GetEditor(column: ASPxClientCardViewColumn): ASPxClientEdit; + /** + * Returns the editor used to edit the specified column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + */ + GetEditor(columnIndex: number): ASPxClientEdit; + /** + * Returns the editor used to edit the specified column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + GetEditor(columnFieldNameOrId: string): ASPxClientEdit; + /** + * Returns the value of the specified edit cell. + * @param column An ASPxClientCardViewColumn object that represents the data column within the client grid. + */ + GetEditValue(column: ASPxClientCardViewColumn): string; + /** + * Returns the value of the specified edit cell. + * @param columnIndex An integer value that identifies the data column within the grid's column collection. + */ + GetEditValue(columnIndex: number): string; +} +/** + * Represents a client column. + */ +interface ASPxClientCardViewColumn extends ASPxClientGridColumnBase { + /** + * Gets the name that uniquely identifies the column. + * Value: A string value assigned to the column's Name property. + */ + name: string; + /** + * Gets the column's position within the collection. + * Value: An integer zero-bazed index that specifies the column's position within the collection. + */ + index: number; + /** + * Gets the name of the database field assigned to the current column. + * Value: A string value that specifies the name of a data field. + */ + fieldName: string; + /** + * Gets whether the column is visible. + * Value: true to display the column; otherwise, false. + */ + visible: boolean; +} +/** + * Represents a JavaScript function which receives the list of card values when the client GetSelectedFieldValues method is called. + */ +interface ASPxClientCardViewValuesCallback { + /** + * Represents a JavaScript function which receives the list of card values when the client GetSelectedFieldValues method is called. + * @param result An object that represents the list of card values received from the server. + */ + (result: Object): void; +} +/** + * A method that will handle the cancelable events of a client ASPxCardView column. + */ +interface ASPxClientCardViewColumnCancelEventHandler { + /** + * A method that will handle the cancelable events of a client ASPxCardView column. + * @param source The event source. This parameter identifies the ASPxClientCardView object that raised the event. + * @param e An ASPxClientCardViewColumnCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewColumnCancelEventArgs): void; +} +/** + * Provides data for the cancelable events of a client ASPxCardView column. + */ +interface ASPxClientCardViewColumnCancelEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed client column. + * Value: An ASPxClientCardViewColumn object that represents the processed column. + */ + column: ASPxClientCardViewColumn; +} +/** + * A method that will handle the CardClick event. + */ +interface ASPxClientCardViewCardClickEventHandler { + /** + * A method that will handle the CardClick event. + * @param source The event source. This parameter identifies the ASPxClientCardView object that raised the event. + * @param e An ASPxClientCardViewCardClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewCardClickEventArgs): void; +} +/** + * Provides data for the CardClick event. + */ +interface ASPxClientCardViewCardClickEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed card's visible index. + * Value: An integer zero-based index that identifies the processed record. + */ + visibleIndex: number; + /** + * Provides access to the parameters associated with the CardClick event. + * Value: An object that contains parameters associated with the event. + */ + htmlEvent: Object; +} +/** + * A method that will handle the CustomButtonClick event. + */ +interface ASPxClientCardViewCustomButtonEventHandler { + /** + * A method that will handle the CustomButtonClick event. + * @param source The event source. This parameter identifies the ASPxClientCardView object that raised the event. + * @param e An ASPxClientCardViewCustomButtonEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewCustomButtonEventArgs): void; +} +/** + * Provides data for the CustomButtonClick event. + */ +interface ASPxClientCardViewCustomButtonEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the value which identifies the card whose custom button has been clicked. + * Value: An integer value that identifies the card whose custom button has been clicked. + */ + visibleIndex: number; + /** + * Gets the value which identifies the custom button. + * Value: A string value that identifies the clicked custom button. + */ + buttonID: string; +} +/** + * A method that will handle the SelectionChanged event. + */ +interface ASPxClientCardViewSelectionEventHandler { + /** + * A method that will handle the SelectionChanged event. + * @param source The event source. + * @param e An ASPxClientCardViewSelectionEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewSelectionEventArgs): void; +} +/** + * Provides data for the SelectionChanged event. + */ +interface ASPxClientCardViewSelectionEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the visible index of the card whose selected state has been changed. + * Value: An value that specifies the visible index of the card. + */ + visibleIndex: number; + /** + * Gets whether the card has been selected. + * Value: true if the card has been selected; otherwise, false. + */ + isSelected: boolean; + /** + * Gets whether all cards displayed within a page have been selected or unselected. + * Value: true if all cards displayed within a page have been selected or unselected; otherwise, false. + */ + isAllRecordsOnPage: boolean; + /** + * Gets whether a selection has been changed on the server. + * Value: true if a selection has been changed on the server; otherwise, false. + */ + isChangedOnServer: boolean; +} +/** + * A method that will handle the client BatchEditStartEditing event. + */ +interface ASPxClientCardViewBatchEditStartEditingEventHandler { + /** + * A method that will handle the BatchEditStartEditing event. + * @param source The event source. + * @param e An ASPxClientCardViewBatchEditStartEditingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditStartEditingEventArgs): void; +} +/** + * Provides data for the BatchEditStartEditing event. + */ +interface ASPxClientCardViewBatchEditStartEditingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the visible index of the card whose cells are about to be edited. + * Value: An value that specifies the visible index of the card. + */ + visibleIndex: number; + /** + * Gets the CardView column that owns a cell that is about to be edited. + * Value: An object that is the focused CardView column. + */ + focusedColumn: ASPxClientCardViewColumn; + /** + * Gets a hashtable that maintains information about editable cells. + * Value: A hashtable that stores information about editable cells. + */ + cardValues: Object; +} +/** + * A method that will handle the client BatchEditEndEditing event. + */ +interface ASPxClientCardViewBatchEditEndEditingEventHandler { + /** + * A method that will handle the BatchEditEndEditing event. + * @param source The event source. + * @param e An ASPxClientCardViewBatchEditEndEditingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditEndEditingEventArgs): void; +} +/** + * Provides data for the BatchEditEndEditing event. + */ +interface ASPxClientCardViewBatchEditEndEditingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the visible index of the card whose cells have been edited. + * Value: An value that specifies the visible index of the card. + */ + visibleIndex: number; + /** + * Gets a hashtable that maintains information about editable cells. + * Value: A hashtable that stores information about editable cells. + */ + cardValues: Object; +} +/** + * A method that will handle the client BatchEditCardValidating event. + */ +interface ASPxClientCardViewBatchEditCardValidatingEventHandler { + /** + * A method that will handle the BatchEditCardValidating event. + * @param source The event source. + * @param e An ASPxClientCardViewBatchEditCardValidatingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditCardValidatingEventArgs): void; +} +/** + * Provides data for the BatchEditCardValidating event. + */ +interface ASPxClientCardViewBatchEditCardValidatingEventArgs extends ASPxClientEventArgs { + /** + * Gets the processed card's visible index. + * Value: An integer value that specifies the processed card's visible index. + */ + visibleIndex: number; + /** + * Provides validation information of a card currently being validated. + * Value: An object that is a hashtable containing validation information. + */ + validationInfo: Object; +} +/** + * Represents an object that will handle the client-side BatchEditConfirmShowing event. + */ +interface ASPxClientCardViewBatchEditConfirmShowingEventHandler { + /** + * A method that will handle the BatchEditConfirmShowing client event. + * @param source The event source. + * @param e An ASPxClientCardViewBatchEditConfirmShowingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditConfirmShowingEventArgs): void; +} +/** + * Provides data for the BatchEditConfirmShowing event. + */ +interface ASPxClientCardViewBatchEditConfirmShowingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the client identifier of an object that initiates a send request. + * Value: A string value that specifies the object client identifier. + */ + requestTriggerID: string; +} +/** + * A method that will handle the client BatchEditTemplateCellFocused event. + */ +interface ASPxClientCardViewBatchEditTemplateCellFocusedEventHandler { + /** + * A method that will handle the BatchEditTemplateCellFocused event. + * @param source An object representing the event source. Identifies the button editor that raised the event. + * @param e An ASPxClientCardViewBatchEditTemplateCellFocusedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditTemplateCellFocusedEventArgs): void; +} +/** + * Provides data for the BatchEditTemplateCellFocused event. + */ +interface ASPxClientCardViewBatchEditTemplateCellFocusedEventArgs extends ASPxClientEventArgs { + /** + * Gets the currently processed column. + * Value: An object that is the client-side column object. + */ + column: ASPxClientCardViewColumn; + /** + * Gets or sets a value specifying whether the event was handled. + * Value: true if the event was handled and default processing should not occur; false if the event should be handled using default processing. + */ + handled: boolean; +} +/** + * A method that will handle the BatchEditChangesSaving event. + */ +interface ASPxClientCardViewBatchEditChangesSavingEventHandler { + /** + * A method that will handle the BatchEditChangesSaving event. + * @param source The event source. This parameter identifies the card view object which raised the event. + * @param e An ASPxClientCardViewBatchEditChangesSavingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditChangesSavingEventArgs): void; +} +/** + * Provides data for the BatchEditChangesSaving event. + */ +interface ASPxClientCardViewBatchEditChangesSavingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets a hashtable that maintains information about inserted cells. + * Value: A hashtable that stores information about inserted cells. + */ + insertedValues: Object; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + deletedValues: Object; + /** + * Gets a hashtable that maintains information about updated cells. + * Value: A hashtable that stores information about updated cells. + */ + updatedValues: Object; +} +/** + * A method that will handle the BatchEditChangesCanceling event. + */ +interface ASPxClientCardViewBatchEditChangesCancelingEventHandler { + /** + * A method that will handle the BatchEditChangesCanceling event. + * @param source The event source. This parameter identifies the card view object which raised the event. + * @param e An ASPxClientCardViewBatchEditChangesCancelingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditChangesCancelingEventArgs): void; +} +/** + * Provides data for the BatchEditChangesCanceling event. + */ +interface ASPxClientCardViewBatchEditChangesCancelingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets a hashtable that maintains information about inserted cells. + * Value: A hashtable that stores information about inserted cells. + */ + insertedValues: Object; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + deletedValues: Object; + /** + * Gets a hashtable that maintains information about updated cells. + * Value: A hashtable that stores information about updated cells. + */ + updatedValues: Object; +} +/** + * A method that will handle the BatchEditCardInserting event. + */ +interface ASPxClientCardViewBatchEditCardInsertingEventHandler { + /** + * A method that will handle the BatchEditCardInserting event. + * @param source The event source. This parameter identifies the card view object which raised the event. + * @param e An ASPxClientCardViewBatchEditCardInsertingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditCardInsertingEventArgs): void; +} +/** + * Provides data for the BatchEditCardInserting event. + */ +interface ASPxClientCardViewBatchEditCardInsertingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed card visible index. + * Value: An integer value that specifies the processed card visible index. + */ + visibleIndex: number; +} +/** + * A method that will handle the BatchEditCardDeleting event. + */ +interface ASPxClientCardViewBatchEditCardDeletingEventHandler { + /** + * A method that will handle the BatchEditCardDeleting event. + * @param source The event source. This parameter identifies the card view object which raised the event. + * @param e An ASPxClientCardViewBatchEditCardDeletingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCardViewBatchEditCardDeletingEventArgs): void; +} +/** + * Provides data for the BatchEditCardDeleting event. + */ +interface ASPxClientCardViewBatchEditCardDeletingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed card visible index. + * Value: An integer value that specifies the processed card visible index. + */ + visibleIndex: number; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + cardValues: Object; +} +/** + * Provides members related to Batch Edit Mode + */ +interface ASPxClientCardViewBatchEditApi { + /** + * 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(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. + */ + ValidateCard(visibleIndex: number): boolean; + /** + * Returns an array of card visible indices. + * @param includeDeleted true, to include visible indices of deleted cards to the returned array; otherwise, false. + */ + GetCardVisibleIndices(includeDeleted: boolean): number[]; + /** + * Returns an array of the deleted card visible indices. + */ + GetDeletedCardIndices(): number[]; + /** + * Returns an array of the inserted card visible indices. + */ + GetInsertedCardIndices(): number[]; + /** + * Indicates if the card with the specified visible index is deleted. + * @param visibleIndex An integer value that identifies the card by its visible index. + */ + IsDeletedCard(visibleIndex: number): boolean; + /** + * Indicates if the card with the specified visible index is newly created. + * @param visibleIndex An integer value that identifies the card by its visible index. + */ + IsNewCard(visibleIndex: number): boolean; + /** + * Programmatically moves the focus to the previous cell in the card + */ + MoveFocusBackward(): boolean; + /** + * Programmatically moves the focus to the next cell in the card. + */ + MoveFocusForward(): boolean; + /** + * Sets the value of the specified cell. + * @param visibleIndex An integer zero-based index that identifies the card containing the processed cell. + * @param columnFieldNameOrId A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + * @param value An object that contains the new cell value. + */ + SetCellValue(visibleIndex: number, columnFieldNameOrId: string, value: Object): void; + /** + * Sets the value of the specified cell. + * @param visibleIndex An integer zero-based index that identifies the card containing the processed cell. + * @param columnFieldNameOrId A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + * @param value An object that contains the new cell value. + * @param displayText A string value that specifies the cell display text. + * @param cancelCellHighlighting true to cancel highlighting of the modified cell, false to highlight the modified cell. + */ + SetCellValue(visibleIndex: number, columnFieldNameOrId: string, value: Object, displayText: string, cancelCellHighlighting?: boolean): void; + /** + * Gets the value of the specified cell. + * @param visibleIndex A zero-based integer value that specifies the visible index of a card containing the processed cell. + * @param columnFieldNameOrId A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + * @param initial true, to return the initial (server) value; false, to return a value currently contained on the client side (modified value). + */ + GetCellValue(visibleIndex: number, columnFieldNameOrId: string, initial?: boolean): Object; + /** + * Gets information about the cell currently being edited. + */ + GetEditCellInfo(): ASPxClientCardViewCellInfo; + /** + * Returns a value that indicates whether the card view has changed data. + */ + HasChanges(): boolean; + /** + * Returns a value that indicates whether the specified card has changed data. + * @param visibleIndex An integer value that specifies the visible index of a card. + */ + HasChanges(visibleIndex: number): boolean; + /** + * Returns a value that indicates whether the specified cell's data has been changed. + * @param visibleIndex An integer value that specifies the visible index of a card. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + HasChanges(visibleIndex: number, columnFieldNameOrId: string): boolean; + /** + * Resets changes in the specified card. + * @param visibleIndex An integer value that specifies the visible index of a card. + */ + ResetChanges(visibleIndex: number): void; + /** + * Resets changes in the specified cell. + * @param visibleIndex An integer value that specifies the visible index of a card containing the processed cell. + * @param columnIndex A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + */ + ResetChanges(visibleIndex: number, columnIndex: number): void; + /** + * Switches the specified cell to edit mode. + * @param visibleIndex A zero-based integer value that specifies the visible index of a card containing the processed cell. + * @param columnIndex A zero-based integer value that identifies the column which contains the processed cell in the column collection. + */ + StartEdit(visibleIndex: number, columnIndex: number): void; + /** + * Ends cell or card editing. + */ + EndEdit(): void; +} +/** + * Contains information on a grid cell. + */ +interface ASPxClientCardViewCellInfo { + /** + * Gets the visible index of the card that contains the cell currently being processed. + * Value: An value that specifies the visible index of the card. + */ + cardVisibleIndex: number; + /** + * Gets the data column that contains the cell currently being processed. + * Value: An object that is the data column which contains the processed cell. + */ + column: ASPxClientCardViewColumn; +} +/** + * A client-side equivalent of the ASPxGridView object. + */ +interface ASPxClientGridView extends ASPxClientGridBase { + /** + * Provides access to the batch editing client API. + * Value: A object that exposes the batch editing client API methods. + */ + batchEditApi: ASPxClientGridViewBatchEditApi; + /** + * Occurs when a custom command button has been clicked. + */ + CustomButtonClick: ASPxClientEvent>; + /** + * Fires after the selection has been changed. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Enables you to prevent columns from being sorted. + */ + ColumnSorting: ASPxClientEvent>; + /** + * Fires in response to changing row focus. + */ + FocusedRowChanged: ASPxClientEvent>; + /** + * Enables you to cancel data grouping. + */ + ColumnGrouping: ASPxClientEvent>; + /** + * Fires when an end-user starts dragging the column's header and enables you to cancel this operation. + */ + ColumnStartDragging: ASPxClientEvent>; + /** + * Enables you to prevent columns from being resized. + */ + ColumnResizing: ASPxClientEvent>; + /** + * Occurs after a column's width has been changed by an end-user. + */ + ColumnResized: ASPxClientEvent>; + /** + * Enables you to control column movement. + */ + ColumnMoving: ASPxClientEvent>; + /** + * Fires before a group row is expanded. + */ + RowExpanding: ASPxClientEvent>; + /** + * Fires before a group row is collapsed. + */ + RowCollapsing: ASPxClientEvent>; + /** + * Fires before a detail row is expanded. + */ + DetailRowExpanding: ASPxClientEvent>; + /** + * Fires before a detail row is collapsed. + */ + DetailRowCollapsing: ASPxClientEvent>; + /** + * Fires on the client when a data row is clicked. + */ + RowClick: ASPxClientEvent>; + /** + * Fires on the client when a data row is double clicked. + */ + RowDblClick: ASPxClientEvent>; + /** + * Occurs after an end-user right clicks in the GridView, and enables you to provide a custom context menu. + */ + ContextMenu: ASPxClientEvent>; + /** + * Fires on the client side when a context menu item has been clicked. + */ + ContextMenuItemClick: ASPxClientEvent>; + /** + * Enables you to specify whether row data is valid and provide an error text. + */ + BatchEditRowValidating: ASPxClientEvent>; + /** + * Enables you to prevent a batch edit confirmation message from being displayed. + */ + BatchEditConfirmShowing: ASPxClientEvent>; + /** + * Occurs when a grid switches to batch edit mode. + */ + BatchEditStartEditing: ASPxClientEvent>; + /** + * Occurs when a grid leaves the batch edit mode. + */ + BatchEditEndEditing: ASPxClientEvent>; + /** + * Enables you to provide navigation for editors contained in a templated cell in Batch Edit mode. + */ + BatchEditTemplateCellFocused: ASPxClientEvent>; + /** + * Occurs on the client side before data changes are saved in batch edit mode. + */ + BatchEditChangesSaving: ASPxClientEvent>; + /** + * Occurs on the client side before data changes are canceled in batch edit mode. + */ + BatchEditChangesCanceling: ASPxClientEvent>; + /** + * Occurs on the client side before a data row is inserted in batch edit mode. + */ + BatchEditRowInserting: ASPxClientEvent>; + /** + * Occurs on the client side before a data row is deleted in batch edit mode. + */ + BatchEditRowDeleting: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any unhandled server error occurs during server-side processing of a callback sent by the ASPxClientGridView. + */ + CallbackError: ASPxClientEvent>; + /** + * Fires after the Customization Window has been closed. + */ + CustomizationWindowCloseUp: ASPxClientEvent>; + /** + * Deselects the specified rows (if selected) within the grid. + * @param visibleIndices An array of zero-based indices that identify data rows within the grid. + */ + UnselectRows(visibleIndices: number[]): void; + /** + * Deselects the specified row (if selected) within the grid. + * @param visibleIndex A zero-based integer value that specifies the row's visible index. + */ + UnselectRows(visibleIndex: number): void; + /** + * Deselects all grid rows that match the filter criteria currently applied to the grid. + */ + UnselectFilteredRows(): void; + /** + * Selects the specified row displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the row's visible index. + */ + SelectRowOnPage(visibleIndex: number): void; + /** + * Selects or deselects the specified row displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the row's visible index. + * @param selected true to select the specified row; false to deselect the row. + */ + SelectRowOnPage(visibleIndex: number, selected?: boolean): void; + /** + * Deselects the specified row (if selected) displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the row's visible index. + */ + UnselectRowOnPage(visibleIndex: number): void; + /** + * Selects all unselected rows displayed on the current page. + */ + SelectAllRowsOnPage(): void; + /** + * Allows you to select or deselect all rows displayed on the current page based on the parameter passed. + * @param selected true to select all unselected rows displayed on the current page; false to deselect all selected rows on the page. + */ + SelectAllRowsOnPage(selected: boolean): void; + /** + * Deselects all selected rows displayed on the current page. + */ + UnselectAllRowsOnPage(): void; + /** + * Returns the number of selected rows. + */ + GetSelectedRowCount(): number; + /** + * Indicates whether or not the specified row is selected within the current page. + * @param visibleIndex An integer value that identifies the row by its visible index. + */ + IsRowSelectedOnPage(visibleIndex: number): boolean; + /** + * Indicates whether the specified row is a group row. + * @param visibleIndex An integer value that identifies the row by its visible index. + */ + IsGroupRow(visibleIndex: number): boolean; + /** + * Indicates whether the specified row is a data row. + * @param visibleIndex An integer value that identifies the row by its visible index. + */ + IsDataRow(visibleIndex: number): boolean; + /** + * Indicates whether the specified group row is expanded. + * @param visibleIndex An integer value that identifies the group row by its visible index. + */ + IsGroupRowExpanded(visibleIndex: number): boolean; + /** + * Returns the current vertical scroll position of the grid's content. + */ + GetVertScrollPos(): number; + /** + * Returns the current horizontal scroll position of the grid's content. + */ + GetHorzScrollPos(): number; + /** + * Returns the current horizontal scroll position of the grid's content. + */ + GetHorizontalScrollPosition(): number; + /** + * Specifies the vertical scroll position for the grid's content. + * @param position An integer value specifying the vertical scroll position. + */ + SetVertScrollPos(position: number): void; + /** + * Specifies the horizontal scroll position for the grid's content. + * @param position An integer value specifying the horizontal scroll position. + */ + SetHorzScrollPos(position: number): void; + /** + * Specifies the horizontal scroll position for the grid's content. + * @param position An integer value specifying the horizontal scroll position. + */ + SetHorizontalScrollPosition(position: number): void; + /** + * Sets the scrollability of various types of grid rows when the grid displays fixed columns. + * @param scrollableRowSettings An object specifying which types of grid rows should or should not be scrollable. + */ + SetFixedColumnScrollableRows(scrollableRowSettings: Object): void; + /** + * Applies a filter specified in the filter row to the GridView. + */ + ApplyOnClickRowFilter(): void; + /** + * Returns the editor used to edit the value in the auto filter row for the specified data column. + * @param column An ASPxClientGridViewColumn object that represents the data colum within the ASPxGridView. + */ + GetAutoFilterEditor(column: ASPxClientGridViewColumn): Object; + /** + * Returns the editor used to edit the value in the auto filter row for the specified data column. + * @param columnIndex An integer value that identifies the data column by its index. + */ + GetAutoFilterEditor(columnIndex: number): Object; + /** + * Returns the editor used to edit the value in the auto filter row for the specified data column. + * @param columnFieldNameOrId A string value that specifies the column's name or its data base field name. + */ + GetAutoFilterEditor(columnFieldNameOrId: string): Object; + /** + * Applies a filter to the specified data column. + * @param column An ASPxClientGridViewColumn object that represents the data column within the client GridView. + * @param val A string value that specifies the filter expression. + */ + AutoFilterByColumn(column: ASPxClientGridViewColumn, val: string): void; + /** + * Applies a filter to the specified data column. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param val A string value that specifies the filter expression. + */ + AutoFilterByColumn(columnIndex: number, val: string): void; + /** + * Applies a filter to the specified data column. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param val A string value that specifies the filter expression. + */ + AutoFilterByColumn(columnFieldNameOrId: string, val: string): void; + /** + * Applies the specified search panel filter criterion to grid data. + * @param value A string value that specifies the filter criterion. + */ + ApplySearchPanelFilter(value: string): void; + /** + * Applies the specified filter expression to the GridView. + * @param filterExpression A string value that specifies the filter expression. + */ + ApplyFilter(filterExpression: string): void; + /** + * Clears the filter expression applied to a client GridView. + */ + ClearFilter(): void; + /** + * Gets the Popup Edit Form. + */ + GetPopupEditForm(): ASPxClientPopupControl; + /** + * Sets input focus to the grid. + */ + Focus(): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * + * @param args + * @param onSuccess + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; + /** + * Selects the specified page. + * @param pageIndex An integer value that specifies the active page's index. + */ + GotoPage(pageIndex: number): void; + /** + * Gets the index of the page currently being selected. + */ + GetPageIndex(): number; + /** + * Gets the number of pages to which the grid's data is divided. + */ + GetPageCount(): number; + /** + * Activates the next page. + */ + NextPage(): void; + /** + * Activates the previous page. + */ + PrevPage(): void; + /** + * Returns the index of the first data row displayed within the GridView's active page. + */ + GetTopVisibleIndex(): number; + /** + * Indicates whether the grid is in edit mode. + */ + IsEditing(): boolean; + /** + * Saves all the changes made and switches the grid to browse mode. + */ + UpdateEdit(): void; + /** + * Cancels all the changes made and switches the GridView to browse mode. + */ + CancelEdit(): void; + /** + * Updates data displayed within the grid. + */ + Refresh(): void; + /** + * Indicates whether the Customization Window is displayed. + */ + IsCustomizationWindowVisible(): boolean; + /** + * Invokes the Customization Window. + */ + ShowCustomizationWindow(): void; + /** + * Invokes the Customization Window and displays it over the specified HTML element. + * @param showAtElement An object that specifies the HTML element relative to whose position the customization window is invoked. + */ + ShowCustomizationWindow(showAtElement?: Object): void; + /** + * Closes the Customization Window. + */ + HideCustomizationWindow(): void; + /** + * Returns the number of columns within the client GridView. + */ + GetColumnsCount(): number; + /** + * Returns the number of columns within the client GridView. + */ + GetColumnCount(): number; + /** + * Returns the row values displayed within all selected rows. + * @param fieldNames The names of data source fields separated via a semicolon, whose values within the selected rows are returned. + * @param onCallback A ASPxClientGridViewValuesCallback object that represents the JavaScript function which receives the list of row values as a parameter. + */ + GetSelectedFieldValues(fieldNames: string, onCallback: ASPxClientGridViewValuesCallback): void; + /** + * Returns key values of selected rows displayed within the current page. + */ + GetSelectedKeysOnPage(): Object[]; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event. + * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback A ASPxClientGridViewValuesCallback object that is the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(args: string, onCallback: ASPxClientGridViewValuesCallback): void; + /** + * Returns the values of the specified data source fields within the specified row. + * @param visibleIndex An integer value that identifies the data row. + * @param fieldNames The names of data source fields separated via a semicolon, whose values within the specified row are returned. + * @param onCallback An ASPxClientGridViewValuesCallback object that represents the JavaScript function which receives the list of row values as a parameter. + */ + GetRowValues(visibleIndex: number, fieldNames: string, onCallback: ASPxClientGridViewValuesCallback): void; + /** + * Returns the row values displayed within the current page. + * @param fieldNames The names of data source fields whose values are returned. + * @param onCallback A ASPxClientGridViewValuesCallback object that represents the JavaScript function which receives the list of row values as a parameter. + */ + GetPageRowValues(fieldNames: string, onCallback: ASPxClientGridViewValuesCallback): void; + /** + * Returns the number of rows actually displayed within the active page. + */ + GetVisibleRowsOnPage(): number; + /** + * Returns the client column that resides at the specified position within the column collection. + * @param columnIndex A zero-based index that identifies the column within the column collection (the column's Index property value). + */ + GetColumn(columnIndex: number): ASPxClientGridViewColumn; + /** + * Returns the column with the specified unique identifier. + * @param columnId A string value that specifies the column's unique identifier (the column's Name property value). + */ + GetColumnById(columnId: string): ASPxClientGridViewColumn; + /** + * Returns the client column which is bound to the specified data source field. + * @param columnFieldName A string value that specifies the name of the data source field to which the column is bound (the column's FieldName property value). + */ + GetColumnByField(columnFieldName: string): ASPxClientGridViewColumn; + /** + * Returns the editor used to edit the specified column's values. + * @param column An ASPxClientGridViewColumn object that specifies the required column within the client grid. + */ + GetEditor(column: ASPxClientGridViewColumn): ASPxClientEdit; + /** + * Returns the editor used to edit the specified column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + */ + GetEditor(columnIndex: number): ASPxClientEdit; + /** + * Returns the editor used to edit the specified column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + GetEditor(columnFieldNameOrId: string): ASPxClientEdit; + /** + * Returns the value of the specified edit cell. + * @param column An ASPxClientGridViewColumn object that represents the data column within the client grid. + */ + GetEditValue(column: ASPxClientGridViewColumn): string; + /** + * Returns the value of the specified edit cell. + * @param columnIndex An integer value that identifies the data column within the grid's column collection. + */ + GetEditValue(columnIndex: number): string; + /** + * Returns the value of the specified edit cell. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + GetEditValue(columnFieldNameOrId: string): string; + /** + * Moves focus to the specified edit cell within the edited row. + * @param column An ASPxClientGridViewColumn object that represents the data column within the client grid. + */ + FocusEditor(column: ASPxClientGridViewColumn): void; + /** + * Moves focus to the specified edit cell within the edited row. + * @param columnIndex An integer value that specifies the column's position within the columns collection. + */ + FocusEditor(columnIndex: number): void; + /** + * Moves focus to the specified edit cell within the edited row. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + FocusEditor(columnFieldNameOrId: string): void; + /** + * Sets the value of the specified edit cell. + * @param column An ASPxClientGridViewColumn object that represents the data column within the client grid. + * @param value A string value that specifies the edit cell's new value. + */ + SetEditValue(column: ASPxClientGridViewColumn, value: string): void; + /** + * Sets the value of the specified edit cell. + * @param columnIndex An integer value that identifies the data column within the grid's column collection. + * @param value A string value that specifies the edit cell's new value. + */ + SetEditValue(columnIndex: number, value: string): void; + /** + * Sets the value of the specified edit cell. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param value A string value that specifies the edit cell's new value. + */ + SetEditValue(columnFieldNameOrId: string, value: string): void; + /** + * Displays the Filter Control. + */ + ShowFilterControl(): void; + /** + * Hides the Filter Control. + */ + CloseFilterControl(): void; + /** + * Enables or disables the current filter. + * @param isFilterEnabled true to enable the current filter; otherwise, false. + */ + SetFilterEnabled(isFilterEnabled: boolean): void; + /** + * Returns the current vertical scroll position of the grid's content. + */ + GetVerticalScrollPosition(): number; + /** + * Specifies the vertical scroll position for the grid's content. + * @param position An integer value specifying the vertical scroll position. + */ + SetVerticalScrollPosition(position: number): void; + /** + * Gets information about a focused cell. + */ + GetFocusedCell(): ASPxClientGridViewCellInfo; + /** + * Focuses the specified cell. + * @param rowVisibleIndex An integer value that specifies the visible index of the row. + * @param columnIndex A zero-based index that identifies the column in the column collection (the column's Index property value). + */ + SetFocusedCell(rowVisibleIndex: number, columnIndex: number): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientGridViewColumn object that represents the data column. + */ + SortBy(column: ASPxClientGridViewColumn): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + */ + SortBy(columnIndex: number): void; + /** + * Sorts data by the specified data column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + SortBy(columnFieldNameOrId: string): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientGridViewColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(column: ASPxClientGridViewColumn, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(columnIndex: number, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(columnFieldNameOrId: string, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientGridViewColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(column: ASPxClientGridViewColumn, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(columnIndex: number, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values, and places the column to the specified position among the sorted columns. + * @param column An ASPxClientGridViewColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex An integer value that specifies the zero-based column's index among the sorted columns. -1 if data is not sorted by this column. + */ + SortBy(column: ASPxClientGridViewColumn, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Sorts data by the specified data column's values, and places the column to the specified position among the sorted columns. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex An integer value that specifies the zero-based column's index among the sorted columns. -1 if data is not sorted by this column. + */ + SortBy(columnIndex: number, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Sorts data by the specified data column's values, and places the column to the specified position among the sorted columns. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex An integer value that specifies the zero-based column's index among the sorted columns. -1 if data is not sorted by this column. + */ + SortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Hides the specified column. + * @param column An ASPxClientGridViewColumn object that represents the column to hide. + */ + MoveColumn(column: ASPxClientGridViewColumn): void; + /** + * Hides the specified column. + * @param columnIndex An integer value that specifies the absolute index of the column to hide. + */ + MoveColumn(columnIndex: number): void; + /** + * Hides the specified column. + * @param columnFieldNameOrId A String value that identifies the column to be hidden by the name of the data source field to which the column is bound, or by the column's name. + */ + MoveColumn(columnFieldNameOrId: string): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param column An ASPxClientGridViewColumn object that represents the column to move. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the grid. + */ + MoveColumn(column: ASPxClientGridViewColumn, moveToColumnVisibleIndex: number): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the grid. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param columnFieldNameOrId A String value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the grid. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param column An ASPxClientGridViewColumn object that represents the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + */ + MoveColumn(column: ASPxClientGridViewColumn, moveToColumnVisibleIndex: number, moveBefore: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number, moveBefore: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param columnFieldNameOrId A string value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, moveBefore: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups the grid's data by this column. + * @param column An ASPxClientGridViewColumn object that represents the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + * @param moveToGroup true to group the grid's data by the column; otherwise, false. + */ + MoveColumn(column: ASPxClientGridViewColumn, moveToColumnVisibleIndex: number, moveBefore: boolean, moveToGroup: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups the grid's data by this column. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + * @param moveToGroup true to group the ASPxGridView's data by the column; otherwise, false. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number, moveBefore: boolean, moveToGroup: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups the grid's data by this column. + * @param columnFieldNameOrId A string value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + * @param moveToGroup true to group the grid's data by the column; otherwise, false. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, moveBefore: boolean, moveToGroup: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups or ungroups the grid's data by this column. + * @param column An ASPxClientGridViewColumn object that represents the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + * @param moveToGroup true to group the grid's data by the column; otherwise, false. + * @param moveFromGroup true to ungroup the grid's data by the column; otherwise, false. + */ + MoveColumn(column: ASPxClientGridViewColumn, moveToColumnVisibleIndex: number, moveBefore: boolean, moveToGroup: boolean, moveFromGroup: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups or ungroups the grid's data by this column. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + * @param moveToGroup true to group the grid's data by the column; otherwise, false. + * @param moveFromGroup true to ungroup the grid's data by the column; otherwise, false. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number, moveBefore: boolean, moveToGroup: boolean, moveFromGroup: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups or ungroups the grid's data by this column. + * @param columnFieldNameOrId A string value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param moveBefore true to move the column before the target column; otherwise, false. + * @param moveToGroup true to group the grid's data by the column; otherwise, false. + * @param moveFromGroup true to ungroup the grid's data by the column; otherwise, false. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, moveBefore: boolean, moveToGroup: boolean, moveFromGroup: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the grid. + * @param targetPosition An ASPxClientGridColumnMovingTargetPosition enumeration value specifying the position relative to the target column in which to place the moved column. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number, targetPosition: ASPxClientGridColumnMovingTargetPosition): void; + /** + * Moves the specified column to the specified visual position within the grid. + * @param columnFieldNameOrId A String value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that specifies the column's position among the visible columns within the grid. + * @param targetPosition An ASPxClientGridColumnMovingTargetPosition enumeration value specifying the position relative to the target column in which to place the moved column. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, targetPosition: ASPxClientGridColumnMovingTargetPosition): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups or ungroups the grid's data by this column. + * @param columnIndex An integer value that specifies the absolute index of the column to move. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param targetPosition An ASPxClientGridColumnMovingTargetPosition enumeration value specifying the position relative to the target column in which to place the moved column. + * @param moveToGroup true, to group the ASPxGridView's data by the column; otherwise, false. + * @param moveFromGroup true, to ungroup the grid's data by the column; otherwise, false. + */ + MoveColumn(columnIndex: number, moveToColumnVisibleIndex: number, targetPosition: ASPxClientGridColumnMovingTargetPosition, moveToGroup: boolean, moveFromGroup: boolean): void; + /** + * Moves the specified column to the specified visual position within the grid and optionally groups or ungroups the grid's data by this column. + * @param columnFieldNameOrId A string value that identifies the column to be moved by the name of the data source field to which the column is bound or by the column's name. + * @param moveToColumnVisibleIndex An integer value that identifies the target column displayed within the grid. + * @param targetPosition An ASPxClientGridColumnMovingTargetPosition enumeration value specifying the position relative to the target column in which to place the moved column. + * @param moveToGroup true, to group the grid's data by the column; otherwise, false. + * @param moveFromGroup true, to ungroup the grid's data by the column; otherwise, false. + */ + MoveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, targetPosition: ASPxClientGridColumnMovingTargetPosition, moveToGroup: boolean, moveFromGroup: boolean): void; + /** + * Groups data by the values of the specified column. + * @param column An ASPxClientGridViewColumn object that represents the data column by whose values data is grouped. + */ + GroupBy(column: ASPxClientGridViewColumn): void; + /** + * Groups data by the values of the specified column. + * @param columnIndex An integer value that specifies the column's position within the column collection. + */ + GroupBy(columnIndex: number): void; + /** + * Groups data by the values of the specified column. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + GroupBy(columnFieldNameOrId: string): void; + /** + * Groups data by the values of the specified data column. If several columns are involved in grouping, the specified column will reside at the specified grouping level. + * @param column An ASPxClientGridViewColumn object that represents the data column by whose values data is grouped. + * @param groupIndex An integer value that specifies the grouping level. -1 to cancel grouping by the column's values. + */ + GroupBy(column: ASPxClientGridViewColumn, groupIndex: number): void; + /** + * Groups data by the values of the specified data column. If several columns are involved in grouping, the specified column will reside at the specified grouping level. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param groupIndex An integer value that specifies the grouping level. -1 to cancel grouping by the column's values. + */ + GroupBy(columnIndex: number, groupIndex: number): void; + /** + * Groups data by the values of the specified data column. If several columns are involved in grouping, the specified column will reside at the specified grouping level. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param groupIndex An integer value that specifies the grouping level. -1 to cancel grouping by the column's values. + */ + GroupBy(columnFieldNameOrId: string, groupIndex: number): void; + /** + * Groups data by the values of the specified data column with the specified sort order. If several columns are involved in grouping, the specified column will reside at the specified grouping level. + * @param column An ASPxClientGridViewColumn object that represents the data column by whose values data is grouped. + * @param groupIndex An integer value that specifies the grouping level. -1 to cancel grouping by the column's values. + * @param sortOrder A string value that specifies the column's sort order. + */ + GroupBy(column: ASPxClientGridViewColumn, groupIndex: number, sortOrder: string): void; + /** + * Groups data by the values of the specified data column with the specified sort order. If several columns are involved in grouping, the specified column will reside at the specified grouping level. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param groupIndex An integer value that specifies the grouping level. -1 to cancel grouping by the column's values. + * @param sortOrder A string value that specifies the column's sort order. + */ + GroupBy(columnIndex: number, groupIndex: number, sortOrder: string): void; + /** + * Groups data by the values of the specified data column with the specified sort order. If several columns are involved in grouping, the specified column will reside at the specified grouping level. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param groupIndex An integer value that specifies the grouping level. -1 to cancel grouping by the column's values. + * @param sortOrder A string value that specifies the column's sort order. + */ + GroupBy(columnFieldNameOrId: string, groupIndex: number, sortOrder: string): void; + /** + * Ungroups data by the values of the specified column. + * @param column An ASPxClientGridViewColumn object that represents the data column within the ASPxGridView. + */ + UnGroup(column: ASPxClientGridViewColumn): void; + /** + * Ungroups data by the values of the specified column. + * @param columnIndex An integer value that specifies the column's position within the column collection. + */ + UnGroup(columnIndex: number): void; + /** + * Ungroups data by the values of the specified column. + * @param columnFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + */ + UnGroup(columnFieldNameOrId: string): void; + /** + * Expands all group rows. + */ + ExpandAll(): void; + /** + * Collapses all group rows. + */ + CollapseAll(): void; + /** + * Expands all detail rows. + */ + ExpandAllDetailRows(): void; + /** + * Collapses all detail rows. + */ + CollapseAllDetailRows(): void; + /** + * Expands the specified group row preserving the collapsed state of any child group row. + * @param visibleIndex An integer value that identifies the group row. + */ + ExpandRow(visibleIndex: number): void; + /** + * Expands the specified group row and optionally child group rows at all nesting levels. + * @param visibleIndex An integer value that identifies the group row. + * @param recursive true to expand any child group rows at all nesting levels; false to preserve the collapsed state of any child group rows. + */ + ExpandRow(visibleIndex: number, recursive?: boolean): void; + /** + * Collapses the specified group row preserving the expanded state of child group rows. + * @param visibleIndex An integer value that identifies the group row by its visible index. + */ + CollapseRow(visibleIndex: number): void; + /** + * Collapses the specified group row and optionally child group rows at all nesting levels. + * @param visibleIndex An integer value that identifies the group row by its visible index. + * @param recursive true to collapse child group rows at all nesting levels; false to preserve the expanded state of any child group row. + */ + CollapseRow(visibleIndex: number, recursive?: boolean): void; + /** + * Scrolls the view to the specified row. + * @param visibleIndex An integer value that identifies a row by its visible index. + */ + MakeRowVisible(visibleIndex: number): void; + /** + * Expands the specified detail row. + * @param visibleIndex A zero-based integer index that identifies the detail row. + */ + ExpandDetailRow(visibleIndex: number): void; + /** + * Collapses the specified detail row. + * @param visibleIndex A zero-based integer index that identifies the detail row. + */ + CollapseDetailRow(visibleIndex: number): void; + /** + * Returns the key value of the specified data row. + * @param visibleIndex An integer value that specifies the row's visible index. + */ + GetRowKey(visibleIndex: number): string; + /** + * Switches the grid to edit mode. + * @param visibleIndex A zero-based integer that identifies a data row to be edited. + */ + StartEditRow(visibleIndex: number): void; + /** + * Switches the grid to edit mode. + * @param key An object that uniquely identifies a data row to be edited. + */ + StartEditRowByKey(key: Object): void; + /** + * Indicates whether or not a new row is being edited. + */ + IsNewRowEditing(): boolean; + /** + * Adds a new record. + */ + AddNewRow(): void; + /** + * Deletes the specified row. + * @param visibleIndex An integer value that identifies the row. + */ + DeleteRow(visibleIndex: number): void; + /** + * Deletes a row with the specified key value. + * @param key An object that uniquely identifies the row. + */ + DeleteRowByKey(key: Object): void; + /** + * Returns the focused row's index. + */ + GetFocusedRowIndex(): number; + /** + * Moves focus to the specified row. + * @param visibleIndex An integer value that specifies the focused row's index. + */ + SetFocusedRowIndex(visibleIndex: number): void; + /** + * Selects all the unselected rows within the grid. + */ + SelectRows(): void; + /** + * Selects the specified row displayed within the grid. + * @param visibleIndex A zero-based integer value that specifies the row's visible index. + */ + SelectRows(visibleIndex: number): void; + /** + * Selects the specified rows within the grid. + * @param visibleIndices An array of zero-based indices that identify data rows within the grid. + */ + SelectRows(visibleIndices: number[]): void; + /** + * Selects or deselects the specified rows within the grid. + * @param visibleIndices An array of zero-based indices that identify data rows within the grid. + * @param selected true to select the specified rows; false to deselect the rows. + */ + SelectRows(visibleIndices: number[], selected: boolean): void; + /** + * Selects or deselects the specified row within the grid. + * @param visibleIndex An integer zero-based index that identifies the data row within the grid. + * @param selected true to select the specified row; false to deselect the row. + */ + SelectRows(visibleIndex: number, selected?: boolean): void; + /** + * Selects or deselects the specified rows displayed within the grid. + * @param keys An array of objects that uniquely identify the rows. + * @param selected true to select the specified rows; false to deselect the rows. + */ + SelectRowsByKey(keys: Object[], selected?: boolean): void; + /** + * Selects or deselects the specified row displayed within the grid. + * @param key An object that uniquely identifies the row. + * @param selected true to select the specified row; false to deselect the row. + */ + SelectRowsByKey(key: Object, selected?: boolean): void; + /** + * Selects the specified rows displayed within the grid. + * @param keys An array of objects that uniquely identify the rows. + */ + SelectRowsByKey(keys: Object[]): void; + /** + * Selects a grid row by its key. + * @param key An object that uniquely identifies the row. + */ + SelectRowsByKey(key: Object): void; + /** + * Deselects the specified rows displayed within the grid. + * @param keys An array of objects that uniquely identify the rows. + */ + UnselectRowsByKey(keys: Object[]): void; + /** + * Deselects the specified row displayed within the grid. + * @param key An object that uniquely identifies the row. + */ + UnselectRowsByKey(key: Object): void; + /** + * Deselects all the selected rows within the grid. + */ + UnselectRows(): void; +} +/** + * A client grid column. + */ +interface ASPxClientGridViewColumn extends ASPxClientGridColumnBase { + /** + * Gets the column's unique identifier. + * Value: A string value that specifies the column's unique identifier. + */ + id: string; + /** + * Gets the name that uniquely identifies the column. + * Value: A string value assigned to the column's Name property. + */ + name: string; + /** + * Gets the column's position within the collection. + * Value: An integer zero-bazed index that specifies the column's position within the collection. + */ + index: number; + /** + * Gets the name of the database field assigned to the current column. + * Value: A string value that specifies the name of a data field. + */ + fieldName: string; + /** + * Gets whether the column is visible. + * Value: true to display the column; otherwise, false. + */ + visible: boolean; +} +/** + * Represents a JavaScript function which receives the list of row values when the client GetSelectedFieldValues method is called. + */ +interface ASPxClientGridViewValuesCallback { + /** + * Represents a JavaScript function which receives the list of row values when the client GetSelectedFieldValues method is called. + * @param result An object that represents the list of row values received from the server. + */ + (result: Object): void; +} +/** + * A method that will handle the cancelable events of a client ASPxGridView column. + */ +interface ASPxClientGridViewColumnCancelEventHandler { + /** + * A method that will handle the cancelable events of a client ASPxGridView column. + * @param source The event source. + * @param e An ASPxClientGridViewColumnCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewColumnCancelEventArgs): void; +} +/** + * Provides data for the cancelable events of a client ASPxGridView column. + */ +interface ASPxClientGridViewColumnCancelEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed client column. + * Value: An ASPxClientGridViewColumn object that represents the processed column. + */ + column: ASPxClientGridViewColumn; +} +/** + * A method that will handle the client events concerned with column processing. + */ +interface ASPxClientGridViewColumnProcessingModeEventHandler { + /** + * A method that will handle the client events concerned with column processing. + * @param source The event source. + * @param e A ASPxClientGridViewColumnProcessingModeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewColumnProcessingModeEventArgs): void; +} +/** + * Provides data for the client events concerned with column processing, and that allow the event's processing to be passed to the server side. + */ +interface ASPxClientGridViewColumnProcessingModeEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets a grid column related to the event. + * Value: An ASPxClientGridViewColumn object representing the column related to the event. + */ + column: ASPxClientGridViewColumn; +} +/** + * A method that will handle the RowExpanding events. + */ +interface ASPxClientGridViewRowCancelEventHandler { + /** + * A method that will handle the RowExpanding events. + * @param source The event source. + * @param e An ASPxClientGridViewRowCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewRowCancelEventArgs): void; +} +/** + * Provides data for the RowExpanding events. + */ +interface ASPxClientGridViewRowCancelEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed row's visible index. + * Value: An integer zero-based index that identifies the processed row. + */ + visibleIndex: number; +} +/** + * A method that will handle the SelectionChanged event. + */ +interface ASPxClientGridViewSelectionEventHandler { + /** + * A method that will handle the SelectionChanged event. + * @param source The event source. + * @param e An ASPxClientGridViewSelectionEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewSelectionEventArgs): void; +} +/** + * Provides data for the SelectionChanged event. + */ +interface ASPxClientGridViewSelectionEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the visible index of the row whose selected state has been changed. + * Value: An value that specifies the visible index of the row. + */ + visibleIndex: number; + /** + * Gets whether the row has been selected. + * Value: true if the row has been selected; otherwise, false. + */ + isSelected: boolean; + /** + * Gets whether all rows displayed within a page have been selected or unselected. + * Value: true if all rows displayed within a page have been selected or unselected; otherwise, false. + */ + isAllRecordsOnPage: boolean; + /** + * Gets whether a selection has been changed on the server. + * Value: true if a selection has been changed on the server; otherwise, false. + */ + isChangedOnServer: boolean; +} +/** + * A method that will handle the RowClick events. + */ +interface ASPxClientGridViewRowClickEventHandler { + /** + * A method that will handle the RowClick event. + * @param source The event source. This parameter identifies the ASPxClientGridView object that raised the event. + * @param e An ASPxClientGridViewRowClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewRowClickEventArgs): void; +} +/** + * Provides data for the RowClick event. + */ +interface ASPxClientGridViewRowClickEventArgs extends ASPxClientGridViewRowCancelEventArgs { + /** + * Provides access to the parameters associated with the RowClick event. + * Value: An object that contains parameters associated with the event. + */ + htmlEvent: Object; +} +/** + * A method that will handle the ContextMenu event. + */ +interface ASPxClientGridViewContextMenuEventHandler { + /** + * A method that will handle the ContextMenu event. + * @param source The event source. + * @param e An ASPxClientGridViewContextMenuEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewContextMenuEventArgs): void; +} +/** + * Provides data for the ContextMenu event. + */ +interface ASPxClientGridViewContextMenuEventArgs extends ASPxClientEventArgs { + /** + * Gets which grid element has been right clicked by the user. + * Value: A String value that specifies grid element. + */ + objectType: string; + /** + * Identifies the grid element being right clicked by the user. + * Value: A zero-based integer index that identifies the grid element being clicked by the user. + */ + index: number; + /** + * Provides access to the parameters associated with the ContextMenu event. + * Value: An object that contains parameters associated with the event. + */ + htmlEvent: Object; + /** + * Gets the currently processed menu object. + * Value: An object that is the currently processed menu. + */ + menu: Object; + /** + * Specifies whether a browser context menu should be displayed. + * Value: true, to display a browser context menu; otherwise, false. The default is false. + */ + showBrowserMenu: boolean; +} +/** + * A method that will handle the client ContextMenuItemClick event. + */ +interface ASPxClientGridViewContextMenuItemClickEventHandler { + /** + * A method that will handle the ContextMenuItemClick event. + * @param source The event source. + * @param e An ASPxClientGridViewContextMenuItemClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewContextMenuItemClickEventArgs): void; +} +/** + * Provides data for the ContextMenuItemClick event. + */ +interface ASPxClientGridViewContextMenuItemClickEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the clicked context menu item. + * Value: An object, manipulations on which forced the event to be raised. + */ + item: ASPxClientMenuItem; + /** + * Gets which grid element has been right clicked by the user. + * Value: A String value that specifies the grid element. + */ + objectType: string; + /** + * Returns the processed element index. + * Value: An integer value that specifies the processed element index. + */ + elementIndex: number; + /** + * Specifies whether a postback or a callback is used to finally process the event on the server side. + * Value: true to perform the round trip to the server side via postback; false to perform the round trip to the server side via callback. + */ + usePostBack: boolean; + /** + * Specifies whether default context menu item click is handled manually, so no default processing is required. + * Value: true if no default processing is required; otherwise false. + */ + handled: boolean; +} +/** + * A method that will handle the CustomButtonClick event. + */ +interface ASPxClientGridViewCustomButtonEventHandler { + /** + * A method that will handle the CustomButtonClick event. + * @param source The event source. This parameter identifies the ASPxClientGridView object that raised the event. + * @param e An ASPxClientGridViewCustomButtonEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewCustomButtonEventArgs): void; +} +/** + * Provides data for the CustomButtonClick event. + */ +interface ASPxClientGridViewCustomButtonEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the value which identifies the row whose custom button has been clicked. + * Value: An integer value that identifies the row whose custom button has been clicked. + */ + visibleIndex: number; + /** + * Gets the value which identifies the custom button. + * Value: A string value that identifies the clicked custom button. + */ + buttonID: string; +} +/** + * A method that will handle the ColumnMoving event. + */ +interface ASPxClientGridViewColumnMovingEventHandler { + /** + * A method that will handle the ColumnMoving event. + * @param source The event source. + * @param e An ASPxClientGridViewColumnMovingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewColumnMovingEventArgs): void; +} +/** + * Provides data for the ColumnMoving event. + */ +interface ASPxClientGridViewColumnMovingEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets whether a column is allowed to be moved. + * Value: true to allow column moving; otherwise, false. + */ + allow: boolean; + /** + * Gets the column currently being dragged by an end-user. + * Value: An ASPxClientGridViewColumn object that represents the column currently being dragged by an end-user. + */ + sourceColumn: ASPxClientGridViewColumn; + /** + * Gets the target column, before or after which the source column will be inserted (if dropped). + * Value: An ASPxClientGridViewColumn object that represents the target column. null (Nothing in Visual Basic) if the source column isn't over the column header panel. + */ + destinationColumn: ASPxClientGridViewColumn; + /** + * Gets whether the source column will be inserted before the target column (if dropped). + * Value: true if the source column will be inserted before the target column (if dropped); otherwise, false. + */ + isDropBefore: boolean; + /** + * Gets whether the source column is currently over the Group Panel. + * Value: true if the source column is currently over the Group Panel; otherwise, false. + */ + isGroupPanel: boolean; +} +/** + * Represents an object that will handle the client-side BatchEditConfirmShowing event. + */ +interface ASPxClientGridViewBatchEditConfirmShowingEventHandler { + /** + * A method that will handle the BatchEditConfirmShowing client event. + * @param source The event source. + * @param e An ASPxClientGridViewBatchEditConfirmShowingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditConfirmShowingEventArgs): void; +} +/** + * Provides data for the BatchEditConfirmShowing event. + */ +interface ASPxClientGridViewBatchEditConfirmShowingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the client identifier of an object that initiates a send request. + * Value: A string value that specifies the object client identifier. + */ + requestTriggerID: string; +} +/** + * A method that will handle the client BatchEditStartEditing event. + */ +interface ASPxClientGridViewBatchEditStartEditingEventHandler { + /** + * A method that will handle the BatchEditStartEditing event. + * @param source The event source. + * @param e An ASPxClientGridViewBatchEditStartEditingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditStartEditingEventArgs): void; +} +/** + * Provides data for the BatchEditStartEditing event. + */ +interface ASPxClientGridViewBatchEditStartEditingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the visible index of the row whose cells are about to be edited. + * Value: An value that specifies the visible index of the row. + */ + visibleIndex: number; + /** + * Gets the grid column that owns a cell that is about to be edited. + * Value: An object that is the focused grid column. + */ + focusedColumn: ASPxClientGridViewColumn; + /** + * Gets a hashtable that maintains information about editable cells. + * Value: A hashtable that stores information about editable cells. + */ + rowValues: Object; +} +/** + * A method that will handle the client BatchEditEndEditing event. + */ +interface ASPxClientGridViewBatchEditEndEditingEventHandler { + /** + * A method that will handle the BatchEditEndEditing event. + * @param source The event source. + * @param e An ASPxClientGridViewBatchEditEndEditingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditEndEditingEventArgs): void; +} +/** + * Provides data for the BatchEditEndEditing event. + */ +interface ASPxClientGridViewBatchEditEndEditingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the visible index of the row whose cells has been edited. + * Value: An value that specifies the visible index of the row. + */ + visibleIndex: number; + /** + * Gets a hashtable that maintains information about editable cells. + * Value: A hashtable that stores information about editable cells. + */ + rowValues: Object; +} +/** + * A method that will handle the client BatchEditRowValidating event. + */ +interface ASPxClientGridViewBatchEditRowValidatingEventHandler { + /** + * A method that will handle the BatchEditRowValidating event. + * @param source The event source. + * @param e An ASPxClientGridViewBatchEditRowValidatingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditRowValidatingEventArgs): void; +} +/** + * Provides data for the BatchEditRowValidating event. + */ +interface ASPxClientGridViewBatchEditRowValidatingEventArgs extends ASPxClientEventArgs { + /** + * Gets the processed row's visible index. + * Value: An integer value that specifies the processed row's visible index. + */ + visibleIndex: number; + /** + * Provides validation information of a row currently being validated. + * Value: An object that is a hashtable containing validation information. + */ + validationInfo: Object; +} +/** + * A method that will handle the client BatchEditTemplateCellFocused event. + */ +interface ASPxClientGridViewBatchEditTemplateCellFocusedEventHandler { + /** + * A method that will handle the BatchEditTemplateCellFocused event. + * @param source An object representing the event source. Identifies the button editor that raised the event. + * @param e An ASPxClientGridViewBatchEditTemplateCellFocusedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditTemplateCellFocusedEventArgs): void; +} +/** + * Provides data for the BatchEditTemplateCellFocused event. + */ +interface ASPxClientGridViewBatchEditTemplateCellFocusedEventArgs extends ASPxClientEventArgs { + /** + * Gets the currently processed column. + * Value: A object that is the client-side column object. + */ + column: ASPxClientGridViewColumn; + /** + * Gets or sets a value specifying whether the event was handled. + * Value: true if the event was handled and default processing should not occur; false if the event should be handled using default processing. + */ + handled: boolean; +} +/** + * A method that will handle the BatchEditChangesSaving event. + */ +interface ASPxClientGridViewBatchEditChangesSavingEventHandler { + /** + * A method that will handle the BatchEditChangesSaving event. + * @param source The event source. This parameter identifies the grid view object which raised the event. + * @param e An ASPxClientGridViewBatchEditChangesSavingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditChangesSavingEventArgs): void; +} +/** + * Provides data for the BatchEditChangesSaving event. + */ +interface ASPxClientGridViewBatchEditChangesSavingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets a hashtable that maintains information about inserted cells. + * Value: A hashtable that stores information about inserted cells. + */ + insertedValues: Object; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + deletedValues: Object; + /** + * Gets a hashtable that maintains information about updated cells. + * Value: A hashtable that stores information about updated cells. + */ + updatedValues: Object; +} +/** + * A method that will handle the BatchEditChangesCanceling event. + */ +interface ASPxClientGridViewBatchEditChangesCancelingEventHandler { + /** + * A method that will handle the BatchEditChangesCanceling event. + * @param source The event source. This parameter identifies the grid view object which raised the event. + * @param e An ASPxClientGridViewBatchEditChangesCancelingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditChangesCancelingEventArgs): void; +} +/** + * Provides data for the BatchEditChangesCanceling event. + */ +interface ASPxClientGridViewBatchEditChangesCancelingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets a hashtable that maintains information about inserted cells. + * Value: A hashtable that stores information about inserted cells. + */ + insertedValues: Object; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + deletedValues: Object; + /** + * Gets a hashtable that maintains information about updated cells. + * Value: A hashtable that stores information about updated cells. + */ + updatedValues: Object; +} +/** + * A method that will handle the BatchEditRowInserting event. + */ +interface ASPxClientGridViewBatchEditRowInsertingEventHandler { + /** + * A method that will handle the BatchEditRowInserting event. + * @param source The event source. This parameter identifies the card view object which raised the event. + * @param e An ASPxClientGridViewBatchEditRowInsertingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditRowInsertingEventArgs): void; +} +/** + * Provides data for the BatchEditRowInserting event. + */ +interface ASPxClientGridViewBatchEditRowInsertingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed row's visible index. + * Value: An integer value that specifies the processed row's visible index. + */ + visibleIndex: number; +} +/** + * A method that will handle the BatchEditRowDeleting event. + */ +interface ASPxClientGridViewBatchEditRowDeletingEventHandler { + /** + * A method that will handle the BatchEditRowDeleting event. + * @param source The event source. This parameter identifies the grid view object which raised the event. + * @param e An ASPxClientGridViewBatchEditRowDeletingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGridViewBatchEditRowDeletingEventArgs): void; +} +/** + * Provides data for the BatchEditRowDeleting event. + */ +interface ASPxClientGridViewBatchEditRowDeletingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed row's visible index. + * Value: An integer value that specifies the processed row's visible index. + */ + visibleIndex: number; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + rowValues: Object; +} +/** + * Contains information on a grid cell. + */ +interface ASPxClientGridViewCellInfo { + /** + * Gets the visible index of the row that contains the cell currently being processed. + * Value: An value that specifies the visible index of the row. + */ + rowVisibleIndex: number; + /** + * Gets the data column that contains the cell currently being processed. + * Value: An object that is the data column which contains the processed cell. + */ + column: ASPxClientGridViewColumn; +} +/** + * Provides members related to Batch Edit Mode + */ +interface ASPxClientGridViewBatchEditApi { + /** + * 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(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. + */ + ValidateRow(visibleIndex: number): boolean; + /** + * Returns an array of row visible indices. + * @param includeDeleted true, to include visible indices of deleted rows to the returned array; otherwise, false. + */ + GetRowVisibleIndices(includeDeleted: boolean): number[]; + /** + * Returns an array of the deleted row visible indices. + */ + GetDeletedRowIndices(): number[]; + /** + * Returns an array of the inserted row visible indices. + */ + GetInsertedRowIndices(): number[]; + /** + * Indicates if the row with specified visible index is deleted. + * @param visibleIndex An integer value that identifies the row by its visible index. + */ + IsDeletedRow(visibleIndex: number): boolean; + /** + * Indicates if the row with specified visible index is newly created. + * @param visibleIndex An integer value that identifies the row by its visible index. + */ + IsNewRow(visibleIndex: number): boolean; + /** + * Programmatically moves the focus to the previous cell in the row. + */ + MoveFocusBackward(): boolean; + /** + * Programmatically moves the focus to the next cell in the row. + */ + MoveFocusForward(): boolean; + /** + * Sets a value of the specified cell. + * @param visibleIndex An integer zero-based index that identifies the row containing the processed cell. + * @param columnFieldNameOrId A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + * @param value An object that contains the new cell value. + */ + SetCellValue(visibleIndex: number, columnFieldNameOrId: string, value: Object): void; + /** + * Sets the value of the specified cell. + * @param visibleIndex An integer zero-based index that identifies the row containing the processed cell. + * @param columnFieldNameOrId A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + * @param value An object that contains the new cell value. + * @param displayText A string value that specifies the cell display text. + * @param cancelCellHighlighting true to cancel highlighting of the modified cell, false to highlight the modified cell. + */ + SetCellValue(visibleIndex: number, columnFieldNameOrId: string, value: Object, displayText: string, cancelCellHighlighting?: boolean): void; + /** + * Gets the value of the specified cell. + * @param visibleIndex A zero-based integer value that specifies a visible index of a row containing the processed cell. + * @param columnFieldNameOrId A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + * @param initial true, to return the initial (server) value; false, to return a value currently contained on the client side (modified value). + */ + GetCellValue(visibleIndex: number, columnFieldNameOrId: string, initial?: boolean): Object; + /** + * Gets information about the cell currently being edited. + */ + GetEditCellInfo(): ASPxClientGridViewCellInfo; + /** + * Returns a value that indicates whether the grid has changed data. + */ + HasChanges(): boolean; + /** + * Returns a value that indicates whether the specified row has changed data. + * @param visibleIndex An integer value that specifies the visible index of a row. + */ + HasChanges(visibleIndex: number): boolean; + /** + * Returns a value that indicates whether the specified data cell's data has been changed. + * @param visibleIndex An integer value that specifies the visible index of a row. + * @param columnFieldNameOrId A string value that identifies the column by the name of the data source field to which the column is bound, or by the column's name. + */ + HasChanges(visibleIndex: number, columnFieldNameOrId: string): boolean; + /** + * Resets changes in the specified row. + * @param visibleIndex An integer value that specifies the visible index of a row. + */ + ResetChanges(visibleIndex: number): void; + /** + * Resets changes in the specified cell. + * @param visibleIndex An integer value that specifies the visible index of a row containing the processed cell. + * @param columnIndex A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + */ + ResetChanges(visibleIndex: number, columnIndex: number): void; + /** + * Switches the specified cell to edit mode. + * @param visibleIndex A zero-based integer value that specifies the visible index of a row containing the processed cell. + * @param columnIndex A zero-based integer value that identifies the column which contains the processed cell in the column collection. + */ + StartEdit(visibleIndex: number, columnIndex: number): void; + /** + * Ends cell or row editing. + */ + EndEdit(): void; +} +/** + * A client-side equivalent of the ASPxVerticalGrid object. + */ +interface ASPxClientVerticalGrid extends ASPxClientGridBase { + /** + * Provides access to the batch editing client API. + * Value: A object that exposes the batch editing client API methods. + */ + batchEditApi: ASPxClientVerticalGridBatchEditApi; + /** + * Occurs when a custom command button has been clicked. + */ + CustomButtonClick: ASPxClientEvent>; + /** + * Fires after the selection has been changed. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Occurs when a grid switches to batch edit mode. + */ + BatchEditStartEditing: ASPxClientEvent>; + /** + * Occurs when a grid leaves the batch edit mode. + */ + BatchEditEndEditing: ASPxClientEvent>; + /** + * Enables you to prevent a batch edit confirmation message from being displayed. + */ + BatchEditConfirmShowing: ASPxClientEvent>; + /** + * Enables you to provide navigation for editors contained in a templated cell in Batch Edit mode. + */ + BatchEditTemplateCellFocused: ASPxClientEvent>; + /** + * Occurs on the client side before data changes are saved in batch edit mode. + */ + BatchEditChangesSaving: ASPxClientEvent>; + /** + * Occurs on the client side before data changes are canceled in batch edit mode. + */ + BatchEditChangesCanceling: ASPxClientEvent>; + /** + * Occurs on the client side before a record is inserted in batch edit mode. + */ + BatchEditRecordInserting: ASPxClientEvent>; + /** + * Occurs on the client side before a record is deleted in batch edit mode. + */ + BatchEditRecordDeleting: ASPxClientEvent>; + /** + * Enables you to specify whether record data is valid and provide an error text. + */ + BatchEditRecordValidating: ASPxClientEvent>; + /** + * Enables you to prevent rows from being sorted. + */ + RowSorting: ASPxClientEvent>; + /** + * Fires on the client side before the expansion state of a row is changed by end-user interaction. + */ + RowExpandedChanging: ASPxClientEvent>; + /** + * Fires on the client side after a row's expansion state has been changed by end-user interaction. + */ + RowExpandedChanged: ASPxClientEvent>; + /** + * Fires on the client when a record is clicked. + */ + RecordClick: ASPxClientEvent>; + /** + * Fires on the client when a record is double clicked. + */ + RecordDblClick: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any unhandled server error occurs during server-side processing of a callback sent by the ASPxClientVerticalGrid. + */ + CallbackError: ASPxClientEvent>; + /** + * Sorts data by the specified data row's values. + * @param row An ASPxClientVerticalGridRow object that represents the data row. + */ + SortBy(row: ASPxClientVerticalGridRow): void; + /** + * Sorts data by the specified data row's values. + * @param rowIndex An integer value that specifies the row's position within the row collection. + */ + SortBy(rowIndex: number): void; + /** + * Sorts data by the specified data row's values. + * @param rowFieldNameOrId A string value that specifies the row's field name or unique identifier (the row's Name property value). + */ + SortBy(rowFieldNameOrId: string): void; + /** + * Sorts data by the specified data row's values. + * @param row An ASPxClientVerticalGridRow object that represents the data row. + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(row: ASPxClientVerticalGridRow, sortOrder: string): void; + /** + * Sorts data by the specified data row's values. + * @param rowIndex An integer value that specifies the row's position within the row collection. + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(rowIndex: number, sortOrder: string): void; + /** + * Sorts data by the specified data row's values. + * @param rowFieldNameOrId A string value that specifies the row's field name or unique identifier (the row's Name property value). + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + */ + SortBy(rowFieldNameOrId: string, sortOrder: string): void; + /** + * Sorts data by the specified data row's values. + * @param row An ASPxClientVerticalGridRow object that represents the data row. + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(row: ASPxClientVerticalGridRow, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data row's values. + * @param rowIndex An integer value that specifies the row's position within the row collection. + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true, to clear any previous sorting; otherwise, false. + */ + SortBy(rowIndex: number, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data row's values. + * @param rowFieldNameOrId A string value that specifies the row's field name or unique identifier (the row's Name property value). + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(rowFieldNameOrId: string, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data row's values, and places the row to the specified position among the sorted rows. + * @param row An ASPxClientGridViewColumn object that represents the data column. + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex An integer value that specifies the zero-based row's index among the sorted rows. -1 if data is not sorted by this row. + */ + SortBy(row: ASPxClientVerticalGridRow, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Sorts data by the specified data row's values, and places the row to the specified position among the sorted rows. + * @param rowIndex An integer value that specifies the row's position within the row collection. + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex + */ + SortBy(rowIndex: number, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Sorts data by the specified data row's values, and places the row to the specified position among the sorted rows. + * @param rowFieldNameOrId A string value that specifies the column's field name or unique identifier (the column's Name property value). + * @param sortOrder A string value that specifies the row's sort order ('ASC', 'DSC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + * @param sortIndex An integer value that specifies the zero-based row's index among the sorted rows. -1 if data is not sorted by this row. + */ + SortBy(rowFieldNameOrId: string, sortOrder: string, reset: boolean, sortIndex: number): void; + /** + * Returns the key value of the specified data row (record in the vertical grid). + * @param visibleIndex An integer value that specifies the record's visible index. + */ + GetRecordKey(visibleIndex: number): string; + /** + * Adds a new record. + */ + AddNewRecord(): void; + /** + * Deletes the specified record. + * @param visibleIndex An integer value that identifies the record. + */ + DeleteRecord(visibleIndex: number): void; + /** + * Deletes a record with the specified key value. + * @param key An object that uniquely identifies the record. + */ + DeleteRecordByKey(key: Object): void; + /** + * Selects all the unselected records within the grid. + */ + SelectRecords(): void; + /** + * Selects the specified record displayed within the grid. + * @param visibleIndex A zero-based integer value that specifies the record's visible index. + */ + SelectRecords(visibleIndex: number): void; + /** + * Selects the specified rercords within the grid. + * @param visibleIndices An array of zero-based indices that identify records within the grid. + */ + SelectRecords(visibleIndices: number[]): void; + /** + * Selects or deselects the specified records within the grid. + * @param visibleIndices An array of zero-based indices that identify records within the grid. + * @param selected true to select the specified records; false to deselect the records. + */ + SelectRecords(visibleIndices: number[], selected: boolean): void; + /** + * Selects or deselects the specified record within the grid. + * @param visibleIndex An integer zero-based index that identifies the record within the grid. + * @param selected true to select the specified record; false to deselect the record. + */ + SelectRecords(visibleIndex: number, selected?: boolean): void; + /** + * Selects or deselects the specified records displayed within the grid. + * @param keys An array of objects that uniquely identify the records. + * @param selected true to select the specified records; false to deselect the records. + */ + SelectRecordsByKey(keys: Object[], selected?: boolean): void; + /** + * Selects or deselects the specified record displayed within the grid. + * @param key An object that uniquely identifies the record. + * @param selected true to select the specified record; false to deselect the record. + */ + SelectRecordsByKey(key: Object, selected?: boolean): void; + /** + * Selects the specified records displayed within the grid. + * @param keys An array of objects that uniquely identify the records. + */ + SelectRecordsByKey(keys: Object[]): void; + /** + * Selects a grid record by its key. + * @param key An object that uniquely identifies the record. + */ + SelectRecordsByKey(key: Object): void; + /** + * Deselects all the selected records within the grid. + */ + UnselectRecords(): void; + /** + * Deselects the specified records (if selected) within the grid. + * @param visibleIndices An array of zero-based indices that identify records within the grid. + */ + UnselectRecords(visibleIndices: number[]): void; + /** + * Deselects the specified record (if selected) within the grid. + * @param visibleIndex A zero-based integer value that specifies the record's visible index. + */ + UnselectRecords(visibleIndex: number): void; + /** + * Deselects the specified records displayed within the grid. + * @param keys An array of objects that uniquely identify the records. + */ + UnselectRecordsByKey(keys: Object[]): void; + /** + * Deselects the specified record displayed within the grid. + * @param key An object that uniquely identifies the record. + */ + UnselectRecordsByKey(key: Object): void; + /** + * Deselects all grid records that match the filter criteria currently applied to the grid. + */ + UnselectFilteredRecords(): void; + /** + * Selects the specified record displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the record's visible index. + */ + SelectRecordOnPage(visibleIndex: number): void; + /** + * Selects or deselects the specified record displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the record's visible index. + * @param selected true to select the specified record; false to deselect the record. + */ + SelectRecordOnPage(visibleIndex: number, selected?: boolean): void; + /** + * Deselects the specified record (if selected) displayed on the current page. + * @param visibleIndex A zero-based integer value that specifies the record's visible index. + */ + UnselectRecordOnPage(visibleIndex: number): void; + /** + * Selects all unselected records displayed on the current page. + */ + SelectAllRecordsOnPage(): void; + /** + * Allows you to select or deselect all records displayed on the current page based on the parameter passed. + * @param selected true to select all unselected records displayed on the current page; false to deselect all selected records on the page. + */ + SelectAllRecordsOnPage(selected: boolean): void; + /** + * Deselects all selected records displayed on the current page. + */ + UnselectAllRecordsOnPage(): void; + /** + * Returns the number of selected records. + */ + GetSelectedRecordCount(): number; + /** + * Indicates whether or not the specified record is selected within the current page. + * @param visibleIndex An integer value that identifies the record by its visible index. + */ + IsRecordSelectedOnPage(visibleIndex: number): boolean; + /** + * Returns the values of the specified data source fields within the specified record. + * @param visibleIndex An integer value that identifies the record. + * @param fieldNames The names of data source fields separated using a semicolon, whose values within the specified record are returned. + * @param onCallback An ASPxClientVerticalGridValuesCallback object that represents the JavaScript function which receives the list of record values as a parameter. + */ + GetRecordValues(visibleIndex: number, fieldNames: string, onCallback: ASPxClientVerticalGridValuesCallback): void; + /** + * Returns the record values displayed within the current page. + * @param fieldNames The names of data source fields whose values are returned. + * @param onCallback A ASPxClientVerticalGridValuesCallback object that represents the JavaScript function which receives the list of record values as a parameter. + */ + GetPageRecordValues(fieldNames: string, onCallback: ASPxClientVerticalGridValuesCallback): void; + /** + * Returns the number of records actually displayed within the active page. + */ + GetVisibleRecordsOnPage(): number; + /** + * Returns the number of rows within the client vertical grid. + */ + GetRowCount(): number; + /** + * Applies the specified search panel filter criterion to grid data. + * @param value A string value that specifies the filter criterion. + */ + ApplySearchPanelFilter(value: string): void; + /** + * Applies the specified filter expression to the ASPxVerticalGrid. + * @param filterExpression A string value that specifies the filter expression. + */ + ApplyFilter(filterExpression: string): void; + /** + * Clears the filter expression applied to a client vertical grid. + */ + ClearFilter(): void; + /** + * Sets input focus to the grid. + */ + Focus(): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * + * @param args + * @param onSuccess + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; + /** + * Selects the specified page. + * @param pageIndex An integer value that specifies the active page's index. + */ + GotoPage(pageIndex: number): void; + /** + * Gets the index of the page currently being selected. + */ + GetPageIndex(): number; + /** + * Gets the number of pages to which the grid's data is divided. + */ + GetPageCount(): number; + /** + * Activates the next page. + */ + NextPage(): void; + /** + * Activates the previous page. + */ + PrevPage(): void; + /** + * Returns the index of the first record displayed within the vertical grid's active page. + */ + GetTopVisibleIndex(): number; + /** + * Saves all the changes made and switches the grid to browse mode. + */ + UpdateEdit(): void; + /** + * Cancels all the changes made and switches the ASPxVerticalGrid to browse mode. + */ + CancelEdit(): void; + /** + * Updates data displayed within the grid. + */ + Refresh(): void; + /** + * Returns the record values displayed within all selected records. + * @param fieldNames The names of data source fields separated by a semicolon, whose values within the selected records are returned. + * @param onCallback A ASPxClientVerticalGridValuesCallback object that represents the JavaScript function which receives the list of record values as a parameter. + */ + GetSelectedFieldValues(fieldNames: string, onCallback: ASPxClientVerticalGridValuesCallback): void; + /** + * Returns key values of selected records displayed within the current page. + */ + GetSelectedKeysOnPage(): Object[]; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event. + * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback A ASPxClientVerticalGridValuesCallback object that is the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(args: string, onCallback: ASPxClientVerticalGridValuesCallback): void; + /** + * Returns the editor used to edit the specified row's values. + * @param row An ASPxClientVerticalGridRowobject that specifies the required row within the client grid. + */ + GetEditor(row: ASPxClientVerticalGridRow): ASPxClientEdit; + /** + * Returns the editor used to edit the specified row's values. + * @param rowIndex An integer value that specifies the row's position within the rows collection. + */ + GetEditor(rowIndex: number): ASPxClientEdit; + /** + * Returns the editor used to edit the specified row's values. + * @param rowFieldNameOrId A string value that specifies the row's field name or unique identifier (the row's Name property value). + */ + GetEditor(rowFieldNameOrId: string): ASPxClientEdit; + /** + * Displays the Filter Control. + */ + ShowFilterControl(): void; + /** + * Hides the Filter Control. + */ + CloseFilterControl(): void; + /** + * Enables or disables the current filter. + * @param isFilterEnabled true to enable the current filter; otherwise, false. + */ + SetFilterEnabled(isFilterEnabled: boolean): void; + /** + * Returns the client row that resides at the specified position within the row collection. + * @param rowIndex A zero-based index that identifies the row within the row collection (the row's Index property value). + */ + GetRow(rowIndex: number): ASPxClientVerticalGridRow; + /** + * Returns the row with the specified unique identifier. + * @param rowId A string value that specifies the row's unique identifier (the row's Name property value). + */ + GetRowById(rowId: string): ASPxClientVerticalGridRow; + /** + * Returns the client row which is bound to the specified data source field. + * @param rowFieldName A string value that specifies the name of the data source field to which the row is bound (the row's fieldName property value). + */ + GetRowByField(rowFieldName: string): ASPxClientVerticalGridRow; + /** + * Returns the current vertical scroll position of the grid's content. + */ + GetVerticalScrollPosition(): number; + /** + * Returns the current horizontal scroll position of the grid's content. + */ + GetHorizontalScrollPosition(): number; + /** + * Specifies the vertical scroll position for the grid's content. + * @param position An integer value specifying the vertical scroll position. + */ + SetVerticalScrollPosition(position: number): void; + /** + * Specifies the horizontal scroll position for the grid's content. + * @param position An integer value specifying the horizontal scroll position. + */ + SetHorizontalScrollPosition(position: number): void; + /** + * Gets the value that specifies whether the required row is expanded. + * @param row An ASPxClientVerticalGridRowobject that specifies the row. + */ + GetRowExpanded(row: ASPxClientVerticalGridRow): boolean; + /** + * Gets the value that specifies whether the row with the specified index is expanded. + * @param rowIndex An integer value specifying the row's index. + */ + GetRowExpanded(rowIndex: number): boolean; + /** + * Gets the value that specifies whether the row with the specified field name or ID is expanded. + * @param rowFieldNameOrId A string value specifying the row's field name or ID. + */ + GetRowExpanded(rowFieldNameOrId: string): boolean; + /** + * Sets a value indicating whether the row is expanded. + * @param row An ASPxClientVerticalGridRowobject that specifies the required row within the client grid. + * @param value true, to expand the row; otherwise, false. + */ + SetRowExpanded(row: ASPxClientVerticalGridRow, value: boolean): void; + /** + * Sets a value indicating whether the row is expanded. + * @param rowIndex An integer value specifying the index of the row. + * @param value true, to expand the row; otherwise, false. + */ + SetRowExpanded(rowIndex: number, value: boolean): void; + /** + * Sets a value indicating whether the row is expanded. + * @param rowFieldNameOrId A string value that specifies the row's field name or unique identifier (the row's Name property value). + * @param value true, to expand the row; otherwise, false. + */ + SetRowExpanded(rowFieldNameOrId: string, value: boolean): void; +} +/** + * A client grid row. + */ +interface ASPxClientVerticalGridRow extends ASPxClientGridColumnBase { + /** + * Gets the name that uniquely identifies the row. + * Value: A string value assigned to the row's Name property. + */ + name: string; + /** + * Gets the row's position within the collection. + * Value: An integer zero-bazed index that specifies the row's position within the collection. + */ + index: number; + /** + * Gets the name of the database field assigned to the current row. + * Value: A string value that specifies the name of a data field. + */ + fieldName: string; + /** + * Gets whether the row is visible. + * Value: true, to display the row; otherwise, false. + */ + visible: boolean; +} +/** + * Represents a JavaScript function which receives the list of record values when the client GetSelectedFieldValues method is called. + */ +interface ASPxClientVerticalGridValuesCallback { + /** + * Represents a JavaScript function which receives the list of record values when the client GetSelectedFieldValues method is called. + * @param result An object that represents the list of record values received from the server. + */ + (result: Object): void; +} +/** + * A method that will handle the CustomButtonClick event. + */ +interface ASPxClientVerticalGridRowCancelEventHandler { + /** + * A method that will handle the cancelable events of a client ASPxVerticalGrid row. + * @param source The event source. + * @param e An ASPxClientVerticalGridRowCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridRowCancelEventArgs): void; +} +/** + * Provides data for the cancelable events of a client ASPxVerticalGrid row. + */ +interface ASPxClientVerticalGridRowCancelEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed client row. + * Value: An ASPxClientVerticalGridRow object that represents the processed row. + */ + row: ASPxClientVerticalGridRow; +} +/** + * A method that will handle the RecordClick event. + */ +interface ASPxClientVerticalGridRecordClickEventHandler { + /** + * A method that will handle the RecordClick event. + * @param source The event source. This parameter identifies the ASPxClientVerticalGrid object that raised the event. + * @param e An ASPxClientVerticalGridRecordClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridRecordClickEventArgs): void; +} +/** + * Provides data for the RecordClick event. + */ +interface ASPxClientVerticalGridRecordClickEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed record's visible index. + * Value: An integer zero-based index that identifies the processed record. + */ + visibleIndex: number; + /** + * Provides access to the parameters associated with the RecordClick event. + * Value: An object that contains parameters associated with the event. + */ + htmlEvent: Object; +} +/** + * A method that will handle the CustomButtonClick event. + */ +interface ASPxClientVerticalGridCustomButtonEventHandler { + /** + * A method that will handle the CustomButtonClick event. + * @param source The event source. This parameter identifies the ASPxClientVerticalGrid object that raised the event. + * @param e An ASPxClientVerticalGridCustomButtonEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridCustomButtonEventArgs): void; +} +/** + * Provides data for the CustomButtonClick event. + */ +interface ASPxClientVerticalGridCustomButtonEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the value which identifies the record whose custom button has been clicked. + * Value: An integer value that identifies the record whose custom button has been clicked. + */ + visibleIndex: number; + /** + * Gets the value which identifies the custom button. + * Value: A string value that identifies the clicked custom button. + */ + buttonID: string; +} +/** + * A method that will handle the SelectionChanged event. + */ +interface ASPxClientVerticalGridSelectionEventHandler { + /** + * A method that will handle the SelectionChanged event. + * @param source The event source. + * @param e An ASPxClientVerticalGridSelectionEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridSelectionEventArgs): void; +} +/** + * Provides data for the SelectionChanged event. + */ +interface ASPxClientVerticalGridSelectionEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the visible index of the record whose selected state has been changed. + * Value: An value that specifies the visible index of the record. + */ + visibleIndex: number; + /** + * Gets whether the record has been selected. + * Value: true, if the record has been selected; otherwise, false. + */ + isSelected: boolean; + /** + * Gets whether all records displayed within a page have been selected or unselected. + * Value: true if all records displayed within a page have been selected or unselected; otherwise, false. + */ + isAllRecordsOnPage: boolean; + /** + * Gets whether a selection has been changed on the server. + * Value: true if a selection has been changed on the server; otherwise, false. + */ + isChangedOnServer: boolean; +} +/** + * A method that will handle the RowExpandedChanged event. + */ +interface ASPxClientVerticalGridRowExpandedEventHandler { + /** + * A method that will handle the RowExpandedChanged event. + * @param source The event source. + * @param e An ASPxClientVerticalGridRowExpandedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridRowExpandedEventArgs): void; +} +/** + * Provides data for the RowExpandedChanged event. + */ +interface ASPxClientVerticalGridRowExpandedEventArgs extends ASPxClientEventArgs { + /** + * Gets the expanded row. + * Value: An ASPxClientVerticalGridRow object that represents the expanded row. + */ + row: ASPxClientVerticalGridRow; +} +/** + * A method that will handle the RowExpandedChanging event. + */ +interface ASPxClientVerticalGridRowExpandingEventHandler { + /** + * A method that will handle the RowExpandedChanging event. + * @param source The event source. + * @param e An ASPxClientVerticalGridRowExpandedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridRowExpandingEventArgs): void; +} +/** + * Provides data for the RowExpandedChanging event. + */ +interface ASPxClientVerticalGridRowExpandingEventArgs extends ASPxClientVerticalGridRowExpandedEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true, if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * Represents an object that will handle the client-side BatchEditStartEditing event. + */ +interface ASPxClientVerticalGridBatchEditStartEditingEventHandler { + /** + * A method that will handle the BatchEditStartEditing event. + * @param source The event source. + * @param e An ASPxClientVerticalGridBatchEditStartEditingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditStartEditingEventArgs): void; +} +/** + * Provides data for the BatchEditStartEditing event. + */ +interface ASPxClientVerticalGridBatchEditStartEditingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the visible index of the record whose cells are about to be edited. + * Value: An value that specifies the visible index of the record. + */ + visibleIndex: number; + /** + * Gets the grid row that owns a cell that is about to be edited. + * Value: An object that is the focused grid row. + */ + focusedRow: ASPxClientVerticalGridRow; + /** + * Gets a hashtable that maintains information about editable cells. + * Value: A hashtable that stores information about editable cells. + */ + recordValues: Object; +} +/** + * Represents an object that will handle the client-side BatchEditEndEditing event. + */ +interface ASPxClientVerticalGridBatchEditEndEditingEventHandler { + /** + * A method that will handle the BatchEditEndEditing event. + * @param source The event source. + * @param e An ASPxClientVerticalGridBatchEditEndEditingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditEndEditingEventArgs): void; +} +/** + * Provides data for the BatchEditEndEditing event. + */ +interface ASPxClientVerticalGridBatchEditEndEditingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the visible index of the record whose cells have been edited. + * Value: An value that specifies the visible index of the record. + */ + visibleIndex: number; + /** + * Gets a hashtable that maintains information about editable cells. + * Value: Gets a hashtable that maintains information about editable cells. + */ + recordValues: Object; +} +/** + * Represents an object that will handle the client-side BatchEditRecordValidating event. + */ +interface ASPxClientVerticalGridBatchEditRecordValidatingEventHandler { + /** + * A method that will handle the BatchEditRecordValidating event. + * @param source The event source. + * @param e An ASPxClientVerticalGridBatchEditRecordValidatingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditRecordValidatingEventArgs): void; +} +/** + * Provides data for the BatchEditRecordValidating event. + */ +interface ASPxClientVerticalGridBatchEditRecordValidatingEventArgs extends ASPxClientEventArgs { + /** + * Gets the processed record's visible index. + * Value: An integer value that specifies the processed record's visible index. + */ + visibleIndex: number; + /** + * Provides validation information on the record currently being validated. + * Value: An object that is a hashtable containing validation information. + */ + validationInfo: Object; +} +/** + * Represents an object that will handle the client-side BatchEditConfirmShowing event. + */ +interface ASPxClientVerticalGridBatchEditConfirmShowingEventHandler { + /** + * A method that will handle the BatchEditConfirmShowing client event. + * @param source The event source. + * @param e An ASPxClientVerticalGridBatchEditConfirmShowingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditConfirmShowingEventArgs): void; +} +/** + * Provides data for the BatchEditConfirmShowing event. + */ +interface ASPxClientVerticalGridBatchEditConfirmShowingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the client identifier of an object that initiates a send request. + * Value: A string value that specifies the object client identifier. + */ + requestTriggerID: string; +} +/** + * Represents an object that will handle the client-side BatchEditTemplateCellFocused event. + */ +interface ASPxClientVerticalGridBatchEditTemplateCellFocusedEventHandler { + /** + * A method that will handle the BatchEditTemplateCellFocused event. + * @param source An object representing the event source. Identifies the button editor that raised the event. + * @param e An ASPxClientVerticalGridBatchEditTemplateCellFocusedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditTemplateCellFocusedEventArgs): void; +} +/** + * Provides data for the BatchEditTemplateCellFocused event. + */ +interface ASPxClientVerticalGridBatchEditTemplateCellFocusedEventArgs extends ASPxClientEventArgs { + /** + * Gets the currently processed row. + * Value: A object that is the client-side row object. + */ + row: ASPxClientVerticalGridRow; + /** + * Gets or sets a value specifying whether the event was handled. + * Value: true if the event was handled and default processing should not occur; false if the event should be handled using default processing. + */ + handled: boolean; +} +/** + * Represents an object that will handle the client-side BatchEditChangesSaving event. + */ +interface ASPxClientVerticalGridBatchEditChangesSavingEventHandler { + /** + * A method that will handle the BatchEditChangesSaving event. + * @param source The event source. This parameter identifies the vertical grid object which raised the event. + * @param e An ASPxClientVerticalGridBatchEditChangesSavingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditChangesSavingEventArgs): void; +} +/** + * Provides data for the BatchEditChangesSaving event. + */ +interface ASPxClientVerticalGridBatchEditChangesSavingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets a hashtable that maintains information about inserted cells. + * Value: A hashtable that stores information about inserted cells. + */ + insertedValues: Object; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + deletedValues: Object; + /** + * Gets a hashtable that maintains information about updated cells. + * Value: A hashtable that stores information about updated cells. + */ + updatedValues: Object; +} +/** + * Represents an object that will handle the client-side BatchEditChangesCanceling event. + */ +interface ASPxClientVerticalGridBatchEditChangesCancelingEventHandler { + /** + * A method that will handle the BatchEditChangesCanceling event. + * @param source The event source. This parameter identifies the vertical grid object which raised the event. + * @param e An ASPxClientVerticalGridBatchEditChangesCancelingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditChangesCancelingEventArgs): void; +} +/** + * Provides data for the BatchEditChangesCanceling event. + */ +interface ASPxClientVerticalGridBatchEditChangesCancelingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets a hashtable that maintains information about inserted cells. + * Value: A hashtable that stores information about inserted cells. + */ + insertedValues: Object; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + deletedValues: Object; + /** + * Gets a hashtable that maintains information about updated cells. + * Value: A hashtable that stores information about updated cells. + */ + updatedValues: Object; +} +/** + * Represents an object that will handle the client-side BatchEditRecordInserting event. + */ +interface ASPxClientVerticalGridBatchEditRecordInsertingEventHandler { + /** + * A method that will handle the BatchEditRecordInserting event. + * @param source The event source. This parameter identifies the vertical grid object which raised the event. + * @param e An ASPxClientVerticalGridBatchEditRecordInsertingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditRecordInsertingEventArgs): void; +} +/** + * Provides data for the BatchEditRecordInserting event. + */ +interface ASPxClientVerticalGridBatchEditRecordInsertingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed record's visible index. + * Value: An integer value that specifies the processed record's visible index. + */ + visibleIndex: number; +} +/** + * Represents an object that will handle the client-side BatchEditRecordDeleting event. + */ +interface ASPxClientVerticalGridBatchEditRecordDeletingEventHandler { + /** + * A method that will handle the BatchEditRecordDeleting event. + * @param source The event source. This parameter identifies the vertical grid object which raised the event. + * @param e An ASPxClientVerticalGridBatchEditRecordDeletingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientVerticalGridBatchEditRecordDeletingEventArgs): void; +} +/** + * Provides data for the BatchEditRecordDeleting event. + */ +interface ASPxClientVerticalGridBatchEditRecordDeletingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed record's visible index. + * Value: An integer value that specifies the processed record's visible index. + */ + visibleIndex: number; + /** + * Gets a hashtable that maintains information about deleted cells. + * Value: A hashtable that stores information about deleted cells. + */ + recordValues: Object; +} +/** + * Contains information on a cell that is being edited. + */ +interface ASPxClientVerticalGridCellInfo { + /** + * Gets the row that contains the cell currently being processed. + * Value: An object that is the row which contains the processed cell. + */ + row: ASPxClientVerticalGridRow; + /** + * Gets the visible index of the record that contains the cell currently being processed. + * Value: An value that specifies the visible index of the record. + */ + recordVisibleIndex: number; +} +/** + * Provides members related to Batch Edit Mode + */ +interface ASPxClientVerticalGridBatchEditApi { + /** + * 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(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. + */ + ValidateRecord(visibleIndex: number): boolean; + /** + * Returns an array of record visible indices. + * @param includeDeleted true, to include visible indices of deleted records to the returned array; otherwise, false. + */ + GetRecordVisibleIndices(includeDeleted: boolean): number[]; + /** + * Returns an array of the deleted record visible indices. + */ + GetDeletedRecordIndices(): number[]; + /** + * Returns an array of the inserted record visible indices. + */ + GetInsertedRecordIndices(): number[]; + /** + * Indicates if the record with the specified visible index is deleted. + * @param visibleIndex An integer value that identifies the record by its visible index. + */ + IsDeletedRecord(visibleIndex: number): boolean; + /** + * Indicates if the record with specified visible index is newly created. + * @param visibleIndex An integer value that identifies the record by its visible index. + */ + IsNewRecord(visibleIndex: number): boolean; + /** + * Programmatically moves the focus to the previous cell in the record. + */ + MoveFocusBackward(): boolean; + /** + * Programmatically moves the focus to the next cell in the record. + */ + MoveFocusForward(): boolean; + /** + * Sets a value of the specified cell. + * @param visibleIndex An integer zero-based index that identifies the record containing the processed cell. + * @param rowFieldNameOrId A string value that specifies the field name or unique identifier (the row's Name property value) of a row containing the processed cell. + * @param value An object that contains the new cell value. + */ + SetCellValue(visibleIndex: number, rowFieldNameOrId: string, value: Object): void; + /** + * Sets the value of the specified cell. + * @param visibleIndex An integer zero-based index that identifies the row containing the processed cell. + * @param rowFieldNameOrId A string value that specifies the field name or unique identifier (the column's Name property value) of a column containing the processed cell. + * @param value An object that contains the new cell value. + * @param displayText A string value that specifies the cell display text. + * @param cancelCellHighlighting true to cancel highlighting of the modified cell, false to highlight the modified cell. + */ + SetCellValue(visibleIndex: number, rowFieldNameOrId: string, value: Object, displayText: string, cancelCellHighlighting?: boolean): void; + /** + * Gets the value of the specified cell. + * @param visibleIndex A zero-based integer value that specifies a visible index of a record containing the processed cell. + * @param rowFieldNameOrId A string value that specifies the field name or unique identifier (the row's Name property value) of a row containing the processed cell. + * @param initial true, to return the initial (server) value; false, to return a value currently contained on the client side (modified value). + */ + GetCellValue(visibleIndex: number, rowFieldNameOrId: string, initial?: boolean): Object; + /** + * Gets information about the cell currently being edited. + */ + GetEditCellInfo(): ASPxClientVerticalGridCellInfo; + /** + * Returns a value that indicates whether the vertical grid has changed data. + */ + HasChanges(): boolean; + /** + * Returns a value that indicates whether the specified record has changed data. + * @param visibleIndex An integer value that specifies the visible index of a record. + */ + HasChanges(visibleIndex: number): boolean; + /** + * Returns a value that indicates whether the specified data cell's data has been changed. + * @param visibleIndex An integer value that specifies the visible index of a record. + * @param rowFieldNameOrId A string value that identifies the row by the name of the data source field to which the row is bound, or by the row's name. + */ + HasChanges(visibleIndex: number, rowFieldNameOrId: string): boolean; + /** + * Resets changes in the specified record. + * @param visibleIndex An integer value that specifies the visible index of a record. + */ + ResetChanges(visibleIndex: number): void; + /** + * Resets changes in the specified cell. + * @param visibleIndex An integer value that specifies the visible index of a record containing the processed cell. + * @param rowIndex A string value that specifies the field name or unique identifier (the row's Name property value) of a row containing the processed cell. + */ + ResetChanges(visibleIndex: number, rowIndex: number): void; + /** + * Switches the specified cell to batch edit mode. + * @param visibleIndex A zero-based integer value that specifies the visible index of a record containing the processed cell. + * @param rowIndex A zero-based integer value that identifies the row which contains the processed cell in the rows collection. + */ + StartEdit(visibleIndex: number, rowIndex: number): void; + /** + * Ends the cell(s) editing. + */ + EndEdit(): void; +} +/** + * Contains style settings related to media elements in ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorCommandStyleSettings { + /** + * Gets or sets a media element's CSS class name. + * Value: A string that specifies a class name. + */ + className: string; + /** + * Gets or sets an element's width. + * Value: A string that specifies an element's width in any correct format. + */ + width: string; + /** + * Gets or sets an element's height. + * Value: A string that specifies an element's height in any correct format. + */ + height: string; + /** + * Gets or sets a media element's border width. + * Value: A string that specifies a border width in any correct format. + */ + borderWidth: string; + /** + * Gets or sets a media element's border color. + * Value: A string that specifies a border color in any correct format. + */ + borderColor: string; + /** + * Gets or sets a media element's border style. + * Value: A string that specifies a border style in any correct format. + */ + borderStyle: string; + /** + * Gets or sets an element's top margin. + * Value: A string that specifies an element's top margin in any correct format. + */ + marginTop: string; + /** + * Gets or sets an element's right margin. + * Value: A string that specifies an element's right margin in any correct format. + */ + marginRight: string; + /** + * Gets or sets an element's bottom margin. + * Value: A string that specifies an element's bottom margin in any correct format. + */ + marginBottom: string; + /** + * Gets or sets an element's left margin. + * Value: A string that specifies an element's left margin in any correct format. + */ + marginLeft: string; + backgroundColor: string; + textAlign: string; + verticalAlign: string; +} +/** + * The base class for parameters used in the ASPxHtmlEditor's client-side commands. + */ +interface ASPxClientHtmlEditorCommandArguments { + /** + * Gets the currently selected element in the ASPxHtmlEditor. + * Value: An HTML object which is the currently selected element. + */ + selectedElement: Object; +} +/** + * Contains settings related to the INSERTIMAGE_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorInsertImageCommandArguments extends ASPxClientHtmlEditorCommandArguments { + /** + * Specifies the source of the target image. + * Value: A string specifying the source of the target image. + */ + src: string; + /** + * Creates an alternate text for the target image. + * Value: A string that specifies an alternate text for the target image. + */ + alt: string; + /** + * Determines if the target image is wrapped with text. + * Value: true, if the target image is wrapped with text; otherwise, false. + */ + useFloat: boolean; + /** + * Determines the position of the target image. + * Value: A string value defining the position of the target image. + */ + align: string; + /** + * Contains the style settings specifying the appearance of the target image. + * Value: An object that contains the style settings specifying the appearance of the target image. + */ + styleSettings: ASPxClientHtmlEditorCommandStyleSettings; +} +/** + * Contains settings related to the CHANGEIMAGE_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorChangeImageCommandArguments extends ASPxClientHtmlEditorInsertImageCommandArguments { +} +/** + * Contains settings related to the INSERTLINK_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorInsertLinkCommandArguments extends ASPxClientHtmlEditorCommandArguments { + /** + * Specifies the url of the page the target link goes to. + * Value: A string value specifying the target link url. + */ + url: string; + /** + * Specifiies the text of the target link. + * Value: A string value specifying the text of the target link. + */ + text: string; + /** + * Determines where to open the target link. + * Value: A string that specifies where to open the target link in any correct format. + */ + target: string; + /** + * Defines the title of the target link. + * Value: A string value defining the title of the target link. + */ + title: string; + styleSettings: ASPxClientHtmlEditorCommandStyleSettings; +} +/** + * The base class for parameters related to inserting or changing media elements in the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorChangeMediaElementCommandArguments extends ASPxClientHtmlEditorCommandArguments { + /** + * Defines the HTML "id" attribute of the target media element. + * Value: A string value which is a unique identifier for the element. + */ + id: string; + /** + * Defines the source of the target media element. + * Value: A string defining the source of the target media element. + */ + src: string; + /** + * Determines the position of the target media element. + * Value: A string value indicating the position of the target media element. + */ + align: string; + /** + * Contains the style settings defining the appearance of the target media element. + * Value: An object that contains the style settings defining the appearance of the target media element. + */ + styleSettings: ASPxClientHtmlEditorCommandStyleSettings; + /** + * Returns the name of the client-side command corresponding to the parameter. + */ + GetCommandName(): string; +} +/** + * The base class for parameters related to inserting or changing HTML5 media elements (Audio and Video) in the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorChangeHtml5MediaElementCommandArguments extends ASPxClientHtmlEditorChangeMediaElementCommandArguments { + /** + * Determines if a media file will start playing automatically. + * Value: true, if autoplay is enabled; otherwise, false. + */ + autoPlay: boolean; + /** + * Determines if a media file repeats indefinitely, or stops when it reaches the last frame. + * Value: true, to loop playback; otherwise, false. + */ + loop: boolean; + /** + * Determines if the media player controls should be displayed. + * Value: true, if media player controls are displayed; otherwise, false. + */ + showPlayerControls: boolean; + /** + * Determines how a media file should be loaded when the page loads. + * Value: One of the ASPxClientHtmlEditorMediaPreloadMode enumeration values. + */ + preloadMode: string; +} +/** + * Contains settings related to the INSERTAUDIO_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorInsertAudioCommandArguments extends ASPxClientHtmlEditorChangeHtml5MediaElementCommandArguments { +} +/** + * Contains settings related to the CHANGEAUDIO_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorChangeAudioCommandArguments extends ASPxClientHtmlEditorInsertAudioCommandArguments { +} +/** + * Contains settings related to the INSERTVIDEO_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorInsertVideoCommandArguments extends ASPxClientHtmlEditorChangeHtml5MediaElementCommandArguments { + /** + * Defines the URL of an image that is shown while the video file is downloading, or until an end-user clicks the play button. + * Value: A string value that specifies the poster image URL. + */ + posterUrl: string; +} +/** + * Contains settings related to the CHANGEVIDEO_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorChangeVideoCommandArguments extends ASPxClientHtmlEditorInsertVideoCommandArguments { +} +/** + * Contains settings related to the INSERTFLASH_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorInsertFlashCommandArguments extends ASPxClientHtmlEditorChangeMediaElementCommandArguments { + /** + * Determines if the target flash element will start playing automatically. + * Value: true, if autoplay is enabled; otherwise, false. + */ + autoPlay: boolean; + /** + * Defines if the target flash element repeats indefinitely, or stops when it reaches the last frame. + * Value: true, to loop playback; otherwise, false. + */ + loop: boolean; + /** + * Determines if the flash related items are displayed in the context menu of the target flash element. + * Value: true, if the specific context menu items are displayed; otherwise, false + */ + enableFlashMenu: boolean; + /** + * Determines if the target flash element can be displayed in the fullscreen mode. + * Value: true, if the fullscreen mode is allowed; otherwise, false. + */ + allowFullscreen: boolean; + /** + * Defines the rendering quality level used for the target flash element. + * Value: A string value that specifies the target flash element rendering quality. + */ + quality: string; +} +/** + * Contains settings related to the CHANGEFLASH_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorChangeFlashCommandArguments extends ASPxClientHtmlEditorInsertFlashCommandArguments { +} +/** + * Contains settings related to the INSERTYOUTUBEVIDEO_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorInsertYouTubeVideoCommandArguments extends ASPxClientHtmlEditorChangeMediaElementCommandArguments { + /** + * Determines if suggested videos are shown after the target YouTube video finishes. + * Value: true, to show suggested videos; otherwise, false + */ + showRelatedVideos: boolean; + /** + * Determines if the target YouTube video title and player actions (Watch later, Share) are shown. + * Value: true, to display the title and player actions; otherwise, false. + */ + showVideoInfo: boolean; + /** + * Determines if the privacy-enhanced mode is enabled for the target YouTube video. + * Value: true, if the privace-enhanced mode is enabled; otherwise, false + */ + enablePrivacyEnhancedMode: boolean; + /** + * Determines if the player controls are displayed for the target YouTube video. + * Value: true, if the player controls are displayed; otherwise, false. + */ + showPlayerControls: boolean; +} +/** + * Contains settings related to the CHANGEYOUTUBEVIDEO_COMMAND command parameter. + */ +interface ASPxClientHtmlEditorChangeYouTubeVideoCommandArguments extends ASPxClientHtmlEditorInsertYouTubeVideoCommandArguments { +} +interface ASPxClientHtmlEditorTablePropertiesCommandArguments extends ASPxClientHtmlEditorCommandArguments { + styleSettings: ASPxClientHtmlEditorCommandStyleSettings; + align: string; + cellPadding: number; + cellSpacing: number; + caption: string; + headers: string; + summary: string; +} +interface ASPxClientHtmlEditorInsertTableCommandArguments extends ASPxClientHtmlEditorTablePropertiesCommandArguments { + columns: number; + rows: number; + isEqualColumnWidth: boolean; +} +interface ASPxClientHtmlEditorTableCellPropertiesCommandArguments extends ASPxClientHtmlEditorCommandArguments { + styleSettings: ASPxClientHtmlEditorCommandStyleSettings; + applyForAll: boolean; +} +interface ASPxClientHtmlEditorTableRowPropertiesCommandArguments extends ASPxClientHtmlEditorCommandArguments { + styleSettings: ASPxClientHtmlEditorCommandStyleSettings; +} +interface ASPxClientHtmlEditorTableColumnPropertiesCommandArguments extends ASPxClientHtmlEditorCommandArguments { + styleSettings: ASPxClientHtmlEditorCommandStyleSettings; +} +/** + * A method that will handle the DialogInitialized client event. + */ +interface ASPxClientHtmlEditorDialogInitializedEventHandler { + /** + * A method that will handle the client DialogInitialized event. + * @param source An object representing the event's source. + * @param e An ASPxClientHtmlEditorDialogInitializedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorDialogInitializedEventArgs): void; +} +/** + * Provides data for the DialogInitialized client event. + */ +interface ASPxClientHtmlEditorDialogInitializedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the dialog that has been initialized. + * Value: A string value that is the name of the initialized dialog. + */ + dialogName: string; +} +/** + * A method that will handle the CommandExecuting event. + */ +interface ASPxClientHtmlEditorCommandExecutingEventHandler { + /** + * A method that will handle the client CommandExecuted event. + * @param source The event's source. + * @param e An ASPxClientHtmlEditorCommandExecutingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorCommandExecutingEventArgs): void; +} +/** + * Provides data for the CommandExecuting event. + */ +interface ASPxClientHtmlEditorCommandExecutingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value specifying the processed command's name. + */ + commandName: string; + /** + * Gets an optional parameter that complements the processed command. + * Value: An object containing additional information about the processed command. + */ + parameter: Object; +} +/** + * A method that will handle the client events related to command processing. + */ +interface ASPxClientHtmlEditorCommandEventHandler { + /** + * A method that will handle the corresponding client event. + * @param source The event source. This parameter identifies the editor which raised the event. + * @param e An ASPxClientHtmlEditorCommandEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorCommandEventArgs): void; +} +/** + * Provides data for client events that relate to command processing (CustomCommand). + */ +interface ASPxClientHtmlEditorCommandEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value representing the processed command's name. + */ + commandName: string; + /** + * Gets an optional parameter that complements the processed command. + * Value: A string value containing additional information about the processed command. + */ + parameter: Object; +} +/** + * A method that will handle the client events that relate to custom dialog operations. + */ +interface ASPxClientHtmlEditorCustomDialogEventHandler { + /** + * A method that will handle the client CustomDialogOpened event. + * @param source An object representing the event's source. + * @param e An ASPxClientHtmlEditorCustomDialogEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorCustomDialogEventArgs): void; +} +/** + * Provides data for client events that relate to custom dialog operations. + */ +interface ASPxClientHtmlEditorCustomDialogEventArgs extends ASPxClientEventArgs { + /** + * Gets the name that uniquely identifies the processed custom dialog. + * Value: A string value that represents the value assigned to the processed custom dialog's Name property. + */ + name: string; +} +/** + * Provides data for client events that relate to closing a custom dialog. + */ +interface ASPxClientHtmlEditorCustomDialogCloseEventArgsBase extends ASPxClientHtmlEditorCustomDialogEventArgs { + /** + * Gets the status of the closed custom dialog. + * Value: An object representing a custom dialog's closing status. By default, it's the "cancel" string if the dialog operation is canceled, or the "ok" string if a dialog is closed by submitting a file. You can also provide your custom status, if your dialog contains additional buttons. + */ + status: Object; +} +/** + * A method that will handle the CustomDialogClosing client event. + */ +interface ASPxClientHtmlEditorCustomDialogClosingEventHandler { + /** + * A method that will handle the client CustomDialogClosing event. + * @param source An object representing the event's source. + * @param e An ASPxClientHtmlEditorCustomDialogClosingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorCustomDialogClosingEventArgs): void; +} +/** + * Provides data for the CustomDialogClosing client event. + */ +interface ASPxClientHtmlEditorCustomDialogClosingEventArgs extends ASPxClientHtmlEditorCustomDialogCloseEventArgsBase { + /** + * Gets or sets a value specifying whether the event was handled. + * Value: true if the event was handled and default processing should not occur; false if the event should be handled using default processing. + */ + handled: boolean; +} +/** + * A method that will handle the CustomDialogClosed client event. + */ +interface ASPxClientHtmlEditorCustomDialogClosedEventHandler { + /** + * A method that will handle the client CustomDialogClosed event. + * @param source An object representing the event's source. + * @param e An ASPxClientHtmlEditorCustomDialogClosedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorCustomDialogClosedEventArgs): void; +} +/** + * Provides data for the CustomDialogClosed client event. + */ +interface ASPxClientHtmlEditorCustomDialogClosedEventArgs extends ASPxClientHtmlEditorCustomDialogCloseEventArgsBase { + /** + * Gets an object associated with the closed dialog. + * Value: An object containing custom data associated with dialog closing. + */ + data: Object; +} +/** + * A method that will handle the Validation client event. + */ +interface ASPxClientHtmlEditorValidationEventHandler { + /** + * A method that will handle the client Validation event. + * @param source An object representing the event's source. + * @param e An ASPxClientHtmlEditorValidationEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorValidationEventArgs): void; +} +/** + * Provides data for the Validation client event. + */ +interface ASPxClientHtmlEditorValidationEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets the HTML markup that is the ASPxHtmlEditor's content. + * Value: A string value that specifies the HTML content to validate. + */ + html: string; + /** + * Gets or sets a value specifying whether the validated value is valid. + * Value: true if the validation has been completed successfully; otherwise, false. + */ + isValid: boolean; + /** + * Gets or sets the error text to be displayed within the editor's error frame if the editor's validation fails. + * Value: A string value specifying the error description. + */ + errorText: string; +} +/** + * A method that will handle the ActiveTabChanged event. + */ +interface ASPxClientHtmlEditorTabEventHandler { + /** + * A method that will handle the client ActiveTabChanged event. + * @param source The event's source. + * @param e An ASPxClientHtmlEditorTabEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorTabEventArgs): void; +} +/** + * Provides data for the ActiveTabChanged event that concerns manipulations on tabs. + */ +interface ASPxClientHtmlEditorTabEventArgs extends ASPxClientEventArgs { + /** + * Gets the name that uniquely identifies an editor tab. + * Value: A string value that is the tab name. + */ + name: string; +} +/** + * A method that will handle the ActiveTabChanging event. + */ +interface ASPxClientHtmlEditorTabCancelEventHandler { + /** + * A method that will handle the client ActiveTabChanging event. + * @param source The event's source. + * @param e An ASPxClientHtmlEditorTabCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorTabCancelEventArgs): void; +} +/** + * Provides data for the cancellable ActiveTabChanging event that concerns manipulations on tabs. + */ +interface ASPxClientHtmlEditorTabCancelEventArgs extends ASPxClientHtmlEditorTabEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event, should be canceled. + * Value: true, if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the BeforePaste event. + */ +interface ASPxClientHtmlEditorBeforePasteEventHandler { + /** + * A method that will handle the BeforePaste event. + * @param source The event source. This parameter identifies the HTML editor object that raised the event. + * @param e An ASPxClientHtmlEditorBeforePasteEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorBeforePasteEventArgs): void; +} +/** + * Provides data for the BeforePaste event. + */ +interface ASPxClientHtmlEditorBeforePasteEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value identifying the command's name. + */ + commandName: string; + /** + * Gets or sets the HTML markup that is about to be pasted to the ASPxHtmlEditor's content. + * Value: A string value that specifies the HTML content to paste. + */ + html: string; +} +/** + * Represents a client-side equivalent of the ASPxHtmlEditor control. + */ +interface ASPxClientHtmlEditor extends ASPxClientControl { + /** + * Occurs on the client side after a dialog has been initialized. + */ + DialogInitialized: ASPxClientEvent>; + /** + * Occurs before a default or custom command has been executed and allows you to cancel the action. + */ + CommandExecuting: ASPxClientEvent>; + /** + * Enables you to implement a custom command's logic. + */ + CustomCommand: ASPxClientEvent>; + /** + * Occurs after a default or custom command has been executed on the client side. + */ + CommandExecuted: ASPxClientEvent>; + /** + * Fires on the client side when the editor's Design View Area receives input focus. + */ + GotFocus: ASPxClientEvent>; + /** + * Fires on the client side when the editor's Design View Area loses input focus. + */ + LostFocus: ASPxClientEvent>; + /** + * Occurs on the client when a selection is changed within the ASPxHtmlEditor. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Occurs on the client side when the content of the editor changes. + */ + HtmlChanged: ASPxClientEvent>; + /** + * Occurs on the client side after a custom dialog is opened. + */ + CustomDialogOpened: ASPxClientEvent>; + /** + * Fires on the client side before a custom dialog is closed. + */ + CustomDialogClosing: ASPxClientEvent>; + /** + * Occurs on the client side after a custom dialog is closed. + */ + CustomDialogClosed: ASPxClientEvent>; + /** + * Allows you to specify whether the value entered into the ASPxHtmlEditor is valid. + */ + Validation: ASPxClientEvent>; + /** + * Occurs on the client side before a context menu is shown. + */ + ContextMenuShowing: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientHtmlEditor. + */ + CallbackError: ASPxClientEvent>; + /** + * Fires after a callback, sent by the CustomDataCallback event handler. + */ + CustomDataCallback: ASPxClientEvent>; + /** + * Occurs on the client side after the editor content is spell checked. + */ + SpellingChecked: ASPxClientEvent>; + /** + * Fires on the client side after the active tab has been changed within a control. + */ + ActiveTabChanged: ASPxClientEvent>; + /** + * Fires on the client side before the active tab is changed within a control. + */ + ActiveTabChanging: ASPxClientEvent>; + /** + * Occurs before an HTML code is pasted to editor content, and allows you to modify it. + */ + BeforePaste: ASPxClientEvent>; + /** + * Returns the document object generated by an iframe element within a design view area. + */ + GetDesignViewDocument(): Object; + /** + * Returns the document object generated by an iframe element within a preview area. + */ + GetPreviewDocument(): Object; + /** + * Returns a collection of client context menu objects. + */ + GetContextMenu(): ASPxClientPopupMenu; + /** + * Returns a value indicating whether an editor is enabled. + */ + GetEnabled(): boolean; + /** + * Specifies whether an editor is enabled. + * @param value true to enable the editor; false to disable it. + */ + SetEnabled(value: boolean): void; + /** + * Sets input focus to the ASPxHtmlEditor's edit region. + */ + Focus(): void; + /** + * Gets the HTML markup that represents the editor's content. + */ + GetHtml(): string; + /** + * Specifies the HTML markup that represents the editor's content. + * @param html A string value that specifies the HTML markup. + */ + SetHtml(html: string): void; + /** + * Sets the HTML markup that represents the editor's content. + * @param html A string value that specifies the HTML markup. + * @param clearUndoHistory true to clear the undo stack; otherwise, false. + */ + SetHtml(html: string, clearUndoHistory: boolean): void; + /** + * Replaces placeholders with the specified values. + * @param html A string value that specifies the HTML code to process. + * @param placeholders An array of objects that specify the placeholders and values to replace them. + */ + ReplacePlaceholders(html: string, placeholders: Object[]): string; + /** + * Creates a parameter for ASPxHtmlEditor's client-side commands related to changing media elements. + * @param element An element that is being changed. + */ + CreateChangeMediaElementCommandArguments(element: Object): ASPxClientHtmlEditorChangeMediaElementCommandArguments; + /** + * Executes the specified command. + * @param commandName A string value that specifies the command to perform. + * @param parameter A string value specifying additional information about the command to perform. + * @param addToUndoHistory true, to add the specified command to the undo stack; otherwise, false. + */ + ExecuteCommand(commandName: string, parameter: Object, addToUndoHistory: boolean): boolean; + /** + * Adds the current editor state to the undo/redo history. + */ + SaveToUndoHistory(): void; + /** + * Returns the selection in the ASPxHtmlEditor. + */ + GetSelection(): ASPxClientHtmlEditorSelection; + /** + * Restores the selection within the ASPxHtmlEditor. + */ + RestoreSelection(): boolean; + /** + * Sets the value of the combo box within the HtmlEditor on the client side. + * @param commandName A string value that identifies the combo box's command name within the HtmlEditor's control collection. + * @param value A string value that specifies the combo box's new value. + */ + SetToolbarComboBoxValue(commandName: string, value: string): void; + /** + * Sets the value of the dropdown item picker in the HtmlEditor on the client side. + * @param commandName A string value that identifies the dropdown item picker by its command name. This value is contained in the CommandName property. + * @param value A string value that specifies the dropdown item picker's new value, i.e., the ToolbarItemPickerItem object. + */ + SetToolbarDropDownItemPickerValue(commandName: string, value: string): void; + /** + * Specifies the visibility of a ribbon context tab category specified by its name. + * @param categoryName A Name property value of the required category. + * @param active true to make a category visible; false to make it hidden. + */ + SetRibbonContextTabCategoryVisible(categoryName: string, active: string): void; + /** + * Provides access to an object implementing the HtmlEditor's ribbon UI. + */ + GetRibbon(): ASPxClientRibbon; + /** + * Gets a value that indicates whether the editor's value passes validation. + */ + GetIsValid(): boolean; + /** + * Gets the error text to be displayed within the editor's error frame if the editor's validation fails. + */ + GetErrorText(): string; + /** + * Sets a value that specifies whether the editor's value passes validation. + * @param isValid true if the editor's value passes validation; otherwise, false. + */ + SetIsValid(isValid: boolean): void; + /** + * Sets the error text to be displayed within the editor's error frame if the editor's validation fails. + * @param errorText A string value representing the error text. + */ + SetErrorText(errorText: string): void; + /** + * Performs validation of the editor's content. + */ + Validate(): void; + /** + * Set an active tab specified by its name. + * @param name A string value that is the name of the tab. + */ + SetActiveTabByName(name: string): void; + /** + * Returns the name of the active HTML editor tab. + */ + GetActiveTabName(): string; + /** + * Reconnect the control to an external ribbon. + */ + ReconnectToExternalRibbon(): void; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback A ASPxClientDataCallback object that represents the JavaScript function which receives the callback data as a parameter. + */ + PerformDataCallback(parameter: string, onCallback: ASPxClientDataCallback): void; +} +/** + * A selection in the ASPxHtmlEditor. + */ +interface ASPxClientHtmlEditorSelection { + /** + * Returns a DOM element that relates to the current selection. + */ + GetSelectedElement(): Object; + /** + * Returns the HTML markup specifying the currently selected ASPxHtmlEditor content. + */ + GetHtml(): string; + /** + * Returns the text within the currently selected ASPxHtmlEditor content. + */ + GetText(): string; + /** + * Returns an array of the currently selected elements. + */ + GetElements(): Object[]; + /** + * Sets the new HTML markup in place of the currently selected within ASPxHtmlEditor content. + * @param html A string value specifying the new HTML markup. + * @param addToHistory true to add this operation to the history; otherwise, false. + */ + SetHtml(html: string, addToHistory: boolean): void; +} +/** + * The client-side equivalent of the ASPxPivotGrid control. + */ +interface ASPxClientPivotGrid extends ASPxClientControl { + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientPivotGrid. + */ + CallbackError: ASPxClientEvent>; + /** + * Fires after a callback that has been processed on the server returns back to the client. + */ + AfterCallback: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Fires before a callback is sent to the server for server-side processing. + */ + BeforeCallback: ASPxClientEvent>; + /** + * Fires on the client side after the customization form's visible state has been changed. + */ + CustomizationFieldsVisibleChanged: ASPxClientEvent>; + /** + * Occurs when a cell is clicked. + */ + CellClick: ASPxClientEvent>; + /** + * Occurs when a cell is double clicked. + */ + CellDblClick: ASPxClientEvent>; + /** + * Occurs when a custom menu item has been clicked. + */ + PopupMenuItemClick: ASPxClientEvent>; + /** + * Indicates whether the Defer Layout Update check box is enabled. + */ + IsDeferUpdatesChecked(): boolean; + /** + * Indicates whether the Filter Editor (Prefilter) is visible. + */ + IsPrefilterVisible(): boolean; + /** + * Shows the Filter Editor. + */ + ShowPrefilter(): void; + /** + * Hides the Filter Editor. + */ + HidePrefilter(): void; + /** + * Clears the filter expression applied using the Prefilter (Filter Editor). + */ + ClearPrefilter(): void; + /** + * Enables or disables the current filter applied by the Filter Editor (Prefilter). + */ + ChangePrefilterEnabled(): void; + /** + * Returns a value that specifies whether the customization form is visible. + */ + GetCustomizationFieldsVisibility(): boolean; + /** + * Specifies the visibility of the customization form. + * @param value true to display the customization form; false to hide the customization form. + */ + SetCustomizationFieldsVisibility(value: boolean): void; + /** + * Switches the customization form's visible state. + */ + ChangeCustomizationFieldsVisibility(): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; +} +/** + * A method that will handle the CellDblClick event. + */ +interface ASPxClientClickEventHandler { + /** + * A method that will handle the CellDblClick event. + * @param source The event source. + * @param e An ASPxClientClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientClickEventArgs): void; +} +/** + * Provides data for the CellDblClick client events. + */ +interface ASPxClientClickEventArgs extends ASPxClientEventArgs { + /** + * Provides access to the parameters associated with the CellDblClick events. + * Value: An object that contains parameters associated with the CellDblClick events. + */ + HtmlEvent: Object; + /** + * Gets the processed cell's value. + * Value: An object that represents the processed cell's value. + */ + Value: Object; + /** + * Gets the index of a column that owns the processed cell. + * Value: An integer value that identifies a column. + */ + ColumnIndex: number; + /** + * Gets the index of a row that owns the processed cell. + * Value: An integer value that identifies a row. + */ + RowIndex: number; + /** + * Gets a column field value. + * Value: An object that represents a column field value. + */ + ColumnValue: Object; + /** + * Gets a row field value. + * Value: An object that represents a row field value. + */ + RowValue: Object; + /** + * Gets a column field name. + * Value: A String value that represents a column field name. + */ + ColumnFieldName: string; + /** + * Gets a row field name. + * Value: A String value that represents a row field name. + */ + RowFieldName: string; + /** + * Gets a column value type. + * Value: A String value that represents a column value type. + */ + ColumnValueType: string; + /** + * Gets a row value type. + * Value: A String value that represents a row value type. + */ + RowValueType: string; + /** + * Gets the index of the data field which corresponds to the clicked summary value. + * Value: An integer value that identifies the data field. + */ + DataIndex: number; +} +/** + * A method that will handle the PopupMenuItemClick event. + */ +interface ASPxClientPivotMenuItemClickEventHandler { + /** + * A method that will handle the PopupMenuItemClick event. + * @param source The event source. + * @param e An ASPxClientPivotMenuItemClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientPivotMenuItemClickEventArgs): void; +} +/** + * Provides data for the PopupMenuItemClick event. + */ +interface ASPxClientPivotMenuItemClickEventArgs extends ASPxClientEventArgs { + /** + * Gets the context menu's type. + * Value: A PivotGridPopupMenuType enumeration value that identifies the context menu. + */ + MenuType: string; + /** + * Gets the name of the menu item currently being clicked. + * Value: A String value that identifies the clicked item by its name. + */ + MenuItemName: string; + /** + * Gets the field's unique indentifier. + * Value: A string which specifies the field's unique indentifier. + */ + FieldID: string; + /** + * Gets the index of the field value for which the popup menu has been invoked. + * Value: An integer value that identifies the field value. + */ + FieldValueIndex: number; +} +/** + * A client-side equivalent of the ASPxPivotCustomizationControl control. + */ +interface ASPxClientPivotCustomization extends ASPxClientControl { + /** + * Returns an HTML element that represents the root of the control's hierarchy. + */ + GetMainContainer(): Object; + /** + * Returns a client-side equivalent of the owner Pivot Grid Control. + */ + GetPivotGrid(): ASPxClientPivotGrid; + /** + * Specifies the Customization Control's height. + * @param value An integer value that specifies the Customization Control's height. + */ + SetHeight(value: number): void; + /** + * Specifies the Customization Control's width. + * @param value An integer value that specifies the Customization Control's width. + */ + SetWidth(value: number): void; + /** + * Recalculates the Customization Control height. + */ + UpdateHeight(): void; + /** + * Specifies the Customization Control's layout. + * @param layout A string that specifies the Customization Control's layout. + */ + SetLayout(layout: string): void; +} +/** + * A method that will handle the CustomCommandExecuted event. + */ +interface ASPxClientRichEditCustomCommandExecutedEventHandler { + /** + * A method that will handle the CustomCommandExecuted event. + * @param source An object representing the event source. Identifies the RichEdit that raised the event. + * @param e A ASPxClientRichEditCustomCommandExecutedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRichEditCustomCommandExecutedEventArgs): void; +} +/** + * Provides data for the CustomCommandExecuted event. + */ +interface ASPxClientRichEditCustomCommandExecutedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value representing the processed command's name. + */ + commandName: string; + /** + * Gets an optional parameter that complements the processed command. + * Value: A string value containing additional information about the processed command. + */ + parameter: Object; +} +/** + * A method that will handle the HyperlinkClick event. + */ +interface ASPxClientRichEditHyperlinkClickEventHandler { + /** + * A method that will handle the HyperlinkClick event. + * @param source The event source. + * @param e An ASPxClientRichEditHyperlinkClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRichEditHyperlinkClickEventArgs): void; +} +/** + * Provides data for the HyperlinkClick event. + */ +interface ASPxClientRichEditHyperlinkClickEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets whether the event is handled manually, so no default processing is required. + * Value: true if the event is handled and no default processing is required; otherwise false. + */ + handled: boolean; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; + /** + * Gets a value identifying the clicked hyperlink type. + * Value: One of the values. + */ + hyperlinkType: ASPxClientOfficeDocumentLinkType; + /** + * Gets the clicked link's URI. + * Value: A sting value specifying the link's URI. + */ + targetUri: string; +} +/** + * A client-side equivalent of the ASPxRichEdit object. + */ +interface ASPxClientRichEdit extends ASPxClientControl { + /** + * Provides access to document structural elements. + * Value: A object that lists RichEdit's document structural elements. + */ + document: RichEditDocument; + /** + * Provides access to RichEdit's client-side commands. + * Value: A object that lists RichEdit's client-side commands. + */ + commands: RichEditCommands; + /** + * Provides access to the client methods that changes the selection. + * 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. + */ + CustomCommandExecuted: ASPxClientEvent>; + /** + * Fires after a client change has been made to the document and the client-server synchronization starts to apply the change on the server. + */ + BeginSynchronization: ASPxClientEvent>; + /** + * Fires after a document change has been applied to the server and server and client document models have been synchronized. + */ + EndSynchronization: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the RichEdit. + */ + CallbackError: ASPxClientEvent>; + /** + * Fires if any change is made to the RichEdit's document on the client. + */ + DocumentChanged: ASPxClientEvent>; + /** + * Occurs when a hyperlink is clicked within the document. + */ + HyperlinkClick: ASPxClientEvent>; + /** + * Occurs when the selection is changed within the document. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Enables you to switch the full-screen mode of the Rich Text Editor. + * @param fullscreen true to activate full-screen mode; false to deactivate full-screen mode. + */ + SetFullscreenMode(fullscreen: boolean): void; + /** + * Provides access to an object implementing the RichEdit's ribbon UI. + */ + GetRibbon(): ASPxClientRibbon; + /** + * Sets input focus to the RichEdit. + */ + Focus(): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Indicates whether any unsaved changes are contained in the current document. + */ + HasUnsavedChanges(): boolean; + /** + * Reconnects the RichEdit to an external ribbon. + */ + ReconnectToExternalRibbon(): void; +} +/** + * Contains a set of the available client commands. + */ +interface RichEditCommands { + /** + * Gets a command to create a new empty document. + * Value: A object that provides methods for executing the command and checking its state. + */ + fileNew: FileNewCommand; + /** + * Gets a command to open the file, specifying its path. + * Value: A object that provides methods for executing the command and checking its state. + */ + fileOpen: FileOpenCommand; + /** + * Gets a command to invoke the File Open dialog allowing one to select and load a document file into RichEdit. + * Value: A object that provides methods for executing the command and checking its state. + */ + fileOpenDialog: FileOpenDialogCommand; + /** + * Gets a command to save the document to a file. + * Value: A object that provides methods for executing the command and checking its state. + */ + fileSave: FileSaveCommand; + /** + * Gets a command to download the document file, specifying its extension. + * Value: A object that provides methods for executing the command and checking its state. + */ + fileDownload: FileDownloadCommand; + /** + * Gets a command to invoke the Save As dialog that prompts for a file name and saves the current document in a file with the specified path. + * Value: A object that provides methods for executing the command and checking its state. + */ + fileSaveAs: FileSaveAsCommand; + fileSaveAsDialog: FileSaveAsDialogCommand; + /** + * Gets a command to invoke a browser-specific Print dialog allowing one to print the current document. + * Value: A object that provides methods for executing the command and checking its state. + */ + filePrint: FilePrintCommand; + /** + * Gets a command to cancel changes caused by the previous command. + * Value: A object that provides methods for executing the command and checking its state. + */ + undo: UndoCommand; + /** + * Gets a command to reverse actions of the previous undo command. + * Value: A object that provides methods for executing the command and checking its state. + */ + redo: RedoCommand; + /** + * Gets a command to copy the selected text and place it to the clipboard. + * Value: A object that provides methods for executing the command and checking its state. + */ + copy: CopyCommand; + /** + * Gets a command to paste the text from the clipboard over the selection. + * Value: A object that provides methods for executing the command and checking its state. + */ + paste: PasteCommand; + /** + * Gets a command to cut the selected text and place it to the clipboard. + * Value: A object that provides methods for executing the command and checking its state. + */ + cut: CutCommand; + /** + * Gets a command to change the font name of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontName: ChangeFontNameCommand; + /** + * Gets a command to change the font size of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontSize: ChangeFontSizeCommand; + /** + * Gets a command to increase the font size of characters in a selected range to the closest larger predefined value. + * Value: A object that provides methods for executing the command and checking its state. + */ + increaseFontSize: IncreaseFontSizeCommand; + /** + * Gets a command to decrease the selected range's font size to the closest smaller predefined value. + * Value: A object that provides methods for executing the command and checking its state. + */ + decreaseFontSize: DecreaseFontSizeCommand; + /** + * Gets a command to convert selected text to upper case. + * Value: A object that provides methods for executing the command and checking its state. + */ + makeTextUpperCase: MakeTextUpperCaseCommand; + /** + * Gets a command to convert selected text to lower case. + * Value: A object that provides methods for executing the command and checking its state. + */ + makeTextLowerCase: MakeTextLowerCaseCommand; + /** + * Gets a command to capitalize each word in the selected sentence. + * Value: A object that provides methods for executing the command and checking its state. + */ + capitalizeEachWordTextCase: CapitalizeEachWordTextCaseCommand; + /** + * Gets a command to toggle case for each character - upper case becomes lower, lower case becomes upper. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTextCase: ToggleTextCaseCommand; + /** + * Gets a command to change the bold formatting of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontBold: ChangeFontBoldCommand; + /** + * Gets a command to change the italic formatting of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontItalic: ChangeFontItalicCommand; + /** + * Gets a command to change the underline formatting of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontUnderline: ChangeFontUnderlineCommand; + /** + * Gets a command to change the strikeout formatting of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontStrikeout: ChangeFontStrikeoutCommand; + /** + * Gets a command to change the superscript formatting of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontSuperscript: ChangeFontSuperscriptCommand; + /** + * Gets a command to change the subscript formatting of characters in the selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontSubscript: ChangeFontSubscriptCommand; + /** + * Gets a command to change the font color of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontForeColor: ChangeFontForeColorCommand; + /** + * Gets a command to change the background color of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontBackColor: ChangeFontBackColorCommand; + /** + * Gets a command to reset the selected text's formatting to default. + * Value: A object that provides methods for executing the command and checking its state. + */ + clearFormatting: ClearFormattingCommand; + /** + * Gets a command to change the selected range's style. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeStyle: ChangeStyleCommand; + /** + * Gets a command to toggle between the bulleted paragraph and normal text. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleBulletedList: ToggleBulletedListCommand; + /** + * Gets a command to toggle between the numbered paragraph and normal text. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleNumberingList: ToggleNumberingListCommand; + /** + * Gets a command to toggle between the multilevel list style and normal text. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleMultilevelList: ToggleMultilevelListCommand; + /** + * Gets a command to increment the indent level of paragraphs in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + increaseIndent: IncreaseIndentCommand; + /** + * Gets a command to decrement the indent level of paragraphs in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + decreaseIndent: DecreaseIndentCommand; + /** + * Gets a command to toggle hidden symbol visibility. + * Value: A object that provides methods for executing the command and checking its state. + */ + showHiddenSymbols: ShowHiddenSymbolsCommand; + /** + * Gets a command to toggle left paragraph alignment on and off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleParagraphAlignmentLeft: ToggleParagraphAlignmentLeftCommand; + /** + * Gets a command to toggle centered paragraph alignment on and off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleParagraphAlignmentCenter: ToggleParagraphAlignmentCenterCommand; + /** + * Gets a command to toggle right paragraph alignment on and off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleParagraphAlignmentRight: ToggleParagraphAlignmentRightCommand; + /** + * Gets a command to toggle justified paragraph alignment on and off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleParagraphAlignmentJustify: ToggleParagraphAlignmentJustifyCommand; + /** + * Gets a command to format a current paragraph with single line spacing. + * Value: A object that provides methods for executing the command and checking its state. + */ + setSingleParagraphSpacing: SetSingleParagraphSpacingCommand; + /** + * Gets a command to format a current paragraph with one and a half line spacing. + * Value: A object that provides methods for executing the command and checking its state. + */ + setSesquialteralParagraphSpacing: SetSesquialteralParagraphSpacingCommand; + /** + * Gets a command to format a selected paragraph with double line spacing. + * Value: A object that provides methods for executing the command and checking its state. + */ + setDoubleParagraphSpacing: SetDoubleParagraphSpacingCommand; + /** + * Gets a command to add spacing before a paragraph. + * Value: A object that provides methods for executing the command and checking its state. + */ + addSpacingBeforeParagraph: AddSpacingBeforeParagraphCommand; + /** + * Gets a command to add spacing after a paragraph. + * Value: A object that provides methods for executing the command and checking its state. + */ + addSpacingAfterParagraph: AddSpacingAfterParagraphCommand; + /** + * Gets a command to remove spacing before the selected paragraph. + * Value: A object that provides methods for executing the command and checking its state. + */ + removeSpacingBeforeParagraph: RemoveSpacingBeforeParagraphCommand; + /** + * Gets a command to remove spacing after the selected paragraph. + * Value: A object that provides methods for executing the command and checking its state. + */ + removeSpacingAfterParagraph: RemoveSpacingAfterParagraphCommand; + /** + * Gets a command to change the background color of paragraphs in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeParagraphBackColor: ChangeParagraphBackColorCommand; + /** + * Gets a command to invoke the Font dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openFontFormattingDialog: OpenFontFormattingDialogCommand; + /** + * Gets a command to change the font formatting of characters in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeFontFormatting: ChangeFontFormattingCommand; + /** + * Gets a command to invoke the Indents And Spacing tab of the Paragraph dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openParagraphFormattingDialog: OpenParagraphFormattingDialogCommand; + /** + * Gets a command to change the formatting of paragraphs in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeParagraphFormatting: ChangeParagraphFormattingCommand; + /** + * Gets a command to insert a page break at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertPageBreak: InsertPageBreakCommand; + /** + * Gets a command to invoke the Insert Table dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openInsertTableDialog: OpenInsertTableDialogCommand; + /** + * Gets a command to invoke the Insert Table dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTable: InsertTableCommand; + /** + * Gets a command to invoke the Insert Image dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openInsertPictureDialog: OpenInsertPictureDialogCommand; + /** + * Gets a command to insert a picture from a file. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertPicture: InsertPictureCommand; + /** + * Gets a command to invoke the Bookmark dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openInsertBookmarkDialog: OpenInsertBookmarkDialogCommand; + /** + * Gets a command to insert a new bookmark that references the current selection. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertBookmark: InsertBookmarkCommand; + /** + * A command to delete a specific bookmark. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteBookmark: DeleteBookmarkCommand; + /** + * Gets a command to navigate to the specified bookmark. + * Value: A object that provides methods for executing the command and checking its state. + */ + 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. + */ + openInsertHyperlinkDialog: OpenInsertHyperlinkDialogCommand; + /** + * Gets a command to insert a hyperlink at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertHyperlink: InsertHyperlinkCommand; + /** + * Gets a command to delete the selected hyperlink. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteHyperlink: DeleteHyperlinkCommand; + /** + * Gets a command to delete all hyperlinks in the selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteHyperlinks: DeleteHyperlinksCommand; + /** + * Gets a command to navigate to the document bookmark or URI (uniform resource identifier) specified for the hyperlink. + * Value: A object that provides methods for executing the command and checking its state. + */ + openHyperlink: OpenHyperlinkCommand; + /** + * Gets a command to invoke the Symbols dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openInsertSymbolDialog: OpenInsertSymbolDialogCommand; + /** + * Gets a command to insert a character into a document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertSymbol: InsertSymbolCommand; + /** + * Gets a command to change page margin settings. + * Value: A object that provides methods for executing the command and checking its state. + */ + changePageMargins: ChangePageMarginsCommand; + /** + * Gets a command to invoke the Margins tab of the Page Setup dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openPageMarginsDialog: OpenPageMarginsDialogCommand; + /** + * Gets a command to change the page orientation. + * Value: A object that provides methods for executing the command and checking its state. + */ + changePageOrientation: ChangePageOrientationCommand; + /** + * Gets a command to define the page size dialog's settings. + * Value: A object that provides methods for executing the command and checking its state. + */ + 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. + */ + openPagePaperSizeDialog: OpenPagePaperSizeDialogCommand; + /** + * Gets a command to change the page size. + * Value: A object that provides methods for executing the command and checking its state. + */ + changePageSize: ChangePageSizeCommand; + /** + * Gets a command to change the number of section columns having the same width. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeSectionEqualColumnCount: ChangeSectionEqualColumnCountCommand; + /** + * Gets a command to invoke the Columns dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openSectionColumnsDialog: OpenSectionColumnsDialogCommand; + /** + * Gets a command to change the settings of individual section columns. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeSectionColumns: ChangeSectionColumnsCommand; + /** + * Gets a command to insert a column break at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertColumnBreak: InsertColumnBreakCommand; + /** + * Gets a command to insert a section break and starts a new section on the next page. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertSectionBreakNextPage: InsertSectionBreakNextPageCommand; + /** + * Gets a command to insert a section break and starts a new section on the next even-numbered page. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertSectionBreakEvenPage: InsertSectionBreakEvenPageCommand; + /** + * Gets a command to insert a section break and starts a new section on the next odd-numbered page. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertSectionBreakOddPage: InsertSectionBreakOddPageCommand; + /** + * Gets a command to set the background color of the page. + * Value: A object that provides methods for executing the command and checking its state. + */ + changePageColor: ChangePageColorCommand; + /** + * Gets a command to toggle the horizontal ruler's visibility. + * Value: A object that provides methods for executing the command and checking its state. + */ + showHorizontalRuler: ShowHorizontalRulerCommand; + /** + * Gets a command to toggle the fullscreen mode. + * Value: A object that provides methods for executing the command and checking its state. + */ + setFullscreen: SetFullscreenCommand; + /** + * Gets a command to invoke the Bulleted and Numbering dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openNumberingListDialog: OpenNumberingListDialogCommand; + /** + * Gets a command to insert a paragraph break at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertParagraph: InsertParagraphCommand; + /** + * Gets a command to insert text at the current position in a document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertText: InsertTextCommand; + /** + * Gets a command to delete the text in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + delete: DeleteCommand; + /** + * Gets a command to remove the previous word. + * Value: A object that provides methods for executing the command and checking its state. + */ + removePrevWord: RemovePrevWordCommand; + /** + * Gets a command to remove the next word. + * Value: A object that provides methods for executing the command and checking its state. + */ + removeNextWord: RemoveNextWordCommand; + /** + * Gets a command to move the cursor backwards and erase the character in that space. + * Value: A object that provides methods for executing the command and checking its state. + */ + backspace: BackspaceCommand; + /** + * Gets a command to insert the line break at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertLineBreak: InsertLineBreakCommand; + /** + * Gets a command to scale pictures in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + changePictureScale: ChangePictureScaleCommand; + /** + * Gets a command to increment the left indentation of paragraphs in a selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + incrementParagraphLeftIndent: IncrementParagraphLeftIndentCommand; + /** + * Gets a command to decrement the paragraph's left indent position. + * Value: A object that provides methods for executing the command and checking its state. + */ + decrementParagraphLeftIndent: DecrementParagraphLeftIndentCommand; + /** + * Gets a command to move the selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + moveContent: MoveContentCommand; + /** + * Gets a command to copy the selected text and place it to the specified position. + * Value: A object that provides methods for executing the command and checking its state. + */ + copyContent: CopyContentCommand; + /** + * Gets a command to insert a tab character at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTab: InsertTabCommand; + /** + * Gets a command to invoke the Tabs dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openTabsDialog: OpenTabsDialogCommand; + /** + * Gets a command to change paragraph tab stops. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTabs: ChangeTabsCommand; + /** + * Gets a command to invoke the Customize Numbered List dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openCustomNumberingListDialog: OpenCustomNumberingListDialogCommand; + /** + * Gets a command to customize the numbered list parameters. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeCustomNumberingList: ChangeCustomNumberingListCommand; + /** + * Gets a command to restart the numbering list. + * Value: A object that provides methods for executing the command and checking its state. + */ + restartNumberingList: RestartNumberingListCommand; + /** + * Gets a command to increment the indent level of paragraphs in a selected numbered list. + * Value: A object that provides methods for executing the command and checking its state. + */ + incrementNumberingIndent: IncrementNumberingIndentCommand; + /** + * Gets a command to decrement the indent level of paragraphs in a selected numbered list. + * Value: A object that provides methods for executing the command and checking its state. + */ + decrementNumberingIndent: DecrementNumberingIndentCommand; + /** + * Gets a command to create an empty field in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + createField: CreateFieldCommand; + /** + * Gets a command to update the field's result. + * Value: A object that provides methods for executing the command and checking its state. + */ + updateField: UpdateFieldCommand; + /** + * Gets a command to display the selected field's codes. + * Value: A object that provides methods for executing the command and checking its state. + */ + showFieldCodes: ShowFieldCodesCommand; + /** + * Get a command to display all field codes in place of the fields in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + showAllFieldCodes: ShowAllFieldCodesCommand; + /** + * Gets a command to continue the list's numbering. + * Value: A object that provides methods for executing the command and checking its state. + */ + continueNumberingList: ContinueNumberingListCommand; + /** + * Gets a command to insert numeration to a paragraph making it a numbering list item. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertNumeration: InsertNumerationCommand; + /** + * Gets a command to remove the selected numeration. + * Value: A object that provides methods for executing the command and checking its state. + */ + removeNumeration: RemoveNumerationCommand; + /** + * Gets a command to update all fields in the selected range. + * Value: A object that provides methods for executing the command and checking its state. + */ + updateAllFields: UpdateAllFieldsCommand; + /** + * Gets a command to insert a DATE field displaying the current date. + * Value: A object that provides methods for executing the command and checking its state. + */ + createDateField: CreateDateFieldCommand; + /** + * Gets a command to insert a TIME field displaying the current time. + * Value: A object that provides methods for executing the command and checking its state. + */ + createTimeField: CreateTimeFieldCommand; + /** + * A command to insert a PAGE field displaying the current page number. + * Value: A object that provides methods for executing the command and checking its state. + */ + createPageField: CreatePageFieldCommand; + /** + * Gets a command to convert the text of all selected sentences to sentence case. + * Value: A object that provides methods for executing the command and checking its state. + */ + makeTextSentenceCase: MakeTextSentenceCaseCommand; + /** + * Gets a command to switch the text case at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + switchTextCase: SwitchTextCaseCommand; + /** + * Gets a command to navigate to the first data record. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToFirstDataRecord: GoToFirstDataRecordCommand; + /** + * Gets a command to navigate to the previous data record of the bound data source. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToPreviousDataRecord: GoToPreviousDataRecordCommand; + /** + * Gets a command to navigate to the next data record of the bound data source. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToNextDataRecord: GoToNextDataRecordCommand; + /** + * Gets a command to navigate to the next data record. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToDataRecord: GoToDataRecordCommand; + /** + * Gets a command to navigate to the last data record of the bound data source. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToLastDataRecord: GoToLastDataRecordCommand; + /** + * Gets a command to display or hide actual data in MERGEFIELD fields. + * Value: A object that provides methods for executing the command and checking its state. + */ + showMergedData: ShowMergedDataCommand; + /** + * Gets a command to invoke the Insert Merge Field dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + mergeFieldDialog: MergeFieldDialogCommand; + /** + * Gets a command to insert a MERGEFIELD field (with a data source column name) at the current position in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + createMergeField: CreateMergeFieldCommand; + /** + * Gets a command to invoke the Export Range dialog window to start a mail merge. + * Value: A object that provides methods for executing the command and checking its state. + */ + mailMergeDialog: MailMergeDialogCommand; + /** + * Gets a command to perform a mail merge and download the merged document. + * Value: A object that provides methods for executing the command and checking its state. + */ + mailMergeAndDownload: MailMergeAndDownloadCommand; + /** + * Gets a command to perform a mail merge and save the merged document to the server. + * Value: A object that provides methods for executing the command and checking its state. + */ + mailMergeAndSaveAs: MailMergeAndSaveAsCommand; + /** + * Gets a command to activate the page header and begin editing. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertHeader: InsertHeaderCommand; + /** + * Gets a command to activate the page footer and begin editing. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertFooter: InsertFooterCommand; + /** + * Gets a command to link a header/footer to the previous section, so it has the same content. + * Value: A object that provides methods for executing the command and checking its state. + */ + linkHeaderFooterToPrevious: LinkHeaderFooterToPreviousCommand; + /** + * Gets a command to navigate to the page footer from the page header in the header/footer editing mode. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToFooter: GoToFooterCommand; + /** + * Gets a command to navigate to the page header from the page footer in the header/footer editing mode. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToHeader: GoToHeaderCommand; + /** + * Gets a command to navigate to the next page header or footer in the header/footer editing mode. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToNextHeaderFooter: GoToNextHeaderFooterCommand; + /** + * Gets a command to navigate to the previous page header or footer in the header/footer editing mode. + * Value: A object that provides methods for executing the command and checking its state. + */ + goToPreviousHeaderFooter: GoToPreviousHeaderFooterCommand; + /** + * Gets a command to change the header/footer edit mode, so it allows creation of a different header or footer for the first page of a document or section. + * Value: A object that provides methods for executing the command and checking its state. + */ + setDifferentFirstPageHeaderFooter: SetDifferentFirstPageHeaderFooterCommand; + /** + * Gets a command to change the header/footer edit mode so it allows creation of a different header or footer for odd and even pages of a document or section. + * Value: A object that provides methods for executing the command and checking its state. + */ + setDifferentOddAndEvenPagesHeaderFooter: SetDifferentOddAndEvenPagesHeaderFooterCommand; + /** + * Gets a command to finish header/footer editing. + * Value: A object that provides methods for executing the command and checking its state. + */ + closeHeaderFooter: CloseHeaderFooterCommand; + /** + * Gets a command to insert a NUMPAGES field displaying the total number of pages. + * Value: A object that provides methods for executing the command and checking its state. + */ + createPageCountField: CreatePageCountFieldCommand; + /** + * Gets a command to invoke the Table tab of the Table Properties dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openTableFormattingDialog: OpenTableFormattingDialogCommand; + /** + * Gets a command to change the selected table's formatting. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableFormatting: ChangeTableFormattingCommand; + /** + * Gets a command to change the selected table rows' preferred height. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableRowPreferredHeight: ChangeTableRowPreferredHeightCommand; + /** + * Gets a command to change the preferred cell width of the selected table rows. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableCellPreferredWidth: ChangeTableCellPreferredWidthCommand; + /** + * Gets a command to toggle inside borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + 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. + */ + changeTableColumnPreferredWidth: ChangeTableColumnPreferredWidthCommand; + /** + * Gets a command to change the cell formatting of the selected table elements. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableCellFormatting: ChangeTableCellFormattingCommand; + /** + * Gets a command to insert a table column to the left of the current position in the table. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTableColumnToTheLeft: InsertTableColumnToTheLeftCommand; + /** + * Gets a command to insert a table column to the right of the current position in the table. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTableColumnToTheRight: InsertTableColumnToTheRightCommand; + /** + * Gets a command to insert a row in the table below the selected row. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTableRowBelow: InsertTableRowBelowCommand; + /** + * Gets a command to insert a row in the table above the selected row. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTableRowAbove: InsertTableRowAboveCommand; + /** + * Gets a command to delete the selected rows in the table. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteTableRows: DeleteTableRowsCommand; + /** + * Gets a command to delete the selected columns in the table. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteTableColumns: DeleteTableColumnsCommand; + /** + * Gets a command to insert table cells with a horizontal shift into the selected table. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTableCellWithShiftToTheLeft: InsertTableCellWithShiftToTheLeftCommand; + /** + * Gets a command to delete the selected table cells with a horizontal shift. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteTableCellsWithShiftHorizontally: DeleteTableCellsWithShiftHorizontallyCommand; + /** + * Gets a command to delete the selected table cells with a vertical shift. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteTableCellsWithShiftVertically: DeleteTableCellsWithShiftVerticallyCommand; + /** + * Gets a command to delete the selected table. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteTable: DeleteTableCommand; + /** + * Gets a command to invoke the Insert Cells dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTableCellsDialog: InsertTableCellsDialogCommand; + /** + * Gets a command to invoke the Delete Cells dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + deleteTableCellsDialog: DeleteTableCellsDialogCommand; + /** + * Gets a command to merge the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + mergeTableCells: MergeTableCellsCommand; + /** + * Gets a command to invoke the Split Cells dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + splitTableCellsDialog: SplitTableCellsDialogCommand; + /** + * Gets a command to split the selected table cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + splitTableCells: SplitTableCellsCommand; + /** + * Gets a command to insert table cells with a vertical shift into the selected table. + * Value: A object that provides methods for executing the command and checking its state. + */ + insertTableCellsWithShiftToTheVertically: InsertTableCellsWithShiftToTheVerticallyCommand; + /** + * Gets a command to invoke the Borders tab of the Borders and Shading dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openTableBordersAndShadingDialog: OpenTableBordersAndShadingDialogCommand; + /** + * Gets a command to change the selected table's borders and shading. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableBordersAndShading: ChangeTableBordersAndShadingCommand; + /** + * Gets a command to apply top-left alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignTopLeft: ToggleTableCellAlignTopLeftCommand; + /** + * Gets a command to apply top-center alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignTopCenter: ToggleTableCellAlignTopCenterCommand; + /** + * Gets a command to apply top-right alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignTopRight: ToggleTableCellAlignTopRightCommand; + /** + * Gets a command to apply middle-left alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignMiddleLeft: ToggleTableCellAlignMiddleLeftCommand; + /** + * Gets a command to apply middle-center alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignMiddleCenter: ToggleTableCellAlignMiddleCenterCommand; + /** + * Gets a command to apply middle-right alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignMiddleRight: ToggleTableCellAlignMiddleRightCommand; + /** + * Gets a command to apply bottom-left alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignBottomLeft: ToggleTableCellAlignBottomLeftCommand; + /** + * Gets a command to apply bottom-center alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignBottomCenter: ToggleTableCellAlignBottomCenterCommand; + /** + * Gets a command to apply bottom-right alignment for the selected cells. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAlignBottomRight: ToggleTableCellAlignBottomRightCommand; + /** + * Gets a command to change the selected table's style. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableStyle: ChangeTableStyleCommand; + /** + * Gets a command to toggle top borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellTopBorder: ToggleTableCellTopBorderCommand; + /** + * Gets a command to toggle right borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellRightBorder: ToggleTableCellRightBorderCommand; + /** + * Gets a command to toggle bottom borders for selected cells on/off. + * 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. + * Value: A object that provides methods for executing the command and checking its state. + */ + removeTableCellBorders: RemoveTableCellBordersCommand; + /** + * Gets a command to toggle all borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellAllBorders: ToggleTableCellAllBordersCommand; + /** + * Gets a command to toggle inner horizontal borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellInsideHorizontalBorders: ToggleTableCellInsideHorizontalBordersCommand; + /** + * Gets a command to toggle inner vertical borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellInsideVerticalBorders: ToggleTableCellInsideVerticalBordersCommand; + /** + * Gets a command to toggle outer borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + toggleTableCellOutsideBorders: ToggleTableCellOutsideBordersCommand; + /** + * Gets a command to change the selected table's style options. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableLook: ChangeTableLookCommand; + /** + * Gets a command to change the repository item's table border style. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableBorderRepositoryItem: ChangeTableBorderRepositoryItemCommand; + /** + * Gets a command to change cell shading in the selected table elements. + * Value: A object that provides methods for executing the command and checking its state. + */ + changeTableCellShading: ChangeTableCellShadingCommand; + /** + * Gets a command to toggle the display of grid lines for a table with no borders applied - on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ + showTableGridLines: ShowTableGridLinesCommand; + /** + * Gets a command to invoke the Search Panel allowing end-users to search text and navigate through search results. + * Value: A object that provides methods for executing the command and checking its state. + */ + openFindPanel: OpenFindPanelCommand; + /** + * Gets a command to invoke the Find and Replace dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ + openFindAndReplaceDialog: OpenFindAndReplaceDialogCommand; + /** + * Gets a command to find all matches of the specified text in the document. + * Value: A object that provides methods for executing the command and checking its state. + */ + findAll: FindAllCommand; + /** + * Gets a command to hide the results of the search. + * Value: A object that provides methods for executing the command and checking its state. + */ + hideFindResults: HideFindResultsCommand; + /** + * Gets a command to search for a specific text and replace all matches in the document with the specified string. + * Value: A object that provides methods for executing the command and checking its state. + */ + replaceAll: ReplaceAllCommand; + /** + * Gets a command to search for a specific text and replace the next match in the document with the specified string. + * 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; + /** + * Gets a command to assign a shortcut to the specified client command. + * Value: A object that provides methods for executing the command and checking its state. + */ + assignShortcut: AssignShortcutCommand; +} +/** + * Serves as a base for objects that implement different client command functionalities. + */ +interface CommandBase { +} +/** + * Serves as a base for commands with a simple common command state. + */ +interface CommandWithSimpleStateBase extends CommandBase { + /** + * Gets information about the command state. + */ + getState(): SimpleCommandState; +} +/** + * Serves as a base for commands with the Boolean state. + */ +interface CommandWithBooleanStateBase extends CommandBase { + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * Defines a simple state common to most of the client commands. + */ +interface SimpleCommandState { + /** + * Gets a value indicating whether the command's UI element is enabled (within the ribbon and context menu). + * Value: true, if the command's related UI element is enabled; otherwise, false. + */ + enabled: boolean; + /** + * Gets a value indicating whether the command's UI element is visible. + * Value: true, if the command's related UI element is visible; otherwise, false. + */ + visible: boolean; +} +/** + * Defines the state of a command. + */ +interface CommandState extends SimpleCommandState { + /** + * Gets the command state value. + * Value: A T object specifying the command state value. + */ + value: T; +} +/** + * Contains a set properties providing the current information about certain document structural elements. + */ +interface RichEditDocument { + /** + * Provides the information about the active sub-document. + * Value: A object storing information about the essential document functionality. + */ + activeSubDocument: SubDocument; + /** + * Provides information about sections in the current document. + * Value: An array of Section objects storing information about sections. + */ + sectionsInfo: Section[]; + /** + * Provides information about paragraph styles in the current document. + * Value: An array of ParagraphStyle objects storing information about paragraph styles. + */ + paragraphStylesInfo: ParagraphStyle[]; + /** + * Provides information about character styles in the current document. + * Value: An array of CharacterStyle objects storing information about character styles. + */ + characterStylesInfo: CharacterStyle[]; + /** + * Provides information about numbered paragraphs in the document. + * Value: An array of AbstractNumberingList objects storing the information about numbered paragraphs. + */ + abstractNumberingListsInfo: AbstractNumberingList[]; + /** + * Provides information about table styles in the current document. + * Value: An array of TableStyle objects storing information about table styles. + */ + tableStylesInfo: TableStyle[]; + /** + * Provides information about spell checking in the current document. + * Value: A object. + */ + spellingInfo: SpellingInfo; +} +/** + * An abstract numbering list definition that defines the appearance and behavior of numbered paragraphs in a document. + */ +interface AbstractNumberingList { + deleted: boolean; +} +/** + * Defines a paragraph in the document. + */ +interface Paragraph { + /** + * Gets the paragraph's character length. + * Value: An integer value specifying the element length in characters. + */ + length: number; + /** + * Gets the paragraph's start position in the document. + * 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. + */ + styleName: string; + /** + * Gets the index of a list applied to the paragraph. + * Value: An integer that is the index of a list to which the paragraph belongs. + */ + listIndex: number; + /** + * Gets the index of the list level applied to the current paragraph in the numbering list. + * Value: An integer that is the index of the list level of the current paragraph. + */ + listLevelIndex: number; +} +/** + * Defines a field in the document. + */ +interface Field { + /** + * Gets the field's start position in a document. + * Value: An integer value specifying the start position. + */ + start: number; + /** + * Gets the field length in a document. + * Value: An integer value specifying the field length. + */ + length: number; + codeInterval: Interval; + resultInterval: Interval; + 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. + */ + hyperlinkUri: string; + /** + * Gets or sets the text for the tooltip displayed when the mouse hovers over a hyperlink field. + * Value: A string containing the tooltip text. + */ + hyperlinkTip: string; + /** + * Gets or sets the name of a bookmark (or a hyperlink) in the current document which shall be the target of the hyperlink field. + * Value: A string representing the bookmark's name. + */ + hyperlinkAnchor: string; + /** + * Gets a value specifying whether a field's code or result is dispalyed. + * Value: true, if the field code is displayed; false, if the field result is displayed. + */ + showCode: boolean; +} +/** + * Defines a bookmark in the document. + */ +interface Bookmark { + /** + * Gets the bookmark's start position in a document. + * Value: An integer value specifying the start position. + */ + start: number; + /** + * Gets the bookmark's length. + * 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. + */ + name: string; +} +/** + * Defines a section in the document. + */ +interface Section { + /** + * Gets the section's start position in the document. + * Value: An integer value specifying the start position. + */ + start: number; + /** + * Gets the section's character length. + * 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. + */ + headers: HeaderFooter[]; + /** + * Provides access to the section's footers. + * Value: An array of HeaderFooter objects storing information about the section's footers. + */ + footers: HeaderFooter[]; +} +/** + * Contains settings defining a header or footer in a document. + */ +interface HeaderFooter { + /** + * Gets the type of the header (footer). + * Value: One of the values. + */ + type: any; + /** + * Provides access to an object implementing the basic document functionality that is common to the header, footer and the main document body. + * Value: A object exposing the basic document functionality. + */ + subDocument: SubDocument; +} +interface InlinePictureInfo { + id: number; + position: number; + initialWidth: number; + initialHeight: number; + scaleX: number; + scaleY: number; + /** + * Gets the actual image width. + */ + actualWidth: number; + /** + * Gets the actual image height. + */ + actualHeight: number; +} +declare enum HeaderFooterType { + First=0, + Odd=1, + Primary=1, + Even=2 +} +interface RichEditFileInfo { + folderPath: string; + fileName: string; + documentFormat: any; +} +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. + */ +interface RichEditSelection { + /** + * Gets or sets an array of document interval in the selection. + * Value: An array of Interval objects. + */ + intervals: Interval[]; + /** + * Gets or sets a value specifying whether the current selection is collapsed (and represents the cursor position). + * Value: true, if the selection is collapsed; otherwise, false. + */ + collapsed: boolean; + getIntervalMaxPosition(): number; + /** + * Moves the cursor to the next line. + */ + goToNextLine(): void; + /** + * Moves the cursor to the next line and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToNextLine(extendSelection: boolean): void; + /** + * Moves the cursor to the end of the line in which the cursor is located. + */ + goToLineEnd(): void; + /** + * Moves the cursor to the end of the line in which the cursor is located and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToLineEnd(extendSelection: boolean): void; + /** + * Moves the cursor to the start of the line in which the cursor is located. + */ + goToLineStart(): void; + /** + * Moves the cursor to the start of the line in which the cursor is located and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToLineStart(extendSelection: boolean): void; + /** + * Moves the cursor to the previous line. + */ + goToPreviousLine(): void; + /** + * Moves the cursor to the previous line and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToPreviousLine(extendSelection: boolean): void; + /** + * Moves the cursor to the next character. + */ + goToNextCharacter(): void; + /** + * Moves the cursor to the next character and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToNextCharacter(extendSelection: boolean): void; + /** + * Moves the cursor to the previous character. + */ + goToPreviousCharacter(): void; + /** + * Moves the cursor to the previous character and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToPreviousCharacter(extendSelection: boolean): void; + /** + * Selects the line in which the cursor is located. + */ + selectLine(): void; + /** + * Selects the line in which the cursor is located and allows you to extend the entire selection with the currently existing selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + selectLine(extendSelection: boolean): void; + /** + * Moves the cursor to the beginning of the next page. + */ + goToNextPage(): void; + /** + * Moves the cursor to the beginning of the next page and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToNextPage(extendSelection: boolean): void; + /** + * Moves the cursor to the beginning of the previous page. + */ + goToPreviousPage(): void; + /** + * Moves the cursor to the beginning of the previous page and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToPreviousPage(extendSelection: boolean): void; + /** + * Moves the cursor to the start of the document. + */ + goToDocumentStart(): void; + /** + * Moves the cursor to the start of the document and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToDocumentStart(extendSelection: boolean): void; + /** + * Moves the cursor to the end of the document. + */ + goToDocumentEnd(): void; + /** + * Moves the cursor to the end of the document and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToDocumentEnd(extendSelection: boolean): void; + /** + * Moves the cursor to the next word. + */ + goToNextWord(): void; + /** + * Moves the cursor to the next word and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToNextWord(extendSelection: boolean): void; + /** + * Moves the cursor to the previous word. + */ + goToPrevWord(): void; + /** + * Moves the cursor to the previous word and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToPrevWord(extendSelection: boolean): void; + /** + * Moves the cursor to the start of the paragraph in which the cursor is located. + */ + goToParagraphStart(): void; + /** + * Moves the cursor to the start of the paragraph in which the cursor is located and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToParagraphStart(extendSelection: boolean): void; + /** + * Moves the cursor to the end of the paragraph in which the cursor is located. + */ + goToParagraphEnd(): void; + /** + * Moves the cursor to the end of the paragraph in which the cursor is located and allows you to extend the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToParagraphEnd(extendSelection: boolean): void; + /** + * Selects the paragraph in which the cursor is located. + */ + selectParagraph(): void; + /** + * Moves the cursor to the next page break mark. + */ + goToStartNextPageCommand(): void; + /** + * Moves the cursor to the next page break mark and extends the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToStartNextPageCommand(extendSelection: boolean): void; + /** + * Moves the cursor to the previous page break mark. + */ + goToStartPrevPageCommand(): void; + /** + * Moves the cursor to the previous page break mark and extends the selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + goToStartPrevPageCommand(extendSelection: boolean): void; + /** + * Selects the table cell in which the cursor is located. + */ + selectTableCell(): void; + /** + * Selects the table cell in which the cursor is located and allows you to extend the entire selection with the currently existing selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + selectTableCell(extendSelection: boolean): void; + /** + * Selects the table row in which the cursor is located. + */ + selectTableRow(): void; + /** + * Selects the table row in which the cursor is located and allows you to extend the entire selection with the currently existing selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + selectTableRow(extendSelection: boolean): void; + /** + * Selects the entire table in which the cursor is located. + */ + selectTable(): void; + /** + * Selects the entire table in which the cursor is located and allows you to extend the entire selection with the currently existing selection. + * @param extendSelection true to extend the selection; otherwise, false. + */ + selectTable(extendSelection: boolean): void; + /** + * Selects the editor's entire content. + */ + selectAll(): void; + /** + * Makes the main sub-document active and moves the cursor to its beginning. + */ + setMainSubDocumentAsActive(): void; + /** + * Creates a footer sub-document (if it was not created before) and sets the footer as the active sub-document. Moves the cursor to the footer's start position. + * @param pageIndex An integer value specifying the active page's index. + */ + setFooterSubDocumentAsActiveByPageIndex(pageIndex: number): void; + /** + * Creates a header sub-document (if it was not created before) and sets the header as the active sub-document. Moves the cursor to the header's start position. + * @param pageIndex An integer value specifying the active page's index. + */ + setHeaderSubDocumentAsActiveByPageIndex(pageIndex: number): void; +} +/** + * Defines a document's interval. + */ +interface Interval { + /** + * Gets the interval's start position in the document. + * Value: An integer value specifying the start position. + */ + start: number; + /** + * Gets the interval's character length. + * Value: An integer value specifying the element length in characters. + */ + 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 { + /** + * + * @param value + */ + pixelsToTwips(value: number): number; + /** + * + * @param value + */ + inchesToTwips(value: number): number; + /** + * + * @param value + */ + pointsToTwips(value: number): number; + /** + * Converts a value on centimeters to twips. + * @param value + */ + centimetersToTwips(value: number): number; + /** + * + * @param value + */ + twipsToCentimeters(value: number): number; + /** + * + * @param value + */ + pixelsToCentimeters(value: number): number; + /** + * + * @param value + */ + twipsToInches(value: number): number; + /** + * + * @param value + */ + pixelsToInches(value: number): number; + /** + * + * @param value + */ + pixelsToPoints(value: number): number; + /** + * + * @param value + */ + twipsToPoints(value: number): number; +} +/** + * A command to invoke the Bookmark dialog. + */ +interface OpenInsertBookmarkDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenInsertBookmarkDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a new bookmark that references the current selection. + */ +interface InsertBookmarkCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertBookmarkCommand command by applying the specified settings. 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 name A string value specifying name of creating bookmark. + * @param start An integer value specifying the start position of bookmark's range. + * @param length An integer value specifying the length of bookmark's range. + */ + execute(name: string, start: number, length: number): boolean; +} +/** + * A command to delete a specific bookmark. + */ +interface DeleteBookmarkCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteBookmarkCommand command by applying the specified setting. 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 name A string value specifying name of the deleted bookmark. + */ + execute(name: string): boolean; +} +/** + * Gets a command to navigate to the specified bookmark in the document. + */ +interface GoToBookmarkCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToBookmarkCommand command by applying the specified setting. 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 name + */ + execute(name: string): boolean; +} +/** + * A command to paste the text from the clipboard over the selection. + */ +interface PasteCommand extends CommandWithSimpleStateBase { + /** + * Executes the PasteCommand 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. + */ + execute(): boolean; +} +/** + * A command to copy the selected text and place it to the clipboard. + */ +interface CopyCommand extends CommandWithSimpleStateBase { + /** + * Executes the CopyCommand 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. + */ + execute(): boolean; +} +/** + * A command to cut the selected text and place it to the clipboard. + */ +interface CutCommand extends CommandWithSimpleStateBase { + /** + * Executes the CutCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert an empty document field at the current position in the document. + */ +interface CreateFieldCommand extends CommandWithSimpleStateBase { + /** + * Executes the CreateFieldCommand 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. + */ + execute(): boolean; +} +/** + * A command to update the field's result. + */ +interface UpdateFieldCommand extends CommandWithSimpleStateBase { + /** + * Executes the UpdateFieldCommand 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. + */ + execute(): boolean; +} +/** + * A command to display the selected field's field codes. + */ +interface ShowFieldCodesCommand extends CommandWithSimpleStateBase { + /** + * Executes the ShowFieldCodesCommand command by applying the specified setting. 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 showFieldCodes true to display field codes, false to hide field codes. + */ + execute(showFieldCodes: boolean): boolean; + /** + * Executes the ShowFieldCodesCommand 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. + */ + execute(): boolean; +} +/** + * A command to display all field codes in place of the fields in the document. + */ +interface ShowAllFieldCodesCommand extends CommandWithSimpleStateBase { + /** + * Executes the ShowAllFieldCodesCommand command by applying the specified setting. 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 showFieldCodes true to display field codes, false to hide field codes. + */ + execute(showFieldCodes: boolean): boolean; + /** + * Executes the ShowAllFieldCodesCommand 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. + */ + execute(): boolean; +} +/** + * A command to update all fields in the selected range. + */ +interface UpdateAllFieldsCommand extends CommandWithSimpleStateBase { + /** + * Executes the UpdateAllFieldsCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a DATE field displaying the current date. + */ +interface CreateDateFieldCommand extends CommandWithSimpleStateBase { + /** + * Executes the CreateDateFieldCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a TIME field displaying the current time. + */ +interface CreateTimeFieldCommand extends CommandWithSimpleStateBase { + /** + * Executes the CreateTimeFieldCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a PAGE field displaying the current page number. + */ +interface CreatePageFieldCommand extends CommandWithSimpleStateBase { + /** + * Executes the CreatePageFieldCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the next data record of the bound data source. + */ +interface GoToDataRecordCommand extends CommandBase { + /** + * Executes the GoToDataRecordCommand command by applying the specified setting. 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 activeRecordIndex An integer value specifying index of the next data record. + */ + execute(activeRecordIndex: number): boolean; + getState(): any; +} +interface DataRecordOptions { + /** + * Gets or sets the index of the active data record. + */ + activeRecordIndex: number; + recordCount: number; +} +/** + * A command to navigate to the first data record of the bound data source. + */ +interface GoToFirstDataRecordCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToFirstDataRecordCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the previous data record of the bound data source. + */ +interface GoToPreviousDataRecordCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToPreviousDataRecordCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the next data record of the bound data source. + */ +interface GoToNextDataRecordCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToNextDataRecordCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the last data record of the bound data source. + */ +interface GoToLastDataRecordCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToLastDataRecordCommand 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. + */ + execute(): boolean; +} +/** + * A command to display or hide actual data in MERGEFIELD fields. + */ +interface ShowMergedDataCommand extends CommandWithBooleanStateBase { + /** + * Executes the ShowMergedDataCommand 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. + */ + execute(): boolean; + /** + * Executes the ShowMergedDataCommand command by applying the specified setting. 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 showMergedData true to display merged data, false to hide merged data. + */ + execute(showMergedData: boolean): boolean; +} +/** + * A command to invoke the Insert Merge Field dialog. + */ +interface MergeFieldDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the MergeFieldDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a MERGEFIELD field (with a data source column name) at the current position in the document. + */ +interface CreateMergeFieldCommand extends CommandWithSimpleStateBase { + /** + * Executes the CreateMergeFieldCommand command by applying the specified setting. 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 fieldName A string value specifying the name of the merge field. + */ + execute(fieldName: string): boolean; +} +/** + * Gets a command to invoke the Export Range dialog to start a mail merge. + */ +interface MailMergeDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the MailMergeDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to start the mail merge process and download the resulting document containing the merged information. + */ +interface MailMergeAndDownloadCommand extends CommandBase { + /** + * Executes the MailMergeAndDownloadCommand command by applying the specified setting. 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 fileExtension A string value specifying the file extension of the resulting document. + */ + execute(fileExtension: string): boolean; + /** + * + * @param documentFormat + */ + execute(documentFormat: any): boolean; + /** + * Executes the MailMergeAndDownloadCommand command by applying the specified settings. 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 fileExtension A string value specifying the file extension of the resulting document. + * @param settings A MailMergeSettings object containing settings to set up mail merge operations. + */ + execute(fileExtension: string, settings: MailMergeSettings): boolean; + /** + * + * @param documentFormat + * @param settings + */ + execute(documentFormat: any, settings: MailMergeSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to start the mail merge process and save the resulting merged document to the server. + */ +interface MailMergeAndSaveAsCommand extends CommandBase { + /** + * Executes the MailMergeAndSaveAsCommand command by applying the specified setting. 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 filePath A string value specifying path to the saving file on the server. + */ + execute(filePath: string): boolean; + /** + * + * @param fileInfo + * @param settings + */ + execute(fileInfo: RichEditFileInfo, settings: MailMergeSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to insert a NUMPAGES field displaying the total number of pages. + */ +interface CreatePageCountFieldCommand extends CommandWithSimpleStateBase { + /** + * Executes the CreatePageCountFieldCommand 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. + */ + execute(): boolean; +} +/** + * Contains settings to set up mail merge operations. + */ +interface MailMergeSettings { + /** + * Gets or sets a value specifying which data rows should be exported into a merged document. + * Value: One of the values. + */ + range: any; + /** + * Gets or sets the index of the row from which the exported range starts. + * Value: An integer value specifying the row index. + */ + exportFrom: number; + /** + * Gets or sets the number of data rows in the exported mail-merge range. + * Value: An integer value specifying the row count. + */ + exportRecordsCount: number; + /** + * Gets or sets the merge mode. + * Value: One of the values. + */ + mergeMode: any; +} +declare enum MergeMode { + NewParagraph=0, + NewSection=1, + JoinTables=2 +} +declare enum MailMergeExportRange { + AllRecords=0, + CurrentRecord=1, + Range=2 +} +/** + * A command to create a new empty document. + */ +interface FileNewCommand extends CommandWithSimpleStateBase { + /** + * Executes the FileNewCommand 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. + */ + execute(): boolean; +} +/** + * A command to open the file, specifying its path. + */ +interface FileOpenCommand extends CommandWithSimpleStateBase { + /** + * Executes the FileOpenCommand command by applying the specified setting. 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 path A string value specifying path to the opening file. + */ + execute(path: string): boolean; +} +/** + * A command to invoke the File Open dialog allowing one to select and load a document file into RichEdit. + */ +interface FileOpenDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the FileOpenDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to save the document to a file. + */ +interface FileSaveCommand extends CommandWithSimpleStateBase { + /** + * Executes the FileSaveCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Save As dialog that prompts for a file name and saves the current document in a file with the specified path. + */ +interface FileSaveAsCommand extends CommandWithSimpleStateBase { + /** + * Executes the FileSaveAsCommand command by applying the specified setting. 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 path A string value specifying path to the saving file. + */ + execute(path: string): boolean; + /** + * + * @param fileInfo + */ + execute(fileInfo: RichEditFileInfo): boolean; +} +interface FileSaveAsDialogCommand extends CommandWithSimpleStateBase { + execute(): boolean; +} +/** + * A command to download the document file, specifying its extension. + */ +interface FileDownloadCommand extends CommandWithSimpleStateBase { + /** + * Executes the FileDownloadCommand command by applying the specified setting. 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 fileExtension A string value specifying the extension of the downloading file. + */ + execute(fileExtension: string): boolean; + /** + * + * @param documentFormat + */ + execute(documentFormat: any): boolean; +} +/** + * A command to invoke a browser-specific Print dialog allowing one to print the current document. + */ +interface FilePrintCommand extends CommandWithSimpleStateBase { + /** + * Executes the FilePrintCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Search Panel allowing end-users to search text and navigate through search results. + */ +interface OpenFindPanelCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenFindPanelCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Find and Replace dialog. + */ +interface OpenFindAndReplaceDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenFindAndReplaceDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to find all matches of the specified text in the document. + */ +interface FindAllCommand extends CommandWithSimpleStateBase { + /** + * Executes the FindAllCommand command by applying the specified settings. 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 text A string value specifying finding text. + * @param matchCase true, to perform a case-sensitive search; otherwise, false. + * @param highlightResults true, to highlight result of search; otherwise, false. + */ + execute(text: string, matchCase: boolean, highlightResults: boolean): boolean; + /** + * Executes the FindAllCommand command by applying the specified settings. 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 text A string value specifying text to find. + * @param matchCase true, to perform a case-sensitive search; otherwise, false. + * @param highlightResults true, to highlight result of search; otherwise, false. + * @param results An array of Interval objects containing the results of search. + */ + execute(text: string, matchCase: boolean, highlightResults: boolean, results: Interval[]): boolean; +} +/** + * A command to hide the search results. + */ +interface HideFindResultsCommand extends CommandWithSimpleStateBase { + /** + * Executes the HideFindResultsCommand 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. + */ + execute(): boolean; +} +/** + * A command to search for a specific text and replace all matches in the document with the specified string. + */ +interface ReplaceAllCommand extends CommandWithSimpleStateBase { + /** + * Executes the ReplaceAllCommand command by applying the specified settings. 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 text A string value specifying text to replace. + * @param replaceText A string value specifying replacing text. + * @param matchCase true, to perform a case-sensitive search; otherwise, false. + */ + execute(text: string, replaceText: string, matchCase: boolean): boolean; +} +/** + * A command to search for a specific text and replace the next match in the document with the specified string. + */ +interface ReplaceNextCommand extends CommandWithSimpleStateBase { + /** + * Executes the ReplaceNextCommand command by applying the specified settings. 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 text A string value specifying text to replace. + * @param replaceText A string value specifying replacing text. + * @param matchCase true, to perform a case-sensitive search; otherwise, false. + */ + execute(text: string, replaceText: string, matchCase: boolean): boolean; +} +/** + * A command to cancel changes caused by the previous command. + */ +interface UndoCommand extends CommandWithSimpleStateBase { + /** + * Executes the UndoCommand 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. + */ + execute(): boolean; +} +/** + * A command to reverse actions of the previous undo command. + */ +interface RedoCommand extends CommandWithSimpleStateBase { + /** + * Executes the RedoCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Hyperlink dialog. + */ +interface OpenInsertHyperlinkDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenInsertHyperlinkDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a hyperlink at the current position in the document. + */ +interface InsertHyperlinkCommand extends CommandBase { + /** + * Executes the InsertHyperlinkCommand command by applying the specified setting. 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 settings A HyperLinkSettings object specifying hyperlink settings. + */ + execute(settings: HyperlinkSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to delete the selected hyperlink. + */ +interface DeleteHyperlinkCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteHyperlinkCommand 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. + */ + execute(): boolean; +} +/** + * A command to delete all hyperlinks in a selected range. + */ +interface DeleteHyperlinksCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteHyperlinksCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the document bookmark or URI (uniform resource identifier) specified for the hyperlink. + */ +interface OpenHyperlinkCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenHyperlinkCommand 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. + */ + execute(): boolean; +} +/** + * Contains settings to define hyperlinks. + */ +interface HyperlinkSettings { + /** + * Gets or sets a text displayed for a hyperlink. + * Value: A string value specifying the hyperlink display text. + */ + text: string; + /** + * Gets or sets a text for the tooltip displayed when the mouse hovers over a hyperlink. + * Value: A string containing the tooltip text. + */ + tooltip: string; + /** + * Gets or sets the hyperlink destination. + * Value: A string value that specifies the destination to which a hyperlink refers. + */ + url: string; + /** + * Gets or sets the associated bookmak. + * Value: A string value specifying the bookmark name. + */ + bookmark: string; +} +/** + * A command to insert a page break at the current position in the document. + */ +interface InsertPageBreakCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertPageBreakCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a column break at the current position in the document. + */ +interface InsertColumnBreakCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertColumnBreakCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a section break and start a new section on the next page. + */ +interface InsertSectionBreakNextPageCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertSectionBreakNextPageCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a section break and start a new section on the next even-numbered page. + */ +interface InsertSectionBreakEvenPageCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertSectionBreakEvenPageCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a section break and start a new section on the next odd-numbered page. + */ +interface InsertSectionBreakOddPageCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertSectionBreakOddPageCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert the line break at the current position in the document. + */ +interface InsertLineBreakCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertLineBreakCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle between the bulleted paragraph and normal text. + */ +interface ToggleBulletedListCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleBulletedListCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle between the numbered paragraph and normal text. + */ +interface ToggleNumberingListCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleNumberingListCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle between the multilevel list style and normal text. + */ +interface ToggleMultilevelListCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleMultilevelListCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Bulleted and Numbering dialog. + */ +interface OpenNumberingListDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenNumberingListDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Customize Numbered List dialog. + */ +interface OpenCustomNumberingListDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenCustomNumberingListDialogCommand command by applying the specified setting. 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 abstractNumberingListIndex An integer value specifying index of abstract numbering list. + */ + execute(abstractNumberingListIndex: number): boolean; +} +/** + * A command to customize the numbered list parameters. + */ +interface ChangeCustomNumberingListCommand extends CommandBase { + /** + * Executes the ChangeCustomNumberingListCommand command by applying the specified settings. 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 abstractNumberingListIndex An integer value specifying the numbering list index. + * @param listLevelSettings An array of ListLevelSettings objects defining settings for list levels. + */ + execute(abstractNumberingListIndex: number, listLevelSettings: ListLevelSettings[]): boolean; + /** + * Gets information about the command state. + * @param abstractNumberingListIndex An integer value specifying the index of the abstract numbering list item whose state to return. + */ + getState(abstractNumberingListIndex: number): any; +} +/** + * A command to restart the numbering list. + */ +interface RestartNumberingListCommand extends CommandWithSimpleStateBase { + /** + * Executes the RestartNumberingListCommand 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. + */ + execute(): boolean; +} +/** + * A command to increment the indent level of paragraphs in a selected numbered list. + */ +interface IncrementNumberingIndentCommand extends CommandWithSimpleStateBase { + /** + * Executes the IncrementNumberingIndentCommand 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. + */ + execute(): boolean; +} +/** + * A command to decrement the indent level of paragraphs in a selected numbered list. + */ +interface DecrementNumberingIndentCommand extends CommandWithSimpleStateBase { + /** + * Executes the DecrementNumberingIndentCommand 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. + */ + execute(): boolean; +} +/** + * A command to continue the list's numbering. + */ +interface ContinueNumberingListCommand extends CommandWithSimpleStateBase { + /** + * Executes the ContinueNumberingListCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert numeration to a paragraph making it a numbering list item. + */ +interface InsertNumerationCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertNumerationCommand command by applying the specified setting. 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 abstractNumberingListIndex An integer value specifying index of abstract numbering list. + */ + execute(abstractNumberingListIndex: number): boolean; + /** + * Executes the InsertNumerationCommand command by applying the specified settings. 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 numberingListIndex An integer value specifying index of numbering list. + * @param isAbstractNumberingList true, to insert an abstract numbering list; otherwise, false. + */ + execute(numberingListIndex: number, isAbstractNumberingList: boolean): boolean; +} +/** + * A command to remove the selected numeration. + */ +interface RemoveNumerationCommand extends CommandWithSimpleStateBase { + /** + * Executes the RemoveNumerationCommand 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. + */ + execute(): boolean; +} +/** + * Contains settings to define individual bulleted or numbered list levels. + */ +interface ListLevelSettings { + /** + * Gets or sets the pattern used to format the list level for display purposes. + * Value: A string value specifying the format pattern. + */ + displayFormatString: string; + /** + * Gets or sets the numbering format used for the current list level's paragraph. + * Value: One of the values. + */ + format: any; + /** + * Gets the list level item's start position in the document. + * Value: An integer value specifying the start position. + */ + start: number; + /** + * Gets or sets the paragraph text alignment within numbered list levels. + * Value: One of the values. + */ + alignment: any; + separator: string; + /** + * Gets or sets the left indent for text within the current list level's paragraph. + * Value: An integer value specifying the left indent. + */ + leftIndent: number; + /** + * Gets or sets a value specifying the indent of the first line of the current list level's paragraph. + * Value: An integer value specifying the indent. + */ + firstLineIndent: number; + /** + * Gets or sets a value specifying whether and how the first line of the current list level's paragraph is indented. + * Value: One of the values. + */ + firstLineIndentType: any; + /** + * Gets or sets the font name of the current list level's paragraph. + * Value: A string value specifying the font name. + */ + fontName: string; + /** + * Gets or sets the font color of the current list level's paragraph. + * Value: A string value specifying the font color. + */ + fontColor: string; + /** + * Gets or sets the font size of the current list level's paragraph. + * Value: An integer value specifying the font size. + */ + fontSize: number; + /** + * Gets or sets whether the font formatting of the current list level's paragraph is bold. + * Value: true, if the font formatting is bold; otherwise, false. + */ + fontBold: boolean; + /** + * Gets or sets whether the font formatting of the current list level's paragraph is italic. + * Value: true, if the font formatting is italic; otherwise, false. + */ + fontItalic: boolean; +} +declare enum ListLevelFormat { + Decimal=0, + AIUEOHiragana=1, + AIUEOFullWidthHiragana=2, + ArabicAbjad=3, + ArabicAlpha=4, + Bullet=5, + CardinalText=6, + Chicago=7, + ChineseCounting=8, + ChineseCountingThousand=9, + ChineseLegalSimplified=10, + Chosung=11, + DecimalEnclosedCircle=12, + DecimalEnclosedCircleChinese=13, + DecimalEnclosedFullstop=14, + DecimalEnclosedParentheses=15, + DecimalFullWidth=16, + DecimalFullWidth2=17, + DecimalHalfWidth=18, + DecimalZero=19, + Ganada=20, + Hebrew1=21, + Hebrew2=22, + Hex=23, + HindiConsonants=24, + HindiDescriptive=25, + HindiNumbers=26, + HindiVowels=27, + IdeographDigital=28, + IdeographEnclosedCircle=29, + IdeographLegalTraditional=30, + IdeographTraditional=31, + IdeographZodiac=32, + IdeographZodiacTraditional=33, + Iroha=34, + IrohaFullWidth=35, + JapaneseCounting=36, + JapaneseDigitalTenThousand=37, + JapaneseLegal=38, + KoreanCounting=39, + KoreanDigital=40, + KoreanDigital2=41, + KoreanLegal=42, + LowerLetter=43, + LowerRoman=44, + None=45, + NumberInDash=46, + Ordinal=47, + OrdinalText=48, + RussianLower=49, + RussianUpper=50, + TaiwaneseCounting=51, + TaiwaneseCountingThousand=52, + TaiwaneseDigital=53, + ThaiDescriptive=54, + ThaiLetters=55, + ThaiNumbers=56, + UpperLetter=57, + UpperRoman=58, + VietnameseDescriptive=59 +} +declare enum ListLevelNumberAlignment { + Left=0, + Center=1, + Right=2 +} +/** + * A command to invoke the Insert Image dialog. + */ +interface OpenInsertPictureDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenInsertPictureDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a picture from a file. + */ +interface InsertPictureCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertPictureCommand command by applying the specified setting. 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 imageUrl A string value specifying picture's Url. + */ + execute(imageUrl: string): boolean; +} +/** + * A command to invoke the Symbols dialog. + */ +interface OpenInsertSymbolDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenInsertSymbolDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a character into the document. + */ +interface InsertSymbolCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertSymbolCommand command by applying the specified settings. 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 symbol A string value specifying symbols to insert. + * @param fontName A string value specifying font of symbols to insert. + */ + execute(symbol: string, fontName: string): boolean; +} +/** + * A command to insert a paragraph break at the current position in the document. + */ +interface InsertParagraphCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertParagraphCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert text at the current position in the document. + */ +interface InsertTextCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTextCommand command by applying the specified setting. 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 text A string value specifying text to insert. + */ + execute(text: string): boolean; +} +/** + * A command to delete the text in a selected range. + */ +interface DeleteCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteCommand 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. + */ + execute(): boolean; +} +interface RemovePrevWordCommand extends CommandWithSimpleStateBase { + execute(): boolean; +} +interface RemoveNextWordCommand extends CommandWithSimpleStateBase { + execute(): boolean; +} +/** + * A command to move the cursor backwards and erase the character in that space. + */ +interface BackspaceCommand extends CommandWithSimpleStateBase { + /** + * Executes the BackspaceCommand 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. + */ + execute(): boolean; +} +/** + * A command to scale pictures in a selected range. + */ +interface ChangePictureScaleCommand extends CommandBase { + /** + * Executes the ChangePictureScaleCommand command by applying the specified setting. 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 scale A Scale object specifying scaling of the picture. + */ + execute(scale: Scale): boolean; + /** + * Executes the ChangePictureScaleCommand command by applying the specified settings. 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 x An interger number specifying width of the picture + * @param y An interger number specifying height of the picture + */ + execute(x: number, y: number): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to move the selected range to a specific position in the document. + */ +interface MoveContentCommand extends CommandWithSimpleStateBase { + /** + * Executes the MoveContentCommand command by applying the specified setting. 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 position An integer value specifying position to insert selected text. + */ + execute(position: number): boolean; +} +/** + * A command to copy the selected text and place it to the specified position. + */ +interface CopyContentCommand extends CommandWithSimpleStateBase { + /** + * Executes the CopyContentCommand command by applying the specified setting. 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 position An integer number value specifying position for pasting selected text. + */ + execute(position: number): boolean; +} +/** + * A command to insert a tab character at the current position in the document. + */ +interface InsertTabCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTabCommand 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. + */ + execute(): boolean; +} +/** + * Defines the scaling settings. + */ +interface Scale { + x: number; + y: number; +} +/** + * A command to change page margin settings. + */ +interface ChangePageMarginsCommand extends CommandBase { + /** + * Executes the ChangePageMarginsCommand command by applying the specified settings. 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 left An integer number specifying left margin of the page. + * @param top An integer number specifying top margin of the page. + * @param right An integer number specifying right margin of the page. + * @param bottom An integer number specifying bottom margin of the page. + */ + execute(left: number, top: number, right: number, bottom: number): boolean; + /** + * Executes the ChangePageMarginsCommand command by applying the specified setting. 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 margins A Margins object specifying page margin settings. + */ + execute(margins: Margins): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to invoke the Margins tab of the Page Setup dialog. + */ +interface OpenPageMarginsDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenPageMarginsDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the page orientation. + */ +interface ChangePageOrientationCommand extends CommandBase { + /** + * + * @param isPortrait + */ + execute(isPortrait: any): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to invoke the Paper tab of the Page Setup dialog. + */ +interface OpenPagePaperSizeDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenPagePaperSizeDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to set the page size. + */ +interface SetPageSizeDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the SetPageSizeDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the page size. + */ +interface ChangePageSizeCommand extends CommandBase { + /** + * Executes the ChangePageSizeCommand command by applying the specified settings. 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 width An integer number specifying width of the page. + * @param height An integer number specifying height of the page. + */ + execute(width: number, height: number): boolean; + /** + * Executes the ChangePageSizeCommand command by applying the specified setting. 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 size A Size object specifying the page size settings. + */ + execute(size: Size): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the number of section columns having the same width. + */ +interface ChangeSectionEqualColumnCountCommand extends CommandBase { + /** + * Executes the ChangeSectionEqualColumnCountCommand command by applying the specified setting. 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 columnCount An interger number specifying the number of section columns having the same width. + */ + execute(columnCount: number): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to invoke the Columns dialog. + */ +interface OpenSectionColumnsDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenSectionColumnsDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the settings of individual section columns. + */ +interface ChangeSectionColumnsCommand extends CommandBase { + /** + * + * @param columns + */ + execute(columns: SectionColumn[]): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the background color of the page. + */ +interface ChangePageColorCommand extends CommandBase { + /** + * Executes the ChangePageColorCommand command by applying the specified setting. 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 color A string specifying background color of the page. May be specified as color name or hex color value. + */ + execute(color: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to activate the page header and begin editing. + */ +interface InsertHeaderCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertHeaderCommand 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. + */ + execute(): boolean; +} +/** + * A command to activate the page footer and begin editing. + */ +interface InsertFooterCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertFooterCommand 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. + */ + execute(): boolean; +} +/** + * A command to link a header/footer to the previous section, so it has the same content. + */ +interface LinkHeaderFooterToPreviousCommand extends CommandWithSimpleStateBase { + /** + * Executes the LinkHeaderFooterToPreviousCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the page footer from the page header in the header/footer editing mode. + */ +interface GoToFooterCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToFooterCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the page header from the page footer in the header/footer editing mode. + */ +interface GoToHeaderCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToHeaderCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the next page header or footer in the header/footer editing mode. + */ +interface GoToNextHeaderFooterCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToNextHeaderFooterCommand 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. + */ + execute(): boolean; +} +/** + * A command to navigate to the previous page header or footer in the header/footer editing mode. + */ +interface GoToPreviousHeaderFooterCommand extends CommandWithSimpleStateBase { + /** + * Executes the GoToPreviousHeaderFooterCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the header/footer edit mode, so it allows creation of a different header or footer for the first page of a document or section. + */ +interface SetDifferentFirstPageHeaderFooterCommand extends CommandWithBooleanStateBase { + /** + * Executes the SetDifferentFirstPageHeaderFooterCommand 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. + */ + execute(): boolean; + /** + * Executes the SetDifferentFirstPageHeaderFooterCommand command by applying the specified setting. 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 differentFirstPage true to apply different text for first page's header and footer, false to remove difference. + */ + execute(differentFirstPage: boolean): boolean; +} +/** + * A command to change the header/footer edit mode so it allows creation of a different header or footer for odd and even pages of a document or section. + */ +interface SetDifferentOddAndEvenPagesHeaderFooterCommand extends CommandWithBooleanStateBase { + /** + * Executes the SetDifferentOddAndEvenPagesHeaderFooterCommand 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. + */ + execute(): boolean; + /** + * Executes the SetDifferentOddAndEvenPagesHeaderFooterCommand command by applying the specified setting. 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 differentOddAndEvenPages true to apply different text for odd and even pages' header and footer, false to remove difference. + */ + execute(differentOddAndEvenPages: boolean): boolean; +} +/** + * A command to finish header/footer editing. + */ +interface CloseHeaderFooterCommand extends CommandWithSimpleStateBase { + /** + * Executes the CloseHeaderFooterCommand 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. + */ + execute(): boolean; +} +/** + * Defines a section column in the document. + */ +interface SectionColumn { + /** + * Gets or sets the width of the section column. + * Value: An integer value specifying the section column width. + */ + width: number; + /** + * Gets or sets the amount of space between adjacent section columns. + * Value: An integer value specifying the spacing between section columns. + */ + spacing: number; +} +/** + * Defines the size settings. + */ +interface Size { + /** + * Gets or sets the width value. + * Value: An integer value specifying the width. + */ + width: number; + /** + * Gets or sets the height value. + * Value: An integer value specifying the height. + */ + height: number; +} +/** + * Defines the margin settings. + */ +interface Margins { + /** + * Gets or sets the left margin. + * Value: An integer value specifying the left margin. + */ + left: number; + /** + * Gets or sets the top margin. + * Value: An integer value specifying the top margin. + */ + top: number; + /** + * Gets or sets the right margin. + * Value: An integer value specifying the right margin. + */ + right: number; + /** + * Gets or sets the bottom margin. + * Value: An integer value specifying the bottom margin. + */ + bottom: number; +} +declare enum Orientation { + Landscape=0, + Portrait=1 +} +/** + * A command to increment the indent level of paragraphs in a selected range. + */ +interface IncreaseIndentCommand extends CommandWithSimpleStateBase { + /** + * Executes the IncreaseIndentCommand 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. + */ + execute(): boolean; +} +/** + * A command to decrement the indent level of paragraphs in a selected range. + */ +interface DecreaseIndentCommand extends CommandWithSimpleStateBase { + /** + * Executes the DecreaseIndentCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle the visibility of hidden symbols. + */ +interface ShowHiddenSymbolsCommand extends CommandWithBooleanStateBase { + /** + * Executes the ShowHiddenSymbolsCommand 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. + */ + execute(): boolean; + /** + * Executes the ShowHiddenSymbolsCommand command by applying the specified setting. 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 show true to display hidden symbols; otherwise, false. + */ + execute(show: boolean): boolean; +} +/** + * A command to toggle left paragraph alignment on and off. + */ +interface ToggleParagraphAlignmentLeftCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleParagraphAlignmentLeftCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle centered paragraph alignment on and off. + */ +interface ToggleParagraphAlignmentCenterCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleParagraphAlignmentCenterCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle right paragraph alignment on and off. + */ +interface ToggleParagraphAlignmentRightCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleParagraphAlignmentRightCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle justified paragraph alignment on and off. + */ +interface ToggleParagraphAlignmentJustifyCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleParagraphAlignmentJustifyCommand 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. + */ + execute(): boolean; +} +/** + * A command to format a current paragraph with single line spacing. + */ +interface SetSingleParagraphSpacingCommand extends CommandWithBooleanStateBase { + /** + * Executes the SetSingleParagraphSpacingCommand 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. + */ + execute(): boolean; +} +/** + * A command to format a current paragraph with one and a half line spacing. + */ +interface SetSesquialteralParagraphSpacingCommand extends CommandWithBooleanStateBase { + /** + * Executes the SetSesquialteralParagraphSpacingCommand 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. + */ + execute(): boolean; +} +/** + * A command to format a current paragraph with double line spacing. + */ +interface SetDoubleParagraphSpacingCommand extends CommandWithBooleanStateBase { + /** + * Executes the SetDoubleParagraphSpacingCommand 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. + */ + execute(): boolean; +} +/** + * A command to add spacing before a paragraph. + */ +interface AddSpacingBeforeParagraphCommand extends CommandWithSimpleStateBase { + /** + * Executes the AddSpacingBeforeParagraphCommand 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. + */ + execute(): boolean; +} +/** + * A command to add spacing after a paragraph. + */ +interface AddSpacingAfterParagraphCommand extends CommandWithSimpleStateBase { + /** + * Executes the AddSpacingAfterParagraphCommand 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. + */ + execute(): boolean; +} +/** + * A command to remove spacing before the selected paragraph. + */ +interface RemoveSpacingBeforeParagraphCommand extends CommandWithSimpleStateBase { + /** + * Executes the RemoveSpacingBeforeParagraphCommand 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. + */ + execute(): boolean; +} +/** + * A command to remove spacing after the selected paragraph. + */ +interface RemoveSpacingAfterParagraphCommand extends CommandWithSimpleStateBase { + /** + * Executes the RemoveSpacingAfterParagraphCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the background color of paragraphs in a selected range. + */ +interface ChangeParagraphBackColorCommand extends CommandBase { + /** + * Executes the ChangeParagraphBackColorCommand command by applying the specified setting. 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 color A string specifying highlighting color of the paragraphs in a selected range. May be specified as color name or hex color value. + */ + execute(color: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to invoke the Paragraph dialog allowing end-users to set paragraph formatting. + */ +interface OpenParagraphFormattingDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenParagraphFormattingDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the formatting of paragraphs in a selected range. + */ +interface ChangeParagraphFormattingCommand extends CommandBase { + /** + * Executes the ChangeParagraphFormattingCommand command by applying the specified setting. 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 settings A ParagraphFormattingSettings object specifying paragraph formatting settings. + */ + execute(settings: ParagraphFormattingSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to increment the left indentation of paragraphs in a selected range. + */ +interface IncrementParagraphLeftIndentCommand extends CommandWithSimpleStateBase { + /** + * Executes the IncrementParagraphLeftIndentCommand 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. + */ + execute(): boolean; +} +/** + * A command to decrement the left indentation of paragraphs in a selected range. + */ +interface DecrementParagraphLeftIndentCommand extends CommandWithSimpleStateBase { + /** + * Executes the DecrementParagraphLeftIndentCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Tabs paragraph dialog. + */ +interface OpenTabsDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenTabsDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to change paragraph tab stops. + */ +interface ChangeTabsCommand extends CommandBase { + /** + * Executes the ChangeTabsCommand command by applying the specified setting. 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 settings A TabsSettings object maintaining the information about tab stops. + */ + execute(settings: TabsSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * Contains the information about tab stops. + */ +interface TabsSettings { + /** + * Gets or sets the default tab stop value. + * Value: An integer value specifying the default tab stop. + */ + defaultTabStop: number; + /** + * Gets or sets a list of tab stops. + * Value: An array of TabSettings objects containing individual tab stop settings. + */ + tabs: TabSettings[]; +} +/** + * Contains settings of a tab stop. + */ +interface TabSettings { + /** + * Gets or sets the alignment type, specifying how any text after the tab will be lined up. + * Value: One of the values. + */ + alignment: any; + /** + * Gets or sets the tab leader style, i.e., the symbol used as a tab leader. + * Value: One of the values. + */ + leader: any; + /** + * Gets or sets the position of the tab stop. + * Value: A number representing the distance from the left edge of the text area. + */ + position: number; + /** + * Gets or sets whether the individual tab stop is in effect. + * Value: true to switch off this tab stop; otherwise, false. + */ + deleted: boolean; +} +declare enum TabAlign { + Left=0, + Center=1, + Right=2, + Decimal=3 +} +declare enum TabLeaderType { + None=0, + Dots=1, + MiddleDots=2, + Hyphens=3, + Underline=4, + ThickLine=5, + EqualSign=6 +} +/** + * Contains settings to define the paragraph formatting. + */ +interface ParagraphFormattingSettings { + /** + * Gets or sets the paragraph alignment. + * Value: One of the values. + */ + alignment: any; + /** + * Gets or sets the outline level of a paragraph. + * Value: An integer specifying the level number. + */ + outlineLevel: number; + /** + * Gets or sets the right indent value for the specified paragraph. + * Value: An integer value specifying the right indent. + */ + rightIndent: number; + /** + * Gets or sets the spacing before the current paragraph. + * Value: An integer value specifying the spacing before the paragraph. + */ + spacingBefore: number; + /** + * Gets or sets the spacing after the current paragraph. + * Value: An integer value specifying the spacing after the paragraph. + */ + spacingAfter: number; + /** + * Gets or sets a value which determines the spacing between lines in a paragraph. + * Value: One of the values. + */ + lineSpacingType: any; + /** + * Gets or sets a value specifying whether and how the first line of a paragraph is indented. + * Value: One of the values. + */ + firstLineIndentType: any; + /** + * Gets or sets a value specifying the indent of the first line of a paragraph. + * Value: An integer value specifying the indent of the first line. + */ + firstLineIndent: number; + /** + * Gets or sets whether to suppress addition of additional space (contextual spacing) between paragraphs of the same style. + * Value: true to remove extra spacing between paragraphs, false to add extra space. + */ + contextualSpacing: boolean; + /** + * Gets or sets whether to prevent all page breaks that interrupt a paragraph. + * Value: true, to keep paragraph lines together; otherwise, false. + */ + keepLinesTogether: boolean; + /** + * Gets or sets whether a page break is inserted automatically before a specified paragraph(s). + * Value: true, if a page break is inserted automatically before a paragraph(s); otherwise, false. + */ + pageBreakBefore: boolean; + /** + * Gets or sets the left indent for text within a paragraph. + * Value: An integer value specifying the left indent. + */ + leftIndent: number; + /** + * Gets or sets a line spacing value. + * Value: An integer value specifying the line spacing. + */ + lineSpacing: number; + /** + * Gets or sets the paragraph background color. + * Value: A string value specifying the background color. + */ + backColor: string; +} +declare enum ParagraphAlignment { + Left=0, + Right=1, + Center=2, + Justify=3 +} +declare enum ParagraphLineSpacingType { + Single=0, + Sesquialteral=1, + Double=2, + Multiple=3, + Exactly=4, + AtLeast=5 +} +declare enum ParagraphFirstLineIndent { + None=0, + Indented=1, + Hanging=2 +} +interface AssignShortcutCommand extends CommandWithSimpleStateBase { + /** + * + * @param keyCode + * @param callback + */ + execute(keyCode: number, callback: (arg1: string) => void): boolean; +} +interface OpenSpellingDialogCommand extends CommandWithSimpleStateBase { + execute(): boolean; +} +/** + * A command to invoke the Insert Table dialog. + */ +interface OpenInsertTableDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenInsertTableDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Insert Table dialog. + */ +interface InsertTableCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableCommand command by applying the specified settings. 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 columnCount An integer value specifying number of columns in a generated table. + * @param rowCount An integer value specifying number of rows in a generated table. + */ + execute(columnCount: number, rowCount: number): boolean; +} +/** + * A command to invoke the Table Properties dialog. + */ +interface OpenTableFormattingDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenTableFormattingDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the selected table's formatting. + */ +interface ChangeTableFormattingCommand extends CommandBase { + /** + * Executes the ChangeTableFormattingCommand command by applying the specified setting. 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 settings A TableFormattingSettings object containing the settings to format a table. + */ + execute(settings: TableFormattingSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the selected table's preferred row height. + */ +interface ChangeTableRowPreferredHeightCommand extends CommandBase { + /** + * Executes the ChangeTableRowPreferredHeightCommand command by applying the specified setting. 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 preferredHeight A TableHeightUnit object specifying preferred height of the selected table rows. + */ + execute(preferredHeight: TableHeightUnit): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the preferred cell width of the selected table rows. + */ +interface ChangeTableCellPreferredWidthCommand extends CommandBase { + /** + * Executes the ChangeTableCellPreferredWidthCommand command by applying the specified setting. 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 preferredWidth A TableWidthUnit object specifying preferred width of the selected table rows. + */ + execute(preferredWidth: TableWidthUnit): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the selected table's preferred column width. + */ +interface ChangeTableColumnPreferredWidthCommand extends CommandBase { + /** + * Executes the ChangeTableColumnPreferredWidthCommand command by applying the specified setting. 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 preferredWidth A TableWidthUnit object specifying preferred width of the selected table columns. + */ + execute(preferredWidth: TableWidthUnit): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the cell formatting of the selected table elements. + */ +interface ChangeTableCellFormattingCommand extends CommandBase { + /** + * Executes the ChangeTableCellFormattingCommand command by applying the specified setting. 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 settings A TableFormattingSettings object specifying cell formatting of the selected table elements. + */ + execute(settings: TableCellFormattingSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to insert a table column to the left of the current position in the table. + */ +interface InsertTableColumnToTheLeftCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableColumnToTheLeftCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a table column to the right of the current position in the table. + */ +interface InsertTableColumnToTheRightCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableColumnToTheRightCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a row in a table below the selected row. + */ +interface InsertTableRowBelowCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableRowBelowCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert a row in a table above the selected row. + */ +interface InsertTableRowAboveCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableRowAboveCommand 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. + */ + execute(): boolean; +} +/** + * A command to delete the selected table rows. + */ +interface DeleteTableRowsCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteTableRowsCommand 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. + */ + execute(): boolean; +} +/** + * A command to delete the selected table columns. + */ +interface DeleteTableColumnsCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteTableColumnsCommand 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. + */ + execute(): boolean; +} +/** + * A command to insert table cells with a horizontal shift into the selected table. + */ +interface InsertTableCellWithShiftToTheLeftCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableCellWithShiftToTheLeftCommand 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. + */ + execute(): boolean; +} +/** + * A command to delete the selected table cells with a horizontal shift. + */ +interface DeleteTableCellsWithShiftHorizontallyCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteTableCellsWithShiftHorizontallyCommand 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. + */ + execute(): boolean; +} +/** + * A command to delete the selected table cells with a vertical shift. + */ +interface DeleteTableCellsWithShiftVerticallyCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteTableCellsWithShiftVerticallyCommand 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. + */ + execute(): boolean; +} +/** + * A command to delete the selected table. + */ +interface DeleteTableCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteTableCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Insert Cells dialog. + */ +interface InsertTableCellsDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableCellsDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Delete Cells dialog. + */ +interface DeleteTableCellsDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the DeleteTableCellsDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to merge the selected table cells. + */ +interface MergeTableCellsCommand extends CommandWithSimpleStateBase { + /** + * Executes the MergeTableCellsCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Split Cells dialog. + */ +interface SplitTableCellsDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the SplitTableCellsDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to split the selected table cells based on the specified options. + */ +interface SplitTableCellsCommand extends CommandWithSimpleStateBase { + /** + * Executes the SplitTableCellsCommand command by applying the specified settings. 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 rowCount An integer value specifying number of rows in the splitted table cells. + * @param columnCount An integer value specifying number of columns in the splitted table cells. + * @param mergeBeforeSplit true to merge the selected cells before splitting; otherwise, false. + */ + execute(rowCount: number, columnCount: number, mergeBeforeSplit: boolean): boolean; +} +/** + * A command to insert table cells with a vertical shift into the selected table. + */ +interface InsertTableCellsWithShiftToTheVerticallyCommand extends CommandWithSimpleStateBase { + /** + * Executes the InsertTableCellsWithShiftToTheVerticallyCommand 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. + */ + execute(): boolean; +} +/** + * A command to invoke the Borders and Shading table dialog. + */ +interface OpenTableBordersAndShadingDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenTableBordersAndShadingDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to change borders and shading of the selected table elements. + */ +interface ChangeTableBordersAndShadingCommand extends CommandBase { + /** + * Executes the ChangeTableBordersAndShadingCommand command by applying the specified settings. 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 settings A TableBorderSettings object with settings specifying table borders. + * @param applyToWholeTable true to apply the border settings to the whole table, false to apply the border settings to the selected cells. + */ + execute(settings: TableBordersSettings, applyToWholeTable: boolean): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to apply top-left alignment for the selected table cells. + */ +interface ToggleTableCellAlignTopLeftCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignTopLeftCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply top-center alignment for the selected table cells. + */ +interface ToggleTableCellAlignTopCenterCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignTopCenterCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply top-right alignment for the selected table cells. + */ +interface ToggleTableCellAlignTopRightCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignTopRightCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply middle-left alignment for the selected table cells. + */ +interface ToggleTableCellAlignMiddleLeftCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignMiddleLeftCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply middle-center alignment for the selected table cells. + */ +interface ToggleTableCellAlignMiddleCenterCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignMiddleCenterCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply middle-right alignment for the selected table cells. + */ +interface ToggleTableCellAlignMiddleRightCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignMiddleRightCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply bottom-left alignment for the selected table cells. + */ +interface ToggleTableCellAlignBottomLeftCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignBottomLeftCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply bottom-center alignment for the selected table cells. + */ +interface ToggleTableCellAlignBottomCenterCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignBottomCenterCommand 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. + */ + execute(): boolean; +} +/** + * A command to apply bottom-right alignment for the selected table cells. + */ +interface ToggleTableCellAlignBottomRightCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAlignBottomRightCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the selected table's style. + */ +interface ChangeTableStyleCommand extends CommandBase { + /** + * Executes the ChangeTableStyleCommand command by applying the specified setting. 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 style A TableStyle object specifying the style applying to the table. + */ + execute(style: TableStyle): boolean; + /** + * Executes the ChangeTableStyleCommand command by applying the specified setting. 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 styleName A string specifying the name of style applying to the table. + */ + execute(styleName: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to toggle top borders for selected cells on/off. + */ +interface ToggleTableCellTopBorderCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellTopBorderCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle right borders for selected cells on/off. + */ +interface ToggleTableCellRightBorderCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellRightBorderCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle bottom borders for selected cells on/off. + */ +interface ToggleTableCellBottomBorderCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellBottomBorderCommand 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. + */ + execute(): boolean; +} +interface ToggleTableCellLeftBorderCommand extends CommandWithBooleanStateBase { + execute(): boolean; +} +/** + * A command to remove the borders of the selected table cells. + */ +interface RemoveTableCellBordersCommand extends CommandWithSimpleStateBase { + /** + * Executes the RemoveTableCellBordersCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle all borders for selected cells on/off. + */ +interface ToggleTableCellAllBordersCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellAllBordersCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle inner borders for selected cells on/off. + */ +interface ToggleTableCellInsideBordersCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellInsideBordersCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle inner horizontal borders for selected cells on/off. + */ +interface ToggleTableCellInsideHorizontalBordersCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellInsideHorizontalBordersCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle inner vertical borders for selected cells on/off. + */ +interface ToggleTableCellInsideVerticalBordersCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellInsideVerticalBordersCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle outer borders for selected cells on/off. + */ +interface ToggleTableCellOutsideBordersCommand extends CommandWithBooleanStateBase { + /** + * Executes the ToggleTableCellOutsideBordersCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the selected table's style options. + */ +interface ChangeTableLookCommand extends CommandBase { + /** + * Executes the ChangeTableLookCommand command by applying the specified setting. 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 settings A TableLookSettings object containing the settings that modify the table appearance. + */ + execute(settings: TableLookSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the repository item's table border style. + */ +interface ChangeTableBorderRepositoryItemCommand extends CommandBase { + /** + * Executes the ChangeTableBorderRepositoryItemCommand command by applying the specified setting. 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 settings A TableBorderSettings object specifying the repository item's table border style. + */ + execute(settings: TableBorderSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change cell shading in the selected table elements. + */ +interface ChangeTableCellShadingCommand extends CommandBase { + /** + * Executes the ChangeTableCellShadingCommand command by applying the specified setting. 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 color A string specifying color of the selected cells' shading. May be specified as color name or hex color value. + */ + execute(color: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to toggle the display of grid lines for a table with no borders applied - on/off. + */ +interface ShowTableGridLinesCommand extends CommandWithBooleanStateBase { + /** + * Executes the ShowTableGridLinesCommand 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. + */ + execute(): boolean; + /** + * Executes the ShowTableGridLinesCommand command by applying the specified setting. 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 showTableGridLines true to display grid lines of the table, false to hide grid lines of the table. + */ + execute(showTableGridLines: boolean): boolean; +} +/** + * Contains the table style settings that modify the table appearance. + */ +interface TableLookSettings { + /** + * Gets or sets a value specifying whether special formatting is applied to the first row of the table. + * Value: true, to apply the formatting; otherwise, false. + */ + applyFirstRow: boolean; + /** + * Gets or sets a value specifying whether special formatting is applied to the last row of the table. + * Value: true, to apply the formatting; otherwise, false. + */ + applyLastRow: boolean; + /** + * Gets or sets a value specifying whether special formatting is applied to the first column of the table. + * Value: true, to apply the formatting; otherwise, false. + */ + applyFirstColumn: boolean; + /** + * Gets or sets a value specifying whether special formatting is applied to the last column of the table. + * Value: true, to apply the formatting; otherwise, false. + */ + applyLastColumn: boolean; + /** + * Gets or sets a value specifying whether row banding formatting is not applied to the table. + * Value: true, to apply the formatting; otherwise, false. + */ + doNotApplyRowBanding: boolean; + /** + * Gets or sets a value specifying whether column banding formatting is not applied to the table. + * Value: true, to apply the formatting; otherwise, false. + */ + doNotApplyColumnBanding: boolean; +} +/** + * Contains settings to define table borders. + */ +interface TableBordersSettings { + /** + * Gets or sets the top border's settings. + * Value: A TableBorderSettings object containing the table border settings. + */ + top: TableBorderSettings; + /** + * Gets or sets the right border's settings. + * Value: A TableBorderSettings object containing the table border settings. + */ + right: TableBorderSettings; + /** + * Gets or sets the bottom border's settings. + * Value: A TableBorderSettings object containing the table border settings. + */ + bottom: TableBorderSettings; + /** + * Gets or sets the left border's settings. + * Value: A TableBorderSettings object containing the table border settings. + */ + left: TableBorderSettings; + /** + * Gets or sets the inside horizontal border's settings. + * Value: A TableBorderSettings object containing the table border settings. + */ + insideHorizontal: TableBorderSettings; + /** + * Gets or sets the inside vertical border's settings. + * Value: A TableBorderSettings object containing the table border settings. + */ + insideVertical: TableBorderSettings; + /** + * Gets or sets the background color of table borders. + * Value: A string value specifying the background color. + */ + backgroundColor: string; +} +/** + * Contains settings to define a table border. + */ +interface TableBorderSettings { + /** + * Gets or sets the border color. + * Value: A string value specifying the border color. + */ + color: string; + /** + * Gets or sets the border line width. + * Value: An integer value defining the border line width. + */ + width: number; + /** + * Gets or sets the border line style. + * Value: A object defining the border line style. + */ + style: any; +} +declare enum BorderLineStyle { + None=0, + Single=1, + Thick=2, + Double=3, + Dotted=4, + Dashed=5, + DotDash=6, + DotDotDash=7, + Triple=8, + ThinThickSmallGap=9, + ThickThinSmallGap=10, + ThinThickThinSmallGap=11, + ThinThickMediumGap=12, + ThickThinMediumGap=13, + ThinThickThinMediumGap=14, + ThinThickLargeGap=15, + ThickThinLargeGap=16, + ThinThickThinLargeGap=17, + Wave=18, + DoubleWave=19, + DashSmallGap=20, + DashDotStroked=21, + ThreeDEmboss=22, + ThreeDEngrave=23, + Outset=24, + Inset=25, + Apples=26, + ArchedScallops=27, + BabyPacifier=28, + BabyRattle=29, + Balloons3Colors=30, + BalloonsHotAir=31, + BasicBlackDashes=32, + BasicBlackDots=33, + BasicBlackSquares=34, + BasicThinLines=35, + BasicWhiteDashes=36, + BasicWhiteDots=37, + BasicWhiteSquares=38, + BasicWideInline=39, + BasicWideMidline=40, + BasicWideOutline=41, + Bats=42, + Birds=43, + BirdsFlight=44, + Cabins=45, + CakeSlice=46, + CandyCorn=47, + CelticKnotwork=48, + CertificateBanner=49, + ChainLink=50, + ChampagneBottle=51, + CheckedBarBlack=52, + CheckedBarColor=53, + Checkered=54, + ChristmasTree=55, + CirclesLines=56, + CirclesRectangles=57, + ClassicalWave=58, + Clocks=59, + Compass=60, + Confetti=61, + ConfettiGrays=62, + ConfettiOutline=63, + ConfettiStreamers=64, + ConfettiWhite=65, + CornerTriangles=66, + CouponCutoutDashes=67, + CouponCutoutDots=68, + CrazyMaze=69, + CreaturesButterfly=70, + CreaturesFish=71, + CreaturesInsects=72, + CreaturesLadyBug=73, + CrossStitch=74, + Cup=75, + DecoArch=76, + DecoArchColor=77, + DecoBlocks=78, + DiamondsGray=79, + DoubleD=80, + DoubleDiamonds=81, + Earth1=82, + Earth2=83, + EclipsingSquares1=84, + EclipsingSquares2=85, + EggsBlack=86, + Fans=87, + Film=88, + Firecrackers=89, + FlowersBlockPrint=90, + FlowersDaisies=91, + FlowersModern1=92, + FlowersModern2=93, + FlowersPansy=94, + FlowersRedRose=95, + FlowersRoses=96, + FlowersTeacup=97, + FlowersTiny=98, + Gems=99, + GingerbreadMan=100, + Gradient=101, + Handmade1=102, + Handmade2=103, + HeartBalloon=104, + HeartGray=105, + Hearts=106, + HeebieJeebies=107, + Holly=108, + HouseFunky=109, + Hypnotic=110, + IceCreamCones=111, + LightBulb=112, + Lightning1=113, + Lightning2=114, + MapleLeaf=115, + MapleMuffins=116, + MapPins=117, + Marquee=118, + MarqueeToothed=119, + Moons=120, + Mosaic=121, + MusicNotes=122, + Northwest=123, + Ovals=124, + Packages=125, + PalmsBlack=126, + PalmsColor=127, + PaperClips=128, + Papyrus=129, + PartyFavor=130, + PartyGlass=131, + Pencils=132, + People=133, + PeopleHats=134, + PeopleWaving=135, + Poinsettias=136, + PostageStamp=137, + Pumpkin1=138, + PushPinNote1=139, + PushPinNote2=140, + Pyramids=141, + PyramidsAbove=142, + Quadrants=143, + Rings=144, + Safari=145, + Sawtooth=146, + SawtoothGray=147, + ScaredCat=148, + Seattle=149, + ShadowedSquares=150, + SharksTeeth=151, + ShorebirdTracks=152, + Skyrocket=153, + SnowflakeFancy=154, + Snowflakes=155, + Sombrero=156, + Southwest=157, + Stars=158, + Stars3d=159, + StarsBlack=160, + StarsShadowed=161, + StarsTop=162, + Sun=163, + Swirligig=164, + TornPaper=165, + TornPaperBlack=166, + Trees=167, + TriangleParty=168, + Triangles=169, + Tribal1=170, + Tribal2=171, + Tribal3=172, + Tribal4=173, + Tribal5=174, + Tribal6=175, + TwistedLines1=176, + TwistedLines2=177, + Vine=178, + Waveline=179, + WeavingAngles=180, + WeavingBraid=181, + WeavingRibbon=182, + WeavingStrips=183, + WhiteFlowers=184, + Woodwork=185, + XIllusions=186, + ZanyTriangles=187, + ZigZag=188, + ZigZagStitch=189, + Nil=-1 +} +/** + * Contains the settings to define the table cell formatting. + */ +interface TableCellFormattingSettings { + /** + * Gets or sets a table cell's preferred width. + * Value: A object specifying the preferred cell width. + */ + preferredWidth: TableWidthUnit; + /** + * Gets or sets the vertical alignment of a table cell's content. + * Value: One the values. + */ + verticalAlignment: any; + /** + * Gets or sets a value specifying whether text is wrapped in a table cell. + * Value: true if text is wrapped; false if text is not wrapped. + */ + noWrap: boolean; + /** + * Gets or sets a table cell's left margin. + * Value: An integer value specifying the left margin. + */ + marginLeft: number; + /** + * Gets or sets a table cell's right margin. + * Value: An integer value specifying the right margin. + */ + marginRight: number; + /** + * Gets or sets a table cell's top margin. + * Value: An integer value specifying the top margin. + */ + marginTop: number; + /** + * Gets or sets a table cell's bottom margin. + * Value: An integer value specifying the bottom margin. + */ + marginBottom: number; + /** + * Gets or sets a value specifying whether a table cell's margins are inherited from the table level settings. + * Value: true to inherit table level margins; false to use a table cell's own margin settings. + */ + marginsSameAsTable: boolean; +} +declare enum TableCellVerticalAlignment { + Top=0, + Both=1, + Center=2, + Bottom=3 +} +/** + * Contains the settings to format a table. + */ +interface TableFormattingSettings { + /** + * Gets or sets the preferred width of cells in the table. + * Value: A object specifying the width. + */ + preferredWidth: TableWidthUnit; + /** + * Gets or sets the alignment of table rows. + * Value: One of the values. + */ + alignment: any; + /** + * Gets or sets the table's left indent. + * Value: An integer value specifying the indent. + */ + indent: number; + /** + * Gets or sets the spacing between table cells. + * Value: An integer value specifying the spacing. + */ + spacingBetweenCells: number; + /** + * Gets or sets a value specifying whether spacing is allowed between table cells. + * Value: true, to allow spacing; otherwise, false. + */ + allowSpacingBetweenCells: boolean; + /** + * Gets or sets a value that specifying whether to allow automatic resizing of table cells to fit their contents. + * Value: true, to allow automatic resizing; otherwise, false. + */ + resizeToFitContent: boolean; + /** + * Gets or sets the default left margin for cells in the table. + * Value: An integer value specifying the margin value. + */ + defaultCellMarginLeft: number; + /** + * Gets or sets the default right margin for cells in the table. + * Value: An integer value specifying the margin value. + */ + defaultCellMarginRight: number; + /** + * Gets or sets the default top margin for cells in the table. + * Value: An integer value specifying the margin value. + */ + defaultCellMarginTop: number; + /** + * Gets or sets the default bottom margin for cells in the table. + * Value: An integer value specifying the margin value. + */ + defaultCellMarginBottom: number; +} +/** + * Contains settings defining the table width's measurement units and value. + */ +interface TableWidthUnit { + /** + * Gets or sets the table width value. + * Value: An integer value specifying the table width. + */ + value: number; + /** + * Gets or sets the unit type for the table width. + * Value: One of the values. + */ + type: any; +} +/** + * Contains settings defining the table height's measurement units and value. + */ +interface TableHeightUnit { + /** + * Gets or sets the table height value. + * Value: An integer value specifying the table height. + */ + value: number; + type: any; +} +declare enum TableHeightUnitType { + Minimum=0, + Auto=1, + Exact=2 +} +declare enum TableRowAlignment { + Both=0, + Center=1, + Distribute=2, + Left=3, + NumTab=4, + Right=5 +} +declare enum TableWidthUnitType { + Nil=0, + Auto=1, + FiftiethsOfPercent=2, + ModelUnits=3 +} +/** + * A command to change the font name of characters in a selected range. + */ +interface ChangeFontNameCommand extends CommandBase { + /** + * Executes the ChangeFontNameCommand command by applying the specified setting. 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 fontName A string specifying font name. + */ + execute(fontName: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the font size of characters in a selected range. + */ +interface ChangeFontSizeCommand extends CommandBase { + /** + * Executes the ChangeFontSizeCommand command by applying the specified setting. 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 fontSize An integer number specifying font size. + */ + execute(fontSize: number): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to increase the font size of characters in a selected range to the closest larger predefined value. + */ +interface IncreaseFontSizeCommand extends CommandWithSimpleStateBase { + /** + * Executes the IncreaseFontSizeCommand 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. + */ + execute(): boolean; +} +/** + * A command to decrease the font size of characters in a selected range to the closest smaller predefined value. + */ +interface DecreaseFontSizeCommand extends CommandWithSimpleStateBase { + /** + * Executes the DecreaseFontSizeCommand 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. + */ + execute(): boolean; +} +/** + * A command to convert the selected text to upper case. + */ +interface MakeTextUpperCaseCommand extends CommandWithSimpleStateBase { + /** + * Executes the MakeTextUpperCaseCommand 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. + */ + execute(): boolean; +} +/** + * A command to convert the selected text to lower case. + */ +interface MakeTextLowerCaseCommand extends CommandWithSimpleStateBase { + /** + * Executes the MakeTextLowerCaseCommand 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. + */ + execute(): boolean; +} +/** + * A command to capitalize each word in the selected sentence. + */ +interface CapitalizeEachWordTextCaseCommand extends CommandWithSimpleStateBase { + /** + * Executes the CapitalizeEachWordTextCaseCommand 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. + */ + execute(): boolean; +} +/** + * A command to toggle the case for each character - upper case becomes lower, lower case becomes upper. + */ +interface ToggleTextCaseCommand extends CommandWithSimpleStateBase { + /** + * Executes the ToggleTextCaseCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the bold formatting of characters in a selected range. + */ +interface ChangeFontBoldCommand extends CommandWithBooleanStateBase { + /** + * Executes the ChangeFontBoldCommand 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. + */ + execute(): boolean; + /** + * Executes the ChangeFontBoldCommand command by applying the specified setting. 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 fontBold true to apply bold formatting to the text, false to remove bold formatting. + */ + execute(fontBold: boolean): boolean; +} +/** + * A command to change the italic formatting of characters in a selected range. + */ +interface ChangeFontItalicCommand extends CommandWithBooleanStateBase { + /** + * Executes the ChangeFontItalicCommand 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. + */ + execute(): boolean; + /** + * Executes the ChangeFontItalicCommand command by applying the specified setting. 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 fontItalic true to apply italic formatting to the text, false to remove italic formatting. + */ + execute(fontItalic: boolean): boolean; +} +/** + * A command to change the underline formatting of characters in a selected range. + */ +interface ChangeFontUnderlineCommand extends CommandWithBooleanStateBase { + /** + * Executes the ChangeFontUnderlineCommand 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. + */ + execute(): boolean; + /** + * Executes the ChangeFontUnderlineCommand command by applying the specified setting. 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 fontUnderline true to apply underline formatting to the text, false to remove underline formatting. + */ + execute(fontUnderline: boolean): boolean; +} +/** + * A command to change the strikeout formatting of characters in a selected range. + */ +interface ChangeFontStrikeoutCommand extends CommandWithBooleanStateBase { + /** + * Executes the ChangeFontStrikeoutCommand 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. + */ + execute(): boolean; + /** + * Executes the ChangeFontStrikeoutCommand command by applying the specified setting. 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 fontStrikeout true to apply strikeout formatting to the text, false to remove strikeout formatting. + */ + execute(fontStrikeout: boolean): boolean; +} +/** + * A command to change the superscript formatting of characters in a selected range. + */ +interface ChangeFontSuperscriptCommand extends CommandWithBooleanStateBase { + /** + * Executes the ChangeFontSuperscriptCommand 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. + */ + execute(): boolean; + /** + * Executes the ChangeFontSuperscriptCommand command by applying the specified setting. 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 fontSuperscript true to apply superscript formatting to the text, false to remove superscript formatting. + */ + execute(fontSuperscript: boolean): boolean; +} +/** + * A command to change the subscript formatting of characters in the selected range. + */ +interface ChangeFontSubscriptCommand extends CommandWithBooleanStateBase { + /** + * Executes the ChangeFontSubscriptCommand 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. + */ + execute(): boolean; + /** + * Executes the ChangeFontSubscriptCommand command by applying the specified setting. 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 fontSubscript true to apply subscript formatting to the text, false to remove subscript formatting. + */ + execute(fontSubscript: boolean): boolean; +} +/** + * A command to change the font color of characters in a selected range. + */ +interface ChangeFontForeColorCommand extends CommandBase { + /** + * Executes the ChangeFontForeColorCommand command by applying the specified setting. 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 color A string specifying font color. May be specified as color name or hex color value. + */ + execute(color: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to change the background color of characters in a selected range. + */ +interface ChangeFontBackColorCommand extends CommandBase { + /** + * Executes the ChangeFontBackColorCommand command by applying the specified setting. 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 color A string specifying highlighting color. May be specified as color name or hex color value. + */ + execute(color: string): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to reset the selected text's formatting to default. + */ +interface ClearFormattingCommand extends CommandWithSimpleStateBase { + /** + * Executes the ClearFormattingCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the selected range's style. + */ +interface ChangeStyleCommand extends CommandBase { + /** + * Executes the ChangeStyleCommand command by applying the specified setting. 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 style A StyleBase object specifying the selected range's style. + */ + execute(style: StyleBase): boolean; + /** + * Executes the ChangeStyleCommand command by applying the specified settings. 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 styleName A string specifying the name of applying style. + * @param isParagraphStyle true to apply style to paragraph, false to apply style to character. + */ + execute(styleName: string, isParagraphStyle: boolean): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * A command to invoke the Font dialog allowing end-users to change the font, size and style of the selected text. + */ +interface OpenFontFormattingDialogCommand extends CommandWithSimpleStateBase { + /** + * Executes the OpenFontFormattingDialogCommand 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. + */ + execute(): boolean; +} +/** + * A command to convert the text of all selected sentences to sentence case. + */ +interface MakeTextSentenceCaseCommand extends CommandWithSimpleStateBase { + /** + * Executes the MakeTextSentenceCaseCommand 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. + */ + execute(): boolean; +} +/** + * A command to switch the text case at the current position in the document. + */ +interface SwitchTextCaseCommand extends CommandWithSimpleStateBase { + /** + * Executes the SwitchTextCaseCommand 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. + */ + execute(): boolean; +} +/** + * A command to change the font formatting of characters in a selected range. + */ +interface ChangeFontFormattingCommand extends CommandBase { + /** + * Executes the ChangeFontFormattingCommand command by applying the specified setting. 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 settings A FontFormattingSettings object specifying font formatting settings. + */ + execute(settings: FontFormattingSettings): boolean; + /** + * Gets information about the command state. + */ + getState(): any; +} +/** + * Contains settings to define the font formatting. + */ +interface FontFormattingSettings { + /** + * Gets or sets the character(s) font name. + * Value: A string value specifying the font name. + */ + fontName: string; + /** + * Gets or sets the character(s) font size. + * Value: An integer value specifying the font size. + */ + size: number; + /** + * Gets or sets the foreground color of characters. + * Value: A string value specifying the foreground color. + */ + foreColor: string; + /** + * Gets or sets the character background color. + * Value: A string value specifying the background color. + */ + backColor: string; + /** + * Gets or sets the type of underline applied to the character(s). + * Value: true, if characters are underlined; otherwise, false. + */ + underline: boolean; + /** + * Gets or sets the color of the underline for the specified characters. + * Value: A string value specifying the underline color. + */ + underlineColor: string; + /** + * Gets or sets whether the character formatting is bold. + * Value: true, if characters are bold; otherwise, false. + */ + bold: boolean; + /** + * Gets or sets a value indicating whether a character(s) is italicized. + * Value: true, if characters are italicized; otherwise, false. + */ + italic: 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. + */ + underlineWordsOnly: boolean; + /** + * Gets or sets a value specifying character script formatting. + * Value: One of the values. + */ + script: any; + /** + * Gets or sets a value indicating whether all characters are capital letters. + * Value: true, if all characters are capitalized; otherwise, false. + */ + allCaps: boolean; + /** + * Gets or sets a value indicating whether a character(s) is hidden. + * Value: true, if characters are hidden; otherwise, false. + */ + hidden: boolean; +} +declare enum CharacterFormattingScript { + Normal=0, + Subscript=1, + Superscript=2 +} +/** + * A command to toggle the horizontal ruler's visibility. + */ +interface ShowHorizontalRulerCommand extends CommandWithBooleanStateBase { + /** + * Executes the ShowHorizontalRulerCommand 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. + */ + execute(): boolean; + /** + * Executes the ShowHorizontalRulerCommand command by applying the specified setting. 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 show true to display the horizontal ruler, false to hide the horizontal ruler. + */ + execute(show: boolean): boolean; +} +/** + * A command to toggle the fullscreen mode. + */ +interface SetFullscreenCommand extends CommandWithBooleanStateBase { + /** + * Executes the SetFullscreenCommand 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. + */ + execute(): boolean; + /** + * Executes the SetFullscreenCommand command by applying the specified setting. 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 fullscreen true to apply fullscreen mode, false to remove fullscreen mode. + */ + execute(fullscreen: boolean): boolean; +} +/** + * Holds the information that determines what action types can be performed for appointments. + */ +interface ASPxClientAppointmentFlags { + /** + * Gets a value that specifies whether an end-user is allowed to delete appointments. + * Value: true if an end-user can delete appointments; otherwise, false. Default is true. + */ + allowDelete: boolean; + /** + * Gets a value that specifies whether an end-user is allowed to edit appointments. + * Value: true if the end-user can edit appointments; otherwise, false. + */ + allowEdit: boolean; + /** + * Gets a value that specifies whether an end-user is allowed to change the time boundaries of appointments. + * Value: true if appointment resizing is allowed; otherwise, false. Default is true. + */ + allowResize: boolean; + /** + * Gets a value that specifies whether an end-user is allowed to copy appointments. + * Value: true if a user can copy appointments; otherwise, false. Default is true. + */ + allowCopy: boolean; + /** + * Gets a value that specifies whether an end-user is allowed to drag and drop appointments to another time slot or date. + * Value: true if the user can drag and drop appointments; otherwise, false. + */ + allowDrag: boolean; + /** + * Gets a value that specifies whether an end-user is allowed to drag and drop appointments between resources. + * Value: true if the end-user can drag appointment from one resource to another; otherwise, false. + */ + allowDragBetweenResources: boolean; + /** + * Gets a value that specifies whether an inplace editor can be activated for an appointment. + * Value: true if an inplace editor is activated; otherwise, false. Default is true. + */ + allowInplaceEditor: boolean; + /** + * Gets a value that specifies whether an end-user is allowed to share the schedule time between two or more appointments. + * Value: true if appointments with the same schedule time are allowed; otherwise, false. Default is true. + */ + allowConflicts: boolean; +} +/** + * Represents a client-side equivalent of the Appointment class. + */ +interface ASPxClientAppointment { + /** + * Gets the time interval of the appointment for client-side scripting. + * Value: An ASPxClientTimeInterval object, representing the interval assigned to an appointment. + */ + interval: ASPxClientTimeInterval; + /** + * Gets the identifiers of resources associated with the appointment for client-side scripting. + * Value: An array of string representations for resource identifiers. + */ + resources: string[]; + /** + * Gets the ID of an appointment for use in client-side scripts. + * Value: A string representation of the appointment ID. + */ + appointmentId: string; + /** + * Gets the type of appointment for use in client-side scripts. + * Value: An ASPxAppointmentType enumeration member, representing the appointment's type. + */ + appointmentType: ASPxAppointmentType; + /** + * Gets the index of the availability status object associated with the appointment. + * Value: An integer value that specifies the index of the corresponding Statuses collection. + */ + statusIndex: number; + /** + * Gets the index of the label object associated with the appointment for client-side scripting. + * Value: An integer value that specifies the index of the corresponding Labels collection. + */ + labelIndex: number; + /** + * Gets the client appointment value that is equivalent in meaning to the Subject property. + * Value: A string representing the appointment subject. + */ + subject: string; + /** + * Gets the client appointment value that is equivalent in meaning to the Description property. + * Value: A string, representing the description for an appointment. + */ + description: string; + /** + * Gets the client appointment value that is equivalent in meaning to the Location property. + * Value: A string representing the appointment location. + */ + location: string; + /** + * Gets the client appointment value that is equivalent in meaning to the AllDay property. + * Value: true indicates the all-day appointment; otherwise, false. + */ + allDay: boolean; + /** + * Adds a resource to the collection of resources associated with the client appointment. + * @param resourceId An object, representing the resource id. + */ + AddResource(resourceId: Object): void; + /** + * Gets the resource associated with the client-side appointment by its index. + * @param index An integer, representing an index of a resource in a resource collection associated with the current appointment. + */ + GetResource(index: number): Object; + /** + * Sets the property value of the client appointment, corresponding to the Start appointment property. + * @param start A JavaScript Date object representing the appointment start. + */ + SetStart(start: Date): void; + /** + * Gets the property value of the client appointment corresponding to the Start appointment property. + */ + GetStart(): Date; + /** + * Sets the property value of the client appointment, corresponding to the End appointment property. + * @param end A JavaScript Date object representing the end of the appointment. + */ + SetEnd(end: Date): void; + /** + * Gets the property value of the client appointment corresponding to the End appointment property. + */ + GetEnd(): Date; + /** + * Sets the property value of the client appointment, corresponding to the Duration appointment property. + * @param duration A TimeSpan object representing the appointment duration. + */ + SetDuration(duration: any): void; + /** + * Gets the property value of the client appointment corresponding to the Duration appointment property. + */ + GetDuration(): number; + /** + * Sets the ID of the client appointment. + * @param id An object representing the appointment identifier. + */ + SetId(id: Object): void; + /** + * Gets the ID of the client appointment. + */ + GetId(): Object; + /** + * Specifies the type of the current client appointment. + * @param type An ASPxAppointmentType enumeration value indicating the appointment type. + */ + SetAppointmentType(type: ASPxAppointmentType): void; + /** + * Gets the type of the client appointment. + */ + GetAppointmentType(): ASPxAppointmentType; + /** + * Sets the property value of the client appointment, corresponding to the StatusId appointment property. + * @param statusId An integer representing the index in the AppointmentStatusCollection. + */ + SetStatusId(statusId: number): void; + /** + * Gets the property value of the client appointment corresponding to the StatusId appointment property. + */ + GetStatusId(): number; + /** + * Sets the property value of the client appointment, corresponding to the LabelId appointment property. + * @param statusId An integer representing the index of the label in the Labels label collection. + */ + SetLabelId(statusId: number): void; + /** + * Gets the property value of the client appointment corresponding to the LabelId appointment property. + */ + GetLabelId(): number; + /** + * Sets the property value of the client appointment, corresponding to the Subject appointment property. + * @param subject A string containing the appointment subject. + */ + SetSubject(subject: string): void; + /** + * Gets the property value of the client appointment corresponding to the Subject appointment property. + */ + GetSubject(): string; + /** + * Sets the property value of the client appointment, corresponding to the Description appointment property. + * @param description A string representing the appointment description. + */ + SetDescription(description: string): void; + /** + * Gets the property value of the client appointment corresponding to the Description appointment property. + */ + GetDescription(): string; + /** + * Sets the property value of the client appointment, corresponding to the Location appointment property. + * @param location A string representing the appointment location. + */ + SetLocation(location: string): void; + /** + * Gets the property value of the client appointment corresponding to the Location appointment property. + */ + GetLocation(): string; + /** + * Specifies the property value of the client appointment corresponding to the AllDay appointment property. + * @param allDay true to indicate the all-day appointment; otherwise, false. + */ + SetAllDay(allDay: boolean): void; + /** + * Gets the property value of the client appointment corresponding to the AllDay appointment property. + */ + GetAllDay(): boolean; + /** + * Gets the appointment that is the RecurrencePattern for the current appointment. + */ + GetRecurrencePattern(): ASPxClientAppointment; + /** + * Sets the property value of the client appointment, corresponding to the RecurrenceInfo appointment property. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object representing the recurrence information. + */ + SetRecurrenceInfo(recurrenceInfo: ASPxClientRecurrenceInfo): void; + /** + * Gets the property value of the client appointment corresponding to the RecurrenceInfo appointment property. + */ + GetRecurrenceInfo(): ASPxClientRecurrenceInfo; +} +/** + * A client point object. + */ +interface ASPxClientPoint { + /** + * Gets the point's X-coordinate. + */ + GetX(): number; + /** + * Gets the point's Y-coordinate. + */ + GetY(): number; +} +/** + * A client rectangle object. + */ +interface ASPxClientRect { + /** + * Gets the X-coordinate of the rectangle's left edge. + */ + GetLeft(): number; + /** + * Gets the X-coordinate of the rectangle's right edge. + */ + GetRight(): number; + /** + * Gets the Y-coordinate of the rectangle's top edge. + */ + GetTop(): number; + /** + * Gets the Y-coordinate of the rectangle's bottom edge. + */ + GetBottom(): number; + /** + * Gets the rectangle's width. + */ + GetWidth(): number; + /** + * Gets the rectangle's height. + */ + GetHeight(): number; +} +/** + * Contains information defining the occurrences of a recurring client appointment. + */ +interface ASPxClientRecurrenceInfo { + /** + * Sets the recurrence start date. + * @param start A JavaScript date object value that specifies the start date for the recurrence. + */ + SetStart(start: Date): void; + /** + * Gets the recurrence start date. + */ + GetStart(): Date; + /** + * Sets the recurrence end date. + * @param end A JavaScript Date object that specifies the end date for the recurrence. + */ + SetEnd(end: Date): void; + /** + * Gets the recurrence end date. + */ + GetEnd(): Date; + /** + * Sets the duration of the recurrence. + * @param duration A TimeSpan object representing the duration. + */ + SetDuration(duration: any): void; + /** + * Gets the duration of the recurrence. + */ + GetDuration(): number; + /** + * Sets the time base for the frequency of the corresponding appointment occurrences. + * @param type An ASPxClientRecurrenceType enumeration value that specifies the recurrence's frequency type. + */ + SetRecurrenceType(type: ASPxClientRecurrenceType): void; + /** + * Gets the time base for the frequency of the corresponding appointment reoccurrence. + */ + GetRecurrenceType(): ASPxClientRecurrenceType; + /** + * Sets the day/days in a week that the corresponding appointment recurs on. + * @param weekDays The ASPxClientWeekDays enumeration value specifying the day/days in a week. + */ + SetWeekDays(weekDays: ASPxClientWeekDays): void; + /** + * Gets the day/days in a week on which the corresponding appointment occurs. + */ + GetWeekDays(): ASPxClientWeekDays; + /** + * Sets how many times the appointment occurs. + * @param occurrenceCount An integer value that specifies how many times the appointment occurs. + */ + SetOccurrenceCount(occurrenceCount: number): void; + /** + * Gets how many times the appointment occurs. + */ + GetOccurrenceCount(): number; + /** + * Sets the frequency with which the corresponding appointment occurs (dependent on the recurrence Type). + * @param periodicity An integer value that specifies the frequency with which the corresponding appointment occurs. + */ + SetPeriodicity(periodicity: number): void; + /** + * Gets the frequency with which the corresponding appointment reoccurs (dependent on the recurrence Type). + */ + GetPeriodicity(): number; + /** + * Sets the ordinal number of a day within a defined month. + * @param dayNumber A positive integer value that specifies the day number within a month. + */ + SetDayNumber(dayNumber: number): void; + /** + * Gets the ordinal number of a day within a defined month. + */ + GetDayNumber(): number; + /** + * Sets the occurrence number of the week in a month for the recurrence pattern. + * @param weekOfMonth A ASPxClientWeekOfMonth enumeration value that specifies a particular week in every month. + */ + SetWeekOfMonth(weekOfMonth: ASPxClientWeekOfMonth): void; + /** + * Gets the occurrence number of the week in a month for the recurrence pattern. + */ + GetWeekOfMonth(): ASPxClientWeekOfMonth; + /** + * Sets the month (as a number) on which the corresponding appointment occurs. + * @param month A positive integer value that specifies the month's number. + */ + SetMonth(month: number): void; + /** + * Gets the month (as a number) on which the corresponding appointment recurs. + */ + GetMonth(): number; + /** + * Gets the type of the recurrence range. + */ + GetRange(): ASPxClientRecurrenceRange; + /** + * Sets the type of the recurrence range. + * @param range An ASPxClientRecurrenceRangeenumeration value that specifies the recurrence range type. + */ + SetRange(range: ASPxClientRecurrenceRange): void; +} +/** + * Contains types of the recurrence range. + */ +interface ASPxClientRecurrenceRange { + /** + * A recurring appointment will not have an end date, i.e. infinite recurrence + * Value: The "NoEndDate" string. + */ + NoEndDate: string; + /** + * A recurring appointment will end after its recurrence count exceeds the value specified by the SetOccurrenceCount method. + * Value: The "OccurrenceCount" string. + */ + OccurrenceCount: string; + /** + * A recurring appointment will end after the date specified by the SetEnd method. + * Value: The "EndByDate" string. + */ + EndByDate: string; +} +/** + * Contains recurrence types. + */ +interface ASPxClientRecurrenceType { + /** + * The recurring appointment occurs on a daily basis. + * Value: The "Daily" string. + */ + Daily: string; + /** + * The recurring appointment reoccurs on a weekly basis. + * Value: The "Weekly" string. + */ + Weekly: string; + /** + * The recurring appointment reoccurs on a monthly basis. + * Value: The "Monthly" string. + */ + Monthly: string; + /** + * The recurring appointment reoccurs on an yearly basis. + * Value: The "Yearly" string. + */ + Yearly: string; + /** + * The recurring appointment occurs on an hourly base. + * Value: The "Hourly" string. + */ + Hourly: string; +} +/** + * Contains days and groups of days for use in recurrence patterns. + */ +interface ASPxClientWeekDays { + /** + * Specifies Sunday. + * Value: The integer 1 value. + */ + Sunday: number; + /** + * Specifies Monday. + * Value: The integer 2 value. + */ + Monday: number; + /** + * Specifies Tuesday. + * Value: The integer 4 value. + */ + Tuesday: number; + /** + * Specifies Wednesday. + * Value: The integer 8 value. + */ + Wednesday: number; + /** + * Specifies Thursday. + * Value: The integer 16 value. + */ + Thursday: number; + /** + * Specifies Friday. + * Value: The integer 32 value. + */ + Friday: number; + /** + * Specifies Saturday. + * Value: The integer 64 value. + */ + Saturday: number; + /** + * Specifies Saturday and Sunday. + * Value: The integer 65 value. + */ + WeekendDays: number; + /** + * Specifies work days (Monday, Tuesday, Wednesday, Thursday and Friday). + * Value: The integer 62 value. + */ + WorkDays: number; + /** + * Specifies every day of the week. + * Value: The integer 127 value. + */ + EveryDay: number; +} +/** + * Contains number of weeks in a month in which the event occurs. + */ +interface ASPxClientWeekOfMonth { + /** + * There isn't any recurrence rule based on the weeks in a month. + * Value: The integer 0 value. + */ + None: number; + /** + * The recurring event will occur once a month, on the specified day or days of the first week in the month. + * Value: The integer 1 value. + */ + First: number; + /** + * The recurring event will occur once a month, on the specified day or days of the second week in the month. + * Value: The integer 2 value. + */ + Second: number; + /** + * The recurring event will occur once a month, on the specified day or days of the third week in the month. + * Value: The integer 3 value. + */ + Third: number; + /** + * The recurring event will occur once a month, on the specified day or days of the fourth week in the month. + * Value: The integer 4 value; + */ + Fourth: number; + /** + * The recurring event will occur once a month, on the specified day or days of the last week in the month. + * Value: The integer 5 value; + */ + Last: number; +} +/** + * Represents a client-side equivalent of the WeekDaysCheckEdit control. + */ +interface ASPxClientWeekDaysCheckEdit extends ASPxClientControl { + /** + * Gets the selection state of the week day check boxes. + */ + GetValue(): ASPxClientWeekDays; + /** + * Gets the selection state of the week day check boxes. + * @param value An ASPxClientWeekDays object specifying the selection state of the week day check boxes. + */ + SetValue(value: ASPxClientWeekDays): void; +} +/** + * Represents a client-side equivalent of the RecurrenceRangeControl. + */ +interface ASPxClientRecurrenceRangeControl extends ASPxClientControl { + /** + * Gets the type of the recurrence range. + */ + GetRange(): ASPxClientRecurrenceRange; + /** + * Gets how many times the appointment occurs. + */ + GetOccurrenceCount(): number; + /** + * Gets the recurrence end date. + */ + GetEndDate(): Date; + /** + * Sets the type of the recurrence range. + * @param range An ASPxClientRecurrenceRangeenumeration value that specifies the recurrence range type. + */ + SetRange(range: ASPxClientRecurrenceRange): void; + /** + * Sets how many times the appointment occurs. + * @param occurrenceCount An integer value that specifies how many times the appointment occurs. + */ + SetOccurrenceCount(occurrenceCount: number): void; + /** + * Sets the recurrence end date. + * @param date A JavaScript Date object that specifies the end date for the recurrence. + */ + SetEndDate(date: Date): void; +} +/** + * A base for client equivalents of recurrence controls available in the XtraScheduler library. + */ +interface ASPxClientRecurrenceControlBase extends ASPxClientControl { + /** + * Returns an object providing access to the ASPxClientRecurrenceControlBase control's editor values. + */ + CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; + /** + * Updates values of editors displayed by the ASPxClientRecurrenceControlBase control. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. + */ + Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; +} +/** + * Represents a client-side equivalent of the DailyRecurrenceControl - a control for specifying the daily recurrence. + */ +interface ASPxClientDailyRecurrenceControl extends ASPxClientRecurrenceControlBase { + /** + * Returns an object providing access to the ASPxClientDailyRecurrenceControl's editor values. + */ + CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; + /** + * Updates values of editors displayed by the ASPxClientDailyRecurrenceControl. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. + */ + Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; +} +/** + * Represents a client-side equivalent of the WeeklyRecurrenceControl. + */ +interface ASPxClientWeeklyRecurrenceControl extends ASPxClientRecurrenceControlBase { + /** + * Returns an object providing access to the ASPxClientWeeklyRecurrenceControl's editor values. + */ + CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; + /** + * Updates values of editors displayed by the ASPxClientWeeklyRecurrenceControl. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. + */ + Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; +} +/** + * Represents a client-side equivalent of the MonthlyRecurrenceControl. + */ +interface ASPxClientMonthlyRecurrenceControl extends ASPxClientRecurrenceControlBase { + /** + * Returns an object providing access to the ASPxClientMonthlyRecurrenceControl's editor values. + */ + CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; + /** + * Updates values of editors displayed by the ASPxClientMonthlyRecurrenceControll. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. + */ + Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; +} +/** + * Represents a client-side equivalent of the YearlyRecurrenceControl. + */ +interface ASPxClientYearlyRecurrenceControl extends ASPxClientRecurrenceControlBase { + /** + * Returns an object providing access to the ASPxClientYearlyRecurrenceControl's editor values. + */ + CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; + /** + * Updates values of editors displayed by the ASPxClientYearlyRecurrenceControl. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. + */ + Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; +} +/** + * An object providing access to an ASPxClientRecurrenceControlBase control's editor values. + */ +interface DefaultRecurrenceRuleValuesAccessor { + /** + * Get the frequency with which the appointment occurs with respect to the appointment's recurrence type. + */ + GetPeriodicity(): number; + /** + * Gets the number of the month's day in which the appointment is scheduled. + */ + GetDayNumber(): number; + /** + * Gets or sets the month's number. + */ + GetMonth(): number; + /** + * Gets the days of the week on which a weekly recurrent appointment is scheduled. + */ + GetWeekDays(): ASPxClientWeekDays; + /** + * Gets the number of the week in a month when an appointment is scheduled. + */ + GetWeekOfMonth(): ASPxClientWeekOfMonth; +} +/** + * An object providing access to an ASPxClientDailyRecurrenceControl's editor values. + */ +interface DailyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAccessor { + /** + * Gets the number of days between appointment occurrences. + */ + GetPeriodicity(): number; + /** + * Gets the days of the week to which a daily recurrent appointment is scheduled. + */ + GetWeekDays(): ASPxClientWeekDays; +} +/** + * An object providing access to an ASPxClientWeeklyRecurrenceControl's editor values. + */ +interface WeeklyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAccessor { + /** + * Gets the number of weeks between appointment occurrences. + */ + GetPeriodicity(): number; + /** + * Gets the days of the week on which a weekly recurrent appointment is scheduled. + */ + GetWeekDays(): ASPxClientWeekDays; +} +/** + * An object providing access to an ASPxClientMonthlyRecurrenceControl's editor values. + */ +interface MonthlyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAccessor { + /** + * Gets the day of the month on which the appointment is scheduled. + */ + GetDayNumber(): number; + /** + * Gets the number of months between appointment occurrences. + */ + GetPeriodicity(): number; + /** + * Gets the days of the week on which a monthly recurrent appointment is scheduled. + */ + GetWeekDays(): ASPxClientWeekDays; + /** + * Gets the number of the week in a month when an appointment is scheduled. + */ + GetWeekOfMonth(): ASPxClientWeekOfMonth; +} +/** + * An object providing access to an ASPxClientYearlyRecurrenceControl's editor values. + */ +interface YearlyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAccessor { + /** + * Gets the day of the month on which the appointment is scheduled. + */ + GetDayNumber(): number; + /** + * Gets or sets the month's number. + */ + GetMonth(): number; + /** + * Gets the days of the week on which a yearly recurrent appointment is scheduled. + */ + GetWeekDays(): ASPxClientWeekDays; + /** + * Gets or sets the number of a week in a month when an appointment is scheduled. + */ + GetWeekOfMonth(): ASPxClientWeekOfMonth; +} +/** + * Provides base functionality for ASPxClientScheduler's forms. + */ +interface ASPxClientFormBase { + /** + * Occurs when the form has been closed. + */ + FormClosed: ASPxClientEvent>; + /** + * Closes the form. + */ + Close(): void; + /** + * Sets the visibility state of the specified form element. + * @param element An object specifying the element whose visibility state should be changed. + * @param isVisible true to display the element; false to hide the element. + */ + SetVisibleCore(element: Object, isVisible: boolean): void; +} +/** + * Represents a client-side equivalent of the RecurrenceTypeEdit. + */ +interface ASPxClientRecurrenceTypeEdit extends ASPxClientRadioButtonList { + /** + * Gets the selected recurrence type. + */ + GetRecurrenceType(): ASPxClientRecurrenceType; + /** + * Sets the selected recurrence type. + * @param recurrenceType An ASPxClientRecurrenceType enumeration value. + */ + SetRecurrenceType(recurrenceType: ASPxClientRecurrenceType): void; +} +/** + * Contains lists of property names for different appointment types. + */ +interface AppointmentPropertyNames { + /** + * Gets the list of properties characteristic for appointments of the Normal type. + * Value: A string array which is composed of the appointment property names. + */ + Normal: string; + /** + * Gets the list of properties characteristic for appointments of the Pattern type. + * Value: A string array which is composed of the appointment property names. + */ + Pattern: string; +} +/** + * Represents the client-side equivalent of the TimeInterval class. + */ +interface ASPxClientTimeInterval { + /** + * Gets a value indicating if the time interval is All-Day. + */ + GetAllDay(): boolean; + /** + * Sets a value specifying if the time interval is All-Day. + * @param allDayValue true, if this is an all-day time interval; otherwise, false. + */ + SetAllDay(allDayValue: boolean): void; + /** + * Client-side function that returns the start time of the interval. + */ + GetStart(): Date; + /** + * Client-side function that returns the duration of the specified time interval. + */ + GetDuration(): number; + /** + * Client-side function that returns the end time of the interval. + */ + GetEnd(): Date; + /** + * Client-side function that sets the start time of the interval. + * @param value A DateTime value, representing the beginning of the interval. + */ + SetStart(value: Date): void; + /** + * Client-side function that returns the duration of the specified time interval. + * @param value A TimeSpan object, representing the duration of the time period. + */ + SetDuration(value: any): void; + /** + * Client-side function that sets the end time of the interval. + * @param value A DateTime value, representing the end of the interval. + */ + SetEnd(value: Date): void; + /** + * Determines whether the specified object is equal to the current ASPxClientTimeInterval instance. + * @param interval The object to compare with the current object. + */ + Equals(interval: ASPxClientTimeInterval): boolean; + /** + * Checks if the current time interval intersects with the specified time interval. + * @param interval A ASPxClientTimeInterval object which represents the time interval to be checked. + */ + IntersectsWith(interval: ASPxClientTimeInterval): boolean; + /** + * Checks if the current time interval intersects with the specified time interval. The boundaries of the time intervals are excluded from the check. + * @param interval A ASPxClientTimeInterval object which represents the time interval to be checked. + */ + IntersectsWithExcludingBounds(interval: ASPxClientTimeInterval): boolean; + /** + * Client-side function that determines whether the specified interval is contained within the current one. + * @param interval An ASPxClientTimeInterval object, representing the time interval to check. + */ + Contains(interval: ASPxClientTimeInterval): boolean; +} +/** + * Holds action types for the client-side Refresh method. + */ +interface ASPxClientSchedulerRefreshAction { + /** + * Gets the value of the action parameter which initiates a simple reload of the control. + * Value: An integer representing the action parameter value. + */ + None: number; + /** + * Gets the value of the action parameter which initiates reloading of the main ASPxScheduler control and its data-dependent satellites. + * Value: An integer representing the action parameter value. + */ + VisibleIntervalChanged: number; + /** + * Gets the value of the action parameter which initiates reloading of the main ASPxScheduler control and its satellite View controls. + * Value: An integer representing the action parameter value. + */ + ActiveViewTypeChanged: number; +} +/** + * Contains methods allowing you to perform or cancel an operation. + */ +interface ASPxClientAppointmentOperation { + /** + * Passes parameters to the corresponding callback function to accomplish the operation. + */ + Apply(): void; + /** + * Cancels the operation. + */ + Cancel(): void; +} +/** + * Represents the client-side equivalent of the ASPxScheduler control. + */ +interface ASPxClientScheduler extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientScheduler. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client side when the Scheduler control is about to change its active view. + */ + ActiveViewChanging: ASPxClientEvent>; + /** + * Client-side event. Occurs after the active view of the ASPxScheduler has been changed. + */ + ActiveViewChanged: ASPxClientEvent>; + /** + * Occurs when the end-user clicks an appointment. + */ + AppointmentClick: ASPxClientEvent>; + /** + * Occurs when the end-user double clicks on an appointment. + */ + AppointmentDoubleClick: ASPxClientEvent>; + /** + * Occurs on the client side when the user selects an appointment. + */ + AppointmentsSelectionChanged: ASPxClientEvent>; + /** + * Fires on the client side when the time cell selection is changed. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Occurs on the client side when the time cell selection is about to change. + */ + SelectionChanging: ASPxClientEvent>; + /** + * Fires on the client side when the time interval of the scheduling area is changed. + */ + VisibleIntervalChanged: ASPxClientEvent>; + /** + * Occurs when one of More Buttons is clicked. + */ + MoreButtonClicked: ASPxClientEvent>; + /** + * Client-side event that occurs when a popup menu item is clicked. + */ + MenuItemClicked: ASPxClientEvent>; + /** + * Client-side event that occurs after an appointment has been dragged and dropped. + */ + AppointmentDrop: ASPxClientEvent>; + /** + * A client-side event that occurs when an appointment is being dragged. + */ + AppointmentDrag: ASPxClientEvent>; + /** + * A client-side event that occurs when an appointment is being resized. + */ + AppointmentResizing: ASPxClientEvent>; + /** + * Client-side event that occurs when an appointment is resized. + */ + AppointmentResize: ASPxClientEvent>; + /** + * Client-side event that fires before an appointment is deleted. + */ + AppointmentDeleting: ASPxClientEvent>; + /** + * Client-side scripting method that gets the active View. + */ + GetActiveViewType(): ASPxSchedulerViewType; + /** + * Client-side scripting method to change the ASPxScheduler's active View. + * @param value A ASPxSchedulerViewType enumeration value, representing a view type to set. + */ + SetActiveViewType(value: ASPxSchedulerViewType): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Client-side scripting method which initiates a round trip to the server so that the current page will be reloaded. + */ + Refresh(): void; + /** + * Client-side scripting method which initiates a round trip to the server, so that the control will be reloaded using the specified refresh action. + * @param refreshAction An ASPxClientSchedulerRefreshAction enumeration value, specifying the refresh action. + */ + Refresh(refreshAction: ASPxClientSchedulerRefreshAction): void; + /** + * Client-side function that returns the type of grouping applied to the appointments displayed in the scheduler. + */ + GetGroupType(): ASPxSchedulerGroupType; + /** + * Client-side scripting method which raises the callback command to set the GroupType. + * @param value An ASPxSchedulerGroupType enumeration value, which specifies how appointments are grouped. + */ + SetGroupType(value: ASPxSchedulerGroupType): void; + /** + * Client-side method that navigates the scheduler to the current system date. + */ + GotoToday(): void; + /** + * Client-side scripting method which raises the GotoDate callback command. + * @param date A DateTime value specifying the destination time. + */ + GotoDate(date: Date): void; + /** + * Client-side function which slides the visible interval one time span back. + */ + NavigateBackward(): void; + /** + * Client-side function which slides the visible interval one time span forward. + */ + NavigateForward(): void; + /** + * Client-side method which raises the callback command to change the ClientTimeZoneId of the scheduler. + * @param timeZoneId A string, a time zone identifier which is valid for the System.TimeZoneInfo.Id property. + */ + ChangeTimeZoneId(timeZoneId: string): void; + /** + * Displays a Selection ToolTip on a position given by the specified coordinates. + * @param x An integer representing the X-coordinate. + * @param y An integer representing the Y-coordinate. + */ + ShowSelectionToolTip(x: number, y: number): void; + /** + * Client-side function that returns the time interval, selected in the scheduler. + */ + GetSelectedInterval(): ASPxClientTimeInterval; + /** + * Client-side function that returns the ResourceId of selected time cell's resource. + */ + GetSelectedResource(): string; + /** + * Client-side function that returns an appointment with the specified ID. + * @param id An appointment's identifier. + */ + GetAppointmentById(id: Object): ASPxClientAppointment; + /** + * Client-side function that returns the id's of selected appointments. + */ + GetSelectedAppointmentIds(): string[]; + /** + * Client-side function that removes the appointment specified by its client ID from a collection of selected appointments. + * @param aptId An appointment's identifier. + */ + DeselectAppointmentById(aptId: Object): void; + /** + * Client-side function that selects an appointment with the specified ID. + * @param aptId An appointment's identifier. + */ + SelectAppointmentById(aptId: Object): void; + /** + * Enables obtaining appointment property values in a client-side script. Executes the callback command with the AppointmentData identifier. + * @param aptId An integer, representing the appointment ID. + * @param propertyNames An array of strings, representing the appointment properties to query. + * @param onCallBack A handler of a function which will receive and process the properties' values. + */ + GetAppointmentProperties(aptId: number, propertyNames: string[], onCallBack: Object): string[]; + /** + * Initiates a callback to retrieve and apply the values for the specified list of properties to the specified appointment, and transfer control to the specified function. + * @param clientAppointment An ASPxClientAppointment object that is the client appointment for which the data is retrieved. + * @param propertyNames An array of strings, that are the names of appointment properties to query. + * @param onCallBack A handler of a function executed after a callback. + */ + RefreshClientAppointmentProperties(clientAppointment: ASPxClientAppointment, propertyNames: string[], onCallBack: Object): void; + /** + * Client-side function that invokes the editing form for the appointment specified by its client ID. + * @param aptClientId A string, representing the appointment client identifier. + */ + ShowAppointmentFormByClientId(aptClientId: string): void; + /** + * Client-side function that invokes the editing form for the appointment specified by its storage identifier. + * @param aptServerId A string, representing the appointment identifier. + */ + ShowAppointmentFormByServerId(aptServerId: string): void; + /** + * Sets the time of the day corresponding to the start of the topmost displayed time cell row. + * @param duration An integer, representing the number of milliseconds passed since the start of the day. + * @param viewType An ASPxSchedulerViewType enumeration member, representing the scheduler's View. It can be either 'Day' or 'WorkWeek'. + */ + SetTopRowTime(duration: number, viewType: ASPxSchedulerViewType): void; + /** + * Sets the time of the day corresponding to the start of the topmost displayed time cell row. + * @param duration An integer, representing the number of milliseconds passed since the start of the day. + */ + SetTopRowTime(duration: number): void; + /** + * Gets the time of the day corresponding to the start of the topmost displayed time cell row. + * @param viewType An ASPxSchedulerViewType enumeration member, representing the scheduler's View. It can be either "Day" or "WorkWeek", otherwise the result is undefined. + */ + GetTopRowTime(viewType: ASPxSchedulerViewType): number; + /** + * Gets the time of day corresponding to the start of the topmost displayed time cell row. + */ + GetTopRowTime(): number; + /** + * Client-side scripting method which displays the Loading Panel. + */ + ShowLoadingPanel(): void; + /** + * Client-side scripting method which hides the Loading Panel from view. + */ + HideLoadingPanel(): void; + /** + * Client-side method that invokes the inplace editor form to create a new appointment. + * @param start A date object, representing the start of the new appointment. + * @param end A date object, representing the end of the new appointment. + */ + ShowInplaceEditor(start: Date, end: Date): void; + /** + * Client-side method that invokes the inplace editor form to create a new appointment. + * @param start A date object, representing the start of the new appointment. + * @param end A date object, representing the end of the new appointment. + * @param resourceId An object representing the identifier of a resource associated with the new appointment. + */ + ShowInplaceEditor(start: Date, end: Date, resourceId: string): void; + /** + * Client-side scripting method to insert the specified appointment. + * @param apt An ASPxClientAppointment object representing the client-side appointment. + */ + InsertAppointment(apt: ASPxClientAppointment): void; + /** + * Client-side scripting method to update the specified appointment. + * @param apt An ASPxClientAppointment object representing the client-side appointment. + */ + UpdateAppointment(apt: ASPxClientAppointment): void; + /** + * Client-side scripting method to delete the specified appointment. + * @param apt An ASPxClientAppointment object representing the client-side appointment. + */ + DeleteAppointment(apt: ASPxClientAppointment): void; + /** + * Client-side method that allows retrieving a collection of time intervals displayed by the ASPxScheduler. + */ + GetVisibleIntervals(): ASPxClientTimeInterval[]; + /** + * Changes the container that the ASPxScheduler tooltip belongs to. + * @param container An object that serves as the new container for the pop-up menu. + */ + ChangeToolTipContainer(container: Object): void; + /** + * Changes the container that the ASPxScheduler pop-up menu belongs to. + * @param container An object that serves as the new container for the pop-up menu. + */ + ChangePopupMenuContainer(container: Object): void; + /** + * Returns focus to the form if the ASPxScheduler control is not visible when the reminder fires. + * @param container A DIV object that is located in such a way that it is visible on the page in situations when the ASPxScheduler control is hidden. + */ + ChangeFormContainer(container: Object): void; + /** + * Client-side scripting method that saves appointment modifications and closes the form. + */ + AppointmentFormSave(): void; + /** + * Client-side scripting method that deletes the appointment being edited. + */ + AppointmentFormDelete(): void; + /** + * Client-side scripting method that cancels changes and closes the appointment editing form. + */ + AppointmentFormCancel(): void; + /** + * Client-side scripting method that navigates the scheduler to the date selected in the GotoDate form and closes the form. + */ + GoToDateFormApply(): void; + /** + * Client-side scripting method that cancels changes and closes the GotoDate form. + */ + GoToDateFormCancel(): void; + /** + * Client-side scripting method that cancels changes and closes the form. + */ + InplaceEditFormSave(): void; + /** + * Client-side scripting method that cancels changes and closes the form. + */ + InplaceEditFormCancel(): void; + /** + * Client-side scripting method that invokes the appointment editing form for the appointment being edited in the inplace editor. + */ + InplaceEditFormShowMore(): void; + /** + * Client-side scripting method that closes the Reminder form. + */ + ReminderFormCancel(): void; + /** + * Client-side scripting method that calls the Dismiss method for the selected reminder. + */ + ReminderFormDismiss(): void; + /** + * Client-side scripting method that dismisses all reminders shown in the Reminder form. + */ + ReminderFormDismissAll(): void; + /** + * Client-side scripting method that changes the alert time for the selected reminder to the specified interval. + */ + ReminderFormSnooze(): void; +} +/** + * Represents a client-side equivalent of the SchedulerViewType object. + */ +interface ASPxSchedulerViewType { + /** + * Gets a string representation equivalent of Day enumeration for use in client scripts. + * Value: A string "Day", indicating the DayView. + */ + Day: string; + /** + * Gets a string representation equivalent of WorkWeek enumeration for use in client scripts. + * Value: A string "WorkWeek", indicating the WorkWeekView. + */ + WorkWeek: string; + /** + * Gets a string representation equivalent of Week enumeration for use in client scripts. + * Value: A string "Week", indicating the WeekView. + */ + Week: string; + /** + * Gets a string representation equivalent of Month enumeration for use in client scripts. + * Value: A string "Month", indicating the MonthView. + */ + Month: string; + /** + * Gets a string representation equivalent of Timeline enumeration for use in client scripts. + * Value: A string "Timeline", indicating the TimelineView. + */ + Timeline: string; + /** + * Gets a string representation equivalent of FullWeek enumeration for use in client scripts. + * Value: A string "FullWeek", indicating the FullWeekView. + */ + FullWeek: string; +} +/** + * Represents a client-side equivalent of the SchedulerGroupType enumeration. + */ +interface ASPxSchedulerGroupType { + /** + * Gets a string representation equivalent of None enumeration for use in client scripts. + * Value: A "None" string value. + */ + None: string; + /** + * Gets a string representation equivalent of Date enumeration for use in client scripts. + * Value: A "Date" string value. + */ + Date: string; + /** + * Gets a string representation equivalent of Resource enumeration for use in client scripts. + * Value: A "Resource" string value. + */ + Resource: string; +} +/** + * Represents a client-side equivalent of the AppointmentType enumeration. + */ +interface ASPxAppointmentType { + /** + * Gets a string representation equivalent of Normal enumeration for use in client scripts. + * Value: A "Normal" string value. + */ + Normal: string; + /** + * Gets a string representation equivalent of Pattern enumeration for use in client scripts. + * Value: A "Pattern" string value. + */ + Pattern: string; + /** + * Gets a string representation equivalent of Occurrence enumeration for use in client scripts. + * Value: An "Occurrence" string value. + */ + Occurrence: string; + /** + * Gets a string representation equivalent of ChangedOccurrence enumeration for use in client scripts. + * Value: A "ChangedOccurrence" string value. + */ + ChangedOccurrence: string; + /** + * Gets a string representation equivalent of DeletedOccurrence enumeration for use in client scripts. + * Value: A "DeletedOccurrence" string value. + */ + DeletedOccurrence: string; +} +interface ASPxClientAppointmentDeletingEventHandler { + /** + * A method that will handle the AppointmentDeleting event. + * @param source The event sender (typically an ASPxClientScheduler control). + * @param e A ASPxClientAppointmentDeletingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientAppointmentDeletingEventArgs): void; +} +/** + * Provides data for the AppointmentDeleting event. + */ +interface ASPxClientAppointmentDeletingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets client IDs of the appointments that are intended to be removed. + * Value: An array of client appointment identifiers, representing appointments passed for deletion. + */ + appointmentIds: Object[]; +} +interface AppointmentClickEventHandler { + /** + * A method that will handle the AppointmentClick event. + * @param source The event sender (typically an ASPxClientScheduler control). + * @param e A AppointmentClickEventArgs object that contains event data. + */ + (source: S, e: AppointmentClickEventArgs): void; +} +/** + * Provides data for the AppointmentDoubleClick events. + */ +interface AppointmentClickEventArgs extends ASPxClientEventArgs { + /** + * Gets the client appointment ID for the appointment being clicked. + * Value: A string, representing the client ID of the appointment. + */ + appointmentId: string; + /** + * Gets the HTML element that the event was triggered on. + * Value: An object containing event data. + */ + htmlElement: Object; + /** + * Gets or sets whether an event is handled, and that default actions are not required. + * Value: true if no default processing is required; otherwise, false. + */ + handled: boolean; +} +/** + * A method that will handle the AppointmentsSelectionChanged event. + */ +interface AppointmentsSelectionEventHandler { + /** + * A method that will handle the AppointmentsSelectionChanged event. + * @param source The ASPxScheduler control which fires the event. + * @param e A AppointmentsSelectionEventArgs object that contains event data. + */ + (source: S, e: AppointmentsSelectionEventArgs): void; +} +/** + * Provides data for the AppointmentsSelectionChanged event. + */ +interface AppointmentsSelectionEventArgs extends ASPxClientEventArgs { + /** + * Gets identifiers of the selected appointments. + * Value: A comma separated list of string values, representing appointment IDs. + */ + appointmentIds: string[]; +} +/** + * A method that will handle the ActiveViewChanging event. + */ +interface ActiveViewChangingEventHandler { + /** + * A method that will handle the ActiveViewChanging event. + * @param source The ASPxClientScheduler control which fires the event. + * @param e An ActiveViewChangingEventArgs object that contains event data + */ + (source: S, e: ActiveViewChangingEventArgs): void; +} +/** + * Provides data for the client-side ActiveViewChanging event. + */ +interface ActiveViewChangingEventArgs extends ASPxClientEventArgs { + /** + * Gets the value of the ActiveView property before modification. + * Value: A SchedulerViewType enumeration. + */ + oldView: ASPxSchedulerViewType; + /** + * Gets the new value of the ActiveView property. + * Value: A string, which is the SchedulerViewType enumeration value. + */ + newView: ASPxSchedulerViewType; + /** + * Gets or sets whether the change of active view should be canceled. + * Value: true to cancel the operation; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the MoreButtonClicked event. + */ +interface MoreButtonClickedEventHandler { + /** + * A method that will handle MoreButtonClicked event. + * @param source The ASPxClientScheduler control which fires the event. + * @param e A MoreButtonClickedEventArgs object that contains event data. + */ + (source: S, e: MoreButtonClickedEventArgs): void; +} +/** + * Provides data for the MoreButtonClicked client-side event. + */ +interface MoreButtonClickedEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the Start or End values of the target appointment. + * Value: A DateTime value representing the target appointment's boundary. + */ + targetDateTime: Date; + /** + * Gets the time interval of the cell where the button is located. + * Value: An ASPxClientTimeInterval object representing the time interval of the cell which holds the button. + */ + interval: ASPxClientTimeInterval; + /** + * Gets the resource identifier associated with the cell where the button is located. + * Value: A string, corresponding to ResourceId. + */ + resource: string; + /** + * Gets or sets whether an event is handled. If it is handled, default actions are not required. + * Value: true if no default processing is required; otherwise, false. + */ + handled: boolean; +} +/** + * A method that will handle the MenuItemClicked event. + */ +interface MenuItemClickedEventHandler { + /** + * A method that will handle the MenuItemClicked event. + * @param source The ASPxClientScheduler control which fires the event. + * @param e A MenuItemClickedEventArgs object that contains event data. + */ + (source: S, e: MenuItemClickedEventArgs): void; +} +/** + * Provides data for the MenuItemClicked event. + */ +interface MenuItemClickedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the menu item which is clicked. + * Value: A string, containing the menu item name. + */ + itemName: string; + /** + * Gets or sets whether an event is handled, and that default actions are not required. + * Value: true if no default processing is required; otherwise, false. + */ + handled: boolean; +} +interface AppointmentDragEventHandler { + /** + * + * @param source + * @param e + */ + (source: S, e: ASPxClientAppointmentDragEventArgs): void; +} +/** + * Provides data for the AppointmentDrag event. + */ +interface ASPxClientAppointmentDragEventArgs extends ASPxClientEventArgs { + /** + * Specifies whether or not appointments can be dropped into the intervals over which they are currently dragged. + * Value: true to allow dropping appointments; otherwise, false. + */ + allow: boolean; + /** + * Gets a mouse event object related to the current drag operation. + * Value: An object providing event properties specific to mouse events. + */ + mouseEvent: Object; + /** + * Provides information about dragged appointments. + * Value: An array of ASPxClientAppointmentDragInfo objects storing information about dragged appointments. + */ + dragInformation: ASPxClientAppointmentDragInfo[]; +} +interface AppointmentDropEventHandler { + /** + * + * @param source + * @param e + */ + (source: S, e: ASPxClientAppointmentDropEventArgs): void; +} +/** + * Provides data for the AppointmentDrop event. + */ +interface ASPxClientAppointmentDropEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets a value that specifies whether the event is handled, and the default processing is not required. + * Value: true, if if the event is completely handled by custom code and no default processing is required; otherwise, false. + */ + handled: boolean; + /** + * Provides access to an object that enables you to choose an operation to perform. + * Value: An ASPxClientAppointmentOperation object providing methods to perform the required operation. + */ + operation: ASPxClientAppointmentOperation; + /** + * Provides information about dropped appointments. + * Value: An array of ASPxClientAppointmentDragInfo objects storing information about dropped appointments. + */ + dragInformation: ASPxClientAppointmentDragInfo[]; +} +interface AppointmentResizeEventHandler { + /** + * A method that will handle the AppointmentResize event. + * @param source The event sender (typically an ASPxClientScheduler control). + * @param e A ASPxClientAppointmentResizeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientAppointmentResizeEventArgs): void; +} +/** + * Provides data for the AppointmentResize event. + */ +interface ASPxClientAppointmentResizeEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets whether default event processing is required. + * Value: true to process an event using only custom code; otherwise, false. + */ + handled: boolean; + /** + * Provides access to an object that enables you to choose an operation to perform. + * Value: An ASPxClientAppointmentOperation object providing methods to perform the required operation. + */ + operation: ASPxClientAppointmentOperation; + /** + * Gets the resized appointment's identifier. + * Value: A string containing an appointment identifier. + */ + appointmentId: string; + /** + * Gets the appointment's interval before resizing. + * Value: An object representing the interval assigned to the appointment. + */ + oldInterval: ASPxClientTimeInterval; + /** + * Gets the appointment's interval after resizing. + * Value: An object representing the interval assigned to the appointment. + */ + newInterval: ASPxClientTimeInterval; +} +interface AppointmentResizingEventHandler { + /** + * + * @param source + * @param e + */ + (source: S, e: ASPxClientAppointmentResizingEventArgs): void; +} +/** + * Provides data for the AppointmentResizing event. + */ +interface ASPxClientAppointmentResizingEventArgs extends ASPxClientEventArgs { + /** + * Specifies whether or not an appointment can be resized to the new time interval. + * Value: true to allow resizing the appointment; otherwise, false. + */ + allow: boolean; + /** + * Gets a mouse event object related to the current appointment resizing operation. + * Value: An object providing event properties specific to mouse events. + */ + mouseEvent: Object; + /** + * Gets the resized appointment's identifier. + * Value: A string containing an appointment identifier. + */ + appointmentId: string; + /** + * Gets the appointment's interval before resizing. + * Value: An object representing the interval assigned to the appointment. + */ + oldInterval: ASPxClientTimeInterval; + /** + * Gets the appointment's interval after resizing. + * Value: An object representing the interval assigned to the appointment. + */ + newInterval: ASPxClientTimeInterval; +} +/** + * Stores information about an appointment drag operation. + */ +interface ASPxClientAppointmentDragInfo { + /** + * Gets the dragged appointment's identifier. + * Value: A string containing an appointment identifier. + */ + appointmentId: string; + /** + * Gets the appointment's interval before the drag operation. + * Value: An object representing the interval assigned to the appointment. + */ + oldInterval: ASPxClientTimeInterval; + /** + * Gets resources that were associated with the appointment before the drag operation. + * Value: A array of strings containing resource identifiers. + */ + oldResources: string[]; + /** + * Gets the appointment's interval after the drag operation. + * Value: An object representing the interval assigned to the appointment. + */ + newInterval: ASPxClientTimeInterval; + /** + * Gets resources associated with the appointment after the drag operation. + * Value: An array of strings containing resource identifiers. + */ + newResources: string[]; +} +/** + * Contains information about a client tooltip. + */ +interface ASPxClientSchedulerToolTipData { + /** + * Returns the client appointment for which the tooltip is displayed. + */ + GetAppointment(): ASPxClientAppointment; + /** + * Returns the client time interval for which the tooltip is displayed. + */ + GetInterval(): ASPxClientTimeInterval; + /** + * Returns the resources associated with the appointment for which the tooltip is displayed. + */ + GetResources(): Object[]; +} +/** + * A client-side equivalent of the ASPxSchedulerToolTipBase control. + */ +interface ASPxClientToolTipBase { + /** + * Returns the value that indicates whether or not the tooltip can be displayed. + */ + CanShowToolTip(): boolean; + /** + * Ends updating the tooltip content. + * @param toolTipData An ASPxClientSchedulerToolTipData object providing data required to update the tooltip content. + */ + FinalizeUpdate(toolTipData: ASPxClientSchedulerToolTipData): void; + /** + * Updates the tooltip content. + * @param toolTipData An ASPxClientSchedulerToolTipData object providing data required to update the tooltip content. + */ + Update(toolTipData: ASPxClientSchedulerToolTipData): void; + /** + * Closes the tooltip. + */ + Close(): void; + /** + * + * @param bounds + */ + CalculatePosition(bounds: Object): ASPxClientPoint; + /** + * Displays the Appointment Menu in the position of the tooltip. + * @param eventObject An object containing information about the event on which the menu is displayed. + */ + ShowAppointmentMenu(eventObject: Object): void; + /** + * Displays the View Menu in the position of the tooltip. + * @param eventObject An object containing information about the event on which the menu is displayed. + */ + ShowViewMenu(eventObject: Object): void; + /** + * Returns the string representation of the specified interval. + * @param interval An ASPxClientTimeInterval object to convert. + */ + ConvertIntervalToString(interval: ASPxClientTimeInterval): string; +} +/** + * Represents the client-side equivalent of the ASPxSpellChecker class. + */ +interface ASPxClientSpellChecker extends ASPxClientControl { + /** + * Client-side event that occurs before the spell check starts. + */ + BeforeCheck: ASPxClientEvent>; + /** + * Client-side event that occurs before a message box informing about process completion is shown. + */ + CheckCompleteFormShowing: ASPxClientEvent>; + /** + * Client-side event that occurs when a spell check is finished. + */ + AfterCheck: ASPxClientEvent>; + /** + * Occurs after a word is changed in a checked text. + */ + WordChanged: ASPxClientEvent>; + /** + * Starts the spelling check of the text contained within the element specified by the CheckedElementID value. + */ + Check(): void; + /** + * Starts checking contents of the specified element. + * @param element An object representing the element being checked. + */ + CheckElement(element: Object): void; + /** + * Starts checking contents of the specified element. + * @param id A string representing the identifier of the element being checked. + */ + CheckElementById(id: string): void; + /** + * Starts checking the contents of controls in the specified container. + * @param containerElement An object representing a control which contains elements being checked. + */ + CheckElementsInContainer(containerElement: Object): void; + /** + * Starts checking the contents of controls in the specified container. + * @param containerId A string, specifying the control's identifier. + */ + CheckElementsInContainerById(containerId: string): void; +} +/** + * Represents an object that will handle the client-side BeforeCheck event. + */ +interface ASPxClientBeforeCheckEventHandler { + /** + * A method that will handle the BeforeCheck event. + * @param source The ASPxClientSpellChecker control which fires the event. + * @param e A ASPxClientSpellCheckerBeforeCheckEventArgs object that contains event data + */ + (source: S, e: ASPxClientSpellCheckerBeforeCheckEventArgs): void; +} +/** + * Provides data for an event that occurs before a spelling check is started. Represents the client-side equivalent of the BeforeCheckEventArgs class. + */ +interface ASPxClientSpellCheckerBeforeCheckEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the programmatic identifier assigned to the control which is going to be checked. + * Value: A string, containing the control's identifier. + */ + controlId: string; +} +/** + * Represents an object that will handle the client-side AfterCheck event. + */ +interface ASPxClientAfterCheckEventHandler { + /** + * A method that will handle the AfterCheck event. + * @param source The ASPxClientSpellChecker control which fires the event. + * @param e A ASPxClientSpellCheckerAfterCheckEventArgs object that contains event data + */ + (source: S, e: ASPxClientSpellCheckerAfterCheckEventArgs): void; +} +/** + * Provides data for the client event that occurs after a spelling check is complete. + */ +interface ASPxClientSpellCheckerAfterCheckEventArgs extends ASPxClientEventArgs { + /** + * Gets the programmatic identifier assigned to the control which has been checked. + * Value: A string, containing the control's identifier. + */ + controlId: string; + /** + * Gets the text that has been checked. + * Value: A string, containing checked text. + */ + checkedText: string; + reason: string; +} +/** + * Represents an object that will handle the client-side WordChanged event. + */ +interface ASPxClientWordChangedEventHandler { + /** + * A method that will handle the AfterCheck event. + * @param source The event source. + * @param e An ASPxClientSpellCheckerAfterCheckEventArgs object which contains event data. + */ + (source: S, e: ASPxClientSpellCheckerAfterCheckEventArgs): void; +} +/** + * A method that will handle the CustomCommandExecuted event. + */ +interface ASPxClientSpreadsheetCustomCommandExecutedEventHandler { + /** + * A method that will handle the CustomCommandExecuted event. + * @param source An object representing the event source. Identifies the Spreadsheet that raised the event. + * @param e A ASPxClientSpreadsheetCustomCommandExecutedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSpreadsheetCustomCommandExecutedEventArgs): void; +} +/** + * Provides data for the CustomCommandExecuted event. + */ +interface ASPxClientSpreadsheetCustomCommandExecutedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value representing the processed command's name. + */ + commandName: string; + /** + * Gets an optional parameter that complements the processed command. + * Value: A string value containing additional information about the processed command. + */ + parameter: string; + item: ASPxClientRibbonItem; +} +/** + * A method that will handle the DocumentChanged event. + */ +interface ASPxClientSpreadsheetDocumentChangedEventHandler { + /** + * A method that will handle the DocumentChanged event. + * @param source An object representing the event source. Identifies the Spreadsheet that raised the event. + * @param e A ASPxClientSpreadsheetDocumentChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSpreadsheetDocumentChangedEventArgs): void; +} +/** + * Provides data for the DocumentChanged event. + */ +interface ASPxClientSpreadsheetDocumentChangedEventArgs extends ASPxClientEventArgs { +} +/** + * A method that will handle the EndSynchronization events. + */ +interface ASPxClientSpreadsheetSynchronizationEventHandler { + /** + * A method that will handle the EndSynchronization events. + * @param source An object representing the event source. Identifies the Spreadsheet that raised the event. + * @param e A ASPxClientSpreadsheetSynchronizationEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSpreadsheetSynchronizationEventArgs): void; +} +/** + * Provides data for the EndSynchronization events. + */ +interface ASPxClientSpreadsheetSynchronizationEventArgs extends ASPxClientEventArgs { +} +/** + * A method that will handle the HyperlinkClick event. + */ +interface ASPxClientSpreadsheetHyperlinkClickEventHandler { + /** + * A method that will handle the HyperlinkClick event. + * @param source An object representing the event source. Identifies the Spreadsheet that raised the event. + * @param e An ASPxClientSpreadsheetHyperlinkClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSpreadsheetHyperlinkClickEventArgs): void; +} +/** + * Provides data for the HyperlinkClick event. + */ +interface ASPxClientSpreadsheetHyperlinkClickEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets a value that specifies whether the event is handled, and the default processing is not required. + * Value: true, if if the event is completely handled by custom code and no default processing is required; otherwise, false. + */ + handled: boolean; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; + /** + * Gets a value identifying the clicked hyperlink type. + * Value: One of the values. + */ + hyperlinkType: ASPxClientOfficeDocumentLinkType; + /** + * Gets the clicked link's URI. + * Value: A sting value specifying the link's URI. + */ + targetUri: string; +} +/** + * A client-side equivalent of the ASPxSpreadsheet object. + */ +interface ASPxClientSpreadsheet extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientSpreadsheet. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client when a selection is changed in the ASPxSpreadsheet. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Occurs after a custom command has been executed on the client side. + */ + CustomCommandExecuted: ASPxClientEvent>; + /** + * Fires if any change is made to the Spreadsheet's document on the client. + */ + DocumentChanged: ASPxClientEvent>; + /** + * Fires after a client change has been made to the document and the client-server synchronization starts to apply the change on the server. + */ + BeginSynchronization: ASPxClientEvent>; + /** + * Fires after a document change has been applied to the server and server and client document models have been synchronized. + */ + EndSynchronization: ASPxClientEvent>; + /** + * Occurs on the client side after a hyperlink is clicked within the Spreadsheet's document. + */ + HyperlinkClick: ASPxClientEvent>; + /** + * Sets input focus to the Spreadsheet. + */ + Focus(): void; + /** + * Gets access to the client ribbon object. + */ + GetRibbon(): ASPxClientRibbon; + /** + * Enables you to switch the full-screen mode of the Spreadsheet. + * @param fullscreen true to activate full-screen mode; false to deactivate full-screen mode. + */ + SetFullscreenMode(fullscreen: boolean): void; + /** + * Returns the current selection made in a Spreadsheet. + */ + GetSelection(): ASPxClientSpreadsheetSelection; + /** + * Indicates whether any unsaved changes are contained in the current document. + */ + HasUnsavedChanges(): boolean; + /** + * Gets the value of the specified cell. + * @param colModelIndex An integer value specifying the cell's column index. + * @param rowModelIndex An integer value specifying the cell's row index. + */ + GetCellValue(colModelIndex: number, rowModelIndex: number): Object; + /** + * Gets the value of the currently active cell. + */ + GetActiveCellValue(): Object; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side DocumentCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side DocumentCallback event. + */ + PerformDocumentCallback(parameter: string): void; + /** + * Reconnects the Spreadsheet to an external ribbon. + */ + ReconnectToExternalRibbon(): void; +} +/** + * A method that will handle the client SelectionChanged event. + */ +interface ASPxClientSpreadsheetSelectionChangedEventHandler { + /** + * A method that will handle the SelectionChanged event. + * @param source An object representing the event source. Identifies the button editor that raised the event. + * @param e An ASPxClientSpreadsheetSelectionChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSpreadsheetSelectionChangedEventArgs): void; +} +/** + * Provides data for the SelectionChanged event. + */ +interface ASPxClientSpreadsheetSelectionChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets an object that determines the currently selected region within the Spreadsheet. + * Value: A object defining the current selection. + */ + selection: ASPxClientSpreadsheetSelection; +} +/** + * Represents the selection in the Spreadsheet. + */ +interface ASPxClientSpreadsheetSelection { + /** + * Gets the column index of the active cell. + * Value: An integer value specifying the active cell column index. + */ + activeCellColumnIndex: number; + /** + * Gets the row index of the active cell. + * Value: An integer value specifying the active cell row index. + */ + activeCellRowIndex: number; + /** + * Gets the index of the selection's left column. + * Value: An integer value specifying the index of the left column within the selection. + */ + leftColumnIndex: number; + /** + * Gets the index of the selection's top row. + * Value: An integer value specifying the index of the top row within the selection. + */ + topRowIndex: number; + /** + * Gets the index of the selection's right column. + * Value: An integer value specifying the index of the right column within the selection. + */ + rightColumnIndex: number; + /** + * Gets the index of the selection's bottom row. + * Value: An integer value specifying the index of the bottom row within the selection. + */ + bottomRowIndex: number; +} +/** + * Represents the client ASPxTreeList. + */ +interface ASPxClientTreeList extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any unhandled server error occurs during server-side processing of a callback sent by the ASPxClientTreeList. + */ + CallbackError: ASPxClientEvent>; + /** + * Enables you to display a context menu. + */ + ContextMenu: ASPxClientEvent>; + /** + * Occurs when a custom command button has been clicked. + */ + CustomButtonClick: ASPxClientEvent>; + /** + * Fires before the focused node has been changed. + */ + NodeFocusing: ASPxClientEvent>; + /** + * Fires in response to changing node focus. + */ + FocusedNodeChanged: ASPxClientEvent>; + /** + * Fires after the selection has been changed via end-user interaction. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Fires after the Customization Window has been closed. + */ + CustomizationWindowCloseUp: ASPxClientEvent>; + /** + * Fires after the callback has been processed in the CustomDataCallback event handler. + */ + CustomDataCallback: ASPxClientEvent>; + /** + * Fires on the client when a node is clicked. + */ + NodeClick: ASPxClientEvent>; + /** + * Fires on the client when a node is double clicked. + */ + NodeDblClick: ASPxClientEvent>; + /** + * Fires before a node is expanded. + */ + NodeExpanding: ASPxClientEvent>; + /** + * Fires before a node is collapsed. + */ + NodeCollapsing: ASPxClientEvent>; + /** + * Occurs before a node is dragged by an end-user. + */ + StartDragNode: ASPxClientEvent>; + /** + * Occurs after a node drag and drop operation is completed. + */ + EndDragNode: ASPxClientEvent>; + /** + * Enables you to prevent columns from being resized. + */ + ColumnResizing: ASPxClientEvent>; + /** + * Occurs after a column's width has been changed by an end-user. + */ + ColumnResized: ASPxClientEvent>; + /** + * Sets input focus to the ASPxTreeList. + */ + Focus(): void; + /** + * Gets the Popup Edit Form. + */ + GetPopupEditForm(): ASPxClientPopupControl; + /** + * Returns the focused node's key value. + */ + GetFocusedNodeKey(): string; + /** + * Moves focus to the specified node. + * @param key A String value that uniquely identifies the node. + */ + SetFocusedNodeKey(key: string): void; + /** + * Indicates whether the specified node is selected. + * @param nodeKey A String value that identifies the node by its key value. + */ + IsNodeSelected(nodeKey: string): any; + /** + * Selects the specified node. + * @param nodeKey A string value that identifies the node. + */ + SelectNode(nodeKey: string): void; + /** + * Selects or deselects the specified node. + * @param nodeKey A string value that identifies the node. + * @param state true to select the node; otherwise, false. + */ + SelectNode(nodeKey: string, state: boolean): void; + /** + * Obtains key values of selected nodes that are displayed within the current page. + */ + GetVisibleSelectedNodeKeys(): string[]; + /** + * Indicates whether the Customization Window is displayed. + */ + IsCustomizationWindowVisible(): boolean; + /** + * Invokes the Customization Window. + */ + ShowCustomizationWindow(): void; + /** + * Invokes the Customization Window and displays it over the specified HTML element. + * @param htmlElement An object that specifies the HTML element relative to whose position the customization window is invoked. + */ + ShowCustomizationWindow(htmlElement: Object): void; + /** + * Closes the Customization Window. + */ + HideCustomizationWindow(): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCustomCallback(arg: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side CustomDataCallback event. + */ + PerformCustomDataCallback(arg: string): void; + /** + * Obtains specified data source field values within a specified node, and submits them to the specified JavaScript function. + * @param nodeKey A string value that identifies the node. + * @param fieldNames A string value that contains the names of data source fields whose values within the specified node are returned. The field names should be separated by ';'. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + */ + GetNodeValues(nodeKey: string, fieldNames: string, onCallback: ASPxClientTreeListValuesCallback): void; + /** + * Obtains specified data source field values within a specified node, and submits them to the specified JavaScript function. + * @param nodeKey A string value that identifies the node. + * @param fieldNames The names of data source fields whose values within the specified node are returned. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + */ + GetNodeValues(nodeKey: string, fieldNames: string[], onCallback: ASPxClientTreeListValuesCallback): void; + /** + * Obtains specified data source field values within nodes that are displayed within the current page, and submits them to the specified JavaScript function. + * @param fieldNames A string value that contains the names of data source fields whose values within visible nodes are returned. The field names should be separated by ';'. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + */ + GetVisibleNodeValues(fieldNames: string, onCallback: ASPxClientTreeListValuesCallback): void; + /** + * Obtains specified data source field values within nodes that are displayed within the current page, and submits them to the specified JavaScript function. + * @param fieldNames The names of data source fields whose values within visible nodes are returned. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + */ + GetVisibleNodeValues(fieldNames: string[], onCallback: ASPxClientTreeListValuesCallback): void; + /** + * Obtains specified data source field values within selected nodes, and submits them to the specified JavaScript function. + * @param fieldNames A string value that contains the names of data source fields whose values within selected nodes are returned. The field names should be separated by ';'. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + */ + GetSelectedNodeValues(fieldNames: string, onCallback: ASPxClientTreeListValuesCallback): void; + /** + * Obtains specified data source field values within selected nodes, and submits them to the specified JavaScript function. + * @param fieldNames The names of data source fields whose values within selected nodes are returned. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + */ + GetSelectedNodeValues(fieldNames: string[], onCallback: ASPxClientTreeListValuesCallback): void; + /** + * Obtains specified data source field values within selected nodes, and submits them to the specified JavaScript function. + * @param fieldNames A string value that contains the names of data source fields whose values within selected nodes are returned. The field names should be separated by ';'. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + * @param visibleOnly true to return values within selected nodes that are displayed within the current page; false to return values within all selected nodes. + */ + GetSelectedNodeValues(fieldNames: string, onCallback: ASPxClientTreeListValuesCallback, visibleOnly: boolean): void; + /** + * Obtains specified data source field values within selected nodes, and submits them to the specified JavaScript function. + * @param fieldNames The names of data source fields whose values within selected nodes are returned. + * @param onCallback A ASPxClientTreeListValuesCallback object that represents the JavaScript function which receives the list of values as a parameter. + * @param visibleOnly true to return values within selected nodes that are displayed within the current page; false to return values within all selected nodes. + */ + GetSelectedNodeValues(fieldNames: string[], onCallback: ASPxClientTreeListValuesCallback, visibleOnly: boolean): void; + /** + * Selects the specified page. + * @param index An integer value that specifies the active page's index. + */ + GoToPage(index: number): void; + /** + * Activates the previous page. + */ + PrevPage(): void; + /** + * Activates the next page. + */ + NextPage(): void; + /** + * Gets the index of the page currently being selected. + */ + GetPageIndex(): number; + /** + * Gets the number of pages to which the ASPxTreeList's data is divided. + */ + GetPageCount(): number; + /** + * Returns the specified node's state. + * @param nodeKey A String value that identifies the node. + */ + GetNodeState(nodeKey: string): string; + /** + * Expands all nodes. + */ + ExpandAll(): void; + /** + * Collapses all Node. + */ + CollapseAll(): void; + /** + * Expands the specified node preserving the collapsed state of child nodes. + * @param key A String value that uniquely identifies the node. + */ + ExpandNode(key: string): void; + /** + * Collapses the specified node preserving the expanded state of child nodes. + * @param key A String value that uniquely identifies the node. + */ + CollapseNode(key: string): void; + /** + * Obtains key values of nodes that are displayed within the current page. + */ + GetVisibleNodeKeys(): string[]; + /** + * Returns an HTML table row that represents the specified node. + * @param nodeKey A string value that identifies the node. + */ + GetNodeHtmlElement(nodeKey: string): Object; + /** + * Returns the number of visible columns within the client ASPxTreeList. + */ + GetVisibleColumnCount(): number; + /** + * Returns the number of columns within the client ASPxTreeList. + */ + GetColumnCount(): number; + /** + * Returns the column located at the specified position within the Columns collection. + * @param index An integer value that identifies the column within the collection (the column's Index property value). + */ + GetColumnByIndex(index: number): ASPxClientTreeListColumn; + /** + * Returns the column with the specified name. + * @param name A string value that specifies the column's name (the column's Name property value). + */ + GetColumnByName(name: string): ASPxClientTreeListColumn; + /** + * Returns the client column which is bound to the specified data source field. + * @param fieldName A string value that specifies the name of the data source field to which the column is bound (the column's FieldName property value). + */ + GetColumnByFieldName(fieldName: string): ASPxClientTreeListColumn; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + */ + SortBy(columnIndex: number): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DESC' or 'NONE'). + */ + SortBy(columnIndex: number, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param columnIndex An integer value that specifies the column's position within the column collection. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DESC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(columnIndex: number, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values. + * @param nameOrFieldName A String value that specifies the column's name or field name. + */ + SortBy(nameOrFieldName: string): void; + /** + * Sorts data by the specified data column's values. + * @param nameOrFieldName A String value that specifies the column's name or field name. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DESC' or 'NONE'). + */ + SortBy(nameOrFieldName: string, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param nameOrFieldName A String value that specifies the column's name or field name. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DESC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(nameOrFieldName: string, sortOrder: string, reset: boolean): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientTreeListColumn object that represents the data column. + */ + SortBy(column: ASPxClientTreeListColumn): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientTreeListColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DESC' or 'NONE'). + */ + SortBy(column: ASPxClientTreeListColumn, sortOrder: string): void; + /** + * Sorts data by the specified data column's values. + * @param column An ASPxClientTreeListColumn object that represents the data column. + * @param sortOrder A string value that specifies the column's sort order ('ASC', 'DESC' or 'NONE'). + * @param reset true to clear any previous sorting; otherwise, false. + */ + SortBy(column: ASPxClientTreeListColumn, sortOrder: string, reset: boolean): void; + /** + * Switches the ASPxTreeList to edit mode. + * @param nodeKey A string value that identifies the node by its key value. + */ + StartEdit(nodeKey: string): void; + /** + * Saves all the changes made and switches the ASPxTreeList to browse mode. + */ + UpdateEdit(): void; + /** + * Cancels all the changes made and switches the ASPxTreeList to browse mode. + */ + CancelEdit(): void; + /** + * Indicates whether the ASPxTreeList is in edit mode. + */ + IsEditing(): boolean; + /** + * Gets the key value of the node currently being edited. + */ + GetEditingNodeKey(): string; + /** + * Moves the specified node to a new position. + * @param nodeKey A string value that identifies the target node by its key value. + * @param parentNodeKey A string value that identifies the node to whose child collection the target node is moved. An empty string to display the target node within the root. + */ + MoveNode(nodeKey: string, parentNodeKey: string): void; + /** + * Deletes the specified node. + * @param nodeKey A string value that identifies the node. + */ + DeleteNode(nodeKey: string): void; + /** + * Switches the ASPxTreeList to edit mode and allows new root node values to be edited. + */ + StartEditNewNode(): void; + /** + * Switches the ASPxTreeList to edit mode and allows new node values to be edited. + * @param parentNodeKey A String value that identifies the parent node, which owns a new node. + */ + StartEditNewNode(parentNodeKey: string): void; + /** + * Returns the editor used to edit the specified column's values. + * @param column An ASPxClientTreeListColumn object that represents the data column within the client ASPxTreeList. + */ + GetEditor(column: ASPxClientTreeListColumn): Object; + /** + * Returns the editor used to edit the specified column's values. + * @param columnIndex An integer value that identifies the column by its position within the column collection. + */ + GetEditor(columnIndex: number): Object; + /** + * Returns the editor used to edit the specified column's values. + * @param columnNameOrFieldName A String value that identifies the column by its name or field name. + */ + GetEditor(columnNameOrFieldName: string): Object; + /** + * Returns the value of the specified edit cell. + * @param column An ASPxClientTreeListColumn object that represents the data column within the client ASPxTreeList. + */ + GetEditValue(column: ASPxClientTreeListColumn): Object; + /** + * Returns the value of the specified edit cell. + * @param columnIndex An integer value that identifies the data column by its index within the ASPxTreeList's column collection. + */ + GetEditValue(columnIndex: number): Object; + /** + * Returns the value of the specified edit cell. + * @param columnNameOrFieldName A String value that identifies the column by its name or field name. + */ + GetEditValue(columnNameOrFieldName: string): Object; + /** + * Sets the value of the specified edit cell. + * @param column An ASPxClientTreeListColumn object that represents the data column within the client ASPxTreeList. + * @param value An object that specifies the edit cell's new value. + */ + SetEditValue(column: ASPxClientTreeListColumn, value: Object): void; + /** + * Sets the value of the specified edit cell. + * @param columnIndex An integer value that identifies the data column by its index within the ASPxTreeList's column collection. + * @param value An object that specifies the edit cell's new value. + */ + SetEditValue(columnIndex: number, value: Object): void; + /** + * Sets the value of the specified edit cell. + * @param columnNameOrFieldName A String value that identifies the column by its name or field name. + * @param value An object that specifies the edit cell's new value. + */ + SetEditValue(columnNameOrFieldName: string, value: Object): void; + /** + * Moves focus to the specified editor within the edited node. + * @param column A ASPxClientTreeListColumn object that represents the data column within the client ASPxTreeList. + */ + FocusEditor(column: ASPxClientTreeListColumn): void; + /** + * Moves focus to the specified editor within the edited node. + * @param columnIndex An integer value that identifies the data column. + */ + FocusEditor(columnIndex: number): void; + /** + * Moves focus to the specified editor within the edited node. + * @param columnNameOrFieldName A String value that specifies the column's name or field name. + */ + FocusEditor(columnNameOrFieldName: string): void; + /** + * Scrolls the tree list so that the specified node becomes visible. + * @param nodeKey An integer value that specifies the node index within the tree list's client item list. + */ + MakeNodeVisible(nodeKey: string): void; + /** + * Returns the current vertical scroll position of the tree list's content. + */ + GetVerticalScrollPosition(): number; + /** + * Returns the current horizontal scroll position of the tree list's content. + */ + GetHorizontalScrollPosition(): number; + /** + * Specifies the vertical scroll position for the tree list's content. + * @param position An integer value specifying the vertical scroll position. + */ + SetVerticalScrollPosition(position: number): void; + /** + * Specifies the horizontal scroll position for the tree list's content. + * @param position An integer value specifying the horizontal scroll position. + */ + SetHorizontalScrollPosition(position: number): void; +} +/** + * Represents a client column. + */ +interface ASPxClientTreeListColumn { + /** + * Gets the column's position within the collection. + * Value: An integer zero-bazed index that specifies the column's position within the collection. + */ + index: number; + /** + * Gets the name that uniquely identifies the column. + * Value: A string value assigned to the column's Name property. + */ + name: string; + /** + * Gets the name of the database field assigned to the current column. + * Value: A String value that specifies the name of a data field. + */ + fieldName: string; +} +/** + * Provides data for the CustomDataCallback event. + */ +interface ASPxClientTreeListCustomDataCallbackEventArgs extends ASPxClientEventArgs { + /** + * Gets the information that has been collected on the client-side and sent to the server-side CustomDataCallback event. + * Value: A string value that represents the information that has been collected on the client-side and sent to the server-side CustomDataCallback event. + */ + arg: string; + /** + * Gets the information passed from the server-side CustomDataCallback event. + * Value: An object that represents the information passed from the server-side CustomDataCallback event. + */ + result: Object; +} +/** + * A method that will handle the CustomDataCallback event. + */ +interface ASPxClientTreeListCustomDataCallbackEventHandler { + /** + * A method that will handle the CustomDataCallback event. + * @param source The event source. + * @param e An ASPxClientTreeListCustomDataCallbackEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListCustomDataCallbackEventArgs): void; +} +/** + * Provides data for the NodeDblClick events. + */ +interface ASPxClientTreeListNodeEventArgs extends ASPxClientEventArgs { + /** + * Gets the processed node's key value. + * Value: A String value that identifies the processed node. + */ + nodeKey: string; + /** + * Provides access to the parameters associated with the NodeDblClick events. + * Value: An object that contains parameters associated with the event. + */ + htmlEvent: Object; + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the NodeDblClick event. + */ +interface ASPxClientTreeListNodeEventHandler { + /** + * A method that will handle the NodeDblClick event. + * @param source The event source. + * @param e An ASPxClientTreeListNodeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListNodeEventArgs): void; +} +/** + * Provides data for the ContextMenu event. + */ +interface ASPxClientTreeListContextMenuEventArgs extends ASPxClientEventArgs { + /** + * Identifies which tree list element has been right-clicked. + * Value: A string value that identifies which tree list element ('Header' or 'Node') has been right-clicked. + */ + objectType: string; + /** + * Gets a value that identifies the right-clicked object. + * Value: The right-clicked object's identifier. + */ + objectKey: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that relates to the processed event. + */ + htmlEvent: Object; + /** + * Gets or sets whether to invoke the browser's context menu. + * Value: true to hide the browser's context menu; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the ContextMenu event. + */ +interface ASPxClientTreeListContextMenuEventHandler { + /** + * A method that will handle the ContextMenu event. + * @param source The event sender. + * @param e An ASPxClientTreeListContextMenuEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListContextMenuEventArgs): void; +} +/** + * Provides data for the StartDragNode event. + */ +interface ASPxClientTreeListStartDragNodeEventArgs extends ASPxClientTreeListNodeEventArgs { + /** + * Gets an array of targets where a node can be dragged. + * Value: An array of objects that represent targets for the dragged node. + */ + targets: Object[]; +} +/** + * A method that will handle the StartDragNode event. + */ +interface ASPxClientTreeListStartDragNodeEventHandler { + /** + * A method that will handle the StartDragNode event. + * @param source The event source. + * @param e An ASPxClientTreeListStartDragNodeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListStartDragNodeEventArgs): void; +} +/** + * Provides data for the EndDragNode event. + */ +interface ASPxClientTreeListEndDragNodeEventArgs extends ASPxClientTreeListNodeEventArgs { + /** + * Gets the target element. + * Value: An object that represents the target element to which the dragged node has been dropped. + */ + targetElement: Object; +} +/** + * A method that will handle the EndDragNode event. + */ +interface ASPxClientTreeListEndDragNodeEventHandler { + /** + * A method that will handle the EndDragNode event. + * @param source The event source. + * @param e An ASPxClientTreeListEndDragNodeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListEndDragNodeEventArgs): void; +} +/** + * Provides data for the CustomButtonClick event. + */ +interface ASPxClientTreeListCustomButtonEventArgs extends ASPxClientEventArgs { + /** + * Gets the key value of the node whose custom button has been clicked. + * Value: A string value that uniquely identifies the node whose custom button has been clicked. + */ + nodeKey: string; + /** + * Gets the button's index. + * Value: An integer value that specifies the button's position within the CustomButtons collection. + */ + buttonIndex: number; + /** + * Gets the value which identifies the custom button. + * Value: A String value that identifies the clicked custom button. + */ + buttonID: string; +} +/** + * A method that will handle the CustomButtonClick event. + */ +interface ASPxClientTreeListCustomButtonEventHandler { + /** + * A method that will handle the CustomButtonClick event. + * @param source The event source. + * @param e An ASPxClientTreeListCustomButtonEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListCustomButtonEventArgs): void; +} +/** + * Represents a JavaScript function which receives the list of row values when a specific client method (such as the GetSelectedNodeValues) is called. + */ +interface ASPxClientTreeListValuesCallback { + /** + * A JavaScript function which receives the list of row values when a specific client method (such as the GetSelectedNodeValues) is called. + * @param result An object that represents the list of row values received from the server. + */ + (result: Object): void; +} +/** + * Provides data for the ColumnResizing event. + */ +interface ASPxClientTreeListColumnResizingEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the processed client column. + * Value: An object that is the processed column. + */ + column: ASPxClientTreeListColumn; +} +/** + * A method that will handle the client ColumnResizing event. + */ +interface ASPxClientTreeListColumnResizingEventHandler { + /** + * A method that will handle the ColumnResizing event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientTreeListColumnResizingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListColumnResizingEventArgs): void; +} +/** + * Provides data for the ColumnResized event. + */ +interface ASPxClientTreeListColumnResizedEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the processed client column. + * Value: An object that is the processed column. + */ + column: ASPxClientTreeListColumn; +} +/** + * A method that will handle the client ColumnResized event. + */ +interface ASPxClientTreeListColumnResizedEventHandler { + /** + * A method that will handle the ColumnResized event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientTreeListColumnResizedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeListColumnResizedEventArgs): void; +} +/** + * Represents a client-side equivalent of the BootstrapAccordion control. + */ +interface BootstrapClientAccordion extends ASPxClientNavBar { +} +/** + * Represents a client-side equivalent of the BootstrapButton control. + */ +interface BootstrapClientButton extends ASPxClientButton { + /** + * Returns the text displayed within the button. + */ + GetText(): string; + /** + * Sets the text to be displayed within the button. + * @param value A string value specifying the text to be displayed within the button. + */ + SetText(value: string): void; +} +/** + * Represents a client-side equivalent of the BootstrapCalendar control. + */ +interface BootstrapClientCalendar extends ASPxClientCalendar { +} +/** + * Represents a client-side equivalent of the BootstrapCheckBox control. + */ +interface BootstrapClientCheckBox extends ASPxClientEdit { + /** + * Occurs on the client side when the editor's checked state is changed. + */ + CheckedChanged: ASPxClientEvent>; + /** + * Returns a value indicating whether the check box editor is checked. + */ + GetChecked(): boolean; + /** + * Sets a value which specifies the checked status of the check box editor. + * @param isChecked + */ + SetChecked(isChecked: boolean): void; + /** + * Returns the text displayed within the editor. + */ + GetText(): string; + /** + * Returns a value which specifies a check box checked state. + */ + GetCheckState(): string; + /** + * Sets a value specifying the state of a check box. + * @param checkState + */ + SetCheckState(checkState: string): void; + /** + * Sets the text to be displayed within the editor. + * @param text + */ + SetText(text: string): void; +} +/** + * Represents a client-side equivalent of the BootstrapRadioButton control. + */ +interface BootstrapClientRadioButton extends BootstrapClientCheckBox { +} +/** + * Represents a client-side equivalent of the BootstrapComboBox control. + */ +interface BootstrapClientComboBox extends ASPxClientComboBox { +} +/** + * Represents a client-side equivalent of the BootstrapDateEdit control. + */ +interface BootstrapClientDateEdit extends ASPxClientDateEdit { +} +/** + * Represents a client-side equivalent of the BootstrapDropDownEdit control. + */ +interface BootstrapClientDropDownEdit extends ASPxClientDropDownEdit { +} +/** + * Represents a client-side equivalent of the BootstrapFormLayout control. + */ +interface BootstrapClientFormLayout extends ASPxClientFormLayout { +} +/** + * Represents a client-side equivalent of the BootstrapGridView control. + */ +interface BootstrapClientGridView extends ASPxClientGridView { +} +/** + * Represents a client-side equivalent of the BootstrapHyperLink control. + */ +interface BootstrapClientHyperLink extends ASPxClientHyperLink { +} +/** + * Represents a client-side equivalent of the BootstrapListBox control. + */ +interface BootstrapClientListBox extends ASPxClientListBox { +} +interface BootstrapClientCheckBoxList extends ASPxClientCheckBoxList { +} +interface BootstrapClientRadioButtonList extends ASPxClientRadioButtonList { +} +/** + * Represents a client-side equivalent of the BootstrapMenu control. + */ +interface BootstrapClientMenu extends ASPxClientMenu { +} +/** + * Represents a client-side equivalent of the BootstrapPopupControl control. + */ +interface BootstrapClientPopupControl extends ASPxClientPopupControl { +} +/** + * Represents a client-side equivalent of the BootstrapPopupMenu control. + */ +interface BootstrapClientPopupMenu extends ASPxClientPopupMenu { +} +/** + * Represents a client-side equivalent of the BootstrapProgressBar control. + */ +interface BootstrapClientProgressBar extends ASPxClientProgressBar { +} +/** + * Represents a client-side equivalent of the BootstrapSpinEdit control. + */ +interface BootstrapClientSpinEdit extends ASPxClientSpinEdit { +} +/** + * Represents a client-side equivalent of the BootstrapTabControl control. + */ +interface BootstrapClientTabControl extends ASPxClientTabControl { +} +/** + * Represents a client-side equivalent of the BootstrapPageControl control. + */ +interface BootstrapClientPageControl extends ASPxClientPageControl { +} +/** + * Represents a client-side equivalent of the BootstrapTextBox control. + */ +interface BootstrapClientTextBox extends ASPxClientTextBox { +} +/** + * Represents a client-side equivalent of the BootstrapMemo control. + */ +interface BootstrapClientMemo extends ASPxClientMemo { +} +/** + * Represents a client-side equivalent of the BootstrapButtonEdit control. + */ +interface BootstrapClientButtonEdit extends ASPxClientButtonEdit { +} +/** + * Represents a client-side equivalent of the BootstrapTreeView control. + */ +interface BootstrapClientTreeView extends ASPxClientTreeView { +} +/** + * A client-side counterpart of the Calendar and CalendarFor extensions. + */ +interface MVCxClientCalendar extends ASPxClientCalendar { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; +} +/** + * A client-side counterpart of the CallbackPanel extension. + */ +interface MVCxClientCallbackPanel extends ASPxClientCallbackPanel { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the Callback Panel by processing the passed information on the server, in an Action specified by the Callback Panel's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the Callback Panel by processing the passed information on the server, in an Action specified by the Callback Panel's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the CardView extension. + */ +interface MVCxClientCardView extends ASPxClientCardView { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the CardView by processing the passed information on the server, in an Action specified via the CardView's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CardView's CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the CardView by processing the passed information on the server, in an Action specified via the CardView's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CardView's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the CardView's CustomDataActionRouteValues property, and then process the returned result in the specified client function. This method does not update the CardView. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. + * @param onCallback A ASPxClientCardViewValuesCallback object that represents the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(data: Object, onCallback: ASPxClientCardViewValuesCallback): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * + * @param args + * @param onSuccess + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event. + * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback An ASPxClientCardViewValuesCallback object that is the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(args: string, onCallback: ASPxClientCardViewValuesCallback): void; +} +/** + * A client-side counterpart of the Chart extension. + */ +interface MVCxClientChart extends ASPxClientWebChartControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update a Chart by processing the passed information on the server, in an Action specified via the Chart's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update a Chart by processing the passed information on the server, in an Action specified via the Chart's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the ComboBox and ComboBoxFor extensions. + */ +interface MVCxClientComboBox extends ASPxClientComboBox { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the ComboBox by processing the passed information on the server, in an Action specified by the ComboBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the ComboBox by processing the passed information on the server, in an Action specified by the ComboBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; +} +/** + * A client-side counterpart of the DataView extension. + */ +interface MVCxClientDataView extends ASPxClientDataView { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the DataView by processing the passed information on the server, in an Action specified via the DataView's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the DataView by processing the passed information on the server, in an Action specified via the DataView's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the DateEdit extension. + */ +interface MVCxClientDateEdit extends ASPxClientDateEdit { +} +/** + * A client-side counterpart of the DockManager extension. + */ +interface MVCxClientDockManager extends ASPxClientDockManager { + /** + * Sends a callback with a parameter to update the DockManager by processing the passed information on the server, in an Action specified by the DockManager's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the DockManager by processing the passed information on the server, in an Action specified by the DockManager's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the DockPanel extension. + */ +interface MVCxClientDockPanel extends ASPxClientDockPanel { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the DockPanel by processing the passed information on the server, in an Action specified by the DockPanel's DockPanelSettings.CallbackRouteValues) property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the DockPanel by processing the passed information on the server, in an Action specified by the DockPanel's DockPanelSettings.CallbackRouteValues) property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side WindowCallback event, passing the specified argument to it. + * @param parameter A string value that is any information that needs to be sent to the server-side WindowCallback event. + */ + PerformCallback(parameter: string): void; +} +/** + * A client-side counterpart of the FileManager extension. + */ +interface MVCxClientFileManager extends ASPxClientFileManager { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the FileManager by processing the passed information on the server, in an Action specified via the extension's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the file manager's CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param data A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the GridView extension. + */ +interface MVCxClientGridView extends ASPxClientGridView { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the GridView by processing the passed information on the server, in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the GridView by processing the passed information on the server, in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the GridView's CustomDataActionRouteValues property, and then process the returned result in the specified client function. This method does not update the GridView. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. + * @param onCallback A ASPxClientGridViewValuesCallback object that represents the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(data: Object, onCallback: ASPxClientGridViewValuesCallback): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * + * @param args + * @param onSuccess + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event. + * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback A ASPxClientGridViewValuesCallback object that is the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(args: string, onCallback: ASPxClientGridViewValuesCallback): void; +} +/** + * A client-side counterpart of the HtmlEditor extension. + */ +interface MVCxClientHtmlEditor extends ASPxClientHtmlEditor { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the HtmlEditor's CustomDataCallback event on the client. This method does not update the HtmlEditor. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. + */ + PerformDataCallback(data: Object): void; + /** + * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the HtmlEditor's CustomDataCallback event on the client. This method does not update the HtmlEditor. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. + * @param onCallback An ASPxClientDataCallback object that is the JavaScript function which receives the callback data as a parameter. + */ + PerformDataCallback(data: Object, onCallback: ASPxClientDataCallback): void; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback A ASPxClientDataCallback object that represents the JavaScript function which receives the callback data as a parameter. + */ + PerformDataCallback(parameter: string, onCallback: ASPxClientDataCallback): void; +} +/** + * A client-side counterpart of the ImageGallery extension. + */ +interface MVCxClientImageGallery extends ASPxClientImageGallery { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the ImageGallery by processing the passed information on the server, in an Action specified via the ImageGallery's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the ImageGallery by processing the passed information on the server, in an Action specified via the ImageGallery's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the ListBox and ListBoxFor extensions. + */ +interface MVCxClientListBox extends ASPxClientListBox { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the ListBox by processing the passed information on the server, in an Action specified by the ListBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the ListBox by processing the passed information on the server, in an Action specified by the ListBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server, and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; +} +/** + * A client-side counterpart of the NavBar extension. + */ +interface MVCxClientNavBar extends ASPxClientNavBar { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; +} +/** + * A client-side counterpart of the PivotGrid extension. + */ +interface MVCxClientPivotGrid extends ASPxClientPivotGrid { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the PivotGrid by processing the passed information on the server, in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the PivotGrid by processing the passed information on the server, in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Passes PivotGrid callback parameters to the specified object. + * @param obj An object that receives PivotGrid callback parameters. + */ + FillStateObject(obj: Object): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the PopupControl extension. + */ +interface MVCxClientPopupControl extends ASPxClientPopupControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the PopupControl by processing the passed information on the server, in an Action specified via the PopupControl's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the PopupControl by processing the passed information on the server, in an Action specified via the PopupControl's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback with a parameters to update the popup window by processing the related popup window and the passed information on the server, in an Action specified by the PopupControl's CallbackRouteValues property. + * @param window A ASPxClientPopupWindow object identifying the processed popup window. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformWindowCallback(window: ASPxClientPopupWindow, data: Object): void; + /** + * + * @param window + * @param parameter + */ + PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string): void; + /** + * Sends a callback with parameters to update the popup window by processing the related popup window and the passed information on the server. + * @param window A ASPxClientPopupWindow object identifying the processed popup window. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side WindowCallback event, passing the specified argument to it. + * @param parameter A string value that is any information that needs to be sent to the server-side WindowCallback event. + */ + PerformCallback(parameter: string): void; +} +/** + * A client-side equivalent of the MVCxDocumentViewer class. + */ +interface MVCxClientDocumentViewer extends ASPxClientDocumentViewer { + /** + * Occurs before performing a document export request. + */ + BeforeExportRequest: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; +} +/** + * Obsolete. Use the MVCxClientDocumentViewer class instead. + */ +interface MVCxClientReportViewer extends ASPxClientReportViewer { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs before performing a document export request. + */ + BeforeExportRequest: ASPxClientEvent>; +} +/** + * A method that will handle the BeforeExportRequest event. + */ +interface MVCxClientBeforeExportRequestEventHandler { + /** + * A method that will handle the BeforeExportRequest event. + * @param source An object which is the event source. Identifies the client object that raised the event. + * @param e A MVCxClientBeforeExportRequestEventArgs object that contains event data. + */ + (source: S, e: MVCxClientBeforeExportRequestEventArgs): void; +} +/** + * Provides data for client BeforeExportRequest events. + */ +interface MVCxClientBeforeExportRequestEventArgs extends ASPxClientEventArgs { + /** + * Gets an object containing specific information (if any, as name/value pairs) that should be passed as a request parameter from the client to the server side for further processing. + * Value: A hash table object containing named values to be passed from the client to the server side via request parameters. + */ + customArgs: Object; +} +/** + * A client-side equivalent of the MVCxReportDesigner class. + */ +interface MVCxClientReportDesigner extends ASPxClientReportDesigner { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs after executing the Save command on the client. + */ + SaveCommandExecuted: ASPxClientEvent>; + /** + * Sends a callback to the server with the specified argument. + * @param arg A Object value, specifying the callback argument. + */ + PerformCallback(arg: Object): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(arg: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server with the specified argument. + * @param arg A String value, specifying the callback argument. + */ + PerformCallback(arg: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; +} +/** + * A method that will handle the SaveCommandExecuted event. + */ +interface MVCxClientReportDesignerSaveCommandExecutedEventHandler { + /** + * A method that will handle the SaveCommandExecuted event. + * @param source An object which is the event source. Identifies the client object that raised the event. + * @param e A MVCxClientBeforeExportRequestEventArgs object that contains event data. + */ + (source: S, e: MVCxClientReportDesignerSaveCommandExecutedEventArgs): void; +} +/** + * Provides data for the SaveCommandExecuted event. + */ +interface MVCxClientReportDesignerSaveCommandExecutedEventArgs extends ASPxClientEventArgs { + /** + * Returns the operation result. + * Value: A String value, specifying the operation result. + */ + Result: string; +} +/** + * A client-side counterpart of the RichEdit extension. + */ +interface MVCxClientRichEdit extends ASPxClientRichEdit { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the RichEdit by processing the passed information on the server, in an Action specified via the CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the RichEdit by processing the passed information on the server, in an Action specified via the CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the RoundPanel extension. + */ +interface MVCxClientRoundPanel extends ASPxClientRoundPanel { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the Round Panel by processing the passed information on the server, in an Action specified by the Round Panel's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the Round Panel by processing the passed information on the server, in an Action specified by the Round Panel's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. + * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. + * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the Scheduler extension. + */ +interface MVCxClientScheduler extends ASPxClientScheduler { + ToolTipDisplaying: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the Scheduler by processing the passed information on the server, in an Action specified via the Scheduler's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the Scheduler by processing the passed information on the server, in an Action specified via the Scheduler's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; +} +/** + * A template that is rendered to display a tooltip. + */ +interface MVCxClientSchedulerTemplateToolTip extends ASPxClientToolTipBase { + type: MVCxSchedulerToolTipType; +} +/** + * A delegate method that enables you to adjust the tooltip content before displaying. + */ +interface MVCxClientSchedulerToolTipDisplayingEventHandler { + /** + * A method that will handle the ToolTipDisplaying event. + * @param source An object which is the event source. Identifies the client object that raised the event. + * @param e A MVCxClientSchedulerToolTipDisplayingEventArgs object that contains the related arguments. + */ + (source: S, e: MVCxClientSchedulerToolTipDisplayingEventArgs): void; +} +/** + * Provides data for the ToolTipDisplaying event. + */ +interface MVCxClientSchedulerToolTipDisplayingEventArgs extends ASPxClientEventArgs { + toolTip: MVCxClientSchedulerTemplateToolTip; + data: ASPxClientSchedulerToolTipData; +} +/** + * Lists available tooltip types. + */ +interface MVCxSchedulerToolTipType { +} +/** + * A client-side counterpart of the Spreadsheet extension. + */ +interface MVCxClientSpreadsheet extends ASPxClientSpreadsheet { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the Spreadsheet by processing the passed information on the server, in an Action specified via the CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the Spreadsheet by processing the passed information on the server, in an Action specified via the CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the PageControl extension. + */ +interface MVCxClientPageControl extends ASPxClientPageControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the PageControl by processing the passed information on the server, in an Action specified by the PageControl's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the PageControl by processing the passed information on the server, in an Action specified by the PageControl's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A client-side counterpart of the TokenBox and TokenBoxFor extensions. + */ +interface MVCxClientTokenBox extends ASPxClientTokenBox { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the TokenBox by processing the passed information on the server, in an Action specified by the TokenBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the TokenBox by processing the passed information on the server, in an Action specified by the TokenBox's CallbackRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; +} +/** + * A client-side counterpart of the TreeList extension. + */ +interface MVCxClientTreeList extends ASPxClientTreeList { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the TreeList by processing the passed information on the server, in an Action specified via the TreeList's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the TreeList by processing the passed information on the server, in an Action specified via the TreeList's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the TreeList's CustomDataCallback event. This method does not update the TreeList. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. + */ + PerformCustomDataCallback(data: Object): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side CustomDataCallback event. + */ + PerformCustomDataCallback(arg: string): void; +} +/** + * A client-side counterpart of the TreeView extension. + */ +interface MVCxClientTreeView extends ASPxClientTreeView { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; +} +/** + * A client-side counterpart of the UploadControl extension. + */ +interface MVCxClientUploadControl extends ASPxClientUploadControl { +} +/** + * A method that will handle client BeginCallback events. + */ +interface MVCxClientBeginCallbackEventHandler { + /** + * A method that will handle client BeginCallback events. + * @param source An object which is the event source. Identifies the client object that raised the event. + * @param e A MVCxClientBeginCallbackEventArgs object that contains event data. + */ + (source: S, e: MVCxClientBeginCallbackEventArgs): void; +} +/** + * Provides data for client BeginCallback events. + */ +interface MVCxClientBeginCallbackEventArgs extends ASPxClientBeginCallbackEventArgs { + /** + * Gets an object containing specific information (if any, as name/value pairs) that should be passed as a request parameter from the client to the server side for further processing. + * Value: A hash table object containing named values to be passed from the client to the server side via request parameters. + */ + customArgs: Object; +} +/** + * A method that will handle the BeginCallback event. + */ +interface MVCxClientGlobalBeginCallbackEventHandler { + /** + * A method that will handle the BeginCallback event. + * @param source An object which is the event source. Identifies the client object that raised the event. + * @param e A MVCxClientGlobalBeginCallbackEventArgs object that contains event data. + */ + (source: S, e: MVCxClientGlobalBeginCallbackEventArgs): void; +} +/** + * Provides data for the BeginCallback event. + */ +interface MVCxClientGlobalBeginCallbackEventArgs extends ASPxClientGlobalBeginCallbackEventArgs { + /** + * Gets an object containing specific information (if any, as name/value pairs) that should be passed as a request parameter from the client to the server side for further processing. + * Value: A hash table object containing named values to be passed from the client to the server side via request parameters. + */ + customArgs: Object; +} +/** + * An ASP.NET MVC equivalent of the client ASPxClientGlobalEvents component. + */ +interface MVCxClientGlobalEvents { + /** + * Occurs on the client side after client object models of all DevExpress MVC extensions contained within the page have been initialized. + */ + ControlsInitialized: ASPxClientEvent>; + /** + * Occurs on the client when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by a DevExpress MVC extension. + */ + CallbackError: ASPxClientEvent>; +} +/** + * A client-side counterpart of the VerticalGrid extension. + */ +interface MVCxClientVerticalGrid extends ASPxClientVerticalGrid { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Sends a callback with a parameter to update the VerticalGrid by processing the passed information on the server in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + */ + PerformCallback(data: Object): void; + /** + * Sends a callback with a parameter to update the VerticalGrid by processing the passed information on the server in an Action specified via the grid's CustomActionRouteValues property. + * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the VerticalGrid's CustomDataActionRouteValues property, and then process the returned result in the specified client function. This method does not update the VerticalGrid. + * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. + * @param onCallback A ASPxClientGridViewValuesCallback object that represents the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(data: Object, onCallback: ASPxClientGridViewValuesCallback): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * + * @param args + * @param onSuccess + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; + /** + * Sends a callback to the server and generates the server-side CustomDataCallback event. + * @param args A string value that is any information that needs to be sent to the server-side CustomDataCallback event. + * @param onCallback A ASPxClientVerticalGridValuesCallback object that is the JavaScript function which receives the information on the client side. + */ + GetValuesOnCustomCallback(args: string, onCallback: ASPxClientVerticalGridValuesCallback): void; +} +/** + * A client-side equivalent of the MVCxWebDocumentViewer class. + */ +interface MVCxClientWebDocumentViewer extends ASPxClientWebDocumentViewer { +} +/** + * Serves as the base type for all the objects included in the client-side object model. + */ +interface ASPxClientControlBase { + /** + * Gets the unique, hierarchically-qualified identifier for the control. + * Value: The fully-qualified identifier for the control. + */ + name: string; + /** + * Occurs on the client side after the control has been initialized. + */ + Init: ASPxClientEvent>; + /** + * Returns an HTML element that is the root of the control's hierarchy. + */ + GetMainElement(): Object; + /** + * Specifies the text that Assistive Technologies (screen readers or braille display, for example) will provide to a user. + * @param message A String value that specifies a text. + */ + SendMessageToAssistiveTechnology(message: string): void; + /** + * Returns a value specifying whether a control is displayed. + */ + GetClientVisible(): boolean; + /** + * Specifies whether a control is displayed. + * @param visible + */ + SetClientVisible(visible: boolean): void; + /** + * Returns a value specifying whether a control is displayed. + */ + GetVisible(): boolean; + /** + * Specifies whether a control is displayed. + * @param visible true to make a control visible; false to make it hidden. + */ + SetVisible(visible: boolean): void; + /** + * Returns a value that determines whether a callback request sent by a web control is being currently processed on the server side. + */ + InCallback(): boolean; +} +/** + * Serves as the base type for all the objects included in the client-side object model. + */ +interface ASPxClientControl extends ASPxClientControlBase { + /** + * Returns the control's width. + */ + GetWidth(): number; + /** + * Returns the control's height. + */ + GetHeight(): number; + /** + * Specifies the control's width. + * @param width An integer value that specifies the control's width. + */ + SetWidth(width: number): void; + /** + * Specifies the control's height. Note that this method is not in effect for some controls. + * @param height An integer value that specifies the control's height. + */ + SetHeight(height: number): void; + /** + * Modifies the control's size against the control's container. + */ + AdjustControl(): void; +} +/** + * Represents a client-side equivalent of the ASPxCallback control. + */ +interface ASPxClientCallback extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientCallback. + */ + CallbackError: ASPxClientEvent>; + /** + * Fires on the client side when a callback initiated by the client Callback event's handler returns back to the client. + */ + CallbackComplete: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side Callback event passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + SendCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A method that will handle the client events related to completion of callback server-side processing. + */ +interface ASPxClientCallbackCompleteEventHandler { + /** + * A method that will handle the client events related to completion of callback server-side processing. + * @param source An object representing the event source. Identifies the web control that raised the event. + * @param e An ASPxClientCallbackCompleteEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCallbackCompleteEventArgs): void; +} +/** + * Serves as the base class for arguments of the web controls' client-side events. + */ +interface ASPxClientEventArgs { +} +/** + * Provides data for events concerning the final processing of a callback. + */ +interface ASPxClientCallbackCompleteEventArgs extends ASPxClientEventArgs { + /** + * Gets a string that contains specific information (if any) passed from the client side for server-side processing. + * Value: A string value representing specific information passed from the client to the server side. + */ + parameter: string; + /** + * Gets a string that contains specific information (if any) that has been passed from the server to the client side for further processing. + * Value: A string value representing specific information passed from the server back to the client side. + */ + result: string; +} +/** + * Serves as the base class for controls that implement panel functionality. + */ +interface ASPxClientPanelBase extends ASPxClientControl { + /** + * Returns the HTML code that is the content of the panel. + */ + GetContentHtml(): string; + /** + * Sets the HTML content for the panel. + * @param html A string value that is the HTML code defining the content of the panel. + */ + SetContentHtml(html: string): void; + /** + * Sets a value specifying whether the panel is enabled. + * @param enabled true to enable the panel; false to disable it. + */ + SetEnabled(enabled: boolean): void; + /** + * Returns a value specifying whether a panel is enabled. + */ + GetEnabled(): boolean; +} +/** + * Represents a client-side equivalent of the ASPxPanel control. + */ +interface ASPxClientPanel extends ASPxClientPanelBase { + /** + * Occurs when the expanded panel is closed. + */ + Collapsed: ASPxClientEvent>; + /** + * Occurs when an end-user opens the expand panel. + */ + Expanded: ASPxClientEvent>; + /** + * Expands or collapses the client panel. + */ + Toggle(): void; + /** + * Returns a value specifying whether the panel can be expanded. + */ + IsExpandable(): boolean; + /** + * Returns a value specifying whether the panel is expanded. + */ + IsExpanded(): boolean; + /** + * Expands the collapsed panel. + */ + Expand(): void; + /** + * Collapses the expanded panel. + */ + Collapse(): void; +} +/** + * Represents a client-side equivalent of the ASPxCallbackPanel control. + */ +interface ASPxClientCallbackPanel extends ASPxClientPanel { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientCallbackPanel. + */ + CallbackError: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Returns the text displayed within the control's loading panel. + */ + GetLoadingPanelText(): string; + /** + * Sets the text to be displayed within the control's loading panel. + * @param loadingPanelText A string value specifying the text to be displayed within the loading panel. + */ + SetLoadingPanelText(loadingPanelText: string): void; + /** + * Sets a value specifying whether the callback panel is enabled. + * @param enabled true, to enable the callback panel; false to disable it. + */ + SetEnabled(enabled: boolean): void; + /** + * Returns a value specifying whether a callback panel is enabled. + */ + GetEnabled(): boolean; +} +/** + * Represents the event object used for client-side events. + */ +interface ASPxClientEvent { + /** + * Dynamically connects the event with an appropriate event handler function. + * @param handler An object representing the event handling function's content. + */ + AddHandler(handler: T): void; + /** + * Dynamically disconnects the event from the associated event handler function. + * @param handler An object representing the event handling function's content. + */ + RemoveHandler(handler: T): void; + /** + * Dynamically disconnects the event from all the associated event handler functions. + */ + ClearHandlers(): void; + /** + * For internal use only. + * @param source + * @param e + */ + FireEvent(source: Object, e: ASPxClientEventArgs): void; +} +/** + * A method that will handle the client-side events of a web control's client-side equivalent. + */ +interface ASPxClientEventHandler { + /** + * A method that will handle the client-side events of a web control's client-side equivalent. + * @param source An object representing the event source. Identifies the control that raised the event. + * @param e An ASPxClientEventArgs object that contains event data. + */ + (source: S, e: ASPxClientEventArgs): void; +} +/** + * A method that will handle the cancelable events of a web control's client-side equivalent. + */ +interface ASPxClientCancelEventHandler { + /** + * A method that will handle the cancelable events of a web control's client-side equivalent. + * @param source An object representing the event source. Identifies the web control that raised the event. + * @param e An ASPxClientCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCancelEventArgs): void; +} +/** + * Provides data for cancelable client events. + */ +interface ASPxClientCancelEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the client events which can't be cancelled and allow the event's processing to be passed to the server side. + */ +interface ASPxClientProcessingModeEventHandler { + /** + * A method that will handle the client events which can't be cancelled and allow the event's processing to be passed to the server side. + * @param source An object representing the event source. Identifies the web control that raised the event. + * @param e An ASPxClientProcessingModeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientProcessingModeEventArgs): void; +} +/** + * Provides data for the client events which can't be cancelled and allow the event's processing to be passed to the server side. + */ +interface ASPxClientProcessingModeEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets a value that specifies whether the event should be finally processed on the server side. + * Value: true to process the event on the server side; false to completely handle it on the client side. + */ + processOnServer: boolean; +} +/** + * A method that will handle the cancelable client-side events which allow the event's processing to be passed to the server side. + */ +interface ASPxClientProcessingModeCancelEventHandler { + /** + * A method that will handle the cancelable client-side events which allow the event's processing to be passed to the server side. + * @param source An object representing the event source. Identifies the web control that raised the event. + * @param e An ASPxClientProcessingModeCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientProcessingModeCancelEventArgs): void; +} +/** + * Provides data for the cancelable client-side events which allow the event's processing to be passed to the server side. + */ +interface ASPxClientProcessingModeCancelEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * Represents a JavaScript function which receives callback data obtained via a call to a specific client method (such as the PerformDataCallback). + */ +interface ASPxClientDataCallback { + /** + * A JavaScript function which receives a callback data obtained via a call to a specific client method (such as the PerformDataCallback). + * @param sender An object whose client method generated a callback. + * @param result A string value that represents the result of server-side callback processing. + */ + (sender: Object, result: string): void; +} +/** + * Represents a client-side equivalent of the ASPxCloudControl control. + */ +interface ASPxClientCloudControl extends ASPxClientControl { + /** + * Fires after an item has been clicked. + */ + ItemClick: ASPxClientEvent>; +} +/** + * A method that will handle client events involving manipulations with the control's items. + */ +interface ASPxClientCloudControlItemEventHandler { + /** + * A method that will handle client events concerning manipulations with items. + * @param source The event source. This parameter identifies the cloud control object which raised the event. + * @param e An ASPxClientCloudControlItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCloudControlItemEventArgs): void; +} +/** + * Provides data for events which involve clicking on the control's items. + */ +interface ASPxClientCloudControlItemEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the name that uniquely identifies the processed item. + * Value: A string value that represents the value assigned to the item's Name property. + */ + name: Object; + /** + * Gets the HTML object that contains the processed item. + * Value: An object representing a container for the item related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * A method that will handle the client events related to the begining of a callback processing round trip. + */ +interface ASPxClientBeginCallbackEventHandler { + /** + * A method that will handle client BeginCallback events. + * @param source An object representing the event source. Identifies the web control that raised the event. + * @param e An ASPxClientBeginCallbackEventArgs object that contains event data. + */ + (source: S, e: ASPxClientBeginCallbackEventArgs): void; +} +/** + * Provides data for client events related to the beginning of a callback processing round trip. + */ +interface ASPxClientBeginCallbackEventArgs extends ASPxClientEventArgs { + /** + * Gets a command name that identifies which client action forced a callback to be occurred. + * Value: A string value that represents the name of the command which initiated a callback. + */ + command: string; +} +/** + * A method that will handle the BeginCallback event. + */ +interface ASPxClientGlobalBeginCallbackEventHandler { + /** + * A method that will handle the BeginCallback event. + * @param source The event source. + * @param e An ASPxDataValidationEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGlobalBeginCallbackEventArgs): void; +} +/** + * Provides data for the BeginCallback event. + */ +interface ASPxClientGlobalBeginCallbackEventArgs extends ASPxClientBeginCallbackEventArgs { + /** + * Gets an object that initiated a callback. + * Value: An class descendant object that is the control that initiated a callback. + */ + control: ASPxClientControl; +} +/** + * A method that will handle the client events related to the completion of a callback processing round trip. + */ +interface ASPxClientEndCallbackEventHandler { + /** + * A method that will handle client EndCallback events. + * @param source An object representing the event source. + * @param e A MenuItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientEndCallbackEventArgs): void; +} +/** + * Provides data for client events related to the completion of a callback processing round trip. + */ +interface ASPxClientEndCallbackEventArgs extends ASPxClientEventArgs { +} +/** + * A method that will handle the EndCallback event. + */ +interface ASPxClientGlobalEndCallbackEventHandler { + /** + * A method that will handle the EndCallback event. + * @param source The event source. + * @param e An ASPxDataValidationEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGlobalEndCallbackEventArgs): void; +} +/** + * Provides data for the EndCallback event. + */ +interface ASPxClientGlobalEndCallbackEventArgs extends ASPxClientEndCallbackEventArgs { + /** + * Gets an object that initiated a callback. + * Value: An class descendant object that is the control that initiated a callback. + */ + control: ASPxClientControl; +} +/** + * A method that will handle a CustomCallback client event exposed by some DevExpress web controls. + */ +interface ASPxClientCustomDataCallbackEventHandler { + /** + * A method that will handle the client CustomCallback event of some controls. + * @param source An object representing the event source. + * @param e An ASPxClientCustomDataCallbackEventHandler object that contains event data. + */ + (source: S, e: ASPxClientCustomDataCallbackEventArgs): void; +} +/** + * Provides data for the CustomCallback event. + */ +interface ASPxClientCustomDataCallbackEventArgs extends ASPxClientEventArgs { + /** + * Gets a string that contains specific information (if any) that has been passed from the server to the client side for further processing, related to the CustomCallback event. + * Value: A string value representing specific information passed from the server back to the client side. + */ + result: string; +} +/** + * A method that will handle client events related to server-side errors that occured during callback processing. + */ +interface ASPxClientCallbackErrorEventHandler { + /** + * A method that will handle client CallbackError events. + * @param source An object representing the event source. + * @param e A ASPxClientCallbackErrorEventArgs object that contains event data. + */ + (source: S, e: ASPxClientCallbackErrorEventArgs): void; +} +/** + * Provides data for client events related to server-side errors that occured during callback processing. + */ +interface ASPxClientCallbackErrorEventArgs extends ASPxClientEventArgs { + /** + * Gets the error message that describes the server error that occurred. + * Value: A string value that represents the error message. + */ + message: string; + /** + * Gets or sets whether the event is handled and the default error handling actions are not required. + * Value: true if the error is handled and no default processing is required; otherwise false. + */ + handled: boolean; +} +/** + * A method that will handle the CallbackError event. + */ +interface ASPxClientGlobalCallbackErrorEventHandler { + /** + * A method that will handle the CallbackError event. + * @param source The event source. + * @param e An ASPxDataValidationEventArgs object that contains event data. + */ + (source: S, e: ASPxClientGlobalCallbackErrorEventArgs): void; +} +/** + * Provides data for the CallbackError event. + */ +interface ASPxClientGlobalCallbackErrorEventArgs extends ASPxClientCallbackErrorEventArgs { + /** + * Gets an object that initiated a callback. + * Value: An class descendant object that is the control that initiated a callback. + */ + control: ASPxClientControl; +} +/** + * A method that will handle the ValidationCompleted client event. + */ +interface ASPxClientValidationCompletedEventHandler { + /** + * A method that will handle the ValidationCompleted event. + * @param source An object representing the event source. Identifies the ASPxClientGlobalEvents object that raised the event. + * @param e An ASPxClientValidationCompletedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientValidationCompletedEventArgs): void; +} +/** + * Provides data for the ValidationCompleted client event that allows you to centrally validate user input within all DevExpress web controls to which validation is applied. + */ +interface ASPxClientValidationCompletedEventArgs extends ASPxClientEventArgs { + /** + * Gets a container object that holds the validated control(s). + * Value: An object that represents a container of the validated control(s). + */ + container: Object; + /** + * Gets the name of the validation group name to which validation has been applied. + * Value: A string value that represents the name of the validation group that has been validated. + */ + validationGroup: string; + /** + * Gets a value that indicates whether validation has been applied to both visible and invisible controls. + * Value: true if validation has been applied to both visible and invisible controls; false if only visible controls have been validated. + */ + invisibleControlsValidated: boolean; + /** + * Gets a value specifying whether the validation has been completed successfully. + * Value: true if the validation has been completed successfully; otherwise, false. + */ + isValid: boolean; + /** + * Gets the first control (either visible or invisible) that hasn't passed the validation applied. + * Value: An ASPxClientControl object that represents the first invalid control. + */ + firstInvalidControl: ASPxClientControl; + /** + * Gets the first visible control that hasn't passed the validation applied. + * Value: An ASPxClientControl object that represents the first visible invalid control. + */ + firstVisibleInvalidControl: ASPxClientControl; +} +/** + * A method that will handle the client ControlsInitialized event. + */ +interface ASPxClientControlsInitializedEventHandler { + /** + * A method that will handle the client ControlsInitialized event. + * @param source An object representing the event source. + * @param e An ASPxClientControlsInitializedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientControlsInitializedEventArgs): void; +} +/** + * Provides data for the client ControlsInitialized event. + */ +interface ASPxClientControlsInitializedEventArgs extends ASPxClientEventArgs { + /** + * Gets a value that specifies whether a callback is sent during a controls initialization. + * Value: true if a callback is sent; otherwise, false. + */ + isCallback: boolean; +} +/** + * A JavaScript function which returns a value specifying whether an object meets the criteria defined within the method specified by this delegate. + */ +interface ASPxClientControlPredicate { + /** + * A JavaScript function which returns a value specifying whether an object meets the criteria defined within the method specified by this delegate. + * @param control An object to compare against the criteria defined within the method. + */ + (control: Object): boolean; +} +/** + * Represents a JavaScript function which receives the action to perform for a control when the client ForEachControl method is called. + */ +interface ASPxClientControlAction { + /** + * Represents a JavaScript function which receives the action to perform for a control when the client ForEachControl method is called. + * @param control An object that specifies a control. + */ + (control: Object): void; +} +/** + * A collection object used on the client side to maintain particular client control objects + */ +interface ASPxClientControlCollection { + /** + * Occurs on the client side after client object models of all DevExpress web controls contained within the page have been initialized. + */ + ControlsInitialized: ASPxClientEvent>; + /** + * Occurs when the browser window is being resized. + */ + BrowserWindowResized: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated by any DevExpress control. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side, after server-side processing of a callback initiated by any DevExpress web control, has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by any DevExpress web control. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs after the validation initiated for a DevExpress web control (or a group of DevExpress web controls) has been completed. + */ + ValidationCompleted: ASPxClientEvent>; + /** + * Returns a collection item identified by its unique hierarchically-qualified identifier. + * @param name A string value representing the hierarchically-qualified identifier of the required control. + */ + Get(name: Object): Object; + /** + * Returns a DevExpress client control object identified by its unique hierarchically-qualified identifier (either ClientInstanceName or ClientID property value). + * @param name A string value that is the hierarchically-qualified identifier of the required DevExpress control. + */ + GetByName(name: string): Object; + /** + * 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[]; + /** + * Returns all controls of the specified type. + * @param type The object specifying the client control type. + */ + GetControlsByType(type: Object): Object[]; + /** + * Performs the specified action for each control in the collection. + * @param action An ASPxClientControlAction object specifying an action to perform. + */ + ForEachControl(action: ASPxClientControlAction): void; +} +/** + * Represents a client-side equivalent of the ASPxDataView object. + */ +interface ASPxClientDataView extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientDataView. + */ + CallbackError: ASPxClientEvent>; + /** + * Activates the specified page. + * @param pageIndex An integer value that specifies the active page's index. + */ + GotoPage(pageIndex: number): void; + /** + * Gets the index of the page that is currently active. + */ + GetPageIndex(): number; + /** + * Gets the size of a single ASPxDataView's page. + */ + GetPageSize(): number; + /** + * Sets the size of a single ASPxDataView's page. + * @param pageSize An integer value that specifies the page size. + */ + SetPageSize(pageSize: number): void; + /** + * Gets the number of pages into which the ASPxDataView's data is divided. + */ + GetPageCount(): number; + /** + * Activates the next page. + */ + NextPage(): void; + /** + * Activates the previous page. + */ + PrevPage(): void; + /** + * Activates the first page. + */ + FirstPage(): void; + /** + * Activates the last page. + */ + LastPage(): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * A JavaScript function which returns a value specifying whether an object meets the criteria defined within the method specified by this delegate. + */ +interface ASPxClientDockingFilterPredicate { + /** + * A JavaScript function which returns a value specifying whether an object meets the criteria defined within the method specified by this delegate. + * @param item An object to compare against the criteria defined within the method. + */ + (item: Object): boolean; +} +/** + * A client-side equivalent of the ASPxDockManager object. + */ +interface ASPxClientDockManager extends ASPxClientControl { + /** + * Fires on the client side before a panel is docked in a zone and allows you to cancel the action. + */ + BeforeDock: ASPxClientEvent>; + /** + * Fires on the client side after a panel is docked in a zone. + */ + AfterDock: ASPxClientEvent>; + /** + * Fires on the client side before a panel is made floating (undocked from a zone) and allows you to cancel the action. + */ + BeforeFloat: ASPxClientEvent>; + /** + * Fires on the client side after a panel is undocked from a zone. + */ + AfterFloat: ASPxClientEvent>; + /** + * Occurs when a panel dragging operation is started. + */ + StartPanelDragging: ASPxClientEvent>; + /** + * Occurs after a panel dragging operation is complete. + */ + EndPanelDragging: ASPxClientEvent>; + /** + * Occurs on the client side before a panel is closed, and allows you to cancel the action. + */ + PanelClosing: ASPxClientEvent>; + /** + * Occurs on the client side when a panel is closed. + */ + PanelCloseUp: ASPxClientEvent>; + /** + * Occurs on the client side when a panel pops up. + */ + PanelPopUp: ASPxClientEvent>; + /** + * Occurs on the client side after a panel has been invoked. + */ + PanelShown: ASPxClientEvent>; + /** + * Occurs on the client side after a panel has been resized. + */ + PanelResize: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Returns a zone specified by its unique identifier (zoneUID). + * @param zoneUID A string value specifying the unique identifier of the zone. + */ + GetZoneByUID(zoneUID: string): ASPxClientDockZone; + /** + * Returns a panel specified by its unique identifier (panelUID). + * @param panelUID A string value specifying the unique identifier of the panel. + */ + GetPanelByUID(panelUID: string): ASPxClientDockPanel; + /** + * Returns an array of panels contained in a page. + */ + GetPanels(): ASPxClientDockPanel[]; + /** + * Returns an array of panels that are contained in a page and meet a specified criteria. + * @param filterPredicate An ASPxClientDockingFilterPredicate delegate that defines a set of criteria and determines whether a panel meets those criteria. + */ + GetPanels(filterPredicate: ASPxClientDockingFilterPredicate): ASPxClientDockPanel[]; + /** + * Returns an array of zones contained in a page. + */ + GetZones(): ASPxClientDockZone[]; + /** + * Returns an array of zones that are contained in a page and meet a specified criteria. + * @param filterPredicate An ASPxClientDockingFilterPredicate delegate that defines a set of criteria and determines whether a zone meets those criteria. + */ + GetZones(filterPredicate: ASPxClientDockingFilterPredicate): ASPxClientDockZone[]; +} +/** + * A method that will handle the client BeforeDock event. + */ +interface ASPxClientDockManagerProcessingModeCancelEventHandler { + /** + * A method that will handle the BeforeDock event. + * @param source The event source. This parameter identifies the dock manager object which raised the event. + * @param e An ASPxClientDockManagerProcessingModeCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockManagerProcessingModeCancelEventArgs): void; +} +/** + * Provides data for the BeforeDock event. + */ +interface ASPxClientDockManagerProcessingModeCancelEventArgs extends ASPxClientProcessingModeCancelEventArgs { + /** + * Gets the panel currently being processed. + * Value: An ASPxClientDockPanel object that is the processed panel. + */ + panel: ASPxClientDockPanel; + /** + * Gets the zone currently being processed. + * Value: An ASPxClientDockZone object that is the processed zone. + */ + zone: ASPxClientDockZone; +} +/** + * A method that will handle the client AfterDock event. + */ +interface ASPxClientDockManagerProcessingModeEventHandler { + /** + * A method that will handle the AfterDock event. + * @param source The event source. This parameter identifies the dock manager object which raised the event. + * @param e An ASPxClientDockManagerProcessingModeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockManagerProcessingModeEventArgs): void; +} +/** + * Provides data for the AfterDock event. + */ +interface ASPxClientDockManagerProcessingModeEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the panel currently being processed. + * Value: An ASPxClientDockPanel object that is the processed panel. + */ + panel: ASPxClientDockPanel; + /** + * Gets the zone currently being processed. + * Value: An ASPxClientDockZone object that is the processed zone. + */ + zone: ASPxClientDockZone; +} +/** + * A method that will handle client-side events concerning manipulations with panels. + */ +interface ASPxClientDockManagerEventHandler { + /** + * A method that will handle client-side events concerning manipulations with panels. + * @param source The event source. This parameter identifies the dock manager object which raised the event. + * @param e An ASPxClientDockManagerEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockManagerEventArgs): void; +} +/** + * Provides data for events which concern manipulations on panels. + */ +interface ASPxClientDockManagerEventArgs extends ASPxClientEventArgs { + /** + * Gets the panel currently being processed. + * Value: An ASPxClientDockPanel object that is the processed panel. + */ + panel: ASPxClientDockPanel; +} +/** + * A method that will handle the client BeforeDock event. + */ +interface ASPxClientDockManagerCancelEventHandler { + /** + * A method that will handle the PanelClosing event. + * @param source The event source. This parameter identifies the dock manager object which raised the event. + * @param e An ASPxClientDockManagerCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockManagerCancelEventArgs): void; +} +/** + * Provides data for the BeforeDock event. + */ +interface ASPxClientDockManagerCancelEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the panel currently being processed. + * Value: An ASPxClientDockPanel object that is the processed panel. + */ + panel: ASPxClientDockPanel; +} +/** + * Serves as a base class for the ASPxClientPopupControl classes. + */ +interface ASPxClientPopupControlBase extends ASPxClientControl { + /** + * Occurs on the client side when window resizing initiates. + */ + BeforeResizing: ASPxClientEvent>; + /** + * Occurs on the client side when window resizing completes. + */ + AfterResizing: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the control. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client side when a control's window closes or hides. + */ + CloseUp: ASPxClientEvent>; + /** + * Enables you to cancel window closing on the client side. + */ + Closing: ASPxClientEvent>; + /** + * Occurs on the client side when a control's window is invoked. + */ + PopUp: ASPxClientEvent>; + /** + * Occurs on the client side after a window has been resized. + */ + Resize: ASPxClientEvent>; + /** + * Occurs on the client side after a control's window has been invoked. + */ + Shown: ASPxClientEvent>; + /** + * Occurs on the client side when the window pin state is changed. + */ + PinnedChanged: ASPxClientEvent>; + /** + * Modifies a control's window size in accordance with the content. + */ + AdjustSize(): void; + /** + * Brings the window to the front of the z-order. + */ + BringToFront(): void; + /** + * Returns a value indicating whether the window is collapsed. + */ + GetCollapsed(): boolean; + /** + * Returns the HTML code that specifies the contents of the control's window. + */ + GetContentHtml(): string; + /** + * Returns an iframe object containing a web page specified via the control's SetContentUrl client method). + */ + GetContentIFrame(): Object; + /** + * Returns an iframe object containing a web page specified via the control's SetContentUrl client method). + */ + GetContentIFrameWindow(): Object; + /** + * Returns the URL pointing to the web page displayed within the control's window. + */ + GetContentUrl(): string; + /** + * Returns the URL pointing to the image displayed within the window footer by default. + */ + GetFooterImageUrl(): string; + /** + * Returns the URL where the web browser will navigate when the text or image is clicked within a window's footer. + */ + GetFooterNavigateUrl(): string; + /** + * Returns the text displayed within a window's footer. + */ + GetFooterText(): string; + /** + * Returns the URL pointing to the image displayed within the window header. + */ + GetHeaderImageUrl(): string; + /** + * Returns the URL where the web browser will navigate when the text or image is clicked within a window's header. + */ + GetHeaderNavigateUrl(): string; + /** + * Returns the text displayed within a window's header. + */ + GetHeaderText(): string; + /** + * Gets the width of the default window's (for ASPxPopupControl) or panel's (for ASPxDockPanel) content region. + */ + GetContentWidth(): number; + /** + * Gets the height of the default window's (for ASPxPopupControl) or panel's (for ASPxDockPanel) content region. + */ + GetContentHeight(): number; + /** + * Returns a value indicating whether the window is maximized. + */ + GetMaximized(): boolean; + /** + * Returns a value indicating whether the window is pinned. + */ + GetPinned(): boolean; + /** + * Sends a callback to the server and generates the server-side WindowCallback event, passing the specified argument to it. + * @param parameter A string value that is any information that needs to be sent to the server-side WindowCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Refreshes the content of the web page displayed within the control's window. + */ + RefreshContentUrl(): void; + /** + * Sets a value indicating whether the window is collapsed. + * @param value true, to collapse the window; otherwise, false. + */ + SetCollapsed(value: boolean): void; + /** + * Sets the HTML markup specifying the contents of the control's window. + * @param html A string value that specifies the HTML markup. + */ + SetContentHtml(html: string): void; + /** + * Sets the URL to point to the web page that should be loaded into, and displayed within the control's window. + * @param url A string value specifying the URL to the web page displayed within the control's window. + */ + SetContentUrl(url: string): void; + /** + * Specifies the URL which points to the image displayed within the window footer by default. + * @param value A string value that is the URL for the image displayed within the window footer. + */ + SetFooterImageUrl(value: string): void; + /** + * Specifies the URL where the web browser will navigate when the text or image is clicked within a window's footer. + * @param value A string value which specifies the required navigation location. + */ + SetFooterNavigateUrl(value: string): void; + /** + * Specifies the text displayed within a window's footer. + * @param value A string value that specifies a window's footer text. + */ + SetFooterText(value: string): void; + /** + * Specifies the URL which points to the image displayed within the window header. + * @param value A string value that is the URL to the image displayed within the header. + */ + SetHeaderImageUrl(value: string): void; + /** + * Specifies the URL where the web browser will navigate when the text or image is clicked within a window's header. + * @param value A string value which specifies the required navigation location. + */ + SetHeaderNavigateUrl(value: string): void; + /** + * Specifies the text displayed within a window's header. + * @param value A string value that specifies a window's header text. + */ + SetHeaderText(value: string): void; + /** + * Sets a value indicating whether the window is maximized. + * @param value true. to maximize the window; otherwise, false. + */ + SetMaximized(value: boolean): void; + /** + * Sets a value indicating whether the window is pinned. + * @param value true, to pin the window; otherwise, false. + */ + SetPinned(value: boolean): void; + /** + * Invokes the control's window. + */ + Show(): void; + /** + * Invokes the control's window at the popup element with the specified index. + * @param popupElementIndex An integer value specifying the zero-based index of the popup element. + */ + Show(popupElementIndex: number): void; + /** + * Invokes the control's window and displays it over the specified HTML element. + * @param htmlElement An object specifying the HTML element relative to whose position the window is invoked. + */ + ShowAtElement(htmlElement: Object): void; + /** + * Invokes the control's window and displays it over an HTML element specified by its unique identifier. + * @param id A string value that specifies the hierarchically qualified identifier of an HTML element relative to whose position the window is invoked. + */ + ShowAtElementByID(id: string): void; + /** + * Invokes the control's window at the specified position. + * @param x A integer value specifying the x-coordinate of the window's display position. + * @param y A integer value specifying the y-coordinate of the window's display position. + */ + ShowAtPos(x: number, y: number): void; + /** + * Closes the control's window. + */ + Hide(): void; + /** + * Returns a value that specifies whether the control's window is displayed. + */ + IsVisible(): boolean; +} +/** + * A client-side equivalent of the ASPxDockPanel object. + */ +interface ASPxClientDockPanel extends ASPxClientPopupControlBase { + /** + * Gets or sets the unique identifier of a panel on a page. + * Value: A string that is the unique identifier of a panel. + */ + panelUID: string; + /** + * Fires on the client side before a panel is docked in a zone and allows you to cancel the action. + */ + BeforeDock: ASPxClientEvent>; + /** + * Fires on the client side after a panel is docked in a zone. + */ + AfterDock: ASPxClientEvent>; + /** + * Fires on the client side before a panel is made floating (undocked from a zone) and allows you to cancel the action. + */ + BeforeFloat: ASPxClientEvent>; + /** + * Fires on the client side after a panel is undocked from a zone. + */ + AfterFloat: ASPxClientEvent>; + /** + * Occurs when a panel dragging operation is started. + */ + StartDragging: ASPxClientEvent>; + /** + * Occurs after a panel dragging operation is complete. + */ + EndDragging: ASPxClientEvent>; + /** + * Retrieves a zone that owns the current panel. + */ + GetOwnerZone(): ASPxClientDockZone; + /** + * Docks the current panel in the specified zone. + * @param zone An ASPxClientDockZone object specifying the zone. + */ + Dock(zone: ASPxClientDockZone): void; + /** + * Docks the current panel in a zone at the specified position. + * @param zone An ASPxClientDockZone object specifying the zone, where the panel is docked + * @param visibleIndex An integer value specifying the visible index position. + */ + Dock(zone: ASPxClientDockZone, visibleIndex: number): void; + /** + * Undocks the current panel. + */ + MakeFloat(): void; + /** + * Undocks the current panel and place it at the specified position. + * @param x An integer value that specifies the X-coordinate of the panel's display position. + * @param y An integer value that specifies the Y-coordinate of the panel's display position. + */ + MakeFloat(x: number, y: number): void; + /** + * Gets or sets a value specifying the position of the current panel, amongst the visible panels within a zone. + */ + GetVisibleIndex(): number; + /** + * Sets a value specifying the position of the current panel, amongst the visible panels in a zone. + * @param visibleIndex An integer value specifying the zero-based index of the panel amongst visible panels in the zone. + */ + SetVisibleIndex(visibleIndex: number): void; + /** + * Returns a value indicating whether the panel is docked. + */ + IsDocked(): boolean; +} +/** + * A method that will handle the client BeforeDock event. + */ +interface ASPxClientDockPanelProcessingModeCancelEventHandler { + /** + * A method that will handle the BeforeDock event. + * @param source A ASPxClientDockPanel object that raised the event. + * @param e A ASPxClientDockPanelProcessingModeCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockPanelProcessingModeCancelEventArgs): void; +} +/** + * Provides data for the BeforeDock event. + */ +interface ASPxClientDockPanelProcessingModeCancelEventArgs extends ASPxClientProcessingModeCancelEventArgs { + /** + * Gets the zone currently being processed. + * Value: An ASPxClientDockZone object that is the processed zone. + */ + zone: ASPxClientDockZone; +} +/** + * A method that will handle the client BeforeDock event. + */ +interface ASPxClientDockPanelProcessingModeEventHandler { + /** + * A method that will handle the AfterFloat event. + * @param source A ASPxClientDockPanel object that raised the event. + * @param e A ASPxClientDockPanelProcessingModeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockPanelProcessingModeEventArgs): void; +} +/** + * Provides data for the AfterFloat event. + */ +interface ASPxClientDockPanelProcessingModeEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the zone currently being processed. + * Value: An ASPxClientDockZone object that is the processed zone. + */ + zone: ASPxClientDockZone; +} +/** + * A client-side equivalent of the ASPxDockZone object. + */ +interface ASPxClientDockZone extends ASPxClientControl { + /** + * Gets or sets the unique identifier of a zone on a page. + * Value: A string that is the unique identifier of a zone. + */ + zoneUID: string; + /** + * Fires on the client side before a panel is docked in a zone and allows you to cancel the action. + */ + BeforeDock: ASPxClientEvent>; + /** + * Fires on the client side after a panel is docked in a zone. + */ + AfterDock: ASPxClientEvent>; + /** + * Returns a value that indicates the orientation in which panels are stacked in the current zone. + */ + IsVertical(): boolean; + /** + * Gets a value that indicates whether the zone can enlarge its size. + */ + GetAllowGrowing(): boolean; + /** + * Gets the number of panels contained in the zone. + */ + GetPanelCount(): number; + /** + * Returns a panel specified by its unique identifier (panelUID). + * @param panelUID A string value specifying the unique identifier of the panel. + */ + GetPanelByUID(panelUID: string): ASPxClientDockPanel; + /** + * Returns a panel specified by its visible index. + * @param visibleIndex An integer value specifying the panel's position among the visible panels within the current zone. + */ + GetPanelByVisibleIndex(visibleIndex: number): ASPxClientDockPanel; + /** + * Returns an array of panels docked in the current zone. + */ + GetPanels(): ASPxClientDockPanel[]; + /** + * Returns an array of panels that are docked in the current zone and meet a specified criteria. + * @param filterPredicate An ASPxClientDockingFilterPredicate delegate that defines a set of criteria and determines whether a panel meets those criteria. + */ + GetPanels(filterPredicate: ASPxClientDockingFilterPredicate): ASPxClientDockPanel[]; +} +/** + * A method that will handle the client BeforeDock event. + */ +interface ASPxClientDockZoneCancelEventHandler { + /** + * A method that will handle the BeforeDock event. + * @param source The event source. This parameter identifies the zone object which raised the event. + * @param e A ASPxClientDockZoneCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockZoneCancelEventArgs): void; +} +/** + * Provides data for the BeforeDock event. + */ +interface ASPxClientDockZoneCancelEventArgs extends ASPxClientProcessingModeCancelEventArgs { + /** + * Gets the panel currently being processed. + * Value: An ASPxClientDockPanel object that is the processed panel. + */ + panel: ASPxClientDockPanel; +} +/** + * A method that will handle the client AfterDock event. + */ +interface ASPxClientDockZoneProcessingModeEventHandler { + /** + * A method that will handle the AfterDock event. + * @param source The event source. This parameter identifies the zone object which raised the event. + * @param e An ASPxClientDockZoneProcessingModeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientDockZoneProcessingModeEventArgs): void; +} +/** + * Provides data for the AfterDock event. + */ +interface ASPxClientDockZoneProcessingModeEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the panel currently being processed. + * Value: An ASPxClientDockPanel object that is the processed panel. + */ + panel: ASPxClientDockPanel; +} +/** + * Represents the client-side equivalent of the ASPxFileManager control. + */ +interface ASPxClientFileManager extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientFileManager. + */ + CallbackError: ASPxClientEvent>; + /** + * Fires on the client side after the selected file has been changed. + */ + SelectedFileChanged: ASPxClientEvent>; + /** + * Fires on the client side when an end-user opens a file by double-clicking it or pressing the Enter key. + */ + SelectedFileOpened: ASPxClientEvent>; + /** + * Fires after the focused item has been changed. + */ + FocusedItemChanged: ASPxClientEvent>; + /** + * Fires after the selection has been changed. + */ + SelectionChanged: ASPxClientEvent>; + /** + * Fires on the client side after the current folder has been changed within a file manager. + */ + CurrentFolderChanged: ASPxClientEvent>; + /** + * Fires on the client side before the folder is created, and allows you to cancel the action. + */ + FolderCreating: ASPxClientEvent>; + /** + * Occurs on the client side after a folder has been created. + */ + FolderCreated: ASPxClientEvent>; + /** + * Fires on the client side before an item is renamed and allows you to cancel the action. + */ + ItemRenaming: ASPxClientEvent>; + /** + * Occurs on the client side after a file manager's item has been renamed. + */ + ItemRenamed: ASPxClientEvent>; + /** + * Fires on the client side before an item is deleted and allows you to cancel the action. + */ + ItemDeleting: ASPxClientEvent>; + /** + * Occurs on the client side after a file manager's item has been deleted. + */ + ItemDeleted: ASPxClientEvent>; + /** + * Occurs on the client side after all the selected items have been deleted. + */ + ItemsDeleted: ASPxClientEvent>; + /** + * Fires on the client side before an item is moved and allows you to cancel the action. + */ + ItemMoving: ASPxClientEvent>; + /** + * Occurs on the client side after a file manager's item has been moved. + */ + ItemMoved: ASPxClientEvent>; + /** + * Occurs on the client side after all the selected items have been moved . + */ + ItemsMoved: ASPxClientEvent>; + /** + * Fires on the client side before an item is copied and allows you to cancel the action. + */ + ItemCopying: ASPxClientEvent>; + /** + * Occurs on the client side after a file manager item has been copied. + */ + ItemCopied: ASPxClientEvent>; + /** + * Occurs on the client side after all the selected items have been copied. + */ + ItemsCopied: ASPxClientEvent>; + /** + * Fires on the client if any error occurs while editing an item. + */ + ErrorOccurred: ASPxClientEvent>; + /** + * Enables you to display the alert with the result error description. + */ + ErrorAlertDisplaying: ASPxClientEvent>; + /** + * Fires when a custom item is clicked, allowing you to perform custom actions. + */ + CustomCommand: ASPxClientEvent>; + /** + * Fires on the client side when the file manager updates the state of toolbar or context menu items. + */ + ToolbarUpdating: ASPxClientEvent>; + /** + * Enables you to highlight the search text, which is specified using the filter box, in templates. + */ + HighlightItemTemplate: ASPxClientEvent>; + /** + * Fires on the client side before a file upload starts, and allows you to cancel the action. + */ + FileUploading: ASPxClientEvent>; + /** + * Fires on the client side before the selected items are uploaded and allows you to cancel the action. + */ + FilesUploading: ASPxClientEvent>; + /** + * Occurs on the client side after a file has been uploaded. + */ + FileUploaded: ASPxClientEvent>; + /** + * Occurs on the client side after upload of all selected files has been completed. + */ + FilesUploaded: ASPxClientEvent>; + /** + * Fires on the client side before a file download starts, and allows you to cancel the action. + */ + FileDownloading: ASPxClientEvent>; + /** + * Gets the name of the currently active file manager area. + */ + GetActiveAreaName(): string; + /** + * Client-side scripting method which initiates a round trip to the server, so that the current page will be reloaded. + */ + Refresh(): void; + /** + * Executes the specified command. + * @param commandName A string value that specifies the command to perform. + */ + ExecuteCommand(commandName: string): boolean; + /** + * Returns the selected file within the ASPxFileManager control's file container. + */ + GetSelectedFile(): ASPxClientFileManagerFile; + /** + * Returns an array of the file manager's selected items. + */ + GetSelectedItems(): ASPxClientFileManagerFile[]; + /** + * Returns a list of files that are loaded on the current page. + */ + GetItems(): ASPxClientFileManagerFile[]; + /** + * Sends a callback to the server and returns a list of files that are contained within the current folder. + * @param onCallback A object that represents the JavaScript function which receives the list of row values as a parameter. + */ + GetAllItems(onCallback: ASPxClientFileManagerAllItemsCallback): void; + /** + * Returns a toolbar item specified by its command name. + * @param commandName A string value specifying the command name of the item. + */ + GetToolbarItemByCommandName(commandName: string): ASPxClientFileManagerToolbarItem; + /** + * Returns a context menu item specified by its command name. + * @param commandName A string value specifying the command name of the item. + */ + GetContextMenuItemByCommandName(commandName: string): ASPxClientFileManagerToolbarItem; + /** + * Gets the current folder's path. + */ + GetCurrentFolderPath(): string; + /** + * Gets the current folder's path with the specified separator. + * @param separator A string value that specifies the separator between the folder's name within a path. + */ + GetCurrentFolderPath(separator: string): string; + /** + * Gets the current folder's path with the specified settings. + * @param separator A string value that specifies the separator between the folder's name within the path. + * @param skipRootFolder true to skip the root folder; otherwise, false. + */ + GetCurrentFolderPath(separator: string, skipRootFolder: boolean): string; + /** + * Sets the current folder's path. + * @param path A String value that is the relative path to the folder (without the root folder). + * @param onCallback A ASPxClientFileManagerCallback object that is the JavaScript function that receives the callback data as a parameter. + */ + SetCurrentFolderPath(path: string, onCallback: ASPxClientFileManagerCallback): void; + /** + * Gets the current folder's ID. + */ + GetCurrentFolderId(): string; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; +} +/** + * A JavaScript function which receives callback data obtained via a call to the client SetCurrentFolderPath method. + */ +interface ASPxClientFileManagerCallback { + /** + * A JavaScript function that receives callback data obtained via a call to the SetCurrentFolderPath method. + * @param result An object that contains a callback data. + */ + (result: Object): void; +} +/** + * A client-side equivalent of the file manager's FileManagerItem object and serves as a base class for client file and folder objects. + */ +interface ASPxClientFileManagerItem { + /** + * Gets the name of the current item. + * Value: A string value that is the item's name. + */ + name: string; + /** + * Gets the item's unique identifier. + * Value: A String value that specifies the item's unique identifier. + */ + id: string; + /** + * Gets a value that indicates if the current file manager item is a folder. + * Value: true if the current item is a folder or parent folder; false if the current item is a file. + */ + isFolder: boolean; + /** + * Specifies whether the file manager item is selected. + * @param selected true, to select the item; otherwise, false. + */ + SetSelected(selected: boolean): void; + /** + * Gets a value indicating whether the item is selected in the file manager. + */ + IsSelected(): boolean; + /** + * Gets the current item's full name. + */ + GetFullName(): string; + /** + * Gets the current item's full name with the specified separator. + * @param separator A string value that specifies the separator between the folder name inside the item's full name. + */ + GetFullName(separator: string): string; + /** + * Gets the current item's full name with the specified settings. + * @param separator A string value that specifies the separator between the folder name inside the item's full name. + * @param skipRootFolder true, to skip the root folder; otherwise, false. + */ + GetFullName(separator: string, skipRootFolder: boolean): string; +} +/** + * Represents the client-side equivalent of the FileManagerFile object. + */ +interface ASPxClientFileManagerFile extends ASPxClientFileManagerItem { + /** + * Downloads a file from a file manager. + */ + Download(): void; +} +/** + * 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; +} +/** + * A JavaScript function which receives callback data obtained by a call to the client GetAllItems method. + */ +interface ASPxClientFileManagerAllItemsCallback { + /** + * A JavaScript function which receives callback data obtained by a call to the client GetAllItems method. + * @param items An array of ASPxClientFileManagerItem objects that are items contained in the current folder. + */ + (items: ASPxClientFileManagerItem[]): void; +} +/** + * A method that will handle the client SelectedFileOpened events. + */ +interface ASPxClientFileManagerFileEventHandler { + /** + * A method that will handle the SelectedFileOpened events. + * @param source An object representing the event's source. + * @param e An ASPxClientFileManagerFileEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFileEventArgs): void; +} +/** + * Provides data for the SelectedFileOpened events. + */ +interface ASPxClientFileManagerFileEventArgs extends ASPxClientEventArgs { + /** + * Gets a file related to the event. + * Value: An ASPxClientFileManagerFile object that represents a file currently being processed. + */ + file: ASPxClientFileManagerFile; +} +/** + * A method that will handle the client SelectedFileOpened event. + */ +interface ASPxClientFileManagerFileOpenedEventHandler { + /** + * A method that will handle the SelectedFileOpened event. + * @param source The event source. This parameter identifies the file manager object which raised the event. + * @param e An ASPxClientFileManagerFileOpenedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFileOpenedEventArgs): void; +} +/** + * Provides data for the SelectedFileOpened event. + */ +interface ASPxClientFileManagerFileOpenedEventArgs extends ASPxClientFileManagerFileEventArgs { + /** + * Gets or sets a value that specifies whether the event should be finally processed on the server side. + * Value: true to process the event on the server side; false to completely handle it on the client side. + */ + processOnServer: boolean; +} +/** + * Serves as a base for classes that are used as arguments for events generated on the client side. + */ +interface ASPxClientFileManagerActionEventArgsBase extends ASPxClientEventArgs { + /** + * Gets the full name of the item currently being processed. + * Value: A string value that is the item's full name. + */ + fullName: string; + /** + * Gets the name of the currently processed item. + * Value: A string value that specifies the item's name. + */ + name: string; + /** + * Gets a value specifying whether the current processed item is a folder. + * Value: true if the processed item is a folder; false if the processed item is a file. + */ + isFolder: boolean; +} +/** + * A method that will handle the client ItemRenaming events. + */ +interface ASPxClientFileManagerItemEditingEventHandler { + /** + * A method that will handle the ItemRenaming events. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemEditingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemEditingEventArgs): void; +} +/** + * Provides data for the item editing event. + */ +interface ASPxClientFileManagerItemEditingEventArgs extends ASPxClientFileManagerActionEventArgsBase { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the client ItemRenamed event. + */ +interface ASPxClientFileManagerItemRenamedEventHandler { + /** + * A method that will handle the ItemRenamed event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemRenamedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemRenamedEventArgs): void; +} +/** + * Provides data for the ItemRenamed event. + */ +interface ASPxClientFileManagerItemRenamedEventArgs extends ASPxClientFileManagerActionEventArgsBase { + /** + * Gets the previous name of the renamed item. + * Value: A string value that specifies the item name. + */ + oldName: string; +} +/** + * A method that will handle the client ItemDeleted event. + */ +interface ASPxClientFileManagerItemDeletedEventHandler { + /** + * A method that will handle the ItemDeleted event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemDeletedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemDeletedEventArgs): void; +} +/** + * Provides data for the ItemDeleted event. + */ +interface ASPxClientFileManagerItemDeletedEventArgs extends ASPxClientFileManagerActionEventArgsBase { +} +/** + * A method that will handle the client ItemsDeleted event. + */ +interface ASPxClientFileManagerItemsDeletedEventHandler { + /** + * A method that will handle the ItemsDeleted event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemsDeletedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemsDeletedEventArgs): void; +} +/** + * Provides data for the ItemsDeleted event. + */ +interface ASPxClientFileManagerItemsDeletedEventArgs extends ASPxClientEventArgs { + /** + * Gets an array of the currently processed items. + * Value: An array of ASPxClientFileManagerItem objects that are items currently being processed. + */ + items: ASPxClientFileManagerItem[]; +} +/** + * A method that will handle the client ItemMoved event. + */ +interface ASPxClientFileManagerItemMovedEventHandler { + /** + * A method that will handle the ItemMoved event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemMovedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemMovedEventArgs): void; +} +/** + * Provides data for the ItemMoved event. + */ +interface ASPxClientFileManagerItemMovedEventArgs extends ASPxClientFileManagerActionEventArgsBase { + /** + * Gets the full name of the folder from which an item is moved. + * Value: A string value that specifies the folder's full name. + */ + oldFolderFullName: string; +} +/** + * A method that will handle the client ItemsMoved event. + */ +interface ASPxClientFileManagerItemsMovedEventHandler { + /** + * A method that will handle the ItemsMoved event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemsMovedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemsMovedEventArgs): void; +} +/** + * Provides data for the ItemsMoved event. + */ +interface ASPxClientFileManagerItemsMovedEventArgs extends ASPxClientEventArgs { + /** + * Gets an array of the currently processed items. + * Value: An array of ASPxClientFileManagerItem objects that are items currently being processed. + */ + items: ASPxClientFileManagerItem[]; + /** + * Gets the full name of the folder from which items are moved. + * Value: A string value that specifies the folder's full name. + */ + oldFolderFullName: string; +} +/** + * A method that will handle the client ItemCopied event. + */ +interface ASPxClientFileManagerItemCopiedEventHandler { + /** + * A method that will handle the ItemCopied event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemCopiedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemCopiedEventArgs): void; +} +/** + * Provides data for the ItemCopied event. + */ +interface ASPxClientFileManagerItemCopiedEventArgs extends ASPxClientFileManagerActionEventArgsBase { + /** + * Gets the full name of the folder from which an item is copied. + * Value: A string value that specifies the folder's full name. + */ + oldFolderFullName: string; +} +/** + * A method that will handle the client ItemsCopied event. + */ +interface ASPxClientFileManagerItemsCopiedEventHandler { + /** + * A method that will handle the ItemsCopied event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemsCopiedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemsCopiedEventArgs): void; +} +/** + * Provides data for the ItemsCopied event. + */ +interface ASPxClientFileManagerItemsCopiedEventArgs extends ASPxClientEventArgs { + /** + * Gets an array of the currently processed items. + * Value: An array of ASPxClientFileManagerItem objects that are items currently being processed. + */ + items: ASPxClientFileManagerItem[]; + /** + * Gets the full name of the folder from which items are copied. + * Value: A string value that specifies the folder's full name. + */ + oldFolderFullName: string; +} +/** + * A method that will handle the client FolderCreated event. + */ +interface ASPxClientFileManagerItemCreatedEventHandler { + /** + * A method that will handle the FolderCreated event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerItemCreatedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerItemCreatedEventArgs): void; +} +/** + * Provides data for the FolderCreated event. + */ +interface ASPxClientFileManagerItemCreatedEventArgs extends ASPxClientFileManagerActionEventArgsBase { +} +/** + * A method that will handle the client ErrorOccurred event. + */ +interface ASPxClientFileManagerErrorEventHandler { + /** + * A method that will handle the client ErrorOccurred event. + * @param source An object representing the event's source. + * @param e An ASPxClientFileManagerErrorEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerErrorEventArgs): void; +} +/** + * Provides data for the ErrorOccurred event. + */ +interface ASPxClientFileManagerErrorEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value representing the processed command's name. + */ + commandName: string; + /** + * Gets or sets the error description. + * Value: A string value specifying the error description. + */ + errorText: string; + /** + * Gets or sets a value specifying whether an event error message is sent to the ErrorAlertDisplaying event. + * Value: true to sent an error message; otherwise, false. + */ + showAlert: boolean; + /** + * Gets a specifically generated code that uniquely identifies an error, which occurs while editing an item. + * Value: An integer value that specifies the code uniquely identifying an error. + */ + errorCode: number; +} +/** + * A method that will handle the client ErrorAlertDisplaying event. + */ +interface ASPxClientFileManagerErrorAlertDisplayingEventHandler { + /** + * A method that will handle the ErrorAlertDisplaying event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerErrorAlertDisplayingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerErrorAlertDisplayingEventArgs): void; +} +/** + * Provides data for the ErrorAlertDisplaying event. + */ +interface ASPxClientFileManagerErrorAlertDisplayingEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value that is the processed command's name. + */ + commandName: string; + /** + * Gets or sets the errors description. + * Value: A string that is the errors description. + */ + errorText: string; + /** + * Gets or sets a value specifying whether an alert message is displayed when the event fires. + * Value: true to display an alert message; otherwise, false. + */ + showAlert: boolean; +} +/** + * A method that will handle the client FileUploading event. + */ +interface ASPxClientFileManagerFileUploadingEventHandler { + /** + * A method that will handle the FileUploading event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerFileUploadingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFileUploadingEventArgs): void; +} +/** + * Provides data for the FileUploading event. + */ +interface ASPxClientFileManagerFileUploadingEventArgs extends ASPxClientEventArgs { + /** + * Gets the path to the folder where a file is being uploaded. + * Value: A string value specifying the path where a file is being uploaded. + */ + folder: string; + /** + * Gets the name of a file selected for upload. + * Value: A string value that specifies the file name. + */ + fileName: string; + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the client FilesUploading event. + */ +interface ASPxClientFileManagerFilesUploadingEventHandler { + /** + * A method that will handle the FilesUploading event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerFilesUploadingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFilesUploadingEventArgs): void; +} +/** + * Provides data for the FilesUploading event. + */ +interface ASPxClientFileManagerFilesUploadingEventArgs extends ASPxClientEventArgs { + /** + * Gets the path to the folder where files are being uploaded. + * Value: A string value specifying the folder path. + */ + folder: string; + /** + * Gets the names of files selected for upload. + * Value: An array of string values that are the file names. + */ + fileNames: string[]; + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the client FileUploaded event. + */ +interface ASPxClientFileManagerFileUploadedEventHandler { + /** + * A method that will handle the FileUploaded event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerFileUploadedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFileUploadedEventArgs): void; +} +/** + * Provides data for the FileUploaded event. + */ +interface ASPxClientFileManagerFileUploadedEventArgs extends ASPxClientEventArgs { + /** + * Gets the path to the folder where a file is uploaded. + * Value: A string value specifying the uploaded file path. + */ + folder: string; + /** + * Gets the name of the uploaded file. + * Value: A string value that specifies the file name. + */ + fileName: string; +} +/** + * A method that will handle the client FilesUploaded event. + */ +interface ASPxClientFileManagerFilesUploadedEventHandler { + /** + * A method that will handle the FilesUploaded event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerFilesUploadedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFilesUploadedEventArgs): void; +} +/** + * Provides data for the FilesUploaded event. + */ +interface ASPxClientFileManagerFilesUploadedEventArgs extends ASPxClientEventArgs { + /** + * Gets the path to the folder where files are uploaded. + * Value: A string value specifying the uploaded files path. + */ + folder: string; + /** + * Gets an array of uploaded file names. + * Value: An array of string values that are the file names. + */ + fileNames: string[]; +} +/** + * A method that will handle the client FileDownloading event. + */ +interface ASPxClientFileManagerFileDownloadingEventHandler { + /** + * A method that will handle the FileDownloading event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerFileDownloadingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFileDownloadingEventArgs): void; +} +/** + * Provides data for the FileDownloading event. + */ +interface ASPxClientFileManagerFileDownloadingEventArgs extends ASPxClientFileManagerFileEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event, should be canceled. + * Value: true, if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that will handle the client FocusedItemChanged event. + */ +interface ASPxClientFileManagerFocusedItemChangedEventHandler { + /** + * A method that will handle the FocusedItemChanged event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerFocusedItemChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerFocusedItemChangedEventArgs): void; +} +/** + * Provides data for the FocusedItemChanged event. + */ +interface ASPxClientFileManagerFocusedItemChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the file manager item object related to the event. + * Value: An object, manipulations on which forced the event to be raised. + */ + item: ASPxClientFileManagerItem; + /** + * Gets the name of the focused item. + * Value: A string value that specifies the item's name. + */ + name: string; + /** + * Gets the full name of the item currently being processed. + * Value: A string value that is the item's full name. + */ + fullName: string; +} +/** + * A method that will handle the client CurrentFolderChanged event. + */ +interface ASPxClientFileManagerCurrentFolderChangedEventHandler { + /** + * A method that will handle the CurrentFolderChanged event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerCurrentFolderChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerCurrentFolderChangedEventArgs): void; +} +/** + * Provides data for the CurrentFolderChanged event. + */ +interface ASPxClientFileManagerCurrentFolderChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the currently processed folder. + * Value: A string value that specifies the folder's name. + */ + name: string; + /** + * Gets the full name of the folder currently being processed. + * Value: A string value that is the folder's full name. + */ + fullName: string; +} +/** + * A method that will handle the client SelectionChanged event. + */ +interface ASPxClientFileManagerSelectionChangedEventHandler { + /** + * A method that will handle the SelectionChanged event. + * @param source The event source. Identifies the ASPxFileManager control that raised the event. + * @param e A ASPxClientFileManagerSelectionChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerSelectionChangedEventArgs): void; +} +/** + * Provides data for the SelectionChanged event. + */ +interface ASPxClientFileManagerSelectionChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the file manager item object related to the event. + * Value: An object, manipulations on which forced the event to be raised. + */ + item: ASPxClientFileManagerItem; + /** + * Gets the name of the currently processed file. + * Value: A string value that specifies the file's name. + */ + name: string; + /** + * Gets the full name of the file currently being processed. + * Value: A string value that is the file's full name. + */ + fullName: string; + /** + * Gets whether the item has been selected. + * Value: true if the file has been selected; otherwise, false. + */ + isSelected: boolean; +} +/** + * A method that will handle the CustomCommand event. + */ +interface ASPxClientFileManagerCustomCommandEventHandler { + /** + * A method that will handle the CustomCommand event. + * @param source The event source. + * @param e An ASPxClientFileManagerCustomCommandEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerCustomCommandEventArgs): void; +} +/** + * Provides data for the CustomCommand event. + */ +interface ASPxClientFileManagerCustomCommandEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the processed command. + * Value: A string value that is the processed command's name. + */ + commandName: string; +} +/** + * A method that will handle the ToolbarUpdating event. + */ +interface ASPxClientFileManagerToolbarUpdatingEventHandler { + /** + * A method that will handle the ToolbarUpdating event. + * @param source The event source. + * @param e An ASPxClientFileManagerToolbarUpdatingEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerToolbarUpdatingEventArgs): void; +} +/** + * Provides data for the ToolbarUpdating event. + */ +interface ASPxClientFileManagerToolbarUpdatingEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the currently active file manager area. + * Value: A string value that identifies the active area. + */ + activeAreaName: string; +} +/** + * A method that will handle the client HighlightItemTemplate event. + */ +interface ASPxClientFileManagerHighlightItemTemplateEventHandler { + /** + * A method that will handle the HighlightItemTemplate event. + * @param source The event source. This parameter identifies the file manager object that raised the event. + * @param e An ASPxClientFileManagerHighlightItemTemplateEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFileManagerHighlightItemTemplateEventArgs): void; +} +/** + * Provides data for the HighlightItemTemplate event. + */ +interface ASPxClientFileManagerHighlightItemTemplateEventArgs extends ASPxClientEventArgs { + /** + * Gets a string that is a filter value specified by the filter box. + * Value: A string that is a filter value. + */ + filterValue: string; + /** + * Gets the name of the item currently being processed. + * Value: A string that is the item name. + */ + itemName: string; + /** + * Gets an element containing the item template. + * Value: An object that is an element containing the item template. + */ + templateElement: string; + /** + * Get the name of the cascading style sheet (CSS) class associated with an item in the highlighted state. + * Value: A string that is the name of a CSS class. + */ + highlightCssClassName: string; +} +/** + * Represents a client-side equivalent of the menu's MenuItem object. + */ +interface ASPxClientMenuItem { + /** + * Gets the menu object to which the current item belongs. + * Value: An ASPxClientMenuBase object representing the menu to which the item belongs. + */ + menu: ASPxClientMenuBase; + /** + * Gets the immediate parent item to which the current item belongs. + * Value: An ASPxClientMenuItem object representing the item's immediate parent. + */ + parent: ASPxClientMenuItem; + /** + * Gets the item's index within the parent's collection of items. + * Value: An integer value representing the item's zero-based index within the Items collection of the parent object (a menu or item) to which the item belongs. + */ + index: number; + /** + * Gets the name that uniquely identifies the menu item. + * Value: A string value that represents the value assigned to the item's Name property. + */ + name: string; + /** + * For internal use only. + */ + indexPath: string; + /** + * Returns the number of the current menu item's immediate child items. + */ + GetItemCount(): number; + /** + * Returns the current menu item's immediate subitem specified by its index. + * @param index An integer value specifying the zero-based index of the submenu item to be retrieved. + */ + GetItem(index: number): ASPxClientMenuItem; + /** + * Returns the current menu item's subitem specified by its name. + * @param name A string value specifying the name of the menu item. + */ + GetItemByName(name: string): ASPxClientMenuItem; + /** + * Indicates whether the menu item is checked. + */ + GetChecked(): boolean; + /** + * Specifies whether the menu item is checked. + * @param value true if the menu item is checked; otherwise, false. + */ + SetChecked(value: boolean): void; + /** + * Returns a value specifying whether a menu item is enabled. + */ + GetEnabled(): boolean; + /** + * Specifies whether the menu item is enabled. + * @param value true to enable the menu item; otherwise, false. + */ + SetEnabled(value: boolean): void; + /** + * Returns the URL pointing to the image displayed within the menu item. + */ + GetImageUrl(): string; + /** + * Sets the URL which points to the image displayed within the menu item. + * @param value A string value specifying the URL to the image displayed within the menu item. + */ + SetImageUrl(value: string): void; + /** + * Gets a URL which defines the navigation location for the menu item. + */ + GetNavigateUrl(): string; + /** + * Specifies a URL which defines the navigation location for the menu item. + * @param value A string value which specifies a URL to where the client web browser will navigate when the menu item is clicked. + */ + SetNavigateUrl(value: string): void; + /** + * Returns text displayed within the menu item. + */ + GetText(): string; + /** + * Sets the text to be displayed within the menu item. + * @param value A string value specifying the text to be displayed within the menu item. + */ + SetText(value: string): void; + /** + * Returns a value specifying whether a menu item is displayed. + */ + GetVisible(): boolean; + /** + * Specifies the menu item's visibility. + * @param value true if the menu item is visible; otherwise, false. + */ + SetVisible(value: boolean): void; +} +/** + * A client-side equivalent of the file manager's FileManagerToolbarItemBase object. + */ +interface ASPxClientFileManagerToolbarItem extends ASPxClientMenuItem { + /** + * This property is not in effect for the ASPxClientFileManagerToolbarItem class. + */ + menu: ASPxClientMenuBase; + /** + * This property is not in effect for the ASPxClientFileManagerToolbarItem class. + */ + parent: ASPxClientMenuItem; + /** + * This property is not in effect for the ASPxClientFileManagerToolbarItem class. + */ + index: number; +} +/** + * A client-side equivalent of the ASPxFormLayout's LayoutItem object. + */ +interface ASPxClientLayoutItem { + /** + * Gets the form layout object to which the current item belongs. + * Value: An object representing the form layout to which the item belongs. + */ + formLayout: ASPxClientFormLayout; + /** + * Gets the name that uniquely identifies the layout item. + * Value: A string value that represents the value assigned to the layout item's Name property. + */ + name: string; + /** + * Gets the immediate parent layout item to which the current layout item belongs. + * Value: An object representing the item's immediate parent. + */ + parent: ASPxClientLayoutItem; + /** + * Returns the current layout item's subitem specified by its name. + * @param name A string value specifying the name of the layout item. + */ + GetItemByName(name: string): ASPxClientLayoutItem; + /** + * Returns a value specifying whether a layout item is displayed. + */ + GetVisible(): boolean; + /** + * Specifies the layout item's visibility. + * @param value true, if the layout item is visible; otherwise, false. + */ + SetVisible(value: boolean): void; + /** + * Specifies the text displayed in the layout item caption. + * @param caption A string value specifying the item caption. + */ + SetCaption(caption: string): void; + /** + * Returns the text displayed in the layout item caption. + */ + GetCaption(): string; +} +/** + * Represents a client-side equivalent of the ASPxFormLayout object. + */ +interface ASPxClientFormLayout extends ASPxClientControl { + /** + * Returns an item specified by its name. + * @param name A string value specifying the name of the item. + */ + GetItemByName(name: string): ASPxClientLayoutItem; +} +/** + * Represents a client-side equivalent of the ASPxGlobalEvents component. + */ +interface ASPxClientGlobalEvents { + /** + * Occurs on the client side after client object models of all DevExpress web controls contained within the page have been initialized. + */ + ControlsInitialized: ASPxClientEvent>; + /** + * Occurs when the browser window is being resized. + */ + BrowserWindowResized: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated by any DevExpress control. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side, after server-side processing of a callback initiated by any DevExpress web control, has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by any of DevExpress web controls. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client side after the validation initiated for a DevExpress web control (or a group of DevExpress web controls) has been completed. + */ + ValidationCompleted: ASPxClientEvent>; +} +/** + * Represents a client-side equivalent of the ASPxHiddenField control. + */ +interface ASPxClientHiddenField extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientHiddenField. + */ + CallbackError: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Adds a new value to the control's collection of property name/value pairs, on the client side. + * @param propertyName A string value that specifies the property name. It can contain letters, digits, underline characters, and dollar signs. It cannot begin with a digit character. + * @param propertyValue An object that represents the value of the specified property. + */ + Add(propertyName: string, propertyValue: Object): void; + /** + * Returns the value with the specified property name. + * @param propertyName A string value that specifies the property name. + */ + Get(propertyName: string): Object; + /** + * Adds a new value to the control's collection of property name/value pairs, on the client side. + * @param propertyName A string value that specifies the property name. It can contain letters, digits, underline characters, and dollar signs. It cannot begin with a digit character. + * @param propertyValue An object that represents the property value. + */ + Set(propertyName: string, propertyValue: Object): void; + /** + * Removes the specified value from the ASPxHiddenField collection. + * @param propertyName A string value representing the property name. + */ + Remove(propertyName: string): void; + /** + * Clears the ASPxHiddenField's value collection. + */ + Clear(): void; + /** + * Returns a value indicating whether the value with the specified property name is contained within the ASPxHiddenField control's value collection. + * @param propertyName A string value that specifies the property name. + */ + Contains(propertyName: string): boolean; +} +/** + * The client-side equivalent of the ASPxImageGallery control. + */ +interface ASPxClientImageGallery extends ASPxClientDataView { + /** + * Fires on the client side before the fullscreen viewer is shown and allows you to cancel the action. + */ + FullscreenViewerShowing: ASPxClientEvent>; + /** + * Occurs on the client side after an active item has been changed within the fullscreen viewer. + */ + FullscreenViewerActiveItemIndexChanged: ASPxClientEvent>; + /** + * Shows the fullscreen viewer with the specified active item. + * @param index An Int32 value that is an index of the active item. + */ + ShowFullscreenViewer(index: number): void; + /** + * Hides the fullscreen viewer. + */ + HideFullscreenViewer(): void; + /** + * Makes the specified item active within the fullscreen viewer on the client side. + * @param index An integer value specifying the index of the item to select. + * @param preventAnimation true to prevent the animation effect; false to change images using animation. + */ + SetFullscreenViewerActiveItemIndex(index: number, preventAnimation: boolean): void; + /** + * Gets the number of items contained in the control's item collection. + */ + GetFullscreenViewerItemCount(): number; + /** + * Returns the index of the active item within the fullscreen viewer. + */ + GetFullscreenViewerActiveItemIndex(): number; + /** + * Plays a slide show within a fullscreen viewer. + */ + PlaySlideShow(): void; + /** + * Pauses a slide show within a fullscreen viewer. + */ + PauseSlideShow(): void; +} +/** + * A method that will handle the client FullscreenViewerShowing event. + */ +interface ASPxClientImageGalleryCancelEventHandler { + /** + * A method that will handle the FullscreenViewerShowing event. + * @param source The event source. Identifies the ASPxImageGallery control that raised the event. + * @param e An ASPxClientImageGalleryCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientImageGalleryCancelEventArgs): void; +} +/** + * Provides data for the FullscreenViewerShowing event. + */ +interface ASPxClientImageGalleryCancelEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the index of the item related to the event. + * Value: An value that is the related item's index. + */ + index: number; + /** + * Gets the unique identifier name of the item related to the event. + * Value: A string value that specifies the item's unique identifier name. + */ + name: string; +} +/** + * A method that will handle the client FullscreenViewerActiveItemIndexChanged event. + */ +interface ASPxClientImageGalleryFullscreenViewerEventHandler { + /** + * A method that will handle the FullscreenViewerActiveItemIndexChanged event. + * @param source The event source. Identifies the ASPxImageGallery control that raised the event. + * @param e An ASPxClientImageGalleryFullscreenViewerEventArgs object that contains event data. + */ + (source: S, e: ASPxClientImageGalleryFullscreenViewerEventArgs): void; +} +/** + * Provides data for the FullscreenViewerActiveItemIndexChanged event. + */ +interface ASPxClientImageGalleryFullscreenViewerEventArgs extends ASPxClientEventArgs { + /** + * Gets the index of the item related to the event. + * Value: An value that is the related item's index. + */ + index: number; + /** + * Gets the unique identifier name of the item related to the event. + * Value: A string value that specifies the item's unique identifier name. + */ + name: string; +} +/** + * A client-side equivalent of the ASPxImageSlider object. + */ +interface ASPxClientImageSlider extends ASPxClientControl { + /** + * Occurs after the active image, displayed within the image area, is changed. + */ + ActiveItemChanged: ASPxClientEvent>; + /** + * Fires after an image item has been clicked within the image area. + */ + ItemClick: ASPxClientEvent>; + /** + * Occurs on the client side when a thumbnail is clicked. + */ + ThumbnailItemClick: ASPxClientEvent>; + /** + * Returns an item specified by its index within the image slider's item collection. + * @param index An integer value specifying the zero-based index of the item to be retrieved. + */ + GetItem(index: number): ASPxClientImageSliderItem; + /** + * Returns an item specified by its name. + * @param name A string value specifying the name of the item. + */ + GetItemByName(name: string): ASPxClientImageSliderItem; + /** + * Returns the index of the active item within the image slider control. + */ + GetActiveItemIndex(): number; + /** + * Makes the specified item active within the image slider control on the client side. + * @param index An integer value specifying the index of the item to select. + * @param preventAnimation true to prevent the animation effect; false to change images using animation. + */ + SetActiveItemIndex(index: number, preventAnimation: boolean): void; + /** + * Returns the active item within the ASPxImageSlider control. + */ + GetActiveItem(): ASPxClientImageSliderItem; + /** + * Makes the specified item active within the image slider control on the client side. + * @param item An ASPxClientImageSliderItem object specifying the item to select. + * @param preventAnimation true to prevent animation effect; false to enable animation. + */ + SetActiveItem(item: ASPxClientImageSliderItem, preventAnimation: boolean): void; + /** + * Gets the number of items contained in the control's item collection. + */ + GetItemCount(): number; + /** + * Sets input focus to the ASPxImageSlider control. + */ + Focus(): void; + /** + * Plays a slide show within an image slider. + */ + Play(): void; + /** + * Pauses a slide show within image slider. + */ + Pause(): void; + /** + * Gets a value indicating whether the slide show is playing. + */ + IsSlideShowPlaying(): boolean; +} +/** + * A method that will handle the ItemClick events. + */ +interface ASPxClientImageSliderItemEventHandler { + /** + * A method that will handle the ItemClick events. + * @param source The event source. Identifies the ASPxImageSlider control that raised the event. + * @param e An ASPxClientImageSliderItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientImageSliderItemEventArgs): void; +} +/** + * Provides data for the ItemClick events. + */ +interface ASPxClientImageSliderItemEventArgs extends ASPxClientEventArgs { + /** + * Gets an item object related to the event. + * Value: An object, manipulations on which forced the event to be raised. + */ + item: ASPxClientImageSliderItem; +} +/** + * A client-side equivalent of the image slider's ImageSliderItem object. + */ +interface ASPxClientImageSliderItem { + /** + * Gets an image slider to which the current item belongs. + * Value: An object that is the item's owner. + */ + imageSlider: ASPxClientImageSlider; + /** + * Gets the item's index within an items collection. + * Value: An integer value is the item's zero-based index within the Items collection. + */ + index: number; + /** + * Gets the name that uniquely identifies the image slider item. + * Value: A string value that is the value assigned to the item's Name property. + */ + name: string; + /** + * Gets or sets the path to the image displayed within the ASPxClientImageSliderItem. + * Value: A value specifying the path to the image. + */ + imageUrl: string; + /** + * Gets the item's display text. + * Value: A string value that is the item's display text. + */ + text: string; +} +/** + * The client-side equivalent of the ASPxImageZoomNavigator object. + */ +interface ASPxClientImageZoomNavigator extends ASPxClientImageSlider { +} +/** + * A client-side equivalent of the ASPxImageZoom object. + */ +interface ASPxClientImageZoom extends ASPxClientControl { + /** + * Sets the properties on an image displayed in the image zoom control. + * @param imageUrl A string value specifying the path to the preview image displayed in the preview image. + * @param largeImageUrl A string value specifying the path to the preview image displayed in the zoom window and the expand window. + * @param zoomWindowText A string value specifying the text displayed in the zoom window. + * @param expandWindowText A string value specifying the text displayed in the expand window. + * @param alternateText A string value that specifies the alternate text displayed instead of the image. + */ + SetImageProperties(imageUrl: string, largeImageUrl: string, zoomWindowText: string, expandWindowText: string, alternateText: string): void; +} +/** + * Represents a client-side equivalent of the ASPxLoadingPanel control. + */ +interface ASPxClientLoadingPanel extends ASPxClientControl { + /** + * Invokes the loading panel. + */ + Show(): void; + /** + * Invokes the loading panel, displaying it over the specified HTML element. + * @param htmlElement An object that specifies the required HTML element. + */ + ShowInElement(htmlElement: Object): void; + /** + * Invokes the loading panel, displaying it over the specified element. + * @param id A string that specifies the required element's identifier. + */ + ShowInElementByID(id: string): void; + /** + * Invokes the loading panel at the specified position. + * @param x An integer value specifying the x-coordinate of the loading panel's display position. + * @param y An integer value specifying the y-coordinate of the loaidng panel's display position. + */ + ShowAtPos(x: number, y: number): void; + /** + * Sets the text to be displayed within the ASPxLoadingPanel. + * @param text A string value specifying the text to be displayed within the ASPxLoadingPanel. + */ + SetText(text: string): void; + /** + * Gets the text displayed within the ASPxLoadingPanel. + */ + GetText(): string; + /** + * Hides the loading panel. + */ + Hide(): void; +} +/** + * Serves as the base type for the ASPxClientPopupMenu objects. + */ +interface ASPxClientMenuBase extends ASPxClientControl { + /** + * Fires after a menu item has been clicked. + */ + ItemClick: ASPxClientEvent>; + /** + * Occurs on the client side when the mouse cursor is moved into a menu item. + */ + ItemMouseOver: ASPxClientEvent>; + /** + * Occurs on the client side when the mouse cursor moves outside a menu item. + */ + ItemMouseOut: ASPxClientEvent>; + /** + * Occurs on the client side when a submenu pops up. + */ + PopUp: ASPxClientEvent>; + /** + * Occurs on the client side when a submenu closes. + */ + CloseUp: ASPxClientEvent>; + /** + * Returns the number of menu items at the root menu level. + */ + GetItemCount(): number; + /** + * Returns the menu's root menu item specified by its index. + * @param index An integer value specifying the zero-based index of the root menu item to be retrieved. + */ + GetItem(index: number): ASPxClientMenuItem; + /** + * Returns a menu item specified by its name. + * @param name A string value specifying the name of the menu item. + */ + GetItemByName(name: string): ASPxClientMenuItem; + /** + * Returns the selected item within the menu control. + */ + GetSelectedItem(): ASPxClientMenuItem; + /** + * Selects the specified menu item within a menu control on the client side. + * @param item An ASPxClientMenuItem object specifying the menu item to select. + */ + SetSelectedItem(item: ASPxClientMenuItem): void; + /** + * Returns a root menu item. + */ + GetRootItem(): ASPxClientMenuItem; +} +/** + * Represents a client collection that maintains client menu objects. + */ +interface ASPxClientMenuCollection extends ASPxClientControlCollection { + /** + * Recalculates the position of visible sub menus. + */ + RecalculateAll(): void; + /** + * Hides all menus maitained by the collection. + */ + HideAll(): void; +} +/** + * Represents a client-side equivalent of the ASPxMenu object. + */ +interface ASPxClientMenu extends ASPxClientMenuBase { + /** + * Gets a value specifying the menu orientation. + */ + GetOrientation(): string; + /** + * Sets the menu orientation. + * @param orientation 'Vertical' to orient the menu vertically; 'Horizontal' to orient the menu horizontally. + */ + SetOrientation(orientation: string): void; +} +/** + * A method that will handle the menu's client events concerning manipulations with an item. + */ +interface ASPxClientMenuItemEventHandler { + /** + * A method that will handle the menu's client events concerning manipulations with an item. + * @param source The event source. This parameter identifies the menu object which raised the event. + * @param e An ASPxClientMenuItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientMenuItemEventArgs): void; +} +/** + * Provides data for events which concern manipulations on menu items. + */ +interface ASPxClientMenuItemEventArgs extends ASPxClientEventArgs { + /** + * Gets the menu item object related to the event. + * Value: An ASPxClientMenuItem object, manipulations on which forced the event to be raised. + */ + item: ASPxClientMenuItem; +} +/** + * A method that will handle client events which relate to mouse hovering (such as entering or leaving) over menu items. + */ +interface ASPxClientMenuItemMouseEventHandler { + /** + * A method that will handle the ItemMouseOver events. + * @param source An object representing the event source. + * @param e A MenuItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientMenuItemMouseEventArgs): void; +} +/** + * Provides data for client events which relate to mouse hovering (such as entering or leaving) over menu items. + */ +interface ASPxClientMenuItemMouseEventArgs extends ASPxClientMenuItemEventArgs { + /** + * Gets the HTML object that contains the processed item. + * Value: An HTML object representing a container for the item related to the event. + */ + htmlElement: Object; +} +/** + * A method that will handle client events concerning clicks on the control's items. + */ +interface ASPxClientMenuItemClickEventHandler { + /** + * A method that will handle client ItemClick events. + * @param source An object representing the event source. + * @param e A MenuItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientMenuItemClickEventArgs): void; +} +/** + * Provides data for events which concern clicking on the control's items. + */ +interface ASPxClientMenuItemClickEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the menu item object related to the event. + * Value: An ASPxClientMenuItem object, manipulations on which forced the event to be raised. + */ + item: ASPxClientMenuItem; + /** + * Gets the HTML object that contains the processed item. + * Value: An object representing a container for the item related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * Contains options affecting the touch scrolling functionality. + */ +interface ASPxClientTouchUIOptions { + /** + * Gets or sets a value that specifies whether or not the horizontal scroll bar should be displayed. + * Value: true to display the horizontal scroll bar; otherwise, false. The default value is true. + */ + showHorizontalScrollbar: boolean; + /** + * Gets or sets a value that specifies whether or not the vertical scroll bar should be displayed. + * Value: true to display the vertical scroll bar; otherwise, false. The default value is true. + */ + showVerticalScrollbar: boolean; + /** + * Gets or sets the name of the CSS class defining the vertical scroll bar's appearance. + * Value: A string value specifying the class name. + */ + vScrollClassName: string; + /** + * Gets or sets the name of the CSS class defining the horizontal scroll bar's appearance. + * Value: A string value specifying the class name. + */ + hScrollClassName: string; +} +/** + * Contains a method allowing you to apply the current scroll extender to a specific element. + */ +interface ScrollExtender { + /** + * Applies the current scroll extender to the element specified by the ID. + * @param id A string value specifying the element's ID. + */ + ChangeElement(id: string): void; + /** + * Applies the current scroll extender to the specified DOM element. + * @param element An object specifying the required DOM element. + */ + ChangeElement(element: Object): void; +} +/** + * Represents a client-side equivalent of the ASPxNavBar control. + */ +interface ASPxClientNavBar extends ASPxClientControl { + /** + * Fires after an item has been clicked. + */ + ItemClick: ASPxClientEvent>; + /** + * Fires on the client side after a group's expansion state has been changed. + */ + ExpandedChanged: ASPxClientEvent>; + /** + * Fires on the client side before the expansion state of a group is changed. + */ + ExpandedChanging: ASPxClientEvent>; + /** + * Fires when a group header is clicked. + */ + HeaderClick: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientNavBar. + */ + CallbackError: ASPxClientEvent>; + /** + * Returns the number of groups in the navbar. + */ + GetGroupCount(): number; + /** + * Returns a group specified by its index. + * @param index An integer value specifying the zero-based index of the group object to retrieve. + */ + GetGroup(index: number): ASPxClientNavBarGroup; + /** + * Returns a group specified by its name. + * @param name A string value specifying the name of the group. + */ + GetGroupByName(name: string): ASPxClientNavBarGroup; + /** + * Returns the navbar's active group. + */ + GetActiveGroup(): ASPxClientNavBarGroup; + /** + * Makes the specified group active. + * @param group A ASPxClientNavBarGroup object that specifies the active group. + */ + SetActiveGroup(group: ASPxClientNavBarGroup): void; + /** + * Returns an item specified by its name. + * @param name A string value specifying the name of the item. + */ + GetItemByName(name: string): ASPxClientNavBarItem; + /** + * Returns the selected item within the navbar control. + */ + GetSelectedItem(): ASPxClientNavBarItem; + /** + * Selects the specified item within the navbar control on the client side. + * @param item An ASPxClientNavBarItem object specifying the item to select. + */ + SetSelectedItem(item: ASPxClientNavBarItem): void; + /** + * Collapses all groups of the navbar. + */ + CollapseAll(): void; + /** + * Expands all groups of the navbar. + */ + ExpandAll(): void; +} +/** + * Represents a client-side equivalent of the navbar's NavBarGroup object. + */ +interface ASPxClientNavBarGroup { + /** + * Gets the navbar to which the current group belongs. + * Value: An ASPxClientNavBar object representing the navbar to which the group belongs. + */ + navBar: ASPxClientNavBar; + /** + * Gets the group's index within a collection of a navbar's groups. + * Value: An integer value representing the group's zero-based index within the Groups collection of the navbar to which the group belongs. + */ + index: number; + /** + * Gets the name that uniquely identifies the group. + * Value: A string value that represents the value assigned to the group's Name property. + */ + name: string; + /** + * Returns a value specifying whether a group is enabled. + */ + GetEnabled(): boolean; + /** + * Returns a value specifying whether the group is expanded. + */ + GetExpanded(): boolean; + /** + * Sets the group's expansion state. + * @param value true to expand the group; false to collapse the group. + */ + SetExpanded(value: boolean): void; + /** + * Returns a value specifying whether a group is displayed. + */ + GetVisible(): boolean; + /** + * Returns text displayed within a group. + */ + GetText(): string; + /** + * Specifies the text displayed within a group. + * @param text A string value that is the text displayed within the navbar group. + */ + SetText(text: string): void; + /** + * Specifies whether the group is visible. + * @param value true if the group is visible; otherwise, false. + */ + SetVisible(value: boolean): void; + /** + * Returns the number of items in the group. + */ + GetItemCount(): number; + /** + * Returns the group's item specified by its index. + * @param index An integer value specifying the zero-based index of the item to be retrieved. + */ + GetItem(index: number): ASPxClientNavBarItem; + /** + * Returns a group item specified by its name. + * @param name A string value specifying the name of the item. + */ + GetItemByName(name: string): ASPxClientNavBarItem; +} +/** + * Represents a client-side equivalent of the navbar's NavBarItem object. + */ +interface ASPxClientNavBarItem { + /** + * Gets the navbar to which the current item belongs. + * Value: An ASPxClientNavBar object representing the navbar to which the item belongs. + */ + navBar: ASPxClientNavBar; + /** + * Gets the group to which the current item belongs. + * Value: An ASPxClientNavBarGroup object representing the group to which the item belongs. + */ + group: ASPxClientNavBarGroup; + /** + * Gets the item's index within a collection of a group's items. + * Value: An integer value representing the item's zero-based index within the Items collection of the group to which the item belongs. + */ + index: number; + /** + * Gets the name that uniquely identifies the item. + * Value: A string value that represents the value assigned to the item's Name property. + */ + name: string; + /** + * Returns a value indicating whether an item is enabled. + */ + GetEnabled(): boolean; + /** + * Specifies whether the item is enabled. + * @param value true if the item is enabled; otherwise, false. + */ + SetEnabled(value: boolean): void; + /** + * Returns the URL which points to the image displayed within the item. + */ + GetImageUrl(): string; + /** + * Specifies the URL which points to the image displayed within the item. + * @param value A string value that specifies the URL to the image displayed within the item. + */ + SetImageUrl(value: string): void; + /** + * Gets an URL which defines the item's navigation location. + */ + GetNavigateUrl(): string; + /** + * Specifies a URL which defines the item's navigation location. + * @param value A string value which represents the URL to where the client web browser will navigate when the item is clicked. + */ + SetNavigateUrl(value: string): void; + /** + * Returns text displayed within the item. + */ + GetText(): string; + /** + * Specifies the text displayed within the item. + * @param value A string value that represents the text displayed within the item. + */ + SetText(value: string): void; + /** + * Returns a value specifying whether an item is displayed. + */ + GetVisible(): boolean; + /** + * Specifies whether the item is visible. + * @param value true is the item is visible; otherwise, false. + */ + SetVisible(value: boolean): void; +} +/** + * A method that will handle the navbar's client events concerning manipulations with an item. + */ +interface ASPxClientNavBarItemEventHandler { + /** + * A method that will handle the navbar's client events concerning manipulations with an item. + * @param source An object representing the event's source. Identifies the navbar object that raised the event. + * @param e An ASPxClientNavBarItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientNavBarItemEventArgs): void; +} +/** + * Provides data for events which concern manipulations on items. + */ +interface ASPxClientNavBarItemEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the item object related to the event. + * Value: An ASPxClientNavBarItem object, manipulations on which forced the event to be raised. + */ + item: ASPxClientNavBarItem; + /** + * Gets the HTML object that contains the processed navbar item. + * Value: An object representing a container for the navbar item related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * A method that will handle the navbar's client events concerning manipulations with a group. + */ +interface ASPxClientNavBarGroupEventHandler { + /** + * A method that will handle the navbar's client events concerning manipulations with a group. + * @param source An object representing the event's source. Identifies the navbar object that raised the event. + * @param e An ASPxClientNavBarGroupEventArgs object that contains event data. + */ + (source: S, e: ASPxClientNavBarGroupEventArgs): void; +} +/** + * Provides data for events which concern manipulations on groups. + */ +interface ASPxClientNavBarGroupEventArgs extends ASPxClientEventArgs { + /** + * Gets the group object related to the event. + * Value: An ASPxClientNavBarGroup object, manipulations on which forced the event to be raised. + */ + group: ASPxClientNavBarGroup; +} +/** + * A method that will handle the navbar's cancelable client events concerning manipulations with a group. + */ +interface ASPxClientNavBarGroupCancelEventHandler { + /** + * A method that will handle the navbar's cancelable client events concerning manipulations with a group. + * @param source An object representing the event's source. Identifies the navbar object that raised the event. + * @param e An ASPxClientNavBarGroupCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientNavBarGroupCancelEventArgs): void; +} +/** + * Provides data for cancellable events which concern manipulations on groups. + */ +interface ASPxClientNavBarGroupCancelEventArgs extends ASPxClientProcessingModeCancelEventArgs { + /** + * Gets the group object related to the event. + * Value: An ASPxClientNavBarGroup object representing the group manipulations on which forced the navbar to raise the event. + */ + group: ASPxClientNavBarGroup; +} +/** + * A method that will handle client events concerning clicks on the control's group headers. + */ +interface ASPxClientNavBarGroupClickEventHandler { + /** + * A method that will handle the navbar's client events concerning clicks on groups. + * @param source The event source. This parameter identifies the navbar object which raised the event. + * @param e An ASPxClientNavBarGroupClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientNavBarGroupClickEventArgs): void; +} +/** + * Provides data for events which concern clicking on the control's group headers. + */ +interface ASPxClientNavBarGroupClickEventArgs extends ASPxClientNavBarGroupCancelEventArgs { + /** + * Gets the HTML object that contains the processed group. + * Value: An object representing a container for the group related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * Represents a client-side equivalent of the ASPxNewsControl object. + */ +interface ASPxClientNewsControl extends ASPxClientDataView { + /** + * Fires after an item's tail has been clicked. + */ + TailClick: ASPxClientEvent>; +} +/** + * A method that will handle client events concerning manipulations with an item. + */ +interface ASPxClientNewsControlItemEventHandler { + /** + * A method that will handle the news control's client events concerning manipulations with an item. + * @param source An object representing the event's source. Identifies the news control object that raised the event. + * @param e An ASPxClientNewsControlItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientNewsControlItemEventArgs): void; +} +/** + * Provides data for events which concern tail clicking within the control's items. + */ +interface ASPxClientNewsControlItemEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the name that uniquely identifies the processed item. + * Value: A string value that represents the value assigned to the processed item's Name property. + */ + name: Object; + /** + * Gets the HTML object that contains the processed item. + * Value: An object representing a container for the item related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * Represents a client-side equivalent of the ASPxObjectContainer control. + */ +interface ASPxClientObjectContainer extends ASPxClientControl { + /** + * Occurs on the client side when the FSCommand action is called within the associated flash object's action script. + */ + FlashScriptCommand: ASPxClientEvent>; + /** + * Play the Flash movie backwards. + */ + Back(): void; + /** + * Returns the value of the Flash variable specified. + * @param name A string value that specifies the Flash variable. + */ + GetVariable(name: string): string; + /** + * Play the Flash movie forwards. + */ + Forward(): void; + /** + * Activates the specified frame in the Flash movie. + * @param frameNumber An integer value that specifies the requested frame. + */ + GotoFrame(frameNumber: number): void; + /** + * Indicates whether the Flash movie is currently playing. + */ + IsPlaying(): boolean; + /** + * Loads the Flash movie to the specified layer. + * @param layerNumber An integer value that identifies a layer in which to load the movie. + * @param url A string value that specifies the movie's URL. + */ + LoadMovie(layerNumber: number, url: string): void; + /** + * Pans a zoomed-in Flash movie to the specified coordinates. + * @param x An integer value that specifies the X-coordinate. + * @param y An integer value that specifies the Y-coordinate. + * @param mode 0 the coordinates are pixels; 1 the coordinates are a percentage of the window. + */ + Pan(x: number, y: number, mode: number): void; + /** + * Returns the percent of the Flash Player movie that has streamed into the browser so far. + */ + PercentLoaded(): string; + /** + * Starts playing the Flash movie. + */ + Play(): void; + /** + * Rewinds the Flash movie to the first frame. + */ + Rewind(): void; + /** + * Sets the value of the specified Flash variable. + * @param name A string value that specifies the Flash variable. + * @param value A string value that represents a new value. + */ + SetVariable(name: string, value: string): void; + /** + * Zooms in on the specified rectangular area of the Flash movie. + * @param left An integer value that specifies the x-coordinate of the rectangle's left side, in twips. + * @param top An integer value that specifies the y-coordinate of the rectangle's top side, in twips. + * @param right An integer value that specifies the x-coordinate of the rectangle's right side, in twips. + * @param bottom An integer value that specifies the y-coordinate of the rectangle's bottom side, in twips. + */ + SetZoomRect(left: number, top: number, right: number, bottom: number): void; + /** + * Stops playing the Flash movie. + */ + StopPlay(): void; + /** + * Returns the total number of frames in the Flash movie. + */ + TotalFrames(): number; + /** + * Zooms the Flash view by a relative scale factor. + * @param percent An integer value that specifies the relative scale factor, as a percentage. + */ + Zoom(percent: number): void; + /** + * Starts playing a Quick Time movie. + */ + QTPlay(): void; + /** + * Stops playing a Quick Time movie. + */ + QTStopPlay(): void; + /** + * Rewinds a Quick Time movie to the first frame. + */ + QTRewind(): void; + /** + * Steps through a Quick Time video stream by a specified number of frames. + * @param count An integer value that specifies the number of frames to step. + */ + QTStep(count: number): void; +} +/** + * A method that will handle the FlashScriptCommand event. + */ +interface ASPxClientFlashScriptCommandEventHandler { + /** + * A method that will handle the FlashScriptCommand event. + * @param source The event source. + * @param e A ASPxClientFlashScriptCommandEventArgs object that contains event data. + */ + (source: S, e: ASPxClientFlashScriptCommandEventArgs): void; +} +/** + * Provides data for the FlashScriptCommand client event. + */ +interface ASPxClientFlashScriptCommandEventArgs extends ASPxClientEventArgs { + /** + * Gets a command passed via the FSCommand action of the flash object. + * Value: A string that represents the value of the FSCommand action's command parameter. + */ + command: string; + /** + * Gets arguments passed via the FSCommand action of the flash object. + * Value: A string that represents the value of the FSCommand action's args parameter. + */ + args: string; +} +/** + * Lists the available link types within office documents. + */ +interface ASPxClientOfficeDocumentLinkType { +} +interface ASPxClientPager extends ASPxClientControl { +} +/** + * Represents a client-side equivalent of the ASPxPopupControl control. + */ +interface ASPxClientPopupControl extends ASPxClientPopupControlBase { + /** + * Occurs when a popup window's close button is clicked. + */ + CloseButtonClick: ASPxClientEvent>; + /** + * This method is not in effect for a ASPxClientPopupControl object. + */ + GetMainElement(): Object; + /** + * Returns an object containing the information about a mouse event that invoked a default popup window. + */ + GetPopUpReasonMouseEvent(): Object; + /** + * Returns an object containing the information about a mouse event that invoked the specified popup window. + * @param window A ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowPopUpReasonMouseEvent(window: ASPxClientPopupWindow): Object; + /** + * + * @param window + * @param parameter + */ + PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string): void; + /** + * Sends a callback with parameters to update the popup window by processing the related popup window and the passed information on the server. + * @param window A ASPxClientPopupWindow object identifying the processed popup window. + * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Specifies the default popup window's size. + * @param width An integer value that specifies the default popup window's width. + * @param height An integer value that specifies the default popup window's height. + */ + SetSize(width: number, height: number): void; + /** + * Gets the width of the specified popup window's content region. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowContentWidth(window: ASPxClientPopupWindow): number; + /** + * Gets the height of the specified popup window's content region. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowContentHeight(window: ASPxClientPopupWindow): number; + /** + * Returns the height of a specific popup window. + * @param window A ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowHeight(window: ASPxClientPopupWindow): number; + /** + * Returns the width of a specific popup window. + * @param window A ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowWidth(window: ASPxClientPopupWindow): number; + /** + * Specifies the size of a specific popup window. + * @param window A ASPxClientPopupWindow object that specifies the required popup window. + * @param width An integer value that specifies the required popup window's width. + * @param height An integer value that specifies the required popup window's height. + */ + SetWindowSize(window: ASPxClientPopupWindow, width: number, height: number): void; + /** + * Returns the HTML code that is the content of the popup control's default popup window. + */ + GetContentHTML(): string; + /** + * Defines the HTML content for the popup control's default popup window. + * @param html A string value that is the HTML code defining the content of the popup window. + */ + SetContentHTML(html: string): void; + /** + * Sets the ID of a web control or HTML element (or a list of IDs) with which the current popup control's window is associated. + * @param window An ASPxClientPopupWindow object representing a popup control's window. + * @param popupElementId A string value specifying the ID (or a list of IDs) of the web control or HTML element with which the popup control's window is associated. + */ + SetWindowPopupElementID(window: ASPxClientPopupWindow, popupElementId: string): void; + /** + * Sets the ID of a web control or HTML element (or a list of IDs) with which the current popup control is associated. + * @param popupElementId A string value specifying the ID (or a list of IDs) of the web control or HTML element to which the popup control is associated. + */ + SetPopupElementID(popupElementId: string): void; + /** + * Returns an index of the object that invoked the default window within the PopupElementID list. + */ + GetCurrentPopupElementIndex(): number; + /** + * Returns an index of the object that invoked the specified popup window, within the window's PopupElementID list. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowCurrentPopupElementIndex(window: ASPxClientPopupWindow): number; + /** + * Returns an object that invoked the default window. + */ + GetCurrentPopupElement(): Object; + /** + * Returns an object that invoked the specified popup window. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowCurrentPopupElement(window: ASPxClientPopupWindow): Object; + /** + * Returns a value that specifies whether the popup control's specific window is displayed. + * @param window A ASPxClientPopupWindow object representing the popup window whose visibility is checked. + */ + IsWindowVisible(window: ASPxClientPopupWindow): boolean; + /** + * Returns a popup window specified by its index. + * @param index An integer value specifying the zero-based index of the popup window object to be retrieved. + */ + GetWindow(index: number): ASPxClientPopupWindow; + /** + * Returns a popup window specified by its name. + * @param name A string value specifying the name of the popup window. + */ + GetWindowByName(name: string): ASPxClientPopupWindow; + /** + * Returns the number of popup windows in the popup control. + */ + GetWindowCount(): number; + /** + * Invokes the popup control's specific window. + * @param window A ASPxClientPopupWindow object representing the popup window to display. + */ + ShowWindow(window: ASPxClientPopupWindow): void; + /** + * Invokes the specified popup window at the popup element with the specified index. + * @param window A ASPxClientPopupWindow object that specifies the required popup window. + * @param popupElementIndex An integer value specifying the zero-based index of the popup element within the window's PopupElementID list. + */ + ShowWindow(window: ASPxClientPopupWindow, popupElementIndex: number): void; + /** + * Invokes the popup control's specific window and displays it over the specified HTML element. + * @param window A ASPxClientPopupWindow object representing the popup window to display. + * @param htmlElement An object specifying the HTML element relative to whose position the default popup window is invoked. + */ + ShowWindowAtElement(window: ASPxClientPopupWindow, htmlElement: Object): void; + /** + * Invokes the popup control's specific window and displays it over an HTML element specified by its unique identifier. + * @param window A ASPxClientPopupWindow object representing the popup window to display. + * @param id A string value that specifies the hierarchically qualified identifier of an HTML element relative to whose position the default popup window is invoked. + */ + ShowWindowAtElementByID(window: ASPxClientPopupWindow, id: string): void; + /** + * Invokes the popup control's specific popup window at the specified position. + * @param window A ASPxClientPopupWindow object representing the popup window to display. + * @param x A integer value specifying the x-coordinate of the popup window's display position. + * @param y A integer value specifying the y-coordinate of the popup window's display position. + */ + ShowWindowAtPos(window: ASPxClientPopupWindow, x: number, y: number): void; + /** + * Brings the specified popup window to the front of the z-order. + * @param window A ASPxClientPopupWindow object representing the popup window. + */ + BringWindowToFront(window: ASPxClientPopupWindow): void; + /** + * Closes the popup control's specified window. + * @param window A ASPxClientPopupWindow object representing the popup window to close. + */ + HideWindow(window: ASPxClientPopupWindow): void; + /** + * Returns the HTML code that represents the contents of the specified popup window. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + */ + GetWindowContentHtml(window: ASPxClientPopupWindow): string; + /** + * Defines the HTML content for a specific popup window within the popup control. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + * @param html A string value that represents the HTML code defining the content of the specified popup window. + */ + SetWindowContentHtml(window: ASPxClientPopupWindow, html: string): void; + /** + * Returns an iframe object containing a web page specified via the specified popup window's SetWindowContentUrl client method). + * @param window A ASPxClientPopupWindow object representing the required popup window. + */ + GetWindowContentIFrame(window: ASPxClientPopupWindow): Object; + /** + * Returns the URL pointing to the web page displayed within the control's specific popup window. + * @param window A ASPxClientPopupWindow object representing the required popup window. + */ + GetWindowContentUrl(window: ASPxClientPopupWindow): string; + /** + * Sets the URL pointing to the web page that should be loaded into and displayed within the control's specific popup window. + * @param window A ASPxClientPopupWindow object representing the required popup window. + * @param url A string value specifying the URL to the web page to be displayed within the specified popup window. + */ + SetWindowContentUrl(window: ASPxClientPopupWindow, url: string): void; + /** + * Returns a value indicating whether the specified window is pinned. + * @param window An ASPxClientPopupWindow object specifying the popup window. + */ + GetWindowPinned(window: ASPxClientPopupWindow): boolean; + /** + * Sets a value indicating whether the specified window is pinned. + * @param window An ASPxClientPopupWindow object specifying the popup window. + * @param value true to pin the window; otherwise, false. + */ + SetWindowPinned(window: ASPxClientPopupWindow, value: boolean): void; + /** + * Returns a value indicating whether the specified window is maximized. + * @param window An ASPxClientPopupWindow object specifying the popup window. + */ + GetWindowMaximized(window: ASPxClientPopupWindow): boolean; + /** + * Sets a value indicating whether the specified window is maximized. + * @param window An ASPxClientPopupWindow object specifying the popup window. + * @param value true to maximize the window; otherwise, false. + */ + SetWindowMaximized(window: ASPxClientPopupWindow, value: boolean): void; + /** + * Returns a value indicating whether the specified window is collapsed. + * @param window An ASPxClientPopupWindow object specifying the popup window. + */ + GetWindowCollapsed(window: ASPxClientPopupWindow): boolean; + /** + * Sets a value indicating whether the specified window is collapsed. + * @param window An ASPxClientPopupWindow object specifying the popup window. + * @param value true to collapse the window; otherwise, false. + */ + SetWindowCollapsed(window: ASPxClientPopupWindow, value: boolean): void; + /** + * Refreshes the content of the web page displayed within the control's specific popup window. + * @param window A ASPxClientPopupWindow object representing the required popup window. + */ + RefreshWindowContentUrl(window: ASPxClientPopupWindow): void; + /** + * Updates the default popup window's position, to correctly align it at either the specified element, or the center of the browser's window. + */ + UpdatePosition(): void; + /** + * Updates the default popup window's position, to correctly align it at the specified HTML element. + * @param htmlElement An object specifying the HTML element to which the default popup window is aligned using the PopupVerticalAlign properties. + */ + UpdatePositionAtElement(htmlElement: Object): void; + /** + * Updates the specified popup window's position, to correctly align it at either the specified element, or the center of the browser's window. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + */ + UpdateWindowPosition(window: ASPxClientPopupWindow): void; + /** + * Updates the specified popup window's position, to correctly align it at the specified HTML element. + * @param window An ASPxClientPopupWindow object that specifies the required popup window. + * @param htmlElement An object specifying the HTML element to which the specified popup window is aligned using the PopupVerticalAlign properties. + */ + UpdateWindowPositionAtElement(window: ASPxClientPopupWindow, htmlElement: Object): void; + /** + * Refreshes the connection between the ASPxPopupControl and the popup element. + */ + RefreshPopupElementConnection(): void; +} +/** + * Represents a client-side equivalent of a popup control's PopupWindow object. + */ +interface ASPxClientPopupWindow { + /** + * Gets the popup control to which the current popup window belongs. + * Value: An ASPxClientPopupControl object representing the popup control to which the window belongs. + */ + popupControl: ASPxClientPopupControl; + /** + * Gets the index of the current popup window within the popup control's Windows collection. + * Value: An integer value representing the zero-based index of the current popup window within the Windows collection of the popup control to which the window belongs. + */ + index: number; + /** + * Gets the name that uniquely identifies the current popup window. + * Value: A string value that represents a value assigned to the popup window's Name property. + */ + name: string; + /** + * Returns the URL pointing to the image displayed within the window header. + */ + GetHeaderImageUrl(): string; + /** + * Specifies the URL which points to the image displayed within the window header. + * @param value A string value that is the URL to the image displayed within the header. + */ + SetHeaderImageUrl(value: string): void; + /** + * Returns the URL pointing to the image displayed within the window footer. + */ + GetFooterImageUrl(): string; + /** + * Specifies the URL which points to the image displayed within the window footer. + * @param value A string value that is the URL to the image displayed within the window footer. + */ + SetFooterImageUrl(value: string): void; + /** + * Returns the URL where the web browser will navigate when the text or image is clicked within the popup window's header. + */ + GetHeaderNavigateUrl(): string; + /** + * Returns the URL where the web browser will navigate when the text or image is clicked within the popup window's header. + * @param value A string value which specifies the required navigation location. + */ + SetHeaderNavigateUrl(value: string): void; + /** + * Returns the URL where the web browser will navigate when the text or image is clicked within the popup window's footer. + */ + GetFooterNavigateUrl(): string; + /** + * Specifies the URL where the web browser will navigate when the text or image is clicked within the popup window's footer. + * @param value A string value which specifies the required navigation location. + */ + SetFooterNavigateUrl(value: string): void; + /** + * Returns the text displayed within the window's header. + */ + GetHeaderText(): string; + /** + * Specifies the text displayed within the window's header. + * @param value A string value that specifies the window's header text. + */ + SetHeaderText(value: string): void; + /** + * Returns the text displayed within the popup window's footer. + */ + GetFooterText(): string; + /** + * Specifies the text displayed within the window's footer. + * @param value A string value that specifies the window's footer text. + */ + SetFooterText(value: string): void; +} +/** + * A method that will handle the popup control's client events invoked in response to manipulating a popup window. + */ +interface ASPxClientPopupWindowEventHandler { + /** + * A method that will handle the popup control's client events when a popup window is manipulated. + * @param source An object representing the event's source. Identifies the popup control object (ASPxClientPopupControl) that raised the event. + * @param e An ASPxClientPopupWindowEventArgs object that contains event data. + */ + (source: S, e: ASPxClientPopupWindowEventArgs): void; +} +/** + * Provides data for events concerning client manipulations on popup windows. + */ +interface ASPxClientPopupWindowEventArgs extends ASPxClientEventArgs { + /** + * Gets the popup window object related to the event. + * Value: An ASPxClientPopupWindow object representing the popup window that was manipulated, causing the popup control to raise the event. + */ + window: ASPxClientPopupWindow; +} +/** + * A method that will handle the popup window's cancellable client events, such as the Closing. + */ +interface ASPxClientPopupWindowCancelEventHandler { + /** + * A method that will handle the popup window's cancelable client events. + * @param source An object representing the event's source. Identifies the popup window object that raised the event. + * @param e An ASPxClientPopupWindowCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientPopupWindowCancelEventArgs): void; +} +/** + * Provides data for the popup control's cancellable client events, such as the Closing. + */ +interface ASPxClientPopupWindowCancelEventArgs extends ASPxClientCancelEventArgs { + /** + * Gets the popup window object related to the event. + * Value: An ASPxClientPopupWindow object representing the popup window that was manipulated, causing the popup control to raise the event. + */ + window: ASPxClientPopupWindow; + /** + * Gets the value that identifies the reason the popup window is about to close. + * Value: One of the ASPxClientPopupControlCloseReason enumeration values. + */ + closeReason: ASPxClientPopupControlCloseReason; +} +/** + * A method that will handle the CloseUp event. + */ +interface ASPxClientPopupWindowCloseUpEventHandler { + /** + * A method that will handle the CloseUp event. + * @param source The event source. + * @param e An ASPxClientPopupWindowCloseUpEventArgs object that contains event data. + */ + (source: S, e: ASPxClientPopupWindowCloseUpEventArgs): void; +} +/** + * Provides data for the CloseUp event. + */ +interface ASPxClientPopupWindowCloseUpEventArgs extends ASPxClientPopupWindowEventArgs { + /** + * Gets the value that identifies the reason the popup window closes. + * Value: One of the ASPxClientPopupControlCloseReason enumeration values. + */ + closeReason: ASPxClientPopupControlCloseReason; +} +/** + * A method that will handle the Resize event. + */ +interface ASPxClientPopupWindowResizeEventHandler { + /** + * A method that will handle the Resize event. + * @param source The event source. + * @param e A ASPxClientPopupWindowResizeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientPopupWindowResizeEventArgs): void; +} +/** + * Provides data for the Resize event. + */ +interface ASPxClientPopupWindowResizeEventArgs extends ASPxClientPopupWindowEventArgs { + /** + * Returns the value indicating the window state after resizing. + * Value: The integer value indicating the window resize state. + */ + resizeState: number; +} +/** + * A method that will handle the PinnedChanged event. + */ +interface ASPxClientPopupWindowPinnedChangedEventHandler { + /** + * A method that will handle the PinnedChanged event. + * @param source The event source. + * @param e A ASPxClientPopupWindowPinnedChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientPopupWindowPinnedChangedEventArgs): void; +} +/** + * Provides data for the PinnedChanged event. + */ +interface ASPxClientPopupWindowPinnedChangedEventArgs extends ASPxClientPopupWindowEventArgs { + /** + * Gets a value indicating whether the processed popup window has been pinned. + * Value: true, if the window has been pinned; otherwise, false. + */ + pinned: boolean; +} +/** + * Represents a client collection that maintains client popup control objects. + */ +interface ASPxClientPopupControlCollection extends ASPxClientControlCollection { + /** + * Hides all popup windows maintained by the collection. + */ + HideAllWindows(): void; +} +/** + * Declares client constants that identify the reason the popup window closes. + */ +interface ASPxClientPopupControlCloseReason { +} +/** + * Represents a client-side equivalent of the ASPxPopupMenu object. + */ +interface ASPxClientPopupMenu extends ASPxClientMenuBase { + /** + * Sets the ID of a web control or HTML element (or a list of IDs) with which the current popup menu is associated. + * @param popupElementId A string value specifying the ID (or a list of IDs) of the web control or HTML element with which the popup menu is associated. + */ + SetPopupElementID(popupElementId: string): void; + /** + * Returns an index of the object that invoked the popup menu within the PopupElementID list. + */ + GetCurrentPopupElementIndex(): number; + /** + * Returns an object that invoked the popup menu. + */ + GetCurrentPopupElement(): Object; + /** + * Refreshes the connection between the ASPxPopupMenu and the popup element. + */ + RefreshPopupElementConnection(): void; + /** + * Hides the popup menu. + */ + Hide(): void; + /** + * Invokes the popup menu. + */ + Show(): void; + /** + * Invokes the popup menu at the popup element with the specified index. + * @param popupElementIndex An integer value specifying the zero-based index of the popup element. + */ + Show(popupElementIndex: number): void; + /** + * Invokes the popup menu and displays it over the specified HTML element. + * @param htmlElement An object specifying the HTML element relative to which position the popup menu is invoked. + */ + ShowAtElement(htmlElement: Object): void; + /** + * Invokes the popup menu and displays it over an HTML element specified by its unique identifier. + * @param id A string value that specifies the hierarchically qualified identifier of an HTML element relative to which position the popup menu is invoked. + */ + ShowAtElementByID(id: string): void; + /** + * Invokes the popup menu at the specified position. + * @param x An integer value specifying the x-coordinate of the popup menu's display position. + * @param y An integer value specifying the y-coordinate of the popup menu's display position. + */ + ShowAtPos(x: number, y: number): void; +} +/** + * Represents the client-side equivalent of the ASPxRatingControl control. + */ +interface ASPxClientRatingControl extends ASPxClientControl { + /** + * Fires on the server after an item has been clicked. + */ + ItemClick: ASPxClientEvent>; + /** + * Occurs on the client side when the mouse cursor is moved into a rating control item. + */ + ItemMouseOver: ASPxClientEvent>; + /** + * Occurs on the client side when the mouse cursor moves outside a rating control item. + */ + ItemMouseOut: ASPxClientEvent>; + /** + * Gets the item tooltip title specified by the item index. + * @param index An integer value specifying the item index. + */ + GetTitle(index: number): string; + /** + * Returns a value indicating whether the control's status is read-only. + */ + GetReadOnly(): boolean; + /** + * Specifies whether the control's status is read-only. + * @param value true to make the control read-only; otherwise, false. + */ + SetReadOnly(value: boolean): void; + /** + * Returns the value of the ASPxRatingControl. + */ + GetValue(): number; + /** + * Modifies the value of the ASPxRatingControl on the client side. + * @param value A decimal value representing the value of the control. + */ + SetValue(value: number): void; +} +/** + * A method that will handle the client ItemClick event. + */ +interface ASPxClientRatingControlItemClickEventHandler { + /** + * A method that will handle the client ItemClick event. + * @param source An object representing the event source. + * @param e A ASPxClientRatingControlItemClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRatingControlItemClickEventArgs): void; +} +/** + * Provides data for the ItemClick event. + */ +interface ASPxClientRatingControlItemClickEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the index of the item related to the event. + * Value: An integer value that represents the clicked item's index. + */ + index: number; +} +/** + * A method that will handle the rating control's ItemMouseOver and ItemMouseOut client events (such as ItemMouseOut). + */ +interface ASPxClientRatingControlItemMouseEventHandler { + /** + * A method that will handle the ItemMouseOver events. + * @param source The event source. + * @param e An ASPxClientRatingControlItemMouseEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRatingControlItemMouseEventArgs): void; +} +/** + * Provides data for the rating control's ItemMouseOver and ItemMouseOut client events (such as ItemMouseOut). + */ +interface ASPxClientRatingControlItemMouseEventArgs extends ASPxClientEventArgs { + /** + * Gets the index of the item related to the event. + * Value: An integer value that represents the related item's index. + */ + index: number; +} +/** + * Represents the client-side equivalent of the ASPxRibbon control. + */ +interface ASPxClientRibbon extends ASPxClientControl { + /** + * Occurs after an end-user executes an action on a ribbon item. + */ + CommandExecuted: ASPxClientEvent>; + /** + * Fires on the client side after the active tab has been changed within a ribbon control. + */ + ActiveTabChanged: ASPxClientEvent>; + /** + * Occurs on the client side when the ribbon minimization state is changed by end-user actions. + */ + MinimizationStateChanged: ASPxClientEvent>; + /** + * Occurs when the file tab is clicked. + */ + FileTabClicked: ASPxClientEvent>; + /** + * Fires on the client side after a dialog box launcher has been clicked. + */ + DialogBoxLauncherClicked: ASPxClientEvent>; + /** + * Fires after key tips are closed by pressing Esc. + */ + KeyTipsClosedOnEscape: ASPxClientEvent>; + /** + * Specifies whether the ribbon control is enabled. + * @param enabled true to enable the ribbon; false to disable it. + */ + SetEnabled(enabled: boolean): void; + /** + * Returns a value indicating whether the ribbon is enabled. + */ + GetEnabled(): boolean; + /** + * Returns a tab specified by its index. + * @param index An integer value specifying the zero-based index of the tab object to retrieve. + */ + GetTab(index: number): ASPxClientRibbonTab; + /** + * Returns a tab specified by its name. + * @param name A string value specifying the name of the tab. + */ + GetTabByName(name: string): ASPxClientRibbonTab; + /** + * Returns the number of tabs in the ribbon Tabs collection. + */ + GetTabCount(): number; + /** + * Returns the active tab within the ribbon control. + */ + GetActiveTab(): ASPxClientRibbonTab; + /** + * Makes the specified tab active in the ribbon control on the client side. + * @param tab A ASPxClientRibbonTab object specifying the tab selection. + */ + SetActiveTab(tab: ASPxClientRibbonTab): void; + /** + * Makes a tab active within the ribbon control, specifying the tab's index. + * @param index An integer value specifying the index of the tab to select. + */ + SetActiveTabIndex(index: number): void; + /** + * Returns a ribbon item specified by its name. + * @param name A string value specifying the name of the item. + */ + GetItemByName(name: string): ASPxClientRibbonItem; + /** + * Returns a value of item with the specified name. + * @param name A string value specifying the name of the item. + */ + GetItemValueByName(name: string): Object; + /** + * Sets the value of the item with the specified name. + * @param name A string value specifying the name of the item. + * @param value An object that is the new item value. + */ + SetItemValueByName(name: string, value: Object): void; + /** + * Specifies whether the ribbon is minimized. + * @param minimized true to set the ribbon state to minimized; false to set the ribbon state to normal. + */ + SetMinimized(minimized: boolean): void; + /** + * Gets a value specifying whether the ribbon is minimized. + */ + GetMinimized(): boolean; + /** + * Specifies the visibility of a context tab category specified by its name. + * @param categoryName A Name property value of the required category. + * @param visible true to make a category visible; false to make it hidden. + */ + SetContextTabCategoryVisible(categoryName: string, visible: boolean): void; + /** + * Shows ribbon key tips. + */ + ShowKeyTips(): void; +} +/** + * A client-side equivalent of the ribbon's RibbonTab object. + */ +interface ASPxClientRibbonTab { + /** + * Gets the client ribbon object to which the current tab belongs. + * Value: An object to which the tab belongs. + */ + ribbon: ASPxClientRibbon; + /** + * Gets or sets the tab's index within the collection. + * Value: An integer value that is the zero-based index of the tab within the collection. + */ + index: number; + /** + * Gets the name of the current ribbon tab. + * Value: A string value that is the tab's name. + */ + name: string; + /** + * Returns the text displayed in the tab. + */ + GetText(): string; + /** + * Sets a value specifying whether the tab is enabled. + * @param enabled true to enable the tab; false to disable it. + */ + SetEnabled(enabled: boolean): void; + /** + * Returns a value indicating whether a ribbon tab is enabled. + */ + GetEnabled(): boolean; + /** + * Returns a value specifying whether a ribbon tab is displayed. + */ + GetVisible(): boolean; +} +/** + * A client-side equivalent of the ribbon's RibbonGroup object. + */ +interface ASPxClientRibbonGroup { + /** + * Gets the client ribbon object to which the current group belongs. + * Value: An object to which the group belongs. + */ + ribbon: ASPxClientRibbon; + /** + * Gets the client tab object to which the current group belongs. + * Value: An object to which the group belongs. + */ + tab: ASPxClientRibbonTab; + /** + * Gets or sets the group's index within the collection. + * Value: An integer value that is the zero-based index of the group within the collection. + */ + index: number; + /** + * Gets the name of the current ribbon group. + * Value: A string value that is the group's name. + */ + name: string; + /** + * Returns a value specifying whether a ribbon group is displayed. + */ + GetVisible(): boolean; +} +/** + * A client-side equivalent of the ribbon's RibbonItemBase object. + */ +interface ASPxClientRibbonItem { + /** + * Gets the client group object to which the current item belongs. + * Value: An object to which the item belongs. + */ + group: ASPxClientRibbonGroup; + /** + * Gets or sets the item's index within the collection. + * Value: An integer value that is the zero-based index of the item within the collection. + */ + index: number; + /** + * Gets the name of the current ribbon item. + * Value: A string value that is the item's name. + */ + name: string; + /** + * Gets the client ribbon object to which the current item belongs. + * Value: An object to which the item belongs. + */ + ribbon: ASPxClientRibbon; + /** + * Returns a value indicating whether a ribbon item is enabled. + */ + GetEnabled(): boolean; + /** + * Sets a value specifying whether the item is enabled. + * @param enabled true to enable the item; false to disable it. + */ + SetEnabled(enabled: boolean): void; + /** + * Returns the item value. + */ + GetValue(): Object; + /** + * Sets the item value. + * @param value An that specifies the item value. + */ + SetValue(value: Object): void; + /** + * Returns a value specifying whether a ribbon item is displayed. + */ + GetVisible(): boolean; +} +/** + * A method that will handle the CommandExecuted event. + */ +interface ASPxClientRibbonCommandExecutedEventHandler { + /** + * A method that will handle the CommandExecuted event. + * @param source The event source. Identifies the ASPxRibbon control that raised the event. + * @param e An ASPxClientRibbonCommandExecutedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRibbonCommandExecutedEventArgs): void; +} +/** + * Provides data for the CommandExecuted event. + */ +interface ASPxClientRibbonCommandExecutedEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets an item object related to the event. + * Value: An object, manipulations on which forced the event to be raised. + */ + item: ASPxClientRibbonItem; + /** + * Gets an optional parameter that complements the processed command. + * Value: A string value containing additional information about the processed command. + */ + parameter: string; +} +/** + * A method that will handle the ActiveTabChanged event. + */ +interface ASPxClientRibbonTabEventHandler { + /** + * A method that will handle the ActiveTabChanged event. + * @param source The event source. Identifies the ASPxRibbon control that raised the event. + * @param e A ASPxClientRibbonTabEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRibbonTabEventArgs): void; +} +/** + * Provides data for the ActiveTabChanged event. + */ +interface ASPxClientRibbonTabEventArgs extends ASPxClientEventArgs { + /** + * Gets the tab object related to the event. + * Value: An object that is the tab, manipulations on which forced the ribbon control to raise the event. + */ + tab: ASPxClientRibbonTab; +} +/** + * A method that will handle the MinimizationStateChanged event. + */ +interface ASPxClientRibbonMinimizationStateEventHandler { + /** + * A method that will handle the MinimizationStateChanged event. + * @param source The event source. Identifies the ASPxRibbon control that raised the event. + * @param e An ASPxClientRibbonMinimizationStateEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRibbonMinimizationStateEventArgs): void; +} +/** + * Provides data for the MinimizationStateChanged event. + */ +interface ASPxClientRibbonMinimizationStateEventArgs extends ASPxClientEventArgs { + /** + * Returns the value indicating the new ribbon state. + * Value: The integer value indicating the ribbon minimization state. + */ + ribbonState: number; +} +/** + * A method that will handle the DialogBoxLauncherClicked event. + */ +interface ASPxClientRibbonDialogBoxLauncherClickedEventHandler { + /** + * A method that will handle the DialogBoxLauncherClicked event. + * @param source The event source. This parameter identifies the ribbon object which raised the event. + * @param e An ASPxClientRibbonDialogBoxLauncherClickedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientRibbonDialogBoxLauncherClickedEventArgs): void; +} +/** + * Provides data for the DialogBoxLauncherClicked event. + */ +interface ASPxClientRibbonDialogBoxLauncherClickedEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the client group object to which the clicked dialog box launcher belongs. + * Value: An object to which the dialog box launcher belongs. + */ + group: ASPxClientRibbonGroup; +} +/** + * Represents a client-side equivalent of the ASPxRoundPanel control. + */ +interface ASPxClientRoundPanel extends ASPxClientPanelBase { + /** + * Fires on the client side after a panel has been expanded or collapsed via end-user interactions, i.e., by clicking a panel header or collapse button. + */ + CollapsedChanged: ASPxClientEvent>; + /** + * Fires on the client side before a panel is expanded or collapsed by end-user interactions, i.e., by clicking a panel header or collapse button. + */ + CollapsedChanging: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientRoundPanel. + */ + CallbackError: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. + * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. + * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; + /** + * Returns the text displayed within the panel's header. + */ + GetHeaderText(): string; + /** + * Specifies the text displayed in the panel's header. + * @param text A string value that specifies the panel header's text. + */ + SetHeaderText(text: string): void; + /** + * Returns a value indicating whether the panel is collapsed. + */ + GetCollapsed(): boolean; + /** + * Sets a value indicating whether the panel is collapsed. + * @param collapsed true, to collapse the panel; otherwise, false. + */ + SetCollapsed(collapsed: boolean): void; +} +/** + * Represents a client-side equivalent of the ASPxSplitter object. + */ +interface ASPxClientSplitter extends ASPxClientControl { + /** + * Fires before a pane is resized. + */ + PaneResizing: ASPxClientEvent>; + /** + * Fires after a pane has been resized. + */ + PaneResized: ASPxClientEvent>; + /** + * Fires before a pane is collapsed. + */ + PaneCollapsing: ASPxClientEvent>; + /** + * Fires after a pane has been collapsed. + */ + PaneCollapsed: ASPxClientEvent>; + /** + * Fires before a pane is expanded. + */ + PaneExpanding: ASPxClientEvent>; + /** + * Fires after a pane has been expanded. + */ + PaneExpanded: ASPxClientEvent>; + /** + * Occurs when a pane resize operation has been completed. + */ + PaneResizeCompleted: ASPxClientEvent>; + /** + * Fires after a specific web page has been loaded into a pane. + */ + PaneContentUrlLoaded: ASPxClientEvent>; + /** + * Returns the number of panes at the root level of a splitter. + */ + GetPaneCount(): number; + /** + * Returns the splitter's root pane specified by its index within the Panes collection. + * @param index An integer value specifying the zero-based index of the root pane to be retrieved. + */ + GetPane(index: number): ASPxClientSplitterPane; + /** + * Returns a pane specified by its name. + * @param name A string value specifying the name of the pane. + */ + GetPaneByName(name: string): ASPxClientSplitterPane; + /** + * Specifies whether the control's panes can be resized by end-users on the client side. + * @param allowResize true if pane resizing is allowed; otherwise, false. + */ + SetAllowResize(allowResize: boolean): void; + /** + * Returns a string value that represents the client state of splitter panes. + */ + GetLayoutData(): string; +} +/** + * Represents a client-side equivalent of the splitter's SplitterPane object. + */ +interface ASPxClientSplitterPane { + /** + * Gets the index of the current pane within the pane collection to which it belongs. + * Value: An integer value representing the zero-based index of the current pane within the SplitterPaneCollection collection. + */ + index: number; + /** + * Gets the name that uniquely identifies the current splitter pane. + * Value: A string value that represents the value assigned to the pane's Name property. + */ + name: string; + /** + * Returns a client splitter object that contains the current pane. + */ + GetSplitter(): ASPxClientSplitter; + /** + * Returns the immediate parent of the current pane. + */ + GetParentPane(): ASPxClientSplitterPane; + /** + * Returns the previous sibling pane of the current pane. + */ + GetPrevPane(): ASPxClientSplitterPane; + /** + * Returns the next sibling pane of the current pane. + */ + GetNextPane(): ASPxClientSplitterPane; + /** + * Determines whether the current pane is the first pane within the SplitterPaneCollection. + */ + IsFirstPane(): boolean; + /** + * Determines whether the current pane is the last pane within the SplitterPaneCollection. + */ + IsLastPane(): boolean; + /** + * Returns a value that indicates the orientation in which the current pane and its sibling panes are stacked. + */ + IsVertical(): boolean; + /** + * Returns the number of the current pane's immediate child panes. + */ + GetPaneCount(): number; + /** + * Returns the current pane's immediate child pane specified by its index. + * @param index An integer value specifying the zero-based index of the child pane to be retrieved. + */ + GetPane(index: number): ASPxClientSplitterPane; + /** + * Returns the current pane's child pane specified by its name. + * @param name A string value specifying the name of the pane. + */ + GetPaneByName(name: string): ASPxClientSplitterPane; + /** + * Gets the width of the pane's content area. + */ + GetClientWidth(): number; + /** + * Gets the height of the pane's content area. + */ + GetClientHeight(): number; + /** + * Collapses the current pane and occupies its space by maximizing the specified pane. + * @param maximizedPane A ASPxClientSplitterPane object specifying the pane to be maximized to occupy the freed space. + */ + Collapse(maximizedPane: ASPxClientSplitterPane): boolean; + /** + * Collapses the current pane in a forward direction and occupies its space by maximizing the previous adjacent pane. + */ + CollapseForward(): boolean; + /** + * Collapses the current pane in a backward direction, and occupies its space by maximizing the next adjacent pane. + */ + CollapseBackward(): boolean; + /** + * Expands the current pane object on the client side. + */ + Expand(): boolean; + /** + * Returns whether the pane is collapsed. + */ + IsCollapsed(): boolean; + /** + * Returns whether the pane's content is loaded from an external web page. + */ + IsContentUrlPane(): boolean; + /** + * Gets the URL of a web page displayed as a pane's content. + */ + GetContentUrl(): string; + /** + * Sets the URL to point to a web page that should be loaded into, and displayed within the current pane. + * @param url A string value specifying the URL to a web page displayed within the pane. + */ + SetContentUrl(url: string): void; + /** + * Sets the URL to point to a web page that should be loaded into, and displayed within the current pane, but should not be cached by a client browser. + * @param url A string value specifying the URL to a web page displayed within the pane. + * @param preventBrowserCaching true to prevent the browser to cache the loaded content; false to allow browser caching. + */ + SetContentUrl(url: string, preventBrowserCaching: boolean): void; + /** + * Refreshes the content of the web page displayed within the current pane. + */ + RefreshContentUrl(): void; + /** + * Returns an iframe object containing a web page specified via the pane's SetContentUrl client method). + */ + GetContentIFrame(): Object; + /** + * Specifies whether the current pane can be resized by end-users on the client side. + * @param allowResize true if pane resizing is allowed; otherwise, false. + */ + SetAllowResize(allowResize: boolean): void; + /** + * Forces the client PaneResized event to be generated. + */ + RaiseResizedEvent(): void; + /** + * Returns an HTML element representing a splitter pane object. + */ + GetElement(): Object; + /** + * Specifies the splitter pane's size in pixels. + * @param size An integer value that specifies the splitter pane's size. + */ + SetSize(size: number): void; + /** + * Specifies the splitter pane's size, in pixels or percents. + * @param size A string value that specifies the splitter pane's size, in pixels or percents. + */ + SetSize(size: string): void; + /** + * Returns the splitter pane's size, in pixels or percents. + */ + GetSize(): string; + /** + * Returns the distance between the top edge of the pane content and the topmost portion of the content currently visible in the pane. + */ + GetScrollTop(): number; + /** + * Specifies the distance between the top edge of the pane content and the topmost portion of the content currently visible in the pane. + * @param value An integer value that is the distance (in pixels). + */ + SetScrollTop(value: number): void; + /** + * Returns the distance between the left edge of the pane content and the leftmost portion of the content currently visible in the pane. + */ + GetScrollLeft(): number; + /** + * Specifies the distance between the left edge of the pane content and the leftmost portion of the content currently visible in the pane. + * @param value An integer value that is the distance (in pixels). + */ + SetScrollLeft(value: number): void; +} +/** + * A method that will handle the splitter's client events concerning manipulations with a pane. + */ +interface ASPxClientSplitterPaneEventHandler { + /** + * A method that will handle the splitter's client events concerning pane manipulations. + * @param source An object representing the event's source. Identifies the splitter object that raised the event. + * @param e An ASPxClientSplitterPaneEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSplitterPaneEventArgs): void; +} +/** + * A method that will handle the splitter's client events concerning manipulations with a pane. + */ +interface ASPxClientSplitterPaneEventArgs extends ASPxClientEventArgs { + /** + * Gets the pane object related to the event. + * Value: An ASPxClientSplitterPane object, manipulations on which forced the event to be raised. + */ + pane: ASPxClientSplitterPane; +} +/** + * A method that will handle a splitter control's cancelable client events concerning manipulations with a pane. + */ +interface ASPxClientSplitterPaneCancelEventHandler { + /** + * A method that will handle a splitter control's cancelable client events concerning pane manipulations. + * @param source An object representing the event's source. Identifies the splitter control object that raised the event. + * @param e An ASPxClientSplitterPaneCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientSplitterPaneCancelEventArgs): void; +} +/** + * Provides data for a splitter control's cancelable client events concerning manipulations with a pane. + */ +interface ASPxClientSplitterPaneCancelEventArgs extends ASPxClientSplitterPaneEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * Represents a base for the ASPxClientPageControl objects. + */ +interface ASPxClientTabControlBase extends ASPxClientControl { + /** + * Fires when a tab is clicked. + */ + TabClick: ASPxClientEvent>; + /** + * Fires on the client side after the active tab has been changed within a tab control. + */ + ActiveTabChanged: ASPxClientEvent>; + /** + * Fires on the client side before the active tab is changed within a tab control. + */ + ActiveTabChanging: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by a client tab control. + */ + CallbackError: ASPxClientEvent>; + /** + * Modifies a tab page's size in accordance with the content. + */ + AdjustSize(): void; + /** + * Returns the active tab within the tab control. + */ + GetActiveTab(): ASPxClientTab; + /** + * Makes the specified tab active within the tab control on the client side. + * @param tab An ASPxClientTab object specifying the tab to select. + */ + SetActiveTab(tab: ASPxClientTab): void; + /** + * Returns the index of the active tab within the tab control. + */ + GetActiveTabIndex(): number; + /** + * Makes a tab active within the tab control, specifying the tab's index. + * @param index An integer value specifying the index of the tab to select. + */ + SetActiveTabIndex(index: number): void; + /** + * Returns the number of tabs in the ASPxTabControl. + */ + GetTabCount(): number; + /** + * Returns a tab specified by its index. + * @param index An integer value specifying the zero-based index of the tab object to retrieve. + */ + GetTab(index: number): ASPxClientTab; + /** + * Returns a tab specified by its name. + * @param name A string value specifying the name of the tab. + */ + GetTabByName(name: string): ASPxClientTab; +} +/** + * Represents a client-side equivalent of the ASPxTabControl object. + */ +interface ASPxClientTabControl extends ASPxClientTabControlBase { +} +/** + * Represents a client-side equivalent of the ASPxPageControl object. + */ +interface ASPxClientPageControl extends ASPxClientTabControlBase { + /** + * Returns the HTML code that represents the contents of the specified page within the page control. + * @param tab An ASPxClientTab object that specifies the required page. + */ + GetTabContentHTML(tab: ASPxClientTab): string; + /** + * Defines the HTML content for a specific tab page within the page control. + * @param tab An ASPxClientTab object that specifies the required tab page. + * @param html A string value that represents the HTML code defining the content of the specified page. + */ + SetTabContentHTML(tab: ASPxClientTab, html: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + */ + PerformCallback(parameter: string): void; + /** + * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. + * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; +} +/** + * Represents a client-side equivalent of a tab control's TabPage object. + */ +interface ASPxClientTab { + /** + * Gets the tab control to which the current tab belongs. + * Value: An ASPxClientTabControlBase object representing the control to which the tab belongs. + */ + tabControl: ASPxClientTabControlBase; + /** + * Gets the index of the current tab (tabbed page) within the control's collection of tabs (tabbed pages). + * Value: An integer value representing the zero-based index of the current tab (tabbed page) within the TabPages) collection of the control to which the tab belongs. + */ + index: number; + /** + * Gets the name that uniquely identifies the current tab. + * Value: A string value that represents the value assigned to the tab's Name property. + */ + name: string; + /** + * Returns a value specifying whether a tab is enabled. + */ + GetEnabled(): boolean; + /** + * Specifies whether the tab is enabled. + * @param value true to enable the tab; otherwise, false. + */ + SetEnabled(value: boolean): void; + /** + * Returns the URL pointing to the image displayed within the tab. + */ + GetImageUrl(): string; + /** + * Specifies the URL which points to the image displayed within the tab. + * @param value A string value that is the URL to the image displayed within the tab. + */ + SetImageUrl(value: string): void; + /** + * Returns the URL pointing to the image displayed within the active tab. + */ + GetActiveImageUrl(): string; + /** + * Specifies the URL which points to the image displayed within the active tab. + * @param value A string value that is the URL to the image displayed within the active tab. + */ + SetActiveImageUrl(value: string): void; + /** + * Gets an URL which defines the navigation location for the tab. + */ + GetNavigateUrl(): string; + /** + * Specifies a URL which defines the navigation location for the tab. + * @param value A string value which is a URL to where the client web browser will navigate when the tab is clicked. + */ + SetNavigateUrl(value: string): void; + /** + * Returns text displayed within the tab. + */ + GetText(): string; + /** + * Specifies the text displayed within the tab. + * @param value A string value that is the text displayed within the tab. + */ + SetText(value: string): void; + /** + * Returns a value specifying whether a tab is displayed. + */ + GetVisible(): boolean; + /** + * Specifies whether the tab is visible. + * @param value true is the tab is visible; otherwise, false. + */ + SetVisible(value: boolean): void; +} +/** + * A method that will handle a tab control's client events concerning manipulations with a tab. + */ +interface ASPxClientTabControlTabEventHandler { + /** + * A method that will handle a tab control's client events concerning manipulations with a tab. + * @param source An object representing the event's source. Identifies the tab control object that raised the event. + * @param e An ASPxClientTabControlTabEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTabControlTabEventArgs): void; +} +/** + * Provides data for events which concern manipulations on tabs. + */ +interface ASPxClientTabControlTabEventArgs extends ASPxClientEventArgs { + /** + * Gets the tab object related to the event. + * Value: An ASPxClientTab object, manipulations on which forced the event to be raised. + */ + tab: ASPxClientTab; +} +/** + * A method that will handle a tab control's cancelable client events concerning manipulations with a tab. + */ +interface ASPxClientTabControlTabCancelEventHandler { + /** + * A method that will handle a tab control's cancelable client events concerning manipulations with a tab. + * @param source An object representing the event's source. Identifies the tab control object that raised the event. + * @param e An ASPxClientTabControlTabCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTabControlTabCancelEventArgs): void; +} +/** + * Provides data for cancellable events which concern manipulations on tabs. + */ +interface ASPxClientTabControlTabCancelEventArgs extends ASPxClientProcessingModeCancelEventArgs { + /** + * Gets the tab object related to the event. + * Value: An ASPxClientTab object representing the tab manipulations on which forced the tab control to raise the event. + */ + tab: ASPxClientTab; + /** + * Gets or sets a value specifying whether a callback should be sent to the server to reload the content of the page being activated. + * Value: true to reload the page's content; otherwise, false. + */ + reloadContentOnCallback: boolean; +} +/** + * A method that will handle client events concerning clicks on the control's tabs. + */ +interface ASPxClientTabControlTabClickEventHandler { + /** + * A method that will handle client events concerning clicks on tabs. + * @param source The event source. This parameter identifies the tab control object which raised the event. + * @param e An ASPxClientTabControlTabClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTabControlTabClickEventArgs): void; +} +/** + * Provides data for events which concern clicking on the control's tabs. + */ +interface ASPxClientTabControlTabClickEventArgs extends ASPxClientTabControlTabCancelEventArgs { + /** + * Gets the HTML object that contains the processed tab. + * Value: An object representing a container for the tab related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * Represents a client-side equivalent of the ASPxTimer object. + */ +interface ASPxClientTimer extends ASPxClientControl { + /** + * Fires on the client side when the specified timer interval has elapsed, and the timer is enabled. + */ + Tick: ASPxClientEvent>; + /** + * Returns a value indicating whether the timer is enabled. + */ + GetEnabled(): boolean; + /** + * Enables the timer. + * @param enabled true to turn the timer on; false, to turn the timer off. + */ + SetEnabled(enabled: boolean): void; + /** + * Gets the time before the Tick event. + */ + GetInterval(): number; + /** + * Specifies the time before the Tick event. + * @param interval An integer value that specifies the number of milliseconds before the Tick event is raised relative to the last occurrence of the Tick event. The value cannot be less than one. + */ + SetInterval(interval: number): void; +} +/** + * Represents a client-side equivalent of the ASPxTitleIndex object. + */ +interface ASPxClientTitleIndex extends ASPxClientControl { + /** + * Fires after an item has been clicked. + */ + ItemClick: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientTitleIndex. + */ + CallbackError: ASPxClientEvent>; +} +/** + * A method that will handle client events concerning manipulations with an item. + */ +interface ASPxClientTitleIndexItemEventHandler { + /** + * A method that will handle the title index control's client events concerning manipulations with an item. + * @param source An object representing the event's source. Identifies the title index control object that raised the event. + * @param e An ASPxClientTitleIndexItemEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTitleIndexItemEventArgs): void; +} +/** + * Provides data for events which concern manipulations on the control's items. + */ +interface ASPxClientTitleIndexItemEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the name that uniquely identifies the processed item. + * Value: A string value that represents the value assigned to the processed item's Name property. + */ + name: Object; + /** + * Gets the HTML object that contains the processed item. + * Value: An object representing a container for the item related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * Represents a client-side equivalent of the ASPxTreeView object. + */ +interface ASPxClientTreeView extends ASPxClientControl { + /** + * Fires on the client side after a node has been clicked. + */ + NodeClick: ASPxClientEvent>; + /** + * Fires on the client side after a node's expansion state has been changed by end-user interaction. + */ + ExpandedChanged: ASPxClientEvent>; + /** + * Fires on the client side before the expansion state of a node is changed via end-user interaction. + */ + ExpandedChanging: ASPxClientEvent>; + /** + * Occurs on the client side when the node's checked state is changed by clicking on a check box. + */ + CheckedChanged: ASPxClientEvent>; + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientTreeView. + */ + CallbackError: ASPxClientEvent>; + /** + * Returns a node specified by its index within the ASPxTreeView's node collection. + * @param index An integer value specifying the zero-based index of the node to be retrieved. + */ + GetNode(index: number): ASPxClientTreeViewNode; + /** + * Returns a node specified by its name. + * @param name A string value specifying the name of the node. + */ + GetNodeByName(name: string): ASPxClientTreeViewNode; + /** + * Returns a node specified by its text. + * @param text A string value specifying the text content of the node. + */ + GetNodeByText(text: string): ASPxClientTreeViewNode; + /** + * Returns the number of nodes at the ASPxTreeView's zero level. + */ + GetNodeCount(): number; + /** + * Returns the selected node within the ASPxTreeView control on the client side. + */ + GetSelectedNode(): ASPxClientTreeViewNode; + /** + * Selects the specified node within the ASPxTreeView control on the client side. + * @param node An ASPxClientTreeViewNode object specifying the node to select. + */ + SetSelectedNode(node: ASPxClientTreeViewNode): void; + /** + * Gets the root node of the ASPxTreeView object. + */ + GetRootNode(): ASPxClientTreeViewNode; + /** + * Collapses all nodes in the ASPxTreeView on the client side. + */ + CollapseAll(): void; + /** + * Expands all nodes in the ASPxTreeView on the client side. + */ + ExpandAll(): void; +} +/** + * Represents a client-side equivalent of the ASPxTreeView's TreeViewNode object. + */ +interface ASPxClientTreeViewNode { + /** + * Gets the client representation of the ASPxTreeView control to which the current node belongs. + * Value: An ASPxClientTreeView object representing the control to which the node belongs. + */ + treeView: ASPxClientTreeView; + /** + * Gets the current node's parent node. + * Value: An ASPxClientTreeViewNode object representing the node's immediate parent. + */ + parent: ASPxClientTreeViewNode; + /** + * Gets the node's index within the parent's collection of nodes. + * Value: An integer value representing the node's zero-based index within the Nodes collection of the node to which the node belongs. + */ + index: number; + /** + * Gets the name that uniquely identifies the node. + * Value: A string value that represents the value assigned to the node's Name property. + */ + name: string; + /** + * Returns the number of the current node's immediate child nodes. + */ + GetNodeCount(): number; + /** + * Returns the current node's immediate child node specified by its index. + * @param index An integer value specifying the zero-based index of the node to be retrieved. + */ + GetNode(index: number): ASPxClientTreeViewNode; + /** + * Returns the current node's child node specified by its name. + * @param name A string value specifying the name of the node. + */ + GetNodeByName(name: string): ASPxClientTreeViewNode; + /** + * Returns the current node's child node specified by its text. + * @param text A string value specifying the text content of the node. + */ + GetNodeByText(text: string): ASPxClientTreeViewNode; + /** + * Returns a value indicating whether the node is expanded. + */ + GetExpanded(): boolean; + /** + * Sets a value which specifies the node's expansion state. + * @param value true if the node is expanded; otherwise, false. + */ + SetExpanded(value: boolean): void; + /** + * Returns a value indicating whether the node is checked. + */ + GetChecked(): boolean; + /** + * Sets a value indicating whether the node is checked. + * @param value true if the node is checked; otherwise, false. + */ + SetChecked(value: boolean): void; + /** + * Returns a value which specifies the node's check state. + */ + GetCheckState(): string; + /** + * Returns a value specifying whether the node is enabled. + */ + GetEnabled(): boolean; + /** + * Sets a value specifying whether the node is enabled. + * @param value true to make the node enabled; false to disable it. + */ + SetEnabled(value: boolean): void; + /** + * Returns the URL pointing to the image displayed within the node. + */ + GetImageUrl(): string; + /** + * Sets the URL which points to the image displayed within the node. + * @param value A string value specifying the URL to the image displayed within the node. + */ + SetImageUrl(value: string): void; + /** + * Gets an URL which defines the navigation location for the node's hyperlink. + */ + GetNavigateUrl(): string; + /** + * Specifies a URL which defines the node's navigate URL. + * @param value A string value which specifies a URL to where the client web browser will navigate when the node is clicked. + */ + SetNavigateUrl(value: string): void; + /** + * Gets the text, displayed within the node. + */ + GetText(): string; + /** + * Specifies the text, displayed within the node. + * @param value A string value that represents the text displayed within the node. + */ + SetText(value: string): void; + /** + * Returns a value specifying whether a node is displayed. + */ + GetVisible(): boolean; + /** + * Specifies whether the node is visible. + * @param value true if the node is visible; otherwise, false. + */ + SetVisible(value: boolean): void; + /** + * Gets the HTML object that contains the current node. + */ + GetHtmlElement(): Object; +} +/** + * A method that will handle the client events concerned with node processing. + */ +interface ASPxClientTreeViewNodeProcessingModeEventHandler { + /** + * A method that will handle the client events concerned with node processing. + * @param source An object representing the event source. Identifies the ASPxClientTreeView control that raised the event. + * @param e An ASPxClientTreeViewNodeProcessingModeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeViewNodeProcessingModeEventArgs): void; +} +/** + * Provides data for the client events concerned with node processing, and that allow the event's processing to be passed to the server side. + */ +interface ASPxClientTreeViewNodeProcessingModeEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets a node object related to the event. + * Value: An ASPxClientTreeViewNode object, manipulations on which forced the event to be raised. + */ + node: ASPxClientTreeViewNode; +} +/** + * A method that will handle the ASPxClientTreeView.ItemClick event. + */ +interface ASPxClientTreeViewNodeClickEventHandler { + /** + * A method that will handle the NodeClick event. + * @param source The ASPxClientTreeView control which fires the event. + * @param e An ASPxClientTreeViewNodeClickEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeViewNodeClickEventArgs): void; +} +/** + * Provides data for the NodeClick event. + */ +interface ASPxClientTreeViewNodeClickEventArgs extends ASPxClientTreeViewNodeProcessingModeEventArgs { + /** + * Gets the HTML object that contains the processed node. + * Value: An object representing a container for the node related to the event. + */ + htmlElement: Object; + /** + * Gets a DHTML event object that relates to the processed event. + * Value: An object that maintains DHTML event-specific information. + */ + htmlEvent: Object; +} +/** + * A method that will handle the ASPxTreeView control's client events concerning manipulations with a node. + */ +interface ASPxClientTreeViewNodeEventHandler { + /** + * A method that will handle the ASPxTreeView control's client events, concerning manipulations with a node. + * @param source An object representing the event's source. Identifies the ASPxClientTreeView control object that raised the event. + * @param e An ASPxClientTreeViewNodeEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeViewNodeEventArgs): void; +} +/** + * Provides data for the ExpandedChanged events. + */ +interface ASPxClientTreeViewNodeEventArgs extends ASPxClientEventArgs { + /** + * Gets a node object related to the event. + * Value: An ASPxClientTreeViewNode object, manipulations on which forced the event to be raised. + */ + node: ASPxClientTreeViewNode; +} +/** + * A method that will handle the ASPxTreeView's cancelable client events, concerning manipulations with nodes. + */ +interface ASPxClientTreeViewNodeCancelEventHandler { + /** + * A method that will handle the ASPxTreeView's cancelable client events, concerning manipulations with nodes. + * @param source An object representing the event's source. Identifies the ASPxClientTreeView object that raised the event. + * @param e An ASPxClientTreeViewNodeCancelEventArgs object that contains event data. + */ + (source: S, e: ASPxClientTreeViewNodeCancelEventArgs): void; +} +/** + * Provides data for the ExpandedChanging event. + */ +interface ASPxClientTreeViewNodeCancelEventArgs extends ASPxClientProcessingModeCancelEventArgs { + /** + * Gets a node object related to the event. + * Value: An ASPxClientTreeViewNode object, manipulations on which forced the event to be raised. + */ + node: ASPxClientTreeViewNode; +} +/** + * Represents a client-side equivalent of the ASPxUploadControl control. + */ +interface ASPxClientUploadControl extends ASPxClientControl { + /** + * Occurs on the client after a file has been uploaded. + */ + FileUploadComplete: ASPxClientEvent>; + /** + * Occurs on the client after upload of all selected files has been completed. + */ + FilesUploadComplete: ASPxClientEvent>; + /** + * Occurs on the client side before upload of the specified files starts. + */ + FileUploadStart: ASPxClientEvent>; + /** + * Occurs on the client side before file upload is started. + */ + FilesUploadStart: ASPxClientEvent>; + /** + * Fires on the client side when the text within the control's edit box is changed while the control has focus. + */ + TextChanged: ASPxClientEvent>; + /** + * Occurs on the client side when the progress bar indicator position is changed. + */ + UploadingProgressChanged: ASPxClientEvent>; + /** + * Occurs on the client side when the file input elements count is changed. + */ + FileInputCountChanged: ASPxClientEvent>; + /** + * Fires when the mouse enters a drop zone or an external drop zone element while dragging a file. + */ + DropZoneEnter: ASPxClientEvent>; + /** + * Fires when the mouse leaves a drop zone or an external drop zone element while dragging a file. + */ + DropZoneLeave: ASPxClientEvent>; + /** + * Initiates uploading of the specified file to the web server's memory. + */ + UploadFile(): void; + /** + * Adds a new file input element to the ASPxUploadControl. + */ + AddFileInput(): void; + /** + * Removes a file input element from the ASPxUploadControl. + * @param index An integer value that represents a file input element's index. + */ + RemoveFileInput(index: number): void; + /** + * Removes a file with the specified index from the selected file list. + * @param fileIndex An integer value that is the zero-based index of an item in the file list. + */ + RemoveFileFromSelection(fileIndex: number): void; + /** + * Gets the text displayed within the edit box of the specified file input element. + * @param index An integer value that specifies the required file input element's index. + */ + GetText(index: number): string; + /** + * Gets the number of file input elements contained within the ASPxUploadControl. + */ + GetFileInputCount(): number; + /** + * Specifies the count of the file input elements within the upload control. + * @param count An integer value that specifies the file input elements count. + */ + SetFileInputCount(count: number): void; + /** + * Specifies whether the upload control is enabled. + * @param enabled true, to enable the upload control; otherwise, false. + */ + SetEnabled(enabled: boolean): void; + /** + * Returns a value indicating whether the upload control is enabled. + */ + GetEnabled(): boolean; + /** + * Initiates uploading of the specified file(s) to the web server's memory. + */ + Upload(): void; + /** + * Cancels the initiated file uploading process. + */ + Cancel(): void; + /** + * Clears the file selection in the upload control. + */ + ClearText(): void; + /** + * Sets the text to be displayed within the add button. + * @param text A string value specifying the text to be displayed within the button. + */ + SetAddButtonText(text: string): void; + /** + * Sets the text to be displayed within the upload button. + * @param text A string value specifying the text to be displayed within the button. + */ + SetUploadButtonText(text: string): void; + /** + * Returns the text displayed within the add button. + */ + GetAddButtonText(): string; + /** + * Returns the text displayed within the upload button. + */ + GetUploadButtonText(): string; + /** + * Sets the ID of a web control or HTML element (or a list of IDs), a click on which invokes file upload dialog. + * @param ids A string value specifying the ID or a list of IDs separated by the semicolon (;). + */ + SetDialogTriggerID(ids: string): void; +} +/** + * A method that will handle the client FilesUploadStart event. + */ +interface ASPxClientUploadControlFilesUploadStartEventHandler { + /** + * A method that will handle the FilesUploadStart event. + * @param source The event source. Identifies the ASPxUploadControl control that raised the event. + * @param e A ASPxClientUploadControlFilesUploadStartEventArgs object that contains event data. + */ + (source: S, e: ASPxClientUploadControlFilesUploadStartEventArgs): void; +} +/** + * Provides data for the FilesUploadStart event. + */ +interface ASPxClientUploadControlFilesUploadStartEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets a value indicating whether the action which raised the event should be canceled. + * Value: true if the action that raised the event should be canceled; otherwise, false. + */ + cancel: boolean; +} +/** + * A method that handles the FileUploadComplete client event. + */ +interface ASPxClientUploadControlFileUploadCompleteEventHandler { + /** + * A method that will handle the corresponding client event. + * @param source The event source. This parameter identifies the upload control which raised the event. + * @param e An ASPxClientUploadControlFileUploadCompleteEventArgs object that contains event data. + */ + (source: S, e: ASPxClientUploadControlFileUploadCompleteEventArgs): void; +} +/** + * Provides data for the FileUploadComplete event. + */ +interface ASPxClientUploadControlFileUploadCompleteEventArgs extends ASPxClientEventArgs { + /** + * Gets the index of a file input element within the ASPxUploadControl. + * Value: An integer value that specifies the file input element's index. + */ + inputIndex: number; + /** + * Gets or sets a value indicating whether the uploaded file passes validation. + * Value: true if the file is valid; otherwise, false. + */ + isValid: boolean; + /** + * Gets the error text to be displayed within the ASPxUploadControl's error frame. + * Value: A string value that represents the error text. + */ + errorText: string; + /** + * Gets a string that contains specific information (if any) passed from the server side for further client processing. + * Value: A string value representing callback data passed from the server. + */ + callbackData: string; +} +/** + * A method that will handle the FilesUploadComplete client event. + */ +interface ASPxClientUploadControlFilesUploadCompleteEventHandler { + /** + * A method that will handle the client FilesUploadComplete event. + * @param source The event source. This parameter identifies the upload control which raised the event. + * @param e A object that contains event data. + */ + (source: S, e: ASPxClientUploadControlFilesUploadCompleteEventArgs): void; +} +/** + * Provides data for the FilesUploadComplete client event, which enables you to perform specific actions after all selected files have been uploaded. + */ +interface ASPxClientUploadControlFilesUploadCompleteEventArgs extends ASPxClientEventArgs { + /** + * Gets the error text to be displayed within the upload control's error frame. + * Value: A string value that is the error text. + */ + errorText: string; + /** + * Gets a string that contains specific information (if any) passed from the server side for further client processing. + * Value: A string value that is the callback data passed from the server. + */ + callbackData: string; +} +/** + * A method that will handle the TextChanged client event. + */ +interface ASPxClientUploadControlTextChangedEventHandler { + /** + * A method that will handle the TextChanged client event. + * @param source The event source. This parameter identifies the upload control which raised the event. + * @param e An ASPxClientUploadControlTextChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientUploadControlTextChangedEventArgs): void; +} +/** + * Provides data for the TextChanged client event that allows you to respond to an end-user changing an edit box's text. + */ +interface ASPxClientUploadControlTextChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the index of a file input element within the ASPxUploadControl. + * Value: An integer value that specifies the file input element's index. + */ + inputIndex: number; +} +/** + * A method that will handle the ASPxUploadControl's client event, concerned with changes in upload progress. + */ +interface ASPxClientUploadControlUploadingProgressChangedEventHandler { + /** + * A method that will handle the ASPxUploadControl's client event concerning the uploading process being changed. + * @param source An object representing the event's source. Identifies the ASPxUploadControl object that raised the event. + * @param e An ASPxClientUploadControlUploadingProgressChangedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientUploadControlUploadingProgressChangedEventArgs): void; +} +/** + * Provides data for the UploadingProgressChanged event. + */ +interface ASPxClientUploadControlUploadingProgressChangedEventArgs extends ASPxClientEventArgs { + /** + * Gets the number of the files selected for upload. + * Value: An integer value that represents the total number of selected files. + */ + fileCount: number; + /** + * Gets the name of the file being currently uploaded. + * Value: A string value that represents the file name. + */ + currentFileName: string; + /** + * Gets the content length of the currently uploaded file. + * Value: An integer value specifying the content length. + */ + currentFileContentLength: number; + /** + * Gets the content length of the current file already uploaded to the server. + * Value: An integer value that is the content length. + */ + currentFileUploadedContentLength: number; + /** + * Gets the position of the current file upload progress. + * Value: An value specifying the upload progress position. + */ + currentFileProgress: number; + /** + * Gets the content length of the files selected for upload. + * Value: An integer value specifying the total content length of the selected files. + */ + totalContentLength: number; + /** + * Gets the content length of the files already uploaded to the server. + * Value: An integer value that represents the content length. + */ + uploadedContentLength: number; + /** + * Gets the current position of total upload progress. + * Value: An value specifying the total upload progress position. + */ + progress: number; +} +/** + * A method that will handle the DropZoneEnter event. + */ +interface ASPxClientUploadControlDropZoneEnterEventHandler { + /** + * A method that will handle the DropZoneEnter event. + * @param source The event source. This parameter identifies the upload control object which raised the event. + * @param e An ASPxClientUploadControlDropZoneEnterEventArgs object that contains event data. + */ + (source: S, e: ASPxClientUploadControlDropZoneEnterEventArgs): void; +} +/** + * Provides data for the DropZoneEnter event. + */ +interface ASPxClientUploadControlDropZoneEnterEventArgs extends ASPxClientEventArgs { + /** + * Gets a drop zone object related to the processed event. + * Value: An object that is a drop zone related to the processed event. + */ + dropZone: Object; +} +/** + * A method that will handle the DropZoneLeave event. + */ +interface ASPxClientUploadControlDropZoneLeaveEventHandler { + /** + * A method that will handle the DropZoneLeave event. + * @param source The event source. Identifies the upload control object that raised the event. + * @param e A ASPxClientUploadControlDropZoneLeaveEventArgs object that contains event data. + */ + (source: S, e: ASPxClientUploadControlDropZoneLeaveEventArgs): void; +} +/** + * Provides data for the DropZoneLeave event. + */ +interface ASPxClientUploadControlDropZoneLeaveEventArgs extends ASPxClientEventArgs { + /** + * Gets a drop zone object related to the processed event. + * Value: An object that is a drop zone related to the processed event. + */ + dropZone: Object; +} +/** + * The JavaScript equivalent of the ASPxChartDesigner class. + */ +interface ASPxClientChartDesigner extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientChartDesigner. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs when executing the Save command on the client. + */ + SaveCommandExecute: ASPxClientEvent>; + /** + * Enables you to customize the menu actions of a Client Chart Designer. + */ + CustomizeMenuActions: ASPxClientEvent>; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + */ + PerformCallback(arg: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; + /** + * Updates the localization settings of the ASPxClientChartDesigner properties. + * @param localization A dictionary containing the property names, along with their localized equivalents. + */ + UpdateLocalization(localization: { [key: string]: string; }): void; + /** + * Returns the model of the Client Chart Designer. + */ + GetDesignerModel(): Object; + /** + * For internal use. + */ + GetJsonChartModel(): string; +} +/** + * A method that will handle the SaveCommandExecute event. + */ +interface ASPxClientChartDesignerSaveCommandExecuteEventHandler { + /** + * Represents a method that will handle the SaveCommandExecute event. + * @param source The event source. This parameter identifies the ASPxChartDesigner which raised the event. + * @param e A ASPxClientChartDesignerSaveCommandExecuteEventArgs object which contains event data. + */ + (source: S, e: ASPxClientChartDesignerSaveCommandExecuteEventArgs): void; +} +/** + * Provides data for a chart control's SaveCommandExecute event. + */ +interface ASPxClientChartDesignerSaveCommandExecuteEventArgs extends ASPxClientEventArgs { + /** + * Gets or sets a value specifying whether an event has been handled. + * Value: true, if the event hasn't been handled by a control; otherwise, false. + */ + handled: boolean; +} +/** + * Represents a method that will handle the CustomizeMenuActions events. + */ +interface ASPxClientChartDesignerCustomizeMenuActionsEventHandler { + /** + * Represents a method that will handle the CustomizeMenuActions event. + * @param source The event source. This parameter identifies the ASPxChartDesigner which raised the event. + * @param e An ASPxClientChartDesignerCustomizeMenuActionsEventArgs object which contains event data. + */ + (source: S, e: ASPxClientChartDesignerCustomizeMenuActionsEventArgs): void; +} +/** + * An action of the Client Chart Designer's menu. + */ +interface ASPxClientChartDesignerMenuAction { + /** + * Provides access to the text for the command. + * Value: A String value. + */ + text: string; + /** + * Provides access to the CSS class of the command's glyph. + * Value: A String value. + */ + imageClassName: string; + /** + * Provides access to the action performed when the Client Chart Designer's button is clicked. + * Value: The specific action implementation. + */ + clickAction: Function; + /** + * Provides access to the value that specifies whether or not the command is disabled by default. + * Value: true, if the command is disabled by default; otherwise, false. + */ + disabled: boolean; + /** + * Provides access to the value that specifies whether or not the command is visible in the designer user interface. + * Value: true if the command is visible; otherwise false. + */ + visible: boolean; + /** + * Provides access to the keyboard shortcut used to invoke the command. + * Value: A String value. + */ + hotKey: string; + /** + * Provides access to the value that specifies whether or not the command has a visual separator. + * Value: true, if the command has a visual separator; otherwise, false. + */ + hasSeparator: string; + /** + * Provides access to the location of the displayed command. + * Value: A String value. + */ + container: string; +} +/** + * Provides data for a chart control's CustomizeMenuActions event on the client side. + */ +interface ASPxClientChartDesignerCustomizeMenuActionsEventArgs extends ASPxClientEventArgs { + /** + * Returns an array of the Client Chart Designer's menu actions. + * Value: An array of the ASPxClientChartDesignerMenuAction objects. + */ + actions: ASPxClientChartDesignerMenuAction[]; +} +/** + * A class which provides access to the entire hierarchy of chart elements on the client side. + */ +interface ASPxClientWebChartControl extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client side after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientWebChartControl. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client side when any chart element is hot-tracked. + */ + ObjectHotTracked: ASPxClientEvent>; + /** + * Occurs before crosshair items are drawn when the chart's contents are being drawn. + */ + CustomDrawCrosshair: ASPxClientEvent>; + /** + * Occurs on the client side when any chart element is selected. + */ + ObjectSelected: ASPxClientEvent>; + /** + * Returns an ASPxClientWebChart object, which contains information about the hierarchy of a chart control, and provides access to the main properties of chart elements on the client side. + */ + GetChart(): ASPxClientWebChart; + /** + * Returns the printing options of the chart control. + */ + GetPrintOptions(): ASPxClientChartPrintOptions; + /** + * Changes the mouse pointer, which is shown when the mouse is over the chart control, to the pointer with the specified name. + * @param cursor A string value representing the name of the desired cursor. + */ + SetCursor(cursor: string): void; + /** + * Returns the specific chart element which is located under the test point. + * @param x An integer value that specifies the x coordinate of the test point. + * @param y An integer value that specifies the y coordinate of the test point. + */ + HitTest(x: number, y: number): ASPxClientHitObject[]; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side event. + */ + PerformCallback(args: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param args A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; + /** + * Prints the current chart on the client side. + */ + Print(): void; + /** + * Loads a chart which should be customized from its object model. + * @param serializedChartObjectModel A String object representing the chart model. + */ + LoadFromObjectModel(serializedChartObjectModel: string): void; + /** + * Exports a chart to the file of the specified format, and saves it to the disk. + * @param format A string value specifying the format, to which a chart should be exported. + */ + SaveToDisk(format: string): void; + /** + * Exports a chart to a file in the specified format, and saves it to disk, using the specified file name. + * @param format A string value specifying the format, to which a chart should be exported. + * @param filename A string value specifying the file name, to which a chart should be exported. If this parameter is missing or set to an empty string, then the created file will be named using the client-side name of a chart. + */ + SaveToDisk(format: string, filename: string): void; + /** + * Exports a report to the file of the specified format, and shows it in a new Web Browser window. + * @param format A string value specifying a format in which a report should be exported. + */ + SaveToWindow(format: string): void; + /** + * Gets the main DOM (Document Object Model) element on a Web Page representing this ASPxClientWebChartControl object. + */ + GetMainDOMElement(): Object; +} +/** + * A method that will handle the CustomDrawCrosshair event. + */ +interface ASPxClientWebChartControlCustomDrawCrosshairEventHandler { + /** + * A method that will handle the CustomDrawCrosshair event. + * @param source The event source. This parameter identifies the chartControl which raised the event. + * @param e An ASPxClientWebChartControlCustomDrawCrosshairEventArgs object which contains event data. + */ + (source: S, e: ASPxClientWebChartControlCustomDrawCrosshairEventArgs): void; +} +/** + * Provides data for a chart control's CustomDrawCrosshair event. + */ +interface ASPxClientWebChartControlCustomDrawCrosshairEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets crosshair elements settings to custom draw a crosshair cursor. + * Value: An ASPxClientCrosshairElement object. + */ + crosshairElements: ASPxClientCrosshairElement; + /** + * Gets the settings of crosshair axis label elements to customize their appearance. + * Value: An ASPxClientCrosshairAxisLabelElement object. + */ + cursorCrosshairAxisLabelElements: ASPxClientCrosshairAxisLabelElement; + /** + * Gets crosshair line element settings that are used to custom draw a crosshair cursor. + * Value: An ASPxClientCrosshairLineElement object that contains crosshair line element settings. + */ + cursorCrosshairLineElement: ASPxClientCrosshairLineElement; + /** + * Gets the settings of crosshair group header elements to customize their appearance. + * Value: An ASPxClientCrosshairGroupHeaderElement object. + */ + crosshairGroupHeaderElements: ASPxClientCrosshairGroupHeaderElement; + /** + * Provides access to the settings of crosshair elements and crosshair group header elements to customize their appearance. + * Value: An ASPxClientCrosshairElementGroup object. + */ + crosshairElementGroups: ASPxClientCrosshairElementGroup; +} +/** + * Represents the client-side equivalent of the CrosshairElement class. + */ +interface ASPxClientCrosshairElement { + /** + * Gets a series that a crosshair element hovers over when implementing a custom draw. + * Value: An ASPxClientSeries object which represents the series currently being painted. + */ + Series: ASPxClientSeries; + /** + * Gets the series point that a crosshair element hovers over when implementing a custom draw. + * Value: An ASPxClientSeriesPoint object, representing the series point that a crosshair element hovers over. + */ + Point: ASPxClientSeriesPoint; + /** + * Gets or sets the crosshair line element to custom draw a crosshair cursor. + * Value: An ASPxClientCrosshairLineElement object, representing the crosshair line element. + */ + LineElement: ASPxClientCrosshairLineElement; + /** + * Provides access to the crosshair axis label element. + * Value: An ASPxClientCrosshairAxisLabelElement object, representing the crosshair axis label element. + */ + AxisLabelElement: ASPxClientCrosshairAxisLabelElement; + /** + * Gets the crosshair label element. + * Value: An ASPxClientCrosshairSeriesLabelElement object, representing the crosshair label element. + */ + LabelElement: ASPxClientCrosshairSeriesLabelElement; + /** + * Specifies whether the crosshair element is visible when implementing custom drawing in the crosshair cursor. + * Value: true, if the crosshair element is visible; otherwise, false. + */ + visible: boolean; +} +/** + * Represents the client-side equivalent of the CrosshairLineElement class. + */ +interface ASPxClientCrosshairLineElement { +} +/** + * Represents the client-side equivalent of the CrosshairAxisLabelElement class. + */ +interface ASPxClientCrosshairAxisLabelElement { +} +/** + * The client-side equivalent of the CrosshairGroupHeaderElement class. + */ +interface ASPxClientCrosshairGroupHeaderElement { +} +/** + * The client-side equivalent of the CrosshairLabelElement class. + */ +interface ASPxClientCrosshairSeriesLabelElement { +} +/** + * Represents the client-side equivalent of the CrosshairElementGroup class. + */ +interface ASPxClientCrosshairElementGroup { +} +/** + * Represents a method that will handle the ObjectSelected events. + */ +interface ASPxClientWebChartControlHotTrackEventHandler { + /** + * Represents a method that will handle the ObjectSelected events. + * @param source The event source. This parameter identifies the ASPxClientWebChartControl which raised the event. + * @param e An ASPxClientWebChartControlHotTrackEventArgs object which contains event data. + */ + (source: S, e: ASPxClientWebChartControlHotTrackEventArgs): void; +} +/** + * Provides data for a chart control's ObjectSelected events on the client side. + */ +interface ASPxClientWebChartControlHotTrackEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Provides access on the client side to the chart element, for which the event was raised. + * Value: An ASPxClientWebChartElement object, which represents the chart element for which the event was raised. + */ + hitObject: ASPxClientWebChartElement; + /** + * Provides access on the client side to the object, which is in some way related to the object being hit. The returned value depends on the hitObject type and hit point location. + * Value: An ASPxClientWebChartElement object representing an additional object that relates to the one being hit. + */ + additionalHitObject: ASPxClientWebChartElement; + /** + * Gets details on the chart elements located at the point where an end-user has clicked when hot-tracking or selecting a chart element on the client side. + * Value: An ASPxClientWebChartHitInfo object, which contains information about the chart elements located at the point where an end-user has clicked. + */ + hitInfo: ASPxClientWebChartHitInfo; + /** + * Provides access on the client side to the chart and all its elements. + * Value: An ASPxClientWebChart object, which provides access to chart properties. + */ + chart: ASPxClientWebChart; + /** + * Gets the HTML object that contains the processed item. + * Value: An object representing a container for the item related to the event. + */ + htmlElement: Object; + /** + * Gets the X-coordinate of the hit test point, relative to the top left corner of the chart. + * Value: An integer value specifying X-coordinate of the hit test point (in pixels). + */ + x: number; + /** + * Gets the Y-coordinate of the hit test point, relative to the top left corner of the chart. + * Value: An integer value specifying Y-coordinate of the hit test point (in pixels). + */ + y: number; + /** + * Gets the X-coordinate of the hit test point, relative to the top left corner of the Web Page containing this chart. + * Value: An integer value specifying X-coordinate of the hit test point (in pixels). + */ + absoluteX: number; + /** + * Gets the Y-coordinate of the hit test point, relative to the top left corner of the Web Page containing this chart. + * Value: An integer value specifying Y-coordinate of the hit test point (in pixels). + */ + absoluteY: number; + /** + * Gets a value indicating whether the hot-tracking or object selection should be canceled. + * Value: true to cancel the hot-tracking or selection of an object; otherwise, false. + */ + cancel: boolean; +} +/** + * Represents an object under the hit test point within a chart control, on the client side. + */ +interface ASPxClientHitObject { + /** + * Gets the chart element for which the event was raised. + * Value: An ASPxClientWebChartElement object, representing the chart element for which the event was raised. + */ + Object: ASPxClientWebChartElement; + /** + * Provides access to an object, which is in some way related to the object being hit. The returned value depends on the Object type and hit point location. + * Value: An ASPxClientWebChartElement object that represents an additional object related to the one being hit. + */ + AdditionalObject: ASPxClientWebChartElement; +} +/** + * Contains information about a specific test point within a chart control, on the client side. + */ +interface ASPxClientWebChartHitInfo { + /** + * Gets a value indicating whether the test point is within the chart. + * Value: true if the test point is within a chart; otherwise, false. + */ + inChart: boolean; + /** + * Gets a value indicating whether the test point is within the chart title. + * Value: true if the test point is within a chart title; otherwise, false. + */ + inChartTitle: boolean; + /** + * 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; + /** + * Gets a value indicating whether the test point is within the axis label item. + * Value: true if the test point is within an axis label item; otherwise, false. + */ + inAxisLabelItem: boolean; + /** + * Gets a value indicating whether the test point is within the axis title. + * Value: true if the test point is within an axis title; otherwise, false. + */ + inAxisTitle: boolean; + /** + * Gets a value indicating whether the test point is within the constant line. + * Value: true if the test point is within a constant line; otherwise, false. + */ + inConstantLine: boolean; + /** + * Gets a value indicating whether the test point is within the diagram. + * Value: true if the test point is within a diagram; otherwise, false. + */ + inDiagram: boolean; + /** + * Gets a value indicating whether the test point is within the non-default pane. + * Value: true if the test point is within a non-default pane; otherwise, false. + */ + inNonDefaultPane: boolean; + /** + * Gets a value indicating whether the test point is within the legend. + * Value: true if the test point is within a legend; otherwise, false. + */ + inLegend: boolean; + /** + * Gets the value indicating whether or not the test point is within a custom legend item. + * Value: true if the test point is within a custom legend item; otherwise, false. + */ + inCustomLegendItem: boolean; + /** + * Gets a value indicating whether the test point is within the series. + * Value: true if the test point is within a series; otherwise, false. + */ + inSeries: boolean; + /** + * Gets a value indicating whether the test point is within the series label. + * Value: true if the test point is within a series label; otherwise, false. + */ + inSeriesLabel: boolean; + /** + * Gets a value indicating whether the test point is within the series point. + * Value: true if the test point is within a series point; otherwise, false. + */ + inSeriesPoint: boolean; + /** + * Gets a value indicating whether the test point is within the series title. + * Value: true if the test point is within a series title; otherwise, false. + */ + inSeriesTitle: boolean; + /** + * Gets a value indicating whether the test point is within the trendline. + * Value: true if the test point is within a trendline; otherwise, false. + */ + inTrendLine: boolean; + /** + * Gets a value indicating whether the test point is within the Fibonacci Indicator. + * Value: true if the test point is within a Fibonacci Indicator; otherwise, false. + */ + inFibonacciIndicator: boolean; + /** + * Gets a value indicating whether the test point is within the regression line. + * Value: true if the test point is within a regression line; otherwise, false. + */ + inRegressionLine: boolean; + /** + * Gets a value specifying whether the test point is within an indicator. + * Value: true if the test point is within an indicator; otherwise, false. + */ + inIndicator: boolean; + /** + * Gets a value indicating whether the test point is within an annotation. + * Value: true if the test point is within an annotation; otherwise, false. + */ + inAnnotation: boolean; + /** + * Gets a value indicating whether the test point is within a hyperlink. + * Value: true, if the test point is within a hyperlink; otherwise, false. + */ + inHyperlink: boolean; + /** + * Gets the client-side chart instance from under the test point. + * Value: An ASPxClientWebChart object. + */ + chart: ASPxClientWebChart; + /** + * Gets the client-side chart title instance from under the test point. + * Value: An ASPxClientChartTitle object. + */ + chartTitle: ASPxClientChartTitle; + /** + * Gets the client-side axis instance from under the test point. + * Value: An ASPxClientAxisBase descendant. + */ + axis: ASPxClientAxisBase; + /** + * Gets the client-side constant line instance from under the test point. + * Value: An ASPxClientConstantLine object. + */ + constantLine: ASPxClientConstantLine; + /** + * Gets the client-side diagram instance from under the test point. + * Value: An ASPxClientXYDiagramBase descendant. + */ + diagram: ASPxClientXYDiagramBase; + /** + * Gets the client-side non-default pane instance from under the test point. + * Value: An ASPxClientXYDiagramPane object. + */ + nonDefaultPane: ASPxClientXYDiagramPane; + /** + * Gets the client-side legend instance from under the test point. + * Value: An ASPxClientLegend object. + */ + legend: ASPxClientLegend; + /** + * Gets a custom legend item which is located under the test point. + * Value: An ASPxClientCustomLegendItem object which represents the item located under the test point. + */ + customLegendItem: ASPxClientCustomLegendItem; + /** + * Gets the client-side series instance from under the test point. + * Value: An ASPxClientSeries object. + */ + series: ASPxClientSeries; + /** + * Gets the client-side series label instance from under the test point. + * Value: An ASPxClientSeriesLabel object. + */ + seriesLabel: ASPxClientSeriesLabel; + /** + * Gets the client-side series title instance from under the test point. + * Value: An ASPxClientSeriesTitle object. + */ + seriesTitle: ASPxClientSeriesTitle; + /** + * Gets the client-side trendline instance from under the test point. + * Value: An ASPxClientTrendLine object. + */ + trendLine: ASPxClientTrendLine; + /** + * Gets the client-side Fibonacci indicator instance from under the test point. + * Value: An ASPxClientFibonacciIndicator object. + */ + fibonacciIndicator: ASPxClientFibonacciIndicator; + /** + * Gets the client-side regression line instance from under the test point. + * Value: An ASPxClientRegressionLine object. + */ + regressionLine: ASPxClientRegressionLine; + /** + * Gets the client-side indicator instance from under the test point. + * Value: An ASPxClientIndicator descendant. + */ + indicator: ASPxClientIndicator; + /** + * Gets the client-side annotation instance from under the test point. + * Value: An ASPxClientAnnotation object. + */ + annotation: ASPxClientAnnotation; + /** + * Gets the client-side series point instance from under the test point. + * Value: An ASPxClientSeriesPoint object. + */ + seriesPoint: ASPxClientSeriesPoint; + /** + * Gets the client-side axis label item instance from under the test point. + * Value: An ASPxClientAxisLabelItem object. + */ + axisLabelItem: ASPxClientAxisLabelItem; + /** + * Gets the client-side axis title instance from under the test point. + * Value: An ASPxClientAxisTitle object. + */ + axisTitle: ASPxClientAxisTitle; + /** + * Returns a hyperlink which is located under the test point. + * Value: A String object representing a hyperlink. + */ + hyperlink: string; +} +/** + * Represents the client-side equivalent of the DiagramCoordinates class. + */ +interface ASPxClientDiagramCoordinates { + /** + * Gets the type of the argument scale. + * Value: A string object which contains the current scale type. + */ + argumentScaleType: string; + /** + * Gets the type of the value scale. + * Value: A string object which contains the current scale type. + */ + valueScaleType: string; + /** + * Gets the argument of the data point as a text string. + * Value: A string object, representing a data point's argument. + */ + qualitativeArgument: string; + /** + * Gets the numerical representation of the data point's argument. + * Value: A Double value, representing the data point's argument. + */ + numericalArgument: number; + /** + * Gets the date-time representation of the data point's argument. + * Value: A date object, representing the point's argument. + */ + dateTimeArgument: Date; + /** + * Gets the numerical representation of the data point's value. + * Value: A Double value, representing the data point's value. + */ + numericalValue: number; + /** + * Gets the date-time representation of the data point's value. + * Value: A date object, representing the point's value. + */ + dateTimeValue: Date; + /** + * Gets the X-axis of the diagram point. + * Value: An ASPxClientAxisBase descendant, representing the axis of arguments (X-axis). + */ + axisX: ASPxClientAxisBase; + /** + * Gets the Y-axis of the diagram point. + * Value: An ASPxClientAxisBase descendant, representing the axis of values (Y-axis). + */ + axisY: ASPxClientAxisBase; + /** + * Gets the pane of the diagram point. + * Value: An ASPxClientXYDiagramPane descendant, representing the pane. + */ + pane: ASPxClientXYDiagramPane; + /** + * Checks whether the current object represents a point outside the diagram area. + */ + IsEmpty(): boolean; + /** + * Gets the value of the client-side axis instance. + * @param axis An ASPxClientAxisBase class descendant, representing the axis that contains the requested value. + */ + GetAxisValue(axis: ASPxClientAxisBase): ASPxClientAxisValue; +} +/** + * Contains the information about an axis value. + */ +interface ASPxClientAxisValue { + /** + * Gets the axis scale type. + * Value: A String value, specifying the axis scale type. + */ + scaleType: string; + /** + * Gets the axis value, if the axis scale type is qualitative. + * Value: A String value, specifying the axis value. + */ + qualitativeValue: string; + /** + * Gets the axis value, if the axis scale type is numerical. + * Value: A Double value, specifying the axis value. + */ + numericalValue: number; + /** + * Gets the axis value, if the axis scale type is date-time. + * Value: A DateTime value, specifying the axis value. + */ + dateTimeValue: Date; +} +/** + * Represents the client-side equivalent of the ControlCoordinates class. + */ +interface ASPxClientControlCoordinates { + /** + * Gets the point's pane. + * Value: An ASPxClientXYDiagramPane object. + */ + pane: ASPxClientXYDiagramPane; + /** + * Gets the point's X-coordinate, in pixels. + * Value: An integer value, specifying the X-coordinate (in pixels). + */ + x: number; + /** + * Gets the point's Y-coordinate, in pixels. + * Value: An integer value, specifying the Y-coordinate (in pixels). + */ + y: number; + /** + * Gets the point's visibility state. + * Value: "Visible", "Hidden", or "Undefined". + */ + visibility: string; +} +/** + * Represents the client-side equivalent of the ChartElement class. + */ +interface ASPxClientWebChartElement { + /** + * Gets the chart that owns the current chart element. + * Value: An ASPxClientWebChart object, to which the chart element belongs. + */ + chart: ASPxClientWebChart; +} +/** + * Represents a base class for chart elements, which are not necessarily required to be present on the client side. + */ +interface ASPxClientWebChartEmptyElement extends ASPxClientWebChartElement { +} +/** + * Represents a base class for chart elements, which are required to be present on the client side. + */ +interface ASPxClientWebChartRequiredElement extends ASPxClientWebChartElement { +} +/** + * Represents the client-side equivalent of the ChartElementNamed class. + */ +interface ASPxClientWebChartElementNamed extends ASPxClientWebChartRequiredElement { + /** + * Gets the name of the chart element. + * Value: A string object representing the name of the chart element. + */ + name: string; +} +/** + * Represents the client-side equivalent of the WebChartControl control. + */ +interface ASPxClientWebChart extends ASPxClientWebChartRequiredElement { + /** + * Gets the client-side Chart Control that owns the current chart. + * Value: An ASPxClientWebChartControl object, to which the chart belongs. + */ + chartControl: ASPxClientWebChartControl; + /** + * Gets the chart's diagram and provides access to its settings. + * Value: An ASPxClientRadarDiagram), that represents the chart's diagram. + */ + diagram: ASPxClientWebChartElement; + /** + * Provides access to the chart's collection of series. + * Value: An array of ASPxClientSeries objects that represent the collection of series. + */ + series: ASPxClientSeries[]; + /** + * Provides access to the collection of chart titles. + * Value: An array of ASPxClientChartTitle objects, that represent the collection of chart titles. + */ + titles: ASPxClientChartTitle[]; + /** + * Provides access to the chart's collection of annotations. + * Value: An array of ASPxClientAnnotation objects, representing the collection of annotations. + */ + annotations: ASPxClientAnnotation[]; + /** + * Gets the chart's legend and provides access to its settings. + * Value: An ASPxClientLegend object that represents the chart's legend. + */ + legend: ASPxClientLegend; + /** + * Returns the collection of legends. + * Value: An array of ASPxClientLegend objects. + */ + legends: ASPxClientLegend[]; + /** + * Gets the name of the appearance, which is currently used to draw the chart's elements. + * Value: A string value that represents the appearance name. + */ + appearanceName: string; + /** + * Gets the name of the palette currently used to draw the chart's series. + * Value: A string value that represents the palette name. + */ + paletteName: string; + /** + * Gets a value indicating whether series tooltips should be shown. + * Value: true to show tooltips for series; otherwise, false. + */ + showSeriesToolTip: boolean; + /** + * Gets a value indicating whether point tooltips should be shown. + * Value: true to show tooltips for series points; otherwise, false. + */ + showPointToolTip: boolean; + /** + * Gets a value indicating whether a crosshair cursor should be shown. + * Value: true to show a crosshair cursor; otherwise, false. + */ + showCrosshair: boolean; + /** + * Gets a value that contains information on how the tooltip position is defined, for example, relative to a mouse pointer or chart element. + * Value: An ASPxClientToolTipPosition class descendant that defines the tooltip position type. + */ + toolTipPosition: ASPxClientToolTipPosition; + /** + * Returns the tooltip controller that shows tooltips for chart elements. + * Value: An ASPxClientToolTipController object. + */ + toolTipController: ASPxClientToolTipController; + /** + * Gets the settings for a crosshair cursor concerning its position and appearance on a diagram. + * Value: An ASPxClientCrosshairOptions object descendant which provides access to crosshair cursor options on a diagram. + */ + crosshairOptions: ASPxClientCrosshairOptions; + /** + * Gets a css postfix for a chart. + * Value: A string value. + */ + cssPostfix: string; + /** + * Gets or sets a value which specifies how the chart elements are selected. + * Value: A String object representing the name of the selection mode. + */ + selectionMode: string; +} +/** + * Represents the client-side equivalent of the SimpleDiagram class. + */ +interface ASPxClientSimpleDiagram extends ASPxClientWebChartEmptyElement { +} +/** + * Represents the base class for all diagram classes, which have X and Y axes. + */ +interface ASPxClientXYDiagramBase extends ASPxClientWebChartRequiredElement { + /** + * Gets the X-axis. + * Value: An ASPxClientAxisBase object which represents the X-axis. + */ + axisX: ASPxClientAxisBase; + /** + * Gets the Y-axis. + * Value: An ASPxClientAxisBase object which represents the Y-axis. + */ + axisY: ASPxClientAxisBase; +} +/** + * Represents the client-side equivalent of the XYDiagram2D class. + */ +interface ASPxClientXYDiagram2D extends ASPxClientXYDiagramBase { + /** + * Provides access to a collection of secondary X-axes for a given 2D XY-diagram. + * Value: An array of ASPxClientAxis objects, that is a collection of secondary X-axes. + */ + secondaryAxesX: ASPxClientAxis[]; + /** + * Provides access to a collection of secondary Y-axes for a given 2D XY-diagram. + * Value: An array of ASPxClientAxis objects, that is a collection of secondary X-axes. + */ + secondaryAxesY: ASPxClientAxis[]; + /** + * 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 panes. + * Value: An array of ASPxClientXYDiagramPane objects. + */ + panes: ASPxClientXYDiagramPane[]; + /** + * Converts the display coordinates into a diagram coordinates object. + * @param x An integer value, representing the X-coordinate of a point (measured in pixels relative to the top left corner of a chart). + * @param y An integer value, representing the Y-coordinate of a point (measured in pixels relative to the top left corner of a chart). + */ + PointToDiagram(x: number, y: number): ASPxClientDiagramCoordinates; + /** + * Converts the diagram coordinates of a point into screen coordinates. + * @param argument An object, representing the point's argument. + * @param value An object, representing the point's value. + * @param axisX An ASPxClientAxis2D descendant, representing the X-axis. + * @param axisY An ASPxClientAxis2D descendant, representing the Y-axis. + * @param pane An ASPxClientXYDiagramPane object, representing the pane. + */ + DiagramToPoint(argument: Object, value: Object, axisX: ASPxClientAxis2D, axisY: ASPxClientAxis2D, pane: ASPxClientXYDiagramPane): ASPxClientControlCoordinates; + /** + * Shows the Crosshair Cursor at the point with the specified coordinates. + * @param screenX The horizontal coordinate that is related to the top-left angle of the chart. + * @param screenY The vertical coordinate that is related to the top-left angle of the chart. + */ + ShowCrosshair(screenX: number, screenY: number): void; +} +/** + * Represents the client-side equivalent of the XYDiagram class. + */ +interface ASPxClientXYDiagram extends ASPxClientXYDiagram2D { + /** + * Gets a value indicating whether the diagram is rotated. + * Value: true if the diagram is rotated; otherwise, false. + */ + rotated: boolean; +} +/** + * Represents the client-side equivalent of the SwiftPlotDiagram class. + */ +interface ASPxClientSwiftPlotDiagram extends ASPxClientXYDiagram2D { +} +/** + * Represents the client-side equivalent of the XYDiagramPane class. + */ +interface ASPxClientXYDiagramPane extends ASPxClientWebChartElementNamed { + /** + * Gets the diagram that owns the current pane object. + * Value: An ASPxClientXYDiagram object, to which the pane belongs. + */ + diagram: ASPxClientXYDiagram; +} +/** + * Represents the client-side equivalent of the XYDiagram3D class. + */ +interface ASPxClientXYDiagram3D extends ASPxClientXYDiagramBase { +} +/** + * Represents the client-side equivalent of the RadarDiagram class. + */ +interface ASPxClientRadarDiagram extends ASPxClientXYDiagramBase { + /** + * Converts the display coordinates into a diagram coordinates object. + * @param x An integer value, representing the X-coordinate of a point (measured in pixels relative to the top left corner of a chart). + * @param y An integer value, representing the Y-coordinate of a point (measured in pixels relative to the top left corner of a chart). + */ + PointToDiagram(x: number, y: number): ASPxClientDiagramCoordinates; + /** + * Converts the diagram coordinates of a point into screen coordinates. + * @param argument An object, representing the point's argument. + * @param value An object, representing the point's value. + */ + DiagramToPoint(argument: Object, value: Object): ASPxClientControlCoordinates; +} +/** + * Represents the client-side equivalent of the AxisBase class. + */ +interface ASPxClientAxisBase extends ASPxClientWebChartElementNamed { + /** + * Provides access to the XY-diagram which contains the current axis. + * Value: An ASPxClientXYDiagramBase class descendant. + */ + diagram: ASPxClientXYDiagramBase; + /** + * Provides acess to the range of the axis coordinates. + * Value: An ASPxClientAxisRange object, which contains the common range settings of the axis coordinates. + */ + range: ASPxClientAxisRange; +} +/** + * Represents the client-side equivalent of the Axis2D class. + */ +interface ASPxClientAxis2D extends ASPxClientAxisBase { + /** + * Provides access to an axis title object. + * Value: An ASPxClientAxisTitle object which represents the axis title. + */ + axisTitle: ASPxClientAxisTitle; + /** + * Provides access to the axis strips collection. + * Value: An array of ASPxClientStrip objects. + */ + strips: ASPxClientStrip[]; + /** + * Provides access to the collection of the axis constant lines. + * Value: An array of ASPxClientConstantLine objects which represent constant lines that belong to this axis. + */ + constantLines: ASPxClientConstantLine[]; +} +/** + * Represents the client-side equivalent of the Axis class. + */ +interface ASPxClientAxis extends ASPxClientAxis2D { + /** + * Gets a value indicating whether the axis is reversed. + * Value: true if the axis is reversed; otherwise, false. + */ + reverse: boolean; +} +/** + * Represents the client-side equivalent of the SwiftPlotDiagramAxis class. + */ +interface ASPxClientSwiftPlotDiagramAxis extends ASPxClientAxis2D { +} +/** + * Represents the client-side equivalent of the Axis3D class. + */ +interface ASPxClientAxis3D extends ASPxClientAxisBase { +} +/** + * Represents the client-side equivalent of the RadarAxis class. + */ +interface ASPxClientRadarAxis extends ASPxClientAxisBase { +} +/** + * Represents the client-side equivalent of the AxisTitle class. + */ +interface ASPxClientAxisTitle extends ASPxClientWebChartRequiredElement { + /** + * Gets the axis to which the axis title belongs. + * Value: An ASPxClientAxisBase descendant, which identifies the axis. + */ + axis: ASPxClientAxisBase; + /** + * Gets the text of the axis title. + * Value: A string object which contains the axis title's text. + */ + text: string; +} +/** + * Represents the client-side equivalent of the AxisLabelItem class. + */ +interface ASPxClientAxisLabelItem extends ASPxClientWebChartRequiredElement { + /** + * Gets the axis to which an axis label item belongs. + * Value: An ASPxClientAxisBase descendant, which identifies the axis. + */ + axis: ASPxClientAxisBase; + /** + * Gets the text of an axis label item. + * Value: A string object which contains the axis label item's text. + */ + text: string; + /** + * Gets the axis value to which an axis label item corresponds. + * Value: An object that specifies the axis value. + */ + axisValue: Object; + /** + * Gets the internal representation of the axis value to which an axis label item corresponds. + * Value: A Double value which specifies the internal representation of the axis value. + */ + axisValueInternal: number; +} +/** + * Represents the client-side equivalent of the AxisRange class. + */ +interface ASPxClientAxisRange extends ASPxClientWebChartRequiredElement { + /** + * Gets the axis that owns the current axis range object. + * Value: An ASPxClientAxisBase object, to which the axis range belongs. + */ + axis: ASPxClientAxisBase; + /** + * Gets the minimum value to display on an axis. + * Value: An object representing the minimum value of the axis range. + */ + minValue: Object; + /** + * Gets the maximum value to display on an axis. + * Value: An object representing the maximum value of the axis range. + */ + maxValue: Object; + /** + * Gets the internal float representation of the range minimum value. + * Value: A Double value which specifies the internal representation of the range minimum value. + */ + minValueInternal: number; + /** + * Gets the internal float representation of the range maximum value. + * Value: A Double value which specifies the internal representation of the range maximum value. + */ + maxValueInternal: number; +} +/** + * Represents the client-side equivalent of the Strip class. + */ +interface ASPxClientStrip extends ASPxClientWebChartElementNamed { + /** + * Gets the axis that owns the current strip object. + * Value: An ASPxClientAxis object, to which the strip belongs. + */ + axis: ASPxClientAxis; + /** + * Gets the minimum value of the strip's range. + * Value: An object that represents the minimum value of the strip's range. + */ + minValue: Object; + /** + * Gets the maximum value of the strip's range. + * Value: An object that represents the maximum value of the strip's range. + */ + maxValue: Object; +} +/** + * Represents the client-side equivalent of the ConstantLine class. + */ +interface ASPxClientConstantLine extends ASPxClientWebChartElementNamed { + /** + * Gets the axis that owns the current constant line object. + * Value: An ASPxClientAxis object, to which the constant line belongs. + */ + axis: ASPxClientAxis; + /** + * Gets the constant line's position along the axis. + * Value: An object that specifies the constant line's position. + */ + value: Object; + /** + * Gets the constant line title. + * Value: A string object, representing the title's text. + */ + title: string; +} +/** + * Represents the client-side equivalent of the Series class. + */ +interface ASPxClientSeries extends ASPxClientWebChartElementNamed { + /** + * Gets a value that specifies the view type of the series. + * Value: A string object which contains the current view type. + */ + viewType: string; + /** + * Gets a value that specifies the scale type for the argument data of the series' data points. + * Value: A string object which contains the current scale type. + */ + argumentScaleType: string; + /** + * Gets a value that specifies the scale type for the value data of the series' data points. + * Value: A string object which contains the current scale type. + */ + valueScaleType: string; + /** + * Gets the X-Axis that is used to plot the current series on the XY-diagram. + * Value: A string object, which represents the X-axis name. + */ + axisX: string; + /** + * Gets the Y-Axis that is used to plot the current series on the XY-diagram. + * Value: A string object, which represents the Y-axis name. + */ + axisY: string; + /** + * Gets the pane that is used to plot the current series on the XY-diagram. + * Value: A string object, which represents the pane's name. + */ + pane: string; + /** + * Gets a value indicating whether the series is visible. + * Value: true if the series is visible; otherwise, false. + */ + visible: boolean; + /** + * Gets a value that specifies whether or not a tooltip is enabled for a chart. + * Value: true - a tooltip is enabled for a chart; false - a tooltip is disabled. + */ + toolTipEnabled: boolean; + /** + * Gets the text to be displayed within series tooltips. + * Value: A string value. + */ + toolTipText: string; + /** + * Gets an image to be displayed within series tooltips. + * Value: A string value. + */ + toolTipImage: string; + /** + * Gets the settings of series labels. + * Value: An ASPxClientSeriesLabel object, which provides the series label settings. + */ + label: ASPxClientSeriesLabel; + /** + * Gets the series' collection of data points. + * Value: An array of ASPxClientSeriesPoint objects, that represent the series' data points. + */ + points: ASPxClientSeriesPoint[]; + /** + * Provides access to the collection of series titles. + * Value: An array of ASPxClientSeriesTitle objects, that represent the collection of series titles. + */ + titles: ASPxClientSeriesTitle[]; + /** + * Gets the series' collection of indicators. + * Value: An array of ASPxClientIndicator objects, that belong to the series. + */ + indicators: ASPxClientIndicator[]; + /** + * Provides access to the collection of regression lines. + * Value: An array of ASPxClientRegressionLine objects which represent regression lines available for the series. + */ + regressionLines: ASPxClientRegressionLine[]; + /** + * Provides access to the collection of trendlines. + * Value: An array of ASPxClientTrendLine objects, that represent the collection of trendlines. + */ + trendLines: ASPxClientTrendLine[]; + /** + * Provides access to the collection of Fibonacci Indicators. + * Value: An array of ASPxClientFibonacciIndicator objects, that represent the collection of Fibonacci Indicators. + */ + fibonacciIndicators: ASPxClientFibonacciIndicator[]; + /** + * Gets the color of a series. + * Value: A string value. + */ + color: string; + /** + * Gets a value that defines a group for stacked series. + * Value: A string value. + */ + stackedGroup: string; + /** + * Gets a string which represents the pattern specifying the text to be displayed within a crosshair label for the current Series type. + * Value: A Empty. + */ + crosshairLabelPattern: string; + /** + * This property is intended for internal use only. + * Value: A String value. + */ + groupedElementsPattern: string; + /** + * Returns a collection of crosshair value items. + * Value: An array of ASPxClientCrosshairValueItem objects. + */ + crosshairValueItems: ASPxClientCrosshairValueItem[]; + /** + * Gets a value indicating whether a crosshair cursor is enabled. + * Value: true if a crosshair cursor is enabled; otherwise, false. + */ + actualCrosshairEnabled: boolean; + /** + * Gets a value indicating whether a crosshair label should be shown for this series. + * Value: true if crosshair labels are visible; otherwise, false. + */ + actualCrosshairLabelVisibility: boolean; +} +/** + * Represents the client-side equivalent of the SeriesLabelBase class. + */ +interface ASPxClientSeriesLabel extends ASPxClientWebChartElement { + /** + * Gets the series that owns the current series label object. + * Value: An ASPxClientSeries object, to which the series label belongs. + */ + series: ASPxClientSeries; + /** + * Gets the common text for all series point labels. + * Value: Returns an empty string object. + */ + text: string; +} +/** + * Represents the client-side equivalent of the SeriesPoint class. + */ +interface ASPxClientSeriesPoint extends ASPxClientWebChartRequiredElement { + /** + * Gets the series that owns the current series point object. + * Value: An ASPxClientSeries object, to which the series point belongs. + */ + series: ASPxClientSeries; + /** + * Gets the data point's argument. + * Value: An object that specifies the data point's argument. + */ + argument: Object; + /** + * Gets the point's data value(s). + * Value: An array of objects that represent the data value(s) of the series data point. + */ + values: Object[]; + /** + * Gets the text to be displayed within series points tooltips. + * Value: A string value. + */ + toolTipText: string; + /** + * Gets the color of a series point. + * Value: A string value. + */ + color: string; + /** + * Gets the percent value of a series point. + * Value: A float value. + */ + percentValue: number; + /** + * Gets a hint that is shown in series points tooltips. + * Value: A string value. + */ + toolTipHint: string; +} +/** + * Represents the client-side equivalent of the Legend class. + */ +interface ASPxClientLegend extends ASPxClientWebChartEmptyElement { + /** + * Returns a value which determines whether to use checkboxes instead of markers on a chart legend for all legend items. + * Value: true, if legend checkboxes are shown instead of markers for all legend items; otherwise, false. + */ + useCheckBoxes: boolean; + /** + * Returns a collection of custom legend items of the legend. + * Value: A collection of ASPxClientCustomLegendItem objects. + */ + customItems: ASPxClientCustomLegendItem[]; + /** + * Returns the name of the legend. + * Value: The string value representing the name of the legend. + */ + name: string; +} +/** + * Represents the base for ASPxClientSeriesTitle classes. + */ +interface ASPxClientTitleBase extends ASPxClientWebChartRequiredElement { + /** + * Gets the lines of text within a title. + * Value: An array of string values containing the text of a title. + */ + lines: string[]; + /** + * Gets the alignment of the title. + * Value: A string value containing the text, which specifies the alignment of a title. + */ + alignment: string; + /** + * Gets a value that specifies to which edges of a parent element the title should be docked. + * Value: A string value. + */ + dock: string; +} +/** + * Represents the client-side equivalent of the ChartTitle class. + */ +interface ASPxClientChartTitle extends ASPxClientTitleBase { +} +/** + * Represents the client-side equivalent of the SeriesTitle class. + */ +interface ASPxClientSeriesTitle extends ASPxClientTitleBase { + /** + * Gets the series that owns the current title object. + * Value: An ASPxClientSeries object, to which the series title belongs. + */ + series: ASPxClientSeries; +} +/** + * Represents the client-side equivalent of the Indicator class. + */ +interface ASPxClientIndicator extends ASPxClientWebChartElementNamed { + /** + * Gets the indicator's associated series. + * Value: An ASPxClientSeries object. + */ + series: ASPxClientSeries; +} +/** + * Represents the client-side equivalent of the FinancialIndicator class. + */ +interface ASPxClientFinancialIndicator extends ASPxClientIndicator { + /** + * Gets the first point of the financial indicator. + * Value: An ASPxClientFinancialIndicatorPoint object, which represents a financial indicator's first point. + */ + point1: ASPxClientFinancialIndicatorPoint; + /** + * Gets the second point of the financial indicator. + * Value: An ASPxClientFinancialIndicatorPoint object, which represents a financial indicator's second point. + */ + point2: ASPxClientFinancialIndicatorPoint; +} +/** + * Represents the client-side equivalent of the TrendLine class. + */ +interface ASPxClientTrendLine extends ASPxClientFinancialIndicator { +} +/** + * Represents the client-side equivalent of the FibonacciIndicator class. + */ +interface ASPxClientFibonacciIndicator extends ASPxClientFinancialIndicator { +} +/** + * Represents the client-side equivalent of the FinancialIndicatorPoint class. + */ +interface ASPxClientFinancialIndicatorPoint extends ASPxClientWebChartRequiredElement { + /** + * Gets the financial indicator that owns the current financial indicator point. + * Value: An ASPxClientFinancialIndicator object, to which the point belongs. + */ + financialIndicator: ASPxClientFinancialIndicator; + /** + * Gets the argument of the financial indicator's point. + * Value: An object that specifies the point argument. + */ + argument: Object; + /** + * Gets a value, indicating how the value of a financial indicator's point is obtained. + * Value: A string value, which indicates how to obtain a financial indicator point's value. + */ + valueLevel: string; +} +/** + * The client-side equivalent of the SingleLevelIndicator class. + */ +interface ASPxClientSingleLevelIndicator extends ASPxClientIndicator { + /** + * Gets a value specifying the value level to which the single-level indicator corresponds. + * Value: A string value. + */ + valueLevel: string; +} +/** + * Represents the client-side equivalent of the RegressionLine class. + */ +interface ASPxClientRegressionLine extends ASPxClientSingleLevelIndicator { +} +/** + * The client-side equivalent of the MovingAverage class. + */ +interface ASPxClientMovingAverage extends ASPxClientSingleLevelIndicator { + /** + * Gets the number of data points used to calculate the moving average. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; + /** + * Gets a value specifying whether to display a Moving Average, Envelope, or both. + * Value: A string value. + */ + kind: string; + /** + * Gets a value specifying the Envelope percent. + * Value: A double value which specifies the Envelope percent. + */ + envelopePercent: number; +} +/** + * The client-side equivalent of the SimpleMovingAverage class. + */ +interface ASPxClientSimpleMovingAverage extends ASPxClientMovingAverage { +} +/** + * The client-side equivalent of the ExponentialMovingAverage class. + */ +interface ASPxClientExponentialMovingAverage extends ASPxClientMovingAverage { +} +/** + * The client-side equivalent of the WeightedMovingAverage class. + */ +interface ASPxClientWeightedMovingAverage extends ASPxClientMovingAverage { +} +/** + * The client-side equivalent of the TriangularMovingAverage class. + */ +interface ASPxClientTriangularMovingAverage extends ASPxClientMovingAverage { +} +/** + * Represents the client-side equivalent of the TripleExponentialMovingAverageTema class. + */ +interface ASPxClientTripleExponentialMovingAverageTema extends ASPxClientMovingAverage { +} +/** + * Represents the client-side equivalent of the BollingerBands class. + */ +interface ASPxClientBollingerBands extends ASPxClientIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; + /** + * Gets a value, indicating whose series point values are used to calculate the indicator's values. + * Value: A string value, which indicates which series point value should be used to calculate indicator values. + */ + valueLevel: string; +} +/** + * Represents the client-side equivalent of the MedianPrice class. + */ +interface ASPxClientMedianPrice extends ASPxClientIndicator { +} +/** + * Represents the client-side equivalent of the TypicalPrice class. + */ +interface ASPxClientTypicalPrice extends ASPxClientIndicator { +} +/** + * Represents the client-side equivalent of the WeightedClose class. + */ +interface ASPxClientWeightedClose extends ASPxClientIndicator { +} +/** + * Represents the client-side equivalent of the SeparatePaneIndicator class. + */ +interface ASPxSeparatePaneIndicator extends ASPxClientIndicator { + /** + * Returns the name of the Y-axis that is used to plot the current indicator on a ASPxClientXYDiagram. + * Value: A string value specifying the Y-axis name. + */ + axisY: string; + /** + * Returns the name of a pane, used to plot the separate pane indicator on an XYDiagram. + * Value: A string that is the name of a pane. + */ + pane: string; +} +/** + * Represents the client-side equivalent of the AverageTrueRange class. + */ +interface ASPxClientAverageTrueRange extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; +} +/** + * Represents the client-side equivalent of the ChaikinsVolatility class. + */ +interface ASPxClientChaikinsVolatility extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; +} +/** + * Represents the client-side equivalent of the CommodityChannelIndex class. + */ +interface ASPxClientCommodityChannelIndex extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; +} +/** + * Represents the client-side equivalent of the DetrendedPriceOscillator class. + */ +interface ASPxClientDetrendedPriceOscillator extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; + /** + * Gets a value, indicating whose series point values are used to calculate the indicator's values. + * Value: A string value, which indicates which series point value should be used to calculate indicator values. + */ + valueLevel: string; +} +/** + * Represents the client-side equivalent of the MassIndex class. + */ +interface ASPxClientMassIndex extends ASPxSeparatePaneIndicator { + /** + * Returns the count of points used to calculate the exponential moving average (EMA). + * Value: An integer value, specifying the count of points used to calculate EMA. + */ + movingAveragePointsCount: number; + /** + * Returns the count of summable values. + * Value: An integer value specifying the count of summable ratios. + */ + sumPointsCount: number; +} +/** + * Represents the client-side equivalent of the MovingAverageConvergenceDivergence class. + */ +interface ASPxClientMovingAverageConvergenceDivergence extends ASPxSeparatePaneIndicator { + /** + * Returns the short period value required to calculate the indicator. + * Value: An integer value specifying the short period value. + */ + shortPeriod: number; + /** + * Returns the long period value required to calculate the indicator. + * Value: An integer value specifying the long period. + */ + longPeriod: number; + /** + * Returns the smoothing period value required to calculate the indicator. + * Value: An integer value specifying the smoothing period value. + */ + signalSmoothingPeriod: number; +} +/** + * Represents the client-side equivalent of the RateOfChange class. + */ +interface ASPxClientRateOfChange extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; + /** + * Gets a value, indicating whose series point values are used to calculate the indicator's values. + * Value: A string value, which indicates which series point value should be used to calculate indicator values. + */ + valueLevel: string; +} +/** + * Represents the client-side equivalent of the RelativeStrengthIndex class. + */ +interface ASPxClientRelativeStrengthIndex extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; + /** + * Gets a value, indicating whose series point values are used to calculate the indicator's values. + * Value: A string value, which indicates which series point value should be used to calculate indicator values. + */ + valueLevel: string; +} +/** + * Represents the client-side equivalent of the StandardDeviation class. + */ +interface ASPxClientStandardDeviation extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; + /** + * Gets a value, indicating whose series point values are used to calculate the indicator's values. + * Value: A string value, which indicates which series point value should be used to calculate indicator values. + */ + valueLevel: string; +} +/** + * Represents the client-side equivalent of the TripleExponentialMovingAverageTrix class. + */ +interface ASPxClientTripleExponentialMovingAverageTrix extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; + /** + * Gets a value, indicating whose series point values are used to calculate the indicator's values. + * Value: A string value, which indicates which series point value should be used to calculate indicator values. + */ + valueLevel: string; +} +/** + * Represents the client-side equivalent of the WilliamsR class. + */ +interface ASPxClientWilliamsR extends ASPxSeparatePaneIndicator { + /** + * Gets the number of data points used to calculate the indicator values. + * Value: An integer value, specifying the number of points. + */ + pointsCount: number; +} +/** + * Represents the client-side equivalent of the FixedValueErrorBars class. + */ +interface ASPxClientFixedValueErrorBars extends ASPxClientIndicator { + /** + * Gets or sets the fixed positive error value. + * Value: A double value specifying the positive error value. + */ + positiveError: number; + /** + * Returns the fixed negative error value. + * Value: A double value specifying the negative error value. + */ + negativeError: number; +} +/** + * Represents the client-side equivalent of the PercentageErrorBars class. + */ +interface ASPxClientPercentageErrorBars extends ASPxClientIndicator { + /** + * Returns the value specifying the percentage of error values of series point values. + * Value: A double value specifying the percentage. Values less than or equal to 0 are not allowed. + */ + percent: number; +} +/** + * Represents the client-side equivalent of the StandardDeviationErrorBars class. + */ +interface ASPxClientStandardDeviationErrorBars extends ASPxClientIndicator { + /** + * Returns the multiplier on which the standard deviation value is multiplied before display. + * Value: A double value specifying the multiplier. Values less than 0 are not allowed. + */ + multiplier: number; +} +/** + * Represents the client-side equivalent of the StandardErrorBars class. + */ +interface ASPxClientStandardErrorBars extends ASPxClientIndicator { +} +/** + * Represents the client-side equivalent of the DataSourceBasedErrorBars class. + */ +interface ASPxClientDataSourceBasedErrorBars extends ASPxClientIndicator { +} +/** + * Represents the client-side equivalent of the Annotation class. + */ +interface ASPxClientAnnotation extends ASPxClientWebChartElementNamed { +} +/** + * Represents the client-side equivalent of the TextAnnotation class. + */ +interface ASPxClientTextAnnotation extends ASPxClientAnnotation { + /** + * Gets the lines of text within an annotation. + * Value: An array of string values containing the text of a title. + */ + lines: string[]; +} +/** + * Represents the client-side equivalent of the ImageAnnotation class. + */ +interface ASPxClientImageAnnotation extends ASPxClientAnnotation { +} +/** + * The client-side equivalent of the CrosshairValueItem class. + */ +interface ASPxClientCrosshairValueItem { + /** + * Gets the value that is displayed in a crosshair label. + * Value: A float value. + */ + value: number; + /** + * Gets an index of a point for which this crosshair value item is displayed. + * Value: An integer value. + */ + pointIndex: number; +} +/** + * The client-side equivalent of the ChartToolTipController class. + */ +interface ASPxClientToolTipController extends ASPxClientWebChartEmptyElement { + /** + * Gets a value indicating whether an image should be shown in tooltips. + * Value: true to show an image in tooltips; otherwise, false. + */ + showImage: boolean; + /** + * Gets a value indicating whether it is necessary to show text in tooltips. + * Value: true to show text in tooltips; otherwise, false. + */ + showText: boolean; + /** + * Gets a value that defines the position of an image within a tooltip. + * Value: A string value. + */ + imagePosition: string; + /** + * Gets a value that defines when tooltips should be invoked. + * Value: A string value. + */ + openMode: string; +} +/** + * The client-side equivalent of the ToolTipPosition class. + */ +interface ASPxClientToolTipPosition { +} +/** + * The client-side equivalent of the ToolTipRelativePosition class. + */ +interface ASPxClientToolTipRelativePosition extends ASPxClientToolTipPosition { + /** + * Gets the horizontal offset of a tooltip. + * Value: An integer value. + */ + offsetX: number; + /** + * Gets the vertical offset of a tooltip. + * Value: An integer value. + */ + offsetY: number; +} +/** + * The client-side equivalent of the ToolTipFreePosition class. + */ +interface ASPxClientToolTipFreePosition extends ASPxClientToolTipPosition { + /** + * Gets the horizontal offset of a tooltip. + * Value: An integer value. + */ + offsetX: number; + /** + * Gets the vertical offset of a tooltip. + * Value: An integer value. + */ + offsetY: number; + /** + * Gets the ID of a pane. + * Value: An integer value. + */ + paneID: number; + /** + * Gets an object containing settings that define how a tooltip should be docked. + * Value: A string value. + */ + dockPosition: string; +} +/** + * The client-side equivalent of the CrosshairLabelPosition class. + */ +interface ASPxClientCrosshairPosition { + /** + * Gets the horizontal offset of a crosshair cursor. + * Value: An integer value that is the X-offset. + */ + offsetX: number; + /** + * Gets the vertical offset of a crosshair cursor. + * Value: An integer value that is the Y-offset. + */ + offsetY: number; +} +/** + * The client-side equivalent of the CrosshairMousePosition class. + */ +interface ASPxClientCrosshairMousePosition extends ASPxClientCrosshairPosition { +} +/** + * The client-side equivalent of the CrosshairFreePosition class. + */ +interface ASPxClientCrosshairFreePosition extends ASPxClientCrosshairPosition { + /** + * Gets a Pane's ID when the crosshair cursor is in the free position mode. + * Value: An integer value that is the pane's ID. + */ + paneID: number; + /** + * Gets a string containing information on a crosshair label's dock position when the crosshair cursor is in the free position mode. + * Value: A string value containing information on a crosshair label's dock position. + */ + dockPosition: string; +} +/** + * Defines line style settings. + */ +interface ASPxClientLineStyle extends ASPxClientWebChartElement { + /** + * Gets the dash style used to paint the line. + * Value: A string value that contains information about the style used to paint the line. + */ + dashStyle: string; + /** + * Gets the thickness that corresponds to the value of the current ASPxClientLineStyle object. + * Value: An integer value which specifies the thickness, in pixels. + */ + thickness: number; + /** + * Returns the join style for the ends of consecutive lines. + * Value: A string representing the name of the line join type. + */ + lineJoin: string; +} +/** + * The client-side equivalent of the CrosshairOptions class. + */ +interface ASPxClientCrosshairOptions extends ASPxClientWebChartEmptyElement { + /** + * Gets a value indicating whether it is necessary to show a crosshair label for the X-axis. + * Value: true to show a crosshair label for the X-axis; otherwise, false. + */ + showAxisXLabels: boolean; + /** + * Gets a value indicating whether it is necessary to show a crosshair label for the Y-axis. + * Value: true to show the crosshair label for the Y-axis; otherwise, false. + */ + showAxisYLabels: boolean; + /** + * Gets a value that defines whether a crosshair label of a series point indicated by a crosshair cursor is shown on a diagram. + * Value: true if a crosshair label indicated by a crosshair cursor is shown on a diagram; otherwise, false. + */ + showCrosshairLabels: boolean; + /** + * Gets a value that indicates whether a crosshair cursor argument line is shown for a series point on a diagram. + * Value: true if a crosshair cursor argument line is displayed on a diagram; otherwise, false. + */ + showArgumentLine: boolean; + /** + * Specifies whether to show a value line of a series point indicated by a crosshair cursor on a diagram. + * Value: true to display a value line indicated by a crosshair cursor on a diagram; otherwise, false. + */ + showValueLine: boolean; + /** + * Gets a value that specifies whether to show a crosshair cursor in a focused pane only. + * Value: true to display a crosshair cursor in a focused pane; otherwise, false. + */ + showOnlyInFocusedPane: boolean; + /** + * Specifies the current snap mode of a crosshair cursor. + * Value: A string value. + */ + snapMode: string; + /** + * Specifies the way in which the crosshair label is shown for a series on a diagram. + * Value: A string value that specifies how the crosshair label is shown for a series. + */ + crosshairLabelMode: string; + /** + * Gets a value that indicates whether to show a header for each series group in crosshair cursor labels. + * Value: true, to show a group header in crosshair cursor labels; otherwise, false. + */ + showGroupHeaders: boolean; + /** + * Gets a string which represents the pattern specifying the group header text to be displayed within the crosshair label. + * Value: A String, which represents the group header's pattern. + */ + groupHeaderPattern: string; + /** + * Gets a value that specifies whether the Crosshair cursor should show points that are out of visual range. + * Value: true if the out of visual range points should be shown in the Crosshair label; otherwise false. + */ + showOutOfRangePoints: boolean; + /** + * Gets the identifier specifying the behavior of the selection of points shown in the crosshair label. + * Value: The selection behavior identifier. + */ + valueSelectionMode: string; + /** + * Gets the color of a crosshair argument line. + * Value: A String value, specifying the color of a crosshair argument line. + */ + argumentLineColor: string; + /** + * Gets the color of a crosshair value line. + * Value: A String value, specifying the color of a crosshair value line. + */ + valueLineColor: string; +} +/** + * The chart print options storage. + */ +interface ASPxClientChartPrintOptions { + /** + * Gets the size mode used to print a chart. + */ + GetSizeMode(): string; + /** + * Sets the size mode used to print a chart. + * @param sizeMode A System.String object, specifying the name of the size mode. + */ + SetSizeMode(sizeMode: string): void; + /** + * Gets a value indicating that the landscape orientation will be used to print a chart. + */ + GetLandscape(): boolean; + /** + * Sets a value indicating that the landscape orientation will be used to print a chart. + * @param landscape A Boolean value, specifying that the landscape orientation will be used to print a chart. + */ + SetLandscape(landscape: boolean): void; + /** + * Gets the left margin which will be used to print a chart. + */ + GetMarginLeft(): number; + /** + * Sets the left margin which will be used to print a chart. + * @param marginLeft A System.Int32 value, specifying the margin in hundredths of an inch. + */ + SetMarginLeft(marginLeft: number): void; + /** + * Gets the top margin which will be used to print a chart. + */ + GetMarginTop(): number; + /** + * Sets the top margin which will be used to print a chart. + * @param marginTop A System.Int32 value, specifying the margin in hundredths of an inch. + */ + SetMarginTop(marginTop: number): void; + /** + * Gets the right margin which will be used to print a chart. + */ + GetMarginRight(): number; + /** + * Sets the right margin which will be used to print a chart. + * @param marginRight A System.Int32 value, specifying the margin in hundredths of an inch. + */ + SetMarginRight(marginRight: number): void; + /** + * Gets the bottom margin which will be used to print a chart. + */ + GetMarginBottom(): number; + /** + * Sets the bottom margin which will be used to print a chart. + * @param marginBottom A System.Int32 value, specifying the margin in hundredths of an inch. + */ + SetMarginBottom(marginBottom: number): void; + /** + * Gets the predefined size ratio of the paper which will be used to print a chart. + */ + GetPaperKind(): string; + /** + * Sets the predefined size ratio of the paper which will be used to print a chart. + * @param paperKind A System.String object, specifying the name of a size ratio. + */ + SetPaperKind(paperKind: string): void; + /** + * Gets the custom paper width which will be used to print a chart. + */ + GetCustomPaperWidth(): number; + /** + * Sets the custom paper width which will be used to print a chart. + * @param customPaperWidth A System.Int32 object, specifying the width in hundredths of an inch. + */ + SetCustomPaperWidth(customPaperWidth: number): void; + /** + * Gets the custom paper height which will be used to print a chart. + */ + GetCustomPaperHeight(): number; + /** + * Sets the custom paper height which will be used to print a chart. + * @param customPaperHeight A System.Int32 object, specifying the height in hundredths of an inch. + */ + SetCustomPaperHeight(customPaperHeight: number): void; + /** + * Gets the name of the custom paper width-height ratio used to print the chart. + */ + GetCustomPaperName(): string; + /** + * Sets the name of the custom paper width-height ratio used to print a chart. + * @param customPaperName A String object, specifying the name of the custom paper width-height ratio. + */ + SetCustomPaperName(customPaperName: string): void; +} +/** + * Represents the client-side equivalent of the CustomLegendItem class. + */ +interface ASPxClientCustomLegendItem extends ASPxClientWebChartElementNamed { + /** + * Returns the text displayed by the custom legend item. + * Value: A string value that specifies legend item text. + */ + text: string; +} +/** + * The client-side equivalent of the ASPxDocumentViewer control. + */ +interface ASPxClientDocumentViewer extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientDocumentViewer. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs when the value of an item within the Document Viewer's report toolbar is changed. + */ + ToolbarItemValueChanged: ASPxClientEvent>; + /** + * Occurs when an item within the Document Viewer's report toolbar is clicked. + */ + ToolbarItemClick: ASPxClientEvent>; + /** + * Occurs on the client side when a report page is loaded into this ASPxClientDocumentViewer instance. + */ + PageLoad: ASPxClientEvent>; + /** + * Provides access to the Splitter of the ASPxClientDocumentViewer. + */ + GetSplitter(): ASPxClientSplitter; + /** + * Provides access to the ASPxClientDocumentViewer's preview that exposes methods to print and export the document. + */ + GetViewer(): ASPxClientReportViewer; + /** + * Provides access to the Document Viewer toolbar on the client. + */ + GetToolbar(): ASPxClientReportToolbar; + /** + * Provides access to the Ribbon of the ASPxClientDocumentViewer. + */ + GetRibbonToolbar(): ASPxClientRibbon; + /** + * Provides access to the parameters panel of the ASPxClientDocumentViewer. + */ + GetParametersPanel(): ASPxClientReportParametersPanel; + /** + * Provides access to the document of the ASPxClientDocumentViewer. + */ + GetDocumentMap(): ASPxClientReportDocumentMap; + /** + * Sets focus on the report control specified by its bookmark. + * @param pageIndex An integer value, specifying the page index. + * @param bookmarkPath A String value, specifying the path to the bookmark. + */ + GotoBookmark(pageIndex: number, bookmarkPath: string): void; + /** + * Initiates a round trip to the server so that the current page will be reloaded. + */ + Refresh(): void; + /** + * Prints the current document. + */ + Print(): void; + /** + * Prints the document's page with the specified page index. + * @param pageIndex A Int32 representing the index of the page to be printed. + */ + Print(pageIndex: number): void; + /** + * Displays the specified report page. + * @param pageIndex An integer value, identifying the report page. + */ + GotoPage(pageIndex: number): void; + /** + * Invokes the Search dialog, which allows end-users to search for specific text in a report. + */ + Search(): void; + /** + * Gets a value indicating whether or not searching text across a report is permitted in the web browser. + */ + IsSearchAllowed(): boolean; + /** + * Exports a report to a file of the specified format, and shows it in a new Web Browser window. + * @param format A string specifying the format to which a report should be exported. + */ + SaveToWindow(format: string): void; + /** + * Exports a report to a file of the specified format, and saves it to the disk. + * @param format A string specifying the format to which a report should be exported. + */ + SaveToDisk(format: string): void; +} +/** + * A method that will handle the ItemValueChanged event. + */ +interface ASPxClientToolbarItemValueChangedEventHandler { + /** + * A method that will handle the ToolbarItemValueChanged event. + * @param source A Object that is the event source. + * @param e An ASPxClientToolbarItemValueChangedEventArgs object, containing the event arguments. + */ + (source: S, e: ASPxClientToolbarItemValueChangedEventArgs): void; +} +/** + * Provides data for the ItemValueChanged event. + */ +interface ASPxClientToolbarItemValueChangedEventArgs extends ASPxClientProcessingModeEventArgs { + /** + * Gets the menu item object related to the event. + * Value: An ASPxClientMenuItem object, manipulations on which forced the event to be raised. + */ + item: ASPxClientMenuItem; + /** + * Provides access to the toolbar's value editor on the client. + * Value: An ASPxClientControl descendant. + */ + editor: ASPxClientControl; +} +/** + * The client-side equivalent of the ASPxQueryBuilder control. + */ +interface ASPxClientQueryBuilder extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientQueryBuilder. + */ + CallbackError: ASPxClientEvent>; + /** + * Enables you to customize the menu actions of a Query Builder. + */ + CustomizeToolbarActions: ASPxClientEvent>; + /** + * Occurs when executing the Save command on the client. + */ + SaveCommandExecute: ASPxClientEvent>; + /** + * Sends a callback to the server with the specified argument. + * @param arg A String value, specifying the callback argument. + */ + PerformCallback(arg: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; + /** + * Updates the localization settings of the ASPxClientQueryBuilder properties. + * @param localization A dictionary containing the property names, along with their localized equivalents. + */ + UpdateLocalization(localization: { [key: string]: string; }): void; + /** + * Returns the object model of a Query Builder. + */ + GetDesignerModel(): Object; + /** + * Gets a client-side model of the currently opened query serialized to Json. + */ + GetJsonQueryModel(): string; + /** + * Saves the current query. + */ + Save(): void; + /** + * Invokes a Data Preview for the current query. + */ + ShowPreview(): void; + /** + * Specifies whether or not the current query is a valid SQL string. + */ + IsQueryValid(): boolean; +} +/** + * A method that will handle the SaveCommandExecute event. + */ +interface ASPxClientQueryBuilderSaveCommandExecuteEventHandler { + /** + * A method that will handle the SaveCommandExecute event. + * @param source The event sender. + * @param e An ASPxClientQueryBuilderSaveCommandExecuteEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientQueryBuilderSaveCommandExecuteEventArgs): void; +} +/** + * Provides data for the SaveCommandExecute event. + */ +interface ASPxClientQueryBuilderSaveCommandExecuteEventArgs extends ASPxClientEventArgs { + /** + * Specifies whether or not the event was handled. + * Value: true if the event was handled and default processing should not occur; false if the event should be handled using default processing. + */ + handled: boolean; +} +/** + * A method that will handle the CustomizeToolbarActions event. + */ +interface ASPxClientQueryBuilderCustomizeToolbarActionsEventHandler { + /** + * + * @param source + * @param e + */ + (source: S, e: ASPxClientCustomizeMenuActionsEventArgs): void; +} +/** + * The client-side equivalent of the Web Report Designer control. + */ +interface ASPxClientReportDesigner extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientReportDesigner. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs when executing the Save command on the client. + */ + SaveCommandExecute: ASPxClientEvent>; + /** + * Enables you to customize the menu actions of a Web Report Designer. + */ + CustomizeMenuActions: ASPxClientEvent>; + /** + * 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. + */ + ExitDesigner: ASPxClientEvent>; + /** + * Sends a callback to the server with the specified argument. + * @param arg A String value, specifying the callback argument. + */ + PerformCallback(arg: string): void; + /** + * Sends a callback to the server and generates the server-side event, passing it the specified argument. + * @param arg A string value that represents any information that needs to be sent to the server-side event. + * @param onSuccess A client action to perform if the server round-trip completed successfully. + */ + PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; + /** + * Updates the localization settings of the ASPxClientReportDesigner properties. + * @param localization A dictionary containing the property names, along with their localized equivalents. + */ + UpdateLocalization(localization: { [key: string]: string; }): void; + /** + * Returns the object model of a Web Report Designer. + */ + GetDesignerModel(): Object; + /** + * Gets a client-side model of the currently opened report serialized to Json. + */ + GetJsonReportModel(): string; + /** + * Returns serialization information for the specific property of the specific control type. + * @param controlType A string that identifies the name of the control type for which serialization information is to be returned. + * @param propertyDisplayName A string that identifies the name of the property for which serialization information is to be returned. + */ + GetPropertyInfo(controlType: string, propertyDisplayName: string): ASPxDesignerElementSerializationInfo; + /** + * Indicates whether or not the current ASPxClientReportDesigner instance has been modified. + */ + IsModified(): boolean; + /** + * Resets the value returned by the IsModified method. + */ + ResetIsModified(): void; +} +/** + * A method that will handle the SaveCommandExecute event. + */ +interface ASPxClientReportDesignerSaveCommandExecuteEventHandler { + /** + * A method that will handle the SaveCommandExecute event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerSaveCommandExecuteEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerSaveCommandExecuteEventArgs): void; +} +/** + * Provides data for the SaveCommandExecute event. + */ +interface ASPxClientReportDesignerSaveCommandExecuteEventArgs extends ASPxClientEventArgs { + /** + * Specifies whether or not the event was handled. + * Value: true if the event was handled and default processing should not occur; false if the event should be handled using default processing. + */ + handled: boolean; +} +/** + * A method that will handle the CustomizeMenuActions event. + */ +interface ASPxClientReportDesignerCustomizeMenuActionsEventHandler { + /** + * + * @param source + * @param e + */ + (source: S, e: ASPxClientCustomizeMenuActionsEventArgs): void; +} +/** + * Provides data for the ExitDesigner event. + */ +interface ASPxClientReportDesignerExitDesignerEventArgs extends ASPxClientEventArgs { +} +/** + * A method that will handle the CustomizeParameterLookUpSource event. + */ +interface ASPxClientReportDesignerCustomizeParameterLookUpSourceEventHandler { + /** + * A method that will handle the CustomizeParameterLookUpSource event. + * @param source The event sender. + * @param e An ASPxClientCustomizeParameterLookUpSourceEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientCustomizeParameterLookUpSourceEventArgs): void; +} +/** + * A method that will handle the CustomizeParameterEditors event. + */ +interface ASPxClientReportDesignerCustomizeParameterEditorsEventHandler { + /** + * A method that will handle the CustomizeParameterEditors event. + * @param source The event sender. + * @param e An ASPxClientCustomizeParameterEditorsEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientCustomizeParameterEditorsEventArgs): void; +} +/** + * A method that will handle the ExitDesigner event. + */ +interface ASPxClientReportDesignerExitDesignerEventHandler { + /** + * A method that will handle the ExitDesigner event. + * @param source The event sender. + * @param e An ASPxClientReportDesignerExitDesignerEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportDesignerExitDesignerEventArgs): void; +} +/** + * The client-side equivalent of the ASPxClientDocumentViewer control's Document Map. + */ +interface ASPxClientReportDocumentMap extends ASPxClientControl { + /** + * Occurs after the content of the Document Viewer's document map is updated. + */ + ContentChanged: ASPxClientEvent>; +} +/** + * The client-side equivalent of the ASPxClientDocumentViewer control's Parameters Panel. + */ +interface ASPxClientReportParametersPanel extends ASPxClientControl { + /** + * Assigns a value to a parameter of the report displayed in the document viewer. + * @param parametersInfo An array of ASPxClientReportParameterInfo values specifying parameters and values to assign. + */ + AssignParameters(parametersInfo: ASPxClientReportParameterInfo[]): void; + /** + * Assigns a value to a parameter of the report displayed in the document viewer. + * @param path A System.String specifying the parameter's path. + * @param value An object specifying the parameter value. + */ + AssignParameter(path: string, value: Object): void; + /** + * Returns an array storing the names of parameters available in a report. + */ + GetParameterNames(): string[]; + /** + * Returns a value editor that is associated with a parameter with the specified name. + * @param parameterName A String value, specifying the parameter name. + */ + GetEditorByParameterName(parameterName: string): ASPxClientControl; +} +/** + * Provides information about a report parameter on the client side. + */ +interface ASPxClientReportParameterInfo { + /** + * Specifies the parameter path, relative to its parent container (e.g., "subreport1.subreportParameter1" for a subreport's parameter, or "parameter1" for a report's parameter). + * Value: A String value, specifying the parameter path (e.g., "subreport1.subreportParameter1"). + */ + Path: string; + /** + * Provides access to a parameter value on the client. + * Value: A Object value. + */ + Value: Object; +} +/** + * The client-side equivalent of the ASPxClientDocumentViewer control's toolbar. + */ +interface ASPxClientReportToolbar extends ASPxClientControl { + /** + * Provides access to the control template assigned for the specified menu item. + * @param name A String value, specifying the menu item name. + */ + GetItemTemplateControl(name: string): ASPxClientControl; +} +/** + * The client-side equivalent of the ReportViewer. + */ +interface ASPxClientReportViewer extends ASPxClientControl { + /** + * Occurs when a callback for server-side processing is initiated. + */ + BeginCallback: ASPxClientEvent>; + /** + * Occurs on the client after a callback's server-side processing has been completed. + */ + EndCallback: ASPxClientEvent>; + /** + * Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientReportViewer. + */ + CallbackError: ASPxClientEvent>; + /** + * Occurs on the client side when another report page is loaded into this ASPxClientReportViewer instance. + */ + PageLoad: ASPxClientEvent>; + /** + * Submits the values of the specified parameters. + * @param parameters A dictionary containing the parameter names, along with their Object values. + */ + SubmitParameters(parameters: { [key: string]: Object; }): void; + /** + * Prints a report shown in the ReportViewer. + */ + Print(): void; + /** + * Prints a report page with the specified page index. + * @param pageIndex An integer value which specifies an index of the page to be printed. + */ + Print(pageIndex: number): void; + /** + * Displays a report page with the specified page index in the ReportViewer. + * @param pageIndex An integer value which specifies the index of a page to be displayed. + */ + GotoPage(pageIndex: number): void; + /** + * Initiates a round trip to the server so that the current page will be reloaded. + */ + Refresh(): void; + /** + * Invokes the Search dialog, which allows end-users to search for specific text in a report. + */ + Search(): void; + /** + * Exports a report to a file of the specified format, and shows it in a new Web Browser window. + * @param format A string specifying the format, to which a report should be exported. + */ + SaveToWindow(format: string): void; + /** + * Exports a report to a file of the specified format, and saves it to the disk. + * @param format A string specifying the format, to which a report should be exported. + */ + SaveToDisk(format: string): void; + /** + * Gets a value indicating whether or not searching text across a report is permitted in the web browser. + */ + IsSearchAllowed(): boolean; +} +/** + * A method that will handle the PageLoad events. + */ +interface ASPxClientReportViewerPageLoadEventHandler { + /** + * A method that will handle the PageLoad event. + * @param source The event sender. + * @param e An ASPxClientReportViewerPageLoadEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientReportViewerPageLoadEventArgs): void; +} +/** + * Provides data for the PageLoad events on the client side. + */ +interface ASPxClientReportViewerPageLoadEventArgs extends ASPxClientEventArgs { + /** + * Gets a value specifying a zero-based index of a page to be displayed in a report viewer. + * Returns: $ + */ + PageIndex: number; + /** + * Gets a value specifying the total number of pages displayed in a report viewer. + * Returns: $ + */ + PageCount: number; + /** + * Gets a value indicating whether a report page, which is currently loaded into the ASPxClientReportViewer, is the first page of a report. + */ + IsFirstPage(): boolean; + /** + * Gets a value indicating whether a report page, which is currently loaded into the ASPxClientReportViewer, is the last page of a report. + */ + IsLastPage(): boolean; +} +/** + * Provides data for the CustomizeParameterEditors events. + */ +interface ASPxClientCustomizeParameterEditorsEventArgs extends ASPxClientEventArgs { + /** + * Provides access to an object that stores information about a parameter. + * Value: An ASPxDesignerElementParameterDescriptor object. + */ + parameter: ASPxDesignerElementParameterDescriptor; + /** + * Provides access to an object that stores information required to serialize a parameter editor. + * Value: An ASPxDesignerElementSerializationInfo object. + */ + info: ASPxDesignerElementSerializationInfo; +} +/** + * Provides data for the CustomizeParameterLookUpSource events. + */ +interface ASPxClientCustomizeParameterLookUpSourceEventArgs extends ASPxClientEventArgs { + /** + * Provides access to an object that stores information about a parameter. + * Value: An ASPxDesignerElementParameterDescriptor object that stores information about the parameter. + */ + parameter: ASPxDesignerElementParameterDescriptor; + /** + * Provides access to the collection of look-up parameter values. + * Value: An array of ASPxDesignerElementEditorItem objects that store information about look-up parameter values. + */ + items: ASPxDesignerElementEditorItem[]; + /** + * Specifies the data source that provides look-up values for the parameter editor. + * Value: An Object specifying the data source that provides look-up values to the parameter editor. + */ + dataSource: Object; +} +interface ASPxClientCustomizeMenuActionsEventArgs extends ASPxClientEventArgs { + Actions: ASPxClientMenuAction[]; + GetById(actionId: string): ASPxClientMenuAction; +} +interface ASPxClientMenuAction { + text: string; + imageClassName: string; + clickAction: Function; + disabled: boolean; + visible: boolean; + hotKey: ASPxClientMenuActionHotKey; + hasSeparator: string; + container: string; +} +interface ASPxClientMenuActionHotKey { + keyCode: number; + ctrlKey: boolean; +} +/** + * Provides general information about a report parameter. + */ +interface ASPxDesignerElementParameterDescriptor { + /** + * Provides access to the parameter description. + * Value: A String value, specifying the parameter description. + */ + description: string; + /** + * Provides access to the parameter name. + * Value: A String value, specifying the parameter name. + */ + name: string; + /** + * Provides access to the parameter type. + * Value: A String value, specifying the parameter type. + */ + type: string; + /** + * Provides access to the parameter value. + * Value: A Object, specifying the parameter value. + */ + value: Object; + /** + * Provides access to the parameter visibility state. + * Value: true if the parameter is visible; otherwise false. + */ + visible: boolean; +} +/** + * Provides information required to serialize an element. + */ +interface ASPxDesignerElementSerializationInfo { + /** + * Gets the property name that will be used in the model to store the property value. + * Value: A String value. + */ + propertyName: string; + /** + * Gets the property name in the model that is displayed in the Property grid. + * Value: A String value. + */ + displayName: string; + /** + * Gets the property name that will be used during serialization to store the property value. + * Value: A String value. + */ + modelName: string; + /** + * Gets the default property value used for serialization. + * Value: A Object value. + */ + defaultVal: Object; + /** + * Gets the information about a complex object's content. + * Value: An array of ASPxDesignerElementSerializationInfo objects. + */ + info: ASPxDesignerElementSerializationInfo[]; + /** + * Gets a value indicating whether or not the property returns an array. + * Value: true if the property returns an array; otherwise false. + */ + array: boolean; + /** + * Gets a value indicating whether an object should be serialized to the ComponentStorage property. + * Value: true to serialize an object to the ObjectStorage; otherwise false. + */ + link: boolean; + /** + * Gets a value specifying the type of value editor for the Property Grid. + * Value: An ASPxDesignerElementEditor object. + */ + editor: ASPxDesignerElementEditor; + /** + * Gets the collection of values displayed in the Property grid. + * Value: An array of ASPxDesignerElementEditorItem objects. + */ + valuesArray: ASPxDesignerElementEditorItem[]; + /** + * Gets the rules for validating the property value entered into its editor. + * Value: An array of Object values. + */ + validationRules: Object[]; + /** + * Gets the visibility state of the value editor in the Property Grid. + * Value: A Object value. + */ + visible: Object; + /** + * Gets a value, indicating whether or not the property value can be edited. + * Value: true to disable the property editing; otherwise false. + */ + disabled: Object; +} +/** + * Provides information about a serialized property's value editor used in the Property Grid. + */ +interface ASPxDesignerElementEditor { + /** + * Gets the name of an HTML template specifying the editor and header of a complex object (i.e., an object having its content properties specified). + * Value: A String value. + */ + header: string; + /** + * Gets a nullable value, specifying the name of an HTML template used by a complex object's editor. + * Value: A String value. + */ + content: string; + extendedOptions: Object; + /** + * Gets a nullable value, specifying the type of the editor's model. + * Value: A Object value. + */ + editorType: Object; +} +/** + * Provides information about property values. + */ +interface ASPxDesignerElementEditorItem { + /** + * Gets an actual property value. + * Value: A Object value. + */ + value: Object; + /** + * Gets a value displayed by a property editor. + * Value: A String value. + */ + displayValue: string; +} +/** + * A client-side equivalent of the ASPxWebDocumentViewer class. + */ +interface ASPxClientWebDocumentViewer extends ASPxClientControl { + /** + * Enables you to customize the menu actions of a Web Document Viewer. + */ + CustomizeMenuActions: ASPxClientEvent>; + /** + * 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. + */ + GetPreviewModel(): Object; + /** + * Opens the specified report in the HTML5 Document Viewer. + */ + OpenReport(): Object; + /** + * Prints the current document. + */ + Print(): void; + /** + * Prints the document's page with the specified index. + * @param pageIndex An index of the page to be printed. + */ + Print(pageIndex: number): void; + /** + * Exports the document to a PDF file. + */ + ExportTo(): void; + /** + * Exports the document to a specified file format. + * @param format A String value, specifying the export format. The following formats are currently supported: 'csv', 'html', 'image', 'mht', 'pdf', 'rtf', 'txt', 'xls', and 'xlsx'. + */ + ExportTo(format: string): void; + /** + * Updates the localization settings of the ASPxClientWebDocumentViewer properties. + * @param localization A dictionary containing the property names, along with their localized equivalents. + */ + UpdateLocalization(localization: { [key: string]: string; }): void; +} +/** + * A method that will handle the CustomizeMenuActions event. + */ +interface ASPxClientWebDocumentViewerCustomizeMenuActionsEventHandler { + /** + * + * @param source + * @param e + */ + (source: S, e: ASPxClientCustomizeMenuActionsEventArgs): void; +} +/** + * A method that will handle the CustomizeParameterEditors event. + */ +interface ASPxClientWebDocumentViewerCustomizeParameterEditorsEventHandler { + /** + * A method that will handle the CustomizeParameterEditors event. + * @param source The event sender. + * @param e An ASPxClientCustomizeParameterEditorsEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientCustomizeParameterEditorsEventArgs): void; +} +/** + * A method that will handle the CustomizeParameterLookUpSource event. + */ +interface ASPxClientWebDocumentViewerCustomizeParameterLookUpSourceEventHandler { + /** + * A method that will handle the CustomizeParameterLookUpSource event. + * @param source The event sender. + * @param e An ASPxClientCustomizeParameterLookUpSourceEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientCustomizeParameterLookUpSourceEventArgs): void; +} + +interface MVCxClientDashboardViewerStatic extends ASPxClientDashboardViewerStatic { +} +interface DashboardDataAxisNamesStatic { + /** + * Identifies a default axis in all data-bound dashboard items. + */ + DefaultAxis: string; + /** + * Identifies a series axis in a chart and pie. + */ + ChartSeriesAxis: string; + /** + * Identifies an argument axis in a chart, scatter chart and pie. + */ + ChartArgumentAxis: string; + /** + * Identifies a sparkline axis in a grid and cards. + */ + SparklineAxis: string; + /** + * Identifies a pivot column axis. + */ + PivotColumnAxis: string; + /** + * Identifies a pivot row axis. + */ + PivotRowAxis: string; +} +interface DashboardSpecialValuesStatic { + /** + * Represents a null value. + */ + NullValue: string; + /** + * Represents a null value in OLAP mode. + */ + OlapNullValue: string; + /** + * Represents an Others value. + */ + OthersValue: string; + /** + * Represents an error value for calculated fields. + */ + ErrorValue: string; + /** + * Returns whether or not the specified value is an NullValue. + * @param value The specified value. + */ + IsNullValue(value: Object): boolean; + /** + * Returns whether or not the specified value is an OlapNullValue. + * @param value The specified value. + */ + IsOlapNullValue(value: Object): boolean; + /** + * Returns whether or not the specified value is an OthersValue. + * @param value The specified value. + */ + IsOthersValue(value: Object): boolean; + /** + * Returns whether or not the specified value is an ErrorValue. + * @param value The specified value. + */ + IsErrorValue(value: Object): boolean; +} +interface DashboardExportPageLayoutStatic { + /** + * The page orientation used to export a dashboard (dashboard item) is portrait. + */ + Portrait: string; + /** + * The page orientation used to export a dashboard (dashboard item) is landscape. + */ + Landscape: string; +} +interface DashboardExportPaperKindStatic { + /** + * Letter paper (8.5 in. by 11 in.). + */ + Letter: string; + /** + * Legal paper (8.5 in. by 14 in.). + */ + Legal: string; + /** + * Executive paper (7.25 in. by 10.5 in.). + */ + Executive: string; + /** + * A5 paper (148 mm by 210 mm). + */ + A5: string; + /** + * A4 paper (210 mm by 297 mm). + */ + A4: string; + /** + * A3 paper (297 mm by 420 mm). + */ + A3: string; +} +interface DashboardExportScaleModeStatic { + /** + * The dashboard (dashboard item) on the exported page retains its original size. + */ + None: string; + /** + * The size of the dashboard (dashboard item) on the exported page is changed according to the scale factor value. + */ + UseScaleFactor: string; + /** + * The size of the dashboard (dashboard item) is changed according to the width of the exported page. + */ + AutoFitToPageWidth: string; + /** + * The size of the dashboard (dashboard item) is changed to fit its content on a single page. + */ + AutoFitWithinOnePage: string; +} +interface DashboardExportFilterStateStatic { + /** + * The filter state is not included in the exported document. + */ + None: string; + /** + * The filter state is placed below the dashboard (dashboard item) in the exported document. + */ + Below: string; + /** + * The filter state is placed on a separate page in the exported document. + */ + SeparatePage: string; +} +interface DashboardExportImageFormatStatic { + /** + * The PNG image format. + */ + Png: string; + /** + * The GIF image format. + */ + Gif: string; + /** + * The JPG image format. + */ + Jpg: string; +} +interface DashboardExportExcelFormatStatic { + /** + * The Excel 97 - Excel 2003 (XLS) file format. + */ + Xls: string; + /** + * The Office Excel 2007 XML-based (XLSX) file format. + */ + Xlsx: string; + /** + * A comma-separated values (CSV) file format. + */ + Csv: string; +} +interface ChartExportSizeModeStatic { + /** + * A chart dashboard item is exported in a size identical to that shown on the dashboard. + */ + None: string; + /** + * A chart dashboard item is stretched or shrunk to fit the page to which it is exported. + */ + Stretch: string; + /** + * A chart dashboard item is resized proportionally to best fit the exported page. + */ + Zoom: string; +} +interface MapExportSizeModeStatic { + /** + * A map dashboard item is exported in a size identical to that shown on the dashboard + */ + None: string; + /** + * A map dashboard item is resized proportionally to best fit the exported page. + */ + Zoom: string; +} +interface RangeFilterExportSizeModeStatic { + /** + * A Range Filter dashboard item is exported in a size identical to that shown on the dashboard. + */ + None: string; + /** + * A Range Filter dashboard item is stretched or shrunk to fit the page to which it is exported. + */ + Stretch: string; + /** + * A Range Filter dashboard item is resized proportionally to best fit the printed page. + */ + Zoom: string; +} +interface DashboardSelectionModeStatic { + None: string; + Single: string; + Multiple: string; +} +interface ASPxClientDashboardStatic extends ASPxClientControlStatic { +} +interface ASPxClientDashboardViewerStatic 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): ASPxClientDashboardViewer; +} +interface ASPxClientEditBaseStatic extends ASPxClientControlStatic { +} +interface ASPxClientEditStatic extends ASPxClientEditBaseStatic { + /** + * Assigns a null value to all editors in a specified visibility state, which are located within a specified container and belong to a specific validation group. + * @param container An HTML element specifying the container of editors to be validated. + * @param validationGroup A string value specifying the validation group's name. + * @param clearInvisibleEditors true to clear both visible and invisible editors that belong to the specified container and group; false to clear only visible editors. + */ + ClearEditorsInContainer(container: Object, validationGroup: string, clearInvisibleEditors: boolean): void; + /** + * Assigns a null value to all visible editors located within a specified container, and belonging to a specific validation group. + * @param container An HTML element specifying the container of editors to be validated. + * @param validationGroup A string value specifying the validation group's name. + */ + ClearEditorsInContainer(container: Object, validationGroup: string): void; + /** + * Assigns a null value to all visible editors located within a specified container. + * @param container An HTML element specifying the container of editors to be validated. + */ + ClearEditorsInContainer(container: Object): void; + /** + * Assigns a null value to all editors which are located within the specified container object, and belonging to a specific validation group, dependent on the visibility state specified. + * @param containerId A string value specifying the editor container's identifier. + * @param validationGroup A string value specifying the validatiion group's name. + * @param clearInvisibleEditors true to clear both visible and invisible editors that belong to the specified container and group; false to clear only visible editors. + */ + ClearEditorsInContainerById(containerId: string, validationGroup: string, clearInvisibleEditors: boolean): void; + /** + * Assigns a null value to all visible editors that are located within the specified container object, and belonging to a specific validation group. + * @param containerId A string value specifying the editor container's identifier. + * @param validationGroup A string value specifying the validatiion group's name. + */ + ClearEditorsInContainerById(containerId: string, validationGroup: string): void; + /** + * Assigns a null value to all visible editors that are located within the specified container object. + * @param containerId A string value specifying the editor container's identifier. + */ + ClearEditorsInContainerById(containerId: string): void; + /** + * Assigns a null value to all editors which belong to a specific validation group, dependent on the visibility state specified. + * @param validationGroup A string value specifying the validation group's name. + * @param clearInvisibleEditors true to clear both visible and invisible editors that belong to the specified validation group; false to clear only visible editors. + */ + ClearGroup(validationGroup: string, clearInvisibleEditors: boolean): void; + /** + * Assigns a null value to all visible editors which belong to a specific validation group. + * @param validationGroup A string value specifying the validation group's name. + */ + ClearGroup(validationGroup: string): void; + /** + * Performs validation of all editors in a specified visibility state, which are located within a specified container and belong to a specific validation group. + * @param container An HTML element specifying the container of editors to be validated. + * @param validationGroup A string value that specifies the validation group's name. + * @param validateInvisibleEditors true to validate both visible and invisible editors that belong to the specified container and group; false to validate only visible editors. + */ + ValidateEditorsInContainer(container: Object, validationGroup: string, validateInvisibleEditors: boolean): boolean; + /** + * Performs validation of visible editors that are located within the specified container and belong to a specific validation group. + * @param container An HTML element specifying the container of editors to be validated. + * @param validationGroup A string value that specifies the validation group's name. + */ + ValidateEditorsInContainer(container: Object, validationGroup: string): boolean; + /** + * Performs validation of visible editors that are located within the specified container. + * @param container An HTML element specifying the container of editors to be validated. + */ + ValidateEditorsInContainer(container: Object): boolean; + /** + * Performs validation of the editors which are located within the specified container and belong to a specific validation group, dependent on the visibility state specified. + * @param containerId A string value specifying the editor container's identifier. + * @param validationGroup A string value that specifies the validation group's name. + * @param validateInvisibleEditors true to validate both visible and invisible editors that belong to the specified container and group; false to validate only visible editors. + */ + ValidateEditorsInContainerById(containerId: string, validationGroup: string, validateInvisibleEditors: boolean): boolean; + /** + * Performs validation of visible editors that are located within the specified container and belong to a specific validation group. + * @param containerId A string value that specifies the container's unique identifier. + * @param validationGroup A string value that specifies the validation group's name. + */ + ValidateEditorsInContainerById(containerId: string, validationGroup: string): boolean; + /** + * Performs validation of visible editors which are located within the specified container. + * @param containerId A string value that specifies the container's unique identifier. + */ + ValidateEditorsInContainerById(containerId: string): boolean; + /** + * Performs validation of editors contained within the specified validation group, dependent on the editor visibility state specified. + * @param validationGroup A string value specifying the validation group's name. + * @param validateInvisibleEditors true to validate both visible and invisible editors that belong to the specified validation group; false to validate only visible editors. + */ + ValidateGroup(validationGroup: string, validateInvisibleEditors: boolean): boolean; + /** + * Performs validation of visible editors contained within the specified validation group. + * @param validationGroup A string value specifying the validation group's name. + */ + ValidateGroup(validationGroup: string): boolean; + /** + * Verifies whether the editors in a specified visibility state, which are located within a specified container and belong to a specific validation group, are valid. + * @param container An HTML element specifying the container of editors to be validated. + * @param validationGroup A string value that specifies the validation group's name. + * @param checkInvisibleEditors true to check both visible and invisible editors that belong to the specified container; false to check only visible editors. + */ + AreEditorsValid(container: Object, validationGroup: string, checkInvisibleEditors: boolean): boolean; + /** + * Verifies whether visible editors, which are located within a specified container and belong to a specific validation group, are valid. + * @param container An HTML element specifying the container of editors to be validated. + * @param validationGroup A string value that specifies the validation group's name. + */ + AreEditorsValid(container: Object, validationGroup: string): boolean; + /** + * Verifies whether visible editors located in a specified container are valid. + * @param container An HTML element specifying the container of editors to be validated. + */ + AreEditorsValid(container: Object): boolean; + /** + * Verifies whether the editors with the specified settings are valid. + * @param containerId A string value that specifies the container's unique identifier. + * @param validationGroup A string value that specifies the validation group's name. + * @param checkInvisibleEditors true to check both visible and invisible editors that belong to the specified container; false to check only visible editors. + */ + AreEditorsValid(containerId: string, validationGroup: string, checkInvisibleEditors: boolean): boolean; + /** + * Verifies whether visible editors with the specified settings are valid. + * @param containerId A string value that specifies the container's unique identifier. + * @param validationGroup A string value that specifies the validation group's name. + */ + AreEditorsValid(containerId: string, validationGroup: string): boolean; + /** + * Verifies whether visible editors with the specified settings are valid. + * @param containerId A string value that specifies the container's unique identifier. + */ + AreEditorsValid(containerId: string): boolean; + /** + * Verifies whether visible editors on a page are valid. + */ + AreEditorsValid(): boolean; +} +interface ASPxClientBinaryImageStatic extends ASPxClientEditStatic { + /** + * 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): ASPxClientBinaryImage; +} +interface ASPxClientButtonStatic 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): ASPxClientButton; +} +interface ASPxClientCalendarStatic extends ASPxClientEditStatic { + /** + * 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): ASPxClientCalendar; +} +interface ASPxClientCaptchaStatic 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): ASPxClientCaptcha; +} +interface ASPxClientCheckBoxStatic extends ASPxClientEditStatic { + /** + * 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): ASPxClientCheckBox; +} +interface ASPxClientRadioButtonStatic extends ASPxClientCheckBoxStatic { + /** + * 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): ASPxClientRadioButton; +} +interface ASPxClientTextEditStatic extends ASPxClientEditStatic { +} +interface ASPxClientTextBoxBaseStatic extends ASPxClientTextEditStatic { +} +interface ASPxClientButtonEditBaseStatic extends ASPxClientTextBoxBaseStatic { +} +interface ASPxClientDropDownEditBaseStatic extends ASPxClientButtonEditBaseStatic { +} +interface ASPxClientColorEditStatic extends ASPxClientDropDownEditBaseStatic { + /** + * 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): ASPxClientColorEdit; +} +interface ASPxClientComboBoxStatic extends ASPxClientDropDownEditBaseStatic { + /** + * 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): ASPxClientComboBox; +} +interface ASPxClientDateEditStatic extends ASPxClientDropDownEditBaseStatic { + /** + * 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): ASPxClientDateEdit; +} +interface ASPxClientDropDownEditStatic extends ASPxClientDropDownEditBaseStatic { + /** + * 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): ASPxClientDropDownEdit; +} +interface ASPxClientFilterControlStatic 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): ASPxClientFilterControl; +} +interface ASPxClientListEditStatic extends ASPxClientEditStatic { +} +interface ASPxClientListBoxStatic extends ASPxClientListEditStatic { + /** + * 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): ASPxClientListBox; +} +interface ASPxClientCheckListBaseStatic extends ASPxClientListEditStatic { +} +interface ASPxClientRadioButtonListStatic extends ASPxClientCheckListBaseStatic { + /** + * 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): ASPxClientRadioButtonList; +} +interface ASPxClientCheckBoxListStatic extends ASPxClientCheckListBaseStatic { + /** + * 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): ASPxClientCheckBoxList; +} +interface ASPxClientProgressBarStatic extends ASPxClientEditBaseStatic { + /** + * 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): ASPxClientProgressBar; +} +interface ASPxClientSpinEditBaseStatic extends ASPxClientButtonEditBaseStatic { +} +interface ASPxClientSpinEditStatic extends ASPxClientSpinEditBaseStatic { + /** + * 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): ASPxClientSpinEdit; +} +interface ASPxClientTimeEditStatic extends ASPxClientSpinEditBaseStatic { + /** + * 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): ASPxClientTimeEdit; +} +interface ASPxClientStaticEditStatic extends ASPxClientEditBaseStatic { +} +interface ASPxClientHyperLinkStatic extends ASPxClientStaticEditStatic { + /** + * 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): ASPxClientHyperLink; +} +interface ASPxClientImageBaseStatic extends ASPxClientStaticEditStatic { +} +interface ASPxClientImageStatic extends ASPxClientImageBaseStatic { + /** + * 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): ASPxClientImage; +} +interface ASPxClientLabelStatic extends ASPxClientStaticEditStatic { + /** + * 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): ASPxClientLabel; +} +interface ASPxClientTextBoxStatic extends ASPxClientTextBoxBaseStatic { + /** + * 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): ASPxClientTextBox; +} +interface ASPxClientMemoStatic extends ASPxClientTextEditStatic { + /** + * 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): ASPxClientMemo; +} +interface ASPxClientButtonEditStatic extends ASPxClientButtonEditBaseStatic { + /** + * 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): 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 { + /** + * 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): ASPxClientTrackBar; +} +interface ASPxClientValidationSummaryStatic extends ASPxClientControlStatic { +} +interface ASPxClientGaugeControlStatic 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): ASPxClientGaugeControl; +} +interface ASPxClientGridBaseStatic extends ASPxClientControlStatic { +} +interface ASPxClientGridViewCallbackCommandStatic { + /** + * Default value: "NEXTPAGE" + */ + NextPage: string; + /** + * Default value: "PREVPAGE" + */ + PreviousPage: string; + /** + * Default value: "GOTOPAGE" + */ + GotoPage: string; + /** + * Default value: "SELECTROWS" + */ + SelectRows: string; + /** + * Default value: "SELECTROWSKEY" + */ + SelectRowsKey: string; + /** + * Default value: "SELECTION" + */ + Selection: string; + /** + * Default value: "FOCUSEDROW" + */ + FocusedRow: string; + /** + * Default value: "GROUP" + */ + Group: string; + /** + * Default value: "UNGROUP" + */ + UnGroup: string; + /** + * Default value: "SORT" + */ + Sort: string; + /** + * Default value: "COLUMNMOVE" + */ + ColumnMove: string; + /** + * Default value: "COLLAPSEALL" + */ + CollapseAll: string; + /** + * Default value: "EXPANDALL" + */ + ExpandAll: string; + /** + * Default value: "EXPANDROW" + */ + ExpandRow: string; + /** + * Default value: "COLLAPSEROW" + */ + CollapseRow: string; + /** + * Default value: "HIDEALLDETAIL" + */ + HideAllDetail: string; + /** + * Default value: "SHOWALLDETAIL" + */ + ShowAllDetail: string; + /** + * Default value: "SHOWDETAILROW" + */ + ShowDetailRow: string; + /** + * Default value: "HIDEDETAILROW" + */ + HideDetailRow: string; + /** + * Default value: "PAGERONCLICK" + */ + PagerOnClick: string; + /** + * Default value: "APPLYFILTER" + */ + ApplyFilter: string; + /** + * Default value: "APPLYCOLUMNFILTER" + */ + ApplyColumnFilter: string; + /** + * Default value: "APPLYMULTICOLUMNFILTER" + */ + ApplyMultiColumnFilter: string; + /** + * Default value: "APPLYHEADERCOLUMNFILTER" + */ + ApplyHeaderColumnFilter: string; + /** + * Default value: "APPLYSEARCHPANELFILTER" + */ + ApplySearchPanelFilter: string; + /** + * Default value: "FILTERROWMENU" + */ + FilterRowMenu: string; + /** + * Default value: "STARTEDIT" + */ + StartEdit: string; + /** + * Default value: "CANCELEDIT" + */ + CancelEdit: string; + /** + * Default value: "UPDATEEDIT" + */ + UpdateEdit: string; + /** + * Default value: "ADDNEWROW" + */ + AddNewRow: string; + /** + * Default value: "DELETEROW" + */ + DeleteRow: string; + /** + * Default value: "CUSTOMBUTTON" + */ + CustomButton: string; + /** + * Default value: "CUSTOMCALLBACK" + */ + CustomCallback: string; + /** + * Default value: "SHOWFILTERCONTROL" + */ + ShowFilterControl: string; + /** + * Default value: "CLOSEFILTERCONTROL" + */ + CloseFilterControl: string; + /** + * Default value: "SETFILTERENABLED" + */ + SetFilterEnabled: string; + /** + * Default value: "REFRESH" + */ + Refresh: string; + /** + * Default value: "SELFIELDVALUES" + */ + SelFieldValues: string; + /** + * Default value: "ROWVALUES" + */ + RowValues: string; + /** + * Default value: "PAGEROWVALUES" + */ + PageRowValues: string; + /** + * Default value: "FILTERPOPUP" + */ + FilterPopup: string; + /** + * Default value: "CONTEXTMENU" + */ + ContextMenu: string; + /** + * Default value: "CUSTOMVALUES" + */ + CustomValues: string; +} +interface ASPxClientGridLookupStatic extends ASPxClientDropDownEditBaseStatic { + /** + * 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): ASPxClientGridLookup; +} +interface ASPxClientCardViewStatic extends ASPxClientGridBaseStatic { + /** + * 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): ASPxClientCardView; +} +interface ASPxClientGridViewStatic extends ASPxClientGridBaseStatic { + /** + * 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): ASPxClientGridView; +} +interface ASPxClientVerticalGridStatic extends ASPxClientGridBaseStatic { + /** + * 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): ASPxClientVerticalGrid; +} +interface ASPxClientVerticalGridCallbackCommandStatic { + /** + * Default value: "EXPANDROW" + */ + ExpandRow: string; +} +interface ASPxClientCommandConstsStatic { + /** + * Identifies a command that shows a search panel. + * Value: "showsearchpanel" + */ + SHOWSEARCHPANEL_COMMAND: string; + /** + * Identifies a command that invokes the Find and Replace dialog. + * Value: "findandreplacedialog" + */ + FINDANDREPLACE_DIALOG_COMMAND: string; + /** + * Identifies a command that applies the bold text formatting to the selected text. If it's already applied, cancels it. + * Value: "bold" + */ + BOLD_COMMAND: string; + /** + * Identifies a command that makes the selected text italic or regular type depending on the current state. + * Value: "italic" + */ + ITALIC_COMMAND: string; + /** + * Identifies a command that applies the underline text formatting to the selected text. If it's already applied, cancels it. + * Value: "underline" + */ + UNDERLINE_COMMAND: string; + /** + * Identifies a command that applies the strike through text formatting to the selected text. If it's already applied, cancels it. + * Value: "strikethrough" + */ + STRIKETHROUGH_COMMAND: string; + /** + * Identifies a command that applies the superscript text formatting to the selected text. If it's already applied, cancels it. + * Value: "superscript" + */ + SUPERSCRIPT_COMMAND: string; + /** + * Identifies a command that applies the subscript text formatting to the selected text. If it's already applied, cancels it. + * Value: "subscript" + */ + SUBSCRIPT_COMMAND: string; + /** + * Identifies a command that centers the content of the currently focused paragraph. + * Value: "justifycenter" + */ + JUSTIFYCENTER_COMMAND: string; + /** + * Identifies a command that left justifies the content of the currently focused paragraph. + * Value: "justifyleft" + */ + JUSTIFYLEFT_COMMAND: string; + /** + * Identifies a command that creates an indent for the selected paragarph. + * Value: "indent" + */ + INDENT_COMMAND: string; + /** + * Identifies a command that creates an outdent for the focused paragarph. + * Value: "outdent" + */ + OUTDENT_COMMAND: string; + /** + * Identifies a command that right justifies the content of the currently focused paragraph. + * Value: "justifyright" + */ + JUSTIFYRIGHT_COMMAND: string; + /** + * Identifies a command that fully justifies the content of the currently focused paragraph (aligned with both the left and right margines). + * Value: "justifyfull" + */ + JUSTIFYFULL_COMMAND: string; + /** + * Identifies a command that changes the size of the selected text. + * Value: "fontsize" + */ + FONTSIZE_COMMAND: string; + /** + * Identifies a command that changes the font of the selected text. + * Value: "fontname" + */ + FONTNAME_COMMAND: string; + /** + * Identifies a command that changes the color of a fore color pickers and sets the selected text fore color. + * Value: "forecolor" + */ + FONTCOLOR_COMMAND: string; + /** + * Identifies a command that changes the color of a back color pickers and sets the selected text back color. + * Value: "backcolor" + */ + BACKCOLOR_COMMAND: string; + /** + * Identifies a command that wraps the selected paragraph in the specified html tag. + * Value: "formatblock" + */ + FORMATBLOCK_COMMAND: string; + /** + * Identifies a command that wraps the currently selected text content in a specific html tag with a css class assigned to it. + * Value: "applycss" + */ + APPLYCSS_COMMAND: string; + /** + * Identifies a command that removes all formatting from the selected content. + * Value: "removeformat" + */ + REMOVEFORMAT_COMMAND: string; + /** + * Identifies a command that cancels the last action. + * Value: "undo" + */ + UNDO_COMMAND: string; + /** + * Identifies a command that returns a previously canceled action. + * Value: "redo" + */ + REDO_COMMAND: string; + /** + * Identifies a command that copies the selected content. + * Value: "copy" + */ + COPY_COMMAND: string; + /** + * Identifies a command that pastes the content of the clipboard at the current cursor position. + * Value: "paste" + */ + PASTE_COMMAND: string; + /** + * Identifies a command that pastes a specified content taking into account that it was copied from Word. + * Value: "pastefromword" + */ + PASTEFROMWORD_COMMAND: string; + /** + * Identifies a command that invokes the Paste from Word dialog. + * Value: "pastefromworddialog" + */ + PASTEFROMWORDDIALOG_COMMAND: string; + /** + * Identifies a command that cuts the selected content. + * Value: "cut" + */ + CUT_COMMAND: string; + /** + * Identifies a command that selects all content inside the html editor. + * Value: "selectall" + */ + SELECT_ALL: string; + /** + * Identifies a command that deletes the selected content. + * Value: "delete" + */ + DELETE_COMMAND: string; + /** + * Identifies a command that can be used to correctly insert HTML code into the editor. + * Value: "pastehtml" + */ + PASTEHTML_COMMAND: string; + /** + * Identifies a command that inserts a new ordered list. + * Value: "insertorderedlist" + */ + INSERTORDEREDLIST_COMMAND: string; + /** + * Identifies a command that inserts a new unordered list. + * Value: "insertunorderedlist" + */ + INSERTUNORDEREDLIST_COMMAND: string; + /** + * Identifies a command that restarts the current ordered list. + * Value: "restartorderedlist" + */ + RESTARTORDEREDLIST_COMMAND: string; + /** + * Identifies a command that continues a disrupted ordered list. + * Value: "continueorderedlist" + */ + CONTINUEORDEREDLIST_COMMAND: string; + /** + * Identifies a command that removes a hyperlink from the selected text or image. + * Value: "unlink" + */ + UNLINK_COMMAND: string; + /** + * Identifies a command that inserts a new hyperlink. + * Value: "insertlink" + */ + INSERTLINK_COMMAND: string; + /** + * Identifies a command that inserts a new image. + * Value: "insertimage" + */ + INSERTIMAGE_COMMAND: string; + /** + * Identifies a command that changes the selected image. + * Value: "changeimage" + */ + CHANGEIMAGE_COMMAND: string; + /** + * Identifies a command that initiates spell checking. + * Value: "checkspelling" + */ + CHECKSPELLING_COMMAND: string; + /** + * Identifies a command that invokes the Insert Image dialog. + * Value: "insertimagedialog" + */ + INSERTIMAGE_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Change Image dialog. + * Value: "changeimagedialog" + */ + CHANGEIMAGE_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Insert Link dialog. + * Value: "insertlinkdialog" + */ + INSERTLINK_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Change Link dialog. + * Value: "changelinkdialog" + */ + CHANGELINK_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Insert Table dialog. + * Value: "inserttabledialog" + */ + INSERTTABLE_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Table Properties dialog. + * Value: "tablepropertiesdialog" + */ + TABLEPROPERTIES_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Cell Properties dialog. + * Value: "tablecellpropertiesdialog" + */ + TABLECELLPROPERTIES_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Column Properties dialog. + * Value: "tablecolumnpropertiesdialog" + */ + TABLECOLUMNPROPERTIES_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Row Properties dialog. + * Value: "tablerowpropertiesdialog" + */ + TABLEROWPROPERTIES_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes a default browser Print dialog, allowing an end-user to print the content of the html editor. + * Value: "print" + */ + PRINT_COMMAND: string; + /** + * Identifies a command that toggles the full-screen mode. + * Value: "fullscreen" + */ + FULLSCREEN_COMMAND: string; + /** + * Identifies a command that inserts a new table. + * Value: "inserttable" + */ + INSERTTABLE_COMMAND: string; + /** + * Identifies a command that changes the selected table. + * Value: "changetable" + */ + CHANGETABLE_COMMAND: string; + /** + * Identifies a command that changes the selected table cell. + * Value: "changetablecell" + */ + CHANGETABLECELL_COMMAND: string; + /** + * Identifies a command that changes the selected table row. + * Value: "changetablerow" + */ + CHANGETABLEROW_COMMAND: string; + /** + * Identifies a command that changes the selected table column. + * Value: "changetablecolumn" + */ + CHANGETABLECOLUMN_COMMAND: string; + /** + * Identifies a command that deletes the currently selected table. + * Value: "deletetable" + */ + DELETETABLE_COMMAND: string; + /** + * Identifies a command that deletes the currently selected table row. + * Value: "deletetablerow" + */ + DELETETABLEROW_COMMAND: string; + /** + * Identifies a command that deletes the currently selected table column. + * Value: "deletetablecolumn" + */ + DELETETABLECOLUMN_COMMAND: string; + /** + * Identifies a command that inserts a new column to the left from the currently focused one. + * Value: "inserttablecolumntoleft" + */ + INSERTTABLECOLUMNTOLEFT_COMMAND: string; + /** + * Identifies a command that inserts a new column to the right from the currently focused one. + * Value: "inserttablecolumntoright" + */ + INSERTTABLECOLUMNTORIGHT_COMMAND: string; + /** + * Identifies a command that inserts a new row below the currently focused one. + * Value: "inserttablerowbelow" + */ + INSERTTABLEROWBELOW_COMMAND: string; + /** + * Identifies a command that inserts a new row above the currently focused one. + * Value: "inserttablerowabove" + */ + INSERTTABLEROWABOVE_COMMAND: string; + /** + * Identifies a command that splits the current table cell horizontally. + * Value: "splittablecellhorizontally" + */ + SPLITTABLECELLHORIZONTALLY_COMMAND: string; + /** + * Identifies a command that splits the current table cell vertically. + * Value: "splittablecellvertically" + */ + SPLITTABLECELLVERTICALLY_COMMAND: string; + /** + * Identifies a command that merges the focused table cell with the one to the right. + * Value: "mergetablecellright" + */ + MERGETABLECELLRIGHT_COMMAND: string; + /** + * Identifies a command that merges the focused table cell with the one below. + * Value: "mergetablecelldown" + */ + MERGETABLECELLDOWN_COMMAND: string; + /** + * Identifies a command that invokes a custom dialog. + * Value: "customdialog" + */ + CUSTOMDIALOG_COMMAND: string; + /** + * Identifies a command that exports the html editor content. + * Value: "export" + */ + EXPORT_COMMAND: string; + /** + * Identifies a command that inserts a new audio element. + * Value: "insertaudio" + */ + INSERTAUDIO_COMMAND: string; + /** + * Identifies a command that inserts a new video. + * Value: "insertvideo" + */ + INSERTVIDEO_COMMAND: string; + /** + * Identifies a command that inserts a new flash element. + * Value: "insertflash" + */ + INSERTFLASH_COMMAND: string; + /** + * Identifies a command that inserts a new YouTube video. + * Value: "insertyoutubevideo" + */ + INSERTYOUTUBEVIDEO_COMMAND: string; + /** + * Identifies a command that changes the selected audio element. + * Value: "changeaudio" + */ + CHANGEAUDIO_COMMAND: string; + /** + * Identifies a command that changes the selected video element. + * Value: "changevideo" + */ + CHANGEVIDEO_COMMAND: string; + /** + * Identifies a command that changes the selected flash element. + * Value: "changeflash" + */ + CHANGEFLASH_COMMAND: string; + /** + * Identifies a command that changes the selected YouTube video element. + * Value: "changeyoutubevideo" + */ + CHANGEYOUTUBEVIDEO_COMMAND: string; + /** + * Identifies a command that invokes the Insert Audio dialog. + * Value: "insertaudiodialog" + */ + INSERTAUDIO_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Insert Video dialog. + * Value: "insertvideodialog" + */ + INSERTVIDEO_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Insert Flash dialog. + * Value: "insertflashdialog" + */ + INSERTFLASH_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Insert YouTube Video dialog. + * Value: "insertyoutubevideodialog" + */ + INSERTYOUTUBEVIDEO_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Change Audio dialog. + * Value: "changeaudiodialog" + */ + CHANGEAUDIO_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Change Video dialog. + * Value: "changevideodialog" + */ + CHANGEVIDEO_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Change Flash dialog. + * Value: "changeflash" + */ + CHANGEFLASH_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Change YouTube Video dialog. + * Value: "changeyoutubevideodialog" + */ + CHANGEYOUTUBEVIDEO_DIALOG_COMMAND: string; + /** + * Identifies a command that pastes the content of the clipboard to the current cursor position, taking into account that the PasteMode property is set to SourceFormatting. + * Value: "pastehtmlsourceformatting" + */ + PASTEHTMLSOURCEFORMATTING_COMMAND: string; + /** + * Identifies a command that pastes the content of the clipboard to the current cursor position, taking into account that the PasteMode property is set to PlainText. + * Value: "pastehtmlplaintext" + */ + PASTEHTMLPLAINTEXT_COMMAND: string; + /** + * Identifies a command that pastes the content of the clipboard to the current cursor position, taking into account that the PasteMode property is set to MergeFormatting. + * Value: "pastehtmlmergeformatting" + */ + PASTEHTMLMERGEFORMATTING_COMMAND: string; + /** + * Identifies a command that inserts a new placeholder. + * Value: "insertplaceholder" + */ + INSERTPLACEHOLDER_COMMAND: string; + /** + * Identifies a command that changes the selected placeholder. + * Value: "changeplaceholder" + */ + CHANGEPLACEHOLDER_COMMAND: string; + /** + * Identifies a command that invokes the Insert Placeholder dialog. + * Value: "insertplaceholderdialog" + */ + INSERTPLACEHOLDER_DIALOG_COMMAND: string; + /** + * Identifies a command that invokes the Change Placeholder dialog. + * Value: "changeplaceholderdialog" + */ + CHANGEPLACEHOLDER_DIALOG_COMMAND: string; + /** + * Identifies a command that updates the editor content. + * Value: "updatedocument" + */ + UPDATEDOCUMENT_COMMAND: string; + /** + * Identifies a command that changes properties of the element selected in the tag inspector. + * Value: "changeelementproperties" + */ + CHANGEELEMENTPROPERTIES_COMMAND: string; + /** + * Identifies a command that invokes the Change Element Properties dialog. + * Value: "changeelementpropertiesdialog" + */ + CHANGEELEMENTPROPERTIES_DIALOG_COMMAND: string; + /** + * Identifies a command that comments the selected HTML code. If no code is selected, it comments the focused tag. + * Value: "comment" + */ + COMMENT_COMMAND: string; + /** + * Identifies a command that uncomments the selected HTML code. If no code is selected, the command uncomments the currently focused tag. + * Value: "uncomment" + */ + UNCOMMENTHTML_COMMAND: string; + /** + * Identifies a command that formats the current HTML document. + * Value: "formatdocument" + */ + FORMATDOCUMENT_COMMAND: string; + /** + * Identifies a command that applies the indent formatting to the selected content. + * Value: "indent" + */ + INDENTLINE_COMMAND: string; + /** + * Identifies a command that applies the outdent formatting to the focused content. + * Value: "outdent" + */ + OUTDENTLINE_COMMAND: string; + /** + * Identifies a command that collapses the selected HTML tag. + * Value: "collapsetag" + */ + COLLAPSETAG_COMMAND: string; + /** + * Identifies a command that expands the selected HTML tag. + * Value: "expandtag" + */ + EXPANDTAG_COMMAND: string; + /** + * Identifies a command that shows intellisense for the HTML code editor. + * Value: "showintellisense" + */ + SHOWINTELLISENSE_COMMAND: string; +} +interface ASPxClientHtmlEditorStatic 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): ASPxClientHtmlEditor; + /** + * Programmatically closes a custom dialog, supplying it with specific parameters. + * @param status An object representing a custom dialog's closing status. + * @param data An object representing custom data associated with a custom dialog. + */ + CustomDialogComplete(status: Object, data: Object): void; +} +interface ASPxClientHtmlEditorMediaPreloadModeStatic { + /** + * The browser does not load a media file when the page loads. + */ + None: string; + /** + * The browser loads the entire video when the page loads. + */ + Auto: string; + /** + * The browser loads only metadata when the page loads. + */ + Metadata: string; +} +interface ASPxClientPivotGridStatic 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): ASPxClientPivotGrid; +} +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 { + /** + * Returns the date part of the specified DateTime value. + * @param date A DateTime object from which to extract the date. + */ + TruncToDate(date: Date): Date; + /** + * Returns the day time part of the specified DateTime value. + * @param date A DateTime object from which to extract the day time. + */ + ToDayTime(date: Date): any; + /** + * Adds the specified number of days to a DateTime object and returns the result. + * @param date A DateTime object to which to add days. + * @param dayCount The number of days to add. + */ + AddDays(date: Date, dayCount: number): Date; + /** + * Adds the specified timespan to a DateTime object and returns the result. + * @param date A DateTime object to which to add a timespan. + * @param timeSpan A TimeSpan object specifying the timespan to add. + */ + AddTimeSpan(date: Date, timeSpan: any): Date; + /** + * Rounds a DateTime value up to the nearest interval. + * @param date A DateTime object containing a value to round. + * @param spanInMs A TimeSpan object specifying an interval to which to round. + */ + CeilDateTime(date: Date, spanInMs: any): Date; +} +interface ASPxClientWeekDaysCheckEditStatic extends ASPxClientControlStatic { +} +interface ASPxClientRecurrenceRangeControlStatic extends ASPxClientControlStatic { +} +interface ASPxClientRecurrenceControlBaseStatic extends ASPxClientControlStatic { +} +interface ASPxClientDailyRecurrenceControlStatic extends ASPxClientRecurrenceControlBaseStatic { +} +interface ASPxClientWeeklyRecurrenceControlStatic extends ASPxClientRecurrenceControlBaseStatic { +} +interface ASPxClientMonthlyRecurrenceControlStatic extends ASPxClientRecurrenceControlBaseStatic { +} +interface ASPxClientYearlyRecurrenceControlStatic extends ASPxClientRecurrenceControlBaseStatic { +} +interface ASPxClientRecurrenceTypeEditStatic extends ASPxClientRadioButtonListStatic { +} +interface ASPxClientTimeIntervalStatic { + /** + * Gets the duration of a time interval between two points in time. + * @param start A DateTime object specifying the starting point of the time interval. + * @param end A DateTime object specifying the ending point of the time interval. + */ + CalculateDuration(start: Date, end: Date): number; +} +interface ASPxClientSchedulerStatic 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): ASPxClientScheduler; +} +interface ASPxClientSpellCheckerStatic 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): ASPxClientSpellChecker; +} +interface ASPxClientSpellCheckerStopCheckingReasonStatic { + Default: string; + User: string; +} +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 { + /** + * 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): ASPxClientTreeList; +} +interface BootstrapClientAccordionStatic extends ASPxClientNavBarStatic { +} +interface BootstrapClientButtonStatic extends ASPxClientButtonStatic { +} +interface BootstrapClientCalendarStatic extends ASPxClientCalendarStatic { +} +interface BootstrapClientCheckBoxStatic extends ASPxClientEditStatic { +} +interface BootstrapClientRadioButtonStatic extends BootstrapClientCheckBoxStatic { +} +interface BootstrapClientComboBoxStatic extends ASPxClientComboBoxStatic { +} +interface BootstrapClientDateEditStatic extends ASPxClientDateEditStatic { +} +interface BootstrapClientDropDownEditStatic extends ASPxClientDropDownEditStatic { +} +interface BootstrapClientFormLayoutStatic extends ASPxClientFormLayoutStatic { +} +interface BootstrapClientGridViewStatic extends ASPxClientGridViewStatic { +} +interface BootstrapClientHyperLinkStatic extends ASPxClientHyperLinkStatic { +} +interface BootstrapClientListBoxStatic extends ASPxClientListBoxStatic { +} +interface BootstrapClientCheckBoxListStatic extends ASPxClientCheckBoxListStatic { +} +interface BootstrapClientRadioButtonListStatic extends ASPxClientRadioButtonListStatic { +} +interface BootstrapClientMenuStatic extends ASPxClientMenuStatic { +} +interface BootstrapClientPopupControlStatic extends ASPxClientPopupControlStatic { +} +interface BootstrapClientPopupMenuStatic extends ASPxClientPopupMenuStatic { +} +interface BootstrapClientProgressBarStatic extends ASPxClientProgressBarStatic { +} +interface BootstrapClientSpinEditStatic extends ASPxClientSpinEditStatic { +} +interface BootstrapClientTabControlStatic extends ASPxClientTabControlStatic { +} +interface BootstrapClientPageControlStatic extends ASPxClientPageControlStatic { +} +interface BootstrapClientTextBoxStatic extends ASPxClientTextBoxStatic { +} +interface BootstrapClientMemoStatic extends ASPxClientMemoStatic { +} +interface BootstrapClientButtonEditStatic extends ASPxClientButtonEditStatic { +} +interface BootstrapClientTreeViewStatic extends ASPxClientTreeViewStatic { +} +interface MVCxClientCalendarStatic extends ASPxClientCalendarStatic { + /** + * 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): MVCxClientCalendar; +} +interface MVCxClientCallbackPanelStatic extends ASPxClientCallbackPanelStatic { + /** + * 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): MVCxClientCallbackPanel; +} +interface MVCxClientCardViewStatic extends ASPxClientCardViewStatic { + /** + * 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): MVCxClientCardView; +} +interface MVCxClientChartStatic extends ASPxClientWebChartControlStatic { + /** + * 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): MVCxClientChart; +} +interface MVCxClientComboBoxStatic 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): MVCxClientComboBox; +} +interface MVCxClientDataViewStatic extends ASPxClientDataViewStatic { + /** + * 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): MVCxClientDataView; +} +interface MVCxClientDateEditStatic extends ASPxClientDateEditStatic { + /** + * 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): MVCxClientDateEdit; +} +interface MVCxClientDockManagerStatic extends ASPxClientDockManagerStatic { + /** + * 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): MVCxClientDockManager; +} +interface MVCxClientDockPanelStatic extends ASPxClientDockPanelStatic { + /** + * 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): MVCxClientDockPanel; +} +interface MVCxClientFileManagerStatic extends ASPxClientFileManagerStatic { + /** + * 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): MVCxClientFileManager; +} +interface MVCxClientGridViewStatic extends ASPxClientGridViewStatic { + /** + * 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): MVCxClientGridView; +} +interface MVCxClientHtmlEditorStatic extends ASPxClientHtmlEditorStatic { + /** + * 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): MVCxClientHtmlEditor; +} +interface MVCxClientImageGalleryStatic extends ASPxClientImageGalleryStatic { + /** + * 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): MVCxClientImageGallery; +} +interface MVCxClientListBoxStatic extends ASPxClientListBoxStatic { + /** + * 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): MVCxClientListBox; +} +interface MVCxClientNavBarStatic extends ASPxClientNavBarStatic { + /** + * 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): MVCxClientNavBar; +} +interface MVCxClientPivotGridStatic extends ASPxClientPivotGridStatic { + /** + * 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): MVCxClientPivotGrid; +} +interface MVCxClientPopupControlStatic extends ASPxClientPopupControlStatic { + /** + * 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): MVCxClientPopupControl; +} +interface MVCxClientDocumentViewerStatic extends ASPxClientDocumentViewerStatic { +} +interface MVCxClientReportViewerStatic extends ASPxClientReportViewerStatic { +} +interface MVCxClientReportDesignerStatic extends ASPxClientReportDesignerStatic { +} +interface MVCxClientRichEditStatic extends ASPxClientRichEditStatic { + /** + * 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): MVCxClientRichEdit; +} +interface MVCxClientRoundPanelStatic extends ASPxClientRoundPanelStatic { + /** + * 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): MVCxClientRoundPanel; +} +interface MVCxClientSchedulerStatic extends ASPxClientSchedulerStatic { + /** + * 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): MVCxClientScheduler; +} +interface MVCxSchedulerToolTipTypeStatic { + /** + * The tooltip is displayed for a selected appointment. + */ + Appointment: number; + /** + * The tooltip is displayed for a dragged appointment. + */ + AppointmentDrag: number; + /** + * The tooltip is displayed for a selected time interval. + */ + Selection: number; +} +interface MVCxClientSpreadsheetStatic extends ASPxClientSpreadsheetStatic { + /** + * 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): MVCxClientSpreadsheet; +} +interface MVCxClientPageControlStatic extends ASPxClientPageControlStatic { + /** + * 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): MVCxClientPageControl; +} +interface MVCxClientTokenBoxStatic extends ASPxClientTokenBoxStatic { + /** + * 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): MVCxClientTokenBox; +} +interface MVCxClientTreeListStatic extends ASPxClientTreeListStatic { + /** + * 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): MVCxClientTreeList; +} +interface MVCxClientTreeViewStatic extends ASPxClientTreeViewStatic { + /** + * 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): MVCxClientTreeView; +} +interface MVCxClientUploadControlStatic extends ASPxClientUploadControlStatic { + /** + * 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): MVCxClientUploadControl; +} +interface MVCxClientUtilsStatic { + /** + * Loads service resources (such as scripts, CSS files, etc.) required for DevExpress functionality to work properly after a non DevExpress callback has been processed on the server and returned back to the client. + */ + FinalizeCallback(): void; + /** + * Returns values of editors placed in the specified container. + * @param containerOrId A container of editors, or its ID. + */ + GetSerializedEditorValuesInContainer(containerOrId: Object): Object; + /** + * Returns values of editors placed in the specified container. + * @param containerOrId A container of editors, or its ID. + * @param processInvisibleEditors true to process both visible and invisible editors that belong to the specified container; false to process only visible editors. + */ + GetSerializedEditorValuesInContainer(containerOrId: Object, processInvisibleEditors: boolean): Object; +} +interface MVCxClientGlobalEventsStatic { + /** + * Dynamically connects the ControlsInitialized client event with an appropriate event handler function. + * @param handler A object representing the event handling function's content. + */ + AddControlsInitializedEventHandler(handler: ASPxClientControlsInitializedEventHandler): void; + /** + * Dynamically connects the BeginCallback client event with an appropriate event handler function. + * @param handler A object containing the event handling function's content. + */ + AddBeginCallbackEventHandler(handler: MVCxClientBeginCallbackEventHandler): void; + /** + * Dynamically connects the EndCallback client event with an appropriate event handler function. + * @param handler A object containing the event handling function's content. + */ + AddEndCallbackEventHandler(handler: ASPxClientEndCallbackEventHandler): void; + /** + * Dynamically connects the CallbackError client event with an appropriate event handler function. + * @param handler A object containing the event handling function's content. + */ + AddCallbackErrorHandler(handler: ASPxClientCallbackErrorEventHandler): void; +} +interface MVCxClientVerticalGridStatic extends ASPxClientVerticalGridStatic { + /** + * 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): MVCxClientVerticalGrid; +} +interface MVCxClientWebDocumentViewerStatic extends ASPxClientWebDocumentViewerStatic { +} +interface ASPxClientControlBaseStatic { + /** + * 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): ASPxClientControlBase; +} +interface ASPxClientControlStatic extends ASPxClientControlBaseStatic { + /** + * 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): ASPxClientControl; + /** + * Modifies the controls size on the page. + */ + AdjustControls(): void; + /** + * Modifies the controls size within the specified container. + * @param container An HTML element that is the container of the controls. + */ + AdjustControls(container: Object): void; + /** + * Returns a collection of client web control objects. + */ + GetControlCollection(): ASPxClientControlCollection; +} +interface ASPxClientCallbackStatic 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): ASPxClientCallback; +} +interface ASPxClientPanelBaseStatic 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): ASPxClientPanelBase; +} +interface ASPxClientPanelStatic extends ASPxClientPanelBaseStatic { + /** + * 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): ASPxClientPanel; +} +interface ASPxClientCallbackPanelStatic extends ASPxClientPanelStatic { + /** + * 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): ASPxClientCallbackPanel; +} +interface ASPxClientCloudControlStatic 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): ASPxClientCloudControl; +} +interface ASPxClientDataViewStatic 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): ASPxClientDataView; +} +interface ASPxClientDockManagerStatic 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): ASPxClientDockManager; +} +interface ASPxClientPopupControlBaseStatic extends ASPxClientControlStatic { +} +interface ASPxClientDockPanelStatic extends ASPxClientPopupControlBaseStatic { + /** + * 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): ASPxClientDockPanel; +} +interface ASPxClientDockZoneStatic 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): ASPxClientDockZone; +} +interface ASPxClientFileManagerStatic 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): ASPxClientFileManager; +} +interface ASPxClientFileManagerCommandConstsStatic { + /** + * The name of a command that is executed when an end-user renames an item. + */ + Rename: string; + /** + * The name of a command that is executed when an end-user moves an item. + */ + Move: string; + /** + * The name of a command that is executed when an end-user deletes an item. + */ + Delete: string; + /** + * The name of a command that is executed when an end-user creates a folder. + */ + Create: string; + /** + * The name of a command that is executed when an end-user uploads a file. + */ + Upload: string; + /** + * The name of a command that is executed when an end-user downloads an item. + */ + Download: string; + /** + * The name of a command that is executed when an end-user copies an item. + */ + Copy: string; + /** + * The name of a command that is executed when an end-user opens an item. + */ + Open: string; +} +interface ASPxClientFileManagerErrorConstsStatic { + /** + * The specified file is not found. Return Value: 0 + */ + FileNotFound: number; + /** + * The specified folder is not found. Return Value: 1 + */ + FolderNotFound: number; + /** + * Access is denied. Return Value: 2 + */ + AccessDenied: number; + /** + * Unspecified IO error occurs. Return Value: 3 + */ + UnspecifiedIO: number; + /** + * Unspecified error occurs. Return Value: 4 + */ + Unspecified: number; + /** + * The file/folder name is empty. Return Value: 5 + */ + EmptyName: number; + /** + * The operation was canceled. Return Value: 6 + */ + CanceledOperation: number; + /** + * The specified name contains invalid characters. Return Value: 7 + */ + InvalidSymbols: number; + /** + * The specified file extension is not allowed. Return Value: 8 + */ + WrongExtension: number; + /** + * The file/folder is being used by another process. Return Value: 9 + */ + UsedByAnotherProcess: number; + /** + * The specified file/folder already exists. Return Value: 10 + */ + AlreadyExists: number; +} +interface ASPxClientFormLayoutStatic 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): ASPxClientFormLayout; +} +interface ASPxClientHiddenFieldStatic 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): ASPxClientHiddenField; +} +interface ASPxClientImageGalleryStatic extends ASPxClientDataViewStatic { + /** + * 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): ASPxClientImageGallery; +} +interface ASPxClientImageSliderStatic 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): ASPxClientImageSlider; +} +interface ASPxClientImageZoomNavigatorStatic extends ASPxClientImageSliderStatic { +} +interface ASPxClientImageZoomStatic extends ASPxClientControlStatic { +} +interface ASPxClientLoadingPanelStatic 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): ASPxClientLoadingPanel; +} +interface ASPxClientMenuBaseStatic extends ASPxClientControlStatic { + /** + * Returns a collection of client menu objects. + */ + GetMenuCollection(): ASPxClientMenuCollection; +} +interface ASPxClientMenuStatic extends ASPxClientMenuBaseStatic { + /** + * 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): ASPxClientMenu; +} +interface ASPxClientTouchUIStatic { + /** + * Extends the specified element's functionality with scrolling via touch behavior (one finger) and the ability to display vertical and horizontal scroll bars. + * @param id A string value specifying the element's ID. + */ + MakeScrollable(id: string): ScrollExtender; + /** + * Extends the specified element's functionality with scrolling via touch behavior (one finger) and the ability to display vertical and horizontal scroll bars. + * @param element An object that specifies the required DOM element. + */ + MakeScrollable(element: Object): ScrollExtender; + /** + * Extends the specified element's functionality with scrolling via touch behavior (one finger) and customized scrollbar-related options. + * @param id A string value specifying the name of a DOM element that should be extended with the touch scrolling functionality. + * @param options An ASPxClientTouchUIOptions object that provides options affecting the touch scrolling functionality. + */ + MakeScrollable(id: string, options: ASPxClientTouchUIOptions): ScrollExtender; + /** + * Extends the specified element's functionality with scrolling via touch behavior (one finger) and customized scrollbar-related options. + * @param element An object specifying the DOM element to extend with the touch scrolling functionality. + * @param options An ASPxClientTouchUIOptions object that provides options affecting the touch scrolling functionality. + */ + MakeScrollable(element: Object, options: ASPxClientTouchUIOptions): ScrollExtender; +} +interface ASPxClientNavBarStatic 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): ASPxClientNavBar; +} +interface ASPxClientNewsControlStatic extends ASPxClientDataViewStatic { + /** + * 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): ASPxClientNewsControl; +} +interface ASPxClientObjectContainerStatic 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): ASPxClientObjectContainer; +} +interface ASPxClientPagerStatic extends ASPxClientControlStatic { +} +interface ASPxClientPopupControlStatic extends ASPxClientPopupControlBaseStatic { + /** + * 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): ASPxClientPopupControl; + /** + * Returns a collection of client popup control objects. + */ + GetPopupControlCollection(): ASPxClientPopupControlCollection; +} +interface ASPxClientPopupControlResizeStateStatic { + /** + * A window has been resized. Returns 0. + */ + Resized: number; + /** + * A window has been collapsed. Returns 1. + */ + Collapsed: number; + /** + * A window has been expanded. Returns 2. + */ + Expanded: number; + /** + * A window has been maximized. Returns 3. + */ + Maximized: number; + /** + * A window has been restored after maximizing. Returns 4. + */ + RestoredAfterMaximized: number; +} +interface ASPxClientPopupControlCloseReasonStatic { + /** + * The window has been closed by an API. + */ + API: string; + /** + * An end-user clicks the close header button. + */ + CloseButton: string; + /** + * An end-user clicks outside the window's region + */ + OuterMouseClick: string; + /** + * An end-user moves the mouse pointer out of the window region. + */ + MouseOut: string; + /** + * An end-user presses the ESC key. + */ + Escape: string; +} +interface ASPxClientPopupMenuStatic extends ASPxClientMenuBaseStatic { + /** + * 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): ASPxClientPopupMenu; +} +interface ASPxClientRatingControlStatic 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): ASPxClientRatingControl; +} +interface ASPxClientRibbonStatic 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): ASPxClientRibbon; +} +interface ASPxClientRibbonStateStatic { + /** + * A ribbon is in the normal state. Returns 0 + */ + Normal: number; + /** + * A ribbon is minimized. Returns 1 + */ + Minimized: number; + /** + * A ribbon is temporarily shown. Returns 2 + */ + TemporaryShown: number; +} +interface ASPxClientRoundPanelStatic extends ASPxClientPanelBaseStatic { + /** + * 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): ASPxClientRoundPanel; +} +interface ASPxClientSplitterStatic 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): ASPxClientSplitter; +} +interface ASPxClientTabControlBaseStatic extends ASPxClientControlStatic { +} +interface ASPxClientTabControlStatic extends ASPxClientTabControlBaseStatic { + /** + * 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): ASPxClientTabControl; +} +interface ASPxClientPageControlStatic extends ASPxClientTabControlBaseStatic { + /** + * 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): ASPxClientPageControl; +} +interface ASPxClientTimerStatic 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): ASPxClientTimer; +} +interface ASPxClientTitleIndexStatic 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): ASPxClientTitleIndex; +} +interface ASPxClientTreeViewStatic 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): ASPxClientTreeView; +} +interface ASPxClientUploadControlStatic 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): ASPxClientUploadControl; +} +interface ASPxClientUtilsStatic { + /** + * Gets the user-agent string, which identifies the client browser and provides certain system details of the client computer. + * Value: A string value representing the browser's user-agent string. + */ + agent: string; + /** + * Gets a value that specifies whether the client browser is Opera. + * Value: true if the client browser is Opera; otherwise, false. + */ + opera: boolean; + /** + * Gets a value that specifies whether the client browser is Opera version 9. + * Value: true if the client browser is Opera version 9; otherwise, false. + */ + opera9: boolean; + /** + * Gets a value that specifies whether the client browser is Safari. + * Value: true if the client browser is Safari; otherwise, false. + */ + safari: boolean; + /** + * Gets a value that specifies whether the client browser is Safari version 3. + * Value: true if the client browser is Safari version 3; otherwise, false. + */ + safari3: boolean; + /** + * Gets a value that specifies whether the client browser is Safari, running under a MacOS operating system. + * Value: true if the client browser is Safari, running under a MacOS operating system; otherwise, false. + */ + safariMacOS: boolean; + /** + * Gets a value that specifies whether the client browser is Google Chrome. + * Value: true if the client browser is Google Chrome; otherwise, false. + */ + chrome: boolean; + /** + * Gets a value that specifies whether the client browser is Internet Explorer. + * Value: true if the client browser is Intenet Explorer; otherwise, false. + */ + ie: boolean; + /** + * Gets a value that specifies whether the client browser is Internet Explorer version 7. + * Value: true if the client browser is Intenet Explorer version 7; otherwise, false. + */ + ie7: boolean; + /** + * Gets a value that specifies whether the client browser is Firefox. + * Value: true if the client browser is Firefox; otherwise, false. + */ + firefox: boolean; + /** + * Gets a value that specifies whether the client browser is Firefox version 3. + * Value: true if the client browser is Firefox version 3; otherwise, false. + */ + firefox3: boolean; + /** + * Gets a value that specifies whether the client browser is Mozilla. + * Value: true if the client browser is Mozilla; otherwise, false. + */ + mozilla: boolean; + /** + * Gets a value that specifies whether the client browser is Netscape. + * Value: true if the client browser is Netscape; otherwise, false. + */ + netscape: boolean; + /** + * Gets a value that specifies a client browser's full version. + * Value: A double precision floating-point value that specifies a client browser's version. + */ + browserVersion: number; + /** + * Gets a value that specifies a client browser's major version. + * Value: An integer value that specifies a client browser's major version. + */ + browserMajorVersion: number; + /** + * Gets a value that specifies whether the application is run under a MacOS platform. + * Value: true if the application is run under the MacOS platform; otherwise, false. + */ + macOSPlatform: boolean; + /** + * Gets a value that specifies whether the application is run under the Windows platform. + * Value: true if the application is run under the Windows platform; otherwise, false. + */ + windowsPlatform: boolean; + /** + * Gets a value that specifies whether a client browser is based on WebKit. + * Value: true if the client browser is based on WebKit; otherwise, false. + */ + webKitFamily: boolean; + /** + * Gets a value that specifies whether a client browser is based on Netscape. + * Value: true if client browser is based on Netscape; otherwise, false. + */ + netscapeFamily: boolean; + /** + * Gets a value that specifies whether the client browser supports touch. + * Value: true if the client browser supports touch; otherwise, false. + */ + touchUI: boolean; + /** + * Gets a value that specifies whether the client browser supports the WebKit touch user interface. + * Value: true if the client browser supports the WebKit touch user interface; otherwise, false. + */ + webKitTouchUI: boolean; + /** + * Gets a value that specifies whether the client browser supports the Microsoft touch user interface. + * Value: true if the client browser supports the Microsoft touch user interface; otherwise, false. + */ + msTouchUI: boolean; + /** + * Gets a value that specifies whether the application is run under an iOS platform. + * Value: true if the application is run under the iOS platform; otherwise, false. + */ + iOSPlatform: boolean; + /** + * Gets a value that specifies whether the application is run under the Android platform. + * Value: true if the application is run under the Android platform; otherwise, false. + */ + androidPlatform: boolean; + /** + * Inserts the specified item into the specified array object. + * @param array An object that specifies the array to manipulate. + * @param element An object that specifies the array item to insert. + */ + ArrayInsert(array: Object[], element: Object): void; + /** + * Removes the specified item from the specified array object. + * @param array An object that specifies the array to manipulate. + * @param element An object that specifies the array item to remove. + */ + ArrayRemove(array: Object[], element: Object): void; + /** + * Removes an item at the specified index location from the specified array object. + * @param array An object that specifies the array to manipulate. + * @param index The zero-based index location of the array item to remove. + */ + ArrayRemoveAt(array: Object[], index: number): void; + /** + * Removes all items from the specified array object. + * @param array An object that specifies the array to manipulate. + */ + ArrayClear(array: Object[]): void; + /** + * Searches for the specified array item and returns the zero-based index of its first occurrence within the specified array object. + * @param array An object that specifies the array to manipulate. + * @param element An object that specifies the array item to locate. + */ + ArrayIndexOf(array: Object[], element: Object): number; + /** + * Binds the specified function to a specific element's event, so that the function gets called whenever the event fires on the element. + * @param element An object specifying the required element. + * @param eventName A string value that specifies the required event name without the "on" prefix. + * @param method An object that specifies the event's handling function. + */ + AttachEventToElement(element: Object, eventName: string, method: Object): void; + /** + * Unbinds the specified function from a specific element's event, so that the function stops receiving notifications when the event fires. + * @param element An object specifying the required element. + * @param eventName A string value that specifies the required event name. + * @param method An object that specifies the event's handling function. + */ + DetachEventFromElement(element: Object, eventName: string, method: Object): void; + /** + * Returns the object that fired the event. + * @param htmlEvent An object that represents the current event. + */ + GetEventSource(htmlEvent: Object): Object; + /** + * Gets the x-coordinate of the event-related mouse pointer position relative to an end-user's screen. + * @param htmlEvent An object specifying the required HTML event. + */ + GetEventX(htmlEvent: Object): number; + /** + * Gets the y-coordinate of the event-related mouse pointer position relative to an end-user's screen. + * @param htmlEvent An object specifying the required HTML event. + */ + GetEventY(htmlEvent: Object): number; + /** + * Gets the keyboard code for the specified event. + * @param htmlEvent An object specifying the required HTML event. + */ + GetKeyCode(htmlEvent: Object): number; + /** + * Cancels the default action of the specified event. + * @param htmlEvent An object that specifies the required HTML event. + */ + PreventEvent(htmlEvent: Object): boolean; + /** + * Cancels both the specified event's default action and the event's bubbling upon the hierarchy of event handlers. + * @param htmlEvent An object that specifies the required HTML event. + */ + PreventEventAndBubble(htmlEvent: Object): boolean; + /** + * Removes mouse capture from the specified event's source object. + * @param htmlEvent An object that specifies the required HTML event. + */ + PreventDragStart(htmlEvent: Object): boolean; + /** + * Clears any text selection made within the window's client region. + */ + ClearSelection(): void; + /** + * Gets a value that indicates whether the specified object exists on the client side. + * @param obj The object to test. + */ + IsExists(obj: Object): boolean; + /** + * Gets a value that indicates whether the specified object is a function. + * @param obj The object to test. + */ + IsFunction(obj: Object): boolean; + /** + * Gets the x-coordinate of the specified element's top left corner relative to the client area of the window, excluding scroll bars. + * @param element An object identifying the HTML element whose position should be obtained. + */ + GetAbsoluteX(element: Object): number; + /** + * Gets the y-coordinate of the specified element's top left corner relative to the client area of the window, excluding scroll bars. + * @param element An object identifying the HTML element whose position should be obtained. + */ + GetAbsoluteY(element: Object): number; + /** + * Sets the x-coordinate of the specified element's top left corner relative to the client area of the window, excluding scroll bars. + * @param element An object identifying the HTML element whose position should be defined. + * @param x An integer value specifying the required element's x-coordinate, in pixels. + */ + SetAbsoluteX(element: Object, x: number): void; + /** + * Sets the y-coordinate of the specified element's top left corner relative to the client area of the window, excluding scroll bars. + * @param element An object identifying the HTML element whose position should be defined. + * @param y An integer value specifying the required element's y-coordinate, in pixels. + */ + SetAbsoluteY(element: Object, y: number): void; + /** + * Returns the distance between the top edge of the document and the topmost portion of the content currently visible in the window. + */ + GetDocumentScrollTop(): number; + /** + * Returns the distance between the left edge of the document and the leftmost portion of the content currently visible in the window. + */ + GetDocumentScrollLeft(): number; + /** + * Gets the width of the window's client region. + */ + GetDocumentClientWidth(): number; + /** + * Gets the height of the window's client region. + */ + GetDocumentClientHeight(): number; + /** + * Gets a value indicating whether the object passed via the parentElement parameter is a parent of the object passed via the element parameter. + * @param parentElement An object specifying the parent HTML element. + * @param element An object specifying the child HTML element. + */ + GetIsParent(parentElement: Object, element: Object): boolean; + /** + * Returns a reference to the specified HTML element's first parent object which has an ID that matches the specified value. + * @param element An object specifying the child HTML element whose parent elements are searched. + * @param id A string specifying the required parent's ID. + */ + GetParentById(element: Object, id: string): Object; + /** + * Returns a reference to the specified HTML element's first parent object whose element name matches the specified value. + * @param element An object specifying the child HTML element whose parent elements are searched. + * @param tagName A string value specifying the element name (tag name) of the desired HTML element. + */ + GetParentByTagName(element: Object, tagName: string): Object; + /** + * Returns a reference to the specified HTML element's first parent object whose class name matches the specified value. + * @param element An object specifying the child HTML element whose parent elements are searched. + * @param className A string value specifying the class name of the desired HTML element. + */ + GetParentByClassName(element: Object, className: string): Object; + /** + * Returns a reference to the first element that has the specified ID in the parent HTML element specified. + * @param element An object identifying the parent HTML element to search. + * @param id A string specifying the ID attribute value of the desired child element. + */ + GetChildById(element: Object, id: string): Object; + /** + * Returns a reference to the particular element that has the specified element name and is contained within the specified parent HTML element. + * @param element An object specifying the parent HTML element to search. + * @param tagName A string value specifying the element name (tag name) of the desired HTML element. + * @param index An integer value specifying the zero-based index of the desired element amongst all the matching elements found. + */ + GetChildByTagName(element: Object, tagName: string, index: number): Object; + /** + * Creates or updates the HTTP cookie for the response. + * @param name A string value that represents the name of a cookie. + * @param value A string representing the cookie value. + */ + SetCookie(name: string, value: string): void; + /** + * Creates or updates the HTTP cookie for the response. + * @param name A string value that represents the name of a cookie. + * @param value A string representing the cookie value. + * @param expirationDate A date-time object that represents the expiration date and time for the cookie. + */ + SetCookie(name: string, value: string, expirationDate: Date): void; + /** + * Retrieves a cookie with the specified name. + * @param name A string value that represents the name of a cookie. + */ + GetCookie(name: string): string; + /** + * Deletes a cookie with the specified name. + * @param name A string value that represents the name of a cookie. + */ + DeleteCookie(name: string): void; + /** + * Returns a specifically generated code that uniquely identifies the combination of keys specified via the parameters. + * @param keyCode An integer value that specifies the code of the key. + * @param isCtrlKey true if the CTRL key should be included into the key combination; otherwise, false. + * @param isShiftKey true if the SHIFT key should be included into the key combination; otherwise, false. + * @param isAltKey true if the ALT key should be included into the key combination; otherwise, false. + */ + GetShortcutCode(keyCode: number, isCtrlKey: boolean, isShiftKey: boolean, isAltKey: boolean): number; + /** + * Returns a specifically generated code that uniquely identifies the pressed key combination, which is specified by the related HTML event. + * @param htmlEvent A DHTML event object that relates to a key combination being pressed. + */ + GetShortcutCodeByEvent(htmlEvent: Object): number; + /** + * Returns a specifically generated code that uniquely identifies the combination of keys specified via the parameter. + * @param shortcutString A string value that specifies the key combination. + */ + StringToShortcutCode(shortcutString: string): number; + /** + * Trims all leading and trailing whitespaces from the string. + * @param str A string value representing the string for trimming. + */ + Trim(str: string): string; + /** + * Trims all leading whitespaces from the string. + * @param str A string value representing the string for trimming. + */ + TrimStart(str: string): string; + /** + * Trims all trailing whitespaces from the string. + * @param str A string value representing the string for trimming. + */ + TrimEnd(str: string): string; + /** + * Specifies the text that Assistive Technologies (screen readers or braille display, for example) will provide to a user. + * @param message A String value that specifies a text. + */ + SendMessageToAssistiveTechnology(message: string): void; +} +interface ASPxClientChartDesignerStatic 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): ASPxClientChartDesigner; +} +interface ASPxClientWebChartControlStatic 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): ASPxClientWebChartControl; +} +interface ASPxClientDocumentViewerStatic 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): ASPxClientDocumentViewer; +} +interface ASPxClientQueryBuilderStatic 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): ASPxClientQueryBuilder; +} +interface ASPxClientReportDesignerStatic 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): ASPxClientReportDesigner; +} +interface ASPxClientReportDocumentMapStatic extends ASPxClientControlStatic { +} +interface ASPxClientReportParametersPanelStatic extends ASPxClientControlStatic { +} +interface ASPxClientReportToolbarStatic 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): ASPxClientReportToolbar; +} +interface ASPxClientReportViewerStatic 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): ASPxClientReportViewer; +} +interface ASPxClientWebDocumentViewerStatic 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): ASPxClientWebDocumentViewer; +} + +declare var MVCxClientDashboardViewer: MVCxClientDashboardViewerStatic; +declare var DashboardDataAxisNames: DashboardDataAxisNamesStatic; +declare var DashboardSpecialValues: DashboardSpecialValuesStatic; +declare var DashboardExportPageLayout: DashboardExportPageLayoutStatic; +declare var DashboardExportPaperKind: DashboardExportPaperKindStatic; +declare var DashboardExportScaleMode: DashboardExportScaleModeStatic; +declare var DashboardExportFilterState: DashboardExportFilterStateStatic; +declare var DashboardExportImageFormat: DashboardExportImageFormatStatic; +declare var DashboardExportExcelFormat: DashboardExportExcelFormatStatic; +declare var ChartExportSizeMode: ChartExportSizeModeStatic; +declare var MapExportSizeMode: MapExportSizeModeStatic; +declare var RangeFilterExportSizeMode: RangeFilterExportSizeModeStatic; +declare var DashboardSelectionMode: DashboardSelectionModeStatic; +declare var ASPxClientDashboard: ASPxClientDashboardStatic; +declare var ASPxClientDashboardViewer: ASPxClientDashboardViewerStatic; +declare var ASPxClientEditBase: ASPxClientEditBaseStatic; +declare var ASPxClientEdit: ASPxClientEditStatic; +declare var ASPxClientBinaryImage: ASPxClientBinaryImageStatic; +declare var ASPxClientButton: ASPxClientButtonStatic; +declare var ASPxClientCalendar: ASPxClientCalendarStatic; +declare var ASPxClientCaptcha: ASPxClientCaptchaStatic; +declare var ASPxClientCheckBox: ASPxClientCheckBoxStatic; +declare var ASPxClientRadioButton: ASPxClientRadioButtonStatic; +declare var ASPxClientTextEdit: ASPxClientTextEditStatic; +declare var ASPxClientTextBoxBase: ASPxClientTextBoxBaseStatic; +declare var ASPxClientButtonEditBase: ASPxClientButtonEditBaseStatic; +declare var ASPxClientDropDownEditBase: ASPxClientDropDownEditBaseStatic; +declare var ASPxClientColorEdit: ASPxClientColorEditStatic; +declare var ASPxClientComboBox: ASPxClientComboBoxStatic; +declare var ASPxClientDateEdit: ASPxClientDateEditStatic; +declare var ASPxClientDropDownEdit: ASPxClientDropDownEditStatic; +declare var ASPxClientFilterControl: ASPxClientFilterControlStatic; +declare var ASPxClientListEdit: ASPxClientListEditStatic; +declare var ASPxClientListBox: ASPxClientListBoxStatic; +declare var ASPxClientCheckListBase: ASPxClientCheckListBaseStatic; +declare var ASPxClientRadioButtonList: ASPxClientRadioButtonListStatic; +declare var ASPxClientCheckBoxList: ASPxClientCheckBoxListStatic; +declare var ASPxClientProgressBar: ASPxClientProgressBarStatic; +declare var ASPxClientSpinEditBase: ASPxClientSpinEditBaseStatic; +declare var ASPxClientSpinEdit: ASPxClientSpinEditStatic; +declare var ASPxClientTimeEdit: ASPxClientTimeEditStatic; +declare var ASPxClientStaticEdit: ASPxClientStaticEditStatic; +declare var ASPxClientHyperLink: ASPxClientHyperLinkStatic; +declare var ASPxClientImageBase: ASPxClientImageBaseStatic; +declare var ASPxClientImage: ASPxClientImageStatic; +declare var ASPxClientLabel: ASPxClientLabelStatic; +declare var ASPxClientTextBox: ASPxClientTextBoxStatic; +declare var ASPxClientMemo: ASPxClientMemoStatic; +declare var ASPxClientButtonEdit: ASPxClientButtonEditStatic; +declare var ASPxClientTokenBox: ASPxClientTokenBoxStatic; +declare var ASPxClientTrackBar: ASPxClientTrackBarStatic; +declare var ASPxClientValidationSummary: ASPxClientValidationSummaryStatic; +declare var ASPxClientGaugeControl: ASPxClientGaugeControlStatic; +declare var ASPxClientGridBase: ASPxClientGridBaseStatic; +declare var ASPxClientGridViewCallbackCommand: ASPxClientGridViewCallbackCommandStatic; +declare var ASPxClientGridLookup: ASPxClientGridLookupStatic; +declare var ASPxClientCardView: ASPxClientCardViewStatic; +declare var ASPxClientGridView: ASPxClientGridViewStatic; +declare var ASPxClientVerticalGrid: ASPxClientVerticalGridStatic; +declare var ASPxClientVerticalGridCallbackCommand: ASPxClientVerticalGridCallbackCommandStatic; +declare var ASPxClientCommandConsts: ASPxClientCommandConstsStatic; +declare var ASPxClientHtmlEditor: ASPxClientHtmlEditorStatic; +declare var ASPxClientHtmlEditorMediaPreloadMode: ASPxClientHtmlEditorMediaPreloadModeStatic; +declare var ASPxClientPivotGrid: ASPxClientPivotGridStatic; +declare var ASPxClientPivotCustomization: ASPxClientPivotCustomizationStatic; +declare var ASPxClientRichEdit: ASPxClientRichEditStatic; +declare var ASPxSchedulerDateTimeHelper: ASPxSchedulerDateTimeHelperStatic; +declare var ASPxClientWeekDaysCheckEdit: ASPxClientWeekDaysCheckEditStatic; +declare var ASPxClientRecurrenceRangeControl: ASPxClientRecurrenceRangeControlStatic; +declare var ASPxClientRecurrenceControlBase: ASPxClientRecurrenceControlBaseStatic; +declare var ASPxClientDailyRecurrenceControl: ASPxClientDailyRecurrenceControlStatic; +declare var ASPxClientWeeklyRecurrenceControl: ASPxClientWeeklyRecurrenceControlStatic; +declare var ASPxClientMonthlyRecurrenceControl: ASPxClientMonthlyRecurrenceControlStatic; +declare var ASPxClientYearlyRecurrenceControl: ASPxClientYearlyRecurrenceControlStatic; +declare var ASPxClientRecurrenceTypeEdit: ASPxClientRecurrenceTypeEditStatic; +declare var ASPxClientTimeInterval: ASPxClientTimeIntervalStatic; +declare var ASPxClientScheduler: ASPxClientSchedulerStatic; +declare var ASPxClientSpellChecker: ASPxClientSpellCheckerStatic; +declare var ASPxClientSpellCheckerStopCheckingReason: ASPxClientSpellCheckerStopCheckingReasonStatic; +declare var ASPxClientSpreadsheet: ASPxClientSpreadsheetStatic; +declare var ASPxClientTreeList: ASPxClientTreeListStatic; +declare var BootstrapClientAccordion: BootstrapClientAccordionStatic; +declare var BootstrapClientButton: BootstrapClientButtonStatic; +declare var BootstrapClientCalendar: BootstrapClientCalendarStatic; +declare var BootstrapClientCheckBox: BootstrapClientCheckBoxStatic; +declare var BootstrapClientRadioButton: BootstrapClientRadioButtonStatic; +declare var BootstrapClientComboBox: BootstrapClientComboBoxStatic; +declare var BootstrapClientDateEdit: BootstrapClientDateEditStatic; +declare var BootstrapClientDropDownEdit: BootstrapClientDropDownEditStatic; +declare var BootstrapClientFormLayout: BootstrapClientFormLayoutStatic; +declare var BootstrapClientGridView: BootstrapClientGridViewStatic; +declare var BootstrapClientHyperLink: BootstrapClientHyperLinkStatic; +declare var BootstrapClientListBox: BootstrapClientListBoxStatic; +declare var BootstrapClientCheckBoxList: BootstrapClientCheckBoxListStatic; +declare var BootstrapClientRadioButtonList: BootstrapClientRadioButtonListStatic; +declare var BootstrapClientMenu: BootstrapClientMenuStatic; +declare var BootstrapClientPopupControl: BootstrapClientPopupControlStatic; +declare var BootstrapClientPopupMenu: BootstrapClientPopupMenuStatic; +declare var BootstrapClientProgressBar: BootstrapClientProgressBarStatic; +declare var BootstrapClientSpinEdit: BootstrapClientSpinEditStatic; +declare var BootstrapClientTabControl: BootstrapClientTabControlStatic; +declare var BootstrapClientPageControl: BootstrapClientPageControlStatic; +declare var BootstrapClientTextBox: BootstrapClientTextBoxStatic; +declare var BootstrapClientMemo: BootstrapClientMemoStatic; +declare var BootstrapClientButtonEdit: BootstrapClientButtonEditStatic; +declare var BootstrapClientTreeView: BootstrapClientTreeViewStatic; +declare var MVCxClientCalendar: MVCxClientCalendarStatic; +declare var MVCxClientCallbackPanel: MVCxClientCallbackPanelStatic; +declare var MVCxClientCardView: MVCxClientCardViewStatic; +declare var MVCxClientChart: MVCxClientChartStatic; +declare var MVCxClientComboBox: MVCxClientComboBoxStatic; +declare var MVCxClientDataView: MVCxClientDataViewStatic; +declare var MVCxClientDateEdit: MVCxClientDateEditStatic; +declare var MVCxClientDockManager: MVCxClientDockManagerStatic; +declare var MVCxClientDockPanel: MVCxClientDockPanelStatic; +declare var MVCxClientFileManager: MVCxClientFileManagerStatic; +declare var MVCxClientGridView: MVCxClientGridViewStatic; +declare var MVCxClientHtmlEditor: MVCxClientHtmlEditorStatic; +declare var MVCxClientImageGallery: MVCxClientImageGalleryStatic; +declare var MVCxClientListBox: MVCxClientListBoxStatic; +declare var MVCxClientNavBar: MVCxClientNavBarStatic; +declare var MVCxClientPivotGrid: MVCxClientPivotGridStatic; +declare var MVCxClientPopupControl: MVCxClientPopupControlStatic; +declare var MVCxClientDocumentViewer: MVCxClientDocumentViewerStatic; +declare var MVCxClientReportViewer: MVCxClientReportViewerStatic; +declare var MVCxClientReportDesigner: MVCxClientReportDesignerStatic; +declare var MVCxClientRichEdit: MVCxClientRichEditStatic; +declare var MVCxClientRoundPanel: MVCxClientRoundPanelStatic; +declare var MVCxClientScheduler: MVCxClientSchedulerStatic; +declare var MVCxSchedulerToolTipType: MVCxSchedulerToolTipTypeStatic; +declare var MVCxClientSpreadsheet: MVCxClientSpreadsheetStatic; +declare var MVCxClientPageControl: MVCxClientPageControlStatic; +declare var MVCxClientTokenBox: MVCxClientTokenBoxStatic; +declare var MVCxClientTreeList: MVCxClientTreeListStatic; +declare var MVCxClientTreeView: MVCxClientTreeViewStatic; +declare var MVCxClientUploadControl: MVCxClientUploadControlStatic; +declare var MVCxClientUtils: MVCxClientUtilsStatic; +declare var MVCxClientGlobalEvents: MVCxClientGlobalEventsStatic; +declare var MVCxClientVerticalGrid: MVCxClientVerticalGridStatic; +declare var MVCxClientWebDocumentViewer: MVCxClientWebDocumentViewerStatic; +declare var ASPxClientControlBase: ASPxClientControlBaseStatic; +declare var ASPxClientControl: ASPxClientControlStatic; +declare var ASPxClientCallback: ASPxClientCallbackStatic; +declare var ASPxClientPanelBase: ASPxClientPanelBaseStatic; +declare var ASPxClientPanel: ASPxClientPanelStatic; +declare var ASPxClientCallbackPanel: ASPxClientCallbackPanelStatic; +declare var ASPxClientCloudControl: ASPxClientCloudControlStatic; +declare var ASPxClientDataView: ASPxClientDataViewStatic; +declare var ASPxClientDockManager: ASPxClientDockManagerStatic; +declare var ASPxClientPopupControlBase: ASPxClientPopupControlBaseStatic; +declare var ASPxClientDockPanel: ASPxClientDockPanelStatic; +declare var ASPxClientDockZone: ASPxClientDockZoneStatic; +declare var ASPxClientFileManager: ASPxClientFileManagerStatic; +declare var ASPxClientFileManagerCommandConsts: ASPxClientFileManagerCommandConstsStatic; +declare var ASPxClientFileManagerErrorConsts: ASPxClientFileManagerErrorConstsStatic; +declare var ASPxClientFormLayout: ASPxClientFormLayoutStatic; +declare var ASPxClientHiddenField: ASPxClientHiddenFieldStatic; +declare var ASPxClientImageGallery: ASPxClientImageGalleryStatic; +declare var ASPxClientImageSlider: ASPxClientImageSliderStatic; +declare var ASPxClientImageZoomNavigator: ASPxClientImageZoomNavigatorStatic; +declare var ASPxClientImageZoom: ASPxClientImageZoomStatic; +declare var ASPxClientLoadingPanel: ASPxClientLoadingPanelStatic; +declare var ASPxClientMenuBase: ASPxClientMenuBaseStatic; +declare var ASPxClientMenu: ASPxClientMenuStatic; +declare var ASPxClientTouchUI: ASPxClientTouchUIStatic; +declare var ASPxClientNavBar: ASPxClientNavBarStatic; +declare var ASPxClientNewsControl: ASPxClientNewsControlStatic; +declare var ASPxClientObjectContainer: ASPxClientObjectContainerStatic; +declare var ASPxClientPager: ASPxClientPagerStatic; +declare var ASPxClientPopupControl: ASPxClientPopupControlStatic; +declare var ASPxClientPopupControlResizeState: ASPxClientPopupControlResizeStateStatic; +declare var ASPxClientPopupControlCloseReason: ASPxClientPopupControlCloseReasonStatic; +declare var ASPxClientPopupMenu: ASPxClientPopupMenuStatic; +declare var ASPxClientRatingControl: ASPxClientRatingControlStatic; +declare var ASPxClientRibbon: ASPxClientRibbonStatic; +declare var ASPxClientRibbonState: ASPxClientRibbonStateStatic; +declare var ASPxClientRoundPanel: ASPxClientRoundPanelStatic; +declare var ASPxClientSplitter: ASPxClientSplitterStatic; +declare var ASPxClientTabControlBase: ASPxClientTabControlBaseStatic; +declare var ASPxClientTabControl: ASPxClientTabControlStatic; +declare var ASPxClientPageControl: ASPxClientPageControlStatic; +declare var ASPxClientTimer: ASPxClientTimerStatic; +declare var ASPxClientTitleIndex: ASPxClientTitleIndexStatic; +declare var ASPxClientTreeView: ASPxClientTreeViewStatic; +declare var ASPxClientUploadControl: ASPxClientUploadControlStatic; +declare var ASPxClientUtils: ASPxClientUtilsStatic; +declare var ASPxClientChartDesigner: ASPxClientChartDesignerStatic; +declare var ASPxClientWebChartControl: ASPxClientWebChartControlStatic; +declare var ASPxClientDocumentViewer: ASPxClientDocumentViewerStatic; +declare var ASPxClientQueryBuilder: ASPxClientQueryBuilderStatic; +declare var ASPxClientReportDesigner: ASPxClientReportDesignerStatic; +declare var ASPxClientReportDocumentMap: ASPxClientReportDocumentMapStatic; +declare var ASPxClientReportParametersPanel: ASPxClientReportParametersPanelStatic; +declare var ASPxClientReportToolbar: ASPxClientReportToolbarStatic; +declare var ASPxClientReportViewer: ASPxClientReportViewerStatic; +declare var ASPxClientWebDocumentViewer: ASPxClientWebDocumentViewerStatic; + diff --git a/types/devexpress-web/v162/tsconfig.json b/types/devexpress-web/v162/tsconfig.json new file mode 100644 index 0000000000..7014b0435c --- /dev/null +++ b/types/devexpress-web/v162/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "devexpress-web": ["devexpress-web/v162"], + "devexpress-web/*": ["devexpress-web/v162/*"] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "devexpress-web-tests.ts" + ] +} \ No newline at end of file diff --git a/types/diff/diff-tests.ts b/types/diff/diff-tests.ts index 36edef83b3..e1b1025495 100644 --- a/types/diff/diff-tests.ts +++ b/types/diff/diff-tests.ts @@ -1,13 +1,11 @@ - - +// tslint:disable:no-var only-arrow-functions import jsdiff = require('diff'); - var one = 'beep boop'; var other = 'beep boob blah'; var diff = jsdiff.diffChars(one, other); -diff.forEach(function (part) { +diff.forEach(function(part) { var mark = part.added ? '+' : part.removed ? '-' : ' '; console.log(mark + " " + part.value); @@ -16,11 +14,11 @@ diff.forEach(function (part) { // -------------------------- class LineDiffWithoutWhitespace extends jsdiff.Diff { - tokenize(value:string):any { + tokenize(value: string): any { return value.split(/^/m); } - equals(left:string, right:string):boolean { + equals(left: string, right: string): boolean { return left.trim() === right.trim(); } } @@ -29,8 +27,8 @@ var obj = new LineDiffWithoutWhitespace(true); var diff = obj.diff(one, other); printDiff(diff); -function printDiff(diff:jsdiff.IDiffResult[]) { - function addLineHeader(decorator:string, str:string) { +function printDiff(diff: jsdiff.IDiffResult[]) { + function addLineHeader(decorator: string, str: string) { return str.split("\n").map((line, index, array) => { if (index === array.length - 1 && line === "") { return line; @@ -40,7 +38,7 @@ function printDiff(diff:jsdiff.IDiffResult[]) { }).join("\n"); } - diff.forEach((part)=> { + diff.forEach((part) => { if (part.added) { console.log(addLineHeader("+", part.value)); } else if (part.removed) { diff --git a/types/diff/index.d.ts b/types/diff/index.d.ts index 102305ce70..03228269e0 100644 --- a/types/diff/index.d.ts +++ b/types/diff/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for diff +// Type definitions for diff 3.2 // Project: https://github.com/kpdecker/jsdiff // Definitions by: vvakame // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 export = JsDiff; export as namespace JsDiff; @@ -36,34 +37,37 @@ declare namespace JsDiff { } class Diff { - ignoreWhitespace:boolean; + ignoreWhitespace: boolean; - constructor(ignoreWhitespace?:boolean); + constructor(ignoreWhitespace?: boolean); - diff(oldString:string, newString:string):IDiffResult[]; + diff(oldString: string, newString: string): IDiffResult[]; - pushComponent(components:IDiffResult[], value:string, added:boolean, removed:boolean):void; + pushComponent(components: IDiffResult[], value: string, added: boolean, removed: boolean): void; - extractCommon(basePath:IBestPath, newString:string, oldString:string, diagonalPath:number):number; + extractCommon(basePath: IBestPath, newString: string, oldString: string, diagonalPath: number): number; - equals(left:string, right:string):boolean; + equals(left: string, right: string): boolean; - join(left:string, right:string):string; + join(left: string, right: string): string; - tokenize(value:string):any; // return types are string or string[] + tokenize(value: string): any; // return types are string or string[] } - function diffChars(oldStr:string, newStr:string):IDiffResult[]; + function diffChars(oldStr: string, newStr: string): IDiffResult[]; - function diffWords(oldStr:string, newStr:string):IDiffResult[]; + function diffWords(oldStr: string, newStr: string): IDiffResult[]; - function diffWordsWithSpace(oldStr:string, newStr:string):IDiffResult[]; + function diffWordsWithSpace(oldStr: string, newStr: string): IDiffResult[]; - function diffJson(oldObj: Object, newObj: Object): IDiffResult[]; + function diffJson(oldObj: object, newObj: object): IDiffResult[]; - function diffLines(oldStr:string, newStr:string):IDiffResult[]; + function diffLines(oldStr: string, newStr: string, options?: { + ignoreWhitespace?: boolean, + newlineIsToken?: boolean, + }): IDiffResult[]; - function diffCss(oldStr:string, newStr:string):IDiffResult[]; + function diffCss(oldStr: string, newStr: string): IDiffResult[]; function createPatch(fileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string; @@ -74,14 +78,14 @@ declare namespace JsDiff { function applyPatch(oldStr: string, uniDiff: string | IUniDiff | IUniDiff[]): string; function applyPatches(uniDiff: IUniDiff[], options: { - loadFile: (index: number, callback: (err: Error, data: string) => void) => void, - patched: (index: number, content: string) => void, - complete: (err?: Error) => void + loadFile(index: number, callback: (err: Error, data: string) => void): void, + patched(index: number, content: string): void, + complete(err?: Error): void }): void; function parsePatch(diffStr: string, options?: {strict: boolean}): IUniDiff[]; - function convertChangesToXML(changes:IDiffResult[]):string; + function convertChangesToXML(changes: IDiffResult[]): string; - function convertChangesToDMP(changes:IDiffResult[]):{0: number; 1:string;}[]; + function convertChangesToDMP(changes: IDiffResult[]): Array<{0: number; 1: string; }>; } diff --git a/types/diff/tslint.json b/types/diff/tslint.json new file mode 100644 index 0000000000..1b7b2672e6 --- /dev/null +++ b/types/diff/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "interface-name": false, + "export-just-namespace": false + } +} diff --git a/types/dockerode/dockerode-tests.ts b/types/dockerode/dockerode-tests.ts index 4b4e406839..8dd9a380de 100644 --- a/types/dockerode/dockerode-tests.ts +++ b/types/dockerode/dockerode-tests.ts @@ -24,6 +24,25 @@ const docker6 = new Docker({ key: 'key' }); +const docker7 = new Docker({ + Promise +}); + +async function foo() { + const containers = await docker7.listContainers(); + for (const container of containers) { + const foo = await docker7.getContainer(container.Id); + const inspect = await foo.inspect(); + } + + const images = await docker5.listImages(); + for (const image of images) { + const foo = await docker5.getImage(image.Id); + const inspect = await foo.inspect(); + await foo.remove(); + } +} + const container = docker.getContainer('container-id'); container.inspect((err, data) => { // NOOP @@ -47,6 +66,10 @@ docker.listContainers((err, containers) => { }); }); +docker.listContainers().then(containers => { + return containers.map(container => docker.getContainer(container.Id)); +}); + docker.buildImage('archive.tar', { t: 'imageName' }, (err, response) => { // NOOP }); diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index 2e834f0b3b..a4a1144872 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -12,69 +12,93 @@ declare namespace Dockerode { interface Container { inspect(options: {}, callback: Callback): void; inspect(callback: Callback): void; - inspect(options?: {}): { id: string }; + inspect(options?: {}): Promise; rename(options: {}, callback: Callback): void; + rename(options: {}): Promise; update(options: {}, callback: Callback): void; + update(options: {}): Promise; top(options: {}, callback: Callback): void; top(callback: Callback): void; + top(options?: {}): Promise; changes(callback: Callback): void; + changes(): Promise; export(callback: Callback): void; + export(): Promise; start(options: {}, callback: Callback): void; start(callback: Callback): void; + start(options?: {}): Promise; pause(options: {}, callback: Callback): void; pause(callback: Callback): void; + pause(options?: {}): Promise; unpause(options: {}, callback: Callback): void; unpause(callback: Callback): void; + unpause(options?: {}): Promise; exec(options: {}, callback: Callback): void; + exec(options: {}): Promise; commit(options: {}, callback: Callback): void; commit(callback: Callback): void; + commit(options?: {}): Promise; stop(options: {}, callback: Callback): void; stop(callback: Callback): void; + stop(options?: {}): Promise; restart(options: {}, callback: Callback): void; restart(callback: Callback): void; + restart(options?: {}): Promise; kill(options: {}, callback: Callback): void; kill(callback: Callback): void; + kill(options?: {}): Promise; resize(options: {}, callback: Callback): void; resize(callback: Callback): void; + resize(options?: {}): Promise; wait(callback: Callback): void; + wait(): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; + remove(options?: {}): Promise; /** Deprecated since RAPI v1.20 */ copy(options: {}, callback: Callback): void; /** Deprecated since RAPI v1.20 */ copy(callback: Callback): void; + /** Deprecated since RAPI v1.20 */ + copy(options?: {}): Promise; getArchive(options: {}, callback: Callback): void; + getArchive(options: {}): Promise; infoArchive(options: {}, callback: Callback): void; + infoArchive(options: {}): Promise; /** @param file Filename (will read synchronously), Buffer or stream */ putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}, callback: Callback): void; + putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}): Promise; - logs(options: { stdout?: boolean, stderr?: boolean, follow?: boolean, since?: number, details?: boolean, tail?: number, timestamps?: boolean }, callback: Callback): void; + logs(options: ContainerLogsOptions, callback: Callback): void; logs(callback: Callback): void; + logs(options?: ContainerLogsOptions): Promise; stats(options: {}, callback: Callback): void; stats(callback: Callback): void; + stats(options?: {}): Promise; attach(options: {}, callback: Callback): void; + attach(options: {}): Promise; modem: any; id?: string; @@ -82,19 +106,25 @@ declare namespace Dockerode { interface Image { inspect(callback: Callback): void; + inspect(): Promise; history(callback: Callback): void; + history(): Promise; get(callback: Callback): void; + get(): Promise; push(options: {}, callback: Callback): void; push(callback: Callback): void; + push(options?: {}): Promise; tag(options: {}, callback: Callback): void; tag(callback: Callback): void; + tag(options?: {}): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; + remove(options?: {}): Promise; modem: any; id?: string; @@ -102,9 +132,11 @@ declare namespace Dockerode { interface Volume { inspect(callback: Callback): void; + inspect(): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; + remove(options?: {}): Promise; modem: any; name?: string; @@ -112,11 +144,14 @@ declare namespace Dockerode { interface Service { inspect(callback: Callback): void; + inspect(): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; + remove(options?: {}): Promise; update(options: {}, callback: Callback): void; + update(options: {}): Promise; modem: any; id?: string; @@ -124,6 +159,7 @@ declare namespace Dockerode { interface Task { inspect(callback: Callback): void; + inspect(): Promise; modem: any; id?: string; @@ -131,6 +167,7 @@ declare namespace Dockerode { interface Node { inspect(callback: Callback): void; + inspect(): Promise; modem: any; id?: string; @@ -142,38 +179,50 @@ declare namespace Dockerode { remote: any; inspect(callback: Callback): void; + inspect(): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; + remove(options?: {}): Promise; privileges(callback: Callback): void; + privileges(): Promise; pull(options: {}, callback: Callback): void; + pull(options: {}): Promise; enable(options: {}, callback: Callback): void; enable(callback: Callback): void; + enable(options?: {}): Promise; disable(options: {}, callback: Callback): void; disable(callback: Callback): void; + disable(options?: {}): Promise; push(options: {}, callback: Callback): void; push(callback: Callback): void; + push(options?: {}): Promise; configure(options: {}, callback: Callback): void; configure(callback: Callback): void; + configure(options?: {}): Promise; upgrade(auth: any, options: {}, callback: Callback): void; upgrade(auth: any, callback: Callback): void; + upgrade(auth: any, options?: {}): Promise; } interface Secret { inspect(callback: Callback): void; + inspect(): Promise; update(options: {}, callback: Callback): void; update(callback: Callback): void; + update(options?: {}): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; + remove(options?: {}): Promise; modem: any; id?: string; @@ -181,15 +230,19 @@ declare namespace Dockerode { interface Network { inspect(callback: Callback): void; + inspect(): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; + remove(options?: {}): Promise; connect(options: {}, callback: Callback): void; connect(callback: Callback): void; + connect(options?: {}): Promise; disconnect(options: {}, callback: Callback): void; disconnect(callback: Callback): void; + disconnect(options?: {}): Promise; modem: any; id?: string; @@ -197,10 +250,13 @@ declare namespace Dockerode { interface Exec { inspect(callback: Callback): void; + inspect(): Promise; start(options: {}, callback: Callback): void; + start(options: {}): Promise; resize(options: {}, callback: Callback): void; + resize(options: {}): Promise; modem: any; id?: string; @@ -587,6 +643,7 @@ declare namespace Dockerode { key?: string; protocol?: "https" | "http"; timeout?: number; + Promise?: typeof Promise; } interface SecretVersion { @@ -719,6 +776,16 @@ declare namespace Dockerode { interface PruneNetworksInfo { NetworksDeleted: string[]; } + + interface ContainerLogsOptions { + stdout?: boolean; + stderr?: boolean; + follow?: boolean; + since?: number; + details?: boolean; + tail?: number; + timestamps?: boolean; + } } type Callback = (error?: any, result?: T) => void; @@ -727,20 +794,27 @@ declare class Dockerode { constructor(options?: Dockerode.DockerOptions); createContainer(options: Dockerode.ContainerCreateOptions, callback: Callback): void; + createContainer(options: Dockerode.ContainerCreateOptions): Promise; createImage(options: {}, callback: Callback): void; createImage(auth: any, options: {}, callback: Callback): void; + createImage(options: {}): Promise; + createImage(auth: any, options: {}): Promise; loadImage(file: string, options: {}, callback: Callback): void; loadImage(file: string, callback: Callback): void; + loadImage(file: string, options?: {}): Promise; importImage(file: string, options: {}, callback: Callback): void; importImage(file: string, callback: Callback): void; + importImage(file: string, options?: {}): Promise; checkAuth(options: any, callback: Callback): void; + checkAuth(options: any): Promise; buildImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback): void; buildImage(file: string | NodeJS.ReadableStream, callback: Callback): void; + buildImage(file: string | NodeJS.ReadableStream, options?: {}): Promise; getContainer(id: string): Dockerode.Container; @@ -764,80 +838,110 @@ declare class Dockerode { listContainers(options: {}, callback: Callback): void; listContainers(callback: Callback): void; + listContainers(options?: {}): Promise; listImages(options: {}, callback: Callback): void; listImages(callback: Callback): void; + listImages(options?: {}): Promise; listServices(options: {}, callback: Callback): void; listServices(callback: Callback): void; + listServices(options?: {}): Promise; listNodes(options: {}, callback: Callback): void; listNodes(callback: Callback): void; + listNodes(options?: {}): Promise; listTasks(options: {}, callback: Callback): void; listTasks(callback: Callback): void; + listTasks(options?: {}): Promise; listSecrets(options: {}, callback: Callback): void; listSecrets(callback: Callback): void; + listSecrets(options?: {}): Promise; listPlugins(options: {}, callback: Callback): void; listPlugins(callback: Callback): void; + listPlugins(options?: {}): Promise; listVolumes(options: {}, callback: Callback): void; listVolumes(callback: Callback): void; + listVolumes(options?: {}): Promise; listNetworks(options: {}, callback: Callback): void; listNetworks(callback: Callback): void; + listNetworks(options?: {}): Promise; createSecret(options: {}, callback: Callback): void; + createSecret(options: {}): Promise; createPlugin(options: {}, callback: Callback): void; + createPlugin(options: {}): Promise; createVolume(options: {}, callback: Callback): void; + createVolume(options: {}): Promise; createService(options: {}, callback: Callback): void; + createService(options: {}): Promise; createNetwork(options: {}, callback: Callback): void; + createNetwork(options: {}): Promise; searchImages(options: {}, callback: Callback): void; + searchImages(options: {}): Promise; pruneImages(options: {}, callback: Callback): void; pruneImages(callback: Callback): void; + pruneImages(options?: {}): Promise; pruneContainers(options: {}, callback: Callback): void; pruneContainers(callback: Callback): void; + pruneContainers(options?: {}): Promise; pruneVolumes(options: {}, callback: Callback): void; pruneVolumes(callback: Callback): void; + pruneVolumes(options?: {}): Promise; pruneNetworks(options: {}, callback: Callback): void; pruneNetworks(callback: Callback): void; + pruneNetworks(options?: {}): Promise; info(callback: Callback): void; + info(): Promise; version(callback: Callback): void; + version(): Promise; ping(callback: Callback): void; + ping(): Promise; getEvents(options: {}, callback: Callback): void; getEvents(callback: Callback): void; + getEvents(options?: {}): Promise; pull(repoTag: string, options: {}, callback: Callback, auth?: {}): Dockerode.Image; + pull(repoTag: string, options: {}, auth?: {}): Promise; run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions: {}, startOptions: {}, callback: Callback): events.EventEmitter; run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, startOptions: {}, callback: Callback): events.EventEmitter; run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, callback: Callback): events.EventEmitter; run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions: {}, callback: Callback): events.EventEmitter; + run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions?: {}, startOptions?: {}): Promise; swarmInit(options: {}, callback: Callback): void; + swarmInit(options: {}): Promise; swarmJoin(options: {}, callback: Callback): void; + swarmJoin(options: {}): Promise; swarmLeave(options: {}, callback: Callback): void; + swarmLeave(options: {}): Promise; swarmUpdate(options: {}, callback: Callback): void; + swarmUpdate(options: {}): Promise; swarmInspect(callback: Callback): void; + swarmInspect(): Promise; modem: any; } diff --git a/types/dockerode/tsconfig.json b/types/dockerode/tsconfig.json index 2a83a71968..8f360ab29a 100644 --- a/types/dockerode/tsconfig.json +++ b/types/dockerode/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "target": "es6", "module": "commonjs", "lib": [ "es6" diff --git a/types/dot/dot-tests.ts b/types/dot/dot-tests.ts index 507f63e81d..43ff610d91 100644 --- a/types/dot/dot-tests.ts +++ b/types/dot/dot-tests.ts @@ -23,6 +23,8 @@ const data = { name: "My name" }; +doT.templateSettings.varname = 'test'; + let pagefn = doT.template(pagetmpl, undefined, def); const content = pagefn(data); diff --git a/types/dot/index.d.ts b/types/dot/index.d.ts index 9ecd61b7ab..3594381fff 100644 --- a/types/dot/index.d.ts +++ b/types/dot/index.d.ts @@ -8,8 +8,8 @@ export as namespace doT; /** Version number */ export const version: string; -/** Default template settings */ -export const templateSettings: TemplateSettings; +/** Template settings */ +export let templateSettings: TemplateSettings; export type RenderFunction = (...args: any[]) => string; diff --git a/types/dottie/dottie-tests.ts b/types/dottie/dottie-tests.ts new file mode 100644 index 0000000000..35b02946eb --- /dev/null +++ b/types/dottie/dottie-tests.ts @@ -0,0 +1,22 @@ +import dottie = require('dottie'); + +dottie.memoizePath = true; + +const nestedObject = { + some: { + nested: { + value: 'a' + } + } +}; + +dottie.exists(nestedObject, 'some.nested'); +dottie.default(nestedObject, 'some.nested.value', 'b'); +dottie.get(nestedObject, 'some.nested.value'); +dottie.get(nestedObject, 'some.nested.value', 'b'); +dottie.set(nestedObject, 'some.nested.value', 'b'); +dottie.transform({ 'foo.bar': 'baz' }); +dottie.transform({ foo_bar: 'baz' }, { delimiter: '_' }); +dottie.flatten({ foo: { bar: 'baz' }}); +dottie.flatten({ foo: { bar: 'baz' }}, '_'); +dottie.paths(nestedObject); diff --git a/types/dottie/index.d.ts b/types/dottie/index.d.ts new file mode 100644 index 0000000000..1c9f601380 --- /dev/null +++ b/types/dottie/index.d.ts @@ -0,0 +1,194 @@ +// Type definitions for dottie 2.0 +// Project: https://github.com/mickhansen/dottie +// Definitions by: Dom Armstrong +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare const dottie: dottie.Dottie; +export = dottie; + +declare namespace dottie { + type DottiePath = string | string[]; + + /** + * @example: + * { + * 'foo.bar.baz': 'baz', + * 'foo.baz': 'baz', + * } + */ + interface FlatPaths { + [path: string]: any; + } + + interface SetOptions { + /** + * force overwrite defined non-object keys into objects if needed + */ + force?: boolean; + } + + interface TransformOptions { + /** + * Use a custom delimiter for path + */ + delimiter?: string; + } + + interface Dottie { + /** + * Dottie memoization flag + */ + memoizePath: boolean; + + /** + * Check path exists in object + * + * @example + * const values = { + * some: { + * key: 'foobar'; + * }, + * } + * + * dottie.exists(values, 'some.key'); // true + * dottie.exists(values, 'some.otherKey'); // false + */ + exists(obj: object, path: DottiePath): boolean; + + /** + * Gets nested value, or undefined if unreachable, or a default value if passed. + * + * @example + * const values = { + * some: { + * nested: { + * key: 'foobar'; + * } + * }, + * 'some.dot.included': { + * key: 'barfoo' + * } + * } + * + * dottie.get(values, 'some.nested.key'); // 'foobar' + * dottie.get(values, 'some.undefined.key'); // undefined + * dottie.get(values, 'some.undefined.key', 'defaultval'); // 'defaultval' + * dottie.get(values, ['some.dot.included', 'key']); // 'barfoo' + */ + get(obj: object, path: DottiePath, defaultValue?: T): T; + + /** + * Sets nested value, creates nested structure if needed + * + * @example + * dottie.set(values, 'some.nested.value', someValue); + * dottie.set(values, ['some.dot.included', 'value'], someValue); + * dottie.set(values, 'some.nested.object', someValue, { force: true }); + */ + set(obj: object, path: DottiePath, value: any, options?: SetOptions): void; + + /** + * Set the default value if path does not exist + * + * @example + * dottie.default({}, 'some.value', 'a') as MyType; // { some: { value: 'a' }} + * dottie.default({ some: { value: 'a' }}, 'some.value', 'b') as MyType; // { some: { value: 'a' }} + */ + default(obj: object, path: DottiePath, value: any): any; + + /** + * Transform object from keys with dottie notation to nested objects + * + * @example + * const values = { + * 'user.name': 'Gummy Bear', + * 'user.email': 'gummybear@candymountain.com', + * 'user.professional.title': 'King', + * 'user.professional.employer': 'Candy Mountain' + * }; + * const transformed = dottie.transform(values) as MyType; + * + * assert.deepEqual(transformed, { + * user: { + * name: 'Gummy Bear', + * email: 'gummybear@candymountain.com', + * professional: { + * title: 'King', + * employer: 'Candy Mountain' + * } + * } + * }); + * + * @example with custom delimiter + * const values = { + * 'user_name': 'Mick Hansen', + * 'user_email': 'maker@mhansen.io' + * }; + * const transformed = dottie.transform(values, { delimiter: '_' }) as MyType; + * + * assert.deepEqual(transformed, { + * user: { + * name: 'Mick Hansen', + * email: 'maker@mhansen.io' + * } + * }); + */ + transform(obj: FlatPaths, options?: TransformOptions): any; + + /** + * Opposite of transform. Flattens a nested object + * + * @example + * const values = { + * user: { + * name: 'Gummy Bear', + * email: 'gummybear@candymountain.com', + * professional: { + * title: 'King', + * employer: 'Candy Mountain' + * } + * } + * }; + * const transformed = dottie.transform(values); + * + * assert.deepEqual(transformed, { + * 'user.name': 'Gummy Bear', + * 'user.email': 'gummybear@candymountain.com', + * 'user.professional.title': 'King', + * 'user.professional.employer': 'Candy Mountain' + * }); + * + * @example with custom delimiter + * const values = { + * user: { + * name: 'Mick Hansen', + * email: 'maker@mhansen.io' + * } + * }; + * const transformed = dottie.flatten(values, '_'); + * + * assert.deepEqual(transformed, { + * 'user_name': 'Mick Hansen', + * 'user_email': 'maker@mhansen.io' + * }); + */ + flatten(obj: object, delimiter?: string): FlatPaths; + + /** + * Get paths in object + * + * @example + * const object = { + * a: 1, + * b: { + * c: 2, + * d: { e: 3 } + * } + * }; + * + * dottie.paths(object); // ["a", "b.c", "b.d.e"]; + */ + paths(obj: object): string[]; + } +} diff --git a/types/dottie/tsconfig.json b/types/dottie/tsconfig.json new file mode 100644 index 0000000000..03af0fda9b --- /dev/null +++ b/types/dottie/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dottie-tests.ts" + ] +} diff --git a/types/dottie/tslint.json b/types/dottie/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/dottie/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/draft-js/draft-js-tests.tsx b/types/draft-js/draft-js-tests.tsx index 1ac3c622a0..178db06a0e 100644 --- a/types/draft-js/draft-js-tests.tsx +++ b/types/draft-js/draft-js-tests.tsx @@ -2,24 +2,85 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; import {Map} from "immutable"; -import {Editor, EditorState, RichUtils, DefaultDraftBlockRenderMap, ContentBlock} from 'draft-js'; +import { + ContentBlock, + DefaultDraftBlockRenderMap, + Editor, + EditorState, + Modifier, + RichUtils, + SelectionState, + getDefaultKeyBinding, + ContentState, + convertFromHTML +} from 'draft-js'; + +const SPLIT_HEADER_BLOCK = 'split-header-block'; + +export type KeyName = + 'ENTER'; + +export type KeyCode = number; + +export const KEYCODES: Record = { + ENTER: 13, +}; + +type SyntheticKeyboardEvent = React.KeyboardEvent<{}>; class RichEditorExample extends React.Component<{}, { editorState: EditorState }> { constructor() { super(); - this.state = { editorState: EditorState.createEmpty() }; - } + const sampleMarkup = + 'Bold text, Italic text

    ' + + 'Example link

    ' + + ''; + const blocksFromHTML = convertFromHTML(sampleMarkup); + const state = ContentState.createFromBlockArray( + blocksFromHTML.contentBlocks, + blocksFromHTML.entityMap, + ); + + this.state = { editorState: EditorState.createWithContent(state) }; + } onChange: (editorState: EditorState) => void = (editorState: EditorState) => this.setState({ editorState }); + keyBindingFn(e: SyntheticKeyboardEvent): string { + if (e.keyCode === KEYCODES.ENTER) { + const { editorState } = this.state; + const contentState = editorState.getCurrentContent(); + const selectionState = editorState.getSelection(); + + // only split headers into header and unstyled if we press 'Enter' + // at the end of a header (without text selected) + if (selectionState.isCollapsed()) { + const endKey = selectionState.getEndKey(); + const endOffset = selectionState.getEndOffset(); + const endBlock = contentState.getBlockForKey(endKey); + if (isHeaderBlock(endBlock) && endOffset === endBlock.getText().length) { + return SPLIT_HEADER_BLOCK; + } + } + } + + return getDefaultKeyBinding(e); + } + handleKeyCommand = (command: string) => { + if (command === SPLIT_HEADER_BLOCK) { + this.onChange(this.splitHeaderToNewBlock()); + return 'handled'; + } + const {editorState} = this.state; const newState = RichUtils.handleKeyCommand(editorState, command); + if (newState) { this.onChange(newState); return "handled"; - } + } return "not-handled"; } @@ -32,6 +93,40 @@ class RichEditorExample extends React.Component<{}, { editorState: EditorState } this.onChange(RichUtils.toggleInlineStyle(this.state.editorState, inlineStyle)); } + splitHeaderToNewBlock(): EditorState { + const { editorState } = this.state; + const selection = editorState.getSelection(); + + // Add a new block after the cursor + const contentWithBlock = Modifier.splitBlock( + editorState.getCurrentContent(), + selection, + ); + + // Change the new block type to be normal 'unstyled' text, + const newBlock = contentWithBlock.getBlockAfter(selection.getEndKey()); + const contentWithUnstyledBlock = Modifier.setBlockType( + contentWithBlock, + SelectionState.createEmpty(newBlock.getKey()), + 'unstyled', + ); + + // push the new state with 'insert-characters' to preserve the undo/redo stack + const stateWithNewline = EditorState.push( + editorState, + contentWithUnstyledBlock, + 'insert-characters' + ); + + // manually move the cursor to the next line (as expected) + const nextState = EditorState.forceSelection( + stateWithNewline, + SelectionState.createEmpty(newBlock.getKey()), + ); + + return nextState; + } + render(): React.ReactElement<{}> { // If the user changes block type before entering any text, we can // either style the placeholder or hide it. Let's just hide it now. @@ -58,6 +153,7 @@ class RichEditorExample extends React.Component<{}, { editorState: EditorState } blockStyleFn={getBlockStyle} customStyleMap={styleMap} editorState={this.state.editorState} + keyBindingFn={this.keyBindingFn} handleKeyCommand={this.handleKeyCommand} onChange={this.onChange} placeholder="Tell a story..." @@ -125,6 +221,20 @@ const BLOCK_TYPES = [ { label: 'Code Block', style: 'code-block' }, ]; +const isHeaderBlock = (block: ContentBlock): boolean => { + switch (block.getType()) { + case 'header-one': + case 'header-two': + case 'header-three': + case 'header-four': + case 'header-five': + case 'header-six': { + return true; + } + default: return false; + } +} + const BlockStyleControls = (props: {editorState: EditorState, onToggle: (blockType: string) => void}) => { const {editorState} = props; const selection = editorState.getSelection(); diff --git a/types/draft-js/index.d.ts b/types/draft-js/index.d.ts index c0086319a3..2474ecf56a 100644 --- a/types/draft-js/index.d.ts +++ b/types/draft-js/index.d.ts @@ -1,6 +1,9 @@ // Type definitions for Draft.js v0.10.0 // Project: https://facebook.github.io/draft-js/ -// Definitions by: Dmitry Rogozhny , Eelco Lempsink +// Definitions by: Dmitry Rogozhny +// Eelco Lempsink +// Yale Cason +// Ryan Schwers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -27,6 +30,8 @@ declare namespace Draft { type DraftBlockRenderMap = Immutable.Map; + type EditorCommand = DraftEditorCommand | string; + /** * `DraftEditor` is the root editor component. It composes a `contentEditable` * div, and provides a wide variety of useful function props for managing the @@ -78,8 +83,7 @@ declare namespace Draft { // A function that accepts a synthetic key event and returns // the matching DraftEditorCommand constant, or null if no command should // be invoked. - keyBindingFn?(e: SyntheticKeyboardEvent): DraftEditorCommand; - keyBindingFn?(e: SyntheticKeyboardEvent): string; + keyBindingFn?(e: SyntheticKeyboardEvent): EditorCommand | null; // Set whether the `DraftEditor` component should be editable. Useful for // temporarily disabling edit behavior or allowing `DraftEditor` rendering @@ -118,9 +122,7 @@ declare namespace Draft { // Map a key command string provided by your key binding function to a // specified behavior. - handleKeyCommand?(command: DraftEditorCommand): DraftHandleValue, - handleKeyCommand?(command: string): DraftHandleValue, - + handleKeyCommand?(command: EditorCommand): DraftHandleValue, // Handle intended text insertion before the insertion occurs. This may be // useful in cases where the user has entered characters that you would like @@ -201,8 +203,7 @@ declare namespace Draft { /** * Retrieve a bound key command for the given event. */ - function getDefaultKeyBinding(e: SyntheticKeyboardEvent): DraftEditorCommand; - function getDefaultKeyBinding(e: SyntheticKeyboardEvent): string; + function getDefaultKeyBinding(e: SyntheticKeyboardEvent): DraftEditorCommand | null; } } @@ -458,7 +459,7 @@ declare namespace Draft { entityMap: { [key: string]: RawDraftEntity }; } - function convertFromHTMLtoContentBlocks(html: string, DOMBuilder?: Function, blockRenderMap?: DraftBlockRenderMap): Array; + function convertFromHTMLtoContentBlocks(html: string, DOMBuilder?: Function, blockRenderMap?: DraftBlockRenderMap): { contentBlocks: Array, entityMap: any }; function convertFromRawToDraftState(rawState: RawDraftContentState): ContentState; function convertFromDraftStateToRaw(contentState: ContentState): RawDraftContentState; } @@ -701,7 +702,7 @@ declare namespace Draft { } class ContentState extends Record { - static createFromBlockArray(blocks: Array): ContentState; + static createFromBlockArray(blocks: Array, entityMap: any): ContentState; static createFromText(text: string, delimiter?: string): ContentState; createEntity(type: DraftEntityType, mutability: DraftEntityMutability, data?: Object): ContentState; diff --git a/types/dwt/dwt-tests.ts b/types/dwt/dwt-tests.ts new file mode 100644 index 0000000000..4b201cf33d --- /dev/null +++ b/types/dwt/dwt-tests.ts @@ -0,0 +1,101 @@ +function dwtOnReady() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer' + if (DWObject) { + let count = DWObject.SourceCount; + if (count === 0) { + DWObject.CloseSourceManager(); + DWObject.ImageCaptureDriverType = 0; + DWObject.OpenSourceManager(); + count = DWObject.SourceCount; + } + } +} + +function acquireImage() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + DWObject.SelectSourceByIndex(0); // Use method SelectSourceByIndex to avoid the 'Select Source' dialog + DWObject.OpenSource(); + DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan. + DWObject.AcquireImage({}, () => {}, (errorCode: number, errorString: string) => {DWObject.CloseSource(); }); + } +} + +function registerEvent() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + // The event OnPostTransfer fires after each image is scanned and transferred + DWObject.RegisterEvent("OnPostTransfer", function () {}); + + // The event OnPostLoad fires after the images from a local directory have been loaded into the control + DWObject.RegisterEvent("OnPostLoad", function () {}); + + // The event OnMouseClick fires when the mouse clicks on an image on Dynamic Web TWAIN viewer + DWObject.RegisterEvent("OnMouseClick", function () {}); + + // The event OnTopImageInTheViewChanged fires when the top image currently displayed in the viewer changes + DWObject.RegisterEvent("OnTopImageInTheViewChanged", function (index: number) { + DWObject.CurrentImageIndexInBuffer = index; + }); + } +} + +function editImage() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + if (DWObject.HowManyImagesInBuffer > 0) + DWObject.RotateLeft(DWObject.CurrentImageIndexInBuffer); + + if (DWObject.HowManyImagesInBuffer > 0) + DWObject.RotateRight(DWObject.CurrentImageIndexInBuffer); + + if (DWObject.HowManyImagesInBuffer > 0) + DWObject.Mirror(DWObject.CurrentImageIndexInBuffer); + + if (DWObject.HowManyImagesInBuffer > 0) + DWObject.Flip(DWObject.CurrentImageIndexInBuffer); + } +} + +function showImageEditor() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + DWObject.ShowImageEditor(); + } +} + +function saveImage() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + DWObject.ConvertToGrayScale(DWObject.CurrentImageIndexInBuffer); + DWObject.SaveAsJPEG("DynamicWebTWAIN.jpg", DWObject.CurrentImageIndexInBuffer); + DWObject.SaveAllAsMultiPageTIFF("DynamicWebTWAIN.tiff", () => {}, (errorCode: number, errorString: string) => {}); + DWObject.SaveAllAsPDF("DynamicWebTWAIN.pdf", () => {}, (errorCode: number, errorString: string) => {}); + } +} + +function updateLargeViewer() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + let DWObjectLargeViewer = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainerLargeViewer'); + if (DWObject) { + DWObject.CopyToClipboard(DWObject.CurrentImageIndexInBuffer); // Copy the current image in the thumbnail to clipboard in DIB format. + DWObjectLargeViewer.LoadDibFromClipboard(); // Load the image from Clipboard into the large viewer. + } +} + +function uploadImage() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + DWObject.HTTPPort = 80; + DWObject.IfSSL = false; + DWObject.HTTPUploadThroughPost("www.dynamsoft.com", DWObject.CurrentImageIndexInBuffer, "upload", "tmp.jpg", () => {}, (errorCode: number, errorString: string) => {}); + } +} + +function downloadImage() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + DWObject.HTTPPort = 80; + DWObject.HTTPDownload("www.dynamsoft.com", "img.png", () => {}, (errorCode: number, errorString: string) => {}); + } +} diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts new file mode 100644 index 0000000000..460158afe1 --- /dev/null +++ b/types/dwt/index.d.ts @@ -0,0 +1,3459 @@ +// Type definitions for dwt 12.3 +// Project: http://www.dynamsoft.com/Products/WebTWAIN_Overview.aspx +// Definitions by: Xiao Ling +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/*! +* Dynamsoft WebTwain JavaScript Intellisense +* Product: Dynamsoft Web Twain +* Web Site: http://www.dynamsoft.com +* +* Copyright 2017, Dynamsoft Corporation +* Author: Dynamsoft Support Team +* Version: 12.3 +*/ + +/** + * @namespace Dynamsoft + */ +declare namespace Dynamsoft { + namespace WebTwainEnv { + function GetWebTwain (cid: string): WebTwain; + function RegisterEvent(event: string, fn: () => void): void; + } +} + +/** ICAP_PIXELTYPE values (PT_ means Pixel Type) */ +declare enum EnumDWT_PixelType { + TWPT_BW = 0, + TWPT_GRAY = 1, + TWPT_RGB = 2, + TWPT_PALLETE = 3, + TWPT_CMY = 4, + TWPT_CMYK = 5, + TWPT_YUV = 6, + TWPT_YUVK = 7, + TWPT_CIEXYZ = 8, + TWPT_LAB = 9, + TWPT_SRGB = 10, + TWPT_SCRGB = 11, + TWPT_INFRARED = 16 +} + +declare enum EnumDWT_BorderStyle { + /** No border. */ + TWBS_NONE = 0, + /** Flat border. */ + TWBS_SINGLEFLAT = 1, + /** 3D border. */ + TWBS_SINGLE3D = 2 +} + +/** For query the operation that are supported by the data source on a capability . + * Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT + */ +declare enum EnumDWT_MessageType { + TWQC_GET = 1, + TWQC_SET = 2, + TWQC_GETDEFAULT = 4, + TWQC_GETCURRENT = 8, + TWQC_RESET = 16 +} + +/** Capabilities */ +declare enum EnumDWT_Cap { + /** Nothing. */ + CAP_NONE = 0, + /** The application is willing to accept this number of images. */ + CAP_XFERCOUNT = 1, + /** Allows the application and Source to identify which compression schemes they have in + * common for Buffered Memory and File transfers. + * Note for File transfers: + * Since only certain file formats support compression, this capability must be negotiated after + * setting the desired file format with ICAP_IMAGEFILEFORMAT. + */ + ICAP_COMPRESSION = 256, + /** The type of pixel data that a Source is capable of acquiring (for example, black and white, gray, RGB, etc.). */ + ICAP_PIXELTYPE = 257, + /** Unless a quantity is dimensionless or uses a specified unit of measure, ICAP_UNITS determines + * the unit of measure for all quantities. + */ + ICAP_UNITS = 258, + /** Allows the application and Source to identify which transfer mechanisms the source supports. */ + ICAP_XFERMECH = 259, + /** The name or other identifying information about the Author of the image. It may include a copyright string. */ + CAP_AUTHOR = 4096, + /** A general note about the acquired image. */ + CAP_CAPTION = 4097, + /** If TRUE, Source must acquire data from the document feeder acquire area and other feeder + * capabilities can be used. If FALSE, Source must acquire data from the non-feeder acquire area + * and no other feeder capabilities can be used. + */ + CAP_FEEDERENABLED = 4098, + /** Reflect whether there are documents loaded in the Source's feeder. */ + CAP_FEEDERLOADED = 4099, + /** The date and time the image was acquired. + * Stored in the form "YYYY/MM/DD HH:mm:SS.sss" where YYYY is the year, MM is the + * numerical month, DD is the numerical day, HH is the hour, mm is the minute, SS is the second, + * and sss is the millisecond. + */ + CAP_TIMEDATE = 4100, + /** Returns a list of all the capabilities for which the Source will answer inquiries. Does not indicate + * which capabilities the Source will allow to be set by the application. Some capabilities can only + * be set if certain setup work has been done so the Source cannot globally answer which + * capabilities are "set-able." + */ + CAP_SUPPORTEDCAPS = 4101, + /** Allows the application and Source to negotiate capabilities to be used in States 5 and 6. */ + CAP_EXTENDEDCAPS = 4102, + /** If TRUE, the Source will automatically feed the next page from the document feeder after the + * number of frames negotiated for capture from each page are acquired. CAP_FEEDERENABLED + * must be TRUE to use this capability. + */ + CAP_AUTOFEED = 4103, + /** If TRUE, the Source will eject the current page being acquired from and will leave the feeder + * acquire area empty. + * If CAP_AUTOFEED is TRUE, a fresh page will be advanced. + * CAP_FEEDERENABLED must equal TRUE to use this capability. + * This capability must have been negotiated as an extended capability to be used in States 5 and 6. + */ + CAP_CLEARPAGE = 4104, + /** If TRUE, the Source will eject the current page and advance the next page in the document feeder + * into the feeder acquire area. + * If CAP_AUTOFEED is TRUE, the same action just described will occur and CAP_AUTOFEED will + * remain active. + * CAP_FEEDERENABLED must equal TRUE to use this capability. + * This capability must have been negotiated as an extended capability to be used in States 5 and 6. + */ + CAP_FEEDPAGE = 4105, + /** If TRUE, the Source will return the current page to the input side of the document feeder and + * feed the last page from the output side of the feeder back into the acquisition area. + * If CAP_AUTOFEED is TRUE, automatic feeding will continue after all negotiated frames from this + * page are acquired. + * CAP_FEEDERENABLED must equal TRUE to use this capability. + * This capability must have been negotiated as an extended capability to be used in States 5 and 6. + */ + CAP_REWINDPAGE = 4106, + /** If TRUE, the Source will display a progress indicator during acquisition and transfer, regardless + * of whether the Source's user interface is active. If FALSE, the progress indicator will be + * suppressed if the Source's user interface is inactive. + * The Source will continue to display device-specific instructions and error messages even with + * the Source user interface and progress indicators turned off. + */ + CAP_INDICATORS = 4107, + /** Returns a list of all the capabilities for which the Source will answer inquiries. Does not indicate + * which capabilities the Source will allow to be set by the application. Some capabilities can only + * be set if certain setup work has been done so the Source cannot globally answer which + * capabilities are "set-able." + */ + CAP_SUPPORTEDCAPSEXT = 4108, + /** This capability determines whether the device has a paper sensor that can detect documents on the ADF or Flatbed. */ + CAP_PAPERDETECTABLE = 4109, + /** If TRUE, indicates that this Source supports acquisition with the UI disabled; i.e., + * TW_USERINTERFACE's ShowUI field can be set to FALSE. If FALSE, indicates that this Source + * can only support acquisition with the UI enabled. + */ + CAP_UICONTROLLABLE = 4110, + /** If TRUE, the physical hardware (e.g., scanner, digital camera, image database, etc.) that + * represents the image source is attached, powered on, and communicating. + */ + CAP_DEVICEONLINE = 4111, + /** This capability is intended to boost the performance of a Source. The fundamental assumption + * behind AutoScan is that the device is able to capture the number of images indicated by the + * value of CAP_XFERCOUNT without waiting for the Application to request the image transfers. + * This is only possible if the device has internal buffers capable of caching the images it captures. + * The default behavior is undefined, because some high volume devices are incapable of anything + * but CAP_AUTOSCAN being equal to TRUE. However, if a Source supports FALSE, it should use it + * as the mandatory default, since this best describes the behavior of pre-1.8 TWAIN Applications. + */ + CAP_AUTOSCAN = 4112, + /** Allows an application to request the delivery of thumbnail representations for the set of images + * that are to be delivered. + * Setting CAP_THUMBNAILSENABLED to TRUE turns on thumbnail mode. Images transferred + * thereafter will be sent at thumbnail size (exact thumbnail size is determined by the Data Source). + * Setting this capability to FALSE turns thumbnail mode off and returns full size images. + */ + CAP_THUMBNAILSENABLED = 4113, + /** This indicates whether the scanner supports duplex. If so, it further indicates whether one-path + * or two-path duplex is supported. + */ + CAP_DUPLEX = 4114, + /** The user can set the duplex option to be TRUE or FALSE. If TRUE, the scanner scans both sides + * of a paper; otherwise, the scanner will scan only one side of the image. + */ + CAP_DUPLEXENABLED = 4115, + /** Allows an application to query a source to see if it implements the new user interface settings dialog. */ + CAP_ENABLEDSUIONLY = 4116, + CAP_CUSTOMDSDATA = 4117, + /** Allows the application to specify the starting endorser / imprinter number. All other endorser/ + * imprinter properties should be handled through the data source's user interface. + * The user can set the starting number for the endorser. + */ + CAP_ENDORSER = 4118, + /** Turns specific audible alarms on and off. */ + CAP_ALARMS = 4120, + /** The volume of a device's audible alarm. Note that this control affects the volume of all alarms; + * no specific volume control for individual types of alarms is provided. + */ + CAP_ALARMVOLUME = 4121, + /** The number of images to automatically capture. This does not refer to the number of images to + * be sent to the Application, use CAP_XFERCOUNT for that. + */ + CAP_AUTOMATICCAPTURE = 4122, + /** For automatic capture, this value selects the number of milliseconds before the first picture is to + * be taken, or the first image is to be scanned. + */ + CAP_TIMEBEFOREFIRSTCAPTURE = 4123, + /** For automatic capture, this value selects the milliseconds to wait between pictures taken, or images scanned. */ + CAP_TIMEBETWEENCAPTURES = 4124, + /** CapGet() reports the presence of data in the scanner's buffers. CapSet() with a value of TWCB_CLEAR immediately clears the buffers. */ + CAP_CLEARBUFFERS = 4125, + /** Describes the number of pages that the scanner can buffer when CAP_AUTOSCAN is enabled. */ + CAP_MAXBATCHBUFFERS = 4126, + /** The date and time of the device's clock. + * Managed in the form "YYYY/MM/DD HH:mm:SS:sss" where YYYY is the year, MM is the + * numerical month, DD is the numerical day, HH is the hour, mm is the minute, SS is the second, + * and sss is the millisecond. + */ + CAP_DEVICETIMEDATE = 4127, + /** CapGet() reports the kinds of power available to the device. CapGetCurrent() reports the current power supply in use. */ + CAP_POWERSUPPLY = 4128, + /** This capability queries the Source for UI support for preview mode. If TRUE, the Source supports preview UI. */ + CAP_CAMERAPREVIEWUI = 4129, + /** A string containing the serial number of the currently selected device in the Source. Multiple + * devices may all report the same serial number. + */ + CAP_SERIALNUMBER = 4132, + /** CapGet() returns the current list of available printer devices, along with the one currently being used for negotiation. + * CapSet() selects the current device for negotiation, and optionally constrains the list. + * Top/Bottom refers to duplex devices, and indicates if the printer is writing on the top or the bottom of the sheet of paper. + * Simplex devices use the top settings. Before/After indicates whether printing occurs before or after the sheet of paper has been scanned. + */ + CAP_PRINTER = 4134, + /** Turns the current CAP_PRINTER device on or off. */ + CAP_PRINTERENABLED = 4135, + /** The User can set the starting number for the current CAP_PRINTER device. */ + CAP_PRINTERINDEX = 4136, + /** Specifies the appropriate current CAP_PRINTER device mode. + * Note: + * • TWPM_SINGLESTRING specifies that the printed text will consist of a single string. + * • TWPM _MULTISTRING specifies that the printed text will consist of an enumerated list of + * strings to be printed in order. + * • TWPM _COMPOUNDSTRING specifies that the printed string will consist of a compound of a + * String followed by a value followed by a suffix string. + */ + CAP_PRINTERMODE = 4137, + /** Specifies the string(s) that are to be used in the string component when the current + * CAP_PRINTER device is enabled. + */ + CAP_PRINTERSTRING = 4138, + /** Specifies the string that shall be used as the current CAP_PRINTER device's suffix. */ + CAP_PRINTERSUFFIX = 4139, + /** Allows Application and Source to identify which languages they have in common for the exchange of string data, + * and to select the language of the internal UI. Since the TWLG_xxxx codes include language and country data, there is no separate + * capability for selecting the country. + */ + CAP_LANGUAGE = 4140, + /** Helps the Application determine any special actions it may need to take when negotiating + * frames with the Source. Allowed values are listed in . + * TWFA_NONE: The alignment is free-floating. Applications should assume + * that the origin for frames is on the left. + * TWFA_LEFT: The alignment is to the left. + * TWFA_CENTER: The alignment is centered. This means that the paper will + * be fed in the middle of the ICAP_PHYSICALWIDTH of the + * device. If this is set, then the Application should calculate + * any frames with a left offset of zero. + * TWFA_RIGHT: The alignment is to the right. + */ + CAP_FEEDERALIGNMENT = 4141, + /** TWFO_FIRSTPAGEFIRST if the feeder starts with the top of the first page. + * TWFO_LASTPAGEFIRST is the feeder starts with the top of the last page. + */ + CAP_FEEDERORDER = 4142, + /** Indicates whether the physical hardware (e.g. scanner, digital camera) is capable of acquiring + * multiple images of the same page without changes to the physical registration of that page. + */ + CAP_REACQUIREALLOWED = 4144, + /** The minutes of battery power remaining to the device. */ + CAP_BATTERYMINUTES = 4146, + /** When used with CapGet(), return the percentage of battery power level on camera. If -1 is returned, it indicates that the battery is not present. */ + CAP_BATTERYPERCENTAGE = 4147, + /** Added 1.91 */ + CAP_CAMERASIDE = 4148, + /** Added 1.91 */ + CAP_SEGMENTED = 4149, + /** Added 2.0 */ + CAP_CAMERAENABLED = 4150, + /** Added 2.0 */ + CAP_CAMERAORDER = 4151, + /** Added 2.0 */ + CAP_MICRENABLED = 4152, + /** Added 2.0 */ + CAP_FEEDERPREP = 4153, + /** Added 2.0 */ + CAP_FEEDERPOCKET = 4154, + /** Added 2.1 */ + CAP_AUTOMATICSENSEMEDIUM = 4155, + /** Added 2.1 */ + CAP_CUSTOMINTERFACEGUID = 4156, + /** TRUE enables and FALSE disables the Source's Auto-brightness function (if any). */ + ICAP_AUTOBRIGHT = 4352, + /** The brightness values available within the Source. */ + ICAP_BRIGHTNESS = 4353, + /** The contrast values available within the Source. */ + ICAP_CONTRAST = 4355, + /** Specifies the square-cell halftone (dithering) matrix the Source should use to halftone the image. */ + ICAP_CUSTHALFTONE = 4356, + /** Specifies the exposure time used to capture the image, in seconds. */ + ICAP_EXPOSURETIME = 4357, + /** Describes the color characteristic of the subtractive filter applied to the image data. Multiple + * filters may be applied to a single acquisition. + */ + ICAP_FILTER = 4358, + /** Specifies whether or not the image was acquired using a flash. */ + ICAP_FLASHUSED = 4359, + /** Gamma correction value for the image data. */ + ICAP_GAMMA = 4360, + /** A list of names of the halftone patterns available within the Source. */ + ICAP_HALFTONES = 4361, + /** Specifies which value in an image should be interpreted as the lightest "highlight." All values + * "lighter" than this value will be clipped to this value. Whether lighter values are smaller or + * larger can be determined by examining the Current value of ICAP_PIXELFLAVOR. + */ + ICAP_HIGHLIGHT = 4362, + /** Informs the application which file formats the Source can generate (CapGet()). Tells the Source which file formats the application can handle (CapSet()). + * TWFF_TIFF Used for document + * TWFF_PICT Native Macintosh + * TWFF_BMP Native Microsoft + * TWFF_XBM Used for document + * TWFF_JFIF Wrapper for JPEG + * TWFF_FPX FlashPix, used with digital + * TWFF_TIFFMULTI Multi-page TIFF files + * TWFF_PNG An image format standard intended for use on the web, replaces GIF + * TWFF_SPIFF A standard from JPEG, intended to replace JFIF, also supports JBIG + * TWFF_EXIF File format for use with digital cameras. + */ + ICAP_IMAGEFILEFORMAT = 4364, + /** TRUE means the lamp is currently, or should be set to ON. Sources may not support CapSet() operations. */ + ICAP_LAMPSTATE = 4365, + /** Describes the general color characteristic of the light source used to acquire the image. */ + ICAP_LIGHTSOURCE = 4366, + /** Defines which edge of the "paper" the image's "top" is aligned with. This information is used to adjust the frames to match the + * scanning orientation of the paper. For instance, if an ICAP_SUPPORTEDSIZE of TWSS_ISOA4 has been negotiated, + * and ICAP_ORIENTATION is set to TWOR_LANDSCAPE, then the Source must rotate the frame it downloads to the scanner to reflect the + * orientation of the paper. Please note that setting ICAP_ORIENTATION does not affect the values reported by ICAP_FRAMES; + * it just causes the Source to use them in a different way. The upper-left of the image is defined as the location where both the primary and + * secondary scans originate. (The X axis is the primary scan direction and the Y axis is the secondary scan direction.) + * For a flatbed scanner, the light bar moves in the secondary scan direction. For a handheld scanner, the scanner is drug in the + * secondary scan direction. For a digital camera, the secondary direction is the vertical axis when the viewed image is considered upright. + */ + ICAP_ORIENTATION = 4368, + /** The maximum physical width (X-axis) the Source can acquire (measured in units of ICAP_UNITS). */ + ICAP_PHYSICALWIDTH = 4369, + /** The maximum physical height (Y-axis) the Source can acquire (measured in units of ICAP_UNITS). */ + ICAP_PHYSICALHEIGHT = 4370, + /** Specifies which value in an image should be interpreted as the darkest "shadow." All values + * "darker" than this value will be clipped to this value. + */ + ICAP_SHADOW = 4371, + /** The list of frames the Source will acquire on each page. */ + ICAP_FRAMES = 4372, + /** The native optical resolution along the X-axis of the device being controlled by the Source. Most + * devices will respond with a single value (TW_ONEVALUE). + * This is NOT a list of all resolutions that can be generated by the device. Rather, this is the + * resolution of the device's optics. Measured in units of pixels per unit as defined by + * ICAP_UNITS (pixels per TWUN_PIXELS yields dimensionless data). + */ + ICAP_XNATIVERESOLUTION = 4374, + /** The native optical resolution along the Y-axis of the device being controlled by the Source. + * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS + * yields dimensionless data). + */ + ICAP_YNATIVERESOLUTION = 4375, + /** All the X-axis resolutions the Source can provide. + * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS + * yields dimensionless data). That is, when the units are TWUN_PIXELS, both + * ICAP_XRESOLUTION and ICAP_YRESOLUTION shall report 1 pixel/pixel. Some data sources + * like to report the actual number of pixels that the device reports, but that response is more + * appropriate in ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH. + */ + ICAP_XRESOLUTION = 4376, + /** All the Y-axis resolutions the Source can provide. + * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS + * yields dimensionless data). That is, when the units are TWUN_PIXELS, both + * ICAP_XRESOLUTION and ICAP_YRESOLUTION shall report 1 pixel/pixel. Some data sources + * like to report the actual number of pixels that the device reports, but that response is more + * appropriate in ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH. + */ + ICAP_YRESOLUTION = 4377, + /** The maximum number of frames the Source can provide or the application can accept per page. + * This is a bounding capability only. It does not establish current or future behavior. + */ + ICAP_MAXFRAMES = 4378, + /** This is used with buffered memory transfers. If TRUE, Source can provide application with tiled image data. */ + ICAP_TILES = 4379, + /** Specifies how the bytes in an image are filled by the Source. TWBO_MSBFIRST indicates that the leftmost bit in the byte (usually bit 7) is + * the byte's Most Significant Bit. + */ + ICAP_BITORDER = 4380, + /** Used for CCITT Group 3 2-dimensional compression. The 'K' factor indicates how often the + * new compression baseline should be re-established. A value of 2 or 4 is common in facsimile + * communication. A value of zero in this field will indicate an infinite K factor—the baseline is + * only calculated at the beginning of the transfer. + */ + ICAP_CCITTKFACTOR = 4381, + /** Describes whether the image was captured transmissively or reflectively. */ + ICAP_LIGHTPATH = 4382, + /** Sense of the pixel whose numeric value is zero (minimum data value). */ + ICAP_PIXELFLAVOR = 4383, + /** Allows the application and Source to identify which color data formats are available. There are + * two options, "planar" and "chunky." + */ + ICAP_PLANARCHUNKY = 4384, + /** How the Source can/should rotate the scanned image data prior to transfer. This doesn't use + * ICAP_UNITS. It is always measured in degrees. Any applied value is additive with any + * rotation specified in ICAP_ORIENTATION. + */ + ICAP_ROTATION = 4385, + /** For devices that support fixed frame sizes. + * Defined sizes match typical page sizes. This specifies the size(s) the Source can/should use to acquire image data. + */ + ICAP_SUPPORTEDSIZES = 4386, + /** Specifies the dividing line between black and white. This is the value the Source will use to + * threshold, if needed, when ICAP_PIXELTYPE:TWPT_BW. + * The value is normalized so there are no units of measure associated with this ICAP. + */ + ICAP_THRESHOLD = 4387, + /** All the X-axis scaling values available. A value of '1.0' is equivalent to 100% scaling. Do not use values less than or equal to zero. */ + ICAP_XSCALING = 4388, + /** All the Y-axis scaling values available. A value of '1.0' is equivalent to 100% scaling. Do not use values less than or equal to zero. + * There are no units inherent with this data as it is normalized to 1.0 being "unscaled." + */ + ICAP_YSCALING = 4389, + /** Used for CCITT data compression only. Indicates the bit order representation of the stored compressed codes. */ + ICAP_BITORDERCODES = 4390, + /** Used only for CCITT data compression. Specifies whether the compressed codes' pixel "sense" + * will be inverted from the Current value of ICAP_PIXELFLAVOR prior to transfer. + */ + ICAP_PIXELFLAVORCODES = 4391, + /** Allows the application and Source to agree upon a common set of color descriptors that are + * made available by the Source. This ICAP is only useful for JPEG-compressed buffered memory image transfers. + */ + ICAP_JPEGPIXELTYPE = 4392, + /** Used only with CCITT data compression. Specifies the minimum number of words of compressed codes (compressed data) to be transmitted per line. */ + ICAP_TIMEFILL = 4394, + /** Specifies the pixel bit depths for the Current value of ICAP_PIXELTYPE. For example, when + * using ICAP_PIXELTYPE:TWPT_GRAY, this capability specifies whether this is 8-bit gray or 4-bit gray. + * This depth applies to all the data channels (for instance, the R, G, and B channels will all have + * this same bit depth for RGB data). + */ + ICAP_BITDEPTH = 4395, + /** Specifies the Reduction Method the Source should use to reduce the bit depth of the data. Most + * commonly used with ICAP_PIXELTYPE:TWPT_BW to reduce gray data to black and white. + */ + ICAP_BITDEPTHREDUCTION = 4396, + /** If TRUE the Source will issue a MSG_XFERREADY before starting the scan. + * Note: The Source may need to scan the image before initiating the transfer. This is the case if + * the scanned image is rotated or merged with another scanned image. + */ + ICAP_UNDEFINEDIMAGESIZE = 4397, + /** Allows the application to query the data source to see if it supports extended image attribute capabilities, + * such as Barcode Recognition, Shaded Area Detection and Removal, Skew detection and Removal, and so on. + */ + ICAP_EXTIMAGEINFO = 4399, + /** Allows the source to define the minimum height (Y-axis) that the source can acquire. */ + ICAP_MINIMUMHEIGHT = 4400, + /** Allows the source to define theminimum width (X-axis) that the source can acquire. */ + ICAP_MINIMUMWIDTH = 4401, + /** Use this capability to have the Source discard blank images. The Application never sees these + * images during the scanning session. + * TWBP_DISABLE – this must be the default state for the Source. It indicates that all images will + * be delivered to the Application, none of them will be discarded. + * TWBP_AUTO – if this is used, then the Source will decide if an image is blank or not and discard + * as appropriate. + * If the specified value is a positive number in the range 0 to 231–1, then this capability will use it + * as the byte size cutoff point to identify which images are to be discarded. If the size of the image + * is less than or equal to this value, then it will be discarded. If the size of the image is greater + * than this value, then it will be kept so that it can be transferred to the Application. + */ + ICAP_AUTODISCARDBLANKPAGES = 4404, + /** Flip rotation is used to properly orient images that flip orientation every other image. + * TWFR_BOOK The images to be scanned are viewed in book form, flipping each page from left to right or right to left. + * TWFR_FANFOLD The images to be scanned are viewed in fanfold paper style, flipping each page up or down. + */ + ICAP_FLIPROTATION = 4406, + /** Turns bar code detection on and off. */ + ICAP_BARCODEDETECTIONENABLED = 4407, + /** Provides a list of bar code types that can be detected by the current Data Source. */ + ICAP_SUPPORTEDBARCODETYPES = 4408, + /** The maximum number of supported search priorities. */ + ICAP_BARCODEMAXSEARCHPRIORITIES = 4409, + /** A prioritized list of bar code types dictating the order in which bar codes will be sought. */ + ICAP_BARCODESEARCHPRIORITIES = 4410, + /** Restricts bar code searching to certain orientations, or prioritizes one orientation over the other. */ + ICAP_BARCODESEARCHMODE = 4411, + /** Restricts the number of times a search will be retried if none are found on each page. */ + ICAP_BARCODEMAXRETRIES = 4412, + /** Restricts the total time spent on searching for a bar code on each page. */ + ICAP_BARCODETIMEOUT = 4413, + /** When used with CapGet(), returns all camera supported lens zooming range. */ + ICAP_ZOOMFACTOR = 4414, + /** Turns patch code detection on and off. */ + ICAP_PATCHCODEDETECTIONENABLED = 4415, + /** A list of patch code types that may be detected by the current Data Source. */ + ICAP_SUPPORTEDPATCHCODETYPES = 4416, + /** The maximum number of supported search priorities. */ + ICAP_PATCHCODEMAXSEARCHPRIORITIES = 4417, + /** A prioritized list of patch code types dictating the order in which patch codes will be sought. */ + ICAP_PATCHCODESEARCHPRIORITIES = 4418, + /** Restricts patch code searching to certain orientations, or prioritizes one orientation over the other. */ + ICAP_PATCHCODESEARCHMODE = 4419, + /** Restricts the number of times a search will be retried if none are found on each page. */ + ICAP_PATCHCODEMAXRETRIES = 4420, + /** Restricts the total time spent on searching for a patch code on each page. */ + ICAP_PATCHCODETIMEOUT = 4421, + /** For devices that support flash. CapSet() selects the flash to be used (if any). CapGet() reports the current setting. + * This capability replaces ICAP_FLASHUSED, which is only able to negotiate the flash being on or off. + */ + ICAP_FLASHUSED2 = 4422, + /** For devices that support image enhancement filtering. This capability selects the algorithm used to improve the quality of the image. */ + ICAP_IMAGEFILTER = 4423, + /** For devices that support noise filtering. This capability selects the algorithm used to remove noise. */ + ICAP_NOISEFILTER = 4424, + /** Overscan is used to scan outside of the boundaries described by ICAP_FRAMES, and is used to help acquire image data that + * may be lost because of skewing. + * This is primarily of use for transport scanners which rely on edge detection to begin scanning. + * If overscan is supported, then the device is capable of scanning in the inter-document gap to get the skewed image information. + */ + ICAP_OVERSCAN = 4425, + /** Turns automatic border detection on and off. */ + ICAP_AUTOMATICBORDERDETECTION = 4432, + /** Turns automatic deskew correction on and off. */ + ICAP_AUTOMATICDESKEW = 4433, + /** When TRUE this capability depends on intelligent features within the Source to automatically + * rotate the image to the correct position. + */ + ICAP_AUTOMATICROTATE = 4434, + /** Added 1.9 */ + ICAP_JPEGQUALITY = 4435, + /** Added 1.91 */ + ICAP_FEEDERTYPE = 4436, + /** Added 1.91 */ + ICAP_ICCPROFILE = 4437, + /** Added 2.0 */ + ICAP_AUTOSIZE = 4438, + /** Added 2.1 */ + ICAP_AUTOMATICCROPUSESFRAME = 4439, + /** Added 2.1 */ + ICAP_AUTOMATICLENGTHDETECTION = 4440, + /** Added 2.1 */ + ICAP_AUTOMATICCOLORENABLED = 4441, + /** Added 2.1 */ + ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE = 4442, + /** Added 2.1 */ + ICAP_COLORMANAGEMENTENABLED = 4443, + /** Added 2.1 */ + ICAP_IMAGEMERGE = 4444, + /** Added 2.1 */ + ICAP_IMAGEMERGEHEIGHTTHRESHOLD = 4445, + /** Added 2.1 */ + ICAP_SUPPORTEDEXTIMAGEINFO = 4446 +} + +/** Capabilities exist in many varieties but all have a Default Value, Current Value, and may have other values available that can be supported if selected. + * To help categorize the supported values into clear structures, TWAIN defines four types of containers for capabilities = + * TW_ONEVALUE, TW_ARRAY, TW_RANGE and TW_ENUMERATION. + */ +declare enum EnumDWT_CapType { + /** Nothing. */ + TWON_NONE = 0, + /** A rectangular array of values that describe a logical item. It is similar to the TW_ONEVALUE because the current and default values are the same and + * there are no other values to select from. For example, a list of the names, such as the supported capabilities list returned by the CAP_SUPPORTEDCAPS + * capability, would use this type of container. + */ + TWON_ARRAY = 3, + /** This is the most general type because it defines a list of values from which the Current Value can be chosen. + * The values do not progress uniformly through a range and there is not a consistent step size between the values. + * For example, if a Source's resolution options do not occur in even step sizes then an enumeration would be used (for example, 150, 400, and 600). + */ + TWON_ENUMERATION = 4, + /** A single value whose current and default values are coincident. The range of available values for this type of capability is simply this single value. + * For example, a capability that indicates the presence of a document feeder could be of this type. + */ + TWON_ONEVALUE = 5, + /** Many capabilities allow users to select their current value from a range of regularly spaced values. + * The capability can specify the minimum and maximum acceptable values and the incremental step size between the values. + * For example, resolution might be supported from 100 to 600 in steps of 50 (100, 150, 200, ..., 550, 600). + */ + TWON_RANGE = 6 +} + +/** ICAP_XFERMECH values. */ +declare enum EnumDWT_TransferMode { + /** Native transfers require the data to be transferred to a single large block of RAM. Therefore, + * they always face the risk of having an inadequate amount of RAM available to perform the transfer successfully. + */ + TWSX_NATIVE = 0, + /** Disk File Mode Transfers. */ + TWSX_FILE = 1, + /** Buffered Memory Mode Transfers. */ + TWSX_MEMORY = 2, + /** added 1.91 */ + TWSX_MEMFILE = 4 +} + +/** ICAP_IMAGEFILEFORMAT values. */ +declare enum EnumDWT_FileFormat { + /** Used for document imaging. Tagged Image File Format */ + TWFF_TIFF = 0, + /** Native Macintosh format. Macintosh PICT */ + TWFF_PICT = 1, + /** Native Microsoft format. Windows Bitmap */ + TWFF_BMP = 2, + /** Used for document imaging. X-Windows Bitmap */ + TWFF_XBM = 3, + /** Wrapper for JPEG images. JPEG File Interchange Format */ + TWFF_JFIF = 4, + /** FlashPix, used with digital cameras. Flash Pix */ + TWFF_FPX = 5, + /** Multi-page TIFF files. Multi-page tiff file */ + TWFF_TIFFMULTI = 6, + /** An image format standard intended for use on the web, replaces GIF. */ + TWFF_PNG = 7, + /** A standard from JPEG, intended to replace JFIF, also supports JBIG. */ + TWFF_SPIFF = 8, + /** File format for use with digital cameras. */ + TWFF_EXIF = 9, + /** A file format from Adobe. 1.91 NB: this is not PDF/A */ + TWFF_PDF = 10, + /** A file format from the Joint Photographic Experts Group. 1.91 */ + TWFF_JP2 = 11, + /** 1.91 */ + TWFF_JPN = 12, + /** 1.91 */ + TWFF_JPX = 13, + /** A file format from LizardTech. 1.91 */ + TWFF_DEJAVU = 14, + /** A file format from Adobe. 2.0 */ + TWFF_PDFA = 15, + /** 2.1 Adobe PDF/A, Version 2 */ + TWFF_PDFA2 = 16 +} + +/** TIFF file compression type. */ +declare enum EnumDWT_TIFFCompressionType { + /** Auto mode. */ + TIFF_AUTO = 0, + /** Dump mode. */ + TIFF_NONE = 1, + /** CCITT modified Huffman RLE. */ + TIFF_RLE = 2, + /** CCITT Group 3 fax encoding. */ + TIFF_FAX3 = 3, + /** CCITT T.4 (TIFF 6 name). */ + TIFF_T4 = 3, + /** CCITT Group 4 fax encoding */ + TIFF_FAX4 = 4, + /** CCITT T.6 (TIFF 6 name). */ + TIFF_T6 = 4, + /** Lempel Ziv and Welch */ + TIFF_LZW = 5, + TIFF_JPEG = 7, + TIFF_PACKBITS = 32773 +} + +/** The method to do interpolation. */ +declare enum EnumDWT_InterpolationMethod { + IM_NEARESTNEIGHBOUR = 1, + IM_BILINEAR = 2, + IM_BICUBIC = 3, + IM_BESTQUALITY = 5 +} + +/** Image type */ +declare enum EnumDWT_ImageType { + /** Native Microsoft format. */ + IT_BMP = 0, + /** JPEG format. */ + IT_JPG = 1, + /** Tagged Image File Format. */ + IT_TIF = 2, + /** An image format standard intended for use on the web, replaces GIF. */ + IT_PNG = 3, + /** A file format from Adobe. */ + IT_PDF = 4, + IT_ALL = 5 +} + +/** PDF file compression type. */ +declare enum EnumDWT_PDFCompressionType { + /** Auto mode. */ + PDF_AUTO = 0, + /** CCITT Group 3 fax encoding. */ + PDF_FAX3 = 1, + /** CCITT Group 4 fax encoding */ + PDF_FAX4 = 2, + /** Lempel Ziv and Welch */ + PDF_LZW = 3, + /** CCITT modified Huffman RLE. */ + PDF_RLE = 4, + PDF_JPEG = 5 +} + +declare enum EnumDWT_ShowMode { + /** Activates the window and displays it in its current size and position. */ + SW_ACTIVE = 0, + /** Maximizes the window */ + SW_MAX = 1, + /** Minimize the window */ + SW_MIN = 2, + /** Close the latest opened editor window */ + SW_CLOSE = 3, + /** Check whether a window exists */ + SW_IFLIVE = 4 +} + +/** The kind of data stored in the container. */ +declare enum EnumDWT_CapValueType { + TWTY_INT8 = 0, + /** Means Item is a TW_INT16 */ + TWTY_INT16 = 1, + /** Means Item is a TW_INT32 */ + TWTY_INT32 = 2, + /** Means Item is a TW_UINT8 */ + TWTY_UINT8 = 3, + /** Means Item is a TW_UINT16 */ + TWTY_UINT16 = 4, + /** Means Item is a TW_int */ + TWTY_int = 5, + /** Means Item is a TW_BOOL */ + TWTY_BOOL = 6, + /** Means Item is a TW_FIX32 */ + TWTY_FIX32 = 7, + /** Means Item is a TW_FRAME */ + TWTY_FRAME = 8, + /** Means Item is a TW_STR32 */ + TWTY_STR32 = 9, + /** Means Item is a TW_STR64 */ + TWTY_STR64 = 10, + /** Means Item is a TW_STR128 */ + TWTY_STR128 = 11, + /** Means Item is a TW_STR255 */ + TWTY_STR255 = 12 +} + +/** ICAP_UNITS values. */ +declare enum EnumDWT_UnitType { + TWUN_INCHES = 0, + TWUN_CENTIMETERS = 1, + TWUN_PICAS = 2, + TWUN_POINTS = 3, + TWUN_TWIPS = 4, + TWUN_PIXELS = 5, + TWUN_MILLIMETERS = 6 +} + +/** ICAP_DUPLEX values. */ +declare enum EnumDWT_DUPLEX { + TWDX_NONE = 0, + TWDX_1PASSDUPLEX = 1, + TWDX_2PASSDUPLEX = 2 +} + +/** CAP_LANGUAGE values. */ +declare enum EnumDWT_CapLanguage { + /** Danish */ + TWLG_DAN = 0, + /** Dutch */ + TWLG_DUT = 1, + /** International English */ + TWLG_ENG = 2, + /** French Canadian */ + TWLG_FCF = 3, + /** Finnish */ + TWLG_FIN = 4, + /** French */ + TWLG_FRN = 5, + /** German */ + TWLG_GER = 6, + /** Icelandic */ + TWLG_ICE = 7, + /** Italian */ + TWLG_ITN = 8, + /** Norwegian */ + TWLG_NOR = 9, + /** Portuguese */ + TWLG_POR = 10, + /** Spanish */ + TWLG_SPA = 11, + /** Swedish */ + TWLG_SWE = 12, + /** U.S. English */ + TWLG_USA = 13, + /** Added for 1.8 */ + TWLG_USERLOCALE = -1, + TWLG_AFRIKAANS = 14, + TWLG_ALBANIA = 15, + TWLG_ARABIC = 16, + TWLG_ARABIC_ALGERIA = 17, + TWLG_ARABIC_BAHRAIN = 18, + TWLG_ARABIC_EGYPT = 19, + TWLG_ARABIC_IRAQ = 20, + TWLG_ARABIC_JORDAN = 21, + TWLG_ARABIC_KUWAIT = 22, + TWLG_ARABIC_LEBANON = 23, + TWLG_ARABIC_LIBYA = 24, + TWLG_ARABIC_MOROCCO = 25, + TWLG_ARABIC_OMAN = 26, + TWLG_ARABIC_QATAR = 27, + TWLG_ARABIC_SAUDIARABIA = 28, + TWLG_ARABIC_SYRIA = 29, + TWLG_ARABIC_TUNISIA = 30, + /** United Arabic Emirates */ + TWLG_ARABIC_UAE = 31, + TWLG_ARABIC_YEMEN = 32, + TWLG_BASQUE = 33, + TWLG_BYELORUSSIAN = 34, + TWLG_BULGARIAN = 35, + TWLG_CATALAN = 36, + TWLG_CHINESE = 37, + TWLG_CHINESE_HONGKONG = 38, + /** People's Republic of China */ + TWLG_CHINESE_PRC = 39, + TWLG_CHINESE_SINGAPORE = 40, + TWLG_CHINESE_SIMPLIFIED = 41, + TWLG_CHINESE_TAIWAN = 42, + TWLG_CHINESE_TRADITIONAL = 43, + TWLG_CROATIA = 44, + TWLG_CZECH = 45, + TWLG_DANISH = 0, + TWLG_DUTCH = 1, + TWLG_DUTCH_BELGIAN = 46, + TWLG_ENGLISH = 2, + TWLG_ENGLISH_AUSTRALIAN = 47, + TWLG_ENGLISH_CANADIAN = 48, + TWLG_ENGLISH_IRELAND = 49, + TWLG_ENGLISH_NEWZEALAND = 50, + TWLG_ENGLISH_SOUTHAFRICA = 51, + TWLG_ENGLISH_UK = 52, + TWLG_ENGLISH_USA = 13, + TWLG_ESTONIAN = 53, + TWLG_FAEROESE = 54, + TWLG_FARSI = 55, + TWLG_FINNISH = 4, + TWLG_FRENCH = 5, + TWLG_FRENCH_BELGIAN = 56, + TWLG_FRENCH_CANADIAN = 3, + TWLG_FRENCH_LUXEMBOURG = 57, + TWLG_FRENCH_SWISS = 58, + TWLG_GERMAN = 6, + TWLG_GERMAN_AUSTRIAN = 59, + TWLG_GERMAN_LUXEMBOURG = 60, + TWLG_GERMAN_LIECHTENSTEIN = 61, + TWLG_GERMAN_SWISS = 62, + TWLG_GREEK = 63, + TWLG_HEBREW = 64, + TWLG_HUNGARIAN = 65, + TWLG_ICELANDIC = 7, + TWLG_INDONESIAN = 66, + TWLG_ITALIAN = 8, + TWLG_ITALIAN_SWISS = 67, + TWLG_JAPANESE = 68, + TWLG_KOREAN = 69, + TWLG_KOREAN_JOHAB = 70, + TWLG_LATVIAN = 71, + TWLG_LITHUANIAN = 72, + TWLG_NORWEGIAN = 9, + TWLG_NORWEGIAN_BOKMAL = 73, + TWLG_NORWEGIAN_NYNORSK = 74, + TWLG_POLISH = 75, + TWLG_PORTUGUESE = 10, + TWLG_PORTUGUESE_BRAZIL = 76, + TWLG_ROMANIAN = 77, + TWLG_RUSSIAN = 78, + TWLG_SERBIAN_LATIN = 79, + TWLG_SLOVAK = 80, + TWLG_SLOVENIAN = 81, + TWLG_SPANISH = 11, + TWLG_SPANISH_MEXICAN = 82, + TWLG_SPANISH_MODERN = 83, + TWLG_SWEDISH = 12, + TWLG_THAI = 84, + TWLG_TURKISH = 85, + TWLG_UKRANIAN = 86, + /** More stuff added for 1.8 */ + TWLG_ASSAMESE = 87, + TWLG_BENGALI = 88, + TWLG_BIHARI = 89, + TWLG_BODO = 90, + TWLG_DOGRI = 91, + TWLG_GUJARATI = 92, + TWLG_HARYANVI = 93, + TWLG_HINDI = 94, + TWLG_KANNADA = 95, + TWLG_KASHMIRI = 96, + TWLG_MALAYALAM = 97, + TWLG_MARATHI = 98, + TWLG_MARWARI = 99, + TWLG_MEGHALAYAN = 100, + TWLG_MIZO = 101, + TWLG_NAGA = 102, + TWLG_ORISSI = 103, + TWLG_PUNJABI = 104, + TWLG_PUSHTU = 105, + TWLG_SERBIAN_CYRILLIC = 106, + TWLG_SIKKIMI = 107, + TWLG_SWEDISH_FINLAND = 108, + TWLG_TAMIL = 109, + TWLG_TELUGU = 110, + TWLG_TRIPURI = 111, + TWLG_URDU = 112, + TWLG_VIETNAMESE = 113 +} + +/** TWAIN Supported sizes. */ +declare enum EnumDWT_CapSupportedSizes { + /** 0 */ + TWSS_NONE = 0, + /** 1 */ + TWSS_A4LETTER = 1, + /** 2 */ + TWSS_B5LETTER = 2, + /** 3 */ + TWSS_USLETTER = 3, + /** 4 */ + TWSS_USLEGAL = 4, + /** Added 1.5 + * 5 + */ + TWSS_A5 = 5, + /** 6 */ + TWSS_B4 = 6, + /** 7 */ + TWSS_B6 = 7, + /** Added 1.7 + * 9 + */ + TWSS_USLEDGER = 9, + /** 10 */ + TWSS_USEXECUTIVE = 10, + /** 11 */ + TWSS_A3 = 11, + /** 12 */ + TWSS_B3 = 12, + /** 13 */ + TWSS_A6 = 13, + /** 14 */ + TWSS_C4 = 14, + /** 15 */ + TWSS_C5 = 15, + /** 16 */ + TWSS_C6 = 16, + /** Added 1.8 + * 17 + */ + TWSS_4A0 = 17, + /** 18 */ + TWSS_2A0 = 18, + /** 19 */ + TWSS_A0 = 19, + /** 20 */ + TWSS_A1 = 20, + /** 21 */ + TWSS_A2 = 21, + /** 1 */ + TWSS_A4 = 1, + /** 22 */ + TWSS_A7 = 22, + /** 23 */ + TWSS_A8 = 23, + /** 24 */ + TWSS_A9 = 24, + /** 25 */ + TWSS_A10 = 25, + /** 26 */ + TWSS_ISOB0 = 26, + /** 27 */ + TWSS_ISOB1 = 27, + /** 28 */ + TWSS_ISOB2 = 28, + /** 12 */ + TWSS_ISOB3 = 12, + /** 6 */ + TWSS_ISOB4 = 6, + /** 29 */ + TWSS_ISOB5 = 29, + /** 7 */ + TWSS_ISOB6 = 7, + /** 30 */ + TWSS_ISOB7 = 30, + /** 31 */ + TWSS_ISOB8 = 31, + /** 32 */ + TWSS_ISOB9 = 32, + /** 33 */ + TWSS_ISOB10 = 33, + /** 34 */ + TWSS_JISB0 = 34, + /** 35 */ + TWSS_JISB1 = 35, + /** 36 */ + TWSS_JISB2 = 36, + /** 37 */ + TWSS_JISB3 = 37, + /** 38 */ + TWSS_JISB4 = 38, + /** 2 */ + TWSS_JISB5 = 2, + /** 39 */ + TWSS_JISB6 = 39, + /** 40 */ + TWSS_JISB7 = 40, + /** 41 */ + TWSS_JISB8 = 41, + /** 41 */ + TWSS_JISB9 = 42, + /** 43 */ + TWSS_JISB10 = 43, + /** 44 */ + TWSS_C0 = 44, + /** 45 */ + TWSS_C1 = 45, + /** 46 */ + TWSS_C2 = 46, + /** 47 */ + TWSS_C3 = 47, + /** 48 */ + TWSS_C7 = 48, + /** 49 */ + TWSS_C8 = 49, + /** 50 */ + TWSS_C9 = 50, + /** 51 */ + TWSS_C10 = 51, + /** 52 */ + TWSS_USSTATEMENT = 52, + /** 53 */ + TWSS_BUSINESSCARD = 53, + /** 54. Added 2.1 */ + TWSS_MAXSIZE = 54 +} + +/** CAP_FEEDERALIGNMENT values. */ +declare enum EnumDWT_CapFeederAlignment { + /** The alignment is free-floating. Applications should assume that the origin for frames is on the left. */ + TWFA_NONE = 0, + /** The alignment is to the left. */ + TWFA_LEFT = 1, + /** The alignment is centered. This means that the paper will be fed in the middle of the ICAP_PHYSICALWIDTH of the + * device. If this is set, then the Application should calculate any frames with a left offset of zero. + */ + TWFA_CENTER = 2, + /** The alignment is to the right. */ + TWFA_RIGHT = 3 +} +/** CAP_FEEDERORDER values. */ +declare enum EnumDWT_CapFeederOrder { + /** The feeder starts with the top of the first page. */ + TWFO_FIRSTPAGEFIRST = 0, + /** The feeder starts with the top of the last page. */ + TWFO_LASTPAGEFIRST = 1 +} + +/** CAP_PRINTER values. */ +declare enum EnumDWT_CapPrinter { + TWPR_IMPRINTERTOPBEFORE = 0, + TWPR_IMPRINTERTOPAFTER = 1, + TWPR_IMPRINTERBOTTOMBEFORE = 2, + TWPR_IMPRINTERBOTTOMAFTER = 3, + TWPR_ENDORSERTOPBEFORE = 4, + TWPR_ENDORSERTOPAFTER = 5, + TWPR_ENDORSERBOTTOMBEFORE = 6, + TWPR_ENDORSERBOTTOMAFTER = 7 +} + +/** CAP_PRINTERMODE values. */ +declare enum EnumDWT_CapPrinterMode { + /** Specifies that the printed text will consist of a single string. */ + TWPM_SINGLESTRING = 0, + /** Specifies that the printed text will consist of an enumerated list of strings to be printed in order. */ + TWPM_MULTISTRING = 1, + /** Specifies that the printed string will consist of a compound of a String followed by a value followed by a suffix string. */ + TWPM_COMPOUNDSTRING = 2 +} + +/** ICAP_BITDEPTHREDUCTION values. */ +declare enum EnumDWT_CapBitdepthReduction { + TWBR_THRESHOLD = 0, + TWBR_HALFTONE = 1, + TWBR_CUSTHALFTONE = 2, + TWBR_DIFFUSION = 3 +} + +/** ICAP_BITORDER values. */ +declare enum EnumDWT_CapBitOrder { + TWBO_LSBFIRST = 0, + /** Indicates that the leftmost bit in the byte (usually bit 7) is the byte's Most Significant Bit. */ + TWBO_MSBFIRST = 1 +} + +/** ICAP_FILTER values. */ +declare enum EnumDWT_CapFilterType { + TWFT_RED = 0, + TWFT_GREEN = 1, + TWFT_BLUE = 2, + TWFT_NONE = 3, + TWFT_WHITE = 4, + TWFT_CYAN = 5, + TWFT_MAGENTA = 6, + TWFT_YELLOW = 7, + TWFT_BLACK = 8 +} + +/** ICAP_FLASHUSED2 values. */ +declare enum EnumDWT_CapFlash { + TWFL_NONE = 0, + TWFL_OFF = 1, + TWFL_ON = 2, + TWFL_AUTO = 3, + TWFL_REDEYE = 4 +} + +/** ICAP_FLIPROTATION values. */ +declare enum EnumDWT_CapFlipRotation { + /** The images to be scanned are viewed in book form, flipping each page from left to right or right to left. */ + TWFR_BOOK = 0, + /** The images to be scanned are viewed in fanfold paper style, flipping each page up or down. */ + TWFR_FANFOLD = 1 +} + +/** ICAP_IMAGEFILTER values. */ +declare enum EnumDWT_CapImageFilter { + TWIF_NONE = 0, + TWIF_AUTO = 1, + /** Good for halftone images. */ + TWIF_LOWPASS = 2, + /** Good for improving text. */ + TWIF_BANDPASS = 3, + /** Good for improving fine lines. */ + TWIF_HIGHPASS = 4, + TWIF_TEXT = 3, + TWIF_FINELINE = 4 +} + +/** ICAP_LIGHTPATH values. */ +declare enum EnumDWT_CapLightPath { + TWLP_REFLECTIVE = 0, + TWLP_TRANSMISSIVE = 1 +} + +/** ICAP_LIGHTSOURCE values. */ +declare enum EnumDWT_CapLightSource { + TWLS_RED = 0, + TWLS_GREEN = 1, + TWLS_BLUE = 2, + TWLS_NONE = 3, + TWLS_WHITE = 4, + TWLS_UV = 5, + TWLS_IR = 6 +} + +/** TWEI_MAGTYPE values. (MD_ means Mag Type) Added 2.0 */ +declare enum EnumDWT_MagType { + /** Added 2.0 */ + TWMD_MICR = 0, + /** added 2.1 */ + TWMD_RAW = 1, + /** added 2.1 */ + TWMD_INVALID = 2 +} + +/** ICAP_NOISEFILTER values. */ +declare enum EnumDWT_CapNoiseFilter { + TWNF_NONE = 0, + TWNF_AUTO = 1, + TWNF_LONEPIXEL = 2, + TWNF_MAJORITYRULE = 3 +} + +/** ICAP_ORIENTATION values. */ +declare enum EnumDWT_CapORientation { + TWOR_ROT0 = 0, + TWOR_ROT90 = 1, + TWOR_ROT180 = 2, + TWOR_ROT270 = 3, + TWOR_PORTRAIT = 0, + TWOR_LANDSCAPE = 3, + /** 2.0 */ + TWOR_AUTO = 4, + /** 2.0 */ + TWOR_AUTOTEXT = 5, + /** 2.0 */ + TWOR_AUTOPICTURE = 6 +} + +/** ICAP_OVERSCAN values. */ +declare enum EnumDWT_CapOverscan { + TWOV_NONE = 0, + TWOV_AUTO = 1, + TWOV_TOPBOTTOM = 2, + TWOV_LEFTRIGHT = 3, + TWOV_ALL = 4 +} + +/** ICAP_PIXELFLAVOR values. */ +declare enum EnumDWT_CapPixelFlavor { + /** Zero pixel represents darkest shade. zero pixel represents darkest shade */ + TWPF_CHOCOLATE = 0, + /** Zero pixel represents lightest shade. zero pixel represents lightest shade */ + TWPF_VANILLA = 1 +} + +/** ICAP_PLANARCHUNKY values. */ +declare enum EnumDWT_CapPlanarChunky { + TWPC_CHUNKY = 0, + TWPC_PLANAR = 1 +} + +/** Data source status. */ +declare enum EnumDWT_DataSourceStatus { + /** Indicate the data source is closed. */ + TWDSS_CLOSED = 0, + /** Indicate the data source is opened. */ + TWDSS_OPENED = 1, + /** Indicate the data source is enabled. */ + TWDSS_ENABLED = 2, + /** Indicate the data source is acquiring image. */ + TWDSS_ACQUIRING = 3 +} + +/** Fit window type */ +declare enum EnumDWT_FitWindowType { + /** Fit the image to the width and height of the window */ + enumFitWindow = 0, + /** Fit the image to the height of the window */ + enumFitWindowHeight = 1, + /** Fit the image to the width of the window */ + enumFitWindowWidth = 2 +} + +declare enum EnumDWT_UploadDataFormat { + Binary = 0, + Base64 = 1 +} + +declare enum EnumDWT_MouseShape { + Default = 0, + Hand = 1, + Crosshair = 2, + Zoom = 3 +} + +/** + * @class + */ +// properties (get/set) / sync functions +interface WebTwain { + /** + * Returns or sets whether multi-page selection is supported. + * @type {bool} + */ + AllowMultiSelect: boolean; + + /** + * [Deprecated.] Returns or sets whether allowing the plugin to send authentication request. The default value of this property is TRUE. + * @type {bool} + */ + AllowPluginAuthentication: boolean; + + /** + * [Deprecated.] Returns or sets whether the async mode is activated. With this mode, Dynamic Web TWAIN is able to upload/download files via HTTP/FTP asynchronously. The default value is false. + * @type {bool} + */ + AsyncMode: boolean; + + /** + * Returns or sets the background color of the main control. It is a value specifying the 24-bit RGB value. + * @type {int} + */ + BackgroundColor: number; + + /** + * Returns or sets the fill color of the selected area of an image when it is cut, erased or rotated. It is a value specifying the 24-bit RGB value. + * @type {int} + */ + BackgroundFillColor: number; + + /** + * [Deprecated.] Returns the number of barcode detected in an image. + * @type {int} + */ + BarcodeCount: number; + + /** + * Returns or sets the pixel bit depths for the current value of PixelType property. This is a runtime property. + * @type {short} + */ + BitDepth: number; + + /** + * Returns the current deviation of the pixels in the image. + * @type {float} + */ + BlankImageCurrentStdDev: number; + + /** + * Returns or sets the standard deviation of the pixels in the image. + * @type {float} + */ + BlankImageMaxStdDev: number; + + /** + * Returns or sets the dividing line between black and white. The default value is 128. + * @type {int} + */ + BlankImageThreshold: number; + + /** + * [Deprecated.] Returns or sets the border style. + * @type {EnumDWT_BorderStyle} + */ + BorderStyle: EnumDWT_BorderStyle; + + /** + * Returns or sets the brightness values available within the Source. This is a runtime property. + * @type {float} + */ + Brightness: number; + + /** + * [Deprecated.] Sets or returns whether brokerprocess is enabled for scanning. + * @type {int} + */ + BrokerProcessType: number; + + /** + * Sets or returns how much physical memory is allowed for storing images currently loaded in Dynamic Web TWAIN. Once the limit is reached, images will be cached on the hard disk. + * @type {int} + */ + BufferMemoryLimit: number; + + /** + * Specifies the capabiltiy to be negotiated. This is a runtime property. + * @type {EnumDWT_Cap} + */ + Capability: EnumDWT_Cap; + + /** + * Sets or returns the index (0-based) of a list to indicate the Current Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property. + * @type {int} + */ + CapCurrentIndex: number; + + /** + * Sets or returns the current value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. + * @type {double} + */ + CapCurrentValue: number; + + /** + * Returns the index (0-based) of a list to indicate the Default Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime, read-only property. + * @type {int} + */ + CapDefaultIndex: number; + + /** + * Returns the default value in a range when the value of the CapType property is TWON_RANGE. This is a runtime, read-only property. + * @type {double} + */ + CapDefaultValue: number; + + /** + * Sets or returns the maximum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. + * @type {double} + */ + CapMaxValue: number; + + /** + * Sets or returns the minimum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. + * @type {double} + */ + CapMinValue: number; + + /** + * [Deprecated.] Sets or returns how many items are in the list when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. For String data type, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property. + * @type {int} + */ + CapNumItems: number; + + /** + * [Deprecated.] Replaced by GetCapItemsString method and SetCapItemsString method. + * @type {string} + */ + CapItemsString: string; + + /** + * Sets or returns the step size in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. + * @type {double} + */ + CapStepSize: number; + + /** + * Sets or returns the type of capability container used to exchange capability information between application and source. This is a runtime property. + * @type {EnumDWT_CapType} + */ + CapType: EnumDWT_CapType; + + /** + * Returns or sets the value of the capability specified by Capability property when the value of the CapType property is TWON_ONEVALUE. This is a runtime property. + * @type {double} + */ + CapValue: number; + + /** + * Sets or returns the string value for a capability when the value of the CapType property is TWON_ONEVALUE. This is a runtime property. + * @type {string} + */ + CapValueString: string; + + /** + * Sets or returns the value type for reading the value of a capability. This is a runtime property. + * @type {short} + */ + CapValueType: number; + + /** + * Returns or sets the contrast values available within the Source. This is a runtime property. + * @type {float} + */ + Contrast: number; + + /** + * Sets or returns the product name string for the application identity. + * @type {string} + */ + ProductName: string; + + /** + * Returns or sets current index of image in buffer. This is a runtime property. + * @type {short} + */ + CurrentImageIndexInBuffer: number; + + /** + * Returns the device name of current source. This is a runtime, read-only property. + * @type {string} + */ + CurrentSourceName: string; + + /** + * Returns the value indicating the data source status. This is a runtime, read-only property. + * @type {int} + */ + DataSourceStatus: number; + + /** + * Returns the device name of default source. This is a runtime, read-only property. + * @type {string} + */ + DefaultSourceName: string; + + /** + * Returns whether the source supports duplex. If so, it further returns the level of duplex the Source supports (one pass or two pass duplex). This is a runtime, read-only property. + * @type {int} + */ + Duplex: number; + + /** + * [Deprecated.] Returns or sets whether the user can zoom image using hot key. + * @type {bool} + */ + EnableInteractiveZoom: boolean; + + /** + * Returns the error code. This is a runtime, read-only property. + * @type {int} + */ + ErrorCode: number; + + /** + * Returns the error string. This is a runtime, read-only property. + * @type {string} + */ + ErrorString: string; + + /** + * Returns or sets whether to resize the image to fit the image to the width or height of the window. To use the property, the view mode should be set to -1 by -1. You can use SetViewMode method to set the view mode. + * @type {EnumDWT_FitWindowType} + */ + FitWindowType: EnumDWT_FitWindowType; + + /** + * Returns or sets the password used to log into the FTP server. + * @type {string} + */ + FTPPassword: string; + + /** + * Returns or sets the port number of the FTP server. + * @type {int} + */ + FTPPort: number; + + /** + * Returns or sets the user name used to log into the FTP server. + * @type {string} + */ + FTPUserName: string; + + /** + * Returns how many images are in buffer. This is a runtime, read-only property. + * @type {short} + */ + HowManyImagesInBuffer: number; + + /** + * Specifies the field name of uploaded image through POST. + * @type {string} + */ + HttpFieldNameOfUploadedImage: string; + + /** + * [Deprecated.] Sets or returns the password used to log into the HTTP server. + * @type {string} + */ + HTTPPassword: string; + + /** + * Returns or sets the port number of the HTTP server. + * @type {int} + */ + HTTPPort: number; + + /** + * Returns the response string from the HTTP server if an error occurs for HTTPUploadThroughPost() method. This is a runtime, read-only property. + * @type {string} + */ + HTTPPostResponseString: string; + + /** + * [Deprecated.] Returns or sets the user name used to log into the HTTP server. + * @type {string} + */ + HTTPUserName: string; + + /** + * Returns or sets whether the feature of disk caching is enabled. + * @type {bool} + */ + IfAllowLocalCache: boolean; + + /** + * Returns or sets whether insert or append new scanned images. + * @type {bool} + */ + IfAppendImage: boolean; + + /** + * Returns or sets whether the Source's Auto-brightness function is enabled. This is a runtime property. + * @type {bool} + */ + IfAutoBright: boolean; + + /** + * Returns or sets whether the data source (scanner) will discard blank images during scanning. The property works only if the device and its driver support discarding blank pages. You can find whether your device supports this capbility from its user manual. Or, you can use the built-in methods of Dynamic Web TWAIN to detect blank images: IsBlankImage, IsBlankImageEx. + * @type {bool} + */ + IfAutoDiscardBlankpages: boolean; + + /** + * Returns or sets whether the Source enable automatic document feeding process. This is a runtime property. + * @type {bool} + */ + IfAutoFeed: boolean; + + /** + * Turns automatic border detection on and off. The property works only if the device and its driver support detecting the border automatically. You can find whether your device supports this capbility from its user manual. + * @type {bool} + */ + IfAutomaticBorderDetection: boolean; + + /** + * Turns automatic skew correction on and off. + * @type {bool} + */ + IfAutomaticDeskew: boolean; + + /** + * Returns or sets whether the Source enables the automatic document scanning process. This is a runtime property. + * @type {bool} + */ + IfAutoScan: boolean; + + /** + * Returns or sets whether close the Data Source User Interface after acquire all images. Default value of this property is FALSE. + * @type {bool} + */ + IfDisableSourceAfterAcquire: boolean; + + /** + * Returns or sets whether the Source supports duplex. If TRUE, the scanner scans both sides of a paper; otherwise, the scanner will scan only one side of the image. This is a runtime property. + * @type {bool} + */ + IfDuplexEnabled: boolean; + + /** + * Returns or sets whether the Automatic Document Feeder (ADF) is enabled. This is a runtime property. + * @type {bool} + */ + IfFeederEnabled: boolean; + + /** + * Returns whether or not there are documents loaded in the Source's feeder when IfFeederEnabled and IfPaperDetectable are TRUE. This is a runtime, read-only property. + * @type {bool} + */ + IfFeederLoaded: boolean; + + /** + * Returns or sets whether to resize the image to fit the size of window when the view mode is set to -1 by -1. You can use SetViewMode method to set the view mode. + * @type {bool} + */ + IfFitWindow: boolean; + + /** + * [Deprecated.] Returns or sets whether the UI (User Interface) of Source runs in modal state. Default value of this property is TRUE. + * @type {bool} + */ + IfModalUI: boolean; + + /** + * Sets or returns whether Dynamic Web TWAIN uses Graphics Device Interface (GDI) when decoding images. + * @type {bool} + */ + IfOpenImageWithGDIPlus: boolean; + + /** + * Returns the value whether the Source has a paper sensor that can detect documents on the ADF or Flatbed. This is a runtime, read-only property. + * @type {bool} + */ + IfPaperDetectable: boolean; + + /** + * Returns or sets whether FTP passive mode is enabled. + * @type {bool} + */ + IfPASVMode: boolean; + + /** + * [Deprecated.] Returns or sets whether communicate with device in a separate thread. Default value of this property is FALSE. + * @type {bool} + */ + IfScanInNewThread: boolean; + + /** + * Sets or returns whether to show the cancel dialog when uploading images to server. + * @type {bool} + */ + IfShowCancelDialogWhenImageTransfer: boolean; + + /** + * Returns or sets whether to show the file dialog box when saving scanned images or loading images from local folder. + * @type {bool} + */ + IfShowFileDialog: boolean; + + /** + * Returns or sets whether the Source displays a progress indicator during acquisition and transfer, regardless of whether the Source's user interface is active. This is a runtime property. + * @type {bool} + */ + IfShowIndicator: boolean; + + /** + * [Deprecated.] Returns or sets whether the driver of the printer displays the User Interface. + * @type {bool} + */ + IfShowPrintUI: boolean; + + /** + * Returns or sets whether the progress bar will be displayed during the transaction. This is a runtime property. + * @type {bool} + */ + IfShowProgressBar: boolean; + + /** + * Returns or sets whether the Source displays the User Interface. + * @type {bool} + */ + IfShowUI: boolean; + + /** + * Returns or sets whether SSL is used when uploading or downloading images. + * @type {bool} + */ + IfSSL: boolean; + + /** + * Return or sets whether the Source allows to save many images in one TIFF file. The default value is FALSE. + * @type {bool} + */ + IfTiffMultiPage: boolean; + + /** + * Returns whether the Source supports acquisition with the UI (User Interface) disabled. If FALSE, indicates that this Source can only support acquisition with the UI enabled. This is a runtime, read-only property. + * @type {bool} + */ + IfUIControllable: boolean; + + /** + * Sets or returns whether Dynamic Web TWAIN uses the new TWAIN Data Source Manager (TWAINDSM.dll) when acquiring images from TWAIN devices. + * @type {bool} + */ + IfUseTwainDSM: boolean; + + /** + * Specifies whether or not to automatically scroll to the last image or stay on the current image when loading or acquiring images + * @type {bool} + */ + IfAutoScroll: boolean; + + /** + * [Deprecated.] The number of bits in each image pixel (or bit depth). This is a runtime, read-only property. + * @type {short} + */ + ImageBitsPerPixel: number; + + /** + * Returns or sets whether a TWAIN driver or Native Scan of Mac OS X is used for document scanning. This property works for Mac edition only. + * @type {int} + */ + ImageCaptureDriverType: number; + + /** + * [Deprecated.] Returns or sets whether the image enumerator is enabled in Image Editor. + * @type {bool} + */ + ImageEditorIfEnableEnumerator: boolean; + + /** + * [Deprecated.] Returns or sets whether the Image Editor is a modal window. + * @type {bool} + */ + ImageEditorIfModal: boolean; + + /** + * [Deprecated.] Returns or sets whether the Image Editor is read-only. + * @type {bool} + */ + ImageEditorIfReadonly: boolean; + + /** + * [Deprecated.] Returns or sets the title of Image Editor window. + * @type {string} + */ + ImageEditorWindowTitle: string; + + /** + * Returns the document number of the current image. This is a runtime, read-only property. + * @type {int} + */ + ImageLayoutDocumentNumber: number; + + /** + * Returns the value of the bottom-most edge of the current image frame (in Unit). This is a read-only runtime property. + * @type {float} + */ + ImageLayoutFrameBottom: number; + + /** + * Returns the value of the left-most edge of the current image frame (in Unit). This is a runtime, read-only property. + * @type {float} + */ + ImageLayoutFrameLeft: number; + + /** + * Returns the frame number of the current image. This is a runtime, read-only property. + * @type {int} + */ + ImageLayoutFrameNumber: number; + + /** + * Returns the value of the right-most edge of the current image frame (in Unit). This is a runtime, read-only property. + * @type {float} + */ + ImageLayoutFrameRight: number; + + /** + * Returns the value of the top-most edge of the current image frame (in Unit). This is a runtime, read-only property. + * @type {float} + */ + ImageLayoutFrameTop: number; + + /** + * Returns the page number of the current image. This is a runtime, read-only property. + * @type {Long} + */ + ImageLayoutPageNumber: number; + + /** + * [Deprecated.] Returns how tall/long, in pixels, the image is. This is a runtime, read-only property. + * @type {int} + */ + ImageLength: number; + + /** + * Returns or sets the margin between images when multiple images are displayed in Dynamic Web TWAIN. + * @type {short} + */ + ImageMargin: number; + + /** + * Returns the pixel type of the current image. This is a runtime, read-only property. Please note the property is only valid in OnPreTransfer and OnPostTransfer event. + * @type {EnumDWT_PixelType} + */ + ImagePixelType: EnumDWT_PixelType; + + /** + * [Deprecated.] Returns how width, in pixels, the image is. This is a runtime, read-only property. + * @type {int} + */ + ImageWidth: number; + + /** + * [Deprecated.] Returns the X resolution of the current image. X resolution is the number of pixels per Unit in the horizontal direction. This is a runtime, read-only property. + * @type {float} + */ + ImageXResolution: number; + + /** + * [Deprecated.] Returns the Y resolution of the current image. Y resolution is the number of pixels per Unit in the vertical direction. This is a runtime, read-only property. + * @type {float} + */ + ImageYResolution: number; + + /** + * Returns or sets the quality of JPEG files and PDF files using JPEG compression. + * @type {short} + */ + JPEGQuality: number; + + /** + * Returns or sets the log level for debugging. + * @type {short} + */ + LogLevel: number; + + /** + * Return the magnetic data if the scanner support magnetic data recognition. + * @type {string} + */ + MagData: string; + + /** + * Return the magnetic type if the scanner support magnetic data recognition. + * @type {short} + */ + MagType: number; + + /** + * Sets or returns the manufacture string for the application identity. + * @type {string} + */ + Manufacturer: string; + + /** + * Returns or sets the maximum number of images can be held in buffer. + * @type {short} + */ + MaxImagesInBuffer: number; + + /** + * [Deprecated.] Returns or sets how many threads can be used when you upload files through POST. + * @type {int} + */ + MaxInternetTransferThreads: number; + + /** + * Sets or returns the maximum allowed size when Dynamic Web TWAIN uploads a document. + * @type {int} + */ + MaxUploadImageSize: number; + + /** + * Returns or sets the shape of the mouse. + * @type {bool} + */ + MouseShape: boolean; + + /** + * Returns the X co-ordinate of the mouse. This is a runtime property. + * @type {int} + */ + MouseX: number; + + /** + * Returns the Y co-ordinate of the mouse. This is a runtime property. + * @type {int} + */ + MouseY: number; + + /** + * Returns or sets the page size(s) the Source can/should use to acquire image data. This is a runtime property. + * @type {short} + */ + PageSize: number; + + /** + * Returns or sets the name of the person who creates the PDF document. + * @type {string} + */ + PDFAuthor: string; + + /** + * Returns or sets the compression type of PDF files. This is a runtime property. + * @type {EnumDWT_PDFCompressionType} + */ + PDFCompressionType: EnumDWT_PDFCompressionType; + + /** + * Returns or sets the date when the PDF document is created. + * @type {string} + */ + PDFCreationDate: string; + + /** + * Returns or sets the name of the application that created the original document, if the PDF document is converted from another form. + * @type {string} + */ + PDFCreator: string; + + /** + * Returns or sets the keywords associated with the PDF document. + * @type {string} + */ + PDFKeywords: string; + + /** + * Returns or sets the date when the PDF document is last modified. + * @type {string} + */ + PDFModifiedDate: string; + + /** + * Returns or sets the name of the application that converted the PDF document from its native. + * @type {string} + */ + PDFProducer: string; + + /** + * Returns or sets the subject of the PDF document. + * @type {string} + */ + PDFSubject: string; + + /** + * Returns or sets the title of the PDF document. + * @type {string} + */ + PDFTitle: string; + + /** + * Returns or sets the value of the PDF version. + * @type {string} + */ + PDFVersion: string; + + /** + * Returns the number of transfers the Source is ready to supply, upon demand. This is a runtime, read-only property. + * @type {short} + */ + PendingXfers: number; + + /** + * Returns or sets the pixel flavor for acquired images. This is a runtime property. + * @type {short} + */ + PixelFlavor: number; + + /** + * Returns or sets the pixel type of current data source. This is a runtime property. Using this property after calling OpenSource() method and before calling AcquireImage(). + * @type {EnumDWT_PixelType} + */ + PixelType: EnumDWT_PixelType; + + /** + * Sets or returns the product family string for the application identity. + * @type {string} + */ + ProductFamily: string; + + /** + * Sets the product key. A product key is generated in Licensing Tool which is intalled with Dynamic Web TWAIN. Each product key corresponds with a license. + * @type {string} + */ + ProductKey: string; + + /** + * [Deprecated.] Returns or sets the name of the proxy server. + * @type {string} + */ + ProxyServer: string; + + /** + * Returns or sets the current resolution for acquired images. This is a runtime property. + * @type {float} + */ + Resolution: number; + + /** + * Returns or sets how many scanned images are selected. + * @type {short} + */ + SelectedImagesCount: number; + + /** + * Returns or sets the border color of the selected image. It is a value specifying the 24-bit RGB value. + * @type {int} + */ + SelectionImageBorderColor: number; + + /** + * Specifies a fixed aspect ratio to be used for selecting an area. + * @type {float} + */ + SelectionRectAspectRatio: number; + + /** + * Returns how many sources are installed in the system. This is a runtime, read-only property. + * @type {int} + */ + SourceCount: number; + + /** + * [Deprecated.] Replaced by GetSourceNameItems method. + * @type {string} + */ + SourceNameItems: string; + + /** + * [Deprecated.] + * @type {string} + */ + GetSourceNames: string; + + /** + * Returns or sets the compression type of TIFF files. This is a runtime property. + * @type {EnumDWT_TIFFCompressionType} + */ + TIFFCompressionType: EnumDWT_TIFFCompressionType; + + /** + * Sets or returns the transfer mode. + * @type {EnumDWT_TransferMode} + */ + TransferMode: EnumDWT_TransferMode; + + /** + * Returns or sets the unit of measure. This is a runtime property. + * @type {short} + */ + Unit: number; + + /** + * Sets or returns the version info string for the application identity. + * @type {string} + */ + VersionInfo: string; + + /** + * Returns and sets the number of images you are willing to transfer per session. This is a runtime property. + * @type {short} + */ + XferCount: number; + + /** + * Returns or sets zoom factor for the image, only valid When the view mode is set to -1 by -1. + * @type {float} + */ + Zoom: number; + + /** + * Binds a specified function to an event, so that the function gets called whenever the event fires. + * @method WebTwain#RegisterEvent + * @param {string} name the name of the event that the function is bound to. + * @param {object} evt specifies the function to call when event fires. + * @return {bool} + */ + RegisterEvent(name: string, evt: object): boolean; + + // --- SCAN start -- + + /** + * Cancels all pending transfers. + * @method WebTwain#CancelAllPendingTransfers + * @return {bool} + */ + CancelAllPendingTransfers(): boolean; + + /** + * Closes Data Source. + * @method WebTwain#CloseSource + * @return {bool} + */ + CloseSource(): boolean; + + /** + * Closes and unloads Data Source Manager. + * @method WebTwain#CloseSourceManager + * @return {bool} + */ + CloseSourceManager(): boolean; + + /** + * Disable the source. If the source's user interface is displayed when the source is enabled, it will be closed. + * @method WebTwain#DisableSource + * @return {bool} + */ + DisableSource(): boolean; + + /** + * Sets the Source to eject the current page and advance the next page in the document feeder into the feeder acquire area when IfFeederEnabled is TRUE. + * @method WebTwain#FeedPage + * @return {bool} + */ + FeedPage(): boolean; + + /** + * Retrieve the device type of the currently selected data source, it might be a scanner, a web camera, etc. + * @method WebTwain#GetDeviceType + * @return {int} + */ + GetDeviceType(): number; + + /** + * Get the source name according to the source index. + * @method WebTwain#GetSourceNameItems + * @param {short} index int index. Index is 0-based and can not be greater than SourceCount property. + * @return {string} + */ + GetSourceNameItems(index: number): string; + + /** + * Loads the specified Source into main memory and causes its initialization, + * placing Dynamic Web TWAIN into Capability Negotiation state. If no source is + * specified (no SelectSource() or SelectSourceByIndex() is called), opens the default source. + * @method WebTwain#OpenSource + * @return {bool} + */ + OpenSource(): boolean; + + /** + * Loads and opens Data Source Manager. + * @method WebTwain#OpenSourceManager + * @return {bool} + */ + OpenSourceManager(): boolean; + + /** + * Reverts the current image layout to the Data Source's default. + * @method WebTwain#ResetImageLayout + * @return {bool} + */ + ResetImageLayout(): boolean; + + /** + * Sets the Source to return the current page to the input side of the document feeder and + * feed the last page from the outside of the feeder back into the acquisition area if IfFeederEnabled is TRUE. + * @method WebTwain#RewindPage + * @return {bool} + */ + RewindPage(): boolean; + + /** + * Brings up the TWAIN Data Source Manager's Source Selection User Interface (UI) + * so that user can choose which Data Source to be the current Source. + * @method WebTwain#SelectSource + * @return {bool} + */ + SelectSource(): boolean; + + /** + * Selects the index-the source in SourceNameItems property as the current source. + * @method WebTwain#SelectSourceByIndex + * @param {short} index It is the index of SourceNameItems property. + * @return {bool} + */ + SelectSourceByIndex(index: number): boolean; + + /** + * Sets file name and file format information used in File Transfer Mode. + * @method WebTwain#SetFileXferInfo + * @param {string} fileName the name of the file to be used in transfer. + * @param {EnumDWT_FileFormat} fileFormat an enumerated value indicates the format of the image. + * @return {bool} + */ + SetFileXferInfo(fileName: string, fileFormat: EnumDWT_FileFormat): boolean; + + /** + * Sets the left, top, right, and bottom sides of the image layout rectangle for the current Data Source. + * @method WebTwain#SetImageLayout + * @param {float} left specifies the floating point number for the left side of the image layout rectangle. + * @param {float} top specifies the floating point number for the top side of the image layout rectangle. + * @param {float} right specifies the floating point number for the right side of the image layout rectangle. + * @param {float} bottom specifies the floating point number for the bottom side of the image layout rectangle. + * @return {bool} + */ + SetImageLayout(left: number, top: number, right: number, bottom: number): boolean; + + /** + * Clears all the web forms which are used for image uploading. + * @method WebTwain#ClearAllHTTPFormField + * @return {bool} + */ + ClearAllHTTPFormField(): boolean; + + /** + * Clears the content of all custom tiff tags. + * @method WebTwain#ClearTiffCustomTag + * @return {void} + */ + ClearTiffCustomTag(): void; + + /** + * Check whether a certain file exists on the local disk. + * @method WebTwain#FileExists + * @param {string} localFile specifies the absolute path of the local file. + * @return {bool} + */ + FileExists(localFile: string): boolean; + + /** + * Downloads an image from the FTP server. + * @method WebTwain#FTPDownload + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPDownload(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Directly download a file from the FTP server to local disk without loading it into Dynamic Web TWAIN. + * @method WebTwain#FTPDownloadDirectly + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. + * @param {string} localFile specify a full path to store the file. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPDownloadDirectly(FTPServer: string, FTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Downloads an image from the FTP server. + * @method WebTwain#FTPDownloadEx + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. + * @param {EnumDWT_ImageType} lImageType simage format of the file to be downloaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPDownloadEx(FTPServer: string, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the image of a specified index in the buffer to the FTP server. + * @method WebTwain#FTPUpload + * @param {string} FTPServer the name of the FTP server. + * @param {short} sImageIndex specifies the index of the image in the buffer. The index is 0-based. + * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPUpload(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Directly upload a specific file to the FTP server without loading it into Dynamic Web TWAIN. + * @method WebTwain#FTPUploadDirectly + * @param {string} FTPServer the name of the FTP server. + * @param {string} localFile specify the the full path of a local file. + * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPUploadDirectly(FTPServer: string, localFile: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the image of a specified index in the buffer to the FTP server as a specified image format. + * @method WebTwain#FTPUploadEx + * @param {string} FTPServer the name of the FTP server. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPUploadEx(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads all images in buffer to the FTP server as Multi-Page TIFF. + * @method WebTwain#FTPUploadAllAsMultiPageTIFF + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPUploadAllAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads all images in buffer to the FTP server as Multi-Page PDF. + * @method WebTwain#FTPUploadAllAsPDF + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPUploadAllAsPDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the selected images in buffer to the FTP server as Multi-Page PDF. + * @method WebTwain#FTPUploadAsMultiPagePDF + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPUploadAsMultiPagePDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the selected images in buffer to the FTP server as Multi-Page TIFF. + * @method WebTwain#FTPUploadAsMultiPageTIFF + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPUploadAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Downloads an image from the HTTP server. + * @method WebTwain#HTTPDownload + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile the name of the image to be downloaded. It should be the relative path of the file on the HTTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPDownload(HTTPServer: string, HTTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Directly downloads a file from the HTTP server to a local disk without loading it into Dynamic Web TWAIN. + * @method WebTwain#HTTPDownloadDirectly + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile The relative path of the file on the HTTP server. + * @param {string} localFile specify the location to store the downloaded file. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPDownloadDirectly(HTTPServer: string, HTTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Downloads an image from the HTTP server. + * @method WebTwain#HTTPDownloadEx + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info) + * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPDownloadEx(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Download an image from the server using a HTTP Post call. + * @method WebTwain#HTTPDownloadThroughPost + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info) + * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPDownloadThroughPost(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the image of a specified index in the buffer to the HTTP server through the HTTP POST method. + * @method WebTwain#HTTPUploadThroughPost + * @param {string} HTTPServer the name of the HTTP server. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {bool} + */ + HTTPUploadThroughPost(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Directly upload a specific local file to the HTTP server through the HTTP POST method without loading it into Dynamic Web TWAIN. + * @method WebTwain#HTTPUploadThroughPostDirectly + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} localFile specifies the path of a local file . + * @param {string} ActionPage the specified page for posting files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the file to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {bool} + */ + HTTPUploadThroughPostDirectly(HTTPServer: string, localFile: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP POST method. + * @method WebTwain#HTTPUploadThroughPostEx + * @param {string} HTTPServer the name of the HTTP server. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.s + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadFailure. + * @return {bool} + */ + HTTPUploadThroughPostEx(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads all images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadAllThroughPostAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {bool} + */ + HTTPUploadAllThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadThroughPostAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {bool} + */ + HTTPUploadThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads all images in the buffer to the HTTP server through HTTP Post method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadAllThroughPostAsPDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {bool} + */ + HTTPUploadAllThroughPostAsPDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadThroughPostAsMultiPagePDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {bool} + */ + HTTPUploadThroughPostAsMultiPagePDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Directly uploads a specific local file to the HTTP server through the HTTP PUT method without loading it into Dynamic Web TWAIN. + * @method WebTwain#HTTPUploadThroughPutDirectly + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} localFile specifies the path of a local file. + * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUploadThroughPutDirectly(HTTPServer: string, localFile: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server through the HTTP PUT method. + * @method WebTwain#HTTPUploadThroughPut + * @param {string} HTTPServer the name of the HTTP server. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} RemoteFileName the name of the image to be created on the HTTP server. It should a relative path on the web server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUploadThroughPut(HTTPServer: string, sImageIndex: number, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP PUT method. + * @method WebTwain#HTTPUploadThroughPutEx + * @param {string} HTTPServer the name of the HTTP server. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUploadThroughPutEx(HTTPServer: string, sImageIndex: number, RemoteFileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadAllThroughPutAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUploadAllThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadThroughPutAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUploadThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadAllThroughPutAsPDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUploadAllThroughPutAsPDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadThroughPutAsMultiPagePDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUploadThroughPutAsMultiPagePDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Configures how segmented upload is done. + * @method WebTwain#SetUploadSegment + * @param {int} segmentUploadThreshold specifies the threshold (in MB) over which segmented upload will be invoked. + * @param {int} moduleSize specifies the size of each segment (in KB). + * @return {bool} + */ + SetUploadSegment (segmentUploadThreshold: number, moduleSize: number): boolean; + + /** + * Uploads the images specified by the indices to the HTTP server. + * @method WebTwain#HTTPUpload + * @param {string} url the url where the images are sent in a POST request. + * @param {Array} indices indices specifies which images are to be uploaded. + * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be uploaded. + * @param {EnumDWT_UploadDataFormat} dataFormat whether to upload the images as binary or a base64-based string. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUpload (url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Loads a DIB format image from Clipboard into the Dynamic Web TWAIN. + * @method WebTwain#LoadDibFromClipboard + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + LoadDibFromClipboard(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Loads an image into the Dynamic Web TWAIN. + * @method WebTwain#LoadImage + * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + LoadImage(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Loads an image into the Dynamic Web TWAIN. + * @method WebTwain#LoadImageEx + * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be loaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + LoadImageEx(localFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Loads image from a base64 byte array with the specified file format. + * @method WebTwain#LoadImageFromBase64Binary + * @param {string} bry specifies the base64 string data. + * @param {EnumDWT_ImageType} lImageType specifies the file format. + * @return {bool} + */ + LoadImageFromBase64Binary(bry: string, lImageType: EnumDWT_ImageType): boolean; + + /** + * [Deprecated.] Loads image from a byte array with the specified file format. + * @method WebTwain#LoadImageFromBytes + * @param {int} lBufferSize Specifies the buffer size. + * @param {Array} buffer A byte array of the image data. + * @param {EnumDWT_ImageType} lImageType Specifies the file format. + * @return {bool} + */ + LoadImageFromBytes(lBufferSize: number, buffer: number[], lImageType: EnumDWT_ImageType): boolean; + + /** + * Saves all images in buffer as a MultiPage TIFF file. + * @method WebTwain#SaveAllAsMultiPageTIFF + * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + SaveAllAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves all images in buffer as a Multi-Page PDF file. + * @method WebTwain#SaveAllAsPDF + * @param {string} localFile the name of the Multi-Page PDF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + SaveAllAsPDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the image of a specified index in buffer as a BMP file. + * @method WebTwain#SaveAsBMP + * @param {string} localFile the name of the BMP file to be saved. It should be an absolute path on the local disk. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + SaveAsBMP(localFile: string, sImageIndex: number): boolean; + + /** + * Saves the image of a specified index in buffer as a JPEG file. + * @method WebTwain#SaveAsJPEG + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + SaveAsJPEG(localFile: string, sImageIndex: number): boolean; + + /** + * Saves the image of a specified index in buffer as a PDF file. + * @method WebTwain#SaveAsPDF + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + SaveAsPDF(localFile: string, sImageIndex: number): boolean; + + /** + * Saves the image of a specified index in buffer as a PNG file. + * @method WebTwain#SaveAsPNG + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + SaveAsPNG(localFile: string, sImageIndex: number): boolean; + + /** + * Saves the image of a specified index in buffer as a TIFF file. + * @method WebTwain#SaveAsTIFF + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + SaveAsTIFF(localFile: string, sImageIndex: number): boolean; + + /** + * Saves the selected images in buffer as a Multipage PDF file. + * @method WebTwain#SaveSelectedImagesAsMultiPagePDF + * @param {string} localFile the name of the MultiPage PDF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + SaveSelectedImagesAsMultiPagePDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the selected images in buffer as a Multipage TIFF file. + * @method WebTwain#SaveSelectedImagesAsMultiPageTIFF + * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + SaveSelectedImagesAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the selected images in buffer to base64 string. + * @method WebTwain#SaveSelectedImagesToBase64Binary + * @return {string} + */ + SaveSelectedImagesToBase64Binary(): string; + + /** + * [Deprecated.] Saves the selected images in buffer to a byte array in the specified file format. + * @method WebTwain#SaveSelectedImagesToBytes + * @param {int} bufferSize specified the buffer size. + * @param {Array} buffer A byte array of the image data. + * @return {int} + */ + SaveSelectedImagesToBytes(bufferSize: number, buffer: number[]): number; + + /** + * [Deprecated.] Sets current cookie into the Http Header to be used when uploading scanned images through POST. + * @method WebTwain#SetCookie + * @param {string} cookie the cookie on current page. + * @return {void} + */ + SetCookie(cookie: string): void; + + /** + * Sets a text parameter as a filed in a web form. This form is maintained by the component itself (meaning it's not on the page). All fields in this form will be passed to the server when uploading images. + * @method WebTwain#SetHTTPFormField + * @param {string} FieldName specifies the name of a text field in web form. + * @param {string} FieldValue specifies the value of a text field in web form. + * @return {bool} + */ + SetHTTPFormField(FieldName: string, FieldValue: string): boolean; + + /** + * Sets a custom tiff tag. Currently you can set up to 32 tags. The string to be set in a tag can be encoded with base64. + * @method WebTwain#SetTiffCustomTag + * @param {int} tag specifies the tag identifier. The value should be between 600 and 700. + * @param {string} content the string to be set for this tag. The string will be written to the .tiff file when you save/upload it. If the string is base64 encoded, we'll decode it before writing it. + * @param {bool} base64Str if you'd like to encode the string with base64, set this to true. Otherwise, the string will be plin text. + * @return {bool} + */ + SetTiffCustomTag(tag: number, content: string, base64Str: boolean): boolean; + + /** + * Show save file dialog or show open file dialog. + * @method WebTwain#ShowFileDialog + * @param {bool} SaveDialog True -- show save file dialog, False -- show open file dialog. + * @param {string} Filter The filter name specifies the filter pattern (for example, "*.TXT"). To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string. To retrieve a shortcut's target without filtering, use the string "All Files\0*.*\0\0", but the program will replace "\0" with "|" automatically. + * @param {int} FilterIndex The index of the currently selected filter in the File Types control. The buffer pointed to by Filter contains pairs of strings that define the filters. The index is 0-based. + * @param {string} DefExtension Define the default extension. GetOpenFileName and GetSaveFileName append this extension to the file name only if the user fails to type an extension. If this member is NULL and the user fails to type an extension, no extension is appended. + * @param {string} InitialDir The initial directory. The algorithm for selecting the initial directory varies on different platforms. + * @param {bool} AllowMultiSelect True -- allows users to select more than one file, False -- only allows to select one file. + * @param {bool} OverwritePrompt True -- If a file already exists with the same name, the old file will be simply overwritten, False -- not allows to save and overwrite a same name file. + * @param {int} Flags If this parameter equals 0, the program will be initiated with the default flags, otherwise initiated with the cumstom value and paramters "AllowMultiSelect" and "OverwritePrompt" will be useless. + * @return {bool} + */ + ShowFileDialog(SaveDialog: boolean, Filter: string, FilterIndex: number, DefExtension: string, InitialDir: string, AllowMultiSelect: boolean, OverwritePrompt: boolean, Flags: number): boolean; + + /** + * Gets information of the capability specified by the Capability property. + * @method WebTwain#CapGet + * @return {bool} + */ + CapGet(): boolean; + + /** + * Returns the Source's current Value for the specified capability. + * @method WebTwain#CapGetCurrent + * @return {bool} + */ + CapGetCurrent(): boolean; + + /** + * Returns the Source's Default Value for the specified capability. This is the Source's preferred default value. + * @method WebTwain#CapGetDefault + * @return {bool} + */ + CapGetDefault(): boolean; + + /** + * Returns the value of the bottom-most edge of the specified frame. + * @method WebTwain#CapGetFrameBottom + * @param {short} index specifies the value of which frame to get. The index is 0-based. + * @return {float} + */ + CapGetFrameBottom(index: number): number; + + /** + * Returns the value (in Unit) of the left-most edge of the specified frame. + * @method WebTwain#CapGetFrameLeft + * @param {short} index specifies the value of which frame to get. The index is 0-based. + * @return {float} + */ + CapGetFrameLeft(index: number): number; + + /** + * Returns the value (in Unit) of the left-most edge of the specified frame. + * @method WebTwain#CapGetFrameRight + * @param {short} index specifies the value of which frame to get. The index is 0-based. + * @return {float} + */ + CapGetFrameRight(index: number): number; + + /** + * Returns the value (in Unit) of the top-most edge of the specified frame. + * @method WebTwain#CapGetFrameTop + * @param {short} index specifies the value of which frame to get. The index is 0-based. + * @return {float} + */ + CapGetFrameTop(index: number): number; + + /** + * Queries whether the Source supports a particular operation on the capability. + * @method WebTwain#CapIfSupported + * @param {EnumDWT_MessageType} messageType specifies the type of capability operation. + * @return {bool} + */ + CapIfSupported(messageType: EnumDWT_MessageType): boolean; + + /** + * Changes the Current Value of the capability specified by Capability property back to its power-on value. + * @method WebTwain#CapReset + * @return {bool} + */ + CapReset(): boolean; + + /** + * Sets the current capability using the container type specified by CapType property. The current capability is specified by Capability property. + * @method WebTwain#CapSet + * @return {bool} + */ + CapSet(): boolean; + + /** + * Sets the values of the specified frame. + * @method WebTwain#CapSetFrame + * @param {short} index specifies the values of which frame to set. The index is 0-based. + * @param {float} left the value (in Unit) of the left-most edge of the specified frame. + * @param {float} top the value (in Unit) of the top-most edge of the specified frame. + * @param {float} right the value (in Unit) of the right-most edge of the specified frame. + * @param {float} bottom the value (in Unit) of the bottom-most edge of the specified frame. + * @return {bool} + */ + CapSetFrame(index: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Get the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. + * @method WebTwain#GetCapItems + * @param {int} index Index is 0-based. It is the index of the cap item. + * @return {double} + */ + GetCapItems(index: number): number; + + /** + * Returns the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. + * @method WebTwain#GetCapItemsString + * @param {int} index Index is 0-based. It is the index of the cap item. + * @return {string} + */ + GetCapItemsString(index: number): string; + + /** + * Set the value of the specified cap item. + * @method WebTwain#SetCapItems + * @param {int} index Index is 0-based. It is the index of the cap item. + * @param {double} newVal The Double type of CapItems property is used to present Double, Single(float), Long, int and even boolean types. For string type, please use CapItemsstring property. + * @return {void} + */ + SetCapItems(index: number, newVal: number): void; + + /** + * Set the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. + * @method WebTwain#SetCapItemsString + * @param {int} index Index is 0-based. It is the index of the cap item. + * @param {string} newVal The new value to be set. + * @return {void} + */ + SetCapItemsString(index: number, newVal: string): void; + // --- SCAN end -- + + // --- View & Edit start -- + + /** + * Add text on an image. + * @method WebTwain#AddText + * @param {short} sImageIndex the index of the image that you want to add text to. + * @param {int} x the x coordinate for the text. + * @param {int} y the y coordinate for the text. + * @param {string} text the content of the text that you want to add. + * @param {int} txtColor the color for the text. + * @param {int} backgroundColor the background color. + * @param {float} backgroundRoundRadius ranging from 0 to 0.5. Please NOTE that MAC version does not support this parameter. + * @param {float} backgroundOpacity specifies the opacity of the background of the added text, it ranges from 0 to 1.0. Please NOTE that Mac version only supports value 0 and 1 + * @return {bool} + */ + AddText(sImageIndex: number, x: number, y: number, text: string, txtColor: number, backgroundColor: number, backgroundRoundRadius: number, backgroundOpacity: number): boolean; + + /** + * Create the font for adding text using the method AddText. + * @method WebTwain#CreateTextFont + * @param {int} height Specifies the desired height (in logical units) of the font.The absolute value of nHeight must not exceed 16,384 device units after it is converted.For all height comparisons, the font mapper looks for the largest font that does not exceed the requested size or the smallest font if all the fonts exceed the requested size. + * @param {int} width Specifies the average width (in logical units) of characters in the font. If Width is 0, the aspect ratio of the device will be matched against the digitization aspect ratio of the available fonts to find the closest match, which is determined by the absolute value of the difference. + * @param {int} escapement Specifies the angle (in 0.1-degree units) between the escapement vector and the x-axis of the display surface. The escapement vector is the line through the origins of the first and last characters on a line. The angle is measured counterclockwise from the x-axis. + * @param {int} orientation Specifies the angle (in 0.1-degree units) between the baseline of a character and the x-axis.The angle is measured counterclockwise from the x-axis for coordinate systems in which the y-direction is down and clockwise from the x-axis for coordinate systems in which the y-direction is up. + * @param {int} weight Specifies the font weight (in inked pixels per 1000). The described valuesare approximate; the actual appearance depends on the typeface. Some fonts haveonly FW_NORMAL, FW_REGULAR, and FW_BOLD weights. If FW_DONTCARE is specified, a default weight is used. + * @param {short} italic Specifies an italic font if set to TRUE. + * @param {short} underline Specifies an underlined font if set to TRUE. + * @param {short} strikeOut A strikeout font if set to TRUE. + * @param {short} charSet Specifies the font's character set. The OEM character set is system-dependent. Fonts with other character sets may exist in the system. An application that uses a font with an unknown character set must not attempt to translate or interpret strings that are to be rendered with that font. + * @param {short} outputPrecision Specifies the desired output precision. The output precision defines how closely the output must match the requested font's height, width, character orientation, escapement, and pitch. + * @param {short} clipPrecision Specifies the desired clipping precision. The clipping precision defines how to clip characters that are partially outside the clipping region. + * @param {short} quality Specifies the font's output quality, which defines how carefully the GDI must attempt to match the logical-font attributes to those of an actual physical font. + * @param {short} pitchAndFamily The pitch and family of the font. + * @param {string} faceName the typeface name, the length of this string must not exceed 32 characters, including the terminating null character. + * @return {bool} + */ + CreateTextFont(height: number, width: number, escapement: number, orientation: number, weight: number, italic: number, underline: number, strikeOut: number, charSet: number, outputPrecision: number, clipPrecision: number, quality: number, pitchAndFamily: number, faceName: string): boolean; + + /** + * Copies the image of a specified index in buffer to clipboard in DIB format. + * @method WebTwain#CopyToClipboard + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + CopyToClipboard(sImageIndex: number): boolean; + + /** + * Clears the specified area of a specified image, and fill the area with the fill color. + * @method WebTwain#Erase + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {bool} + */ + Erase(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Returns the pixel bit depth of the selected image. + * @method WebTwain#GetImageBitDepth + * @param {short} sImageIndex specifies the index of image. The index is 0-based. + * @return {short} + */ + GetImageBitDepth(sImageIndex: number): number; + + /** + * Returns the width (pixels) of the selected image. This is a read-only property. + * @method WebTwain#GetImageWidth + * @param {short} sImageIndex specifies the index of image. The index is 0-based. + * @return {int} + */ + GetImageWidth(sImageIndex: number): number; + + /** + * Returns the height (pixels) of the selected image. This is a read-only property. + * @method WebTwain#GetImageHeight + * @param {short} sImageIndex specifies the index of image. The index is 0-based. + * @return {int} + */ + GetImageHeight(sImageIndex: number): number; + + /** + * Returns the file size of the new image resized from the image of a specified index in buffer. + * @method WebTwain#GetImageSize + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} iWidth specifies the pixel width of the new image. + * @param {int} iHeight specifies the pixel height of the new image. + * @return {double} + */ + GetImageSize(sImageIndex: number, iWidth: number, iHeight: number): number; + + /** + * Pre-calculate the file size of the local image file that is saved from an image of a specified index in buffer. + * @method WebTwain#GetImageSizeWithSpecifiedType + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {short} sImageType specifies the type of an image file.. + * @return {int} + */ + GetImageSizeWithSpecifiedType(sImageIndex: number, sImageType: number): number; + + /** + * Return the horizontal resolution of the specified image. + * @method WebTwain#GetImageXResolution + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {int} + */ + GetImageXResolution(sImageIndex: number): number; + + /** + * Return the vertical resolution of the specified image. + * @method WebTwain#GetImageYResolution + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {int} + */ + GetImageYResolution(sImageIndex: number): number; + + /** + * Returns the index of the selected image. + * @method WebTwain#GetSelectedImageIndex + * @param {short} sSelectedIndex specifies the index of the selected image. + * @return {short} + */ + GetSelectedImageIndex(sSelectedIndex: number): number; + + /** + * You can use the method to select images programatically which is ususally done by mouse clicking. + * @method WebTwain#SetSelectedImageIndex + * @param {short} sSelectedIndex this is the index of an array that holds the indices of selected images. + * @param {short} newVal specifies the index of an image that you want to select. + * @return {void} + */ + SetSelectedImageIndex(selectedIndex: number, newVal: number): void; + + /** + * Pre-calculate the file size of the local image file that is saved from the selected images in buffer. + * @method WebTwain#GetSelectedImagesSize + * @param {int} iImageType specifies the type of an image file. + * @return {int} + */ + GetSelectedImagesSize(iImageType: number): number; + + /** + * Check the skew angle of an image by its index in buffer. + * @method WebTwain#GetSkewAngle + * @param {short} sImageIndex the index of the image in the buffer. + * @return {double} + */ + GetSkewAngle(sImageIndex: number): number; + + /** + * Check the skew angle of a rectangular part of an image by its index in buffer. + * @method WebTwain#GetSkewAngleEx + * @param {short} sImageIndex the index of the image in the buffer. + * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {double} + */ + GetSkewAngleEx(sImageIndex: number, left: number, top: number, right: number, bottom: number): number; + + /** + * [Deprecated.] Detects whether a certain area on an image is blank. + * @method WebTwain#IsBlankImageEx + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @param {bool} bFuzzyMatch specifies whether use fuzzy matching when detecting. + * @return {bool} + */ + IsBlankImageEx(sImageIndex: number, left: number, top: number, right: number, bottom: number, bFuzzyMatch: boolean): boolean; + + /** + * Mirrors the image of a specified index in buffer. + * @method WebTwain#Mirror + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + Mirror(sImageIndex: number): boolean; + + /** + * Decorates image of a specified index in buffer with rectangles of transparent color. + * @method WebTwain#OverlayRectangle + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @param {int} color Specifies the fill color of the rectangle. The byte-ordering of the RGB value is 0xBBGGRR. BB represents blue, GG represents green, RR represents red. + * @param {float} fOpacity Specifies the opacity of the rectangle. The value represents opacity. 1.0 is 100% opaque and 0.0 is totally transparent. + * @return {bool} + */ + OverlayRectangle(sImageIndex: number, left: number, top: number, right: number, bottom: number, color: number, fOpacity: number): boolean; + + /** + * Removes all images in buffer. + * @method WebTwain#RemoveAllImages + * @return {void} + */ + RemoveAllImages(): void; + + /** + * Removes selected images in buffer. + * @method WebTwain#RemoveAllSelectedImages + * @return {bool} + */ + RemoveAllSelectedImages(): boolean; + + /** + * Removes the image of a specified index in buffer. + * @method WebTwain#RemoveImage + * @param {short} sImageIndexToBeDeleted specifies the index of the image to be deleted in buffer. The index is 0-based. + * @return {bool} + */ + RemoveImage(sImageIndexToBeDeleted: number): boolean; + + // Image Operate + /** + * Rotates the image of a specified index in buffer by specified angle. + * @method WebTwain#Rotate + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {float} fAngle Specifies the rotation angle. + * @param {bool} bKeepSize Keep size or not. + * @return {bool} + */ + Rotate(sImageIndex: number, fAngle: number, bKeepSize: boolean): boolean; + + /** + * Rotates the image of a specified index in buffer by specified angle. + * @method WebTwain#RotateEx + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {float} fAngle Specifies the rotation angle. + * @param {bool} bKeepSize Keep size or not. + * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. + * @return {bool} + */ + RotateEx(sImageIndex: number, fAngle: number, bKeepSize: boolean, newVal: EnumDWT_InterpolationMethod): boolean; + + /** + * Rotates the image of a specified index in buffer by 90 degrees counter-clockwise. + * @method WebTwain#RotateLeft + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + RotateLeft(sImageIndex: number): boolean; + + /** + * Rotates the image of a specified index in buffer by 90 degrees clockwise. + * @method WebTwain#RotateRight + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + RotateRight(sImageIndex: number): boolean; + + /** + * Changes width and height of the image of a specified index in the buffer. Please note the file size of the image will be changed proportionately. + * @method WebTwain#ChangeImageSize + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} iNewWidth specifies the pixel width of the new image. + * @param {int} iNewHeight specifies the pixel height of the new image. + * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. + * @return {bool} + */ + ChangeImageSize(sImageIndex: number, iNewWidth: number, iNewHeight: number, newVal: EnumDWT_InterpolationMethod): boolean; + + /** + * Flips the image of a specified index in buffer. + * @method WebTwain#Flip + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + Flip(sImageIndex: number): boolean; + + /** + * Crops the image of a specified index in buffer. + * @method WebTwain#Crop + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {bool} + */ + Crop(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Crops the image of a specified index in buffer to clipboard in DIB format. + * @method WebTwain#CropToClipboard + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {bool} + */ + CropToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Cuts the image data in the specified area to the system clipboard in DIB format. + * @method WebTwain#CutFrameToClipboard + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {bool} + */ + CutFrameToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Cuts the image of a specified index in buffer to clipboard in DIB format. + * @method WebTwain#CutToClipboard + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + CutToClipboard(sImageIndex: number): boolean; + + /** + * Change the DPI (dots per inch) for the specified image. + * @method WebTwain#SetDPI + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} xResolution The horizontal resolution. + * @param {int} yResolution The vertical resolution. + * @param {bool} bResampleImage Whether to resample the image. (The image size will be changed if this is set to true). + * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. + * @return {bool} + */ + SetDPI(sImageIndex: number, xResolution: number, yResolution: number, bResampleImage: boolean, newVal: EnumDWT_InterpolationMethod): boolean; + + /** + * Sets the view mode that images are displayed in Dynamic Web TWAIN. You can use this method to display multiple images in Dynamic Web TWAIN. + * @method WebTwain#SetViewMode + * @param {short} sHorizontalImageCount specifies how many columns can be displayed in Dynamic Web TWAIN. + * @param {short} sVerticalImageCount specifies how many rows can be displayed in Dynamic Web TWAIN.. + * @return {void} + */ + SetViewMode(sHorizontalImageCount: number, sVerticalImageCount: number): void; + + /** + * Moves a specified image. + * @method WebTwain#MoveImage + * @param {short} sSourceImageIndex Specifies the source index of image in buffer. The index is 0-based. + * @param {short} sTargetImageIndex Specifies the target index of image in buffer. The index is 0-based. + * @return {bool} + */ + MoveImage(sSourceImageIndex: number, sTargetImageIndex: number): boolean; + + /** + * Switchs two images of specified indices in buffer. + * @method WebTwain#SwitchImage + * @param {short} sImageIndex1 specifies the index of image in buffer. The index is 0-based. + * @param {short} sImageIndex2 specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + SwitchImage(sImageIndex1: number, sImageIndex2: number): boolean; + + /** + * Shows the GUI of Image Printer. + * @method WebTwain#Print + * @return {bool} + */ + Print(): boolean; + // --- View & Edit end -- + + // --- Upload & Save end -- + + // --- Others --- + /** + * Shows the GUI of Image Editor. + * @method WebTwain#ShowImageEditor + * @return {bool} + */ + ShowImageEditor(): boolean; + + /** + * Unbinds an event from the specified function, so that the function stops receiving notifications when the event fires. + * @method WebTwain#UnregisterEvent + * @param {string} name the name of the event. + * @param {object} evt specified the function to be unbound. + * @return {bool} + */ + UnregisterEvent(name: string, evt: object): boolean; + // --- Others end --- + + /** + * Enables the source to accept image. + * @method WebTwain#EnableSource + * @return {bool} + */ + EnableSource(): boolean; + + /** + * Displays the source's built-in interface to acquire image. + * @method WebTwain#AcquireImage + * @param {object} optionalDeviceConfig a JS object used to set up the device for image acquisition. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + AcquireImage(optionalDeviceConfig?: object, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + // start from 10.0 + /** + * Change the width of an image in buffer. + * @method WebTwain#SetImageWidth + * @param {short} sImageIndex specifies which image you'd like to change. + * @param {int} iNewWidth specifies how wide you'd like to change the image. + * @return {bool} + */ + SetImageWidth(sImageIndex: number, iNewWidth: number): boolean; + + // Set custom DS data (DAT_CUSTOMDSDATA), the input string is encoded with base64 + /** + * Sets custom DS data to be used for scanning, the input string is encoded with base64. Custom DS data means a specific scanning profile. + * @method WebTwain#SetCustomDSDataEx + * @param {string} value the input string which is encoded with base64. + * @return {bool} + */ + SetCustomDSDataEx(value: string): boolean; + + // Set custom DS data, load data from the specified file + /** + * Sets custom DS data to be used for scanning, the data is stored in a file. Custom DS data means a specific scanning profile. + * @method WebTwain#SetCustomDSData + * @param {string} fileName the absolute path of the file where the custom data source data is stored. + * @return {bool} + */ + SetCustomDSData(fileName: string): boolean; + + // Get custom DS data, and returned string is encoded with base64 + /** + * Gets custom DS data, the returned string is base64 encoded. + * @method WebTwain#GetCustomDSDataEx + * @return {string} + */ + GetCustomDSDataEx(): string; + + // Get custom DS data, and save the data to the specified file + /** + * Gets custom DS data and save the data in a specified file. + * @method WebTwain#GetCustomDSData + * @param {string} fileName the path of the file used for storing custom DS data. + * @return {bool} + */ + GetCustomDSData(fileName: string): boolean; + + /** + * Changes the bitdepth of a specified image. + * @method WebTwain#ChangeBitDepth + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {short} sBitDepth specifies the target bit depth. + * @param {bool} bHighQuality specifies whether or not to keep high quality while changing the bit depth. When it's true, it takes more time. + * @return {bool} + */ + ChangeBitDepth(sImageIndex: number, sBitDepth: number, bHighQuality: boolean): boolean; + + /** + * Changes a specified image to gray scale. + * @method WebTwain#ConvertToGrayScale + * @param {short} sIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + ConvertToGrayScale(sIndex: number): boolean; + + /** + * [Deprecated.] Shows the GUI of Image Editor with custom settings. + * @method WebTwain#ShowImageEditorEx + * @param {int} x specifies the new position of the left top corner of the window. + * @param {int} y specifies the new position of the left top corner of the window. + * @param {int} cx specifies the width of the window. + * @param {int} cy specifies the height of the window. + * @param {int} nCmdShow specifices how the window should be shown. + * @return {bool} + */ + ShowImageEditorEx(x: number, y: number, cx: number, cy: number, nCmdShow: number): boolean; + + /** + * [Deprecated.] Detects whether an image is blank. + * @method WebTwain#IsBlankImage + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + IsBlankImage(sImageIndex: number): boolean; + + /** + * Detects whether a specific image is blank. + * @method WebTwain#IsBlankImageExpress + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + IsBlankImageExpress(sImageIndex: number): boolean; + + /** + * [Deprecated.] Detects whether a specific image is blank. + * @method WebTwain#GetBarcodeInfo + * @param {int} barcodeInfoType Defined in TWAIN Specification. + * @param {int} barcodeIndex Specifies which barcode to check. The index is 0-based. + * @return {object} + */ + GetBarcodeInfo(barcodeInfoType: number, barcodeIndex: number): object; + + /** + * [Deprecated.] Gets the content from a specified barcode. + * @method WebTwain#GetBarcodeText + * @param {int} barcodeIndex Specifies which barcode to check. The index is 0-based. + * @return {bool} + */ + GetBarcodeText(barcodeIndex: number): boolean; + + /** + * Sets the default source to use. It's only valid when IfUseTWAINDSM is set to true. + * @method WebTwain#SetDefaultSource + * @param {short} sImageIndex specifies the index of the default source. The index is 0-based. + * @return {bool} + */ + SetDefaultSource(sImageIndex: number): boolean; + + /** + * Draws a rectangle on the viewer which represents the selected area. + * @method WebTwain#SetSelectedImageArea + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} left The X axis of the left border. + * @param {int} top The Y axis of the top border. + * @param {int} right The X axis of the right border. + * @param {int} bottom The Y axis of the bottom border. + * @return {bool} + */ + SetSelectedImageArea(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Converts the images specified by the indices to base64. + * @method WebTwain#ConvertToBase64 + * @param {Array} indices indices specifies which images are to be converted to base64. + * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + ConvertToBase64(indices: number[], enumImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Returns the direct URL of an image specified by index, if iWidth or iHeight is set to -1, you get the original image, otherwise you get the image with specified iWidth or iHeight while keeping the same aspect ratio. + * @method WebTwain#GetImageURL + * @param {short} index the index of the image. + * @param {int} iWidth the width of the image. + * @param {int} iHeight the height of the image. + * @return {string} + */ + GetImageURL(index: number, iWidth: number, iHeight: number): string; + + /** + * Sets a header for the current HTTP Post request. + * @method WebTwain#SetHTTPHeader + * @param {string} key the key of the header. + * @param {string} value the value of the header. + * @return {bool} + */ + SetHTTPHeader(key: string, value: string): boolean; +} diff --git a/types/cookiejs/tsconfig.json b/types/dwt/tsconfig.json similarity index 93% rename from types/cookiejs/tsconfig.json rename to types/dwt/tsconfig.json index 310990fba6..5ff27b3787 100644 --- a/types/cookiejs/tsconfig.json +++ b/types/dwt/tsconfig.json @@ -17,6 +17,6 @@ }, "files": [ "index.d.ts", - "cookiejs-tests.ts" + "dwt-tests.ts" ] } \ No newline at end of file diff --git a/types/dwt/tslint.json b/types/dwt/tslint.json new file mode 100644 index 0000000000..acce7c8a0b --- /dev/null +++ b/types/dwt/tslint.json @@ -0,0 +1,9 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "max-line-length": [false], + "no-trailing-whitespace": false, + "space-before-function-paren": false, + "only-arrow-functions": [false] + } +} diff --git a/types/dygraphs/index.d.ts b/types/dygraphs/index.d.ts index 6d2cedf9d2..fb6f4b997d 100644 --- a/types/dygraphs/index.d.ts +++ b/types/dygraphs/index.d.ts @@ -1266,5 +1266,5 @@ declare class Dygraph { } declare module "dygraphs" { - export = Dygraph; -} \ No newline at end of file + export default Dygraph; +} diff --git a/types/easy-jsend/easy-jsend-tests.ts b/types/easy-jsend/easy-jsend-tests.ts index 705fe5b7e1..0ea41f4418 100644 --- a/types/easy-jsend/easy-jsend-tests.ts +++ b/types/easy-jsend/easy-jsend-tests.ts @@ -1,14 +1,15 @@ -import mongoose = require('mongoose'); +// import mongoose = require('mongoose'); import express = require('express'); import jSend = require('easy-jsend'); -var schema = new mongoose.Schema({ - name: {type: String} -}); +// var schema = new mongoose.Schema({ +// name: {type: String} +// }); -var Model = mongoose.model('model', schema); +// var Model = mongoose.model('model', schema); +var Model = {}; jSend.init({partial: true}); diff --git a/types/ej.web.all/index.d.ts b/types/ej.web.all/index.d.ts index 0a715f52bf..61698887b8 100644 --- a/types/ej.web.all/index.d.ts +++ b/types/ej.web.all/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ej.web.all 15.1 +// Type definitions for ej.web.all 15.2 // Project: http://help.syncfusion.com/js/typescript // Definitions by: Syncfusion // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -7,7 +7,7 @@ /*! * filename: ej.web.all.d.ts -* version : 15.1.0.41 +* version : 15.2.0.43 * Copyright Syncfusion Inc. 2001 - 2017. 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 @@ -239,6 +239,7 @@ declare namespace ej { convertToQueryString(req: any, query: ej.Query, dm: ej.DataManager): JQueryParam; processResponse(data: any, ds: any, query: ej.Query, xhr: JQueryXHR, request?: any, changes?: Changes): any; onGroup(e: any): void; + onAggregates(e: any): void; batchRequest(dm: ej.DataManager, changes: Changes, e: any): void; beforeSend(dm: ej.DataManager, request: any, settings?: any): void; insert(dm: ej.DataManager, data: any, tableName: string): { url: string; data: any }; @@ -246,7 +247,24 @@ declare namespace ej { update(dm: ej.DataManager, keyField: string, value: any, tableName: string): { type: string; url: string; data: any }; getFiltersFrom(data: any, query: ej.Query): ej.Predicate; } + class WebMethodAdaptor extends ej.UrlAdaptor { + constructor(); + processQuery(dm: ej.DataManager, query: ej.Query, hierarchyFilters?: any): { + type: string; url: string; ejPvtData: any; contentType?: string; data?: any; + }; + } + class CacheAdaptor extends ej.UrlAdaptor { + constructor(); + init(adaptor: any, timeStamp: number, pageSize: number): void; + generateKey(url: string, query: ej.Query): string; + processQuery(dm: ej.DataManager, query: ej.Query, hierarchyFilters?: any): any; + processResponse(data: any, ds: any, query: ej.Query, xhr: JQueryXHR, request?: any, changes?: Changes): any; + insert(dm: ej.DataManager, data: any, tableName: string): { url: string; data: any }; + remove(dm: ej.DataManager, keyField: string, value: any, tableName: string): { type: string; url: string; data?: any }; + update(dm: ej.DataManager, keyField: string, value: any, tableName: string): { type: string; url: string; data: any }; + batchRequest(dm: ej.DataManager, changes: Changes, e: any): { url: string; type: string; data: any; contentType: string }; + } class ODataAdaptor extends ej.UrlAdaptor { constructor(); options: UrlAdaptorOptions; @@ -260,6 +278,7 @@ declare namespace ej { onSortBy(e: any): string; onGroup(e: any): string; onSelect(e: any): string; + onAggregates(e: any): string; onCount(e: any): string; beforeSend(dm: ej.DataManager, request: any, settings?: any): void; processResponse(data: any, ds: any, query: ej.Query, xhr: any, request: any, changes: Changes): { @@ -293,6 +312,7 @@ declare namespace ej { changeSetContent?: string; batchChangeSetContentType?: string; } + class WebApiAdaptor extends ej.ODataAdaptor { constructor(); insert(dm: ej.DataManager, data: any, tableName?: string): { url: string; type: string; data: any; }; @@ -302,6 +322,7 @@ declare namespace ej { result: any; count: number }; } + class ODataV4Adaptor extends ej.ODataAdaptor { constructor(); options: ODataAdaptorOptions; @@ -309,9 +330,13 @@ declare namespace ej { onEachSearch(e: any): void; onSearch(e: any): string; beforeSend(dm: ej.DataManager, request: any, settings?: any): void; + processQuery(ds: any, query: ej.Query): { + type: string; url: string; ejPvtData: any; contentType?: string; data?: any; + }; processResponse(data: any, ds: any, query: ej.Query, xhr: any, request: any, changes: Changes): { result: any; count: number }; + } interface ODataAdaptorOptions { requestType?: string; @@ -339,6 +364,7 @@ declare namespace ej { processQuery(ds: any, query: ej.Query): string; batchRequest(dm: ej.DataManager, changes: Changes, e: any): Changes; onWhere(ds: any, e: any): any; + onAggregates(ds: any, e: any): any; onSearch(ds: any, e: any): any; onSortBy(ds: any, e: any, query: ej.Query): any; onGroup(ds: any, e: any, query: ej.Query): any; @@ -347,10 +373,16 @@ declare namespace ej { onTake(ds: any, e: any): any; onSkip(ds: any, e: any): any; onSelect(ds: any, e: any): any; - insert(dm: ej.DataManager, data: any): any; + insert(dm: ej.DataManager, data: any, tableName?: string): any; remove(dm: ej.DataManager, keyField: string, value: any, tableName: string): any; update(dm: ej.DataManager, keyField: string, value: any, tableName: string): any; } + class ForeignKeyAdaptor extends ej.JsonAdaptor { + constructor(); + processQuery(ds: any, query: ej.Query): any; + insert(dm: ej.DataManager, data: any, tableName: string): { url: string; data: any }; + update(dm: ej.DataManager, keyField: string, value: any, tableName: string): { url: string; type: string; data: any }; + } class remoteSaveAdaptor extends ej.UrlAdaptor { constructor(); batchRequest(dm: ej.DataManager, changes: Changes, e: any): void; @@ -720,7 +752,7 @@ declare namespace ej { /** returns the element which accepts the droppable element. */ - targetElement?: any; + target?: any; } export interface OutEventArgs { @@ -739,7 +771,7 @@ declare namespace ej { /** returns the mouse out over the element */ - targetElement?: any; + target?: any; } export interface OverEventArgs { @@ -758,7 +790,7 @@ declare namespace ej { /** returns the mouse over the element */ - targetElement?: any; + target?: any; } } @@ -3247,7 +3279,10 @@ declare namespace ej { * @Default {false} */ showRoundedCorner?: boolean; - + /** Set to sort ListBox items either by Ascending or Descending order. By default sortOrder is set as enum type of "None".You can use only below mentioned type for sorting purpose. + * @Default {ej.SortOrder.None} + */ + sortOrder?: ej.ListBox.SortOrder | string; /** The template to display the ListBox widget with customized appearance. * @Default {null} */ @@ -3844,6 +3879,14 @@ declare namespace ej { */ value?: string; } + enum SortOrder { + /// The items are not sorted. + None, + /// To sort items in Ascending order. + Ascending, + /// To sort items in Descending order. + Descending + } } class Calculate { @@ -6848,8 +6891,8 @@ declare namespace ej { export interface TimeDrillDown { - /** This is the field to show/hide the timeDrillDown in DateTimePicker. - */ + /** This is the field to show/hide the timeDrillDown in DateTimePicker. + */ enabled?: boolean; /** Sets the interval time of minutes on selected date. @@ -7322,6 +7365,10 @@ declare namespace ej { */ animation?: any; + /** To Enable or disable the scrolling for background element of the modal dialog. This will work only with modal dialog. + */ + backgroundScroll?: boolean; + /** Closes the dialog widget on pressing the ESC key when it is set to true. */ closeOnEscape?: boolean; @@ -8982,6 +9029,10 @@ declare namespace ej { */ target?: string; + /** defines Tooltip size and gap between tooltip against the target element. + */ + tip?: Tip; + /** The title text to be displayed in the Tooltip header. * @Default {null} */ @@ -9238,6 +9289,44 @@ declare namespace ej { stem?: PositionStem; } + export interface TipSize { + + /** Sets the Tooltip width. + * @Default {20} + */ + width?: number; + + /** Sets the Tooltip height. + * @Default {10} + */ + height?: number; + } + + export interface TipAdjust { + + /** Sets horizontal gap between Tooltip and target element. + * @Default {0} + */ + xValue?: number; + + /** Sets vertical gap between Tooltip and target element. + * @Default {0} + */ + yValue?: number; + } + + export interface Tip { + + /** Sets the Tooltip size. + */ + size?: TipSize; + + /** Sets gap between tooltip against the target element. + */ + adjust?: TipAdjust; + } + + enum effect { ///No animation takes place when showing/hiding the Tooltip @@ -9878,6 +9967,26 @@ declare namespace ej { */ width?: string | number; + /** Specifies the number of items to be fetched on each scroll. Note: This property works only with Virtual scrolling. + * @Default {5} + */ + itemRequestCount?: number; + + /** Specifies the maximum number of items to be fetched. Note: This will work only with Virtual scrolling + * @Default {null} + */ + totalItemsCount?: number; + + /** Loads the list data on demand via scrolling behavior to improve the application’s performance. There are two ways to load data which can be defined using virtualScrollMode property. + * @Default {false} + */ + allowVirtualScrolling?: boolean; + + /** Specifies the virtual scroll mode to load the list data on demand via scrolling behavior. There are two types of mode. + * @Default {ej.VirtualScrollMode.Normal} + */ + virtualScrollMode?: ej.VirtualScrollMode | string; + /** Event triggers before the AJAX request happens. */ ajaxBeforeLoad?(e: AjaxBeforeLoadEventArgs): void; @@ -10654,6 +10763,11 @@ declare namespace ej { */ contextMenuTarget?: string; + /** Specifies the container element selectors for submenu’s collision. The submenu gets displayed based on spacing available with respect to container element. + * @Default {null} + */ + container?: string; + /** Specify the CSS class to achieve custom theme. */ cssClass?: string; @@ -11182,6 +11296,102 @@ declare namespace ej { } } + class Print extends ej.Widget { + static fn: Print; + constructor(element: JQuery | Element, options?: Print.Model); + static Locale: any; + model: Print.Model; + defaults: Print.Model; + + /** Print the specific page or an element. + * @returns {void} + */ + print(): void; + } + + export namespace Print { + + export interface Model { + + /** Append the custom HTML after the selected content. + * @Default {null} + */ + append?: string; + + /** A selector that specifies a particular element to be excluded from printing. + * @Default {null} + */ + excludeSelector?: string; + + /** Specifies whether the URL of an external stylesheet can be included to customize and print that page. + * @Default {null} + */ + externalStyles?: string; + + /** Prepend a doctype to the document frame. + * @Default {<!doctype html>} + */ + docType?: string; + + /** Specifies whether the global styles can be applied to the element to be printed. + * @Default {true} + */ + globalStyles?: boolean; + + /** Sets the height of the print window. + * @Default {454} + */ + height?: number; + + /** Prepends the custom HTML before the selected content. + * @Default {null} + */ + prepend?: string; + + /** Allows printing the content in a new window. + * @Default {false} + */ + printInNewWindow?: boolean; + + /** Sets the period of time to wait before printing the content. + * @Default {1000} + */ + timeOutPeriod?: number; + + /** Sets the title of the print document. + * @Default {null} + */ + title?: string; + + /** Defines the width of the print window. + * @Default {1024} + */ + width?: number; + + /** Event triggers before the document page or an element in it gets printed. */ + beforeStart?(e: BeforeStartEventArgs): void; + } + + export interface BeforeStartEventArgs { + + /** Set this option as true to cancel the event. + */ + cancel?: boolean; + + /** Returns the Print model + */ + model?: ej.Print.Model; + + /** Returns the name of an event + */ + type?: string; + + /** Returns the printed element + */ + content?: any; + } + } + class ProgressBar extends ej.Widget { static fn: ProgressBar; constructor(element: JQuery | Element, options?: ProgressBar.Model); @@ -11836,8 +12046,8 @@ declare namespace ej { export interface MouseoverEventArgs { - /** returns the current value. - */ + /** returns the current value. + */ value?: number; /** if the event should be canceled; otherwise, false. @@ -13455,6 +13665,9 @@ declare namespace ej { /** Triggered initial load. */ load?(e: LoadEventArgs): void; + /** Triggers before swim lane expand or collapse icon is clicked. */ + swimlaneClick?(e: SwimlaneClickEventArgs): void; + /** Triggered every time a single card rendered request is made to access particular card information. */ queryCellInfo?(e: QueryCellInfoEventArgs): void; @@ -14150,6 +14363,37 @@ declare namespace ej { type?: string; } + export interface SwimlaneClickEventArgs { + + /** Current Action name while swim lane clicked. Actions are "expand" or "collapse" + */ + action?: string; + + /** Returns the kanban model. + */ + model?: any; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the name of the event. + */ + type?: string; + + /** Returns the swim lane group data's. + */ + data?: any; + + /** Returns current swim lane row index. + */ + rowIndex?: number; + + /** Returns current target element. + */ + target?: any; + } + export interface QueryCellInfoEventArgs { /** Returns Kanban card. @@ -14176,8 +14420,8 @@ declare namespace ej { */ model?: any; - /** Returns the name of the event. - */ + /** Returns the name of the event. + */ type?: string; } @@ -15293,6 +15537,11 @@ declare namespace ej { */ autoHeight?: boolean; + /** This API holds configuration setting for paste clenaup behavior. + * @Default {{ listConversion: false, cleanCSS: false, removeStyles: false, cleanElements: false }} + */ + pasteCleanupSettings?: PasteCleanupSettings; + /** Sets the colorCode to display the color of the fontColor and backgroundColor in the font tools of the RTE. * @Default {[000000, FFFFFF, C4C4C4, ADADAD, 595959, 262626, 4f81bd, dbe5f1, b8cce4, 95b3d7, 366092, 244061, c0504d, f2dcdb, e5b9b7, d99694, 953734,632423, 9bbb59, * ebf1dd, d7e3bc, c3d69b, 76923c, 4f6128, 8064a2, e5e0ec, ccc1d9, b2a2c7, 5f497a, 3f3151, f79646, fdeada, fbd5b5, fac08f,e36c09, 974806]} @@ -15541,6 +15790,11 @@ declare namespace ej { */ toolsList?: any[]; + /** Specifies the overflow mode for RTE responsive toolbar + * @Default {Popup} + */ + toolbarOverflowMode?: ej.RTE.ToolbarOverflowMode | string; + /** Display the hints for the tools in the Toolbar. * @Default {{ associate: mouseenter, showShadow: true, position: { stem: { horizontal: left, vertical: top } }, tip: { size: { width: 5, height: 5 }, isBalloon: false }} */ @@ -15743,6 +15997,29 @@ declare namespace ej { event?: any; } + export interface PasteCleanupSettings { + + /** This API is used to convert the list elements pasted from word document to editor. + * @Default {false} + */ + listConversion?: boolean; + + /** This API is used to clean the unwanted css in the elements pasted from word document to editor. + * @Default {false} + */ + cleanCSS?: boolean; + + /** This API is used to remove all styles in the elements pasted from word document to editor. + * @Default {false} + */ + removeStyles?: boolean; + + /** This API is used to clean the unwanted elements pasted from word document to editor. + * @Default {false} + */ + cleanElements?: boolean; + } + export interface ExportToPdfSettings { /** This API is used to receive the server-side handler for export related operations. @@ -15942,6 +16219,16 @@ declare namespace ej { */ customUnorderedList?: ToolsCustomUnorderedList[]; } + + enum ToolbarOverflowMode { + + ///To display the RTE toolbar overflow items as popup + Popup, + + ///To display the RTE toolbar overflow items as inline toolbar + Inline + } + } class Slider extends ej.Widget { @@ -15971,6 +16258,7 @@ declare namespace ej { */ setValue(): void; } + export namespace Slider { export interface Model { @@ -16264,6 +16552,7 @@ declare namespace ej { cancel?: boolean; } } + namespace slider { enum sliderType { //Shows default slider @@ -17079,8 +17368,8 @@ declare namespace ej { */ activeIndex?: number; - /** returns, is it triggered by interaction or not. - */ + /** returns, is it triggered by interaction or not. + */ isInteraction?: boolean; } @@ -21039,6 +21328,12 @@ declare namespace ej { */ addIgnoreOnExport(propertyNames: any[]): void; + /** Adds a grid model property which is to be ignored upon OnServerToolbarClick. + * @param {Array} Pass the array of parameters which need to be ignored on OnServerToolbarClick + * @returns {void} + */ + addIgnoreOnToolbarServerClick(propertyNames: any[]): void; + /** Add a new record in grid control when allowAdding is set as true. * @returns {void} */ @@ -23427,6 +23722,21 @@ declare namespace ej { type?: string; } + export interface MergeHeaderCellInfoEventArgs { + + /** Method to merge the header cells. + */ + headerCellMerge?: any; + + /** Returns the column headers. + */ + columnHeaders?: any; + + /** Returns the grid model. + */ + model?: any; + } + export interface MergeCellInfoEventArgs { /** Returns grid cell. @@ -23439,7 +23749,7 @@ declare namespace ej { /** Returns current row record object (JSON). */ - data?: any; + rowData?: any; /** Returns the text value in the cell. */ @@ -23482,7 +23792,7 @@ declare namespace ej { /** Returns current row record object (JSON). */ - data?: any; + rowData?: any; /** Returns the text value in the cell. */ @@ -23914,7 +24224,7 @@ declare namespace ej { /** Returns the current row data. */ - data?: any; + rowData?: any; /** Returns the grid model. */ @@ -24476,6 +24786,10 @@ declare namespace ej { * @Default {null} */ dropMapper?: string; + /** Gets or sets a value that indicates whether to define the behavior for drag. + * @Default {ej.Grid.DragBehavior.Move} + */ + dragBehavior?: ej.Grid.DragBehavior | string; } export interface SearchSettings { @@ -24718,6 +25032,17 @@ declare namespace ej { wrapMode?: ej.Grid.WrapMode | string; } + export interface ToolbarSettingsCustomToolbarItem { + + /** Gets or sets a value that indicates whether to add custom toolbar item as a template element. + */ + templateID?: string; + + /** Gets or sets a value that indicates whether to add custom toolbar item with a custom tooltip. + */ + tooltip?: string; + } + export interface ToolbarSettings { /** Gets or sets a value that indicates whether to add custom toolbar items within the toolbar to perform any action in the grid @@ -24904,6 +25229,16 @@ declare namespace ej { } + enum DragBehavior { + + ///Moves a dragged row from one grid to another + Move, + + ///Copies a dragged row from one grid to another + Copy + } + + enum SelectionType { ///Specifies the selection type as single. @@ -25071,6 +25406,11 @@ declare namespace ej { */ rangeBandSettings?: RangeBandSettings; + /** Name of the culture based on which sparkline should be localized. + * @Default {en-US} + */ + locale?: string; + /** Name of a field in data source, where the fill color for all the data points is generated. */ palette?: string; @@ -25085,6 +25425,11 @@ declare namespace ej { */ enableCanvasRendering?: boolean; + /** Specify to convert the date object to string, using locale settings. + * @Default {false} + */ + enableGroupSeparator?: boolean; + /** Specifies the dataSource for the series. It can be an array of JSON objects or an instance of ej.DataManager. * @Default {null} */ @@ -25223,8 +25568,8 @@ declare namespace ej { */ cancel?: boolean; - /** Instance of the sparkline model object - */ + /** Instance of the sparkline model object + */ model?: any; /** Name of the event @@ -26868,6 +27213,16 @@ declare namespace ej { */ frozenHeaderSettings?: FrozenHeaderSettings; + /** Allows user to display header name in PivotGrid control. + * @Default {{}} + */ + headerSettings?: HeaderSettings; + + /** Allows user to show appropriate unique name on Pivot button. + * @Default {false} + */ + showUniqueNameOnPivotButton?: boolean; + /** Object utilized to pass additional information between client-end and service-end on operating the control in server mode. * @Default {null} */ @@ -27711,6 +28066,24 @@ declare namespace ej { * @Default {false} */ enableFrozenHeaders?: boolean; + + /** Allows user to set the size of the scrollbar (horizontal and vertical) visible in PivotGrid. + * @Default {18} + */ + scrollerSize?: number; + } + + export interface HeaderSettings { + + /** Allows user to enable/disable row header names in PivotGrid control. + * @Default {false} + */ + showRowItems?: boolean; + + /** Allows user to enable/disable column header names in PivotGrid control. + * @Default {false} + */ + showColumnItems?: boolean; } export interface HyperlinkSettings { @@ -28287,6 +28660,11 @@ declare namespace ej { */ enableRTL?: boolean; + /** Allows user to render complete PivotChart on drill operation, that is, when expanding and collapsing members which are shown in multi-level labels. + * @Default {false} + */ + enableMultiLevelLabels?: boolean; + /** Allows the user to enable PivotChart’s responsiveness in the browser layout. * @Default {false} */ @@ -28851,6 +29229,16 @@ declare namespace ej { */ displaySettings?: DisplaySettings; + /** Allows user to set visibility of icons in toolbar panel. + * @Default {{}} + */ + toolbarIconSettings?: ToolbarIconSettings; + + /** Allows user to show unique name on pivotbutton. + * @Default {false} + */ + showUniqueNameOnPivotButton?: boolean; + /** Enables the splitter option for resizing the elements inside the control. * @Default {false} */ @@ -29472,6 +29860,89 @@ declare namespace ej { mode?: ej.PivotClient.DisplayMode | string; } + export interface ToolbarIconSettings { + + /** Allows user to set the visibility of Add Report icon in toolbar panel. + * @Default {true} + */ + enableAddReport?: boolean; + + /** Allows user to set the visibility of New Report icon in toolbar panel. + * @Default {true} + */ + enableNewReport?: boolean; + + /** Allows user to set the visibility of Rename Report icon in toolbar panel. + * @Default {true} + */ + enableRenameReport?: boolean; + + /** Allows user to set the visibility of DB Manipulation icon in toolbar panel. + * @Default {true} + */ + enableDBManipulation?: boolean; + + /** Allows user to set the visibility of Word Export icon in toolbar panel. + * @Default {true} + */ + enableWordExport?: boolean; + + /** Allows user to set the visibility of Excel Export icon in toolbar panel. + * @Default {true} + */ + enableExcelExport?: boolean; + + /** Allows user to set the visibility of PDF Export icon in toolbar panel. + * @Default {true} + */ + enablePdfExport?: boolean; + + /** Allows user to set the visibility of MDX Query icon in toolbar panel. + * @Default {true} + */ + enableMDXQuery?: boolean; + + /** Allows user to set the visibility of Defer Update icon in toolbar panel. + * @Default {false} + */ + enableDeferUpdate?: boolean; + + /** Allows user to set the visibility of Full Screen icon in toolbar panel. + * @Default {false} + */ + enableFullScreen?: boolean; + + /** Allows user to set the visibility of Sort/Filter Column icon in toolbar panel. + * @Default {true} + */ + enableSortOrFilterColumn?: boolean; + + /** Allows user to set the visibility of Sort/Filter Row icon in toolbar panel. + * @Default {true} + */ + enableSortOrFilterRow?: boolean; + + /** Allows user to set the visibility of Toggle Axis icon in toolbar panel. + * @Default {true} + */ + enableToggleAxis?: boolean; + + /** Allows user to set the visibility of Chart Types icon in toolbar panel. + * @Default {true} + */ + enableChartTypes?: boolean; + + /** Allows user to set the visibility of Remove Report icon in toolbar panel. + * @Default {true} + */ + enableRemoveReport?: boolean; + + /** Allows user to set the visibility of Calculated Member icon in toolbar panel. + * @Default {false} + */ + enableCalculatedMember?: boolean; + } + export interface ServiceMethodSettings { /** Allows the user to set the custom name for the service method responsible for updating the entire report and widget, while changing the Cube. @@ -29733,9 +30204,9 @@ declare namespace ej { */ showHeaderLabel?: boolean; - /** Connects the service using the specified URL for any server updates on server mode operation. - * @Default {“”} - */ + /** 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. @@ -30689,6 +31160,11 @@ declare namespace ej { */ showAllDayRow?: boolean; + /** When set to false, hides the weekend days on all the Scheduler views. + * @Default {true} + */ + showWeekend?: boolean; + /** When set to true, displays the current time indicator on the Schedule. * @Default {true} */ @@ -32301,6 +32777,13 @@ declare namespace ej { */ setSplitterIndex(index: number): void; + /** To sort the column in required direction + * @param {string} Defines the column's mapping name in which sorting have to be performed + * @param {string} Defines the sort direction whether the column has to sorted in ascending/descending order. By default it is sorting in an ascending order + * @returns {void} + */ + sortColumn(mappingName: string, columnSortDirection: string): void; + /** To cancel the edited state of an item in Gantt * @returns {void} */ @@ -32332,6 +32815,14 @@ declare namespace ej { */ expandCollapseRecord(taskId: number): void; + /** Export the Gantt content to excel or PDF document. + * @param {string} Pass the controller action name corresponding to exporting + * @param {string} optionalASP server event name corresponding to exporting + * @param {boolean} optionalPass the multiple exporting value as true/false + * @returns {void} + */ + export(action: string, serverEvent?: string, multipleExport?: boolean): void; + /** To hide the column by using header text * @param {string} you can pass a header text of a column to hide * @returns {void} @@ -32440,6 +32931,14 @@ declare namespace ej { */ baselineColor?: string; + /** Specifies the mapping property path for the work field of a task in the data source. When it is mapped the end date and duration for a task will be calculated automatically. + */ + workMapping?: string; + + /** Specifies the mapping property path for the expand status of a record in data source. + */ + expandStateMapping?: string; + /** Specifies the mapping property path for baseline end date in datasource */ baselineEndDateMapping?: string; @@ -32489,6 +32988,11 @@ declare namespace ej { */ dateFormat?: string; + /** Specifies the customized working time for tasks in Gantt + * @Default {[{ from: 08:00 AM, to: 12:00 PM }, { from: 01:00 PM, to: 05:00 PM }]} + */ + dayWorkingTime?: any[]; + /** Specifies the mapping property path for duration of a task in datasource */ durationMapping?: string; @@ -32824,6 +33328,11 @@ declare namespace ej { */ taskbarEditingTooltipTemplateId?: string; + /** Specifies the height of taskBar in Gantt. + * @Default {20} + */ + taskbarHeight?: number; + /** Specifies the template for tooltip on mouse action on taskbars */ taskbarTooltipTemplate?: string; @@ -33636,6 +34145,17 @@ declare namespace ej { type?: string; } + export interface AddDialogField { + + /** Specifies mapping name to include required fields in Gantt + */ + field?: string; + + /** Specifies editType of fields to be included in the add dialog in Gantt + */ + editType?: string; + } + export interface DragTooltip { /** Specifies option to enable/disable tooltip while drag and drop a row. @@ -33654,6 +34174,17 @@ declare namespace ej { tooltipTemplate?: string; } + export interface EditDialogField { + + /** Specifies mapping name to include required fields in Gantt + */ + field?: string; + + /** Specifies editType of fields to be included in the edit dialog in Gantt + */ + editType?: string; + } + export interface SplitterSettings { /** Specifies position of the splitter in Gantt , splitter can be placed either based on percentage values or pixel values. @@ -33708,6 +34239,21 @@ declare namespace ej { rowPosition?: ej.Gantt.RowPosition | string; } + export interface Holiday { + + /** Specifies holiday date to be displayed in Gantt + */ + day?: string; + + /** Specifies the background color for holiday date in Gantt Schedule + */ + background?: string; + + /** Specifies the label to be displayed for rendered holiday in Gantt + */ + label?: string; + } + export interface ScheduleHeaderSettings { /** Specified the format for day view in schedule header @@ -33745,9 +34291,9 @@ declare namespace ej { */ weekendBackground?: string; - /** Specified the format for week view in schedule header - * @Default {ddd} - */ + /** Specified the format for week view in schedule header + * @Default {MMM dd , yyyy} + */ weekHeaderFormat?: string; /** Specified the format for year view in schedule header @@ -33791,12 +34337,61 @@ declare namespace ej { cellIndex?: number; } + export interface SortSettingsSortedColumn { + + /** Specifies the field to be sorted in Gantt + */ + field?: string; + + /** Specifies the sort direction in Gantt + */ + direction?: string; + } + export interface SortSettings { /** Specifies the sorted columns for Gantt * @Default {[]} */ - sortedColumns?: any[]; + sortedColumns?: SortSettingsSortedColumn[]; + } + + export interface StripLine { + + /** Specifies date to render striplines in Gantt + */ + day?: string; + + /** Specifies label to be displayed for striplines in Gantt + */ + label?: string; + + /** Specifies line style for rendered striplines in Gantt + */ + lineStyle?: string; + + /** Specifies the line color for rendered striplines in Gantt + */ + lineColor?: string; + + /** Specifies the width of the stripline in Gantt + */ + lineWidth?: string; + } + + export interface ToolbarSettingsCustomToolbarItem { + + /** Allows the user to insert the custom icons in toolbar using CSS class name selector. + */ + text?: string; + + /** Allows the user to insert the custom icons in toolbar using script templates. Using this property we can bind HTML elements and other EJ controls to Gantt toolbar. + */ + templateID?: string; + + /** Allows the user to display custom tooltip text for Gantt custom toolbar items. + */ + tooltipText?: string; } export interface ToolbarSettings { @@ -33810,6 +34405,10 @@ declare namespace ej { * @Default {[]} */ toolbarItems?: any[]; + + /** Allows the user to insert custom toolbar items. + */ + customToolbarItems?: ToolbarSettingsCustomToolbarItem[]; } enum DurationUnit { @@ -34702,12 +35301,6 @@ declare namespace ej { */ saveCell(): void; - /** To search an item with search string provided at the run time - * @param {string} you can pass a searchString to search the tree grid - * @returns {void} - */ - search(searchString: string): void; - /** To show the column by using header text * @param {string} you can pass a header text of a column to show. * @returns {void} @@ -34719,7 +35312,7 @@ declare namespace ej { * @param {string} you can pass a sort direction to sort the column. * @returns {void} */ - sortColumn(columnName: string, columnSortDirection: string): void; + sortColumn(fieldName: 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. @@ -34782,6 +35375,10 @@ declare namespace ej { */ altRowTemplateID?: string; + /** Specifies the mapping property path for the expand status of a record in data source. + */ + expandStateMapping?: string; + /** Specifies the mapping property path for sub tasks in datasource */ childMapping?: string; @@ -34809,9 +35406,9 @@ declare namespace ej { dataSource?: any[]; /** Specifies whether to wrap the header text when it is overflown i.e., when it exceeds the header width. - * @Default {none} + * @Default {ej.TreeGrid.HeaderTextOverflow.None} */ - headerTextOverflow?: string; + headerTextOverflow?: ej.TreeGrid.HeaderTextOverflow | string; /** Options for displaying and customizing the tooltip. This tooltip will show the preview of the row that is being dragged. */ @@ -34845,6 +35442,11 @@ declare namespace ej { */ columnResizeSettings?: ColumnResizeSettings; + /** Defines the common width for all the columns in TreeGrid + * @Default {150} + */ + commonWidth?: number; + /** Options for filtering and customizing filter actions. */ filterSettings?: FilterSettings; @@ -34900,6 +35502,10 @@ declare namespace ej { */ selectedRowIndex?: number; + /** Specifies the selected cell information on rendering TreeGrid. + */ + selectedCellIndexes?: SelectedCellIndex[]; + /** Specifies the settings for row and cell selection. */ selectionSettings?: SelectionSettings; @@ -35018,6 +35624,15 @@ declare namespace ej { /** Triggered when TreeGrid is rendered completely */ create?(e: CreateEventArgs): void; + /** Triggered while rendering details template in TreeGrid */ + detailsDataBound?(e: DetailsDataBoundEventArgs): void; + + /** Triggered when details template pop-up is shown. */ + detailsShown?(e: DetailsShownEventArgs): void; + + /** Triggered when details template pop-up is hidden. */ + detailsHidden?(e: DetailsHiddenEventArgs): void; + /** Triggered after saved the modified cellValue in TreeGrid */ endEdit?(e: EndEditEventArgs): void; @@ -35467,6 +36082,79 @@ declare namespace ej { type?: string; } + export interface DetailsDataBoundEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the data collection of selected row. + */ + data?: any; + + /** Returns the details element of selected row. + */ + detailsElement?: any; + + /** Returns the rowIndex of selected row. + */ + rowIndex?: number; + + /** Returns the TreeGrid model + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; + } + + export interface DetailsShownEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the data collection of selected row. + */ + data?: any; + + /** Returns the details element of selected row. + */ + detailsElement?: any; + + /** Returns the rowIndex of selected row. + */ + rowIndex?: number; + + /** Returns the TreeGrid model + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; + } + + export interface DetailsHiddenEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the TreeGrid model + */ + model?: any; + + /** Returns the data collection of hidden details Template + */ + rowData?: any; + + /** Returns the name of the event. + */ + type?: string; + } + export interface EndEditEventArgs { /** Returns the cancel option value. @@ -35864,6 +36552,11 @@ declare namespace ej { */ allowFiltering?: boolean; + /** Enables the blanks option in ejDropDownList mapped in TreeGrid column + * @Default {true} + */ + allowFilteringBlankContent?: boolean; + /** Enables or disables the ability to sort the rows based on this column/field. * @Default {false} */ @@ -35874,15 +36567,35 @@ declare namespace ej { */ allowCellSelection?: boolean; + /** To customize the ej controls defined in TreeGrid column with their native property. + */ + editParams?: any; + /** Specifies the edit type of the column. * @Default {ej.TreeGrid.EditingType.String} */ editType?: ej.TreeGrid.EditingType | string; + /** To bind the dropdown data for TreeGrid column mapped with ejDropDownList + */ + dropdownData?: string; + /** Specifies the name of the field from the dataSource to bind with this column. */ field?: string; + /** Specifies the template string of the script element to enable column template for a column. + */ + template?: string; + + /** Specifies the template ID of the script element to enable column template for a column. + */ + templateID?: string; + + /** Specifies the template ID or the template string of the AngularJS script element to enable column template for a column. + */ + angularTemplate?: string; + /** Specifies the type of the editor control to be used to filter the rows. * @Default {ej.TreeGrid.EditingType.String} */ @@ -35896,6 +36609,11 @@ declare namespace ej { /** Enables or disables the checkbox visibility in a column to make it as a checkbox column * @Default {false} */ + displayAsCheckbox?: boolean; + + /** Enables or disables the checkbox visibility in a column for checkbox selection. + * @Default {false} + */ showCheckbox?: boolean; /** Controls the visibility of the column. @@ -35936,15 +36654,35 @@ declare namespace ej { */ textAlign?: ej.TextAlign | string; - /** Specifies the template for the TreeGrid column - */ - templateID?: string; - /** Enables or disables the ability to edit a row or cell. * @Default {false} */ allowEditing?: boolean; + /** We can include or exclude particular column from column visibility list in column menu. + * @Default {true} + */ + showInColumnChooser?: boolean; + + /** Sets the clip mode for TreeGrid cell as ellipsis or clipped content(both header and content) + * @Default {ej.TreeGrid.ClipMode.Clip} + */ + clipMode?: ej.TreeGrid.ClipMode | string; + + /** Sets the tooltip template for the specific column. + * @Default {null} + */ + tooltip?: string; + + /** Sets the tooltip template for the column header + * @Default {null} + */ + headerTooltip?: string; + + /** specifies the conditions for saving data to the database while adding or editing the fields. + */ + validationRules?: any; + /** Enables or disables the ability to freeze/unfreeze the columns * @Default {false} */ @@ -36013,14 +36751,37 @@ declare namespace ej { * @Default {top} */ rowPosition?: ej.TreeGrid.RowPosition | string; + /** Specifies the template ID for the custom dialog. + * @Default {null} + */ + dialogEditorTemplateID?: string; } export interface ColumnResizeSettings { /** Specifies the mode for column resizing - * @Default {normal} + * @Default {ej.TreeGrid.ColumnResizeMode.Normal} */ - columnResizeMode?: string; + columnResizeMode?: ej.TreeGrid.ColumnResizeMode | string; + } + + export interface FilterSettingsFilteredColumn { + + /** Specifies the value to be filtered in TreeGrid. + */ + value?: string; + + /** Specifies the field where filtering has to be performed. + */ + field?: string; + + /** Specifies the predicate(and/or) value to perform filtering. + */ + predicate?: string; + + /** Specifies the filter condition to filtered column. See operator + */ + operator?: string; } export interface FilterSettings { @@ -36031,9 +36792,9 @@ declare namespace ej { filterBarMode?: string; /** Specifies the type of column filtering. - * @Default {filterbar} + * @Default {ej.TreeGrid.FilterType.FilterBar} */ - filterType?: string; + filterType?: ej.TreeGrid.FilterType | string; /** Specifies the column collection for filtering the TreeGrid content on initial load * @Default {[]} @@ -36074,6 +36835,18 @@ declare namespace ej { template?: string; } + export interface SelectedCellIndex { + + /** Specifies the row index of the cell to be selected in TreeGrid control + */ + rowIndex?: number; + + /** Specifies the cell index to be selected in the row. + * @Default { } + */ + cellIndex?: number; + } + export interface SelectionSettings { /** Specifies the type of selection whether to select row or cell. @@ -36097,6 +36870,44 @@ declare namespace ej { enableSelectAll?: boolean; } + export interface SummaryRowsSummaryColumn { + + /** Specifies the summary type to perform calculations in a corresponding summary column. See summaryType. + */ + summaryType?: ej.TreeGrid.SummaryType | string; + + /** Specifies summary column used to perform the summary calculation. + */ + dataMember?: string; + + /** Specifies the required column to display the summary. + */ + displayColumn?: string; + + /** Specifies the text to be displayed before the summary column value. + */ + prefix?: string; + + /** Specifies the text to be displayed after the summary column value. + */ + suffix?: string; + + /** Specifies the format to be applied on the summary column value. + */ + format?: string; + } + + export interface SummaryRow { + + /** Specifies the title for summary row collection in TreeGrid + */ + title?: string; + + /** Specifies the summary columns in the summary rows. + */ + summaryColumns?: SummaryRowsSummaryColumn[]; + } + export interface SizeSettings { /** Height of the TreeGrid. @@ -36110,12 +36921,38 @@ declare namespace ej { width?: string; } + export interface SortSettingsSortedColumn { + + /** Specifies the field to be sorted in TreeGrid + */ + field?: string; + + /** Specifies the sort direction in TreeGrid + */ + direction?: string; + } + export interface SortSettings { /** Option to add columns based on which the rows have to be sorted recursively. * @Default {[]} */ - sortedColumns?: any[]; + sortedColumns?: SortSettingsSortedColumn[]; + } + + export interface ToolbarSettingsCustomToolbarItem { + + /** Allows the user to insert the custom icons in toolbar using CSS class name selector. + */ + text?: string; + + /** Allows the user to insert the custom icons in toolbar using script templates. Using this property we can bind HTML elements and other EJ controls to TreeGrid toolbar. + */ + templateID?: string; + + /** Allows the user to display custom tooltip text for TreeGrid custom toolbar items. + */ + tooltipText?: string; } export interface ToolbarSettings { @@ -36129,6 +36966,10 @@ declare namespace ej { * @Default {[]} */ toolbarItems?: any[]; + + /** Allows the user to insert custom toolbar items. + */ + customToolbarItems?: ToolbarSettingsCustomToolbarItem[]; } enum EditingType { @@ -36156,6 +36997,26 @@ declare namespace ej { } + enum ClipMode { + + ///Shows ellipsis for the overflown cell. + Ellipsis, + + ///Truncate the text in the cell. + Clip + } + + + enum HeaderTextOverflow { + + ///You can disable the word wrap + None, + + ///You can wrap the header content + Wrap + } + + enum BeginEditAction { ///you can begin the editing at double click @@ -36195,6 +37056,29 @@ declare namespace ej { } + enum ColumnResizeMode { + + ///At load time column are rendered with given width value, while resizing the column only current column width is changed + FixedColumns, + + ///At load time columns are stretched with control width,while resizing the column, current column width updated based on next column + Normal, + + ///In this mode columns are stretched with control width in load time and on resizing action. + NextColumn + } + + + enum FilterType { + + ///Enables the filterbar filtering + FilterBar, + + ///Enables the menu filtering + Menu + } + + enum PageSizeMode { ///To count all the parent and child records. @@ -36227,6 +37111,37 @@ declare namespace ej { Checkbox } + + enum SummaryType { + + ///Displays the sum of summary column + Sum, + + ///Displays the average of summary column + Average, + + ///Displays the maximum value of summary column + Maximum, + + ///Displays the minimum value of summary column + Minimum, + + ///Displays the total count of summary column + Count, + + ///Displays the minimum date value in summary column + MinimumDate, + + ///Displays the maximum date value in summary column + MaximumDate, + + ///Displays the true count value for boolean summary columns + TrueCount, + + ///Displays the false count value for boolean summary columns + FalseCount + } + } class GroupButton extends ej.Widget { @@ -38079,6 +38994,11 @@ declare namespace ej { */ gotoPage(sheetIdx: number, newSheet: boolean): void; + /** This method is used to hide the pivot table activationPanel in the Spreadsheet. + * @returns {void} + */ + hideActivationPanel(): void; + /** This method is used to hide the entire columns from the specified range (startCol, endCol) in Spreadsheet. * @param {number} Index of the start column. * @param {number} Optional. Index of the end column. @@ -38798,6 +39718,12 @@ declare namespace ej { export interface XLFormat { + /** This method is used to add the font to the Ribbon font family dropdown. + * @param {string} Font name which needs to add into the font family option. + * @returns {void} + */ + addFontFamily(fontName: string): void; + /** This method is used to convert table range to normal range. * @param {any} Pass the sheet index and table id. * @returns {void} @@ -38818,6 +39744,12 @@ declare namespace ej { */ format(formatObj: any, range: string): void; + /** This method is used to remove the font from the Ribbon font family dropdown. + * @param {string} Font name which needs to remove from the font family drop down. + * @returns {void} + */ + removeFontFamily(fontName: string): void; + /** This method is used to remove the style in the specified range. * @param {Array|string} Pass the cell range . * @param {any} Optional. Pass the options for which the style gets removed. @@ -38832,7 +39764,7 @@ declare namespace ej { removeTable(tableId: number): void; /** This method is used to update the decimal places for numeric value for the selected range of cells in the Spreadsheet. - * @param {string} Pass the decimal places type in increment/decrement. + * @param {string} Pass the decimal places type in IncreaseDecimal/DecreaseDecimal. * @param {string|Array} Pass the range. * @returns {void} */ @@ -39321,9 +40253,9 @@ declare namespace ej { */ 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 {false} + /** Gets or sets a value that indicates whether to enable or disable freeze pane support in Spreadsheet. By enabling this feature, you can use freeze top row, + * freeze first column and freeze panes options. + * @Default {true} */ allowFreezing?: boolean; @@ -39466,6 +40398,10 @@ declare namespace ej { */ locale?: string; + /** Gets or sets a value that indicates name manager in Spreadsheet. + */ + nameManager?: NameManager[]; + /** Gets or sets an object that indicates to customize the picture behavior in the Spreadsheet. */ pictureSettings?: PictureSettings; @@ -40858,6 +41794,17 @@ declare namespace ej { password?: string; } + export interface NameManager { + + /** Specifies the name for the cell or a range. + */ + name?: string; + + /** Specifies the address for the cell or a range. + */ + refersto?: string; + } + 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. @@ -42084,6 +43031,11 @@ declare namespace ej { */ isResponsive?: boolean; + /** Gets or sets a value that indicates whether to enable the spellcheck operation on Enter/Space key-press. + * @Default {false} + */ + enableValidateOnType?: boolean; + /** It allows to spell check the multiple target HTML element's texts and correct its error words. * @Default {null} */ @@ -42648,6 +43600,7 @@ declare namespace ej { } } + declare namespace ej.datavisualization { class SymbolPalette extends ej.Widget { @@ -43247,6 +44200,16 @@ declare namespace ej.datavisualization { */ isResponsive?: boolean; + /** Used to Convert the date object to string while using the locale settings + * @Default {false} + */ + enableGroupSeparator?: boolean; + + /** Responsiveness of the linear gauge is controlled + * @Default {false} + */ + enableResize?: boolean; + /** Specify frame of linear gauge * @Default {null} */ @@ -43261,6 +44224,10 @@ declare namespace ej.datavisualization { * @Default {null} */ labelColor?: string; + /** Set the localization culture for the Linear gauge + * @Default {en-US} + */ + locale?: string; /** Specifies the maximum value of Linear gauge. * @Default {100} @@ -45258,6 +46225,16 @@ declare namespace ej.datavisualization { */ enableAnimation?: boolean; + /** Specify to convert the date object to string, using locale settings. + * @Default {false} + */ + enableGroupSeparator?: boolean; + + /** Controls whether circular gauge has to be responsive while resizing. + * @Default {false} + */ + enableResize?: boolean; + /** Specify the frame of circular gauge * @Default {Object} */ @@ -45288,6 +46265,11 @@ declare namespace ej.datavisualization { */ isResponsive?: boolean; + /** Name of the culture based on which circular gauge should be localized. + * @Default {en-US} + */ + locale?: string; + /** Specifies the maximum value of circular gauge. * @Default {100} */ @@ -45323,6 +46305,10 @@ declare namespace ej.datavisualization { */ theme?: string; + /** Options to customize the legend. + */ + legend?: Legend; + /** Specify tooltip option of circular gauge * @Default {object} */ @@ -45338,6 +46324,15 @@ declare namespace ej.datavisualization { */ width?: number; + /** Fires before rendering the legend item. This event is fired for each legend item in CircularGauge. You can use this event to customize legend item shape or add custom text to legend item. */ + legendItemRender?(e: LegendItemRenderEventArgs): void; + + /** Fires on clicking the legend item. */ + legendItemClick?(e: LegendItemClickEventArgs): void; + + /** Fires when mouse moving on ranges. */ + rangeMouseMove?(e: RangeMouseMoveEventArgs): void; + /** Triggers while the custom labels are being drawn on the gauge. */ drawCustomLabel?(e: DrawCustomLabelEventArgs): void; @@ -45375,6 +46370,63 @@ declare namespace ej.datavisualization { renderComplete?(e: RenderCompleteEventArgs): void; } + export interface LegendItemRenderEventArgs { + + /** Set this option to true to cancel the event + */ + cancel?: boolean; + + /** Instance of the circulargauge model object + */ + model?: any; + + /** Name of the event + */ + type?: string; + + /** Instance of the legend item object that is about to be rendered + */ + data?: any; + } + + export interface LegendItemClickEventArgs { + + /** Set this option to true to cancel the event + */ + cancel?: boolean; + + /** Instance of the circulargauge model object + */ + model?: any; + + /** Name of the event + */ + type?: string; + + /** Instance of the legend item object that is about to be rendered + */ + data?: any; + } + + export interface RangeMouseMoveEventArgs { + + /** Set this option to true to cancel the event + */ + cancel?: boolean; + + /** Instance of the circulargauge model object + */ + model?: any; + + /** Name of the event + */ + type?: string; + + /** Region of ranges + */ + data?: any; + } + export interface DrawCustomLabelEventArgs { /** returns the object of the gauge. @@ -46017,10 +47069,20 @@ declare namespace ej.datavisualization { */ position?: ScalesCustomLabelsPosition; + /** Specify angle for the rotation of the custom labels in degrees. + * @Default {0} + */ + textAngle?: number; + /** Specify font for custom labels * @Default {Object} */ font?: ScalesCustomLabelsFont; + + /** Specifies the position of the custom labels. See CustomLabelPositionType + * @Default {inner} + */ + positionType?: ej.datavisualization.CircularGauge.CustomLabelPositionType | string; } export interface ScalesIndicatorsPosition { @@ -46386,6 +47448,11 @@ declare namespace ej.datavisualization { */ backgroundColor?: string; + /** Specify text for the ranges of circular gauge + * @Default {null} + */ + legendText?: string; + /** Specify border for ranges of circular gauge * @Default {Object} */ @@ -46644,6 +47711,144 @@ declare namespace ej.datavisualization { ticks?: ScalesTick[]; } + export interface LegendBorder { + + /** Border color of the legend. + * @Default {transparent} + */ + color?: string; + + /** Border width of the legend. + * @Default {1} + */ + width?: number; + } + + export interface LegendItemStyleBorder { + + /** Border color of the legend items. + * @Default {transparent} + */ + color?: string; + + /** Border width of the legend items. + * @Default {1} + */ + width?: number; + } + + export interface LegendItemStyle { + + /** Options for customizing the border of legend items. + */ + border?: LegendItemStyleBorder; + + /** Specifies the height of the legend item shapes. + * @Default {10} + */ + height?: number; + + /** Specifies the width of the legend item shapes. + * @Default {10} + */ + width?: number; + } + + export interface LegendSize { + + /** Specify the height of the legend. Height can be specified in pixel. + * @Default {null} + */ + height?: string; + + /** Specify the width of the legend. Width can be specified in pixel. + * @Default {null} + */ + width?: string; + } + + export interface LegendFont { + + /** Font family for legend item text. + * @Default {Segoe UI} + */ + fontFamily?: string; + + /** Font style for legend item text. + * @Default {Normal} + */ + fontStyle?: string; + + /** Font weight for legend item text. + * @Default {Regular} + */ + fontWeight?: string; + + /** Font size for legend item text. + * @Default {12px} + */ + size?: string; + + /** Font color of the text for legend items. + * @Default {null} + */ + color?: string; + } + + export interface Legend { + + /** Toggles the visibility of the legend. + * @Default {false} + */ + visible?: boolean; + + /** Specifies the alignment of the legend. + * @Default {Center. See Alignment} + */ + alignment?: ej.datavisualization.CircularGauge.LegendAlignment | string; + + /** Options for customizing the legend border. + */ + border?: LegendBorder; + + /** Fill color for the legend items. By using this property, it displays all legend item shapes in same color.Legend items representing invisible ranges is displayed in gray color. + * @Default {null} + */ + fill?: string; + + /** Gap or padding between the legend items. + * @Default {20} + */ + itemPadding?: number; + + /** Options to customize the style of legend items. + */ + itemStyle?: LegendItemStyle; + + /** Opacity of the legend. + * @Default {1} + */ + opacity?: number; + + /** Places the legend at specified position. Legend can be placed at left, right, top or bottom of the circular gauge. + * @Default {Bottom. See Position} + */ + position?: ej.datavisualization.CircularGauge.LegendPosition | string; + + /** Shape of the legend items. + * @Default {Circle. See Shape} + */ + shape?: ej.datavisualization.CircularGauge.LegendShape | string; + + /** Options to customize the size of the legend. + */ + size?: LegendSize; + + /** Options to customize the font used for legend item text. + */ + font?: LegendFont; + } + export interface Tooltip { /** enable showCustomLabelTooltip of circular gauge @@ -46801,6 +48006,53 @@ declare namespace ej.datavisualization { } } + namespace CircularGauge { + enum LegendAlignment { + //string + Center, + //string + Near, + //string + Far, + } + } + + namespace CircularGauge { + enum LegendPosition { + //string + Left, + //string + Right, + //string + Top, + //string + Bottom, + } + } + + namespace CircularGauge { + enum LegendShape { + //string + Rectangle, + //string + Circle, + //string + Triangle, + //string + Ellipse, + //string + Diamond, + //string + Pentagon, + //string + Slider, + //string + Trapezoid, + //string + Line, + } + } + class DigitalGauge extends ej.Widget { static fn: DigitalGauge; constructor(element: JQuery | Element, options?: DigitalGauge.Model); @@ -46870,6 +48122,11 @@ declare namespace ej.datavisualization { */ isResponsive?: boolean; + /** Specifies the responsiveness of the Digital gauge + * @Default {false} + */ + enableResize?: boolean; + /** Specifies the items for the DigitalGauge. * @Default {null} */ @@ -47230,6 +48487,11 @@ declare namespace ej.datavisualization { */ animate(options: any): void; + /** Prints the rendered chart. + * @returns {void} + */ + print(): void; + /** Exports chart as an image or to an excel file. Chart can be exported as an image only when exportCanvasRendering option is set to true. * @param {string} Type of the export operation to be performed. Following are the two export types that are supported now,1. 'image'2. 'excel'Example * @param {string} URL of the service, where the chart will be exported to excel.Example, @@ -47445,6 +48707,9 @@ declare namespace ej.datavisualization { /** Fires before loading the chart. */ load?(e: LoadEventArgs): void; + /** Fires while performing rectangle zooming in chart. */ + zoomed?(e: ZoomedEventArgs): void; + /** Fires after selected the data in chart. */ rangeSelected?(e: RangeSelectedEventArgs): void; @@ -47540,15 +48805,15 @@ declare namespace ej.datavisualization { /** Instance of the corresponding axis. */ - Axis?: any; + axis?: any; /** Formatted text of the respective label. You can also add custom text to the label. */ - LabelText?: string; + Text?: string; /** Actual value of the label. */ - LabelValue?: string; + Value?: string; /** Set this option to true to cancel the event. */ @@ -47902,6 +49167,42 @@ declare namespace ej.datavisualization { */ type?: string; } + export interface ZoomedEventArgs { + + /** Set this option to true to cancel the event + */ + cancel?: boolean; + + /** Instance of the chart model object + */ + model?: any; + + /** Name of the event + */ + type?: string; + + /** Selected data collection of object + */ + data?: any; + } + export interface RangeSelectedEventArgs { + + /** Set this option to true to cancel the event + */ + cancel?: boolean; + + /** Instance of the chart model object + */ + model?: any; + + /** Name of the event + */ + type?: string; + + /** Selected data collection of object + */ + data?: any; + } export interface RangeSelectedEventArgs { @@ -49611,6 +50912,11 @@ declare namespace ej.datavisualization { */ labelPosition?: ej.datavisualization.Chart.LabelPosition | string; + /** Specifies the mode for splitting the data points in pieOfPie series. + * @Default {value. See SplitMode} + */ + splitMode?: ej.datavisualization.Chart.SplitMode | string; + /** Quartile calculation has been performed in three different formulas to render the box and whisker series. * @Default {exclusive} */ @@ -49648,6 +50954,21 @@ declare namespace ej.datavisualization { */ pieCoefficient?: number; + /** Controls the size of the second pie in pieOfPie series. Value ranges from 0 to 1. + * @Default {0.6} + */ + pieOfPieCoefficient?: number; + + /** Split Value of pieofpie series. + * @Default {null} + */ + splitValue?: string; + + /** Distance between the two pie's in pieOfPie series. + * @Default {50} + */ + gapWidth?: number; + /** Name of the property in the datasource that contains fill color for the series. * @Default {null} */ @@ -50987,6 +52308,11 @@ declare namespace ej.datavisualization { */ multiLevelLabels?: PrimaryXAxisMultiLevelLabel[]; + /** Specifies whether the axis elements need to be placed nearby the axis line, while crossing. + * @Default {true} + */ + showNextToAxisLine?: boolean; + /** Options for customizing the strip lines. * @Default {[ ]} */ @@ -51664,6 +52990,11 @@ declare namespace ej.datavisualization { */ multiLevelLabels?: AxesMultiLevelLabel[]; + /** Specifies whether the axis elements need to be placed nearby the axis line, while crossing. + * @Default {true} + */ + showNextToAxisLine?: boolean; + /** Options for customizing the strip lines. * @Default {[ ]} */ @@ -52337,6 +53668,11 @@ declare namespace ej.datavisualization { */ multiLevelLabels?: PrimaryYAxisMultiLevelLabel[]; + /** Specifies whether the axis elements need to be placed nearby the axis line, while crossing. + * @Default {true} + */ + showNextToAxisLine?: boolean; + /** Options for customizing the strip lines. * @Default {[ ]} */ @@ -53565,6 +54901,11 @@ declare namespace ej.datavisualization { */ labelPosition?: ej.datavisualization.Chart.LabelPosition | string; + /** Specifies the mode for splitting the data points in pieOfPie series. + * @Default {value. See SplitMode} + */ + splitMode?: ej.datavisualization.Chart.SplitMode | string; + /** Quartile calculation has been performed in three different formulas to render the boxplot series . * @Default {exclusive} */ @@ -53607,6 +54948,21 @@ declare namespace ej.datavisualization { */ pieCoefficient?: number; + /** Controls the size of the second pie in pieOfPie series. Value ranges from 0 to 1. + * @Default {0.6} + */ + pieOfPieCoefficient?: number; + + /** Split Value of pieofpie series. + * @Default {null} + */ + splitValue?: string; + + /** Distance between the two pie's in pieOfPie series. + * @Default {50} + */ + gapWidth?: number; + /** Options for customizing the empty point in the series. */ emptyPointSettings?: SeriesEmptyPointSettings; @@ -54069,6 +55425,19 @@ declare namespace ej.datavisualization { OutsideExtended, } } + + namespace Chart { + enum SplitMode { + //string + Position, + //string + Value, + //string + Percentage, + //string + Indexes, + } + } namespace Chart { enum boxPlotMode { //string @@ -54565,6 +55934,11 @@ declare namespace ej.datavisualization { */ enableScrollbar?: boolean; + /** Enable the resize option in the rangenavigator. + * @Default {false} + */ + enableAutoResizing?: boolean; + /** Toggles the direction of rendering the range navigator control. * @Default {false} */ @@ -54659,6 +56033,12 @@ declare namespace ej.datavisualization { /** Fires on when starting to change the scrollbar position of range navigator. */ scrollStart?(e: ScrollStartEventArgs): void; + /** Fires on when starting to change the slider position of range navigator. */ + selectedRangeStart?(e: SelectedRangeStartEventArgs): void; + + /** Fires when the selection ends in the range navigator */ + selectedRangeEnd?(e: SelectedRangeEndEventArgs): void; + /** Fires on changes ending the scrollbar position of range navigator. */ scrollEnd?(e: ScrollEndEventArgs): void; } @@ -54774,6 +56154,19 @@ declare namespace ej.datavisualization { type?: string; } + export interface SelectedRangeStartEventArgs { + + /** if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + } + + export interface SelectedRangeEndEventArgs { + + /** if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + } export interface ScrollEndEventArgs { /** parameters from RangeNavigator @@ -55490,6 +56883,24 @@ declare namespace ej.datavisualization { width?: number; } + export interface ValueAxisSettingsRange { + + /** Default Value + * @Default {null} + */ + min?: number; + + /** Default Value + * @Default {null} + */ + max?: number; + + /** Default Value + * @Default {null} + */ + interval?: number; + } + export interface ValueAxisSettings { /** Options for customizing the axis line. @@ -55508,6 +56919,10 @@ declare namespace ej.datavisualization { */ majorTickLines?: ValueAxisSettingsMajorTickLines; + /** You can customize the range of the axis by setting minimum , maximum and interval. + */ + range?: ValueAxisSettingsRange; + /** If the range is not given explicitly, range will be calculated automatically. You can customize the automatic range calculation using rangePadding. * @Default {none} */ @@ -55673,6 +57088,11 @@ declare namespace ej.datavisualization { */ enableAnimation?: boolean; + /** Controls whether bullet graph has to be responsive while resizing. + * @Default {true} + */ + enableResizing?: boolean; + /** Specifies the direction of flow in bullet graph. Neither it may be backward nor forward. * @Default {forward} */ @@ -55688,6 +57108,16 @@ declare namespace ej.datavisualization { */ isResponsive?: boolean; + /** Specifies to convert the date object to string, using locale settings. + * @Default {false} + */ + enableGroupSeparator?: boolean; + + /** Name of the culture based on which bulletgraph should be localized. + * @Default {en-US} + */ + locale?: string; + /** Bullet graph will render in the specified orientation. * @Default {horizontal} */ @@ -55748,6 +57178,9 @@ declare namespace ej.datavisualization { /** Fires on rendering the labels. */ drawLabels?(e: DrawLabelsEventArgs): void; + /** Fires on rendering the ticks. */ + drawTicks?(e: DrawTicksEventArgs): void; + /** Fires on rendering the qualitative ranges. */ drawQualitativeRanges?(e: DrawQualitativeRangesEventArgs): void; @@ -55869,6 +57302,11 @@ declare namespace ej.datavisualization { labelType?: string; } + export interface DrawTicksEventArgs { + /** Returns the cancel option value. + */ + cancel?: boolean; + } export interface DrawQualitativeRangesEventArgs { /** returns the object of the bullet graph. @@ -57798,6 +59236,15 @@ declare namespace ej.datavisualization { /** Triggers on treemap item selected. */ treeMapItemSelected?(e: TreeMapItemSelectedEventArgs): void; + + /** Triggers when drilldown is started */ + drillStarted?(e: DrillStartedEventArgs): void; + + /** Triggers on treemap drilldown item selected. */ + drillDownItemSelected?(e: DrillDownItemSelectedEventArgs): void; + + /** Triggers after refreshing the treemap items. */ + refreshed?(e: RefreshedEventArgs): void; } export interface TreeMapItemSelectedEventArgs { @@ -57807,6 +59254,27 @@ declare namespace ej.datavisualization { originalEvent?: any; } + export interface DrillStartedEventArgs { + + /** Returns selected drilled treeMap object. + */ + originalEvent?: any; + } + + export interface DrillDownItemSelectedEventArgs { + + /** Returns selected drilldown treeMap object. + */ + originalEvent?: any; + } + + export interface RefreshedEventArgs { + + /** Refresh and load the treemap. + */ + originalEvent?: any; + } + export interface UniColorMapping { /** Specifies the uniform color mapping of the treemap @@ -57931,6 +59399,11 @@ declare namespace ej.datavisualization { */ borderThickness?: number; + /** Specifies the space between the leaf items. + * @Default {0} + */ + gap?: number; + /** Specifies the label template of the leaf item. * @Default {null} */ @@ -58238,13 +59711,13 @@ declare namespace ej.datavisualization { */ findNode(name: string): any; - /** Fit the diagram content into diagram viewport - * @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} - */ - fitToPage(mode?: string, region?: string, margin?: any): void; + /** Fit the diagram content into diagram viewport + * @param {ej.datavisualization.Diagram.FitMode} to set the mode of fit to command. + * @param {ej.datavisualization.Diagram.Region} to set whether the region to be fit will be based on diagram elements or page settings. + * @param {any} to set the required margin + * @returns {void} + */ + fitToPage(mode?: ej.datavisualization.Diagram.FitMode, region?: ej.datavisualization.Diagram.Region, margin?: any): void; /** Group the selected nodes and connectors * @returns {void} @@ -58463,17 +59936,17 @@ declare namespace ej.datavisualization { */ fileName?: string; - /** format of the exported file/data. See [File Formats](/api/js/global#fileformats). + /** format of the exported file/data. */ - format?: string; + format?: ej.datavisualization.Diagram.FileFormats; - /** to set whether to export diagram as a file or as raw data. See [Export Modes](/api/js/global#exportmodes). + /** to set whether to export diagram as a file or as raw data. */ - mode?: string; + mode?: ej.datavisualization.Diagram.ExportModes; - /** to set the region of the diagram to be exported. See [Region](/api/js/global#region). + /** to set the region of the diagram to be exported. */ - region?: string; + region?: ej.datavisualization.Diagram.Region; /** to export any custom region of diagram. */ @@ -58483,9 +59956,9 @@ declare namespace ej.datavisualization { */ margin?: any; - /** to set stretch to the exported data. + /** to resize the diagram content to fill its allocated space. */ - stretch?: string; + stretch?: ej.datavisualization.Diagram.Stretch; } export interface Zoom { @@ -58771,6 +60244,10 @@ declare namespace ej.datavisualization { /** parameter returns the id of the diagram */ diagramId?: string; + + /** parameter to specify whether or not to cancel the event + */ + cancel?: boolean; } export interface ConnectionChangeEventArgs { @@ -58898,6 +60375,17 @@ declare namespace ej.datavisualization { /** parameter returns the id of the diagram */ diagramId?: string; + /** parameter returns whether or not to cancel the dragOver event + */ + cancel?: boolean; + + /** parameter returns the actual click event arguments that explains which button is clicked + */ + model?: any; + + /** parameter returns the type of the event triggered + */ + type?: string; } export interface ContextMenuClickEventArgs { @@ -58929,6 +60417,22 @@ declare namespace ej.datavisualization { /** parameter returns the id of the diagram */ diagramId?: string; + + /** parameter to specify whether or not to cancel the event + */ + cancel?: boolean; + + /** parameter returns the elementof the object that was clicked + */ + element?: any; + + /** parameter returns the object that is selected + */ + selectedItem?: any; + + /** parameter returns the model of the diagram + */ + events?: any; } export interface DoubleClickEventArgs { @@ -58944,6 +60448,10 @@ declare namespace ej.datavisualization { /** parameter returns the id of the diagram */ diagramId?: string; + + /** parameter to specify whether or not to cancel the event + */ + cancel?: boolean; } export interface DragEventArgs { @@ -58971,6 +60479,10 @@ declare namespace ej.datavisualization { /** parameter returns the id of the diagram */ diagramId?: string; + + /** parameter returns the offset of the selecteditems + */ + offset?: any; } export interface DragEnterEventArgs { @@ -58994,6 +60506,10 @@ declare namespace ej.datavisualization { */ element?: any; + /** parameter returns whether or not to cancel the dragOver event + */ + cancel?: boolean; + /** parameter returns the id of the diagram */ diagramId?: string; @@ -59050,7 +60566,7 @@ declare namespace ej.datavisualization { /** parameter returns the enum which defines the type of the source */ - sourceType?: string; + objectType?: string; /** parameter returns the id of the diagram */ @@ -59058,7 +60574,7 @@ declare namespace ej.datavisualization { } export interface EditorFocusChangeEventArgs { - /** Returns the cancel option value. + /** parameter to specify whether or not to cancel the event */ cancel?: boolean; } @@ -59099,6 +60615,14 @@ declare namespace ej.datavisualization { /** parameter returns the id of the diagram */ diagramId?: string; + + /** parameter to specify whether or not to cancel the event + */ + cancel?: boolean; + + /** parameter returns the model of the diagram + */ + cause?: boolean; } export interface ItemClickEventArgs { @@ -59115,7 +60639,7 @@ declare namespace ej.datavisualization { */ cancel?: boolean; - /** parameter returns the actual click event arguments that explains which button is clicked + /** parameter returns the model of the diagram */ event?: any; @@ -59141,6 +60665,10 @@ declare namespace ej.datavisualization { /** parameter returns the id of the diagram */ diagramId?: string; + + /** parameter returns whether or not to cancel the dragOver event + */ + cancel?: boolean; } export interface MouseLeaveEventArgs { @@ -59157,6 +60685,10 @@ declare namespace ej.datavisualization { */ target?: any; + /** parameter returns whether or not to cancel the dragOver event + */ + cancel?: boolean; + /** parameter returns the id of the diagram */ diagramId?: string; @@ -59176,6 +60708,10 @@ declare namespace ej.datavisualization { */ target?: any; + /** parameter returns whether or not to cancel the dragOver event + */ + cancel?: boolean; + /** parameter returns the id of the diagram */ diagramId?: string; @@ -59229,6 +60765,10 @@ declare namespace ej.datavisualization { /** parameter returns the id of the diagram */ diagramId?: string; + + /** parameter defines whether to cancel the property change or not + */ + cancel?: boolean; } export interface RotationChangeEventArgs { @@ -59252,6 +60792,10 @@ declare namespace ej.datavisualization { /** parameter returns the id of the diagram */ diagramId?: string; + + /** parameter returns the actual click event arguments that explains which button is clicked + */ + cause?: string; } export interface ScrollChangeEventArgs { @@ -59264,9 +60808,17 @@ declare namespace ej.datavisualization { */ oldValues?: any; + /** parameter returns whether or not to cancel the dragOver event + */ + cancel?: boolean; + /** parameter returns the id of the diagram */ diagramId?: string; + + /** Parameter returns the new zoom value, horizontal and vertical scroll offsets. + */ + cause?: string; } export interface SegmentChangeEventArgs { @@ -59318,14 +60870,18 @@ declare namespace ej.datavisualization { */ 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. + /** 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; + + /** parameter returns the actual cause of the event + */ + cause?: string; } export interface SizeChangeEventArgs { @@ -59357,6 +60913,10 @@ declare namespace ej.datavisualization { /** parameter returns the id of the diagram */ diagramId?: string; + + /** parameter returns the direction of the node is resized + */ + direction?: string; } export interface TextChangeEventArgs { @@ -59376,6 +60936,10 @@ declare namespace ej.datavisualization { /** parameter returns the id of the diagram */ diagramId?: string; + + /** parameter to specify whether or not to cancel the event + */ + cancel?: boolean; } export interface CreateEventArgs { @@ -60019,6 +61583,105 @@ declare namespace ej.datavisualization { showCustomMenuItemsOnly?: boolean; } + export interface DataSourceSettingsCrudAction { + + /** Specifies the create method which is used to get the nodes to be added from client side to the server side + * @Default {null} + */ + create?: string; + + /** Specifies the update method which is used to get the updated data from client side to the server side + * @Default {null} + */ + update?: string; + + /** Specifies the destroy method which is used to get the deleted items data from client side to the server side + * @Default {null} + */ + destroy?: string; + + /** Specifies the read method to get the created nodes from client side to the server side + * @Default {null} + */ + read?: string; + } + + export interface DataSourceSettingsConnectionDataSourceCrudAction { + + /** Specifies the create method which is used to get the connectors to be added from client side to the server side + * @Default {null} + */ + create?: string; + + /** Specifies the update method which is used to get the updated connectors from client side to the server side + * @Default {null} + */ + update?: string; + + /** Specifies the destroy method which is used to get the deleted items data from client side to the server side + * @Default {null} + */ + destroy?: string; + + /** Specifies the read method which is used to get the data from client side to the server side + * @Default {null} + */ + read?: string; + } + + export interface DataSourceSettingsConnectionDataSource { + + /** Sets the datasource for the connection datasource settings items. + * @Default {null} + */ + dataSource?: string; + + /** Sets the unique id of the connection data source item + * @Default {null} + */ + id?: string; + + /** Sets the sourcenode of the connection data source item + * @Default {null} + */ + sourceNode?: string; + + /** Sets the targetnode of the connection data source item + * @Default {null} + */ + targetNode?: string; + + /** Sets the sourcepoint-x value of the connection data source item + * @Default {null} + */ + sourcePointX?: string; + + /** Sets the sourcePoint-y value of the connection data source item + * @Default {null} + */ + sourcePointY?: string; + + /** Sets the targetPoint-x value of the connection data source item + * @Default {null} + */ + targetPointX?: string; + + /** Sets the targetPoint-y value of the connection data source item + * @Default {null} + */ + targetPointY?: string; + + /** Specifies the method name which is used to get updated connectors from client side to the server side + * @Default {null} + */ + crudAction?: DataSourceSettingsConnectionDataSourceCrudAction; + + /** Specifies the customfields to get the updated data from client side to the server side + * @Default {[]} + */ + customFields?: any[]; + } + export interface DataSourceSettings { /** Defines the data source either as a collection of objects or as an instance of ej.DataManager @@ -60048,6 +61711,21 @@ declare namespace ej.datavisualization { * @Default {null} */ tableName?: string; + + /** Specifies the method name which is used to get the updated data from client side to the server side + * @Default {null} + */ + crudAction?: DataSourceSettingsCrudAction; + + /** Specifies the customfields to get the updated data from client side to the server side + * @Default {[]} + */ + customFields?: any[]; + + /** Defines the data source either as a collection of objects or as an instance of ej.DataManager + * @Default {null} + */ + connectionDataSource?: DataSourceSettingsConnectionDataSource; } export interface DefaultSettings { @@ -60131,6 +61809,11 @@ declare namespace ej.datavisualization { */ getLayoutInfo?: any; + /** Defines a method to customize the segments based on source and target nodes. + * @Default {null} + */ + getConnectorSegments?: any; + /** Sets the space to be horizontally left between nodes * @Default {30} */ @@ -61380,6 +63063,10 @@ declare namespace ej.datavisualization { export interface SelectedItemsUserHandle { + /** Defines the name of the user handle + */ + name?: string; + /** Defines the background color of the user handle * @Default {#2382c3} */ @@ -62537,6 +64224,57 @@ declare namespace ej.datavisualization { Mouse, } } + namespace Diagram { + enum FileFormats { + //Used to export the diagram into JPG format. + JPG, + //Used to export the diagram into PNG format. + PNG, + //Used to export the diagram into BMP format. + BMP, + //Used to export the diagram into SVG format. + SVG, + } + } + namespace Diagram { + enum ExportModes { + //Used to export the diagram as a file. + Download, + //Used to export the diagram as raw data. + Data, + } + } + namespace Diagram { + enum Region { + //Used to export the content of the diagram only. + Content, + //Used to export the page region of the diagram. + PageSettings, + } + } + namespace Diagram { + enum Stretch { + //The diagram content preserves its original size. + None, + //The diagram content is resized to fill the destination dimensions. The aspect ratio is not preserved. + Fill, + //The diagram content is resized to fit in the destination dimensions while it preserves its native aspect ratio. + Uniform, + //The diagram content is resized to fill the destination dimensions while it preserves its native aspect ratio. If the aspect ratio of the destination rectangle differs from the source, + //the source content is clipped to fit in the destination dimensions. + UniformToFill, + } + } + namespace Diagram { + enum FitMode { + //Used to fit the diagram content based on page size. + Page, + //Used to fit the diagram content based on diagram width. + Width, + //Used to fit the diagram content based on diagram height. + Height, + } + } namespace Diagram { enum ZoomCommand { //Used to zoom in the Diagram @@ -63224,6 +64962,11 @@ declare namespace ej.datavisualization { */ rangeBandSettings?: RangeBandSettings; + /** Name of the culture based on which sparkline should be localized. + * @Default {en-US} + */ + locale?: string; + /** Name of a field in data source, where the fill color for all the data points is generated. */ palette?: string; @@ -63238,6 +64981,11 @@ declare namespace ej.datavisualization { */ enableCanvasRendering?: boolean; + /** Specify to convert the date object to string, using locale settings. + * @Default {false} + */ + enableGroupSeparator?: boolean; + /** Specifies the dataSource for the series. It can be an array of JSON objects or an instance of ej.DataManager. * @Default {null} */ @@ -64925,6 +66673,7 @@ declare namespace ej.datavisualization { } + interface JQueryXHR { /** * Returns the cancel option value. @@ -65089,6 +66838,9 @@ interface JQuery { ejPivotTreeMap(options?: ej.PivotTreeMap.Model): JQuery; ejPivotTreeMap(memberName: any, value?: any, param?: any): any; + ejPrint(options?: ej.Print.Model): JQuery; + ejPrint(memberName: any, value?: any, param?: any): any; + ejProgressBar(options?: ej.ProgressBar.Model): JQuery; ejProgressBar(memberName: any, value?: any, param?: any): any; @@ -65247,6 +66999,7 @@ interface JQuery { data(key: "ejPivotPager"): ej.PivotPager; data(key: "ejPivotSchemaDesigner"): ej.PivotSchemaDesigner; data(key: "ejPivotTreeMap"): ej.PivotTreeMap; + data(key: "ejPrint"): ej.Print; data(key: "ejProgressBar"): ej.ProgressBar; data(key: "ejRadialMenu"): ej.RadialMenu; data(key: "ejRadialSlider"): ej.RadialSlider; diff --git a/types/electron-config/electron-config-tests.ts b/types/electron-config/electron-config-tests.ts index bf1ad2087b..a5ac9e9ec3 100644 --- a/types/electron-config/electron-config-tests.ts +++ b/types/electron-config/electron-config-tests.ts @@ -13,7 +13,7 @@ const electronConfig = new ElectronConfig(); electronConfig.set('foo', 'bar'); electronConfig.set({ foo: 'bar', - 'foo2': 'bar2', + foo2: 'bar2', }); electronConfig.delete('foo'); electronConfig.get('foo'); diff --git a/types/electron-config/tslint.json b/types/electron-config/tslint.json index 3db14f85ea..e830836d23 100644 --- a/types/electron-config/tslint.json +++ b/types/electron-config/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json" , + "rules": { + "no-namespace":false, + "object-literal-key-quotes": false + } +} diff --git a/types/electron-settings/v2/electron-settings-tests.ts b/types/electron-settings/v2/electron-settings-tests.ts new file mode 100644 index 0000000000..38e37e6ba0 --- /dev/null +++ b/types/electron-settings/v2/electron-settings-tests.ts @@ -0,0 +1,102 @@ +import * as settings from 'electron-settings'; + +function test_configure() { + settings.configure({ + atomicSaving: false, + prettify: true + }) === undefined; +} + +function test_defaults() { + settings.defaults({ + a: 1, + b: '', + c: false, + d: { + d1: 'd1', + d2: true + }, + e: ['e1', 'e2'] + }) === undefined; +} + +async function test_has() { + await settings.has('a') === true; +} + +function test_hasSync() { + settings.hasSync('a') === true; +} + +async function test_get() { + await settings.get('b') === ''; +} + +function test_getSync() { + settings.getSync('b') === ''; +} + +async function test_set() { + await settings.set('c', true) === undefined; +} + +function test_setSync() { + settings.setSync('c', true) === undefined; +} + +async function test_delete() { + await settings.delete('d') === undefined; +} + +function test_deleteSync() { + settings.deleteSync('d') === undefined; +} + +async function test_clear() { + await settings.clear() === undefined; +} + +function test_clearSync() { + settings.clearSync() === undefined; +} +async function test_applyDefaults() { + await settings.applyDefaults({ overwrite: true }) === undefined; +} + +function test_applyDefaultsSync() { + settings.applyDefaultsSync({ overwrite: true }) === undefined; +} + +async function test_resetToDefaults() { + await settings.resetToDefaults() === undefined; +} + +function test_resetToDefaultsSync() { + settings.resetToDefaultsSync() === undefined; +} + +function test_observe() { + const observer = settings.observe('b', evt => { + if (evt.oldValue !== evt.newValue) { + console.log(evt.newValue); + } + }); + + observer.dispose(); +} + +function test_getSettingsFilePath() { + settings.getSettingsFilePath() === __filename; +} + +function test_on_create() { + settings.on('create', pathToSettings => { + pathToSettings === __dirname; + }) === settings; +} + +function test_on_write() { + settings.on('write', () => { + console.log(); + }) === settings; +} diff --git a/types/electron-settings/v2/index.d.ts b/types/electron-settings/v2/index.d.ts new file mode 100644 index 0000000000..ead5250015 --- /dev/null +++ b/types/electron-settings/v2/index.d.ts @@ -0,0 +1,241 @@ +// Type definitions for electron-settings 2.2 +// Project: https://github.com/nathanbuchar/electron-settings +// Definitions by: Leonard Thieu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +import * as EventEmitter from 'events'; + +/** + * The Settings class. + */ +declare class Settings extends EventEmitter { + /** + * Globally configures default options. + * + * @throws if options is not an object. + */ + configure(options: ElectronSettings.Options | object): void; + + /** + * Globally configures default settings. + * + * If the settings file has not been created yet, these defaults will be applied, + * but only if settings.defaults is called before making any other calls that + * interact with the file system, such as has(), get(), or set(). + * + * @param defaults The defaults object. + * @throws if defaults is not an object. + */ + defaults(defaults: any): void; + + /** + * Returns a promise whose first argument is a boolean indicating if the key path exists within the settings object. + * For synchronous operation, use hasSync(). + * + * @param keyPath The path to the key that we wish to check exists within the settings object. + * @throws if key path is not a string. + * @see hasSync + */ + has(keyPath: string): Promise; + + /** + * The synchronous version of has(). + * + * @see has + */ + hasSync(keyPath: string): boolean; + + /** + * Returns a promise whose first argument is the value at the chosen key path. + * If no key path is chosen, the entire settings object will be returned instead. + * For synchronous operation, use getSync(). + * + * @param keyPath The path to the key that we wish to get the value of. + * @see getSync + */ + get(keyPath?: string): Promise; + + /** + * The synchronous version of get(). + * + * @see get + */ + getSync(keyPath?: string): any; + + /** + * Sets the value of the key at the chosen key path. + * For synchronous operation, use setSync(). + * + * @param keyPath The path to the key whose value we wish to set. This key need not already exist. + * @param value The value to set the key at the chosen key path to. This must be a data type supported by JSON: object, array, string, number, boolean, or null. + * @param options + * @throws if key path is not a string. + * @throws if options is not an object. + * @see setSync + */ + set(keyPath: string, value: any, options?: ElectronSettings.Options | object): Promise; + + /** + * The synchronous version of set(). + * + * @see set + */ + setSync(keyPath: string, value: any, options?: ElectronSettings.Options | object): void; + + /** + * Deletes the key and value at the chosen key path. + * + * @param keyPath The path to the key we wish to unset. + * @param options + * @throws if keyPath is not a string. + * @throws if options is not an object. + * @see deleteSync + */ + delete(keyPath: string, options?: ElectronSettings.Options | object): Promise; + + /** + * The synchronous version of delete(). + * + * @see delete + */ + deleteSync(keyPath: string, options?: ElectronSettings.Options | object): void; + + /** + * Clears the entire settings object. + * For synchronous operation, use clearSync(). + * + * @throws if options is not an object. + * @see clearSync + */ + clear(options?: ElectronSettings.Options | object): Promise; + + /** + * The synchronous version of clear(). + * + * @see clear + */ + clearSync(options?: ElectronSettings.Options | object): void; + + /** + * Applies defaults to the current settings object (deep). + * Settings that already exist will not be overwritten, but keys that exist within the defaults + * that don't exist within the setting object will be added. + * To configure defaults, use defaults(). + * For synchronous operation, use applyDefaultsSync(). + * + * @throws if options is not an object. + * @see defaults + * @see applyDefaultsSync + */ + applyDefaults(options?: ElectronSettings.ApplyDefaultsOptions | object): Promise; + + /** + * The synchronous version of applyDefaults(). + * + * @see applyDefaults + */ + applyDefaultsSync(options?: ElectronSettings.ApplyDefaultsOptions | object): void; + + /** + * Resets all settings to defaults. + * To configure defaults, use defaults(). + * For synchronous operation, use resetToDefaultsSync(). + * + * @throws if options is not an object. + * @see defaults + * @see resetToDefaultsSync + */ + resetToDefaults(options?: ElectronSettings.Options | object): Promise; + + /** + * The synchronous version of resetToDefaults(). + * + * @see resetToDefaults + */ + resetToDefaultsSync(options?: ElectronSettings.Options | object): void; + + /** + * Observes the chosen key path for changes and calls the handler if the value changes. + * Returns an Observer instance which has a dispose method. + * To unsubscribe, simply call dispose() on the returned key path observer. + * + * @param keyPath The path to the key that we wish to observe. + * @param handler The callback that will be invoked if the value at the chosen key path changes. + * @throws if key path is not a string. + * @throws if handler is not a function. + */ + observe(keyPath: string, handler: (evt: ElectronSettings.ChangeEvent) => void): ElectronSettings.Observer; + + /** + * Returns the path to the config file. Typically found in your application's user data directory: + * ~/Library/Application Support/YourApp on MacOS. + * %APPDATA%/YourApp on Windows. + * $XDG_CONFIG_HOME/YourApp or ~/.config/YourApp on Linux. + */ + getSettingsFilePath(): string; + + /** + * Emitted when the settings file has been created. + */ + on(event: 'create', listener: (pathToSettings: string) => void): this; + /** + * Emitted when the settings have been written to disk. + */ + on(event: 'write', listener: () => void): this; +} + +declare const SettingsInstance: Settings; +export = SettingsInstance; + +declare namespace ElectronSettings { + /** + * The Observer class. + */ + class Observer { + /** + * Disposes of the key path observer by unbinding the event listener and + * nullifying all internal references. + */ + dispose(): void; + } + + interface Options extends Pick { } + + namespace Options { + interface _Impl { + /** + * Whether electron-settings should create a tmp file during save to ensure data-write consistency. + * + * @default true + */ + atomicSaving: boolean; + /** + * Prettify the JSON output. + * + * @default false + */ + prettify: boolean; + } + } + + interface ApplyDefaultsOptions extends Pick { } + + namespace ApplyDefaultsOptions { + interface _Impl extends Options._Impl { + /** + * Overwrite pre-existing settings with their respective default values. + * + * @default false + */ + overwrite: boolean; + } + } + + interface ChangeEvent { + oldValue: any; + newValue: any; + } +} diff --git a/types/electron-settings/v2/tsconfig.json b/types/electron-settings/v2/tsconfig.json new file mode 100644 index 0000000000..3a5b7b152c --- /dev/null +++ b/types/electron-settings/v2/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "electron-settings": [ + "electron-settings/v2" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "electron-settings-tests.ts" + ] +} diff --git a/types/electron-settings/v2/tslint.json b/types/electron-settings/v2/tslint.json new file mode 100644 index 0000000000..4f44991c3c --- /dev/null +++ b/types/electron-settings/v2/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-empty-interface": false + } +} diff --git a/types/electron/.editorconfig b/types/electron/.editorconfig deleted file mode 100644 index 2d98d905de..0000000000 --- a/types/electron/.editorconfig +++ /dev/null @@ -1,2 +0,0 @@ -[*.ts] -indent_style = tab diff --git a/types/electron/index.d.ts b/types/electron/index.d.ts deleted file mode 100644 index 782a509305..0000000000 --- a/types/electron/index.d.ts +++ /dev/null @@ -1,6147 +0,0 @@ -// Type definitions for Electron v1.4.8 -// Project: http://electron.atom.io/ -// Definitions by: jedmao , rhysd , Milan Burda , aliib , Daniel Perez Alvarez , Markus Olsson -// 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 - - 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. - */ - 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; - /** - * 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; - /** - * @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; - /** - * 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; - /** - * 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. - */ - 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 | null): 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[]; - /** - * 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'; - 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; - /** - * Add a type of vibrancy effect to the window, only on macOS - */ - vibrancy?: VibrancyType; - /** - * 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; bookmark?: 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; - /** - * 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'; - - 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' | 'promptToCreate' | 'noResolveAliases')[]; - /** - * Normalize the keyboard access keys across platforms. - */ - normalizeAccessKeys?: boolean; - /** - * Message to display above input boxes. - */ - message?: string; - } - - 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[]; - }[]; - /** - * macOS - Message to display above text fields. - */ - message?: string; - /** - * macOS - Custom label for the text displayed in front of the filename text field. - */ - nameFieldLabel?: string; - /** - * macOS - Show the tags input box, defaults to true. - */ - showsTagField?: boolean; - } - - 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); - - /** - * A function that is fired when the MenuItem receives a click event - */ - click: (event: Event, browserWindow: BrowserWindow, webContents: WebContents) => 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' | 'reload' | 'toggledevtools'; - 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, event: Event) => 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. - * - * Passing null will remove the menu bar on Windows and Linux but has no - * effect on macOS. - */ - static setApplicationMenu(menu: Menu | null): void; - /** - * @returns The application menu if set, or null if not set. - */ - static getApplicationMenu(): Menu | null; - /** - * 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; - } - - // 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 - - /** - * 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: string, - 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) | null): 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. - */ - on(event: 'new-window', listener: (event: Event, - url: string, - frameName: string, - disposition: NewWindowDisposition, - options: BrowserWindowOptions - ) => 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 Whether the web page is destroyed. - */ - isDestroyed(): boolean; - /** - * @returns Whether the web page is focused. - */ - isFocused(): boolean; - /** - * @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. - * - * @returns Promise - */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; - /** - * 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. - */ - 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. - */ - 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; - } - - 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; - /** - * 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 { - /** - * 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 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. - */ - 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 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; - 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. - */ - 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. - */ - 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, options?: RegisterURLSchemeOptions): 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. - * - * @returns Promise - */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; - /** - * @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; - } - - 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 - - /** - * 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 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 ,. - */ - 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. - * - * @returns Promise - */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; - /** - * 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; - net: Electron.Net; - 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/types/electron/test/index.ts b/types/electron/test/index.ts deleted file mode 100644 index 8ae462139a..0000000000 --- a/types/electron/test/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import electron = require('electron'); -import child_process = require('child_process'); - -// TODO -child_process.spawn(electron as any); diff --git a/types/electron/test/main.ts b/types/electron/test/main.ts deleted file mode 100644 index 0f3f17ca33..0000000000 --- a/types/electron/test/main.ts +++ /dev/null @@ -1,1138 +0,0 @@ - -import { - app, - autoUpdater, - BrowserWindow, - contentTracing, - dialog, - globalShortcut, - ipcMain, - Menu, - MenuItem, - net, - powerMonitor, - powerSaveBlocker, - protocol, - Tray, - clipboard, - crashReporter, - nativeImage, - screen, - shell, - session, - systemPreferences, - webContents -} from 'electron'; - -import * as path from 'path'; - -// Quick start -// https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md - -// Keep a global reference of the window object, if you don't, the window will -// be closed automatically when the javascript object is GCed. -var mainWindow: Electron.BrowserWindow = null; - -// Quit when all windows are closed. -app.on('window-all-closed', () => { - if (process.platform !== 'darwin') - app.quit(); -}); - -// Check single instance app -var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) { - // Someone tried to run a second instance, we should focus our window - if (mainWindow) { - if (mainWindow.isMinimized()) mainWindow.restore(); - mainWindow.focus(); - } -}); - -if (shouldQuit) { - app.quit(); - process.exit(0); -} - -// This method will be called when Electron has done everything -// initialization and ready for creating browser windows. -app.on('ready', () => { - // Create the browser window. - mainWindow = new BrowserWindow({ width: 800, height: 600 }); - - // and load the index.html of the app. - 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(); - mainWindow.webContents.openDevTools({mode: 'detach'}); - mainWindow.webContents.closeDevTools(); - mainWindow.webContents.addWorkSpace('/path/to/workspace'); - mainWindow.webContents.removeWorkSpace('/path/to/workspace'); - var opened: boolean = mainWindow.webContents.isDevToolsOpened() - var focused = mainWindow.webContents.isDevToolsFocused(); - // Emitted when the window is closed. - mainWindow.on('closed', () => { - // Dereference the window object, usually you would store windows - // in an array if your app supports multi windows, this is the time - // when you should delete the corresponding element. - mainWindow = null; - }); - - mainWindow.webContents.setVisualZoomLevelLimits(50, 200); - mainWindow.webContents.setLayoutZoomLevelLimits(50, 200); - - mainWindow.webContents.print({silent: true, printBackground: false}); - mainWindow.webContents.print(); - - mainWindow.webContents.printToPDF({ - marginsType: 1, - pageSize: 'A3', - printBackground: true, - printSelectionOnly: true, - landscape: true, - }, (error: Error, data: Buffer) => {}); - - mainWindow.webContents.printToPDF({}, (err, data) => {}); - - 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'); - mainWindow.webContents.startDrag({file: '/path/to/img.png', icon: nativeImage.createFromPath('/path/to/icon.png')}); - mainWindow.webContents.findInPage('blah'); - mainWindow.webContents.findInPage('blah', { - forward: true, - matchCase: false, - }); - mainWindow.webContents.stopFindInPage('clearSelection'); - mainWindow.webContents.stopFindInPage('keepSelection'); - mainWindow.webContents.stopFindInPage('activateSelection'); - - mainWindow.loadURL('https://github.com'); - - mainWindow.webContents.on('did-finish-load', function() { - mainWindow.webContents.savePage('/tmp/test.html', 'HTMLComplete', function(error) { - if (!error) - console.log("Save page successfully"); - }); - }); - - try { - mainWindow.webContents.debugger.attach("1.1"); - } catch(err) { - console.log("Debugger attach failed : ", err); - }; - - mainWindow.webContents.debugger.on('detach', function(event, reason) { - console.log("Debugger detached due to : ", reason); - }); - - mainWindow.webContents.debugger.on('message', function(event, method, params) { - if (method == "Network.requestWillBeSent") { - if (params.request.url == "https://www.github.com") { - win.webContents.debugger.detach(); - } - } - }); - - mainWindow.webContents.debugger.sendCommand("Network.enable"); - mainWindow.webContents.capturePage(image => { - console.log(image.toDataURL()); - }); - mainWindow.webContents.capturePage({x: 0, y: 0, width: 100, height: 200}, image => { - console.log(image.toPNG()); - }); - - mainWindow.setMenu(null); - mainWindow.setMenu(Menu.buildFromTemplate([])); -}); - -app.commandLine.appendSwitch('enable-web-bluetooth'); - -app.on('ready', () => { - mainWindow.webContents.on('select-bluetooth-device', (event, deviceList, callback) => { - event.preventDefault(); - - let result = (() => { - for (let device of deviceList) { - if (device.deviceName === 'test') { - return device; - } - } - return null; - })(); - - if (!result) { - callback(''); - } else { - callback(result.deviceId); - } - }); -}); - -// Locale -app.getLocale(); - -// Desktop environment integration -// https://github.com/atom/electron/blob/master/docs/tutorial/desktop-environment-integration.md - -app.addRecentDocument('/Users/USERNAME/Desktop/work.type'); -app.clearRecentDocuments(); -var dockMenu = Menu.buildFromTemplate([ - { - label: 'New Window', - click: () => { - console.log('New Window'); - } - }, - { - label: 'New Window with Settings', - submenu: [ - { label: 'Basic' }, - { label: 'Pro' } - ] - }, - { label: 'New Command...' }, - { - label: 'Edit', - submenu: [ - { - label: 'Undo', - accelerator: 'CmdOrCtrl+Z', - role: 'undo' - }, - { - label: 'Redo', - accelerator: 'Shift+CmdOrCtrl+Z', - role: 'redo' - }, - { - type: 'separator' - }, - { - label: 'Cut', - accelerator: 'CmdOrCtrl+X', - role: 'cut' - }, - { - label: 'Copy', - accelerator: 'CmdOrCtrl+C', - role: 'copy' - }, - { - label: 'Paste', - accelerator: 'CmdOrCtrl+V', - role: 'paste' - }, - ] - }, -]); -app.dock.setMenu(dockMenu); -app.dock.setBadge('foo'); -var id = app.dock.bounce('informational'); -app.dock.cancelBounce(id); -app.dock.setIcon('/path/to/icon.png'); - -app.setBadgeCount(app.getBadgeCount() + 1); - -app.setUserTasks([ - { - program: process.execPath, - arguments: '--new-window', - iconPath: process.execPath, - iconIndex: 0, - title: 'New Window', - description: 'Create a new window' - } -]); -app.setUserTasks([]); - -app.setJumpList([ - { - type: 'custom', - name: 'Recent Projects', - items: [ - { type: 'file', path: 'C:\\Projects\\project1.proj' }, - { type: 'file', path: 'C:\\Projects\\project2.proj' } - ] - }, - { // has a name so type is assumed to be "custom" - name: 'Tools', - items: [ - { - type: 'task', - title: 'Tool A', - program: process.execPath, - args: '--run-tool-a', - iconPath: process.execPath, - iconIndex: 0, - description: 'Runs Tool A' - }, - { - type: 'task', - title: 'Tool B', - program: process.execPath, - args: '--run-tool-b', - iconPath: process.execPath, - iconIndex: 0, - description: 'Runs Tool B' - }] - }, - { - type: 'frequent' - }, - { // has no name and no type so type is assumed to be "tasks" - items: [ - { - type: 'task', - title: 'New Project', - program: process.execPath, - args: '--new-project', - description: 'Create a new project.' - }, - { - type: 'separator' - }, - { - type: 'task', - title: 'Recover Project', - program: process.execPath, - args: '--recover-project', - description: 'Recover Project' - }] - } -]); - -if (app.isUnityRunning()) { -} -if (app.isAccessibilitySupportEnabled()) { -} -app.setLoginItemSettings({openAtLogin: true, openAsHidden: false}); -console.log(app.getLoginItemSettings().wasOpenedAtLogin); -app.setAboutPanelOptions({ - applicationName: 'Test', - version: '1.2.3' -}); - -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 - -var onlineStatusWindow: Electron.BrowserWindow; - -app.on('ready', () => { - 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)); - -ipcMain.on('online-status-changed', (event: any, status: any) => { - console.log(status); -}); - -// Synopsis -// https://github.com/atom/electron/blob/master/docs/api/synopsis.md - -app.on('ready', () => { - window = new BrowserWindow({ - width: 800, - height: 600, - titleBarStyle: 'hidden-inset', - }); - window.loadURL('https://github.com'); -}); - -// Supported Chrome command line switches -// https://github.com/atom/electron/blob/master/docs/api/chrome-command-line-switches.md - -app.commandLine.appendSwitch('remote-debugging-port', '8315'); -app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1'); -app.commandLine.appendSwitch('vmodule', 'console=0'); - -// systemPreferences -// https://github.com/electron/electron/blob/master/docs/api/system-preferences.md - -var browserOptions = { - width: 1000, - height: 800, - transparent: false, - frame: true -}; - -// Make the window transparent only if the platform supports it. -if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) { - browserOptions.transparent = true; - browserOptions.frame = false; -} - -if (process.platform === 'win32') { - systemPreferences.on('color-changed', () => { console.log('color changed'); }); - systemPreferences.on('inverted-color-scheme-changed', (_, inverted) => console.log(inverted ? 'inverted' : 'not inverted')); - console.log('Color for menu is', systemPreferences.getColor('menu')); -} - -// Create the window. -var win = new BrowserWindow(browserOptions); - -// Navigate. -if (browserOptions.transparent) { - win.loadURL('file://' + __dirname + '/index.html'); -} else { - // No transparency, so we load a fallback that uses basic styles. - win.loadURL('file://' + __dirname + '/fallback.html'); -} - -// app -// https://github.com/atom/electron/blob/master/docs/api/app.md - -app.on('certificate-error', function(event, webContents, url, error, certificate, callback) { - if (url == "https://github.com") { - // Verification logic. - event.preventDefault(); - callback(true); - } else { - callback(false); - } -}); - -app.on('select-client-certificate', function(event, webContents, url, list, callback) { - event.preventDefault(); - callback(list[0]); -}); - -app.on('login', function(event, webContents, request, authInfo, callback) { - event.preventDefault(); - callback('username', 'secret'); -}); - -var win = new BrowserWindow({show: false}) -win.once('ready-to-show', () => { - win.show(); -}); - -app.relaunch({args: process.argv.slice(1).concat(['--relaunch'])}); -app.exit(0); - -// auto-updater -// https://github.com/atom/electron/blob/master/docs/api/auto-updater.md - -autoUpdater.setFeedURL('http://mycompany.com/myapp/latest?version=' + app.getVersion()); -autoUpdater.checkForUpdates(); -autoUpdater.quitAndInstall(); - -autoUpdater.on('error', (error) => { - console.log('error', error); -}); - -autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName, releaseDate, updateURL) => { - console.log('update-downloaded', releaseNotes, releaseName, releaseDate, updateURL); -}); - -// browser-window -// https://github.com/atom/electron/blob/master/docs/api/browser-window.md - -var win = new BrowserWindow({ width: 800, height: 600, show: false }); -win.on('closed', () => { - win = null; -}); - -win.loadURL('https://github.com'); -win.show(); - -var toolbarRect = document.getElementById('toolbar').getBoundingClientRect(); -win.setSheetOffset(toolbarRect.height); - -var installed = BrowserWindow.getDevToolsExtensions().hasOwnProperty('devtron'); - -// content-tracing -// https://github.com/atom/electron/blob/master/docs/api/content-tracing.md - -const options = { - categoryFilter: '*', - traceOptions: 'record-until-full,enable-sampling' -} - -contentTracing.startRecording(options, function() { - console.log('Tracing started'); - setTimeout(function() { - contentTracing.stopRecording('', function(path) { - console.log('Tracing data recorded to ' + path); - }); - }, 5000); -}); - -// dialog -// https://github.com/atom/electron/blob/master/docs/api/dialog.md - -// variant without browserWindow -var openDialogResult: string[] = dialog.showOpenDialog({ - title: 'Testing showOpenDialog', - defaultPath: '/var/log/syslog', - filters: [{name: '', extensions: ['']}], - properties: ['openFile', 'openDirectory', 'multiSelections'] -}); - -// variant with browserWindow -openDialogResult = dialog.showOpenDialog(win, { - title: 'Testing showOpenDialog', - defaultPath: '/var/log/syslog', - filters: [{name: '', extensions: ['']}], - properties: ['openFile', 'openDirectory', 'multiSelections'] -}); - -// global-shortcut -// https://github.com/atom/electron/blob/master/docs/api/global-shortcut.md - -// Register a 'ctrl+x' shortcut listener. -var ret = globalShortcut.register('ctrl+x', () => { - console.log('ctrl+x is pressed'); -}); -if (!ret) - console.log('registerion fails'); - -// Check whether a shortcut is registered. -console.log(globalShortcut.isRegistered('ctrl+x')); - -// Unregister a shortcut. -globalShortcut.unregister('ctrl+x'); - -// Unregister all shortcuts. -globalShortcut.unregisterAll(); - -// ipcMain -// https://github.com/atom/electron/blob/master/docs/api/ipc-main-process.md - -ipcMain.on('asynchronous-message', (event: Electron.IpcMainEvent, arg: any) => { - console.log(arg); // prints "ping" - event.sender.send('asynchronous-reply', 'pong'); -}); - -ipcMain.on('synchronous-message', (event: Electron.IpcMainEvent, arg: any) => { - console.log(arg); // prints "ping" - event.returnValue = 'pong'; -}); - -var winWindows = new BrowserWindow({ - width: 800, - height: 600, - show: false, - thickFrame: false, - type: 'toolbar', -}); - -// menu-item -// https://github.com/atom/electron/blob/master/docs/api/menu-item.md - -var menuItem = new MenuItem({ - click: (menuItem: Electron.MenuItem, browserWindow: Electron.BrowserWindow, event: Electron.Event) => { - console.log('click', menuItem, browserWindow, event); - } -}); - -const fakeEvent: Electron.Event = { - preventDefault: () => { }, - sender: winWindows.webContents, -} - -menuItem.label = 'Hello World!'; -menuItem.click(fakeEvent, winWindows, winWindows.webContents) - -// menu -// https://github.com/atom/electron/blob/master/docs/api/menu.md - -var menu = new Menu(); -menu.append(new MenuItem({ label: 'MenuItem1', click: () => { console.log('item 1 clicked'); } })); -menu.append(new MenuItem({ type: 'separator' })); -menu.append(new MenuItem({ label: 'MenuItem2', type: 'checkbox', checked: true })); -menu.insert(0, menuItem); - -console.log(menu.items); - -var pos = screen.getCursorScreenPoint(); -menu.popup(null, pos.x, pos.y); - -// main.js -var template = [ - { - label: 'Electron', - submenu: [ - { - label: 'About Electron', - role: 'about' - }, - { - type: 'separator' - }, - { - label: 'Services', - role: 'services', - submenu: [] - }, - { - type: 'separator' - }, - { - label: 'Hide Electron', - accelerator: 'Command+H', - role: 'hide' - }, - { - label: 'Hide Others', - accelerator: 'Command+Shift+H', - role: 'hideothers' - }, - { - label: 'Show All', - role: 'unhide' - }, - { - type: 'separator' - }, - { - label: 'Quit', - accelerator: 'Command+Q', - click: () => { app.quit(); } - } - ] - }, - { - label: 'Edit', - submenu: [ - { - label: 'Undo', - accelerator: 'Command+Z', - role: 'undo' - }, - { - label: 'Redo', - accelerator: 'Shift+Command+Z', - role: 'redo' - }, - { - type: 'separator' - }, - { - label: 'Cut', - accelerator: 'Command+X', - role: 'cut' - }, - { - label: 'Copy', - accelerator: 'Command+C', - role: 'copy' - }, - { - label: 'Paste', - accelerator: 'Command+V', - role: 'paste' - }, - { - label: 'Select All', - accelerator: 'Command+A', - role: 'selectall' - } - ] - }, - { - label: 'View', - submenu: [ - { - label: 'Reload', - accelerator: 'Command+R', - click: (item, focusedWindow) => { - if (focusedWindow) { - focusedWindow.webContents.reloadIgnoringCache(); - } - } - }, - { - label: 'Toggle DevTools', - accelerator: 'Alt+Command+I', - click: (item, focusedWindow) => { - if (focusedWindow) { - focusedWindow.webContents.toggleDevTools(); - } - } - }, - { - type: 'separator' - }, - { - label: 'Actual Size', - accelerator: 'CmdOrCtrl+0', - click: (item, focusedWindow) => { - if (focusedWindow) { - focusedWindow.webContents.setZoomLevel(0) - } - } - }, - { - label: 'Zoom In', - accelerator: 'CmdOrCtrl+Plus', - click: (item, focusedWindow) => { - if (focusedWindow) { - const { webContents } = focusedWindow; - webContents.getZoomLevel((zoomLevel) => { - webContents.setZoomLevel(zoomLevel + 0.5) - }); - } - } - }, - { - label: 'Zoom Out', - accelerator: 'CmdOrCtrl+-', - click: (item, focusedWindow) => { - if (focusedWindow) { - const { webContents } = focusedWindow; - webContents.getZoomLevel((zoomLevel) => { - webContents.setZoomLevel(zoomLevel - 0.5) - }); - } - } - } - ] - }, - { - label: 'Window', - submenu: [ - { - label: 'Minimize', - accelerator: 'Command+M', - role: 'minimize' - }, - { - label: 'Close', - accelerator: 'Command+W', - role: 'close' - }, - { - type: 'separator' - }, - { - label: 'Bring All to Front', - role: 'front' - } - ] - }, - { - label: 'Help', - submenu: [] - } -]; - -menu = Menu.buildFromTemplate(template); - -Menu.setApplicationMenu(menu); // Must be called within app.on('ready', function(){ ... }); -Menu.setApplicationMenu(null); - -Menu.buildFromTemplate([ - { label: '4', id: '4' }, - { label: '5', id: '5' }, - { label: '1', id: '1', position: 'before=4' }, - { label: '2', id: '2' }, - { label: '3', id: '3' } -]); - -Menu.buildFromTemplate([ - { label: 'a', position: 'endof=letters' }, - { label: '1', position: 'endof=numbers' }, - { label: 'b', position: 'endof=letters' }, - { label: '2', position: 'endof=numbers' }, - { label: 'c', position: 'endof=letters' }, - { 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 - -app.on('ready', () => { - powerMonitor.on('suspend', () => { - console.log('The system is going to sleep'); - }); - powerMonitor.on('resume', () => { - console.log('The system has resumed from sleep'); - }); - powerMonitor.on('on-ac', () => { - console.log('The system changed to AC power') - }); - powerMonitor.on('on-battery', () => { - console.log('The system changed to battery power'); - }); -}); - -// power-save-blocker -// https://github.com/atom/electron/blob/master/docs/api/power-save-blocker.md - -var id = powerSaveBlocker.start('prevent-display-sleep'); -console.log(powerSaveBlocker.isStarted(id)); - -powerSaveBlocker.stop(id); - -// protocol -// https://github.com/atom/electron/blob/master/docs/api/protocol.md - -app.on('ready', () => { - protocol.registerStandardSchemes(['https']); - protocol.registerServiceWorkerSchemes(['https']); - - protocol.registerFileProtocol('atom', (request, callback) => { - callback(`${__dirname}/${request.url}`); - }); - - protocol.registerBufferProtocol('atom', (request, callback) => { - callback({mimeType: 'text/html', data: new Buffer('
    Response
    ')}); - }); - - protocol.registerStringProtocol('atom', (request, callback) => { - callback('Hello World!'); - }); - - protocol.registerHttpProtocol('atom', (request, callback) => { - callback({url: request.url, method: request.method}); - }); - - protocol.unregisterProtocol('atom', (error) => { - console.log(error ? error.message : 'ok'); - }); - - protocol.isProtocolHandled('atom', (handled) => { - console.log(handled); - }); -}); - -// tray -// https://github.com/atom/electron/blob/master/docs/api/tray.md - -var appIcon: Electron.Tray = null; -app.on('ready', () => { - appIcon = new Tray('/path/to/my/icon'); - var contextMenu = Menu.buildFromTemplate([ - { label: 'Item1', type: 'radio' }, - { label: 'Item2', type: 'radio' }, - { label: 'Item3', type: 'radio', checked: true }, - { label: 'Item4', type: 'radio' }, - ]); - appIcon.setToolTip('This is my application.'); - appIcon.setContextMenu(contextMenu); - appIcon.setImage('/path/to/new/icon'); - appIcon.popUpContextMenu(contextMenu, {x: 100, y: 100}); - - appIcon.on('click', (event, bounds) => { - console.log('click', event, bounds); - }); - - appIcon.on('ballon-show', () => { - console.log('ballon-show'); - }); - - appIcon.displayBalloon({ - title: 'Hello World!' - }); -}); - -// clipboard -// https://github.com/atom/electron/blob/master/docs/api/clipboard.md - -{ - 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() - }); -} - -// crash-reporter -// https://github.com/atom/electron/blob/master/docs/api/crash-reporter.md - -crashReporter.start({ - productName: 'YourName', - companyName: 'YourCompany', - submitURL: 'https://your-domain.com/url-to-submit', - autoSubmit: true, - extra: { - someKey: "value" - } -}); - -console.log(crashReporter.getLastCrashReport()); -console.log(crashReporter.getUploadedReports()); - -// nativeImage -// https://github.com/atom/electron/blob/master/docs/api/native-image.md - -var appIcon2 = new Tray('/Users/somebody/images/icon.png'); -var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' }); -var image = clipboard.readImage(); -var appIcon3 = new Tray(image); -var appIcon4 = new Tray('/Users/somebody/images/icon.png'); - -let image2 = nativeImage.createFromPath('/Users/somebody/images/icon.png'); - -// process -// https://github.com/electron/electron/blob/master/docs/api/process.md - -console.log(process.versions.electron); -console.log(process.versions.chrome); -console.log(process.type); -console.log(process.resourcesPath); -console.log(process.mas); -console.log(process.windowsStore); -process.noAsar = true; -process.crash(); -process.hang(); -process.setFdLimit(8192); - -// screen -// https://github.com/atom/electron/blob/master/docs/api/screen.md - -app.on('ready', () => { - var size = screen.getPrimaryDisplay().workAreaSize; - mainWindow = new BrowserWindow({ width: size.width, height: size.height }); -}); - -app.on('ready', () => { - var displays = screen.getAllDisplays(); - var externalDisplay: any = null; - for (var i in displays) { - if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) { - externalDisplay = displays[i]; - break; - } - } - - if (externalDisplay) { - mainWindow = new BrowserWindow({ - x: externalDisplay.bounds.x + 50, - y: externalDisplay.bounds.y + 50, - }); - } - - screen.on('display-added', (event, display) => { - console.log('display-added', display); - }); - - screen.on('display-removed', (event, display) => { - console.log('display-removed', display); - }); - - screen.on('display-metrics-changed', (event, display, changes) => { - console.log('display-metrics-changed', display, changes); - }); -}); - -// shell -// https://github.com/atom/electron/blob/master/docs/api/shell.md - -shell.showItemInFolder('/home/user/Desktop/test.txt'); -shell.openItem('/home/user/Desktop/test.txt'); -shell.moveItemToTrash('/home/user/Desktop/test.txt'); - -shell.openExternal('https://github.com', { - activate: false -}); - -shell.beep(); - -shell.writeShortcutLink('/home/user/Desktop/shortcut.lnk', 'update', shell.readShortcutLink('/home/user/Desktop/shortcut.lnk')); - -// session -// https://github.com/atom/electron/blob/master/docs/api/session.md - -session.defaultSession.on('will-download', (event, item, webContents) => { - event.preventDefault(); - require('request')(item.getURL(), (data: any) => { - require('fs').writeFileSync('/somewhere', data); - }); -}); - -// Query all cookies. -session.defaultSession.cookies.get({}, (error, cookies) => { - console.log(cookies); -}); - -// Query all cookies associated with a specific url. -session.defaultSession.cookies.get({ url : "http://www.github.com" }, (error, cookies) => { - console.log(cookies); -}); - -// Set a cookie with the given cookie data; -// may overwrite equivalent cookies if they exist. -var cookie = { url : "http://www.github.com", name : "dummy_name", value : "dummy" }; -session.defaultSession.cookies.set(cookie, (error) => { - if (error) { - console.error(error); - } -}); - -// In the main process. -session.defaultSession.on('will-download', (event, item, webContents) => { - // Set the save path, making Electron not to prompt a save dialog. - item.setSavePath('/tmp/save.pdf'); - console.log(item.getSavePath()); - console.log(item.getMimeType()); - console.log(item.getFilename()); - console.log(item.getTotalBytes()); - - item.on('updated', (event, state) => { - if (state === 'interrupted') { - console.log('Download is interrupted but can be resumed'); - } else if (state === 'progressing') { - if (item.isPaused()) { - console.log('Download is paused'); - } else { - console.log(`Received bytes: ${item.getReceivedBytes()}`); - } - } - }); - - item.on('done', function(e, state) { - if (state == "completed") { - console.log("Download successfully"); - } else { - console.log(`Download failed: ${state}`) - } - }); -}); - -// To emulate a GPRS connection with 50kbps throughput and 500 ms latency. -session.defaultSession.enableNetworkEmulation({ - latency: 500, - downloadThroughput: 6400, - uploadThroughput: 6400 -}); - -// To emulate a network outage. -session.defaultSession.enableNetworkEmulation({ - offline: true -}); - -session.defaultSession.setCertificateVerifyProc((hostname, cert, callback) => { - callback((hostname === 'github.com') ? true : false); - console.log(cert.issuer.commonName); -}); - -session.defaultSession.setPermissionRequestHandler(function(webContents, permission, callback) { - if (webContents.getURL() === 'github.com') { - if (permission == "notifications") { - callback(false); - return; - } - } - - callback(true); -}); - -// consider any url ending with `example.com`, `foobar.com`, `baz` -// for integrated authentication. -session.defaultSession.allowNTLMCredentialsForDomains('*example.com, *foobar.com, *baz') - -// consider all urls for integrated authentication. -session.defaultSession.allowNTLMCredentialsForDomains('*') - -// Modify the user agent for all requests to the following urls. -var filter = { - urls: ["https://*.github.com/*", "*://electron.github.io"] -}; - -session.defaultSession.webRequest.onBeforeSendHeaders(filter, function(details, callback) { - details.requestHeaders['User-Agent'] = "MyAgent"; - callback({cancel: false, requestHeaders: details.requestHeaders}); -}); - -app.on('ready', function () { - const protocol = session.defaultSession.protocol - protocol.registerFileProtocol('atom', function (request, callback) { - var url = request.url.substr(7); - callback({path: path.normalize(__dirname + '/' + url)}); - }, function (error) { - if (error) { - console.error('Failed to register protocol'); - } - }) -}); - -// webContents -// https://github.com/electron/electron/blob/master/docs/api/web-contents.md - -console.log(webContents.getAllWebContents()); -console.log(webContents.getFocusedWebContents()); - -var win = new BrowserWindow({ - webPreferences: { - offscreen: true - } -}); - -win.webContents.on('paint', (event, dirty, image) => { - console.log(dirty, image.getBitmap()); -}); - -win.loadURL('http://github.com'); diff --git a/types/electron/test/renderer.ts b/types/electron/test/renderer.ts deleted file mode 100644 index 8394f59d24..0000000000 --- a/types/electron/test/renderer.ts +++ /dev/null @@ -1,311 +0,0 @@ - -import { - ipcRenderer, - remote, - webFrame, - clipboard, - crashReporter, - nativeImage, - screen, - shell -} from 'electron'; - -import * as fs from 'fs'; - -// In renderer process (web page). -// https://github.com/atom/electron/blob/master/docs/api/ipc-renderer.md -console.log(ipcRenderer.sendSync('synchronous-message', 'ping')); // prints "pong" - -ipcRenderer.on('asynchronous-reply', (event: Electron.IpcRendererEvent, arg: any) => { - console.log(arg); // prints "pong" - event.sender.send('another-message', 'Hello World!'); -}); - -ipcRenderer.send('asynchronous-message', 'ping'); - -// remote -// https://github.com/atom/electron/blob/master/docs/api/remote.md - -var BrowserWindow = remote.BrowserWindow; -var win = new BrowserWindow({ width: 800, height: 600 }); -win.loadURL('https://github.com'); - -remote.getCurrentWindow().on('close', () => { - // blabla... -}); - -remote.getCurrentWindow().capturePage(buf => { - fs.writeFile('/tmp/screenshot.png', buf, err => { - console.log(err); - }); -}); - -remote.getCurrentWebContents().print(); - -remote.getCurrentWindow().capturePage(buf => { - remote.require('fs').writeFile('/tmp/screenshot.png', buf, (err: Error) => { - console.log(err); - }); -}); - -// web-frame -// https://github.com/atom/electron/blob/master/docs/api/web-frame.md - -webFrame.setZoomFactor(2); -console.log(webFrame.getZoomFactor()); - -webFrame.setZoomLevel(200); -console.log(webFrame.getZoomLevel()); - -webFrame.setVisualZoomLevelLimits(50, 200); -webFrame.setLayoutZoomLevelLimits(50, 200); - -webFrame.setSpellCheckProvider('en-US', true, { - spellCheck: text => { - return !(require('spellchecker').isMisspelled(text)); - } -}); - -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(); - -// clipboard -// https://github.com/atom/electron/blob/master/docs/api/clipboard.md - -clipboard.writeText('Example String'); -clipboard.writeText('Example String', 'selection'); -console.log(clipboard.readText('selection')); -console.log(clipboard.availableFormats()); -clipboard.clear(); - -clipboard.write({ - html: '', - text: 'Hello World!', - bookmark: "Bookmark name", - image: clipboard.readImage() -}); - -// crash-reporter -// https://github.com/atom/electron/blob/master/docs/api/crash-reporter.md - -crashReporter.start({ - productName: 'YourName', - companyName: 'YourCompany', - submitURL: 'https://your-domain.com/url-to-submit', - autoSubmit: true -}); - -// desktopCapturer -// https://github.com/atom/electron/blob/master/docs/api/desktop-capturer.md - -var desktopCapturer = require('electron').desktopCapturer; - -desktopCapturer.getSources({types: ['window', 'screen']}, function(error, sources) { - if (error) throw error; - for (var i = 0; i < sources.length; ++i) { - if (sources[i].name == "Electron") { - (navigator as any).webkitGetUserMedia({ - audio: false, - video: { - mandatory: { - chromeMediaSource: 'desktop', - chromeMediaSourceId: sources[i].id, - minWidth: 1280, - maxWidth: 1280, - minHeight: 720, - maxHeight: 720 - } - } - }, gotStream, getUserMediaError); - return; - } - } -}); - -function gotStream(stream: any) { - (document.querySelector('video') as HTMLVideoElement).src = URL.createObjectURL(stream); -} - -function getUserMediaError(error: Error) { - console.log('getUserMediaError', error); -} - -// File object -// https://github.com/atom/electron/blob/master/docs/api/file-object.md - -/* -
    - Drag your file here -
    -*/ - -var holder = document.getElementById('holder'); - -holder.ondragover = function () { - return false; -}; - -holder.ondragleave = holder.ondragend = function () { - return false; -}; - -holder.ondrop = function (e) { - e.preventDefault(); - var file = e.dataTransfer.files[0]; - console.log('File you dragged here is', file.path); - return false; -}; - -// nativeImage -// https://github.com/atom/electron/blob/master/docs/api/native-image.md - -var Tray = remote.Tray; -var appIcon2 = new Tray('/Users/somebody/images/icon.png'); -var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' }); -var image = clipboard.readImage(); -var appIcon3 = new Tray(image); -var appIcon4 = new Tray('/Users/somebody/images/icon.png'); - -// https://github.com/electron/electron/blob/master/docs/api/process.md - -// preload.js -var _setImmediate = setImmediate; -var _clearImmediate = clearImmediate; -process.once('loaded', function() { - global.setImmediate = _setImmediate; - global.clearImmediate = _clearImmediate; -}); - -// screen -// https://github.com/atom/electron/blob/master/docs/api/screen.md - -var app = remote.app; - -var mainWindow: Electron.BrowserWindow = null; - -app.on('ready', () => { - var size = screen.getPrimaryDisplay().workAreaSize; - mainWindow = new BrowserWindow({ width: size.width, height: size.height }); -}); - -app.on('ready', () => { - var displays = screen.getAllDisplays(); - var externalDisplay: any = null; - for (var i in displays) { - if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) { - externalDisplay = displays[i]; - break; - } - } - - if (externalDisplay) { - mainWindow = new BrowserWindow({ - x: externalDisplay.bounds.x + 50, - y: externalDisplay.bounds.y + 50, - }); - } -}); - -// shell -// https://github.com/atom/electron/blob/master/docs/api/shell.md - -shell.openExternal('https://github.com'); - -// -// https://github.com/atom/electron/blob/master/docs/api/web-view-tag.md - -var webview = document.createElement('webview'); -webview.loadURL('https://github.com'); - -webview.addEventListener('console-message', function(e) { - console.log('Guest page logged a message:', e.message); -}); - -webview.addEventListener('found-in-page', function(e) { - if (e.result.finalUpdate) { - webview.stopFindInPage("keepSelection"); - } -}); - -var requestId = webview.findInPage("test"); - -webview.addEventListener('new-window', function(e) { - require('electron').shell.openExternal(e.url); -}); - -webview.addEventListener('close', function() { - webview.src = 'about:blank'; -}); - -// In embedder page. -webview.addEventListener('ipc-message', function(event) { - console.log(event.channel); // Prints "pong" -}); -webview.send('ping'); -webview.capturePage((image) => { console.log(image); }); - -{ - const opened: boolean = webview.isDevToolsOpened(); - const focused: boolean = webview.isDevToolsFocused(); - const focused2: boolean = webview.getWebContents().isFocused(); -} - -// In guest page. -ipcRenderer.on('ping', function() { - ipcRenderer.sendToHost('pong'); -}); - - -// showOpenDialog -// https://electron.atom.io/docs/api/dialog/#dialogshowopendialogbrowserwindow-options-callback - -remote.dialog.showOpenDialog(win); -remote.dialog.showOpenDialog(win, {}, fileNames => fileNames); -remote.dialog.showOpenDialog(win, { - title: 'foo', - defaultPath: '/bar', - buttonLabel: 'foo bar', - filters: [ - {name: 'Images', extensions: ['jpg', 'png', 'gif']}, - {name: 'Movies', extensions: ['mkv', 'avi', 'mp4']}, - {name: 'Custom File Type', extensions: ['as']}, - {name: 'All Files', extensions: ['*']} - ], - properties: ['openFile', 'openDirectory', 'multiSelections', 'showHiddenFiles', 'createDirectory', 'promptToCreate', 'noResolveAliases'], - normalizeAccessKeys: true, - message: 'foo message', -}); - -// showSaveDialog -// https://electron.atom.io/docs/api/dialog/#dialogshowsavedialogbrowserwindow-options-callback - -remote.dialog.showSaveDialog(win); -remote.dialog.showSaveDialog(win, {}, fileNames => fileNames); -remote.dialog.showSaveDialog(win, { - title: 'foo', - defaultPath: '/bar', - buttonLabel: 'foo bar', - filters: [ - {name: 'Images', extensions: ['jpg', 'png', 'gif']}, - {name: 'Movies', extensions: ['mkv', 'avi', 'mp4']}, - {name: 'Custom File Type', extensions: ['as']}, - {name: 'All Files', extensions: ['*']} - ], - message: 'foo message', - nameFieldLabel: 'foo name', - showsTagField: true -}); diff --git a/types/element-resize-event/element-resize-event-tests.ts b/types/element-resize-event/element-resize-event-tests.ts index 96c859cdae..5ebf93dcab 100644 --- a/types/element-resize-event/element-resize-event-tests.ts +++ b/types/element-resize-event/element-resize-event-tests.ts @@ -2,6 +2,6 @@ import ere = require("element-resize-event"); var domNode: Element = null; -ere(domNode, (): void => { -}); +ere(domNode, (): void => {}); +ere.unbind(domNode, (): void => {}); diff --git a/types/element-resize-event/index.d.ts b/types/element-resize-event/index.d.ts index e500d2e7f9..4745bc3a11 100644 --- a/types/element-resize-event/index.d.ts +++ b/types/element-resize-event/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for element-resize-event 1.0.1 +// Type definitions for element-resize-event 2.0.9 // Project: https://github.com/KyleAMathews/element-resize-event -// Definitions by: Rogier Schouten +// Definitions by: Rogier Schouten , Pierre-Luc Gregoire // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare function elementResizeEvent(domNode: Element, callback: () => void): void; -export = elementResizeEvent; +export = element_resize_event; +declare function element_resize_event(omNode: Element, callback: () => void): void; +declare namespace element_resize_event { + function unbind(omNode: Element, callback: () => void): void; +} diff --git a/types/ember/ember-tests.ts b/types/ember/ember-tests.ts index 99f00aae6f..4119e1d7ec 100644 --- a/types/ember/ember-tests.ts +++ b/types/ember/ember-tests.ts @@ -105,6 +105,17 @@ App.userController = Em.Object.create({ }) }); +Ember.Helper.helper((params) => { + let cents = params[0]; + return `${cents * 0.01}`; +}); + +Ember.Helper.helper((params, hash) => { + let cents = params[0]; + let currency = hash.currency; + return `${currency}${cents * 0.01}`; +}); + Handlebars.registerHelper('highlight', (property: string, options: any) => new Handlebars.SafeString('' + "some value" + '')); diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index f7aedcb7c1..201f14f156 100644 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Ember.js 2.7 // Project: http://emberjs.com/ // Definitions by: Jed Mao +// bttf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -548,9 +549,9 @@ declare namespace Ember { toArray(): any[]; uniq(): Enumerable; without(value: any): Enumerable; - '@each': EachProxy; + '@each': EachProxy; Boolean: boolean; - '[]': any[]; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; @@ -630,8 +631,8 @@ declare namespace Ember { unshiftObject(object: any): any; unshiftObjects(objects: any[]): any[]; without(value: any): Enumerable; - '[]': any[]; - '@each': EachProxy; + '[]': any[]; + '@each': EachProxy; Boolean: boolean; firstObject: any; hasEnumerableObservers: boolean; @@ -1030,7 +1031,7 @@ declare namespace Ember { toArray(): any[]; uniq(): Enumerable; without(value: any): Enumerable; - '[]': any[]; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; @@ -1137,7 +1138,7 @@ declare namespace Ember { service(name?: string): Service; }; class Helper extends Object { - static helper( h: (a: any) => any): Helper; + static helper( h: (params: any, hash?: any) => any): Helper; compute(params: any[], hash: any): any; recompute(params: any[], hash: any): any; } @@ -1291,7 +1292,7 @@ declare namespace Ember { toArray(): any[]; uniq(): Enumerable; without(value: any): Enumerable; - '[]': any[]; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; @@ -1571,6 +1572,34 @@ declare namespace Ember { @return {Promise} */ finally(callback: (a: T) => V, label?: string): Promise; + + static all(promises: GlobalArray<(Q | Thenable)>): Promise; + static race(promises: GlobalArray>): Promise; + + /** + @method resolve + @param {Any} value value that the returned promise will be resolved with + @param {String} label optional string for identifying the returned promise. + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` + */ + static resolve(object?: Q | Thenable): Promise; + + /** + @method cast (Deprecated in favor of resolve + @param {Any} value value that the returned promise will be resolved with + @param {String} label optional string for identifying the returned promise. + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` + */ + static cast(object: Q | Thenable, label?: string): Promise; + + /** + `RSVP.Promise.reject` returns a promise rejected with the passed `reason`. + */ + static reject(reason?: any): Promise; } function all(promises: GlobalArray>): Promise; diff --git a/types/emscripten/emscripten-tests.ts b/types/emscripten/emscripten-tests.ts index 0c7f99b710..153ea6b5de 100644 --- a/types/emscripten/emscripten-tests.ts +++ b/types/emscripten/emscripten-tests.ts @@ -1,8 +1,20 @@ - - - /// Module function ModuleTest(): void { + Module.environment = "WEB"; + Module.environment = "NODE"; + Module.noInitialRun = false; + Module.logReadFiles = false; + Module.filePackagePrefixURL = "http://www.example.org/"; + Module.preinitializedWebGLContext = new WebGLRenderingContext(); + + let package: ArrayBuffer = Module.getPreloadedPackage("package-name", 100); + let exports: WebAssembly.Exports = Module.instantiateWasm( + [{name: "func-name", kind: "function"}], + (module: WebAssembly.Module) => {} + ); + let memFile: string = Module.locateFile("http://www.example.org/file.mem"); + Module.onCustomMessage(new MessageEvent("TestType")); + Module.print = function(text) { alert('stdout: ' + text) }; var int_sqrt = Module.cwrap('int_sqrt', 'number', ['number']) @@ -16,6 +28,7 @@ function ModuleTest(): void { Module.HEAPU8.set(myTypedArray, buf); Module.ccall('my_function', 'number', ['number'], [buf]); Module._free(buf); + Module.destroy({}); } /// FS diff --git a/types/emscripten/index.d.ts b/types/emscripten/index.d.ts index 38e659a0f3..14260dd9d4 100644 --- a/types/emscripten/index.d.ts +++ b/types/emscripten/index.d.ts @@ -1,7 +1,11 @@ // Type definitions for Emscripten // Project: http://kripken.github.io/emscripten-site/index.html // Definitions by: Kensuke Matsuzaki +// Periklis Tsirakidis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// declare namespace Emscripten { interface FileSystemType { @@ -9,13 +13,30 @@ declare namespace Emscripten { } declare namespace Module { + type EnvironmentType = "WEB" | "NODE" | "SHELL" | "WORKER"; + function print(str: string): void; function printErr(str: string): void; var arguments: string[]; + var environment: EnvironmentType; var preInit: { (): void }[]; var preRun: { (): void }[]; var postRun: { (): void }[]; + var preinitializedWebGLContext: WebGLRenderingContext; + var noInitialRun: boolean; var noExitRuntime: boolean; + var logReadFiles: boolean; + var filePackagePrefixURL: string; + var wasmBinary: ArrayBuffer; + + function destroy(object: object): void; + function getPreloadedPackage(remotePackageName: string, remotePackageSize: number): ArrayBuffer; + function instantiateWasm( + imports: WebAssembly.Imports, + successCallback: (module: WebAssembly.Module) => void + ): WebAssembly.Exports; + function locateFile(url: string): string; + function onCustomMessage(event: MessageEvent): void; var Runtime: any; @@ -65,7 +86,7 @@ declare namespace Module { function addOnExit(cb: () => any): void; function addOnPostRun(cb: () => any): void; - // Tools + // Tools function intArrayFromString(stringy: string, dontAddNull?: boolean, length?: number): number[]; function intArrayToString(array: number[]): string; function writeStringToMemory(str: string, buffer: number, dontAddNull: boolean): void; diff --git a/types/enhanced-resolve/index.d.ts b/types/enhanced-resolve/index.d.ts index d773f52b16..aa85a8336f 100644 --- a/types/enhanced-resolve/index.d.ts +++ b/types/enhanced-resolve/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for enhanced-resolve v3.0.0 // Project: http://github.com/webpack/enhanced-resolve.git -// Definitions by: e-cloud +// Definitions by: e-cloud , Onigoetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -8,7 +8,6 @@ import fs = require('fs'); import { - ResolveResult, LoggingCallbackWrapper, ResolverRequest, ResolveContext, @@ -19,31 +18,35 @@ import Resolver = require('./lib/Resolver'); import Tapable = require('tapable'); declare namespace Resolve { - function sync(path: string, request: string): ResolveResult; - function sync(context: ResolveContext, path: string, request: string): ResolveResult; + function sync(path: string, request: string): string; + function sync(context: ResolveContext, path: string, request: string): string; function context(path: string, request: string, callback: LoggingCallbackWrapper): void; function context(context: ResolveContext, path: string, request: string, callback: LoggingCallbackWrapper): void; namespace context { - function sync(path: string, request: string): ResolveResult; - function sync(context: ResolveContext, path: string, request: string): ResolveResult; + function sync(path: string, request: string): string; + function sync(context: ResolveContext, path: string, request: string): string; } function loader(path: string, request: string, callback: LoggingCallbackWrapper): void; function loader(context: ResolveContext, path: string, request: string, callback: LoggingCallbackWrapper): void; - namespace context { - function sync(path: string, request: string): ResolveResult; - function sync(context: ResolveContext, path: string, request: string): ResolveResult; + namespace loader { + function sync(path: string, request: string): string; + function sync(context: ResolveContext, path: string, request: string): string; } - function create(path: string, request: string, callback: LoggingCallbackWrapper): void; - function create(context: ResolveContext, path: string, request: string, callback: LoggingCallbackWrapper): void; + function create(options: ResolverFactory.ResolverOption): { + (path: string, request: string, callback: LoggingCallbackWrapper): void; + (context: ResolveContext, path: string, request: string, callback: LoggingCallbackWrapper): void; + } export namespace create { - function sync(path: string, request: string): ResolveResult; - function sync(context: ResolveContext, path: string, request: string): ResolveResult; + function sync(options: ResolverFactory.ResolverOption): { + (path: string, request: string): string; + (context: ResolveContext, path: string, request: string): string; + } } export namespace ResolverFactory { @@ -54,8 +57,8 @@ declare namespace Resolve { descriptionFiles?: string[]; enforceExtension?: boolean; enforceModuleExtension?: boolean; - extensions: string[]; - fileSystem: AbstractInputFileSystem; + extensions?: string[]; + fileSystem?: AbstractInputFileSystem; mainFields?: string[]; mainFiles?: string[]; moduleExtensions?: string[]; @@ -70,7 +73,7 @@ declare namespace Resolve { interface AliasItem { alias: string; name: string; - onlyModule: boolean; + onlyModule?: boolean; } function createResolver(options: ResolverOption): Resolver; } diff --git a/types/enhanced-resolve/lib/Resolver.d.ts b/types/enhanced-resolve/lib/Resolver.d.ts index 20fc1c0914..1799fba39b 100644 --- a/types/enhanced-resolve/lib/Resolver.d.ts +++ b/types/enhanced-resolve/lib/Resolver.d.ts @@ -2,7 +2,6 @@ import Tapable = require('tapable'); import { ResolveParseResult, - ResolveResult, ResolverRequest, LoggingCallbackWrapper, AbstractInputFileSystem, @@ -14,7 +13,7 @@ declare class Resolver extends Tapable { constructor(fileSystem: AbstractInputFileSystem); - resolveSync(context: ResolveContext, path: string, request: string): ResolveResult; + resolveSync(context: ResolveContext, path: string, request: string): string; resolve(context: ResolveContext, path: string, request: string, callback: LoggingCallbackWrapper): any; diff --git a/types/enhanced-resolve/lib/common-types.d.ts b/types/enhanced-resolve/lib/common-types.d.ts index 6607dee64f..b0ec925c0b 100644 --- a/types/enhanced-resolve/lib/common-types.d.ts +++ b/types/enhanced-resolve/lib/common-types.d.ts @@ -23,11 +23,6 @@ export interface ResolveContext { issuer?: string; } -export interface ResolveResult { - path: boolean | string; - query: string; -} - export interface ResolverRequest { context: ResolveContext; descriptionFileData?: DescriptionFileData; diff --git a/types/enhanced-resolve/test/index.ts b/types/enhanced-resolve/test/index.ts index dfd5087be4..aeec1d57d8 100644 --- a/types/enhanced-resolve/test/index.ts +++ b/types/enhanced-resolve/test/index.ts @@ -1,5 +1,5 @@ import resolve = require('enhanced-resolve'); -import { ResolveResult, AbstractInputFileSystem } from 'enhanced-resolve/lib/common-types' +import { AbstractInputFileSystem } from 'enhanced-resolve/lib/common-types' import Resolver = require('enhanced-resolve/lib/Resolver') resolve('lib', 'string', function (err) { }); @@ -20,19 +20,30 @@ const nfs = new resolve.NodeJsInputFileSystem(); const cfs = new resolve.CachedInputFileSystem(nfs, 4); -let result: ResolveResult +let result: string result = resolve.sync(context, 'path', 'string'); result = resolve.sync('path', 'string'); + +// Context + 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 () { }); +// Loader -result = resolve.create.sync(context, 'path', 'string'); -result = resolve.create.sync('path', 'string'); +resolve.loader('lib', 'string', function (err) { }); +resolve.loader(context, 'path', 'string', function () { }); + +result = resolve.loader.sync(context, 'path', 'string'); +result = resolve.loader.sync('path', 'string'); + +// Create + +resolve.create({extensions: [".js", ".json", ".node"]})(context, 'path', 'string', function () { }); + +result = resolve.create.sync({mainFields: ["loader", "main"]})(context, 'path', 'string'); diff --git a/types/enzyme/enzyme-tests.tsx b/types/enzyme/enzyme-tests.tsx index 7118fd4403..083cee54b2 100644 --- a/types/enzyme/enzyme-tests.tsx +++ b/types/enzyme/enzyme-tests.tsx @@ -1,6 +1,6 @@ import * as React from "react"; -import {shallow, mount, render, ShallowWrapper, ReactWrapper} from "enzyme"; -import {Component, ReactElement, HTMLAttributes, ComponentClass, StatelessComponent} from "react"; +import { shallow, mount, render, ShallowWrapper, ReactWrapper } from "enzyme"; +import { Component, ReactElement, HTMLAttributes, ComponentClass, StatelessComponent } from "react"; // Help classes/interfaces interface MyComponentProps { @@ -27,9 +27,11 @@ const MyStatelessComponent = (props: StatelessProps) => ; // ShallowWrapper function ShallowWrapperTest() { let shallowWrapper: ShallowWrapper = - shallow(); + shallow(); let reactElement: ReactElement; + let reactElements: Array>; + let domElement: Element; let boolVal: boolean; let stringVal: string; let numOrStringVal: number | string; @@ -44,7 +46,7 @@ function ShallowWrapperTest() { } function test_shallow_options() { - shallow(, { + shallow(, { context: { test: "a", }, @@ -68,7 +70,7 @@ function ShallowWrapperTest() { shallowWrapper = shallowWrapper.filter(MyComponent); statelessWrapper = statelessWrapper.filter(MyStatelessComponent); shallowWrapper = shallowWrapper.filter({ numberProp: 12 }); - elementWrapper = shallowWrapper.filter('.selector'); + shallowWrapper = shallowWrapper.filter('.selector'); } function test_filterWhere() { @@ -80,19 +82,19 @@ function ShallowWrapperTest() { } function test_contains() { - boolVal = shallowWrapper.contains(
    ); + boolVal = shallowWrapper.contains(
    ); } function test_containsMatchingElement() { - boolVal = shallowWrapper.contains(
    ); + boolVal = shallowWrapper.contains(
    ); } function test_containsAllMatchingElements() { - boolVal = shallowWrapper.containsAllMatchingElements([
    ]); + boolVal = shallowWrapper.containsAllMatchingElements([
    ]); } function test_containsAnyMatchingElement() { - boolVal = shallowWrapper.containsAnyMatchingElements([
    ]); + boolVal = shallowWrapper.containsAnyMatchingElements([
    ]); } function test_dive() { @@ -104,15 +106,15 @@ function ShallowWrapperTest() { bar: any; } - const diveWrapper: ShallowWrapper = shallowWrapper.dive({ context: { foobar: 'barfoo' }}); + const diveWrapper: ShallowWrapper = shallowWrapper.dive({ context: { foobar: 'barfoo' } }); } function test_equals() { - boolVal = shallowWrapper.equals(
    ); + boolVal = shallowWrapper.equals(
    ); } function test_matchesElement() { - boolVal = shallowWrapper.matchesElement(
    ); + boolVal = shallowWrapper.matchesElement(
    ); } function test_hasClass() { @@ -196,6 +198,18 @@ function ShallowWrapperTest() { reactElement = shallowWrapper.get(1); } + function test_getNode() { + reactElement = shallowWrapper.getNode(); + } + + function test_getNodes() { + reactElements = shallowWrapper.getNodes(); + } + + function test_getDOMNode() { + domElement = shallowWrapper.getDOMNode(); + } + function test_at() { shallowWrapper = shallowWrapper.at(1); } @@ -208,6 +222,15 @@ function ShallowWrapperTest() { shallowWrapper = shallowWrapper.last(); } + function test_slice() { + shallowWrapper = shallowWrapper.slice(1); + shallowWrapper = shallowWrapper.slice(1, 3); + } + + function test_tap() { + shallowWrapper.tap((intercepter) => { }); + } + function test_state() { const state: MyComponentState = shallowWrapper.state(); const prop: string = shallowWrapper.state('stateProperty'); @@ -333,9 +356,11 @@ function ShallowWrapperTest() { // ReactWrapper function ReactWrapperTest() { let reactWrapper: ReactWrapper = - mount(); + mount(); let reactElement: ReactElement; + let reactElements: Array>; + let domElement: Element; let boolVal: boolean; let stringVal: string; let elementWrapper: ReactWrapper, {}>; @@ -355,7 +380,7 @@ function ReactWrapperTest() { function test_mount() { reactWrapper = reactWrapper.mount(); - mount(, { + mount(, { attachTo: document.getElementById('test'), context: { a: "b" @@ -397,7 +422,7 @@ function ReactWrapperTest() { reactWrapper = reactWrapper.filter(MyComponent); statelessWrapper = statelessWrapper.filter(MyStatelessComponent); reactWrapper = reactWrapper.filter({ numberProp: 12 }); - elementWrapper = reactWrapper.filter('.selector'); + reactWrapper = reactWrapper.filter('.selector'); } function test_filterWhere() { @@ -409,27 +434,27 @@ function ReactWrapperTest() { } function test_contains() { - boolVal = reactWrapper.contains(
    ); + boolVal = reactWrapper.contains(
    ); } function test_containsMatchingElement() { - boolVal = reactWrapper.contains(
    ); + boolVal = reactWrapper.contains(
    ); } function test_containsAllMatchingElements() { - boolVal = reactWrapper.containsAllMatchingElements([
    ]); + boolVal = reactWrapper.containsAllMatchingElements([
    ]); } function test_containsAnyMatchingElement() { - boolVal = reactWrapper.containsAnyMatchingElements([
    ]); + boolVal = reactWrapper.containsAnyMatchingElements([
    ]); } function test_equals() { - boolVal = reactWrapper.equals(
    ); + boolVal = reactWrapper.equals(
    ); } function test_matchesElement() { - boolVal = reactWrapper.matchesElement(
    ); + boolVal = reactWrapper.matchesElement(
    ); } function test_hasClass() { @@ -501,6 +526,18 @@ function ReactWrapperTest() { reactElement = reactWrapper.get(1); } + function test_getNode() { + reactElement = reactWrapper.getNode(); + } + + function test_getNodes() { + reactElements = reactWrapper.getNodes(); + } + + function test_getDOMNode() { + domElement = reactWrapper.getDOMNode(); + } + function test_at() { reactWrapper = reactWrapper.at(1); } @@ -513,6 +550,15 @@ function ReactWrapperTest() { reactWrapper = reactWrapper.last(); } + function test_slice() { + reactWrapper = reactWrapper.slice(1); + reactWrapper = reactWrapper.slice(1, 3); + } + + function test_tap() { + reactWrapper.tap((intercepter) => { }); + } + function test_state() { const state: MyComponentState = reactWrapper.state(); const prop: string = reactWrapper.state('stateProperty'); diff --git a/types/enzyme/index.d.ts b/types/enzyme/index.d.ts index abd40975be..721895e522 100644 --- a/types/enzyme/index.d.ts +++ b/types/enzyme/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Enzyme 2.7 +// Type definitions for Enzyme 2.8 // Project: https://github.com/airbnb/enzyme // Definitions by: Marian Palkus // Cap3 @@ -6,6 +6,7 @@ // Tom Crockett // jwbay // huhuanming +// MartynasZilinskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -22,7 +23,7 @@ export class ElementClass extends Component { * all specified in the implementation. TS chooses the EnzymePropSelector overload and loses the generics */ export interface ComponentClass { - new(props?: Props, context?: any): Component; + new (props?: Props, context?: any): Component; } export type StatelessComponent = (props: Props, context?: any) => JSX.Element; @@ -42,6 +43,8 @@ export interface EnzymePropSelector { } export type EnzymeSelector = string | StatelessComponent | ComponentClass | EnzymePropSelector; +export type Intercepter = (intercepter: T) => void; + export interface CommonWrapper { /** * Returns a new wrapper with only the nodes of the current wrapper that, when passed into the provided predicate function, return true. @@ -97,6 +100,7 @@ export interface CommonWrapper { /** * Returns whether or not the current node is empty. + * @deprecated Use .exists() instead. */ isEmpty(): boolean; @@ -134,6 +138,21 @@ export interface CommonWrapper { */ get(index: number): ReactElement; + /** + * Returns the wrapper's underlying node. + */ + getNode(): ReactElement; + + /** + * Returns the wrapper's underlying nodes. + */ + getNodes(): Array>; + + /** + * Returns the outer most DOMComponent of the current wrapper. + */ + getDOMNode(): Element; + /** * Returns a wrapper around the node at a given index of the current wrapper. * @param index @@ -150,6 +169,16 @@ export interface CommonWrapper { */ last(): this; + /** + * Returns a new wrapper with a subset of the nodes of the original wrapper, according to the rules of `Array#slice`. + */ + slice(begin?: number, end?: number): this; + + /** + * Taps into the wrapper method chain. Helpful for debugging. + */ + tap(intercepter: Intercepter): this; + /** * 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] @@ -335,7 +364,7 @@ export interface CommonWrapper { * * Note: can only be called on a wrapper of a single node. */ - type(): string | ComponentClass

    | StatelessComponent

    ; + type(): string | ComponentClass

    | StatelessComponent

    ; length: number; } diff --git a/types/es6-shim/es6-shim-tests.ts b/types/es6-shim/es6-shim-tests.ts index ed89d2ac35..8f187e4d2b 100644 --- a/types/es6-shim/es6-shim-tests.ts +++ b/types/es6-shim/es6-shim-tests.ts @@ -1,31 +1,37 @@ - +declare const require: (module: string) => Object; +if (require !== null) { + require('es6-shim'); +} interface Point { x: number; y: number; } interface Point3D extends Point { z: number; } let a: any; -let s: string; -let i: number; +let s: string = ''; +let i: number = 2; +let iOrUndef: number | undefined; let b: boolean; -let f: () => void; +let f: () => void = () => {}; let o: Object; -let r: RegExp; -let sym: symbol; -let e: Error; +let r: RegExp = /a/; +let sym: symbol = {} as symbol; +let e: Error = new Error(); let date: Date; let key: PropertyKey; -let point: Point; -let point3d: Point3D; -let arrayOfPoint: Point[]; +let point: Point = { x: 1, y: 2 }; +let point3d: Point3D = { x: 1, y: 2, z: 3 }; +let point3dOrUndef: Point3D | undefined; +let pointOrUndef: Point | undefined; +let arrayOfPoint: Point[] = []; let arrayOfPoint3D: Point3D[]; let arrayOfSymbol: symbol[]; let arrayOfPropertyKey: PropertyKey[]; let arrayOfAny: any[]; let arrayOfStringAny: [string, any][]; -let arrayLikeOfAny: ArrayLike; -let iterableOfPoint: IterableShim; -let iterableOfStringPoint: IterableShim<[string, Point]>; -let iterableOfPointPoint3D: IterableShim<[Point, Point3D]>; +let arrayLikeOfAny: ArrayLike = []; +let iterableOfPoint: IterableShim = []; +let iterableOfStringPoint: IterableShim<[string, Point]> = []; +let iterableOfPointPoint3D: IterableShim<[Point, Point3D]> = []; let iterableIteratorOfPoint: IterableIteratorShim; let iterableIteratorOfNumberPoint: IterableIteratorShim<[number, Point]>; let iterableIteratorOfNumber: IterableIteratorShim; @@ -37,23 +43,23 @@ let iterableIteratorOfAny: IterableIteratorShim; let iterableIteratorOfPropertyKey: IterableIteratorShim; let iterableIteratorOfPropertyKeyPoint: IterableIteratorShim<[PropertyKey, Point]>; let nodeList: NodeList; -let pd: PropertyDescriptor; -let pdm: PropertyDescriptorMap; -let map: Map; -let set: Set; -let weakMap: WeakMap; -let weakSet: WeakSet; -let promiseLikeOfPoint: PromiseLike; -let promiseLikeOfPoint3D: PromiseLike; -let promiseOfPoint: Promise; -let promiseOfPoint3D: Promise; +let pd: PropertyDescriptor = {}; +let pdm: PropertyDescriptorMap = {}; +let map: Map = new Map(); +let set: Set = new Set(); +let weakMap: WeakMap = new WeakMap(); +let weakSet: WeakSet = new WeakSet(); +let promiseLikeOfPoint: PromiseLike = Promise.resolve(point); +let promiseLikeOfPoint3D: PromiseLike = Promise.resolve(point3d); +let promiseOfPoint: Promise = Promise.resolve(point); +let promiseOfPoint3D: Promise = Promise.resolve(point); let promiseOfArrayOfPoint: Promise; let promiseOfVoid: Promise; point = Object.assign(point, point); b = Object.is(point, point); -Object.setPrototypeOf(point, point); -point = arrayOfPoint.find(p => b); +Object.setPrototypeOf(point, {}); +pointOrUndef = arrayOfPoint.find(p => b); i = arrayOfPoint.findIndex(p => b); arrayOfPoint = arrayOfPoint.fill(point, i, arrayOfPoint.length); arrayOfPoint = arrayOfPoint.copyWithin(i, i, i); @@ -69,7 +75,7 @@ b = s.includes(s, i); b = s.endsWith(s, i); s = s.repeat(i); b = s.startsWith(s, i); -s = String.fromCodePoint(i, i); +s = String.fromCodePoint(2 as number, 3 as number); s = String.raw`abc`; s = r.flags; i = Number.EPSILON; @@ -102,7 +108,7 @@ i = Math.cbrt(i); map.clear(); map.delete(s); map.forEach((value: Point, key: string) => { }); -point = map.get(s); +pointOrUndef = map.get(s); b = map.has(s); map = map.set(s, point); i = map.size; @@ -117,7 +123,7 @@ i = set.size; set = new Set(); set = new Set(iterableOfPoint); weakMap.delete(point); -point3d = weakMap.get(point); +point3dOrUndef = weakMap.get(point); b = weakMap.has(point); weakMap = weakMap.set(point, point3d); weakMap = new WeakMap(); @@ -184,6 +190,8 @@ promiseOfPoint = new Promise((resolve, reject) => resolve(point)); promiseOfPoint = new Promise((resolve, reject) => resolve(promiseOfPoint)); promiseOfPoint = new Promise((resolve, reject) => resolve(promiseLikeOfPoint)); promiseOfPoint = new Promise((resolve, reject) => reject(e)); +// To prevent UnhandledPromiseRejectionWarning +promiseOfPoint.catch(() => {}); promiseOfArrayOfPoint = Promise.all(arrayOfPoint); promiseOfArrayOfPoint = Promise.all(iterableOfPoint); promiseOfPoint = Promise.race(arrayOfPoint); @@ -193,7 +201,11 @@ promiseOfPoint = Promise.resolve(point3d); promiseOfPoint = Promise.resolve(promiseOfPoint); promiseOfPoint = Promise.resolve(promiseLikeOfPoint); promiseOfVoid = Promise.reject(e); +// To prevent UnhandledPromiseRejectionWarning +promiseOfVoid.catch(() => {}); promiseOfPoint = Promise.reject(e); +// To prevent UnhandledPromiseRejectionWarning +promiseOfPoint.catch(() => {}); a = Reflect.apply(f, a, arrayLikeOfAny); a = Reflect.construct(f, arrayLikeOfAny); b = Reflect.defineProperty(a, s, pd); @@ -203,9 +215,9 @@ b = Reflect.deleteProperty(a, s); b = Reflect.deleteProperty(a, i); b = Reflect.deleteProperty(a, sym); iterableIteratorOfAny = Reflect.enumerate(a); -a = Reflect.get(a, s, a); -a = Reflect.get(a, i, a); -a = Reflect.get(a, sym, a); +Reflect.get(a, s, a); +Reflect.get(a, i, a); +Reflect.get(a, sym, a); pd = Reflect.getOwnPropertyDescriptor(a, s); pd = Reflect.getOwnPropertyDescriptor(a, i); pd = Reflect.getOwnPropertyDescriptor(a, sym); @@ -219,4 +231,4 @@ b = Reflect.preventExtensions(a); b = Reflect.set(a, s, a, a); b = Reflect.set(a, i, a, a); b = Reflect.set(a, sym, a, a); -b = Reflect.setPrototypeOf(a, a); \ No newline at end of file +b = Reflect.setPrototypeOf(a, a); diff --git a/types/es6-shim/index.d.ts b/types/es6-shim/index.d.ts index 483f4357e0..4c03fc8b9e 100644 --- a/types/es6-shim/index.d.ts +++ b/types/es6-shim/index.d.ts @@ -185,11 +185,10 @@ interface Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T | undefined; /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. + * Returns the index of the first element in the array where predicate is true, and -1 otherwise. * @param predicate find calls predicate once for each element of the array, in ascending * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. @@ -556,9 +555,9 @@ interface Map { clear(): void; delete(key: K): boolean; forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V; + get(key: K): V | undefined; has(key: K): boolean; - set(key: K, value?: V): Map; + set(key: K, value: V): Map; size: number; entries(): IterableIteratorShim<[K, V]>; keys(): IterableIteratorShim; @@ -596,9 +595,9 @@ declare var Set: SetConstructor; interface WeakMap { delete(key: K): boolean; - get(key: K): V; + get(key: K): V | undefined; has(key: K): boolean; - set(key: K, value?: V): WeakMap; + set(key: K, value: V): WeakMap; } interface WeakMapConstructor { diff --git a/types/es6-shim/tsconfig.json b/types/es6-shim/tsconfig.json index 1243a36ddb..02c35aee5a 100644 --- a/types/es6-shim/tsconfig.json +++ b/types/es6-shim/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,4 +20,4 @@ "index.d.ts", "es6-shim-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/exceljs/exceljs-tests.ts b/types/exceljs/exceljs-tests.ts new file mode 100644 index 0000000000..95147c7726 --- /dev/null +++ b/types/exceljs/exceljs-tests.ts @@ -0,0 +1,82 @@ +import * as Excel from 'exceljs'; + +// most examples taken and adapted from README.md + +const workbook = new Excel.Workbook(); + +workbook.creator = 'Me'; +workbook.lastModifiedBy = 'Her'; +workbook.created = new Date(1985, 8, 30); +workbook.modified = new Date(); +workbook.lastPrinted = new Date(2016, 9, 27); +workbook.properties.date1904 = true; + +workbook.views = [ + { + x: 0, y: 0, width: 10000, height: 20000, + firstSheet: 0, activeTab: 1, visibility: 'visible' + } +]; + +const worksheet: Excel.Worksheet = workbook.addWorksheet('My Sheet'); +const worksheet2 = workbook.getWorksheet('My Sheet'); +const worksheet3 = workbook.getWorksheet(1); +const sheet = workbook.addWorksheet('My Sheet', {views: [{showGridLines: false}]}); + +const row: Excel.Row = worksheet.addRow([3, 'Sam', new Date()]); +row.getCell(1).value = 5; + +worksheet.eachRow((row: Excel.Row, rowNumber: number): void => { + // nothing +}); + +row.eachCell((cell: Excel.Cell, colNumber: number): void => { + // nothing +}); + +worksheet.mergeCells('A4:B5'); + +worksheet.getCell('A1').numFmt = '0.00%'; +worksheet.getCell('A1').font = { + name: 'Comic Sans MS', + family: 4, + size: 16, + underline: true, + bold: true +}; + +worksheet.getCell('A1').alignment = { vertical: 'top', horizontal: 'left' }; +worksheet.getCell('B1').alignment = { vertical: 'middle', horizontal: 'center' }; +worksheet.getCell('C1').alignment = { vertical: 'bottom', horizontal: 'right' }; +worksheet.getCell('D1').alignment = { wrapText: true }; +worksheet.getCell('E1').alignment = { indent: 1 }; + +worksheet.getCell('A1').border = { + top: {style: 'thin'}, + left: {style: 'thin'}, + bottom: {style: 'thin'}, + right: {style: 'thin'} +}; + +worksheet.getCell('A3').border = { + top: {style: 'double', color: {argb: 'FF00FF00'}}, + left: {style: 'double', color: {argb: 'FF00FF00'}}, + bottom: {style: 'double', color: {argb: 'FF00FF00'}}, + right: {style: 'double', color: {argb: 'FF00FF00'}} +}; + +worksheet.getCell('A1').fill = { + type: 'pattern', + pattern: 'solid', + fgColor: {argb: 'FFFF0000'} +}; + +workbook.xlsx.readFile("/home/john/bla.xlsx") + .then((): void => { + // use workbook + }); + +workbook.xlsx.writeFile("/home/john/bla.xlsx") + .then((): void => { + // done + }); diff --git a/types/exceljs/index.d.ts b/types/exceljs/index.d.ts new file mode 100644 index 0000000000..259eaccae1 --- /dev/null +++ b/types/exceljs/index.d.ts @@ -0,0 +1,231 @@ +// Type definitions for exceljs 0.4 +// Project: https://github.com/guyonroche/exceljs +// Definitions by: Rogier Schouten +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export const enum ValueType { + Null = 0, + Merge = 1, + Number = 2, + String = 3, + Date = 4, + Hyperlink = 5, + Formula = 6, + SharedString = 7, + RichText = 8, + Boolean = 9, + Error = 10 +} + +export const enum FormulaType { + None = 0, + Master = 1, + Shared = 2 +} + +export const enum RelationshipType { + None = 0, + OfficeDocument = 1, + Worksheet = 2, + CalcChain = 3, + SharedStrings = 4, + Styles = 5, + Theme = 6, + Hyperlink = 7 +} + +export const enum DocumentType { + Xlsx = 1 +} + +export const enum ReadingOrder { + RightToLeft = 1, + LeftToRight = 2, +} + +export interface ErrorValue { + error: "#N/A" | "#REF!" | "#NAME?" | "#DIV/0!" | "#NULL!" | "#VALUE!" | "#NUM!"; +} + +export interface WorksheetView { + state?: "normal" | "split" | "frozen"; + showRuler?: boolean; + showRowColHeaders?: boolean; + showGridLines?: boolean; + zoomScale?: number; + zoomScaleNormal?: number; + style?: "pageBreakPreview" | "pageLayout"; +} + +export interface WorkbookView { + x?: number; + y?: number; + width?: number; + height?: number; + firstSheet?: number; + activeTab?: number; + visibility?: string; +} + +export interface Fill { + type: "pattern" | "gradient"; + pattern?: "none" | "solid"; + fgColor?: Color; + bgColor?: Color; +} + +export interface Font { + name: string; + size?: number; + family?: number; + schema?: "minor" | "major" | "none"; + charset?: number; + color?: Color; + bold?: boolean; + italic?: boolean; + underline?: true | false | "none" | "single" | "double" | "singleAccounting" | "doubleAccounting"; + strike?: boolean; + outline?: boolean; +} + +export type BorderStyle = + "thin" | "dotted" | "dashDot" | "hair" | "dashDotDot" | "slantDashDot" | "mediumDashed" | "mediumDashDotDot" | + "mediumDashDot" | "medium" | "double" | "thick"; + +export interface Color { + /** + * Hex string for alpha-red-green-blue e.g. FF00FF00 + */ + argb: string; +} + +export interface Border { + style?: BorderStyle; + color?: Color; +} + +export interface Borders { + top?: Border; + left?: Border; + bottom?: Border; + right?: Border; +} + +export interface Alignment { + horizontal?: "left" | "center" | "right" | "fill" | "justify" | "centerContinuous" | "distributed"; + vertical?: "top" | "middle" | "bottom" | "distributed" | "justify"; + wrapText?: boolean; + indent?: number; + readingOrder?: "rtl" | "ltr"; + textrotation?: number | "vertical"; +} + +export interface Cell { + border?: Borders; + font?: Font; + alignment?: Alignment; + numFmt?: string; + value?: any; + fill?: Fill; +} + +export interface Row { + /** + * The row number + */ + number: number; + height: number; + hidden: boolean; + collapsed: boolean; + values: any[]; + outlineLevel?: number; + + readonly cellCount: number; + readonly actualCellCount: number; + + getCell(index: number): Cell; + + eachCell(callback: (cell: Cell, colNumber: number) => void): void; + eachCell(opts: { includeEmpty: boolean}, callback: (cell: Cell, colNumber: number) => void): void; +} + +export interface Column { + width: number; +} + +export interface Worksheet { + /** + * The total row size of the document. Equal to the row number of the last row that has values. + */ + rowCount: number; + /** + * A count of the number of rows that have values. If a mid-document row is empty, it will not be included in the count. + */ + actualRowCount: number; + /** + * The total column size of the document. Equal to the maximum cell count from all of the rows + */ + columnCount: number; + /** + * A count of the number of columns that have values. + */ + actualColumnCount: number; + + /** + * Get or create a column + */ + getColumn(index: number): Column; + + /** + * Create a new row + */ + addRow(data: any[]): Row; + + /** + * Get or create row by 0-based index + */ + getRow(index: number): Row; + eachRow(callback: (row: Row, rowNumber: number) => void): void; + + /** + * Get or create cell + */ + getCell(ref: string): Cell; + + /** + * Merge cells, either: + * tlbr string + * tl string, br string + * t, l, b, r numbers + */ + mergeCells(a: number | string, b?: number | string, c?: number, d?: number): void; +} + +export interface Xlsx { + readFile(path: string): Promise; + writeFile(path: string): Promise; +} + +export interface WorksheetProps { + showGridLines: boolean; +} + +export class Workbook { + constructor(); + + creator: string; + lastModifiedBy: string; + created: Date; + modified: Date; + lastPrinted: Date; + properties: { + date1904: boolean; + }; + views: WorkbookView[]; + + addWorksheet(name: string, opts?: { properties?: WorksheetProps, views?: WorksheetView[] }): Worksheet; + + getWorksheet(indexOrName: number | string): Worksheet; + + xlsx: Xlsx; +} diff --git a/types/exceljs/tsconfig.json b/types/exceljs/tsconfig.json new file mode 100644 index 0000000000..f9cb219d06 --- /dev/null +++ b/types/exceljs/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "exceljs-tests.ts" + ] +} diff --git a/types/exceljs/tslint.json b/types/exceljs/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/exceljs/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/execa/execa-tests.ts b/types/execa/execa-tests.ts new file mode 100644 index 0000000000..7d5e21e4b4 --- /dev/null +++ b/types/execa/execa-tests.ts @@ -0,0 +1,124 @@ +import * as assert from 'assert'; +import * as execa from 'execa'; +import { PassThrough } from "stream"; + +execa('unicorns') + .then(result => { + assert(result.cmd === 'unicorns'); + assert(result.code === 0); + assert(result.failed === false); + assert(result.killed === false); + assert(result.signal === null); + assert(result.stderr === 'bad unicorns'); + assert(result.stdout === 'good unicorns'); + assert(result.timedOut === false); + }); + +execa('foo') + .catch(error => { + assert(error.cmd === 'foo'); + assert(error.code === 128); + assert(error.failed === true); + assert(error.killed === false); + assert(error.signal === 'SIGINT'); + assert(error.stderr === 'stderr'); + assert(error.stdout === 'stdout'); + assert(error.timedOut === false); + }); + +execa('noop', ['foo']) + .then(result => result.stderr.toLocaleLowerCase()); + +execa.stdout('unicorns') + .then(stdout => stdout.toLocaleLowerCase()); +execa.stdout('echo', ['unicorns']) + .then(stdout => stdout.toLocaleLowerCase()); + +execa.stderr('unicorns') + .then(stderr => stderr.toLocaleLowerCase()); +execa.stderr('echo', ['unicorns']) + .then(stderr => stderr.toLocaleLowerCase()); + +execa.shell('echo unicorns') + .then(result => result.stdout.toLocaleLowerCase()); + +{ + let result: string; + result = execa.shellSync('foo').stderr; + result = execa.shellSync('noop', ['foo']).stdout; + + result = execa.shellSync('foo').stderr; + result = execa.shellSync('noop foo').stdout; +} + +execa('echo', ['unicorns']).stdout.pipe(process.stdout); +execa('echo', ['unicorns']).stderr.pipe(process.stderr); + +async () => { + const { stdout } = await execa('noop', ['foo'], { stripEof: false }); + assert(stdout === 'foo\n'); +}; + +async () => { + const { stdout } = await execa('foo', { preferLocal: false }); + assert(stdout === 'global foo'); +}; + +async () => { + const { stdout } = await execa('stdin', { input: 'foobar' }); + assert(stdout === 'foobar'); +}; + +async () => { + const { stdout } = await execa('stdin', { input: new Buffer('foobar') }); + assert(stdout === 'foobar'); +}; + +async () => { + const s = new PassThrough(); + s.write('howdy'); + s.end(); + const { stdout } = await execa('stdin', { input: s }); + assert(stdout === 'foobar'); +}; + +async () => { + const child = execa('stdin'); + child.stdin.end('unicorns'); + const { stdout } = await child; + assert(stdout === 'unicorns'); +}; + +async () => { + const { stdout } = await execa('stdin', { + input: 'hello', + stdio: [null, 'ignore', null] + }); + assert(stdout === null); +}; + +{ + const child = execa('stdin', { + input: 'hello', + stdio: [null, 'ignore', null] + }); + + child.stdout.setEncoding('utf8'); + + assert(child.pid === 0); + child.kill(); +} + +async () => { + const { timedOut, code } = await execa('delay', ['3000', '22'], { timeout: 9000 }); + assert(timedOut === true); + assert(code === 22); +}; + +async () => { + const { stdout } = await execa.shell('noop foo', { + shell: process.platform === 'win32' ? 'cmd.exe' : '/bin/bash' + }); + + assert(stdout === 'foo'); +}; diff --git a/types/execa/index.d.ts b/types/execa/index.d.ts new file mode 100644 index 0000000000..df868e4d15 --- /dev/null +++ b/types/execa/index.d.ts @@ -0,0 +1,51 @@ +// Type definitions for execa 0.6 +// Project: https://github.com/sindresorhus/execa#readme +// Definitions by: Douglas Duteil +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +import { ExecOptions, SpawnOptions, SpawnSyncOptions, SpawnSyncReturns, ChildProcess } from "child_process"; +import { Stream } from 'stream'; + +interface ExecaOptions { + input: string | Buffer | Stream; + preferLocal: boolean; + stripEof: boolean; +} + +type Options = SpawnOptions & ExecaOptions & ExecOptions; + +interface ExecaReturns { + cmd: string; + code: number; + failed: boolean; + killed: boolean; + signal: string | null; + stderr: string; + stdout: string; + timedOut: boolean; +} + +type ExecaError = Error & ExecaReturns; + +interface ExecaChildPromise { + catch(onrejected?: ((reason: ExecaError) => TResult | PromiseLike) | undefined | null): Promise; +} +type ExecaChildProcess = ChildProcess & ExecaChildPromise & Promise; + +declare function execa(file: string, options?: Partial): ExecaChildProcess; +declare function execa(file: string, args?: string[], options?: Partial): ExecaChildProcess; +declare namespace execa { + function stdout(file: string, options?: Partial): Promise; + function stdout(file: string, args?: string[], options?: Partial): Promise; + function stderr(file: string, options?: Partial): Promise; + function stderr(file: string, args?: string[], options?: Partial): Promise; + function shell(command: string, options?: SpawnOptions): ExecaChildProcess; + function sync(file: string, options?: SpawnSyncOptions): ExecaReturns; + function sync(file: string, args?: string[], options?: SpawnSyncOptions): ExecaReturns; + function shellSync(command: string, options?: SpawnOptions): ExecaReturns; +} + +export = execa; diff --git a/types/execa/tsconfig.json b/types/execa/tsconfig.json new file mode 100644 index 0000000000..276a55194a --- /dev/null +++ b/types/execa/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "execa-tests.ts" + ] +} diff --git a/types/execa/tslint.json b/types/execa/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/execa/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/express-brute-mongo/index.d.ts b/types/express-brute-mongo/index.d.ts index cf248f8883..9714fedd5d 100644 --- a/types/express-brute-mongo/index.d.ts +++ b/types/express-brute-mongo/index.d.ts @@ -2,9 +2,9 @@ // Project: https://github.com/auth0/express-brute-mongo // Definitions by: Cyril Schumacher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 - - +import { Collection } from "mongodb"; /** * @summary MongoDB store adapter. @@ -17,5 +17,5 @@ export = class MongoStore { * @param {Function} getCollection The collection. * @param {Object} options The otpions. */ - constructor(getCollection: (collection: any) => void, options?: Object); + constructor(getCollection: (collection: (c: Collection) => void) => void, options?: Object); } diff --git a/types/express-jwt/index.d.ts b/types/express-jwt/index.d.ts index 4b6883a258..d75dfa9adf 100644 --- a/types/express-jwt/index.d.ts +++ b/types/express-jwt/index.d.ts @@ -34,7 +34,7 @@ declare namespace jwt { [property: string]: any; } export interface RequestHandler extends express.RequestHandler { - unless?: typeof unless; + unless: typeof unless; } } declare global { diff --git a/types/express-rate-limit/index.d.ts b/types/express-rate-limit/index.d.ts index 54bdacb936..86b8d497b0 100644 --- a/types/express-rate-limit/index.d.ts +++ b/types/express-rate-limit/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for express-rate-limit 2.6 +// Type definitions for express-rate-limit 2.8 // Project: https://github.com/nfriedly/express-rate-limit // Definitions by: Cyril Schumacher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -17,14 +17,15 @@ declare namespace RateLimit { interface Options { delayAfter?: number; delayMs?: number; - handlers?(): any; + handlers?(req?: express.Request, res?: express.Response, next?: express.NextFunction): any; headers?: boolean; - keyGenerator?(): string; + keyGenerator?(req?: express.Request, res?: express.Response): string; max?: number; message?: string; - skip?(): boolean; + skip?(req?: express.Request, res?: express.Response): boolean; statusCode?: number; store?: Store; + onLimitReached?(req?: express.Request, res?: express.Response, optionsUsed?: Options): void; windowMs?: number; } } diff --git a/types/express-serve-static-core/index.d.ts b/types/express-serve-static-core/index.d.ts index a54481027d..dd012cab4e 100644 --- a/types/express-serve-static-core/index.d.ts +++ b/types/express-serve-static-core/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Express 4.x // Project: http://expressjs.com -// Definitions by: Boris Yankov +// Definitions by: Boris Yankov , Michał Lytek , Kacper Polak // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // This extracts the core definitions from express to prevent a circular dependency between express and serve-static /// @@ -168,6 +168,10 @@ interface CookieOptions { sameSite?: boolean | string; } +interface ByteRange { start: number; end: number; } + +interface RequestRanges extends Array { type: string; } + interface Errback { (err: Error): void; } interface Request extends http.IncomingMessage, Express.Request { @@ -298,7 +302,7 @@ interface Request extends http.IncomingMessage, Express.Request { * * @param size */ - range(size: number): any[]; + range(size: number): RequestRanges|null|-1|-2; /** * Return an array of Accepted media types @@ -471,7 +475,6 @@ interface MediaType { } interface Send { - (status: number, body?: any): Response; (body?: any): Response; } diff --git a/types/express-session/express-session-tests.ts b/types/express-session/express-session-tests.ts index 83748b8b1e..4ee9a76a6e 100644 --- a/types/express-session/express-session-tests.ts +++ b/types/express-session/express-session-tests.ts @@ -1,9 +1,7 @@ - - import express = require('express'); import session = require('express-session'); -var app = express(); +let app = express(); app.use(session({ secret: 'keyboard cat', @@ -14,7 +12,7 @@ app.use(session({ name: 'connect.sid', store: new session.MemoryStore(), cookie: { path: '/', httpOnly: true, secure: false, maxAge: null }, - genid: (req: express.Request): string => { return ''; }, + genid: (req: express.Request): string => '', rolling: false, resave: true, proxy: true, @@ -22,21 +20,20 @@ app.use(session({ unset: 'keep' })); - interface MySession extends Express.Session { views: number; } -app.use(function(req, res, next) { - var sess = req.session; + +app.use((req, res, next) => { + let sess = req.session as MySession; if (sess.views) { - sess.views++ - res.setHeader('Content-Type', 'text/html') - res.write('

    views: ' + sess.views + '

    ') - res.write('

    expires in: ' + (sess.cookie.maxAge / 1000) + 's

    ') - res.end() + sess.views++; + res.setHeader('Content-Type', 'text/html'); + res.write('

    views: ' + sess.views + '

    '); + res.write('

    expires in: ' + (sess.cookie.maxAge / 1000) + 's

    '); + res.end(); } else { - sess.views = 1 - res.end('welcome to the session demo. refresh!') + sess.views = 1; + res.end('welcome to the session demo. refresh!'); } }); - diff --git a/types/express-session/index.d.ts b/types/express-session/index.d.ts index 6d2585d3f9..60dedea20a 100644 --- a/types/express-session/index.d.ts +++ b/types/express-session/index.d.ts @@ -1,96 +1,99 @@ -// Type definitions for express-session +// Type definitions for express-session 1.15 // Project: https://www.npmjs.org/package/express-session // Definitions by: Hiroki Horiuchi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +// Definitions by: Jacob Bogers -/// -declare namespace Express { +import express = require('express'); +import node = require('events'); - export interface Request { - session?: Session; - sessionID?: string; - } +declare global { + namespace Express { + interface Request { + session?: Session; + sessionID?: string; + } - export interface Session { - [key: string]: any; - id: string; + interface SessionData { + [key: string]: any; + cookie: Express.SessionCookieData; + } - regenerate: (callback: (err: any) => void) => void; - destroy: (callback: (err: any) => void) => void; - reload: (callback: (err: any) => void) => void; - save: (callback: (err: any) => void) => void; - touch: (callback: (err: any) => void) => void; + interface SessionCookieData { + originalMaxAge: number; + path: string; + maxAge: number | null; + secure?: boolean; + httpOnly: boolean; + domain?: string; + expires: Date | boolean; + } - cookie: SessionCookie; - } - export interface SessionCookie { - originalMaxAge: number; - path: string; - maxAge: number; - secure?: boolean; - httpOnly: boolean; - domain?: string; - expires: Date | boolean; - serialize: (name: string, value: string) => string; + interface SessionCookie extends SessionCookieData { + serialize(name: string, value: string): string; + } + + interface Session extends SessionData { + id: string; + regenerate(callback: (err: any) => void): void; + destroy(callback: (err: any) => void): void; + reload(callback: (err: any) => void): void; + save(callback: (err: any) => void): void; + touch(callback: (err: any) => void): void; + cookie: SessionCookie; + } } } -declare module "express-session" { - import express = require('express'); - import node = require('events'); +declare function session(options?: session.SessionOptions): express.RequestHandler; - function session(options?: session.SessionOptions): express.RequestHandler; - - namespace session { - export interface SessionOptions { - secret: string; - name?: string; - store?: Store | MemoryStore; - cookie?: express.CookieOptions; - genid?: (req: express.Request) => string; - rolling?: boolean; - resave?: boolean; - proxy?: boolean; - saveUninitialized?: boolean; - unset?: string; - } - - export interface BaseMemoryStore { - get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; - set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; - destroy: (sid: string, callback: (err: any) => void) => void; - length?: (callback: (err: any, length: number) => void) => void; - clear?: (callback: (err: any) => void) => void; - } - - export abstract class Store extends node.EventEmitter { - constructor(config?: any); - - regenerate (req: express.Request, fn: (err: any) => any): void; - load (sid: string, fn: (err: any, session: Express.Session) => any): void; - createSession (req: express.Request, sess: Express.Session): void; - - get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; - set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; - destroy: (sid: string, callback: (err: any) => void) => void; - all: (callback: (err: any, obj: { [sid: string]: Express.Session; }) => void) => void; - length: (callback: (err: any, length: number) => void) => void; - clear: (callback: (err: any) => void) => void; - } - - export class MemoryStore implements BaseMemoryStore { - get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; - set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; - destroy: (sid: string, callback: (err: any) => void) => void; - all: (callback: (err: any, obj: { [sid: string]: Express.Session; }) => void) => void; - length: (callback: (err: any, length: number) => void) => void; - clear: (callback: (err: any) => void) => void; - } +declare namespace session { + interface SessionOptions { + secret: string; + name?: string; + store?: Store | MemoryStore; + cookie?: express.CookieOptions; + genid?(req: express.Request): string; + rolling?: boolean; + resave?: boolean; + proxy?: boolean; + saveUninitialized?: boolean; + unset?: string; } - export = session; + interface BaseMemoryStore { + get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; + set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; + destroy: (sid: string, callback: (err: any) => void) => void; + length?: (callback: (err: any, length: number) => void) => void; + clear?: (callback: (err: any) => void) => void; + } + + abstract class Store extends node.EventEmitter { + constructor(config?: any); + + regenerate: (req: express.Request, fn: (err: any) => any) => void; + load: (sid: string, fn: (err: any, session: Express.Session) => any) => void; + createSession: (req: express.Request, sess: Express.SessionData) => void; + + get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; + set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; + destroy: (sid: string, callback: (err: any) => void) => void; + all: (callback: (err: any, obj: { [sid: string]: Express.SessionData; }) => void) => void; + length: (callback: (err: any, length: number) => void) => void; + clear: (callback: (err: any) => void) => void; + } + + class MemoryStore implements BaseMemoryStore { + get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; + set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; + destroy: (sid: string, callback: (err: any) => void) => void; + all: (callback: (err: any, obj: { [sid: string]: Express.Session; }) => void) => void; + length: (callback: (err: any, length: number) => void) => void; + clear: (callback: (err: any) => void) => void; + } } +export = session; diff --git a/types/express-session/tslint.json b/types/express-session/tslint.json new file mode 100644 index 0000000000..907305050c --- /dev/null +++ b/types/express-session/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "prefer-method-signature": false + } +} \ No newline at end of file diff --git a/types/express-validator/express-validator-tests.ts b/types/express-validator/express-validator-tests.ts deleted file mode 100644 index 9c374d9948..0000000000 --- a/types/express-validator/express-validator-tests.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* Usage Example from https://github.com/ctavan/express-validator */ - -import util = require('util') -import express = require('express') -import expressValidator = require('express-validator') -var app = express(); - -app.use(expressValidator()); - -app.post('/:urlparam', function(req: express.Request, res: express.Response) { - - // checkBody only checks req.body; none of the other req parameters - // Similarly checkParams only checks in req.params (URL params) and - // checkQuery only checks req.query (GET params). - req.checkBody('postparam', 'Invalid postparam').notEmpty().isInt(); - req.checkParams('urlparam', 'Invalid urlparam').isAlpha().matches(/test?/i).matches('test?', 'i'); - req.checkQuery('getparam', 'Invalid getparam').isInt(); - req.checkHeaders('testHeader', 'Invalid testHeader').isLowercase().isUppercase(); - req.checkFiles('testFiles', 'Invalid testFiles').isURL(); - - // OR assert can be used to check on all 3 types of params. - // req.assert('postparam', 'Invalid postparam').notEmpty().isInt(); - // req.assert('urlparam', 'Invalid urlparam').isAlpha(); - // req.assert('getparam', 'Invalid getparam').isInt(); - - req.filter('postparam').toBoolean(); - req.sanitize('postparam').blacklist('t').blacklist(['']).whitelist('hello').whitelist(['h', 'e', 'l']); - req.sanitizeBody('postvar').trim().stripLow().escape(); - req.sanitizeQuery('queryvar').toDate(); - req.sanitizeParams('urlparam').toFloat().toInt().toInt(10); - req.sanitizeHeaders('header').normalizeEmail(); - - - var errors = req.validationErrors(); - var mappedErrors = req.validationErrors(true); - - if (errors) { - res.status(400).send('There have been validation errors: ' + util.inspect(errors)); - return; - } - res.json({ - urlparam: req.param('urlparam'), - getparam: req.param('getparam'), - postparam: req.param('postparam') - }); -}); - -app.listen(8888); diff --git a/types/express-validator/index.d.ts b/types/express-validator/index.d.ts deleted file mode 100644 index 0416b4db44..0000000000 --- a/types/express-validator/index.d.ts +++ /dev/null @@ -1,244 +0,0 @@ -// Type definitions for express-validator 2.20.4 -// Project: https://github.com/ctavan/express-validator -// Definitions by: Nathan Ridley , Jonathan Häberle , Peter Harris -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -// Add RequestValidation Interface on to Express's Request Interface. -declare namespace Express { - interface Request extends ExpressValidator.RequestValidation {} -} - -// External express-validator module. -declare module "express-validator" { - import express = require('express'); - - /** - * - * @middlewareOptions see: https://github.com/ctavan/express-validator#middleware-options - */ - function ExpressValidator(middlewareOptions?:any):express.RequestHandler; - - export = ExpressValidator; -} - -// Internal Module. -declare namespace ExpressValidator { - - export interface ValidationError { - msg: string; - param: string; - } - - interface ValidatorFunction { (item: string | {}, message?: string): Validator; } - interface ValidatorExtraFunction extends ValidatorFunction { (matchIndex: number, message?: string): Validator; } - interface SanitizerFunction { (item: string): Sanitizer; } - interface Dictionary { [key: string]: T; } - - export interface RequestValidation { - assert: ValidatorExtraFunction; - validate: ValidatorExtraFunction; - check: ValidatorExtraFunction; - checkBody: ValidatorFunction; - checkFiles: ValidatorFunction; - checkHeaders: ValidatorFunction; - checkParams: ValidatorFunction; - checkQuery: ValidatorFunction; - - filter: SanitizerFunction; - sanitize: SanitizerFunction; - sanitizeBody: SanitizerFunction; - sanitizeQuery: SanitizerFunction; - sanitizeParams: SanitizerFunction; - sanitizeHeaders: SanitizerFunction; - - onValidationError(errback: (msg: string) => void): void; - validationErrors(mapped?: boolean): Dictionary | MappedError[]; - validationErrors(mapped?: boolean): Dictionary | T[]; - asyncValidationErrors(mapped?: boolean): Promise>; - asyncValidationErrors(mapped?: boolean): Promise>; - } - - export interface Validator { - /** - * Alias for regex() - */ - is(): Validator; - /** - * Alias for notRegex() - */ - not(): Validator; - isEmail(options?:{}): Validator; - /** - * Accepts http, https, ftp - */ - isURL(): Validator; - isFQDN(options?: MinMaxOptions): Validator; - - /** - * Combines isIPv4 and isIPv6 - */ - isIP(): Validator; - isIPv4(): Validator; - isIPv6(): Validator; - isMACAddress(): Validator; - isISBN(version?: number): Validator; - isISIN(): Validator; - isISO8601(): Validator; - isMobilePhone(locale: string): Validator; - isMongoId(): Validator; - isMultibyte(): Validator; - isAlpha(locale?: string): Validator; - isAlphanumeric(locale?: string): Validator; - isAscii(): Validator; - isBase64(): Validator; - isBoolean(): Validator; - isByteLength(options: MinMaxOptions): Validator; - isCurrency(options: {}): Validator; - isDataURI(): Validator; - isDivisibleBy(num: number): Validator; - isNumeric(): Validator; - isHexadecimal(): Validator; - /** - * Accepts valid hexcolors with or without # prefix - */ - isHexColor(): Validator; - /** - * isNumeric accepts zero padded numbers, e.g. '001', isInt doesn't - */ - isInt(options?: MinMaxOptions): Validator; - isLowercase(): Validator; - isUppercase(): Validator; - isDecimal(): Validator; - /** - * Alias for isDecimal - */ - isFloat(): Validator; - isFullWidth(): Validator; - isHalfWidth(): Validator; - isVariableWidth(): Validator; - /** - * Check if length is 0 - */ - isNull(): Validator; - /** - * Not just whitespace (input.trim().length !== 0) - */ - notEmpty(): Validator; - equals(equals:any): Validator; - contains(str:string): Validator; - - /** - * Usage: matches(/[a-z]/i) or matches('[a-z]','i') - */ - matches(pattern:string, modifiers?:string): Validator; - matches(pattern: RegExp): Validator; - - /** - * max is optional - */ - len(min:number, max?:number): Validator; - /** - * Version can be 3, 4 or 5 or empty, see http://en.wikipedia.org/wiki/Universally_unique_identifier - */ - isUUID(version?:number): Validator; - /** - * Alias for isUUID(3) - */ - isUUIDv3(): Validator; - /** - * Alias for isUUID(4) - */ - isUUIDv4(): Validator; - /** - * Alias for isUUID(5) - */ - isUUIDv5(): Validator; - /** - * Uses Date.parse() - regex is probably a better choice - */ - isDate(): Validator; - /** - * Argument is optional and defaults to today. Comparison is non-inclusive - */ - isAfter(date?:Date): Validator; - /** - * Argument is optional and defaults to today. Comparison is non-inclusive - */ - isBefore(date?:Date): Validator; - isIn(options:string): Validator; - isIn(options:string[]): Validator; - notIn(options:string): Validator; - notIn(options:string[]): Validator; - max(val:string): Validator; - min(val:string): Validator; - isJSON(): Validator; - isLength(options: MinMaxOptions): Validator; - isWhitelisted(chars: string): Validator; - /** - * Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats - */ - isCreditCard(): Validator; - /** - * Check an input only when the input exists - */ - isSurrogatePar(): Validator; - - optional(options?: { checkFalsy?: boolean }): Validator; - withMessage(message: string): Validator; - } - - interface Sanitizer { - /** - * Trim optional `chars`, default is to trim whitespace (\r\n\t ) - */ - trim(...chars:string[]): Sanitizer; - ltrim(...chars:string[]): Sanitizer; - rtrim(...chars:string[]): Sanitizer; - stripLow(keep_new_lines?: boolean): Sanitizer; - toFloat(): Sanitizer; - toInt(radix?: number): Sanitizer; - /** - * True unless str = '0', 'false', or str.length == 0. In strict mode only '1' and 'true' return true. - */ - toBoolean(strict?: boolean): Sanitizer; - - /** - * Convert the input string to a date, or null if the input is not a date. - */ - toDate(): Sanitizer; - - /** - * Escape &, <, >, and " - */ - escape(): Sanitizer; - - /** - * Replaces HTML encoded entities with <, >, &, ', " and /. - */ - unescape(): Sanitizer; - - blacklist(chars: string): Sanitizer; - blacklist(chars: string[]): Sanitizer; - whitelist(chars: string): Sanitizer; - whitelist(chars: string[]): Sanitizer; - - normalizeEmail(options?: { lowercase?: boolean; remove_dots?: boolean; remove_extensions?: boolean }): Sanitizer; - - /** - * !!! XSS sanitization was removed from the library (see: https://github.com/chriso/validator.js#xss-sanitization) - */ - } - - interface MappedError { - param: string; - msg: string; - value: string; - } - - interface MinMaxOptions { - min?: number; - max?: number; - } -} diff --git a/types/extended-listbox/extended-listbox-tests.ts b/types/extended-listbox/extended-listbox-tests.ts index dfa51ffebf..4d03ada74e 100644 --- a/types/extended-listbox/extended-listbox-tests.ts +++ b/types/extended-listbox/extended-listbox-tests.ts @@ -12,7 +12,7 @@ options.multiple = true; options.searchBar = false; options.searchBarWatermark = "Search"; options.searchBarButton = { icon: "fa fa-search", visible: true, onClick: function () { alert(); } }; -options.getItems = function (): any[] { +options.getItems = (): (string|ListboxItem)[] => { return ["Test1"]; }; options.onItemsChanged = (event: ListboxEvent): void => { @@ -23,13 +23,13 @@ options.onItemsChanged = (event: ListboxEvent): void => { options.onFilterChanged = (event: ListboxEvent): void => { console.log(event.args); }; -options.onValueChanged = function (event: ListboxEvent): void { +options.onValueChanged = (event: ListboxEvent): void => { console.log(event.args); }; -options.onItemDoubleClicked = function (event: ListboxEvent): void { +options.onItemDoubleClicked = (event: ListboxEvent): void => { console.log(event.args); }; -options.onItemEnterPressed = function (event: ListboxEvent): void { +options.onItemEnterPressed = (event: ListboxEvent): void => { console.log(event.args); }; @@ -39,7 +39,7 @@ instance = $test.listbox(options); /////// NEW API /////// // Add string item -var id = instance.addItem("Test2"); +var id: string = instance.addItem("Test2"); // Add item @@ -54,10 +54,18 @@ item.text = "Test3"; id = instance.addItem(item); +// Add string items +var ids: string[] = instance.addItems(["Test2", "Test1"]); + + // Remove item instance.removeItem(id); +// Remove items +instance.removeItems([id, ids[0]]); + + // Get item var i: ListboxItem = instance.getItem(id); diff --git a/types/extended-listbox/index.d.ts b/types/extended-listbox/index.d.ts index 3f3527b903..b8495b2f94 100644 --- a/types/extended-listbox/index.d.ts +++ b/types/extended-listbox/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for extended-listbox 2.0.x +// Type definitions for extended-listbox 3.0.x // Project: https://github.com/code-chris/extended-listbox // Definitions by: Christian Kotzbauer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -26,7 +26,7 @@ interface ListboxItem { parentGroupId?: string; /** list of childItems */ - childItems?: any[]; + childItems?: ListboxItem[]; } interface ListboxSearchBarButtonOptions { @@ -54,7 +54,7 @@ interface ListBoxOptions { multiple?: boolean; /** function which returns a array of items */ - getItems?: () => any; + getItems?: () => (string|ListboxItem)[]; /** callback for selection changes */ onValueChanged?: (event: ListboxEvent) => void; @@ -90,9 +90,15 @@ interface ExtendedListboxInstance { /** Adds a new item to the list */ addItem(item: string|ListboxItem): string; + /** Adds new items to the list */ + addItems(item: (string|ListboxItem)[]): string[]; + /** Removes a item from the list */ removeItem(identifier: string): void; + /** Removes items from the list */ + removeItems(identifiers: string[]): void; + /** Reverts all changes from the DOM */ destroy(): void; diff --git a/types/extract-text-webpack-plugin/index.d.ts b/types/extract-text-webpack-plugin/index.d.ts index 6da0c183c3..0897d7b594 100644 --- a/types/extract-text-webpack-plugin/index.d.ts +++ b/types/extract-text-webpack-plugin/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for extract-text-webpack-plugin 2.0.0 +// Type definitions for extract-text-webpack-plugin 2.1.0 // Project: https://github.com/webpack-contrib/extract-text-webpack-plugin // Definitions by: flying-sheep , kayo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -42,7 +42,7 @@ interface ExtractTextPlugin extends Plugin { * Creates an extracting loader from an existing loader. * Use the resulting loader in `module.rules`/`module.loaders`. */ - extract: (loader: Loader | Loader[] | ExtractOptions) => Loader + extract: (loader: Loader | Loader[] | ExtractOptions) => Loader[] } declare const extractTextPlugin: ExtractTextPlugin diff --git a/types/eyes/eyes-tests.ts b/types/eyes/eyes-tests.ts index 2775aff7c4..c0ca4bc846 100644 --- a/types/eyes/eyes-tests.ts +++ b/types/eyes/eyes-tests.ts @@ -27,7 +27,7 @@ var options = { maxLength: 120 } -var result = eyes.inspector(testObj) +var result = eyes.inspector(options) diff --git a/types/eyes/index.d.ts b/types/eyes/index.d.ts index 3307d9d484..219d13c0fe 100644 --- a/types/eyes/index.d.ts +++ b/types/eyes/index.d.ts @@ -43,7 +43,7 @@ export interface EyesOptions { /** Don't output functions at all */ hideFunctions?: boolean; /** Stream to write to, or null */ - stream?: stream.Writable; + stream?: NodeJS.WritableStream; /** Truncate output if longer */ maxLength?: number; } diff --git a/types/fabric/fabric-tests.ts b/types/fabric/fabric-tests.ts index 62c0726e16..9966e081d8 100644 --- a/types/fabric/fabric-tests.ts +++ b/types/fabric/fabric-tests.ts @@ -1,5 +1,3 @@ -import * as fabric from "fabric"; - function sample1() { const canvas = new fabric.Canvas('c', { hoverCursor: 'pointer', @@ -124,11 +122,12 @@ function sample3() { } }); - fabric.Image.fromURL('../assets/printio.png', img => { + const image = fabric.Image.fromURL('../assets/printio.png', img => { const oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9); canvas.add(oImg).renderAll(); canvas.setActiveObject(oImg); }); + image.setSrc('../assets/printio.png'); $('grayscale').onclick = function(this: HTMLInputElement) { applyFilter(0, this.checked && new f.Grayscale()); @@ -260,18 +259,16 @@ function sample4() { }); } -declare module "fabric" { - export interface CircleWithLineInfos extends Circle { - line1?: Line; - line2?: Line; - line3?: Line; - line4?: Line; - } +interface CircleWithLineInfos extends fabric.Circle { + line1?: fabric.Line; + line2?: fabric.Line; + line3?: fabric.Line; + line4?: fabric.Line; } function sample5() { const makeCircle = (left: number, top: number, line1?: fabric.Line, line2?: fabric.Line, line3?: fabric.Line, line4?: fabric.Line): fabric.Circle => { - const c = new fabric.Circle({ + const c = new fabric.Circle({ left, top, strokeWidth: 5, @@ -318,11 +315,11 @@ function sample5() { ); canvas.on('object:moving', e => { - const p = e.target; - p.line1 && p.line1.set({ 'x2': p.left, 'y2': p.top }); - p.line2 && p.line2.set({ 'x1': p.left, 'y1': p.top }); - p.line3 && p.line3.set({ 'x1': p.left, 'y1': p.top }); - p.line4 && p.line4.set({ 'x1': p.left, 'y1': p.top }); + const p = e.target; + p.line1 && p.line1.set({ x2: p.left, y2: p.top }); + p.line2 && p.line2.set({ x1: p.left, y1: p.top }); + p.line3 && p.line3.set({ x1: p.left, y1: p.top }); + p.line4 && p.line4.set({ x1: p.left, y1: p.top }); canvas.renderAll(); }); } @@ -352,10 +349,8 @@ function sample6() { }); } -declare module "fabric" { - export interface ImageWithInfo extends Image { +interface ImageWithInfo extends fabric.Image { movingLeft: boolean; - } } function sample7() { @@ -363,7 +358,7 @@ function sample7() { setInterval(() => { fabric.Image.fromURL('../assets/ladybug.png', obj => { - const img = obj; + const img = obj; img.set('left', fabric.util.getRandomInt(200, 600)).set('top', -50); img.movingLeft = !!Math.round(Math.random()); canvas.add(img); @@ -372,7 +367,7 @@ function sample7() { const animate = (function animate() { canvas.forEachObject(obj => { - const img = obj; + const img = obj; img.left += (img.movingLeft ? -1 : 1); img.top += 1; if (img.left > 900 || img.top > 500) { @@ -609,7 +604,7 @@ function sample8() { const activeGroup = canvas.getActiveGroup(); if (activeObject || activeGroup) { - (activeObject || activeGroup).setOpacity(parseInt(this.value, 10) / 100); + (activeObject || activeGroup).setOpacity(parseInt(( this).value, 10) / 100); canvas.renderAll(); } }; @@ -640,7 +635,7 @@ function sample8() { const activeGroup = canvas.getActiveGroup(); if (activeObject || activeGroup) { - (activeObject || activeGroup).setFill(this.value); + (activeObject || activeGroup).setFill(( this).value); canvas.renderAll(); } }; @@ -849,16 +844,16 @@ function sample8() { const activeObject = canvas.getActiveObject(); if (activeObject && activeObject.type === 'text') { - this.value = ( activeObject).text; + ( this).value = ( activeObject).text; } }; textEl.onkeyup = function(e) { const activeObject = canvas.getActiveObject(); if (activeObject) { - if (!this.value) { + if (!( this).value) { canvas.discardActiveObject(); } else { - ( activeObject).text = this.value; + ( activeObject).text = ( this).value; } canvas.renderAll(); } @@ -1006,7 +1001,7 @@ function sample8() { slider.onchange = function() { const activeObject = canvas.getActiveObject(); if (activeObject && activeObject.type === 'text') { - activeObject.lineHeight = +this.value; + activeObject.lineHeight = +( this).value; canvas.renderAll(); } }; diff --git a/types/fabric/index.d.ts b/types/fabric/index.d.ts index ca99080bad..1596d7d428 100644 --- a/types/fabric/index.d.ts +++ b/types/fabric/index.d.ts @@ -1866,7 +1866,7 @@ export class Image { * @param {Function} [callback] Callback is invoked when image has been loaded (and all filters have been applied) * @param {Object} [options] Options object */ - setSrc(src: string, callback: Function, options: IImageOptions): Image; + setSrc(src: string, callback?: Function, options?: IImageOptions): Image; /** * Creates an instance of fabric.Image from an URL string diff --git a/types/facebook-js-sdk/facebook-js-sdk-tests.ts b/types/facebook-js-sdk/facebook-js-sdk-tests.ts index 56fc91cd02..f919e3290f 100644 --- a/types/facebook-js-sdk/facebook-js-sdk-tests.ts +++ b/types/facebook-js-sdk/facebook-js-sdk-tests.ts @@ -107,4 +107,5 @@ FB.ui({ method: 'share', mobile_iframe: true, href: 'https://developers.facebook.com/docs/', + picture: 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/2000px-Google_2015_logo.svg.png', }, response => {}); diff --git a/types/facebook-js-sdk/index.d.ts b/types/facebook-js-sdk/index.d.ts index cb1981580a..300eeb3ec0 100644 --- a/types/facebook-js-sdk/index.d.ts +++ b/types/facebook-js-sdk/index.d.ts @@ -113,6 +113,7 @@ declare namespace facebook { interface ShareDialogParams extends DialogParams { method: 'share'; href: string; + picture?: string; hashtag?: string; quote?: string; mobile_iframe?: boolean; diff --git a/types/fecha/fecha-tests.ts b/types/fecha/fecha-tests.ts new file mode 100644 index 0000000000..0d0ce48638 --- /dev/null +++ b/types/fecha/fecha-tests.ts @@ -0,0 +1,124 @@ +import fecha = require('fecha'); + +// test fecha.parse +fecha.parse("February 3rd, 2014", "MMMM Do, YYYY"); +fecha.parse("5/3/98", "shortDate"); + +// test override fecha.i18n +fecha.i18n = { + dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat"], + dayNames: [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ], + monthNamesShort: [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" + ], + monthNames: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ], + amPm: ["am", "pm"], + DoFn(D: number) { + return D + "th"; + } +}; + +// just change one default mask +fecha.masks.shortDate = "M/D/YY"; + +// test override fecha.masks with an object. Must implement all keys. +// if you want to implement partially, use +// fecha.masks = Object.assign(fecha.masks, {shortDate: 'M/D/YY'}) for example. +fecha.masks = { + default: "ddd MMM DD YYYY HH:mm:ss", + shortDate: "M/D/YY", + mediumDate: "MMM D, YYYY", + longDate: "MMMM D, YYYY", + fullDate: "dddd, MMMM D, YYYY", + shortTime: "HH:mm", + mediumTime: "HH:mm:ss", + longTime: "HH:mm:ss.SSS" +}; + +// test add custom named mask. +// fecha.masks.myMask = "HH:mm:ss YY/MM/DD"; does not work for now. +fecha.masks['myMask'] = "HH:mm:ss YY/MM/DD"; + +// test fecha.format without i18nSettings, with Date object. +fecha.format(new Date(2014, 5, 6, 14, 10, 45), "myMask"); + +// test fecha.format without i18nSettings with number. +fecha.format(Date.now(), "myMask"); + +// test override i18nSettings with fecha.format +fecha.format(new Date(2014, 5, 6, 14, 10, 45), "myMask", { + dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat"], + dayNames: [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ], + monthNamesShort: [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" + ], + monthNames: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ], + amPm: ["am", "pm"], + DoFn(D: number) { + return D + "th"; + } +}); diff --git a/types/fecha/index.d.ts b/types/fecha/index.d.ts new file mode 100644 index 0000000000..f68d26a316 --- /dev/null +++ b/types/fecha/index.d.ts @@ -0,0 +1,52 @@ +// Type definitions for fecha 2.3 +// Project: https://github.com/taylorhakes/fecha +// Definitions by: Goh Yisheng +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export type Days = [string, string, string, string, string, string, string]; + +export type Months = [ + string, + string, + string, + string, + string, + string, + string, + string, + string, + string, + string, + string +]; + +export interface i18nSettings { + amPm: [string, string]; + dayNames: Days; + dayNamesShort: Days; + monthNames: Months; + monthNamesShort: Months; + DoFn(D: number): string; +} + +export interface Masks { + default: string; + fullDate: string; + longDate: string; + longTime: string; + mediumDate: string; + mediumTime: string; + shortDate: string; + shortTime: string; + [myMask: string]: string; +} + +export let masks: Masks; + +export let i18n: i18nSettings; + +export function format(dateObj: Date | number, mask: string, i18nSettings?: i18nSettings): string; + +export function parse(dateStr: string, format: string, i18nSettings?: i18nSettings): Date; + +export as namespace Fecha; diff --git a/types/fecha/tsconfig.json b/types/fecha/tsconfig.json new file mode 100644 index 0000000000..581630d1b6 --- /dev/null +++ b/types/fecha/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "fecha-tests.ts" + ] +} diff --git a/types/fecha/tslint.json b/types/fecha/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/fecha/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/fetch.io/index.d.ts b/types/fetch.io/index.d.ts index ab949d4880..8258cbf8da 100644 --- a/types/fetch.io/index.d.ts +++ b/types/fetch.io/index.d.ts @@ -23,7 +23,7 @@ export interface Options extends RequestInit { header?: Header; - beforeRequest?(url: TUrl, body: BodyInit): boolean; + beforeRequest?(url: TUrl, body: BodyInit): boolean | void; afterResponse?(res: Response): void; diff --git a/types/firebird/firebird-tests.ts b/types/firebird/firebird-tests.ts new file mode 100644 index 0000000000..4a6bd59c05 --- /dev/null +++ b/types/firebird/firebird-tests.ts @@ -0,0 +1,122 @@ +import * as fb from "firebird"; + +/* createConnection */ +let con: fb.Connection = fb.createConnection(); + +/* Connection */ +con = new fb.Connection(); + +con.connectSync('test.fdb', 'sysdba', 'masterkey', ''); +con.connect('test.fdb', 'sysdba', 'masterkey', '', (err: Error | null) => {}); + +if (con.connected === true) { + console.log('connected'); +} + +con.querySync("insert into test (id,name) values (5, 'new one')"); +const res: fb.FBResult = con.querySync("select * from test"); +con.query("select * from test", (err: Error | null, res: fb.FBResult) => {}); + +con.commitSync(); +con.commit((err: Error | null) => {}); + +con.rollbackSync(); +con.rollback((err: Error | null) => {}); + +con.startSync(); +con.start((err: Error | null) => {}); + +let stmt: fb.FBStatement = con.prepareSync("select * from test where name = ?"); + +if (con.inTransaction === true) { + console.log('in transaction'); +} + +let blob: fb.FBBlob = con.newBlobSync(); + +let tx: fb.Transaction = con.startNewTransactionSync(); +con.startNewTransaction((err: Error | null, tx: fb.Transaction) => {}); + +/* DataType */ +let column: fb.DataType = {}; +if (typeof (column) === "number") { + column * 10; +} else if (typeof (column) === "string") { + column.substring(0, 1); +} else if (column instanceof Date) { + column.toISOString(); +} else { + let _: fb.FBBlob = column; +} + +/* FBResult */ +interface MyRow { + id: number; + name: string; +} + +let rowsArray: fb.DataType[][] = res.fetchSync("all", false); +rowsArray = res.fetchSync(1, false); +res.fetch("all", false, (row: fb.DataType[]) => {}, (err: Error | null, eof: boolean) => {}); +res.fetch(1, false, (row: fb.DataType[]) => {}, (err: Error | null, eof: boolean) => {}); +let rowsObject: Array<{[colmn: string]: fb.DataType}> = res.fetchSync("all", true); +rowsObject = res.fetchSync(1, true); +res.fetch("all", true, (row: {[colmn: string]: fb.DataType}) => {}, (err: Error | null, eof: boolean) => {}); +res.fetch(1, true, (row: {[colmn: string]: fb.DataType}) => {}, (err: Error | null, eof: boolean) => {}); +let rowsTyped: MyRow[] = res.fetchSync("all", true); +rowsTyped = res.fetchSync(1, true); +res.fetch("all", true, (row: MyRow) => {}, (err: Error | null, eof: boolean) => {}); +res.fetch(1, true, (row: MyRow) => {}, (err: Error | null, eof: boolean) => {}); + +/* Transaction */ +tx.querySync("insert into test (id,name) values (5, 'new one')"); +tx.query("select * from test", (err: Error | null, res: fb.FBResult) => {}); + +tx.commitSync(); +tx.commit((err: Error | null) => {}); + +tx.rollbackSync(); +tx.rollback((err: Error | null) => {}); + +tx.startSync(); +tx.start((error: Error | null) => {}); +stmt = tx.prepareSync("select * from test where name = ?"); + +if (tx.inTransaction === true) { + console.log('in transaction'); +} + +/* FBStatement */ +let asFBResult: fb.FBResult = stmt; +stmt.execSync("John"); +stmt.execSync(1, "Mary"); +stmt.execInTransSync(tx, "John"); +stmt.execInTransSync(tx, 1, "Mary"); +stmt.exec("John"); +stmt.exec(1, "Mary"); +stmt.execInTrans(tx, "John"); +stmt.execInTrans(tx, 1, "Mary"); + +/* FBBlob */ +blob._openSync(); + +blob._closeSync(); + +let buffer: Buffer = {}; +let readBytes: number = blob._readSync(buffer); +blob._read(buffer, (err: Error | null, buffer: Buffer, len: number) => {}); + +blob._readAll(); +blob._readAll(10); +blob._readAll(10, 20); +blob._readAll(10, (err: Error | null, buffer: Buffer, len: number) => {}); +blob._readAll(10, 20, (err: Error | null, buffer: Buffer, len: number) => {}); + +let writtenBytes = blob._writeSync(buffer); +writtenBytes = blob._writeSync(buffer, 10); +blob._write(buffer); +blob._write(buffer, 10); +blob._write(buffer, 10, (err: Error | null) => {}); + +/* Stream */ +let strm: NodeJS.ReadWriteStream = new fb.Stream(blob); diff --git a/types/firebird/index.d.ts b/types/firebird/index.d.ts new file mode 100644 index 0000000000..6506762408 --- /dev/null +++ b/types/firebird/index.d.ts @@ -0,0 +1,501 @@ +// Type definitions for firebird 0.1 +// Project: https://github.com/xdenser/node-firebird-libfbclient +// Definitions by: Yasushi Kato +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +/** + * This is a type declaration file for 'firebird' package. + * + * Original document is [here](https://www.npmjs.com/package/firebird). + */ +declare module 'firebird' { + /** + * @see createConnection() method will create Firebird Connection object for you + */ + function createConnection(): Connection; + + /** + * Handles database connection and queries. Supports Synchronous and Asynchronous operation. + */ + class Connection { + constructor(); + + /** + * Connects you to database, + * + * @param database a database name in Firebird notation, i.e. : + * @param username user name + * @param pasword + * @param role + * + * @throws raises exception on error (try to catch it). + */ + connectSync(db: string, user: string, pass: string, role: string): void; + + /** + * Asynchronously connects you to Database. + * + * @param database a database name in Firebird notation, i.e. : + * @param username user name + * @param pasword + * @param role + * @param callback function(err), where err is error object in case of error. + */ + connect(db: string, user: string, pass: string, role: string, callback: (err: Error | null) => void): void; + + /** + * A boolean readonly property indicating if Connection object is connected to database + */ + connected: boolean; + + /** + * Executes SQL query. + * @param sql an SQL query to execute. + * @return object in case of success. + * @throws Raises error otherwise. + */ + querySync(sql: string): FBResult; + + /** + * Asynchronously executes query. + * + * @param sql an SQL query to execute. + * @param callback function(err,res), err - is error object or null, res - FBResult object. + */ + query(sql: string, callback: (err: Error | null, res: FBResult) => void): void; + + /** + * Registers connection to listen for firebird event name, called from PL\SQL (in stored procedures or triggers) with post_event 'name'. + * + * @desc + * You may set callback for event with + * @code connection.on('fbevent', function(name, count){ ));. + * Where name is event name, and count is number of times event were posted. + * + * @param name Firebird Event Name. + */ + addFBevent(name: string): void; + + /** + * Unsubscribes connection from getting events for name. + * + * @param name Firebird Event Name. + */ + deleteFBevent(name: string): void; + + /** + * @summary + * Synchronously commits current transaction. + * + * @desc + * Notes: + * There is only one transaction associated with connection. + * Transacation is automatically started before any query if connection does not have active transaction (check @see inTransaction property). + * You also should note that DDL statements (altering database structure) are commited automatically. + * To run quieries in context of other transaction use @see Transaction object. + */ + commitSync(): void; + + /** + * Asynchronous commit transaction. + * + * @desc + * Read notes in @see commitSync() . + * + * @param callback function(err), where err is error object in case of error. + */ + commit(callback: (err: Error | null) => void): void; + + /** + * Synchronously rollbacks current transaction. + * + * @desc + * Read notes in @see commitSync() . + */ + rollbackSync(): void; + + /** + * Asynchronously rollbacks current transaction. + * + * @desc + * Read notes in @see commitSync() . + * + * @param callback function(err), where err is error object in case of error. + */ + rollback(callback: (err: Error | null) => void): void; + + /** + * Synchronously starts new default transaction. + * + * @desc + * The default transaction should be not in started state before call to this method. + * Read notes in @see commitSync() . + */ + startSync(): void; + + /** + * Asynchronously starts new default transaction. + * + * @desc + * Read notes in @see commitSync() . + * + * @param callback function(err), where err is error object in case of error. + */ + start(callback: (err: Error | null) => void): void; + + /**Synchronously prepares SQL statement and returns FBStatement object. + * + * @param sql an SQL query to prepare. + */ + prepareSync(sql: string): FBStatement; + + /** + * A boolean readonly property indicating if connection is in started transaction state. + */ + inTransaction: boolean; + + /** + * Creates new FBblob object and opens it for write. + * After finishing write operation and closing blob one may insert it in database passing as parameter to exec, + * execSync methods of @see FBStatement object. + */ + newBlobSync(): FBBlob; + + /** + * Creates new Transaction object and starts new transaction. + * @returns created object. + */ + startNewTransactionSync(): Transaction; + + /** + * Creates new Transaction object and starts new transaction. + * + * @param callback function(err, transaction), where err is error object in case of error, transaction - newly created transaction. + */ + startNewTransaction(callback: (err: Error | null, transaction: Transaction) => void): void; + } + + /** + * @desc + * Here is Firebird to Node data type accordance: + * + * | Firebird | Node | + * | :------- | :-------- | + * | DATE | Date | + * | TIME | Date | + * | TIMESTAMP | Date | + * | CHAR | String | + * | VARCHAR | String | + * | SMALLINT | Integer| + * | INTEGER | Integer| + * | NUMERIC | Number | + * | DECIMAL | Number | + * | FLOAT | Number | + * | DOUBLE | Number | + * | BLOB | FBblob | + */ + type DataType = Date | string /*| Integer*/ | number | FBBlob; + + /** + * Represents results of SQL query if any. + * You should use this object to fetch rows from database. + * Each row may be represented as array of field values or as object with named fields. + * + * @see DataType + */ + class FBResult { + /** + * @summary + * Synchronously fetches result rows. + * + * @desc + * If you pass "all" as rowCount - it will fetch all result rows. + * If you pass less rowCount than are actually in result, it will return specified number of rows. + * You may call fetchSync multiple times until all rows will be fetched. + * If you specify more rowCount than available it will return only actual number of rows. + * + * @param rowCount number of rows to fetch from results; + * @param asObject format of returned rows. When false - methods returns array of array, when true - array of objects. + */ + fetchSync(rowCount: number | "all", asObject: boolean): DataType[][] | Array<{[column: string]: DataType}>; + fetchSync(rowCount: number | "all", asObject: false): DataType[][]; + fetchSync(rowCount: number | "all", asObject: true): Array<{[column: string]: DataType}>; + fetchSync(rowCount: number | "all", asObject: true): T[]; + + /** + * Asynchronously fetches rows one by one. + * + * @param rowCount number of rows to fetch from results + * @param asObject format of returned rows. When false - methods returns array of array, when true - array of objects + * @param rowCallback function(row), row - Array or Object (depends on asObject parameter) representing single row from result; called for each fetched row. + * @param eofCallback function(err,eof), err - Error object in case of error, or null; eof - true | false. called when whole operation is complete. + */ + fetch(rowCount: number | "all", asObject: boolean, rowCallback: (row: DataType[]| {[column: string]: DataType}) => void, eofCallback: (err: Error | null, eof: boolean) => void): void; + fetch(rowCount: number | "all", asObject: false, rowCallback: (row: DataType[]) => void, eofCallback: (err: Error | null, eof: boolean) => void): void; + fetch(rowCount: number | "all", asObject: true, rowCallback: (row: {[column: string]: DataType}) => void, eofCallback: (err: Error | null, eof: boolean) => void): void; + fetch(rowCount: number | "all", asObject: true, rowCallback: (row: T) => void, eofCallback: (err: Error | null, eof: boolean) => void): void; + } + + /** + * Represents SQL transaction. + * + * @desc + * To get instance of this object call @see startNewTransactionSync or @see startNewTransaction methods of @see Connection object. + * Transaction objects may be reused after commit or rollback. + */ + interface Transaction { + /** + * Executes SQL query in context of this transaction. Returns FBResult object in case of success. Raises error otherwise. + * + * @param sql an SQL query to execute. + */ + querySync(sql: string): void; + + /** + * Asynchronously executes query in context of this transaction. + * + * @param sql an SQL query to execute. + * @param callback err - is error object or null, res - FBResult object. + */ + query(sql: string, callback: (err: Error | null, res: FBResult) => void): void; + + /** + * Synchronously commits this transaction. + * + * @desc + * Notes: + * Transacation is automatically started before any query in context of this object + * if this object does not have active transaction (check inTransaction property). + * You also should note that DDL statements (altering database structure) are commited automatically. + */ + commitSync(): void; + + /** + * Asynchronous commit transaction. + * + * @desc + * Read notes in @see commitSync() . + * + * @param callback function(err), where err is error object in case of error. + */ + commit(callback: (err: Error | null) => void): void; + + /** + * Synchronously rollbacks transaction. + * + * @desc + * Read notes in @see commitSync() . + */ + rollbackSync(): void; + + /** + * Asynchronously rollbacks transaction. + * + * @desc + * Read notes in @see commitSync() . + * + * @param callback function(err), where err is error object in case of error. + */ + rollback(callback: (err: Error | null) => void): void; + + /** + * Synchronously starts transaction. + * + * @desc + * The transaction should be not in started state before call to this method. + * Read notes in @see commitSync() . + * See @see inTransaction property. + */ + startSync(): void; + + /** + * Asynchronously starts new transaction. + * + * @desc + * Read notes in @see commitSync() . + * + * @param callback function(err), where err is error object in case of error. + */ + start(callback: (err: Error | null) => void): void; + + /** + * Synchronously prepares SQL statement + * + * @param sql an SQL query to prepare. + * @returns @see FBStatement object in context of this transaction. + */ + prepareSync(sql: string): FBStatement; + + /* + * A boolean readonly property indicating if this transaction is in started state. + */ + inTransaction: boolean; + } + + /** + * Represents prepared SQL query (returned by @see Connection.prepare() and @see Connection.prepareSync()). + * + * @see FBStatement is derived form @see FBResult class. + * So it can fetch rows just like @see FBresult object after call to @see execSync, exec methods. + */ + class FBStatement extends FBResult { + /** + * Synchronously executes prepared statement with given parameters. + * + * @desc + * You may fetch rows with methods inherited from @see FBResult. + * @see Statement is executed in context of default connection transaction. + * + * @param params parameters of prepared statement in the same order as in SQL and with appropriate types. + */ + execSync(...params: DataType[]): void; + + /** + * Same as @see execSync but executes statement in context of given @see Transaction obejct. + * + * @param transaction + * @param params + */ + execInTransSync(transaction: Transaction, ...params: DataType[]): void; + + /** + * Asynchronously executes prepared statement with given parameters. + * + * @desc + * @see FBStatement emits 'result' or 'error' event. + * You may fetch rows with methods inherited from @see FBResult after 'result' event emitted. + * Statement is executed in context of default connection transaction. + * + * @param params parameters of prepared statement in the same order as in SQL and with appropriate types. + */ + exec(...params: DataType[]): void; + + /** + * Same as @see exec but executes statement in context of given @see Transaction obejct. + * + * @param transaction + * @param params + */ + execInTrans(transaction: Transaction, ...params: DataType[]): void; + } + + /** + * Represents BLOB data type. + */ + interface FBBlob { + /** + * Synchronously opens blob for reading. + */ + _openSync(): void; + + /** + * Synchronously closes previously opened blob. + */ + _closeSync(): void; + + /** + * Synchronously reads BLOB segment (chunk) into buffer. Tries to fill whole buffer with data. + * + * @param buffer Node buffer to fill with data. + * @returns actual number of bytes read. + */ + _readSync(buffer: Buffer): number; + + /** + * Asynchronously reads BLOB segment (chunk) into buffer. Tries to fill whole buffer with data. + * + * @param buffer Node buffer to fill with data. + * @param callback function(err,buffer,len), err - Error object in case of error, or null;buffer - buffer filled with data; len - actual data length. + */ + _read(buffer: Buffer, callback: (err: Error | null, buffer: Buffer, len: number) => void): void; + + /** + * Asynchronously reads all data from BLOB field. + * Object emits events while reading data error, drain',end`. + * + * @param initialSize - optional, initial result buffer to allocate, default = 0 + * @param chunkSize - optional, size of chunk used to read data, default = 1024 + * @param callback - optional, function (err, buffer, len), err - Error object in case of error, or null;buffer - buffer filled with data; len - actual data length. + */ + _readAll(initialSize?: number, chunkSize?: number, callback?: (err: Error | null, buffer: Buffer, len: number) => void): void; + _readAll(initialSize: number, callback: (err: Error | null, buffer: Buffer, len: number) => void): void; + _readAll(callback: (err: Error | null, buffer: Buffer, len: number) => void): void; + + /** + * Synchronously writes BLOB segment (chunk) from buffer. + * + * @param buffer Node buffer to write from to blob; + * @param len optional length parameter, if specified only len bytes from buffer will be writen. + * @returns number of bytes actually writen. + */ + _writeSync(buffer: Buffer, len?: number): number; + + /** + * Asynchronously writes BLOB segment (chunk) from buffer and calls callback function if any. + * + * @param buffer Node buffer to write from to blob; + * @param len optional length parameter, if specified only len bytes from buffer will be writen. + * @param callback function(err), err - Error object in case of error, or null; + */ + _write(buffer: Buffer, len?: number, callback?: (err: Error | null) => void): void; + } + + /** + * Represents BLOB stream. + * + * @desc + * Create BLOB stream using + * @code var strm = new fb.Stream(FBblob);. + * + * You may pipe strm to/from NodeJS Stream objects (fs or socket). + * You may also look at [NodeJS Streams reference](https://nodejs.org/api/stream.html). + */ + class Stream implements NodeJS.ReadWriteStream { + constructor(blob: FBBlob); + + /* Following lines is JUST AS NodeJS.ReadStream, NodeJS.WriteStream, and NodeJS.Emmiter */ + /* tslint:disable */ + + /* NodeJS.ReadStream */ + readable: boolean; + read(size?: number): string | Buffer; + setEncoding(encoding: string | null): this; + pause(): this; + resume(): this; + isPaused(): boolean; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): this; + unshift(chunk: string): void; + unshift(chunk: Buffer): void; + wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; + + /* NodeJS.WriteStream */ + writable: boolean; + write(buffer: Buffer | string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + + /* EventEmitter */ + addListener(event: string | symbol, listener: Function): this; + on(event: string | symbol, listener: Function): this; + once(event: string | symbol, listener: Function): this; + removeListener(event: string | symbol, listener: Function): this; + removeAllListeners(event?: string | symbol): this; + setMaxListeners(n: number): this; + getMaxListeners(): number; + listeners(event: string | symbol): Function[]; + emit(event: string | symbol, ...args: any[]): boolean; + listenerCount(type: string | symbol): number; + prependListener(event: string | symbol, listener: Function): this; + prependOnceListener(event: string | symbol, listener: Function): this; + eventNames(): (string | symbol)[]; + + /* tslint:enable */ + } +} diff --git a/types/firebird/tsconfig.json b/types/firebird/tsconfig.json new file mode 100644 index 0000000000..705913437a --- /dev/null +++ b/types/firebird/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "scripthost" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "firebird-tests.ts" + ] +} diff --git a/types/firebird/tslint.json b/types/firebird/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/firebird/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/flatbuffers/flatbuffers-tests.ts b/types/flatbuffers/flatbuffers-tests.ts index 87593106c7..cdcabac25b 100644 --- a/types/flatbuffers/flatbuffers-tests.ts +++ b/types/flatbuffers/flatbuffers-tests.ts @@ -1,3 +1,5 @@ +import { flatbuffers } from "flatbuffers"; + enum Color { Red= 1, Green= 2, @@ -303,9 +305,9 @@ class Stat { } class Monster { - bb: flatbuffers.ByteBuffer= null; + bb: flatbuffers.ByteBuffer= null; - bb_pos: number = 0; + bb_pos: number = 0; __init(i: number, bb: flatbuffers.ByteBuffer): Monster { this.bb_pos = i; diff --git a/types/flatbuffers/index.d.ts b/types/flatbuffers/index.d.ts index 1342acdf15..4f75a7cc30 100644 --- a/types/flatbuffers/index.d.ts +++ b/types/flatbuffers/index.d.ts @@ -3,625 +3,629 @@ // Definitions by: Kamil Rojewski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace flatbuffers { - /** - * @typedef {number} - */ - type Offset = number; +export { flatbuffers }; - /** - * @typedef {{ - * bb: flatbuffers.ByteBuffer, - * bb_pos: number - * }} - */ - interface Table { - bb: ByteBuffer; - bb_pos: number; - } - - /** - * @type {number} - * @const - */ - const SIZEOF_SHORT: number; - - /** - * @type {number} - * @const - */ - const SIZEOF_INT: number; - - /** - * @type {number} - * @const - */ - const FILE_IDENTIFIER_LENGTH: number; - - /** - * @enum {number} - */ - enum Encoding { UTF8_BYTES, UTF16_STRING } - - /** - * @type {Int32Array} - * @const - */ - const int32: Int32Array; - - /** - * @type {Float32Array} - * @const - */ - const float32: Float32Array; - - /** - * @type {Float64Array} - * @const - */ - const float64: Float64Array; - - /** - * @type {boolean} - * @const - */ - const isLittleEndian: boolean; - - //////////////////////////////////////////////////////////////////////////////// - - class Long { +declare global { + namespace flatbuffers { /** - * @type {number} - * @const + * @typedef {number} */ - low: number; + type Offset = number; + + /** + * @typedef {{ + * bb: flatbuffers.ByteBuffer, + * bb_pos: number + * }} + */ + interface Table { + bb: ByteBuffer; + bb_pos: number; + } /** * @type {number} * @const */ - high: number; + const SIZEOF_SHORT: number; /** - * @type {flatbuffers.Long} + * @type {number} * @const */ - static ZERO: Long; + const SIZEOF_INT: number; /** - * @constructor - * @param {number} high - * @param {number} low + * @type {number} + * @const */ - constructor(low: number, high: number); + const FILE_IDENTIFIER_LENGTH: number; /** - * @returns {number} + * @enum {number} */ - toFloat64(): number; + enum Encoding { UTF8_BYTES, UTF16_STRING } /** - * @param {flatbuffers.Long} other - * @returns {boolean} + * @type {Int32Array} + * @const */ - equals(other: any): boolean; + const int32: Int32Array; /** - * @param {number} low - * @param {number} high + * @type {Float32Array} + * @const */ - static create(low: number, high: number): Long; - } - - //////////////////////////////////////////////////////////////////////////////// - - class Builder { - /** - * @constructor - * @param {number=} initial_size - */ - constructor(initial_size?: number); - - /** - * In order to save space, fields that are set to their default value - * don't get serialized into the buffer. Forcing defaults provides a - * way to manually disable this optimization. - * - * @param {boolean} forceDefaults true always serializes default values - */ - forceDefaults(forceDefaults: boolean): void; - - /** - * Get the ByteBuffer representing the FlatBuffer. Only call this after you've - * called finish(). The actual data starts at the ByteBuffer's current position, - * not necessarily at 0. - * - * @returns {flatbuffers.ByteBuffer} - */ - dataBuffer(): ByteBuffer; - - /** - * Get the ByteBuffer representing the FlatBuffer. Only call this after you've - * called finish(). The actual data starts at the ByteBuffer's current position, - * not necessarily at 0. - * - * @returns {Uint8Array} - */ - asUint8Array(): Uint8Array; - - /** - * Prepare to write an element of `size` after `additional_bytes` have been - * written, e.g. if you write a string, you need to align such the int length - * field is aligned to 4 bytes, and the string data follows it directly. If all - * you need to do is alignment, `additional_bytes` will be 0. - * - * @param {number} size This is the of the new element to write - * @param {number} additional_bytes The padding size - */ - prep(size: number, additional_bytes: number): void; - - /** - * @param {number} byte_size - */ - pad(byte_size: number): void; - - /** - * @param {number} value - */ - writeInt8(value: number): void; - - /** - * @param {number} value - */ - writeInt16(value: number): void; - - /** - * @param {number} value - */ - writeInt32(value: number): void; - - /** - * @param {flatbuffers.Long} value - */ - writeInt64(value: Long): void; - - /** - * @param {number} value - */ - writeFloat32(value: number): void; - - /** - * @param {number} value - */ - writeFloat64(value: number): void; - - /** - * @param {number} value - */ - addInt8(value: number): void; - - /** - * @param {number} value - */ - addInt16(value: number): void; - - /** - * @param {number} value - */ - addInt32(value: number): void; - - /** - * @param {flatbuffers.Long} value - */ - addInt64(value: Long): void; - - /** - * @param {number} value - */ - addFloat32(value: number): void; - - /** - * @param {number} value - */ - addFloat64(value: number): void; - - /** - * @param {number} voffset - * @param {number} value - * @param {number} defaultValue - */ - addFieldInt8(voffset: number, value: number, defaultValue: number): void; - - /** - * @param {number} voffset - * @param {number} value - * @param {number} defaultValue - */ - addFieldInt16(voffset: number, value: number, defaultValue: number): void; - - /** - * @param {number} voffset - * @param {number} value - * @param {number} defaultValue - */ - addFieldInt32(voffset: number, value: number, defaultValue: number): void; - - /** - * @param {number} voffset - * @param {flatbuffers.Long} value - * @param {flatbuffers.Long} defaultValue - */ - addFieldInt64(voffset: number, value: Long, defaultValue: Long): void; - - /** - * @param {number} voffset - * @param {number} value - * @param {number} defaultValue - */ - addFieldFloat32(voffset: number, value: number, defaultValue: number): void; - - /** - * @param {number} voffset - * @param {number} value - * @param {number} defaultValue - */ - addFieldFloat64(voffset: number, value: number, defaultValue: number): void; - - /** - * @param {number} voffset - * @param {flatbuffers.Offset} value - * @param {flatbuffers.Offset} defaultValue - */ - addFieldOffset(voffset: number, value: Offset, defaultValue: Offset): void; - - /** - * Structs are stored inline, so nothing additional is being added. `d` is always 0. - * - * @param {number} voffset - * @param {flatbuffers.Offset} value - * @param {flatbuffers.Offset} defaultValue - */ - addFieldStruct(voffset: number, value: Offset, defaultValue: Offset): void; - - /** - * Structures are always stored inline, they need to be created right - * where they're used. You'll get this assertion failure if you - * created it elsewhere. - * - * @param {flatbuffers.Offset} obj The offset of the created object - */ - nested(obj: Offset): void; - - /** - * Should not be creating any other object, string or vector - * while an object is being constructed - */ - notNested(): void; - - /** - * Set the current vtable at `voffset` to the current location in the buffer. - * - * @param {number} voffset - */ - slot(voffset: number): void; + const float32: Float32Array; /** - * @returns {flatbuffers.Offset} Offset relative to the end of the buffer. + * @type {Float64Array} + * @const */ - offset(): Offset; + const float64: Float64Array; /** - * Doubles the size of the backing ByteBuffer and copies the old data towards - * the end of the new buffer (since we build the buffer backwards). - * - * @param {flatbuffers.ByteBuffer} bb The current buffer with the existing data - * @returns {flatbuffers.ByteBuffer} A new byte buffer with the old data copied - * to it. The data is located at the end of the buffer. + * @type {boolean} + * @const */ - static growByteBuffer(bb: ByteBuffer): ByteBuffer; + const isLittleEndian: boolean; - /** - * Adds on offset, relative to where it will be written. - * - * @param {flatbuffers.Offset} offset The offset to add - */ - addOffset(offset: Offset): void; + //////////////////////////////////////////////////////////////////////////////// - /** - * Start encoding a new object in the buffer. Users will not usually need to - * call this directly. The FlatBuffers compiler will generate helper methods - * that call this method internally. - * - * @param {number} numfields - */ - startObject(numfields: number): void; - - /** - * Finish off writing the object that is under construction. - * - * @returns {flatbuffers.Offset} The offset to the object inside `dataBuffer` - */ - endObject(): Offset; + class Long { + /** + * @type {number} + * @const + */ + low: number; - /** - * @param {flatbuffers.Offset} root_table - * @param {string=} file_identifier - */ - finish(root_table: Offset, file_identifier?: string): void; - - /** - * This checks a required field has been set in a given table that has - * just been constructed. - * - * @param {flatbuffers.Offset} table - * @param {number} field - */ - requiredField(table: Offset, field: number): void; - - /** - * Start a new array/vector of objects. Users usually will not call - * this directly. The FlatBuffers compiler will create a start/end - * method for vector types in generated code. - * - * @param {number} elem_size The size of each element in the array - * @param {number} num_elems The number of elements in the array - * @param {number} alignment The alignment of the array - */ - startVector(elem_size: number, num_elems: number, alignment: number): void; - - /** - * Finish off the creation of an array and all its elements. The array must be - * created with `startVector`. - * - * @returns {flatbuffers.Offset} The offset at which the newly created array - * starts. - */ - endVector(): Offset; - - /** - * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed - * instead of a string, it is assumed to contain valid UTF-8 encoded data. - * - * @param {string|Uint8Array} s The string to encode - * @return {flatbuffers.Offset} The offset in the buffer where the encoded string starts - */ - createString(s: string|Uint8Array): Offset; - - /** - * Conveniance function for creating Long objects. - * - * @param {number} low - * @param {number} high - * @returns {Long} - */ - createLong(low: number, high: number): Long; - } - - //////////////////////////////////////////////////////////////////////////////// - - class ByteBuffer { - /** - * @constructor - * @param {Uint8Array} bytes - */ - constructor(bytes: Uint8Array); - - /** - * @param {number} byte_size - * @returns {flatbuffers.ByteBuffer} - */ - static allocate(byte_size: number): ByteBuffer; - - /** - * @returns {Uint8Array} - */ - bytes(): Uint8Array; - - /** - * @returns {number} - */ - position(): number; - - /** - * @param {number} position - */ - setPosition(position: number): void; - - /** - * @returns {number} - */ - capacity(): number; - - /** - * @param {number} offset - * @returns {number} - */ - readInt8(offset: number): number; - - /** - * @param {number} offset - * @returns {number} - */ - readUint8(offset: number): number; - - /** - * @param {number} offset - * @returns {number} - */ - readInt16(offset: number): number; - - /** - * @param {number} offset - * @returns {number} - */ - readUint16(offset: number): number; - - /** - * @param {number} offset - * @returns {number} - */ - readInt32(offset: number): number; - - /** - * @param {number} offset - * @returns {number} - */ - readUint32(offset: number): number; - - /** - * @param {number} offset - * @returns {flatbuffers.Long} - */ - readInt64(offset: number): Long; - - /** - * @param {number} offset - * @returns {flatbuffers.Long} - */ - readUint64(offset: number): Long; - - /** - * @param {number} offset - * @returns {number} - */ - readFloat32(offset: number): number; - - /** - * @param {number} offset - * @returns {number} - */ - readFloat64(offset: number): number; - - /** - * @param {number} offset - * @param {number} value - */ - writeInt8(offset: number, value: number): void; - - /** - * @param {number} offset - * @param {number} value - */ - writeUint8(offset: number, value: number): void; - - /** - * @param {number} offset - * @param {number} value - */ - writeInt16(offset: number, value: number): void; - - /** - * @param {number} offset - * @param {number} value - */ - writeUint16(offset: number, value: number): void; - - /** - * @param {number} offset - * @param {number} value - */ - writeInt32(offset: number, value: number): void; - - /** - * @param {number} offset - * @param {number} value - */ - writeUint32(offset: number, value: number): void; - - /** - * @param {number} offset - * @param {flatbuffers.Long} value - */ - writeInt64(offset: number, value: Long): void; - - /** - * @param {number} offset - * @param {flatbuffers.Long} value - */ - writeUint64(offset: number, value: Long): void; - - /** - * @param {number} offset - * @param {number} value - */ - writeFloat32(offset: number, value: number): void; - - /** - * @param {number} offset - * @param {number} value - */ - writeFloat64(offset: number, value: number): void; - - /** - * Look up a field in the vtable, return an offset into the object, or 0 if the - * field is not present. - * - * @param {number} bb_pos - * @param {number} vtable_offset - * @returns {number} - */ - __offset(bb_pos: number, vtable_offset: number): number; - - /** - * Initialize any Table-derived type to point to the union at the given offset. - * - * @param {flatbuffers.Table} t - * @param {number} offset - * @returns {flatbuffers.Table} - */ - __union(t: T, offset: number): T; - - /** - * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer. - * This allocates a new string and converts to wide chars upon each access. - * - * To avoid the conversion to UTF-16, pass flatbuffers.Encoding.UTF8_BYTES as - * the "optionalEncoding" argument. This is useful for avoiding conversion to - * and from UTF-16 when the data will just be packaged back up in another - * FlatBuffer later on. - * - * @param {number} offset - * @param {flatbuffers.Encoding=} optionalEncoding Defaults to UTF16_STRING - * @returns {string|Uint8Array} - */ - __string(offset: number, optionalEncoding?: Encoding): string|Uint8Array; - - /** - * Retrieve the relative offset stored at "offset" - * @param {number} offset - * @returns {number} - */ - __indirect(offset: number): number; - - /** - * Get the start of data of a vector whose offset is stored at "offset" in this object. - * - * @param {number} offset - * @returns {number} - */ - __vector(offset: number): number; - - /** - * Get the length of a vector whose offset is stored at "offset" in this object. - * - * @param {number} offset - * @returns {number} - */ - __vector_len(offset: number): number; - - /** - * @param {string} ident - * @returns {boolean} - */ - __has_identifier(ident: string): boolean; - - /** - * Conveniance function for creating Long objects. - * - * @param {number} low - * @param {number} high - * @returns {Long} - */ - createLong(low: number, high: number): Long; + /** + * @type {number} + * @const + */ + high: number; + + /** + * @type {flatbuffers.Long} + * @const + */ + static ZERO: Long; + + /** + * @constructor + * @param {number} high + * @param {number} low + */ + constructor(low: number, high: number); + + /** + * @returns {number} + */ + toFloat64(): number; + + /** + * @param {flatbuffers.Long} other + * @returns {boolean} + */ + equals(other: any): boolean; + + /** + * @param {number} low + * @param {number} high + */ + static create(low: number, high: number): Long; + } + + //////////////////////////////////////////////////////////////////////////////// + + class Builder { + /** + * @constructor + * @param {number=} initial_size + */ + constructor(initial_size?: number); + + /** + * In order to save space, fields that are set to their default value + * don't get serialized into the buffer. Forcing defaults provides a + * way to manually disable this optimization. + * + * @param {boolean} forceDefaults true always serializes default values + */ + forceDefaults(forceDefaults: boolean): void; + + /** + * Get the ByteBuffer representing the FlatBuffer. Only call this after you've + * called finish(). The actual data starts at the ByteBuffer's current position, + * not necessarily at 0. + * + * @returns {flatbuffers.ByteBuffer} + */ + dataBuffer(): ByteBuffer; + + /** + * Get the ByteBuffer representing the FlatBuffer. Only call this after you've + * called finish(). The actual data starts at the ByteBuffer's current position, + * not necessarily at 0. + * + * @returns {Uint8Array} + */ + asUint8Array(): Uint8Array; + + /** + * Prepare to write an element of `size` after `additional_bytes` have been + * written, e.g. if you write a string, you need to align such the int length + * field is aligned to 4 bytes, and the string data follows it directly. If all + * you need to do is alignment, `additional_bytes` will be 0. + * + * @param {number} size This is the of the new element to write + * @param {number} additional_bytes The padding size + */ + prep(size: number, additional_bytes: number): void; + + /** + * @param {number} byte_size + */ + pad(byte_size: number): void; + + /** + * @param {number} value + */ + writeInt8(value: number): void; + + /** + * @param {number} value + */ + writeInt16(value: number): void; + + /** + * @param {number} value + */ + writeInt32(value: number): void; + + /** + * @param {flatbuffers.Long} value + */ + writeInt64(value: Long): void; + + /** + * @param {number} value + */ + writeFloat32(value: number): void; + + /** + * @param {number} value + */ + writeFloat64(value: number): void; + + /** + * @param {number} value + */ + addInt8(value: number): void; + + /** + * @param {number} value + */ + addInt16(value: number): void; + + /** + * @param {number} value + */ + addInt32(value: number): void; + + /** + * @param {flatbuffers.Long} value + */ + addInt64(value: Long): void; + + /** + * @param {number} value + */ + addFloat32(value: number): void; + + /** + * @param {number} value + */ + addFloat64(value: number): void; + + /** + * @param {number} voffset + * @param {number} value + * @param {number} defaultValue + */ + addFieldInt8(voffset: number, value: number, defaultValue: number): void; + + /** + * @param {number} voffset + * @param {number} value + * @param {number} defaultValue + */ + addFieldInt16(voffset: number, value: number, defaultValue: number): void; + + /** + * @param {number} voffset + * @param {number} value + * @param {number} defaultValue + */ + addFieldInt32(voffset: number, value: number, defaultValue: number): void; + + /** + * @param {number} voffset + * @param {flatbuffers.Long} value + * @param {flatbuffers.Long} defaultValue + */ + addFieldInt64(voffset: number, value: Long, defaultValue: Long): void; + + /** + * @param {number} voffset + * @param {number} value + * @param {number} defaultValue + */ + addFieldFloat32(voffset: number, value: number, defaultValue: number): void; + + /** + * @param {number} voffset + * @param {number} value + * @param {number} defaultValue + */ + addFieldFloat64(voffset: number, value: number, defaultValue: number): void; + + /** + * @param {number} voffset + * @param {flatbuffers.Offset} value + * @param {flatbuffers.Offset} defaultValue + */ + addFieldOffset(voffset: number, value: Offset, defaultValue: Offset): void; + + /** + * Structs are stored inline, so nothing additional is being added. `d` is always 0. + * + * @param {number} voffset + * @param {flatbuffers.Offset} value + * @param {flatbuffers.Offset} defaultValue + */ + addFieldStruct(voffset: number, value: Offset, defaultValue: Offset): void; + + /** + * Structures are always stored inline, they need to be created right + * where they're used. You'll get this assertion failure if you + * created it elsewhere. + * + * @param {flatbuffers.Offset} obj The offset of the created object + */ + nested(obj: Offset): void; + + /** + * Should not be creating any other object, string or vector + * while an object is being constructed + */ + notNested(): void; + + /** + * Set the current vtable at `voffset` to the current location in the buffer. + * + * @param {number} voffset + */ + slot(voffset: number): void; + + /** + * @returns {flatbuffers.Offset} Offset relative to the end of the buffer. + */ + offset(): Offset; + + /** + * Doubles the size of the backing ByteBuffer and copies the old data towards + * the end of the new buffer (since we build the buffer backwards). + * + * @param {flatbuffers.ByteBuffer} bb The current buffer with the existing data + * @returns {flatbuffers.ByteBuffer} A new byte buffer with the old data copied + * to it. The data is located at the end of the buffer. + */ + static growByteBuffer(bb: ByteBuffer): ByteBuffer; + + /** + * Adds on offset, relative to where it will be written. + * + * @param {flatbuffers.Offset} offset The offset to add + */ + addOffset(offset: Offset): void; + + /** + * Start encoding a new object in the buffer. Users will not usually need to + * call this directly. The FlatBuffers compiler will generate helper methods + * that call this method internally. + * + * @param {number} numfields + */ + startObject(numfields: number): void; + + /** + * Finish off writing the object that is under construction. + * + * @returns {flatbuffers.Offset} The offset to the object inside `dataBuffer` + */ + endObject(): Offset; + + /** + * @param {flatbuffers.Offset} root_table + * @param {string=} file_identifier + */ + finish(root_table: Offset, file_identifier?: string): void; + + /** + * This checks a required field has been set in a given table that has + * just been constructed. + * + * @param {flatbuffers.Offset} table + * @param {number} field + */ + requiredField(table: Offset, field: number): void; + + /** + * Start a new array/vector of objects. Users usually will not call + * this directly. The FlatBuffers compiler will create a start/end + * method for vector types in generated code. + * + * @param {number} elem_size The size of each element in the array + * @param {number} num_elems The number of elements in the array + * @param {number} alignment The alignment of the array + */ + startVector(elem_size: number, num_elems: number, alignment: number): void; + + /** + * Finish off the creation of an array and all its elements. The array must be + * created with `startVector`. + * + * @returns {flatbuffers.Offset} The offset at which the newly created array + * starts. + */ + endVector(): Offset; + + /** + * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed + * instead of a string, it is assumed to contain valid UTF-8 encoded data. + * + * @param {string|Uint8Array} s The string to encode + * @return {flatbuffers.Offset} The offset in the buffer where the encoded string starts + */ + createString(s: string|Uint8Array): Offset; + + /** + * Conveniance function for creating Long objects. + * + * @param {number} low + * @param {number} high + * @returns {Long} + */ + createLong(low: number, high: number): Long; + } + + //////////////////////////////////////////////////////////////////////////////// + + class ByteBuffer { + /** + * @constructor + * @param {Uint8Array} bytes + */ + constructor(bytes: Uint8Array); + + /** + * @param {number} byte_size + * @returns {flatbuffers.ByteBuffer} + */ + static allocate(byte_size: number): ByteBuffer; + + /** + * @returns {Uint8Array} + */ + bytes(): Uint8Array; + + /** + * @returns {number} + */ + position(): number; + + /** + * @param {number} position + */ + setPosition(position: number): void; + + /** + * @returns {number} + */ + capacity(): number; + + /** + * @param {number} offset + * @returns {number} + */ + readInt8(offset: number): number; + + /** + * @param {number} offset + * @returns {number} + */ + readUint8(offset: number): number; + + /** + * @param {number} offset + * @returns {number} + */ + readInt16(offset: number): number; + + /** + * @param {number} offset + * @returns {number} + */ + readUint16(offset: number): number; + + /** + * @param {number} offset + * @returns {number} + */ + readInt32(offset: number): number; + + /** + * @param {number} offset + * @returns {number} + */ + readUint32(offset: number): number; + + /** + * @param {number} offset + * @returns {flatbuffers.Long} + */ + readInt64(offset: number): Long; + + /** + * @param {number} offset + * @returns {flatbuffers.Long} + */ + readUint64(offset: number): Long; + + /** + * @param {number} offset + * @returns {number} + */ + readFloat32(offset: number): number; + + /** + * @param {number} offset + * @returns {number} + */ + readFloat64(offset: number): number; + + /** + * @param {number} offset + * @param {number} value + */ + writeInt8(offset: number, value: number): void; + + /** + * @param {number} offset + * @param {number} value + */ + writeUint8(offset: number, value: number): void; + + /** + * @param {number} offset + * @param {number} value + */ + writeInt16(offset: number, value: number): void; + + /** + * @param {number} offset + * @param {number} value + */ + writeUint16(offset: number, value: number): void; + + /** + * @param {number} offset + * @param {number} value + */ + writeInt32(offset: number, value: number): void; + + /** + * @param {number} offset + * @param {number} value + */ + writeUint32(offset: number, value: number): void; + + /** + * @param {number} offset + * @param {flatbuffers.Long} value + */ + writeInt64(offset: number, value: Long): void; + + /** + * @param {number} offset + * @param {flatbuffers.Long} value + */ + writeUint64(offset: number, value: Long): void; + + /** + * @param {number} offset + * @param {number} value + */ + writeFloat32(offset: number, value: number): void; + + /** + * @param {number} offset + * @param {number} value + */ + writeFloat64(offset: number, value: number): void; + + /** + * Look up a field in the vtable, return an offset into the object, or 0 if the + * field is not present. + * + * @param {number} bb_pos + * @param {number} vtable_offset + * @returns {number} + */ + __offset(bb_pos: number, vtable_offset: number): number; + + /** + * Initialize any Table-derived type to point to the union at the given offset. + * + * @param {flatbuffers.Table} t + * @param {number} offset + * @returns {flatbuffers.Table} + */ + __union(t: T, offset: number): T; + + /** + * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer. + * This allocates a new string and converts to wide chars upon each access. + * + * To avoid the conversion to UTF-16, pass flatbuffers.Encoding.UTF8_BYTES as + * the "optionalEncoding" argument. This is useful for avoiding conversion to + * and from UTF-16 when the data will just be packaged back up in another + * FlatBuffer later on. + * + * @param {number} offset + * @param {flatbuffers.Encoding=} optionalEncoding Defaults to UTF16_STRING + * @returns {string|Uint8Array} + */ + __string(offset: number, optionalEncoding?: Encoding): string|Uint8Array; + + /** + * Retrieve the relative offset stored at "offset" + * @param {number} offset + * @returns {number} + */ + __indirect(offset: number): number; + + /** + * Get the start of data of a vector whose offset is stored at "offset" in this object. + * + * @param {number} offset + * @returns {number} + */ + __vector(offset: number): number; + + /** + * Get the length of a vector whose offset is stored at "offset" in this object. + * + * @param {number} offset + * @returns {number} + */ + __vector_len(offset: number): number; + + /** + * @param {string} ident + * @returns {boolean} + */ + __has_identifier(ident: string): boolean; + + /** + * Conveniance function for creating Long objects. + * + * @param {number} low + * @param {number} high + * @returns {Long} + */ + createLong(low: number, high: number): Long; + } } } diff --git a/types/flatbuffers/tslint.json b/types/flatbuffers/tslint.json index e013b93508..3db14f85ea 100644 --- a/types/flatbuffers/tslint.json +++ b/types/flatbuffers/tslint.json @@ -1,6 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "align": false - } -} +{ "extends": "dtslint/dt.json" } diff --git a/types/fluent-ffmpeg/fluent-ffmpeg-tests.ts b/types/fluent-ffmpeg/fluent-ffmpeg-tests.ts index 112d6de09b..e45f8ff855 100644 --- a/types/fluent-ffmpeg/fluent-ffmpeg-tests.ts +++ b/types/fluent-ffmpeg/fluent-ffmpeg-tests.ts @@ -1,5 +1,52 @@ -import ffmpeg = require("fluent-ffmpeg") +import ffmpeg = require('fluent-ffmpeg'); +import { createWriteStream } from 'fs'; -let source: string, format: string, output: string +const stream = createWriteStream('outputfile.divx'); -ffmpeg({ source: source }).format(format).save(output) +ffmpeg('/path/to/file.avi') + .output('outputfile.mp4') + .output(stream); + +ffmpeg('/path/to/file.avi') + // You may pass a pipe() options object when using a stream + .output(stream, { end: true }); + +// Output-related methods apply to the last output added +ffmpeg('/path/to/file.avi') + + .output('outputfile.mp4') + .audioCodec('libfaac') + .videoCodec('libx264') + .size('320x200') + + .output(stream) + .preset('divx') + .size('640x480'); + +// Use the run() method to run commands with multiple outputs +ffmpeg('/path/to/file.avi') + .output('outputfile.mp4') + .output(stream) + .on('end', () => { + console.log('Finished processing'); + }) + .run(); + +// Create a command to convert source.avi to MP4 +const command = ffmpeg('/path/to/source.avi') + .audioCodec('libfaac') + .videoCodec('libx264') + .format('mp4'); + +// Create a clone to save a small resized version +command.clone() + .size('320x200') + .save('/path/to/output-small.mp4'); + +// Create a clone to save a medium resized version +command.clone() + .size('640x400') + .save('/path/to/output-medium.mp4'); + +// Save a converted version with the original size +command.save('/path/to/output-original-size.mp4'); diff --git a/types/fluent-ffmpeg/index.d.ts b/types/fluent-ffmpeg/index.d.ts index 538ac71761..86004caec1 100644 --- a/types/fluent-ffmpeg/index.d.ts +++ b/types/fluent-ffmpeg/index.d.ts @@ -1,315 +1,307 @@ -// Type definitions for node-fluent-ffmpeg +// Type definitions for node-fluent-ffmpeg 2.1 // Project: https://github.com/fluent-ffmpeg/node-fluent-ffmpeg -// Definitions by: KIM Jaesuck a.k.a. gim tcaesvk +// Definitions by: KIM Jaesuck a.k.a. gim tcaesvk , DingWeizhe // Definitions: https://github.com/DefinitelyType/DefinitelyTyped /// -declare module "fluent-ffmpeg" { - import * as events from "events" - import * as stream from "stream" +import * as events from "events"; +import * as stream from "stream"; +declare namespace Ffmpeg { interface FfmpegCommandLogger { - error(...data: any[]): void - warning(...data: any[]): void - info(...data: any[]): void - debug(...data: any[]): void + error(...data: any[]): void; + warning(...data: any[]): void; + info(...data: any[]): void; + debug(...data: any[]): void; } interface FfmpegCommandOptions { - logger?: FfmpegCommandLogger - niceness?: number - priority?: number - presets?: string - preset?: string - stdoutLines?: number - timeout?: number - source?: string | stream.Readable + logger?: FfmpegCommandLogger; + niceness?: number; + priority?: number; + presets?: string; + preset?: string; + stdoutLines?: number; + timeout?: number; + source?: string | stream.Readable; } interface FilterSpecification { - filter: string - inputs: string | string[] - outputs: string | string[] - options?: Object | string | any[] + filter: string; + inputs: string | string[]; + outputs: string | string[]; + options?: any | string | any[]; } - interface GetPreset { - (command: FfmpegCommand): string - } + type GetPreset = (command: FfmpegCommand) => string; interface Filter { - description: string - input: string - multipleInputs: boolean - output: string - multipleOutputs: boolean + description: string; + input: string; + multipleInputs: boolean; + output: string; + multipleOutputs: boolean; } interface Filters { - [key: string]: Filter - } - interface FiltersCallback { - (err: Error, filters: Filters): void + [key: string]: Filter; } + type FiltersCallback = (err: Error, filters: Filters) => void; interface Codec { - type: string - description: string - canDecode: boolean - canEncode: boolean - drawHorizBand?: boolean - directRendering?: boolean - weirdFrameTruncation?: boolean - intraFrameOnly?: boolean - isLossy?: boolean - isLossless?: boolean + type: string; + description: string; + canDecode: boolean; + canEncode: boolean; + drawHorizBand?: boolean; + directRendering?: boolean; + weirdFrameTruncation?: boolean; + intraFrameOnly?: boolean; + isLossy?: boolean; + isLossless?: boolean; } interface Codecs { - [key: string]: Codec - } - interface CodecsCallback { - (err: Error, codecs: Codecs): void + [key: string]: Codec; } + type CodecsCallback = (err: Error, codecs: Codecs) => void; interface Encoder { - type: string - description: string - frameMT: boolean - sliceMT: boolean - experimental: boolean - drawHorizBand: boolean - directRendering: boolean + type: string; + description: string; + frameMT: boolean; + sliceMT: boolean; + experimental: boolean; + drawHorizBand: boolean; + directRendering: boolean; } interface Encoders { - [key: string]: Encoder - } - interface EncodersCallback { - (err: Error, encoders: Encoders): void + [key: string]: Encoder; } + type EncodersCallback = (err: Error, encoders: Encoders) => void; interface Format { - description: string - canDemux: boolean - canMux: boolean + description: string; + canDemux: boolean; + canMux: boolean; } interface Formats { - [key: string]: Format - } - interface FormatsCallback { - (err: Error, formats: Formats): void + [key: string]: Format; } + type FormatsCallback = (err: Error, formats: Formats) => void; interface FfprobeData { - stream: any[] - format: any - chapters: any[] + stream: any[]; + format: any; + chapters: any[]; } interface ScreenshotsConfig { - count?: number - folder?: string - filename?: string - timemarks?: number[] | string[] - timestamps?: number[] | string[] - fastSeek?: boolean - size?: string + count?: number; + folder?: string; + filename?: string; + timemarks?: number[] | string[]; + timestamps?: number[] | string[]; + fastSeek?: boolean; + size?: string; } - interface FfmpegCommand extends events.EventEmitter { - constructor(): FfmpegCommand - constructor(options: FfmpegCommandOptions): FfmpegCommand - constructor(input: string | stream.Readable, options: FfmpegCommandOptions): FfmpegCommand + class FfmpegCommand extends events.EventEmitter { + constructor(options?: FfmpegCommandOptions); + constructor(input?: string | stream.Readable, options?: FfmpegCommandOptions); // options/inputs - mergeAdd(source: string | stream.Readable): FfmpegCommand - addInput(source: string | stream.Readable): FfmpegCommand - input(source: string | stream.Readable): FfmpegCommand - withInputFormat(format: string): FfmpegCommand - inputFormat(format: string): FfmpegCommand - fromFormat(format: string): FfmpegCommand - withInputFps(fps: number): FfmpegCommand - withInputFPS(fps: number): FfmpegCommand - withFpsInput(fps: number): FfmpegCommand - withFPSInput(fps: number): FfmpegCommand - inputFPS(fps: number): FfmpegCommand - inputFps(fps: number): FfmpegCommand - fpsInput(fps: number): FfmpegCommand - FPSInput(fps: number): FfmpegCommand - nativeFramerate(): FfmpegCommand - withNativeFramerate(): FfmpegCommand - native(): FfmpegCommand - setStartTime(seek: string | number): FfmpegCommand - seekInput(seek: string | number): FfmpegCommand - loop(duration: string | number): FfmpegCommand + mergeAdd(source: string | stream.Readable): FfmpegCommand; + addInput(source: string | stream.Readable): FfmpegCommand; + input(source: string | stream.Readable): FfmpegCommand; + withInputFormat(format: string): FfmpegCommand; + inputFormat(format: string): FfmpegCommand; + fromFormat(format: string): FfmpegCommand; + withInputFps(fps: number): FfmpegCommand; + withInputFPS(fps: number): FfmpegCommand; + withFpsInput(fps: number): FfmpegCommand; + withFPSInput(fps: number): FfmpegCommand; + inputFPS(fps: number): FfmpegCommand; + inputFps(fps: number): FfmpegCommand; + fpsInput(fps: number): FfmpegCommand; + FPSInput(fps: number): FfmpegCommand; + nativeFramerate(): FfmpegCommand; + withNativeFramerate(): FfmpegCommand; + native(): FfmpegCommand; + setStartTime(seek: string | number): FfmpegCommand; + seekInput(seek: string | number): FfmpegCommand; + loop(duration: string | number): FfmpegCommand; // options/audio - withNoAudio(): FfmpegCommand - noAudio(): FfmpegCommand - withAudioCodec(codec: string): FfmpegCommand - audioCodec(codec: string): FfmpegCommand - withAudioBitrate(bitrate: string | number): FfmpegCommand - audioBitrate(bitrate: string | number): FfmpegCommand - withAudioChannels(channels: number): FfmpegCommand - audioChannels(channels: number): FfmpegCommand - withAudioFrequency(freq: number): FfmpegCommand - audioFrequency(freq: number): FfmpegCommand - withAudioQuality(quality: number): FfmpegCommand - audioQuality(quality: number): FfmpegCommand - withAudioFilter(filters: { filter: string, options: any }): FfmpegCommand - withAudioFilters(filters: { filter: string, options: any }): FfmpegCommand - audioFilter(filters: { filter: string, options: any }): FfmpegCommand - audioFilters(filters: { filter: string, options: any }): FfmpegCommand + withNoAudio(): FfmpegCommand; + noAudio(): FfmpegCommand; + withAudioCodec(codec: string): FfmpegCommand; + audioCodec(codec: string): FfmpegCommand; + withAudioBitrate(bitrate: string | number): FfmpegCommand; + audioBitrate(bitrate: string | number): FfmpegCommand; + withAudioChannels(channels: number): FfmpegCommand; + audioChannels(channels: number): FfmpegCommand; + withAudioFrequency(freq: number): FfmpegCommand; + audioFrequency(freq: number): FfmpegCommand; + withAudioQuality(quality: number): FfmpegCommand; + audioQuality(quality: number): FfmpegCommand; + withAudioFilter(filters: { filter: string, options: any }): FfmpegCommand; + withAudioFilters(filters: { filter: string, options: any }): FfmpegCommand; + audioFilter(filters: { filter: string, options: any }): FfmpegCommand; + audioFilters(filters: { filter: string, options: any }): FfmpegCommand; - // options/video - withNoVideo(): FfmpegCommand - noVideo(): FfmpegCommand - withVideoCodec(codec: string): FfmpegCommand - videoCodec(codec: string): FfmpegCommand - withVideoBitrate(bitrate: string | number): FfmpegCommand - videoBitrate(bitrate: string | number): FfmpegCommand - withVideoFilter(filters: { filter: string, options: any }): FfmpegCommand - withVideoFilters(filters: { filter: string, options: any }): FfmpegCommand - videoFilter(filters: { filter: string, options: any }): FfmpegCommand - videoFilters(filters: { filter: string, options: any }): FfmpegCommand - withOutputFps(fps: number): FfmpegCommand - withOutputFPS(fps: number): FfmpegCommand - withFpsOutput(fps: number): FfmpegCommand - withFPSOutput(fps: number): FfmpegCommand - withFps(fps: number): FfmpegCommand - withFPS(fps: number): FfmpegCommand - outputFPS(fps: number): FfmpegCommand - outputFps(fps: number): FfmpegCommand - fpsOutput(fps: number): FfmpegCommand - FPSOutput(fps: number): FfmpegCommand - fps(fps: number): FfmpegCommand - FPS(fps: number): FfmpegCommand - takeFrames(frames: number): FfmpegCommand - withFrames(frames: number): FfmpegCommand - frames(frames: number): FfmpegCommand + // options/video; + withNoVideo(): FfmpegCommand; + noVideo(): FfmpegCommand; + withVideoCodec(codec: string): FfmpegCommand; + videoCodec(codec: string): FfmpegCommand; + withVideoBitrate(bitrate: string | number): FfmpegCommand; + videoBitrate(bitrate: string | number): FfmpegCommand; + withVideoFilter(filters: { filter: string, options: any }): FfmpegCommand; + withVideoFilters(filters: { filter: string, options: any }): FfmpegCommand; + videoFilter(filters: { filter: string, options: any }): FfmpegCommand; + videoFilters(filters: { filter: string, options: any }): FfmpegCommand; + withOutputFps(fps: number): FfmpegCommand; + withOutputFPS(fps: number): FfmpegCommand; + withFpsOutput(fps: number): FfmpegCommand; + withFPSOutput(fps: number): FfmpegCommand; + withFps(fps: number): FfmpegCommand; + withFPS(fps: number): FfmpegCommand; + outputFPS(fps: number): FfmpegCommand; + outputFps(fps: number): FfmpegCommand; + fpsOutput(fps: number): FfmpegCommand; + FPSOutput(fps: number): FfmpegCommand; + fps(fps: number): FfmpegCommand; + FPS(fps: number): FfmpegCommand; + takeFrames(frames: number): FfmpegCommand; + withFrames(frames: number): FfmpegCommand; + frames(frames: number): FfmpegCommand; // options/videosize - keepPixelAspect(): FfmpegCommand - keepDisplayAspect(): FfmpegCommand - keepDisplayAspectRatio(): FfmpegCommand - keepDAR(): FfmpegCommand - withSize(size: string): FfmpegCommand - setSize(size: string): FfmpegCommand - size(size: string): FfmpegCommand - withAspect(aspect: string | number): FfmpegCommand - withAspectRatio(aspect: string | number): FfmpegCommand - setAspect(aspect: string | number): FfmpegCommand - setAspectRatio(aspect: string | number): FfmpegCommand - aspect(aspect: string | number): FfmpegCommand - aspectRatio(aspect: string | number): FfmpegCommand - applyAutopadding(pad: boolean, color: string): FfmpegCommand - applyAutoPadding(pad: boolean, color: string): FfmpegCommand - applyAutopad(pad: boolean, color: string): FfmpegCommand - applyAutoPad(pad: boolean, color: string): FfmpegCommand - withAutopadding(pad: boolean, color: string): FfmpegCommand - withAutoPadding(pad: boolean, color: string): FfmpegCommand - withAutopad(pad: boolean, color: string): FfmpegCommand - withAutoPad(pad: boolean, color: string): FfmpegCommand - autoPad(pad: boolean, color: string): FfmpegCommand - autopad(pad: boolean, color: string): FfmpegCommand + keepPixelAspect(): FfmpegCommand; + keepDisplayAspect(): FfmpegCommand; + keepDisplayAspectRatio(): FfmpegCommand; + keepDAR(): FfmpegCommand; + withSize(size: string): FfmpegCommand; + setSize(size: string): FfmpegCommand; + size(size: string): FfmpegCommand; + withAspect(aspect: string | number): FfmpegCommand; + withAspectRatio(aspect: string | number): FfmpegCommand; + setAspect(aspect: string | number): FfmpegCommand; + setAspectRatio(aspect: string | number): FfmpegCommand; + aspect(aspect: string | number): FfmpegCommand; + aspectRatio(aspect: string | number): FfmpegCommand; + applyAutopadding(pad: boolean, color: string): FfmpegCommand; + applyAutoPadding(pad: boolean, color: string): FfmpegCommand; + applyAutopad(pad: boolean, color: string): FfmpegCommand; + applyAutoPad(pad: boolean, color: string): FfmpegCommand; + withAutopadding(pad: boolean, color: string): FfmpegCommand; + withAutoPadding(pad: boolean, color: string): FfmpegCommand; + withAutopad(pad: boolean, color: string): FfmpegCommand; + withAutoPad(pad: boolean, color: string): FfmpegCommand; + autoPad(pad: boolean, color: string): FfmpegCommand; + autopad(pad: boolean, color: string): FfmpegCommand; // options/output - addOutput(target: string | stream.Writable, pipeopts?: { end?: boolean }): FfmpegCommand - output(target: string | stream.Writable, pipeopts?: { end?: boolean }): FfmpegCommand - seekOutput(seek: string | number): FfmpegCommand - seek(seek: string | number): FfmpegCommand - withDuration(duration: string | number): FfmpegCommand - setDuration(duration: string | number): FfmpegCommand - duration(duration: string | number): FfmpegCommand - toFormat(format: string): FfmpegCommand - withOutputFormat(format: string): FfmpegCommand - outputFormat(format: string): FfmpegCommand - format(format: string): FfmpegCommand - map(spec: string): FfmpegCommand - updateFlvMetadata(): FfmpegCommand - flvmeta(): FfmpegCommand + addOutput(target: string | stream.Writable, pipeopts?: { end?: boolean }): FfmpegCommand; + output(target: string | stream.Writable, pipeopts?: { end?: boolean }): FfmpegCommand; + seekOutput(seek: string | number): FfmpegCommand; + seek(seek: string | number): FfmpegCommand; + withDuration(duration: string | number): FfmpegCommand; + setDuration(duration: string | number): FfmpegCommand; + duration(duration: string | number): FfmpegCommand; + toFormat(format: string): FfmpegCommand; + withOutputFormat(format: string): FfmpegCommand; + outputFormat(format: string): FfmpegCommand; + format(format: string): FfmpegCommand; + map(spec: string): FfmpegCommand; + updateFlvMetadata(): FfmpegCommand; + flvmeta(): FfmpegCommand; + preset(format: string): FfmpegCommand; // options/custom - addInputOption(options: string[]): FfmpegCommand - addInputOption(...options: string[]): FfmpegCommand - addInputOptions(options: string[]): FfmpegCommand - addInputOptions(...options: string[]): FfmpegCommand - withInputOption(options: string[]): FfmpegCommand - withInputOption(...options: string[]): FfmpegCommand - withInputOptions(options: string[]): FfmpegCommand - withInputOptions(...options: string[]): FfmpegCommand - inputOption(options: string[]): FfmpegCommand - inputOption(...options: string[]): FfmpegCommand - inputOptions(options: string[]): FfmpegCommand - inputOptions(...options: string[]): FfmpegCommand - addOutputOption(options: string[]): FfmpegCommand - addOutputOption(...options: string[]): FfmpegCommand - addOutputOptions(options: string[]): FfmpegCommand - addOutputOptions(...options: string[]): FfmpegCommand - addOption(options: string[]): FfmpegCommand - addOption(...options: string[]): FfmpegCommand - addOptions(options: string[]): FfmpegCommand - addOptions(...options: string[]): FfmpegCommand - withOutputOption(options: string[]): FfmpegCommand - withOutputOption(...options: string[]): FfmpegCommand - withOutputOptions(options: string[]): FfmpegCommand - withOutputOptions(...options: string[]): FfmpegCommand - withOption(options: string[]): FfmpegCommand - withOption(...options: string[]): FfmpegCommand - withOptions(options: string[]): FfmpegCommand - withOptions(...options: string[]): FfmpegCommand - outputOption(options: string[]): FfmpegCommand - outputOption(...options: string[]): FfmpegCommand - outputOptions(options: string[]): FfmpegCommand - outputOptions(...options: string[]): FfmpegCommand - filterGraph(spec: string | FilterSpecification[], map: string[]): FfmpegCommand - complexFilter(spec: string | FilterSpecification[], map: string[]): FfmpegCommand + addInputOption(options: string[]): FfmpegCommand; + addInputOption(...options: string[]): FfmpegCommand; + addInputOptions(options: string[]): FfmpegCommand; + addInputOptions(...options: string[]): FfmpegCommand; + withInputOption(options: string[]): FfmpegCommand; + withInputOption(...options: string[]): FfmpegCommand; + withInputOptions(options: string[]): FfmpegCommand; + withInputOptions(...options: string[]): FfmpegCommand; + inputOption(options: string[]): FfmpegCommand; + inputOption(...options: string[]): FfmpegCommand; + inputOptions(options: string[]): FfmpegCommand; + inputOptions(...options: string[]): FfmpegCommand; + addOutputOption(options: string[]): FfmpegCommand; + addOutputOption(...options: string[]): FfmpegCommand; + addOutputOptions(options: string[]): FfmpegCommand; + addOutputOptions(...options: string[]): FfmpegCommand; + addOption(options: string[]): FfmpegCommand; + addOption(...options: string[]): FfmpegCommand; + addOptions(options: string[]): FfmpegCommand; + addOptions(...options: string[]): FfmpegCommand; + withOutputOption(options: string[]): FfmpegCommand; + withOutputOption(...options: string[]): FfmpegCommand; + withOutputOptions(options: string[]): FfmpegCommand; + withOutputOptions(...options: string[]): FfmpegCommand; + withOption(options: string[]): FfmpegCommand; + withOption(...options: string[]): FfmpegCommand; + withOptions(options: string[]): FfmpegCommand; + withOptions(...options: string[]): FfmpegCommand; + outputOption(options: string[]): FfmpegCommand; + outputOption(...options: string[]): FfmpegCommand; + outputOptions(options: string[]): FfmpegCommand; + outputOptions(...options: string[]): FfmpegCommand; + filterGraph(spec: string | FilterSpecification[], map: string[]): FfmpegCommand; + complexFilter(spec: string | FilterSpecification[], map: string[]): FfmpegCommand; // options/misc - usingPreset(proset: string | GetPreset): FfmpegCommand - pnreset(proset: string | GetPreset): FfmpegCommand + usingPreset(proset: string | GetPreset): FfmpegCommand; + pnreset(proset: string | GetPreset): FfmpegCommand; // processor - renice(niceness: number): FfmpegCommand - kill(signal: string): FfmpegCommand + renice(niceness: number): FfmpegCommand; + kill(signal: string): FfmpegCommand; // capabilities - setFfmpegPath(path: string): FfmpegCommand - setFfprobePath(path: string): FfmpegCommand - setFlvtoolPath(path: string): FfmpegCommand - availableFilters(callback: FiltersCallback): void - getAvailableFilters(callback: FiltersCallback): void - availableCodecs(callback: CodecsCallback): void - getAvailableCodecs(callback: CodecsCallback): void - availableEncoders(callback: EncodersCallback): void - getAvailableEncoders(callback: EncodersCallback): void - availableFormats(callback: FormatsCallback): void - getAvailableFormats(callback: FormatsCallback): void + setFfmpegPath(path: string): FfmpegCommand; + setFfprobePath(path: string): FfmpegCommand; + setFlvtoolPath(path: string): FfmpegCommand; + availableFilters(callback: FiltersCallback): void; + getAvailableFilters(callback: FiltersCallback): void; + availableCodecs(callback: CodecsCallback): void; + getAvailableCodecs(callback: CodecsCallback): void; + availableEncoders(callback: EncodersCallback): void; + getAvailableEncoders(callback: EncodersCallback): void; + availableFormats(callback: FormatsCallback): void; + getAvailableFormats(callback: FormatsCallback): void; // ffprobe - ffprobe(callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void - ffprobe(index: number, callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void - ffprobe(options: string[], callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void - ffprobe(index: number, options: string[], callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void + /* tslint:disable:unified-signatures */ + ffprobe(callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void; + ffprobe(index: number, callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void; + ffprobe(options: string[], callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void; + ffprobe(index: number, options: string[], callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void; + /* tslint:enable:unified-signatures */ // recipes - saveToFile(output: string): FfmpegCommand - save(output: string): FfmpegCommand - writeToStream(stream: stream.Writable, options?: { end?: boolean }): stream.Writable - pipe(stream: stream.Writable, options?: { end?: boolean }): stream.Writable - stream(stream: stream.Writable, options?: { end?: boolean }): stream.Writable - takeScreenshots(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand - thumbnail(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand - thumbnails(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand - screenshot(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand - screenshots(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand - mergeToFile(target: string | stream.Writable, options?: { end?: boolean }): FfmpegCommand - concatenate(target: string | stream.Writable, options?: { end?: boolean }): FfmpegCommand - concat(target: string | stream.Writable, options?: { end?: boolean }): FfmpegCommand + saveToFile(output: string): FfmpegCommand; + save(output: string): FfmpegCommand; + writeToStream(stream: stream.Writable, options?: { end?: boolean }): stream.Writable; + pipe(stream: stream.Writable, options?: { end?: boolean }): stream.Writable; + stream(stream: stream.Writable, options?: { end?: boolean }): stream.Writable; + takeScreenshots(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand; + thumbnail(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand; + thumbnails(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand; + screenshot(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand; + screenshots(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand; + mergeToFile(target: string | stream.Writable, options?: { end?: boolean }): FfmpegCommand; + concatenate(target: string | stream.Writable, options?: { end?: boolean }): FfmpegCommand; + concat(target: string | stream.Writable, options?: { end?: boolean }): FfmpegCommand; + clone(): FfmpegCommand; + run(): void; } - - function Ffmpeg(): FfmpegCommand - function Ffmpeg(options: FfmpegCommandOptions): FfmpegCommand - function Ffmpeg(input: string | stream.Readable, options: FfmpegCommandOptions): FfmpegCommand - - export = Ffmpeg } +declare function Ffmpeg(options?: Ffmpeg.FfmpegCommandOptions): Ffmpeg.FfmpegCommand; +declare function Ffmpeg(input?: string | stream.Readable, options?: Ffmpeg.FfmpegCommandOptions): Ffmpeg.FfmpegCommand; + +export = Ffmpeg; diff --git a/types/fluent-ffmpeg/tsconfig.json b/types/fluent-ffmpeg/tsconfig.json index 27024331f1..03dae683d6 100644 --- a/types/fluent-ffmpeg/tsconfig.json +++ b/types/fluent-ffmpeg/tsconfig.json @@ -1,22 +1,22 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "fluent-ffmpeg-tests.ts" - ] -} \ No newline at end of file + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "fluent-ffmpeg-tests.ts" + ] +} diff --git a/types/react-day-picker/tslint.json b/types/fluent-ffmpeg/tslint.json similarity index 100% rename from types/react-day-picker/tslint.json rename to types/fluent-ffmpeg/tslint.json diff --git a/types/flux/flux-tests.ts b/types/flux/flux-tests.ts deleted file mode 100644 index 57c8fb3b20..0000000000 --- a/types/flux/flux-tests.ts +++ /dev/null @@ -1,126 +0,0 @@ -import flux = require('flux') -import FluxUtils = require('flux/utils') -import React = require('react') - -var Component = React.Component -var Container = FluxUtils.Container - -// -// Basic dispatcher usage -// - -var basicDispatcher = new flux.Dispatcher() - -// register(callback: (payload: any) => void): string -var id: string = basicDispatcher.register((payload) => { - // payload is type: any - payload.anything -}) - -// unregister(id: string): void -basicDispatcher.unregister(id) - -// waitFor(ids: string[]): void -basicDispatcher.waitFor([id]) - -// dispatch(payload: any): void -basicDispatcher.dispatch({ msg: 'hello' }) - -// isDispatching(): boolean -var dispatcherIsDispatching: boolean = basicDispatcher.isDispatching() - -// -// Typed payload -// - -enum ActionSource { Server, View } -enum ActionType { Create, Update, Delete } - -interface Action { - source: ActionSource - type: ActionType - data: Object -} - -var typedDispatcher = new flux.Dispatcher() - -var typedPayload: Action - -var typedStore = { - dispatcherID: typedDispatcher.register((payload) => { - typedPayload = payload - }) -} - -typedDispatcher.dispatch(typedPayload) - -// -// Derived dispatcher -// - -class CustomDispatcher extends flux.Dispatcher { - - // Dispatch an action with server as source - handleServerAction(type: ActionType, data: Object) { - this.dispatch({ - source: ActionSource.Server, - type: type, - data: data, - }) - } - - // Dispatch an action with view as source - handleViewAction(type: ActionType, data: Object) { - this.dispatch({ - source: ActionSource.View, - type: type, - data: data, - }) - } -} - -var customDispatcher = new CustomDispatcher() - -export = customDispatcher - - -// Sample Reduce Store -class CounterStore extends FluxUtils.ReduceStore { - getInitialState(): number { - return 0; - } - - reduce(state: number, action: any): number { - switch (action.type) { - case 'increment': - return state + 1; - - case 'square': - return state * state; - - default: - return state; - } - } -} - -const Store = new CounterStore(basicDispatcher); - -// Sample Flux container with CounterStore -class CounterContainer extends Component { - static getStores() { - return [Store]; - } - - static calculateState(prevState: any) { - return { - counter: Store.getState(), - }; - } - - render() { - return this.state.counter; - } -} - -const container = Container.create(CounterContainer); diff --git a/types/flux/index.d.ts b/types/flux/index.d.ts index 54fecd3a4e..7380613ce7 100644 --- a/types/flux/index.d.ts +++ b/types/flux/index.d.ts @@ -1,69 +1,12 @@ -// Type definitions for Flux 3.0 +// Type definitions for Flux 3.1 // Project: http://facebook.github.io/flux/ -// Definitions by: Steve Baker , Giedrius Grabauskas +// Definitions by: Steve Baker +// Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.2 -/// -/// +import * as Dispatcher from "./lib/Dispatcher"; -export = Flux; - -declare namespace Flux { - - /** - * Dispatcher class - * Create an instance to use throughout the application. - * Or extend it to create a derived dispatcher class. - * - * Specify a type in the 'TPayload' generic argument to use strongly-typed payloads, - * otherwise specify 'any' - * - * Examples: - * var dispatcher = new flux.Dispatcher() - * var typedDispatcher = new flux.Dispatcher() - * class DerivedDispatcher extends flux.Dispatcher { } - */ - export class Dispatcher { - - /** - * Create an instance of the Dispatcher class to use throughout the application. - * - * Specify a type in the 'TPayload' generic argument to use strongly-typed payloads, - * otherwise specify 'any' - * - * Examples: - * var dispatcher = new flux.Dispatcher() - * var typedDispatcher = new flux.Dispatcher() - */ - constructor(); - - /** - * Registers a callback that will be invoked with every payload sent to the dispatcher. - * Returns a string token to identify the callback to be used with waitFor() or unregister. - */ - register(callback: (payload: TPayload) => void): string; - - /** - * Unregisters a callback with the given ID token - */ - unregister(id: string): void; - - /** - * Waits for the callbacks with the specified IDs to be invoked before continuing execution - * of the current callback. This method should only be used by a callback in response - * to a dispatched payload. - */ - waitFor(IDs: string[]): void; - - /** - * Dispatches a payload to all registered callbacks - */ - dispatch(payload: TPayload): void; - - /** - * Gets whether the dispatcher is currently dispatching - */ - isDispatching(): boolean; - } -} +export { + Dispatcher +}; diff --git a/types/flux/lib/Dispatcher.d.ts b/types/flux/lib/Dispatcher.d.ts new file mode 100644 index 0000000000..045d633088 --- /dev/null +++ b/types/flux/lib/Dispatcher.d.ts @@ -0,0 +1,45 @@ +declare namespace Dispatcher { } + +declare class Dispatcher { + /** + * Create an instance of the Dispatcher class to use throughout the application. + * + * Specify a type in the 'TPayload' generic argument to use strongly-typed payloads, + * otherwise specify 'any' + * + * Examples: + * var dispatcher = new flux.Dispatcher() + * var typedDispatcher = new flux.Dispatcher() + */ + constructor(); + + /** + * Registers a callback that will be invoked with every payload sent to the dispatcher. + * Returns a string token to identify the callback to be used with waitFor() or unregister. + */ + register(callback: (payload: TPayload) => void): string; + + /** + * Unregisters a callback with the given ID token + */ + unregister(id: string): void; + + /** + * Waits for the callbacks with the specified IDs to be invoked before continuing execution + * of the current callback. This method should only be used by a callback in response + * to a dispatched payload. + */ + waitFor(IDs: string[]): void; + + /** + * Dispatches a payload to all registered callbacks + */ + dispatch(payload: TPayload): void; + + /** + * Gets whether the dispatcher is currently dispatching + */ + isDispatching(): boolean; +} + +export = Dispatcher; diff --git a/types/flux/lib/FluxContainer.d.ts b/types/flux/lib/FluxContainer.d.ts new file mode 100644 index 0000000000..54b578cc1d --- /dev/null +++ b/types/flux/lib/FluxContainer.d.ts @@ -0,0 +1,65 @@ +import * as Dispatcher from "./Dispatcher"; +import * as FluxStore from "./FluxStore"; +import * as React from "react"; + +/** + * A FluxContainer is used to subscribe a react component to multiple stores. + * The stores that are used must be returned from a static `getStores()` method. + * + * The component receives information from the stores via state. The state + * is generated using a static `calculateState()` method that each container must implement. + */ +/** + * Default options to create a Container. + * + * @interface RealOptions + */ +export interface RealOptions { + /** + * Default value: true + * + * @type {boolean} + */ + pure?: boolean; + /** + * Default value: false + * + * @type {boolean} + */ + withProps?: boolean; + /** + * Default value: false + * + * @type {boolean} + */ + withContext?: boolean; +} + +export type ComponentConstructor = React.ComponentClass | React.StatelessComponent; + +export interface ComponentStatic { + getStores(maybeProps?: TProps, maybeContext?: TContext): Array>; + calculateState(prevState: TState, maybeProps?: TProps, maybeContext?: TContext): TState; +} + +export type Component = ComponentConstructor & ComponentStatic; + +/** + * Create is used to transform a react class into a container + * that updates its state when relevant stores change. + * The provided base class must have static methods getStores() and calculateState(). + */ +export function create(base: Component, options?: RealOptions): Component; +export function create(base: Component, options?: RealOptions): Component; +export function create(base: Component, options?: RealOptions): Component; +export function create(base: Component & TStatic, options?: RealOptions): Component & TStatic; + +/** + * This is a way to connect stores to a functional stateless view. + */ +export function createFunctional( + viewFn: (props: TProps) => React.ReactElement, + getStores: (maybeProps?: TProps, maybeContext?: any) => Array>, + calculateState: (prevState?: TState, maybeProps?: TProps, maybeContext?: any) => TState, + options?: RealOptions +): Component; diff --git a/types/flux/lib/FluxMixinLegacy.d.ts b/types/flux/lib/FluxMixinLegacy.d.ts new file mode 100644 index 0000000000..2ce825e3da --- /dev/null +++ b/types/flux/lib/FluxMixinLegacy.d.ts @@ -0,0 +1,26 @@ +import * as FluxStore from "./FluxStore"; + +declare namespace FluxMixinLegacy { + interface Options { + withProps?: boolean; + } +} + +/** + * `FluxContainer` should be preferred over this mixin, but it requires using + * react with classes. So this mixin is provided where it is not yet possible + * to convert a container to be a class. + * + * This mixin should be used for React components that have state based purely + * on stores. `this.props` will not be available inside of `calculateState()`. + * + * This mixin will only `setState` not replace it, so you should always return + * every key in your state unless you know what you are doing. + * + * On the second calculateState when prevState is not null, the state will be + * updated to contain the previous foo AND the bar that was just returned. Only + * returning bar will not delete foo. + */ +declare function FluxMixinLegacy(stores: Array>, options?: FluxMixinLegacy.Options): any; + +export = FluxMixinLegacy; diff --git a/types/flux/lib/FluxReduceStore.d.ts b/types/flux/lib/FluxReduceStore.d.ts new file mode 100644 index 0000000000..71a7968812 --- /dev/null +++ b/types/flux/lib/FluxReduceStore.d.ts @@ -0,0 +1,36 @@ +import * as Store from "./FluxStore"; + +declare namespace FluxReduceStore { } + +/** + * This is the basic building block of a Flux application. All of your stores + * should extend this class. + */ +declare abstract class FluxReduceStore extends Store { + /** + * Getter that exposes the entire state of this store. + * If your state is not immutable you should override this and not expose state directly. + */ + getState(): TState; + + /** + * Constructs the initial state for this store. + * This is called once during construction of the store. + */ + abstract getInitialState(): TState; + + /** + * Reduces the current state, and an action to the new state of this store. + * All subclasses must implement this method. + * This method should be pure and have no side-effects. + */ + abstract reduce(state: TState, action: TPayload): TState; + + /** + * Checks if two versions of state are the same. + * You do not need to override this if your state is immutable. + */ + areEqual(one: TState, two: TState): boolean; +} + +export = FluxReduceStore; diff --git a/types/flux/lib/FluxStore.d.ts b/types/flux/lib/FluxStore.d.ts new file mode 100644 index 0000000000..a0b2384c72 --- /dev/null +++ b/types/flux/lib/FluxStore.d.ts @@ -0,0 +1,74 @@ +import * as Dispatcher from "./Dispatcher"; +import * as fbEmitter from "fbemitter"; + +declare namespace FluxStore { } + +/** + * This class represents the most basic functionality for a FluxStore. Do not + * extend this store directly; instead extend FluxReduceStore when creating a + * new store. + */ +declare abstract class FluxStore { + /** + * Constructs and registers an instance of this store with the given dispatcher. + */ + constructor(dispatcher: Dispatcher); + + /** + * Adds a listener to the store, when the store changes the given callback will be called. + * A token is returned that can be used to remove the listener. + * Calling the remove() function on the returned token will remove the listener. + */ + addListener(callback: () => void): fbEmitter.EventSubscription; + + /** + * Returns the dispatcher this store is registered with. + */ + getDispatcher(): Dispatcher; + + /** + * Returns the dispatch token that the dispatcher recognizes this store by. + * Can be used to waitFor() this store. + */ + getDispatchToken(): string; + + /** + * Ask if a store has changed during the current dispatch. + * Can only be invoked while dispatching. + * This can be used for constructing derived stores that depend on data from other stores. + */ + hasChanged(): boolean; + + /** + * Emit an event notifying all listeners that this store has changed. + * This can only be invoked when dispatching. + * Changes are de-duplicated and resolved at the end of this store's __onDispatch function. + */ + protected __emitChange(): void; + + /** + * This method encapsulates all logic for invoking __onDispatch. It should + * be used for things like catching changes and emitting them after the + * subclass has handled a payload. + */ + protected __invokeOnDispatch(payload: TPayload): void; + + /** + * Subclasses must override this method. + * This is how the store receives actions from the dispatcher. + * All state mutation logic must be done during this method. + */ + protected __onDispatch(payload: TPayload): void; + + protected __changed: boolean; + + protected __changeEvent: string; + + protected __className: string; + + protected __dispatcher: Dispatcher; + + protected __emitter: fbEmitter.EventEmitter; +} + +export = FluxStore; diff --git a/types/flux/test/Flux.ts b/types/flux/test/Flux.ts new file mode 100644 index 0000000000..6666b830aa --- /dev/null +++ b/types/flux/test/Flux.ts @@ -0,0 +1,71 @@ +import { Dispatcher } from "flux"; + +enum ActionSource { + Server, + View +} +enum ActionType { + Create, + Update, + Delete +} + +interface Action { + source: ActionSource; + type: ActionType; + data: {}; +} + +function dispatcherCallback(payload: Action) { + let source: ActionSource = payload.source; + let type: ActionType = payload.type; + let data: {} = payload.data; +} + +let dispatcherIsDispatching: boolean; +let dispatcherToken: string; + +const actionPayload = { + data: {}, + source: ActionSource.Server, + type: ActionType.Create +}; + +/** + * Basic dispatcher + */ +const basicDispatcher: Dispatcher = new Dispatcher(); +dispatcherToken = basicDispatcher.register(dispatcherCallback); +basicDispatcher.unregister(dispatcherToken); +basicDispatcher.waitFor([dispatcherToken]); +basicDispatcher.dispatch(actionPayload); +dispatcherIsDispatching = basicDispatcher.isDispatching(); + +/** + * Custom dispatcher + */ +class CustomDispatcher extends Dispatcher { + // Dispatch an action with server as source + handleServerAction(type: ActionType, data: {}) { + this.dispatch({ + source: ActionSource.Server, + type, + data + }); + } + // Dispatch an action with view as source + handleViewAction(type: ActionType, data: {}) { + this.dispatch({ + source: ActionSource.View, + type, + data + }); + } +} + +const customDispatcher: CustomDispatcher = new CustomDispatcher(); +dispatcherToken = customDispatcher.register(dispatcherCallback); +customDispatcher.unregister(dispatcherToken); +customDispatcher.dispatch(actionPayload); +customDispatcher.waitFor([dispatcherToken]); +dispatcherIsDispatching = customDispatcher.isDispatching(); diff --git a/types/flux/test/FluxUtils.tsx b/types/flux/test/FluxUtils.tsx new file mode 100644 index 0000000000..1cd3705fab --- /dev/null +++ b/types/flux/test/FluxUtils.tsx @@ -0,0 +1,80 @@ +import { Dispatcher } from "flux"; +import { ReduceStore, Container } from "flux/utils"; +import * as React from "react"; + +interface Payload { + type: string; +} + +const basicDispatcher = new Dispatcher(); + +// Sample Reduce Store +class CounterStore extends ReduceStore { + getInitialState(): number { + return 0; + } + + reduce(state: number, action: Payload): number { + switch (action.type) { + case 'increment': + return state + 1; + case 'square': + return state * state; + default: + return state; + } + } +} +const Store = new CounterStore(basicDispatcher); + +// Sample Flux container with Store +interface Props { + a: string; + b: boolean; +} + +interface State { + counter: number; +} + +class CounterContainer extends React.Component { + static getStores() { + return [Store]; + } + + static a: string = "asd"; + + static calculateState(prevState: State, props: Props): State { + return { + counter: Store.getState() - (props.b ? 0 : 1) + }; + } + + render() { + return
    + {this.state.counter} +
    ; + } +} + +const ContainerComponent1 = Container.create(CounterContainer, { withProps: true }); +; + +const ContainerComponent2 = Container.create(CounterContainer, { withProps: true }); +; + +const ContainerComponent3 = Container.create(CounterContainer, { withProps: true }); +; + +// Functional flux container with Store +const FunctionalContainerComponent = Container.createFunctional( + (props) => { + return
    + {props.a} {props.b} +
    ; + }, + () => [Store], + (prevState) => ({ counter: Store.getState() }) +); + +; diff --git a/types/flux/tsconfig.json b/types/flux/tsconfig.json index 45255c7d7a..540faa9d2b 100644 --- a/types/flux/tsconfig.json +++ b/types/flux/tsconfig.json @@ -5,20 +5,27 @@ "es6", "dom" ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ "../" ], + "jsx": "react", "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "forceConsistentCasingInFileNames": true, + "noEmit": true }, "files": [ "index.d.ts", - "utils/index.d.ts", - "flux-tests.ts" + "utils.d.ts", + "lib/Dispatcher.d.ts", + "lib/FluxContainer.d.ts", + "lib/FluxMixinLegacy.d.ts", + "lib/FluxReduceStore.d.ts", + "lib/FluxStore.d.ts", + "test/Flux.ts", + "test/FluxUtils.tsx" ] } \ No newline at end of file diff --git a/types/flux/tslint.json b/types/flux/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/flux/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/flux/utils.d.ts b/types/flux/utils.d.ts new file mode 100644 index 0000000000..4eb3d96e99 --- /dev/null +++ b/types/flux/utils.d.ts @@ -0,0 +1,11 @@ +import * as Container from "./lib/FluxContainer"; +import * as Mixin from "./lib/FluxMixinLegacy"; +import * as ReduceStore from "./lib/FluxReduceStore"; +import * as Store from "./lib/FluxStore"; + +export { + Container, + Mixin, + ReduceStore, + Store +}; diff --git a/types/flux/utils/index.d.ts b/types/flux/utils/index.d.ts deleted file mode 100644 index b223945181..0000000000 --- a/types/flux/utils/index.d.ts +++ /dev/null @@ -1,140 +0,0 @@ -// Type definitions for Flux Utils 3.0 -// Project: http://facebook.github.io/flux/ -// Definitions by: Steve Baker , Giedrius Grabauskas -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// -/// - -import * as React from 'react'; -import * as Flux from 'flux'; -import * as fbEmitter from 'fbemitter'; - -export = FluxUtils; - -declare namespace FluxUtils { - /** - * Default options to create a Container with - * - * @interface RealOptions - */ - interface RealOptions { - /** - * Default value: true - * - * @type {boolean} - */ - pure?: boolean; - /** - * Default value: false - * - * @type {boolean} - */ - withProps?: boolean; - /** - * Default value: false - * - * @type {boolean} - */ - withContext?: boolean; - } - - export class Container { - constructor(); - /** - * Create is used to transform a react class into a container - * that updates its state when relevant stores change. - * The provided base class must have static methods getStores() and calculateState(). - */ - static create(base: React.ComponentClass, options?: RealOptions): React.ComponentClass; - - - - /** - * This is a way to connect stores to a functional stateless view - */ - static createFunctional( - viewFn: (props: State) => React.ReactElement, - getStores: (props?: Props, context?: any) => FluxUtils.Store[], - calculateState: (prevState?: State, props?: Props, context?: any) => State, - options?: RealOptions - ): React.ComponentClass; - } - - export class ReduceStore extends Store { - /** - * Getter that exposes the entire state of this store. - * If your state is not immutable you should override this and not expose state directly. - */ - getState(): T; - - /** - * Constructs the initial state for this store. - * This is called once during construction of the store. - */ - getInitialState(): T; - - /** - * Reduces the current state, and an action to the new state of this store. - * All subclasses must implement this method. - * This method should be pure and have no side-effects. - */ - reduce(state: T, action: TPayload): T; - - /** - * Checks if two versions of state are the same. - * You do not need to override this if your state is immutable. - */ - areEqual(one: T, two: T): boolean; - - } - - export class Store { - - /** - * Constructs and registers an instance of this store with the given dispatcher. - */ - constructor(dispatcher: Flux.Dispatcher); - - /** - * Adds a listener to the store, when the store changes the given callback will be called. - * A token is returned that can be used to remove the listener. - * Calling the remove() function on the returned token will remove the listener. - */ - addListener(callback: Function): fbEmitter.EventSubscription; - - /** - * Returns the dispatcher this store is registered with. - */ - getDispatcher(): Flux.Dispatcher; - - /** - * Returns the dispatch token that the dispatcher recognizes this store by. - * Can be used to waitFor() this store. - */ - getDispatchToken(): string; - - /** - * Ask if a store has changed during the current dispatch. - * Can only be invoked while dispatching. - * This can be used for constructing derived stores that depend on data from other stores. - */ - hasChanged(): boolean; - - /** - *Emit an event notifying all listeners that this store has changed. - * This can only be invoked when dispatching. - * Changes are de-duplicated and resolved at the end of this store's __onDispatch function. - */ - __emitChange(): void; - - /** - * Subclasses must override this method. - * This is how the store receives actions from the dispatcher. - * All state mutation logic must be done during this method. - */ - __onDispatch(payload: TPayload): void; - } -} - diff --git a/types/forever-monitor/index.d.ts b/types/forever-monitor/index.d.ts index cd5869f6d3..caa921fa1a 100644 --- a/types/forever-monitor/index.d.ts +++ b/types/forever-monitor/index.d.ts @@ -35,7 +35,7 @@ export interface Options { parser?(command: string, args: string[]): { command: string, args: string[] }; } -export function start(script: string, options?: Options): Monitor; +export function start(script: string | string[], options?: Options): Monitor; export function kill(pid: number, killTree?: boolean, signal?: string, callback?: () => any): void; export function checkProcess(pid: number): boolean; export const version: string; @@ -45,7 +45,7 @@ export class Monitor extends NodeJS.EventEmitter { * @param script - Location of the target script to run. * @param [options] - Configuration for this instance. */ - constructor(script: string, options?: Options); + constructor(script: string | string[], options?: Options); /** * @description Start the process that this instance is configured for diff --git a/types/fs-extra-promise/fs-extra-promise-tests.ts b/types/fs-extra-promise/fs-extra-promise-tests.ts index cd17429fe4..ef8de43ad3 100644 --- a/types/fs-extra-promise/fs-extra-promise-tests.ts +++ b/types/fs-extra-promise/fs-extra-promise-tests.ts @@ -180,17 +180,17 @@ str = fs.readFileSync(filename, encoding); buf = fs.readFileSync(filename, openOpts); fs.writeFile(filename, data, errorCallback); -fs.writeFile(filename, data, encoding, errorCallback); +fs.writeFile(filename, data, { encoding }, errorCallback); fs.writeFile(filename, data, writeOpts, errorCallback); fs.writeFileSync(filename, data); -fs.writeFileSync(filename, data, encoding); +fs.writeFileSync(filename, data, { encoding }); fs.writeFileSync(filename, data, writeOpts); fs.appendFile(filename, data, errorCallback); -fs.appendFile(filename, data, encoding, errorCallback); +fs.appendFile(filename, data, { encoding }, errorCallback); fs.appendFile(filename, data, writeOpts, errorCallback); fs.appendFileSync(filename, data); -fs.appendFileSync(filename, data, encoding); +fs.appendFileSync(filename, data, { encoding }); fs.appendFileSync(filename, data, writeOpts); fs.watchFile(filename, watchListener); diff --git a/types/fs-extra-promise/index.d.ts b/types/fs-extra-promise/index.d.ts index a03512a577..b4c9a648ac 100644 --- a/types/fs-extra-promise/index.d.ts +++ b/types/fs-extra-promise/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/overlookmotel/fs-extra-promise // Definitions by: midknight41 , Jason Swearingen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// /// @@ -10,10 +11,15 @@ import * as stream from 'stream'; import { Stats } from 'fs'; import * as Promise from 'bluebird'; -import { CopyFilter, CopyOptions, ReadOptions, WriteOptions, MkdirOptions, MoveOptions } from 'fs-extra'; +import { CopyFilter, CopyOptions, ReadOptions, WriteOptions, MoveOptions } from 'fs-extra'; export * from 'fs-extra'; +export interface MkdirOptions { + fs?: any; + mode?: number; +} + //promisified versions export declare function copyAsync(src: string, dest: string): Promise; export declare function copyAsync(src: string, dest: string, filter: CopyFilter): Promise; diff --git a/types/fs-extra/fs-extra-tests.ts b/types/fs-extra/fs-extra-tests.ts index d39cae8d6f..39f3a9d37a 100644 --- a/types/fs-extra/fs-extra-tests.ts +++ b/types/fs-extra/fs-extra-tests.ts @@ -1,106 +1,220 @@ import * as fs from 'fs-extra'; import * as Path from 'path'; +const len = 2; const src = ""; const dest = ""; const file = ""; const dir = ""; const path = ""; const data = ""; +const uid = 0; +const gid = 0; +const fd = 0; +const modeNum = 0; +const modeStr = ""; const object = {}; -const errorCallback = (err: Error) => {}; +const errorCallback = (err: Error) => { }; const readOptions: fs.ReadOptions = { - reviver : {} + reviver: {} }; const writeOptions: fs.WriteOptions = { - replacer: {} + replacer: {} }; +fs.moveSync(src, dest, {}); +fs.move(src, dest, {}).then(() => { + // stub +}); +fs.move(src, dest).then(() => { + // stub +}); +fs.move(src, dest, {}, () => { + // stub +}); +fs.move(src, dest, () => { + // stub +}); + +fs.copy(src, dest).then(() => { + // stub +}); +fs.copy(src, dest, { overwrite: true }).then(() => { + // stub +}); fs.copy(src, dest, errorCallback); -fs.copy(src, dest, (src: string) => { - return false; -}, errorCallback); +fs.copy(src, dest, (src: string) => false, errorCallback); fs.copy(src, dest, { - clobber: true, + overwrite: true, preserveTimestamps: true, - filter: (src: string) => { return false; } + filter: (src: string) => false }, errorCallback ); fs.copy(src, dest, { - clobber: true, + overwrite: true, preserveTimestamps: true, filter: /.*/ }, errorCallback ); fs.copySync(src, dest); -fs.copySync(src, dest, (src: string) => { - return false; -}); -fs.copySync(src, dest, /.*/); +fs.copySync(src, dest, (src: string) => false); +fs.copySync(src, dest, { filter: /.*/ }); fs.copySync(src, dest, { - clobber: true, + overwrite: true, preserveTimestamps: true, - filter: (src: string) => { return false; } + filter: (src: string) => false } ); fs.copySync(src, dest, { - clobber: true, + overwrite: true, preserveTimestamps: true, filter: /.*/ } ); +fs.createFile(file).then(() => { + // stub +}); fs.createFile(file, errorCallback); fs.createFileSync(file); +fs.mkdirs(dir).then(() => { + // stub +}); +fs.mkdirp(dir).then(() => { + // stub +}); fs.mkdirs(dir, errorCallback); -fs.mkdirs(dir, {}, errorCallback); fs.mkdirsSync(dir); -fs.mkdirsSync(dir, {}); fs.mkdirp(dir, errorCallback); -fs.mkdirp(dir, {}, errorCallback); fs.mkdirpSync(dir); -fs.mkdirpSync(dir, {}); +fs.outputFile(file, data).then(() => { + // stub +}); fs.outputFile(file, data, errorCallback); fs.outputFileSync(file, data); -fs.outputJson(file, data, errorCallback); + +fs.outputJson(file, data, { + spaces: 2 +}).then(() => { + // stub +}); +fs.outputJson(file, data, { + spaces: 2 +}, errorCallback); fs.outputJSON(file, data, errorCallback); +fs.outputJSON(file, data).then(() => { + // stub +}); fs.outputJsonSync(file, data); fs.outputJSONSync(file, data); -fs.readJson(file, (error: Error, jsonObject: any) => {}); -fs.readJson(file, readOptions, (error: Error, jsonObject: any) => {}); -fs.readJSON(file, (error: Error, jsonObject: any) => {}); -fs.readJSON(file, readOptions, (error: Error, jsonObject: any) => {}); +fs.readJson(file).then(() => { + // stub +}); + +fs.readJson(file, readOptions).then(() => { + // stub +}); +fs.readJson(file, (error: Error, jsonObject: any) => { }); +fs.readJson(file, readOptions, (error: Error, jsonObject: any) => { }); +fs.readJSON(file, (error: Error, jsonObject: any) => { }); +fs.readJSON(file, readOptions, (error: Error, jsonObject: any) => { }); fs.readJsonSync(file, readOptions); fs.readJSONSync(file, readOptions); fs.remove(dir, errorCallback); +fs.remove(dir).then(() => { + // stub +}); fs.removeSync(dir); +fs.writeJson(file, object).then(() => { + // stub +}); +fs.writeJSON(file, object).then(() => { + // stub +}); fs.writeJson(file, object, errorCallback); fs.writeJson(file, object, writeOptions, errorCallback); fs.writeJSON(file, object, errorCallback); fs.writeJSON(file, object, writeOptions, errorCallback); - +fs.writeJson(file, object, writeOptions).then(() => { + // stub +}); +fs.writeJSON(file, object, writeOptions).then(() => { + // stub +}); fs.writeJsonSync(file, object, writeOptions); fs.writeJSONSync(file, object, writeOptions); +fs.ensureDir(path).then(() => { + // stub +}); fs.ensureDir(path, errorCallback); fs.ensureDirSync(path); + +fs.ensureFile(path).then(() => { + // stub +}); fs.ensureFile(path, errorCallback); fs.ensureFileSync(path); -fs.ensureLink(path, errorCallback); -fs.ensureLinkSync(path); -fs.ensureSymlink(path, errorCallback); -fs.ensureSymlinkSync(path); +fs.ensureLink(path, path).then(() => { + // stub +}); +fs.ensureLink(path, path, errorCallback); +fs.ensureLinkSync(path, path); +fs.ensureSymlink(path, path, "file").then(() => { + // stub +}); +fs.ensureSymlink(path, path, errorCallback); +fs.ensureSymlinkSync(path, path); +fs.emptyDir(path).then(() => { + // stub +}); fs.emptyDir(path, errorCallback); fs.emptyDirSync(path); +fs.pathExists(path).then((_exist: boolean) => { + // stub +}); +fs.pathExists(path, (_err: Error, _exists: boolean) => { }); +const x: boolean = fs.pathExistsSync(path); + +fs.rename(src, dest, errorCallback); +fs.renameSync(src, dest); +fs.truncate(path, len, errorCallback); +fs.truncateSync(path, len); +fs.chown(path, uid, gid, errorCallback); +fs.chownSync(path, uid, gid); +fs.fchown(fd, uid, gid, errorCallback); +fs.fchownSync(fd, uid, gid); +fs.lchown(path, uid, gid, errorCallback); +fs.lchownSync(path, uid, gid); +fs.chmod(path, modeNum, errorCallback); +fs.chmod(path, modeStr, errorCallback); +fs.chmodSync(path, modeNum); +fs.chmodSync(path, modeStr); +fs.fchmod(fd, modeNum, errorCallback); +fs.fchmod(fd, modeStr, errorCallback); +fs.fchmodSync(fd, modeNum); +fs.fchmodSync(fd, modeStr); +fs.lchmod(path, modeStr, errorCallback); +fs.lchmod(path, modeNum, errorCallback); +fs.lchmodSync(path, modeNum); +fs.lchmodSync(path, modeStr); +fs.statSync(path); +fs.lstatSync(path); + +// $ExpectType Promise +fs.writeFile("foo.txt", "i am foo", { encoding: "utf-8" }); + +// $ExpectType Promise +fs.mkdtemp("foo"); diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts index c46dddba85..49a056bce7 100644 --- a/types/fs-extra/index.d.ts +++ b/types/fs-extra/index.d.ts @@ -1,9 +1,11 @@ -// Type definitions for fs-extra 2.1 +// Type definitions for fs-extra 3.0 // Project: https://github.com/jprichardson/node-fs-extra -// Definitions by: midknight41 , Brendan Forster +// Definitions by: Alan Agius , +// midknight41 , +// Brendan Forster , +// Mees van Dijk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -// Imported from: https://github.com/soywiz/typescript-node-definitions/fs-extra.d.ts +// TypeScript Version: 2.2 /// @@ -11,123 +13,256 @@ import { Stats } from "fs"; export * from "fs"; -export declare function copy(src: string, dest: string, callback?: (err: Error) => void): void; -export declare function copy(src: string, dest: string, filter: CopyFilter, callback?: (err: Error) => void): void; -export declare function copy(src: string, dest: string, options: CopyOptions, callback?: (err: Error) => void): void; +export function copy(src: string, dest: string, options?: CopyOptions): Promise; +export function copy(src: string, dest: string, callback: (err: Error) => void): void; +export function copy(src: string, dest: string, options: CopyOptions, callback: (err: Error) => void): void; +export function copySync(src: string, dest: string, options?: CopyOptions): void; -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 function move(src: string, dest: string, options?: MoveOptions): Promise; +export function move(src: string, dest: string, callback: (err: Error) => void): void; +export function move(src: string, dest: string, options: MoveOptions, callback: (err: Error) => void): void; +export function moveSync(src: string, dest: string, options?: MoveOptions): 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 function createFile(file: string): Promise; +export function createFile(file: string, callback: (err: Error) => void): void; +export function createFileSync(file: string): void; -export declare function createFile(file: string, callback?: (err: Error) => void): void; -export declare function createFileSync(file: string): void; +export function ensureDir(path: string): Promise; +export function ensureDir(path: string, callback: (err: Error) => void): void; +export function ensureDirSync(path: string): void; -export declare function mkdirs(dir: string, callback?: (err: Error) => void): void; -export declare function mkdirp(dir: string, callback?: (err: Error) => void): void; -export declare function mkdirs(dir: string, options?: MkdirOptions, callback?: (err: Error) => void): void; -export declare function mkdirp(dir: string, options?: MkdirOptions, callback?: (err: Error) => void): void; -export declare function mkdirsSync(dir: string, options?: MkdirOptions): void; -export declare function mkdirpSync(dir: string, options?: MkdirOptions): void; +export function mkdirs(dir: string): Promise; +export function mkdirs(dir: string, callback: (err: Error) => void): void; +export function mkdirp(dir: string): Promise; +export function mkdirp(dir: string, callback: (err: Error) => void): void; +export function mkdirsSync(dir: string): void; +export function mkdirpSync(dir: string): void; -export declare function outputFile(file: string, data: any, callback?: (err: Error) => void): void; -export declare function outputFileSync(file: string, data: any): void; +export function outputFile(file: string, data: any): Promise; +export function outputFile(file: string, data: any, callback: (err: Error) => void): void; +export function outputFileSync(file: string, data: any): void; -export declare function outputJson(file: string, data: any, callback?: (err: Error) => void): void; -export declare function outputJSON(file: string, data: any, callback?: (err: Error) => void): void; -export declare function outputJsonSync(file: string, data: any): void; -export declare function outputJSONSync(file: string, data: any): void; +export function readJson(file: string, options?: ReadOptions): Promise; +export function readJson(file: string, callback: (err: Error, jsonObject: any) => void): void; +export function readJson(file: string, options: ReadOptions, callback: (err: Error, jsonObject: any) => void): void; +export function readJSON(file: string, options?: ReadOptions): Promise; +export function readJSON(file: string, callback: (err: Error, jsonObject: any) => void): void; +export function readJSON(file: string, options: ReadOptions, callback: (err: Error, jsonObject: any) => void): void; -export declare function readJson(file: string, callback: (err: Error, jsonObject: any) => void): void; -export declare function readJson(file: string, options: ReadOptions, callback: (err: Error, jsonObject: any) => void): void; -export declare function readJSON(file: string, callback: (err: Error, jsonObject: any) => void): void; -export declare function readJSON(file: string, options: ReadOptions, callback: (err: Error, jsonObject: any) => void): void; +export function readJsonSync(file: string, options?: ReadOptions): any; +export function readJSONSync(file: string, options?: ReadOptions): any; -export declare function readJsonSync(file: string, options?: ReadOptions): any; -export declare function readJSONSync(file: string, options?: ReadOptions): any; +export function remove(dir: string): Promise; +export function remove(dir: string, callback: (err: Error) => void): void; +export function removeSync(dir: string): void; -export declare function remove(dir: string, callback?: (err: Error) => void): void; -export declare function removeSync(dir: string): void; +export function outputJSON(file: string, data: any, options?: WriteOptions): Promise; +export function outputJSON(file: string, data: any, options: WriteOptions, callback: (err: Error) => void): void; +export function outputJSON(file: string, data: any, callback: (err: Error) => void): void; +export function outputJson(file: string, data: any, options?: WriteOptions): Promise; +export function outputJson(file: string, data: any, options: WriteOptions, callback: (err: Error) => void): void; +export function outputJson(file: string, data: any, callback: (err: Error) => void): void; +export function outputJsonSync(file: string, data: any, options?: WriteOptions): void; +export function outputJSONSync(file: string, data: any, options?: WriteOptions): void; -export declare function writeJson(file: string, object: any, callback?: (err: Error) => void): void; -export declare function writeJson(file: string, object: any, options?: WriteOptions, callback?: (err: Error) => void): void; -export declare function writeJSON(file: string, object: any, callback?: (err: Error) => void): void; -export declare function writeJSON(file: string, object: any, options?: WriteOptions, callback?: (err: Error) => void): void; +export function writeJSON(file: string, object: any, options?: WriteOptions): Promise; +export function writeJSON(file: string, object: any, callback: (err: Error) => void): void; +export function writeJSON(file: string, object: any, options: WriteOptions, callback: (err: Error) => void): void; +export function writeJson(file: string, object: any, options?: WriteOptions): Promise; +export function writeJson(file: string, object: any, callback: (err: Error) => void): void; +export function writeJson(file: string, object: any, options: WriteOptions, callback: (err: Error) => void): void; -export declare function writeJsonSync(file: string, object: any, options?: WriteOptions): void; -export declare function writeJSONSync(file: string, object: any, options?: WriteOptions): void; +export function writeJsonSync(file: string, object: any, options?: WriteOptions): void; +export function writeJSONSync(file: string, object: any, options?: WriteOptions): void; -export declare function ensureDir(path: string, callback: (err: Error) => void): void; -export declare function ensureDirSync(path: string): void; +export function ensureFile(path: string): Promise; +export function ensureFile(path: string, callback: (err: Error) => void): void; +export function ensureFileSync(path: string): void; -export declare function ensureFile(path: string, callback: (err: Error) => void): void; -export declare function ensureFileSync(path: string): void; +export function ensureLink(src: string, dest: string): Promise; +export function ensureLink(src: string, dest: string, callback: (err: Error) => void): void; +export function ensureLinkSync(src: string, dest: string): void; -export declare function ensureLink(path: string, callback: (err: Error) => void): void; -export declare function ensureLinkSync(path: string): void; +export function ensureSymlink(src: string, dest: string, type?: SymlinkType): Promise; +export function ensureSymlink(src: string, dest: string, type: SymlinkType, callback: (err: Error) => void): void; +export function ensureSymlink(src: string, dest: string, callback: (err: Error) => void): void; +export function ensureSymlinkSync(src: string, dest: string, type?: SymlinkType): void; -export declare function ensureSymlink(path: string, callback: (err: Error) => void): void; -export declare function ensureSymlinkSync(path: string): void; +export function emptyDir(path: string): Promise; +export function emptyDir(path: string, callback: (err: Error) => void): void; +export function emptyDirSync(path: string): void; -export declare function emptyDir(path: string, callback?: (err: Error) => void): void; -export declare function emptyDirSync(path: string): boolean; +export function pathExists(path: string): Promise; +export function pathExists(path: string, callback: (err: Error, exists: boolean) => void): void; +export function pathExistsSync(path: string): boolean; -export interface WalkEventEmitter extends NodeJS.ReadableStream { - on(event: 'data', callback: (file: WalkEventFile) => void): this; - on(event: 'readable', callback: (this: PathEntryStream) => void): this; - on(event: 'error', callback: (error: Error, item: PathEntry) => void): this; - on(event: 'end', callback: () => void): this; - on(event: string | symbol, callback: Function): this; -} +// fs async methods +// copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v6/index.d.ts -export interface WalkEventFile { +/** Tests a user's permissions for the file specified by path. */ +export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void; +export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; +export function access(path: string | Buffer, mode?: number): Promise; + +export function appendFile(file: string | Buffer | number, data: any, options: { encoding?: string; mode?: number | string; flag?: string; }, callback: (err: NodeJS.ErrnoException) => void): void; +export function appendFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; +export function appendFile(file: string | Buffer | number, data: any, options?: { encoding?: string; mode?: number | string; flag?: string; }): Promise; + +export function chmod(path: string | Buffer, mode: string | number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function chmod(path: string | Buffer, mode: string | number): Promise; + +export function chown(path: string | Buffer, uid: number, gid: number): Promise; +export function chown(path: string | Buffer, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException) => void): void; + +export function close(fd: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function close(fd: number): Promise; + +export function fchmod(fd: number, mode: string | number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function fchmod(fd: number, mode: string | number): Promise; + +export function fchown(fd: number, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function fchown(fd: number, uid: number, gid: number): Promise; + +export function fdatasync(fd: number, callback: () => void): void; +export function fdatasync(fd: number): Promise; + +export function fstat(fd: number, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void; +export function fstat(fd: number): Promise; + +export function fsync(fd: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function fsync(fd: number): Promise; + +export function ftruncate(fd: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function ftruncate(fd: number, len: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function ftruncate(fd: number, len?: number): Promise; + +export function futimes(fd: number, atime: number, mtime: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function futimes(fd: number, atime: Date, mtime: Date, callback: (err?: NodeJS.ErrnoException) => void): void; +export function futimes(fd: number, atime: number, mtime: number): Promise; +export function futimes(fd: number, atime: Date, mtime: Date): Promise; + +export function lchown(path: string | Buffer, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function lchown(path: string | Buffer, uid: number, gid: number): Promise; + +export function link(srcpath: string | Buffer, dstpath: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; +export function link(srcpath: string | Buffer, dstpath: string | Buffer): Promise; + +export function lstat(path: string | Buffer, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void; +export function lstat(path: string | Buffer): Promise; + +/** + * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param callback No arguments other than a possible exception are given to the completion callback. + */ +export function mkdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; +/** + * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param mode + * @param callback No arguments other than a possible exception are given to the completion callback. + */ +export function mkdir(path: string | Buffer, mode: number | string, callback: (err?: NodeJS.ErrnoException) => void): void; +export function mkdir(path: string | Buffer): Promise; + +export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; +export function open(path: string | Buffer, flags: string | number, mode: number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; +export function open(path: string | Buffer, flags: string | number, mode?: number): Promise; + +export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number | null, callback: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void; +export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number | null): Promise<[number, Buffer]>; + +export function readFile(file: string | Buffer | number, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; +export function readFile(file: string | Buffer | number, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; +export function readFile(file: string | Buffer | number, options: { flag?: string; } | { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; +export function readFile(file: string | Buffer | number, options: { flag?: string; } | { encoding: string; flag?: string; }): Promise; +// tslint:disable-next-line:unified-signatures +export function readFile(file: string | Buffer | number, encoding: string): Promise; +export function readFile(file: string | Buffer | number): Promise; + +export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; +export function readdir(path: string | Buffer): Promise; + +export function readlink(path: string | Buffer, callback: (err: NodeJS.ErrnoException, linkString: string) => any): void; +export function readlink(path: string | Buffer): Promise; + +export function realpath(path: string | Buffer, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; +export function realpath(path: string | Buffer, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; +export function realpath(path: string | Buffer, cache?: { [path: string]: string }): Promise; + +export function rename(oldPath: string, newPath: string, callback: (err?: NodeJS.ErrnoException) => void): void; +export function rename(oldPath: string, newPath: string): Promise; + +/** + * Asynchronous rmdir - removes the directory specified in {path} + * + * @param path + * @param callback No arguments other than a possible exception are given to the completion callback. + */ +export function rmdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; +export function rmdir(path: string | Buffer): Promise; + +export function stat(path: string | Buffer, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void; +export function stat(path: string | Buffer): Promise; + +export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type: string, callback: (err?: NodeJS.ErrnoException) => void): void; +export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type?: string): Promise; + +export function truncate(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; +export function truncate(path: string | Buffer, len: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function truncate(path: string | Buffer, len?: number): Promise; + +/** + * Asynchronous unlink - deletes the file specified in {path} + * + * @param path + * @param callback No arguments other than a possible exception are given to the completion callback. + */ +export function unlink(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; +export function unlink(path: string | Buffer): Promise; + +export function utimes(path: string | Buffer, atime: number, mtime: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function utimes(path: string | Buffer, atime: Date, mtime: Date, callback: (err?: NodeJS.ErrnoException) => void): void; +export function utimes(path: string | Buffer, atime: number, mtime: number): Promise; +export function utimes(path: string | Buffer, atime: Date, mtime: Date): Promise; + +export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number | null, callback: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; +export function write(fd: number, buffer: Buffer, offset: number, length: number, callback: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; +export function write(fd: number, data: any, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; +export function write(fd: number, data: any, offset: number, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; +export function write(fd: number, data: any, offset: number, encoding: string, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; +export function write(fd: number, buffer: Buffer, offset: number, length: number, position?: number | null): Promise<[number, Buffer]>; +export function write(fd: number, data: any, offset: number, encoding?: string): Promise<[number, string]>; + +export function writeFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; +export function writeFile(file: string | Buffer | number, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): Promise; +export function writeFile(file: string | Buffer | number, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback: (err: NodeJS.ErrnoException) => void): void; + +/** + * Asynchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * + * @param prefix + * @param callback The created folder path is passed as a string to the callback's second parameter. + */ +export function mkdtemp(prefix: string): Promise; +export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException, folder: string) => void): void; + +export interface PathEntry { path: string; stats: Stats; } -export interface WalkOptions { - /** - * Control how results are enumerated from `readdir`: - * - 'shift' will return the first element from the array. - * - 'pop' will return the last element from the array. - * - * If not specified, the default behaviour is 'shift' - */ - queueMethod?: 'pop' | 'shift'; - /** - * Provide a function to sort the paths before they are enumerated - */ - pathSorter?: (left: string, right: string) => number; - /** - * An optional object to override the default `fs` APIs for testing purposes - */ - fs?: Object; - /** - * Provide a function to exclude certain file paths. The function should - * return true when the element should be kept, and false otherwise. - */ - filter?: (path: string, index: number, array: Array) => boolean; +export interface PathEntryStream { + read(): PathEntry | null; } -export type PathEntry = { - path: string; - stats: Stats; -} +export type CopyFilter = ((src: string) => boolean) | RegExp; -export type PathEntryStream = { - read(): PathEntry | null -} - -export interface CopyFilterFunction { - (src: string): boolean -} - -export type CopyFilter = CopyFilterFunction | RegExp; +export type SymlinkType = "dir" | "file"; export interface CopyOptions { - clobber?: boolean; dereference?: boolean; overwrite?: boolean; preserveTimestamps?: boolean; @@ -137,28 +272,23 @@ export interface CopyOptions { } export interface MoveOptions { - clobber? : boolean; + overwrite?: boolean; limit?: number; } export interface ReadOptions { throws?: boolean; - fs?: Object; + fs?: object; reviver?: any; encoding?: string; flag?: string; } export interface WriteOptions { - fs?: Object; + fs?: object; replacer?: any; spaces?: number; encoding?: string; flag?: string; mode?: number; } - -export interface MkdirOptions { - fs?: any; - mode?: number; -} diff --git a/types/fs-extra/tsconfig.json b/types/fs-extra/tsconfig.json index 6337361eed..818b38896c 100644 --- a/types/fs-extra/tsconfig.json +++ b/types/fs-extra/tsconfig.json @@ -1,22 +1,22 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "fs-extra-tests.ts" - ] -} \ No newline at end of file + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "fs-extra-tests.ts" + ] +} diff --git a/types/fs-extra/tslint.json b/types/fs-extra/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/fs-extra/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/fullcalendar/fullcalendar-tests.ts b/types/fullcalendar/fullcalendar-tests.ts index 4557a94eef..c0a53a59f1 100644 --- a/types/fullcalendar/fullcalendar-tests.ts +++ b/types/fullcalendar/fullcalendar-tests.ts @@ -417,13 +417,7 @@ $('#calendar').fullCalendar({ }); $('#calendar').fullCalendar({ - dayClick(date, allDay, jsEvent, view) { - if (allDay) { - alert('Clicked on the entire day: ' + date); - } else { - alert('Clicked on the slot: ' + date); - } - + dayClick(date, jsEvent, view) { alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY); alert('Current view: ' + view.name); @@ -628,11 +622,8 @@ $('#calendar').fullCalendar({ eventColor: '#378006' }); -interface EventWithDescription extends FullCalendar.EventObject { - description: string; -} -interface JQuery { - qtip: any; // dummy plugin interface +interface JQueryQTip extends JQuery { + qtip(options: Object): JQuery; // dummy plugin interface } $('#calendar').fullCalendar({ @@ -644,7 +635,7 @@ $('#calendar').fullCalendar({ } // more events here ], - eventRender(event: EventWithDescription, element: any, view: any) { + eventRender(event: FullCalendar.EventObject, element: JQueryQTip, view: FullCalendar.ViewObject) { element.qtip({ content: event.description }); diff --git a/types/fullcalendar/index.d.ts b/types/fullcalendar/index.d.ts index e040d613f9..bed6396214 100644 --- a/types/fullcalendar/index.d.ts +++ b/types/fullcalendar/index.d.ts @@ -2,6 +2,7 @@ // Project: http://fullcalendar.io/ // Definitions by: Neil Stalker , Marcelo Camargo , Patrick Niemann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -57,7 +58,7 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr views?: ViewSpecificOptions; viewRender?(view: ViewObject, element: JQuery): void; viewDestroy?(view: ViewObject, element: JQuery): void; - dayRender?(date: Date, cell: HTMLTableDataCellElement): void; + dayRender?(date: Date, cell: JQuery): void; windowResize?(view: ViewObject): void; // Timezone @@ -90,7 +91,7 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr // Clicking & Hovering - http://fullcalendar.io/docs/mouse/ - dayClick?(date: Date, allDay: boolean, jsEvent: MouseEvent, view: ViewObject): void; + dayClick?(date: Date, jsEvent: MouseEvent, view: ViewObject): void; eventClick?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): any; // return type boolean or void eventMouseover?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): void; eventMouseout?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): void; @@ -130,8 +131,8 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr eventBackgroundColor?: string; eventBorderColor?: string; eventTextColor?: string; - eventRender?(event: EventObject, element: HTMLDivElement, view: ViewObject): void; - eventAfterRender?(event: EventObject, element: HTMLDivElement, view: ViewObject): void; + eventRender?(event: EventObject, element: JQuery, view: ViewObject): void; + eventAfterRender?(event: EventObject, element: JQuery, view: ViewObject): void; eventAfterAllRender?(view: ViewObject): void; eventDestroy?(event: EventObject, element: JQuery, view: ViewObject): void; @@ -184,7 +185,7 @@ export interface EventDraggingResizingOptions { */ export interface SelectionOptions { selectable?: boolean; - selectHelper?: boolean | ((start: moment.Moment, end: moment.Moment) => HTMLElement); + selectHelper?: boolean; unselectAuto?: boolean; unselectCancel?: string; selectOverlap?: boolean | ((event: EventObject) => boolean); @@ -229,6 +230,8 @@ export interface EventObject extends Timespan { backgroundColor?: string; borderColor?: string; textColor?: string; + // non-standard fields, see https://fullcalendar.io/docs/event_data/Event_Object/ and https://fullcalendar.io/docs/event_rendering/eventRender/ + [x: string]: any; } export interface ViewObject extends Timespan { diff --git a/types/gapi.analytics/gapi.analytics-tests.ts b/types/gapi.analytics/gapi.analytics-tests.ts index 2c35403d10..767a3f8657 100644 --- a/types/gapi.analytics/gapi.analytics-tests.ts +++ b/types/gapi.analytics/gapi.analytics-tests.ts @@ -19,19 +19,19 @@ function test_namespace() { "enumDescriptions" ?: string[]; "location" ?: string; } - var kBI : AnalyticsParameter = gapi.client.analytics.kB.parameters.alt; + var kBI : AnalyticsParameter = new gapi.client.analytics.kB.parameters.alt(); var kB = !!kBI; - kBI = gapi.client.analytics.kB.parameters.fields; + kBI = new gapi.client.analytics.kB.parameters.fields(); kB = kB && !!kBI; - kBI = gapi.client.analytics.kB.parameters.key; + kBI = new gapi.client.analytics.kB.parameters.key(); kB = kB && !!kBI; - kBI = gapi.client.analytics.kB.parameters.oauth_token; + kBI = new gapi.client.analytics.kB.parameters.oauth_token(); kB = kB && !!kBI; - kBI = gapi.client.analytics.kB.parameters.prettyPrint; + kBI = new gapi.client.analytics.kB.parameters.prettyPrint(); kB = kB && !!kBI; - kBI = gapi.client.analytics.kB.parameters.quotaUser; + kBI = new gapi.client.analytics.kB.parameters.quotaUser(); kB = kB && !!kBI; - kBI = gapi.client.analytics.kB.parameters.userIP; + kBI = new gapi.client.analytics.kB.parameters.userIP(); kB = kB && !!kBI; analytics = analytics && kB; diff --git a/types/gapi.analytics/index.d.ts b/types/gapi.analytics/index.d.ts index 31bbd1a83b..e70b05ae55 100644 --- a/types/gapi.analytics/index.d.ts +++ b/types/gapi.analytics/index.d.ts @@ -2,6 +2,7 @@ // Project: https://developers.google.com/analytics/devguides/reporting/core/v4/ // Definitions by: César Costas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -47,13 +48,20 @@ declare namespace gapi.client.analytics.kB.parameters { "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 {} + export interface alt extends AnalyticsParameter {} + export class alt {} + export interface fields extends AnalyticsParameter {} + export class fields {} + export interface key extends AnalyticsParameter {} + export class key {} + export interface oauth_token extends AnalyticsParameter {} + export class oauth_token {} + export interface prettyPrint extends AnalyticsParameter {} + export class prettyPrint {} + export interface quotaUser extends AnalyticsParameter {} + export class quotaUser {} + export interface userIP extends AnalyticsParameter {} + export class userIP {} } interface View { diff --git a/types/gapi.auth2/index.d.ts b/types/gapi.auth2/index.d.ts index de75d26ca2..04dfe32c2d 100644 --- a/types/gapi.auth2/index.d.ts +++ b/types/gapi.auth2/index.d.ts @@ -2,6 +2,7 @@ // Project: https://developers.google.com/identity/sign-in/web/ // Definitions by: Derek Lawless // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -48,7 +49,8 @@ declare namespace gapi.auth2 { */ grantOfflineAccess(options: { scope?: string; - redirect_uri?: string; + prompt?: "select_account" | "consent"; + app_package_name?: string; }): any; /** @@ -174,7 +176,7 @@ declare namespace gapi.auth2 { * Forces a refresh of the access token, and then returns a Promise for the new AuthResponse. */ reloadAuthResponse(): Promise; - + /** * Returns true if the user granted the specified scopes. */ diff --git a/types/gapi.calendar/index.d.ts b/types/gapi.calendar/index.d.ts index bd0e3b0d17..e066ebfad4 100644 --- a/types/gapi.calendar/index.d.ts +++ b/types/gapi.calendar/index.d.ts @@ -2,6 +2,7 @@ // Project: https://developers.google.com/google-apps/calendar/ // Definitions by: Tanguy Krotoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/gapi.pagespeedonline/index.d.ts b/types/gapi.pagespeedonline/index.d.ts index 2da0bdca15..f6a19ff6f6 100644 --- a/types/gapi.pagespeedonline/index.d.ts +++ b/types/gapi.pagespeedonline/index.d.ts @@ -2,6 +2,7 @@ // Project: https://developers.google.com/speed/pagespeed/ // Definitions by: Frank M // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/gapi.people/index.d.ts b/types/gapi.people/index.d.ts index 894dd8a0d1..851eab2c0b 100644 --- a/types/gapi.people/index.d.ts +++ b/types/gapi.people/index.d.ts @@ -2,6 +2,7 @@ // Project: https://developers.google.com/people/ // Definitions by: Tanguy Krotoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -117,7 +118,7 @@ declare namespace gapi.client.people { value: string; type: NicknameType; } - + interface CoverPhoto { metadata: FieldMetadata; url: string; diff --git a/types/gapi.plus/index.d.ts b/types/gapi.plus/index.d.ts index 3e24b79ce1..62daa0cfee 100644 --- a/types/gapi.plus/index.d.ts +++ b/types/gapi.plus/index.d.ts @@ -2,6 +2,7 @@ // Project: https://developers.google.com/+/web/people/ // Definitions by: Tanguy Krotoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/gapi.translate/index.d.ts b/types/gapi.translate/index.d.ts index 66bb1719ae..cbf337589d 100644 --- a/types/gapi.translate/index.d.ts +++ b/types/gapi.translate/index.d.ts @@ -2,6 +2,7 @@ // Project: https://developers.google.com/translate/ // Definitions by: Frank M // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/gapi.urlshortener/index.d.ts b/types/gapi.urlshortener/index.d.ts index a7cdcb1364..f870da021f 100644 --- a/types/gapi.urlshortener/index.d.ts +++ b/types/gapi.urlshortener/index.d.ts @@ -2,6 +2,7 @@ // Project: https://developers.google.com/url-shortener/ // Definitions by: Frank M // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/gapi.youtube/index.d.ts b/types/gapi.youtube/index.d.ts index 2bbacb9668..5f3aef616a 100644 --- a/types/gapi.youtube/index.d.ts +++ b/types/gapi.youtube/index.d.ts @@ -2,7 +2,7 @@ // Project: https://developers.google.com/youtube/v3/ // Definitions by: Frank M // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +// TypeScript Version: 2.3 /// diff --git a/types/gapi.youtubeanalytics/index.d.ts b/types/gapi.youtubeanalytics/index.d.ts index 6595cad721..3391aa1b32 100644 --- a/types/gapi.youtubeanalytics/index.d.ts +++ b/types/gapi.youtubeanalytics/index.d.ts @@ -2,6 +2,7 @@ // Project: https://developers.google.com/youtube/analytics/ // Definitions by: Frank M // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/gapi/index.d.ts b/types/gapi/index.d.ts index 8f8e621fa3..26202fe24e 100644 --- a/types/gapi/index.d.ts +++ b/types/gapi/index.d.ts @@ -2,7 +2,7 @@ // Project: https://code.google.com/p/google-api-javascript-client/ // Definitions by: Frank M // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.3 /** * The OAuth 2.0 token object represents the OAuth 2.0 token and any associated data. @@ -148,7 +148,9 @@ declare namespace gapi.client { /** * The scopes to request, as a space-delimited string. */ - scope?: string + scope?: string, + + hosted_domain?: string; }): Promise; interface RequestOptions { @@ -235,17 +237,14 @@ declare namespace gapi.client { /** * HttpRequest supports promises. * See Google API Client JavaScript Using Promises https://developers.google.com/api-client-library/javascript/features/promises - * - * TODO This should be updated when TypeScript 2.3 is released - * See https://github.com/Microsoft/TypeScript/issues/12409 - * See https://github.com/Microsoft/TypeScript/blob/65da012527937a3074c62655d60ee08fee809f7f/lib/lib.es5.d.ts#L1339 */ class HttpRequestPromise { - then( - opt_onFulfilled?: ((response: HttpRequestFulfilled) => void) | null, - opt_onRejected?: ((reason: HttpRequestRejected) => void) | null, - opt_context?: any - ): Promise; + // Taken and adapted from https://github.com/Microsoft/TypeScript/blob/v2.3.1/lib/lib.es5.d.ts#L1343 + then( + onfulfilled?: ((response: HttpRequestFulfilled) => TResult1 | PromiseLike) | undefined | null, + onrejected?: ((reason: HttpRequestRejected) => TResult2 | PromiseLike) | undefined | null, + opt_context?: any + ): Promise; } /** diff --git a/types/get-node-dimensions/get-node-dimensions-tests.ts b/types/get-node-dimensions/get-node-dimensions-tests.ts new file mode 100644 index 0000000000..b83f6d7b6a --- /dev/null +++ b/types/get-node-dimensions/get-node-dimensions-tests.ts @@ -0,0 +1,11 @@ +import getNodeDimensions = require('get-node-dimensions'); + +const div = document.getElementById('div-to-measure'); + +if (div !== null) { + const dimensions = getNodeDimensions(div); +} + +if (div !== null) { + const dimensionsWithMargin = getNodeDimensions(div, {margin: true}); +} diff --git a/types/get-node-dimensions/index.d.ts b/types/get-node-dimensions/index.d.ts new file mode 100644 index 0000000000..e15d08bb21 --- /dev/null +++ b/types/get-node-dimensions/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for get-node-dimensions 1.2 +// Project: https://github.com/souporserious/get-node-dimensions +// Definitions by: Kovács Vince +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface NodeDimensions { + width: number; + height: number; + top: number; + right: number; + bottom: number; + left: number; +} + +interface NodeDimensionsOptions { + margin?: boolean; + clone?: boolean; + display?: string; + width?: string; + height?: string; +} + +declare function getNodeDimensions(element: HTMLElement, options?: NodeDimensionsOptions): NodeDimensions; + +export = getNodeDimensions; diff --git a/types/get-node-dimensions/tsconfig.json b/types/get-node-dimensions/tsconfig.json new file mode 100644 index 0000000000..74d9b030bf --- /dev/null +++ b/types/get-node-dimensions/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "get-node-dimensions-tests.ts" + ] +} diff --git a/types/get-node-dimensions/tslint.json b/types/get-node-dimensions/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/get-node-dimensions/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/get-stream/get-stream-tests.ts b/types/get-stream/get-stream-tests.ts new file mode 100644 index 0000000000..065c0a3c97 --- /dev/null +++ b/types/get-stream/get-stream-tests.ts @@ -0,0 +1,12 @@ +import getStream = require("get-stream"); + +import * as fs from 'fs'; + +getStream(fs.createReadStream('foo')) + .then(str => str.toLowerCase()); + +getStream.array(fs.createReadStream('foo')) + .then(values => values.join(', ')); + +getStream.buffer(fs.createReadStream('foo')) + .then(buffer => buffer.byteLength); diff --git a/types/get-stream/index.d.ts b/types/get-stream/index.d.ts new file mode 100644 index 0000000000..9dafe344ae --- /dev/null +++ b/types/get-stream/index.d.ts @@ -0,0 +1,61 @@ +// Type definitions for get-stream 3.0 +// Project: https://github.com/sindresorhus/get-stream#readme +// Definitions by: Douglas Duteil +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import {Stream} from 'stream'; + +interface Options { + /** + * Encoding of the incoming stream. + * @default 'utf8' + */ + encoding?: string; + /** + * Maximum length of the returned string. If it exceeds this value before + * the stream ends, the promise will be rejected. + * @default Infinity + */ + maxBuffer?: number; +} + +/** + * Get the stream as a string. + * The methods returns a promise that resolves when the end event fires on the + * stream, indicating that there is no more data to be read. + * The stream is switched to flowing mode. + */ +declare function getStrem(stream: Stream, options?: Options): Promise; +declare namespace getStrem { + /** + * Get the `stream` as an array of values. + * + * It honors both the `maxBuffer` and `encoding` options. + * The behavior changes slightly based on the encoding chosen: + * + * - When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) + * and collects values emitted from `stream` unmodified. + * In this case `maxBuffer` refers to the number of items in the array + * (not the sum of their sizes). + * + * - When `encoding` is set to `buffer`, it collects an array of buffers. + * `maxBuffer` refers to the summed byte lengths of every buffer in the array. + * + * - When `encoding` is set to anything else, it collects an array of strings. + * `maxBuffer` refers to the summed character lengths of every string in the array. + * + */ + function array(stream: Stream, options?: Options): Promise; + + /** + * Get the stream as a buffer. + * + * It honors the maxBuffer option as above, but it refers to byte length + * rather than string length. + */ + function buffer(stream: Stream, options?: Options): Promise; +} + +export = getStrem; diff --git a/types/get-stream/tsconfig.json b/types/get-stream/tsconfig.json new file mode 100644 index 0000000000..766ce0ae4a --- /dev/null +++ b/types/get-stream/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "get-stream-tests.ts" + ] +} diff --git a/types/get-stream/tslint.json b/types/get-stream/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/get-stream/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/gm/gm-tests.ts b/types/gm/gm-tests.ts index e8bf5787cd..50c124ffc5 100644 --- a/types/gm/gm-tests.ts +++ b/types/gm/gm-tests.ts @@ -346,3 +346,13 @@ var imageMagick = gm.subClass({ imageMagick: true }); var readStream = imageMagick(src) .adjoin() .stream(); + +var passStream = imageMagick(readStream).stream(); + +var buffers: Buffer[] = []; +var buffer: Buffer; +passStream.on('data', (chunk) => buffers.push(chunk as Buffer)).on('close', () => { + buffer = Buffer.concat(buffers); + var readstream = imageMagick(buffer).stream(); +}) + diff --git a/types/gm/index.d.ts b/types/gm/index.d.ts index 7fd419ede3..8da081ffd5 100644 --- a/types/gm/index.d.ts +++ b/types/gm/index.d.ts @@ -615,6 +615,9 @@ declare namespace m { export interface SubClass { (image: string): State; + (stream: NodeJS.ReadableStream, image?: string): State; + (buffer: Buffer, image?: string): State; + (width: number, height: number, color?: string): State; } export function compare(filename1: string, filename2: string, callback: CompareCallback): void; diff --git a/types/google-apps-script/google-apps-script-tests.ts b/types/google-apps-script/google-apps-script-tests.ts index 5160a5fdae..17de10a2fc 100644 --- a/types/google-apps-script/google-apps-script-tests.ts +++ b/types/google-apps-script/google-apps-script-tests.ts @@ -25,3 +25,9 @@ function createAndSendDocument() { // Send yourself an email with a link to the document. GmailApp.sendEmail(email, subject, body); } + +// Regression + +ScriptApp.getService().getUrl(); + +CalendarApp.GuestStatus.NO; diff --git a/types/google-apps-script/google-apps-script.base.d.ts b/types/google-apps-script/google-apps-script.base.d.ts index 538883cb19..82f92078dd 100644 --- a/types/google-apps-script/google-apps-script.base.d.ts +++ b/types/google-apps-script/google-apps-script.base.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Base { @@ -58,6 +58,8 @@ declare namespace GoogleAppsScript { * * JdbcClobA JDBC Clob. * + * PositionedImageFixed position image anchored to a Paragraph. + * * SpreadsheetThis class allows users to access and modify Google Sheets files. * * StaticMapAllows for the creation and decoration of static map images. @@ -68,7 +70,7 @@ declare namespace GoogleAppsScript { } /** - * This class provides access to Google Apps specific dialog boxes. + * This class provides access to G Suite specific dialog boxes. * * The methods in this class are only available for use in the context of a Google Spreadsheet. * See also @@ -76,7 +78,7 @@ declare namespace GoogleAppsScript { * ButtonSet */ export interface Browser { - Buttons: ButtonSet + Buttons: typeof ButtonSet; inputBox(prompt: string): string; inputBox(prompt: string, buttons: ButtonSet): string; inputBox(title: string, prompt: string, buttons: ButtonSet): string; @@ -219,6 +221,7 @@ declare namespace GoogleAppsScript { getActiveUserLocale(): string; getEffectiveUser(): User; getScriptTimeZone(): string; + getTemporaryActiveUserKey(): string; getTimeZone(): string; getUser(): User; } @@ -244,8 +247,8 @@ declare namespace GoogleAppsScript { * } */ export interface Ui { - Button: Button - ButtonSet: ButtonSet + Button: typeof Button; + ButtonSet: typeof ButtonSet; alert(prompt: string): Button; alert(prompt: string, buttons: ButtonSet): Button; alert(title: string, prompt: string, buttons: ButtonSet): Button; diff --git a/types/google-apps-script/google-apps-script.cache.d.ts b/types/google-apps-script/google-apps-script.cache.d.ts index bdeee152ba..c0cf592b43 100644 --- a/types/google-apps-script/google-apps-script.cache.d.ts +++ b/types/google-apps-script/google-apps-script.cache.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Cache { @@ -16,7 +16,7 @@ declare namespace GoogleAppsScript { * to speed up access on an average request. * * function getRssFeed() { - * var cache = CacheService.getPublicCache(); + * var cache = CacheService.getScriptCache(); * var cached = cache.get("rss-feed-contents"); * if (cached != null) { * return cached; diff --git a/types/google-apps-script/google-apps-script.calendar.d.ts b/types/google-apps-script/google-apps-script.calendar.d.ts index c217e67a07..d94ec25ad3 100644 --- a/types/google-apps-script/google-apps-script.calendar.d.ts +++ b/types/google-apps-script/google-apps-script.calendar.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Calendar { @@ -51,11 +51,12 @@ declare namespace GoogleAppsScript { * that the user owns or is subscribed to. */ export interface CalendarApp { - Color: Color - GuestStatus: GuestStatus - Month: Base.Month - Visibility: Visibility - Weekday: Base.Weekday + Color: typeof Color; + EventColor: typeof EventColor; + GuestStatus: typeof GuestStatus; + Month: typeof Base.Month; + Visibility: typeof Visibility; + Weekday: typeof Base.Weekday; createAllDayEvent(title: string, date: Date): CalendarEvent; createAllDayEvent(title: string, date: Date, options: Object): CalendarEvent; createAllDayEventSeries(title: string, startDate: Date, recurrence: EventRecurrence): CalendarEventSeries; @@ -113,6 +114,7 @@ declare namespace GoogleAppsScript { getAllDayEndDate(): Date; getAllDayStartDate(): Date; getAllTagKeys(): String[]; + getColor(): string; getCreators(): String[]; getDateCreated(): Date; getDescription(): string; @@ -144,6 +146,7 @@ declare namespace GoogleAppsScript { resetRemindersToDefault(): CalendarEvent; setAllDayDate(date: Date): CalendarEvent; setAnyoneCanAddSelf(anyoneCanAddSelf: boolean): CalendarEvent; + setColor(color: string): CalendarEvent; setDescription(description: string): CalendarEvent; setGuestsCanInviteOthers(guestsCanInviteOthers: boolean): CalendarEvent; setGuestsCanModify(guestsCanModify: boolean): CalendarEvent; @@ -168,6 +171,7 @@ declare namespace GoogleAppsScript { deleteEventSeries(): void; deleteTag(key: string): CalendarEventSeries; getAllTagKeys(): String[]; + getColor(): string; getCreators(): String[]; getDateCreated(): Date; getDescription(): string; @@ -193,6 +197,7 @@ declare namespace GoogleAppsScript { removeGuest(email: string): CalendarEventSeries; resetRemindersToDefault(): CalendarEventSeries; setAnyoneCanAddSelf(anyoneCanAddSelf: boolean): CalendarEventSeries; + setColor(color: string): CalendarEventSeries; setDescription(description: string): CalendarEventSeries; setGuestsCanInviteOthers(guestsCanInviteOthers: boolean): CalendarEventSeries; setGuestsCanModify(guestsCanModify: boolean): CalendarEventSeries; @@ -211,6 +216,11 @@ declare namespace GoogleAppsScript { */ export enum Color { BLUE, BROWN, CHARCOAL, CHESTNUT, GRAY, GREEN, INDIGO, LIME, MUSTARD, OLIVE, ORANGE, PINK, PLUM, PURPLE, RED, RED_ORANGE, SEA_BLUE, SLATE, TEAL, TURQOISE, YELLOW } + /** + * An enum representing the named event colors available in the Calendar service. + */ + export enum EventColor { PALE_BLUE, PALE_GREEN, MAUVE, PALE_RED, YELLOW, ORANGE, CYAN, GRAY, BLUE, GREEN, RED } + /** * Represents a guest of an event. */ diff --git a/types/google-apps-script/google-apps-script.charts.d.ts b/types/google-apps-script/google-apps-script.charts.d.ts index 2e1b65290a..de6de7b767 100644 --- a/types/google-apps-script/google-apps-script.charts.d.ts +++ b/types/google-apps-script/google-apps-script.charts.d.ts @@ -1,11 +1,11 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - +/// +/// +/// declare namespace GoogleAppsScript { export module Charts { @@ -232,7 +232,7 @@ declare namespace GoogleAppsScript { /** * Chart types supported by the Charts service. */ - export enum ChartType { AREA, BAR, COLUMN, LINE, PIE, SCATTER, TABLE } + export enum ChartType { AREA, BAR, COLUMN, COMBO, HISTOGRAM, LINE, PIE, SCATTER, TABLE } /** * Entry point for creating Charts in scripts. @@ -265,14 +265,14 @@ declare namespace GoogleAppsScript { * } */ export interface Charts { - ChartType: ChartType - ColumnType: ColumnType - CurveStyle: CurveStyle - MatchType: MatchType - Orientation: Orientation - PickerValuesLayout: PickerValuesLayout - PointStyle: PointStyle - Position: Position + ChartType: typeof ChartType; + ColumnType: typeof ColumnType; + CurveStyle: typeof CurveStyle; + MatchType: typeof MatchType; + Orientation: typeof Orientation; + PickerValuesLayout: typeof PickerValuesLayout; + PointStyle: typeof PointStyle; + Position: typeof Position; newAreaChart(): AreaChartBuilder; newBarChart(): BarChartBuilder; newCategoryFilter(): CategoryFilterBuilder; @@ -446,10 +446,10 @@ declare namespace GoogleAppsScript { * } */ export interface DashboardPanel { - add(widget: UI.Widget): DashboardPanel; getId(): string; getType(): string; setId(id: string): DashboardPanel; + add(widget: UI.Widget): DashboardPanel; } /** diff --git a/types/google-apps-script/google-apps-script.contacts.d.ts b/types/google-apps-script/google-apps-script.contacts.d.ts index 389951d563..46337d87d5 100644 --- a/types/google-apps-script/google-apps-script.contacts.d.ts +++ b/types/google-apps-script/google-apps-script.contacts.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Contacts { @@ -136,12 +136,12 @@ declare namespace GoogleAppsScript { * contacts listed therein. */ export interface ContactsApp { - ExtendedField: ExtendedField - Field: Field - Gender: Gender - Month: Base.Month - Priority: Priority - Sensitivity: Sensitivity + ExtendedField: typeof ExtendedField; + Field: typeof Field; + Gender: typeof Gender; + Month: typeof Base.Month; + Priority: typeof Priority; + Sensitivity: typeof Sensitivity; createContact(givenName: string, familyName: string, email: string): Contact; createContactGroup(name: string): ContactGroup; deleteContact(contact: Contact): void; @@ -197,6 +197,11 @@ declare namespace GoogleAppsScript { /** * A date field in a Contact. + * + * This class is only used by the Contacts service, and dates used elsewhere in App Script use + * JavaScript's standard + * + * Date object. */ export interface DateField { deleteDateField(): void; diff --git a/types/google-apps-script/google-apps-script.content.d.ts b/types/google-apps-script/google-apps-script.content.d.ts index afd34deca1..eaa3057a49 100644 --- a/types/google-apps-script/google-apps-script.content.d.ts +++ b/types/google-apps-script/google-apps-script.content.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Content { @@ -17,7 +17,7 @@ declare namespace GoogleAppsScript { * } */ export interface ContentService { - MimeType: MimeType + MimeType: typeof MimeType; createTextOutput(): TextOutput; createTextOutput(content: string): TextOutput; } @@ -37,7 +37,7 @@ declare namespace GoogleAppsScript { * You can return text content like this: * * function doGet() { - * return ContentService.createPlainTextOutput("hello world!"); + * return ContentService.createTextOutput("hello world!"); * } * * ContentService diff --git a/types/google-apps-script/google-apps-script.document.d.ts b/types/google-apps-script/google-apps-script.document.d.ts index 7477261602..bee604636a 100644 --- a/types/google-apps-script/google-apps-script.document.d.ts +++ b/types/google-apps-script/google-apps-script.document.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Document { @@ -64,6 +64,7 @@ declare namespace GoogleAppsScript { getAttributes(): Object; getChild(childIndex: Integer): Element; getChildIndex(child: Element): Integer; + getHeadingAttributes(paragraphHeading: ParagraphHeading): Object; getImages(): InlineImage[]; getListItems(): ListItem[]; getMarginBottom(): Number; @@ -94,6 +95,7 @@ declare namespace GoogleAppsScript { removeChild(child: Element): Body; replaceText(searchPattern: string, replacement: string): Element; setAttributes(attributes: Object): Body; + setHeadingAttributes(paragraphHeading: ParagraphHeading, attributes: Object): Body; setMarginBottom(marginBottom: Number): Body; setMarginLeft(marginLeft: Number): Body; setMarginRight(marginRight: Number): Body; @@ -230,14 +232,15 @@ declare namespace GoogleAppsScript { * doc = DocumentApp.create('Document Name'); */ export interface DocumentApp { - Attribute: Attribute - ElementType: ElementType - FontFamily: FontFamily - GlyphType: GlyphType - HorizontalAlignment: HorizontalAlignment - ParagraphHeading: ParagraphHeading - TextAlignment: TextAlignment - VerticalAlignment: VerticalAlignment + Attribute: typeof Attribute; + ElementType: typeof ElementType; + FontFamily: typeof FontFamily; + GlyphType: typeof GlyphType; + HorizontalAlignment: typeof HorizontalAlignment; + ParagraphHeading: typeof ParagraphHeading; + PositionedLayout: typeof PositionedLayout; + TextAlignment: typeof TextAlignment; + VerticalAlignment: typeof VerticalAlignment; create(name: string): Document; getActiveDocument(): Document; getUi(): Base.Ui; @@ -737,6 +740,8 @@ declare namespace GoogleAppsScript { */ export interface InlineDrawing { copy(): InlineDrawing; + getAltDescription(): string; + getAltTitle(): string; getAttributes(): Object; getNextSibling(): Element; getParent(): ContainerElement; @@ -745,6 +750,8 @@ declare namespace GoogleAppsScript { isAtDocumentEnd(): boolean; merge(): InlineDrawing; removeFromParent(): InlineDrawing; + setAltDescription(description: string): InlineDrawing; + setAltTitle(title: string): InlineDrawing; setAttributes(attributes: Object): InlineDrawing; } @@ -757,6 +764,8 @@ declare namespace GoogleAppsScript { */ export interface InlineImage { copy(): InlineImage; + getAltDescription(): string; + getAltTitle(): string; getAs(contentType: string): Base.Blob; getAttributes(): Object; getBlob(): Base.Blob; @@ -770,6 +779,8 @@ declare namespace GoogleAppsScript { isAtDocumentEnd(): boolean; merge(): InlineImage; removeFromParent(): InlineImage; + setAltDescription(description: string): InlineImage; + setAltTitle(title: string): InlineImage; setAttributes(attributes: Object): InlineImage; setHeight(height: Integer): InlineImage; setLinkUrl(url: string): InlineImage; @@ -810,6 +821,7 @@ declare namespace GoogleAppsScript { * item2.setListId(item1); */ export interface ListItem { + addPositionedImage(image: Base.BlobSource): PositionedImage; appendHorizontalRule(): HorizontalRule; appendInlineImage(image: Base.BlobSource): InlineImage; appendInlineImage(image: InlineImage): InlineImage; @@ -840,6 +852,8 @@ declare namespace GoogleAppsScript { getNextSibling(): Element; getNumChildren(): Integer; getParent(): ContainerElement; + getPositionedImage(id: string): PositionedImage; + getPositionedImages(): PositionedImage[]; getPreviousSibling(): Element; getSpacingAfter(): Number; getSpacingBefore(): Number; @@ -858,6 +872,7 @@ declare namespace GoogleAppsScript { merge(): ListItem; removeChild(child: Element): ListItem; removeFromParent(): ListItem; + removePositionedImage(id: string): boolean; replaceText(searchPattern: string, replacement: string): Element; setAlignment(alignment: HorizontalAlignment): ListItem; setAttributes(attributes: Object): ListItem; @@ -945,6 +960,7 @@ declare namespace GoogleAppsScript { * body.appendParagraph("This is a typical paragraph."); */ export interface Paragraph { + addPositionedImage(image: Base.BlobSource): PositionedImage; appendHorizontalRule(): HorizontalRule; appendInlineImage(image: Base.BlobSource): InlineImage; appendInlineImage(image: InlineImage): InlineImage; @@ -972,6 +988,8 @@ declare namespace GoogleAppsScript { getNextSibling(): Element; getNumChildren(): Integer; getParent(): ContainerElement; + getPositionedImage(id: string): PositionedImage; + getPositionedImages(): PositionedImage[]; getPreviousSibling(): Element; getSpacingAfter(): Number; getSpacingBefore(): Number; @@ -990,6 +1008,7 @@ declare namespace GoogleAppsScript { merge(): Paragraph; removeChild(child: Element): Paragraph; removeFromParent(): Paragraph; + removePositionedImage(id: string): boolean; replaceText(searchPattern: string, replacement: string): Element; setAlignment(alignment: HorizontalAlignment): Paragraph; setAttributes(attributes: Object): Paragraph; @@ -1059,6 +1078,54 @@ declare namespace GoogleAppsScript { insertText(text: string): Text; } + /** + * Fixed position image anchored to a Paragraph. + * Unlike an InlineImage, + * a PositionedImage is not an + * Element. + * It does not have a parent or sibling + * Element. + * Instead, it is anchored to a Paragraph + * or ListItem, + * and is placed via offsets from that anchor. A PositionedImage + * has an ID that can be used to reference it. + * + * var body = DocumentApp.getActiveDocument().getBody(); + * + * // Append a new paragraph. + * var paragraph = body.appendParagraph("New paragraph to anchor the image to."); + * + * // Get an image in Drive from its ID. + * var image = DriveApp.getFileById('ENTER_IMAGE_FILE_ID_HERE').getBlob(); + * + * // Add the PositionedImage with offsets (in points). + * var posImage = paragraph.addPositionedImage(image) + * .setTopOffset(60) + * .setLeftOffset(40); + */ + export interface PositionedImage { + getAs(contentType: string): Base.Blob; + getBlob(): Base.Blob; + getHeight(): Integer; + getId(): string; + getLayout(): PositionedLayout; + getLeftOffset(): Number; + getParagraph(): Paragraph; + getTopOffset(): Number; + getWidth(): Integer; + setHeight(height: Integer): PositionedImage; + setLayout(layout: PositionedLayout): PositionedImage; + setLeftOffset(offset: Number): PositionedImage; + setTopOffset(offset: Number): PositionedImage; + setWidth(width: Integer): PositionedImage; + } + + /** + * An enumeration that specifies how to lay out a PositionedImage in + * relation to surrounding text. + */ + export enum PositionedLayout { ABOVE_TEXT, BREAK_BOTH, BREAK_LEFT, BREAK_RIGHT, WRAP_TEXT } + /** * A range of elements in a document. The user's selection is represented as a * Range, among other uses. Scripts can only access the selection of the user who is running @@ -1215,6 +1282,7 @@ declare namespace GoogleAppsScript { getBackgroundColor(): string; getChild(childIndex: Integer): Element; getChildIndex(child: Element): Integer; + getColSpan(): Integer; getLinkUrl(): string; getNextSibling(): Element; getNumChildren(): Integer; @@ -1226,6 +1294,7 @@ declare namespace GoogleAppsScript { getParentRow(): TableRow; getParentTable(): Table; getPreviousSibling(): Element; + getRowSpan(): Integer; getText(): string; getTextAlignment(): TextAlignment; getType(): ElementType; diff --git a/types/google-apps-script/google-apps-script.drive.d.ts b/types/google-apps-script/google-apps-script.drive.d.ts index d0fba208f8..36693eaf9f 100644 --- a/types/google-apps-script/google-apps-script.drive.d.ts +++ b/types/google-apps-script/google-apps-script.drive.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Drive { @@ -14,8 +14,7 @@ declare namespace GoogleAppsScript { * DriveApp.Access. * * // Creates a folder that anyone on the Internet can read from and write to. (Domain - * // administrators can prohibit this setting for users of Google Apps for Business, Google Apps - * // for Education, or Google Apps for Your Domain.) + * // administrators can prohibit this setting for users of a G Suite domain.) * var folder = DriveApp.createFolder('Shared Folder'); * folder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT); */ @@ -32,8 +31,8 @@ declare namespace GoogleAppsScript { * } */ export interface DriveApp { - Access: Access - Permission: Permission + Access: typeof Access; + Permission: typeof Permission; addFile(child: File): Folder; addFolder(child: Folder): Folder; continueFileIterator(continuationToken: string): FileIterator; @@ -234,12 +233,11 @@ declare namespace GoogleAppsScript { * DriveApp.Permission. * * // Creates a folder that anyone on the Internet can read from and write to. (Domain - * // administrators can prohibit this setting for users of Google Apps for Business, Google Apps - * // for Education, or Google Apps for Your Domain.) + * // administrators can prohibit this setting for users of a G Suite domain.) * var folder = DriveApp.createFolder('Shared Folder'); * folder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT); */ - export enum Permission { VIEW, EDIT, COMMENT, OWNER, NONE } + export enum Permission { VIEW, EDIT, COMMENT, OWNER, ORGANIZER, NONE } /** * A user associated with a file in Google Drive. Users can be accessed from diff --git a/types/google-apps-script/google-apps-script.forms.d.ts b/types/google-apps-script/google-apps-script.forms.d.ts index 3ce3e41672..e10c47b169 100644 --- a/types/google-apps-script/google-apps-script.forms.d.ts +++ b/types/google-apps-script/google-apps-script.forms.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Forms { @@ -22,8 +22,9 @@ declare namespace GoogleAppsScript { export enum Alignment { LEFT, CENTER, RIGHT } /** - * A question item that allows the respondent to select one or more checkboxes, as well as an - * optional "other" field. Items can be accessed or created from a Form. + * A question item that allows the respondent to select one or more checkboxes, as well + * as an optional "other" field. Items can be accessed or created from a Form. When used in + * a quiz, these items are autograded. * * // Open a form by ID and add a new checkbox item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -37,25 +38,81 @@ declare namespace GoogleAppsScript { * .showOtherOption(true); */ export interface CheckboxItem { + clearValidation(): CheckboxItem; createChoice(value: string): Choice; + createChoice(value: string, isCorrect: boolean): Choice; createResponse(responses: String[]): ItemResponse; duplicate(): CheckboxItem; getChoices(): Choice[]; + getFeedbackForCorrect(): QuizFeedback; + getFeedbackForIncorrect(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; hasOtherOption(): boolean; isRequired(): boolean; setChoiceValues(values: String[]): CheckboxItem; setChoices(choices: Choice[]): CheckboxItem; + setFeedbackForCorrect(feedback: QuizFeedback): CheckboxItem; + setFeedbackForIncorrect(feedback: QuizFeedback): CheckboxItem; setHelpText(text: string): CheckboxItem; + setPoints(points: Integer): CheckboxItem; setRequired(enabled: boolean): CheckboxItem; setTitle(title: string): CheckboxItem; + setValidation(validation: CheckboxValidation): CheckboxItem; showOtherOption(enabled: boolean): CheckboxItem; } + /** + * A DataValidation for a CheckboxItem. + * + * // Add a checkBox item to a form and require exactly two selections. + * var checkBoxItem = form.addCheckboxItem(); + * checkBoxItem.setTitle('What two condiments would you like on your hot dog?'); + * checkBoxItem.setChoices([ + * checkBoxItem.createChoice('Ketchup'), + * checkBoxItem.createChoice('Mustard'), + * checkBoxItem.createChoice('Relish') + * ]); + * var checkBoxValidation = FormApp.createCheckboxValidation() + * .setHelpText(“Select two condiments.”) + * .requireSelectExactly(2) + * .build(); + * checkBoxItem.setValidation(checkBoxValidation); + */ + export interface CheckboxValidation { + getHelpText(): string; + } + + /** + * A DataValidationBuilder for a CheckboxValidation. + * + * // Add a checkBox item to a form and require exactly two selections. + * var checkBoxItem = form.addCheckboxItem(); + * checkBoxItem.setTitle('What two condiments would you like on your hot dog?'); + * checkBoxItem.setChoices([ + * checkBoxItem.createChoice('Ketchup'), + * checkBoxItem.createChoice('Mustard'), + * checkBoxItem.createChoice('Relish') + * ]); + * var checkBoxValidation = FormApp.createCheckboxValidation() + * .setHelpText(“Select two condiments.”) + * .requireSelectExactly(2) + * .build(); + * checkBoxItem.setValidation(checkBoxValidation); + */ + export interface CheckboxValidationBuilder { + build(): CheckboxValidation; + copy(): CheckboxValidationBuilder; + requireSelectAtLeast(number: Integer): CheckboxValidationBuilder; + requireSelectAtMost(number: Integer): CheckboxValidationBuilder; + requireSelectExactly(number: Integer): CheckboxValidationBuilder; + setHelpText(text: string): CheckboxValidationBuilder; + } + /** * A single choice associated with a type of Item that supports choices, like * CheckboxItem, ListItem, or MultipleChoiceItem. @@ -84,11 +141,45 @@ declare namespace GoogleAppsScript { getGotoPage(): PageBreakItem; getPageNavigationType(): PageNavigationType; getValue(): string; + isCorrectAnswer(): boolean; } /** - * A question item that allows the respondent to indicate a date. Items can be accessed or created - * from a Form. + * The base DataValidation that contains properties common to all validations, such as help text. + * Validations can be added to certain Form items. + * + * // Add a text item to a form and require it to be a number within a range. + * var textItem = form.addTextItem().setTitle('Pick a number between 1 and 100?'); + * var textValidation = FormApp.createTextValidation() + * .setHelpText(“Input was not a number between 1 and 100.”) + * .requireNumberBetween(1, 100); + * textItem.setValidation(textValidation); + */ + export interface DataValidation { + getHelpText(): string; + } + + /** + * The base DataValidationBuilder that contains setters for properties common to all validations, + * such as help text. Used to build DataValadation objects. + * + * // Add a text item to a form and require it to be a number within a range. + * var textItem = form.addTextItem().setTitle('Pick a number between 1 and 100?'); + * var textValidation = FormApp.createTextValidation() + * .setHelpText(“Input was not a number between 1 and 100.”) + * .requireNumberBetween(1, 100) + * .build(); + * textItem.setValidation(textValidation); + */ + export interface DataValidationBuilder { + build(): DataValidation; + copy(): DataValidationBuilder; + setHelpText(text: string): DataValidationBuilder; + } + + /** + * A question item that allows the respondent to indicate a date. Items can be accessed or + * created from a Form. When used in a quiz, these items are graded. * * // Open a form by ID and add a new date item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -98,22 +189,26 @@ declare namespace GoogleAppsScript { export interface DateItem { createResponse(response: Date): ItemResponse; duplicate(): DateItem; + getGeneralFeedback(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; includesYear(): boolean; isRequired(): boolean; + setGeneralFeedback(feedback: QuizFeedback): DateItem; setHelpText(text: string): DateItem; setIncludesYear(enableYear: boolean): DateItem; + setPoints(points: Integer): DateItem; setRequired(enabled: boolean): DateItem; setTitle(title: string): DateItem; } /** - * A question item that allows the respondent to indicate a date and time. Items can be accessed or - * created from a Form. + * A question item that allows the respondent to indicate a date and time. Items can be + * accessed or created from a Form. When used in a quiz, these items are graded. * * // Open a form by ID and add a new date-time item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -123,15 +218,19 @@ declare namespace GoogleAppsScript { export interface DateTimeItem { createResponse(response: Date): ItemResponse; duplicate(): DateTimeItem; + getGeneralFeedback(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; includesYear(): boolean; isRequired(): boolean; + setGeneralFeedback(feedback: QuizFeedback): DateTimeItem; setHelpText(text: string): DateTimeItem; setIncludesYear(enableYear: boolean): DateTimeItem; + setPoints(points: Integer): DateTimeItem; setRequired(enabled: boolean): DateTimeItem; setTitle(title: string): DateTimeItem; } @@ -153,8 +252,8 @@ declare namespace GoogleAppsScript { export enum DestinationType { SPREADSHEET } /** - * A question item that allows the respondent to indicate a length of time. Items can be accessed or - * created from a Form. + * A question item that allows the respondent to indicate a length of time. Items can be + * accessed or created from a Form. When used in a quiz, these items are graded. * * // Open a form by ID and add a new duration item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -164,21 +263,44 @@ declare namespace GoogleAppsScript { export interface DurationItem { createResponse(hours: Integer, minutes: Integer, seconds: Integer): ItemResponse; duplicate(): DurationItem; + getGeneralFeedback(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; isRequired(): boolean; + setGeneralFeedback(feedback: QuizFeedback): DurationItem; setHelpText(text: string): DurationItem; + setPoints(points: Integer): DurationItem; setRequired(enabled: boolean): DurationItem; setTitle(title: string): DurationItem; } /** - * A form that contains overall properties (such as title, settings, and where responses are stored) - * and items (which includes question items like checkboxes and layout items like page breaks). - * Forms can be accessed or created from FormApp. + * An enum representing the supported types of feedback. Feedback types can be accessed from + * FormApp.FeedbackType. + * + * // Open a form by ID and add a new list item. + * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); + * var item = form.addListItem(); + * item.setTitle('Do you prefer cats or dogs?'); + * // Set "Dogs" as the correct answer to this question. + * item.setChoices([ + * item.createChoice('Dogs', true), + * item.createChoice('Cats', false)]); + * // Add feedback which will be shown for correct responses; ie "Dogs". + * item.setFeedbackForCorrect( + * FormApp.createFeedback().setDisplayText("Dogs rule, cats drool.").build()); + */ + export enum FeedbackType { CORRECT, INCORRECT, GENERAL } + + /** + * A form that contains overall properties and items. Properties include title, settings, and + * where responses are stored. Items include question items like checkboxes or radio items, while + * layout items refer to things like page breaks. Forms can be accessed or created from + * FormApp. * * // Open a form by ID and create a new spreadsheet. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -242,6 +364,7 @@ declare namespace GoogleAppsScript { hasRespondAgainLink(): boolean; isAcceptingResponses(): boolean; isPublishingSummary(): boolean; + isQuiz(): boolean; moveItem(from: Integer, to: Integer): Item; moveItem(item: Item, toIndex: Integer): Item; removeDestination(): Form; @@ -255,6 +378,7 @@ declare namespace GoogleAppsScript { setCustomClosedFormMessage(message: string): Form; setDescription(description: string): Form; setDestination(type: DestinationType, id: string): Form; + setIsQuiz(enabled: boolean): Form; setLimitOneResponsePerUser(enabled: boolean): Form; setProgressBar(enabled: boolean): Form; setPublishingSummary(enabled: boolean): Form; @@ -263,10 +387,11 @@ declare namespace GoogleAppsScript { setShuffleQuestions(shuffle: boolean): Form; setTitle(title: string): Form; shortenFormUrl(url: string): string; + submitGrades(responses: FormResponse[]): Form; } /** - * Allows a script to open existing Forms or create new ones. + * Allows a script to open an existing Form or create a new one. * * // Open a form by ID. * var existingForm = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -275,11 +400,17 @@ declare namespace GoogleAppsScript { * var newForm = FormApp.create('Form Name'); */ export interface FormApp { - Alignment: Alignment - DestinationType: DestinationType - ItemType: ItemType - PageNavigationType: PageNavigationType + Alignment: typeof Alignment; + DestinationType: typeof DestinationType; + FeedbackType: typeof FeedbackType; + ItemType: typeof ItemType; + PageNavigationType: typeof PageNavigationType; create(title: string): Form; + createCheckboxValidation(): CheckboxValidationBuilder; + createFeedback(): QuizFeedbackBuilder; + createGridValidation(): GridValidationBuilder; + createParagraphTextValidation(): ParagraphTextValidationBuilder; + createTextValidation(): TextValidationBuilder; getActiveForm(): Form; getUi(): Base.Ui; openById(id: string): Form; @@ -287,11 +418,11 @@ declare namespace GoogleAppsScript { } /** - * A response to the form as a whole. Form responses have three main uses: they contain the answers - * submitted by a respondent (see getItemResponses(), they can be used to programmatically - * respond to the form (see withItemResponse(response) and submit()), and they - * can be used as a template to create a URL for the form with pre-filled answers. Form responses - * can be created or accessed from a Form. + * A response to the form as a whole. A FormResponse can be used in three ways: to + * access the answers submitted by a respondent (see getItemResponses()), to + * programmatically submit a response to the form (see withItemResponse(response) and + * submit()), and to generate a URL for the form which pre-fills fields using the + * provided answers. FormResponses can be created or accessed from a Form. * * // Open a form by ID and log the responses to each question. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -310,6 +441,8 @@ declare namespace GoogleAppsScript { */ export interface FormResponse { getEditResponseUrl(): string; + getGradableItemResponses(): ItemResponse[]; + getGradableResponseForItem(item: Item): ItemResponse; getId(): string; getItemResponses(): ItemResponse[]; getRespondentEmail(): string; @@ -317,13 +450,14 @@ declare namespace GoogleAppsScript { getTimestamp(): Date; submit(): FormResponse; toPrefilledUrl(): string; + withItemGrade(gradedResponse: ItemResponse): FormResponse; withItemResponse(response: ItemResponse): FormResponse; } /** * A question item, presented as a grid of columns and rows, that allows the respondent to select * one choice per row from a sequence of radio buttons. Items can be accessed or created from a - * Form. + * Form. * * // Open a form by ID and add a new grid item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -333,6 +467,7 @@ declare namespace GoogleAppsScript { * .setColumns(['Boring', 'So-so', 'Interesting']); */ export interface GridItem { + clearValidation(): GridItem; createResponse(responses: String[]): ItemResponse; duplicate(): GridItem; getColumns(): String[]; @@ -348,6 +483,46 @@ declare namespace GoogleAppsScript { setRequired(enabled: boolean): GridItem; setRows(rows: String[]): GridItem; setTitle(title: string): GridItem; + setValidation(validation: GridValidation): GridItem; + } + + /** + * A DataValidation for a GridItem. + * + * // Add a grid item to a form and require one response per column. + * var gridItem = form.addGridItem(); + * gridItem.setTitle('Rate your interests') + * .setRows(['Cars', 'Computers', 'Celebrities']) + * .setColumns(['Boring', 'So-so', 'Interesting']); + * var gridValidation = FormApp.createGridValidation() + * .setHelpText(“Select one item per column.”) + * .requireLimitOneResponsePerColumn() + * .build(); + * gridItem.setValidation(gridValidation); + */ + export interface GridValidation { + getHelpText(): string; + } + + /** + * A DataValidationBuilder for a GridValidation. + * + * // Add a grid item to a form and require one response per column. + * var gridItem = form.addGridItem(); + * gridItem.setTitle('Rate your interests') + * .setRows(['Cars', 'Computers', 'Celebrities']) + * .setColumns(['Boring', 'So-so', 'Interesting']); + * var gridValidation = FormApp.createGridValidation() + * .setHelpText(“Select one item per column.”) + * .requireLimitOneResponsePerColumn() + * .build(); + * gridItem.setValidation(gridValidation); + */ + export interface GridValidationBuilder { + build(): GridValidation; + copy(): GridValidationBuilder; + requireLimitOneResponsePerColumn(): GridValidationBuilder; + setHelpText(text: string): GridValidationBuilder; } /** @@ -447,8 +622,12 @@ declare namespace GoogleAppsScript { * } */ export interface ItemResponse { + getFeedback(): Object; getItem(): Item; getResponse(): Object; + getScore(): Object; + setFeedback(feedback: Object): ItemResponse; + setScore(score: Object): ItemResponse; } /** @@ -482,27 +661,35 @@ declare namespace GoogleAppsScript { */ export interface ListItem { createChoice(value: string): Choice; + createChoice(value: string, isCorrect: boolean): Choice; createChoice(value: string, navigationItem: PageBreakItem): Choice; createChoice(value: string, navigationType: PageNavigationType): Choice; createResponse(response: string): ItemResponse; duplicate(): ListItem; getChoices(): Choice[]; + getFeedbackForCorrect(): QuizFeedback; + getFeedbackForIncorrect(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; isRequired(): boolean; setChoiceValues(values: String[]): ListItem; setChoices(choices: Choice[]): ListItem; + setFeedbackForCorrect(feedback: QuizFeedback): ListItem; + setFeedbackForIncorrect(feedback: QuizFeedback): ListItem; setHelpText(text: string): ListItem; + setPoints(points: Integer): ListItem; setRequired(enabled: boolean): ListItem; setTitle(title: string): ListItem; } /** - * A question item that allows the respondent to select one choice from a list of radio buttons or - * an optional "other" field. Items can be accessed or created from a Form. + * A question item that allows the respondent to select one choice from a list of radio + * buttons or an optional "other" field. Items can be accessed or created from a Form. + * When used in a quiz, these items are autograded. * * // Open a form by ID and add a new multiple choice item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -516,21 +703,28 @@ declare namespace GoogleAppsScript { */ export interface MultipleChoiceItem { createChoice(value: string): Choice; + createChoice(value: string, isCorrect: boolean): Choice; createChoice(value: string, navigationItem: PageBreakItem): Choice; createChoice(value: string, navigationType: PageNavigationType): Choice; createResponse(response: string): ItemResponse; duplicate(): MultipleChoiceItem; getChoices(): Choice[]; + getFeedbackForCorrect(): QuizFeedback; + getFeedbackForIncorrect(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; hasOtherOption(): boolean; isRequired(): boolean; setChoiceValues(values: String[]): MultipleChoiceItem; setChoices(choices: Choice[]): MultipleChoiceItem; + setFeedbackForCorrect(feedback: QuizFeedback): MultipleChoiceItem; + setFeedbackForIncorrect(feedback: QuizFeedback): MultipleChoiceItem; setHelpText(text: string): MultipleChoiceItem; + setPoints(points: Integer): MultipleChoiceItem; setRequired(enabled: boolean): MultipleChoiceItem; setTitle(title: string): MultipleChoiceItem; showOtherOption(enabled: boolean): MultipleChoiceItem; @@ -593,8 +787,8 @@ declare namespace GoogleAppsScript { export enum PageNavigationType { CONTINUE, GO_TO_PAGE, RESTART, SUBMIT } /** - * A question item that allows the respondent to enter a block of text. Items can be accessed or - * created from a Form. + * A question item that allows the respondent to enter a block of text. Items can be + * accessed or created from a Form. When used in a quiz, these items are graded. * * // Open a form by ID and add a new paragraph text item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -602,22 +796,107 @@ declare namespace GoogleAppsScript { * item.setTitle('What is your address?'); */ export interface ParagraphTextItem { + clearValidation(): ParagraphTextItem; createResponse(response: string): ItemResponse; duplicate(): ParagraphTextItem; + getGeneralFeedback(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; isRequired(): boolean; + setGeneralFeedback(feedback: QuizFeedback): ParagraphTextItem; setHelpText(text: string): ParagraphTextItem; + setPoints(points: Integer): ParagraphTextItem; setRequired(enabled: boolean): ParagraphTextItem; setTitle(title: string): ParagraphTextItem; + setValidation(validation: ParagraphTextValidation): ParagraphTextItem; } /** - * A question item that allows the respondent to choose one option from a numbered sequence of radio - * buttons. Items can be accessed or created from a Form. + * A DataValidation for a ParagraphTextItem. + * + * // Add a paragraph text item to a form and require the answer to be at least 100 characters. + * var paragraphTextItem = form.addParagraphTextItem().setTitle('Describe yourself:'); + * var paragraphtextValidation = FormApp.createParagraphTextValidation() + * .setHelpText(“Answer must be more than 100 characters.”) + * .requireTextLengthGreatherThan(100); + * paragraphTextItem.setValidation(paragraphtextValidation); + */ + export interface ParagraphTextValidation { + getHelpText(): string; + } + + /** + * A DataValidationBuilder for a ParagraphTextValidation. + * + * // Add a paragraph text item to a form and require the answer to be at least 100 characters. + * var paragraphTextItem = form.addParagraphTextItem().setTitle('Describe yourself:'); + * var paragraphtextValidation = FormApp.createParagraphTextValidation() + * .setHelpText(“Answer must be more than 100 characters.”) + * .requireTextLengthGreatherThan(100); + * paragraphTextItem.setValidation(paragraphtextValidation); + */ + export interface ParagraphTextValidationBuilder { + build(): ParagraphTextValidation; + copy(): ParagraphTextValidationBuilder; + requireTextContainsPattern(pattern: string): ParagraphTextValidationBuilder; + requireTextDoesNotContainPattern(pattern: string): ParagraphTextValidationBuilder; + requireTextDoesNotMatchPattern(pattern: string): ParagraphTextValidationBuilder; + requireTextLengthGreaterThanOrEqualTo(number: Integer): ParagraphTextValidationBuilder; + requireTextLengthLessThanOrEqualTo(number: Integer): ParagraphTextValidationBuilder; + requireTextMatchesPattern(pattern: string): ParagraphTextValidationBuilder; + setHelpText(text: string): ParagraphTextValidationBuilder; + } + + /** + * The bean implementation of a Feedback, which contains properties common to all feedback, such as + * display text or links. + * + * Feedback can be added to gradeable Form items. + * + * // Setting feedback which should be automatically shown when a user responds to a question + * // incorrectly. + * var textItem = form.addTextItem().setTitle('Re-hydrating dried fruit is an example of what?'); + * var feedback = FormApp.createFeedback() + * .setDisplayText( + * “Good answer, but not quite right. Please review chapter 4 before next time.”) + * .addLink("http://wikipedia.com/osmosis"); + * textItem.setFeedbackForIncorrect(feedback); + */ + export interface QuizFeedback { + getLinkUrls(): String[]; + getText(): string; + } + + /** + * The base FeedbackBuilder that contains setters for properties common to all feedback, + * such as display text. Used to build Feedback objects. + * + * // Open a form by ID and add a new list item. + * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); + * var item = form.addListItem(); + * item.setTitle('Do you prefer cats or dogs?'); + * item.setChoices([ + * item.createChoice('Dogs', true), + * item.createChoice('Cats', false)]); + * // Add feedback which will be shown for correct responses; ie "Dogs". + * item.setFeedbackForCorrect(FormApp.createFeedback().setText("Dogs rule, cats drool.").build()); + */ + export interface QuizFeedbackBuilder { + addLink(url: string): QuizFeedbackBuilder; + addLink(url: string, displayText: string): QuizFeedbackBuilder; + build(): QuizFeedback; + copy(): QuizFeedbackBuilder; + setText(text: string): QuizFeedbackBuilder; + } + + /** + * A question item that allows the respondent to choose one option from a numbered sequence + * of radio buttons. Items can be accessed or created from a Form. When used in a quiz, + * these items are graded. * * // Open a form by ID and add a new scale item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -628,19 +907,23 @@ declare namespace GoogleAppsScript { export interface ScaleItem { createResponse(response: Integer): ItemResponse; duplicate(): ScaleItem; + getGeneralFeedback(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; getLeftLabel(): string; getLowerBound(): Integer; + getPoints(): Integer; getRightLabel(): string; getTitle(): string; getType(): ItemType; getUpperBound(): Integer; isRequired(): boolean; setBounds(lower: Integer, upper: Integer): ScaleItem; + setGeneralFeedback(feedback: QuizFeedback): ScaleItem; setHelpText(text: string): ScaleItem; setLabels(lower: string, upper: string): ScaleItem; + setPoints(points: Integer): ScaleItem; setRequired(enabled: boolean): ScaleItem; setTitle(title: string): ScaleItem; } @@ -666,8 +949,8 @@ declare namespace GoogleAppsScript { } /** - * A question item that allows the respondent to enter a single line of text. Items can be accessed - * or created from a Form. + * A question item that allows the respondent to enter a single line of text. Items can be + * accessed or created from a Form. When used in a quiz, these items are graded. * * // Open a form by ID and add a new text item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -675,22 +958,77 @@ declare namespace GoogleAppsScript { * item.setTitle('What is your name?'); */ export interface TextItem { + clearValidation(): TextItem; createResponse(response: string): ItemResponse; duplicate(): TextItem; + getGeneralFeedback(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; isRequired(): boolean; + setGeneralFeedback(feedback: QuizFeedback): TextItem; setHelpText(text: string): TextItem; + setPoints(points: Integer): TextItem; setRequired(enabled: boolean): TextItem; setTitle(title: string): TextItem; + setValidation(validation: TextValidation): TextItem; } /** - * A question item that allows the respondent to indicate a time of day. Items can be accessed or - * created from a Form. + * A DataValidation for a TextItem. + * + * // Add a text item to a form and require it to be a number within a range. + * var textItem = form.addTextItem().setTitle('Pick a number between 1 and 100?'); + * var textValidation = FormApp.createTextValidation() + * .setHelpText(“Input was not a number between 1 and 100.”) + * .requireNumberBetween(1, 100) + * .build(); + * textItem.setValidation(textValidation); + */ + export interface TextValidation { + getHelpText(): string; + } + + /** + * A DataValidationBuilder for a TextValidation. + * + * // Add a text item to a form and require it to be a number within a range. + * var textItem = form.addTextItem().setTitle('Pick a number between 1 and 100?'); + * var textValidation = FormApp.createTextValidation() + * .setHelpText(“Input was not a number between 1 and 100.”) + * .requireNumberBetween(1, 100); + * textItem.setValidation(textValidation); + */ + export interface TextValidationBuilder { + build(): TextValidation; + copy(): TextValidationBuilder; + requireNumber(): TextValidationBuilder; + requireNumberBetween(start: Number, end: Number): TextValidationBuilder; + requireNumberEqualTo(number: Number): TextValidationBuilder; + requireNumberGreaterThan(number: Number): TextValidationBuilder; + requireNumberGreaterThanOrEqualTo(number: Number): TextValidationBuilder; + requireNumberLessThan(number: Number): TextValidationBuilder; + requireNumberLessThanOrEqualTo(number: Number): TextValidationBuilder; + requireNumberNotBetween(start: Number, end: Number): TextValidationBuilder; + requireNumberNotEqualTo(number: Number): TextValidationBuilder; + requireTextContainsPattern(pattern: string): TextValidationBuilder; + requireTextDoesNotContainPattern(pattern: string): TextValidationBuilder; + requireTextDoesNotMatchPattern(pattern: string): TextValidationBuilder; + requireTextIsEmail(): TextValidationBuilder; + requireTextIsUrl(): TextValidationBuilder; + requireTextLengthGreaterThanOrEqualTo(number: Integer): TextValidationBuilder; + requireTextLengthLessThanOrEqualTo(number: Integer): TextValidationBuilder; + requireTextMatchesPattern(pattern: string): TextValidationBuilder; + requireWholeNumber(): TextValidationBuilder; + setHelpText(text: string): TextValidationBuilder; + } + + /** + * A question item that allows the respondent to indicate a time of day. Items can be + * accessed or created from a Form. When used in a quiz, these items are graded. * * // Open a form by ID and add a new time item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -700,13 +1038,17 @@ declare namespace GoogleAppsScript { export interface TimeItem { createResponse(hour: Integer, minute: Integer): ItemResponse; duplicate(): TimeItem; + getGeneralFeedback(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; isRequired(): boolean; + setGeneralFeedback(feedback: QuizFeedback): TimeItem; setHelpText(text: string): TimeItem; + setPoints(points: Integer): TimeItem; setRequired(enabled: boolean): TimeItem; setTitle(title: string): TimeItem; } diff --git a/types/google-apps-script/google-apps-script.gmail.d.ts b/types/google-apps-script/google-apps-script.gmail.d.ts index d76f0f1895..fd0bda2b13 100644 --- a/types/google-apps-script/google-apps-script.gmail.d.ts +++ b/types/google-apps-script/google-apps-script.gmail.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Gmail { diff --git a/types/google-apps-script/google-apps-script.groups.d.ts b/types/google-apps-script/google-apps-script.groups.d.ts index dfcf7d79a5..e6833bb840 100644 --- a/types/google-apps-script/google-apps-script.groups.d.ts +++ b/types/google-apps-script/google-apps-script.groups.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Groups { @@ -46,7 +46,7 @@ declare namespace GoogleAppsScript { * Logger.log('You belong to ' + groups.length + ' groups.'); */ export interface GroupsApp { - Role: Role + Role: typeof Role; getGroupByEmail(email: string): Group; getGroups(): Group[]; } diff --git a/types/google-apps-script/google-apps-script.html.d.ts b/types/google-apps-script/google-apps-script.html.d.ts index 3b62ffcb08..f471d23eb3 100644 --- a/types/google-apps-script/google-apps-script.html.d.ts +++ b/types/google-apps-script/google-apps-script.html.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module HTML { @@ -22,6 +22,7 @@ declare namespace GoogleAppsScript { * guide to restrictions in HTML service */ export interface HtmlOutput { + addMetaTag(name: string, content: string): HtmlOutput; append(addedContent: string): HtmlOutput; appendUntrusted(addedContent: string): HtmlOutput; asTemplate(): HtmlTemplate; @@ -29,14 +30,33 @@ declare namespace GoogleAppsScript { getAs(contentType: string): Base.Blob; getBlob(): Base.Blob; getContent(): string; + getFaviconUrl(): string; getHeight(): Integer; + getMetaTags(): HtmlOutputMetaTag[]; getTitle(): string; getWidth(): Integer; setContent(content: string): HtmlOutput; + setFaviconUrl(iconUrl: string): HtmlOutput; setHeight(height: Integer): HtmlOutput; setSandboxMode(mode: SandboxMode): HtmlOutput; setTitle(title: string): HtmlOutput; setWidth(width: Integer): HtmlOutput; + setXFrameOptionsMode(mode: XFrameOptionsMode): HtmlOutput; + } + + /** + * An object that represents a meta tag added to the page by calling + * HtmlOutput.addMetaTag(name, content). + * + * var output = HtmlService.createHtmlOutput('Hello, world!'); + * output.addMetaTag('viewport', 'width=device-width, initial-scale=1'); + * + * var tags = output.getMetaTags(); + * Logger.log('', tags[0].getName(), tags[0].getContent()); + */ + export interface HtmlOutputMetaTag { + getContent(): string; + getName(): string; } /** @@ -47,7 +67,8 @@ declare namespace GoogleAppsScript { * HtmlOutput for what limitations this implies on what can be returned. */ export interface HtmlService { - SandboxMode: SandboxMode + SandboxMode: typeof SandboxMode; + XFrameOptionsMode: typeof XFrameOptionsMode; createHtmlOutput(): HtmlOutput; createHtmlOutput(blob: Base.BlobSource): HtmlOutput; createHtmlOutput(html: string): HtmlOutput; @@ -74,24 +95,17 @@ declare namespace GoogleAppsScript { * scripts. These values can be accessed from HtmlService.SandboxMode, and set by calling * HtmlOutput.setSandboxMode(mode). * + * The NATIVE and EMULATED modes were + * deprecated on October 13, 2015 and both are + * now sunset. + * Only IFRAME mode is now supported. * To protect users from being served malicious HTML or JavaScript, client-side code served from * HTML service executes in a security sandbox that imposes restrictions on the code. The method - * HtmlOutput.setSandboxMode(mode) allows script authors to choose between - * different versions of the sandbox. For more information, see the + * HtmlOutput.setSandboxMode(mode) previously allowed script authors to choose + * between different versions of the sandbox, but now has no effect. For more information, see the * guide to restrictions in HTML service. - * If a script does not set a sandbox mode, Apps Script uses NATIVE mode as the default. - * Prior to February 2014, the default was EMULATED. The default is subject to change. * The IFRAME mode imposes many fewer restrictions than the other sandbox modes and runs - * fastest, but does not work at all in certain older browsers, including Internet Explorer 9. By - * contrast, EMULATED mode is more likely to work in - * older browsers that do not support ECMAScript 5 strict - * mode, most notably Internet Explorer 9. NATIVE mode is the middle ground. If - * NATIVE mode is set but not supported in the user's browser, the sandbox mode falls back - * to EMULATED mode for that user. - * - * // Serve HTML with a defined sandbox mode (in Apps Script server-side code). - * var output = HtmlService.createHtmlOutput('Hello, world!'); - * output.setSandboxMode(HtmlService.SandboxMode.IFRAME); + * fastest, but does not work at all in certain older browsers, including Internet Explorer 9. * * google.script.sandbox.mode * @@ -102,6 +116,23 @@ declare namespace GoogleAppsScript { */ export enum SandboxMode { EMULATED, IFRAME, NATIVE } + /** + * An enum representing the X-Frame-Options modes that can be used for client-side + * HtmlService scripts. These values can be accessed from + * HtmlService.XFrameOptionsMode, and set by calling + * HtmlOutput.setXFrameOptionsMode(mode). + * + * Setting XFrameOptionsMode.ALLOWALL will let any site iframe the page, so the developer + * should implement their own protection against clickjacking. + * If a script does not set an X-Frame-Options mode, Apps Script uses DEFAULT + * mode as the default. + * + * // Serve HTML with no X-Frame-Options header (in Apps Script server-side code). + * var output = HtmlService.createHtmlOutput('Hello, world!'); + * output.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL); + */ + export enum XFrameOptionsMode { ALLOWALL, DEFAULT } + } } diff --git a/types/google-apps-script/google-apps-script.jdbc.d.ts b/types/google-apps-script/google-apps-script.jdbc.d.ts index 16950cff32..ff1a0baf13 100644 --- a/types/google-apps-script/google-apps-script.jdbc.d.ts +++ b/types/google-apps-script/google-apps-script.jdbc.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module JDBC { diff --git a/types/google-apps-script/google-apps-script.language.d.ts b/types/google-apps-script/google-apps-script.language.d.ts index c820f7620e..488568feec 100644 --- a/types/google-apps-script/google-apps-script.language.d.ts +++ b/types/google-apps-script/google-apps-script.language.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Language { diff --git a/types/google-apps-script/google-apps-script.lock.d.ts b/types/google-apps-script/google-apps-script.lock.d.ts index 65891f2844..f255efbc14 100644 --- a/types/google-apps-script/google-apps-script.lock.d.ts +++ b/types/google-apps-script/google-apps-script.lock.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Lock { diff --git a/types/google-apps-script/google-apps-script.mail.d.ts b/types/google-apps-script/google-apps-script.mail.d.ts index 11c97f80fa..2cb8b3cb5f 100644 --- a/types/google-apps-script/google-apps-script.mail.d.ts +++ b/types/google-apps-script/google-apps-script.mail.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Mail { diff --git a/types/google-apps-script/google-apps-script.maps.d.ts b/types/google-apps-script/google-apps-script.maps.d.ts index 02e4ac0195..e9620ee144 100644 --- a/types/google-apps-script/google-apps-script.maps.d.ts +++ b/types/google-apps-script/google-apps-script.maps.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Maps { @@ -93,8 +93,8 @@ declare namespace GoogleAppsScript { * A collection of enums used by DirectionFinder. */ export interface DirectionFinderEnums { - Avoid: Avoid - Mode: Mode + Avoid: typeof Avoid; + Mode: typeof Mode; } /** @@ -200,8 +200,8 @@ declare namespace GoogleAppsScript { * images. */ export interface Maps { - DirectionFinder: DirectionFinderEnums - StaticMap: StaticMapEnums + DirectionFinder: DirectionFinderEnums; + StaticMap: StaticMapEnums; decodePolyline(polyline: string): Number[]; encodePolyline(points: Number[]): string; newDirectionFinder(): DirectionFinder; @@ -299,10 +299,10 @@ declare namespace GoogleAppsScript { * A collection of enums used by StaticMap. */ export interface StaticMapEnums { - Color: Color - Format: Format - MarkerSize: MarkerSize - Type: Type + Color: typeof Color; + Format: typeof Format; + MarkerSize: typeof MarkerSize; + Type: typeof Type; } /** diff --git a/types/google-apps-script/google-apps-script.optimization.d.ts b/types/google-apps-script/google-apps-script.optimization.d.ts index 0217618a25..8ac192c1e6 100644 --- a/types/google-apps-script/google-apps-script.optimization.d.ts +++ b/types/google-apps-script/google-apps-script.optimization.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Optimization { @@ -86,6 +86,7 @@ declare namespace GoogleAppsScript { addConstraint(lowerBound: Number, upperBound: Number): LinearOptimizationConstraint; addVariable(name: string, lowerBound: Number, upperBound: Number): LinearOptimizationEngine; addVariable(name: string, lowerBound: Number, upperBound: Number, type: VariableType): LinearOptimizationEngine; + addVariable(name: string, lowerBound: Number, upperBound: Number, type: VariableType, objectiveCoefficient: Number): LinearOptimizationEngine; setMaximization(): LinearOptimizationEngine; setMinimization(): LinearOptimizationEngine; setObjectiveCoefficient(variableName: string, coefficient: Number): LinearOptimizationEngine; @@ -146,8 +147,8 @@ declare namespace GoogleAppsScript { * } */ export interface LinearOptimizationService { - Status: Status - VariableType: VariableType + Status: typeof Status; + VariableType: typeof VariableType; createEngine(): LinearOptimizationEngine; } diff --git a/types/google-apps-script/google-apps-script.properties.d.ts b/types/google-apps-script/google-apps-script.properties.d.ts index 9ceb24608e..5622fec6f8 100644 --- a/types/google-apps-script/google-apps-script.properties.d.ts +++ b/types/google-apps-script/google-apps-script.properties.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Properties { diff --git a/types/google-apps-script/google-apps-script.script.d.ts b/types/google-apps-script/google-apps-script.script.d.ts index bd1a5340d9..209feaa0a1 100644 --- a/types/google-apps-script/google-apps-script.script.d.ts +++ b/types/google-apps-script/google-apps-script.script.d.ts @@ -1,13 +1,13 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - - - +/// +/// +/// +/// +/// declare namespace GoogleAppsScript { export module Script { @@ -118,18 +118,18 @@ declare namespace GoogleAppsScript { * triggers and control publishing the script as a service. */ export interface ScriptApp { - AuthMode: AuthMode - AuthorizationStatus: AuthorizationStatus - EventType: EventType - InstallationSource: InstallationSource - TriggerSource: TriggerSource - WeekDay: Base.Weekday + AuthMode: typeof AuthMode; + AuthorizationStatus: typeof AuthorizationStatus; + EventType: typeof EventType; + InstallationSource: typeof InstallationSource; + TriggerSource: typeof TriggerSource; + WeekDay: typeof Base.Weekday; deleteTrigger(trigger: Trigger): void; getAuthorizationInfo(authMode: AuthMode): AuthorizationInfo; getInstallationSource(): InstallationSource; getOAuthToken(): string; - getProjectKey(): string; getProjectTriggers(): Trigger[]; + getScriptId(): string; getService(): Service; getUserTriggers(document: Document.Document): Trigger[]; getUserTriggers(form: Forms.Form): Trigger[]; @@ -137,13 +137,27 @@ declare namespace GoogleAppsScript { invalidateAuth(): void; newStateToken(): StateTokenBuilder; newTrigger(functionName: string): TriggerBuilder; + getProjectKey(): string; getScriptTriggers(): Trigger[]; } + /** + * Access and manipulate script publishing. + */ + export interface Service { + Restriction: typeof Service.Restriction; + disable(): void; + getUrl(): string; + isEnabled(): boolean; + enable(restriction: Service.Restriction): void; + } + /** * */ - export enum Service { MYSELF, DOMAIN, ALL } + namespace Service { + export enum Restriction { MYSELF, DOMAIN, ALL } + } /** * Builder for spreadsheet triggers. diff --git a/types/google-apps-script/google-apps-script.sites.d.ts b/types/google-apps-script/google-apps-script.sites.d.ts index acf1f8d6dc..6b21ffe529 100644 --- a/types/google-apps-script/google-apps-script.sites.d.ts +++ b/types/google-apps-script/google-apps-script.sites.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Sites { @@ -12,6 +12,12 @@ declare namespace GoogleAppsScript { * A Sites Attachment such as a file attached to a page. * * Note that an Attachment is a Blob and can be used anywhere Blob input is expected. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. * * var filesPage = SitesApp.getSite('example.com', 'mysite').getChildByName("files"); * var attachments = filesPage.getAttachments(); @@ -42,11 +48,23 @@ declare namespace GoogleAppsScript { /** * A typesafe enum for sites attachment type. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export enum AttachmentType { WEB, HOSTED } /** * A Sites Column - a column from a Sites List page. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export interface Column { deleteColumn(): void; @@ -57,6 +75,12 @@ declare namespace GoogleAppsScript { /** * A Comment attached to any Sites page. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export interface Comment { deleteComment(): void; @@ -72,6 +96,12 @@ declare namespace GoogleAppsScript { /** * A Sites ListItem - a list element from a Sites List page. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export interface ListItem { deleteListItem(): void; @@ -87,6 +117,12 @@ declare namespace GoogleAppsScript { /** * A Page on a Google Site. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export interface Page { addColumn(name: string): Column; @@ -113,8 +149,6 @@ declare namespace GoogleAppsScript { getChildren(): Page[]; getChildren(options: Object): Page[]; getColumns(): Column[]; - getComments(): Comment[]; - getComments(optOptions: Object): Comment[]; getDatePublished(): Date; getHtmlContent(): string; getIsDraft(): boolean; @@ -139,17 +173,31 @@ declare namespace GoogleAppsScript { setParent(parent: Page): Page; setTitle(title: string): Page; addComment(content: string): Comment; + getComments(): Comment[]; + getComments(optOptions: Object): Comment[]; getPageName(): string; getSelfLink(): string; } /** * A typesafe enum for sites page type. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export enum PageType { WEB_PAGE, LIST_PAGE, ANNOUNCEMENT, ANNOUNCEMENTS_PAGE, FILE_CABINET_PAGE } /** * An object representing a Google Site. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export interface Site { addEditor(emailAddress: string): Site; @@ -215,10 +263,16 @@ declare namespace GoogleAppsScript { /** * Create and access Google Sites. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export interface SitesApp { - AttachmentType: AttachmentType - PageType: PageType + AttachmentType: typeof AttachmentType; + PageType: typeof PageType; copySite(domain: string, name: string, title: string, summary: string, site: Site): Site; createSite(domain: string, name: string, title: string, summary: string): Site; getActivePage(): Page; diff --git a/types/google-apps-script/google-apps-script.spreadsheet.d.ts b/types/google-apps-script/google-apps-script.spreadsheet.d.ts index a8f554e4bc..74ca8b2e79 100644 --- a/types/google-apps-script/google-apps-script.spreadsheet.d.ts +++ b/types/google-apps-script/google-apps-script.spreadsheet.d.ts @@ -1,15 +1,21 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - - +/// +/// +/// +/// declare namespace GoogleAppsScript { export module Spreadsheet { + /** + * Styles that can be set on a range using + * Range.setBorder(top, left, bottom, right, vertical, horizontal, color, style). + */ + export enum BorderStyle { DOTTED, DASHED, SOLID } + /** * The chart's position within a sheet. Can be updated using the EmbeddedChart.modify() * function. @@ -135,6 +141,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -175,6 +183,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -265,6 +275,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -288,6 +300,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -318,6 +332,88 @@ declare namespace GoogleAppsScript { useLogScale(): EmbeddedColumnChartBuilder; } + /** + * Builder for combo charts. For more details, see the Gviz + * documentation. + */ + export interface EmbeddedComboChartBuilder { + addRange(range: Range): EmbeddedChartBuilder; + asAreaChart(): EmbeddedAreaChartBuilder; + asBarChart(): EmbeddedBarChartBuilder; + asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; + asLineChart(): EmbeddedLineChartBuilder; + asPieChart(): EmbeddedPieChartBuilder; + asScatterChart(): EmbeddedScatterChartBuilder; + asTableChart(): EmbeddedTableChartBuilder; + build(): EmbeddedChart; + getChartType(): Charts.ChartType; + getContainer(): ContainerInfo; + getRanges(): Range[]; + removeRange(range: Range): EmbeddedChartBuilder; + reverseCategories(): EmbeddedComboChartBuilder; + setBackgroundColor(cssValue: string): EmbeddedComboChartBuilder; + setChartType(type: Charts.ChartType): EmbeddedChartBuilder; + setColors(cssValues: String[]): EmbeddedComboChartBuilder; + setLegendPosition(position: Charts.Position): EmbeddedComboChartBuilder; + setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder; + setOption(option: string, value: Object): EmbeddedChartBuilder; + setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder; + setRange(start: Number, end: Number): EmbeddedComboChartBuilder; + setStacked(): EmbeddedComboChartBuilder; + setTitle(chartTitle: string): EmbeddedComboChartBuilder; + setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder; + setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder; + setXAxisTitle(title: string): EmbeddedComboChartBuilder; + setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder; + setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder; + setYAxisTitle(title: string): EmbeddedComboChartBuilder; + setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder; + useLogScale(): EmbeddedComboChartBuilder; + } + + /** + * Builder for histogram charts. For more details, see the Gviz + * documentation. + */ + export interface EmbeddedHistogramChartBuilder { + addRange(range: Range): EmbeddedChartBuilder; + asAreaChart(): EmbeddedAreaChartBuilder; + asBarChart(): EmbeddedBarChartBuilder; + asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; + asLineChart(): EmbeddedLineChartBuilder; + asPieChart(): EmbeddedPieChartBuilder; + asScatterChart(): EmbeddedScatterChartBuilder; + asTableChart(): EmbeddedTableChartBuilder; + build(): EmbeddedChart; + getChartType(): Charts.ChartType; + getContainer(): ContainerInfo; + getRanges(): Range[]; + removeRange(range: Range): EmbeddedChartBuilder; + reverseCategories(): EmbeddedHistogramChartBuilder; + setBackgroundColor(cssValue: string): EmbeddedHistogramChartBuilder; + setChartType(type: Charts.ChartType): EmbeddedChartBuilder; + setColors(cssValues: String[]): EmbeddedHistogramChartBuilder; + setLegendPosition(position: Charts.Position): EmbeddedHistogramChartBuilder; + setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder; + setOption(option: string, value: Object): EmbeddedChartBuilder; + setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder; + setRange(start: Number, end: Number): EmbeddedHistogramChartBuilder; + setStacked(): EmbeddedHistogramChartBuilder; + setTitle(chartTitle: string): EmbeddedHistogramChartBuilder; + setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder; + setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder; + setXAxisTitle(title: string): EmbeddedHistogramChartBuilder; + setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder; + setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder; + setYAxisTitle(title: string): EmbeddedHistogramChartBuilder; + setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder; + useLogScale(): EmbeddedHistogramChartBuilder; + } + /** * Builder for line charts. For more details, see the Gviz * documentation. @@ -327,6 +423,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -367,6 +465,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -398,6 +498,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -438,6 +540,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -462,6 +566,20 @@ declare namespace GoogleAppsScript { useAlternatingRowStyle(alternate: boolean): EmbeddedTableChartBuilder; } + /** + * Create, access and modify named ranges in a spreadsheet. + * Named ranges are ranges that have associated string aliases. + * They can be viewed and edited via the Sheets UI under the + * Data > Named ranges... menu. + */ + export interface NamedRange { + getName(): string; + getRange(): Range; + remove(): void; + setName(name: string): NamedRange; + setRange(range: Range): NamedRange; + } + /** * * Deprecated. For spreadsheets created in the newer version of Google Sheets, use the more powerful @@ -539,6 +657,7 @@ declare namespace GoogleAppsScript { removeEditors(emailAddresses: String[]): Protection; setDescription(description: string): Protection; setDomainEdit(editable: boolean): Protection; + setNamedRange(namedRange: NamedRange): Protection; setRange(range: Range): Protection; setRangeName(rangeName: string): Protection; setUnprotectedRanges(ranges: Range[]): Protection; @@ -599,6 +718,8 @@ declare namespace GoogleAppsScript { getDataTable(firstRowIsHeader: boolean): Charts.DataTable; getDataValidation(): DataValidation; getDataValidations(): DataValidation[][]; + getDisplayValue(): string; + getDisplayValues(): String[][]; getFontColor(): string; getFontColors(): String[][]; getFontFamilies(): String[][]; @@ -621,6 +742,7 @@ declare namespace GoogleAppsScript { getHorizontalAlignments(): String[][]; getLastColumn(): Integer; getLastRow(): Integer; + getMergedRanges(): Range[]; getNote(): string; getNotes(): String[][]; getNumColumns(): Integer; @@ -640,6 +762,7 @@ declare namespace GoogleAppsScript { isBlank(): boolean; isEndColumnBounded(): boolean; isEndRowBounded(): boolean; + isPartOfMerge(): boolean; isStartColumnBounded(): boolean; isStartRowBounded(): boolean; merge(): Range; @@ -654,6 +777,7 @@ declare namespace GoogleAppsScript { setBackgroundRGB(red: Integer, green: Integer, blue: Integer): Range; setBackgrounds(color: String[][]): Range; setBorder(top: boolean, left: boolean, bottom: boolean, right: boolean, vertical: boolean, horizontal: boolean): Range; + setBorder(top: boolean, left: boolean, bottom: boolean, right: boolean, vertical: boolean, horizontal: boolean, color: string, style: BorderStyle): Range; setDataValidation(rule: DataValidation): Range; setDataValidations(rules: DataValidation[][]): Range; setFontColor(color: string): Range; @@ -718,6 +842,7 @@ declare namespace GoogleAppsScript { getMaxColumns(): Integer; getMaxRows(): Integer; getName(): string; + getNamedRanges(): NamedRange[]; getParent(): Spreadsheet; getProtections(type: ProtectionType): Protection[]; getRange(row: Integer, column: Integer): Range; @@ -728,6 +853,7 @@ declare namespace GoogleAppsScript { getSheetId(): Integer; getSheetName(): string; getSheetValues(startRow: Integer, startColumn: Integer, numRows: Integer, numColumns: Integer): Object[][]; + getTabColor(): string; hideColumn(column: Range): void; hideColumns(columnIndex: Integer): void; hideColumns(columnIndex: Integer, numColumns: Integer): void; @@ -764,6 +890,7 @@ declare namespace GoogleAppsScript { setFrozenRows(rows: Integer): void; setName(name: string): Sheet; setRowHeight(rowPosition: Integer, height: Integer): Sheet; + setTabColor(color: string): Sheet; showColumns(columnIndex: Integer): void; showColumns(columnIndex: Integer, numColumns: Integer): void; showRows(rowIndex: Integer): void; @@ -815,6 +942,7 @@ declare namespace GoogleAppsScript { getLastColumn(): Integer; getLastRow(): Integer; getName(): string; + getNamedRanges(): NamedRange[]; getNumSheets(): Integer; getOwner(): Base.User; getProtections(type: ProtectionType): Protection[]; @@ -893,8 +1021,9 @@ declare namespace GoogleAppsScript { * the parent class for the Spreadsheet service. */ export interface SpreadsheetApp { - DataValidationCriteria: DataValidationCriteria - ProtectionType: ProtectionType + BorderStyle: typeof BorderStyle; + DataValidationCriteria: typeof DataValidationCriteria; + ProtectionType: typeof ProtectionType; create(name: string): Spreadsheet; create(name: string, rows: Integer, columns: Integer): Spreadsheet; flush(): void; diff --git a/types/google-apps-script/google-apps-script.types.d.ts b/types/google-apps-script/google-apps-script.types.d.ts index d5d2989b5c..5204a8a2a4 100644 --- a/types/google-apps-script/google-apps-script.types.d.ts +++ b/types/google-apps-script/google-apps-script.types.d.ts @@ -3,7 +3,7 @@ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace GoogleAppsScript { +declare module GoogleAppsScript { type BigNumber = any; type Byte = number; type Integer = number; diff --git a/types/google-apps-script/google-apps-script.ui.d.ts b/types/google-apps-script/google-apps-script.ui.d.ts index 6d08082dc8..bd4424351e 100644 --- a/types/google-apps-script/google-apps-script.ui.d.ts +++ b/types/google-apps-script/google-apps-script.ui.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module UI { @@ -3263,13 +3263,13 @@ declare namespace GoogleAppsScript { * * deprecated on December 11, 2014. To create user interfaces, use the * HTML service instead. - * Create user interfaces for use inside Google Apps or as standalone services. + * Create user interfaces for use inside G Suite or as standalone services. */ export interface UiApp { - DateTimeFormat: DateTimeFormat - FileType: FileType - HorizontalAlignment: HorizontalAlignment - VerticalAlignment: VerticalAlignment + DateTimeFormat: typeof DateTimeFormat; + FileType: typeof FileType; + HorizontalAlignment: typeof HorizontalAlignment; + VerticalAlignment: typeof VerticalAlignment; createApplication(): UiInstance; getActiveApplication(): UiInstance; getUserAgent(): string; diff --git a/types/google-apps-script/google-apps-script.url-fetch.d.ts b/types/google-apps-script/google-apps-script.url-fetch.d.ts index 94db3c3a7c..b9ede5163e 100644 --- a/types/google-apps-script/google-apps-script.url-fetch.d.ts +++ b/types/google-apps-script/google-apps-script.url-fetch.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module URL_Fetch { @@ -25,30 +25,6 @@ declare namespace GoogleAppsScript { getResponseCode(): Integer; } - /** - * - * Deprecated. This class is deprecated and should not be used in new scripts. - * Represents configuration settings for an OAuth-enabled remote service. - * See also - * - * UrlFetchApp - */ - export interface OAuthConfig { - getAccessTokenUrl(): string; - getAuthorizationUrl(): string; - getMethod(): string; - getParamLocation(): string; - getRequestTokenUrl(): string; - getServiceName(): string; - setAccessTokenUrl(url: string): void; - setAuthorizationUrl(url: string): void; - setConsumerKey(consumerKey: string): void; - setConsumerSecret(consumerSecret: string): void; - setMethod(method: string): void; - setParamLocation(location: string): void; - setRequestTokenUrl(url: string): void; - } - /** * Fetch resources and communicate with other hosts over the Internet. * @@ -58,8 +34,6 @@ declare namespace GoogleAppsScript { * and scaling purposes. * See also * - * OAuthConfig - * * HTTPResponse */ export interface UrlFetchApp { @@ -67,8 +41,6 @@ declare namespace GoogleAppsScript { fetch(url: string, params: Object): HTTPResponse; getRequest(url: string): Object; getRequest(url: string, params: Object): Object; - addOAuthService(serviceName: string): OAuthConfig; - removeOAuthService(serviceName: string): void; } } diff --git a/types/google-apps-script/google-apps-script.utilities.d.ts b/types/google-apps-script/google-apps-script.utilities.d.ts index 3deb1734f4..2beda0bfc1 100644 --- a/types/google-apps-script/google-apps-script.utilities.d.ts +++ b/types/google-apps-script/google-apps-script.utilities.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Utilities { @@ -28,9 +28,9 @@ declare namespace GoogleAppsScript { * and other miscellaneous tasks. */ export interface Utilities { - Charset: Charset - DigestAlgorithm: DigestAlgorithm - MacAlgorithm: MacAlgorithm + Charset: typeof Charset; + DigestAlgorithm: typeof DigestAlgorithm; + MacAlgorithm: typeof MacAlgorithm; base64Decode(encoded: string): Byte[]; base64Decode(encoded: string, charset: Charset): Byte[]; base64DecodeWebSafe(encoded: string): Byte[]; @@ -51,6 +51,7 @@ declare namespace GoogleAppsScript { computeRsaSha256Signature(value: string, key: string, charset: Charset): Byte[]; formatDate(date: Date, timeZone: string, format: string): string; formatString(template: string, ...args: Object[]): string; + getUuid(): string; newBlob(data: Byte[]): Base.Blob; newBlob(data: Byte[], contentType: string): Base.Blob; newBlob(data: Byte[], contentType: string, name: string): Base.Blob; diff --git a/types/google-apps-script/google-apps-script.xml-service.d.ts b/types/google-apps-script/google-apps-script.xml-service.d.ts index d45d4d16a8..664fbfc2b9 100644 --- a/types/google-apps-script/google-apps-script.xml-service.d.ts +++ b/types/google-apps-script/google-apps-script.xml-service.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module XML_Service { @@ -283,9 +283,9 @@ declare namespace GoogleAppsScript { /** * This service allows scripts to parse, navigate, and programmatically create XML documents. * - * // Log the title and labels for the first page of blog posts on the Google Apps Developer blog. + * // Log the title and labels for the first page of blog posts on the G Suite Developer blog. * function parseXml() { - * var url = 'http://googleappsdeveloper.blogspot.com/atom.xml'; + * var url = 'https://gsuite-developers.googleblog.com/atom.xml'; * var xml = UrlFetchApp.fetch(url).getContentText(); * var document = XmlService.parse(xml); * var root = document.getRootElement(); @@ -320,7 +320,7 @@ declare namespace GoogleAppsScript { * } */ export interface XmlService { - ContentTypes: ContentType + ContentTypes: typeof ContentType; createCdata(text: string): Cdata; createComment(text: string): Comment; createDocType(elementName: string): DocType; diff --git a/types/google-cloud__storage/google-cloud__storage-tests.ts b/types/google-cloud__storage/google-cloud__storage-tests.ts new file mode 100644 index 0000000000..a301aa063c --- /dev/null +++ b/types/google-cloud__storage/google-cloud__storage-tests.ts @@ -0,0 +1,398 @@ +// import file system i/o api +import * as fs from "fs"; + +// import Google Cloud Storage +import { + Acl, + Bucket, + Channel, + File, + ApiResponse, + BucketConfig, + BucketFileOptions, + BucketGetOptions, + BucketMetadata, + BucketPrivacyOptions, + BucketQuery, + ChannelConfig, + DownloadOptions, + FileMetadata, + FilePrivateOptions, + ReadStreamOptions, + SignedPolicy, + SignedPolicyOptions, + SignedUrlConfig, + WriteStreamOptions, + UploadOptions, + Storage +} from "@google-cloud/storage"; + +/** + * Test the storage service. + * @class TestStorage + */ +export class TestStorage { + // constants + static BUCKET_CONFIG: BucketConfig = { + multiRegional: true + }; + + // import Storage class + static gcs: Storage = new Storage(); + + // the bucket + private buckets: Bucket[] = []; + + /** + * @constructor + */ + constructor() { + // nothing to do + } + + /** + * Returns the bucket. + * @method bucket + * @param {string} name + * @return {Bucket} + */ + bucket(name: string): Bucket { + return TestStorage.gcs.bucket(name); + } + + /** + * Create a new bucket. + * @param {string} name + * @param {BucketConfig} metadata + * @return {Promise<[Bucket, ApiResponse]>} + */ + createBucket(name: string, config?: BucketConfig): Promise<[Bucket, ApiResponse]> { + // overwrite default values with custom config + config = Object.assign(TestStorage.BUCKET_CONFIG, config); + + return TestStorage.gcs.createBucket(name, config); + } + + /** + * Query for buckets. + * @param {BucketQuery} query + */ + getBuckets(query?: BucketQuery): Promise<[Bucket[]]> { + return TestStorage.gcs.getBuckets(query); + } +} + +/** + * The bucket API wrapper. + * @class TestBucket + */ +export class TestBucket { + // the bucket in the cloud + bucket: Bucket; + + /** + * Create a bucket. + * @param {BucketConfig} config + * @return {Promise<[Bucket, ApiResponse]>} + */ + create(config?: BucketConfig): Promise<[Bucket, ApiResponse]> { + return this.bucket.create(config); + } + + /** + * Create a channel that will be notified when objects in this bucket changes. + * @method createChannel + * @param {string} id + * @param {ChannelConfig} config + * @return {Promise<[Channel, ApiResponse]>} + */ + createChannel(id: string, config: ChannelConfig): Promise<[Channel, ApiResponse]> { + return this.bucket.createChannel(id, config); + } + + /** + * Delete the bucket. + * @method delete + * @return {Promise<[ApiResponse]>} + */ + delete(): Promise<[ApiResponse]> { + return this.bucket.delete(); + } + + /** + * Iterate over the bucket's files, calling file.delete() on each. + * @method deleteFiles + * @return {Promise} + */ + deleteFiles(query?: BucketQuery): Promise { + return this.bucket.deleteFiles(query); + } + + /** + * Check if the bucket exists. + * @method exists + * @return {Promise<[boolean]>} + */ + exists(): Promise<[boolean]> { + return this.bucket.exists(); + } + + /** + * Create a File object. + * @method file + * @param {string} name + * @param {BucketFileOptions} options + */ + file(name: string, options?: BucketFileOptions): File { + return this.bucket.file(name); + } + + /** + * Get a bucket if it exists. + * @method get + * @param {BucketGetOptions} options + */ + get(options?: BucketGetOptions): Promise<[Bucket, ApiResponse]> { + return this.bucket.get(options); + } + + /** + * Get File objects for the files currently in the bucket + * @method getFiles + * @param {BucketQuery} query + * @return {Promise<[File[]]>} + */ + getFiles(query?: BucketQuery): Promise<[File[]]> { + return this.bucket.getFiles(query); + } + + /** + * Get File objects for the files currently in the bucket as a readable object stream. + * @method getFilesStream + * @param {BucketQuery} query + * @return {ReadStream} + */ + getFilesStream(query?: BucketQuery): fs.ReadStream { + return this.bucket.getFilesStream(query); + } + + /** + * Get the bucket's metadata. + * @method getMetadata + * @return {Promise<[BucketMetadata, ApiResponse]>} + */ + getMetadata(): Promise<[BucketMetadata, ApiResponse]> { + return this.bucket.getMetadata(); + } + + /** + * Make the bucket listing private. + * @method makePrivate + * @param {} options + * @return Promise<[File[]]> + */ + makePrivate(options?: BucketPrivacyOptions): Promise<[File[]]> { + return this.bucket.makePrivate(options); + } + + /** + * Make the bucket publicly readable. + * @method makePublic + * @param {} options + * @return Promise<[File[]]> + */ + makePublic(options?: BucketPrivacyOptions): Promise<[File[]]> { + return this.bucket.makePublic(options); + } + + /** + * Set the bucket's metadata. + * @method setMetadata + * @param {BucketMetadata} metadata + * @return {Promise<[ApiResponse]>} + */ + setMetadata(metadata?: BucketMetadata): Promise<[ApiResponse]> { + return this.bucket.setMetadata(metadata); + } + + /** + * Upload a file. + * @method upload + * @param {localPath} string + * @param {UploadOptions} options + */ + upload(localPath: string, options?: UploadOptions): Promise<[File]> { + return this.bucket.upload(localPath, options); + } +} + +/** + * The file API wrapper. + * @class TestFile + */ +export class TestFile { + // the file in the cloud + file: File; + + /** + * Copy this file to another file. + * By default, this will copy the file to the same bucket, but you can choose to copy it to another + * Bucket by providing a Bucket or File object or a URL starting with "gs:// ". + * @method copy + * @param {string} destination + * @return Promise<[File, ApiResponse]> + */ + + copy(destination: string | Bucket | File): Promise<[File, ApiResponse]> { + return this.file.copy(destination); + } + + /** + * Create a readable stream to read the contents of the remote file. + * It can be piped to a writable stream or listened to for 'data' events to read a file's contents. + * @method createReadStream + * @param {ReadStreamOptions} options + * @return {ReadStream} + */ + createReadStream(options?: ReadStreamOptions): fs.ReadStream { + return this.file.createReadStream(options); + } + + /** + * Create a writable stream to overwrite the contents of the file in your bucket. + * @method createWriteStream + * @param {WriteStreamOptions} options + * @return {WriteStream} + */ + createWriteStream(options?: WriteStreamOptions): fs.WriteStream { + return this.file.createWriteStream(options); + } + + /** + * Delete the file. + * @method delete + * @return {Promise<[ApiResponse]>} + */ + delete(): Promise<[ApiResponse]> { + return this.file.delete(); + } + + /** + * Convenience method to download a file into memory or to a local destination. + * @method download + * @param {DownloadOptions} options + * @return {Promise<[string]>} + */ + download(options?: DownloadOptions): Promise<[string]> { + return this.file.download(options); + } + + /** + * Check if the file exists. + * @method exists + * @return {Promise<[boolean]>} + */ + exists(): Promise<[boolean]> { + return this.file.exists(); + } + + /** + * Get a file object and its metadata if it exists. + * @method get + * @return {Promise<[File, ApiResponse]>} + */ + get(): Promise<[File, ApiResponse]> { + return this.file.get(); + } + + /** + * Get the file's metadata. + * @method getMetadata + * @return {Promise<[FileMetadata, ApiResponse]>} + */ + getMetadata(): Promise<[FileMetadata, ApiResponse]> { + return this.file.getMetadata(); + } + + /** + * Get a signed policy document to allow a user to upload data with a POST request + * @method getSignedPolicy + * @param {SignedPolicyOptions} options + * @return {Promise<[SignedPolicy]>} + */ + getSignedPolicy(options?: SignedPolicyOptions): Promise<[SignedPolicy]> { + return this.file.getSignedPolicy(options); + } + + /** + * Get a signed URL to allow limited time access to the file + * @method getSignedUrl + * @param {SignedUrlConfig} config + * @return {Promise<[string]>} + */ + getSignedUrl(config?: SignedUrlConfig): Promise<[string]> { + return this.file.getSignedUrl(config); + } + + /** + * Make a file private to the project and remove all other permissions. + * @method makePrivate + * @param {FilePrivateOptions} options + * @return {Promise<[ApiResponse]>} + */ + makePrivate(options?: FilePrivateOptions): Promise<[ApiResponse]> { + return this.file.makePrivate(options); + } + + /** + * Set a file to be publicly readable and maintain all previous permissions. + * @method makePublic + * @return {Promise<[ApiResponse]>} + */ + makePublic(): Promise<[ApiResponse]> { + return this.file.makePublic(); + } + + /** + * Move this file to another location. + * By default, this will move the file to the same bucket, but you can choose to move it to + * another Bucket by providing a Bucket or File object or a URL beginning with "gs:// ". + * @method move + * @param {string|Bucket|File} destination + * @return {Promise<[File, ApiResponse]>} + */ + move(destination: string | Bucket | File): Promise<[File, ApiResponse]> { + return this.file.move(destination); + } + + /** + * Write arbitrary data to a file. + * @param {string} data + * @param {WriteStreamOptions} options + * @return {Promise} + */ + save(data: string, options?: WriteStreamOptions): Promise { + return this.file.save(data); + } + + /** + * The Storage API allows you to use a custom key for server-side encryption. + * @param {string|Buffer} encryptionKey + * @return {File} + */ + setEncryptionKey(encryptionKey: string | Buffer): File { + return this.file.setEncryptionKey(encryptionKey); + } + + /** + * Merge the given metadata with the current remote file's metadata. + * This will set metadata if it was previously unset or update previously set metadata. + * To unset previously set metadata, set its value to null. + * @method setMetadata + * @param {FileMetadata} metadata + * @return {Promise<[ApiResponse]>} + */ + setMetadata(metadata: FileMetadata): Promise<[ApiResponse]> { + return this.file.setMetadata(metadata); + } +} diff --git a/types/google-cloud__storage/index.d.ts b/types/google-cloud__storage/index.d.ts new file mode 100644 index 0000000000..84f4329601 --- /dev/null +++ b/types/google-cloud__storage/index.d.ts @@ -0,0 +1,371 @@ +// Type definitions for @google-cloud/storage 1.1 +// Project: https://github.com/GoogleCloudPlatform/google-cloud-node/tree/master/packages/storage +// Definitions by: Brian Love +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "@google-cloud/storage" { + export * from "@google-cloud/storage/bucket"; + export * from "@google-cloud/storage/channel"; + export * from "@google-cloud/storage/file"; + export * from "@google-cloud/storage/storage"; +} + +declare module "@google-cloud/storage/bucket" { + import { ReadStream } from "fs"; + import { Channel, ChannelConfig } from "@google-cloud/storage/channel"; + import { File } from "@google-cloud/storage/file"; + import { + Acl, + ApiResponse, + UploadOptions + } from "@google-cloud/storage/storage"; + + /** + * A bucket in the cloud. + */ + class Bucket { + acl: Acl; + combine(sources: string[] | File[], destination: string [] | File[]): Promise<[File, ApiResponse]>; + create(config?: BucketConfig): Promise<[Bucket, ApiResponse]>; + createChannel(id: string, config: ChannelConfig): Promise<[Channel, ApiResponse]>; + delete(): Promise<[ApiResponse]>; + deleteFiles(query?: BucketQuery): Promise; + exists(): Promise<[boolean]>; + file(name: string, options?: BucketFileOptions): File; + get(options?: BucketGetOptions): Promise<[Bucket, ApiResponse]>; + getFiles(query?: BucketQuery): Promise<[File[]]>; + getFilesStream(query?: BucketQuery): ReadStream; + getMetadata(): Promise<[BucketMetadata, ApiResponse]>; + id: string; + makePrivate(options?: BucketPrivacyOptions): Promise<[File[]]>; + makePublic(options?: BucketPrivacyOptions): Promise<[File[]]>; + metadata: BucketMetadata; + name: string; + setMetadata(metadata?: BucketMetadata): Promise<[ApiResponse]>; + upload(localPath: string, options?: UploadOptions): Promise<[File]>; + } + + /** + * Bucket configuration. + */ + interface BucketConfig { + coldline?: boolean; + dra?: boolean; + location?: string; + multiRegional?: boolean; + nearline?: boolean; + regional?: boolean; + versioning?: { + enabled?: boolean + }; + } + + /** + * Options for getting a file. + */ + interface BucketFileOptions { + generation?: string | number; + } + + /** + * Options for getting a bucket. + */ + interface BucketGetOptions { + autoCreate?: boolean; + } + + /** + * Bucket metadata. + */ + interface BucketMetadata { + etag?: string; + id?: string; + kind?: string; + location?: string; + metageneration?: string; + name?: string; + projectNumber?: string; + selfLink?: string; + storageClass?: string; + timeCreated?: string; + updated?: string; + } + + /** + * The options for making the bucket private. + */ + interface BucketPrivacyOptions { + includeFiles?: boolean; + force?: boolean; + } + + /** + * Query a bucket. + */ + interface BucketQuery { + autoPaginate?: boolean; + delimiter?: string; + prefix?: string; + maxApiCalls?: number; + maxResults?: number; + pageToken?: string; + versions?: boolean; + } +} + +declare module "@google-cloud/storage/channel" { + import { ApiResponse } from "@google-cloud/storage/storage"; + + /** + * This class allows you interact with Google Cloud Storage. + */ + class Channel { + stop(): Promise<[ApiResponse]>; + } + + /** + * Channel configuration. + */ + interface ChannelConfig { + address: string; + } +} + +declare module "@google-cloud/storage/file" { + import { ReadStream, WriteStream } from "fs"; + import { Bucket } from "@google-cloud/storage/bucket"; + import { + Acl, + ApiResponse, + DownloadOptions, + ReadStreamOptions, + UploadOptions, + WriteStreamOptions + } from "@google-cloud/storage/storage"; + + /** + * Options for specifying the content length range. + */ + interface ContentLengthRange { + max?: number; + min?: number; + } + + /** + * A file in the cloud. + */ + class File { + acl: Acl; + copy(destination: string | Bucket | File): Promise<[File, ApiResponse]>; + createReadStream(options?: ReadStreamOptions): ReadStream; + createWriteStream(options?: WriteStreamOptions): WriteStream; + delete(): Promise<[ApiResponse]>; + download(options?: DownloadOptions): Promise<[string]>; + exists(): Promise<[boolean]>; + get(): Promise<[File, ApiResponse]>; + getMetadata(): Promise<[FileMetadata, ApiResponse]>; + getSignedPolicy(options?: SignedPolicyOptions): Promise<[SignedPolicy]>; + getSignedUrl(config?: SignedUrlConfig): Promise<[string]>; + makePrivate(options?: FilePrivateOptions): Promise<[ApiResponse]>; + makePublic(): Promise<[ApiResponse]>; + move(destination: string | Bucket | File): Promise<[File, ApiResponse]>; + name: string; + save(data: string, options?: WriteStreamOptions): Promise; + setEncryptionKey(encryptionKey: string | Buffer): File; + setMetadata(metadata: FileMetadata): Promise<[ApiResponse]>; + } + + /** + * File metadata. + */ + interface FileMetadata { + contentType?: string; + } + + /** + * Options when setting the file as private. + */ + interface FilePrivateOptions { + strict?: boolean; + } + + /** + * A signed policy allowing a user to upload a file with a POST. + */ + interface SignedPolicy { + base64?: string; + signature?: string; + string?: string; + } + + /** + * Options when obtaining the signed policy. + */ + interface SignedPolicyOptions { + acl?: string; + contentLengthRange?: ContentLengthRange; + equals?: string[] | [string[]]; + expires?: number | string; + max?: number; + min?: number; + startsWith?: string[] | [string[]]; + successRedirect?: string; + successStatus?: string; + } + + /** + * Options when obtaining a temporary signed URL for a file. + */ + interface SignedUrlConfig { + action: string; + cname?: string; + contentMd5?: string; + contentType?: string; + expires?: number | string; + extensionHeaders?: {[key: string]: string}; + promptSaveAs?: string; + responseDisposition?: string; + responseType?: string; + } +} + +declare module "@google-cloud/storage/storage" { + import { ReadStream } from "fs"; + import { Bucket, BucketConfig, BucketQuery } from "@google-cloud/storage/bucket"; + import { Channel } from "@google-cloud/storage/channel"; + import { FileMetadata } from "@google-cloud/storage/file"; + + /** + * Access control list for storage buckets and files. + */ + class Acl extends AclActions { + default: AclEntity; + owners: AclEntity; + readers: AclEntity; + writers: AclEntity; + } + + /** + * Actions that can be performed on all ACL entities, including the root Acl. + */ + class AclActions { + add(options: AclOptions): Promise<[Acl, ApiResponse]>; + delete(options: AclOptions): Promise<[Acl, ApiResponse]>; + get(options: AclOptions): Promise<[Acl, ApiResponse]>; + update(options: AclOptions): Promise<[Acl, ApiResponse]>; + } + + /** + * An object of convenience methods to add or delete reader ACL permissions for a given entity. + */ + class AclEntity extends AclActions { + addAllAuthenticatedUsers(): Promise<[Acl, ApiResponse]>; + addAllUsers(): Promise<[Acl, ApiResponse]>; + addDomain(entity: string): Promise<[Acl, ApiResponse]>; + addGroup(entity: string): Promise<[Acl, ApiResponse]>; + addProject(entity: string): Promise<[Acl, ApiResponse]>; + addUser(entity: string): Promise<[Acl, ApiResponse]>; + deleteAllAuthenticatedUsers(): Promise<[Acl, ApiResponse]>; + deleteAllUsers(): Promise<[Acl, ApiResponse]>; + deleteDomain(entity: string): Promise<[Acl, ApiResponse]>; + deleteGroup(entity: string): Promise<[Acl, ApiResponse]>; + deleteProject(entity: string): Promise<[Acl, ApiResponse]>; + deleteUser(entity: string): Promise<[Acl, ApiResponse]>; + } + + /** + * ACL options. + */ + interface AclOptions { + entity?: string; + role?: string; + generation?: number; + } + + /** + * The response object. + */ + interface ApiResponse { + etag?: string; + id?: string; + kind?: string; + location?: string; + metageneration?: string; + name?: string; + projectNumber?: string; + selfLink?: string; + storageClass?: string; + timeCreated?: string; + updated?: string; + } + + interface Credentials { + client_email?: string; + private_key?: string; + } + + interface ConfigurationObject { + autoRetry?: boolean; + credentials?: Credentials; + email?: string; + keyFilename?: string; + maxRetries?: number; + projectId?: string; + promise?: PromiseLibrary; + } + + /** + * The options when downloading a file. + */ + interface DownloadOptions extends ReadStreamOptions { + destination?: string; + } + + /** + * Options when reading a file stream. + */ + interface ReadStreamOptions { + end?: number; + start?: number; + validation?: string | boolean; + } + + /** + * Options when uploading file to bucket. + */ + interface UploadOptions extends WriteStreamOptions { + destination?: string; + } + + /** + * Options when writing to a file stream. + */ + interface WriteStreamOptions { + gzip?: boolean; + metadata?: FileMetadata; + offset?: number; + predefinedAcl?: string; + private?: boolean; + public?: boolean; + resumable?: boolean; + uri?: string; + validation?: string | boolean; + } + + /** + * The Storage class allows you interact with Google Cloud Storage. + */ + class Storage { + constructor(options?: ConfigurationObject); + acl: Acl; + bucket(name: string|Bucket): Bucket; + channel(id: string, resourceId: string): Channel; + createBucket(name: string, metadata?: BucketConfig): Promise<[Bucket, ApiResponse]>; + getBuckets(query?: BucketQuery): Promise<[Bucket[]]>; + getBucketsStream(query?: BucketQuery): Promise<[ReadStream]>; + } + + type PromiseLibrary = () => PromiseLike; +} diff --git a/types/google-cloud__storage/tsconfig.json b/types/google-cloud__storage/tsconfig.json new file mode 100644 index 0000000000..51d8bc1368 --- /dev/null +++ b/types/google-cloud__storage/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "google-cloud__storage-tests.ts" + ] +} \ No newline at end of file diff --git a/types/google-cloud__storage/tslint.json b/types/google-cloud__storage/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/google-cloud__storage/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/google-libphonenumber/index.d.ts b/types/google-libphonenumber/index.d.ts index 13659182a9..1fc2d321aa 100644 --- a/types/google-libphonenumber/index.d.ts +++ b/types/google-libphonenumber/index.d.ts @@ -26,7 +26,71 @@ declare namespace libphonenumber { UNKNOWN = -1 } - interface PhoneNumber { + export module PhoneNumber { + export enum CountryCodeSource { + FROM_NUMBER_WITH_PLUS_SIGN = 1, + FROM_NUMBER_WITH_IDD = 5, + FROM_NUMBER_WITHOUT_PLUS_SIGN = 10, + FROM_DEFAULT_COUNTRY = 20, + } + } + + export interface PhoneNumber { + getCountryCode(): number | undefined; + getCountryCodeOrDefault(): number; + setCountryCode(value: number): void; + hasCountryCode(): boolean; + countryCodeCount(): number; + clearCountryCode(): void; + + getNationalNumber(): number | undefined; + getNationalNumberOrDefault(): number; + setNationalNumber(value: number): number; + hasNationalNumber(): boolean; + nationalNumberCount(): number; + clearNationalNumber(): void; + + getExtension(): string | undefined; + getExtensionOrDefault(): string; + setExtension(value: string): void; + hasExtension(): boolean; + extensionCount(): number; + clearExtension(): void; + + getItalianLeadingZero(): boolean | undefined; + getItalianLeadingZeroOrDefault(): boolean; + setItalianLeadingZero(value: boolean): void; + hasItalianLeadingZero(): boolean; + italianLeadingZeroCount(): number; + clearItalianLeadingZero(): void; + + getNumberOfLeadingZeros(): number | undefined; + getNumberOfLeadingZerosOrDefault(): number; + setNumberOfLeadingZeros(value: number): void; + hasNumberOfLeadingZeros(): boolean; + numberOfLeadingZerosCount(): number; + clearNumberOfLeadingZeros(): void; + + getRawInput(): string | undefined; + getRawInputOrDefault(): string; + setRawInput(value: string): void; + hasRawInput(): boolean; + rawInputCount(): number; + clearRawInput(): void; + + getCountryCodeSource(): PhoneNumber.CountryCodeSource | undefined; + getCountryCodeSourceOrDefault(): PhoneNumber.CountryCodeSource; + setCountryCodeSource(value: PhoneNumber.CountryCodeSource): void; + hasCountryCodeSource(): boolean; + countryCodeSourceCount(): number; + clearCountryCodeSource(): void; + + getPreferredDomesticCarrierCode(): string | undefined; + getPreferredDomesticCarrierCodeOrDefault(): string; + setPreferredDomesticCarrierCode(value: string): void; + hasPreferredDomesticCarrierCode(): boolean; + preferredDomesticCarrierCodeCount(): number; + clearPreferredDomesticCarrierCode(): void; } export module PhoneNumberUtil { @@ -40,16 +104,26 @@ declare namespace libphonenumber { export class PhoneNumberUtil { static getInstance(): PhoneNumberUtil - parse(number: string, region: string): PhoneNumber; - isValidNumber(phoneNumber: PhoneNumber): boolean; - isPossibleNumber(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; + getNddPrefixForRegion(regionCode?: string, stripNonDigits?: boolean): string | undefined; + getNumberType(phoneNumber: PhoneNumber): PhoneNumberType; + getRegionCodeForCountryCode(countryCallingCode: number): string; + getRegionCodeForNumber(phoneNumber: PhoneNumber): string | undefined; + isAlphaNumber(number: string): boolean; + isLeadingZeroPossible(countryCallingCode: number): boolean; + isNANPACountry(regionCode?: string): boolean; + isPossibleNumber(number: PhoneNumber): boolean; + isPossibleNumber(phoneNumber: PhoneNumber): boolean; + isPossibleNumberForType(number: PhoneNumber, type: PhoneNumberType): boolean; + isPossibleNumberForTypeWithReason(number: PhoneNumber, type: PhoneNumberType): PhoneNumberUtil.ValidationResult; + isPossibleNumberString(number: string, regionDialingFrom: string): boolean; + isPossibleNumberWithReason(number: PhoneNumber): PhoneNumberUtil.ValidationResult; + isPossibleNumberWithReason(phoneNumber: PhoneNumber): PhoneNumberUtil.ValidationResult; + isValidNumber(phoneNumber: PhoneNumber): boolean; + isValidNumberForRegion(phoneNumber: PhoneNumber, region?: string): boolean; + parse(number?: string, region?: string): PhoneNumber; + parseAndKeepRawInput(number: string, regionCode?: string): PhoneNumber; + truncateTooLongNumber(number: PhoneNumber): boolean; } export class AsYouTypeFormatter { diff --git a/types/google-map-react/index.d.ts b/types/google-map-react/index.d.ts index aedf13e13a..080dbe5762 100644 --- a/types/google-map-react/index.d.ts +++ b/types/google-map-react/index.d.ts @@ -98,7 +98,7 @@ export interface Props { onMapTypeIdChange?(args: any): void; distanceToMouse?(pt: Point, mousePos: Point): void; googleMapLoader?(bootstrapURLKeys: any): void; - onGoogleApiLoaded?({map, maps}: { map: any, maps: any }): void; + onGoogleApiLoaded?(maps: { map: any, maps: any }): void; yesIWantToUseGoogleMapApiInternals?: boolean; } diff --git a/types/google-protobuf/index.d.ts b/types/google-protobuf/index.d.ts index 5ff6b6259d..bb1d2fb3a5 100644 --- a/types/google-protobuf/index.d.ts +++ b/types/google-protobuf/index.d.ts @@ -70,12 +70,12 @@ export abstract class Message { static computeOneofCase(msg: Message, oneof: number[]): number; static getWrapperField( msg: Message, - ctor: {new() : T}, + ctor: { new(): T }, fieldNumber: number, required?: number): T; static getRepeatedWrapperField( msg: Message, - ctor: {new() : T}, + ctor: { new(): T }, fieldNumber: number): T[]; static setWrapperField( msg: Message, @@ -94,7 +94,7 @@ export abstract class Message { msg: Message, fieldNumber: number, value: T | undefined, - ctor: {new() : T}, + ctor: { new(): T }, index?: number): T; static toMap( field: any[], diff --git a/types/googlemaps/googlemaps-tests.ts b/types/googlemaps/googlemaps-tests.ts index f57a4e80e0..20d2bc51c8 100644 --- a/types/googlemaps/googlemaps-tests.ts +++ b/types/googlemaps/googlemaps-tests.ts @@ -11,6 +11,7 @@ let map = new google.maps.Map( fullscreenControlOptions: { position: google.maps.ControlPosition.RIGHT_TOP }, + gestureHandling: "cooperative", scrollwheel: true, zoom: 4 }); diff --git a/types/googlemaps/index.d.ts b/types/googlemaps/index.d.ts index 1ca49880c9..e2a4f89922 100644 --- a/types/googlemaps/index.d.ts +++ b/types/googlemaps/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Google Maps JavaScript API 3.26 // Project: https://developers.google.com/maps/ -// Definitions by: Folia A/S , Chris Wrench , Kiarash Ghiaseddin , Grant Hutchins , Denis Atyasov , Michael McMullin +// Definitions by: Folia A/S , Chris Wrench , Kiarash Ghiaseddin , Grant Hutchins , Denis Atyasov , Michael McMullin , Martin Costello // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* @@ -95,6 +95,10 @@ declare namespace google.maps { fullscreenControl?: boolean; /** The display options for the Fullscreen control. */ fullscreenControlOptions?: FullscreenControlOptions; + /** + * This setting controls how gestures on the map are handled. + */ + gestureHandling?: GestureHandlingOptions; /** * The heading for aerial imagery in degrees measured clockwise from cardinal * direction North. Headings are snapped to the nearest available angle for @@ -250,6 +254,12 @@ declare namespace google.maps { opened?: boolean; } + export type GestureHandlingOptions = + "cooperative" | + "greedy" | + "none" | + "auto"; + /** Options for the rendering of the pan control. */ export interface PanControlOptions { /** @@ -1365,9 +1375,19 @@ declare namespace google.maps { } export interface DirectionsResult { + geocoded_waypoints: DirectionsGeocodedWaypoint[]; routes: DirectionsRoute[]; } + /** + * A single geocoded waypoint. + */ + export interface DirectionsGeocodedWaypoint { + partial_match: boolean; + place_id: string; + types: string[]; + } + /** * A single route containing a set of legs in a DirectionsResult. * Note that though this object is "JSON-like," it is not strictly JSON, @@ -2454,6 +2474,7 @@ declare namespace google.maps { placeIdOnly?: boolean; strictBounds?: boolean; types?: string[]; + type?: string; } export interface AutocompletePrediction { diff --git a/types/graphql-type-json/graphql-type-json-tests.ts b/types/graphql-type-json/graphql-type-json-tests.ts new file mode 100644 index 0000000000..3282681845 --- /dev/null +++ b/types/graphql-type-json/graphql-type-json-tests.ts @@ -0,0 +1,20 @@ +import {GraphQLObjectType, GraphQLInputObjectType} from "graphql"; +import * as GraphQLJSON from "graphql-type-json"; + +const TestType = new GraphQLObjectType({ + name: "TestType", + fields: { + test: { + type: GraphQLJSON + } + } +}); + +const TestInputType = new GraphQLInputObjectType({ + name: "TestInputType", + fields: { + test: { + type: GraphQLJSON + } + } +}); diff --git a/types/graphql-type-json/index.d.ts b/types/graphql-type-json/index.d.ts new file mode 100644 index 0000000000..7d41b83013 --- /dev/null +++ b/types/graphql-type-json/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for graphql-type-json 0.1 +// Project: https://github.com/taion/graphql-type-json#readme +// Definitions by: Pavel Ivanov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import {GraphQLScalarType} from "graphql"; + +declare const GraphQLJSON: GraphQLScalarType; +export = GraphQLJSON; diff --git a/types/graphql-type-json/tsconfig.json b/types/graphql-type-json/tsconfig.json new file mode 100644 index 0000000000..4120681b12 --- /dev/null +++ b/types/graphql-type-json/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "graphql-type-json-tests.ts" + ] +} diff --git a/types/graphql-type-json/tslint.json b/types/graphql-type-json/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/graphql-type-json/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/graphql/type/schema.d.ts b/types/graphql/type/schema.d.ts index 5a2cdd0af4..0f02cd78af 100644 --- a/types/graphql/type/schema.d.ts +++ b/types/graphql/type/schema.d.ts @@ -51,7 +51,7 @@ export class GraphQLSchema { getQueryType(): GraphQLObjectType; getMutationType(): GraphQLObjectType; getSubscriptionType(): GraphQLObjectType; - getTypeMap(): GraphQLNamedType; + getTypeMap(): { [typeName: string]: GraphQLNamedType }; getType(name: string): GraphQLType; getPossibleTypes(abstractType: GraphQLAbstractType): Array; diff --git a/types/grecaptcha/grecaptcha-tests.ts b/types/grecaptcha/grecaptcha-tests.ts index 3546ac3433..f1da1b35b4 100644 --- a/types/grecaptcha/grecaptcha-tests.ts +++ b/types/grecaptcha/grecaptcha-tests.ts @@ -1,22 +1,33 @@ - - -var params: ReCaptchaV2.Parameters = { - "sitekey": "mySuperSecretKey", - "theme": "light", - "type": "image", - "size": "normal", - "tabindex": 5, - "callback": (response: string) => { }, +const params: ReCaptchaV2.Parameters = { + sitekey: "mySuperSecretKey", + theme: "light", + type: "image", + size: "normal", + tabindex: 5, + callback: (response: string) => { }, "expired-callback": () => { }, -} +}; -var id1: number = grecaptcha.render("foo"); -var id2: number = grecaptcha.render("foo", params); -var id3: number = grecaptcha.render(document.getElementById("foo")); -var id4: number = grecaptcha.render(document.getElementById("foo"), params); +const size1: ReCaptchaV2.Size = "compact"; +const size2: ReCaptchaV2.Size = "invisible"; +const size3: ReCaptchaV2.Size = "normal"; + +const badge1: ReCaptchaV2.Badge = "bottomleft"; +const badge2: ReCaptchaV2.Badge = "bottomright"; +const badge3: ReCaptchaV2.Badge = "inline"; + +const invisibleParams: ReCaptchaV2.Parameters = { + sitekey: "siteKey", + badge: badge1, +}; + +const id1: number = grecaptcha.render("foo"); +const id2: number = grecaptcha.render("foo", params); +const id3: number = grecaptcha.render(document.getElementById("foo")); +const id4: number = grecaptcha.render(document.getElementById("foo"), params); // response takes a number and returns a string -var response1: string = grecaptcha.getResponse(id1); +const response1: string = grecaptcha.getResponse(id1); // reset takes a number grecaptcha.reset(id1); diff --git a/types/grecaptcha/index.d.ts b/types/grecaptcha/index.d.ts index 26f4e69507..59d1fa6699 100644 --- a/types/grecaptcha/index.d.ts +++ b/types/grecaptcha/index.d.ts @@ -1,85 +1,90 @@ // Type definitions for Google Recaptcha 2.0 // Project: https://www.google.com/recaptcha -// Definitions by: Kristof Mattei , Martin Costello +// Definitions by: Kristof Mattei , Martin Costello , Ruslan Arkhipau // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var grecaptcha: ReCaptchaV2.ReCaptcha; -declare namespace ReCaptchaV2 -{ - class ReCaptcha - { +declare namespace ReCaptchaV2 { + class ReCaptcha { /** - * Renders the container as a reCAPTCHA widget and returns the ID of the newly created widget. - * @param container The HTML element to render the reCAPTCHA widget. Specify either the ID of the container (string) or the DOM element itself. - * @param parameters An object containing parameters as key=value pairs, for example, {"sitekey": "your_site_key", "theme": "light"}. See @see render parameters. - * @return the ID of the newly created widget. - **/ + * Renders the container as a reCAPTCHA widget and returns the ID of the newly created widget. + * @param container The HTML element to render the reCAPTCHA widget. Specify either the ID of the container (string) or the DOM element itself. + * @param parameters An object containing parameters as key=value pairs, for example, {"sitekey": "your_site_key", "theme": "light"}. See @see render parameters. + * @return the ID of the newly created widget. + */ render(container: (string | HTMLElement), parameters?: Parameters): number; /** - * Resets the reCAPTCHA widget. - * @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified. - **/ + * Resets the reCAPTCHA widget. + * @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified. + */ reset(opt_widget_id?: number): void; /** - * Gets the response for the reCAPTCHA widget. - * @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified. - * @return the response of the reCAPTCHA widget. - **/ + * Gets the response for the reCAPTCHA widget. + * @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified. + * @return the response of the reCAPTCHA widget. + */ getResponse(opt_widget_id?: number): string; /** - * Programatically invoke the reCAPTCHA check. Used if the invisible reCAPTCHA is on a div instead of a button. - * @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified. - **/ + * Programatically invoke the reCAPTCHA check. Used if the invisible reCAPTCHA is on a div instead of a button. + * @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified. + */ execute(opt_widget_id?: number): void; } type Theme = "light" | "dark"; type Type = "image" | "audio"; - type Size = "normal" | "compact"; + type Size = "normal" | "compact" | "invisible"; + type Badge = "bottomright" | "bottomleft" | "inline"; - interface Parameters - { + interface Parameters { /** - * Your sitekey. - **/ + * Your sitekey. + */ sitekey: string; /** - * Optional. The color theme of the widget. - * Accepted values: "light", "dark" - * @default "light" - * @type {Theme} - **/ + * Optional. The color theme of the widget. + * Accepted values: "light", "dark" + * @default "light" + * @type {Theme} + */ theme?: Theme; /** - * Optional. The type of CAPTCHA to serve. - * Accepted values: "audio", "image" - * @default "image" - * @type {Type} - **/ + * Optional. The type of CAPTCHA to serve. + * Accepted values: "audio", "image" + * @default "image" + * @type {Type} + */ type?: Type; /** - * Optional. The size of the widget. - * Accepted values: "compact", "normal" - * @default "compact" - * @type {Size} - */ + * Optional. The size of the widget. + * Accepted values: "compact", "normal", "invisible". + * @default "compact" + * @type {Size} + */ size?: Size; /** - * Optional. The tabindex of the widget and challenge. - * If other elements in your page use tabindex, it should be set to make user navigation easier. - **/ + * Optional. The tabindex of the widget and challenge. + * If other elements in your page use tabindex, it should be set to make user navigation easier. + */ tabindex?: number; /** - * Optional. Your callback function that's executed when the user submits a successful CAPTCHA response. - * The user's response, g-recaptcha-response, will be the input for your callback function. - **/ - callback?: (response: string) => void; + * Optional. Your callback function that's executed when the user submits a successful CAPTCHA response. + * The user's response, g-recaptcha-response, will be the input for your callback function. + */ + callback?(response: string): void; /** - * Optional. Your callback function that's executed when the recaptcha response expires and the user needs to solve a new CAPTCHA. - **/ + * Optional. The badge location for g-recaptcha with size of "invisible". + * + * @default "bottomright" + * @type {Badge} + */ + badge?: Badge; + /** + * Optional. Your callback function that's executed when the recaptcha response expires and the user needs to solve a new CAPTCHA. + */ // Notice to the reader // I need to surround this object with quotes, this will however break intellisense in VS 2013. - "expired-callback"?: () => void; + "expired-callback"?(): void; } } diff --git a/types/grecaptcha/tslint.json b/types/grecaptcha/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/grecaptcha/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/gridfs-stream/index.d.ts b/types/gridfs-stream/index.d.ts index 1c803348ad..80f87bb6c5 100644 --- a/types/gridfs-stream/index.d.ts +++ b/types/gridfs-stream/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/aheckmann/gridfs-stream // Definitions by: Lior Mualem // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/gridstack/gridstack-tests.ts b/types/gridstack/gridstack-tests.ts index 9330d2019e..0ef4a7691b 100644 --- a/types/gridstack/gridstack-tests.ts +++ b/types/gridstack/gridstack-tests.ts @@ -17,6 +17,8 @@ var gsFromElement: GridStack = element.data("gridstack"); if (gridstack !== gsFromElement) throw Error('These should match!'); gridstack.addWidget("test", 1, 2, 3, 4, true); +gridstack.addWidget(document.createElement('div'), 1, 2, 3, 4, true); +gridstack.addWidget($(document.createElement('div')), 1, 2, 3, 4, true); gridstack.batchUpdate(); gridstack.cellHeight();; gridstack.cellHeight(2); diff --git a/types/gridstack/index.d.ts b/types/gridstack/index.d.ts index 8d912e3a33..b1c5f14c0f 100644 --- a/types/gridstack/index.d.ts +++ b/types/gridstack/index.d.ts @@ -14,14 +14,14 @@ interface GridStack { * * Widget will be always placed even if result height is more than actual grid height. You need to use willItFit method before calling addWidget for additional check. * - * @param {string} el widget to add + * @param {string | HTMLElement | JQuery} el widget to add * @param {number} x widget position x * @param {number} y widget position y * @param {number} width widget dimension width * @param {number} height widget dimension height * @param {boolean} autoPosition if true then x, y parameters will be ignored and widget will be places on the first available position */ - addWidget(el: string, x?: number, y?: number, width?: number, height?: number, autoPosition?: boolean, minWidth?: number, maxWidth?: number, minHeight?: number, maxHeight?: number, id?: number): JQuery + addWidget(el: string | HTMLElement | JQuery, x?: number, y?: number, width?: number, height?: number, autoPosition?: boolean, minWidth?: number, maxWidth?: number, minHeight?: number, maxHeight?: number, id?: number): JQuery /** * Initializes batch updates. You will see no changes until commit method is called. */ diff --git a/types/gulp-coffeeify/index.d.ts b/types/gulp-coffeeify/index.d.ts index 161eb9376d..2fe2e1d497 100644 --- a/types/gulp-coffeeify/index.d.ts +++ b/types/gulp-coffeeify/index.d.ts @@ -26,15 +26,15 @@ declare namespace coffeeify { transforms?: Transforms; } - interface Aliases { + type Aliases = Array<{ cwd?: string; base?: string; - } + }>; - interface Transforms { + type Transforms = Array<{ ext?: string; transform?(data: string): string; - } + }>; } declare var coffeeify: coffeeify.Coffeeify; diff --git a/types/gulp-inject/gulp-inject-tests.ts b/types/gulp-inject/gulp-inject-tests.ts index 4cba6ccc4a..ef29ebc343 100644 --- a/types/gulp-inject/gulp-inject-tests.ts +++ b/types/gulp-inject/gulp-inject-tests.ts @@ -39,3 +39,9 @@ gulp.task("inject:transform", () => { })) .pipe(gulp.dest("build")); }); + +function createOptions(starttag: inject.ITagFunction): inject.IOptions { + return { + starttag: starttag + }; +} diff --git a/types/gulp-inject/index.d.ts b/types/gulp-inject/index.d.ts index a0c99efe78..ac6ec0172c 100644 --- a/types/gulp-inject/index.d.ts +++ b/types/gulp-inject/index.d.ts @@ -8,31 +8,31 @@ import File = require("vinyl"); -interface ITagFunction { - (targetExt: string, sourceExt: string): string; +declare function inject(sources: NodeJS.ReadableStream, options?: inject.IOptions): NodeJS.ReadWriteStream; + +declare namespace inject { + interface ITagFunction { + (targetExt: string, sourceExt: string): string; + } + + interface ITransformFunction { + (filepath: string, file?: File, index?: number, length?: number, targetFile?: File): string; + } + + interface IOptions { + ignorePath?: string | string[]; + relative?: boolean; + addPrefix?: string; + addSuffix?: string; + addRootSlash?: boolean; + name?: string; + removeTags?: boolean; + empty?: boolean; + starttag?: string | ITagFunction; + endtag?: string | ITagFunction; + transform?: ITransformFunction; + selfClosingTag?: boolean; + } } -interface ITransformFunction { - (filepath: string, file?: File, index?: number, length?: number, targetFile?: File): string; -} - -interface IOptions { - ignorePath?: string | string[]; - relative?: boolean; - addPrefix?: string; - addSuffix?: string; - addRootSlash?: boolean; - name?: string; - removeTags?: boolean; - empty?: boolean; - starttag?: string | ITagFunction; - endtag?: string | ITagFunction; - transform?: ITransformFunction; - selfClosingTag?: boolean; -} - -declare function inject(sources: NodeJS.ReadableStream, options?: IOptions): NodeJS.ReadWriteStream; - -declare namespace inject { } - export = inject; diff --git a/types/gulp-rev-replace/gulp-rev-replace-tests.ts b/types/gulp-rev-replace/gulp-rev-replace-tests.ts index e20839ab99..2d7e5a3580 100644 --- a/types/gulp-rev-replace/gulp-rev-replace-tests.ts +++ b/types/gulp-rev-replace/gulp-rev-replace-tests.ts @@ -17,21 +17,21 @@ var opt = { distFolder: 'dist' } -gulp.task("revision", ["dist:css", "dist:js"], () => +gulp.task("revision", gulp.parallel("dist:css", "dist:js", () => gulp.src(["dist/**/*.css", "dist/**/*.js"]) .pipe(rev()) .pipe(gulp.dest(opt.distFolder)) .pipe(rev.manifest()) .pipe(gulp.dest(opt.distFolder)) -); +)); -gulp.task("revreplace", ["revision"], () => { +gulp.task("revreplace", gulp.parallel("revision", () => { var manifest = gulp.src("./" + opt.distFolder + "/rev-manifest.json"); return gulp.src(opt.srcFolder + "/index.html") - .pipe(revReplace({manifest: manifest})) + .pipe(revReplace({ manifest: manifest })) .pipe(gulp.dest(opt.distFolder)); -}); +})); function replaceJsIfMap(filename: string): string { @@ -41,7 +41,7 @@ function replaceJsIfMap(filename: string): string { return filename; } -gulp.task("revreplace", ["revision"], () => { +gulp.task("revreplace", gulp.parallel("revision", () => { var manifest = gulp.src("./" + opt.distFolder + "/rev-manifest.json"); return gulp.src(opt.distFolder + '**/*.js') @@ -51,4 +51,4 @@ gulp.task("revreplace", ["revision"], () => { modifyReved: replaceJsIfMap })) .pipe(gulp.dest(opt.distFolder)); -}); +})); diff --git a/types/gulp-shell/gulp-shell-tests.ts b/types/gulp-shell/gulp-shell-tests.ts index 3bd6d906fc..581808670c 100644 --- a/types/gulp-shell/gulp-shell-tests.ts +++ b/types/gulp-shell/gulp-shell-tests.ts @@ -1,6 +1,3 @@ - - - import shell = require('gulp-shell'); import gulp = require('gulp'); @@ -29,13 +26,13 @@ var paths: any = { gulp.task('test', shell.task('mocha -R spec')); -gulp.task('coverage', ['test'], shell.task('istanbul cover _mocha -- -R spec')); - -gulp.task('coveralls', ['coverage'], shell.task('cat coverage/lcov.info | coveralls')); +gulp.task('coverage', gulp.parallel('test', shell.task('istanbul cover _mocha -- -R spec'))); + +gulp.task('coveralls', gulp.parallel('coverage', shell.task('cat coverage/lcov.info | coveralls'))); gulp.task('lint', shell.task('eslint ' + paths.js.join(' '))); -gulp.task('default', ['coverage', 'lint']); +gulp.task('default', gulp.parallel('coverage', 'lint')); gulp.task('watch', function () { gulp.watch(paths.js, ['default']) diff --git a/types/gulp/gulp-tests.ts b/types/gulp/gulp-tests.ts deleted file mode 100644 index 9660b0658a..0000000000 --- a/types/gulp/gulp-tests.ts +++ /dev/null @@ -1,68 +0,0 @@ -import gulp = require("gulp"); -import browserSync = require("browser-sync"); - -var typescript: gulp.GulpPlugin = null; // this would be the TypeScript compiler -var jasmine: gulp.GulpPlugin = null; // this would be the jasmine test runner - -gulp.task('compile', function() -{ - gulp.src("**/*.ts") - .pipe(typescript()) - .pipe(gulp.dest('out')) -}); - -gulp.task('compile2', function(callback: (err?: any) => void) -{ - gulp.src("**/*.ts") - .pipe(typescript()) - .pipe(gulp.dest('out')) - .on('end', callback); -}); - -gulp.task('test', ['compile', 'compile2'], function() -{ - gulp.src("out/test/**/*.js") - .pipe(jasmine()); -}); - -gulp.task('default', ['compile', 'test']); - - - -var opts = {}; - -gulp.watch('*.html', 'compile'); -gulp.watch('*.html', ['compile', 'test']); -gulp.watch('*.html', () => {}); -gulp.watch('*.html', [() => {}, (event) => {}]); -gulp.watch('*.html', ['compile', () => {}]); - -gulp.watch('*.html', opts, 'compile'); -gulp.watch('*.html', opts, ['compile', 'test']); -gulp.watch('*.html', opts, () => {}); -gulp.watch('*.html', opts, [() => {}, (event) => {}]); -gulp.watch('*.html', opts, ['compile', () => {}]); - -gulp.watch(['*.html', '*.ts'], 'compile'); -gulp.watch(['*.html', '*.ts'], ['compile', 'test']); -gulp.watch(['*.html', '*.ts'], () => {}); -gulp.watch(['*.html', '*.ts'], [() => {}, (event) => {}]); -gulp.watch(['*.html', '*.ts'], ['compile', () => {}]); - -gulp.watch(['*.html', '*.ts'], opts, 'compile'); -gulp.watch(['*.html', '*.ts'], opts, ['compile', 'test']); -gulp.watch(['*.html', '*.ts'], opts, () => {}); -gulp.watch(['*.html', '*.ts'], opts, [() => {}, (event) => {}]); -gulp.watch(['*.html', '*.ts'], opts, ['compile', () => {}]); - -var watcher = gulp.watch('*.html', event => { - console.log('Event type: ' + event.type); - console.log('Event path: ' + event.path); -}); - -gulp.task('serve', ['compile'], () => { - var browser = browserSync.create(); - gulp.watch(['*.html', '*.ts'], ['compile', browser.reload]); -}); - -gulp.start('test', 'compile'); diff --git a/types/gulp/index.d.ts b/types/gulp/index.d.ts index fefd5b0fda..465cceb4e5 100644 --- a/types/gulp/index.d.ts +++ b/types/gulp/index.d.ts @@ -1,364 +1,82 @@ -// Type definitions for Gulp v4.0.x +// Type definitions for Gulp 4.0 // Project: http://gulpjs.com -// Definitions by: Drew Noakes , Juan Arroyave +// Definitions by: Drew Noakes +// Juan Arroyave +// Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// -/// -/// +import * as vfs from "vinyl-fs"; +import * as chokidar from "chokidar"; +import * as Undertaker from "undertaker"; +import * as fs from "fs"; +import { Duplex } from "stream"; +declare namespace GulpClient { + type Globs = string | string[]; -import Orchestrator = require("orchestrator"); -import VinylFile = require("vinyl"); -declare type Strings = string|string[]; + type TaskFunction = Undertaker.TaskFunction; -declare namespace gulp { - interface Gulp extends Orchestrator { + /** + * @deprecated - Now use `TaskFunction`. + */ + type TaskCallback = TaskFunction; + + interface Gulp extends Undertaker { /** - * Define a task - * @param name The name of the task. - * @param deps An array of task names to be executed and completed before your task will run. - * @param fn The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete: - *
      - *
    • Take in a callback
    • - *
    • Return a stream or a promise
    • - *
    - */ - task: Orchestrator.AddMethod; - /** - * Takes a number of task names or functions and returns a function of the composed tasks or functions - * When the returned function is executed, the tasks or functions will be executed in series, - * each waiting for the prior to finish. If an error occurs, execution will stop. - * @param A task name, a function or an array of either. - *
      - *
    • Take in a callback
    • - *
    • Return a stream or a promise
    • - *
    - */ - series: SeriesMethod; - /** - * Takes a number of task names or functions and returns a function of the composed tasks or functions - * When the returned function is executed, the tasks or functions will be executed in parallel, - * all being executed at the same time. If an error occurs, all execution will complete. - * @param A task name, a function or an array of either. - *
      - *
    • Take in a callback
    • - *
    • Return a stream or a promise
    • - *
    - */ - parallel: ParallelMethod; - /** - * Emits files matching provided glob or an array of globs. Returns a stream of Vinyl files that can be piped to plugins. - * @param glob Glob or array of globs to read. - * @param opt Options to pass to node-glob through glob-stream. + * Emits files matching provided glob or array of globs. Returns a stream of Vinyl files that can be piped to plugins. + * @param globs Glob or array of globs to read. + * @param options Options to pass to node-glob through glob-stream. */ src: SrcMethod; + /** * Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders. * Folders that don't exist will be created. - * - * @param outFolder The path (output folder) to write files to. Or a function that returns it, the function will be provided a vinyl File instance. - * @param opt + * @param path The path (output folder) to write files to. Or a function that returns it, the function will be provided a vinyl File instance. + * @param options */ dest: DestMethod; + /** - * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. - * - * @param glob a single glob or array of globs that indicate which files to watch for changes. - * @param opt options, that are passed to the gaze library. - * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). + * Functions exactly like gulp.dest, but will create symlinks instead of copying a directory. + * @param folder A folder path or a function that receives in a file and returns a folder path. + * @param options + */ + symlink: typeof vfs.symlink; + + /** + * Takes a path string, an array of path strings, a glob string or an array of glob strings as globs to watch on the filesystem. + * Also optionally takes options to configure the watcher and a fn to execute when a file changes. + * @globs A path string, an array of path strings, a glob string or an array of glob strings that indicate which files to watch for changes. + * @opts Options that are passed to chokidar. + * @fn Once async completion is signalled, if another run is queued, it will be executed. */ watch: WatchMethod; } - interface GulpPlugin { - (...args: any[]): NodeJS.ReadWriteStream; + interface WatchOptions extends chokidar.WatchOptions { + /** + * The delay to wait before triggering the fn. + * Useful for waiting on many changes before doing the work on changed files, e.g. find-and-replace on many files. + * @default 200 + */ + delay?: number; + /** + * Whether or not a file change should queue the fn execution if the fn is already running. Useful for a long running fn. + * @default true + */ + queue?: boolean; } interface WatchMethod { - /** - * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. - * - * @param glob a single glob or array of globs that indicate which files to watch for changes. - * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). - */ - (glob: string|string[], fn: (WatchCallback|string)): NodeJS.EventEmitter; - /** - * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. - * - * @param glob a single glob or array of globs that indicate which files to watch for changes. - * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). - */ - (glob: string|string[], fn: (WatchCallback|string)[]): NodeJS.EventEmitter; - /** - * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. - * - * @param glob a single glob or array of globs that indicate which files to watch for changes. - * @param opt options, that are passed to the gaze library. - * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). - */ - (glob: string|string[], opt: WatchOptions, fn: (WatchCallback|string)): NodeJS.EventEmitter; - /** - * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. - * - * @param glob a single glob or array of globs that indicate which files to watch for changes. - * @param opt options, that are passed to the gaze library. - * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). - */ - (glob: string|string[], opt: WatchOptions, fn: (WatchCallback|string)[]): NodeJS.EventEmitter; - + (globs: Globs, fn?: Undertaker.TaskFunction): fs.FSWatcher; + (globs: Globs, opts?: WatchOptions, fn?: Undertaker.TaskFunction): fs.FSWatcher; } - interface DestMethod { - /** - * Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders. - * Folders that don't exist will be created. - * - * @param outFolder The path (output folder) to write files to. Or a function that returns it, the function will be provided a vinyl File instance. - * @param opt - */ - (outFolder: string|((file: VinylFile) => string), opt?: DestOptions): NodeJS.ReadWriteStream; - } + type SrcMethod = typeof vfs.src; - interface SrcMethod { - /** - * Emits files matching provided glob or an array of globs. Returns a stream of Vinyl files that can be piped to plugins. - * @param glob Glob or array of globs to read. - * @param opt Options to pass to node-glob through glob-stream. - */ - (glob: string|string[], opt?: SrcOptions): NodeJS.ReadWriteStream; - } - interface SeriesMethod { - /** - * Takes a number of task names or functions and returns a function of the composed tasks or functions. - * When using task names, the task should already be registered. - * When the returned function is executed, the tasks or functions will be executed in series, - * each waiting for the prior to finish. If an error occurs, execution will stop. - * @param tasks, string, function or array of both. - */ - (...tasks: string[]): NodeJS.EventEmitter; - - (...tasks: Function[]): NodeJS.EventEmitter; - - (task: string|string[], ...fn: Function[]): NodeJS.EventEmitter; - - //TODO: TypeScript cannot express varargs followed by callback as a last argument... - (task1: Strings, task2: Strings, cb?: (error?: any) => any): Function; - (task1: Strings, task2: Strings, task3: Strings, cb?: (error?: any) => any): NodeJS.EventEmitter; - (task1: Strings, task2: Strings, task3: Strings, task4: Strings, cb?: (error?: any) => any): NodeJS.EventEmitter; - (task1: Strings, task2: Strings, task3: Strings, task4: Strings, task5: Strings, cb?: (error?: any) => any): NodeJS.EventEmitter; - (task1: Strings, task2: Strings, task3: Strings, task4: Strings, task5: Strings, task6: Strings, cb?: (error?: any) => any): NodeJS.EventEmitter; - - } - - interface ParallelMethod { - /** - * Takes a number of task names or functions and returns a function of the composed tasks or functions. - * When using task names, the task should already be registered. - * When the returned function is executed, the tasks or functions will be executed in parallel, - * all being executed at the same time. If an error occurs, all execution will complete. - * @param tasks, string, function or array of both. - */ - (...tasks: string[]): NodeJS.EventEmitter; - - (...tasks: Function[]): NodeJS.EventEmitter; - - (task: string|string[], ...fn: Function[]): NodeJS.EventEmitter; - - //TODO: TypeScript cannot express varargs followed by callback as a last argument... - (task1: Strings, task2: Strings, cb?: (error?: any) => any): Function; - (task1: Strings, task2: Strings, task3: Strings, cb?: (error?: any) => any): NodeJS.EventEmitter; - (task1: Strings, task2: Strings, task3: Strings, task4: Strings, cb?: (error?: any) => any): NodeJS.EventEmitter; - (task1: Strings, task2: Strings, task3: Strings, task4: Strings, task5: Strings, cb?: (error?: any) => any): NodeJS.EventEmitter; - (task1: Strings, task2: Strings, task3: Strings, task4: Strings, task5: Strings, task6: Strings, cb?: (error?: any) => any): NodeJS.EventEmitter; - - } - - /** - * Options to pass to node-glob through glob-stream. - * Specifies two options in addition to those used by node-glob: - * https://github.com/isaacs/node-glob#options - */ - interface SrcOptions { - /** - * Setting this to false will return file.contents as null - * and not read the file at all. - * Default: true. - */ - read?: boolean; - - /** - * Setting this to false will return file.contents as a stream and not buffer files. - * This is useful when working with large files. - * Note: Plugins might not implement support for streams. - * Default: true. - */ - buffer?: boolean; - - /** - * The base path of a glob. - * - * Default is everything before a glob starts. - */ - base?: string; - - /** - * The current working directory in which to search. - * Defaults to process.cwd(). - */ - cwd?: string; - - /** - * The place where patterns starting with / will be mounted onto. - * Defaults to path.resolve(options.cwd, "/") (/ on Unix systems, and C:\ or some such on Windows.) - */ - root?: string; - - /** - * Include .dot files in normal matches and globstar matches. - * Note that an explicit dot in a portion of the pattern will always match dot files. - */ - dot?: boolean; - - /** - * Set to match only fles, not directories. Set this flag to prevent copying empty directories - */ - nodir?: boolean; - - /** - * By default, a pattern starting with a forward-slash will be "mounted" onto the root setting, so that a valid - * filesystem path is returned. Set this flag to disable that behavior. - */ - nomount?: boolean; - - /** - * Add a / character to directory matches. Note that this requires additional stat calls. - */ - mark?: boolean; - - /** - * Don't sort the results. - */ - nosort?: boolean; - - /** - * Set to true to stat all results. This reduces performance somewhat, and is completely unnecessary, unless - * readdir is presumed to be an untrustworthy indicator of file existence. It will cause ELOOP to be triggered one - * level sooner in the case of cyclical symbolic links. - */ - stat?: boolean; - - /** - * When an unusual error is encountered when attempting to read a directory, a warning will be printed to stderr. - * Set the silent option to true to suppress these warnings. - */ - silent?: boolean; - - /** - * When an unusual error is encountered when attempting to read a directory, the process will just continue on in - * search of other matches. Set the strict option to raise an error in these cases. - */ - strict?: boolean; - - /** - * See cache property above. Pass in a previously generated cache object to save some fs calls. - */ - cache?: boolean; - - /** - * A cache of results of filesystem information, to prevent unnecessary stat calls. - * While it should not normally be necessary to set this, you may pass the statCache from one glob() call to the - * options object of another, if you know that the filesystem will not change between calls. - */ - statCache?: boolean; - - /** - * Perform a synchronous glob search. - */ - sync?: boolean; - - /** - * In some cases, brace-expanded patterns can result in the same file showing up multiple times in the result set. - * By default, this implementation prevents duplicates in the result set. Set this flag to disable that behavior. - */ - nounique?: boolean; - - /** - * Set to never return an empty set, instead returning a set containing the pattern itself. - * This is the default in glob(3). - */ - nonull?: boolean; - - /** - * Perform a case-insensitive match. Note that case-insensitive filesystems will sometimes result in glob returning - * results that are case-insensitively matched anyway, since readdir and stat will not raise an error. - */ - nocase?: boolean; - - /** - * Set to enable debug logging in minimatch and glob. - */ - debug?: boolean; - - /** - * Set to enable debug logging in glob, but not minimatch. - */ - globDebug?: boolean; - } - - interface DestOptions { - /** - * The output folder. Only has an effect if provided output folder is relative. - * Default: process.cwd() - */ - cwd?: string; - - /** - * Octal permission string specifying mode for any folders that need to be created for output folder. - * Default: 0777. - */ - mode?: string; - } - - /** - * Options that are passed to gaze. - * https://github.com/shama/gaze - */ - interface WatchOptions { - /** Interval to pass to fs.watchFile. */ - interval?: number; - /** Delay for events called in succession for the same file/event. */ - debounceDelay?: number; - /** Force the watch mode. Either 'auto' (default), 'watch' (force native events), or 'poll' (force stat polling). */ - mode?: string; - /** The current working directory to base file patterns from. Default is process.cwd().. */ - cwd?: string; - } - - interface WatchEvent { - /** The type of change that occurred, either added, changed or deleted. */ - type: string; - /** The path to the file that triggered the event. */ - path: string; - } - - /** - * Callback to be called on each watched file change. - */ - interface WatchCallback { - (event: WatchEvent): void; - } - - interface TaskCallback { - /** - * Defines a task. - * Tasks may be made asynchronous if they are passing a callback or return a promise or a stream. - * @param cb callback used to signal asynchronous completion. Caller includes err in case of error. - */ - (cb?: (err?: any) => void): any; - } + type DestMethod = typeof vfs.dest; } -declare var gulp: gulp.Gulp; - -export = gulp; +declare const GulpClient: GulpClient.Gulp; +export = GulpClient; diff --git a/types/gulp/test/index.ts b/types/gulp/test/index.ts new file mode 100644 index 0000000000..40807f890a --- /dev/null +++ b/types/gulp/test/index.ts @@ -0,0 +1,181 @@ +import * as gulp from 'gulp'; +import * as undertaker from 'undertaker'; +import * as registry from 'undertaker-registry'; +import * as del from "del"; + +const minify: () => any = () => { }; +const jade: () => any = () => { }; +const someplugin: () => any = () => { }; +const promisedDel: (list: string[]) => any = (list) => { }; + +gulp.src('client/templates/*.jade') + .pipe(jade()) + .pipe(minify()) + .pipe(gulp.dest('build/minified_templates')); + +// exclude every JS file that starts with a b except bad.js +gulp.src(['*.js', '!b*.js', 'bad.js']); + +// Matches 'client/js/somedir/somefile.js' and resolves `base` to `client/js/` +gulp.src('client/js/**/*.js') + .pipe(minify()) + .pipe(gulp.dest('build')); // Writes 'build/somedir/somefile.js' + +gulp.src('client/js/**/*.js', { base: 'client' }) + .pipe(minify()) + .pipe(gulp.dest('build')); // Writes 'build/js/somedir/somefile.js' + +// Emits an error if app/scripts.js doesn't exist +gulp.src('app/scripts.js'); + +// Won't emit an error +gulp.src('app/scripts.js', { allowEmpty: true }); + +gulp.src('./client/templates/*.jade') + .pipe(jade()) + .pipe(gulp.dest('./build/templates')) + .pipe(minify()) + .pipe(gulp.dest('./build/minified_templates')); + +gulp.task(() => { + // Do stuff +}); + +// someTask will be the registered task function +const someTask = gulp.task('someTask'); + +const someNextTask = () => { + return gulp.src(['some/glob/**/*.ext']).pipe(someplugin()); +}; + +gulp.task(someTask); + +let foo: gulp.TaskFunction = () => { }; +foo.name === 'foo'; // true + +const bar: gulp.TaskFunction = () => { }; +bar.name === ''; // true + +bar.name = 'bar'; +bar.name === ''; // true + +let test: gulp.TaskFunction = (done) => { + done(); +}; + +gulp.task(test); + +gulp.task('clean', (done) => { + del(['.build/'], done); +}); + +gulp.task('somename', () => { + return gulp.src('client/**/*.js') + .pipe(minify()) + .pipe(gulp.dest('build')); +}); + +gulp.task('clean', () => { + return new Promise((resolve, reject) => { + del(['.build/'], (err: any) => { + if (err) { + reject(err); + } else { + resolve(); + } + }); + }); +}); + +gulp.task('clean', () => { + return promisedDel(['.build/']); +}); + +gulp.task('one', (done) => { + // do stuff + done(); +}); + +gulp.task('two', (done) => { + // do stuff + done(); +}); + +gulp.task('default', gulp.parallel('one', 'two', (done) => { + // do more stuff + done(); +})); + +gulp.task('one', (done) => { + // do stuff + done(); +}); + +gulp.task('two', (done) => { + // do stuff + done(); +}); + +gulp.task('default', gulp.series('one', 'two', (done) => { + // do more stuff + done(); +})); + +gulp.watch('js/**/*.js', gulp.parallel('concat', 'uglify')); + +const watcher = gulp.watch('js/**/*.js', gulp.parallel('concat', 'uglify')); +// watcher.close +watcher.on('change', (path, stats) => { + console.log('File ' + path + ' was changed'); +}); + +watcher.on('unlink', (path: string) => { + console.log('File ' + path + ' was removed'); +}); + +gulp.task('one', (done) => { + // do stuff + done(); +}); + +gulp.task('two', (done) => { + // do stuff + done(); +}); + +gulp.task('three', (done) => { + // do stuff + done(); +}); + +gulp.task('four', gulp.series('one', 'two')); + +gulp.task('five', + gulp.series('four', + gulp.parallel('three', (done) => { + // do more stuff + done(); + }) + ) +); + +gulp.tree(); + +gulp.tree({ deep: true }); + +// gulpfile.js + +const companyTasks = {} as registry; + +gulp.registry(companyTasks); + +gulp.task('one', gulp.parallel('someCompanyTask', (done) => { + console.log('in task one'); + done(); +})); + +gulp.symlink("path/to/dir"); + +gulp.symlink(() => { + return "resolved/path/to/dir"; +}); diff --git a/types/gulp/tsconfig.json b/types/gulp/tsconfig.json index 01afedbf29..08bee78c82 100644 --- a/types/gulp/tsconfig.json +++ b/types/gulp/tsconfig.json @@ -2,24 +2,23 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ "../" ], - "paths": { - "q": [ "q/v0" ] - }, + "jsx": "react", "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true }, "files": [ "index.d.ts", - "gulp-tests.ts" + "test/index.ts" ] -} \ No newline at end of file +} diff --git a/types/gulp/tslint.json b/types/gulp/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/gulp/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/h2o2/h2o2-tests.ts b/types/h2o2/h2o2-tests.ts new file mode 100644 index 0000000000..f8e88c5c9b --- /dev/null +++ b/types/h2o2/h2o2-tests.ts @@ -0,0 +1,165 @@ +import http = require("http"); +import * as Boom from 'boom'; +import * as Hapi from 'hapi'; +import * as Wreck from 'wreck'; +import h2o2 = require('h2o2'); + +// https://github.com/hapijs/h2o2#manual-loading + +const server = new Hapi.Server({}); + +server.register({ + register: h2o2 +}, function (err) { + + if (err) { + console.log('Failed to load h2o2'); + } + + server.start(function (err) { + + console.log('Server started at: ' + server.info!.uri); + }); +}); + +// https://github.com/hapijs/h2o2#replyproxyoptions + +const handler: Hapi.RouteHandler = function (request, reply) { + + return reply.proxy({ host: 'example.com', port: 80, protocol: 'http' }); +}; + +// https://github.com/hapijs/h2o2#using-the-host-port-protocol-options + +server.route({ + method: 'GET', + path: '/', + handler: { + proxy: { + host: '10.33.33.1', + port: '443', + protocol: 'https' + } + } +}); + +// https://github.com/hapijs/h2o2#using-the-uri-option + +server.route({ + method: 'GET', + path: '/', + handler: { + proxy: { + uri: 'https://some.upstream.service.com/that/has?what=you&want=todo' + } + } +}); + +// https://github.com/hapijs/h2o2#custom-uri-template-values + +server.route({ + method: 'GET', + path: '/foo', + handler: { + proxy: { + uri: '{protocol}://{host}:{port}/go/to/{path}' + } + } +}); + +server.route({ + method: 'GET', + path: '/foo/{bar}', + handler: { + proxy: { + uri: 'https://some.upstream.service.com/some/path/to/{bar}' + } + } +}); + +// https://github.com/hapijs/h2o2#using-the-mapuri-and-onresponse-options + +server.route({ + method: 'GET', + path: '/', + handler: { + proxy: { + mapUri: function (request, callback) { + + console.log('doing some aditional stuff before redirecting'); + callback(null, 'https://some.upstream.service.com/'); + }, + onResponse: function (err, res, request, reply, settings, ttl) { + + console.log('receiving the response from the upstream.'); + Wreck.read(res, { json: true }, function (err, payload) { + + console.log('some payload manipulation if you want to.') + reply(payload).headers = res.headers; + }); + } + } + } +}); + +/** + * test code added in additional to code in docs. Demonstrates that for the moment + * you need flat + * objects with typing along the way to benefit from typescript catching + * misspelt, or unsupported keys. + * This is because of an unknown reason. Expecting this to work because: + * "Object literals get special treatment and undergo excess + * property checking when assigning them to other variables, or passing them + * as arguments", see github.com/Microsoft/TypeScript + */ + +var proxyOptions: h2o2.ProxyHandlerOptions = { + host: '10.33.33.1', + port: '443', + protocol: 'https' // errors correctly if misspelt +} + +server.route({ + method: 'GET', + path: '/', + handler: { + proxy: { + host: '10.33.33.1', + port: '443', + BAD_protocol: 'https' // TODO change typings to fix this / submit bug report + } + } +}) + +server.route({ + method: 'GET', + path: '/', + handler: { + proxy: { + uri: 'https://some.upstream.service.com/that/has?what=you&want=todo' + } + } +}) + +server.route({ + method: 'GET', + path: '/', + handler: { + proxy: { + mapUri: function (request: Hapi.Request, callback: (err: null | Boom.BoomError, value: string) => void) { + + console.log('doing some aditional stuff before redirecting'); + callback(null, 'https://some.upstream.service.com/'); + }, + onResponse: function (err: null | Boom.BoomError, res: http.IncomingMessage, request: Hapi.Request, reply: Hapi.ReplyWithContinue, settings: h2o2.ProxyHandlerOptions, ttl: number) { + + console.log('receiving the response from the upstream.'); + Wreck.read(res, { json: true }, function (err: null | Boom.BoomError, payload: any) { + + console.log('some payload manipulation if you want to.') + reply(payload).headers = res.headers; + }); + } + } + } +}); diff --git a/types/h2o2/index.d.ts b/types/h2o2/index.d.ts new file mode 100644 index 0000000000..7ca3ccb85f --- /dev/null +++ b/types/h2o2/index.d.ts @@ -0,0 +1,91 @@ +// Type definitions for h2o2 5.4 +// Project: https://github.com/hapijs/catbox +// Definitions by: Jason Swearingen , AJP +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +import http = require("http"); +import * as hapi from 'hapi'; +import * as Boom from 'boom'; + +declare namespace H2o2 { + /** Proxy handler options */ + export interface ProxyHandlerOptions { + /** host - upstream service host to proxy requests to. It will have the same path as the client request. */ + host?: string; + /** port - upstream service port. */ + port?: number | string; + /** protocol - protocol to use when making the request to the proxied host: */ + protocol?: 'http' | 'https'; + /** uri - absolute URI used instead of host, port, protocol, path, and query. Cannot be used with host, port, protocol, or mapUri. */ + uri?: string; + /** passThrough - if set to true, it forwards the headers from the client to the upstream service, headers sent from the upstream service will also be forwarded to the client. Defaults to false. */ + passThrough?: boolean; + /** localStatePassThrough - if set tofalse, any locally defined state is removed from incoming requests before being sent to the upstream service. This value can be overridden on a per state basis via the server.state()``passThrough option. Defaults to false */ + localStatePassThrough?: boolean; + /** acceptEncoding - if set to false, does not pass-through the 'Accept-Encoding' HTTP header which is useful for the onResponse post-processing to avoid receiving an encoded response. Can only be used together with passThrough. Defaults to true (passing header). */ + acceptEncoding?: boolean; + /** rejectUnauthorized - sets the rejectUnauthorized property on the https agent making the request. This value is only used when the proxied server uses TLS/SSL. If set it will override the node.js rejectUnauthorized property. If false then ssl errors will be ignored. When true the server certificate is verified and an 500 response will be sent when verification fails. This shouldn't be used alongside the agent setting as the agent will be used instead. Defaults to the https agent default value of true. */ + rejectUnauthorized?: boolean; + /** xforward - if set to true, sets the 'X-Forwarded-For', 'X-Forwarded-Port', 'X-Forwarded-Proto', 'X-Forwarded-Host' headers when making a request to the proxied upstream endpoint. Defaults to false. */ + xforward?: boolean; + /** redirects - the maximum number of HTTP redirections allowed to be followed automatically by the handler. Set to false or 0 to disable all redirections (the response will contain the redirection received from the upstream service). If redirections are enabled, no redirections (301, 302, 307, 308) will be passed along to the client, and reaching the maximum allowed redirections will return an error response. Defaults to false. */ + redirects?: number | false; + /** timeout - number of milliseconds before aborting the upstream request. Defaults to 180000 (3 minutes). */ + timeout?: number; + /** mapUri - a function used to map the request URI to the proxied URI. Cannot be used together with host, port, protocol, or uri. The function signature is function (request, callback) where: + * @param request - is the incoming request object. + * @param callback - is function (err, uri, headers) where: + * @param err - internal error condition. TODO: check this is of type BoomError or just Error. + * @param uri - the absolute proxy URI. + * @param headers - optional object where each key is an HTTP request header and the value is the header content. + */ + mapUri?: (request: hapi.Request, callback: (err: null | Boom.BoomError, uri: string, headers?: { [key: string]: string }) => void) => void; + /** + * onResponse - a custom function for processing the response from the upstream service before sending to the client. Useful for custom error handling of responses from the proxied endpoint or other payload manipulation. Function signature is function (err, res, request, reply, settings, ttl) where: + * @param err - internal or upstream error returned from attempting to contact the upstream proxy. TODO: check this is of type BoomError or just Error. + * @param res - the node response object received from the upstream service. res is a readable stream (use the wreck module read method to easily convert it to a Buffer or string). + * @param request - is the incoming request object. + * @param reply - the reply interface function. + * @param settings - the proxy handler configuration. + * @param ttl - the upstream TTL in milliseconds if proxy.ttl it set to 'upstream' and the upstream response included a valid 'Cache-Control' header with 'max-age'. + */ + onResponse?: (err: null | Boom.BoomError, + res: http.IncomingMessage, + req: hapi.Request, + reply: hapi.ReplyWithContinue, // TODO, check it has continue + settings: ProxyHandlerOptions, + ttl: number) => void; + /** ttl - if set to 'upstream', applies the upstream response caching policy to the response using the response.ttl() method (or passed as an argument to the onResponse method if provided). */ + ttl?: 'upstream'; + /** agent - a node http(s) agent to be used for connections to upstream server. @see {@link https://nodejs.org/api/http.html#http_class_http_agent} */ + agent?: http.Agent; + /** maxSockets - sets the maximum number of sockets available per outgoing proxy host connection. false means use the wreck module default value (Infinity). Does not affect non-proxy outgoing client connections. Defaults to Infinity. */ + maxSockets?: false | number; + } +} + +declare module 'hapi' { + /** + * As one of the handlers for hapi, it is used through the route configuration object. + * [see docs](https://github.com/hapijs/h2o2#usage) + */ + interface RouteHandlerPlugins { + proxy?: H2o2.ProxyHandlerOptions; + } + + interface Base_Reply { + /** + * Proxies the request to an upstream endpoint + * @param options an object including the same keys and restrictions defined by the [route proxy handler options](https://github.com/hapijs/h2o2#options). + * [see docs](https://github.com/hapijs/h2o2#replyproxyoptions) + */ + proxy(options: H2o2.ProxyHandlerOptions): void; + } +} + +declare var H2o2: hapi.PluginFunction<{}>; + +export = H2o2; diff --git a/types/h2o2/tsconfig.json b/types/h2o2/tsconfig.json new file mode 100644 index 0000000000..1abbac7fb0 --- /dev/null +++ b/types/h2o2/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "h2o2-tests.ts" + ] +} \ No newline at end of file diff --git a/types/handlebars/index.d.ts b/types/handlebars/index.d.ts index d3ab2c80e3..71cc0a2cfe 100644 --- a/types/handlebars/index.d.ts +++ b/types/handlebars/index.d.ts @@ -15,6 +15,7 @@ declare namespace Handlebars { export function K(): void; export function createFrame(object: any): any; + export function blockParams(obj: any[], ids: any[]): any[]; export function Exception(message: string): void; export function log(level: number, obj: any): void; export function parse(input: string): hbs.AST.Program; @@ -142,7 +143,8 @@ declare namespace hbs { namespace Utils { function escapeExpression(str: string): string; - function createFrame(obj: Object): Object; + function createFrame(object: any): any; + function blockParams(obj: any[], ids: any[]): any[]; function isEmpty(obj: any) : boolean; function extend(obj: any, ...source: any[]): any; function toString(obj: any): string; diff --git a/types/handsontable/index.d.ts b/types/handsontable/index.d.ts index 23f99e60a4..165d872e8f 100644 --- a/types/handsontable/index.d.ts +++ b/types/handsontable/index.d.ts @@ -79,7 +79,8 @@ declare namespace __Handsontable { selectCellByProp(row: number, prop: string, endRow?: number, endProp?: string, scrollToCell?: boolean): boolean; setCellMeta(row: number, col: number, key: string, val: string): void; setCellMetaObject(row: number, col: number, prop: Object): void; - setDataAtCell(row: number|any[], col: number, value: string, source?: string): void; + setDataAtCell(row: number, col: number, value: string, source?: string): void; + setDataAtCell(changes: Array<[number, number, any]>): void; setDataAtRowProp(row: number|any[], prop: string, value: string, source?: string): void; spliceCol(col: number, index: number, amount: number, elements?: any): void; spliceRow(row: number, index: number, amount: number, elements?: any): void; @@ -218,7 +219,7 @@ declare namespace Handsontable { // hooks afterAutofillApplyValues?(startArea: any[], entireArea: any[]): void; afterCellMetaReset?(): void; - afterChange?(changes: any[], source: string): void; + afterChange?(changes: Array<[number, number|string, any, any]>, source?: string): void; afterChangesObserved?(): void; afterColumnMove?(startColumn: number, endColumn: number): void; afterColumnResize?(currentColumn: number, newSize: number, isDoubleClick: boolean): void; @@ -241,6 +242,7 @@ declare namespace Handsontable { afterInit?(): void; afterLoadData?(firstTime: boolean): void; afterMomentumScroll?(): void; + afterOnCellCornerDblClick?(event: Object): void; afterOnCellCornerMouseDown?(event: Object): void; afterOnCellMouseDown?(event: Object, coords: Object, TD: Element): void; afterOnCellMouseOver?(event: Object, coords: Object, TD: Element): void; @@ -412,6 +414,7 @@ declare namespace Handsontable { getWindowScrollTop(): number; outerHeight(element: HTMLElement): number; hasClass(element: HTMLElement, className: string): boolean | undefined; + empty(element: HTMLElement): void; } interface ArrayMapper { diff --git a/types/handsontable/test/global.ts b/types/handsontable/test/global.ts index d4516d80e1..331f62759d 100644 --- a/types/handsontable/test/global.ts +++ b/types/handsontable/test/global.ts @@ -122,7 +122,7 @@ function test_HandsontableInit() { // Hooks afterAutofillApplyValues: () => {return; }, afterCellMetaReset: () => {return; }, - afterChange: () => {return; }, + afterChange: (changes) => {return; }, afterChangesObserved: () => {return; }, afterColumnMove: () => {return; }, afterColumnResize: () => {return; }, @@ -145,6 +145,7 @@ function test_HandsontableInit() { afterInit: () => {return; }, afterLoadData: () => {return; }, afterMomentumScroll: () => {return; }, + afterOnCellCornerDblClick: () => {return; }, afterOnCellCornerMouseDown: () => {return; }, afterOnCellMouseDown: () => {return; }, afterOnCellMouseOver: () => {return; }, @@ -276,6 +277,7 @@ function test_HandsontableMethods() { hot.setCellMeta(123, 123, 'foo', 'foo'); hot.setCellMetaObject(123, 123, {}); hot.setDataAtCell(123, 123, 'foo', 'foo'); + hot.setDataAtCell([[123, 123, 'foo'], [123, 123, 'foo']]); hot.setDataAtRowProp(123, 'foo', 'foo', 'foo'); hot.spliceCol(123, 123, 123, 'foo'); hot.spliceRow(123, 123, 123, 'foo'); @@ -290,6 +292,7 @@ function test_HandsontableMethods() { 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", () => { return; }); + Handsontable.Dom.empty(new HTMLElement()); } class MyCustomHotPlugin extends Handsontable.plugins.BasePlugin { diff --git a/types/handsontable/test/module.ts b/types/handsontable/test/module.ts index 5d0ef22655..a67ab6942d 100644 --- a/types/handsontable/test/module.ts +++ b/types/handsontable/test/module.ts @@ -124,7 +124,7 @@ function test_HandsontableInit() { // Hooks afterAutofillApplyValues: () => {return; }, afterCellMetaReset: () => {return; }, - afterChange: () => {return; }, + afterChange: (changes) => {return; }, afterChangesObserved: () => {return; }, afterColumnMove: () => {return; }, afterColumnResize: () => {return; }, @@ -147,6 +147,7 @@ function test_HandsontableInit() { afterInit: () => {return; }, afterLoadData: () => {return; }, afterMomentumScroll: () => {return; }, + afterOnCellCornerDblClick: () => {return; }, afterOnCellCornerMouseDown: () => {return; }, afterOnCellMouseDown: () => {return; }, afterOnCellMouseOver: () => {return; }, @@ -278,6 +279,7 @@ function test_HandsontableMethods() { hot.setCellMeta(123, 123, 'foo', 'foo'); hot.setCellMetaObject(123, 123, {}); hot.setDataAtCell(123, 123, 'foo', 'foo'); + hot.setDataAtCell([[123, 123, 'foo'], [123, 123, 'foo']]); hot.setDataAtRowProp(123, 'foo', 'foo', 'foo'); hot.spliceCol(123, 123, 123, 'foo'); hot.spliceRow(123, 123, 123, 'foo'); @@ -292,6 +294,7 @@ function test_HandsontableMethods() { 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", () => { return; }); + Handsontable.Dom.empty(new HTMLElement()); } class MyCustomHotPlugin extends Handsontable.plugins.BasePlugin { diff --git a/types/hapi-auth-basic/hapi-auth-basic-tests.ts b/types/hapi-auth-basic/hapi-auth-basic-tests.ts new file mode 100644 index 0000000000..7f78fe9f65 --- /dev/null +++ b/types/hapi-auth-basic/hapi-auth-basic-tests.ts @@ -0,0 +1,42 @@ +// from https://github.com/hapijs/hapi-auth-basic#hapi-auth-basic + +import Bcrypt = require('bcrypt'); +import Basic = require('hapi-auth-basic'); +import * as Hapi from 'hapi'; + +const server = new Hapi.Server(); + +interface User { + username: string; + password: string; + name: string; + id: string; +} + +const users: {[index: string]: User} = { + john: { + username: 'john', + password: '$2a$10$iqJSHD.BGr0E2IxQwYgJmeP3NvhPrXAeLSaGCj6IR/XU5QtjVu5Tm', // 'secret' + name: 'John Doe', + id: '2133d32a' + } +}; + +const validate: Basic.ValidateFunc = function (request, username, password, callback) { + + const user = users[username]; + if (!user) { + return callback(null, false); + } + + Bcrypt.compare(password, user.password, (err, isValid) => { + + callback(err, isValid, { id: user.id, name: user.name }); + }); +}; + +server.register(Basic, (err) => { + + server.auth.strategy('simple', 'basic', { validateFunc: validate }); + server.route({ method: 'GET', path: '/', config: { auth: 'simple' } }); +}); diff --git a/types/hapi-auth-basic/index.d.ts b/types/hapi-auth-basic/index.d.ts new file mode 100644 index 0000000000..07c3c8cc20 --- /dev/null +++ b/types/hapi-auth-basic/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for hapi 4.2 +// Project: https://github.com/hapijs/hapi-auth-basic +// Definitions by: AJP +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as Hapi from 'hapi'; + +declare namespace Basic { + interface ValidateFuncCallback { + (err: Error | null, isValid: boolean, userCredentials?: any): void; + } + + interface ValidateFunc { + (request: Hapi.Request, username: string, password: string, callback: ValidateFuncCallback): void; + } +} + +declare var Basic: Hapi.PluginFunction<{}>; + +export = Basic; diff --git a/types/hapi-auth-basic/tsconfig.json b/types/hapi-auth-basic/tsconfig.json new file mode 100644 index 0000000000..9e26f11c47 --- /dev/null +++ b/types/hapi-auth-basic/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "hapi-auth-basic-tests.ts" + ] +} diff --git a/types/hapi-auth-jwt2/hapi-auth-jwt2-tests.ts b/types/hapi-auth-jwt2/hapi-auth-jwt2-tests.ts index d0bf1b8688..640706f856 100644 --- a/types/hapi-auth-jwt2/hapi-auth-jwt2-tests.ts +++ b/types/hapi-auth-jwt2/hapi-auth-jwt2-tests.ts @@ -29,13 +29,14 @@ function validate(decoded: User, request: Hapi.Request, callback: hapiAuthJwt2.V } server.register(hapiAuthJwt2, err => { - server.auth.strategy('jwt', 'jwt', { + const options: hapiAuthJwt2.Options = { key: 'NeverShareYourSecret', validateFunc: validate, verifyOptions: { algorithms: ['HS256'] } - }); + }; + server.auth.strategy('jwt', 'jwt', options); }); server.start(); diff --git a/types/hapi-auth-jwt2/index.d.ts b/types/hapi-auth-jwt2/index.d.ts index c12a1f8c04..2e5826e044 100644 --- a/types/hapi-auth-jwt2/index.d.ts +++ b/types/hapi-auth-jwt2/index.d.ts @@ -2,125 +2,129 @@ // Project: http://github.com/dwyl/hapi-auth-jwt2 // Definitions by: Warren Seymour // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import {Request, Response} from 'hapi'; +import {Request, Response, PluginFunction} from 'hapi'; -/** - * A key lookup function - * - * @param decoded the *decoded* but *unverified* JWT received from client - * @param callback the key lookup callback - */ -export type KeyLookup = (decoded: any, callback: KeyLookupCallback) => void; - -/** - * Called when key lookup function has completed - * - * @param err an internal error - * @param key the secret key - * @param extraInfo any additional information that you would like - * to use in `validateFunc` which can be accessed via - * `request.plugins['hapi-auth-jwt2'].extraInfo` - */ -export type KeyLookupCallback = (err: any, key: string, extraInfo?: any) => void; - -/** - * Called when Validation has completed - * - * @param err an internal error - * @param valid `true` if the JWT was valid, otherwise `false` - * @param credentials alternative credentials to be set instead of `decoded` - */ -export type ValidateCallback = (err: any, valid: boolean, credentials?: any) => void; - -/** - * Options passed to `hapi.auth.strategy` when this plugin is used - */ -export interface Options { - /** - * The secret key used to check the signature of the token *or* a *key lookup function* - */ - key?: string | KeyLookup; - - /** - * The function which is run once the Token has been decoded - * - * @param decoded the *decoded* and *verified* JWT received from the client in *request.headers.authorization* - * @param request the original *request* received from the client - * @param callback the validation callback - */ - validateFunc(decoded: {}, request: Request, callback: ValidateCallback): void; - - /** - * Settings to define how tokens are verified by the jsonwebtoken library - */ - verifyOptions?: { +declare namespace hapiAuthJwt2 { /** - * Ignore expired tokens + * A key lookup function + * + * @param decoded the *decoded* but *unverified* JWT received from client + * @param callback the key lookup callback */ - ignoreExpiration?: boolean; + type KeyLookup = (decoded: any, callback: KeyLookupCallback) => void; /** - * Do not enforce token audience + * Called when key lookup function has completed + * + * @param err an internal error + * @param key the secret key + * @param extraInfo any additional information that you would like + * to use in `validateFunc` which can be accessed via + * `request.plugins['hapi-auth-jwt2'].extraInfo` */ - audience?: boolean; + type KeyLookupCallback = (err: any, key: string, extraInfo?: any) => void; /** - * Do not require the issuer to be valid + * Called when Validation has completed + * + * @param err an internal error + * @param valid `true` if the JWT was valid, otherwise `false` + * @param credentials alternative credentials to be set instead of `decoded` */ - issuer?: boolean; + type ValidateCallback = (err: any, valid: boolean, credentials?: any) => void; /** - * List of allowed algorithms + * Options passed to `hapi.auth.strategy` when this plugin is used */ - algorithms?: string[]; - }; + interface Options { + /** + * The secret key used to check the signature of the token *or* a *key lookup function* + */ + key?: string | KeyLookup; - /** - * function called to decorate the response with authentication headers - * before the response headers or payload is written - * - * @param request the Request object - * @param reply is called if an error occurred - */ - responseFunc?(request: Request, reply: (err: any, response: Response) => void): void; + /** + * The function which is run once the Token has been decoded + * + * @param decoded the *decoded* and *verified* JWT received from the client in *request.headers.authorization* + * @param request the original *request* received from the client + * @param callback the validation callback + */ + validateFunc(decoded: {}, request: Request, callback: ValidateCallback): void; - /** - * If you prefer to pass your token via url, simply add a token url - * parameter to your request or use a custom parameter by setting `urlKey. - * To disable the url parameter set urlKey to `false` or ''. - * @default 'token' - */ - urlKey?: string | boolean; + /** + * Settings to define how tokens are verified by the jsonwebtoken library + */ + verifyOptions?: { + /** + * Ignore expired tokens + */ + ignoreExpiration?: boolean; - /** - * If you prefer to set your own cookie key or your project has a cookie - * called 'token' for another purpose, you can set a custom key for your - * cookie by setting `options.cookieKey='yourkeyhere'`. To disable cookies - * set cookieKey to `false` or ''. - * @default 'token' - */ - cookieKey?: string | boolean; + /** + * Do not enforce token audience + */ + audience?: boolean; - /** - * If you want to set a custom key for your header token use the - * `headerKey` option. To disable header token set headerKey to `false` or - * ''. - * @default 'authorization' - */ - headerKey?: string | boolean; + /** + * Do not require the issuer to be valid + */ + issuer?: boolean; - /** - * Allow custom token type, e.g. `Authorization: 12345678` - */ - tokenType?: string; + /** + * List of allowed algorithms + */ + algorithms?: string[]; + }; - /** - * Set to `true` to receive the complete token (`decoded.header`, - * `decoded.payload` and `decoded.signature`) as decoded argument to key - * lookup and `verifyFunc` callbacks (*not `validateFunc`*) - * @default false - */ - complete?: boolean; + /** + * function called to decorate the response with authentication headers + * before the response headers or payload is written + * + * @param request the Request object + * @param reply is called if an error occurred + */ + responseFunc?(request: Request, reply: (err: any, response: Response) => void): void; + + /** + * If you prefer to pass your token via url, simply add a token url + * parameter to your request or use a custom parameter by setting `urlKey. + * To disable the url parameter set urlKey to `false` or ''. + * @default 'token' + */ + urlKey?: string | boolean; + + /** + * If you prefer to set your own cookie key or your project has a cookie + * called 'token' for another purpose, you can set a custom key for your + * cookie by setting `options.cookieKey='yourkeyhere'`. To disable cookies + * set cookieKey to `false` or ''. + * @default 'token' + */ + cookieKey?: string | boolean; + + /** + * If you want to set a custom key for your header token use the + * `headerKey` option. To disable header token set headerKey to `false` or + * ''. + * @default 'authorization' + */ + headerKey?: string | boolean; + + /** + * Allow custom token type, e.g. `Authorization: 12345678` + */ + tokenType?: string; + + /** + * Set to `true` to receive the complete token (`decoded.header`, + * `decoded.payload` and `decoded.signature`) as decoded argument to key + * lookup and `verifyFunc` callbacks (*not `validateFunc`*) + * @default false + */ + complete?: boolean; + } } -export default function hapiAuthJwt2(): void; +declare var hapiAuthJwt2: PluginFunction<{}>; + +export = hapiAuthJwt2; diff --git a/types/hapi-decorators/hapi-decorators-tests.ts b/types/hapi-decorators/hapi-decorators-tests.ts index 49a112152a..2a6f2df5b3 100644 --- a/types/hapi-decorators/hapi-decorators-tests.ts +++ b/types/hapi-decorators/hapi-decorators-tests.ts @@ -4,7 +4,7 @@ import { controller, get, post, put, cache, config, route, validate, Controller @controller('/test') class TestController implements Controller { baseUrl: string; - routes: () => hapi.IRouteConfiguration[]; + routes: () => hapi.RouteConfiguration[]; @get('/') @config({ @@ -16,22 +16,22 @@ class TestController implements Controller { @validate({ payload: false }) - getHandler(request: hapi.Request, reply: hapi.IReply) { + getHandler(request: hapi.Request, reply: hapi.ReplyNoContinue) { reply({ success: true }); } @post('/') - postHandler(request: hapi.Request, reply: hapi.IReply) { + postHandler(request: hapi.Request, reply: hapi.ReplyNoContinue) { reply({ success: true }); } @put('/{id}') - putHandler(request: hapi.Request, reply: hapi.IReply) { + putHandler(request: hapi.Request, reply: hapi.ReplyNoContinue) { reply({ success: true }); } @route('delete', '/{id}') - deleteHandler(request: hapi.Request, reply: hapi.IReply) { + deleteHandler(request: hapi.Request, reply: hapi.ReplyNoContinue) { reply({ success: true }); } } @@ -50,7 +50,7 @@ class SimpleTestController implements Controller { } baseUrl: string; - routes: () => hapi.IRouteConfiguration[]; + routes: () => hapi.RouteConfiguration[]; } server.route(new SimpleTestController('bar').routes()); diff --git a/types/hapi-decorators/index.d.ts b/types/hapi-decorators/index.d.ts index fc32ae8ad5..e4d7c40991 100644 --- a/types/hapi-decorators/index.d.ts +++ b/types/hapi-decorators/index.d.ts @@ -2,14 +2,16 @@ // Project: https://github.com/knownasilya/hapi-decorators // Definitions by: Ken Howard // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as hapi from 'hapi'; +import * as Joi from 'joi'; interface ControllerStatic { new (...args: any[]): Controller; } export interface Controller { baseUrl: string; - routes: () => hapi.IRouteConfiguration[]; + routes: () => hapi.RouteConfiguration[]; } export function controller(baseUrl: string): (target: ControllerStatic) => void; interface IRouteSetup { @@ -28,61 +30,9 @@ export const put: IRouteConfig; // export const delete: IRouteConfig; export const patch: IRouteConfig; export const all: IRouteConfig; -export function config(config: hapi.IRouteAdditionalConfigurationOptions): (target: any, key: any, descriptor: any) => any; -interface IValidateConfig { - /** validation rules for incoming request headers.Values allowed: - * trueany headers allowed (no validation performed).This is the default. - falseno headers allowed (this will cause all valid HTTP requests to fail). - a Joi validation object. - a validation function using the signature function(value, options, next) where: - valuethe object containing the request headers. - optionsthe server validation options. - next(err, value)the callback function called when validation is completed. - */ - headers?: boolean | hapi.IJoi | hapi.IValidationFunction; - /** validation rules for incoming request path parameters, after matching the path against the route and extracting any parameters then stored in request.params.Values allowed: - trueany path parameters allowed (no validation performed).This is the default. - falseno path variables allowed. - a Joi validation object. - a validation function using the signature function(value, options, next) where: - valuethe object containing the path parameters. - optionsthe server validation options. - next(err, value)the callback function called when validation is completed. */ - params?: boolean | hapi.IJoi | hapi.IValidationFunction; - /** validation rules for an incoming request URI query component (the key- value part of the URI between '?' and '#').The query is parsed into its individual key- value pairs (using the qs module) and stored in request.query prior to validation.Values allowed: - trueany query parameters allowed (no validation performed).This is the default. - falseno query parameters allowed. - a Joi validation object. - a validation function using the signature function(value, options, next) where: - valuethe object containing the query parameters. - optionsthe server validation options. - next(err, value)the callback function called when validation is completed. */ - query?: boolean | hapi.IJoi | hapi.IValidationFunction; - /** validation rules for an incoming request payload (request body).Values allowed: - trueany payload allowed (no validation performed).This is the default. - falseno payload allowed. - a Joi validation object. - a validation function using the signature function(value, options, next) where: - valuethe object containing the payload object. - optionsthe server validation options. - next(err, value)the callback function called when validation is completed. */ - payload?: boolean | hapi.IJoi | hapi.IValidationFunction; - /** an optional object with error fields copied into every validation error response. */ - errorFields?: any; - /** determines how to handle invalid requests.Allowed values are: - 'error'return a Bad Request (400) error response.This is the default value. - 'log'log the error but continue processing the request. - 'ignore'take no action. - OR a custom error handler function with the signature 'function(request, reply, source, error)` where: - requestthe request object. - replythe continuation reply interface. - sourcethe source of the invalid field (e.g. 'path', 'query', 'payload'). - errorthe error object prepared for the client response (including the validation function error under error.data). */ - failAction?: string | hapi.IRouteFailFunction; - /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ - options?: any; -} -export function validate(config: IValidateConfig): (target: any, key: any, descriptor: any) => any; +export function config(config: hapi.RouteAdditionalConfigurationOptions): (target: any, key: any, descriptor: any) => any; + +export function validate(config: hapi.RouteValidationConfigurationObject): (target: any, key: any, descriptor: any) => any; interface ICacheConfig { privacy?: string; expiresIn?: number; diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index d4c8861a78..efce9f3dc4 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -1,2473 +1,2718 @@ -// Type definitions for hapi 16.0 -// Project: http://github.com/spumko/hapi -// Definitions by: Jason Swearingen +// Type definitions for hapi 16.1 +// Project: https://github.com/hapijs/hapi +// Definitions by: Jason Swearingen , AJP // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -// Note/Disclaimer: This .d.ts was created against hapi v8.x but has been incrementally upgraded to 13.x. Some newer features/changes may be missing. YMMV. +/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WARNING: BACKWARDS INCOMPATIBLE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + * + * + * Removal of IPromise replaced with Promise + * Removal of IReplyStrict<> + * Removal of IReply replaced with different interfaces like: + * ReplyWithContinue + * ReplyNoContinue, etc. + * Renaming of all interfaces to remove preceding I in preparation of dtslint + */ /// -import http = require("http"); -import stream = require("stream"); import Events = require("events"); +import stream = require("stream"); +import http = require("http"); +import https = require("https"); import url = require("url"); +import zlib = require("zlib"); +import domain = require("domain"); -export interface IDictionary { - [key: string]: T; -} +import * as Boom from 'boom'; +import { + ValidationOptions as JoiValidationOptions, + SchemaMap as JoiSchemaMap, + Schema as JoiSchema, +} from 'joi'; +// TODO check JoiValidationObject is correct for "a Joi validation object" +type JoiValidationObject = JoiSchema | JoiSchemaMap | (JoiSchema | JoiSchemaMap)[]; -export interface IHeaderOptions { - append?: boolean; - separator?: string; - override?: boolean; - duplicate?: boolean; -} +import * as Catbox from 'catbox'; +import {MimosOptions} from 'mimos'; +import Podium = require('podium'); +import * as Shot from 'shot'; -/** Boom Module for errors. https://github.com/hapijs/boom - * boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: */ -export interface IBoom extends Error { - /** if true, indicates this is a Boom object instance. */ - isBoom: boolean; - /** convenience bool indicating status code >= 500. */ - isServer: boolean; - /** the error message. */ - message: string; - /** the formatted response.Can be directly manipulated after object construction to return a custom error response.Allowed root keys: */ - output: { - /** the HTTP status code (typically 4xx or 5xx). */ - statusCode: number; - /** an object containing any HTTP headers where each key is a header name and value is the header content. */ - headers: IDictionary; - /** the formatted object used as the response payload (stringified).Can be directly manipulated but any changes will be lost if reformat() is called.Any content allowed and by default includes the following content: */ - payload: { - /** the HTTP status code, derived from error.output.statusCode. */ - statusCode: number; - /** the HTTP status message (e.g. 'Bad Request', 'Internal Server Error') derived from statusCode. */ - error: string; - /** the error message derived from error.message. */ - message: string; - }; - }; - /** reformat()rebuilds error.output using the other object properties. */ - reformat(): void; -} - -/** cache functionality via the "CatBox" module. */ -export interface ICatBoxCacheOptions { - /** a prototype function or catbox engine object. */ - engine: any; - /** an identifier used later when provisioning or configuring caching for server methods or plugins. Each cache name must be unique. A single item may omit the name option which defines the default cache. If every cache includes a name, a default memory cache is provisions as well. */ - name?: string; - /** if true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. */ - shared?: boolean; -} - -/** policy configuration for the "CatBox" module and server method options. */ -export interface ICatBoxCachePolicyOptions { - /** the cache name configured in server.cache. Defaults to the default cache. */ - cache?: string; - /** string segment name, used to isolate cached items within the cache partition. When called within a plugin, defaults to '!name' where 'name' is the plugin name. When called within a server method, defaults to '#name' where 'name' is the server method name. Required when called outside of a plugin. */ - segment?: string; - /** if true, allows multiple cache provisions to share the same segment. Default to false. */ - shared?: boolean; - /** relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. */ - expiresIn?: number; - /** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records expire. Uses local time. Cannot be used together with expiresIn. */ - expiresAt?: number; - /** a function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id, next) where: - id - the id string or object provided to the get() method. - next - the method called when the new item is returned with the signature function(err, value, ttl) where: - err - an error condition. - value - the new value generated. - ttl - the cache ttl value in milliseconds. Set to 0 to skip storing in the cache. Defaults to the cache global policy. */ - generateFunc?: Function; - /** number of milliseconds to mark an item stored in cache as stale and attempt to regenerate it when generateFunc is provided. Must be less than expiresIn. */ - staleIn?: number; - /** number of milliseconds to wait before checking if an item is stale. */ - staleTimeout?: number; - /** number of milliseconds to wait before returning a timeout error when the generateFunc function takes too long to return a value. When the value is eventually returned, it is stored in the cache for future requests. Required if generateFunc is present. Set to false to disable timeouts which may cause all get() requests to get stuck forever. */ - generateTimeout?: number; - /** if true, an error or timeout in the generateFunc causes the stale value to be evicted from the cache. Defaults to true */ - dropOnError?: boolean; - /** if false, an upstream cache read error will stop the cache.get() method from calling the generate function and will instead pass back the cache error. Defaults to true. */ - generateOnReadError?: boolean; - /** if false, an upstream cache write error when calling cache.get() will be passed back with the generated value when calling. Defaults to true. */ - generateIgnoreWriteError?: boolean; - /** number of milliseconds while generateFunc call is in progress for a given id, before a subsequent generateFunc call is allowed. Defaults to 0 (no blocking of concurrent generateFunc calls beyond staleTimeout). */ - pendingGenerateTimeout?: number; -} - -/** Any connections configuration server defaults can be included to override and customize the individual connection. */ -export interface IServerConnectionOptions extends IConnectionConfigurationServerDefaults { - /** - the public hostname or IP address. Used only to set server.info.host and server.info.uri. If not configured, defaults to the operating system hostname and if not available, to 'localhost'.*/ - host?: string; - /** - sets the host name or IP address the connection will listen on.If not configured, defaults to host if present, otherwise to all available network interfaces (i.e. '0.0.0.0').Set to 127.0.0.1 or localhost to restrict connection to only those coming from the same machine.*/ - address?: string; - /** - the TCP port the connection will listen to.Defaults to an ephemeral port (0) which uses an available port when the server is started (and assigned to server.info.port).If port is a string containing a '/' character, it is used as a UNIX domain socket path and if it starts with '\.\pipe' as a Windows named pipe.*/ - port?: string | number; - /** - the full public URI without the path (e.g. 'http://example.com:8080').If present, used as the connection info.uri otherwise constructed from the connection settings.*/ - uri?: string; - /** - optional node.js HTTP (or HTTPS) http.Server object or any compatible object.If the listener needs to be manually started, set autoListen to false.If the listener uses TLS, set tls to true.*/ - listener?: any; - /** - indicates that the connection.listener will be started manually outside the framework.Cannot be specified with a port setting.Defaults to true.*/ - autoListen?: boolean; - /** caching headers configuration: */ - cache?: { - /** - an array of HTTP response status codes (e.g. 200) which are allowed to include a valid caching directive.Defaults to [200]. */ - statuses: number[]; - }; - /** - a string or string array of labels used to server.select() specific connections matching the specified labels.Defaults to an empty array [](no labels).*/ - labels?: string | string[]; - /** - used to create an HTTPS connection.The tls object is passed unchanged as options to the node.js HTTPS server as described in the node.js HTTPS documentation.Set to true when passing a listener object that has been configured to use TLS directly. */ - tls?: boolean | { key?: string; cert?: string; pfx?: string; } | Object; -} - -export interface IConnectionConfigurationServerDefaults { - /** application-specific connection configuration which can be accessed via connection.settings.app. Provides a safe place to store application configuration without potential conflicts with the framework internals. Should not be used to configure plugins which should use plugins[name]. Note the difference between connection.settings.app which is used to store configuration values and connection.app which is meant for storing run-time state. */ - app?: any; - /** if false, response content encoding is disabled. Defaults to true */ - compression?: boolean; - /** connection load limits configuration where: */ - load?: { - /** maximum V8 heap size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ - maxHeapUsedBytes: number; - /** maximum process RSS size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ - maxRssBytes: number; - /** maximum event loop delay duration in milliseconds over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ - maxEventLoopDelay: number; - }; - /** plugin-specific configuration which can later be accessed via connection.settings.plugins. Provides a place to store and pass connection-specific plugin configuration. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between connection.settings.plugins which is used to store configuration values and connection.plugins which is meant for storing run-time state. */ - plugins?: any; - /** controls how incoming request URIs are matched against the routing table: */ - router?: { - /** determines whether the paths '/example' and '/EXAMPLE' are considered different resources. Defaults to true. */ - isCaseSensitive: boolean; - /** removes trailing slashes on incoming paths. Defaults to false. */ - stripTrailingSlash: boolean; - }; - /** a route options object used to set the default configuration for every route. */ - routes?: IRouteAdditionalConfigurationOptions; - state?: IServerState; -} - -/** Note that the options object is deeply cloned and cannot contain any values that are unsafe to perform deep copy on.*/ -export interface IServerOptions { - /** application-specific configuration which can later be accessed via server.settings.app. Note the difference between server.settings.app which is used to store static configuration values and server.app which is meant for storing run-time state. Defaults to {}. */ - app?: any; - /** sets up server-side caching. Every server includes a default cache for storing application state. By default, a simple memory-based cache is created which has limited capacity and capabilities. hapi uses catbox for its cache which includes support for common storage solutions (e.g. Redis, MongoDB, Memcached, and Riak). Caching is only utilized if methods and plugins explicitly store their state in the cache. The server cache configuration only defines the storage container itself. cache can be assigned: - a prototype function (usually obtained by calling require() on a catbox strategy such as require('catbox-redis')). - a configuration object with the following options: - enginea prototype function or catbox engine object. - namean identifier used later when provisioning or configuring caching for server methods or plugins. Each cache name must be unique. A single item may omit the name option which defines the default cache. If every cache includes a name, a default memory cache is provisions as well. - sharedif true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. - other options passed to the catbox strategy used. - an array of the above object for configuring multiple cache instances, each with a unique name. When an array of objects is provided, multiple cache connections are established and each array item (except one) must include a name. */ - cache?: string | ICatBoxCacheOptions | ICatBoxCacheOptions[] | any; - /** sets the default connections configuration which can be overridden by each connection where: */ - connections?: IConnectionConfigurationServerDefaults; - /** determines which logged events are sent to the console (this should only be used for development and does not affect which events are actually logged internally and recorded). Set to false to disable all console logging, or to an object*/ - debug?: boolean | { - /** - a string array of server log tags to be displayed via console.error() when the events are logged via server.log() as well as internally generated server logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error. */ - log: string[]; - /** - a string array of request log tags to be displayed via console.error() when the events are logged via request.log() as well as internally generated request logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error.*/ - request: string[]; - }; - /** file system related settings*/ - files?: { - /** sets the maximum number of file etag hash values stored in the etags cache. Defaults to 10000.*/ - etagsCacheMaxSize?: number; - }; - /** process load monitoring*/ - load?: { - /** the frequency of sampling in milliseconds. Defaults to 0 (no sampling).*/ - sampleInterval?: number; - }; - - /** options passed to the mimos module (https://github.com/hapijs/mimos) when generating the mime database used by the server and accessed via server.mime.*/ - mime?: any; - /** if true, does not load the inert (file and directory support), h2o2 (proxy support), and vision (views support) plugins automatically. The plugins can be loaded manually after construction. Defaults to false (plugins loaded). */ - minimal?: boolean; - /** plugin-specific configuration which can later be accessed via server.settings.plugins. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between server.settings.plugins which is used to store static configuration values and server.plugins which is meant for storing run-time state. Defaults to {}.*/ - plugins?: IDictionary; -} - -export interface IServerViewCompile { - (template: string, options: any): void; - (template: string, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: boolean) => void) => void) => void): void; -} - -export interface IServerViewsAdditionalOptions { - /** path - the root file path used to resolve and load the templates identified when calling reply.view().Defaults to current working directory.*/ - path?: string; - /**partialsPath - the root file path where partials are located.Partials are small segments of template code that can be nested and reused throughout other templates.Defaults to no partials support (empty path). - */ - partialsPath?: string; - /**helpersPath - the directory path where helpers are located.Helpers are functions used within templates to perform transformations and other data manipulations using the template context or other inputs.Each '.js' file in the helpers directory is loaded and the file name is used as the helper name.The files must export a single method with the signature function(context) and return a string.Sub - folders are not supported and are ignored.Defaults to no helpers support (empty path).Note that jade does not support loading helpers this way.*/ - helpersPath?: string; - /**relativeTo - a base path used as prefix for path and partialsPath.No default.*/ - relativeTo?: string; - - /**layout - if set to true or a layout filename, layout support is enabled.A layout is a single template file used as the parent template for other view templates in the same engine.If true, the layout template name must be 'layout.ext' where 'ext' is the engine's extension. Otherwise, the provided filename is suffixed with the engine's extension and loaded.Disable layout when using Jade as it will handle including any layout files independently.Defaults to false.*/ - layout?: boolean | string; - /**layoutPath - the root file path where layout templates are located (using the relativeTo prefix if present). Defaults to path.*/ - layoutPath?: string; - /**layoutKeyword - the key used by the template engine to denote where primary template content should go.Defaults to 'content'.*/ - layoutKeywork?: string; - /**encoding - the text encoding used by the templates when reading the files and outputting the result.Defaults to 'utf8'.*/ - encoding?: string; - /**isCached - if set to false, templates will not be cached (thus will be read from file on every use).Defaults to true.*/ - isCached?: boolean; - /**allowAbsolutePaths - if set to true, allows absolute template paths passed to reply.view().Defaults to false.*/ - allowAbsolutePaths?: boolean; - /**allowInsecureAccess - if set to true, allows template paths passed to reply.view() to contain '../'.Defaults to false.*/ - allowInsecureAccess?: boolean; - /**compileOptions - options object passed to the engine's compile function. Defaults to empty options {}.*/ - compileOptions?: any; - /**runtimeOptions - options object passed to the returned function from the compile operation.Defaults to empty options {}.*/ - runtimeOptions?: any; - /**contentType - the content type of the engine results.Defaults to 'text/html'.*/ - contentType?: string; - /**compileMode - specify whether the engine compile() method is 'sync' or 'async'.Defaults to 'sync'.*/ - compileMode?: string; - /**context - a global context used with all templates.The global context option can be either an object or a function that takes no arguments and returns a context object.When rendering views, the global context will be merged with any context object specified on the handler or using reply.view().When multiple context objects are used, values from the global context always have lowest precedence.*/ - context?: any; -} - -export interface IServerViewsEnginesOptions extends IServerViewsAdditionalOptions { - /**- the npm module used for rendering the templates.The module object must contain: "module", the rendering function. The required function signature depends on the compileMode settings. - * If the compileMode is 'sync', the signature is compile(template, options), the return value is a function with signature function(context, options), and the method is allowed to throw errors.If the compileMode is 'async', the signature is compile(template, options, callback) where callback has the signature function(err, compiled) where compiled is a function with signature function(context, options, callback) and callback has the signature function(err, rendered).*/ - module: { - compile?(template: any, options: any): (context: any, options: any) => void; - compile?(template: any, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: any) => void) => void) => void): void; - }; -} - -/**Initializes the server views manager - var Hapi = require('hapi'); - var server = new Hapi.Server(); - - server.views({ -engines: { -html: require('handlebars'), -jade: require('jade') -}, -path: '/static/templates' -}); - When server.views() is called within a plugin, the views manager is only available to plugins methods. - */ -export interface IServerViewsConfiguration extends IServerViewsAdditionalOptions { - /** - required object where each key is a file extension (e.g. 'html', 'hbr'), mapped to the npm module used for rendering the templates.Alternatively, the extension can be mapped to an object with the following options:*/ - engines: IDictionary | IServerViewsEnginesOptions; - /** defines the default filename extension to append to template names when multiple engines are configured and not explicit extension is provided for a given template. No default value.*/ - defaultExtension?: string; -} - -export interface IReplyMethods { - /** Returns control back to the framework without setting a response. If called in the handler, the response defaults to an empty payload with status code 200. - * The data argument is only used for passing back authentication data and is ignored elsewhere. */ - continue(credentialData?: any): void; - - /** Transmits a file from the file system. The 'Content-Type' header defaults to the matching mime type based on filename extension. The response flow control rules do not apply. */ - file(/** the file path. */ - path: string, - /** optional settings: */ - options?: { - /** - an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ - filename?: string; - /** specifies whether to include the 'Content-Disposition' header with the response. Available values: - false - header is not included. This is the default value. - 'attachment' - 'inline'*/ - mode?: boolean | string; - /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. */ - lookupCompressed: boolean; - }): void; - /** Concludes the handler activity by returning control over to the router with a templatized view response. - the response flow control rules apply. */ - view(/** the template filename and path, relative to the templates path configured via the server views manager. */ - template: string, - /** optional object used by the template to render context-specific result. Defaults to no context {}. */ - context?: {}, - /** optional object used to override the server's views manager configuration for this response. Cannot override isCached, partialsPath, or helpersPath which are only loaded at initialization. */ - options?: any): Response; - /** Sets a header on the response */ - header(name: string, value: string, options?: IHeaderOptions): Response; - - /** Concludes the handler activity by returning control over to the router and informing the router that a response has already been sent back directly via request.raw.res and that no further response action is needed - The response flow control rules do not apply. */ - close(options?: { - /** if false, the router will not call request.raw.res.end()) to ensure the response was ended. Defaults to true. */ - end?: boolean; - }): void; - /** Proxies the request to an upstream endpoint. - the response flow control rules do not apply. */ - - proxy(/** an object including the same keys and restrictions defined by the route proxy handler options. */ - options: IProxyHandlerConfig): void; - /** Redirects the client to the specified uri. Same as calling reply().redirect(uri). - he response flow control rules apply. */ - redirect(uri: string): ResponseRedirect; - - /** Replies with the specified response */ - response(result: any): Response; - - /** Sets a cookie on the response */ - state(name: string, value: any, options?: any): void; - - /** Clears a cookie on the response */ - unstate(name: string, options?: any): void; -} - -/** Concludes the handler activity by setting a response and returning control over to the framework where: - erran optional error response. - result an optional response payload. - Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first. - FLOW CONTROL: - When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */ -export interface IReply extends IReplyMethods { - ( - err: Error, - result?: string | number | boolean | Buffer | stream.Stream | Promise | T, - /** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */ - credentialData?: any): IBoom; - /** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */ - (result: string | number | boolean | Buffer | stream.Stream | Promise | T): Response; -} - -/** Concludes the handler activity by setting a response and returning control over to the framework where: - erran optional error response. - result an optional response payload. - Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first. - FLOW CONTROL: - When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */ -export interface IStrictReply extends IReplyMethods { - (err: Error, - result?: Promise | T, - /** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */ - credentialData?: any): IBoom; - /** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */ - (result: Promise | T): Response; -} - -export interface ISessionHandler { - (request: Request, reply: IReply): void; -} - -export interface IStrictSessionHandler { - (request: Request, reply: IStrictReply): void; -} - -export interface IRequestHandler { - (request: Request): T; -} - -export interface IFailAction { - (source: string, error: any, next: () => void): void; -} -/** generates a reverse proxy handler */ -export interface IProxyHandlerConfig { - /** the upstream service host to proxy requests to. The same path on the client request will be used as the path on the host.*/ - host?: string; - /** the upstream service port. */ - port?: number; - /** The protocol to use when making a request to the proxied host: - 'http' - 'https'*/ - protocol?: string; - /** an absolute URI used instead of the incoming host, port, protocol, path, and query. Cannot be used with host, port, protocol, or mapUri.*/ - uri?: string; - /** if true, forwards the headers sent from the client to the upstream service being proxied to, headers sent from the upstream service will also be forwarded to the client. Defaults to false.*/ - passThrough?: boolean; - /** localStatePassThrough - if false, any locally defined state is removed from incoming requests before being passed upstream. This is a security feature to prevent local state (e.g. authentication cookies) from leaking upstream to other servers along with the cookies intended for those servers. This value can be overridden on a per state basis via the server.state() passThrough option. Defaults to false.*/ - localStatePassThrough?: boolean; - /**acceptEncoding - if false, does not pass-through the 'Accept-Encoding' HTTP header which is useful when using an onResponse post-processing to avoid receiving an encoded response (e.g. gzipped). Can only be used together with passThrough. Defaults to true (passing header).*/ - acceptEncoding?: boolean; - /** rejectUnauthorized - sets the rejectUnauthorized property on the https agent making the request. This value is only used when the proxied server uses TLS/SSL. When set it will override the node.js rejectUnauthorized property. If false then ssl errors will be ignored. When true the server certificate is verified and an 500 response will be sent when verification fails. This shouldn't be used alongside the agent setting as the agent will be used instead. Defaults to the https agent default value of true.*/ - rejectUnauthorized?: boolean; - /**if true, sets the 'X-Forwarded-For', 'X-Forwarded-Port', 'X-Forwarded-Proto' headers when making a request to the proxied upstream endpoint. Defaults to false.*/ - xforward?: boolean; - /** the maximum number of HTTP redirections allowed, to be followed automatically by the handler. Set to false or 0 to disable all redirections (the response will contain the redirection received from the upstream service). If redirections are enabled, no redirections (301, 302, 307, 308) will be passed along to the client, and reaching the maximum allowed redirections will return an error response. Defaults to false.*/ - redirects?: boolean | number; - /**number of milliseconds before aborting the upstream request. Defaults to 180000 (3 minutes).*/ - timeout?: number; - /** a function used to map the request URI to the proxied URI. Cannot be used together with host, port, protocol, or uri. The function signature is function(request, callback) where: - request - is the incoming request object. - callback - is function(err, uri, headers) where: - err - internal error condition. - uri - the absolute proxy URI. - headers - optional object where each key is an HTTP request header and the value is the header content.*/ - mapUri?(request: Request, callback: (err: any, uri: string, headers?: { [key: string]: string }) => void): void; - /** a custom function for processing the response from the upstream service before sending to the client. Useful for custom error handling of responses from the proxied endpoint or other payload manipulation. Function signature is function(err, res, request, reply, settings, ttl) where: - err - internal or upstream error returned from attempting to contact the upstream proxy. - res - the node response object received from the upstream service. res is a readable stream (use the wreck module read method to easily convert it to a Buffer or string). - request - is the incoming request object. - reply - the reply interface function. - settings - the proxy handler configuration. - ttl - the upstream TTL in milliseconds if proxy.ttl it set to 'upstream' and the upstream response included a valid 'Cache-Control' header with 'max-age'.*/ - onResponse?( - err: any, - res: http.ServerResponse, - req: Request, - reply: IReply, - settings: IProxyHandlerConfig, - ttl: number): void; - /** if set to 'upstream', applies the upstream response caching policy to the response using the response.ttl() method (or passed as an argument to the onResponse method if provided).*/ - ttl?: number; - /** - a node http(s) agent to be used for connections to upstream server. see https://nodejs.org/api/http.html#http_class_http_agent */ - agent?: http.Agent; - /** sets the maximum number of sockets available per outgoing proxy host connection. false means use the wreck module default value (Infinity). Does not affect non-proxy outgoing client connections. Defaults to Infinity.*/ - maxSockets?: boolean | number; -} -/** TODO: fill in joi definition */ -export interface IJoi {} - -/** a validation function using the signature function(value, options, next) */ -export interface IValidationFunction { - ( - /** the object containing the path parameters. */ - value: any, - /** the server validation options. */ - options: any, - /** the callback function called when validation is completed. */ - next: (err: any, value: any) => void): void; -} -/** a custom error handler function with the signature 'function(request, reply, source, error)` */ -export interface IRouteFailFunction { - /** a custom error handler function with the signature 'function(request, reply, source, error)` */ - (/** - the [request object]. */ - request: Request, - /** the continuation reply interface. */ - reply: IReply, - /** the source of the invalid field (e.g. 'path', 'query', 'payload'). */ - source: string, - /** the error object prepared for the client response (including the validation function error under error.data). */ - error: any): void; -} - -/** Each route can be customize to change the default behavior of the request lifecycle using the following options: */ -export interface IRouteAdditionalConfigurationOptions { - /** application specific configuration.Should not be used by plugins which should use plugins[name] instead. */ - app?: any; - /** authentication configuration.Value can be: false to disable authentication if a default strategy is set. - a string with the name of an authentication strategy registered with server.auth.strategy(). - an object */ - auth?: boolean | string | - { - /** the authentication mode.Defaults to 'required' if a server authentication strategy is configured, otherwise defaults to no authentication.Available values: - 'required'authentication is required. - 'optional'authentication is optional (must be valid if present). - 'try'same as 'optional' but allows for invalid authentication. */ - mode?: string; - /** a string array of strategy names in order they should be attempted.If only one strategy is used, strategy can be used instead with the single string value.Defaults to the default authentication strategy which is available only when a single strategy is configured. */ - strategies?: string | string[]; - /** if set, the payload (in requests other than 'GET' and 'HEAD') is authenticated after it is processed.Requires a strategy with payload authentication support (e.g.Hawk).Cannot be set to a value other than 'required' when the scheme sets the options.payload to true.Available values: - falseno payload authentication.This is the default value. - 'required'payload authentication required.This is the default value when the scheme sets options.payload to true. - 'optional'payload authentication performed only when the client includes payload authentication information (e.g.hash attribute in Hawk). */ - payload?: string; - /** the application scope required to access the route.Value can be a scope string or an array of scope strings.The authenticated credentials object scope property must contain at least one of the scopes defined to access the route.Set to false to remove scope requirements.Defaults to no scope required. */ - scope?: string | string[] | boolean; - /** the required authenticated entity type.If set, must match the entity value of the authentication credentials.Available values: - anythe authentication can be on behalf of a user or application.This is the default value. - userthe authentication must be on behalf of a user. - appthe authentication must be on behalf of an application. */ - entity?: string; - /** - * an object or array of objects specifying the route access rules. Each rule is evaluated against an incoming - * request and access is granted if at least one rule matches. Each rule object must include at least one of: - */ - access?: IRouteAdditionalConfigurationAuthAccess | IRouteAdditionalConfigurationAuthAccess[]; - }; - /** an object passed back to the provided handler (via this) when called. */ - bind?: any; - /** if the route method is 'GET', the route can be configured to include caching directives in the response using the following options */ - cache?: { - /** mines the privacy flag included in clientside caching using the 'Cache-Control' header.Values are: - fault'no privacy flag.This is the default setting. - 'public'mark the response as suitable for public caching. - 'private'mark the response as suitable only for private caching. */ - privacy: string; - /** relative expiration expressed in the number of milliseconds since the item was saved in the cache.Cannot be used together with expiresAt. */ - expiresIn: number; - /** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire.Cannot be used together with expiresIn. */ - expiresAt: string; - }; - /** the Cross- Origin Resource Sharing protocol allows browsers to make cross- origin API calls.CORS is required by web applications running inside a browser which are loaded from a different domain than the API server.CORS headers are disabled by default. To enable, set cors to true, or to an object with the following options: */ - cors?: { - /** a strings array of allowed origin servers ('Access-Control-Allow-Origin').The array can contain any combination of fully qualified origins along with origin strings containing a wildcard '' character, or a single `''origin string. Defaults to any origin['*']`. */ - origin?: string[]; - /** if true, matches the value of the incoming 'Origin' header to the list of origin values ('*' matches anything) and if a match is found, uses that as the value of the 'Access-Control-Allow-Origin' response header.When false, the origin config is returned as- is.Defaults to true. */ - matchOrigin?: boolean; - /** if false, prevents the connection from returning the full list of non- wildcard origin values if the incoming origin header does not match any of the values.Has no impact if matchOrigin is set to false.Defaults to true. */ - isOriginExposed?: boolean; - /** number of seconds the browser should cache the CORS response ('Access-Control-Max-Age').The greater the value, the longer it will take before the browser checks for changes in policy.Defaults to 86400 (one day). */ - maxAge?: number; - /** a strings array of allowed headers ('Access-Control-Allow-Headers').Defaults to ['Authorization', 'Content-Type', 'If-None-Match']. */ - headers?: string[]; - /** a strings array of additional headers to headers.Use this to keep the default headers in place. */ - additionalHeaders?: string[]; - /** a strings array of allowed HTTP methods ('Access-Control-Allow-Methods').Defaults to ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS']. */ - methods?: string[]; - /** a strings array of additional methods to methods.Use this to keep the default methods in place. */ - additionalMethods?: string[]; - /** a strings array of exposed headers ('Access-Control-Expose-Headers').Defaults to ['WWW-Authenticate', 'Server-Authorization']. */ - exposedHeaders?: string[]; - /** a strings array of additional headers to exposedHeaders.Use this to keep the default headers in place. */ - additionalExposedHeaders?: string[]; - /** if true, allows user credentials to be sent ('Access-Control-Allow-Credentials').Defaults to false. */ - credentials?: boolean; - /** if false, preserves existing CORS headers set manually before the response is sent.Defaults to true. */ - override?: boolean; - }; - /** defines the behavior for serving static resources using the built-in route handlers for files and directories: */ - files?: {/** determines the folder relative paths are resolved against when using the file and directory handlers. */ - relativeTo: string; - }; - - /** an alternative location for the route handler option. */ - handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig; - /** an optional unique identifier used to look up the route using server.lookup(). */ - id?: number; - /** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */ - json?: { - /** the replacer function or array.Defaults to no action. */ - replacer?: Function | string[]; - /** number of spaces to indent nested object keys.Defaults to no indentation. */ - space?: number | string; - /** string suffix added after conversion to JSON string.Defaults to no suffix. */ - suffix?: string; - }; - /** enables JSONP support by setting the value to the query parameter name containing the function name used to wrap the response payload.For example, if the value is 'callback', a request comes in with 'callback=me', and the JSON response is '{ "a":"b" }', the payload will be 'me({ "a":"b" });'.Does not work with stream responses. */ - jsonp?: string; - /** determines how the request payload is processed: */ - payload?: { - /** the type of payload representation requested. The value must be one of: - 'data'the incoming payload is read fully into memory.If parse is true, the payload is parsed (JSON, formdecoded, multipart) based on the 'Content- Type' header.If parse is false, the raw Buffer is returned.This is the default value except when a proxy handler is used. - 'stream'the incoming payload is made available via a Stream.Readable interface.If the payload is 'multipart/form-data' and parse is true, fields values are presented as text while files are provided as streams.File streams from a 'multipart/form-data' upload will also have a property hapi containing filename and headers properties. - 'file'the incoming payload in written to temporary file in the directory specified by the server's payload.uploads settings. If the payload is 'multipart/ formdata' and parse is true, fields values are presented as text while files are saved. Note that it is the sole responsibility of the application to clean up the files generated by the framework. This can be done by keeping track of which files are used (e.g. using the request.app object), and listening to the server 'response' event to perform any needed cleaup. */ - output?: string; - /** can be true, false, or gunzip; determines if the incoming payload is processed or presented raw. true and gunzip includes gunzipping when the appropriate 'Content-Encoding' is specified on the received request. If parsing is enabled and the 'Content-Type' is known (for the whole payload as well as parts), the payload is converted into an object when possible. If the format is unknown, a Bad Request (400) error response is sent. Defaults to true, except when a proxy handler is used. The supported mime types are: - 'application/json' - 'application/x-www-form-urlencoded' - 'application/octet-stream' - 'text/ *' - 'multipart/form-data' */ - parse?: string | boolean; - /** a string or an array of strings with the allowed mime types for the endpoint.Defaults to any of the supported mime types listed above.Note that allowing other mime types not listed will not enable them to be parsed, and that if parsing mode is 'parse', the request will result in an error response. */ - allow?: string | string[]; - /** a mime type string overriding the 'Content-Type' header value received.Defaults to no override. */ - override?: string; - /** limits the size of incoming payloads to the specified byte count.Allowing very large payloads may cause the server to run out of memory.Defaults to 1048576 (1MB). */ - maxBytes?: number; - /** payload reception timeout in milliseconds.Sets the maximum time allowed for the client to transmit the request payload (body) before giving up and responding with a Request Timeout (408) error response.Set to false to disable.Defaults to 10000 (10 seconds). */ - timeout?: number; - /** the directory used for writing file uploads.Defaults to os.tmpDir(). */ - uploads?: string; - /** determines how to handle payload parsing errors. Allowed values are: - 'error'return a Bad Request (400) error response. This is the default value. - 'log'report the error but continue processing the request. - 'ignore'take no action and continue processing the request. */ - failAction?: string; - }; - /** pluginspecific configuration.plugins is an object where each key is a plugin name and the value is the plugin configuration. */ - plugins?: IDictionary; - /** an array with [route prerequisites] methods which are executed in serial or in parallel before the handler is called. */ - pre?: any[]; - /** validation rules for the outgoing response payload (response body).Can only validate object response: */ - response?: { - /** the default HTTP status code when the payload is empty. Value can be 200 or 204. - Note that a 200 status code is converted to a 204 only at the time or response transmission - (the response status code will remain 200 throughout the request lifecycle unless manually set). Defaults to 200. */ - emptyStatusCode?: number; - /** the default response object validation rules (for all non-error responses) expressed as one of: - true - any payload allowed (no validation performed). This is the default. - false - no payload allowed. - a Joi validation object. - a validation function using the signature function(value, options, next) where: - value - the object containing the response object. - options - the server validation options. - next(err) - the callback function called when validation is completed. */ - schema?: boolean | any; - /** HTTP status- codespecific validation rules.The status key is set to an object where each key is a 3 digit HTTP status code and the value has the same definition as schema.If a response status code is not present in the status object, the schema definition is used, expect for errors which are not validated by default. */ - status?: { [statusCode: number]: boolean | any }; - /** the percent of responses validated (0100).Set to 0 to disable all validation.Defaults to 100 (all responses). */ - sample?: number; - /** defines what to do when a response fails validation.Options are: - errorreturn an Internal Server Error (500) error response.This is the default value. - loglog the error but send the response. */ - failAction?: string; - /** if true, applies the validation rule changes to the response.Defaults to false. */ - modify?: boolean; - /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ - options?: any; - }; - /** sets common security headers (disabled by default).To enable set security to true or to an object with the following options */ - security?: boolean | { - /** controls the 'Strict-Transport-Security' header.If set to true the header will be set to max- age=15768000, if specified as a number the maxAge parameter will be set to that number.Defaults to true.You may also specify an object with the following fields: */ - hsts?: boolean | number | { - /** the max- age portion of the header, as a number.Default is 15768000. */ - maxAge?: number; - /** a boolean specifying whether to add the includeSubdomains flag to the header. */ - includeSubdomains?: boolean; - /** a boolean specifying whether to add the 'preload' flag (used to submit domains inclusion in Chrome's HTTP Strict Transport Security (HSTS) preload list) to the header. */ - preload?: boolean; - }; - /** controls the 'X-Frame-Options' header.When set to true the header will be set to DENY, you may also specify a string value of 'deny' or 'sameorigin'.To use the 'allow-from' rule, you must set this to an object with the following fields: */ - xframe?: { - /** either 'deny', 'sameorigin', or 'allow-from' */ - rule: string; - /** when rule is 'allow-from' this is used to form the rest of the header, otherwise this field is ignored.If rule is 'allow-from' but source is unset, the rule will be automatically changed to 'sameorigin'. */ - source: string; - }; - /** boolean that controls the 'X-XSS-PROTECTION' header for IE.Defaults to true which sets the header to equal '1; mode=block'.NOTE: This setting can create a security vulnerability in versions of IE below 8, as well as unpatched versions of IE8.See here and here for more information.If you actively support old versions of IE, it may be wise to explicitly set this flag to false. */ - xss?: boolean; - /** boolean controlling the 'X-Download-Options' header for IE, preventing downloads from executing in your context.Defaults to true setting the header to 'noopen'. */ - noOpen?: boolean; - /** boolean controlling the 'X-Content-Type-Options' header.Defaults to true setting the header to its only and default option, 'nosniff'. */ - noSniff?: boolean; - }; - /** HTTP state management (cookies) allows the server to store information on the client which is sent back to the server with every request (as defined in RFC 6265).state supports the following options: */ - state?: { - /** determines if incoming 'Cookie' headers are parsed and stored in the request.state object.Defaults to true. */ - parse: boolean; - /** determines how to handle cookie parsing errors.Allowed values are: - 'error'return a Bad Request (400) error response.This is the default value. - 'log'report the error but continue processing the request. - 'ignore'take no action. */ - failAction: string; - }; - /** request input validation rules for various request components.When using a Joi validation object, the values of the other inputs (i.e.headers, query, params, payload, and auth) are made available under the validation context (accessible in rules as Joi.ref('$query.key')).Note that validation is performed in order(i.e.headers, params, query, payload) and if type casting is used (converting a string to number), the value of inputs not yet validated will reflect the raw, unvalidated and unmodified values.The validate object supports: */ - validate?: { - /** validation rules for incoming request headers.Values allowed: - * trueany headers allowed (no validation performed).This is the default. - falseno headers allowed (this will cause all valid HTTP requests to fail). - a Joi validation object. - a validation function using the signature function(value, options, next) where: - valuethe object containing the request headers. - optionsthe server validation options. - next(err, value)the callback function called when validation is completed. - */ - headers?: boolean | IJoi | IValidationFunction; - - /** validation rules for incoming request path parameters, after matching the path against the route and extracting any parameters then stored in request.params.Values allowed: - trueany path parameters allowed (no validation performed).This is the default. - falseno path variables allowed. - a Joi validation object. - a validation function using the signature function(value, options, next) where: - valuethe object containing the path parameters. - optionsthe server validation options. - next(err, value)the callback function called when validation is completed. */ - params?: boolean | IJoi | IValidationFunction; - /** validation rules for an incoming request URI query component (the key- value part of the URI between '?' and '#').The query is parsed into its individual key- value pairs (using the qs module) and stored in request.query prior to validation.Values allowed: - trueany query parameters allowed (no validation performed).This is the default. - falseno query parameters allowed. - a Joi validation object. - a validation function using the signature function(value, options, next) where: - valuethe object containing the query parameters. - optionsthe server validation options. - next(err, value)the callback function called when validation is completed. */ - query?: boolean | IJoi | IValidationFunction; - /** validation rules for an incoming request payload (request body).Values allowed: - trueany payload allowed (no validation performed).This is the default. - falseno payload allowed. - a Joi validation object. - a validation function using the signature function(value, options, next) where: - valuethe object containing the payload object. - optionsthe server validation options. - next(err, value)the callback function called when validation is completed. */ - payload?: boolean | IJoi | IValidationFunction; - /** an optional object with error fields copied into every validation error response. */ - errorFields?: any; - /** determines how to handle invalid requests.Allowed values are: - 'error'return a Bad Request (400) error response.This is the default value. - 'log'log the error but continue processing the request. - 'ignore'take no action. - OR a custom error handler function with the signature 'function(request, reply, source, error)` where: - requestthe request object. - replythe continuation reply interface. - sourcethe source of the invalid field (e.g. 'path', 'query', 'payload'). - errorthe error object prepared for the client response (including the validation function error under error.data). */ - failAction?: string | IRouteFailFunction; - /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ - options?: any; - }; - /** define timeouts for processing durations: */ - timeout?: { - /** response timeout in milliseconds.Sets the maximum time allowed for the server to respond to an incoming client request before giving up and responding with a Service Unavailable (503) error response.Disabled by default (false). */ - server: boolean | number; - /** by default, node sockets automatically timeout after 2 minutes.Use this option to override this behavior.Defaults to undefined which leaves the node default unchanged.Set to false to disable socket timeouts. */ - socket: boolean | number; - }; - - /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). - *route description used for generating documentation (string). - */ - description?: string; - /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). - *route notes used for generating documentation (string or array of strings). - */ - notes?: string | string[]; - /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). - *route tags used for generating documentation (array of strings). - */ - tags?: string[]; - - /** Enable logging of routes - */ - log?: boolean; +export interface Dictionary { + [key: string]: T; } /** - * specifying the route access rules. Each rule is evaluated against an incoming request and access is granted if at least one rule matches + * Server + * The Server object is the main application container. The server manages all incoming connections along with all the facilities provided by the framework. A server can contain more than one connection (e.g. listen to port 80 and 8080). + * [See docs](https://hapijs.com/api/16.1.1#server) + * [See docs](https://hapijs.com/api/16.1.1#server-properties) + * [See docs](https://hapijs.com/api/16.1.1#server-events) */ -export interface IRouteAdditionalConfigurationAuthAccess { - /** - * the application scope required to access the route. Value can be a scope string or an array of scope strings. - * The authenticated credentials object scope property must contain at least one of the scopes defined to access the route. - * If a scope string begins with a + character, that scope is required. If a scope string begins with a ! character, - * that scope is forbidden. For example, the scope ['!a', '+b', 'c', 'd'] means the incoming request credentials' - * scope must not include 'a', must include 'b', and must include on of 'c' or 'd'. You may also access properties - * on the request object (query and params} to populate a dynamic scope by using {} characters around the property name, - * such as 'user-{params.id}'. Defaults to false (no scope requirements). - */ - scope?: string | string[] | boolean; - /** the required authenticated entity type. If set, must match the entity value of the authentication credentials. Available values: - * any - the authentication can be on behalf of a user or application. This is the default value. - * user - the authentication must be on behalf of a user which is identified by the presence of a user attribute in the credentials object returned by the authentication strategy. - * app - the authentication must be on behalf of an application which is identified by the lack of presence of a user attribute in the credentials object returned by the authentication strategy. - */ - entity?: string; +export class Server extends Podium { + /** + * Creates a new Server object + */ + constructor(options?: ServerOptions); + + /** + * Provides a safe place to store server-specific run-time application data without potential conflicts with the framework internals. The data can be accessed whenever the server is accessible. Initialized with an empty object. + * [See docs](https://hapijs.com/api/16.1.1#serverapp) + */ + app?: any; + /** + * An array containing the server's connections. When the server object is returned from server.select(), the connections array only includes the connections matching the selection criteria. + * [See docs](https://hapijs.com/api/16.1.1#serverconnections) + */ + connections: ServerConnection[]; + /** + * When the server contains exactly one connection, info is an object containing information about the sole connection + * When the server contains more than one connection, each server.connections array member provides its own connection.info. + * [See docs](https://hapijs.com/api/16.1.1#serverinfo) + */ + info: ServerConnectionInfo | null; + /** + * An object containing the process load metrics (when load.sampleInterval is enabled): + * [See docs](https://hapijs.com/api/16.1.1#serverload) + */ + load: { + /** event loop delay milliseconds. */ + eventLoopDelay: number; + /** V8 heap usage. */ + heapUsed: number; + /** RSS memory usage. */ + rss: number; + }; + /** + * When the server contains exactly one connection, listener is the node HTTP server object of the sole connection. + * When the server contains more than one connection, each server.connections array member provides its own connection.listener. + * [See docs](https://hapijs.com/api/16.1.1#serverlistener) + */ + listener: ServerListener | null; + /** + * An object providing access to the server methods cs://hapijs.com/api/16.1.1#servermethodname-method-options} where each server method name is an object property. + * [See docs](https://hapijs.com/api/16.1.1#servermethods) + */ + methods: Dictionary; + /** + * Provides access to the server MIME database used for setting content-type information. The object must not be modified directly but only through the mime server setting. + * [See docs](https://hapijs.com/api/16.1.1#servermime) + */ + readonly mime: {path(path: string): {type: string}}; + /** + * An object containing the values exposed by each plugin registered where each key is a plugin name and the values are the exposed properties by each plugin using server.expose(). Plugins may set the value of the server.plugins[name] object directly or via the server.expose() method. + * [See docs](https://hapijs.com/api/16.1.1#serverplugins) + */ + plugins: PluginsStates; + /** + * The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin). Realms are a limited version of a sandbox where plugins can maintain state used by the framework when adding routes, extensions, and other properties. + * [See docs](https://hapijs.com/api/16.1.1#serverrealm) + */ + readonly realm: ServerRealm; + /** + * When the server contains exactly one connection, registrations is an object where each key is a registered plugin name + * When the server contains more than one connection, each server.connections array member provides its own connection.registrations. + * TODO check and offer PR to update Hapi docs: Assuming readonly. + * [See docs](https://hapijs.com/api/16.1.1#serverregistrations) + */ + readonly registrations: ServerRegisteredPlugins; + /** + * The root server object containing all the connections and the root server methods (e.g. start(), stop(), connection()). + * TODO, check and offer PR to update Hapi docs: Marked as optional as presumably root server does not reference itself. + * [See docs](https://hapijs.com/api/16.1.1#serverroot) + */ + root?: Server; + /** + * The server configuration object after defaults applied. + * [See docs](https://hapijs.com/api/16.1.1#serversettings) + */ + settings: ServerOptions; + /** + * The hapi module version number. + * [See docs](https://hapijs.com/api/16.1.1#serverversion) + */ + version: string; + + /** + * [See docs](https://hapijs.com/api/16.1.1#serverauthapi) + * [See docs](https://hapijs.com/api/16.1.1#serverauthdefaultoptions) + * [See docs](https://hapijs.com/api/16.1.1#serverauthschemename-scheme) + * [See docs](https://hapijs.com/api/16.1.1#serverauthstrategyname-scheme-mode-options) + * [See docs](https://hapijs.com/api/16.1.1#serverauthteststrategy-request-next) + */ + auth: ServerAuth; + + /** + * Sets a global context used as the default bind object when adding a route or an extension + * When setting context inside a plugin, the context is applied only to methods set up by the plugin. Note that the context applies only to routes and extensions added after it has been set. Ignored if the method being bound is an arrow function. + * @param context the object used to bind this in handler and extension methods. + * [See docs](https://hapijs.com/api/16.1.1#serverbindcontext) + */ + bind(context: any): void; + /** + * [See docs](https://hapijs.com/api/16.1.1#servercacheoptions) + * [See docs](https://hapijs.com/api/16.1.1#servercacheprovisionoptions-callback) + */ + cache: ServerCacheMethod; + /** + * Adds an incoming server connection + * Returns a server object with the new connections selected. + * Must be called before any other server method that modifies connections is called for it to apply to the new connection (e.g. server.state()) + * Note that the options object is deeply cloned (with the exception of listener which is shallowly copied) and cannot contain any values that are unsafe to perform deep copy on. + * + * [See docs](https://hapijs.com/api/16.1.1#serverconnectionoptions) for various advantage topics covering usage and caveats around use of the function in plugin register(), connectionless plugins calling connection(), etc. + * @param connection a connection configuration object or array of objects + */ + connection(options?: ServerConnectionOptions[]): Server; + connection(options?: ServerConnectionOptions): Server; + // connection: (options: ServerConnectionOptions[] | ServerConnectionOptions) => Server; + /** + * Registers a custom content decoding compressor to extend the built-in support for 'gzip' and 'deflate' + * [See docs](https://hapijs.com/api/16.1.1#serverdecoderencoding-decoder) + * @param encoding the decoder name string. + * @param decoder a function using the signature function(options) where options are the encoding specific options configured in the route payload.compression configuration option, and the return value is an object compatible with the output of node's zlib.createGunzip(). + */ + decoder(encoding: string, decoder: ((options: CompressionDecoderSettings) => zlib.Gunzip)): void; + /** + * Extends various framework interfaces with custom methods + * Note that decorations apply to the entire server and all its connections regardless of current selection. + * [See docs](https://hapijs.com/api/16.1.1#serverdecoratetype-property-method-options) + * + * NOTE: it's not possible to type the result of this action. + * It's advised that in a custom definition file, you extend the ReplyNoContinue + * and ReplyWithContinue functions. See Inert `.file` for an example. + * Or if it is not part of a library / plugin then you use a namespace within + * your code to type the request, server and or reply. See + * [tests/server/decorate.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hapi/tests/server/decorate.ts) + * for examples. + * @param type the interface being decorated. Supported types: + * * 'request' - adds methods to the Request object. + * * 'reply' - adds methods to the reply interface. + * * 'server' - adds methods to the Server object. + * @param property the object decoration key name. + * @param method the extension function or other value. + * @param options if the type is 'request', supports the following optional settings: + * * apply - if true, the method function is invoked using the signature function(request) where request is the current request object and the returned value is assigned as the decoration. + */ + decorate(type: 'request' | 'reply' | 'server', property: string, method: Function): void; + decorate(type: 'request', property: string, method: Function, options?: {apply: false}): void; + decorate(type: 'request', property: string, method: (request: Request) => Function, options: {apply: true}): void; + /** + * The server.decorate('server', ...) method can modify this prototype/interface. + * Have disabled these typings as there is a better alternative, see example in: tests/server/decorate.ts + * [And discussion here](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/14517#issuecomment-298891630) + */ + // [index: string]: any; + /** + * Used within a plugin to declare a required dependency on other plugins + * The after method is identical to setting a server extension point on 'onPreStart'. Connectionless plugins (those with attributes.connections set to false) can only depend on other connectionless plugins (server initialization will fail even of the dependency is loaded but is not connectionless). + * Dependencies can also be set via the register attributes property (does not support setting after). + * [See docs](https://hapijs.com/api/16.1.1#serverdependencydependencies-after) + * @param dependencies a single string or array of plugin name strings which must be registered in order for this plugin to operate. Plugins listed must be registered before the server is initialized or started. Does not provide version dependency which should be implemented using npm peer dependencies. + * @param after an optional function called after all the specified dependencies have been registered and before the server starts. The function is only called if the server is initialized or started. If a circular dependency is detected, an exception is thrown (e.g. two plugins each has an after function to be called after the other). The function signature is function(server, next) + */ + dependency(dependencies: string | string[], after?: AfterDependencyLoadCallback): void; + /** + * Emits a custom application event update to all the subscribed listeners + * Note that events must be registered before they can be emitted or subscribed to by calling server.event(events). This is done to detect event name misspelling and invalid event activities. + * [See docs](https://hapijs.com/api/16.1.1#serveremitcriteria-data-callback) + * @param criteria the event update criteria which if an object can have the following optional keys (unless noted otherwise): + * * name - the event name string (required). + * * channel - the channel name string. + * * tags - a tag string or array of tag strings. + * @param data the value emitted to the subscribers. If data is a function, the function signature is function() and it called once to generate (return value) the actual data emitted to the listeners. If no listeners match the event, the data function is not invoked. + * @param callback an optional callback method invoked when all subscribers have been notified using the signature function(). The callback is called only after all the listeners have been notified, including any event updates emitted earlier (the order of event updates are guaranteed to be in the order they were emitted). + */ + emit(criteria: string | {name: string, channel?: string, tags?: string | string[]}, data: any, callback?: () => void): void; + /** + * Registers a custom content encoding compressor to extend the built-in support for 'gzip' and 'deflate' + * [See docs](https://hapijs.com/api/16.1.1#serverencoderencoding-encoder) + * @param encoding the encoder name string. + * @param encoder a function using the signature function(options) where options are the encoding specific options configured in the route compression configuration option, and the return value is an object compatible with the output of node's zlib.createGzip(). + */ + encoder(encoding: string, encoder: ((options: CompressionEncoderSettings) => zlib.Gzip)): void; + /** + * Register custom application events + * [See docs](https://hapijs.com/api/16.1.1#servereventevents) + * @param events see ApplicationEvent + */ + event(events: ApplicationEvent[]): void; + event(events: ApplicationEvent): void; + /** + * Used within a plugin to expose a property via server.plugins[name] + * [See docs](https://hapijs.com/api/16.1.1#serverexposekey-value) + * @param key the key assigned (server.plugins[name][key]). + * @param value the value assigned. + */ + expose(key: string, value: any): void; + /** + * Merges an object into to the existing content of server.plugins[name] + * Note that all properties of obj are deeply cloned into server.plugins[name], so you should avoid using this method for exposing large objects that may be expensive to clone or singleton objects such as database client objects. Instead favor the server.expose(key, value) form, which only copies a reference to value. + * [See docs](https://hapijs.com/api/16.1.1#serverexposeobj) + * @param obj the object merged into the exposed properties container. + */ + expose(obj: Object): void; + /** + * Registers an extension function in one of the available extension points + * [See docs](https://hapijs.com/api/16.1.1#serverextevents) + * @param events see @ServerExtConfigurationObject + */ + ext(events: ServerStartExtConfigurationObject): void; + ext(events: ServerStartExtConfigurationObject[]): void; + ext(events: ServerRequestExtConfigurationObjectWithRequest): void; + ext(events: ServerRequestExtConfigurationObjectWithRequest[]): void; + /** + * Registers a single extension event using the same properties as used in server.ext(events), but passed as arguments. + * [See docs](https://hapijs.com/api/16.1.1#serverextevent-method-options) + * @param event the extension point event name. + * @param method a function or an array of functions to be executed at a specified point during request processing. + * @param options + */ + ext(event: ServerStartExtPoints, method: ServerExtFunction[], options?: ServerExtOptions): void; + ext(event: ServerStartExtPoints, method: ServerExtFunction, options?: ServerExtOptions): void; + ext(event: ServerRequestExtPoints, method: ServerExtRequestHandler[], options?: ServerExtOptions): void; + ext(event: ServerRequestExtPoints, method: ServerExtRequestHandler, options?: ServerExtOptions): void; + /** + * Registers a new handler type to be used in routes + * The method function can have a defaults object or function property. If the property is set to an object, that object is used as the default route config for routes using this handler. If the property is set to a function, the function uses the signature function(method) and returns the route default configuration. + * [See docs](https://hapijs.com/api/16.1.1#serverhandlername-method) + * @param name string name for the handler being registered. Cannot override any previously registered type. + * @param method the function used to generate the route handler using the signature function(route, options) where: + * * route - the route public interface object. + * * options - the configuration object provided in the handler config. + */ + handler(name: string, method: MakeRouteHandler): void; + /** + * Initializes the server (starts the caches, finalizes plugin registration) but does not start listening on the connection ports + * Note that if the method fails and the callback includes an error, the server is considered to be in an undefined state and should be shut down. In most cases it would be impossible to fully recover as the various plugins, caches, and other event listeners will get confused by repeated attempts to start the server or make assumptions about the healthy state of the environment. It is recommended to assert that no error has been returned after calling initialize() to abort the process when the server fails to start properly. If you must try to resume after an error, call server.stop() first to reset the server state. + * [See docs](https://hapijs.com/api/16.1.1#serverinitializecallback) + * @param callback the callback method when server initialization is completed or failed with the signature function(err) + */ + initialize(callback: (err: Error) => void): void; + initialize(): Promise; + /** + * When the server contains exactly one connection, injects a request into the sole connection simulating an incoming HTTP request without making an actual socket connection. Injection is useful for testing purposes as well as for invoking routing logic internally without the overhead or limitations of the network stack. Utilizes the shot module for performing injections, with some additional options and response properties + * If no callback is provided, a Promise object is returned. + * When the server contains more than one connection, each server.connections array member provides its own connection.inject(). + * [See docs](https://hapijs.com/api/16.1.1#serverinjectoptions-callback) + * @param options can be assigned a string with the requested URI, or an object + * @param callback the callback function with signature function(res) + */ + inject(options: string | InjectedRequestOptions, callback: (res: InjectedResponseObject) => void): void; + inject(options: string | InjectedRequestOptions, ): Promise; + /** + * Logs server events that cannot be associated with a specific request. When called the server emits a 'log' event which can be used by other listeners or plugins to record the information or output to the console. + * [See docs](https://hapijs.com/api/16.1.1#serverlogtags-data-timestamp) + * @param tags a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events. Any logs generated by the server internally include the 'hapi' tag along with event-specific information. + * @param data an optional message string or object with the application data being logged. If data is a function, the function signature is function() and it called once to generate (return value) the actual data emitted to the listeners. If no listeners match the event, the data function is not invoked. + * @param timestamp an optional timestamp expressed in milliseconds. Defaults to Date.now() (now). + */ + log(tags: string | string[], data?: string | Object | Function, timestamp?: number): void; + /** + * When the server contains exactly one connection, looks up a route configuration. + * When the server contains more than one connection, each server.connections array member provides its own connection.lookup() method. + * [See docs](https://hapijs.com/api/16.1.1#serverlookupid) + * @param id the route identifier as set in the route options. + * @return the route public interface object if found, otherwise null. + */ + lookup(id: string): RoutePublicInterface | null; + /** + * When the server contains exactly one connection, looks up a route configuration + * When the server contains more than one connection, each server.connections array member provides its own connection.match() method. + * [See docs](https://hapijs.com/api/16.1.1#servermatchmethod-path-host) + * @param method the HTTP method (e.g. 'GET', 'POST'). TODO check if it allows HEAD + * @param path the requested path (must begin with '/'). + * @param host optional hostname (to match against routes with vhost). + * @return the route public interface object if found, otherwise null. + */ + match(method: HTTP_METHODS, path: string, host?: string): RoutePublicInterface | null; + /** + * Registers a server method. Server methods are functions registered with the server and used throughout the application as a common utility. Their advantage is in the ability to configure them to use the built-in cache and share across multiple request handlers without having to create a common module. + * [See docs](https://hapijs.com/api/16.1.1#servermethodname-method-options) + * @param name a unique method name used to invoke the method via server.methods[name]. Supports using nested names such as utils.users.get which will automatically create the missing path under server.methods and can be accessed for the previous example via server.methods.utils.users.get. When configured with caching enabled, server.methods[name].cache will be an object see ServerMethodNameCacheObject + * @param method the method function + * @param options optional configuration + */ + method(name: string, method: ServerMethod, options?: ServerMethodOptions): void; + /** + * Registers a server method function as described in server.method() using a configuration object + * [See docs](https://hapijs.com/api/16.1.1#servermethodmethods) + */ + method(methods: ServerMethodConfigurationObject[]): void; + method(methods: ServerMethodConfigurationObject): void; + /** + * Subscribe a handler to an event + * [See docs](https://hapijs.com/api/16.1.1#serveroncriteria-listener) + * @param criteria the subscription criteria which can be an event name string which can be any of the built-in server events or a custom application event registered with server.event(events). + * Or an see ServerEventCriteria. + * If 'start' - emitted when the server is started using server.start(). + * If 'stop' - emitted when the server is stopped using server.stop(). + * @param listener + */ + on(criteria: 'start' | 'stop' | string | ServerEventCriteria, listener: Function): void; + /** + * The 'log' event includes the event object and a tags object (where each tag is a key with the value true) + * [See docs](https://hapijs.com/api/16.1.1#server-events) + */ + on(criteria: 'log', listener: (event: ServerEventObject, tags: Podium.Tags) => void): void; + /** + * The 'request' and 'request-internal' events include the request object, the event object, and a tags object (where each tag is a key with the value true) + * [See docs](https://hapijs.com/api/16.1.1#server-events) + * TODO submit issue to TypeScript. Using 'request' | 'request-internal' removes the type + * interference when using code like: `server.on('request', (request, event, tags) => {...}` + * Same for 'response' | 'tail'. + */ + on(criteria: 'request', listener: (request: Request, event: ServerEventObject, tags: Podium.Tags) => void): void; + on(criteria: 'request-internal', listener: (request: Request, event: ServerEventObject, tags: Podium.Tags) => void): void; + /** + * The 'request-error' event includes the request object and the causing error err object + * [See docs](https://hapijs.com/api/16.1.1#server-events) + */ + on(criteria: 'request-error', listener: (request: Request, err: Error) => void): void; + /** + * The 'response' and 'tail' events include the request object + * [See docs](https://hapijs.com/api/16.1.1#server-events) + * See 'request' and 'request-internal' + */ + on(criteria: 'response', listener: (request: Request) => void): void; + on(criteria: 'tail', listener: (request: Request) => void): void; + /** + * The 'route' event includes the route public interface, the connection, and the server object used to add the route (e.g. the result of a plugin select operation) + * [See docs](https://hapijs.com/api/16.1.1#server-events) + */ + on(criteria: 'route', listener: (route: RoutePublicInterface, connection: ServerConnection, server: Server) => void): void; + /** + * Same as calling server.on() with the count option set to 1. + * TODO type this to copy the server.on specific types for 'route', 'tail', etc. + * [See docs](https://hapijs.com/api/16.1.1#serveroncecriteria-listener) + * @param criteria + * @param listener + */ + once(criteria: string | ServerEventCriteria, listener: Function): void; + /** + * Sets the path prefix used to locate static resources (files and view templates) when relative paths are used + * Note that setting a path within a plugin only applies to resources accessed by plugin methods. If no path is set, the connection files.relativeTo configuration is used. The path only applies to routes added after it has been set. + * [See docs](https://hapijs.com/api/16.1.1#serverpathrelativeto) + * @param relativeTo the path prefix added to any relative file path starting with '.'. + */ + path(relativeTo: string): void; + /** + * Registers a plugin + * If no callback is provided, a Promise object is returned. + * Note that plugin registration are recorded on each of the available connections. When plugins express a dependency on other plugins, both have to be loaded into the same connections for the dependency requirement to be fulfilled. It is recommended that plugin registration happen after all the server connections are created via server.connection(). + * [See docs](https://hapijs.com/api/16.1.1#serverregisterplugins-options-callback) + * @param plugins + * @param options + * @param callback with signature function(err) where err an error returned from the registration function. Note that exceptions thrown by the registration function are not handled by the framework. + * A note on typings. Common use case is: + * register(Plugin, (err) => {// do more stuff}) + * so these typings save passing empty `options` object or having to + * explicity type the Error in the Callback e.g.: + * register(Plugin, {}, (err) => {// do more stuff}) or + * register(Plugin, (err: Error) => {// do more stuff}) + */ + register(plugins: Array<(PluginFunction | PluginRegistrationObject)>, callback: (err: Error | null) => void): void; + register(plugins: Array<(PluginFunction | PluginRegistrationObject)>): Promise; + register(plugins: PluginFunction | PluginRegistrationObject, callback: (err: Error | null) => void): void; + register(plugins: PluginFunction | PluginRegistrationObject): Promise; + register(plugins: Array<(PluginFunction | PluginRegistrationObject)>, options: PluginRegistrationOptions, callback: (err: Error | null) => void): void; + register(plugins: Array<(PluginFunction | PluginRegistrationObject)>, options: PluginRegistrationOptions): Promise; + register(plugins: PluginFunction | PluginRegistrationObject, options: PluginRegistrationOptions, callback: (err: Error | null) => void): void; + register(plugins: PluginFunction | PluginRegistrationObject, options: PluginRegistrationOptions): Promise; + /** + * Adds a connection route + * [See docs](https://hapijs.com/api/16.1.1#serverrouteoptions) + * @param options a route configuration object [See docs](https://hapijs.com/api/16.1.1#route-configuration) or an array of configuration objects. + */ + route(options: RouteConfiguration[]): void; + route(options: RouteConfiguration): void; + /** + * Selects a subset of the server's connections + * Returns a server object with connections set to the requested subset. Selecting again on a selection operates as a logic AND statement between the individual selections. + * [See docs](https://hapijs.com/api/16.1.1#serverselectlabels) + * @param labels a single string or array of strings of labels used as a logical OR statement to select all the connections with matching labels in their configuration. + */ + select(labels: string | string[]): Server; + /** + * Starts the server connections by listening for incoming requests on the configured port of each listener (unless the connection was configured with autoListen set to false) + * If no callback is provided, a Promise object is returned. + * Note that if the method fails and the callback includes an error, the server is considered to be in an undefined state and should be shut down. In most cases it would be impossible to fully recover as the various plugins, caches, and other event listeners will get confused by repeated attempts to start the server or make assumptions about the healthy state of the environment. It is recommended to assert that no error has been returned after calling start() to abort the process when the server fails to start properly. If you must try to resume after a start error, call server.stop() first to reset the server state. + * If a started server is started again, the second call to start() will only start new connections added after the initial start() was called. No events will be emitted and no extension points invoked. + * [See docs](https://hapijs.com/api/16.1.1#serverstartcallback) + * @param callback the callback method when server startup is completed or failed with the signature function(err) where: + * * err - any startup error condition. + */ + start(callback: (err?: Error) => void): void; + start(): Promise; + /** + * HTTP state management [See docs](https://tools.ietf.org/html/rfc6265) uses client cookies to persist a state across multiple requests. Registers a cookie definitions + * [See docs](https://hapijs.com/api/16.1.1#serverstatename-options) + * @param name the cookie name string. + * @param options optional cookie settings + */ + state(name: string, options?: ServerStateCookieConfiguationObject): void; + /** + * Stops the server's connections by refusing to accept any new connections or requests (existing connections will continue until closed or timeout) + * If no callback is provided, a Promise object is returned. + * [See docs](https://hapijs.com/api/16.1.1#serverstopoptions-callback) + * @param options options object with: + * * timeout - overrides the timeout in millisecond before forcefully terminating a connection. Defaults to 5000 (5 seconds). + * @param callback optional callback method which is called once all the connections have ended and it is safe to exit the process with signature function(err) where: + * * err - any termination error condition. + */ + stop(options: {timeout: number} | null, callback: (err?: Error) => void): void; + stop(options?: {timeout: number}): Promise; + /** + * Returns a copy of the routing table + * Note that if the server has not been started and multiple connections use port 0, the table items will override each other and will produce an incomplete result. + * When calling connection.table() directly on each connection, the return value is the same as the array table item value of an individual connection + * [See docs](https://hapijs.com/api/16.1.1#servertablehost) + * @param host optional host to filter routes matching a specific virtual host. Defaults to all virtual hosts. + */ + table(host?: string): RoutingTableEntry[]; } -/** server.realm http://hapijs.com/api#serverrealm - The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), - the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin). - Realms are a limited version of a sandbox where plugins can maintain state used by the framework when adding routes, extensions, and other properties. - The server.realm object should be considered read-only and must not be changed directly except for the plugins property can be directly manipulated by the plugins (each setting its own under plugins[name]). - exports.register = function (server, options, next) { -console.log(server.realm.modifiers.route.prefix); -return next(); -}; +export interface PluginSpecificConfiguration {} + +/** + * Server Options + * Note that the options object is deeply cloned and cannot contain any values that are unsafe to perform deep copy on. + * [See docs](https://hapijs.com/api/16.1.1#new-serveroptions) */ -export interface IServerRealm { - /** when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method */ - modifiers: { - /** routes preferences: */ - route: { - /** - the route path prefix used by any calls to server.route() from the server. */ - prefix: string; - /** the route virtual host settings used by any calls to server.route() from the server. */ - vhost: string; - }; - }; - /** the active plugin name (empty string if at the server root). */ - plugin: string; - /** plugin-specific state to be shared only among activities sharing the same active state. plugins is an object where each key is a plugin name and the value is the plugin state. */ - plugins: IDictionary; - /** settings overrides */ - settings: { - files: { - relativeTo: any; - }; - bind: any; - }; -} -/** server.state(name, [options]) http://hapijs.com/api#serverstatename-options - HTTP state management uses client cookies to persist a state across multiple requests. Registers a cookie definitions where:*/ -export interface IServerState { - /** - the cookie name string. */name: string; - - /** - are the optional cookie settings: */options: { - /** - time - to - live in milliseconds.Defaults to null (session time- life - cookies are deleted when the browser is closed).*/ttl: number; - /** - sets the 'Secure' flag.Defaults to false.*/isSecure: boolean; - /** - sets the 'HttpOnly' flag.Defaults to false.*/isHttpOnly: boolean - /** - the path scope.Defaults to null (no path).*/path: any; - /** - the domain scope.Defaults to null (no domain). */domain: any; - /** if present and the cookie was not received from the client or explicitly set by the route handler, the cookie is automatically added to the response with the provided value. The value can be a function with signature function(request, next) where: - request - the request object. - next - the continuation function using the function(err, value) signature.*/ - autoValue(request: Request, next: (err: any, value: any) => void): void; - /** - encoding performs on the provided value before serialization. Options are: - 'none' - no encoding. When used, the cookie value must be a string. This is the default value. - 'base64' - string value is encoded using Base64. - 'base64json' - object value is JSON-stringified than encoded using Base64. - 'form' - object value is encoded using the x-www-form-urlencoded method. - 'iron' - Encrypts and sign the value using iron.*/ - encoding: string; - /** - an object used to calculate an HMAC for cookie integrity validation.This does not provide privacy, only a mean to verify that the cookie value was generated by the server.Redundant when 'iron' encoding is used.Options are:*/sign: { - /** - algorithm options.Defaults to require('iron').defaults.integrity.*/integrity: any; - /** - password used for HMAC key generation.*/password: string; - }; - /** - password used for 'iron' encoding.*/password: string; - /** - options for 'iron' encoding.Defaults to require('iron').defaults.*/iron: any; - /** - if false, errors are ignored and treated as missing cookies.*/ignoreErrors: boolean; - /** - if true, automatically instruct the client to remove invalid cookies.Defaults to false.*/clearInvalid: boolean; - /** - if false, allows any cookie value including values in violation of RFC 6265. Defaults to true.*/strictHeader: boolean; - /** - overrides the default proxy localStatePassThrough setting.*/passThrough: any; - }; +export interface ServerOptions { + /** app - application-specific configuration which can later be accessed via server.settings.app. Note the difference between server.settings.app which is used to store static configuration values and server.app which is meant for storing run-time state. Defaults to {}. */ + app?: any; + /** + * cache - sets up server-side caching. Every server includes a default cache for storing application state. By default, a simple memory-based cache is created which has limited capacity and capabilities. hapi uses catbox for its cache which includes support for common storage solutions (e.g. Redis, MongoDB, Memcached, Riak, among others). Caching is only utilized if methods and plugins explicitly store their state in the cache. The server cache configuration only defines the storage container itself. cache can be assigned: + * * a prototype function (usually obtained by calling require() on a catbox strategy such as require('catbox-redis')). A new catbox client will be created internally using this function. + * * a CatboxServerOptionsCacheConfiguration configuration object + * * an array of the above object for configuring multiple cache instances, each with a unique name. When an array of objects is provided, multiple cache connections are established and each array item (except one) must include a name. + */ + cache?: Catbox.EnginePrototype | CatboxServerOptionsCacheConfiguration | CatboxServerOptionsCacheConfiguration[]; + /** sets the default connections configuration which can be overridden by each connection */ + connections?: ConnectionConfigurationServerDefaults; + /** determines which logged events are sent to the console (this should only be used for development and does not affect which events are actually logged internally and recorded). Set to false to disable all console logging, or to an object with: */ + debug?: false | { + /** a string array of server log tags to be displayed via console.error() when the events are logged via server.log() as well as internally generated server logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error. */ + log?: string[] | false; + /** a string array of request log tags to be displayed via console.error() when the events are logged via request.log() as well as internally generated request logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error. */ + request?: string[] | false; + }; + /** process load monitoring */ + load?: { + /** the frequency of sampling in milliseconds. Defaults to 0 (no sampling). */ + sampleInterval?: number; + }; + /** options passed to the mimos module (https://github.com/hapijs/mimos) when generating the mime database used by the server and accessed via server.mime. */ + mime?: MimosOptions; + /** plugin-specific configuration which can later be accessed via server.settings.plugins. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between server.settings.plugins which is used to store static configuration values and server.plugins which is meant for storing run-time state. Defaults to {}. */ + plugins?: PluginSpecificConfiguration; + /** if false, will not use node domains to protect against exceptions thrown in handlers and other external code. Defaults to true. */ + useDomains?: boolean; } -export interface IFileHandlerConfig { - /** a path string or function as described above.*/ - path: string; - /** an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ - filename?: string; - /**- specifies whether to include the 'Content-Disposition' header with the response. Available values: - false - header is not included. This is the default value. - 'attachment' - 'inline'*/ - mode?: boolean | string; - /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false.*/ - lookupCompressed: boolean; +/** + * The server event object + * [See docs](https://hapijs.com/api/16.1.1#server-events) + */ +export interface ServerEventObject { + /** the event timestamp. */ + timestamp: number; + /** if the event relates to a request, the request id. */ + request: string; + /** if the event relates to a server, the server.info.uri. */ + server: string; + /** an array of tags (e.g. ['error', 'http']). */ + tags: string[]; + /** optional event-specific information. */ + data: any; + /** true if the event was generated internally by the framework. */ + internal: boolean; } -/**http://hapijs.com/api#route-handler - Built-in handlers - - The framework comes with a few built-in handler types available by setting the route handler config to an object containing one of these keys.*/ -export interface IRouteHandlerConfig { - /** generates a static file endpoint for serving a single file. file can be set to: - a relative or absolute file path string (relative paths are resolved based on the route files configuration). - a function with the signature function(request) which returns the relative or absolute file path. - an object with the following options */ - file?: string | IRequestHandler | IFileHandlerConfig; - /** directory - generates a directory endpoint for serving static content from a directory. Routes using the directory handler must include a path parameter at the end of the path string (e.g. /path/to/somewhere/{param} where the parameter name does not matter). The path parameter can use any of the parameter options (e.g. {param} for one level files only, {param?} for one level files or the directory root, {param*} for any level, or {param*3} for a specific level). If additional path parameters are present, they are ignored for the purpose of selecting the file system resource. The directory handler is an object with the following options: - path - (required) the directory root path (relative paths are resolved based on the route files configuration). Value can be: - a single path string used as the prefix for any resources requested by appending the request path parameter to the provided string. - an array of path strings. Each path will be attempted in order until a match is found (by following the same process as the single path string). - a function with the signature function(request) which returns the path string or an array of path strings. If the function returns an error, the error is passed back to the client in the response. - index - optional boolean|string|string[], determines if an index file will be served if found in the folder when requesting a directory. The given string or strings specify the name(s) of the index file to look for. If true, looks for 'index.html'. Any falsy value disables index file lookup. Defaults to true. - listing - optional boolean, determines if directory listing is generated when a directory is requested without an index document. Defaults to false. - showHidden - optional boolean, determines if hidden files will be shown and served. Defaults to false. - redirectToSlash - optional boolean, determines if requests for a directory without a trailing slash are redirected to the same path with the missing slash. Useful for ensuring relative links inside the response are resolved correctly. Disabled when the server config router.stripTrailingSlash is true.Defaults to false. - lookupCompressed - optional boolean, instructs the file processor to look for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. - defaultExtension - optional string, appended to file requests if the requested file is not found. Defaults to no extension.*/ - directory?: { - path: string | string[] | IRequestHandler | IRequestHandler; - index?: boolean | string | string[]; - listing?: boolean; - showHidden?: boolean; - redirectToSlash?: boolean; - lookupCompressed?: boolean; - defaultExtension?: string; - }; - proxy?: IProxyHandlerConfig; - view?: string | { - template: string; - context: { - payload: any; - params: any; - query: any; - pre: any; - } - }; - config?: { - handler: any; - bind: any; - app: any; - plugins: { - [name: string]: any; - }; - pre: Array<() => void>; - validate: { - headers: any; - params: any; - query: any; - payload: any; - errorFields?: any; - failAction?: string | IFailAction; - }; - payload: { - output: { - data: any; - stream: any; - file: any; - }; - parse?: any; - allow?: string | string[]; - override?: string; - maxBytes?: number; - uploads?: number; - failAction?: string; - }; - response: { - schema: any; - sample: number; - failAction: string; - }; - cache: { - privacy: string; - expiresIn: number; - expiresAt: number; - }; - auth: string | boolean | { - mode: string; - strategies: string[]; - payload?: boolean | string; - tos?: boolean | string; - scope?: string | string[]; - entity: string; - }; - cors?: boolean; - jsonp?: string; - description?: string; - notes?: string | string[]; - tags?: string[]; - }; -} -/** Route configuration - The route configuration object*/ -export interface IRouteConfiguration { - /** - (required) the absolute path used to match incoming requests (must begin with '/'). Incoming requests are compared to the configured paths based on the connection router configuration option.The path can include named parameters enclosed in {} which will be matched against literal values in the request as described in Path parameters.*/ - path: string; - /** - (required) the HTTP method.Typically one of 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', or 'OPTIONS'.Any HTTP method is allowed, except for 'HEAD'.Use '*' to match against any HTTP method (only when an exact match was not found, and any match with a specific method will be given a higher priority over a wildcard match). - * Can be assigned an array of methods which has the same result as adding the same route with different methods manually.*/ - method: string | string[]; - /** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/ - vhost?: string; - /** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/ - handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig; - /** - additional route options.*/ - config?: IRouteAdditionalConfigurationOptions; -} -/** Route public interface When route information is returned or made available as a property. http://hapijs.com/api#route-public-interface */ -export interface IRoute { - /** the route HTTP method. */ - method: string; - /** the route path. */ - path: string; - /** the route vhost option if configured. */ - vhost?: string | string[]; - /** the [active realm] associated with the route.*/ - realm: IServerRealm; - /** the [route options] object with all defaults applied. */ - settings: IRouteAdditionalConfigurationOptions; +/** + * [See docs](https://hapijs.com/api/16.1.1#serveroncriteria-listener) + */ +export interface ServerEventCriteria { + /** the event name string (required). */ + name: string; + /** if true, the listener method receives an additional callback argument which must be called when the method completes. No other event will be emitted until the callback methods is called. The method signature is function(). If block is set to a positive integer, the value is used to set a timeout after which any pending events will be emitted, ignoring the eventual call to callback. Defaults to false (non blocking). */ + block?: boolean; + /** a string or array of strings specifying the event channels to subscribe to. If the event registration specified a list of allowed channels, the channels array must match the allowed channels. If channels are specified, event updates without any channel designation will not be included in the subscription. Defaults to no channels filter. */ + channels?: string | string[]; + /** if true, the data object passed to server.emit() is cloned before it is passed to the listener method. Defaults to the event registration option (which defaults to false). */ + clone?: boolean; + /** a positive integer indicating the number of times the listener can be called after which the subscription is automatically removed. A count of 1 is the same as calling server.once(). Defaults to no limit. */ + count?: number; + /** + * the event tags (if present) to subscribe to + * If the object is given: + * * tags - a tag string or array of tag strings. + * * all - if true, all tags must be present for the event update to match the subscription. Defaults to false (at least one matching tag). + */ + filter?: string | string[] | {tags: string | string[], all?: boolean}; + /** if true, and the data object passed to server.emit() is an array, the listener method is called with each array element passed as a separate argument. This should only be used when the emitted data structure is known and predictable. Defaults to the event registration option (which defaults to false). */ + spread?: boolean; + /** if true and the criteria object passed to server.emit() includes tags, the tags are mapped to an object (where each tag string is the key and the value is true) which is appended to the arguments list at the end (but before the callback argument if block is set). Defaults to the event registration option (which defaults to false). */ + tags?: boolean; } -export interface IServerAuthScheme { - /** authenticate(request, reply) - required function called on each incoming request configured with the authentication scheme where: - request - the request object. - reply - the reply interface the authentication method must call when done authenticating the request where: - reply(err, response, result) - is called if authentication failed where: - err - any authentication error. - response - any authentication response action such as redirection. Ignored if err is present, otherwise required. - result - an object containing: - credentials - the authenticated credentials. - artifacts - optional authentication artifacts. - reply.continue(result) - is called if authentication succeeded where: - result - same object as result above. - When the scheme authenticate() method implementation calls reply() with an error condition, the specifics of the error affect whether additional authentication strategies will be attempted if configured for the route. - .If the err returned by the reply() method includes a message, no additional strategies will be attempted. - If the err does not include a message but does include a scheme name (e.g. Boom.unauthorized(null, 'Custom')), additional strategies will be attempted in order of preference. - var server = new Hapi.Server(); - server.connection({ port: 80 }); - var scheme = function (server, options) { - return { - authenticate: function (request, reply) { - var req = request.raw.req; - var authorization = req.headers.authorization; - if (!authorization) { - return reply(Boom.unauthorized(null, 'Custom')); - } - return reply(null, { credentials: { user: 'john' } }); - } - }; - }; - server.auth.scheme('custom', scheme);*/ - authenticate(request: Request, reply: IReply): void; - authenticate(request: Request, reply: IStrictReply): void; - /** payload(request, reply) - optional function called to authenticate the request payload where: - request - the request object. - reply(err, response) - is called if authentication failed where: - err - any authentication error. - response - any authentication response action such as redirection. Ignored if err is present, otherwise required. - reply.continue() - is called if payload authentication succeeded. - When the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'.*/ - payload?(request: Request, reply: IReply): void; - payload?(request: Request, reply: IStrictReply): void; - /** response(request, reply) - optional function called to decorate the response with authentication headers before the response headers or payload is written where: - request - the request object. - reply(err, response) - is called if an error occurred where: - err - any authentication error. - response - any authentication response to send instead of the current response. Ignored if err is present, otherwise required. - reply.continue() - is called if the operation succeeded.*/ - response?(request: Request, reply: IReply): void; - response?(request: Request, reply: IStrictReply): void; - /** an optional object */ - options?: { - /** if true, requires payload validation as part of the scheme and forbids routes from disabling payload auth validation. Defaults to false.*/ - payload: boolean; - }; +/** + * Server methods, user configured + * Related to [See docs](https://hapijs.com/api/16.1.1#servermethods) + * Related to [See docs](https://hapijs.com/api/16.1.1#servermethodname-method-options) + */ +export interface ServerMethod { + /** Not possible to improve this typing due to this unresolvable issue: https://github.com/Microsoft/TypeScript/issues/15190 */ + (...args: (any | ServerMethodNext)[]): void; + /** the method must return a value (result, Error, or a promise) or throw an Error. */ + (...args: any[]): any | Error | Promise; + /** When configured with caching enabled, server.methods[name].cache will be an object see ServerMethodNameCacheObject */ + cache?: ServerMethodNameCacheObject; } -/**the response object where: - statusCode - the HTTP status code. - headers - an object containing the headers set. - payload - the response payload string. - rawPayload - the raw response payload buffer. - raw - an object with the injection request and response objects: - req - the simulated node request object. - res - the simulated node response object. - result - the raw handler response (e.g. when not a stream or a view) before it is serialized for transmission. If not available, the value is set to payload. Useful for inspection and reuse of the internal objects returned (instead of parsing the response string). - request - the request object.*/ -export interface IServerInjectResponse { - statusCode: number; - headers: IDictionary; - payload: string; - rawPayload: Buffer; - raw: { - req: http.IncomingMessage; - res: http.ServerResponse - }; - result: any; - request: Request; +/** + * Related to [See docs](https://hapijs.com/api/16.1.1#servermethodname-method-options) + * @param err error response if the method failed. + * @param result the return value. + * @param ttl 0 if result is valid but cannot be cached. Defaults to cache policy. + */ +export interface ServerMethodNext { + (err: Error | null, result: any, ttl?: number): void; } -export interface IServerInject { - (options: string | IServerInjectOptions, callback: (res: IServerInjectResponse) => void): void; - (options: string | IServerInjectOptions): Promise; +/** For context [See docs](https://hapijs.com/api/16.1.1#servermethodname-method-options) */ +export interface ServerMethodNameCacheObject { + /** + * function that can be used to clear the cache for a given key. + * @param ...args any number of string, number or boolean. If other types then generateKey function must be specified. + * @param callback last argument is a callback. + * Not possible to improve this typing due to this unresolvable issue: https://github.com/Microsoft/TypeScript/issues/15190 + */ + drop(...args: (any | Function)[]): void; + /** an object with cache statistics, see stats documentation for catbox. */ + stats: Catbox.CacheStatisticsObject; } -export interface IServerInjectOptions { - /** the request HTTP method (e.g. 'POST'). Defaults to 'GET'.*/ - method: string; - /** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/ - url: string; - /** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/ - headers?: IDictionary; - /** n optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/ - payload?: string | {} | Buffer; - /** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/ - credentials?: any; - /** an optional artifacts object containing authentication artifact information. The artifacts are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Ignored if set without credentials. Defaults to no artifacts.*/ - artifacts?: any; - /** sets the initial value of request.app*/ - app?: any; - /** sets the initial value of request.plugins*/ - plugins?: any; - /** allows access to routes with config.isInternal set to true. Defaults to false.*/ - allowInternals?: boolean; - /** sets the remote address for the incoming connection.*/ - remoteAddress?: boolean; - /**object with options used to simulate client request stream conditions for testing: - error - if true, emits an 'error' event after payload transmission (if any). Defaults to false. - close - if true, emits a 'close' event after payload transmission (if any). Defaults to false. - end - if false, does not end the stream. Defaults to true.*/ - simulate?: { - error: boolean; - close: boolean; - end: boolean; - }; +/** For context [See docs](https://hapijs.com/api/16.1.1#servermethodname-method-options) */ +export interface ServerMethodOptions { + /** a context object passed back to the method function (via this) when called. Defaults to active context (set via server.bind() when the method is registered. Ignored if the method is an arrow function. */ + bind?: any; + /** the same cache configuration used in server.cache(). The generateTimeout option is required. */ + cache?: CatboxServerCacheConfiguration; + /** + * if false, expects the method to be a synchronous function. Note that using a synchronous function with caching will convert the method interface to require a callback as an additional argument with the signature function(err, result, cached, report) since the cache interface cannot return values synchronously. Defaults to true. + * TODO: understand and type "an additional argument with the signature function(err, result, cached, report)" if appropriate. + */ + callback?: boolean; + /** a function used to generate a unique key (for caching) from the arguments passed to the method function (the callback argument is not passed as input). The server will automatically generate a unique key if the function's arguments are all of types 'string', 'number', or 'boolean'. However if the method uses other types of arguments, a key generation function must be provided which takes the same arguments as the function and returns a unique string (or null if no key can be generated). */ + generateKey?(args: any[]): string | null; } -/** host - optional host to filter routes matching a specific virtual host. Defaults to all virtual hosts. - The return value is an array where each item is an object containing: - info - the connection.info the connection the table was generated for. - labels - the connection labels. - table - an array of routes where each route contains: - settings - the route config with defaults applied. - method - the HTTP method in lower case. - path - the route path.*/ -export interface IConnectionTable { - info: any; - labels: any; - table: IRoute[]; +/** For context [See docs](https://hapijs.com/api/16.1.1#servermethodmethods) */ +export interface ServerMethodConfigurationObject { + name: string; + method: ServerMethod; + options: ServerMethodOptions; } -export interface ICookieSettings { - /** - time - to - live in milliseconds.Defaults to null (session time- life - cookies are deleted when the browser is closed).*/ - ttl?: number; - /** - sets the 'Secure' flag.Defaults to false.*/ - isSecure?: boolean; - /** - sets the 'HttpOnly' flag.Defaults to false.*/ - isHttpOnly?: boolean; - /** - the path scope.Defaults to null (no path).*/ - path?: string; - /** - the domain scope.Defaults to null (no domain).*/ - domain?: any; - /** - if present and the cookie was not received from the client or explicitly set by the route handler, the cookie is automatically added to the response with the provided value.The value can be a function with signature function(request, next) where: - request - the request object. - next - the continuation function using the function(err, value) signature.*/ - autoValue?(request: Request, next: (err: any, value: any) => void): void; - /** - encoding performs on the provided value before serialization.Options are: - 'none' - no encoding.When used, the cookie value must be a string.This is the default value. - 'base64' - string value is encoded using Base64. - 'base64json' - object value is JSON- stringified than encoded using Base64. - 'form' - object value is encoded using the x- www - form - urlencoded method. */ - encoding?: string; - /** - an object used to calculate an HMAC for cookie integrity validation.This does not provide privacy, only a mean to verify that the cookie value was generated by the server.Redundant when 'iron' encoding is used.Options are: - integrity - algorithm options.Defaults to require('iron').defaults.integrity. - password - password used for HMAC key generation. */ - sign?: { integrity: any; password: string; }; - password?: string; - iron?: any; - ignoreErrors?: boolean; - clearInvalid?: boolean; - strictHeader?: boolean; - passThrough?: any; +/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Caching with Catbox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */ +// TODO: move to separate file http://stackoverflow.com/questions/43276921 + +/** + * TODO confirm this is the same as CatboxServerCacheConfiguration + * + * ** + * Server instantiation options configuration for Catbox cache + * TODO: check it extends Catbox.PolicyOptions and this is what "other options passed to the catbox strategy used." means. + * For context [See docs](https://hapijs.com/api/16.1.1#new-serveroptions) under: options > cache > a configuration object + * ** + * export interface CatboxServerOptionsCacheConfiguration extends Catbox.IPolicyOptions { + * // a prototype function or catbox engine object. + * engine: Catbox.EnginePrototypeOrObject; + * // an identifier used later when provisioning or configuring caching for server methods or plugins. Each cache name must be unique. A single item may omit the name option which defines the default cache. If every cache includes a name, a default memory cache is provisioned as well. + * name?: string; + * // if true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. + * shared?: boolean; + * } + */ +export type CatboxServerOptionsCacheConfiguration = CatboxServerCacheConfiguration; + +/** + * Server cache method configuration for Catbox cache + * Used for "Provisions a cache segment within the server cache facility" + * For context [See docs](https://hapijs.com/api/16.1.1#servercacheoptions) + * Also used in [See docs](https://hapijs.com/api/16.1.1#servermethodname-method-options) > options.cache + */ +export interface CatboxServerCacheConfiguration extends Catbox.PolicyOptions { + /** the cache name configured in server.cache. Defaults to the default cache. */ + cache?: string; + /** string segment name, used to isolate cached items within the cache partition. When called within a plugin, defaults to '!name' where 'name' is the plugin name. When called within a server method, defaults to '#name' where 'name' is the server method name. Required when called outside of a plugin. */ + segment?: string; + /** if true, allows multiple cache provisions to share the same segment. Default to false. */ + shared?: boolean; + /** + * a prototype function or catbox engine object. + * [See docs](https://hapijs.com/api/16.1.1#servercacheprovisionoptions-callback) example code includes use of `engine` option. But server.cache.provision of `options` says "same as the server cache configuration options.". + * TODO confirm once PR to hapi docs accepted / rejected. + */ + engine?: Catbox.EnginePrototypeOrObject; + /** + * an identifier used later when provisioning or configuring caching for server methods or plugins. Each cache name must be unique. A single item may omit the name option which defines the default cache. If every cache includes a name, a default memory cache is provisioned as well. + * [See docs](https://hapijs.com/api/16.1.1#servercacheprovisionoptions-callback) example code includes use of `name` option. But server.cache.provision of `options` says "same as the server cache configuration options.". + */ + name?: string; } -/** method - the method function with the signature is one of: - function(arg1, arg2, ..., argn, next) where: - arg1, arg2, etc. - the method function arguments. - next - the function called when the method is done with the signature function(err, result, ttl) where: - err - error response if the method failed. - result - the return value. - ttl - 0 if result is valid but cannot be cached. Defaults to cache policy. - function(arg1, arg2, ..., argn) where: - arg1, arg2, etc. - the method function arguments. - the callback option is set to false. - the method must returns a value (result, Error, or a promise) or throw an Error.*/ -export interface IServerMethod { - // (): void; - // (next: (err: any, result: any, ttl: number) => void): void; - // (arg1: any): void; - // (arg1: any, arg2: any, next: (err: any, result: any, ttl: number) => void): void; - // (arg1: any, arg2: any): void; - (...args: any[]): void; +/** + * Additional notes + * payload - In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided. + * [See docs](https://hapijs.com/api/16.1.1#serverinjectoptions-callback) + */ +export interface InjectedRequestOptions extends Shot.RequestOptions { + /** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials. */ + credentials?: any; + /** an optional artifacts object containing authentication artifact information. The artifacts are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Ignored if set without credentials. Defaults to no artifacts. */ + artifacts?: any; + /** sets the initial value of request.app. */ + app?: any; + /** sets the initial value of request.plugins. */ + plugins?: PluginsStates; + /** allows access to routes with config.isInternal set to true. Defaults to false. */ + allowInternals?: boolean; } -/** options - optional configuration: - bind - a context object passed back to the method function (via this) when called. Defaults to active context (set via server.bind() when the method is registered. - cache - the same cache configuration used in server.cache(). - callback - if false, expects the method to be a synchronous function. Note that using a synchronous function with caching will convert the method interface to require a callback as an additional argument with the signature function(err, result, cached, report) since the cache interface cannot return values synchronously. Defaults to true. - generateKey - a function used to generate a unique key (for caching) from the arguments passed to the method function (the callback argument is not passed as input). The server will automatically generate a unique key if the function's arguments are all of types 'string', 'number', or 'boolean'. However if the method uses other types of arguments, a key generation function must be provided which takes the same arguments as the function and returns a unique string (or null if no key can be generated).*/ -export interface IServerMethodOptions { - bind?: any; - cache?: ICatBoxCachePolicyOptions; - callback?: boolean; - generateKey?(args: any[]): string; + +/** + * the response object from server.inject + * [See docs](https://hapijs.com/api/16.1.1#serverinjectoptions-callback) + */ +export interface InjectedResponseObject extends Shot.ResponseObject { + /** the raw handler response (e.g. when not a stream or a view) before it is serialized for transmission. If not available, the value is set to payload. Useful for inspection and reuse of the internal objects returned (instead of parsing the response string). */ + result: Object | string; + /** the request object. */ + request: InjectedRequestOptions; } -/** Request object - The request object is created internally for each incoming request. It is different from the node.js request object received from the HTTP server callback (which is available in request.raw.req). The request object methods and properties change throughout the request lifecycle. - Request events +/** + * For context [See docs](https://hapijs.com/api/16.1.1#new-serveroptions) under: options > connections + */ +export interface ConnectionConfigurationServerDefaults { + /** application-specific connection configuration which can be accessed via connection.settings.app. Provides a safe place to store application configuration without potential conflicts with the framework internals. Should not be used to configure plugins which should use plugins[name]. Note the difference between connection.settings.app which is used to store configuration values and connection.app which is meant for storing run-time state. */ + app?: any; + /** if false, response content encoding is disabled. Defaults to true */ + compression?: boolean; + /** connection load limits configuration where: */ + load?: { + /** maximum V8 heap size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxHeapUsedBytes: number; + /** maximum process RSS size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxRssBytes: number; + /** maximum event loop delay duration in milliseconds over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxEventLoopDelay: number; + }; + /** plugin-specific configuration which can later be accessed via connection.settings.plugins. Provides a place to store and pass connection-specific plugin configuration. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between connection.settings.plugins which is used to store configuration values and connection.plugins which is meant for storing run-time state. */ + plugins?: PluginSpecificConfiguration; + /** controls how incoming request URIs are matched against the routing table: */ + router?: { + /** determines whether the paths '/example' and '/EXAMPLE' are considered different resources. Defaults to true. */ + isCaseSensitive?: boolean; + /** removes trailing slashes on incoming paths. Defaults to false. */ + stripTrailingSlash?: boolean; + }; + /** a route options object used to set the default configuration for every route. */ + routes?: RouteAdditionalConfigurationOptions; + /** sets the default configuration for every state (cookie) set explicitly via server.state() or implicitly (without definition) using the [state configuration object](https://hapijs.com/api/16.1.1#serverstatename-options). */ + state?: ServerStateCookieConfiguationObject; +} - The request object supports the following events: +/** + * a connection configuration object or array of objects with the following optional keys. + * Any connections configuration server defaults can be included to override and customize the individual connection. + * [See docs](https://hapijs.com/api/16.1.1#serverconnectionoptions) + */ +export interface ServerConnectionOptions extends ConnectionConfigurationServerDefaults { + /** host - the public hostname or IP address. Used only to set server.info.host and server.info.uri. If not configured, defaults to the operating system hostname and if not available, to 'localhost'. */ + host?: string; + /** address - sets the host name or IP address the connection will listen on. If not configured, defaults to host if present, otherwise to all available network interfaces (i.e. '0.0.0.0'). Set to 127.0.0.1 or localhost to restrict connection to only those coming from the same machine. */ + address?: string; + /** port - the TCP port the connection will listen to. Defaults to an ephemeral port (0) which uses an available port when the server is started (and assigned to server.info.port). If port is a string containing a '/' character, it is used as a UNIX domain socket path and if it starts with '\.\pipe' as a Windows named pipe. */ + port?: string | number; + /** uri - the full public URI without the path (e.g. 'http://example.com:8080'). If present, used as the connection info.uri otherwise constructed from the connection settings. */ + uri?: string; + /** listener - optional node.js HTTP (or HTTPS) http.Server object or any compatible object. If the listener needs to be manually started, set autoListen to false. If the listener uses TLS, set tls to true. */ + listener?: http.Server; + /** autoListen - indicates that the connection.listener will be started manually outside the framework. Cannot be specified with a port setting. Defaults to true. */ + autoListen?: boolean; + /** labels - a string or string array of labels used to server.select() specific connections matching the specified labels. Defaults to an empty array [] (no labels). */ + labels?: string | string[]; + /** tls - used to create an HTTPS connection. The tls object is passed unchanged as options to the node.js HTTPS server as described in the node.js HTTPS [documentation](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener}) . Set to true when passing a listener object that has been configured to use TLS directly. */ + tls?: true | https.RequestOptions; +} - 'peek' - emitted for each chunk of payload data read from the client connection. The event method signature is function(chunk, encoding). - 'finish' - emitted when the request payload finished reading. The event method signature is function (). - 'disconnect' - emitted when a request errors or aborts unexpectedly. - var Crypto = require('crypto'); - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); +/** + * For context see RouteAdditionalConfigurationOptions > compression + * For context [See docs](https://hapijs.com/api/16.1.1#serverencoderencoding-encoder) + */ +export type CompressionEncoderSettings = any; - server.ext('onRequest', function (request, reply) { +/** + * For context see RouteAdditionalConfigurationOptions > payload > compression + * For context [See docs](https://hapijs.com/api/16.1.1#serverdecoderencoding-decoder) + */ +export type CompressionDecoderSettings = any; -var hash = Crypto.createHash('sha1'); -request.on('peek', function (chunk) { +/** + * an optional function called after all the specified dependencies have been registered and before the server starts. The function is only called if the server is initialized or started. If a circular dependency is detected, an exception is thrown (e.g. two plugins each has an after function to be called after the other). The function signature is function(server, next) where: + * [See docs](https://hapijs.com/api/16.1.1#serverdependencydependencies-after) + * Also see Server.dependency + * @param server the server the dependency() method was called on. + * @param next the callback function the method must call to return control over to the application and complete the registration process. The function signature is function(err) where: + * * err - internal error condition, which is returned back via the server.initialize() or server.start() callback. + */ +export interface AfterDependencyLoadCallback { + (server: Server, next: (err?: Error) => void): void; +} -hash.update(chunk); +/** For context see RouteAdditionalConfigurationOptions > auth */ +export interface AuthOptions { + /** + * the authentication mode. Defaults to 'required' if a server authentication strategy is configured, otherwise defaults to no authentication. Available values: + * * 'required' - authentication is required. + * * 'optional' - authentication is optional (must be valid if present). + * * 'try' - same as 'optional' but allows for invalid authentication. + */ + mode?: 'required' | 'optional' | 'try'; + /** a string array of strategy names in order they should be attempted. If only one strategy is used, strategy can be used instead with the single string value. Defaults to the default authentication strategy which is available only when a single strategy is configured. */ + strategies?: string[]; + strategy?: string; + /** + * if set, the payload (in requests other than 'GET' and 'HEAD') is authenticated after it is processed. Requires a strategy with payload authentication support (e.g. Hawk). Cannot be set to a value other than 'required' when the scheme sets the options.payload to true. Available values: + * * false - no payload authentication. This is the default value. + * * 'required' - payload authentication required. This is the default value when the scheme sets options.payload to true. + * * 'optional' - payload authentication performed only when the client includes payload authentication information (e.g. hash attribute in Hawk). + */ + payload?: false | 'required' | 'optional'; + /** specifying the route access rules. */ + access?: RouteAuthAccessConfiguationObject | RouteAuthAccessConfiguationObject[]; + /** (undocumented) Convenience way of setting access.scope, will over write all values in `access` */ + scope?: false | string | string[]; + /** (undocumented) Convenience way of setting access.entity, will over write all values in `access` */ + entity?: 'any' | 'user' | 'app'; +} + +/** + * Each rule is evaluated against an incoming request and access is granted if at least one rule matches. Each rule object must include at least one of: + * For context see RouteAdditionalConfigurationOptions > auth > an object > access + */ +export interface RouteAuthAccessConfiguationObject { + /** the application scope required to access the route. Value can be a scope string or an array of scope strings. The authenticated credentials object scope property must contain at least one of the scopes defined to access the route. If a scope string begins with a + character, that scope is required. If a scope string begins with a ! character, that scope is forbidden. For example, the scope ['!a', '+b', 'c', 'd'] means the incoming request credentials' scope must not include 'a', must include 'b', and must include one of 'c' or 'd'. You may also access properties on the request object (query and params) to populate a dynamic scope by using {} characters around the property name, such as 'user-{params.id}'. Defaults to false (no scope requirements). */ + scope?: false | string | string[]; + /** + * the required authenticated entity type. If set, must match the entity value of the authentication credentials. Available values: + * * any - the authentication can be on behalf of a user or application. This is the default value. + * * user - the authentication must be on behalf of a user which is identified by the presence of a user attribute in the credentials object returned by the authentication strategy. + * * app - the authentication must be on behalf of an application which is identified by the lack of presence of a user attribute in the credentials object returned by the authentication strategy. + */ + entity?: 'any' | 'user' | 'app'; +} + +/** + * For context see RouteAdditionalConfigurationOptions > cache + */ +export type RouteCacheOptions = { + /** + * determines the privacy flag included in client-side caching using the 'Cache-Control' header. Values are: + * * 'default' - no privacy flag. This is the default setting. + * * 'public' - mark the response as suitable for public caching. + * * 'private' - mark the response as suitable only for private caching. + */ + privacy?: 'default' | 'public' | 'private'; + /** an array of HTTP response status codes (e.g. 200) which are allowed to include a valid caching directive. Defaults to [200]. */ + statuses?: number[]; + /** a string with the value of the 'Cache-Control' header when caching is disabled. Defaults to 'no-cache'. */ + otherwise?: string; +} & ({ + /** relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. */ + expiresIn?: number; + /** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire. Cannot be used together with expiresIn. */ + expiresAt?: undefined; +} | { + /** relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. */ + expiresIn?: undefined; + /** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire. Cannot be used together with expiresIn. */ + expiresAt?: string; +} | { + /** relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. */ + expiresIn?: undefined; + /** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire. Cannot be used together with expiresIn. */ + expiresAt?: undefined; }); -request.once('finish', function () { - -console.log(hash.digest('hex')); -}); - -request.once('disconnect', function () { - -console.error('request aborted'); -}); - -return reply.continue(); -});*/ -export class Request extends Events.EventEmitter { - /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ - app: any; - /** authentication information*/ - auth: { - /** true is the request has been successfully authenticated, otherwise false.*/ - isAuthenticated: boolean; - /** the credential object received during the authentication process. The presence of an object does not mean successful authentication. can be set in the validate function's callback.*/ - credentials: any; - /** an artifact object received from the authentication strategy and used in authentication-related actions.*/ - artifacts: any; - /** the route authentication mode.*/ - mode: any; - /** the authentication error is failed and mode set to 'try'.*/ - error: any; - }; - /** the connection used by this request*/ - connection: ServerConnection; - /** the node domain object used to protect against exceptions thrown in extensions, handlers and route prerequisites. Can be used to manually bind callback functions otherwise bound to other domains.*/ - domain: any; - /** the raw request headers (references request.raw.headers).*/ - headers: IDictionary; - /** a unique request identifier (using the format '{now}:{connection.info.id}:{5 digits counter}').*/ - id: string; - /** request information */ - info: { - /** the request preferred encoding. */ - acceptEncoding: string; - /** if CORS is enabled for the route, contains the following: */ - cors: { - isOriginMatch: boolean; /** true if the request 'Origin' header matches the configured CORS restrictions. Set to false if no 'Origin' header is found or if it does not match. Note that this is only available after the 'onRequest' extension point as CORS is configured per-route and no routing decisions are made at that point in the request lifecycle. */ - }; - /** content of the HTTP 'Host' header (e.g. 'example.com:8080'). */ - host: string; - /** the hostname part of the 'Host' header (e.g. 'example.com').*/ - hostname: string; - /** request reception timestamp. */ - received: number; - /** content of the HTTP 'Referrer' (or 'Referer') header. */ - referrer: string; - /** remote client IP address. */ - remoteAddress: string; - /** remote client port. */ - remotePort: number; - /** request response timestamp (0 is not responded yet). */ - responded: number; - }; - /** the request method in lower case (e.g. 'get', 'post'). */ - method: string; - /** the parsed content-type header. Only available when payload parsing enabled and no payload error occurred. */ - mime: string; - /** an object containing the values of params, query, and payload before any validation modifications made. Only set when input validation is performed.*/ - orig: { - params: any; - query: any; - payload: any; - }; - /** an object where each key is a path parameter name with matching value as described in Path parameters.*/ - params: IDictionary; - /** an array containing all the path params values in the order they appeared in the path.*/ - paramsArray: string[]; - /** the request URI's path component. */ - path: string; - /** the request payload based on the route payload.output and payload.parse settings.*/ - payload: stream.Readable | Buffer | any; - /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state.*/ - plugins: any; - /** an object where each key is the name assigned by a route prerequisites function. The values are the raw values provided to the continuation function as argument. For the wrapped response object, use responses.*/ - pre: IDictionary; - /** the response object when set. The object can be modified but must not be assigned another object. To replace the response with another from within an extension point, use reply(response) to override with a different response. Contains null when no response has been set (e.g. when a request terminates prematurely when the client disconnects).*/ - response: Response; - /**preResponses - same as pre but represented as the response object created by the pre method.*/ - preResponses: any; - /**an object containing the query parameters.*/ - query: any; - /** an object containing the Node HTTP server objects. Direct interaction with these raw objects is not recommended.*/ - raw: { - req: http.IncomingMessage; - res: http.ServerResponse; - }; - /** the route public interface.*/ - route: IRoute; - /** the server object. */ - server: Server; - /** an object containing parsed HTTP state information (cookies) where each key is the cookie name and value is the matching cookie content after processing using any registered cookie definition. */ - state: any; - /** complex object contining details on the url */ - url: { - /** null when i tested */ - auth: any; - /** null when i tested */ - hash: any; - /** null when i tested */ - host: any; - /** null when i tested */ - hostname: any; - href: string; - path: string; - /** path without search*/ - pathname: string; - /** null when i tested */ - port: any; - /** null when i tested */ - protocol: any; - /** querystring parameters*/ - query: IDictionary; - /** querystring parameters as a string*/ - search: string; - /** null when i tested */ - slashes: any; - }; - - /** request.setUrl(url) - - Available only in 'onRequest' extension methods. - - Changes the request URI before the router begins processing the request where: - - url - the new request path value. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - - server.ext('onRequest', function (request, reply) { - - // Change all requests to '/test' - request.setUrl('/test'); - return reply.continue(); - });*/ - setUrl(url: string | url.Url): void; - /** request.setMethod(method) - - Available only in 'onRequest' extension methods. - - Changes the request method before the router begins processing the request where: - - method - is the request HTTP method (e.g. 'GET'). - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - - server.ext('onRequest', function (request, reply) { - - // Change all requests to 'GET' - request.setMethod('GET'); - return reply.continue(); - });*/ - setMethod(method: string): void; - - /** request.log(tags, [data, [timestamp]]) - - Always available. - - Logs request-specific events. When called, the server emits a 'request' event which can be used by other listeners or plugins. The arguments are: - - data - an optional message string or object with the application data being logged. - timestamp - an optional timestamp expressed in milliseconds. Defaults to Date.now() (now). - Any logs generated by the server internally will be emitted only on the 'request-internal' channel and will include the event.internal flag set to true. - - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - - server.on('request', function (request, event, tags) { - - if (tags.error) { - console.log(event); - } - }); - - var handler = function (request, reply) { - - request.log(['test', 'error'], 'Test event'); - return reply(); - }; - */ - log(/** a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events.*/ - tags: string | string[], - /** an optional message string or object with the application data being logged.*/ - data?: any, - /** an optional timestamp expressed in milliseconds. Defaults to Date.now() (now).*/ - timestamp?: number): void; - - /** request.getLog([tags], [internal]) - - Always available. - - Returns an array containing the events matching any of the tags specified (logical OR) - request.getLog(); - request.getLog('error'); - request.getLog(['error', 'auth']); - request.getLog(['error'], true); - request.getLog(false);*/ - - getLog(/** is a single tag string or array of tag strings. If no tags specified, returns all events.*/ - tags?: string, - /** filters the events to only those with a matching event.internal value. If true, only internal logs are included. If false, only user event are included. Defaults to all events (undefined).*/ - internal?: boolean): string[]; - - /** request.tail([name]) - - Available until immediately after the 'response' event is emitted. - - Adds a request tail which has to complete before the request lifecycle is complete where: - - name - an optional tail name used for logging purposes. - Returns a tail function which must be called when the tail activity is completed. - - Tails are actions performed throughout the request lifecycle, but which may end after a response is sent back to the client. For example, a request may trigger a database update which should not delay sending back a response. However, it is still desirable to associate the activity with the request when logging it (or an error associated with it). - - When all tails completed, the server emits a 'tail' event. - - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - - var get = function (request, reply) { - - var dbTail = request.tail('write to database'); - - db.save('key', 'value', function () { - - dbTail(); - }); - - return reply('Success!'); - }; - - server.route({ method: 'GET', path: '/', handler: get }); - - server.on('tail', function (request) { - - console.log('Request completed including db activity'); - });*/ - tail(/** an optional tail name used for logging purposes.*/ - name?: string): Function; -} -/** Response events - - The response object supports the following events: - - 'peek' - emitted for each chunk of data written back to the client connection. The event method signature is function(chunk, encoding). - 'finish' - emitted when the response finished writing but before the client response connection is ended. The event method signature is function (). - var Crypto = require('crypto'); - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - - server.ext('onPreResponse', function (request, reply) { - -var response = request.response; -if (response.isBoom) { -return reply(); +/** + * For context see RouteAdditionalConfigurationOptions > cors + */ +export interface CorsConfigurationObject { + /** a strings array of allowed origin servers ('Access-Control-Allow-Origin'). The array can contain any combination of fully qualified origins along with origin strings containing a wildcard '*' character, or a single '*' origin string. Defaults to any origin ['*']. */ + origin?: string[] | '*'; + /** number of seconds the browser should cache the CORS response ('Access-Control-Max-Age'). The greater the value, the longer it will take before the browser checks for changes in policy. Defaults to 86400 (one day). */ + maxAge?: number; + /** a strings array of allowed headers ('Access-Control-Allow-Headers'). Defaults to ['Accept', 'Authorization', 'Content-Type', 'If-None-Match'] */ + headers?: string[]; + /** a strings array of additional headers to headers. Use this to keep the default headers in place. */ + additionalHeaders?: string[]; + /** a strings array of exposed headers ('Access-Control-Expose-Headers'). Defaults to ['WWW-Authenticate', 'Server-Authorization']. */ + exposedHeaders?: string[]; + /** a strings array of additional headers to exposedHeaders. Use this to keep the default headers in place. */ + additionalExposedHeaders?: string[]; + /** if true, allows user credentials to be sent ('Access-Control-Allow-Credentials'). Defaults to false. */ + credentials?: boolean; } -var hash = Crypto.createHash('sha1'); -response.on('peek', function (chunk) { - -hash.update(chunk); -}); - -response.once('finish', function () { - -console.log(hash.digest('hex')); -}); - -return reply.continue(); -});*/ -export class Response extends Events.EventEmitter { - isBoom: boolean; - /** the HTTP response status code. Defaults to 200 (except for errors).*/ - statusCode: number; - /** an object containing the response headers where each key is a header field name. Note that this is an incomplete list of headers to be included with the response. Additional headers will be added once the response is prepare for transmission.*/ - headers: IDictionary; - /** the value provided using the reply interface.*/ - source: any; - /** a string indicating the type of source with available values: - 'plain' - a plain response such as string, number, null, or simple object (e.g. not a Stream, Buffer, or view). - 'buffer' - a Buffer. - 'view' - a view generated with reply.view(). - 'file' - a file generated with reply.file() of via the directory handler. - 'stream' - a Stream. - 'promise' - a Promise object. */ - variety: string; - /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ - app: any; - /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state. */ - plugins: any; - /** settings - response handling flags: - charset - the 'Content-Type' HTTP header 'charset' property. Defaults to 'utf-8'. - encoding - the string encoding scheme used to serial data into the HTTP payload when source is a string or marshals into a string. Defaults to 'utf8'. - passThrough - if true and source is a Stream, copies the statusCode and headers of the stream to the outbound response. Defaults to true. - stringify - options used for source value requiring stringification. Defaults to no replacer and no space padding. - ttl - if set, overrides the route cache expiration milliseconds value set in the route config. Defaults to no override. - varyEtag - if true, a suffix will be automatically added to the 'ETag' header at transmission time (separated by a '-' character) when the HTTP 'Vary' header is present.*/ - settings: { - charset: string; - encoding: string; - passThrough: boolean; - stringify: any; - ttl: number; - varyEtag: boolean; - }; - - /** sets the HTTP 'Content-Length' header (to avoid chunked transfer encoding) where: - length - the header value. Must match the actual payload size.*/ - bytes(length: number): Response; - - /** sets the 'Content-Type' HTTP header 'charset' property where: charset - the charset property value.*/ - charset(charset: string): Response; - - /** sets the HTTP status code where: - statusCode - the HTTP status code.*/ - code(statusCode: number): Response; - - /** sets the HTTP status code to Created (201) and the HTTP 'Location' header where: uri - an absolute or relative URI used as the 'Location' header value.*/ - created(uri: string): Response; - - /** encoding(encoding) - sets the string encoding scheme used to serial data into the HTTP payload where: encoding - the encoding property value (see node Buffer encoding).*/ - encoding(encoding: string): Response; - - /** etag(tag, options) - sets the representation entity tag where: - tag - the entity tag string without the double-quote. - options - optional settings where: - weak - if true, the tag will be prefixed with the 'W/' weak signifier. Weak tags will fail to match identical tags for the purpose of determining 304 response status. Defaults to false. - vary - if true and content encoding is set or applied to the response (e.g 'gzip' or 'deflate'), the encoding name will be automatically added to the tag at transmission time (separated by a '-' character). Ignored when weak is true. Defaults to true.*/ - etag(tag: string, options: { - weak: boolean; vary: boolean; - }): Response; - - /**header(name, value, options) - sets an HTTP header where: - name - the header name. - value - the header value. - options - optional settings where: - append - if true, the value is appended to any existing header value using separator. Defaults to false. - separator - string used as separator when appending to an exiting value. Defaults to ','. - override - if false, the header value is not set if an existing value present. Defaults to true.*/ - header(name: string, value: string, options?: IHeaderOptions): Response; - - /** hold() - puts the response on hold until response.send() is called. Available only after reply() is called and until response.hold() is invoked once. */ - hold(): Response; - - /** location(uri) - sets the HTTP 'Location' header where: - uri - an absolute or relative URI used as the 'Location' header value.*/ - location(uri: string): Response; - - /** redirect(uri) - sets an HTTP redirection response (302) and decorates the response with additional methods listed below, where: - uri - an absolute or relative URI used to redirect the client to another resource. */ - redirect(uri: string): Response; - - /** replacer(method) - sets the JSON.stringify() replacer argument where: - method - the replacer function or array. Defaults to none.*/ - replacer(method: Function | Function[]): Response; - - /** spaces(count) - sets the JSON.stringify() space argument where: - count - the number of spaces to indent nested object keys. Defaults to no indentation. */ - spaces(count: number): Response; - - /**state(name, value, [options]) - sets an HTTP cookie where: - name - the cookie name. - value - the cookie value. If no encoding is defined, must be a string. - options - optional configuration. If the state was previously registered with the server using server.state(), the specified keys in options override those same keys in the server definition (but not others).*/ - state(name: string, value: string, options?: any): Response; - - /** send() - resume the response which will be transmitted in the next tick. Available only after response.hold() is called and until response.send() is invoked once. */ - send(): void; - - /** sets a string suffix when the response is process via JSON.stringify().*/ - suffix(suffix: string): void; - - /** overrides the default route cache expiration rule for this response instance where: - msec - the time-to-live value in milliseconds.*/ - ttl(msec: number): void; - - /** type(mimeType) - sets the HTTP 'Content-Type' header where: - mimeType - is the mime type. Should only be used to override the built-in default for each response type. */ - type(mimeType: string): Response; - - /** clears the HTTP cookie by setting an expired value where: - name - the cookie name. - options - optional configuration for expiring cookie. If the state was previously registered with the server using server.state(), the specified keys in options override those same keys in the server definition (but not others).*/ - unstate(name: string, options?: { [key: string]: string }): Response; - - /** adds the provided header to the list of inputs affected the response generation via the HTTP 'Vary' header where: - header - the HTTP request header name.*/ - vary(header: string): void; +/** + * An object describing the extension function used whilst registering the extension function in one of the available extension points + * [See docs](https://hapijs.com/api/16.1.1#serverextevents) + * For context see RouteAdditionalConfigurationOptions > ext + */ +export interface ServerStartExtConfigurationObject { + /** the extension point event name. */ + type: ServerStartExtPoints; + /** + * a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is see ServerExtFunction or see ServerExtRequestHandler + */ + method: ServerExtFunction | ServerExtFunction[]; + options?: ServerExtOptions; } -/** When using the redirect() method, the response object provides these additional methods */ -export class ResponseRedirect extends Response { - /** sets the status code to 302 or 307 (based on the rewritable() setting) where: - isTemporary - if false, sets status to permanent. Defaults to true.*/ - temporary(isTemporary: boolean): void; - /** sets the status code to 301 or 308 (based on the rewritable() setting) where: - isPermanent - if true, sets status to temporary. Defaults to false. */ - permanent(isPermanent: boolean): void; - - /** sets the status code to 301/302 for rewritable (allows changing the request method from 'POST' to 'GET') or 307/308 for non-rewritable (does not allow changing the request method from 'POST' to 'GET'). Exact code based on the temporary() or permanent() setting. Arguments: - isRewritable - if false, sets to non-rewritable. Defaults to true. - Permanent Temporary - Rewritable 301 302(1) - Non-rewritable 308(2) 307 - Notes: 1. Default value. 2. Proposed code, not supported by all clients. */ - rewritable(isRewritable: boolean): void; +/** + * An object describing the extension function used whilst registering the extension function in one of the available extension points + * [See docs](https://hapijs.com/api/16.1.1#serverextevents) + * For context see RouteAdditionalConfigurationOptions > ext + */ +export interface ServerRequestExtConfigurationObject { + /** the extension point event name. */ + type: ServerRequestExtPointsBase; + /** + * a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is see ServerExtFunction or see ServerExtRequestHandler + */ + method: ServerExtRequestHandler | ServerExtRequestHandler[] + options?: ServerExtOptions; } -/** info about a server connection */ -export interface IServerConnectionInfo { - /** - a unique connection identifier (using the format '{hostname}:{pid}:{now base36}').*/ - id: string; - /** - the connection creation timestamp.*/ - created: number; - /** - the connection start timestamp (0 when stopped).*/ - started: number; - /** the connection port based on the following rules: - the configured port value before the server has been started. - the actual port assigned when no port is configured or set to 0 after the server has been started.*/ - port: number; - /** - the host name the connection was configured to. Defaults to the operating system hostname when available, otherwise 'localhost'.*/ - host: string; - /** - the active IP address the connection was bound to after starting.Set to undefined until the server has been started or when using a non TCP port (e.g. UNIX domain socket).*/ - address: string; - /** - the protocol used: - 'http' - HTTP. - 'https' - HTTPS. - 'socket' - UNIX domain socket or Windows named pipe.*/ - protocol: string; - /** a string representing the connection (e.g. 'http://example.com:8080' or 'socket:/unix/domain/socket/path'). Contains the uri setting if provided, otherwise constructed from the available settings. If no port is available or set to 0, the uri will not include a port component.*/ - uri: string; +/** + * An object describing the extension function used whilst registering the extension function in one of the available extension points + * [See docs](https://hapijs.com/api/16.1.1#serverextevents) + * For context see RouteAdditionalConfigurationOptions > ext + */ +export interface ServerRequestExtConfigurationObjectWithRequest { + /** the extension point event name. */ + type: ServerRequestExtPoints; + /** + * a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is see ServerExtFunction or see ServerExtRequestHandler + */ + method: ServerExtRequestHandler | ServerExtRequestHandler[]; + options?: ServerExtOptions; +} + +/** + * [See docs](https://hapijs.com/api/16.1.1#route-configuration) > ext + */ +export type RouteExtConfigurationObject = ServerStartExtConfigurationObject | ServerRequestExtConfigurationObject; + +/** + * [See docs](https://hapijs.com/api/16.1.1#serverextevents) > events > method + */ +export type ServerExtMethod = ServerExtFunction | ServerExtRequestHandler; + +/** + * [See docs](https://hapijs.com/api/16.1.1#serverextevents) > events > options + */ +export interface ServerExtOptions { + /** before - a string or array of strings of plugin names this method must execute before (on the same event). Otherwise, extension methods are executed in the order added. */ + before: string | string[]; + /** after - a string or array of strings of plugin names this method must execute after (on the same event). Otherwise, extension methods are executed in the order added. */ + after: string | string[]; + /** bind - a context object passed back to the provided method (via this) when called. Ignored if the method is an arrow function. */ + bind: any; + /** sandbox - if set to 'plugin' when adding a request extension points the extension is only added to routes defined by the current plugin. Not allowed when configuring route-level extensions, or when adding server extensions. Defaults to 'connection' which applies to any route added to the connection the extension is added to. */ + sandbox?: 'connection' | 'plugin'; +} + +/** + * [See docs](https://hapijs.com/api/16.1.1#serverextevents) > events > type + * * 'onPreStart' - called before the connection listeners are started. + * * 'onPostStart' - called after the connection listeners are started. + * * 'onPreStop' - called before the connection listeners are stopped. + * * 'onPostStop' - called after the connection listeners are stopped. + */ +export type ServerStartExtPoints = 'onPreStart' | 'onPostStart' | 'onPreStop' | 'onPostStop'; +/** + * [See docs](https://hapijs.com/api/16.1.1#request-lifecycle) + * * The available extension points include the request extension points as well as the following server extension points: + */ +export type ServerRequestExtPointsBase = 'onPreResponse' | 'onPreAuth' | 'onPostAuth' | 'onPreHandler' | 'onPostHandler' | 'onPreResponse'; + +export type ServerRequestExtPoints = ServerRequestExtPointsBase | 'onRequest'; + +/** + * Server extension function registered an one of the server extension points + * [See docs](https://hapijs.com/api/16.1.1#serverextevents) + * For context see ServerExtConfigurationObject + * @param server - the server object. + * @param next - the continuation method with signature function(err). + * @param this - the object provided via options.bind or the current active context set with server.bind(). + */ +export interface ServerExtFunction { + (server: Server, next: ContinuationFunction): void; +} + +/** + * For context see RouteAdditionalConfigurationOptions > payload + */ +export interface RoutePayloadConfigurationObject { + /** + * the type of payload representation requested. The value must be one of: + * * 'data' - the incoming payload is read fully into memory. If parse is true, the payload is parsed (JSON, form-decoded, multipart) based on the 'Content-Type' header. If parse is false, the raw Buffer is returned. This is the default value except when a proxy handler is used. + * * 'stream' - the incoming payload is made available via a Stream.Readable interface. If the payload is 'multipart/form-data' and parse is true, fields values are presented as text while files are provided as streams. File streams from a 'multipart/form-data' upload will also have a property hapi containing filename and headers properties. + * * 'file' - the incoming payload is written to temporary file in the directory specified by the server's payload.uploads settings. If the payload is 'multipart/form-data' and parse is true, fields values are presented as text while files are saved. Note that it is the sole responsibility of the application to clean up the files generated by the framework. This can be done by keeping track of which files are used (e.g. using the request.app object), and listening to the server 'response' event to perform any needed cleanup. + */ + output?: PayLoadOutputOption; + /** + * can be true, false, or gunzip; determines if the incoming payload is processed or presented raw. true and gunzip includes gunzipping when the appropriate 'Content-Encoding' is specified on the received request. If parsing is enabled and the 'Content-Type' is known (for the whole payload as well as parts), the payload is converted into an object when possible. If the format is unknown, a Bad Request (400) error response is sent. Defaults to true, except when a proxy handler is used. The supported mime types are: + * * 'application/json' + * * 'application/x-www-form-urlencoded' + * * 'application/octet-stream' + * * 'text/*' + * * 'multipart/form-data' + */ + parse?: 'gunzip' | boolean; + /** + * overrides payload processing for multipart requests. Value can be one of: + * * false - disables multipart processing. + * * object with the following required options: + * * output - same as the payload.output option with an additional value option: + * * annotated - wraps each multipart part in an object with the following keys: // TODO type this? + * * headers - the part headers. + * * filename - the part file name. + * * payload - the processed part payload. + */ + multipart?: false | { + output: PayLoadOutputOption | 'annotated'; + }; + /** a string or an array of strings with the allowed mime types for the endpoint. Defaults to any of the supported mime types listed above. Note that allowing other mime types not listed will not enable them to be parsed, and that if parsing mode is 'parse', the request will result in an error response. */ + allow?: string | string[]; + /** a mime type string overriding the 'Content-Type' header value received. Defaults to no override. */ + override?: string; + /** limits the size of incoming payloads to the specified byte count. Allowing very large payloads may cause the server to run out of memory. Defaults to 1048576 (1MB). */ + maxBytes?: number; + /** payload reception timeout in milliseconds. Sets the maximum time allowed for the client to transmit the request payload (body) before giving up and responding with a Request Timeout (408) error response. Set to false to disable. Defaults to 10000 (10 seconds). */ + timeout?: number; + /** the directory used for writing file uploads. Defaults to os.tmpdir(). */ + uploads?: string; + /** + * determines how to handle payload parsing errors. Allowed values are: + * * 'error' - return a Bad Request (400) error response. This is the default value. + * * 'log' - report the error but continue processing the request. + * * 'ignore' - take no action and continue processing the request. + */ + failAction?: 'error' | 'log' | 'ignore'; + /** the default 'Content-Type' HTTP header value is not present. Defaults to 'application/json'. */ + defaultContentType?: string; + /** an object where each key is a content-encoding name and each value is an object with the desired decoder settings. Note that encoder settings are set in the root option compression. */ + compression?: Dictionary; +} + +export type PayLoadOutputOption = 'data' | 'stream' | 'file'; + +/** + * events must be one of: + * * an event name string. + * * an event options object see ApplicationEventOptionsObject + * * a podium [See docs](https://github.com/hapijs/podium) emitter object. + * For context [See docs](https://hapijs.com/api/16.1.1#servereventevents) > events parameter + */ +export type ApplicationEvent = string | ApplicationEventOptionsObject | Podium; + +/** + * an event options object + * For context see ApplicationEvent + * For context [See docs](https://hapijs.com/api/16.1.1#servereventevents) > events parameter + */ +export interface ApplicationEventOptionsObject { + /** the event name string (required). */ + name: string; + /** a string or array of strings specifying the event channels available. Defaults to no channel restrictions (event updates can specify a channel or not). */ + channels?: string | string[]; + /** if true, the data object passed to server.emit() is cloned before it is passed to the listeners (unless an override specified by each listener). Defaults to false (data is passed as-is). */ + clone?: boolean; + /** if true, the data object passed to server.emit() must be an array and the listener method is called with each array element passed as a separate argument (unless an override specified by each listener). This should only be used when the emitted data structure is known and predictable. Defaults to false (data is emitted as a single argument regardless of its type). */ + spread?: boolean; + /** if true and the criteria object passed to server.emit() includes tags, the tags are mapped to an object (where each tag string is the key and the value is true) which is appended to the arguments list at the end (but before the callback argument if block is set). A configuration override can be set by each listener. Defaults to false. */ + tags?: boolean; + /** if true, the same event name can be registered multiple times where the second registration is ignored. Note that if the registration config is changed between registrations, only the first configuration is used. Defaults to false (a duplicate registration will throw an error). */ + shared?: boolean; +} + +/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Route + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */ +// TODO: move to separate file http://stackoverflow.com/questions/43276921 + +/** + * Route configuration + * The route configuration object + * + * [See docs](https://hapijs.com/api/16.1.1#route-configuration) + * + * TODO typings check that the following refers to RouteAdditionalConfigurationOptions "Note that the options object is deeply cloned (with the exception of bind which is shallowly copied) and cannot contain any values that are unsafe to perform deep copy on." + */ +export interface RouteConfiguration { + /** the absolute path used to match incoming requests (must begin with '/'). Incoming requests are compared to the configured paths based on the connection router configuration option. The path can include named parameters enclosed in {} which will be matched against literal values in the request as described in Path parameters. */ + path: string; + /** the HTTP method. Typically one of 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', or 'OPTIONS'. Any HTTP method is allowed, except for 'HEAD'. Use '*' to match against any HTTP method (only when an exact match was not found, and any match with a specific method will be given a higher priority over a wildcard match). Can be assigned an array of methods which has the same result as adding the same route with different methods manually. */ + method: HTTP_METHODS_PARTIAL | '*' | (HTTP_METHODS_PARTIAL | '*')[]; + /** an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field. Matching is done against the hostname part of the header only (excluding the port). Defaults to all hosts. */ + vhost?: string; + /** the function called to generate the response after successful authentication and validation. The handler function is described in Route handler. If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed. Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler. */ + handler?: string | RouteHandler | RouteHandlerPlugins; + /** additional route options. The config value can be an object or a function that returns an object using the signature function(server) where server is the server the route is being added to and this is bound to the current realm's bind option. */ + config?: RouteAdditionalConfigurationOptions | ((server: Server) => RouteAdditionalConfigurationOptions); +} + +/** + * Route options + * Each route can be customize to change the default behavior of the request lifecycle using the following options: + * [See docs](https://hapijs.com/api/16.1.1#route-options) + */ +export interface RouteAdditionalConfigurationOptions { + /** application specific configuration.Should not be used by plugins which should use plugins[name] instead. */ + app?: any; + /** + * Authentication configuration. Value can be: + * * false to disable authentication if a default strategy is set. + * * a string with the name of an authentication strategy registered with server.auth.strategy(). + * * an object + */ + auth?: false | string | AuthOptions; + /** an object passed back to the provided handler (via this) when called. Ignored if the method is an arrow function. */ + bind?: any; + /** + * Route cache options + * if the route method is 'GET', the route can be configured to include caching directives in the response. The default Cache-Control: no-cache header can be disabled by setting cache to false. Caching can be customized using an object + * TODO check: the default is to have 'Cache-Control: no-cache', but on first reading is a contridiction as you can disabled cache and disabled no-cache by setting RouteCacheOptions to false? + */ + cache?: boolean | RouteCacheOptions; + /** an object where each key is a content-encoding name and each value is an object with the desired encoder settings. Note that decoder settings are set in payload.compression. */ + compression?: Dictionary; + /** the Cross-Origin Resource Sharing protocol allows browsers to make cross-origin API calls. CORS is required by web applications running inside a browser which are loaded from a different domain than the API server. CORS headers are disabled by default (false). To enable, set cors to true, or to an object */ + cors?: boolean | CorsConfigurationObject; + /** defined a route-level request extension points by setting the option to an object with a key for each of the desired extension points ('onRequest' is not allowed), and the value is the same as the [server.ext(events)](https://hapijs.com/api/16.1.1#serverextevents) event argument. */ + ext?: RouteExtConfigurationObject | RouteExtConfigurationObject[]; + /** defines the behavior for accessing files: */ + files?: { + /** determines the folder relative paths are resolved against. */ + relativeTo: string; + }; + /** an alternative location for the route.handler option. */ + handler?: string | RouteHandler; + /** an optional unique identifier used to look up the route using server.lookup(). Cannot be assigned to routes with an array of methods. */ + id?: string; + /** if true, the route cannot be accessed through the HTTP connection but only through the server.inject() interface with the allowInternals option set to true. Used for internal routes that should not be accessible to the outside world. Defaults to false. */ + isInternal?: boolean; + /** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload. Supports the following: */ + json?: Json.StringifyArguments & { + /** string suffix added after conversion to JSON string. Defaults to no suffix. */ + suffix?: string; + }; + /** enables JSONP support by setting the value to the query parameter name containing the function name used to wrap the response payload. For example, if the value is 'callback', a request comes in with 'callback=me', and the JSON response is '{ "a":"b" }', the payload will be 'me({ "a":"b" });'. Does not work with stream responses. Headers content-type and x-content-type-options are set to text/javascript and nosniff respectively, and will override those headers even if explicitly set by response.type() */ + jsonp?: string; + /** if true, request level logging is enabled (accessible via request.getLog()). */ + log?: boolean; + /** + * determines how the request payload is processed + * [See docs](https://hapijs.com/api/16.1.1#route-options) + */ + payload?: RoutePayloadConfigurationObject; + /** plugin-specific configuration. plugins is an object where each key is a plugin name and the value is the plugin configuration. */ + plugins?: PluginSpecificConfiguration; + /** an array with [route prerequisites](https://hapijs.com/api/16.1.1#route-prerequisites) methods which are executed in serial or in parallel before the handler is called. */ + pre?: RoutePrerequisitesArray; + /** processing rules for the outgoing response */ + response?: RouteResponseConfigurationObject; + /** sets common security headers (disabled by default). To enable set security to true or to an object with the following options: See RouteSecurityConfigurationObject */ + security?: boolean | RouteSecurityConfigurationObject; + /** HTTP state management (cookies) allows the server to store information on the client which is sent back to the server with every request (as defined in RFC 6265). state supports the following options: */ + state?: { + /** determines if incoming 'Cookie' headers are parsed and stored in the request.state object. Defaults to true. */ + parse?: boolean; + /** + * determines how to handle cookie parsing errors. Allowed values are: + * * 'error' - return a Bad Request (400) error response. This is the default value. + * * 'log' - report the error but continue processing the request. + * * 'ignore' - take no action. + */ + failAction: 'error' | 'log' | 'ignore'; + }; + /** request input validation rules for various request components. When using a Joi validation object, the values of the other inputs (i.e. headers, query, params, payload, and auth) are made available under the validation context (accessible in rules as Joi.ref('$query.key')). Note that validation is performed in order (i.e. headers, params, query, payload) and if type casting is used (converting a string to number), the value of inputs not yet validated will reflect the raw, unvalidated and unmodified values. If the validation rules for headers, params, query, and payload are defined at both the routes defaults level and an individual route, the individual route settings override the routes defaults (the rules are not merged). The validate object supports: */ + validate?: RouteValidationConfigurationObject; + /** define timeouts for processing durations: */ + timeout?: { + /** response timeout in milliseconds. Sets the maximum time allowed for the server to respond to an incoming client request before giving up and responding with a Service Unavailable (503) error response. Disabled by default (false). */ + server?: boolean | number; + /** by default, node sockets automatically timeout after 2 minutes. Use this option to override this behavior. Defaults to undefined which leaves the node default unchanged. Set to false to disable socket timeouts. */ + socket?: boolean | number; + }; + + /** + * TODO decide on moving these to an extended interface of RouteAdditionalConfigurationOptions + */ + /** + * ONLY WHEN ADDING NEW ROUTES (not when setting defaults). + * route description used for generating documentation + */ + description?: string; + /** + * ONLY WHEN ADDING NEW ROUTES (not when setting defaults). + * route notes used for generating documentation + */ + notes?: string | string[]; + /** + * ONLY WHEN ADDING NEW ROUTES (not when setting defaults). + * route tags used for generating documentation + */ + tags?: string[]; +} + +/** + * Route public interface + * When route information is returned or made available as a property, it is an object with the following: + * [See docs](https://hapijs.com/api/16.1.1#route-public-interface) + */ +export interface RoutePublicInterface { + /** the route HTTP method. */ + method: string; + /** the route path. */ + path: string; + /** the route vhost option if configured. */ + vhost?: string | string[]; + /** the [active realm] [See docs](https://hapijs.com/api/16.1.1#serverrealm) associated with the route.*/ + realm: ServerRealm; + /** the [route options] [See docs](https://hapijs.com/api/16.1.1#route-options) object with all defaults applied. */ + settings: RouteAdditionalConfigurationOptions; + /** the route internal normalized string representing the normalized path. */ + fingerprint: string; + /** route authentication utilities: */ + auth: { + /** authenticates the passed request argument against the route's authentication access configuration. Returns true if the request would have passed the route's access requirements. Note that the route's authentication mode and strategies are ignored. The only match is made between the request.auth.credentials scope and entity information and the route access configuration. Also, if the route uses dynamic scopes, the scopes are constructed against the request.query and request.params which may or may not match between the route and the request's route. If this method is called using a request that has not been authenticated (yet or at all), it will return false if the route requires any authentication. */ + access(request: Request): boolean; + }; +} + +export type RouteHandlerConfig = any; + +/** + * For context [See docs](https://hapijs.com/api/16.1.1#serverhandlername-method) + * For source [See docs](https://github.com/hapijs/hapi/blob/v16.1.1/lib/handler.js#L103) + * For source [See docs](https://github.com/hapijs/hapi/blob/v16.1.1/lib/route.js#L56-L60) + * TODO check the type of `RouteHandlerConfig` is correct for `defaults`. + */ +export interface MakeRouteHandler { + (route: RoutePublicInterface, options: RouteHandlerConfig): RouteHandler; + defaults?: RouteHandlerConfig | ((method: HTTP_METHODS_PARTIAL_lowercase) => RouteHandlerConfig); +} + +/** + * [See docs](https://hapijs.com/api/16.1.1#servertablehost) > return value + */ +export interface RoutingTableEntry { + /** the connection.info the connection the table was generated for. */ + info: ServerConnectionInfo; + /** the connection labels. */ + labels: string[]; + /** an array of routes where each route contains: */ + table: Route[]; +} + +/** + * [See docs](https://hapijs.com/api/16.1.1#servertablehost) > return value + * For source [See source](https://github.com/hapijs/hapi/blob/v16.1.1/lib/route.js#L71) + */ +export interface Route { + /** + * the route config with defaults applied. + * TODO check type of RouteConfiguration here is correct + */ + settings: RouteAdditionalConfigurationOptions; + /** + * the HTTP method in lower case. + * TODO, check if it can contain 'head' or not. + */ + method: HTTP_METHODS_PARTIAL_lowercase; + /** the route path. */ + path: string; + + params: string[]; + + connection: ServerConnection; + + fingerprint: string; + + plugin?: any; + + public: RoutePublicInterface; + + server: Server; +} + +/** + * Route Prerequisites + * It is often necessary to perform prerequisite actions before the handler is called (e.g. load required reference data from a database). The route pre option allows defining such pre-handler methods. The methods are called in order. If the pre array contains another array, those methods are called in parallel. pre can be assigned a mixed array of: + * * arrays containing the elements listed below, which are executed in parallel. + * * objects see RoutePrerequisiteObjects + * * functions - same as including an object with a single method key. + * * strings - special short-hand notation for registered server methods using the format 'name(args)' (e.g. 'user(params.id)') where: + * * 'name' - the method name. The name is also used as the default value of assign. + * * 'args' - the method arguments (excluding next) where each argument is a property of the request object + * [See docs](https://hapijs.com/api/16.1.1#route-prerequisites) + * For context see RouteAdditionalConfigurationOptions > pre + * + * TODO follow up on "server methods" in "special short-hand notation for registered server methods" at https://hapijs.com/api/16.1.1#servermethodname-method-options + * TODO follow up on "request object" in "each argument is a property of the request object" at https://hapijs.com/api/16.1.1#request-object + */ +export type RoutePrerequisitesArray = RoutePrerequisitesPart[] | (RoutePrerequisitesPart[] | RoutePrerequisitesPart)[]; +export type RoutePrerequisitesPart = RoutePrerequisiteObjects | RoutePrerequisiteRequestHandler | string; + +/** + * see RoutePrerequisites > objects + */ +export interface RoutePrerequisiteObjects { + /** the function to call (or short-hand method string as described below [see RoutePrerequisitesArray]). the function signature is identical to a route handler as described in Route handler. */ + method: RoutePrerequisiteRequestHandler | string; + /** key name to assign the result of the function to within request.pre. */ + assign: string; + /* + * determines how to handle errors returned by the method. Allowed values are: + * * 'error' - returns the error response back to the client. This is the default value. + * * 'log' - logs the error but continues processing the request. If assign is used, the error will be assigned. + * * 'ignore' - takes no special action. If assign is used, the error will be assigned. + */ + failAction?: 'error' | 'log' | 'ignore'; +} + +/** + * For context see RouteAdditionalConfigurationOptions > response + */ +export interface RouteResponseConfigurationObject { + /** the default HTTP status code when the payload is empty. Value can be 200 or 204. Note that a 200 status code is converted to a 204 only at the time or response transmission (the response status code will remain 200 throughout the request lifecycle unless manually set). Defaults to 200. */ + emptyStatusCode?: number; + /** + * defines what to do when a response fails payload validation. Options are: + * * 'error' - return an Internal Server Error (500) error response. This is the default value. + * * 'log' - log the error but send the response. + * * a custom error handler function with the signature function(request, reply, source, error) where: + * * 'request' - the request object. + * * 'reply' - the continuation reply interface. + * * 'error' - the error returned from the validation schema. + * TODO update type of source once PR to hapi is concluded. + */ + failAction?: 'error' | 'log' | ((request: Request, reply: ReplyWithContinue, source: string, error: Boom.BoomError) => void); + /** if true, applies the validation rule changes to the response payload. Defaults to false. */ + modify?: boolean; + /** + * options to pass to Joi. Useful to set global options such as stripUnknown or abortEarly (the complete list is available [here](https://github.com/hapijs/joi/blob/master/API.md#validatevalue-schema-options-callback) ). + * If a custom validation function (see `schema` or `status` below) is defined then `options` can an arbitrary object that will be passed to this function as the second parameter. + * Defaults to no options. + */ + options?: ValidationOptions; + /** if false, payload range support is disabled. Defaults to true. */ + ranges?: boolean; + /** the percent of response payloads validated (0 - 100). Set to 0 to disable all validation. Defaults to 100 (all response payloads). */ + sample?: number; + /** the default response payload validation rules (for all non-error responses) */ + schema?: RouteResponseConfigurationScheme; + /** HTTP status-code-specific payload validation rules. The status key is set to an object where each key is a 3 digit HTTP status code and the value has the same definition as schema. If a response status code is not present in the status object, the schema definition is used, except for errors which are not validated by default. */ + status?: Dictionary>; +} + +/** + * the default response payload validation rules (for all non-error responses) expressed as one of: + * * true - any payload allowed (no validation performed). This is the default. + * * false - no payload allowed. + * * a Joi validation object. This will receive the request's headers, params, query, payload, and auth credentials and isAuthenticated flags as context. + * * a validation function + * + * TODO check JoiValidationObject is correct for "a Joi validation object" + * + * For context see RouteAdditionalConfigurationOptions > response > schema + * and + * For context see RouteAdditionalConfigurationOptions > response > status + */ +export type RouteResponseConfigurationScheme = boolean | JoiValidationObject | ValidationFunctionForRouteResponse; + +/** + * see RouteResponseConfigurationScheme + * + * a validation function using the signature function(value, options, next) where: + * * value - the value of the response passed to `reply(value)` in the handler. + * * options - the server validation options, merged with an object containing the request's headers, params, payload, and auth credentials object and `isAuthenticated` flag. + * * next([err, [value]]) - the callback function called when validation is completed. `value` will be used as the response value when `err` is falsy, when `value` is not `undefined`, and when `route.settings.response.modify` is `true`. If the response is already a `Boom` error it will be set as its `message` value. + */ +export interface ValidationFunctionForRouteResponse { + (value: any, options: RouteResponseValidationContext & ValidationOptions, next: ContinuationValueFunction): void; +} + +/** + * A context for route input validation via a Joi schema or validation function. + * + * This object is merged with the route response options and passed into the validation function. + * + * See https://github.com/hapijs/hapi/blob/v16.1.1/lib/validation.js#L217 + */ +export interface RouteResponseValidationContext { + context: { + /** The request headers */ + headers: Dictionary; + /** The request path parameters */ + params: any; + /** The request query parameters */ + query: any; + /** The request payload parameters */ + payload: any; + + /** Partial request authentication information */ + auth: { + /** true if the request has been successfully authenticated, otherwise false. */ + isAuthenticated: boolean; + /** the credential object received during the authentication process. The presence of an object does not mean successful authentication. */ + credentials: AuthenticatedCredentials; + }; + } +} + +/** + * For context see RouteAdditionalConfigurationOptions > security + */ +export interface RouteSecurityConfigurationObject { + /** controls the 'Strict-Transport-Security' header. If set to true the header will be set to max-age=15768000, if specified as a number the maxAge parameter will be set to that number. Defaults to true. You may also specify an object with the following fields: */ + hsts?: boolean | number | { + /** the max-age portion of the header, as a number. Default is 15768000. */ + maxAge?: number; + /** a boolean specifying whether to add the includeSubDomains flag to the header. */ + includeSubdomains?: boolean; + /** a boolean specifying whether to add the 'preload' flag (used to submit domains inclusion in Chrome's HTTP Strict Transport Security (HSTS) preload list) to the header. */ + preload?: boolean; + }; + /** controls the 'X-Frame-Options' header. When set to true the header will be set to DENY, you may also specify a string value of 'deny' or 'sameorigin'. Defaults to true. To use the 'allow-from' rule, you must set this to an object with the following fields: */ + xframe?: true | 'deny' | 'sameorigin' | { + /** may also be 'deny' or 'sameorigin' but set directly as a string for xframe */ + rule: 'allow-from'; + /** when rule is 'allow-from' this is used to form the rest of the header, otherwise this field is ignored. If rule is 'allow-from' but source is unset, the rule will be automatically changed to 'sameorigin'. */ + source: string; + }; + /** boolean that controls the 'X-XSS-PROTECTION' header for IE. Defaults to true which sets the header to equal '1; mode=block'. NOTE: This setting can create a security vulnerability in versions of IE below 8, as well as unpatched versions of IE8. See [here](https://hackademix.net/2009/11/21/ies-xss-filter-creates-xss-vulnerabilities/) and [here](https://technet.microsoft.com/library/security/ms10-002) for more information. If you actively support old versions of IE, it may be wise to explicitly set this flag to false. [Kept typing non optional to force this security related documentation to be read.] */ + xss: boolean; + /** boolean controlling the 'X-Download-Options' header for IE, preventing downloads from executing in your context. Defaults to true setting the header to 'noopen'. */ + noOpen?: boolean; + /** boolean controlling the 'X-Content-Type-Options' header. Defaults to true setting the header to its only and default option, 'nosniff' */ + noSniff?: boolean; +} + +/** + * request input validation rules for various request components. When using a Joi validation object, the values of the other inputs (i.e. headers, query, params, payload, and auth) are made available under the validation context (accessible in rules as Joi.ref('$query.key')). Note that validation is performed in order (i.e. headers, params, query, payload) and if type casting is used (converting a string to number), the value of inputs not yet validated will reflect the raw, unvalidated and unmodified values. If the validation rules for headers, params, query, and payload are defined at both the routes defaults level and an individual route, the individual route settings override the routes defaults (the rules are not merged). The validate object supports: + * For context see RouteAdditionalConfigurationOptions > validate + * TODO check JoiValidationObject is correct for "a Joi validation object" + */ +export interface RouteValidationConfigurationObject { + /** + * validation rules for incoming request headers (note that all header field names must be in lowercase to match the headers normalized by node). Values allowed: + * * true - any headers allowed (no validation performed). This is the default. + * * false - no headers allowed (this will cause all valid HTTP requests to fail). + * * a Joi validation object. + * * a validation function using the signature function(value, options, next) where: + * * value - the object containing the request headers. + * * options - the server validation options. + * * next(err, value) - the callback function called when validation is completed. `value` will be used as the `headers` value when `err` is falsy. If `next` is called with `undefined` or no arguments then the original value of `value` will be used. + */ + headers?: boolean | JoiValidationObject | ValidationFunctionForRouteInput; + /** + * validation rules for incoming request path parameters, after matching the path against the route and extracting any parameters then stored in request.params. Values allowed: + * Same as `headers`, see above. + */ + params?: boolean | JoiValidationObject | ValidationFunctionForRouteInput; + /** + * validation rules for an incoming request URI query component (the key-value part of the URI between '?' and '#'). The query is parsed into its individual key-value pairs and stored in request.query prior to validation. Values allowed: + * Same as `headers`, see above. + */ + query?: boolean | JoiValidationObject | ValidationFunctionForRouteInput; + /** + * validation rules for an incoming request payload (request body). Values allowed: + * Same as `headers`, see above, with the addition that: + * * a Joi validation object. Note that empty payloads are represented by a null value. If a validation schema is provided and empty payload are supported, it must be explicitly defined by setting the payload value to a joi schema with null allowed (e.g. Joi.object({ /* keys here * / }).allow(null)). + */ + payload?: boolean | JoiValidationObject | ValidationFunctionForRouteInput; + /** an optional object with error fields copied into every validation error response. */ + errorFields?: any; + /** + * determines how to handle invalid requests. Allowed values are: + * * 'error' - return a Bad Request (400) error response. This is the default value. + * * 'log' - log the error but continue processing the request. + * * 'ignore' - take no action. + * * a custom error handler function with the signature function(request, reply, source, error) see RouteFailFunction + */ + failAction?: 'error' | 'log' | 'ignore' | RouteFailFunction; + /** + * options to pass to Joi. Useful to set global options such as stripUnknown or abortEarly (the complete list is [available here](https://github.com/hapijs/joi/blob/master/API.md#validatevalue-schema-options-callback)). + * If a custom validation function (see `headers`, `params`, `query`, or `payload` above) is defined then `options` can an arbitrary object that will be passed to this function as the second parameter. + * Defaults to no options. + */ + options?: ValidationOptions; +} + +/** + * a validation function using the signature function(value, options, next) where: + * For context see RouteAdditionalConfigurationOptions > validate (RouteValidationConfigurationObject) + * + * Also see ValidationFunctionForRouteResponse + * @param value - the object containing the request headers, query, path params or payload. + * @param options - the server validation options. + * @param next([err, [value]]) - the callback function called when validation is completed. + */ +export interface ValidationFunctionForRouteInput { + (value: any, options: RouteInputValidationContext & ValidationOptions, next: ContinuationValueFunction): void; +} + +/** + * A context for route input validation via a Joi schema or validation function. + * + * This object is merged with the route validation options and passed into the validation function. + * + * See https://github.com/hapijs/hapi/blob/v16.1.1/lib/validation.js#L122 + */ +export interface RouteInputValidationContext { + context: { + // These are only set when *not* validating the respective source (e.g. params, query and payload are set when validating headers): + // See https://github.com/hapijs/hapi/blob/v16.1.1/lib/validation.js#L132 + headers?: Dictionary; + params?: any; + query?: any; + payload?: any; + + /** The request authentication information */ + auth: RequestAuthenticationInformation; + } +} + +/** + * a custom error handler function with the signature 'function(request, reply, source, error)` + * @param request - the request object. + * @param reply - the continuation reply interface. + * @param source - the source of the invalid field (e.g. 'headers', 'params', 'query', 'payload'). + * @param error - the error object prepared for the client response (including the validation function error under error.data). + */ +export interface RouteFailFunction { + (request: Request, reply: ReplyWithContinue, source: string, error: any): void; +} + +/** + * optional cookie settings + * [See docs](https://hapijs.com/api/16.1.1#serverstatename-options) + * Related to see ConnectionConfigurationServerDefaults + */ +export interface ServerStateCookieConfiguationObject { + /** time-to-live in milliseconds. Defaults to null (session time-life - cookies are deleted when the browser is closed). */ + ttl?: number | null; + /** sets the 'Secure' flag. Defaults to true. */ + isSecure?: boolean; + /** sets the 'HttpOnly' flag. Defaults to true. */ + isHttpOnly?: boolean; + /** + * sets the 'SameSite' flag where the value must be one of: + * * false - no flag. + * * 'Strict' - sets the value to 'Strict' (this is the default value). + * * 'Lax' - sets the value to 'Lax'. + */ + isSameSite?: false | 'Strict' | 'Lax'; + /** the path scope. Defaults to null (no path). */ + path?: string | null; + /** the domain scope. Defaults to null (no domain). */ + domain?: string | null; + /** + * if present and the cookie was not received from the client or explicitly set by the route handler, the cookie is automatically added to the response with the provided value. The value can be a function with signature function(request, next) where: + * * request - the request object. + * * next - the continuation function using the function(err, value) signature. + */ + autoValue?(request: Request, next: ContinuationValueFunction): void; + /** + * encoding performs on the provided value before serialization. Options are: + * * 'none' - no encoding. When used, the cookie value must be a string. This is the default value. + * * 'base64' - string value is encoded using Base64. + * * 'base64json' - object value is JSON-stringified then encoded using Base64. + * * 'form' - object value is encoded using the x-www-form-urlencoded method. + * * 'iron' - Encrypts and sign the value using iron. + */ + encoding?: 'none' | 'base64' | 'base64json' | 'form' | 'iron'; + /** + * an object used to calculate an HMAC for cookie integrity validation. This does not provide privacy, only a mean to verify that the cookie value was generated by the server. Redundant when 'iron' encoding is used. Options are: + * * integrity - algorithm options. Defaults to require('iron').defaults.integrity. + * * password - password used for HMAC key generation (must be at least 32 characters long). + */ + sign?: { + integrity?: any; // TODO make iron definitions and getting typing from iron + password: string; + }; + /** password used for 'iron' encoding (must be at least 32 characters long). */ + password?: string; + /** options for 'iron' encoding. Defaults to require('iron').defaults. */ + iron?: any; // TODO make iron definitions and getting typing from iron + /** if true, errors are ignored and treated as missing cookies. */ + ignoreErrors?: boolean; + /** if true, automatically instruct the client to remove invalid cookies. Defaults to false. */ + clearInvalid?: boolean; + /** if false, allows any cookie value including values in violation of RFC 6265. Defaults to true. */ + strictHeader?: boolean; + /** used by proxy plugins (e.g. h2o2). */ + passThrough?: any; +} + +/** + * [See docs](https://hapijs.com/api/16.1.1#serverconnections) + */ +export interface ServerConnection { + /** settings - the connection configuration object passed to server.connection() after applying the server defaults. */ + settings: ServerConnectionOptions; + /** server - the connection's Server object. */ + server: Server; + /** type - set to 'tcp' is the connection is listening on a TCP port, otherwise to 'socket'(a UNIX domain socket or a Windows named pipe). */ + type: 'tcp' | 'socket'; + /** + * registrations + * Described [See docs](https://hapijs.com/api/16.1.1#serverregistrations) "When the server contains more than one connection, each server.connections array member provides its own connection.registrations." + */ + registrations: ServerRegisteredPlugins; + /** states - TODO contribute docs to hapi if they want, and then update type here */ + states: any; + /** auth - TODO contribute docs to hapi if they want, and then update type here */ + auth: any; + /** + * plugins + * TODO contribute docs to hapi if they want. Assuming similar to `registrations`, `listener`, `info`, etc + */ + plugins: PluginsStates; + /** + * app + * TODO contribute docs to hapi if they want. Assuming similar to `registrations`, `listener`, `info`, etc + */ + app: any; + /** Described in server.listener [See docs](https://hapijs.com/api/16.1.1#serverlistener) */ + listener: ServerListener; + /** Described in server.info [See docs](https://hapijs.com/api/16.1.1#serverinfo) */ + info: ServerConnectionInfo; + /** Described in server.inject [See docs](https://hapijs.com/api/16.1.1#serverinjectoptions-callback) */ + inject(options: string | InjectedRequestOptions, callback: (res: InjectedResponseObject) => void): void; + inject(options: string | InjectedRequestOptions, ): Promise; + /** Mentioned but not documented under server.connections [See docs](https://hapijs.com/api/16.1.1#serverconnections) */ + table(host?: string): Route[]; + /** Described in server.table [See docs](https://hapijs.com/api/16.1.1#serverlookupid) */ + lookup(id: string): RoutePublicInterface | null; + /** Described in server.table [See docs](https://hapijs.com/api/16.1.1#servermatchmethod-path-host) */ + match(method: HTTP_METHODS, path: string, host?: string): RoutePublicInterface | null; +} + +/** + * [See docs](https://hapijs.com/api/16.1.1#serverinfo) + */ +export interface ServerConnectionInfo { + /** a unique connection identifier (using the format '{hostname}:{pid}:{now base36}'). */ + id: string; + /** the connection creation timestamp. */ + created: number; + /** the connection start timestamp (0 when stopped). */ + started: number; + /** + * the connection port based on the following rules: + * * the configured port value before the server has been started. + * * the actual port assigned when no port is configured or set to 0 after the server has been started. + * TODO check this type. What happens when socket is a UNIX domain socket or Windows named pipe? + */ + port: number | string; + /** the host name the connection was configured to. Defaults to the operating system hostname when available, otherwise 'localhost'. */ + host: string; + /** the active IP address the connection was bound to after starting. Set to undefined until the server has been started or when using a non TCP port (e.g. UNIX domain socket). */ + address: undefined | string; + /** the protocol used. 'socket' when UNIX domain socket or Windows named pipe. */ + protocol: 'http' | 'https' | 'socket'; + /** a string representing the connection (e.g. 'http://example.com:8080' or 'socket:/unix/domain/socket/path'). Contains the uri setting if provided, otherwise constructed from the available settings. If no port is available or set to 0, the uri will not include a port component. */ + uri: string; +} + +/** + * [See docs](https://hapijs.com/api/16.1.1#serverlistener) + */ +export type ServerListener = http.Server; + +/** + * server.realm + * The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin). Realms are a limited version of a sandbox where plugins can maintain state used by the framework when adding routes, extensions, and other properties. + * [See docs](https://hapijs.com/api/16.1.1#serverrealm) + */ +export interface ServerRealm { + /** when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method and includes: */ + modifiers: { + /** routes preferences: */ + route: { + /** the route path prefix used by any calls to server.route() from the server. Note that if a prefix is used and the route path is set to '/', the resulting path will not include the trailing slash. */ + prefix: string; + /** the route virtual host settings used by any calls to server.route() from the server. */ + vhost: string; + } + }; + /** the active plugin name (empty string if at the server root). */ + plugin: string; + /** the plugin options object passed at registration. */ + pluginOptions: any; // OptionsPassedToPlugin; + /** plugin-specific state to be shared only among activities sharing the same active state. plugins is an object where each key is a plugin name and the value is the plugin state. */ + plugins: PluginsStates; + /** settings overrides (from RouteAdditionalConfigurationOptions) */ + settings: { + files: { + relativeTo: string; + }; + bind: any; + }; +} + +/** + * [See docs](https://hapijs.com/api/16.1.1#serverregistrations) + */ +export interface ServerRegisteredPlugins { + [pluginName: string]: ServerRegisteredPlugin; +} + +/** + * [See docs](https://hapijs.com/api/16.1.1#serverregistrations) + */ +export interface ServerRegisteredPlugin { + /** the plugin version. */ + version: string; + /** the plugin name. */ + name: string; + /** + * options used to register the plugin. + * TODO update with outcome of: https://github.com/hapijs/hapi/pull/3479 + */ + options: any; // OptionsPassedToPlugin; + /** plugin registration attributes. */ + attributes: PluginAttributes; +} + +export interface ServerAuth { + /** + * server.auth.api + * An object where each key is a strategy name and the value is the exposed strategy API. Available on when the authentication scheme exposes an API by returning an api key in the object returned from its implementation function. + * When the server contains more than one connection, each server.connections array member provides its own connection.auth.api object. + * [See docs](https://hapijs.com/api/16.1.1#serverauthapi) + */ + api: Dictionary; + /** + * server.auth.default + * Sets a default strategy which is applied to every route + * The default does not apply when the route config specifies auth as false, or has an authentication strategy configured (contains the strategy or strategies authentication settings). Otherwise, the route authentication config is applied to the defaults. + * Note that if the route has authentication config, the default only applies at the time of adding the route, not at runtime. This means that calling default() after adding a route with some authentication config will have no impact on the routes added prior. However, the default will apply to routes added before default() is called if those routes lack any authentication config. + * The default auth strategy configuration can be accessed via connection.auth.settings.default. To obtain the active authentication configuration of a route, use connection.auth.lookup(request.route). + * [See docs](https://hapijs.com/api/16.1.1#serverauthdefaultoptions) + */ + default(options: string | AuthOptions): void; + /** + * server.auth.scheme + * Registers an authentication scheme + * [See docs](https://hapijs.com/api/16.1.1#serverauthschemename-scheme) + * @param name the scheme name. + * @param scheme the method implementing the scheme with signature function(server, options) see ServerAuthScheme + */ + scheme(name: string, scheme: ServerAuthScheme): void; + /** + * Registers an authentication strategy + * [See docs](https://hapijs.com/api/16.1.1#serverauthstrategyname-scheme-mode-options) + * @param name the strategy name. + * @param scheme the scheme name (must be previously registered using server.auth.scheme()). + * @param mode if set to true (which is the same as 'required') or to a valid authentication mode ('required', 'optional', 'try'), the scheme is automatically assigned as the default strategy for any route without an auth config. Can only be assigned to a single server strategy. Defaults to false (no default settings). + * @param options scheme options based on the scheme requirements. + */ + strategy(name: string, scheme: string, options?: any): void; + strategy(name: string, scheme: string, mode: boolean | 'required' | 'optional' | 'try', options?: any): void; + /** + * Tests a request against an authentication strategy + * Note that the test() method does not take into account the route authentication configuration. It also does not perform payload authentication. It is limited to the basic strategy authentication execution. It does not include verifying scope, entity, or other route properties. + * [See docs](https://hapijs.com/api/16.1.1#serverauthteststrategy-request-next) + * @param strategy - the strategy name registered with server.auth.strategy(). + * @param request - the request object. + * @param next - the callback function with signature function(err, credentials) where: + * * err - the error if authentication failed. + * * credentials - the authentication credentials object if authentication was successful. + */ + test(strategy: string, request: Request, next: (err: Error | null, credentials: AuthenticatedCredentials) => void): void; +} + +export type Strategy = any; +export type SchemeSettings = any; + +/** + * the method implementing the scheme with signature function(server, options) where: + * [See docs](https://hapijs.com/api/16.1.1#serverauthschemename-scheme) + * @param server a reference to the server object the scheme is added to. + * @param options optional scheme settings used to instantiate a strategy. + */ +export interface ServerAuthScheme { + (server: Server, options: SchemeSettings): SchemeMethodResult; +} + +/** + * The scheme method must return an object with the following + * [See docs](https://hapijs.com/api/16.1.1#serverauthschemename-scheme) + */ +export interface SchemeMethodResult { + /** optional object which is exposed via the server.auth.api object. */ + api?: Strategy; + /** + * required function called on each incoming request configured with the authentication scheme + * When the scheme authenticate() method implementation calls reply() with an error condition, the specifics of the error affect whether additional authentication strategies will be attempted (if configured for the route). If the err passed to the reply() method includes a message, no additional strategies will be attempted. If the err does not include a message but does include the scheme name (e.g. Boom.unauthorized(null, 'Custom')), additional strategies will be attempted in the order of preference (defined in the route configuration). If authentication fails the scheme names will be present in the 'WWW-Authenticate' header. + * @param request the request object. + * @param reply the reply interface the authentication method must call when done authenticating the request + */ + authenticate(request: Request, reply: ReplySchemeAuth): void; + /** + * optional function called to authenticate the request payload + * When the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'. + * @param request the request object. + * @param reply is called if authentication failed + */ + payload?(request: Request, reply: ReplySchemeAuthOfPayload): void; + /** + * optional function called to decorate the response with authentication headers before the response headers or payload is written where: + * @param request the request object. + * @param reply is called if an error occured + */ + response?(request: Request, reply: ReplySchemeAuthDecorateResponse): void; + /** an optional object with the following keys: */ + options?: { + /** if true, requires payload validation as part of the scheme and forbids routes from disabling payload auth validation. Defaults to false. */ + payload?: boolean; + }; +} + +export interface ServerCacheMethod { + /** + * Provisions a cache segment within the server cache facility + * [See docs](https://hapijs.com/api/16.1.1#servercacheoptions) + */ + (options: CatboxServerCacheConfiguration): Catbox.Policy; + /** + * Provisions a server cache as described in server.cache + * If no callback is provided, a Promise object is returned. + * Note that if the server has been initialized or started, the cache will be automatically started to match the state of any other provisioned server cache. + * [See docs](https://hapijs.com/api/16.1.1#servercacheprovisionoptions-callback) + * @param options same as the server cache configuration options. + * @param callback the callback method when cache provisioning is completed or failed with the signature function(err) where: + * * err - any cache startup error condition. + */ + provision(options: CatboxServerCacheConfiguration): Promise; + provision(options: CatboxServerCacheConfiguration, callback: (err?: Error) => void): void; +} + +/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Request + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */ +// TODO: move to separate file http://stackoverflow.com/questions/43276921 + +/** + * Request object + * The request object is created internally for each incoming request. It is different from the node.js request object received from the HTTP server callback (which is available in request.raw.req). The request object methods and properties change throughout the request lifecycle. + * [See docs](https://hapijs.com/api/16.1.1#request-object) + * [See docs](https://hapijs.com/api/16.1.1#request-properties) + */ +export class Request extends Podium { + /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name]. */ + app: any; + /** authentication information */ + auth: RequestAuthenticationInformation; + /** the connection the request was received by. */ + connection: ServerConnection; + /** the node domain object used to protect against exceptions thrown in extensions, handlers and route prerequisites. Can be used to manually bind callback functions otherwise bound to other domains. Set to null when the server useDomains options is false. */ + domain: domain.Domain | null; + /** the raw request headers (references request.raw.headers). */ + headers: Dictionary; + /** a unique request identifier (using the format '{now}:{connection.info.id}:{5 digits counter}').*/ + id: string; + /** request information */ + info: { + /** the request preferred encoding. */ + acceptEncoding: string; + /** if CORS is enabled for the route, contains the following: */ + cors: { + /** + * true if the request 'Origin' header matches the configured CORS restrictions. Set to false if no 'Origin' header is found or if it does not match. Note that this is only available after the 'onRequest' extension point as CORS is configured per-route and no routing decisions are made at that point in the request lifecycle. + * Note: marking as optional as "... this is only available after ..." + */ + isOriginMatch?: boolean; + }; + /** content of the HTTP 'Host' header (e.g. 'example.com:8080'). */ + host: string; + /** the hostname part of the 'Host' header (e.g. 'example.com'). */ + hostname: string; + /** request reception timestamp. */ + received: number; + /** content of the HTTP 'Referrer' (or 'Referer') header. */ + referrer: string; + /** remote client IP address. */ + remoteAddress: string; + /** + * remote client port. + * Set to string in casethey're requesting from a UNIX domain socket. + * TODO, what type does Hapi return, should this be number | string? + */ + remotePort: string; + /** request response timestamp (0 is not responded yet). */ + responded: number; + }; + /** the request method in lower case (e.g. 'get', 'post'). */ + method: string; + /** the parsed content-type header. Only available when payload parsing enabled and no payload error occurred. */ + mime: string; + /** an object containing the values of params, query, and payload before any validation modifications made. Only set when input validation is performed. */ + orig: { + params: any; + query: any; + payload: any; + }; + /** an object where each key is a path parameter name with matching value as described in Path parameters [See docs](https://hapijs.com/api/16.1.1#path-parameters). */ + params: Dictionary; + /** an array containing all the path params values in the order they appeared in the path. */ + paramsArray: string[]; + /** the request URI's pathname [See docs](https://nodejs.org/api/url.html#url_urlobject_pathname) component. */ + path: string; + /** + * the request payload based on the route payload.output and payload.parse settings. + * TODO check this typing and add references / links. + */ + payload: stream.Readable | Buffer | any; + /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state. */ + plugins: PluginsStates; + /** an object where each key is the name assigned by a route prerequisites function. The values are the raw values provided to the continuation function as argument. For the wrapped response object, use responses. */ + pre: Object; + /** the response object when set. The object can be modified but must not be assigned another object. To replace the response with another from within an extension point, use reply(response) to override with a different response. Contains null when no response has been set (e.g. when a request terminates prematurely when the client disconnects). */ + response: Response | null; + /** same as pre but represented as the response object created by the pre method. */ + preResponses: Object; + /** + * an object containing the query parameters. + * TODO update with outcome of: https://github.com/hapijs/hapi/pull/3479 + */ + query: Object; + /** an object containing the Node HTTP server objects. **Direct interaction with these raw objects is not recommended.** */ + raw: { + req: http.IncomingMessage; // Or http.ClientRequest http://www.apetuts.com/tutorial/node-js-http-client-request-class/ ? + res: http.ServerResponse; + }; + /** + * the route public interface. + * Optional due to "request.route is not yet populated at this point." [See docs](https://hapijs.com/api/16.1.1#request-lifecycle) + */ + route?: RoutePublicInterface; + /** the server object. */ + server: Server; + /** an object containing parsed HTTP state information (cookies) where each key is the cookie name and value is the matching cookie content after processing using any registered cookie definition. */ + state: Dictionary; + /** the parsed request URI */ + url: url.Url; + + /** + * request.setUrl(url, [stripTrailingSlash]) + * Available only in 'onRequest' extension methods. + * Changes the request URI before the router begins processing the request + * [See docs](https://hapijs.com/api/16.1.1#requestseturlurl-striptrailingslash) + * @param url the new request URI. If url is a string, it is parsed with node's URL parse() method. url can also be set to an object compatible with node's URL parse() method output. + * @param stripTrailingSlash if true, strip the trailing slash from the path. Defaults to false. + */ + setUrl(url: string | url.Url, stripTrailingSlash?: boolean): void; + /** + * request.setMethod(method) + * Available only in 'onRequest' extension methods. + * Changes the request method before the router begins processing the request + * [See docs](https://hapijs.com/api/16.1.1#requestsetmethodmethod) + * @param method is the request HTTP method (e.g. 'GET'). + */ + setMethod(method: HTTP_METHODS): void; + /** + * request.generateResponse(source, [options]) + * Always available. + * Returns a response which you can pass into the reply interface where: + * [See docs](https://hapijs.com/api/16.1.1#requestgenerateresponsesource-options) + * @param source the object to set as the source of the reply interface. TODO, submit a PR to clarify this doc, from the source code it's clear that "the object to set" refers to something of type `ReplyValue` i.e. that can be null, string, number, object, Stream, Promise, or Buffer. + * @param options options for the method, optional. Not documented yet, perhaps not very important. + */ + generateResponse(source?: ReplyValue, options?: {marshal?: any; prepare?: any; close?: any; variety?: any}): Response; + /** + * request.log(tags, [data, [timestamp]]) + * Always available. + * Logs request-specific events. When called, the server emits a 'request' event which can be used by other listeners or plugins. + * Any logs generated by the server internally will be emitted only on the 'request-internal' channel and will include the event.internal flag set to true. + * [See docs](https://hapijs.com/api/16.1.1#requestlogtags-data-timestamp) + * @param tags a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events. + * @param data an optional message string or object with the application data being logged. If data is a function, the function signature is function() and it called once to generate (return value) the actual data emitted to the listeners. + * @param timestamp an optional timestamp expressed in milliseconds. Defaults to Date.now() (now). + */ + log(tags: string | string[], data?: string | Object | (() => string | Object), timestamp?: number): void; + /** + * request.getLog([tags], [internal]) + * Always available. + * Returns an array containing the events matching any of the tags specified (logical OR) + * Note that this methods requires the route log configuration set to true. + * [See docs](https://hapijs.com/api/16.1.1#requestgetlogtags-internal) + * @param tags is a single tag string or array of tag strings. If no tags specified, returns all events. + * @param internal filters the events to only those with a matching event.internal value. If true, only internal logs are included. If false, only user event are included. Defaults to all events (undefined). + */ + getLog(tags?: string | string[], internal?: boolean): string[]; + getLog(internal?: boolean): string[]; + /** + * request.tail([name]) + * Available until immediately after the 'response' event is emitted. + * Adds a request tail which has to complete before the request lifecycle is complete. + * Returns a tail function which must be called when the tail activity is completed. + * Tails are actions performed throughout the request lifecycle, but which may end after a response is sent back to the client. For example, a request may trigger a database update which should not delay sending back a response. However, it is still desirable to associate the activity with the request when logging it (or an error associated with it). + * When all tails completed, the server emits a 'tail' event. + * [See docs](https://hapijs.com/api/16.1.1#requesttailname) + * @param name an optional tail name used for logging purposes. + */ + tail(name?: string): (() => void); + /** + * The server.decorate('request', ...) method can modify this prototype/interface. + * Have disabled these typings as there is a better alternative, see example in: tests/server/decorate.ts + * [And discussion here](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/14517#issuecomment-298891630) + */ + // [index: string]: any; +} + +export interface RequestAuthenticationInformation { + /** true if the request has been successfully authenticated, otherwise false. */ + isAuthenticated: boolean; + /** the credential object received during the authentication process. The presence of an object does not mean successful authentication. */ + credentials: any; + /** an artifact object received from the authentication strategy and used in authentication-related actions. */ + artifacts: any; + /** the route authentication mode. */ + mode: string; + /** the authentication error is failed and mode set to 'try'. */ + error: Error; +} + +export type HTTP_METHODS_PARTIAL_lowercase = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'options'; +export type HTTP_METHODS_PARTIAL = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | HTTP_METHODS_PARTIAL_lowercase; +export type HTTP_METHODS = 'HEAD' | 'head' | HTTP_METHODS_PARTIAL; + +/** + * Request events + * The request object supports the following events: + * * 'peek' - emitted for each chunk of payload data read from the client connection. The event method signature is function(chunk, encoding). + * * 'finish' - emitted when the request payload finished reading. The event method signature is function (). + * * 'disconnect' - emitted when a request errors or aborts unexpectedly. + * [See docs](https://hapijs.com/api/16.1.1#request-events) + */ +export type RequestEventTypes = 'peek' | 'finish' | 'disconnect'; + +/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Handler functions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */ +// TODO: move to separate file http://stackoverflow.com/questions/43276921 + +/** + * Extending RouteConfiguration.handler + * + * The hapi documentation allows for the RouteConfiguration.handler type to have + * `{[pluginName: string]: pluginOptions}` + * "handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler" + * This can be provided by extending the hapi module definition as follows, + * see h2o2 for example: + * + * declare module 'hapi' { + * interface RouteHandlerPlugins { + * proxy?: ... + */ +export interface RouteHandlerPlugins { } /** - * undocumented. The connection object constructed after calling server.connection(); - * can be accessed via server.connections; or request.connection; + * The route handler function uses the signature function(request, reply) (NOTE: do not use a fat arrow style function for route handlers as they do not allow context binding and will cause problems when used in conjunction with server.bind) where: + * * request - is the incoming request object (this is not the node.js request object). + * * reply - the reply interface the handler must call to set a response and return control back to the framework. + * [See docs](https://hapijs.com/api/16.1.1#route-handler) + * Same function signature used by request extension point used in server.ext(event), see ServerExtConfigurationObject.method */ -export class ServerConnection extends Events.EventEmitter { - domain: any; - _events: { route: Function, domain: Function, _events: Function, _eventsCount: Function, _maxListeners: Function }; - _eventsCount: number; - settings: IServerConnectionOptions; - server: Server; - /** ex: "tcp" */ - type: string; - _started: boolean; - /** dictionary of sockets */ - _connections: { [ip_port: string]: any }; - _onConnection: Function; - registrations: any; - _extensions: any; - _requestCounter: { value: number; min: number; max: number }; - _load: any; - states: { - settings: any; cookies: any; names: any[] - }; - auth: { connection: ServerConnection; _schemes: any; _strategies: any; settings: any; api: any; }; - _router: any; - MSPluginsCollection: any; - applicationCache: any; - addEventListener: any; - info: IServerConnectionInfo; +export interface RouteHandler { + (request: Request, reply: ReplyNoContinue): void; + // (request: Request, reply: StrictReply): void; } -export type RequestExtPoints = "onRequest" | "onPreResponse" | "onPreAuth" | "onPostAuth" | "onPreHandler" | "onPostHandler" | "onPreResponse"; -export type ServerExtPoints = "onPreStart" | "onPostStart" | "onPreStop" | "onPostStop"; +/** + * "the function to call, the function signature is identical to a route handler as described in Route handler." + * [See docs](https://hapijs.com/api/16.1.1#route-prerequisites) Route prerequisites + */ +export type RoutePrerequisiteRequestHandler = RouteHandler; -/** Server http://hapijs.com/api#server - rver object is the main application container. The server manages all incoming connections along with all the facilities provided by the framework. A server can contain more than one connection (e.g. listen to port 80 and 8080). - Server events - The server object inherits from Events.EventEmitter and emits the following events: - 'log' - events logged with server.log() and server events generated internally by the framework. - 'start' - emitted when the server is started using server.start(). - 'stop' - emitted when the server is stopped using server.stop(). - 'request' - events generated by request.log(). Does not include any internally generated events. - 'request-internal' - request events generated internally by the framework (multiple events per request). - 'request-error' - emitted whenever an Internal Server Error (500) error response is sent. Single event per request. - 'response' - emitted after the response is sent back to the client (or when the client connection closed and no response sent, in which case request.response is null). Single event per request. - 'tail' - emitted when a request finished processing, including any registered tails. Single event per request. - Note that the server object should not be used to emit application events as its internal implementation is designed to fan events out to the various plugin selections and not for application events. - MORE EVENTS HERE: http://hapijs.com/api#server-events*/ -export class Server extends Events.EventEmitter { - constructor(options?: IServerOptions); - - /** Provides a safe place to store server-specific run-time application data without potential conflicts with the framework internals. The data can be accessed whenever the server is accessible. Initialized with an empty object. - var Hapi = require('hapi'); - server = new Hapi.Server(); - server.app.key = 'value'; - var handler = function (request, reply) { - return reply(request.server.app.key); - }; */ - app: any; - /** An array containing the server's connections. When the server object is returned from server.select(), the connections array only includes the connections matching the selection criteria. - var server = new Hapi.Server(); - server.connection({ port: 80, labels: 'a' }); - server.connection({ port: 8080, labels: 'b' }); - // server.connections.length === 2 - var a = server.select('a'); - // a.connections.length === 1*/ - connections: ServerConnection[]; - /** When the server contains exactly one connection, info is an object containing information about the sole connection. - * When the server contains more than one connection, each server.connections array member provides its own connection.info. - var server = new Hapi.Server(); - server.connection({ port: 80 }); - // server.info.port === 80 - server.connection({ port: 8080 }); - // server.info === null - // server.connections[1].info.port === 8080 - */ - info: IServerConnectionInfo; - /** An object containing the process load metrics (when load.sampleInterval is enabled): - rss - RSS memory usage. - var Hapi = require('hapi'); - var server = new Hapi.Server({ load: { sampleInterval: 1000 } }); - console.log(server.load.rss);*/ - load: { - /** - event loop delay milliseconds.*/ - eventLoopDelay: number; - /** - V8 heap usage.*/ - heapUsed: number; - }; - /** When the server contains exactly one connection, listener is the node HTTP server object of the sole connection. - When the server contains more than one connection, each server.connections array member provides its own connection.listener. - var Hapi = require('hapi'); - var SocketIO = require('socket.io'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - var io = SocketIO.listen(server.listener); - io.sockets.on('connection', function(socket) { - socket.emit({ msg: 'welcome' }); - });*/ - listener: http.Server; - - /** server.methods - An object providing access to the server methods where each server method name is an object property. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.method('add', function (a, b, next) { - return next(null, a + b); - }); - server.methods.add(1, 2, function (err, result) { - // result === 3 - });*/ - methods: IDictionary; - - /** server.mime - Provides access to the server MIME database used for setting content-type information. The object must not be modified directly but only through the mime server setting. - var Hapi = require('hapi'); - var options = { - mime: { - override: { - 'node/module': { - source: 'steve', - compressible: false, - extensions: ['node', 'module', 'npm'], - type: 'node/module' - } - } - } - }; - var server = new Hapi.Server(options); - // server.mime.path('code.js').type === 'application/javascript' - // server.mime.path('file.npm').type === 'node/module'*/ - mime: any; - /**server.plugins - An object containing the values exposed by each plugin registered where each key is a plugin name and the values are the exposed properties by each plugin using server.expose(). Plugins may set the value of the server.plugins[name] object directly or via the server.expose() method. - exports.register = function (server, options, next) { - server.expose('key', 'value'); - // server.plugins.example.key === 'value' - return next(); - }; - exports.register.attributes = { - name: 'example' - };*/ - plugins: IDictionary; - /** server.realm - The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin). Realms are a limited version of a sandbox where plugins can maintain state used by the framework when adding routes, extensions, and other properties. - modifiers - when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method and includes: - route - routes preferences: - prefix - the route path prefix used by any calls to server.route() from the server. - vhost - the route virtual host settings used by any calls to server.route() from the server. - plugin - the active plugin name (empty string if at the server root). - plugins - plugin-specific state to be shared only among activities sharing the same active state. plugins is an object where each key is a plugin name and the value is the plugin state. - settings - settings overrides: - files.relativeTo - bind - The server.realm object should be considered read-only and must not be changed directly except for the plugins property can be directly manipulated by the plugins (each setting its own under plugins[name]). - exports.register = function (server, options, next) { - console.log(server.realm.modifiers.route.prefix); - return next(); - };*/ - realm: IServerRealm; - - /** server.root - The root server object containing all the connections and the root server methods (e.g. start(), stop(), connection()).*/ - root: Server; - /** server.settings - The server configuration object after defaults applied. - var Hapi = require('hapi'); - var server = new Hapi.Server({ - app: { - key: 'value' - } - }); - // server.settings.app === { key: 'value' }*/ - settings: IServerOptions; - - /** server.version - The hapi module version number. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - // server.version === '8.0.0'*/ - version: string; - - /** server.after(method, [dependencies]) - Adds a method to be called after all the plugin dependencies have been registered and before the server starts (only called if the server is started) where: - after - the method with signature function(plugin, next) where: - server - server object the after() method was called on. - next - the callback function the method must call to return control over to the application and complete the registration process. The function signature is function(err) where: - err - internal error which is returned back via the server.start() callback. - dependencies - a string or array of string with the plugin names to call this method after their after() methods. There is no requirement for the other plugins to be registered. Setting dependencies only arranges the after methods in the specified order. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - server.after(function () { - // Perform some pre-start logic - }); - server.start(function (err) { - // After method already executed - }); - server.auth.default(options)*/ - after(method: (plugin: any, next: (err: any) => void) => void, dependencies: string | string[]): void; - - auth: { - /** server.auth.api - An object where each key is a strategy name and the value is the exposed strategy API. Available on when the authentication scheme exposes an API by returning an api key in the object returned from its implementation function. - When the server contains more than one connection, each server.connections array member provides its own connection.auth.api object. - const server = new Hapi.Server(); - server.connection({ port: 80 }); - const scheme = function (server, options) { - return { - api: { - settings: { - x: 5 - } - }, - authenticate: function (request, reply) { - const req = request.raw.req; - const authorization = req.headers.authorization; - if (!authorization) { - return reply(Boom.unauthorized(null, 'Custom')); - } - return reply.continue({ credentials: { user: 'john' } }); - } - }; - }; - server.auth.scheme('custom', scheme); - server.auth.strategy('default', 'custom'); - console.log(server.auth.api.default.settings.x); // 5 - */ - api: { - [index: string]: any; - } - /** server.auth.default(options) - Sets a default strategy which is applied to every route where: - options - a string with the default strategy name or an object with a specified strategy or strategies using the same format as the route auth handler options. - The default does not apply when the route config specifies auth as false, or has an authentication strategy configured. Otherwise, the route authentication config is applied to the defaults. Note that the default only applies at time of route configuration, not at runtime. Calling default() after adding a route will have no impact on routes added prior. - The default auth strategy configuration can be accessed via connection.auth.settings.default. - var server = new Hapi.Server(); - server.connection({ port: 80 }); - server.auth.scheme('custom', scheme); - server.auth.strategy('default', 'custom'); - server.auth.default('default'); - server.route({ - method: 'GET', - path: '/', - handler: function (request, reply) { - return reply(request.auth.credentials.user); - } - });*/ - default(options: string): void; - default(options: { strategy: string }): void; - default(options: { strategies: string[] }): void; - /** server.auth.scheme(name, scheme) - Registers an authentication scheme where: - name - the scheme name. - scheme - the method implementing the scheme with signature function(server, options) where: - server - a reference to the server object the scheme is added to. - options - optional scheme settings used to instantiate a strategy.*/ - scheme( - name: string, - /** - * When the scheme authenticate() method implementation calls reply() with an error condition, the specifics of the error affect whether additional authentication strategies will be attempted if configured for the route. If the err returned by the reply() method includes a message, no additional strategies will be attempted. If the err does not include a message but does include a scheme name (e.g. Boom.unauthorized(null, 'Custom')), additional strategies will be attempted in order of preference. - * n the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'. - * server = new Hapi.Server(); - * server.connection({ port: 80 }); - * scheme = function (server, options) { - * urn { - * authenticate: function (request, reply) { - * req = request.raw.req; - * var authorization = req.headers.authorization; - * if (!authorization) { - * return reply(Boom.unauthorized(null, 'Custom')); - * } - * urn reply(null, { credentials: { user: 'john' } }); - * } - * }; - * }; - */ - scheme: (server: Server, options: any) => IServerAuthScheme): void; - - /** - * server.auth.strategy(name, scheme, [mode], [options]) - * Registers an authentication strategy where: - * name - the strategy name. - * scheme - the scheme name (must be previously registered using server.auth.scheme()). - * mode - if true, the scheme is automatically assigned as a required strategy to any route without an auth config. Can only be assigned to a single server strategy. Value must be true (which is the same as 'required') or a valid authentication mode ('required', 'optional', 'try'). Defaults to false. - * options - scheme options based on the scheme requirements. - * var server = new Hapi.Server(); - * server.connection({ port: 80 }); - * server.auth.scheme('custom', scheme); - * server.auth.strategy('default', 'custom'); - * server.route({ - * method: 'GET', - * path: '/', - * config: { - * auth: 'default', - * handler: function (request, reply) { - * return reply(request.auth.credentials.user); - * } - * } - * }); - */ - strategy(name: string, scheme: string, mode?: boolean | string, options?: any): void; - strategy(name: string, scheme: string, mode?: boolean | string): void; - strategy(name: string, scheme: string, options?: any): void; - - /** server.auth.test(strategy, request, next) - Tests a request against an authentication strategy where: - strategy - the strategy name registered with server.auth.strategy(). - request - the request object. - next - the callback function with signature function(err, credentials) where: - err - the error if authentication failed. - credentials - the authentication credentials object if authentication was successful. - Note that the test() method does not take into account the route authentication configuration. It also does not perform payload authentication. It is limited to the basic strategy authentication execution. It does not include verifying scope, entity, or other route properties. - var server = new Hapi.Server(); - server.connection({ port: 80 }); - server.auth.scheme('custom', scheme); - server.auth.strategy('default', 'custom'); - server.route({ - method: 'GET', - path: '/', - handler: function (request, reply) { - request.server.auth.test('default', request, function (err, credentials) { - if (err) { - return reply({ status: false }); - } - return reply({ status: true, user: credentials.name }); - }); - } - });*/ - test(strategy: string, request: Request, next: (err: any, credentials: any) => void): void; - }; - - /** server.bind(context) - Sets a global context used as the default bind object when adding a route or an extension where: - context - the object used to bind this in handler and extension methods. - When setting context inside a plugin, the context is applied only to methods set up by the plugin. Note that the context applies only to routes and extensions added after it has been set. - var handler = function (request, reply) { - return reply(this.message); - }; - exports.register = function (server, options, next) { - var bind = { - message: 'hello' - }; - server.bind(bind); - server.route({ method: 'GET', path: '/', handler: handler }); - return next(); - };*/ - bind(context: any): void; - - /** server.cache(options) - Provisions a cache segment within the server cache facility where: - options - catbox policy configuration where: - expiresIn - relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. - expiresAt - time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records expire. Uses local time. Cannot be used together with expiresIn. - generateFunc - a function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id, next) where: - id - the id string or object provided to the get() method. - next - the method called when the new item is returned with the signature function(err, value, ttl) where: - err - an error condition. - value - the new value generated. - ttl - the cache ttl value in milliseconds. Set to 0 to skip storing in the cache. Defaults to the cache global policy. - staleIn - number of milliseconds to mark an item stored in cache as stale and attempt to regenerate it when generateFunc is provided. Must be less than expiresIn. - staleTimeout - number of milliseconds to wait before checking if an item is stale. - generateTimeout - number of milliseconds to wait before returning a timeout error when the generateFunc function takes too long to return a value. When the value is eventually returned, it is stored in the cache for future requests. - cache - the cache name configured in 'server.cache`. Defaults to the default cache. - segment - string segment name, used to isolate cached items within the cache partition. When called within a plugin, defaults to '!name' where 'name' is the plugin name. Required when called outside of a plugin. - shared - if true, allows multiple cache provisions to share the same segment. Default to false. - var server = new Hapi.Server(); - server.connection({ port: 80 }); - var cache = server.cache({ segment: 'countries', expiresIn: 60 * 60 * 1000 }); - cache.set('norway', { capital: 'oslo' }, null, function (err) { - cache.get('norway', function (err, value, cached, log) { - // value === { capital: 'oslo' }; - }); - });*/ - cache(options: ICatBoxCachePolicyOptions): void; - - /** server.connection([options]) - Adds an incoming server connection - Returns a server object with the new connection selected. - Must be called before any other server method that modifies connections is called for it to apply to the new connection (e.g. server.state()). - Note that the options object is deeply cloned (with the exception of listener which is shallowly copied) and cannot contain any values that are unsafe to perform deep copy on. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - var web = server.connection({ port: 8000, host: 'example.com', labels: ['web'] }); - var admin = server.connection({ port: 8001, host: 'example.com', labels: ['admin'] }); - // server.connections.length === 2 - // web.connections.length === 1 - // admin.connections.length === 1 */ - connection(options: IServerConnectionOptions): Server; - - /** server.decorate(type, property, method, [options]) - Extends various framework interfaces with custom methods where: - type - the interface being decorated. Supported types: - 'reply' - adds methods to the reply interface. - 'server' - adds methods to the Server object. - property - the object decoration key name. - method - the extension function. - options - if the type is 'request', supports the following optional settings: - 'apply' - if true, the method function is invoked using the signature function(request) where request is the current request object and the returned value is assigned as the decoration. - Note that decorations apply to the entire server and all its connections regardless of current selection. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - server.decorate('reply', 'success', function () { - return this.response({ status: 'ok' }); - }); - server.route({ - method: 'GET', - path: '/', - handler: function (request, reply) { - return reply.success(); - } - });*/ - decorate(type: string, property: string, method: Function, options?: { apply: boolean }): void; - - /** server.dependency(dependencies, [after]) - Used within a plugin to declares a required dependency on other plugins where: - dependencies - a single string or array of plugin name strings which must be registered in order for this plugin to operate. Plugins listed must be registered before the server is started. Does not provide version dependency which should be implemented using npm peer dependencies. - after - an optional function called after all the specified dependencies have been registered and before the server starts. The function is only called if the server is started. If a circular dependency is detected, an exception is thrown (e.g. two plugins each has an after function to be called after the other). The function signature is function(server, next) where: - server - the server the dependency() method was called on. - next - the callback function the method must call to return control over to the application and complete the registration process. The function signature is function(err) where: - err - internal error condition, which is returned back via the server.start() callback. - exports.register = function (server, options, next) { - server.dependency('yar', after); - return next(); - }; - var after = function (server, next) { - // Additional plugin registration logic - return next(); - };*/ - dependency(dependencies: string | string[], after?: (server: Server, next: (err: any) => void) => void): void; - - /** server.expose(key, value) - Used within a plugin to expose a property via server.plugins[name] where: - key - the key assigned (server.plugins[name][key]). - value - the value assigned. - exports.register = function (server, options, next) { - server.expose('util', function () { console.log('something'); }); - return next(); - };*/ - expose(key: string, value: any): void; - - /** server.expose(obj) - Merges a deep copy of an object into to the existing content of server.plugins[name] where: - obj - the object merged into the exposed properties container. - exports.register = function (server, options, next) { - server.expose({ util: function () { console.log('something'); } }); - return next(); - };*/ - expose(obj: any): void; - - /** server.ext(event, method, [options]) - Registers an extension function in one of the available extension points where: - event - the event name. - method - a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is function(request, reply) where: - request - the request object. NOTE: Access the Response via request.response - reply - the reply interface which is used to return control back to the framework. To continue normal execution of the request lifecycle, reply.continue() must be called. To abort processing and return a response to the client, call reply(value) where value is an error or any other valid response. - this - the object provided via options.bind or the current active context set with server.bind(). - options - an optional object with the following: - before - a string or array of strings of plugin names this method must execute before (on the same event). Otherwise, extension methods are executed in the order added. - after - a string or array of strings of plugin names this method must execute after (on the same event). Otherwise, extension methods are executed in the order added. - bind - a context object passed back to the provided method (via this) when called. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - server.ext('onRequest', function (request, reply) { - // Change all requests to '/test' - request.setUrl('/test'); - return reply.continue(); - }); - var handler = function (request, reply) { - return reply({ status: 'ok' }); - }; - server.route({ method: 'GET', path: '/test', handler: handler }); - server.start(); - // All requests will get routed to '/test'*/ - ext(event: RequestExtPoints, method: (request: Request, reply: IReply, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void; - ext(event: RequestExtPoints, method: (request: Request, reply: IStrictReply, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void; - ext(event: ServerExtPoints, method: (server: Server, next: (err?: any) => void, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void; - - /** server.handler(name, method) - Registers a new handler type to be used in routes where: - name - string name for the handler being registered. Cannot override the built-in handler types (directory, file, proxy, and view) or any previously registered type. - method - the function used to generate the route handler using the signature function(route, options) where: - route - the route public interface object. - options - the configuration object provided in the handler config. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ host: 'localhost', port: 8000 }); - // Defines new handler for routes on this server - server.handler('test', function (route, options) { - return function (request, reply) { - return reply('new handler: ' + options.msg); - } - }); - server.route({ - method: 'GET', - path: '/', - handler: { test: { msg: 'test' } } - }); - server.start(); - The method function can have a defaults object or function property. If the property is set to an object, that object is used as the default route config for routes using this handler. If the property is set to a function, the function uses the signature function(method) and returns the route default configuration. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ host: 'localhost', port: 8000 }); - var handler = function (route, options) { - return function (request, reply) { - return reply('new handler: ' + options.msg); - } - }; - // Change the default payload processing for this handler - handler.defaults = { - payload: { - output: 'stream', - parse: false - } - }; - server.handler('test', handler);*/ - handler(name: string, method: (route: IRoute, options: THandlerConfig) => ISessionHandler): void; - - /** server.initialize([callback]) - Initializes the server (starts the caches, finalizes plugin registration) but does not start listening - on the connection ports, where: - - `callback` - the callback method when server initialization is completed or failed with the signature - `function(err)` where: - - `err` - any initialization error condition. - - If no `callback` is provided, a `Promise` object is returned. - - Note that if the method fails and the callback includes an error, the server is considered to be in - an undefined state and should be shut down. In most cases it would be impossible to fully recover as - the various plugins, caches, and other event listeners will get confused by repeated attempts to - start the server or make assumptions about the healthy state of the environment. It is recommended - to assert that no error has been returned after calling `initialize()` to abort the process when the - server fails to start properly. If you must try to resume after an error, call `server.stop()` - first to reset the server state. - */ - initialize(callback?: (error: any) => void): Promise; - - /** When the server contains exactly one connection, injects a request into the sole connection simulating an incoming HTTP request without making an actual socket connection. - Injection is useful for testing purposes as well as for invoking routing logic internally without the overhead or limitations of the network stack. - Utilizes the [shot module | https://github.com/hapijs/shot ] for performing injections, with some additional options and response properties - * When the server contains more than one connection, each server.connections array member provides its own connection.inject(). - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - var handler = function (request, reply) { - return reply('Success!'); - }; - server.route({ method: 'GET', path: '/', handler: handler }); - server.inject('/', function (res) { - console.log(res.result); - }); - */ - inject: IServerInject; - - /** server.log(tags, [data, [timestamp]]) - Logs server events that cannot be associated with a specific request. When called the server emits a 'log' event which can be used by other listeners or plugins to record the information or output to the console. The arguments are: - tags - a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events. Any logs generated by the server internally include the 'hapi' tag along with event-specific information. - data - an optional message string or object with the application data being logged. - timestamp - an optional timestamp expressed in milliseconds. Defaults to Date.now() (now). - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - server.on('log', function (event, tags) { - if (tags.error) { - console.log(event); - } - }); - server.log(['test', 'error'], 'Test event');*/ - log(tags: string | string[], data?: string | any, timestamp?: number): void; - - /**server.lookup(id) - When the server contains exactly one connection, looks up a route configuration where: - id - the route identifier as set in the route options. - returns the route public interface object if found, otherwise null. - var server = new Hapi.Server(); - server.connection(); - server.route({ - method: 'GET', - path: '/', - config: { - handler: function (request, reply) { return reply(); }, - id: 'root' - } - }); - var route = server.lookup('root'); - When the server contains more than one connection, each server.connections array member provides its own connection.lookup() method.*/ - lookup(id: string): IRoute; - - /** server.match(method, path, [host]) - When the server contains exactly one connection, looks up a route configuration where: - method - the HTTP method (e.g. 'GET', 'POST'). - path - the requested path (must begin with '/'). - host - optional hostname (to match against routes with vhost). - returns the route public interface object if found, otherwise null. - var server = new Hapi.Server(); - server.connection(); - server.route({ - method: 'GET', - path: '/', - config: { - handler: function (request, reply) { return reply(); }, - id: 'root' - } - }); - var route = server.match('get', '/'); - When the server contains more than one connection, each server.connections array member provides its own connection.match() method.*/ - match(method: string, path: string, host?: string): IRoute; - - /** server.method(name, method, [options]) - Registers a server method. Server methods are functions registered with the server and used throughout the application as a common utility. Their advantage is in the ability to configure them to use the built-in cache and share across multiple request handlers without having to create a common module. - Methods are registered via server.method(name, method, [options]) - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - // Simple arguments - var add = function (a, b, next) { - return next(null, a + b); - }; - server.method('sum', add, { cache: { expiresIn: 2000 } }); - server.methods.sum(4, 5, function (err, result) { - console.log(result); - }); - // Object argument - var addArray = function (array, next) { - var sum = 0; - array.forEach(function (item) { - sum += item; - }); - return next(null, sum); - }; - server.method('sumObj', addArray, { - cache: { expiresIn: 2000 }, - generateKey: function (array) { - return array.join(','); - } - }); - server.methods.sumObj([5, 6], function (err, result) { - console.log(result); - }); - // Synchronous method with cache - var addSync = function (a, b) { - return a + b; - }; - server.method('sumSync', addSync, { cache: { expiresIn: 2000 }, callback: false }); - server.methods.sumSync(4, 5, function (err, result) { - console.log(result); - }); */ - method(/** a unique method name used to invoke the method via server.methods[name]. When configured with caching enabled, server.methods[name].cache.drop(arg1, arg2, ..., argn, callback) can be used to clear the cache for a given key. Supports using nested names such as utils.users.get which will automatically create the missing path under server.methods and can be accessed for the previous example via server.methods.utils.users.get.*/ - name: string, - method: IServerMethod, - options?: IServerMethodOptions): void; - - /**server.method(methods) - Registers a server method function as described in server.method() using a configuration object where: - methods - an object or an array of objects where each one contains: - name - the method name. - method - the method function. - options - optional settings. - var add = function (a, b, next) { - next(null, a + b); - }; - server.method({ - name: 'sum', - method: add, - options: { - cache: { - expiresIn: 2000 - } - } - });*/ - method(methods: { - name: string; method: IServerMethod; options?: IServerMethodOptions - } | Array<{ - name: string; method: IServerMethod; options?: IServerMethodOptions - }>): void; - - /**server.path(relativeTo) - Sets the path prefix used to locate static resources (files and view templates) when relative paths are used where: - relativeTo - the path prefix added to any relative file path starting with '.'. - Note that setting a path within a plugin only applies to resources accessed by plugin methods. If no path is set, the connection files.relativeTo configuration is used. The path only applies to routes added after it has been set. - exports.register = function (server, options, next) { - server.path(__dirname + '../static'); - server.route({ path: '/file', method: 'GET', handler: { file: './test.html' } }); - next(); - };*/ - path(relativeTo: string): void; - - /** - * server.register(plugins, [options], callback) - * Registers a plugin where: - * plugins - an object or array of objects where each one is either: - * a plugin registration function. - * an object with the following: - * register - the plugin registration function. - * options - optional options passed to the registration function when called. - * options - optional registration options (different from the options passed to the registration function): - * select - a string or array of string labels used to pre-select connections for plugin registration. - * routes - modifiers applied to each route added by the plugin: - * prefix - string added as prefix to any route path (must begin with '/'). If a plugin registers a child plugin the prefix is passed on to the child or is added in front of the child-specific prefix. - * vhost - virtual host string (or array of strings) applied to every route. The outer-most vhost overrides the any nested configuration. - * callback - the callback function with signature function(err) where: - * err - an error returned from the registration function. Note that exceptions thrown by the registration function are not handled by the framework. - * - * If no callback is provided, a Promise object is returned. - */ - register( - plugins: any | any[], - options: { - select: string | string[]; - routes: { - prefix: string; vhost?: string | string[] - }; - }, - callback: (err: any) => void): void; - register( - plugins: any | any[], - options: { - select: string | string[]; - routes: { - prefix: string; vhost?: string | string[] - }; - }): Promise; - - register(plugins: any | any[], callback: (err: any) => void): void; - register(plugins: any | any[]): Promise; - - /**server.render(template, context, [options], callback) - Utilizes the server views manager to render a template where: - template - the template filename and path, relative to the views manager templates path (path or relativeTo). - context - optional object used by the template to render context-specific result. Defaults to no context ({}). - options - optional object used to override the views manager configuration. - callback - the callback function with signature function (err, rendered, config) where: - err - the rendering error if any. - rendered - the result view string. - config - the configuration used to render the template. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - server.views({ - engines: { html: require('handlebars') }, - path: __dirname + '/templates' - }); - var context = { - title: 'Views Example', - message: 'Hello, World' - }; - server.render('hello', context, function (err, rendered, config) { - console.log(rendered); - });*/ - render(template: string, context: any, options: any, callback: (err: any, rendered: any, config: any) => void): void; - - /** server.route(options) - Adds a connection route where: - options - a route configuration object or an array of configuration objects. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - server.route({ method: 'GET', path: '/', handler: function (request, reply) { return reply('ok'); } }); - server.route([ - { method: 'GET', path: '/1', handler: function (request, reply) { return reply('ok'); } }, - { method: 'GET', path: '/2', handler: function (request, reply) { return reply('ok'); } } - ]);*/ - route(options: IRouteConfiguration): void; - route(options: IRouteConfiguration[]): void; - - /**server.select(labels) - Selects a subset of the server's connections where: - labels - a single string or array of strings of labels used as a logical OR statement to select all the connections with matching labels in their configuration. - Returns a server object with connections set to the requested subset. Selecting again on a selection operates as a logic AND statement between the individual selections. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80, labels: ['a'] }); - server.connection({ port: 8080, labels: ['b'] }); - server.connection({ port: 8081, labels: ['c'] }); - server.connection({ port: 8082, labels: ['c','d'] }); - var a = server.select('a'); // The server with port 80 - var ab = server.select(['a','b']); // A list of servers containing the server with port 80 and the server with port 8080 - var c = server.select('c'); // A list of servers containing the server with port 8081 and the server with port 8082 */ - select(labels: string | string[]): Server | Server[]; - - /** server.start([callback]) - Starts the server connections by listening for incoming requests on the configured port of each listener (unless the connection was configured with autoListen set to false), where: - callback - optional callback when server startup is completed or failed with the signature function(err) where: - err - any startup error condition. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - server.start(function (err) { - console.log('Server started at: ' + server.info.uri); - });*/ - start(callback?: (err: any) => void): Promise; - - /** server.state(name, [options]) - HTTP state management uses client cookies to persist a state across multiple requests. Registers a cookie definitions - State defaults can be modified via the server connections.routes.state configuration option. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - // Set cookie definition - server.state('session', { - ttl: 24 * 60 * 60 * 1000, // One day - isSecure: true, - path: '/', - encoding: 'base64json' - }); - // Set state in route handler - var handler = function (request, reply) { - var session = request.state.session; - if (!session) { - session = { user: 'joe' }; - } - session.last = Date.now(); - return reply('Success').state('session', session); - }; - Registered cookies are automatically parsed when received. Parsing rules depends on the route state.parse configuration. If an incoming registered cookie fails parsing, it is not included in request.state, regardless of the state.failAction setting. When state.failAction is set to 'log' and an invalid cookie value is received, the server will emit a 'request-internal' event. To capture these errors subscribe to the 'request-internal' events and filter on 'error' and 'state' tags: - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - server.on('request-internal', function (request, event, tags) { - if (tags.error && tags.state) { - console.error(event); - } - }); */ - state(name: string, options?: ICookieSettings): void; - - /** server.stop([options], [callback]) - Stops the server's connections by refusing to accept any new connections or requests (existing connections will continue until closed or timeout), where: - options - optional object with: - timeout - overrides the timeout in millisecond before forcefully terminating a connection. Defaults to 5000 (5 seconds). - callback - optional callback method with signature function() which is called once all the connections have ended and it is safe to exit the process. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80 }); - server.stop({ timeout: 60 * 1000 }, function () { - console.log('Server stopped'); - });*/ - stop(options?: { timeout: number }, callback?: () => void): Promise; - - /**server.table([host]) - Returns a copy of the routing table where: - host - optional host to filter routes matching a specific virtual host. Defaults to all virtual hosts. - The return value is an array where each item is an object containing: - info - the connection.info the connection the table was generated for. - labels - the connection labels. - table - an array of routes where each route contains: - settings - the route config with defaults applied. - method - the HTTP method in lower case. - path - the route path. - Note that if the server has not been started and multiple connections use port 0, the table items will override each other and will produce an incomplete result. - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80, host: 'example.com' }); - server.route({ method: 'GET', path: '/example', handler: function (request, reply) { return reply(); } }); - var table = server.table(); - When calling connection.table() directly on each connection, the return value is the same as the array table item value of an individual connection: - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.connection({ port: 80, host: 'example.com' }); - server.route({ method: 'GET', path: '/example', handler: function (request, reply) { return reply(); } }); - var table = server.connections[0].table(); - //[ - // { - // method: 'get', - // path: '/example', - // settings: { ... } - // } - //] - */ - table(host?: any): IConnectionTable; - - /**server.views(options) - Initializes the server views manager - var Hapi = require('hapi'); - var server = new Hapi.Server(); - server.views({ - engines: { - html: require('handlebars'), - jade: require('jade') - }, - path: '/static/templates' - }); - When server.views() is called within a plugin, the views manager is only available to plugins methods.*/ - views(options: IServerViewsConfiguration): void; +/** + * request extension points: function(request, reply) where + * this - the object provided via options.bind or the current active context set with server.bind(). + * [See docs](https://hapijs.com/api/16.1.1#serverextevents) + * @param request the request object. + * @param reply the reply interface which is used to return control back to the framework. To continue normal execution of the request lifecycle, reply.continue() must be called. If the extension type is 'onPostHandler' or 'onPreResponse', a single argument passed to reply.continue() will override the current set response (including all headers) but will not stop the request lifecycle execution. To abort processing and return a response to the client, call reply(value) where value is an error or any other valid response. + */ +export interface ServerExtRequestHandler { + (request: Request, reply: ReplyWithContinue): void; +} + +/** + * Used by various extensions to handle a request and + * synchronously return a result of some form. + * + * Left in for backwards compatibility of typings but according to the + * [DefinitelyTyped Readme under common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped#common-mistakes) + * it talks about not using generic types unless the type was used in typing one + * or more of the function arguments. Using it to type the return was suggested + * to be the same as a type assertion. + */ +export interface RequestHandler { + (request: Request): T; +} + +/** + * Used by server extension points + * err can be `Boom` error or Error that will be wrapped as a `Boom` error + * For source [See code](https://github.com/hapijs/hapi/blob/v16.1.1/lib/reply.js#L109-L118) + * For source [See code](https://github.com/hapijs/hapi/blob/v16.1.1/lib/response.js#L60-L65) + */ +export interface ContinuationFunction { + (err?: Boom.BoomError): void; +} +/** + * For source [See docs](https://github.com/hapijs/hapi/blob/v16.1.1/lib/response.js#L60-L65) + * TODO Can value be typed with a useful generic? + */ +export interface ContinuationValueFunction { + (err: Boom.BoomError): void; + (err: null | undefined, value: any): void; + (): void; +} + +/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Reply functions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */ +// TODO: move to separate file http://stackoverflow.com/questions/43276921 + +/** + * Typings listed explicitly here [See docs](https://hapijs.com/api/16.1.1#replyerr-result) + * Typings also described in part here [See docs](https://hapijs.com/api/16.1.1#response-object) + */ +export type ReplyValue = _ReplyValue | Promise<_ReplyValue>; +export type _ReplyValue = null | undefined | string | number | boolean | Buffer | Error | stream.Stream | Object; // | array; + +/** + * Reply interface + * reply([err], [result]) + * Concludes the handler activity by setting a response and returning control over to the framework + * When reply() is called with an error or result response, that value is used as the response sent to the client. When reply() is called within a prerequisite, the value is saved for future use and is not used as the response. In all other places except for the handler, calling reply() will be considered an error and will abort the request lifecycle, jumping directly to the 'onPreResponse' event. + * To return control to the framework within an extension or other places other than the handler, without setting a response, the method reply.continue() must be called. Except when used within an authentication strategy, or in an 'onPostHandler' or 'onPreResponse' extension, the reply.continue() must not be passed any argument or an exception is thrown. + * [See docs](https://hapijs.com/api/16.1.1#reply-interface) + * [See docs](https://hapijs.com/api/16.1.1#replyerr-result) + * + * NOTE: modules should extend this interface to expose reply.Nnn methods + */ +export interface Base_Reply { + (err?: ReplyValue): Response; + (err: null, result?: ReplyValue): Response; + /** the active realm associated with the route. */ + realm: ServerRealm; + /** the request object */ + request: Request; + + /** + * reply.entity(options) + * Sets the response 'ETag' and 'Last-Modified' headers and checks for any conditional request headers to decide if the response is going to qualify for an HTTP 304 (Not Modified). If the entity values match the request conditions, reply.entity() returns control back to the framework with a 304 response. Otherwise, it sets the provided entity headers and returns null. + * Returns a response object if the reply is unmodified or null if the response has changed. If null is returned, the developer must call reply() to continue execution. If the response is not null, the developer must not call reply(). + * [See docs](https://hapijs.com/api/16.1.1#replyentityoptions) + * @param options a required configuration object with: + * * etag - the ETag string. Required if modified is not present. Defaults to no header. + * * modified - the Last-Modified header value. Required if etag is not present. Defaults to no header. + * * vary - same as the response.etag() option. Defaults to true. + */ + entity(options: {etag?: string, modified?: string, vary?: boolean}): Response | null; + /** + * reply.close([options]) + * Concludes the handler activity by returning control over to the router and informing the router that a response has already been sent back directly via request.raw.res and that no further response action is needed. Supports the following optional options: + * The response flow control rules do not apply. + * [See docs](https://hapijs.com/api/16.1.1#replycloseoptions) + * @param options options object: + * * end - if false, the router will not call request.raw.res.end()) to ensure the response was ended. Defaults to true. + */ + close(options?: {end?: boolean}): void; + /** + * reply.redirect(uri) + * Redirects the client to the specified uri. Same as calling reply().redirect(uri). + * The response flow control rules apply. + * Sets an HTTP redirection response (302) and decorates the response with additional methods for + * changing to a permanent or non-rewritable redirect is also available see response object redirect for more information. + * [See docs](https://hapijs.com/api/16.1.1#replyredirecturi) + * @param uri an absolute or relative URI used to redirect the client to another resource. + */ + redirect(uri: string): ResponseRedirect; + /** + * reply.response(result) + * Shorthand for calling `reply(null, result)`, replies with the response set to `result`. + * [See docs](https://hapijs.com/api/16.1.1#replyresponseresult) + * TODO likely to change. Await approval of pull request to Hapi docs. + */ + response(result: ReplyValue): Response; + /** + * Sets a cookie on the response + * [See docs](https://hapijs.com/api/16.1.1#reply) + * TODO likely to change. Await approval of pull request to Hapi docs. + */ + state(name: string, value: any, options?: any): void; + /** + * Clears a cookie on the response + * [See docs](https://hapijs.com/api/16.1.1#reply) + * TODO likely to change. Await approval of pull request to Hapi docs. + */ + unstate(name: string, options?: any): void; + /** + * The server.decorate('reply', ...) method can modify this prototype/interface. + * Have disabled these typings as there is a better alternative, see example in: tests/server/decorate.ts + * [And discussion here](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/14517#issuecomment-298891630) + */ + // [index: string]: any; +} +/** + * reply.continue([result]) + * Returns control back to the framework without ending the request lifecycle + * [See docs](https://hapijs.com/api/16.1.1#replycontinueresult) + * [See docs](https://hapijs.com/api/16.1.1#replyerr-result) "With the exception of the handler function, all other methods provide the reply.continue() method which instructs the framework to continue processing the request without setting a response." + * @param result if called in the handler, prerequisites, or extension points other than the 'onPreHandler' and 'onPreResponse', the result argument is not allowed and will throw an exception if present. If called within an authentication strategy, it sets the authenticated credentials. If called by the 'onPreHandler' or 'onPreResponse' extensions, the result argument overrides the current response including all headers, and returns control back to the framework to continue processing any remaining extensions. + */ +export interface Continue_Reply { + continue(result?: ReplyValue): Response | undefined; +} + +/** + * [See docs](https://hapijs.com/api/16.1.1#serverauthschemename-scheme) > authenticate. + * Also [See docs](https://hapijs.com/api/16.1.1#replyerr-result). + * TODO check it has Base_Reply methods and properties + */ +export interface ReplySchemeAuth extends Base_Reply { + /** + * This function is called if authentication failed. + * TODO, check type the `response` parameter. In https://hapijs.com/api/16.1.1#replyerr-result it is referred to as "null" but this seems to be for a third scenario where it is "used to return both an error and credentials in the authentication methods" then "reply() must be called with three arguments function(err, null, data)" + * @param err any authentication error. + * @param response any authentication response action such as redirection. Ignored if err is present, otherwise required. + * @param result an object containing: + * * credentials the authenticated credentials. + * * artifacts optional authentication artifacts. + */ + (err: Error | null, response: AnyAuthenticationResponseAction | null, result: AuthenticationResult): void; + /** + * is called if authentication succeeded + * @param result same object as result above. + */ + continue(result: AuthenticationResult): void; +} +/** + * Typing as any as it's not yet clear what type this argument takes. + * "any authentication response action such as redirection" is it equivalent to + * `ReplyValue` ? + * [See docs](https://hapijs.com/api/16.1.1#serverauthschemename-scheme) + * TODO research hapi source and type this. + */ +export type AnyAuthenticationResponseAction = any; +/** [See docs](https://hapijs.com/api/16.1.1#serverauthschemename-scheme) */ +export interface AuthenticationResult { + credentials?: AuthenticatedCredentials; + artifacts?: any; +} +export interface AuthenticatedCredentials { + // Disabled to allow typing within a project + // [index: string]: any; +} + +/** + * [See docs](https://hapijs.com/api/16.1.1#serverauthschemename-scheme) > payload + * TODO check it has Base_Reply methods and properties + */ +export interface ReplySchemeAuthOfPayload extends Base_Reply { + /** + * function called to authenticate the request payload where: + * @param err any authentication error. + * @param response any authentication response action such as redirection. Ignored if err is present, otherwise required. + */ + (err: Error | null, response: AnyAuthenticationResponseAction): void; + /** is called if payload authentication succeeded */ + continue(): void; +} + +/** + * [See docs](https://hapijs.com/api/16.1.1#serverauthschemename-scheme) > response + * TODO check it has Base_Reply methods and properties + */ +export interface ReplySchemeAuthDecorateResponse extends Base_Reply { + /** + * is called if an error occurred + * @param err any authentication error. + * @param response any authentication response to send instead of the current response. Ignored if err is present, otherwise required. + */ + (err?: Error, response?: ReplyValue): void; + /** is called if the operation succeeded. */ + continue(): void; +} + +export interface ReplyWithContinue extends Continue_Reply, Base_Reply {} + +export interface ReplyNoContinue extends Base_Reply {} + +// TODO assess use and usefulness of StrictReply + +// Concludes the handler activity by setting a response and returning control over to the framework where: +// erran optional error response. +// result an optional response payload. +// Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first. +// FLOW CONTROL: +// When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() +/** + * + */ +// export interface Reply { // extends ReplyMethods { +// (err: Error, +// result?: string | number | boolean | Buffer | stream.Stream | Promise | T, +// /** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */ +// credentialData?: any): BoomError; +// /** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */ +// (result: string | number | boolean | Buffer | stream.Stream | Promise | T): Response; +// } + +/** Concludes the handler activity by setting a response and returning control over to the framework where: + erran optional error response. + result an optional response payload. + Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first. + FLOW CONTROL: + When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */ +// export interface StrictReply extends ReplyMethods { +// (err: Error, +// result?: Promise | T, +// /** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */ +// credentialData?: any): BoomError; +// /** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */ +// (result: Promise | T): Response; +// } + +/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Response + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */ +// TODO: move to separate file http://stackoverflow.com/questions/43276921 + +/** + * Response object + * [See docs](https://hapijs.com/api/16.1.1#response-object) + * + * TODO, check extending from Podium is correct. Extending because of "The response object supports the following events" [See docs](https://hapijs.com/api/16.1.1#response-events) + * * 'peek' - emitted for each chunk of data written back to the client connection. The event method signature is function(chunk, encoding). + * * 'finish' - emitted when the response finished writing but before the client response connection is ended. The event method signature is function (). + */ +export interface Response extends Podium { + /** the HTTP response status code. Defaults to 200 (except for errors). */ + statusCode: number; + /** an object containing the response headers where each key is a header field name. Note that this is an incomplete list of headers to be included with the response. Additional headers will be added once the response is prepared for transmission. */ + headers: Dictionary; + /** the value provided using the reply interface. */ + source: ReplyValue; + /** + * a string indicating the type of source with available values: + * * 'plain' - a plain response such as string, number, null, or simple object (e.g. not a Stream, Buffer, or view). + * * 'buffer' - a Buffer. + * * 'stream' - a Stream. + * * 'promise' - a Promise object. + */ + variety: 'plain' | 'buffer' | 'stream' | 'promise'; + /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name]. */ + app: any; + /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state. */ + plugins: PluginsStates; + /** response handling flags: */ + settings: { + /** the 'Content-Type' HTTP header 'charset' property. Defaults to 'utf-8'. */ + charset: string; + /** the string encoding scheme used to serial data into the HTTP payload when source is a string or marshals into a string. Defaults to 'utf8'. */ + encoding: string; + /** if true and source is a Stream, copies the statusCode and headers of the stream to the outbound response. Defaults to true. */ + passThrough: boolean; + /** options used for source value requiring stringification. Defaults to no replacer and no space padding. */ + stringify: Json.StringifyArguments; + /** if set, overrides the route cache expiration milliseconds value set in the route config. Defaults to no override. */ + ttl: number | null; + /** if true, a suffix will be automatically added to the 'ETag' header at transmission time (separated by a '-' character) when the HTTP 'Vary' header is present. */ + varyEtag: boolean; + }; + + /** + * The following attribute is present in one or more of the examples + * TODO update once Hapi docs describes explicitly + */ + isBoom?: boolean; + /** + * The following attribute is present in one or more of the examples + * TODO update once Hapi docs describes explicitly + */ + isMissing?: boolean; + /** + * The following attribute is present in one or more of the examples + * TODO update once Hapi docs describes explicitly + */ + output?: Boom.Output; + + /** + * sets the HTTP 'Content-Length' header (to avoid chunked transfer encoding) + * @param length the header value. Must match the actual payload size. + */ + bytes(length: number): Response; + /** + * sets the 'Content-Type' HTTP header 'charset' property + * @param charset the charset property value. + */ + charset(charset: string): Response; + /** + * sets the HTTP status code + * @param statusCode the HTTP status code (e.g. 200). + */ + code(statusCode: number): Response; + /** + * sets the HTTP status message + * @param httpMessage the HTTP status message (e.g. 'Ok' for status code 200). + */ + message(httpMessage: string): Response; + /** + * sets the HTTP status code to Created (201) and the HTTP 'Location' header + * @param uri an absolute or relative URI used as the 'Location' header value. + */ + created(uri: string): Response; + /** + * sets the string encoding scheme used to serial data into the HTTP payload + * @param encoding the encoding property value (see node Buffer encoding [See docs](https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings)). + * * 'ascii' - for 7-bit ASCII data only. This encoding is fast and will strip the high bit if set. + * * 'utf8' - Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8. + * * 'utf16le' - 2 or 4 bytes, little-endian encoded Unicode characters. Surrogate pairs (U+10000 to U+10FFFF) are supported. + * * 'ucs2' - Alias of 'utf16le'. + * * 'base64' - Base64 encoding. When creating a Buffer from a string, this encoding will also correctly accept "URL and Filename Safe Alphabet" as specified in RFC4648, Section 5. + * * 'latin1' - A way of encoding the Buffer into a one-byte encoded string (as defined by the IANA in RFC1345, page 63, to be the Latin-1 supplement block and C0/C1 control codes). + * * 'binary' - Alias for 'latin1'. + * * 'hex' - Encode each byte as two hexadecimal characters. + */ + encoding(encoding: 'ascii' | 'utf8' | 'utf16le' | 'ucs2' | 'base64' | 'latin1' | 'binary' | 'hex'): Response; + /** + * sets the representation entity tag + * @param tag the entity tag string without the double-quote. + * @param options options object + * * weak - if true, the tag will be prefixed with the 'W/' weak signifier. Weak tags will fail to match identical tags for the purpose of determining 304 response status. Defaults to false. + * * vary - if true and content encoding is set or applied to the response (e.g 'gzip' or 'deflate'), the encoding name will be automatically added to the tag at transmission time (separated by a '-' character). Ignored when weak is true. Defaults to true. + */ + etag(tag: string, options?: {weak: boolean, vary: boolean}): Response; + /** + * sets an HTTP header + * @param name the header name. + * @param value the header value. + */ + header(name: string, value: string, options?: ResponseHeaderOptionsObject): Response; + /** + * sets the HTTP 'Location' header + * @param uri an absolute or relative URI used as the 'Location' header value. + */ + location(uri: string): Response; + /** + * sets an HTTP redirection response (302) and decorates the response with additional methods listed below, + * @param uri an absolute or relative URI used to redirect the client to another resource. + */ + redirect(uri: string): Response; + /** + * sets the JSON.stringify() replacer argument + * @param method the replacer function or array. Defaults to none. + */ + replacer(method: Json.StringifyReplacer): Response; + /** + * sets the JSON.stringify() space argument + * @param count the number of spaces to indent nested object keys. Defaults to no indentation. + */ + spaces(count: Json.StringifySpace): Response; + /** + * sets an HTTP cookie + * @param name the cookie name. + * @param value the cookie value. If no encoding is defined, must be a string. + * @param options optional configuration. If the state was previously registered with the server using server.state(), the specified keys in options override those same keys in the server definition (but not others). + */ + state(name: string, value: string | Object | any[], options?: ServerStateCookieConfiguationObject): Response; + /** + * sets a string suffix when the response is process via JSON.stringify(). + */ + suffix(suffix: string): Response; + /** + * overrides the default route cache expiration rule for this response instance + * @param msec the time-to-live value in milliseconds. + */ + ttl(msec: number): Response; + /** + * sets the HTTP 'Content-Type' header + * @param mimeType is the mime type. Should only be used to override the built-in default for each response type. + */ + type(mimeType: string): Response; + /** + * clears the HTTP cookie by setting an expired value + * @param name the cookie name. + * @param options optional configuration for expiring cookie. If the state was previously registered with the server using server.state(), the specified keys in options override those same keys in the server definition (but not others). + */ + unstate(name: string, options?: ServerStateCookieConfiguationObject): Response; + /** + * adds the provided header to the list of inputs affected the response generation via the HTTP 'Vary' header + * @param header the HTTP request header name. + */ + vary(header: string): Response; + + /** + * Flow control - hold() + * When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: + * puts the response on hold until response.send() is called. Available only after reply() is called and until response.hold() is invoked once. + * [See docs](https://hapijs.com/api/16.1.1#flow-control) + */ + hold(): Response; + /** + * Flow control - send() + * When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: + * immediately resume the response. Available only after response.hold() is called and until response.send() is invoked once. + * [See docs](https://hapijs.com/api/16.1.1#flow-control) + */ + send(): Response; + + /** + * Mentioned here: "Note that prerequisites do not follow the same rules of the normal reply interface. In all other cases, calling reply() with or without a value will use the result as the response sent back to the client. In a prerequisite method, calling reply() will assign the returned value to the provided assign key. If the returned value is an error, the failAction setting determines the behavior. To force the return value as the response and skip any other prerequisites and the handler, use the reply().takeover() method." + * TODO prepare documentation PR and submit to hapi. + * [See docs](https://hapijs.com/api/16.1.1#route-prerequisites) + */ + takeover(): Response; +} + +/** + * Response Object Redirect Methods + * When using the redirect() method, the response object provides these additional methods: + * [See docs](https://hapijs.com/api/16.1.1#response-object-redirect-methods) + */ +export interface ResponseRedirect extends Response { + /** + * temporary + * sets the status code to 302 or 307 (based on the rewritable() setting) where: + * [See docs](https://hapijs.com/api/16.1.1#response-object-redirect-methods) + * @param isTemporary if false, sets status to permanent. Defaults to true. + */ + temporary(isTemporary: boolean): Response; + /** + * permanent + * sets the status code to 301 or 308 (based on the rewritable() setting) where: + * [See docs](https://hapijs.com/api/16.1.1#response-object-redirect-methods) + * @param isPermanent if false, sets status to temporary. Defaults to true. + */ + permanent(isPermanent: boolean): Response; + /** + * rewritable + * sets the status code to 301/302 for rewritable (allows changing the request method from 'POST' to 'GET') or 307/308 for non-rewritable (does not allow changing the request method from 'POST' to 'GET'). Exact code based on the temporary() or permanent() setting. Arguments: + * [See docs](https://hapijs.com/api/16.1.1#response-object-redirect-methods) + * @param isRewritable if false, sets to non-rewritable. Defaults to true. + */ + rewritable(isRewritable: boolean): Response; +} + +/** + * [See docs](https://hapijs.com/api/16.1.1#response-object) under "response object provides the following methods" > header > options + */ +export interface ResponseHeaderOptionsObject { + /** if true, the value is appended to any existing header value using separator. Defaults to false. */ + append?: boolean; + /** string used as separator when appending to an existing value. Defaults to ','. */ + separator?: string; + /** if false, the header value is not set if an existing value present. Defaults to true. */ + override?: boolean; + /** if false, the header value is not modified if the provided value is already included. Does not apply when append is false or if the name is 'set-cookie'. Defaults to true. */ + duplicate?: boolean; +} + +/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Plugins and register + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */ +// TODO: move to separate file http://stackoverflow.com/questions/43276921 + +/** + * Plugins + * Plugins provide a way to organize the application code by splitting the server logic into smaller components. Each plugin can manipulate the server and its connections through the standard server interface, but with the added ability to sandbox certain properties. + * [See docs](https://hapijs.com/api/16.1.1#plugins) + * @param server the server object the plugin is being registered to. + * @param options an options object passed to the plugin during registration. + * @param next a callback method the function must call to return control back to the framework to complete the registration process with signature function(err) + */ +export interface PluginFunction { + (server: Server, options: OptionsPassedToPlugin, next: (err?: Error) => void): void; + /** + * Note attributes is NOT optional but this type is easier to use. + */ + attributes?: PluginAttributes; +} + +/** + * see Plugin + * [See docs](https://hapijs.com/api/16.1.1#plugins) + */ +export interface PluginAttributes { + /** + * required plugin name string. The name is used as a unique key. Published plugins should use the same name as the name field in the 'package.json' file. Names must be unique within each application. + * NOTE: marked as optional as `pkg` can be used instead. + */ + name?: string; + /** optional plugin version. The version is only used informatively to enable other plugins to find out the versions loaded. The version should be the same as the one specified in the plugin's 'package.json' file. */ + version?: string; + /** Alternatively, the name and version can be included via the pkg attribute containing the 'package.json' file for the module which already has the name and version included */ + pkg?: any; + /** if true, allows the plugin to be registered multiple times with the same server. Defaults to false. */ + multiple?: boolean; + /** optional string or array of string indicating a plugin dependency. Same as setting dependencies via server.dependency(). */ + dependencies?: string | string[]; + /** if false, does not allow the plugin to call server APIs that modify the connections such as adding a route or configuring state. This flag allows the plugin to be registered before connections are added and to pass dependency requirements. When set to 'conditional', the mode is based on the presence of selected connections (if the server has connections, it is the same as true, but if no connections are available, it is the same as false). Defaults to true. */ + connections?: boolean | 'conditional'; + /** if true, will only register the plugin once per connection (or once per server for a connectionless plugin). If set, overrides the once option passed to server.register(). Defaults to undefined (registration will be based on the server.register() option once). */ + once?: boolean; +} + +/** + * Plugins State + * Related [See docs](https://hapijs.com/api/16.1.1#serverplugins) + * Related [See docs](https://hapijs.com/api/16.1.1#serverrealm) + */ +export interface PluginsStates { + [pluginName: string]: any; +} + +/** + * once, select, routes - optional plugin-specific registration options as defined see PluginRegistrationOptions + * [See docs](https://hapijs.com/api/16.1.1#serverregisterplugins-options-callback) + */ +export interface PluginRegistrationObject extends PluginRegistrationOptions { + /** the plugin registration function. */ + register: PluginFunction; + /** optional options passed to the registration function when called. */ + options?: OptionsPassedToPlugin; +} + +/** + * registration options (different from the options passed to the registration function): + * * once - if true, the registration is skipped for any connection already registered with. Cannot be used with plugin options. If the plugin does not have a connections attribute set to false and the registration selection is empty, registration will be skipped as no connections are available to register once. Defaults to false. + * * routes - modifiers applied to each route added by the plugin: + * * prefix - string added as prefix to any route path (must begin with '/'). If a plugin registers a child plugin the prefix is passed on to the child or is added in front of the child-specific prefix. + * * vhost - virtual host string (or array of strings) applied to every route. The outer-most vhost overrides the any nested configuration. + * * select - a string or array of string labels used to pre-select connections for plugin registration. + * [See docs](https://hapijs.com/api/16.1.1#serverregisterplugins-options-callback) + */ +export interface PluginRegistrationOptions { + once?: boolean; + routes?: {prefix?: string, vhost?: string | string[]}; + select?: string | string[]; +} + +/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JSON + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */ +// This was in a seperate file and perhaps should move to some of the lib typings? +// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/16065#issuecomment-299443673 +// +// json/json-tests.ts +// +// import * as JSON from './index'; +// +// var a: JSON.StringifyReplacer = function(key, value) { +// if (key === "do not include") { +// return undefined; +// } +// return value; +// }; +// + +export namespace Json { + /** + * @see {@link https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter} + */ + export type StringifyReplacer = ((key: string, value: any) => any) | (string | number)[] | undefined; + + /** + * Any value greater than 10 is truncated. + */ + export type StringifySpace = number | string; + + export interface StringifyArguments { + /** the replacer function or array. Defaults to no action. */ + replacer?: StringifyReplacer; + /** number of spaces to indent nested object keys. Defaults to no indentation. */ + space?: StringifySpace; + } } diff --git a/types/hapi/test/connection/table.ts b/types/hapi/test/connection/table.ts new file mode 100644 index 0000000000..24eaa28ddc --- /dev/null +++ b/types/hapi/test/connection/table.ts @@ -0,0 +1,22 @@ + +// From https://hapijs.com/api/16.1.1#servertablehost + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80, host: 'example.com' }); +server.route({ method: 'GET', path: '/example', handler: function (request, reply) { return reply(); } }); + +const connection = server.connections[0]; +const table = connection.table(); + +/* + [ + { + method: 'get', + path: '/example', + settings: { ... } + } + ] +*/ + +table.map(({method, path, settings: {description}}) => { }); diff --git a/types/hapi/test/continuation/errors.ts b/types/hapi/test/continuation/errors.ts new file mode 100644 index 0000000000..165e5214df --- /dev/null +++ b/types/hapi/test/continuation/errors.ts @@ -0,0 +1,57 @@ + +import * as Hapi from 'hapi'; +import * as Boom from 'boom'; + +// Assignment of a typical function to ContinuationValueFunction is possible +const handleError: Hapi.ContinuationValueFunction = (err?: Boom.BoomError | null, value?: any) => { + if (!err || !err.data.isCustom === true) { + return; + } + + // assignment is possible due to default generic Data = any + const customError: Boom.BoomError = err; + + // Discriminated union type works: + switch (customError.data.customType) { + case 'Custom1': + customError.data.custom1; + break; + case 'Custom2': + customError.data.custom2; + break; + } +}; + +// Accepts a simple Boom error +handleError(Boom.badData()); + +// Accepts an error with custom data +const errorWithData = Boom.badImplementation('', { custom1: 'test', customType: <'Custom1'>'Custom1', isCustom: true }); +handleError(errorWithData); + +// Accepts an error with a more explicit type +const errorWithExplicitType: Boom.BoomError = errorWithData; +handleError(errorWithExplicitType); + +// Accepts an error with an even more explicit type +const errorWithConcreteCustomData: Boom.BoomError = errorWithData; // assignment to CustomData2 would not be possible +handleError(errorWithConcreteCustomData); + +/** + * Some complex error data types: + */ +interface CustomDataBase { + isCustom: true; +} + +interface CustomData1 extends CustomDataBase { + customType: 'Custom1'; + custom1: string; +} + +interface CustomData2 extends CustomDataBase { + customType: 'Custom2'; + custom2: string; +} + +type CustomData = CustomData1 | CustomData2; diff --git a/types/hapi/test/getting-started/01-creating-a-server.ts b/types/hapi/test/getting-started/01-creating-a-server.ts new file mode 100644 index 0000000000..819ab5108e --- /dev/null +++ b/types/hapi/test/getting-started/01-creating-a-server.ts @@ -0,0 +1,16 @@ +// From https://hapijs.com/tutorials/getting-started#creating-a-server + +'use strict'; + +import Hapi = require('hapi'); + +const server = new Hapi.Server(); +server.connection({ port: 3000, host: 'localhost' }); + +server.start((err) => { + + if (err) { + throw err; + } + console.log(`Server running at: ${server.info!.uri}`); +}); diff --git a/types/hapi/test/getting-started/02-adding-routes.ts b/types/hapi/test/getting-started/02-adding-routes.ts new file mode 100644 index 0000000000..db4805366c --- /dev/null +++ b/types/hapi/test/getting-started/02-adding-routes.ts @@ -0,0 +1,32 @@ +// from https://hapijs.com/tutorials/getting-started#adding-routes + +'use strict'; + +import Hapi = require('hapi'); + +const server = new Hapi.Server(); +server.connection({ port: 3000, host: 'localhost' }); + +server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + reply('Hello, world!'); + } +}); + +server.route({ + method: 'GET', + path: '/{name}', + handler: function (request, reply) { + reply('Hello, ' + encodeURIComponent(request.params.name) + '!'); + } +}); + +server.start((err) => { + + if (err) { + throw err; + } + console.log(`Server running at: ${server.info!.uri}`); +}); diff --git a/types/hapi/test/getting-started/03-serving-static-content.ts b/types/hapi/test/getting-started/03-serving-static-content.ts new file mode 100644 index 0000000000..06200f2b07 --- /dev/null +++ b/types/hapi/test/getting-started/03-serving-static-content.ts @@ -0,0 +1,23 @@ +'use strict'; + +import Hapi = require('hapi'); +import Inert = require('inert'); + +const server = new Hapi.Server(); + +// from https://hapijs.com/tutorials/getting-started#creating-static-pages-and-content + +server.register(Inert, (err) => { + + if (err) { + throw err; + } + + server.route({ + method: 'GET', + path: '/hello', + handler: function (request, reply) { + reply.file('./public/hello.html'); + } + }); +}); \ No newline at end of file diff --git a/types/hapi/test/getting-started/04-using-plugins.ts b/types/hapi/test/getting-started/04-using-plugins.ts new file mode 100644 index 0000000000..28d1a1b576 --- /dev/null +++ b/types/hapi/test/getting-started/04-using-plugins.ts @@ -0,0 +1,56 @@ +// from https://hapijs.com/tutorials/getting-started#using-plugins + +'use strict'; + +import Hapi = require('hapi'); +const Good = require('good'); + +const server = new Hapi.Server(); +server.connection({ port: 3000, host: 'localhost' }); + +server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + reply('Hello, world!'); + } +}); + +server.route({ + method: 'GET', + path: '/{name}', + handler: function (request, reply) { + reply('Hello, ' + encodeURIComponent(request.params.name) + '!'); + } +}); + +server.register({ + register: Good, + options: { + reporters: { + console: [{ + module: 'good-squeeze', + name: 'Squeeze', + args: [{ + response: '*', + log: '*' + }] + }, { + module: 'good-console' + }, 'stdout'] + } + } +}, (err) => { + + if (err) { + throw err; // something bad happened loading the plugin + } + + server.start((err) => { + + if (err) { + throw err; + } + server.log('info', 'Server running at: ' + server.info!.uri); + }); +}); diff --git a/types/hapi/test/path/catch-all.ts b/types/hapi/test/path/catch-all.ts new file mode 100644 index 0000000000..c9002392b1 --- /dev/null +++ b/types/hapi/test/path/catch-all.ts @@ -0,0 +1,15 @@ + +// From https://hapijs.com/api/16.1.1#catch-all-route + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +server.route({ + method: '*', + path: '/{p*}', + handler: function (request, reply) { + + return reply('The page was not found').code(404); + } +}); diff --git a/types/hapi/test/path/parameters.ts b/types/hapi/test/path/parameters.ts new file mode 100644 index 0000000000..62bbfcc638 --- /dev/null +++ b/types/hapi/test/path/parameters.ts @@ -0,0 +1,33 @@ + +// From https://hapijs.com/api/16.1.1#path-parameters + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +const getAlbum: Hapi.RouteHandler = function (request, reply) { + + return reply('You asked for ' + + (request.params.song ? request.params.song + ' from ' : '') + + request.params.album); +}; + +server.route({ + path: '/{album}/{song?}', + method: 'GET', + handler: getAlbum +}); + +// Example 2 + +const getPerson: Hapi.RouteHandler = function (request, reply) { + + const nameParts = request.params.name.split('/'); + return reply({ first: nameParts[0], last: nameParts[1] }); +}; + +server.route({ + path: '/person/{name*2}', // Matches '/person/john/doe' + method: 'GET', + handler: getPerson +}); diff --git a/types/hapi/test/plugins/options.ts b/types/hapi/test/plugins/options.ts new file mode 100644 index 0000000000..cd192f1996 --- /dev/null +++ b/types/hapi/test/plugins/options.ts @@ -0,0 +1,36 @@ + +// From https://hapijs.com/api/16.1.1#serverinfo + +import * as Hapi from 'hapi'; + +// added in addition to code from docs +interface PluginOptions { + quantity: number; +} + +// modified from docs +var registerFunction: Hapi.PluginFunction = function(server, options, next) { + + server.route({ + method: 'GET', + path: '/test', + handler: function (request, reply) { + + // modified from docs + return reply(`ok ${options.quantity}`); + } + }); + + return next(); +}; + +var attributes: Hapi.PluginAttributes = { + name: 'test', + version: '1.0.0' +}; + +var attributes: Hapi.PluginAttributes = { + pkg: {} // require('./package.json'), +}; + +registerFunction.attributes = attributes; diff --git a/types/hapi/test/reply/continue.ts b/types/hapi/test/reply/continue.ts new file mode 100644 index 0000000000..de6994fbd0 --- /dev/null +++ b/types/hapi/test/reply/continue.ts @@ -0,0 +1,15 @@ + +// From https://hapijs.com/api/16.1.1#replycontinueresult + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +const onRequest: Hapi.ServerExtRequestHandler = function (request, reply) { + + // Change all requests to '/test' + request.setUrl('/test'); + return reply.continue(); +}; + +server.ext('onRequest', onRequest); diff --git a/types/hapi/test/reply/entity.ts b/types/hapi/test/reply/entity.ts new file mode 100644 index 0000000000..cfcce6de25 --- /dev/null +++ b/types/hapi/test/reply/entity.ts @@ -0,0 +1,24 @@ + +// From https://hapijs.com/api/16.1.1#replyentityoptions + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +server.route({ + method: 'GET', + path: '/', + config: { + cache: { expiresIn: 5000 }, + handler: function (request, reply) { + + const response = reply.entity({ etag: 'abc' }); + if (response) { + response.header('X', 'y'); + return; + } + + return reply('ok'); + } + } +}); diff --git a/types/hapi/test/reply/redirect.ts b/types/hapi/test/reply/redirect.ts new file mode 100644 index 0000000000..5baf892ac1 --- /dev/null +++ b/types/hapi/test/reply/redirect.ts @@ -0,0 +1,8 @@ + +// From https://hapijs.com/api/16.1.1#replyredirecturi + +import * as Hapi from 'hapi'; +const handler: Hapi.RouteHandler = function (request, reply) { + + return reply.redirect('http://example.com'); +}; diff --git a/types/hapi/test/reply/reply.ts b/types/hapi/test/reply/reply.ts new file mode 100644 index 0000000000..31f3bff9b4 --- /dev/null +++ b/types/hapi/test/reply/reply.ts @@ -0,0 +1,22 @@ + +// From https://hapijs.com/api/16.1.1#replyerr-result + +import * as Hapi from 'hapi'; + +// verbose notation + +const handler: Hapi.RouteHandler = function (request, reply) { + + const response = reply('success'); + response.type('text/plain'); + response.header('X-Custom', 'some-value'); +}; + +// Chained notation + +const handler2: Hapi.RouteHandler = function (request, reply) { + + return reply('success') + .type('text/plain') + .header('X-Custom', 'some-value'); +}; \ No newline at end of file diff --git a/types/hapi/test/reply/state_cookie.ts b/types/hapi/test/reply/state_cookie.ts new file mode 100644 index 0000000000..bf94219311 --- /dev/null +++ b/types/hapi/test/reply/state_cookie.ts @@ -0,0 +1,33 @@ + +// from https://hapijs.com/tutorials/cookies?lang=en_US + +import * as Hapi from 'hapi'; + +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +server.state('data', { + ttl: null, + isSecure: true, + isHttpOnly: true, + encoding: 'base64json', + clearInvalid: false, // remove invalid cookies + strictHeader: true // don't allow violations of RFC 6265 +}); + +server.route({ + method: 'GET', + path: '/say-hello', + config: { + state: { + parse: true, // parse and store in request.state + failAction: 'error' // may also be 'ignore' or 'log' + } + }, + handler: function(request, reply) { + // TODO test this + reply('Hello').state('data', { firstVisit: false }); + } +}) + + diff --git a/types/hapi/test/request/event-types.ts b/types/hapi/test/request/event-types.ts new file mode 100644 index 0000000000..0946f0a0ed --- /dev/null +++ b/types/hapi/test/request/event-types.ts @@ -0,0 +1,30 @@ + +// From https://hapijs.com/api/16.1.1#requestsetmethodmethod + +import * as Hapi from 'hapi'; +const Crypto = require('crypto'); +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +const onRequest: Hapi.ServerExtRequestHandler = function (request, reply) { + + const hash = Crypto.createHash('sha1'); + request.on('peek', (chunk) => { + + hash.update(chunk); + }); + + request.once('finish', () => { + + console.log(hash.digest('hex')); + }); + + request.once('disconnect', () => { + + console.error('request aborted'); + }); + + return reply.continue(); +}; + +server.ext('onRequest', onRequest); diff --git a/types/hapi/test/request/generate-response.ts b/types/hapi/test/request/generate-response.ts new file mode 100644 index 0000000000..c30c3a7be5 --- /dev/null +++ b/types/hapi/test/request/generate-response.ts @@ -0,0 +1,21 @@ + +// From https://hapijs.com/api/16.1.1#requestgenerateresponsesource-options + +import * as Hapi from 'hapi'; + +// Added in addition to code from docs +function promiseMethod() { + return Promise.resolve(true); +} + +const handler: Hapi.ServerExtRequestHandler = function (request, reply) { + + const result = promiseMethod().then((thing: boolean) => { + + if (!thing) { + return request.generateResponse().code(214); + } + return thing; + }); + return reply(result); +}; diff --git a/types/hapi/test/request/get-log.ts b/types/hapi/test/request/get-log.ts new file mode 100644 index 0000000000..289bdd3282 --- /dev/null +++ b/types/hapi/test/request/get-log.ts @@ -0,0 +1,12 @@ + +// From https://hapijs.com/api/16.1.1#requestgetlogtags-internal + +import * as Hapi from 'hapi'; + +var request: Hapi.Request = {}; + +request.getLog(); +request.getLog('error'); +request.getLog(['error', 'auth']); +request.getLog(['error'], true); +request.getLog(false); diff --git a/types/hapi/test/request/log.ts b/types/hapi/test/request/log.ts new file mode 100644 index 0000000000..1c2da1f3b0 --- /dev/null +++ b/types/hapi/test/request/log.ts @@ -0,0 +1,19 @@ + +// From https://hapijs.com/api/16.1.1#requestlogtags-data-timestamp + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80, routes: { log: true, security: false } }); + +server.on('request', (request, event, tags) => { + + if (tags.error) { + console.log(event); + } +}); + +const handler: Hapi.RouteHandler = function (request, reply) { + + request.log(['test', 'error'], 'Test event'); + return reply(); +}; diff --git a/types/hapi/test/request/set-method.ts b/types/hapi/test/request/set-method.ts new file mode 100644 index 0000000000..7269e6255f --- /dev/null +++ b/types/hapi/test/request/set-method.ts @@ -0,0 +1,15 @@ + +// From https://hapijs.com/api/16.1.1#requestsetmethodmethod + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +const onRequest: Hapi.ServerExtRequestHandler = function (request, reply) { + + // Change all requests to 'GET' + request.setMethod('GET'); + return reply.continue(); +}; + +server.ext('onRequest', onRequest); diff --git a/types/hapi/test/request/set-url.ts b/types/hapi/test/request/set-url.ts new file mode 100644 index 0000000000..4add3c5a17 --- /dev/null +++ b/types/hapi/test/request/set-url.ts @@ -0,0 +1,32 @@ + +// From https://hapijs.com/api/16.1.1#requestseturlurl-striptrailingslash + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +var onRequest: Hapi.ServerExtRequestHandler = function (request, reply) { + + // Change all requests to '/test' + request.setUrl('/test'); + return reply.continue(); +}; + +server.ext('onRequest', onRequest); + +// Example 2 + +const Url = require('url'); +const Qs = require('qs'); + +onRequest = function (request, reply) { + + const uri = request.raw.req.url; + const parsed = Url.parse(uri, false); + parsed.query = Qs.parse(parsed.query); + request.setUrl(parsed); + + return reply.continue(); +}; + +server.ext('onRequest', onRequest); diff --git a/types/hapi/test/request/tail.ts b/types/hapi/test/request/tail.ts new file mode 100644 index 0000000000..9c68ccb8f2 --- /dev/null +++ b/types/hapi/test/request/tail.ts @@ -0,0 +1,26 @@ + +// From https://hapijs.com/api/16.1.1#requestsetmethodmethod + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +const get: Hapi.RouteHandler = function (request, reply) { + + const dbTail = request.tail('write to database'); + + var db: any; + db.save('key', 'value', () => { + + dbTail(); + }); + + return reply('Success!'); +}; + +server.route({ method: 'GET', path: '/', handler: get }); + +server.on('tail', (request) => { + + console.log('Request completed including db activity'); +}); diff --git a/types/hapi/test/response/error-representation.ts b/types/hapi/test/response/error-representation.ts new file mode 100644 index 0000000000..f0fb62eb30 --- /dev/null +++ b/types/hapi/test/response/error-representation.ts @@ -0,0 +1,33 @@ + +// From https://hapijs.com/api/16.1.1#error-transformation + +import * as Hapi from 'hapi'; +import Vision from 'vision'; +const server = new Hapi.Server(); +server.register(Vision, {}, (err) => { + server.views({ + engines: { + html: require('handlebars') + } + }); +}); +server.connection({ port: 80 }); + +const preResponse: Hapi.ServerExtRequestHandler = function (request, reply) { + + const response = request.response!; + if (!response.isBoom) { + return reply.continue(); + } + + // Replace error with friendly HTML + + const error = response; + const ctx = { + message: (error.output!.statusCode === 404 ? 'page not found' : 'something went wrong') + }; + + return reply.view('error', ctx); +}; + +server.ext('onPreResponse', preResponse); diff --git a/types/hapi/test/response/error.ts b/types/hapi/test/response/error.ts new file mode 100644 index 0000000000..0ef503df12 --- /dev/null +++ b/types/hapi/test/response/error.ts @@ -0,0 +1,25 @@ + +// From https://hapijs.com/api/16.1.1#error-response + +import * as Hapi from 'hapi'; +const Boom = require('boom'); + +const server = new Hapi.Server(); + +server.route({ + method: 'GET', + path: '/badRequest', + handler: function (request, reply) { + + return reply(Boom.badRequest('Unsupported parameter')); + } +}); + +server.route({ + method: 'GET', + path: '/internal', + handler: function (request, reply) { + + return reply(new Error('unexpect error')); + } +}); diff --git a/types/hapi/test/response/events.ts b/types/hapi/test/response/events.ts new file mode 100644 index 0000000000..2d1658087b --- /dev/null +++ b/types/hapi/test/response/events.ts @@ -0,0 +1,30 @@ + +// From https://hapijs.com/api/16.1.1#response-events + +import * as Hapi from 'hapi'; +const Crypto = require('crypto'); +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +const preResponse: Hapi.ServerExtRequestHandler = function (request, reply) { + + const response = request.response!; + if (response.isBoom) { + return reply(); + } + + const hash = Crypto.createHash('sha1'); + response.on('peek', (chunk) => { + + hash.update(chunk); + }); + + response.once('finish', () => { + + console.log(hash.digest('hex')); + }); + + return reply.continue(); +}; + +server.ext('onPreResponse', preResponse); diff --git a/types/hapi/test/response/flow-control.ts b/types/hapi/test/response/flow-control.ts new file mode 100644 index 0000000000..bc18a36aff --- /dev/null +++ b/types/hapi/test/response/flow-control.ts @@ -0,0 +1,14 @@ + +// From https://hapijs.com/api/16.1.1#flow-control + +import * as Hapi from 'hapi'; + +const handler = function (request: Hapi.Request, reply: Hapi.ReplyWithContinue) { + + const response = reply('success').hold(); + + setTimeout(() => { + + response.send(); + }, 1000); +}; diff --git a/types/hapi/test/route/additional-options.ts b/types/hapi/test/route/additional-options.ts new file mode 100644 index 0000000000..aaf5a33066 --- /dev/null +++ b/types/hapi/test/route/additional-options.ts @@ -0,0 +1,73 @@ +'use strict'; + +import * as Hapi from 'hapi'; + +var authConfig: Hapi.RouteAdditionalConfigurationOptions = { + app: {}, + payload: {}, +}; + +var extConfigSingle: Hapi.RouteAdditionalConfigurationOptions = { + ext: { + type: 'onPreAuth', + method: function (request, reply) { + reply('ok'); + } + } +} + +var extConfigMulti: Hapi.RouteAdditionalConfigurationOptions = { + ext: [{ + type: 'onPreAuth', + method: function (request, reply) { + reply('ok'); + } + }, { + type: 'onPostAuth', + method: function (request, reply) { + reply('ok'); + } + }, { + type: 'onPostStart', + method: function (server, next) { + next(); + } + }] +} + +// Handler in config +const user: Hapi.RouteAdditionalConfigurationOptions = { + cache: { expiresIn: 5000, statuses: [200, 201] }, + handler: function (request, reply) { + return reply({ name: 'John' }); + } +}; + +// Add in addition to examples in docs + +var cache: Hapi.RouteCacheOptions = { + privacy: 'default', + expiresIn: 5000, +}; + +cache = { + privacy: 'default', + expiresAt: '22:44', +}; + +cache = { + privacy: 'default', +}; + +/* should error (as does!) +var cache: Hapi.RouteCacheOptions = { + expiresIn: 5000, + expiresAt: '22:44', +}; +*/ + +var payloadOptions: Hapi.RoutePayloadConfigurationObject = { + allow: 'multipart/form-data', + maxBytes: 123, + output: 'file', +}; diff --git a/types/hapi/test/route/auth.ts b/types/hapi/test/route/auth.ts new file mode 100644 index 0000000000..e5239322da --- /dev/null +++ b/types/hapi/test/route/auth.ts @@ -0,0 +1,25 @@ +'use strict'; + +import * as Hapi from 'hapi'; + +var routeMoreConfig: Hapi.RouteAdditionalConfigurationOptions = { + auth: false, +} +routeMoreConfig = { + auth: 'some_strategy', +} +routeMoreConfig = { + auth: { + mode: 'required', + strategies: ['strat1', 'strat2'], + strategy: 'should not be given when strategies given', + payload: false, + access: { + scope: false, + entity: 'any', + }, + // Will over write values in access + scope: false, + entity: 'any', + } +} diff --git a/types/hapi/test/route/config.ts b/types/hapi/test/route/config.ts new file mode 100644 index 0000000000..16457395f8 --- /dev/null +++ b/types/hapi/test/route/config.ts @@ -0,0 +1,46 @@ +'use strict'; + +import * as Hapi from 'hapi'; + +// different methods +var routeConfig: Hapi.RouteConfiguration = { + path: '/signin', + method: 'PUT', + vhost: 'site.coms', +}; +var routeConfig: Hapi.RouteConfiguration = { + path: '/signin', + method: '*' +}; +var routeConfig: Hapi.RouteConfiguration = { + path: '/signin', + method: ['OPTIONS', '*'] +}; + +// different handlers +var routeConfig: Hapi.RouteConfiguration = { + path: '/signin', + method: 'PUT', + handler: 'some registered handler' +}; +var routeConfig: Hapi.RouteConfiguration = { + path: '/signin', + method: 'PUT', + handler: function (request, reply) { + return reply('ok'); + } +}; + +const server = new Hapi.Server(); +server.route(routeConfig); + +// Handler in config +const user: Hapi.RouteAdditionalConfigurationOptions = { + cache: { expiresIn: 5000 }, + handler: function (request, reply) { + + return reply({ name: 'John' }); + } +}; + +server.route({method: 'GET', path: '/user', config: user }); diff --git a/types/hapi/test/route/handler.ts b/types/hapi/test/route/handler.ts new file mode 100644 index 0000000000..c66d17018e --- /dev/null +++ b/types/hapi/test/route/handler.ts @@ -0,0 +1,10 @@ +'use strict'; + +import * as Hapi from 'hapi'; + +var handler: Hapi.RouteHandler = function(request, reply) { + reply('success'); +} +var strictHandler: Hapi.RouteHandler = function(request, reply) { + reply(123); +} diff --git a/types/hapi/test/route/plugins.ts b/types/hapi/test/route/plugins.ts new file mode 100644 index 0000000000..2449fc84c0 --- /dev/null +++ b/types/hapi/test/route/plugins.ts @@ -0,0 +1,38 @@ +// Added in addition to code from https://hapijs.com/api/16.1.1#route-options > plugins + +import * as Hapi from 'hapi'; + +// In the plugin code +declare module 'hapi' { + interface PluginSpecificConfiguration { + coolPlugin: { + optionA: string; + optionB?: boolean; + } + } +} + +// In the consumer code +const pluginsServerConfig: Hapi.ServerOptions = { + plugins: { + coolPlugin: { + optionA: "test", + } + } +}; + +const pluginsConnectionConfig: Hapi.ConnectionConfigurationServerDefaults = { + plugins: { + coolPlugin: { + optionA: "test", + } + } +}; + +const pluginsRouteConfig: Hapi.RouteAdditionalConfigurationOptions = { + plugins: { + coolPlugin: { + optionA: "test", + } + } +}; diff --git a/types/hapi/test/route/prerequisites.ts b/types/hapi/test/route/prerequisites.ts new file mode 100644 index 0000000000..c4ca7650fa --- /dev/null +++ b/types/hapi/test/route/prerequisites.ts @@ -0,0 +1,47 @@ + +// From https://hapijs.com/api/16.1.1#route-prerequisites + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +const pre1: Hapi.RoutePrerequisiteRequestHandler = function (request, reply) { + + return reply('Hello'); +}; + +const pre2: Hapi.RoutePrerequisiteRequestHandler = function (request, reply) { + + return reply('World'); +}; + +const pre3: Hapi.RoutePrerequisiteRequestHandler = function (request, reply) { + const pre = request.pre as Pre1; + return reply(pre.m1 + ' ' + pre.m2); +}; + +server.route({ + method: 'GET', + path: '/', + config: { + pre: [ + [ + // m1 and m2 executed in parallel + { method: pre1, assign: 'm1' }, + { method: pre2, assign: 'm2' } + ], + { method: pre3, assign: 'm3' }, + ], + handler: function (request, reply) { + const pre = request.pre as Pre2; + return reply(pre.m3 + '\n'); + } + } +}); +interface Pre1 { + m1: string; + m2: string; +} +interface Pre2 extends Pre1 { + m3: string; +} diff --git a/types/hapi/test/route/public-interface.ts b/types/hapi/test/route/public-interface.ts new file mode 100644 index 0000000000..e61fb8275f --- /dev/null +++ b/types/hapi/test/route/public-interface.ts @@ -0,0 +1,17 @@ +'use strict'; + +import * as Hapi from 'hapi'; + +var route = {}; + +var a: string = route.method; +var a: string = route.path; +if (typeof(route.vhost) == 'string') { + var a: string = route.vhost; +} else { + var b: string[] = route.vhost!; +} +var c: Hapi.ServerRealm = route.realm; +var d: Hapi.RouteAdditionalConfigurationOptions = route.settings; +var a: string = route.fingerprint; +var e: boolean = route.auth.access( {}); diff --git a/types/hapi/test/route/validate.ts b/types/hapi/test/route/validate.ts new file mode 100644 index 0000000000..f579bff8a8 --- /dev/null +++ b/types/hapi/test/route/validate.ts @@ -0,0 +1,64 @@ + +// Added from: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/16065#issuecomment-302216131 + +import * as Hapi from 'hapi'; +import * as Joi from 'joi'; + +const validate: Hapi.RouteValidationConfigurationObject = { + headers: true, + params: { + id: Joi.string(), + }, + payload: Joi.object().required(), + query: { + providerId: Joi.string(), + }, + options: { + abortEarly: true, + }, +}; + +let config: Hapi.RouteAdditionalConfigurationOptions = { + validate, + response: { + schema: Joi.object(), + }, +}; + +interface CustomValidationOptions { + myOption: number; +} + +const inputValidationFunction: Hapi.ValidationFunctionForRouteInput = (value, options, next) => { + options.myOption; // check custom options + options.context.auth.artifacts; // check context + next(null, value); // check with value + next(); // check without value +}; + +const validateWithFunctions: Hapi.RouteValidationConfigurationObject = { + params: inputValidationFunction, + headers: inputValidationFunction, + payload: inputValidationFunction, + query: inputValidationFunction, + options: { + myOption: 18 + } +}; + +const responseValidationFunction: Hapi.ValidationFunctionForRouteResponse = (value, options, next) => { + options.myOption; // check custom options + options.context.auth.isAuthenticated; // check context + next(null, value); // check with value + next(); // check without value +}; + +config = { + validate: validateWithFunctions, + response: >{ + schema: responseValidationFunction, + options: { + myOption: 18 + } + } +}; diff --git a/types/hapi/test/server/app.ts b/types/hapi/test/server/app.ts new file mode 100644 index 0000000000..dac8921c20 --- /dev/null +++ b/types/hapi/test/server/app.ts @@ -0,0 +1,11 @@ + +// From https://hapijs.com/api/16.1.1#serverapp + +import * as Hapi from 'hapi'; +var server = new Hapi.Server(); +server.app.key = 'value'; + +const handler: Hapi.RouteHandler = function (request, reply) { + + return reply(request.server.app.key); +}; diff --git a/types/hapi/test/server/auth.ts b/types/hapi/test/server/auth.ts new file mode 100644 index 0000000000..3f28732d42 --- /dev/null +++ b/types/hapi/test/server/auth.ts @@ -0,0 +1,101 @@ + +// From https://hapijs.com/api/16.1.1#serverauthapi + +import * as Hapi from 'hapi'; +import * as Boom from 'boom'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +var scheme: Hapi.ServerAuthScheme = function (server, options) { + + return { + api: { + settings: { + x: 5 + } + }, + authenticate: function (request, reply) { + + const req = request.raw.req; + const authorization = req.headers.authorization; + if (!authorization) { + return reply(Boom.unauthorized(null, 'Custom')); + } + + return reply.continue({ credentials: { user: 'john' } }); + } + }; +}; + +server.auth.scheme('custom', scheme); +server.auth.strategy('default', 'custom'); + +console.log(server.auth.api.default.settings.x); // 5 + +// Default + +server.auth.default('default'); + +server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + + return reply(request.auth.credentials.user); + } +}); + +// scheme + +scheme = function (server, options) { + + return { + authenticate: function (request, reply) { + + const req = request.raw.req; + const authorization = req.headers.authorization; + if (!authorization) { + return reply(Boom.unauthorized(null, 'Custom')); + } + + return reply.continue({ credentials: { user: 'john' } }); + } + }; +}; + +server.auth.scheme('custom', scheme); + +// strategy + +server.auth.scheme('custom', scheme); +server.auth.strategy('default', 'custom'); + +server.route({ + method: 'GET', + path: '/', + config: { + auth: 'default', + handler: function (request, reply) { + + return reply(request.auth.credentials.user); + } + } +}); + +// test + +server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + + request.server.auth.test('default', request, (err, credentials) => { + + if (err) { + return reply({ status: false }); + } + + return reply({ status: true, user: (credentials as any).name }); + }); + } +}); diff --git a/types/hapi/test/server/bind.ts b/types/hapi/test/server/bind.ts new file mode 100644 index 0000000000..2741e16c82 --- /dev/null +++ b/types/hapi/test/server/bind.ts @@ -0,0 +1,24 @@ + +// From https://hapijs.com/api/16.1.1#serverbindcontext + +import * as Hapi from 'hapi'; + +interface HandlerThis { + message: string; +} + +const handler: Hapi.RouteHandler = function (this: HandlerThis, request, reply) { + + return reply(this.message); +}; + +var register: Hapi.PluginFunction<{}> = function (server, options, next) { + + const bind: HandlerThis = { + message: 'hello' + }; + + server.bind(bind); + server.route({ method: 'GET', path: '/', handler: handler }); + return next(); +}; diff --git a/types/hapi/test/server/cache.ts b/types/hapi/test/server/cache.ts new file mode 100644 index 0000000000..4cb9eaa4b7 --- /dev/null +++ b/types/hapi/test/server/cache.ts @@ -0,0 +1,33 @@ + +// From https://hapijs.com/api/16.1.1#servercacheoptions + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +const cache = server.cache({ segment: 'countries', expiresIn: 60 * 60 * 1000 }); +cache.set('norway', { capital: 'oslo' }, null, (err) => { + + cache.get('norway', (err, value, cached, log) => { + + // value === { capital: 'oslo' }; + }); +}); + +// provision +// From https://hapijs.com/api/16.1.1#servercacheprovisionoptions-callback + +server.initialize((err) => { + + server.cache.provision({ engine: require('catbox-memory'), name: 'countries' }, (err) => { + + const cache = server.cache({ cache: 'countries', expiresIn: 60 * 60 * 1000 }); + cache.set('norway', { capital: 'oslo' }, null, (err) => { + + cache.get('norway', (err, value, cached, log) => { + + // value === { capital: 'oslo' }; + }); + }); + }); +}); diff --git a/types/hapi/test/server/connection-options.ts b/types/hapi/test/server/connection-options.ts new file mode 100644 index 0000000000..3a526307db --- /dev/null +++ b/types/hapi/test/server/connection-options.ts @@ -0,0 +1,39 @@ + +// From https://hapijs.com/api/16.1.1#serverconnectionoptions + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); + +const web = server.connection({ port: 8000, host: 'example.com', labels: ['web'] }); +const admin = server.connection({ port: 8001, host: 'example.com', labels: ['admin'] }); + +server.connections.length === 2; +web.connections.length === 1; +admin.connections.length === 1; + +// example 2 + +var registerFunction: Hapi.PluginFunction<{}> = function (srv, options, next) { + + // Use the 'srv' argument to add a new connection + + const server = srv.connection(); + + // Use the 'server' return value to manage the new connection + + server.route({ + path: '/', + method: 'GET', + handler: function (request, reply) { + + return reply('hello'); + } + }); + + return next(); +}; + +registerFunction.attributes = { + name: 'example', + connections: false +}; diff --git a/types/hapi/test/server/connections.ts b/types/hapi/test/server/connections.ts new file mode 100644 index 0000000000..fb2f9f303e --- /dev/null +++ b/types/hapi/test/server/connections.ts @@ -0,0 +1,13 @@ + +// From https://hapijs.com/api/16.1.1#serverconnections + +import * as Hapi from 'hapi'; +var server = new Hapi.Server(); +server.connection({ port: 80, labels: 'a' }); +server.connection({ port: 8080, labels: 'b' }); + +// server.connections.length === 2 + +const a = server.select('a'); + +// a.connections.length === 1 diff --git a/types/hapi/test/server/decoder.ts b/types/hapi/test/server/decoder.ts new file mode 100644 index 0000000000..edd52485ea --- /dev/null +++ b/types/hapi/test/server/decoder.ts @@ -0,0 +1,9 @@ + +// From https://hapijs.com/api/16.1.1#serverdecoderencoding-decoder + +import * as Hapi from 'hapi'; +import * as Zlib from 'zlib'; +const server = new Hapi.Server(); +server.connection({ port: 80, routes: { payload: { compression: { special: { chunkSize: 16 * 1024 } } } } }); + +server.decoder('special', (options) => Zlib.createGunzip(options)); diff --git a/types/hapi/test/server/decorate.ts b/types/hapi/test/server/decorate.ts new file mode 100644 index 0000000000..540e29c951 --- /dev/null +++ b/types/hapi/test/server/decorate.ts @@ -0,0 +1,68 @@ + +// From https://hapijs.com/api/16.1.1#serverdecoratetype-property-method-options + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +const success = function (this: Hapi.ReplyNoContinue) { + + return this.response({ status: 'ok' }); +}; + +server.decorate('reply', 'success', success); + +declare module 'hapi' { + interface Base_Reply { + success: () => Response; + } +} + +server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + + return reply.success(); + } +}); + +// custom typing code for decorating request + +server.decorate('request', 'some_request_method', (request) => { + return function() { + // Do some sort of processing; + return request.id; + } +}, {apply: true}); + +declare module 'hapi' { + interface Request { + some_request_method(): void; + } +} + +server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + request.some_request_method(); + return reply(); + } +}); + +// custom typing code for decorating server + +server.decorate('server', 'some_server_method', (server: Hapi.Server) => { + return function(arg1: number){ + return "some text"; + } +}); + +declare module 'hapi' { + interface Server { + some_server_method(arg1: number): string; + } +} + +server.some_server_method(1); diff --git a/types/hapi/test/server/dependency.ts b/types/hapi/test/server/dependency.ts new file mode 100644 index 0000000000..1d63397cf2 --- /dev/null +++ b/types/hapi/test/server/dependency.ts @@ -0,0 +1,24 @@ + +// From https://hapijs.com/api/16.1.1#serverdependencydependencies-after + +import * as Hapi from 'hapi'; + +const after: Hapi.AfterDependencyLoadCallback = function (server, next) { + + // Additional plugin registration logic + return next(); +}; + +var registerFunction: Hapi.PluginFunction<{}> = function (server, options, next) { + + server.dependency('yar', after); + return next(); +}; + +// Example 2, via attributes + +registerFunction.attributes = { + name: 'test', + version: '1.0.0', + dependencies: 'yar' +}; diff --git a/types/hapi/test/server/emit.ts b/types/hapi/test/server/emit.ts new file mode 100644 index 0000000000..d248f7d4ab --- /dev/null +++ b/types/hapi/test/server/emit.ts @@ -0,0 +1,12 @@ + +// From https://hapijs.com/api/16.1.1#serveremitcriteria-data-callback + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +server.event('test'); +server.on('test', (update: Update) => console.log(update)); +type Update = string; +var toSend: Update = 'hello'; +server.emit('test', toSend); diff --git a/types/hapi/test/server/encoder.ts b/types/hapi/test/server/encoder.ts new file mode 100644 index 0000000000..f35102b776 --- /dev/null +++ b/types/hapi/test/server/encoder.ts @@ -0,0 +1,9 @@ + +// From https://hapijs.com/api/16.1.1#serverencoderencoding-encoder + +import * as Hapi from 'hapi'; +import * as Zlib from 'zlib'; +const server = new Hapi.Server(); +server.connection({ port: 80, routes: { compression: { special: { chunkSize: 16 * 1024 } } } }); + +server.encoder('special', (options) => Zlib.createGzip(options)); diff --git a/types/hapi/test/server/event.ts b/types/hapi/test/server/event.ts new file mode 100644 index 0000000000..f0c2215f12 --- /dev/null +++ b/types/hapi/test/server/event.ts @@ -0,0 +1,12 @@ + +// From https://hapijs.com/api/16.1.1#servereventevents + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +server.event('test'); +server.on('test', (update: Update) => console.log(update)); +type Update = string; +var toSend: Update = 'hello'; +server.emit('test', toSend); diff --git a/types/hapi/test/server/expose.ts b/types/hapi/test/server/expose.ts new file mode 100644 index 0000000000..effbc1ae49 --- /dev/null +++ b/types/hapi/test/server/expose.ts @@ -0,0 +1,17 @@ + +// From https://hapijs.com/api/16.1.1#serverexposekey-value + +import * as Hapi from 'hapi'; +var register: Hapi.PluginFunction<{}> = function (server, options, next) { + + server.expose('util', function () { console.log('something'); }); + return next(); +}; + +// example of `expose()` merging object + +register = function (server, options, next) { + + server.expose({ util: function () { console.log('something'); } }); + return next(); +}; diff --git a/types/hapi/test/server/ext.ts b/types/hapi/test/server/ext.ts new file mode 100644 index 0000000000..500ac1d4af --- /dev/null +++ b/types/hapi/test/server/ext.ts @@ -0,0 +1,46 @@ + +// From https://hapijs.com/api/16.1.1#serverextevents + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +server.ext({ + type: 'onRequest', + method: function (request, reply) { + + // Change all requests to '/test' + request.setUrl('/test'); + return reply.continue(); + } +}); + +var handler: Hapi.RouteHandler = function (request, reply) { + + return reply({ status: 'ok' }); +}; + +server.route({ method: 'GET', path: '/test', handler: handler }); +server.start((err) => { }); + +// All requests will get routed to '/test' + + +// Example 2 + +server.ext('onRequest', function (request, reply) { + + // Change all requests to '/test' + request.setUrl('/test'); + return reply.continue(); +}); + +handler = function (request, reply) { + + return reply({ status: 'ok' }); +}; + +server.route({ method: 'GET', path: '/test', handler: handler }); +server.start((err) => { }); + +// All requests will get routed to '/test' diff --git a/types/hapi/test/server/handler.ts b/types/hapi/test/server/handler.ts new file mode 100644 index 0000000000..713fe7f114 --- /dev/null +++ b/types/hapi/test/server/handler.ts @@ -0,0 +1,55 @@ + +// From https://hapijs.com/api/16.1.1#serverhandlername-method + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ host: 'localhost', port: 8000 }); + +// Defines new handler for routes on this server +var handler: Hapi.MakeRouteHandler = function (route, options) { + + return function (request, reply) { + + return reply('new handler: ' + options.msg); + } +}; + +server.handler('test', handler); + +interface TestPluginConfig { + msg: string; +} + +declare module 'hapi' { + interface RouteHandlerPlugins { + test?: TestPluginConfig; + } +} + +server.route({ + method: 'GET', + path: '/', + handler: { test: { msg: 'test' } } +}); + +server.start(function (err) { }); + +// example 2 + +handler = function (route, options: TestPluginConfig) { + + return function (request, reply) { + + return reply('new handler: ' + options.msg); + } +}; + +// Change the default payload processing for this handler +handler.defaults = { + payload: { + output: 'stream', + parse: false + } +}; + +server.handler('test', handler); diff --git a/types/hapi/test/server/info.ts b/types/hapi/test/server/info.ts new file mode 100644 index 0000000000..eaf1b39747 --- /dev/null +++ b/types/hapi/test/server/info.ts @@ -0,0 +1,16 @@ + +// From https://hapijs.com/api/16.1.1#serverinfo + +import assert = require('assert'); +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +var options: Hapi.ServerConnectionOptions = { port: 80 }; +server.connection(options); + +if(server.info) assert(server.info.port === 80); + +options = { port: 8080 }; +server.connection(options); + +assert(server.info === null); +assert(server.connections[1].info.port === 8080); diff --git a/types/hapi/test/server/initialize.ts b/types/hapi/test/server/initialize.ts new file mode 100644 index 0000000000..7ef4b51527 --- /dev/null +++ b/types/hapi/test/server/initialize.ts @@ -0,0 +1,12 @@ + +// From https://hapijs.com/api/16.1.1#serverinitializecallback + +import * as Hapi from 'hapi'; +const Hoek = require('hoek'); +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +server.initialize((err) => { + + Hoek.assert(!err, err); +}); diff --git a/types/hapi/test/server/inject.ts b/types/hapi/test/server/inject.ts new file mode 100644 index 0000000000..7010faa3dc --- /dev/null +++ b/types/hapi/test/server/inject.ts @@ -0,0 +1,19 @@ + +// From https://hapijs.com/api/16.1.1#serverinjectoptions-callback + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +const handler: Hapi.RouteHandler = function (request, reply) { + + return reply('Success!'); +}; + +server.route({ method: 'GET', path: '/', handler: handler }); + +server.inject('/', (res) => { + const num: number = res.statusCode; + const result = res.result as {aField: string}; + console.log(res.result); +}); diff --git a/types/hapi/test/server/listener.ts b/types/hapi/test/server/listener.ts new file mode 100644 index 0000000000..d7bb6fc5ea --- /dev/null +++ b/types/hapi/test/server/listener.ts @@ -0,0 +1,19 @@ + +// From https://hapijs.com/api/16.1.1#serverlistener + +import * as Hapi from 'hapi'; +import SocketIO = require('socket.io'); + +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +// https://socket.io/docs/server-api/#server-attach-httpserver-options +const io = SocketIO.listen(server.listener); +io.sockets.on('connection', (socket) => { + + // TODO, FIXME by removing , probably `socket` type given here is + // a wrapper around socket.io. Much less likely is either + // a type error in the TypeScript definitions of socket.io or + // an error in the Hapi docs. + socket.emit( { msg: 'welcome' }); +}); diff --git a/types/hapi/test/server/load.ts b/types/hapi/test/server/load.ts new file mode 100644 index 0000000000..ee204c864f --- /dev/null +++ b/types/hapi/test/server/load.ts @@ -0,0 +1,7 @@ + +// From https://hapijs.com/api/16.1.1#serverload + +import * as Hapi from 'hapi'; +const server = new Hapi.Server({ load: { sampleInterval: 1000 } }); + +var d: number = server.load.rss; diff --git a/types/hapi/test/server/log.ts b/types/hapi/test/server/log.ts new file mode 100644 index 0000000000..4507358d60 --- /dev/null +++ b/types/hapi/test/server/log.ts @@ -0,0 +1,15 @@ + +// From https://hapijs.com/api/16.1.1#serverlogtags-data-timestamp + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +server.on('log', (event, tags) => { + + if (tags.error) { + console.log(event); + } +}); + +server.log(['test', 'error'], 'Test event'); diff --git a/types/hapi/test/server/lookup.ts b/types/hapi/test/server/lookup.ts new file mode 100644 index 0000000000..89ce852700 --- /dev/null +++ b/types/hapi/test/server/lookup.ts @@ -0,0 +1,19 @@ + +// From https://hapijs.com/api/16.1.1#serverlookupid + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection(); +server.route({ + method: 'GET', + path: '/', + config: { + handler: function (request, reply) { + + return reply(); + }, + id: 'root' + } +}); + +const route = server.lookup('root'); diff --git a/types/hapi/test/server/match.ts b/types/hapi/test/server/match.ts new file mode 100644 index 0000000000..f322a31494 --- /dev/null +++ b/types/hapi/test/server/match.ts @@ -0,0 +1,19 @@ + +// From https://hapijs.com/api/16.1.1#servermatchmethod-path-host + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection(); +server.route({ + method: 'GET', + path: '/', + config: { + handler: function (request, reply) { + + return reply(); + }, + id: 'root' + } +}); + +const route = server.match('get', '/'); diff --git a/types/hapi/test/server/method.ts b/types/hapi/test/server/method.ts new file mode 100644 index 0000000000..a67022d250 --- /dev/null +++ b/types/hapi/test/server/method.ts @@ -0,0 +1,78 @@ + +// From https://hapijs.com/api/16.1.1#servermethodname-method-options + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +// Simple arguments + +const add = function (a: number, b: number, next: Hapi.ServerMethodNext) { + + return next(null, a + b); +}; + +server.method('sum', add, { cache: { expiresIn: 2000, generateTimeout: 100 } }); + +var next: Hapi.ServerMethodNext = (err, result) => { + + console.log(result); +}; +server.methods.sum(4, 5, next); + +// Object argument + +const addArray = function (array: number[], next: Hapi.ServerMethodNext) { + + let sum = 0; + array.forEach((item) => { + + sum += item; + }); + + return next(null, sum); +}; + +server.method('sumObj', addArray, { + cache: { expiresIn: 2000, generateTimeout: 100 }, + generateKey: function (array) { + + return array.join(','); + } +}); + +var next: Hapi.ServerMethodNext = (err, result) => { + + console.log(result); +}; +server.methods.sumObj([5, 6], next); + +// Synchronous method with cache + +const addSync = function (a: number, b: number) { + + return a + b; +}; + +server.method('sumSync', addSync, { cache: { expiresIn: 2000, generateTimeout: 100 }, callback: false }); + +var next: Hapi.ServerMethodNext = (err, result) => { + + console.log(result); +}; +server.methods.sumSync(4, 5, next); + +// server.method(methods) + +var config = { + name: 'sum', + method: add, + options: { + cache: { + expiresIn: 2000, + generateTimeout: 100 + } + } +}; +server.method(config); +server.method([config]); diff --git a/types/hapi/test/server/methods.ts b/types/hapi/test/server/methods.ts new file mode 100644 index 0000000000..1e2060c3e8 --- /dev/null +++ b/types/hapi/test/server/methods.ts @@ -0,0 +1,17 @@ + +// From https://hapijs.com/api/16.1.1#servermethods + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); + +const add = function (a: number, b: number, next: (err: Error | null, result: number) => void) { + + return next(null, a + b); +}; + +server.method('add', add); + +server.methods.add(1, 2, (err: Error | null, result: number) => { + + // result === 3 +}); diff --git a/types/hapi/test/server/mime.ts b/types/hapi/test/server/mime.ts new file mode 100644 index 0000000000..e2dd25529b --- /dev/null +++ b/types/hapi/test/server/mime.ts @@ -0,0 +1,21 @@ + +// From https://hapijs.com/api/16.1.1#servermime + +import * as Hapi from 'hapi'; + +const options: Hapi.ServerOptions = { + mime: { + override: { + 'node/module': { + source: 'steve', + compressible: false, + extensions: ['node', 'module', 'npm'], + type: 'node/module' + } + } + } +}; + +const server = new Hapi.Server(options); +server.mime.path('code.js').type === 'application/javascript'; +server.mime.path('file.npm').type === 'node/module'; diff --git a/types/hapi/test/server/new.ts b/types/hapi/test/server/new.ts new file mode 100644 index 0000000000..95f1ce9006 --- /dev/null +++ b/types/hapi/test/server/new.ts @@ -0,0 +1,75 @@ +'use strict'; + +import * as Hapi from 'hapi'; + +new Hapi.Server(); +new Hapi.Server({ + app: {some: 'values'}, + cache: require('catbox-redis'), +}); + +const server = new Hapi.Server({ + cache: require('catbox-redis'), + load: { + sampleInterval: 1000 + } +}); + +// Specific cache configuration options +new Hapi.Server({ + cache: { + engine: require('catbox-redis'), + // name: 'optionally omitted when only a single cache used', + } +}); +new Hapi.Server({ + cache: [{ + engine: require('catbox-redis'), + name: 'unique 1', + }, + { + engine: require('catbox-redis'), + name: 'unique 2', + shared: true, + otherOptions: 'will be passed to the catbox strategy', + }] +}); +new Hapi.Server({ + cache: [{ + engine: require('catbox-redis'), + }, + // Does not correctly error but will be caught by hapi at runtime + { + engine: require('catbox-redis'), + }] +}); + +//+ Code added in addition to docs +declare module 'hapi' { + interface PluginSpecificConfiguration { + // Set this to non optional if plugin config is non optional + 'some-plugin-name'?: {options: string;}; + } +} +//- Code added in addition to docs + +new Hapi.Server({ + connections: { + app: {}, + compression: false, + load: { + maxHeapUsedBytes: 10, + maxRssBytes: 10, + maxEventLoopDelay: 10, + }, + plugins: { + 'some-plugin-name': {options: 'here'}, + coolPlugin: {optionA: ""}, + }, + router: { + isCaseSensitive: false, + stripTrailingSlash: true, + }, + routes: {} + } +}) diff --git a/types/hapi/test/server/on.ts b/types/hapi/test/server/on.ts new file mode 100644 index 0000000000..08802fda96 --- /dev/null +++ b/types/hapi/test/server/on.ts @@ -0,0 +1,43 @@ + +// From https://hapijs.com/api/16.1.1#serveroncriteria-listener +// From https://hapijs.com/api/16.1.1#server-events + +import * as Hapi from 'hapi'; + +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +server.event('test'); +server.on('test', (update: Update) => console.log(update)); +type Update = string; +var toSend: Update = 'hello'; +server.emit('test', toSend); + +server.on('log', (event, tags) => { + + if (tags.error) { + console.log('Server error: ' + (event.data || 'unspecified')); + } +}); + +server.on('request', (request, event, tags) => { + + if (tags.received) { + console.log('New request: ' + request.id); + } +}); + +server.on('request-error', (request, err) => { + + console.log('Error response (500) sent for request: ' + request.id + ' because: ' + err.message); +}); + +server.on('response', (request) => { + + console.log('Response sent for request: ' + request.id); +}); + +server.on('route', (route, connection, server) => { + + console.log('New route added: ' + route.path); +}); diff --git a/types/hapi/test/server/once.ts b/types/hapi/test/server/once.ts new file mode 100644 index 0000000000..55fdb08ec2 --- /dev/null +++ b/types/hapi/test/server/once.ts @@ -0,0 +1,14 @@ + +// From https://hapijs.com/api/16.1.1#serveroncecriteria-listener + +import * as Hapi from 'hapi'; + +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +server.event('test'); +server.once('test', (update: Update) => console.log(update)); +type Update = string; +var toSend: Update = 'hello'; +server.emit('test', toSend); +server.emit('test', toSend); // Ignored diff --git a/types/hapi/test/server/path.ts b/types/hapi/test/server/path.ts new file mode 100644 index 0000000000..20479a795f --- /dev/null +++ b/types/hapi/test/server/path.ts @@ -0,0 +1,13 @@ + +// From https://hapijs.com/api/16.1.1#serverpathrelativeto + +import * as Hapi from 'hapi'; + +var register: Hapi.PluginFunction<{}> = function (server, options, next) { + + // Assuming the Inert plugin was registered previously + + server.path(__dirname + '../static'); + server.route({ path: '/file', method: 'GET', handler: { file: './test.html' } }); + next(); +}; diff --git a/types/hapi/test/server/plugins.ts b/types/hapi/test/server/plugins.ts new file mode 100644 index 0000000000..2ce13ffb2f --- /dev/null +++ b/types/hapi/test/server/plugins.ts @@ -0,0 +1,15 @@ + +// From https://hapijs.com/api/16.1.1#serverplugins + +import * as Hapi from 'hapi'; + +var registerFunction: Hapi.PluginFunction<{}> = function(server, options, next) { + + server.expose('key', 'value'); + server.plugins.example.key === 'value'; + return next(); +}; + +registerFunction.attributes = { + name: 'example' +}; diff --git a/types/hapi/test/server/realm.ts b/types/hapi/test/server/realm.ts new file mode 100644 index 0000000000..31f764b7ef --- /dev/null +++ b/types/hapi/test/server/realm.ts @@ -0,0 +1,10 @@ + +// From https://hapijs.com/api/16.1.1#serverrealm + +import * as Hapi from 'hapi'; + +var registerFunction: Hapi.PluginFunction<{}> = function(server, options, next) { + + console.log(server.realm.modifiers.route.prefix); + return next(); +}; diff --git a/types/hapi/test/server/register.ts b/types/hapi/test/server/register.ts new file mode 100644 index 0000000000..c04e0b16bc --- /dev/null +++ b/types/hapi/test/server/register.ts @@ -0,0 +1,18 @@ + +// From https://hapijs.com/api/16.1.1#serverregisterplugins-options-callback + +import * as Hapi from 'hapi'; + +const server = new Hapi.Server(); + +server.register({ + register: require('plugin_name'), + options: { + message: 'hello' + } +}, (err) => { + + if (err) { + console.log('Failed loading plugin'); + } +}); diff --git a/types/hapi/test/server/route.ts b/types/hapi/test/server/route.ts new file mode 100644 index 0000000000..0402fd3e89 --- /dev/null +++ b/types/hapi/test/server/route.ts @@ -0,0 +1,12 @@ + +// From https://hapijs.com/api/16.1.1#serverrouteoptions + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +server.route({ method: 'GET', path: '/', handler: function (request, reply) { return reply('ok'); } }); +server.route([ + { method: 'GET', path: '/1', handler: function (request, reply) { return reply('ok'); } }, + { method: 'GET', path: '/2', handler: function (request, reply) { return reply('ok'); } } +]); diff --git a/types/hapi/test/server/select.ts b/types/hapi/test/server/select.ts new file mode 100644 index 0000000000..8a25f45abd --- /dev/null +++ b/types/hapi/test/server/select.ts @@ -0,0 +1,11 @@ + +// From https://hapijs.com/api/16.1.1#serverselectlabels + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80, labels: ['a', 'b'] }); +server.connection({ port: 8080, labels: ['a', 'c'] }); +server.connection({ port: 8081, labels: ['b', 'c'] }); + +const a = server.select('a'); // 80, 8080 +const ac = a.select('c'); // 8080 diff --git a/types/hapi/test/server/settings.ts b/types/hapi/test/server/settings.ts new file mode 100644 index 0000000000..c2ec9ce3ed --- /dev/null +++ b/types/hapi/test/server/settings.ts @@ -0,0 +1,11 @@ + +// From https://hapijs.com/api/16.1.1#serversettings + +import * as Hapi from 'hapi'; +const server = new Hapi.Server({ + app: { + key: 'value' + } +}); + +server.settings.app === { key: 'value' }; diff --git a/types/hapi/test/server/start.ts b/types/hapi/test/server/start.ts new file mode 100644 index 0000000000..a15bb79740 --- /dev/null +++ b/types/hapi/test/server/start.ts @@ -0,0 +1,13 @@ + +// From https://hapijs.com/api/16.1.1#serverstartcallback + +import * as Hapi from 'hapi'; +import * as Hoek from 'hoek'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +server.start((err) => { + + Hoek.assert(!err, err!); + console.log('Server started at: ' + server.info!.uri); +}); diff --git a/types/hapi/test/server/state.ts b/types/hapi/test/server/state.ts new file mode 100644 index 0000000000..2035343a17 --- /dev/null +++ b/types/hapi/test/server/state.ts @@ -0,0 +1,38 @@ + +// From https://hapijs.com/api/16.1.1#serverstatename-options + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +// Set cookie definition + +server.state('session', { + ttl: 24 * 60 * 60 * 1000, // One day + isSecure: true, + path: '/', + encoding: 'base64json' +}); + +// Set state in route handler + +const handler: Hapi.RouteHandler = function (request, reply) { + + let session = request.state.session; + if (!session) { + session = { user: 'joe' }; + } + + session.last = Date.now(); + + return reply('Success').state('session', session); +}; + +// Example 2 + +server.on('request-internal', (request, event, tags) => { + + if (tags.error && tags.state) { + console.error(event); + } +}); diff --git a/types/hapi/test/server/stop.ts b/types/hapi/test/server/stop.ts new file mode 100644 index 0000000000..ddfd07aa8f --- /dev/null +++ b/types/hapi/test/server/stop.ts @@ -0,0 +1,11 @@ + +// From https://hapijs.com/api/16.1.1#serverstopoptions-callback + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80 }); + +server.stop({ timeout: 60 * 1000 }, (err) => { + + console.log('Server stopped'); +}); diff --git a/types/hapi/test/server/table.ts b/types/hapi/test/server/table.ts new file mode 100644 index 0000000000..abe0707c76 --- /dev/null +++ b/types/hapi/test/server/table.ts @@ -0,0 +1,9 @@ + +// From https://hapijs.com/api/16.1.1#servertablehost + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.connection({ port: 80, host: 'example.com' }); +server.route({ method: 'GET', path: '/example', handler: function (request, reply) { return reply(); } }); + +const table = server.table(); diff --git a/types/hapi/test/server/version.ts b/types/hapi/test/server/version.ts new file mode 100644 index 0000000000..064e87e3cd --- /dev/null +++ b/types/hapi/test/server/version.ts @@ -0,0 +1,6 @@ + +// From http://hapijs.com/api#serversettings + +import * as Hapi from 'hapi'; +const server = new Hapi.Server(); +server.version === '8.0.0' diff --git a/types/hapi/tsconfig.json b/types/hapi/tsconfig.json index c7385884c3..01c5a12c89 100644 --- a/types/hapi/tsconfig.json +++ b/types/hapi/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -17,6 +17,79 @@ }, "files": [ "index.d.ts", - "hapi-tests.ts" + "test/connection/table.ts", + "test/continuation/errors.ts", + "test/getting-started/01-creating-a-server.ts", + "test/getting-started/02-adding-routes.ts", + "test/getting-started/03-serving-static-content.ts", + "test/getting-started/04-using-plugins.ts", + "test/path/catch-all.ts", + "test/path/parameters.ts", + "test/plugins/options.ts", + "test/reply/continue.ts", + "test/reply/entity.ts", + "test/reply/redirect.ts", + "test/reply/reply.ts", + "test/reply/state_cookie.ts", + "test/request/event-types.ts", + "test/request/generate-response.ts", + "test/request/get-log.ts", + "test/request/log.ts", + "test/request/set-method.ts", + "test/request/set-url.ts", + "test/request/tail.ts", + "test/response/error-representation.ts", + "test/response/error.ts", + "test/response/events.ts", + "test/response/flow-control.ts", + "test/route/additional-options.ts", + "test/route/auth.ts", + "test/route/config.ts", + "test/route/handler.ts", + "test/route/plugins.ts", + "test/route/prerequisites.ts", + "test/route/public-interface.ts", + "test/route/validate.ts", + "test/server/app.ts", + "test/server/auth.ts", + "test/server/bind.ts", + "test/server/cache.ts", + "test/server/connection-options.ts", + "test/server/connections.ts", + "test/server/decoder.ts", + "test/server/decorate.ts", + "test/server/dependency.ts", + "test/server/emit.ts", + "test/server/encoder.ts", + "test/server/event.ts", + "test/server/expose.ts", + "test/server/ext.ts", + "test/server/handler.ts", + "test/server/info.ts", + "test/server/initialize.ts", + "test/server/inject.ts", + "test/server/listener.ts", + "test/server/load.ts", + "test/server/log.ts", + "test/server/lookup.ts", + "test/server/match.ts", + "test/server/method.ts", + "test/server/methods.ts", + "test/server/mime.ts", + "test/server/new.ts", + "test/server/on.ts", + "test/server/once.ts", + "test/server/path.ts", + "test/server/plugins.ts", + "test/server/realm.ts", + "test/server/register.ts", + "test/server/route.ts", + "test/server/select.ts", + "test/server/settings.ts", + "test/server/start.ts", + "test/server/state.ts", + "test/server/stop.ts", + "test/server/table.ts", + "test/server/version.ts" ] -} \ No newline at end of file +} diff --git a/types/hapi/tslint.json b/types/hapi/tslint.json deleted file mode 100644 index 56c322f9d7..0000000000 --- a/types/hapi/tslint.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "indent": [true, "tabs"], - - // All TODOs - "ban-types": false, - "callable-types": false, - "interface-name": false, - "jsdoc-format": false, - "max-line-length": false, - "no-empty-interface": false, - "unified-signatures": false - } -} diff --git a/types/hapi/v12/hapi-tests.ts b/types/hapi/v12/hapi-tests.ts new file mode 100644 index 0000000000..32d1aff704 --- /dev/null +++ b/types/hapi/v12/hapi-tests.ts @@ -0,0 +1,114 @@ +// Copied directly from 918608a5e007d925f4f60a275881057f07c12619 which seems to +// be the last author to work on v12.0 + + +import * as Hapi from 'hapi'; + +// Create a server with a host and port +var server = new Hapi.Server(); +server.connection({ + host: "localhost", + port: 8000 +}); + +// Add plugins +var plugin: any = { + register: function (plugin: Object, options: Object, next: Function) { + next(); + } +}; + +plugin.register.attributes = { + name: "test", + version: "1.0.0" +}; + +// optional options parameter +server.register({}, function (err) {}); + +// optional options.routes.vhost parameter +server.register({}, { select: 'api', routes: { prefix: '/prefix' } }, function (err) {}); + +//server.pack.register(plugin, (err: Object) => { +// if (err) { throw err; } +//}); + +//server.pack.register([plugin], (err: Object) => { +// if (err) { throw err; } +//}); + +// Add server method +var add = function (a: number, b: number, next: (err: any, result?: any, ttl?: number) => void) { + next(null, a + b); +}; + +server.method("sum", add);//, { cache: { expiresIn: 2000 } }); + +server.methods["sum"](4, 5, (err: any, result: any) => { + console.log(result); +}); + +var addArray = function (array: Array, next: (err: any, result?: any, ttl?: number) => void) { + var sum: number = 0; + array.forEach((item: number) => { + sum += item; + }); + next(null, sum); +}; + +server.method("sumObj", addArray, { + //cache: { expiresIn: 2000 }, + generateKey: (array: Array) => { + return array.join(','); + } +}); + +server.methods["sumObj"]([5, 6], (err: any, result: any) => { + console.log(result); +}); + +// Add the route +server.route({ + method: 'GET', + path: '/hello', + handler: function (request: Hapi.Request, reply: Function) { + reply('hello world'); + } +}); + +server.route([{ + method: 'GET', + path: '/hello2', + handler: function (request: Hapi.Request, reply: Function) { + reply('hello world2'); + } +}]); + +// config.validate parameters should be optional +server.route([{ + method: 'GET', + path: '/hello2', + handler: function(request: Hapi.Request, reply: Function) { + reply('hello world2'); + }, + config: { + validate: { + } + } +}]); + +// Should be able to chain reply options +server.route([{ + method: 'GET', + path: '/chained-notation', + handler: function(request: Hapi.Request, reply: Hapi.IReply) { + reply('chained-notation') + .bytes(16) + .code(200) + .type('text/plain') + .header('X-Custom', 'some-value'); + } +}]); + +// Start the server +server.start(); diff --git a/types/hapi/v12/index.d.ts b/types/hapi/v12/index.d.ts new file mode 100644 index 0000000000..13c9e7a28d --- /dev/null +++ b/types/hapi/v12/index.d.ts @@ -0,0 +1,2331 @@ +// Type definitions for hapi 12.0.1 +// Project: http://github.com/spumko/hapi +// Definitions by: Jason Swearingen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// Note/Disclaimer: +// Copied directly from 918608a5e007d925f4f60a275881057f07c12619 which seems to +// be the last author to work on v12.0 + + +/// + +declare module "hapi" { + import http = require("http"); + import stream = require("stream"); + import Events = require("events"); + + interface IDictionary { + [key: string]: T; + } + + interface IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IThenable; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IThenable; + } + + interface IPromise extends IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IPromise; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IPromise; + catch(onRejected?: (error: any) => U | IThenable): IPromise; + } + + /** Boom Module for errors. https://github.com/hapijs/boom + * boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: */ + export interface IBoom extends Error { + /** if true, indicates this is a Boom object instance. */ + isBoom: boolean; + /** convenience bool indicating status code >= 500. */ + isServer: boolean; + /** the error message. */ + message: string; + /** the formatted response.Can be directly manipulated after object construction to return a custom error response.Allowed root keys: */ + output: { + /** the HTTP status code (typically 4xx or 5xx). */ + statusCode: number; + /** an object containing any HTTP headers where each key is a header name and value is the header content. */ + headers: IDictionary; + /** the formatted object used as the response payload (stringified).Can be directly manipulated but any changes will be lost if reformat() is called.Any content allowed and by default includes the following content: */ + payload: { + /** the HTTP status code, derived from error.output.statusCode. */ + statusCode: number; + /** the HTTP status message (e.g. 'Bad Request', 'Internal Server Error') derived from statusCode. */ + error: string; + /** the error message derived from error.message. */ + message: string; + }; + }; + /** reformat()rebuilds error.output using the other object properties. */ + reformat(): void; + + } + + /** cache functionality via the "CatBox" module. */ + export interface ICatBoxCacheOptions { + /** a prototype function or catbox engine object. */ + engine: any; + /** an identifier used later when provisioning or configuring caching for server methods or plugins. Each cache name must be unique. A single item may omit the name option which defines the default cache. If every cache includes a name, a default memory cache is provisions as well. */ + name?: string; + /** if true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. */ + shared?: boolean; + } + + /** Any connections configuration server defaults can be included to override and customize the individual connection. */ + export interface IServerConnectionOptions extends IConnectionConfigurationServerDefaults { + /** - the public hostname or IP address. Used only to set server.info.host and server.info.uri. If not configured, defaults to the operating system hostname and if not available, to 'localhost'.*/ + host?: string; + /** - sets the host name or IP address the connection will listen on.If not configured, defaults to host if present, otherwise to all available network interfaces (i.e. '0.0.0.0').Set to 127.0.0.1 or localhost to restrict connection to only those coming from the same machine.*/ + address?: string; + /** - the TCP port the connection will listen to.Defaults to an ephemeral port (0) which uses an available port when the server is started (and assigned to server.info.port).If port is a string containing a '/' character, it is used as a UNIX domain socket path and if it starts with '\.\pipe' as a Windows named pipe.*/ + port?: string | number; + /** - the full public URI without the path (e.g. 'http://example.com:8080').If present, used as the connection info.uri otherwise constructed from the connection settings.*/ + uri?: string; + /** - optional node.js HTTP (or HTTPS) http.Server object or any compatible object.If the listener needs to be manually started, set autoListen to false.If the listener uses TLS, set tls to true.*/ + listener?: any; + /** - indicates that the connection.listener will be started manually outside the framework.Cannot be specified with a port setting.Defaults to true.*/ + autoListen?: boolean; + /** caching headers configuration: */ + cache?: { + /** - an array of HTTP response status codes (e.g. 200) which are allowed to include a valid caching directive.Defaults to [200]. */ + statuses: number[]; + }; + /** - a string or string array of labels used to server.select() specific connections matching the specified labels.Defaults to an empty array [](no labels).*/ + labels?: string | string[]; + /** - used to create an HTTPS connection.The tls object is passed unchanged as options to the node.js HTTPS server as described in the node.js HTTPS documentation.Set to true when passing a listener object that has been configured to use TLS directly. */ + tls?: boolean | { key?: string; cert?: string; pfx?: string; } | Object; + + } + + export interface IConnectionConfigurationServerDefaults { + /** application-specific connection configuration which can be accessed via connection.settings.app. Provides a safe place to store application configuration without potential conflicts with the framework internals. Should not be used to configure plugins which should use plugins[name]. Note the difference between connection.settings.app which is used to store configuration values and connection.app which is meant for storing run-time state. */ + app?: any; + /** connection load limits configuration where: */ + load?: { + /** maximum V8 heap size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxHeapUsedBytes: number; + /** maximum process RSS size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxRssBytes: number; + /** maximum event loop delay duration in milliseconds over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxEventLoopDelay: number; + }; + /** plugin-specific configuration which can later be accessed via connection.settings.plugins. Provides a place to store and pass connection-specific plugin configuration. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between connection.settings.plugins which is used to store configuration values and connection.plugins which is meant for storing run-time state. */ + plugins?: any; + /** controls how incoming request URIs are matched against the routing table: */ + router?: { + /** determines whether the paths '/example' and '/EXAMPLE' are considered different resources. Defaults to true. */ + isCaseSensitive: boolean; + /** removes trailing slashes on incoming paths. Defaults to false. */ + stripTrailingSlash: boolean; + }; + /** a route options object used to set the default configuration for every route. */ + routes?: IRouteAdditionalConfigurationOptions; + state?: IServerState; + } + + /** Note that the options object is deeply cloned and cannot contain any values that are unsafe to perform deep copy on.*/ + export interface IServerOptions { + /** application-specific configuration which can later be accessed via server.settings.app. Note the difference between server.settings.app which is used to store static configuration values and server.app which is meant for storing run-time state. Defaults to {}. */ + app?: any; + /** sets up server-side caching. Every server includes a default cache for storing application state. By default, a simple memory-based cache is created which has limited capacity and capabilities. hapi uses catbox for its cache which includes support for common storage solutions (e.g. Redis, MongoDB, Memcached, and Riak). Caching is only utilized if methods and plugins explicitly store their state in the cache. The server cache configuration only defines the storage container itself. cache can be assigned: + a prototype function (usually obtained by calling require() on a catbox strategy such as require('catbox-redis')). + a configuration object with the following options: + enginea prototype function or catbox engine object. + namean identifier used later when provisioning or configuring caching for server methods or plugins. Each cache name must be unique. A single item may omit the name option which defines the default cache. If every cache includes a name, a default memory cache is provisions as well. + sharedif true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. + other options passed to the catbox strategy used. + an array of the above object for configuring multiple cache instances, each with a unique name. When an array of objects is provided, multiple cache connections are established and each array item (except one) must include a name. */ + cache?: string | ICatBoxCacheOptions | Array | any; + /** sets the default connections configuration which can be overridden by each connection where: */ + connections?: IConnectionConfigurationServerDefaults; + /** determines which logged events are sent to the console (this should only be used for development and does not affect which events are actually logged internally and recorded). Set to false to disable all console logging, or to an object*/ + debug?: boolean | { + /** - a string array of server log tags to be displayed via console.error() when the events are logged via server.log() as well as internally generated server logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error. */ + log: string[]; + /** - a string array of request log tags to be displayed via console.error() when the events are logged via request.log() as well as internally generated request logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error.*/ + request: string[]; + }; + /** file system related settings*/ + files?: { + /** sets the maximum number of file etag hash values stored in the etags cache. Defaults to 10000.*/ + etagsCacheMaxSize?: number; + }; + /** process load monitoring*/ + load?: { + /** the frequency of sampling in milliseconds. Defaults to 0 (no sampling).*/ + sampleInterval?: number; + }; + + /** options passed to the mimos module (https://github.com/hapijs/mimos) when generating the mime database used by the server and accessed via server.mime.*/ + mime?: any; + /** if true, does not load the inert (file and directory support), h2o2 (proxy support), and vision (views support) plugins automatically. The plugins can be loaded manually after construction. Defaults to false (plugins loaded). */ + minimal?: boolean; + /** plugin-specific configuration which can later be accessed via server.settings.plugins. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between server.settings.plugins which is used to store static configuration values and server.plugins which is meant for storing run-time state. Defaults to {}.*/ + plugins?: IDictionary; + + } + + export interface IServerViewCompile { + (template: string, options: any): void; + (template: string, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: boolean) => void) => void) => void): void; + } + + export interface IServerViewsAdditionalOptions { + /** path - the root file path used to resolve and load the templates identified when calling reply.view().Defaults to current working directory.*/ + path?: string; + /**partialsPath - the root file path where partials are located.Partials are small segments of template code that can be nested and reused throughout other templates.Defaults to no partials support (empty path). + */ + partialsPath?: string; + /**helpersPath - the directory path where helpers are located.Helpers are functions used within templates to perform transformations and other data manipulations using the template context or other inputs.Each '.js' file in the helpers directory is loaded and the file name is used as the helper name.The files must export a single method with the signature function(context) and return a string.Sub - folders are not supported and are ignored.Defaults to no helpers support (empty path).Note that jade does not support loading helpers this way.*/ + helpersPath?: string; + /**relativeTo - a base path used as prefix for path and partialsPath.No default.*/ + relativeTo?: string; + + /**layout - if set to true or a layout filename, layout support is enabled.A layout is a single template file used as the parent template for other view templates in the same engine.If true, the layout template name must be 'layout.ext' where 'ext' is the engine's extension. Otherwise, the provided filename is suffixed with the engine's extension and loaded.Disable layout when using Jade as it will handle including any layout files independently.Defaults to false.*/ + layout?: boolean; + /**layoutPath - the root file path where layout templates are located (using the relativeTo prefix if present). Defaults to path.*/ + layoutPath?: string; + /**layoutKeyword - the key used by the template engine to denote where primary template content should go.Defaults to 'content'.*/ + layoutKeywork?: string; + /**encoding - the text encoding used by the templates when reading the files and outputting the result.Defaults to 'utf8'.*/ + encoding?: string; + /**isCached - if set to false, templates will not be cached (thus will be read from file on every use).Defaults to true.*/ + isCached?: boolean; + /**allowAbsolutePaths - if set to true, allows absolute template paths passed to reply.view().Defaults to false.*/ + allowAbsolutePaths?: boolean; + /**allowInsecureAccess - if set to true, allows template paths passed to reply.view() to contain '../'.Defaults to false.*/ + allowInsecureAccess?: boolean; + /**compileOptions - options object passed to the engine's compile function. Defaults to empty options {}.*/ + compileOptions?: any; + /**runtimeOptions - options object passed to the returned function from the compile operation.Defaults to empty options {}.*/ + runtimeOptions?: any; + /**contentType - the content type of the engine results.Defaults to 'text/html'.*/ + contentType?: string; + /**compileMode - specify whether the engine compile() method is 'sync' or 'async'.Defaults to 'sync'.*/ + compileMode?: string; + /**context - a global context used with all templates.The global context option can be either an object or a function that takes no arguments and returns a context object.When rendering views, the global context will be merged with any context object specified on the handler or using reply.view().When multiple context objects are used, values from the global context always have lowest precedence.*/ + context?: any; + } + + export interface IServerViewsEnginesOptions extends IServerViewsAdditionalOptions { + /**- the npm module used for rendering the templates.The module object must contain: "module", the rendering function. The required function signature depends on the compileMode settings. + * If the compileMode is 'sync', the signature is compile(template, options), the return value is a function with signature function(context, options), and the method is allowed to throw errors.If the compileMode is 'async', the signature is compile(template, options, callback) where callback has the signature function(err, compiled) where compiled is a function with signature function(context, options, callback) and callback has the signature function(err, rendered).*/ + module: { + compile?(template: any, options: any): (context: any, options: any) => void; + compile?(template: any, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: any) => void) => void) => void): void; + }; + } + + /**Initializes the server views manager + var Hapi = require('hapi'); + var server = new Hapi.Server(); + + server.views({ + engines: { + html: require('handlebars'), + jade: require('jade') + }, + path: '/static/templates' + }); + When server.views() is called within a plugin, the views manager is only available to plugins methods. + */ + export interface IServerViewsConfiguration extends IServerViewsAdditionalOptions { + /** - required object where each key is a file extension (e.g. 'html', 'hbr'), mapped to the npm module used for rendering the templates.Alternatively, the extension can be mapped to an object with the following options:*/ + engines: IDictionary | IServerViewsEnginesOptions; + /** defines the default filename extension to append to template names when multiple engines are configured and not explicit extension is provided for a given template. No default value.*/ + defaultExtension?: string; + } + + /** Concludes the handler activity by setting a response and returning control over to the framework where: + erran optional error response. + resultan optional response payload. + Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first. + FLOW CONTROL: + When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */ + export interface IReply { + (err: Error, + result?: string | number | boolean | Buffer | stream.Stream | IPromise | T, + /** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */ + credentialData?: any + ): IBoom; + /** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */ + (result: string | number | boolean | Buffer | stream.Stream | IPromise | T): Response; + + /** Returns control back to the framework without setting a response. If called in the handler, the response defaults to an empty payload with status code 200. + * The data argument is only used for passing back authentication data and is ignored elsewhere. */ + continue(credentialData?: any): void; + + /** Transmits a file from the file system. The 'Content-Type' header defaults to the matching mime type based on filename extension. The response flow control rules do not apply. */ + file( + /** the file path. */ + path: string, + /** optional settings: */ + options?: { + /** - an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ + filename?: string; + /** specifies whether to include the 'Content-Disposition' header with the response. Available values: + false - header is not included. This is the default value. + 'attachment' + 'inline'*/ + mode?: boolean | string; + /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. */ + lookupCompressed: boolean; + }): void; + /** Concludes the handler activity by returning control over to the router with a templatized view response. + the response flow control rules apply. */ + + view( + /** the template filename and path, relative to the templates path configured via the server views manager. */ + template: string, + /** optional object used by the template to render context-specific result. Defaults to no context {}. */ + context?: {}, + /** optional object used to override the server's views manager configuration for this response. Cannot override isCached, partialsPath, or helpersPath which are only loaded at initialization. */ + options?: any): Response; + /** Concludes the handler activity by returning control over to the router and informing the router that a response has already been sent back directly via request.raw.res and that no further response action is needed + The response flow control rules do not apply. */ + close(options?: { + /** if false, the router will not call request.raw.res.end()) to ensure the response was ended. Defaults to true. */ + end?: boolean; + }): void; + /** Proxies the request to an upstream endpoint. + the response flow control rules do not apply. */ + + proxy(/** an object including the same keys and restrictions defined by the route proxy handler options. */ + options: IProxyHandlerConfig): void; + /** Redirects the client to the specified uri. Same as calling reply().redirect(uri). + he response flow control rules apply. */ + redirect(uri: string): ResponseRedirect; + } + + export interface ISessionHandler { + (request: Request, reply: IReply): void; + } + export interface IRequestHandler { + (request: Request): T; + } + + + export interface IFailAction { + (source: string, error: any, next: () => void): void + } + /** generates a reverse proxy handler */ + export interface IProxyHandlerConfig { + /** the upstream service host to proxy requests to. The same path on the client request will be used as the path on the host.*/ + host?: string; + /** the upstream service port. */ + port?: number; + /** The protocol to use when making a request to the proxied host: + 'http' + 'https'*/ + protocol?: string; + /** an absolute URI used instead of the incoming host, port, protocol, path, and query. Cannot be used with host, port, protocol, or mapUri.*/ + uri?: string; + /** if true, forwards the headers sent from the client to the upstream service being proxied to, headers sent from the upstream service will also be forwarded to the client. Defaults to false.*/ + passThrough?: boolean; + /** localStatePassThrough - if false, any locally defined state is removed from incoming requests before being passed upstream. This is a security feature to prevent local state (e.g. authentication cookies) from leaking upstream to other servers along with the cookies intended for those servers. This value can be overridden on a per state basis via the server.state() passThrough option. Defaults to false.*/ + localStatePassThrough?: boolean; + /**acceptEncoding - if false, does not pass-through the 'Accept-Encoding' HTTP header which is useful when using an onResponse post-processing to avoid receiving an encoded response (e.g. gzipped). Can only be used together with passThrough. Defaults to true (passing header).*/ + acceptEncoding?: boolean; + /** rejectUnauthorized - sets the rejectUnauthorized property on the https agent making the request. This value is only used when the proxied server uses TLS/SSL. When set it will override the node.js rejectUnauthorized property. If false then ssl errors will be ignored. When true the server certificate is verified and an 500 response will be sent when verification fails. This shouldn't be used alongside the agent setting as the agent will be used instead. Defaults to the https agent default value of true.*/ + rejectUnauthorized?: boolean; + /**if true, sets the 'X-Forwarded-For', 'X-Forwarded-Port', 'X-Forwarded-Proto' headers when making a request to the proxied upstream endpoint. Defaults to false.*/ + xforward?: boolean; + /** the maximum number of HTTP redirections allowed, to be followed automatically by the handler. Set to false or 0 to disable all redirections (the response will contain the redirection received from the upstream service). If redirections are enabled, no redirections (301, 302, 307, 308) will be passed along to the client, and reaching the maximum allowed redirections will return an error response. Defaults to false.*/ + redirects?: boolean | number; + /**number of milliseconds before aborting the upstream request. Defaults to 180000 (3 minutes).*/ + timeout?: number; + /** a function used to map the request URI to the proxied URI. Cannot be used together with host, port, protocol, or uri. The function signature is function(request, callback) where: + request - is the incoming request object. + callback - is function(err, uri, headers) where: + err - internal error condition. + uri - the absolute proxy URI. + headers - optional object where each key is an HTTP request header and the value is the header content.*/ + mapUri?: (request: Request, callback: (err: any, uri: string, headers?: { [key: string]: string }) => void) => void; + /** a custom function for processing the response from the upstream service before sending to the client. Useful for custom error handling of responses from the proxied endpoint or other payload manipulation. Function signature is function(err, res, request, reply, settings, ttl) where: - err - internal or upstream error returned from attempting to contact the upstream proxy. - res - the node response object received from the upstream service. res is a readable stream (use the wreck module read method to easily convert it to a Buffer or string). - request - is the incoming request object. - reply - the reply interface function. - settings - the proxy handler configuration. - ttl - the upstream TTL in milliseconds if proxy.ttl it set to 'upstream' and the upstream response included a valid 'Cache-Control' header with 'max-age'.*/ + onResponse?: ( + err: any, + res: http.ServerResponse, + req: Request, + reply: IReply, + settings: IProxyHandlerConfig, + ttl: number + ) => void; + /** if set to 'upstream', applies the upstream response caching policy to the response using the response.ttl() method (or passed as an argument to the onResponse method if provided).*/ + ttl?: number; + /** - a node http(s) agent to be used for connections to upstream server. see https://nodejs.org/api/http.html#http_class_http_agent */ + agent?: http.Agent; + /** sets the maximum number of sockets available per outgoing proxy host connection. false means use the wreck module default value (Infinity). Does not affect non-proxy outgoing client connections. Defaults to Infinity.*/ + maxSockets?: boolean | number; + } + /** TODO: fill in joi definition */ + export interface IJoi { + + } + /** a validation function using the signature function(value, options, next) */ + export interface IValidationFunction { + + (/** the object containing the path parameters. */ + value: any, + /** the server validation options. */ + options: any, + /** the callback function called when validation is completed. */ + next: (err: any, value: any) => void): void; + } + /** a custom error handler function with the signature 'function(request, reply, source, error)` */ + export interface IRouteFailFunction { + /** a custom error handler function with the signature 'function(request, reply, source, error)` */ + ( + /** - the [request object]. */ + request: Request, + /** the continuation reply interface. */ + reply: IReply, + /** the source of the invalid field (e.g. 'path', 'query', 'payload'). */ + source: string, + /** the error object prepared for the client response (including the validation function error under error.data). */ + error: any): void; + } + + /** Each route can be customize to change the default behavior of the request lifecycle using the following options: */ + export interface IRouteAdditionalConfigurationOptions { + /** application specific configuration.Should not be used by plugins which should use plugins[name] instead. */ + app?: any; + /** authentication configuration.Value can be: false to disable authentication if a default strategy is set. + a string with the name of an authentication strategy registered with server.auth.strategy(). + an object */ + auth?: boolean | string | + { + /** the authentication mode.Defaults to 'required' if a server authentication strategy is configured, otherwise defaults to no authentication.Available values: + 'required'authentication is required. + 'optional'authentication is optional (must be valid if present). + 'try'same as 'optional' but allows for invalid authentication. */ + mode?: string; + /** a string array of strategy names in order they should be attempted.If only one strategy is used, strategy can be used instead with the single string value.Defaults to the default authentication strategy which is available only when a single strategy is configured. */ + strategies?: string | Array; + /** if set, the payload (in requests other than 'GET' and 'HEAD') is authenticated after it is processed.Requires a strategy with payload authentication support (e.g.Hawk).Cannot be set to a value other than 'required' when the scheme sets the options.payload to true.Available values: + falseno payload authentication.This is the default value. + 'required'payload authentication required.This is the default value when the scheme sets options.payload to true. + 'optional'payload authentication performed only when the client includes payload authentication information (e.g.hash attribute in Hawk). */ + payload?: string; + /** the application scope required to access the route.Value can be a scope string or an array of scope strings.The authenticated credentials object scope property must contain at least one of the scopes defined to access the route.Set to false to remove scope requirements.Defaults to no scope required. */ + scope?: string | Array | boolean; + /** the required authenticated entity type.If set, must match the entity value of the authentication credentials.Available values: + anythe authentication can be on behalf of a user or application.This is the default value. + userthe authentication must be on behalf of a user. + appthe authentication must be on behalf of an application. */ + entity?: string; + /** + * an object or array of objects specifying the route access rules. Each rule is evaluated against an incoming + * request and access is granted if at least one rule matches. Each rule object must include at least one of: + */ + access?: IRouteAdditionalConfigurationAuthAccess | IRouteAdditionalConfigurationAuthAccess[]; + }; + /** an object passed back to the provided handler (via this) when called. */ + bind?: any; + /** if the route method is 'GET', the route can be configured to include caching directives in the response using the following options */ + cache?: { + /** mines the privacy flag included in clientside caching using the 'Cache-Control' header.Values are: + fault'no privacy flag.This is the default setting. + 'public'mark the response as suitable for public caching. + 'private'mark the response as suitable only for private caching. */ + privacy: string; + /** relative expiration expressed in the number of milliseconds since the item was saved in the cache.Cannot be used together with expiresAt. */ + expiresIn: number; + /** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire.Cannot be used together with expiresIn. */ + expiresAt: string; + }; + /** the Cross- Origin Resource Sharing protocol allows browsers to make cross- origin API calls.CORS is required by web applications running inside a browser which are loaded from a different domain than the API server.CORS headers are disabled by default. To enable, set cors to true, or to an object with the following options: */ + cors?: { + /** a strings array of allowed origin servers ('Access-Control-Allow-Origin').The array can contain any combination of fully qualified origins along with origin strings containing a wildcard '' character, or a single `''origin string. Defaults to any origin['*']`. */ + origin?: Array; + /** if true, matches the value of the incoming 'Origin' header to the list of origin values ('*' matches anything) and if a match is found, uses that as the value of the 'Access-Control-Allow-Origin' response header.When false, the origin config is returned as- is.Defaults to true. */ + matchOrigin?: boolean; + /** if false, prevents the connection from returning the full list of non- wildcard origin values if the incoming origin header does not match any of the values.Has no impact if matchOrigin is set to false.Defaults to true. */ + isOriginExposed?: boolean; + /** number of seconds the browser should cache the CORS response ('Access-Control-Max-Age').The greater the value, the longer it will take before the browser checks for changes in policy.Defaults to 86400 (one day). */ + maxAge?: number; + /** a strings array of allowed headers ('Access-Control-Allow-Headers').Defaults to ['Authorization', 'Content-Type', 'If-None-Match']. */ + headers?: string[]; + /** a strings array of additional headers to headers.Use this to keep the default headers in place. */ + additionalHeaders?: string[]; + /** a strings array of allowed HTTP methods ('Access-Control-Allow-Methods').Defaults to ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS']. */ + methods?: string[]; + /** a strings array of additional methods to methods.Use this to keep the default methods in place. */ + additionalMethods?: string[]; + /** a strings array of exposed headers ('Access-Control-Expose-Headers').Defaults to ['WWW-Authenticate', 'Server-Authorization']. */ + exposedHeaders?: string[]; + /** a strings array of additional headers to exposedHeaders.Use this to keep the default headers in place. */ + additionalExposedHeaders?: string[]; + /** if true, allows user credentials to be sent ('Access-Control-Allow-Credentials').Defaults to false. */ + credentials?: boolean; + /** if false, preserves existing CORS headers set manually before the response is sent.Defaults to true. */ + override?: boolean; + }; + /** defines the behavior for serving static resources using the built-in route handlers for files and directories: */ + files?: {/** determines the folder relative paths are resolved against when using the file and directory handlers. */ + relativeTo: string; + }; + + /** an alternative location for the route handler option. */ + handler?: ISessionHandler | string | IRouteHandlerConfig; + /** an optional unique identifier used to look up the route using server.lookup(). */ + id?: number; + /** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */ + json?: { + /** the replacer function or array.Defaults to no action. */ + replacer?: Function | string[]; + /** number of spaces to indent nested object keys.Defaults to no indentation. */ + space?: number | string; + /** string suffix added after conversion to JSON string.Defaults to no suffix. */ + suffix?: string; + }; + /** enables JSONP support by setting the value to the query parameter name containing the function name used to wrap the response payload.For example, if the value is 'callback', a request comes in with 'callback=me', and the JSON response is '{ "a":"b" }', the payload will be 'me({ "a":"b" });'.Does not work with stream responses. */ + jsonp?: string; + /** determines how the request payload is processed: */ + payload?: { + /** the type of payload representation requested. The value must be one of: + 'data'the incoming payload is read fully into memory.If parse is true, the payload is parsed (JSON, formdecoded, multipart) based on the 'Content- Type' header.If parse is false, the raw Buffer is returned.This is the default value except when a proxy handler is used. + 'stream'the incoming payload is made available via a Stream.Readable interface.If the payload is 'multipart/form-data' and parse is true, fields values are presented as text while files are provided as streams.File streams from a 'multipart/form-data' upload will also have a property hapi containing filename and headers properties. + 'file'the incoming payload in written to temporary file in the directory specified by the server's payload.uploads settings. If the payload is 'multipart/ formdata' and parse is true, fields values are presented as text while files are saved. Note that it is the sole responsibility of the application to clean up the files generated by the framework. This can be done by keeping track of which files are used (e.g. using the request.app object), and listening to the server 'response' event to perform any needed cleaup. */ + output?: string; + /** can be true, false, or gunzip; determines if the incoming payload is processed or presented raw. true and gunzip includes gunzipping when the appropriate 'Content-Encoding' is specified on the received request. If parsing is enabled and the 'Content-Type' is known (for the whole payload as well as parts), the payload is converted into an object when possible. If the format is unknown, a Bad Request (400) error response is sent. Defaults to true, except when a proxy handler is used. The supported mime types are: + 'application/json' + 'application/x-www-form-urlencoded' + 'application/octet-stream' + 'text/ *' + 'multipart/form-data' */ + parse?: string | boolean; + /** a string or an array of strings with the allowed mime types for the endpoint.Defaults to any of the supported mime types listed above.Note that allowing other mime types not listed will not enable them to be parsed, and that if parsing mode is 'parse', the request will result in an error response. */ + allow?: string | string[]; + /** a mime type string overriding the 'Content-Type' header value received.Defaults to no override. */ + override?: string; + /** limits the size of incoming payloads to the specified byte count.Allowing very large payloads may cause the server to run out of memory.Defaults to 1048576 (1MB). */ + maxBytes?: number; + /** payload reception timeout in milliseconds.Sets the maximum time allowed for the client to transmit the request payload (body) before giving up and responding with a Request Timeout (408) error response.Set to false to disable.Defaults to 10000 (10 seconds). */ + timeout?: number; + /** the directory used for writing file uploads.Defaults to os.tmpDir(). */ + uploads?: string; + /** determines how to handle payload parsing errors. Allowed values are: + 'error'return a Bad Request (400) error response. This is the default value. + 'log'report the error but continue processing the request. + 'ignore'take no action and continue processing the request. */ + failAction?: string; + }; + /** pluginspecific configuration.plugins is an object where each key is a plugin name and the value is the plugin configuration. */ + plugins?: IDictionary; + /** an array with [route prerequisites] methods which are executed in serial or in parallel before the handler is called. */ + pre?: any[]; + /** validation rules for the outgoing response payload (response body).Can only validate object response: */ + response?: { + /** the default HTTP status code when the payload is empty. Value can be 200 or 204. + Note that a 200 status code is converted to a 204 only at the time or response transmission + (the response status code will remain 200 throughout the request lifecycle unless manually set). Defaults to 200. */ + emptyStatusCode?: number; + /** the default response object validation rules (for all non-error responses) expressed as one of: + true - any payload allowed (no validation performed). This is the default. + false - no payload allowed. + a Joi validation object. + a validation function using the signature function(value, options, next) where: + value - the object containing the response object. + options - the server validation options. + next(err) - the callback function called when validation is completed. */ + schema?: boolean | any; + /** HTTP status- codespecific validation rules.The status key is set to an object where each key is a 3 digit HTTP status code and the value has the same definition as schema.If a response status code is not present in the status object, the schema definition is used, expect for errors which are not validated by default. */ + status?: { [statusCode: number] : boolean | any }; + /** the percent of responses validated (0100).Set to 0 to disable all validation.Defaults to 100 (all responses). */ + sample?: number; + /** defines what to do when a response fails validation.Options are: + errorreturn an Internal Server Error (500) error response.This is the default value. + loglog the error but send the response. */ + failAction?: string; + /** if true, applies the validation rule changes to the response.Defaults to false. */ + modify?: boolean; + /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ + options?: any; + }; + /** sets common security headers (disabled by default).To enable set security to true or to an object with the following options */ + security?: boolean | { + /** controls the 'Strict-Transport-Security' header.If set to true the header will be set to max- age=15768000, if specified as a number the maxAge parameter will be set to that number.Defaults to true.You may also specify an object with the following fields: */ + hsts?: boolean | number | { + /** the max- age portion of the header, as a number.Default is 15768000. */ + maxAge?: number; + /** a boolean specifying whether to add the includeSubdomains flag to the header. */ + includeSubdomains?: boolean; + /** a boolean specifying whether to add the 'preload' flag (used to submit domains inclusion in Chrome's HTTP Strict Transport Security (HSTS) preload list) to the header. */ + preload?: boolean; + }; + /** controls the 'X-Frame-Options' header.When set to true the header will be set to DENY, you may also specify a string value of 'deny' or 'sameorigin'.To use the 'allow-from' rule, you must set this to an object with the following fields: */ + xframe?: { + /** either 'deny', 'sameorigin', or 'allow-from' */ + rule: string; + /** when rule is 'allow-from' this is used to form the rest of the header, otherwise this field is ignored.If rule is 'allow-from' but source is unset, the rule will be automatically changed to 'sameorigin'. */ + source: string; + }; + /** boolean that controls the 'X-XSS-PROTECTION' header for IE.Defaults to true which sets the header to equal '1; mode=block'.NOTE: This setting can create a security vulnerability in versions of IE below 8, as well as unpatched versions of IE8.See here and here for more information.If you actively support old versions of IE, it may be wise to explicitly set this flag to false. */ + xss?: boolean; + /** boolean controlling the 'X-Download-Options' header for IE, preventing downloads from executing in your context.Defaults to true setting the header to 'noopen'. */ + noOpen?: boolean; + /** boolean controlling the 'X-Content-Type-Options' header.Defaults to true setting the header to its only and default option, 'nosniff'. */ + noSniff?: boolean; + }; + /** HTTP state management (cookies) allows the server to store information on the client which is sent back to the server with every request (as defined in RFC 6265).state supports the following options: */ + state?: { + /** determines if incoming 'Cookie' headers are parsed and stored in the request.state object.Defaults to true. */ + parse: boolean; + /** determines how to handle cookie parsing errors.Allowed values are: + 'error'return a Bad Request (400) error response.This is the default value. + 'log'report the error but continue processing the request. + 'ignore'take no action. */ + failAction: string; + }; + /** request input validation rules for various request components.When using a Joi validation object, the values of the other inputs (i.e.headers, query, params, payload, and auth) are made available under the validation context (accessible in rules as Joi.ref('$query.key')).Note that validation is performed in order(i.e.headers, params, query, payload) and if type casting is used (converting a string to number), the value of inputs not yet validated will reflect the raw, unvalidated and unmodified values.The validate object supports: */ + validate?: { + /** validation rules for incoming request headers.Values allowed: + * trueany headers allowed (no validation performed).This is the default. + falseno headers allowed (this will cause all valid HTTP requests to fail). + a Joi validation object. + a validation function using the signature function(value, options, next) where: + valuethe object containing the request headers. + optionsthe server validation options. + next(err, value)the callback function called when validation is completed. + */ + headers?: boolean | IJoi | IValidationFunction; + + + /** validation rules for incoming request path parameters, after matching the path against the route and extracting any parameters then stored in request.params.Values allowed: + trueany path parameters allowed (no validation performed).This is the default. + falseno path variables allowed. + a Joi validation object. + a validation function using the signature function(value, options, next) where: + valuethe object containing the path parameters. + optionsthe server validation options. + next(err, value)the callback function called when validation is completed. */ + params?: boolean | IJoi | IValidationFunction; + /** validation rules for an incoming request URI query component (the key- value part of the URI between '?' and '#').The query is parsed into its individual key- value pairs (using the qs module) and stored in request.query prior to validation.Values allowed: + trueany query parameters allowed (no validation performed).This is the default. + falseno query parameters allowed. + a Joi validation object. + a validation function using the signature function(value, options, next) where: + valuethe object containing the query parameters. + optionsthe server validation options. + next(err, value)the callback function called when validation is completed. */ + query?: boolean | IJoi | IValidationFunction; + /** validation rules for an incoming request payload (request body).Values allowed: + trueany payload allowed (no validation performed).This is the default. + falseno payload allowed. + a Joi validation object. + a validation function using the signature function(value, options, next) where: + valuethe object containing the payload object. + optionsthe server validation options. + next(err, value)the callback function called when validation is completed. */ + payload?: boolean | IJoi | IValidationFunction; + /** an optional object with error fields copied into every validation error response. */ + errorFields?: any; + /** determines how to handle invalid requests.Allowed values are: + 'error'return a Bad Request (400) error response.This is the default value. + 'log'log the error but continue processing the request. + 'ignore'take no action. + OR a custom error handler function with the signature 'function(request, reply, source, error)` where: + requestthe request object. + replythe continuation reply interface. + sourcethe source of the invalid field (e.g. 'path', 'query', 'payload'). + errorthe error object prepared for the client response (including the validation function error under error.data). */ + failAction?: string | IRouteFailFunction; + /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ + options?: any; + }; + /** define timeouts for processing durations: */ + timeout?: { + /** response timeout in milliseconds.Sets the maximum time allowed for the server to respond to an incoming client request before giving up and responding with a Service Unavailable (503) error response.Disabled by default (false). */ + server: boolean | number; + /** by default, node sockets automatically timeout after 2 minutes.Use this option to override this behavior.Defaults to undefined which leaves the node default unchanged.Set to false to disable socket timeouts. */ + socket: boolean | number; + }; + + /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). + *route description used for generating documentation (string). + */ + description?: string; + /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). + *route notes used for generating documentation (string or array of strings). + */ + notes?: string | string[]; + /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). + *route tags used for generating documentation (array of strings). + */ + tags?: string[] + } + + /** + * specifying the route access rules. Each rule is evaluated against an incoming request and access is granted if at least one rule matches + */ + export interface IRouteAdditionalConfigurationAuthAccess { + /** + * the application scope required to access the route. Value can be a scope string or an array of scope strings. + * The authenticated credentials object scope property must contain at least one of the scopes defined to access the route. + * If a scope string begins with a + character, that scope is required. If a scope string begins with a ! character, + * that scope is forbidden. For example, the scope ['!a', '+b', 'c', 'd'] means the incoming request credentials' + * scope must not include 'a', must include 'b', and must include on of 'c' or 'd'. You may also access properties + * on the request object (query and params} to populate a dynamic scope by using {} characters around the property name, + * such as 'user-{params.id}'. Defaults to false (no scope requirements). + */ + scope?: string | Array | boolean; + /** the required authenticated entity type. If set, must match the entity value of the authentication credentials. Available values: + * any - the authentication can be on behalf of a user or application. This is the default value. + * user - the authentication must be on behalf of a user which is identified by the presence of a user attribute in the credentials object returned by the authentication strategy. + * app - the authentication must be on behalf of an application which is identified by the lack of presence of a user attribute in the credentials object returned by the authentication strategy. + */ + entity?: string; + } + + /** server.realm http://hapijs.com/api#serverrealm + The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), + the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin). + Realms are a limited version of a sandbox where plugins can maintain state used by the framework when adding routes, extensions, and other properties. + The server.realm object should be considered read-only and must not be changed directly except for the plugins property can be directly manipulated by the plugins (each setting its own under plugins[name]). + exports.register = function (server, options, next) { + console.log(server.realm.modifiers.route.prefix); + return next(); + }; + */ + export interface IServerRealm { + /** when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method */ + modifiers: { + /** routes preferences: */ + route: { + /** - the route path prefix used by any calls to server.route() from the server. */ + prefix: string; + /** the route virtual host settings used by any calls to server.route() from the server. */ + vhost: string; + }; + + }; + /** the active plugin name (empty string if at the server root). */ + plugin: string; + /** plugin-specific state to be shared only among activities sharing the same active state. plugins is an object where each key is a plugin name and the value is the plugin state. */ + plugins: IDictionary; + /** settings overrides */ + settings: { + files: { + relativeTo: any; + }; + bind: any; + } + } + /** server.state(name, [options]) http://hapijs.com/api#serverstatename-options + HTTP state management uses client cookies to persist a state across multiple requests. Registers a cookie definitions where:*/ + export interface IServerState { +/** - the cookie name string. */name: string; + +/** - are the optional cookie settings: */options: { +/** - time - to - live in milliseconds.Defaults to null (session time- life - cookies are deleted when the browser is closed).*/ttl: number; +/** - sets the 'Secure' flag.Defaults to false.*/isSecure: boolean; +/** - sets the 'HttpOnly' flag.Defaults to false.*/isHttpOnly: boolean +/** - the path scope.Defaults to null (no path).*/path: any; +/** - the domain scope.Defaults to null (no domain). */domain: any; + /** if present and the cookie was not received from the client or explicitly set by the route handler, the cookie is automatically added to the response with the provided value. The value can be a function with signature function(request, next) where: + request - the request object. + next - the continuation function using the function(err, value) signature.*/ + autoValue: (request: Request, next: (err: any, value: any) => void) => void; + /** - encoding performs on the provided value before serialization. Options are: + 'none' - no encoding. When used, the cookie value must be a string. This is the default value. + 'base64' - string value is encoded using Base64. + 'base64json' - object value is JSON-stringified than encoded using Base64. + 'form' - object value is encoded using the x-www-form-urlencoded method. + 'iron' - Encrypts and sign the value using iron.*/ + encoding: string; +/** - an object used to calculate an HMAC for cookie integrity validation.This does not provide privacy, only a mean to verify that the cookie value was generated by the server.Redundant when 'iron' encoding is used.Options are:*/sign: { +/** - algorithm options.Defaults to require('iron').defaults.integrity.*/integrity: any; +/** - password used for HMAC key generation.*/password: string; + }; +/** - password used for 'iron' encoding.*/password: string; +/** - options for 'iron' encoding.Defaults to require('iron').defaults.*/iron: any; +/** - if false, errors are ignored and treated as missing cookies.*/ignoreErrors: boolean; +/** - if true, automatically instruct the client to remove invalid cookies.Defaults to false.*/clearInvalid: boolean; +/** - if false, allows any cookie value including values in violation of RFC 6265. Defaults to true.*/strictHeader: boolean; +/** - overrides the default proxy localStatePassThrough setting.*/passThrough: any; + }; + } + + export interface IFileHandlerConfig { + /** a path string or function as described above.*/ + path: string; + /** an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ + filename?: string; + /**- specifies whether to include the 'Content-Disposition' header with the response. Available values: + false - header is not included. This is the default value. + 'attachment' + 'inline'*/ + mode?: boolean | string; + /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false.*/ + lookupCompressed: boolean; + } + + /**http://hapijs.com/api#route-handler + Built-in handlers + + The framework comes with a few built-in handler types available by setting the route handler config to an object containing one of these keys.*/ + export interface IRouteHandlerConfig { + /** generates a static file endpoint for serving a single file. file can be set to: + a relative or absolute file path string (relative paths are resolved based on the route files configuration). + a function with the signature function(request) which returns the relative or absolute file path. + an object with the following options */ + file?: string | IRequestHandler | IFileHandlerConfig; + /** directory - generates a directory endpoint for serving static content from a directory. Routes using the directory handler must include a path parameter at the end of the path string (e.g. /path/to/somewhere/{param} where the parameter name does not matter). The path parameter can use any of the parameter options (e.g. {param} for one level files only, {param?} for one level files or the directory root, {param*} for any level, or {param*3} for a specific level). If additional path parameters are present, they are ignored for the purpose of selecting the file system resource. The directory handler is an object with the following options: + path - (required) the directory root path (relative paths are resolved based on the route files configuration). Value can be: + a single path string used as the prefix for any resources requested by appending the request path parameter to the provided string. + an array of path strings. Each path will be attempted in order until a match is found (by following the same process as the single path string). + a function with the signature function(request) which returns the path string or an array of path strings. If the function returns an error, the error is passed back to the client in the response. + index - optional boolean|string|string[], determines if an index file will be served if found in the folder when requesting a directory. The given string or strings specify the name(s) of the index file to look for. If true, looks for 'index.html'. Any falsy value disables index file lookup. Defaults to true. + listing - optional boolean, determines if directory listing is generated when a directory is requested without an index document. Defaults to false. + showHidden - optional boolean, determines if hidden files will be shown and served. Defaults to false. + redirectToSlash - optional boolean, determines if requests for a directory without a trailing slash are redirected to the same path with the missing slash. Useful for ensuring relative links inside the response are resolved correctly. Disabled when the server config router.stripTrailingSlash is true.Defaults to false. + lookupCompressed - optional boolean, instructs the file processor to look for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. + defaultExtension - optional string, appended to file requests if the requested file is not found. Defaults to no extension.*/ + directory?: { + path: string | Array | IRequestHandler | IRequestHandler>; + index?: boolean | string | string[]; + listing?: boolean; + showHidden?: boolean; + redirectToSlash?: boolean; + lookupCompressed?: boolean; + defaultExtension?: string; + }; + proxy?: IProxyHandlerConfig; + view?: string | { + template: string; + context: { + payload: any; + params: any; + query: any; + pre: any; + } + }; + config?: { + handler: any; + bind: any; + app: any; + plugins: { + [name: string]: any; + }; + pre: Array<() => void>; + validate: { + headers: any; + params: any; + query: any; + payload: any; + errorFields?: any; + failAction?: string | IFailAction; + }; + payload: { + output: { + data: any; + stream: any; + file: any; + }; + parse?: any; + allow?: string | Array; + override?: string; + maxBytes?: number; + uploads?: number; + failAction?: string; + }; + response: { + schema: any; + sample: number; + failAction: string; + }; + cache: { + privacy: string; + expiresIn: number; + expiresAt: number; + }; + auth: string | boolean | { + mode: string; + strategies: Array; + payload?: boolean | string; + tos?: boolean | string; + scope?: string | Array; + entity: string; + }; + cors?: boolean; + jsonp?: string; + description?: string; + notes?: string | Array; + tags?: Array; + }; + } + /** Route configuration + The route configuration object*/ + export interface IRouteConfiguration { + /** - (required) the absolute path used to match incoming requests (must begin with '/'). Incoming requests are compared to the configured paths based on the connection router configuration option.The path can include named parameters enclosed in {} which will be matched against literal values in the request as described in Path parameters.*/ + path: string; + /** - (required) the HTTP method.Typically one of 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', or 'OPTIONS'.Any HTTP method is allowed, except for 'HEAD'.Use '*' to match against any HTTP method (only when an exact match was not found, and any match with a specific method will be given a higher priority over a wildcard match). + * Can be assigned an array of methods which has the same result as adding the same route with different methods manually.*/ + method: string | string[]; + /** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/ + vhost?: string; + /** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/ + handler: ISessionHandler | string | IRouteHandlerConfig; + /** - additional route options.*/ + config?: IRouteAdditionalConfigurationOptions; + } + /** Route public interface When route information is returned or made available as a property. http://hapijs.com/api#route-public-interface */ + export interface IRoute { + + + /** the route HTTP method. */ + method: string; + /** the route path. */ + path: string; + /** the route vhost option if configured. */ + vhost?: string | Array; + /** the [active realm] associated with the route.*/ + realm: IServerRealm; + /** the [route options] object with all defaults applied. */ + settings: IRouteAdditionalConfigurationOptions; + } + + export interface IServerAuthScheme { + /** authenticate(request, reply) - required function called on each incoming request configured with the authentication scheme where: + request - the request object. + reply - the reply interface the authentication method must call when done authenticating the request where: + reply(err, response, result) - is called if authentication failed where: + err - any authentication error. + response - any authentication response action such as redirection. Ignored if err is present, otherwise required. + result - an object containing: + credentials - the authenticated credentials. + artifacts - optional authentication artifacts. + reply.continue(result) - is called if authentication succeeded where: + result - same object as result above. + When the scheme authenticate() method implementation calls reply() with an error condition, the specifics of the error affect whether additional authentication strategies will be attempted if configured for the route. + .If the err returned by the reply() method includes a message, no additional strategies will be attempted. + If the err does not include a message but does include a scheme name (e.g. Boom.unauthorized(null, 'Custom')), additional strategies will be attempted in order of preference. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + var scheme = function (server, options) { + return { + authenticate: function (request, reply) { + var req = request.raw.req; + var authorization = req.headers.authorization; + if (!authorization) { + return reply(Boom.unauthorized(null, 'Custom')); + } + return reply(null, { credentials: { user: 'john' } }); + } + }; + }; + server.auth.scheme('custom', scheme);*/ + authenticate(request: Request, reply: IReply): void; + /** payload(request, reply) - optional function called to authenticate the request payload where: + request - the request object. + reply(err, response) - is called if authentication failed where: + err - any authentication error. + response - any authentication response action such as redirection. Ignored if err is present, otherwise required. + reply.continue() - is called if payload authentication succeeded. + When the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'.*/ + payload?(request: Request, reply: IReply): void; + /** response(request, reply) - optional function called to decorate the response with authentication headers before the response headers or payload is written where: + request - the request object. + reply(err, response) - is called if an error occurred where: + err - any authentication error. + response - any authentication response to send instead of the current response. Ignored if err is present, otherwise required. + reply.continue() - is called if the operation succeeded.*/ + response?(request: Request, reply: IReply): void; + /** an optional object */ + options?: { + /** if true, requires payload validation as part of the scheme and forbids routes from disabling payload auth validation. Defaults to false.*/ + payload: boolean; + } + } + + + + export interface IServerInject { + (options: string | { + /** the request HTTP method (e.g. 'POST'). Defaults to 'GET'.*/ + method: string; + /** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/ + url: string; + /** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/ + headers?: IDictionary; + /** n optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/ + payload?: string | {} | Buffer; + /** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/ + credentials?: any; + /** an optional artifacts object containing authentication artifact information. The artifacts are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Ignored if set without credentials. Defaults to no artifacts.*/ + artifacts?: any; + /** sets the initial value of request.app*/ + app?: any; + /** sets the initial value of request.plugins*/ + plugins?: any; + /** allows access to routes with config.isInternal set to true. Defaults to false.*/ + allowInternals?: boolean; + /** sets the remote address for the incoming connection.*/ + remoteAddress?: boolean; + /**object with options used to simulate client request stream conditions for testing: + error - if true, emits an 'error' event after payload transmission (if any). Defaults to false. + close - if true, emits a 'close' event after payload transmission (if any). Defaults to false. + end - if false, does not end the stream. Defaults to true.*/ + simulate?: { + error: boolean; + close: boolean; + end: boolean; + }; + }, + callback: ( + /**the response object where: + statusCode - the HTTP status code. + headers - an object containing the headers set. + payload - the response payload string. + rawPayload - the raw response payload buffer. + raw - an object with the injection request and response objects: + req - the simulated node request object. + res - the simulated node response object. + result - the raw handler response (e.g. when not a stream or a view) before it is serialized for transmission. If not available, the value is set to payload. Useful for inspection and reuse of the internal objects returned (instead of parsing the response string). + request - the request object.*/ + res: { statusCode: number; headers: IDictionary; payload: string; rawPayload: Buffer; raw: { req: http.ClientRequest; res: http.ServerResponse }; result: string; request: Request }) => void + ): void; + + } + + + /** host - optional host to filter routes matching a specific virtual host. Defaults to all virtual hosts. + The return value is an array where each item is an object containing: + info - the connection.info the connection the table was generated for. + labels - the connection labels. + table - an array of routes where each route contains: + settings - the route config with defaults applied. + method - the HTTP method in lower case. + path - the route path.*/ + export interface IConnectionTable { + info: any; + labels: any; + table: IRoute[]; + } + + export interface ICookieSettings { + /** - time - to - live in milliseconds.Defaults to null (session time- life - cookies are deleted when the browser is closed).*/ + ttl?: number; + /** - sets the 'Secure' flag.Defaults to false.*/ + isSecure?: boolean; + /** - sets the 'HttpOnly' flag.Defaults to false.*/ + isHttpOnly?: boolean; + /** - the path scope.Defaults to null (no path).*/ + path?: string; + /** - the domain scope.Defaults to null (no domain).*/ + domain?: any; + /** - if present and the cookie was not received from the client or explicitly set by the route handler, the cookie is automatically added to the response with the provided value.The value can be a function with signature function(request, next) where: + request - the request object. + next - the continuation function using the function(err, value) signature.*/ + autoValue?: (request: Request, next: (err: any, value: any) => void) => void; + /** - encoding performs on the provided value before serialization.Options are: + 'none' - no encoding.When used, the cookie value must be a string.This is the default value. + 'base64' - string value is encoded using Base64. + 'base64json' - object value is JSON- stringified than encoded using Base64. + 'form' - object value is encoded using the x- www - form - urlencoded method. */ + encoding?: string; + /** - an object used to calculate an HMAC for cookie integrity validation.This does not provide privacy, only a mean to verify that the cookie value was generated by the server.Redundant when 'iron' encoding is used.Options are: + integrity - algorithm options.Defaults to require('iron').defaults.integrity. + password - password used for HMAC key generation. */ + sign?: { integrity: any; password: string; } + password?: string; + iron?: any; + ignoreErrors?: boolean; + clearInvalid?: boolean; + strictHeader?: boolean; + passThrough?: any; + } + + /** method - the method function with the signature is one of: + function(arg1, arg2, ..., argn, next) where: + arg1, arg2, etc. - the method function arguments. + next - the function called when the method is done with the signature function(err, result, ttl) where: + err - error response if the method failed. + result - the return value. + ttl - 0 if result is valid but cannot be cached. Defaults to cache policy. + function(arg1, arg2, ..., argn) where: + arg1, arg2, etc. - the method function arguments. + the callback option is set to false. + the method must returns a value (result, Error, or a promise) or throw an Error.*/ + export interface IServerMethod { + //(): void; + //(next: (err: any, result: any, ttl: number) => void): void; + //(arg1: any): void; + //(arg1: any, arg2: any, next: (err: any, result: any, ttl: number) => void): void; + //(arg1: any, arg2: any): void; + (...args: any[]): void; + + } + /** options - optional configuration: + bind - a context object passed back to the method function (via this) when called. Defaults to active context (set via server.bind() when the method is registered. + cache - the same cache configuration used in server.cache(). + callback - if false, expects the method to be a synchronous function. Note that using a synchronous function with caching will convert the method interface to require a callback as an additional argument with the signature function(err, result, cached, report) since the cache interface cannot return values synchronously. Defaults to true. + generateKey - a function used to generate a unique key (for caching) from the arguments passed to the method function (the callback argument is not passed as input). The server will automatically generate a unique key if the function's arguments are all of types 'string', 'number', or 'boolean'. However if the method uses other types of arguments, a key generation function must be provided which takes the same arguments as the function and returns a unique string (or null if no key can be generated).*/ + export interface IServerMethodOptions { + bind?: any; + cache?: ICatBoxCacheOptions; + callback?: boolean; + generateKey?(args: any[]): string; + } + /** Request object + + The request object is created internally for each incoming request. It is different from the node.js request object received from the HTTP server callback (which is available in request.raw.req). The request object methods and properties change throughout the request lifecycle. + Request events + + The request object supports the following events: + + 'peek' - emitted for each chunk of payload data read from the client connection. The event method signature is function(chunk, encoding). + 'finish' - emitted when the request payload finished reading. The event method signature is function (). + 'disconnect' - emitted when a request errors or aborts unexpectedly. + var Crypto = require('crypto'); + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.ext('onRequest', function (request, reply) { + + var hash = Crypto.createHash('sha1'); + request.on('peek', function (chunk) { + + hash.update(chunk); + }); + + request.once('finish', function () { + + console.log(hash.digest('hex')); + }); + + request.once('disconnect', function () { + + console.error('request aborted'); + }); + + return reply.continue(); + });*/ + export class Request extends Events.EventEmitter { + /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ + app: any; + /** authentication information*/ + auth: { + /** true is the request has been successfully authenticated, otherwise false.*/ + isAuthenticated: boolean; + /** the credential object received during the authentication process. The presence of an object does not mean successful authentication. can be set in the validate function's callback.*/ + credentials: any; + /** an artifact object received from the authentication strategy and used in authentication-related actions.*/ + artifacts: any; + /** the route authentication mode.*/ + mode: any; + /** the authentication error is failed and mode set to 'try'.*/ + error: any; + /** an object used by the ['cookie' authentication scheme] https://github.com/hapijs/hapi-auth-cookie */ + session: any + }; + /** the connection used by this request*/ + connection: ServerConnection; + /** the node domain object used to protect against exceptions thrown in extensions, handlers and route prerequisites. Can be used to manually bind callback functions otherwise bound to other domains.*/ + domain: any; + /** the raw request headers (references request.raw.headers).*/ + headers: IDictionary; + /** a unique request identifier (using the format '{now}:{connection.info.id}:{5 digits counter}').*/ + id: number; + /** request information */ + info: { + /** request reception timestamp. */ + received: number; + /** request response timestamp (0 is not responded yet). */ + responded: number; + /** remote client IP address. */ + + remoteAddress: string; + /** remote client port. */ + remotePort: number; + /** content of the HTTP 'Referrer' (or 'Referer') header. */ + referrer: string; + /** content of the HTTP 'Host' header (e.g. 'example.com:8080'). */ + host: string; + /** the hostname part of the 'Host' header (e.g. 'example.com').*/ + hostname: string; + }; + /** the request method in lower case (e.g. 'get', 'post'). */ + method: string; + /** the parsed content-type header. Only available when payload parsing enabled and no payload error occurred. */ + mime: string; + /** an object containing the values of params, query, and payload before any validation modifications made. Only set when input validation is performed.*/ + orig: { + params: any; + query: any; + payload: any; + }; + /** an object where each key is a path parameter name with matching value as described in Path parameters.*/ + params: IDictionary; + /** an array containing all the path params values in the order they appeared in the path.*/ + paramsArray: string[]; + /** the request URI's path component. */ + path: string; + /** the request payload based on the route payload.output and payload.parse settings.*/ + payload: stream.Readable | Buffer | any; + /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state.*/ + plugins: any; + /** an object where each key is the name assigned by a route prerequisites function. The values are the raw values provided to the continuation function as argument. For the wrapped response object, use responses.*/ + pre: IDictionary; + /** the response object when set. The object can be modified but must not be assigned another object. To replace the response with another from within an extension point, use reply(response) to override with a different response. Contains null when no response has been set (e.g. when a request terminates prematurely when the client disconnects).*/ + response: Response; + /**preResponses - same as pre but represented as the response object created by the pre method.*/ + preResponses: any; + /**an object containing the query parameters.*/ + query: any; + /** an object containing the Node HTTP server objects. Direct interaction with these raw objects is not recommended.*/ + raw: { + req: http.ClientRequest; + res: http.ServerResponse; + }; + /** the route public interface.*/ + route: IRoute; + /** the server object. */ + server: Server; + /** Special key reserved for plugins implementing session support. Plugins utilizing this key must check for null value to ensure there is no conflict with another similar server. */ + session: any; + /** an object containing parsed HTTP state information (cookies) where each key is the cookie name and value is the matching cookie content after processing using any registered cookie definition. */ + state: any; + /** complex object contining details on the url */ + url: { + /** null when i tested */ + auth: any; + /** null when i tested */ + hash: any; + /** null when i tested */ + host: any; + /** null when i tested */ + hostname: any; + href: string; + path: string; + /** path without search*/ + pathname: string; + /** null when i tested */ + port: any; + /** null when i tested */ + protocol: any; + /** querystring parameters*/ + query: IDictionary; + /** querystring parameters as a string*/ + search: string; + /** null when i tested */ + slashes: any; + }; + /** request.setUrl(url) + + Available only in 'onRequest' extension methods. + + Changes the request URI before the router begins processing the request where: + + url - the new request path value. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.ext('onRequest', function (request, reply) { + + // Change all requests to '/test' + request.setUrl('/test'); + return reply.continue(); + });*/ + setUrl(url: string): void; + /** request.setMethod(method) + + Available only in 'onRequest' extension methods. + + Changes the request method before the router begins processing the request where: + + method - is the request HTTP method (e.g. 'GET'). + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.ext('onRequest', function (request, reply) { + + // Change all requests to 'GET' + request.setMethod('GET'); + return reply.continue(); + });*/ + setMethod(method: string): void; + /** request.log(tags, [data, [timestamp]]) + + Always available. + + Logs request-specific events. When called, the server emits a 'request' event which can be used by other listeners or plugins. The arguments are: + + data - an optional message string or object with the application data being logged. + timestamp - an optional timestamp expressed in milliseconds. Defaults to Date.now() (now). + Any logs generated by the server internally will be emitted only on the 'request-internal' channel and will include the event.internal flag set to true. + + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.on('request', function (request, event, tags) { + + if (tags.error) { + console.log(event); + } + }); + + var handler = function (request, reply) { + + request.log(['test', 'error'], 'Test event'); + return reply(); + }; + */ + log( + /** a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events.*/ + tags: string | string[], + /** an optional message string or object with the application data being logged.*/ + data?: string, + /** an optional timestamp expressed in milliseconds. Defaults to Date.now() (now).*/ + timestamp?: number): void; + /** request.getLog([tags], [internal]) + + Always available. + + Returns an array containing the events matching any of the tags specified (logical OR) + request.getLog(); + request.getLog('error'); + request.getLog(['error', 'auth']); + request.getLog(['error'], true); + request.getLog(false);*/ + + getLog( + /** is a single tag string or array of tag strings. If no tags specified, returns all events.*/ + tags?: string, + /** filters the events to only those with a matching event.internal value. If true, only internal logs are included. If false, only user event are included. Defaults to all events (undefined).*/ + internal?: boolean): string[]; + + /** request.tail([name]) + + Available until immediately after the 'response' event is emitted. + + Adds a request tail which has to complete before the request lifecycle is complete where: + + name - an optional tail name used for logging purposes. + Returns a tail function which must be called when the tail activity is completed. + + Tails are actions performed throughout the request lifecycle, but which may end after a response is sent back to the client. For example, a request may trigger a database update which should not delay sending back a response. However, it is still desirable to associate the activity with the request when logging it (or an error associated with it). + + When all tails completed, the server emits a 'tail' event. + + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + var get = function (request, reply) { + + var dbTail = request.tail('write to database'); + + db.save('key', 'value', function () { + + dbTail(); + }); + + return reply('Success!'); + }; + + server.route({ method: 'GET', path: '/', handler: get }); + + server.on('tail', function (request) { + + console.log('Request completed including db activity'); + });*/ + tail( + /** an optional tail name used for logging purposes.*/ + name?: string): Function; + } + /** Response events + + The response object supports the following events: + + 'peek' - emitted for each chunk of data written back to the client connection. The event method signature is function(chunk, encoding). + 'finish' - emitted when the response finished writing but before the client response connection is ended. The event method signature is function (). + var Crypto = require('crypto'); + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.ext('onPreResponse', function (request, reply) { + + var response = request.response; + if (response.isBoom) { + return reply(); + } + + var hash = Crypto.createHash('sha1'); + response.on('peek', function (chunk) { + + hash.update(chunk); + }); + + response.once('finish', function () { + + console.log(hash.digest('hex')); + }); + + return reply.continue(); + });*/ + export class Response extends Events.EventEmitter { + isBoom: boolean; + /** the HTTP response status code. Defaults to 200 (except for errors).*/ + statusCode: number; + /** an object containing the response headers where each key is a header field name. Note that this is an incomplete list of headers to be included with the response. Additional headers will be added once the response is prepare for transmission.*/ + headers: IDictionary; + /** the value provided using the reply interface.*/ + source: any; + /** a string indicating the type of source with available values: + 'plain' - a plain response such as string, number, null, or simple object (e.g. not a Stream, Buffer, or view). + 'buffer' - a Buffer. + 'view' - a view generated with reply.view(). + 'file' - a file generated with reply.file() of via the directory handler. + 'stream' - a Stream. + 'promise' - a Promise object. */ + variety: string; + /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ + app: any; + /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state. */ + plugins: any; + /** settings - response handling flags: + charset - the 'Content-Type' HTTP header 'charset' property. Defaults to 'utf-8'. + encoding - the string encoding scheme used to serial data into the HTTP payload when source is a string or marshals into a string. Defaults to 'utf8'. + passThrough - if true and source is a Stream, copies the statusCode and headers of the stream to the outbound response. Defaults to true. + stringify - options used for source value requiring stringification. Defaults to no replacer and no space padding. + ttl - if set, overrides the route cache expiration milliseconds value set in the route config. Defaults to no override. + varyEtag - if true, a suffix will be automatically added to the 'ETag' header at transmission time (separated by a '-' character) when the HTTP 'Vary' header is present.*/ + settings: { + charset: string; + encoding: string; + passThrough: boolean; + stringify: any; + ttl: number; + varyEtag: boolean; + } + + /** sets the HTTP 'Content-Length' header (to avoid chunked transfer encoding) where: + length - the header value. Must match the actual payload size.*/ + bytes(length: number): Response; + /** sets the 'Content-Type' HTTP header 'charset' property where: charset - the charset property value.*/ + charset(charset: string): Response; + + /** sets the HTTP status code where: + statusCode - the HTTP status code.*/ + code(statusCode: number): Response; + /** sets the HTTP status code to Created (201) and the HTTP 'Location' header where: uri - an absolute or relative URI used as the 'Location' header value.*/ + created(uri: string): Response; + + + /** encoding(encoding) - sets the string encoding scheme used to serial data into the HTTP payload where: encoding - the encoding property value (see node Buffer encoding).*/ + encoding(encoding: string): Response; + + /** etag(tag, options) - sets the representation entity tag where: + tag - the entity tag string without the double-quote. + options - optional settings where: + weak - if true, the tag will be prefixed with the 'W/' weak signifier. Weak tags will fail to match identical tags for the purpose of determining 304 response status. Defaults to false. + vary - if true and content encoding is set or applied to the response (e.g 'gzip' or 'deflate'), the encoding name will be automatically added to the tag at transmission time (separated by a '-' character). Ignored when weak is true. Defaults to true.*/ + etag(tag: string, options: { + weak: boolean; vary: boolean; + }): Response; + + /**header(name, value, options) - sets an HTTP header where: + name - the header name. + value - the header value. + options - optional settings where: + append - if true, the value is appended to any existing header value using separator. Defaults to false. + separator - string used as separator when appending to an exiting value. Defaults to ','. + override - if false, the header value is not set if an existing value present. Defaults to true.*/ + header(name: string, value: string, options?: { + append: boolean; + separator: string; + override: boolean; + }): Response; + + /** location(uri) - sets the HTTP 'Location' header where: + uri - an absolute or relative URI used as the 'Location' header value.*/ + location(uri: string): Response; + + /** redirect(uri) - sets an HTTP redirection response (302) and decorates the response with additional methods listed below, where: + uri - an absolute or relative URI used to redirect the client to another resource. */ + redirect(uri: string): Response; + + /** replacer(method) - sets the JSON.stringify() replacer argument where: + method - the replacer function or array. Defaults to none.*/ + replacer(method: Function | Array): Response; + + /** spaces(count) - sets the JSON.stringify() space argument where: + count - the number of spaces to indent nested object keys. Defaults to no indentation. */ + spaces(count: number): Response; + /**state(name, value, [options]) - sets an HTTP cookie where: + name - the cookie name. + value - the cookie value. If no encoding is defined, must be a string. + options - optional configuration. If the state was previously registered with the server using server.state(), the specified keys in options override those same keys in the server definition (but not others).*/ + state(name: string, value: string, options?: any): Response; + + /** sets a string suffix when the response is process via JSON.stringify().*/ + suffix(suffix: string): void; + /** overrides the default route cache expiration rule for this response instance where: +msec - the time-to-live value in milliseconds.*/ + ttl(msec: number): void; + /** type(mimeType) - sets the HTTP 'Content-Type' header where: + mimeType - is the mime type. Should only be used to override the built-in default for each response type. */ + type(mimeType: string): Response; + /** clears the HTTP cookie by setting an expired value where: +name - the cookie name. +options - optional configuration for expiring cookie. If the state was previously registered with the server using server.state(), the specified keys in options override those same keys in the server definition (but not others).*/ + unstate(name: string, options?: { [key: string]: string }): void; + /** adds the provided header to the list of inputs affected the response generation via the HTTP 'Vary' header where: +header - the HTTP request header name.*/ + vary(header: string): void; + } + /** When using the redirect() method, the response object provides these additional methods */ + export class ResponseRedirect extends Response { + /** sets the status code to 302 or 307 (based on the rewritable() setting) where: +isTemporary - if false, sets status to permanent. Defaults to true.*/ + temporary(isTemporary: boolean): void; + /** sets the status code to 301 or 308 (based on the rewritable() setting) where: +isPermanent - if true, sets status to temporary. Defaults to false. */ + permanent(isPermanent: boolean): void; + /** sets the status code to 301/302 for rewritable (allows changing the request method from 'POST' to 'GET') or 307/308 for non-rewritable (does not allow changing the request method from 'POST' to 'GET'). Exact code based on the temporary() or permanent() setting. Arguments: +isRewritable - if false, sets to non-rewritable. Defaults to true. +Permanent Temporary +Rewritable 301 302(1) +Non-rewritable 308(2) 307 +Notes: 1. Default value. 2. Proposed code, not supported by all clients. */ + rewritable(isRewritable: boolean): void; + } + /** info about a server connection */ + export interface IServerConnectionInfo { + /** - a unique connection identifier (using the format '{hostname}:{pid}:{now base36}').*/ + id: string; + /** - the connection creation timestamp.*/ + created: number; + /** - the connection start timestamp (0 when stopped).*/ + started: number; + /** the connection port based on the following rules: + the configured port value before the server has been started. + the actual port assigned when no port is configured or set to 0 after the server has been started.*/ + port: number; + + /** - the host name the connection was configured to. Defaults to the operating system hostname when available, otherwise 'localhost'.*/ + host: string; + /** - the active IP address the connection was bound to after starting.Set to undefined until the server has been started or when using a non TCP port (e.g. UNIX domain socket).*/ + address: string; + /** - the protocol used: + 'http' - HTTP. + 'https' - HTTPS. + 'socket' - UNIX domain socket or Windows named pipe.*/ + protocol: string; + /** a string representing the connection (e.g. 'http://example.com:8080' or 'socket:/unix/domain/socket/path'). Contains the uri setting if provided, otherwise constructed from the available settings. If no port is available or set to 0, the uri will not include a port component.*/ + uri: string; + } + /** + * undocumented. The connection object constructed after calling server.connection(); + * can be accessed via server.connections; or request.connection; + */ + export class ServerConnection extends Events.EventEmitter { + domain: any; + _events: { route: Function, domain: Function, _events: Function, _eventsCount: Function, _maxListeners: Function }; + _eventsCount: number; + settings: IServerConnectionOptions; + server: Server; + /** ex: "tcp" */ + type: string; + _started: boolean; + /** dictionary of sockets */ + _connections: { [ip_port: string]: any }; + _onConnection: Function; + registrations: any; + _extensions: any; + _requestCounter: { value: number; min: number; max: number }; + _load: any; + states: { + settings: any; cookies: any; names: any[] + }; + auth: { connection: ServerConnection; _schemes: any; _strategies: any; settings: any; }; + _router: any; + MSPluginsCollection: any; + applicationCache: any; + addEventListener: any; + info: IServerConnectionInfo; + } + + /** Server http://hapijs.com/api#server + rver object is the main application container. The server manages all incoming connections along with all the facilities provided by the framework. A server can contain more than one connection (e.g. listen to port 80 and 8080). + Server events + The server object inherits from Events.EventEmitter and emits the following events: + 'log' - events logged with server.log() and server events generated internally by the framework. + 'start' - emitted when the server is started using server.start(). + 'stop' - emitted when the server is stopped using server.stop(). + 'request' - events generated by request.log(). Does not include any internally generated events. + 'request-internal' - request events generated internally by the framework (multiple events per request). + 'request-error' - emitted whenever an Internal Server Error (500) error response is sent. Single event per request. + 'response' - emitted after the response is sent back to the client (or when the client connection closed and no response sent, in which case request.response is null). Single event per request. + 'tail' - emitted when a request finished processing, including any registered tails. Single event per request. + Note that the server object should not be used to emit application events as its internal implementation is designed to fan events out to the various plugin selections and not for application events. + MORE EVENTS HERE: http://hapijs.com/api#server-events*/ + export class Server extends Events.EventEmitter { + + constructor(options?: IServerOptions); + /** Provides a safe place to store server-specific run-time application data without potential conflicts with the framework internals. The data can be accessed whenever the server is accessible. Initialized with an empty object. + var Hapi = require('hapi'); + server = new Hapi.Server(); + server.app.key = 'value'; + var handler = function (request, reply) { + return reply(request.server.app.key); + }; */ + app: any; + /** An array containing the server's connections. When the server object is returned from server.select(), the connections array only includes the connections matching the selection criteria. + var server = new Hapi.Server(); + server.connection({ port: 80, labels: 'a' }); + server.connection({ port: 8080, labels: 'b' }); + // server.connections.length === 2 + var a = server.select('a'); + // a.connections.length === 1*/ + connections: Array; + /** When the server contains exactly one connection, info is an object containing information about the sole connection. + * When the server contains more than one connection, each server.connections array member provides its own connection.info. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + // server.info.port === 80 + server.connection({ port: 8080 }); + // server.info === null + // server.connections[1].info.port === 8080 + */ + info: IServerConnectionInfo; + /** An object containing the process load metrics (when load.sampleInterval is enabled): + rss - RSS memory usage. + var Hapi = require('hapi'); + var server = new Hapi.Server({ load: { sampleInterval: 1000 } }); + console.log(server.load.rss);*/ + load: { + /** - event loop delay milliseconds.*/ + eventLoopDelay: number; + /** - V8 heap usage.*/ + heapUsed: number; + }; + /** When the server contains exactly one connection, listener is the node HTTP server object of the sole connection. + When the server contains more than one connection, each server.connections array member provides its own connection.listener. + var Hapi = require('hapi'); + var SocketIO = require('socket.io'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + var io = SocketIO.listen(server.listener); + io.sockets.on('connection', function(socket) { + socket.emit({ msg: 'welcome' }); + });*/ + listener: http.Server; + + /** server.methods + An object providing access to the server methods where each server method name is an object property. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.method('add', function (a, b, next) { + return next(null, a + b); + }); + server.methods.add(1, 2, function (err, result) { + // result === 3 + });*/ + methods: IDictionary; + + /** server.mime + Provides access to the server MIME database used for setting content-type information. The object must not be modified directly but only through the mime server setting. + var Hapi = require('hapi'); + var options = { + mime: { + override: { + 'node/module': { + source: 'steve', + compressible: false, + extensions: ['node', 'module', 'npm'], + type: 'node/module' + } + } + } + }; + var server = new Hapi.Server(options); + // server.mime.path('code.js').type === 'application/javascript' + // server.mime.path('file.npm').type === 'node/module'*/ + mime: any; + /**server.plugins + An object containing the values exposed by each plugin registered where each key is a plugin name and the values are the exposed properties by each plugin using server.expose(). Plugins may set the value of the server.plugins[name] object directly or via the server.expose() method. + exports.register = function (server, options, next) { + server.expose('key', 'value'); + // server.plugins.example.key === 'value' + return next(); + }; + exports.register.attributes = { + name: 'example' + };*/ + plugins: IDictionary; + /** server.realm + The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin). Realms are a limited version of a sandbox where plugins can maintain state used by the framework when adding routes, extensions, and other properties. + modifiers - when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method and includes: + route - routes preferences: + prefix - the route path prefix used by any calls to server.route() from the server. + vhost - the route virtual host settings used by any calls to server.route() from the server. + plugin - the active plugin name (empty string if at the server root). + plugins - plugin-specific state to be shared only among activities sharing the same active state. plugins is an object where each key is a plugin name and the value is the plugin state. + settings - settings overrides: + files.relativeTo + bind + The server.realm object should be considered read-only and must not be changed directly except for the plugins property can be directly manipulated by the plugins (each setting its own under plugins[name]). + exports.register = function (server, options, next) { + console.log(server.realm.modifiers.route.prefix); + return next(); + };*/ + realm: IServerRealm; + + /** server.root + The root server object containing all the connections and the root server methods (e.g. start(), stop(), connection()).*/ + root: Server; + /** server.settings + The server configuration object after defaults applied. + var Hapi = require('hapi'); + var server = new Hapi.Server({ + app: { + key: 'value' + } + }); + // server.settings.app === { key: 'value' }*/ + settings: IServerOptions; + + /** server.version + The hapi module version number. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + // server.version === '8.0.0'*/ + version: string; + + /** server.after(method, [dependencies]) + Adds a method to be called after all the plugin dependencies have been registered and before the server starts (only called if the server is started) where: + after - the method with signature function(plugin, next) where: + server - server object the after() method was called on. + next - the callback function the method must call to return control over to the application and complete the registration process. The function signature is function(err) where: + err - internal error which is returned back via the server.start() callback. + dependencies - a string or array of string with the plugin names to call this method after their after() methods. There is no requirement for the other plugins to be registered. Setting dependencies only arranges the after methods in the specified order. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.after(function () { + // Perform some pre-start logic + }); + server.start(function (err) { + // After method already executed + }); + server.auth.default(options)*/ + after(method: (plugin: any, next: (err: any) => void) => void, dependencies: string | string[]): void; + + auth: { + /** server.auth.default(options) + Sets a default strategy which is applied to every route where: + options - a string with the default strategy name or an object with a specified strategy or strategies using the same format as the route auth handler options. + The default does not apply when the route config specifies auth as false, or has an authentication strategy configured. Otherwise, the route authentication config is applied to the defaults. Note that the default only applies at time of route configuration, not at runtime. Calling default() after adding a route will have no impact on routes added prior. + The default auth strategy configuration can be accessed via connection.auth.settings.default. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.auth.scheme('custom', scheme); + server.auth.strategy('default', 'custom'); + server.auth.default('default'); + server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + return reply(request.auth.credentials.user); + } + });*/ + default(options: string): void; + /** server.auth.scheme(name, scheme) + Registers an authentication scheme where: + name - the scheme name. + scheme - the method implementing the scheme with signature function(server, options) where: + server - a reference to the server object the scheme is added to. + options - optional scheme settings used to instantiate a strategy.*/ + scheme(name: string, + /** When the scheme authenticate() method implementation calls reply() with an error condition, the specifics of the error affect whether additional authentication strategies will be attempted if configured for the route. If the err returned by the reply() method includes a message, no additional strategies will be attempted. If the err does not include a message but does include a scheme name (e.g. Boom.unauthorized(null, 'Custom')), additional strategies will be attempted in order of preference. + n the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'. + server = new Hapi.Server(); + server.connection({ port: 80 }); + scheme = function (server, options) { + urn { + authenticate: function (request, reply) { + req = request.raw.req; + var authorization = req.headers.authorization; + if (!authorization) { + return reply(Boom.unauthorized(null, 'Custom')); + } + urn reply(null, { credentials: { user: 'john' } }); + } + }; + }; + */ + scheme: (server: Server, options: any) => IServerAuthScheme): void; + + /** server.auth.strategy(name, scheme, [mode], [options]) + Registers an authentication strategy where: + name - the strategy name. + scheme - the scheme name (must be previously registered using server.auth.scheme()). + mode - if true, the scheme is automatically assigned as a required strategy to any route without an auth config. Can only be assigned to a single server strategy. Value must be true (which is the same as 'required') or a valid authentication mode ('required', 'optional', 'try'). Defaults to false. + options - scheme options based on the scheme requirements. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.auth.scheme('custom', scheme); + server.auth.strategy('default', 'custom'); + server.route({ + method: 'GET', + path: '/', + config: { + auth: 'default', + handler: function (request, reply) { + return reply(request.auth.credentials.user); + } + } + });*/ + strategy(name: string, scheme: any, mode?: boolean | string, options?: any): void; + + /** server.auth.test(strategy, request, next) + Tests a request against an authentication strategy where: + strategy - the strategy name registered with server.auth.strategy(). + request - the request object. + next - the callback function with signature function(err, credentials) where: + err - the error if authentication failed. + credentials - the authentication credentials object if authentication was successful. + Note that the test() method does not take into account the route authentication configuration. It also does not perform payload authentication. It is limited to the basic strategy authentication execution. It does not include verifying scope, entity, or other route properties. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.auth.scheme('custom', scheme); + server.auth.strategy('default', 'custom'); + server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + request.server.auth.test('default', request, function (err, credentials) { + if (err) { + return reply({ status: false }); + } + return reply({ status: true, user: credentials.name }); + }); + } + });*/ + test(strategy: string, request: Request, next: (err: any, credentials: any) => void): void; + }; + /** server.bind(context) + Sets a global context used as the default bind object when adding a route or an extension where: + context - the object used to bind this in handler and extension methods. + When setting context inside a plugin, the context is applied only to methods set up by the plugin. Note that the context applies only to routes and extensions added after it has been set. + var handler = function (request, reply) { + return reply(this.message); + }; + exports.register = function (server, options, next) { + var bind = { + message: 'hello' + }; + server.bind(bind); + server.route({ method: 'GET', path: '/', handler: handler }); + return next(); + };*/ + bind(context: any): void; + + + /** server.cache(options) + Provisions a cache segment within the server cache facility where: + options - catbox policy configuration where: + expiresIn - relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. + expiresAt - time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records expire. Uses local time. Cannot be used together with expiresIn. + generateFunc - a function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id, next) where: - id - the id string or object provided to the get() method. - next - the method called when the new item is returned with the signature function(err, value, ttl) where: - err - an error condition. - value - the new value generated. - ttl - the cache ttl value in milliseconds. Set to 0 to skip storing in the cache. Defaults to the cache global policy. + staleIn - number of milliseconds to mark an item stored in cache as stale and attempt to regenerate it when generateFunc is provided. Must be less than expiresIn. + staleTimeout - number of milliseconds to wait before checking if an item is stale. + generateTimeout - number of milliseconds to wait before returning a timeout error when the generateFunc function takes too long to return a value. When the value is eventually returned, it is stored in the cache for future requests. + cache - the cache name configured in 'server.cache`. Defaults to the default cache. + segment - string segment name, used to isolate cached items within the cache partition. When called within a plugin, defaults to '!name' where 'name' is the plugin name. Required when called outside of a plugin. + shared - if true, allows multiple cache provisions to share the same segment. Default to false. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + var cache = server.cache({ segment: 'countries', expiresIn: 60 * 60 * 1000 }); + cache.set('norway', { capital: 'oslo' }, null, function (err) { + cache.get('norway', function (err, value, cached, log) { + // value === { capital: 'oslo' }; + }); + });*/ + cache(options: ICatBoxCacheOptions): void; + + /** server.connection([options]) + Adds an incoming server connection + Returns a server object with the new connection selected. + Must be called before any other server method that modifies connections is called for it to apply to the new connection (e.g. server.state()). + Note that the options object is deeply cloned (with the exception of listener which is shallowly copied) and cannot contain any values that are unsafe to perform deep copy on. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + var web = server.connection({ port: 8000, host: 'example.com', labels: ['web'] }); + var admin = server.connection({ port: 8001, host: 'example.com', labels: ['admin'] }); + // server.connections.length === 2 + // web.connections.length === 1 + // admin.connections.length === 1 */ + connection(options: IServerConnectionOptions): Server; + /** server.decorate(type, property, method) + Extends various framework interfaces with custom methods where: + type - the interface being decorated. Supported types: + 'reply' - adds methods to the reply interface. + 'server' - adds methods to the Server object. + property - the object decoration key name. + method - the extension function. + Note that decorations apply to the entire server and all its connections regardless of current selection. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.decorate('reply', 'success', function () { + return this.response({ status: 'ok' }); + }); + server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + return reply.success(); + } + });*/ + decorate(type: string, property: string, method: Function): void; + + /** server.dependency(dependencies, [after]) + Used within a plugin to declares a required dependency on other plugins where: + dependencies - a single string or array of plugin name strings which must be registered in order for this plugin to operate. Plugins listed must be registered before the server is started. Does not provide version dependency which should be implemented using npm peer dependencies. + after - an optional function called after all the specified dependencies have been registered and before the server starts. The function is only called if the server is started. If a circular dependency is detected, an exception is thrown (e.g. two plugins each has an after function to be called after the other). The function signature is function(server, next) where: + server - the server the dependency() method was called on. + next - the callback function the method must call to return control over to the application and complete the registration process. The function signature is function(err) where: + err - internal error condition, which is returned back via the server.start() callback. + exports.register = function (server, options, next) { + server.dependency('yar', after); + return next(); + }; + var after = function (server, next) { + // Additional plugin registration logic + return next(); + };*/ + dependency(dependencies: string | string[], after?: (server: Server, next: (err: any) => void) => void): void; + + + /** server.expose(key, value) + Used within a plugin to expose a property via server.plugins[name] where: + key - the key assigned (server.plugins[name][key]). + value - the value assigned. + exports.register = function (server, options, next) { + server.expose('util', function () { console.log('something'); }); + return next(); + };*/ + expose(key: string, value: any): void; + + /** server.expose(obj) + Merges a deep copy of an object into to the existing content of server.plugins[name] where: + obj - the object merged into the exposed properties container. + exports.register = function (server, options, next) { + server.expose({ util: function () { console.log('something'); } }); + return next(); + };*/ + expose(obj: any): void; + + /** server.ext(event, method, [options]) + Registers an extension function in one of the available extension points where: + event - the event name. + method - a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is function(request, reply) where: + request - the request object. NOTE: Access the Response via request.response + reply - the reply interface which is used to return control back to the framework. To continue normal execution of the request lifecycle, reply.continue() must be called. To abort processing and return a response to the client, call reply(value) where value is an error or any other valid response. + this - the object provided via options.bind or the current active context set with server.bind(). + options - an optional object with the following: + before - a string or array of strings of plugin names this method must execute before (on the same event). Otherwise, extension methods are executed in the order added. + after - a string or array of strings of plugin names this method must execute after (on the same event). Otherwise, extension methods are executed in the order added. + bind - a context object passed back to the provided method (via this) when called. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.ext('onRequest', function (request, reply) { + // Change all requests to '/test' + request.setUrl('/test'); + return reply.continue(); + }); + var handler = function (request, reply) { + return reply({ status: 'ok' }); + }; + server.route({ method: 'GET', path: '/test', handler: handler }); + server.start(); + // All requests will get routed to '/test'*/ + ext(event: string, method: (request: Request, reply: IReply, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void; + + /** server.handler(name, method) + Registers a new handler type to be used in routes where: + name - string name for the handler being registered. Cannot override the built-in handler types (directory, file, proxy, and view) or any previously registered type. + method - the function used to generate the route handler using the signature function(route, options) where: + route - the route public interface object. + options - the configuration object provided in the handler config. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ host: 'localhost', port: 8000 }); + // Defines new handler for routes on this server + server.handler('test', function (route, options) { + return function (request, reply) { + return reply('new handler: ' + options.msg); + } + }); + server.route({ + method: 'GET', + path: '/', + handler: { test: { msg: 'test' } } + }); + server.start(); + The method function can have a defaults object or function property. If the property is set to an object, that object is used as the default route config for routes using this handler. If the property is set to a function, the function uses the signature function(method) and returns the route default configuration. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ host: 'localhost', port: 8000 }); + var handler = function (route, options) { + return function (request, reply) { + return reply('new handler: ' + options.msg); + } + }; + // Change the default payload processing for this handler + handler.defaults = { + payload: { + output: 'stream', + parse: false + } + }; + server.handler('test', handler);*/ + handler(name: string, method: (route: IRoute, options: THandlerConfig) => ISessionHandler): void; + /** When the server contains exactly one connection, injects a request into the sole connection simulating an incoming HTTP request without making an actual socket connection. + Injection is useful for testing purposes as well as for invoking routing logic internally without the overhead or limitations of the network stack. + Utilizes the [shot module | https://github.com/hapijs/shot ] for performing injections, with some additional options and response properties + * When the server contains more than one connection, each server.connections array member provides its own connection.inject(). + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + var handler = function (request, reply) { + return reply('Success!'); + }; + server.route({ method: 'GET', path: '/', handler: handler }); + server.inject('/', function (res) { + console.log(res.result); + }); + */ + inject: IServerInject; + + /** server.log(tags, [data, [timestamp]]) + Logs server events that cannot be associated with a specific request. When called the server emits a 'log' event which can be used by other listeners or plugins to record the information or output to the console. The arguments are: + tags - a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events. Any logs generated by the server internally include the 'hapi' tag along with event-specific information. + data - an optional message string or object with the application data being logged. + timestamp - an optional timestamp expressed in milliseconds. Defaults to Date.now() (now). + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.on('log', function (event, tags) { + if (tags.error) { + console.log(event); + } + }); + server.log(['test', 'error'], 'Test event');*/ + log(tags: string | string[], data?: string | any, timestamp?: number): void; + /**server.lookup(id) + When the server contains exactly one connection, looks up a route configuration where: + id - the route identifier as set in the route options. + returns the route public interface object if found, otherwise null. + var server = new Hapi.Server(); + server.connection(); + server.route({ + method: 'GET', + path: '/', + config: { + handler: function (request, reply) { return reply(); }, + id: 'root' + } + }); + var route = server.lookup('root'); + When the server contains more than one connection, each server.connections array member provides its own connection.lookup() method.*/ + lookup(id: string): IRoute; + /** server.match(method, path, [host]) + When the server contains exactly one connection, looks up a route configuration where: + method - the HTTP method (e.g. 'GET', 'POST'). + path - the requested path (must begin with '/'). + host - optional hostname (to match against routes with vhost). + returns the route public interface object if found, otherwise null. + var server = new Hapi.Server(); + server.connection(); + server.route({ + method: 'GET', + path: '/', + config: { + handler: function (request, reply) { return reply(); }, + id: 'root' + } + }); + var route = server.match('get', '/'); + When the server contains more than one connection, each server.connections array member provides its own connection.match() method.*/ + match(method: string, path: string, host?: string): IRoute; + + + + + /** server.method(name, method, [options]) + Registers a server method. Server methods are functions registered with the server and used throughout the application as a common utility. Their advantage is in the ability to configure them to use the built-in cache and share across multiple request handlers without having to create a common module. + Methods are registered via server.method(name, method, [options]) + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + // Simple arguments + var add = function (a, b, next) { + return next(null, a + b); + }; + server.method('sum', add, { cache: { expiresIn: 2000 } }); + server.methods.sum(4, 5, function (err, result) { + console.log(result); + }); + // Object argument + var addArray = function (array, next) { + var sum = 0; + array.forEach(function (item) { + sum += item; + }); + return next(null, sum); + }; + server.method('sumObj', addArray, { + cache: { expiresIn: 2000 }, + generateKey: function (array) { + return array.join(','); + } + }); + server.methods.sumObj([5, 6], function (err, result) { + console.log(result); + }); + // Synchronous method with cache + var addSync = function (a, b) { + return a + b; + }; + server.method('sumSync', addSync, { cache: { expiresIn: 2000 }, callback: false }); + server.methods.sumSync(4, 5, function (err, result) { + console.log(result); + }); */ + method( + /** a unique method name used to invoke the method via server.methods[name]. When configured with caching enabled, server.methods[name].cache.drop(arg1, arg2, ..., argn, callback) can be used to clear the cache for a given key. Supports using nested names such as utils.users.get which will automatically create the missing path under server.methods and can be accessed for the previous example via server.methods.utils.users.get.*/ + name: string, + method: IServerMethod, + options?: IServerMethodOptions): void; + + + /**server.method(methods) + Registers a server method function as described in server.method() using a configuration object where: + methods - an object or an array of objects where each one contains: + name - the method name. + method - the method function. + options - optional settings. + var add = function (a, b, next) { + next(null, a + b); + }; + server.method({ + name: 'sum', + method: add, + options: { + cache: { + expiresIn: 2000 + } + } + });*/ + method(methods: { + name: string; method: IServerMethod; options?: IServerMethodOptions + } | Array<{ + name: string; method: IServerMethod; options?: IServerMethodOptions + }>): void; + /**server.path(relativeTo) + Sets the path prefix used to locate static resources (files and view templates) when relative paths are used where: + relativeTo - the path prefix added to any relative file path starting with '.'. + Note that setting a path within a plugin only applies to resources accessed by plugin methods. If no path is set, the connection files.relativeTo configuration is used. The path only applies to routes added after it has been set. + exports.register = function (server, options, next) { + server.path(__dirname + '../static'); + server.route({ path: '/file', method: 'GET', handler: { file: './test.html' } }); + next(); + };*/ + path(relativeTo: string): void; + /**server.register(plugins, [options], callback) + Registers a plugin where: + plugins - an object or array of objects where each one is either: + a plugin registration function. + an object with the following: + register - the plugin registration function. + options - optional options passed to the registration function when called. + options - optional registration options (different from the options passed to the registration function): + select - a string or array of string labels used to pre-select connections for plugin registration. + routes - modifiers applied to each route added by the plugin: + prefix - string added as prefix to any route path (must begin with '/'). If a plugin registers a child plugin the prefix is passed on to the child or is added in front of the child-specific prefix. + vhost - virtual host string (or array of strings) applied to every route. The outer-most vhost overrides the any nested configuration. + callback - the callback function with signature function(err) where: + err - an error returned from the registration function. Note that exceptions thrown by the registration function are not handled by the framework. + server.register({ + register: require('plugin_name'), + options: { + message: 'hello' + } + }, function (err) { + if (err) { + console.log('Failed loading plugin'); + } + });*/ + register(plugins: any | any[], options: { + select: string | string[]; + routes: { + prefix: string; vhost?: string | string[] + }; + } + , callback: (err: any) => void): void; + + register(plugins: any | any[], callback: (err: any) => void): void; + + /**server.render(template, context, [options], callback) + Utilizes the server views manager to render a template where: + template - the template filename and path, relative to the views manager templates path (path or relativeTo). + context - optional object used by the template to render context-specific result. Defaults to no context ({}). + options - optional object used to override the views manager configuration. + callback - the callback function with signature function (err, rendered, config) where: + err - the rendering error if any. + rendered - the result view string. + config - the configuration used to render the template. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.views({ + engines: { html: require('handlebars') }, + path: __dirname + '/templates' + }); + var context = { + title: 'Views Example', + message: 'Hello, World' + }; + server.render('hello', context, function (err, rendered, config) { + console.log(rendered); + });*/ + render(template: string, context: any, options: any, callback: (err: any, rendered: any, config: any) => void): void; + /** server.route(options) + Adds a connection route where: + options - a route configuration object or an array of configuration objects. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.route({ method: 'GET', path: '/', handler: function (request, reply) { return reply('ok'); } }); + server.route([ + { method: 'GET', path: '/1', handler: function (request, reply) { return reply('ok'); } }, + { method: 'GET', path: '/2', handler: function (request, reply) { return reply('ok'); } } + ]);*/ + route(options: IRouteConfiguration): void; + route(options: IRouteConfiguration[]): void; + /**server.select(labels) + Selects a subset of the server's connections where: + labels - a single string or array of strings of labels used as a logical OR statement to select all the connections with matching labels in their configuration. + Returns a server object with connections set to the requested subset. Selecting again on a selection operates as a logic AND statement between the individual selections. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80, labels: ['a'] }); + server.connection({ port: 8080, labels: ['b'] }); + server.connection({ port: 8081, labels: ['c'] }); + server.connection({ port: 8082, labels: ['c','d'] }); + var a = server.select('a'); // The server with port 80 + var ab = server.select(['a','b']); // A list of servers containing the server with port 80 and the server with port 8080 + var c = server.select('c'); // A list of servers containing the server with port 8081 and the server with port 8082 */ + select(labels: string | string[]): Server | Server[]; + /** server.start([callback]) + Starts the server connections by listening for incoming requests on the configured port of each listener (unless the connection was configured with autoListen set to false), where: + callback - optional callback when server startup is completed or failed with the signature function(err) where: + err - any startup error condition. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.start(function (err) { + console.log('Server started at: ' + server.info.uri); + });*/ + start(callback?: (err: any) => void): void; + /** server.state(name, [options]) + HTTP state management uses client cookies to persist a state across multiple requests. Registers a cookie definitions + State defaults can be modified via the server connections.routes.state configuration option. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + // Set cookie definition + server.state('session', { + ttl: 24 * 60 * 60 * 1000, // One day + isSecure: true, + path: '/', + encoding: 'base64json' + }); + // Set state in route handler + var handler = function (request, reply) { + var session = request.state.session; + if (!session) { + session = { user: 'joe' }; + } + session.last = Date.now(); + return reply('Success').state('session', session); + }; + Registered cookies are automatically parsed when received. Parsing rules depends on the route state.parse configuration. If an incoming registered cookie fails parsing, it is not included in request.state, regardless of the state.failAction setting. When state.failAction is set to 'log' and an invalid cookie value is received, the server will emit a 'request-internal' event. To capture these errors subscribe to the 'request-internal' events and filter on 'error' and 'state' tags: + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.on('request-internal', function (request, event, tags) { + if (tags.error && tags.state) { + console.error(event); + } + }); */ + state(name: string, options?: ICookieSettings): void; + + /** server.stop([options], [callback]) + Stops the server's connections by refusing to accept any new connections or requests (existing connections will continue until closed or timeout), where: + options - optional object with: + timeout - overrides the timeout in millisecond before forcefully terminating a connection. Defaults to 5000 (5 seconds). + callback - optional callback method with signature function() which is called once all the connections have ended and it is safe to exit the process. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.stop({ timeout: 60 * 1000 }, function () { + console.log('Server stopped'); + });*/ + stop(options?: { timeout: number }, callback?: () => void): void; + /**server.table([host]) + Returns a copy of the routing table where: + host - optional host to filter routes matching a specific virtual host. Defaults to all virtual hosts. + The return value is an array where each item is an object containing: + info - the connection.info the connection the table was generated for. + labels - the connection labels. + table - an array of routes where each route contains: + settings - the route config with defaults applied. + method - the HTTP method in lower case. + path - the route path. + Note that if the server has not been started and multiple connections use port 0, the table items will override each other and will produce an incomplete result. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80, host: 'example.com' }); + server.route({ method: 'GET', path: '/example', handler: function (request, reply) { return reply(); } }); + var table = server.table(); + When calling connection.table() directly on each connection, the return value is the same as the array table item value of an individual connection: + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80, host: 'example.com' }); + server.route({ method: 'GET', path: '/example', handler: function (request, reply) { return reply(); } }); + var table = server.connections[0].table(); + //[ + // { + // method: 'get', + // path: '/example', + // settings: { ... } + // } + //] + */ + table(host?: any): IConnectionTable; + + /**server.views(options) + Initializes the server views manager + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.views({ + engines: { + html: require('handlebars'), + jade: require('jade') + }, + path: '/static/templates' + }); + When server.views() is called within a plugin, the views manager is only available to plugins methods.*/ + views(options: IServerViewsConfiguration): void; + + } +} diff --git a/types/hapi/v12/tsconfig.json b/types/hapi/v12/tsconfig.json new file mode 100644 index 0000000000..4659b7940a --- /dev/null +++ b/types/hapi/v12/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "hapi": [ + "hapi/v12" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "hapi-tests.ts" + ] +} \ No newline at end of file diff --git a/types/hapi/hapi-tests.ts b/types/hapi/v15/hapi-tests.ts similarity index 100% rename from types/hapi/hapi-tests.ts rename to types/hapi/v15/hapi-tests.ts diff --git a/types/hapi/v15/index.d.ts b/types/hapi/v15/index.d.ts new file mode 100644 index 0000000000..86b993bfb5 --- /dev/null +++ b/types/hapi/v15/index.d.ts @@ -0,0 +1,2497 @@ +// Type definitions for hapi 15.0 +// Project: http://github.com/spumko/hapi +// Definitions by: Jason Swearingen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Note/Disclaimer: This .d.ts was created against hapi v8.x but has been incrementally upgraded to 13.x. Some newer features/changes may be missing. YMMV. + +/// + +import http = require("http"); +import stream = require("stream"); +import Events = require("events"); +import url = require("url"); + +export interface IDictionary { + [key: string]: T; +} + +export interface IHeaderOptions { + append?: boolean; + separator?: string; + override?: boolean; + duplicate?: boolean; +} + +/** Boom Module for errors. https://github.com/hapijs/boom + * boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: */ +export interface IBoom extends Error { + /** if true, indicates this is a Boom object instance. */ + isBoom: boolean; + /** convenience bool indicating status code >= 500. */ + isServer: boolean; + /** the error message. */ + message: string; + /** the formatted response.Can be directly manipulated after object construction to return a custom error response.Allowed root keys: */ + output: { + /** the HTTP status code (typically 4xx or 5xx). */ + statusCode: number; + /** an object containing any HTTP headers where each key is a header name and value is the header content. */ + headers: IDictionary; + /** the formatted object used as the response payload (stringified).Can be directly manipulated but any changes will be lost if reformat() is called.Any content allowed and by default includes the following content: */ + payload: { + /** the HTTP status code, derived from error.output.statusCode. */ + statusCode: number; + /** the HTTP status message (e.g. 'Bad Request', 'Internal Server Error') derived from statusCode. */ + error: string; + /** the error message derived from error.message. */ + message: string; + }; + }; + /** reformat()rebuilds error.output using the other object properties. */ + reformat(): void; +} + +/** cache functionality via the "CatBox" module. */ +export interface ICatBoxCacheOptions { + /** a prototype function or catbox engine object. */ + engine: any; + /** an identifier used later when provisioning or configuring caching for server methods or plugins. Each cache name must be unique. A single item may omit the name option which defines the default cache. If every cache includes a name, a default memory cache is provisions as well. */ + name?: string; + /** if true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. */ + shared?: boolean; +} + +/** policy configuration for the "CatBox" module and server method options. */ +export interface ICatBoxCachePolicyOptions { + /** the cache name configured in server.cache. Defaults to the default cache. */ + cache?: string; + /** string segment name, used to isolate cached items within the cache partition. When called within a plugin, defaults to '!name' where 'name' is the plugin name. When called within a server method, defaults to '#name' where 'name' is the server method name. Required when called outside of a plugin. */ + segment?: string; + /** if true, allows multiple cache provisions to share the same segment. Default to false. */ + shared?: boolean; + /** relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. */ + expiresIn?: number; + /** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records expire. Uses local time. Cannot be used together with expiresIn. */ + expiresAt?: number; + /** a function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id, next) where: - id - the id string or object provided to the get() method. - next - the method called when the new item is returned with the signature function(err, value, ttl) where: - err - an error condition. - value - the new value generated. - ttl - the cache ttl value in milliseconds. Set to 0 to skip storing in the cache. Defaults to the cache global policy. */ + generateFunc?: Function; + /** number of milliseconds to mark an item stored in cache as stale and attempt to regenerate it when generateFunc is provided. Must be less than expiresIn. */ + staleIn?: number; + /** number of milliseconds to wait before checking if an item is stale. */ + staleTimeout?: number; + /** number of milliseconds to wait before returning a timeout error when the generateFunc function takes too long to return a value. When the value is eventually returned, it is stored in the cache for future requests. Required if generateFunc is present. Set to false to disable timeouts which may cause all get() requests to get stuck forever. */ + generateTimeout?: number; + /** if true, an error or timeout in the generateFunc causes the stale value to be evicted from the cache. Defaults to true */ + dropOnError?: boolean; + /** if false, an upstream cache read error will stop the cache.get() method from calling the generate function and will instead pass back the cache error. Defaults to true. */ + generateOnReadError?: boolean; + /** if false, an upstream cache write error when calling cache.get() will be passed back with the generated value when calling. Defaults to true. */ + generateIgnoreWriteError?: boolean; + /** number of milliseconds while generateFunc call is in progress for a given id, before a subsequent generateFunc call is allowed. Defaults to 0 (no blocking of concurrent generateFunc calls beyond staleTimeout). */ + pendingGenerateTimeout?: number; +} + +/** Any connections configuration server defaults can be included to override and customize the individual connection. */ +export interface IServerConnectionOptions extends IConnectionConfigurationServerDefaults { + /** - the public hostname or IP address. Used only to set server.info.host and server.info.uri. If not configured, defaults to the operating system hostname and if not available, to 'localhost'.*/ + host?: string; + /** - sets the host name or IP address the connection will listen on.If not configured, defaults to host if present, otherwise to all available network interfaces (i.e. '0.0.0.0').Set to 127.0.0.1 or localhost to restrict connection to only those coming from the same machine.*/ + address?: string; + /** - the TCP port the connection will listen to.Defaults to an ephemeral port (0) which uses an available port when the server is started (and assigned to server.info.port).If port is a string containing a '/' character, it is used as a UNIX domain socket path and if it starts with '\.\pipe' as a Windows named pipe.*/ + port?: string | number; + /** - the full public URI without the path (e.g. 'http://example.com:8080').If present, used as the connection info.uri otherwise constructed from the connection settings.*/ + uri?: string; + /** - optional node.js HTTP (or HTTPS) http.Server object or any compatible object.If the listener needs to be manually started, set autoListen to false.If the listener uses TLS, set tls to true.*/ + listener?: any; + /** - indicates that the connection.listener will be started manually outside the framework.Cannot be specified with a port setting.Defaults to true.*/ + autoListen?: boolean; + /** caching headers configuration: */ + cache?: { + /** - an array of HTTP response status codes (e.g. 200) which are allowed to include a valid caching directive.Defaults to [200]. */ + statuses: number[]; + }; + /** - a string or string array of labels used to server.select() specific connections matching the specified labels.Defaults to an empty array [](no labels).*/ + labels?: string | string[]; + /** - used to create an HTTPS connection.The tls object is passed unchanged as options to the node.js HTTPS server as described in the node.js HTTPS documentation.Set to true when passing a listener object that has been configured to use TLS directly. */ + tls?: boolean | { key?: string; cert?: string; pfx?: string; } | Object; +} + +export interface IConnectionConfigurationServerDefaults { + /** application-specific connection configuration which can be accessed via connection.settings.app. Provides a safe place to store application configuration without potential conflicts with the framework internals. Should not be used to configure plugins which should use plugins[name]. Note the difference between connection.settings.app which is used to store configuration values and connection.app which is meant for storing run-time state. */ + app?: any; + /** if false, response content encoding is disabled. Defaults to true */ + compression?: boolean; + /** connection load limits configuration where: */ + load?: { + /** maximum V8 heap size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxHeapUsedBytes: number; + /** maximum process RSS size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxRssBytes: number; + /** maximum event loop delay duration in milliseconds over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxEventLoopDelay: number; + }; + /** plugin-specific configuration which can later be accessed via connection.settings.plugins. Provides a place to store and pass connection-specific plugin configuration. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between connection.settings.plugins which is used to store configuration values and connection.plugins which is meant for storing run-time state. */ + plugins?: any; + /** controls how incoming request URIs are matched against the routing table: */ + router?: { + /** determines whether the paths '/example' and '/EXAMPLE' are considered different resources. Defaults to true. */ + isCaseSensitive: boolean; + /** removes trailing slashes on incoming paths. Defaults to false. */ + stripTrailingSlash: boolean; + }; + /** a route options object used to set the default configuration for every route. */ + routes?: IRouteAdditionalConfigurationOptions; + state?: IServerState; +} + +/** Note that the options object is deeply cloned and cannot contain any values that are unsafe to perform deep copy on.*/ +export interface IServerOptions { + /** application-specific configuration which can later be accessed via server.settings.app. Note the difference between server.settings.app which is used to store static configuration values and server.app which is meant for storing run-time state. Defaults to {}. */ + app?: any; + /** sets up server-side caching. Every server includes a default cache for storing application state. By default, a simple memory-based cache is created which has limited capacity and capabilities. hapi uses catbox for its cache which includes support for common storage solutions (e.g. Redis, MongoDB, Memcached, and Riak). Caching is only utilized if methods and plugins explicitly store their state in the cache. The server cache configuration only defines the storage container itself. cache can be assigned: + a prototype function (usually obtained by calling require() on a catbox strategy such as require('catbox-redis')). + a configuration object with the following options: + enginea prototype function or catbox engine object. + namean identifier used later when provisioning or configuring caching for server methods or plugins. Each cache name must be unique. A single item may omit the name option which defines the default cache. If every cache includes a name, a default memory cache is provisions as well. + sharedif true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. + other options passed to the catbox strategy used. + an array of the above object for configuring multiple cache instances, each with a unique name. When an array of objects is provided, multiple cache connections are established and each array item (except one) must include a name. */ + cache?: string | ICatBoxCacheOptions | ICatBoxCacheOptions[] | any; + /** sets the default connections configuration which can be overridden by each connection where: */ + connections?: IConnectionConfigurationServerDefaults; + /** determines which logged events are sent to the console (this should only be used for development and does not affect which events are actually logged internally and recorded). Set to false to disable all console logging, or to an object*/ + debug?: boolean | { + /** - a string array of server log tags to be displayed via console.error() when the events are logged via server.log() as well as internally generated server logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error. */ + log: string[]; + /** - a string array of request log tags to be displayed via console.error() when the events are logged via request.log() as well as internally generated request logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error.*/ + request: string[]; + }; + /** file system related settings*/ + files?: { + /** sets the maximum number of file etag hash values stored in the etags cache. Defaults to 10000.*/ + etagsCacheMaxSize?: number; + }; + /** process load monitoring*/ + load?: { + /** the frequency of sampling in milliseconds. Defaults to 0 (no sampling).*/ + sampleInterval?: number; + }; + + /** options passed to the mimos module (https://github.com/hapijs/mimos) when generating the mime database used by the server and accessed via server.mime.*/ + mime?: any; + /** if true, does not load the inert (file and directory support), h2o2 (proxy support), and vision (views support) plugins automatically. The plugins can be loaded manually after construction. Defaults to false (plugins loaded). */ + minimal?: boolean; + /** plugin-specific configuration which can later be accessed via server.settings.plugins. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between server.settings.plugins which is used to store static configuration values and server.plugins which is meant for storing run-time state. Defaults to {}.*/ + plugins?: IDictionary; +} + +export interface IServerViewCompile { + (template: string, options: any): void; + (template: string, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: boolean) => void) => void) => void): void; +} + +export interface IServerViewsAdditionalOptions { + /** path - the root file path used to resolve and load the templates identified when calling reply.view().Defaults to current working directory.*/ + path?: string; + /**partialsPath - the root file path where partials are located.Partials are small segments of template code that can be nested and reused throughout other templates.Defaults to no partials support (empty path). + */ + partialsPath?: string; + /**helpersPath - the directory path where helpers are located.Helpers are functions used within templates to perform transformations and other data manipulations using the template context or other inputs.Each '.js' file in the helpers directory is loaded and the file name is used as the helper name.The files must export a single method with the signature function(context) and return a string.Sub - folders are not supported and are ignored.Defaults to no helpers support (empty path).Note that jade does not support loading helpers this way.*/ + helpersPath?: string; + /**relativeTo - a base path used as prefix for path and partialsPath.No default.*/ + relativeTo?: string; + + /**layout - if set to true or a layout filename, layout support is enabled.A layout is a single template file used as the parent template for other view templates in the same engine.If true, the layout template name must be 'layout.ext' where 'ext' is the engine's extension. Otherwise, the provided filename is suffixed with the engine's extension and loaded.Disable layout when using Jade as it will handle including any layout files independently.Defaults to false.*/ + layout?: boolean | string; + /**layoutPath - the root file path where layout templates are located (using the relativeTo prefix if present). Defaults to path.*/ + layoutPath?: string; + /**layoutKeyword - the key used by the template engine to denote where primary template content should go.Defaults to 'content'.*/ + layoutKeywork?: string; + /**encoding - the text encoding used by the templates when reading the files and outputting the result.Defaults to 'utf8'.*/ + encoding?: string; + /**isCached - if set to false, templates will not be cached (thus will be read from file on every use).Defaults to true.*/ + isCached?: boolean; + /**allowAbsolutePaths - if set to true, allows absolute template paths passed to reply.view().Defaults to false.*/ + allowAbsolutePaths?: boolean; + /**allowInsecureAccess - if set to true, allows template paths passed to reply.view() to contain '../'.Defaults to false.*/ + allowInsecureAccess?: boolean; + /**compileOptions - options object passed to the engine's compile function. Defaults to empty options {}.*/ + compileOptions?: any; + /**runtimeOptions - options object passed to the returned function from the compile operation.Defaults to empty options {}.*/ + runtimeOptions?: any; + /**contentType - the content type of the engine results.Defaults to 'text/html'.*/ + contentType?: string; + /**compileMode - specify whether the engine compile() method is 'sync' or 'async'.Defaults to 'sync'.*/ + compileMode?: string; + /**context - a global context used with all templates.The global context option can be either an object or a function that takes no arguments and returns a context object.When rendering views, the global context will be merged with any context object specified on the handler or using reply.view().When multiple context objects are used, values from the global context always have lowest precedence.*/ + context?: any; +} + +export interface IServerViewsEnginesOptions extends IServerViewsAdditionalOptions { + /**- the npm module used for rendering the templates.The module object must contain: "module", the rendering function. The required function signature depends on the compileMode settings. + * If the compileMode is 'sync', the signature is compile(template, options), the return value is a function with signature function(context, options), and the method is allowed to throw errors.If the compileMode is 'async', the signature is compile(template, options, callback) where callback has the signature function(err, compiled) where compiled is a function with signature function(context, options, callback) and callback has the signature function(err, rendered).*/ + module: { + compile?(template: any, options: any): (context: any, options: any) => void; + compile?(template: any, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: any) => void) => void) => void): void; + }; +} + +/**Initializes the server views manager + var Hapi = require('hapi'); + var server = new Hapi.Server(); + + server.views({ +engines: { +html: require('handlebars'), +jade: require('jade') +}, +path: '/static/templates' +}); + When server.views() is called within a plugin, the views manager is only available to plugins methods. + */ +export interface IServerViewsConfiguration extends IServerViewsAdditionalOptions { + /** - required object where each key is a file extension (e.g. 'html', 'hbr'), mapped to the npm module used for rendering the templates.Alternatively, the extension can be mapped to an object with the following options:*/ + engines: IDictionary | IServerViewsEnginesOptions; + /** defines the default filename extension to append to template names when multiple engines are configured and not explicit extension is provided for a given template. No default value.*/ + defaultExtension?: string; +} + +export interface IReplyMethods { + /** Returns control back to the framework without setting a response. If called in the handler, the response defaults to an empty payload with status code 200. + * The data argument is only used for passing back authentication data and is ignored elsewhere. */ + continue(credentialData?: any): void; + + /** Transmits a file from the file system. The 'Content-Type' header defaults to the matching mime type based on filename extension. The response flow control rules do not apply. */ + file(/** the file path. */ + path: string, + /** optional settings: */ + options?: { + /** - an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ + filename?: string; + /** specifies whether to include the 'Content-Disposition' header with the response. Available values: + false - header is not included. This is the default value. + 'attachment' + 'inline'*/ + mode?: boolean | string; + /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. */ + lookupCompressed: boolean; + }): void; + /** Concludes the handler activity by returning control over to the router with a templatized view response. + the response flow control rules apply. */ + view(/** the template filename and path, relative to the templates path configured via the server views manager. */ + template: string, + /** optional object used by the template to render context-specific result. Defaults to no context {}. */ + context?: {}, + /** optional object used to override the server's views manager configuration for this response. Cannot override isCached, partialsPath, or helpersPath which are only loaded at initialization. */ + options?: any): Response; + /** Sets a header on the response */ + header(name: string, value: string, options?: IHeaderOptions): Response; + + /** Concludes the handler activity by returning control over to the router and informing the router that a response has already been sent back directly via request.raw.res and that no further response action is needed + The response flow control rules do not apply. */ + close(options?: { + /** if false, the router will not call request.raw.res.end()) to ensure the response was ended. Defaults to true. */ + end?: boolean; + }): void; + /** Proxies the request to an upstream endpoint. + the response flow control rules do not apply. */ + + proxy(/** an object including the same keys and restrictions defined by the route proxy handler options. */ + options: IProxyHandlerConfig): void; + /** Redirects the client to the specified uri. Same as calling reply().redirect(uri). + he response flow control rules apply. */ + redirect(uri: string): ResponseRedirect; + + /** Replies with the specified response */ + response(result: any): Response; + + /** Sets a cookie on the response */ + state(name: string, value: any, options?: any): void; + + /** Clears a cookie on the response */ + unstate(name: string, options?: any): void; +} + +/** Concludes the handler activity by setting a response and returning control over to the framework where: + erran optional error response. + result an optional response payload. + Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first. + FLOW CONTROL: + When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */ +export interface IReply extends IReplyMethods { + ( + err: Error, + result?: string | number | boolean | Buffer | stream.Stream | Promise | T, + /** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */ + credentialData?: any): IBoom; + /** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */ + (result: string | number | boolean | Buffer | stream.Stream | Promise | T): Response; +} + +/** Concludes the handler activity by setting a response and returning control over to the framework where: + erran optional error response. + result an optional response payload. + Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first. + FLOW CONTROL: + When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */ +export interface IStrictReply extends IReplyMethods { + (err: Error, + result?: Promise | T, + /** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */ + credentialData?: any): IBoom; + /** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */ + (result: Promise | T): Response; +} + +export interface ISessionHandler { + (request: Request, reply: IReply): void; +} + +export interface IStrictSessionHandler { + (request: Request, reply: IStrictReply): void; +} + +export interface IRequestHandler { + (request: Request): T; +} + +export interface IFailAction { + (source: string, error: any, next: () => void): void; +} +/** generates a reverse proxy handler */ +export interface IProxyHandlerConfig { + /** the upstream service host to proxy requests to. The same path on the client request will be used as the path on the host.*/ + host?: string; + /** the upstream service port. */ + port?: number; + /** The protocol to use when making a request to the proxied host: + 'http' + 'https'*/ + protocol?: string; + /** an absolute URI used instead of the incoming host, port, protocol, path, and query. Cannot be used with host, port, protocol, or mapUri.*/ + uri?: string; + /** if true, forwards the headers sent from the client to the upstream service being proxied to, headers sent from the upstream service will also be forwarded to the client. Defaults to false.*/ + passThrough?: boolean; + /** localStatePassThrough - if false, any locally defined state is removed from incoming requests before being passed upstream. This is a security feature to prevent local state (e.g. authentication cookies) from leaking upstream to other servers along with the cookies intended for those servers. This value can be overridden on a per state basis via the server.state() passThrough option. Defaults to false.*/ + localStatePassThrough?: boolean; + /**acceptEncoding - if false, does not pass-through the 'Accept-Encoding' HTTP header which is useful when using an onResponse post-processing to avoid receiving an encoded response (e.g. gzipped). Can only be used together with passThrough. Defaults to true (passing header).*/ + acceptEncoding?: boolean; + /** rejectUnauthorized - sets the rejectUnauthorized property on the https agent making the request. This value is only used when the proxied server uses TLS/SSL. When set it will override the node.js rejectUnauthorized property. If false then ssl errors will be ignored. When true the server certificate is verified and an 500 response will be sent when verification fails. This shouldn't be used alongside the agent setting as the agent will be used instead. Defaults to the https agent default value of true.*/ + rejectUnauthorized?: boolean; + /**if true, sets the 'X-Forwarded-For', 'X-Forwarded-Port', 'X-Forwarded-Proto' headers when making a request to the proxied upstream endpoint. Defaults to false.*/ + xforward?: boolean; + /** the maximum number of HTTP redirections allowed, to be followed automatically by the handler. Set to false or 0 to disable all redirections (the response will contain the redirection received from the upstream service). If redirections are enabled, no redirections (301, 302, 307, 308) will be passed along to the client, and reaching the maximum allowed redirections will return an error response. Defaults to false.*/ + redirects?: boolean | number; + /**number of milliseconds before aborting the upstream request. Defaults to 180000 (3 minutes).*/ + timeout?: number; + /** a function used to map the request URI to the proxied URI. Cannot be used together with host, port, protocol, or uri. The function signature is function(request, callback) where: + request - is the incoming request object. + callback - is function(err, uri, headers) where: + err - internal error condition. + uri - the absolute proxy URI. + headers - optional object where each key is an HTTP request header and the value is the header content.*/ + mapUri?(request: Request, callback: (err: any, uri: string, headers?: { [key: string]: string }) => void): void; + /** a custom function for processing the response from the upstream service before sending to the client. Useful for custom error handling of responses from the proxied endpoint or other payload manipulation. Function signature is function(err, res, request, reply, settings, ttl) where: - err - internal or upstream error returned from attempting to contact the upstream proxy. - res - the node response object received from the upstream service. res is a readable stream (use the wreck module read method to easily convert it to a Buffer or string). - request - is the incoming request object. - reply - the reply interface function. - settings - the proxy handler configuration. - ttl - the upstream TTL in milliseconds if proxy.ttl it set to 'upstream' and the upstream response included a valid 'Cache-Control' header with 'max-age'.*/ + onResponse?( + err: any, + res: http.ServerResponse, + req: Request, + reply: IReply, + settings: IProxyHandlerConfig, + ttl: number): void; + /** if set to 'upstream', applies the upstream response caching policy to the response using the response.ttl() method (or passed as an argument to the onResponse method if provided).*/ + ttl?: number; + /** - a node http(s) agent to be used for connections to upstream server. see https://nodejs.org/api/http.html#http_class_http_agent */ + agent?: http.Agent; + /** sets the maximum number of sockets available per outgoing proxy host connection. false means use the wreck module default value (Infinity). Does not affect non-proxy outgoing client connections. Defaults to Infinity.*/ + maxSockets?: boolean | number; +} +/** TODO: fill in joi definition */ +export interface IJoi { } + +/** a validation function using the signature function(value, options, next) */ +export interface IValidationFunction { + ( + /** the object containing the path parameters. */ + value: any, + /** the server validation options. */ + options: any, + /** the callback function called when validation is completed. */ + next: (err: any, value: any) => void): void; +} +/** a custom error handler function with the signature 'function(request, reply, source, error)` */ +export interface IRouteFailFunction { + /** a custom error handler function with the signature 'function(request, reply, source, error)` */ + (/** - the [request object]. */ + request: Request, + /** the continuation reply interface. */ + reply: IReply, + /** the source of the invalid field (e.g. 'path', 'query', 'payload'). */ + source: string, + /** the error object prepared for the client response (including the validation function error under error.data). */ + error: any): void; +} + +/** Each route can be customize to change the default behavior of the request lifecycle using the following options: */ +export interface IRouteAdditionalConfigurationOptions { + /** application specific configuration.Should not be used by plugins which should use plugins[name] instead. */ + app?: any; + /** authentication configuration.Value can be: false to disable authentication if a default strategy is set. + a string with the name of an authentication strategy registered with server.auth.strategy(). + an object */ + auth?: boolean | string | + { + /** the authentication mode.Defaults to 'required' if a server authentication strategy is configured, otherwise defaults to no authentication.Available values: + 'required'authentication is required. + 'optional'authentication is optional (must be valid if present). + 'try'same as 'optional' but allows for invalid authentication. */ + mode?: string; + /** a string array of strategy names in order they should be attempted.If only one strategy is used, strategy can be used instead with the single string value.Defaults to the default authentication strategy which is available only when a single strategy is configured. */ + strategies?: string | string[]; + /** if set, the payload (in requests other than 'GET' and 'HEAD') is authenticated after it is processed.Requires a strategy with payload authentication support (e.g.Hawk).Cannot be set to a value other than 'required' when the scheme sets the options.payload to true.Available values: + falseno payload authentication.This is the default value. + 'required'payload authentication required.This is the default value when the scheme sets options.payload to true. + 'optional'payload authentication performed only when the client includes payload authentication information (e.g.hash attribute in Hawk). */ + payload?: string; + /** the application scope required to access the route.Value can be a scope string or an array of scope strings.The authenticated credentials object scope property must contain at least one of the scopes defined to access the route.Set to false to remove scope requirements.Defaults to no scope required. */ + scope?: string | string[] | boolean; + /** the required authenticated entity type.If set, must match the entity value of the authentication credentials.Available values: + anythe authentication can be on behalf of a user or application.This is the default value. + userthe authentication must be on behalf of a user. + appthe authentication must be on behalf of an application. */ + entity?: string; + /** + * an object or array of objects specifying the route access rules. Each rule is evaluated against an incoming + * request and access is granted if at least one rule matches. Each rule object must include at least one of: + */ + access?: IRouteAdditionalConfigurationAuthAccess | IRouteAdditionalConfigurationAuthAccess[]; + }; + /** an object passed back to the provided handler (via this) when called. */ + bind?: any; + /** if the route method is 'GET', the route can be configured to include caching directives in the response using the following options */ + cache?: IRouteAdditionalConfigurationCache; + /** the Cross- Origin Resource Sharing protocol allows browsers to make cross- origin API calls.CORS is required by web applications running inside a browser which are loaded from a different domain than the API server.CORS headers are disabled by default. To enable, set cors to true, or to an object with the following options: */ + cors?: { + /** a strings array of allowed origin servers ('Access-Control-Allow-Origin').The array can contain any combination of fully qualified origins along with origin strings containing a wildcard '' character, or a single `''origin string. Defaults to any origin['*']`. */ + origin?: string[]; + /** if true, matches the value of the incoming 'Origin' header to the list of origin values ('*' matches anything) and if a match is found, uses that as the value of the 'Access-Control-Allow-Origin' response header.When false, the origin config is returned as- is.Defaults to true. */ + matchOrigin?: boolean; + /** if false, prevents the connection from returning the full list of non- wildcard origin values if the incoming origin header does not match any of the values.Has no impact if matchOrigin is set to false.Defaults to true. */ + isOriginExposed?: boolean; + /** number of seconds the browser should cache the CORS response ('Access-Control-Max-Age').The greater the value, the longer it will take before the browser checks for changes in policy.Defaults to 86400 (one day). */ + maxAge?: number; + /** a strings array of allowed headers ('Access-Control-Allow-Headers').Defaults to ['Authorization', 'Content-Type', 'If-None-Match']. */ + headers?: string[]; + /** a strings array of additional headers to headers.Use this to keep the default headers in place. */ + additionalHeaders?: string[]; + /** a strings array of allowed HTTP methods ('Access-Control-Allow-Methods').Defaults to ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS']. */ + methods?: string[]; + /** a strings array of additional methods to methods.Use this to keep the default methods in place. */ + additionalMethods?: string[]; + /** a strings array of exposed headers ('Access-Control-Expose-Headers').Defaults to ['WWW-Authenticate', 'Server-Authorization']. */ + exposedHeaders?: string[]; + /** a strings array of additional headers to exposedHeaders.Use this to keep the default headers in place. */ + additionalExposedHeaders?: string[]; + /** if true, allows user credentials to be sent ('Access-Control-Allow-Credentials').Defaults to false. */ + credentials?: boolean; + /** if false, preserves existing CORS headers set manually before the response is sent.Defaults to true. */ + override?: boolean; + }; + /** defines the behavior for serving static resources using the built-in route handlers for files and directories: */ + files?: {/** determines the folder relative paths are resolved against when using the file and directory handlers. */ + relativeTo: string; + }; + + /** an alternative location for the route handler option. */ + handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig; + /** an optional unique identifier used to look up the route using server.lookup(). */ + id?: number; + /** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */ + json?: { + /** the replacer function or array.Defaults to no action. */ + replacer?: Function | string[]; + /** number of spaces to indent nested object keys.Defaults to no indentation. */ + space?: number | string; + /** string suffix added after conversion to JSON string.Defaults to no suffix. */ + suffix?: string; + }; + /** enables JSONP support by setting the value to the query parameter name containing the function name used to wrap the response payload.For example, if the value is 'callback', a request comes in with 'callback=me', and the JSON response is '{ "a":"b" }', the payload will be 'me({ "a":"b" });'.Does not work with stream responses. */ + jsonp?: string; + /** determines how the request payload is processed: */ + payload?: { + /** the type of payload representation requested. The value must be one of: + 'data'the incoming payload is read fully into memory.If parse is true, the payload is parsed (JSON, formdecoded, multipart) based on the 'Content- Type' header.If parse is false, the raw Buffer is returned.This is the default value except when a proxy handler is used. + 'stream'the incoming payload is made available via a Stream.Readable interface.If the payload is 'multipart/form-data' and parse is true, fields values are presented as text while files are provided as streams.File streams from a 'multipart/form-data' upload will also have a property hapi containing filename and headers properties. + 'file'the incoming payload in written to temporary file in the directory specified by the server's payload.uploads settings. If the payload is 'multipart/ formdata' and parse is true, fields values are presented as text while files are saved. Note that it is the sole responsibility of the application to clean up the files generated by the framework. This can be done by keeping track of which files are used (e.g. using the request.app object), and listening to the server 'response' event to perform any needed cleaup. */ + output?: string; + /** can be true, false, or gunzip; determines if the incoming payload is processed or presented raw. true and gunzip includes gunzipping when the appropriate 'Content-Encoding' is specified on the received request. If parsing is enabled and the 'Content-Type' is known (for the whole payload as well as parts), the payload is converted into an object when possible. If the format is unknown, a Bad Request (400) error response is sent. Defaults to true, except when a proxy handler is used. The supported mime types are: + 'application/json' + 'application/x-www-form-urlencoded' + 'application/octet-stream' + 'text/ *' + 'multipart/form-data' */ + parse?: string | boolean; + /** a string or an array of strings with the allowed mime types for the endpoint.Defaults to any of the supported mime types listed above.Note that allowing other mime types not listed will not enable them to be parsed, and that if parsing mode is 'parse', the request will result in an error response. */ + allow?: string | string[]; + /** a mime type string overriding the 'Content-Type' header value received.Defaults to no override. */ + override?: string; + /** limits the size of incoming payloads to the specified byte count.Allowing very large payloads may cause the server to run out of memory.Defaults to 1048576 (1MB). */ + maxBytes?: number; + /** payload reception timeout in milliseconds.Sets the maximum time allowed for the client to transmit the request payload (body) before giving up and responding with a Request Timeout (408) error response.Set to false to disable.Defaults to 10000 (10 seconds). */ + timeout?: number; + /** the directory used for writing file uploads.Defaults to os.tmpDir(). */ + uploads?: string; + /** determines how to handle payload parsing errors. Allowed values are: + 'error'return a Bad Request (400) error response. This is the default value. + 'log'report the error but continue processing the request. + 'ignore'take no action and continue processing the request. */ + failAction?: string; + }; + /** pluginspecific configuration.plugins is an object where each key is a plugin name and the value is the plugin configuration. */ + plugins?: IDictionary; + /** an array with [route prerequisites] methods which are executed in serial or in parallel before the handler is called. */ + pre?: any[]; + /** validation rules for the outgoing response payload (response body).Can only validate object response: */ + response?: { + /** the default HTTP status code when the payload is empty. Value can be 200 or 204. + Note that a 200 status code is converted to a 204 only at the time or response transmission + (the response status code will remain 200 throughout the request lifecycle unless manually set). Defaults to 200. */ + emptyStatusCode?: number; + /** the default response object validation rules (for all non-error responses) expressed as one of: + true - any payload allowed (no validation performed). This is the default. + false - no payload allowed. + a Joi validation object. + a validation function using the signature function(value, options, next) where: + value - the object containing the response object. + options - the server validation options. + next(err) - the callback function called when validation is completed. */ + schema?: boolean | any; + /** HTTP status- codespecific validation rules.The status key is set to an object where each key is a 3 digit HTTP status code and the value has the same definition as schema.If a response status code is not present in the status object, the schema definition is used, expect for errors which are not validated by default. */ + status?: { [statusCode: number]: boolean | any }; + /** the percent of responses validated (0100).Set to 0 to disable all validation.Defaults to 100 (all responses). */ + sample?: number; + /** defines what to do when a response fails validation.Options are: + errorreturn an Internal Server Error (500) error response.This is the default value. + loglog the error but send the response. */ + failAction?: string; + /** if true, applies the validation rule changes to the response.Defaults to false. */ + modify?: boolean; + /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ + options?: any; + }; + /** sets common security headers (disabled by default).To enable set security to true or to an object with the following options */ + security?: boolean | { + /** controls the 'Strict-Transport-Security' header.If set to true the header will be set to max- age=15768000, if specified as a number the maxAge parameter will be set to that number.Defaults to true.You may also specify an object with the following fields: */ + hsts?: boolean | number | { + /** the max- age portion of the header, as a number.Default is 15768000. */ + maxAge?: number; + /** a boolean specifying whether to add the includeSubdomains flag to the header. */ + includeSubdomains?: boolean; + /** a boolean specifying whether to add the 'preload' flag (used to submit domains inclusion in Chrome's HTTP Strict Transport Security (HSTS) preload list) to the header. */ + preload?: boolean; + }; + /** controls the 'X-Frame-Options' header.When set to true the header will be set to DENY, you may also specify a string value of 'deny' or 'sameorigin'.To use the 'allow-from' rule, you must set this to an object with the following fields: */ + xframe?: { + /** either 'deny', 'sameorigin', or 'allow-from' */ + rule: string; + /** when rule is 'allow-from' this is used to form the rest of the header, otherwise this field is ignored.If rule is 'allow-from' but source is unset, the rule will be automatically changed to 'sameorigin'. */ + source: string; + }; + /** boolean that controls the 'X-XSS-PROTECTION' header for IE.Defaults to true which sets the header to equal '1; mode=block'.NOTE: This setting can create a security vulnerability in versions of IE below 8, as well as unpatched versions of IE8.See here and here for more information.If you actively support old versions of IE, it may be wise to explicitly set this flag to false. */ + xss?: boolean; + /** boolean controlling the 'X-Download-Options' header for IE, preventing downloads from executing in your context.Defaults to true setting the header to 'noopen'. */ + noOpen?: boolean; + /** boolean controlling the 'X-Content-Type-Options' header.Defaults to true setting the header to its only and default option, 'nosniff'. */ + noSniff?: boolean; + }; + /** HTTP state management (cookies) allows the server to store information on the client which is sent back to the server with every request (as defined in RFC 6265).state supports the following options: */ + state?: { + /** determines if incoming 'Cookie' headers are parsed and stored in the request.state object.Defaults to true. */ + parse: boolean; + /** determines how to handle cookie parsing errors.Allowed values are: + 'error'return a Bad Request (400) error response.This is the default value. + 'log'report the error but continue processing the request. + 'ignore'take no action. */ + failAction: string; + }; + /** request input validation rules for various request components.When using a Joi validation object, the values of the other inputs (i.e.headers, query, params, payload, and auth) are made available under the validation context (accessible in rules as Joi.ref('$query.key')).Note that validation is performed in order(i.e.headers, params, query, payload) and if type casting is used (converting a string to number), the value of inputs not yet validated will reflect the raw, unvalidated and unmodified values.The validate object supports: */ + validate?: { + /** validation rules for incoming request headers.Values allowed: + * trueany headers allowed (no validation performed).This is the default. + falseno headers allowed (this will cause all valid HTTP requests to fail). + a Joi validation object. + a validation function using the signature function(value, options, next) where: + valuethe object containing the request headers. + optionsthe server validation options. + next(err, value)the callback function called when validation is completed. + */ + headers?: boolean | IJoi | IValidationFunction; + + /** validation rules for incoming request path parameters, after matching the path against the route and extracting any parameters then stored in request.params.Values allowed: + trueany path parameters allowed (no validation performed).This is the default. + falseno path variables allowed. + a Joi validation object. + a validation function using the signature function(value, options, next) where: + valuethe object containing the path parameters. + optionsthe server validation options. + next(err, value)the callback function called when validation is completed. */ + params?: boolean | IJoi | IValidationFunction; + /** validation rules for an incoming request URI query component (the key- value part of the URI between '?' and '#').The query is parsed into its individual key- value pairs (using the qs module) and stored in request.query prior to validation.Values allowed: + trueany query parameters allowed (no validation performed).This is the default. + falseno query parameters allowed. + a Joi validation object. + a validation function using the signature function(value, options, next) where: + valuethe object containing the query parameters. + optionsthe server validation options. + next(err, value)the callback function called when validation is completed. */ + query?: boolean | IJoi | IValidationFunction; + /** validation rules for an incoming request payload (request body).Values allowed: + trueany payload allowed (no validation performed).This is the default. + falseno payload allowed. + a Joi validation object. + a validation function using the signature function(value, options, next) where: + valuethe object containing the payload object. + optionsthe server validation options. + next(err, value)the callback function called when validation is completed. */ + payload?: boolean | IJoi | IValidationFunction; + /** an optional object with error fields copied into every validation error response. */ + errorFields?: any; + /** determines how to handle invalid requests.Allowed values are: + 'error'return a Bad Request (400) error response.This is the default value. + 'log'log the error but continue processing the request. + 'ignore'take no action. + OR a custom error handler function with the signature 'function(request, reply, source, error)` where: + requestthe request object. + replythe continuation reply interface. + sourcethe source of the invalid field (e.g. 'path', 'query', 'payload'). + errorthe error object prepared for the client response (including the validation function error under error.data). */ + failAction?: string | IRouteFailFunction; + /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ + options?: any; + }; + /** define timeouts for processing durations: */ + timeout?: { + /** response timeout in milliseconds.Sets the maximum time allowed for the server to respond to an incoming client request before giving up and responding with a Service Unavailable (503) error response.Disabled by default (false). */ + server: boolean | number; + /** by default, node sockets automatically timeout after 2 minutes.Use this option to override this behavior.Defaults to undefined which leaves the node default unchanged.Set to false to disable socket timeouts. */ + socket: boolean | number; + }; + + /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). + *route description used for generating documentation (string). + */ + description?: string; + /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). + *route notes used for generating documentation (string or array of strings). + */ + notes?: string | string[]; + /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). + *route tags used for generating documentation (array of strings). + */ + tags?: string[]; + + /** Enable logging of routes + */ + log?: boolean; +} + +/** + * specifying the route access rules. Each rule is evaluated against an incoming request and access is granted if at least one rule matches + */ +export interface IRouteAdditionalConfigurationAuthAccess { + /** + * the application scope required to access the route. Value can be a scope string or an array of scope strings. + * The authenticated credentials object scope property must contain at least one of the scopes defined to access the route. + * If a scope string begins with a + character, that scope is required. If a scope string begins with a ! character, + * that scope is forbidden. For example, the scope ['!a', '+b', 'c', 'd'] means the incoming request credentials' + * scope must not include 'a', must include 'b', and must include on of 'c' or 'd'. You may also access properties + * on the request object (query and params} to populate a dynamic scope by using {} characters around the property name, + * such as 'user-{params.id}'. Defaults to false (no scope requirements). + */ + scope?: string | string[] | boolean; + /** the required authenticated entity type. If set, must match the entity value of the authentication credentials. Available values: + * any - the authentication can be on behalf of a user or application. This is the default value. + * user - the authentication must be on behalf of a user which is identified by the presence of a user attribute in the credentials object returned by the authentication strategy. + * app - the authentication must be on behalf of an application which is identified by the lack of presence of a user attribute in the credentials object returned by the authentication strategy. + */ + entity?: string; +} + +export type IRouteAdditionalConfigurationCache = { + /** determines the privacy flag included in clientside caching using the 'Cache-Control' header. Values are: + 'Default': no privacy flag.This is the default setting. + 'public': mark the response as suitable for public caching. + 'private': mark the response as suitable only for private caching. */ + privacy?: 'default' | 'public' | 'private'; + /** an array of HTTP response status codes (e.g. 200) which are allowed to include a valid caching directive. Defaults to [200]. */ + statuses?: number[]; + /** a string with the value of the 'Cache-Control' header when caching is disabled. Defaults to 'no-cache'. */ + otherwise?: string; +} & ({ + /** relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. */ + expiresIn: number; +} | { + /** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire. Cannot be used together with expiresIn. */ + expiresAt: string; +} | {}); + +/** server.realm http://hapijs.com/api#serverrealm + The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), + the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin). + Realms are a limited version of a sandbox where plugins can maintain state used by the framework when adding routes, extensions, and other properties. + The server.realm object should be considered read-only and must not be changed directly except for the plugins property can be directly manipulated by the plugins (each setting its own under plugins[name]). + exports.register = function (server, options, next) { +console.log(server.realm.modifiers.route.prefix); +return next(); +}; + */ +export interface IServerRealm { + /** when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method */ + modifiers: { + /** routes preferences: */ + route: { + /** - the route path prefix used by any calls to server.route() from the server. */ + prefix: string; + /** the route virtual host settings used by any calls to server.route() from the server. */ + vhost: string; + }; + }; + /** the active plugin name (empty string if at the server root). */ + plugin: string; + /** plugin-specific state to be shared only among activities sharing the same active state. plugins is an object where each key is a plugin name and the value is the plugin state. */ + plugins: IDictionary; + /** settings overrides */ + settings: { + files: { + relativeTo: any; + }; + bind: any; + }; +} +/** server.state(name, [options]) http://hapijs.com/api#serverstatename-options + HTTP state management uses client cookies to persist a state across multiple requests. Registers a cookie definitions where:*/ +export interface IServerState { + /** - the cookie name string. */ + name: string; + + /** - are the optional cookie settings: */ + options: { + /** - time - to - live in milliseconds.Defaults to null (session time- life - cookies are deleted when the browser is closed).*/ + ttl: number; + /** - sets the 'Secure' flag.Defaults to false.*/ + isSecure: boolean; + /** - sets the 'HttpOnly' flag.Defaults to false.*/ + isHttpOnly: boolean + /** - the path scope.Defaults to null (no path).*/ + path: any; + /** - the domain scope.Defaults to null (no domain). */ + domain: any; + /** if present and the cookie was not received from the client or explicitly set by the route handler, the cookie is automatically added to the response with the provided value. The value can be a function with signature function(request, next) where: + request - the request object. + next - the continuation function using the function(err, value) signature.*/ + autoValue(request: Request, next: (err: any, value: any) => void): void; + /** - encoding performs on the provided value before serialization. Options are: + 'none' - no encoding. When used, the cookie value must be a string. This is the default value. + 'base64' - string value is encoded using Base64. + 'base64json' - object value is JSON-stringified than encoded using Base64. + 'form' - object value is encoded using the x-www-form-urlencoded method. + 'iron' - Encrypts and sign the value using iron.*/ + encoding: string; + /** - an object used to calculate an HMAC for cookie integrity validation.This does not provide privacy, only a mean to verify that the cookie value was generated by the server.Redundant when 'iron' encoding is used.Options are:*/ + sign: { + /** - algorithm options.Defaults to require('iron').defaults.integrity.*/ + integrity: any; + /** - password used for HMAC key generation.*/ + password: string; + }; + /** - password used for 'iron' encoding.*/ + password: string; + /** - options for 'iron' encoding.Defaults to require('iron').defaults.*/ + iron: any; + /** - if false, errors are ignored and treated as missing cookies.*/ + ignoreErrors: boolean; + /** - if true, automatically instruct the client to remove invalid cookies.Defaults to false.*/ + clearInvalid: boolean; + /** - if false, allows any cookie value including values in violation of RFC 6265. Defaults to true.*/ + strictHeader: boolean; + /** - overrides the default proxy localStatePassThrough setting.*/ + passThrough: any; + }; +} + +export interface IFileHandlerConfig { + /** a path string or function as described above.*/ + path: string; + /** an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ + filename?: string; + /**- specifies whether to include the 'Content-Disposition' header with the response. Available values: + false - header is not included. This is the default value. + 'attachment' + 'inline'*/ + mode?: boolean | string; + /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false.*/ + lookupCompressed: boolean; +} + +/**http://hapijs.com/api#route-handler + Built-in handlers + + The framework comes with a few built-in handler types available by setting the route handler config to an object containing one of these keys.*/ +export interface IRouteHandlerConfig { + /** generates a static file endpoint for serving a single file. file can be set to: + a relative or absolute file path string (relative paths are resolved based on the route files configuration). + a function with the signature function(request) which returns the relative or absolute file path. + an object with the following options */ + file?: string | IRequestHandler | IFileHandlerConfig; + /** directory - generates a directory endpoint for serving static content from a directory. Routes using the directory handler must include a path parameter at the end of the path string (e.g. /path/to/somewhere/{param} where the parameter name does not matter). The path parameter can use any of the parameter options (e.g. {param} for one level files only, {param?} for one level files or the directory root, {param*} for any level, or {param*3} for a specific level). If additional path parameters are present, they are ignored for the purpose of selecting the file system resource. The directory handler is an object with the following options: + path - (required) the directory root path (relative paths are resolved based on the route files configuration). Value can be: + a single path string used as the prefix for any resources requested by appending the request path parameter to the provided string. + an array of path strings. Each path will be attempted in order until a match is found (by following the same process as the single path string). + a function with the signature function(request) which returns the path string or an array of path strings. If the function returns an error, the error is passed back to the client in the response. + index - optional boolean|string|string[], determines if an index file will be served if found in the folder when requesting a directory. The given string or strings specify the name(s) of the index file to look for. If true, looks for 'index.html'. Any falsy value disables index file lookup. Defaults to true. + listing - optional boolean, determines if directory listing is generated when a directory is requested without an index document. Defaults to false. + showHidden - optional boolean, determines if hidden files will be shown and served. Defaults to false. + redirectToSlash - optional boolean, determines if requests for a directory without a trailing slash are redirected to the same path with the missing slash. Useful for ensuring relative links inside the response are resolved correctly. Disabled when the server config router.stripTrailingSlash is true.Defaults to false. + lookupCompressed - optional boolean, instructs the file processor to look for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. + defaultExtension - optional string, appended to file requests if the requested file is not found. Defaults to no extension.*/ + directory?: { + path: string | string[] | IRequestHandler | IRequestHandler; + index?: boolean | string | string[]; + listing?: boolean; + showHidden?: boolean; + redirectToSlash?: boolean; + lookupCompressed?: boolean; + defaultExtension?: string; + }; + proxy?: IProxyHandlerConfig; + view?: string | { + template: string; + context: { + payload: any; + params: any; + query: any; + pre: any; + } + }; + config?: { + handler: any; + bind: any; + app: any; + plugins: { + [name: string]: any; + }; + pre: Array<() => void>; + validate: { + headers: any; + params: any; + query: any; + payload: any; + errorFields?: any; + failAction?: string | IFailAction; + }; + payload: { + output: { + data: any; + stream: any; + file: any; + }; + parse?: any; + allow?: string | string[]; + override?: string; + maxBytes?: number; + uploads?: number; + failAction?: string; + }; + response: { + schema: any; + sample: number; + failAction: string; + }; + cache: { + privacy: string; + expiresIn: number; + expiresAt: number; + }; + auth: string | boolean | { + mode: string; + strategies: string[]; + payload?: boolean | string; + tos?: boolean | string; + scope?: string | string[]; + entity: string; + }; + cors?: boolean; + jsonp?: string; + description?: string; + notes?: string | string[]; + tags?: string[]; + }; +} +/** Route configuration + The route configuration object*/ +export interface IRouteConfiguration { + /** - (required) the absolute path used to match incoming requests (must begin with '/'). Incoming requests are compared to the configured paths based on the connection router configuration option.The path can include named parameters enclosed in {} which will be matched against literal values in the request as described in Path parameters.*/ + path: string; + /** - (required) the HTTP method.Typically one of 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', or 'OPTIONS'.Any HTTP method is allowed, except for 'HEAD'.Use '*' to match against any HTTP method (only when an exact match was not found, and any match with a specific method will be given a higher priority over a wildcard match). + * Can be assigned an array of methods which has the same result as adding the same route with different methods manually.*/ + method: string | string[]; + /** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/ + vhost?: string; + /** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/ + handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig; + /** - additional route options.*/ + config?: IRouteAdditionalConfigurationOptions; +} +/** Route public interface When route information is returned or made available as a property. http://hapijs.com/api#route-public-interface */ +export interface IRoute { + /** the route HTTP method. */ + method: string; + /** the route path. */ + path: string; + /** the route vhost option if configured. */ + vhost?: string | string[]; + /** the [active realm] associated with the route.*/ + realm: IServerRealm; + /** the [route options] object with all defaults applied. */ + settings: IRouteAdditionalConfigurationOptions; +} + +export interface IServerAuthScheme { + /** authenticate(request, reply) - required function called on each incoming request configured with the authentication scheme where: + request - the request object. + reply - the reply interface the authentication method must call when done authenticating the request where: + reply(err, response, result) - is called if authentication failed where: + err - any authentication error. + response - any authentication response action such as redirection. Ignored if err is present, otherwise required. + result - an object containing: + credentials - the authenticated credentials. + artifacts - optional authentication artifacts. + reply.continue(result) - is called if authentication succeeded where: + result - same object as result above. + When the scheme authenticate() method implementation calls reply() with an error condition, the specifics of the error affect whether additional authentication strategies will be attempted if configured for the route. + .If the err returned by the reply() method includes a message, no additional strategies will be attempted. + If the err does not include a message but does include a scheme name (e.g. Boom.unauthorized(null, 'Custom')), additional strategies will be attempted in order of preference. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + var scheme = function (server, options) { + return { + authenticate: function (request, reply) { + var req = request.raw.req; + var authorization = req.headers.authorization; + if (!authorization) { + return reply(Boom.unauthorized(null, 'Custom')); + } + return reply(null, { credentials: { user: 'john' } }); + } + }; + }; + server.auth.scheme('custom', scheme);*/ + authenticate(request: Request, reply: IReply): void; + authenticate(request: Request, reply: IStrictReply): void; + /** payload(request, reply) - optional function called to authenticate the request payload where: + request - the request object. + reply(err, response) - is called if authentication failed where: + err - any authentication error. + response - any authentication response action such as redirection. Ignored if err is present, otherwise required. + reply.continue() - is called if payload authentication succeeded. + When the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'.*/ + payload?(request: Request, reply: IReply): void; + payload?(request: Request, reply: IStrictReply): void; + /** response(request, reply) - optional function called to decorate the response with authentication headers before the response headers or payload is written where: + request - the request object. + reply(err, response) - is called if an error occurred where: + err - any authentication error. + response - any authentication response to send instead of the current response. Ignored if err is present, otherwise required. + reply.continue() - is called if the operation succeeded.*/ + response?(request: Request, reply: IReply): void; + response?(request: Request, reply: IStrictReply): void; + /** an optional object */ + options?: { + /** if true, requires payload validation as part of the scheme and forbids routes from disabling payload auth validation. Defaults to false.*/ + payload: boolean; + }; +} + +/**the response object where: + statusCode - the HTTP status code. + headers - an object containing the headers set. + payload - the response payload string. + rawPayload - the raw response payload buffer. + raw - an object with the injection request and response objects: + req - the simulated node request object. + res - the simulated node response object. + result - the raw handler response (e.g. when not a stream or a view) before it is serialized for transmission. If not available, the value is set to payload. Useful for inspection and reuse of the internal objects returned (instead of parsing the response string). + request - the request object.*/ +export interface IServerInjectResponse { + statusCode: number; + headers: IDictionary; + payload: string; + rawPayload: Buffer; + raw: { + req: http.IncomingMessage; + res: http.ServerResponse + }; + result: any; + request: Request; +} + +export interface IServerInject { + (options: string | IServerInjectOptions, callback: (res: IServerInjectResponse) => void): void; + (options: string | IServerInjectOptions): Promise; +} + +export interface IServerInjectOptions { + /** the request HTTP method (e.g. 'POST'). Defaults to 'GET'.*/ + method: string; + /** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/ + url: string; + /** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/ + headers?: IDictionary; + /** n optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/ + payload?: string | {} | Buffer; + /** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/ + credentials?: any; + /** an optional artifacts object containing authentication artifact information. The artifacts are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Ignored if set without credentials. Defaults to no artifacts.*/ + artifacts?: any; + /** sets the initial value of request.app*/ + app?: any; + /** sets the initial value of request.plugins*/ + plugins?: any; + /** allows access to routes with config.isInternal set to true. Defaults to false.*/ + allowInternals?: boolean; + /** sets the remote address for the incoming connection.*/ + remoteAddress?: boolean; + /**object with options used to simulate client request stream conditions for testing: + error - if true, emits an 'error' event after payload transmission (if any). Defaults to false. + close - if true, emits a 'close' event after payload transmission (if any). Defaults to false. + end - if false, does not end the stream. Defaults to true.*/ + simulate?: { + error: boolean; + close: boolean; + end: boolean; + }; +} + +/** host - optional host to filter routes matching a specific virtual host. Defaults to all virtual hosts. + The return value is an array where each item is an object containing: + info - the connection.info the connection the table was generated for. + labels - the connection labels. + table - an array of routes where each route contains: + settings - the route config with defaults applied. + method - the HTTP method in lower case. + path - the route path.*/ +export interface IConnectionTable { + info: any; + labels: any; + table: IRoute[]; +} + +export interface ICookieSettings { + /** - time - to - live in milliseconds.Defaults to null (session time- life - cookies are deleted when the browser is closed).*/ + ttl?: number; + /** - sets the 'Secure' flag.Defaults to false.*/ + isSecure?: boolean; + /** - sets the 'HttpOnly' flag.Defaults to false.*/ + isHttpOnly?: boolean; + /** - the path scope.Defaults to null (no path).*/ + path?: string; + /** - the domain scope.Defaults to null (no domain).*/ + domain?: any; + /** - if present and the cookie was not received from the client or explicitly set by the route handler, the cookie is automatically added to the response with the provided value.The value can be a function with signature function(request, next) where: + request - the request object. + next - the continuation function using the function(err, value) signature.*/ + autoValue?(request: Request, next: (err: any, value: any) => void): void; + /** - encoding performs on the provided value before serialization.Options are: + 'none' - no encoding.When used, the cookie value must be a string.This is the default value. + 'base64' - string value is encoded using Base64. + 'base64json' - object value is JSON- stringified than encoded using Base64. + 'form' - object value is encoded using the x- www - form - urlencoded method. */ + encoding?: string; + /** - an object used to calculate an HMAC for cookie integrity validation.This does not provide privacy, only a mean to verify that the cookie value was generated by the server.Redundant when 'iron' encoding is used.Options are: + integrity - algorithm options.Defaults to require('iron').defaults.integrity. + password - password used for HMAC key generation. */ + sign?: { integrity: any; password: string; }; + password?: string; + iron?: any; + ignoreErrors?: boolean; + clearInvalid?: boolean; + strictHeader?: boolean; + passThrough?: any; +} + +/** method - the method function with the signature is one of: + function(arg1, arg2, ..., argn, next) where: + arg1, arg2, etc. - the method function arguments. + next - the function called when the method is done with the signature function(err, result, ttl) where: + err - error response if the method failed. + result - the return value. + ttl - 0 if result is valid but cannot be cached. Defaults to cache policy. + function(arg1, arg2, ..., argn) where: + arg1, arg2, etc. - the method function arguments. + the callback option is set to false. + the method must returns a value (result, Error, or a promise) or throw an Error.*/ +export interface IServerMethod { + // (): void; + // (next: (err: any, result: any, ttl: number) => void): void; + // (arg1: any): void; + // (arg1: any, arg2: any, next: (err: any, result: any, ttl: number) => void): void; + // (arg1: any, arg2: any): void; + (...args: any[]): void; +} +/** options - optional configuration: + bind - a context object passed back to the method function (via this) when called. Defaults to active context (set via server.bind() when the method is registered. + cache - the same cache configuration used in server.cache(). + callback - if false, expects the method to be a synchronous function. Note that using a synchronous function with caching will convert the method interface to require a callback as an additional argument with the signature function(err, result, cached, report) since the cache interface cannot return values synchronously. Defaults to true. + generateKey - a function used to generate a unique key (for caching) from the arguments passed to the method function (the callback argument is not passed as input). The server will automatically generate a unique key if the function's arguments are all of types 'string', 'number', or 'boolean'. However if the method uses other types of arguments, a key generation function must be provided which takes the same arguments as the function and returns a unique string (or null if no key can be generated).*/ +export interface IServerMethodOptions { + bind?: any; + cache?: ICatBoxCachePolicyOptions; + callback?: boolean; + generateKey?(args: any[]): string; +} +/** Request object + + The request object is created internally for each incoming request. It is different from the node.js request object received from the HTTP server callback (which is available in request.raw.req). The request object methods and properties change throughout the request lifecycle. + Request events + + The request object supports the following events: + + 'peek' - emitted for each chunk of payload data read from the client connection. The event method signature is function(chunk, encoding). + 'finish' - emitted when the request payload finished reading. The event method signature is function (). + 'disconnect' - emitted when a request errors or aborts unexpectedly. + var Crypto = require('crypto'); + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.ext('onRequest', function (request, reply) { + +var hash = Crypto.createHash('sha1'); +request.on('peek', function (chunk) { + +hash.update(chunk); +}); + +request.once('finish', function () { + +console.log(hash.digest('hex')); +}); + +request.once('disconnect', function () { + +console.error('request aborted'); +}); + +return reply.continue(); +});*/ +export class Request extends Events.EventEmitter { + /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ + app: any; + /** authentication information*/ + auth: { + /** true is the request has been successfully authenticated, otherwise false.*/ + isAuthenticated: boolean; + /** the credential object received during the authentication process. The presence of an object does not mean successful authentication. can be set in the validate function's callback.*/ + credentials: any; + /** an artifact object received from the authentication strategy and used in authentication-related actions.*/ + artifacts: any; + /** the route authentication mode.*/ + mode: any; + /** the authentication error is failed and mode set to 'try'.*/ + error: any; + }; + /** the connection used by this request*/ + connection: ServerConnection; + /** the node domain object used to protect against exceptions thrown in extensions, handlers and route prerequisites. Can be used to manually bind callback functions otherwise bound to other domains.*/ + domain: any; + /** the raw request headers (references request.raw.headers).*/ + headers: IDictionary; + /** a unique request identifier (using the format '{now}:{connection.info.id}:{5 digits counter}').*/ + id: string; + /** request information */ + info: { + /** the request preferred encoding. */ + acceptEncoding: string; + /** if CORS is enabled for the route, contains the following: */ + cors: { + isOriginMatch: boolean; /** true if the request 'Origin' header matches the configured CORS restrictions. Set to false if no 'Origin' header is found or if it does not match. Note that this is only available after the 'onRequest' extension point as CORS is configured per-route and no routing decisions are made at that point in the request lifecycle. */ + }; + /** content of the HTTP 'Host' header (e.g. 'example.com:8080'). */ + host: string; + /** the hostname part of the 'Host' header (e.g. 'example.com').*/ + hostname: string; + /** request reception timestamp. */ + received: number; + /** content of the HTTP 'Referrer' (or 'Referer') header. */ + referrer: string; + /** remote client IP address. */ + remoteAddress: string; + /** remote client port. */ + remotePort: number; + /** request response timestamp (0 is not responded yet). */ + responded: number; + }; + /** the request method in lower case (e.g. 'get', 'post'). */ + method: string; + /** the parsed content-type header. Only available when payload parsing enabled and no payload error occurred. */ + mime: string; + /** an object containing the values of params, query, and payload before any validation modifications made. Only set when input validation is performed.*/ + orig: { + params: any; + query: any; + payload: any; + }; + /** an object where each key is a path parameter name with matching value as described in Path parameters.*/ + params: IDictionary; + /** an array containing all the path params values in the order they appeared in the path.*/ + paramsArray: string[]; + /** the request URI's path component. */ + path: string; + /** the request payload based on the route payload.output and payload.parse settings.*/ + payload: stream.Readable | Buffer | any; + /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state.*/ + plugins: any; + /** an object where each key is the name assigned by a route prerequisites function. The values are the raw values provided to the continuation function as argument. For the wrapped response object, use responses.*/ + pre: IDictionary; + /** the response object when set. The object can be modified but must not be assigned another object. To replace the response with another from within an extension point, use reply(response) to override with a different response. Contains null when no response has been set (e.g. when a request terminates prematurely when the client disconnects).*/ + response: Response; + /**preResponses - same as pre but represented as the response object created by the pre method.*/ + preResponses: any; + /**an object containing the query parameters.*/ + query: any; + /** an object containing the Node HTTP server objects. Direct interaction with these raw objects is not recommended.*/ + raw: { + req: http.IncomingMessage; + res: http.ServerResponse; + }; + /** the route public interface.*/ + route: IRoute; + /** the server object. */ + server: Server; + /** an object containing parsed HTTP state information (cookies) where each key is the cookie name and value is the matching cookie content after processing using any registered cookie definition. */ + state: any; + /** complex object contining details on the url */ + url: { + /** null when i tested */ + auth: any; + /** null when i tested */ + hash: any; + /** null when i tested */ + host: any; + /** null when i tested */ + hostname: any; + href: string; + path: string; + /** path without search*/ + pathname: string; + /** null when i tested */ + port: any; + /** null when i tested */ + protocol: any; + /** querystring parameters*/ + query: IDictionary; + /** querystring parameters as a string*/ + search: string; + /** null when i tested */ + slashes: any; + }; + + /** request.setUrl(url) + + Available only in 'onRequest' extension methods. + + Changes the request URI before the router begins processing the request where: + + url - the new request path value. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.ext('onRequest', function (request, reply) { + + // Change all requests to '/test' + request.setUrl('/test'); + return reply.continue(); + });*/ + setUrl(url: string | url.Url): void; + /** request.setMethod(method) + + Available only in 'onRequest' extension methods. + + Changes the request method before the router begins processing the request where: + + method - is the request HTTP method (e.g. 'GET'). + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.ext('onRequest', function (request, reply) { + + // Change all requests to 'GET' + request.setMethod('GET'); + return reply.continue(); + });*/ + setMethod(method: string): void; + + /** request.log(tags, [data, [timestamp]]) + + Always available. + + Logs request-specific events. When called, the server emits a 'request' event which can be used by other listeners or plugins. The arguments are: + + data - an optional message string or object with the application data being logged. + timestamp - an optional timestamp expressed in milliseconds. Defaults to Date.now() (now). + Any logs generated by the server internally will be emitted only on the 'request-internal' channel and will include the event.internal flag set to true. + + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.on('request', function (request, event, tags) { + + if (tags.error) { + console.log(event); + } + }); + + var handler = function (request, reply) { + + request.log(['test', 'error'], 'Test event'); + return reply(); + }; + */ + log(/** a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events.*/ + tags: string | string[], + /** an optional message string or object with the application data being logged.*/ + data?: any, + /** an optional timestamp expressed in milliseconds. Defaults to Date.now() (now).*/ + timestamp?: number): void; + + /** request.getLog([tags], [internal]) + + Always available. + + Returns an array containing the events matching any of the tags specified (logical OR) + request.getLog(); + request.getLog('error'); + request.getLog(['error', 'auth']); + request.getLog(['error'], true); + request.getLog(false);*/ + + getLog(/** is a single tag string or array of tag strings. If no tags specified, returns all events.*/ + tags?: string, + /** filters the events to only those with a matching event.internal value. If true, only internal logs are included. If false, only user event are included. Defaults to all events (undefined).*/ + internal?: boolean): string[]; + + /** request.tail([name]) + + Available until immediately after the 'response' event is emitted. + + Adds a request tail which has to complete before the request lifecycle is complete where: + + name - an optional tail name used for logging purposes. + Returns a tail function which must be called when the tail activity is completed. + + Tails are actions performed throughout the request lifecycle, but which may end after a response is sent back to the client. For example, a request may trigger a database update which should not delay sending back a response. However, it is still desirable to associate the activity with the request when logging it (or an error associated with it). + + When all tails completed, the server emits a 'tail' event. + + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + var get = function (request, reply) { + + var dbTail = request.tail('write to database'); + + db.save('key', 'value', function () { + + dbTail(); + }); + + return reply('Success!'); + }; + + server.route({ method: 'GET', path: '/', handler: get }); + + server.on('tail', function (request) { + + console.log('Request completed including db activity'); + });*/ + tail(/** an optional tail name used for logging purposes.*/ + name?: string): Function; +} +/** Response events + + The response object supports the following events: + + 'peek' - emitted for each chunk of data written back to the client connection. The event method signature is function(chunk, encoding). + 'finish' - emitted when the response finished writing but before the client response connection is ended. The event method signature is function (). + var Crypto = require('crypto'); + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + + server.ext('onPreResponse', function (request, reply) { + +var response = request.response; +if (response.isBoom) { +return reply(); +} + +var hash = Crypto.createHash('sha1'); +response.on('peek', function (chunk) { + +hash.update(chunk); +}); + +response.once('finish', function () { + +console.log(hash.digest('hex')); +}); + +return reply.continue(); +});*/ +export class Response extends Events.EventEmitter { + isBoom: boolean; + /** the HTTP response status code. Defaults to 200 (except for errors).*/ + statusCode: number; + /** an object containing the response headers where each key is a header field name. Note that this is an incomplete list of headers to be included with the response. Additional headers will be added once the response is prepare for transmission.*/ + headers: IDictionary; + /** the value provided using the reply interface.*/ + source: any; + /** a string indicating the type of source with available values: + 'plain' - a plain response such as string, number, null, or simple object (e.g. not a Stream, Buffer, or view). + 'buffer' - a Buffer. + 'view' - a view generated with reply.view(). + 'file' - a file generated with reply.file() of via the directory handler. + 'stream' - a Stream. + 'promise' - a Promise object. */ + variety: string; + /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ + app: any; + /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state. */ + plugins: any; + /** settings - response handling flags: + charset - the 'Content-Type' HTTP header 'charset' property. Defaults to 'utf-8'. + encoding - the string encoding scheme used to serial data into the HTTP payload when source is a string or marshals into a string. Defaults to 'utf8'. + passThrough - if true and source is a Stream, copies the statusCode and headers of the stream to the outbound response. Defaults to true. + stringify - options used for source value requiring stringification. Defaults to no replacer and no space padding. + ttl - if set, overrides the route cache expiration milliseconds value set in the route config. Defaults to no override. + varyEtag - if true, a suffix will be automatically added to the 'ETag' header at transmission time (separated by a '-' character) when the HTTP 'Vary' header is present.*/ + settings: { + charset: string; + encoding: string; + passThrough: boolean; + stringify: any; + ttl: number; + varyEtag: boolean; + }; + + /** sets the HTTP 'Content-Length' header (to avoid chunked transfer encoding) where: + length - the header value. Must match the actual payload size.*/ + bytes(length: number): Response; + + /** sets the 'Content-Type' HTTP header 'charset' property where: charset - the charset property value.*/ + charset(charset: string): Response; + + /** sets the HTTP status code where: + statusCode - the HTTP status code.*/ + code(statusCode: number): Response; + + /** sets the HTTP status code to Created (201) and the HTTP 'Location' header where: uri - an absolute or relative URI used as the 'Location' header value.*/ + created(uri: string): Response; + + /** encoding(encoding) - sets the string encoding scheme used to serial data into the HTTP payload where: encoding - the encoding property value (see node Buffer encoding).*/ + encoding(encoding: string): Response; + + /** etag(tag, options) - sets the representation entity tag where: + tag - the entity tag string without the double-quote. + options - optional settings where: + weak - if true, the tag will be prefixed with the 'W/' weak signifier. Weak tags will fail to match identical tags for the purpose of determining 304 response status. Defaults to false. + vary - if true and content encoding is set or applied to the response (e.g 'gzip' or 'deflate'), the encoding name will be automatically added to the tag at transmission time (separated by a '-' character). Ignored when weak is true. Defaults to true.*/ + etag(tag: string, options: { + weak: boolean; vary: boolean; + }): Response; + + /**header(name, value, options) - sets an HTTP header where: + name - the header name. + value - the header value. + options - optional settings where: + append - if true, the value is appended to any existing header value using separator. Defaults to false. + separator - string used as separator when appending to an exiting value. Defaults to ','. + override - if false, the header value is not set if an existing value present. Defaults to true.*/ + header(name: string, value: string, options?: IHeaderOptions): Response; + + /** hold() - puts the response on hold until response.send() is called. Available only after reply() is called and until response.hold() is invoked once. */ + hold(): Response; + + /** location(uri) - sets the HTTP 'Location' header where: + uri - an absolute or relative URI used as the 'Location' header value.*/ + location(uri: string): Response; + + /** redirect(uri) - sets an HTTP redirection response (302) and decorates the response with additional methods listed below, where: + uri - an absolute or relative URI used to redirect the client to another resource. */ + redirect(uri: string): Response; + + /** replacer(method) - sets the JSON.stringify() replacer argument where: + method - the replacer function or array. Defaults to none.*/ + replacer(method: Function | Function[]): Response; + + /** spaces(count) - sets the JSON.stringify() space argument where: + count - the number of spaces to indent nested object keys. Defaults to no indentation. */ + spaces(count: number): Response; + + /**state(name, value, [options]) - sets an HTTP cookie where: + name - the cookie name. + value - the cookie value. If no encoding is defined, must be a string. + options - optional configuration. If the state was previously registered with the server using server.state(), the specified keys in options override those same keys in the server definition (but not others).*/ + state(name: string, value: string, options?: any): Response; + + /** send() - resume the response which will be transmitted in the next tick. Available only after response.hold() is called and until response.send() is invoked once. */ + send(): void; + + /** sets a string suffix when the response is process via JSON.stringify().*/ + suffix(suffix: string): void; + + /** overrides the default route cache expiration rule for this response instance where: + msec - the time-to-live value in milliseconds.*/ + ttl(msec: number): void; + + /** type(mimeType) - sets the HTTP 'Content-Type' header where: + mimeType - is the mime type. Should only be used to override the built-in default for each response type. */ + type(mimeType: string): Response; + + /** clears the HTTP cookie by setting an expired value where: + name - the cookie name. + options - optional configuration for expiring cookie. If the state was previously registered with the server using server.state(), the specified keys in options override those same keys in the server definition (but not others).*/ + unstate(name: string, options?: { [key: string]: string }): Response; + + /** adds the provided header to the list of inputs affected the response generation via the HTTP 'Vary' header where: + header - the HTTP request header name.*/ + vary(header: string): void; +} +/** When using the redirect() method, the response object provides these additional methods */ +export class ResponseRedirect extends Response { + /** sets the status code to 302 or 307 (based on the rewritable() setting) where: + isTemporary - if false, sets status to permanent. Defaults to true.*/ + temporary(isTemporary: boolean): void; + + /** sets the status code to 301 or 308 (based on the rewritable() setting) where: + isPermanent - if true, sets status to temporary. Defaults to false. */ + permanent(isPermanent: boolean): void; + + /** sets the status code to 301/302 for rewritable (allows changing the request method from 'POST' to 'GET') or 307/308 for non-rewritable (does not allow changing the request method from 'POST' to 'GET'). Exact code based on the temporary() or permanent() setting. Arguments: + isRewritable - if false, sets to non-rewritable. Defaults to true. + Permanent Temporary + Rewritable 301 302(1) + Non-rewritable 308(2) 307 + Notes: 1. Default value. 2. Proposed code, not supported by all clients. */ + rewritable(isRewritable: boolean): void; +} +/** info about a server connection */ +export interface IServerConnectionInfo { + /** - a unique connection identifier (using the format '{hostname}:{pid}:{now base36}').*/ + id: string; + /** - the connection creation timestamp.*/ + created: number; + /** - the connection start timestamp (0 when stopped).*/ + started: number; + /** the connection port based on the following rules: + the configured port value before the server has been started. + the actual port assigned when no port is configured or set to 0 after the server has been started.*/ + port: number; + + /** - the host name the connection was configured to. Defaults to the operating system hostname when available, otherwise 'localhost'.*/ + host: string; + /** - the active IP address the connection was bound to after starting.Set to undefined until the server has been started or when using a non TCP port (e.g. UNIX domain socket).*/ + address: string; + /** - the protocol used: + 'http' - HTTP. + 'https' - HTTPS. + 'socket' - UNIX domain socket or Windows named pipe.*/ + protocol: string; + /** a string representing the connection (e.g. 'http://example.com:8080' or 'socket:/unix/domain/socket/path'). Contains the uri setting if provided, otherwise constructed from the available settings. If no port is available or set to 0, the uri will not include a port component.*/ + uri: string; +} +/** + * undocumented. The connection object constructed after calling server.connection(); + * can be accessed via server.connections; or request.connection; + */ +export class ServerConnection extends Events.EventEmitter { + domain: any; + _events: { route: Function, domain: Function, _events: Function, _eventsCount: Function, _maxListeners: Function }; + _eventsCount: number; + settings: IServerConnectionOptions; + server: Server; + /** ex: "tcp" */ + type: string; + _started: boolean; + /** dictionary of sockets */ + _connections: { [ip_port: string]: any }; + _onConnection: Function; + registrations: any; + _extensions: any; + _requestCounter: { value: number; min: number; max: number }; + _load: any; + states: { + settings: any; cookies: any; names: any[] + }; + auth: { connection: ServerConnection; _schemes: any; _strategies: any; settings: any; api: any; }; + _router: any; + MSPluginsCollection: any; + applicationCache: any; + addEventListener: any; + info: IServerConnectionInfo; +} + +export type RequestExtPoints = "onRequest" | "onPreResponse" | "onPreAuth" | "onPostAuth" | "onPreHandler" | "onPostHandler" | "onPreResponse"; +export type ServerExtPoints = "onPreStart" | "onPostStart" | "onPreStop" | "onPostStop"; + +/** Server http://hapijs.com/api#server + rver object is the main application container. The server manages all incoming connections along with all the facilities provided by the framework. A server can contain more than one connection (e.g. listen to port 80 and 8080). + Server events + The server object inherits from Events.EventEmitter and emits the following events: + 'log' - events logged with server.log() and server events generated internally by the framework. + 'start' - emitted when the server is started using server.start(). + 'stop' - emitted when the server is stopped using server.stop(). + 'request' - events generated by request.log(). Does not include any internally generated events. + 'request-internal' - request events generated internally by the framework (multiple events per request). + 'request-error' - emitted whenever an Internal Server Error (500) error response is sent. Single event per request. + 'response' - emitted after the response is sent back to the client (or when the client connection closed and no response sent, in which case request.response is null). Single event per request. + 'tail' - emitted when a request finished processing, including any registered tails. Single event per request. + Note that the server object should not be used to emit application events as its internal implementation is designed to fan events out to the various plugin selections and not for application events. + MORE EVENTS HERE: http://hapijs.com/api#server-events*/ +export class Server extends Events.EventEmitter { + constructor(options?: IServerOptions); + + /** Provides a safe place to store server-specific run-time application data without potential conflicts with the framework internals. The data can be accessed whenever the server is accessible. Initialized with an empty object. + var Hapi = require('hapi'); + server = new Hapi.Server(); + server.app.key = 'value'; + var handler = function (request, reply) { + return reply(request.server.app.key); + }; */ + app: any; + /** An array containing the server's connections. When the server object is returned from server.select(), the connections array only includes the connections matching the selection criteria. + var server = new Hapi.Server(); + server.connection({ port: 80, labels: 'a' }); + server.connection({ port: 8080, labels: 'b' }); + // server.connections.length === 2 + var a = server.select('a'); + // a.connections.length === 1*/ + connections: ServerConnection[]; + /** When the server contains exactly one connection, info is an object containing information about the sole connection. + * When the server contains more than one connection, each server.connections array member provides its own connection.info. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + // server.info.port === 80 + server.connection({ port: 8080 }); + // server.info === null + // server.connections[1].info.port === 8080 + */ + info: IServerConnectionInfo; + /** An object containing the process load metrics (when load.sampleInterval is enabled): + rss - RSS memory usage. + var Hapi = require('hapi'); + var server = new Hapi.Server({ load: { sampleInterval: 1000 } }); + console.log(server.load.rss);*/ + load: { + /** - event loop delay milliseconds.*/ + eventLoopDelay: number; + /** - V8 heap usage.*/ + heapUsed: number; + }; + /** When the server contains exactly one connection, listener is the node HTTP server object of the sole connection. + When the server contains more than one connection, each server.connections array member provides its own connection.listener. + var Hapi = require('hapi'); + var SocketIO = require('socket.io'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + var io = SocketIO.listen(server.listener); + io.sockets.on('connection', function(socket) { + socket.emit({ msg: 'welcome' }); + });*/ + listener: http.Server; + + /** server.methods + An object providing access to the server methods where each server method name is an object property. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.method('add', function (a, b, next) { + return next(null, a + b); + }); + server.methods.add(1, 2, function (err, result) { + // result === 3 + });*/ + methods: IDictionary; + + /** server.mime + Provides access to the server MIME database used for setting content-type information. The object must not be modified directly but only through the mime server setting. + var Hapi = require('hapi'); + var options = { + mime: { + override: { + 'node/module': { + source: 'steve', + compressible: false, + extensions: ['node', 'module', 'npm'], + type: 'node/module' + } + } + } + }; + var server = new Hapi.Server(options); + // server.mime.path('code.js').type === 'application/javascript' + // server.mime.path('file.npm').type === 'node/module'*/ + mime: any; + /**server.plugins + An object containing the values exposed by each plugin registered where each key is a plugin name and the values are the exposed properties by each plugin using server.expose(). Plugins may set the value of the server.plugins[name] object directly or via the server.expose() method. + exports.register = function (server, options, next) { + server.expose('key', 'value'); + // server.plugins.example.key === 'value' + return next(); + }; + exports.register.attributes = { + name: 'example' + };*/ + plugins: IDictionary; + /** server.realm + The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin). Realms are a limited version of a sandbox where plugins can maintain state used by the framework when adding routes, extensions, and other properties. + modifiers - when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method and includes: + route - routes preferences: + prefix - the route path prefix used by any calls to server.route() from the server. + vhost - the route virtual host settings used by any calls to server.route() from the server. + plugin - the active plugin name (empty string if at the server root). + plugins - plugin-specific state to be shared only among activities sharing the same active state. plugins is an object where each key is a plugin name and the value is the plugin state. + settings - settings overrides: + files.relativeTo + bind + The server.realm object should be considered read-only and must not be changed directly except for the plugins property can be directly manipulated by the plugins (each setting its own under plugins[name]). + exports.register = function (server, options, next) { + console.log(server.realm.modifiers.route.prefix); + return next(); + };*/ + realm: IServerRealm; + + /** server.root + The root server object containing all the connections and the root server methods (e.g. start(), stop(), connection()).*/ + root: Server; + /** server.settings + The server configuration object after defaults applied. + var Hapi = require('hapi'); + var server = new Hapi.Server({ + app: { + key: 'value' + } + }); + // server.settings.app === { key: 'value' }*/ + settings: IServerOptions; + + /** server.version + The hapi module version number. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + // server.version === '8.0.0'*/ + version: string; + + /** server.after(method, [dependencies]) + Adds a method to be called after all the plugin dependencies have been registered and before the server starts (only called if the server is started) where: + after - the method with signature function(plugin, next) where: + server - server object the after() method was called on. + next - the callback function the method must call to return control over to the application and complete the registration process. The function signature is function(err) where: + err - internal error which is returned back via the server.start() callback. + dependencies - a string or array of string with the plugin names to call this method after their after() methods. There is no requirement for the other plugins to be registered. Setting dependencies only arranges the after methods in the specified order. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.after(function () { + // Perform some pre-start logic + }); + server.start(function (err) { + // After method already executed + }); + server.auth.default(options)*/ + after(method: (plugin: any, next: (err: any) => void) => void, dependencies: string | string[]): void; + + auth: { + /** server.auth.api + An object where each key is a strategy name and the value is the exposed strategy API. Available on when the authentication scheme exposes an API by returning an api key in the object returned from its implementation function. + When the server contains more than one connection, each server.connections array member provides its own connection.auth.api object. + const server = new Hapi.Server(); + server.connection({ port: 80 }); + const scheme = function (server, options) { + return { + api: { + settings: { + x: 5 + } + }, + authenticate: function (request, reply) { + const req = request.raw.req; + const authorization = req.headers.authorization; + if (!authorization) { + return reply(Boom.unauthorized(null, 'Custom')); + } + return reply.continue({ credentials: { user: 'john' } }); + } + }; + }; + server.auth.scheme('custom', scheme); + server.auth.strategy('default', 'custom'); + console.log(server.auth.api.default.settings.x); // 5 + */ + api: { + [index: string]: any; + } + /** server.auth.default(options) + Sets a default strategy which is applied to every route where: + options - a string with the default strategy name or an object with a specified strategy or strategies using the same format as the route auth handler options. + The default does not apply when the route config specifies auth as false, or has an authentication strategy configured. Otherwise, the route authentication config is applied to the defaults. Note that the default only applies at time of route configuration, not at runtime. Calling default() after adding a route will have no impact on routes added prior. + The default auth strategy configuration can be accessed via connection.auth.settings.default. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.auth.scheme('custom', scheme); + server.auth.strategy('default', 'custom'); + server.auth.default('default'); + server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + return reply(request.auth.credentials.user); + } + });*/ + default(options: string): void; + default(options: { strategy: string }): void; + default(options: { strategies: string[] }): void; + /** server.auth.scheme(name, scheme) + Registers an authentication scheme where: + name - the scheme name. + scheme - the method implementing the scheme with signature function(server, options) where: + server - a reference to the server object the scheme is added to. + options - optional scheme settings used to instantiate a strategy.*/ + scheme( + name: string, + /** + * When the scheme authenticate() method implementation calls reply() with an error condition, the specifics of the error affect whether additional authentication strategies will be attempted if configured for the route. If the err returned by the reply() method includes a message, no additional strategies will be attempted. If the err does not include a message but does include a scheme name (e.g. Boom.unauthorized(null, 'Custom')), additional strategies will be attempted in order of preference. + * n the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'. + * server = new Hapi.Server(); + * server.connection({ port: 80 }); + * scheme = function (server, options) { + * urn { + * authenticate: function (request, reply) { + * req = request.raw.req; + * var authorization = req.headers.authorization; + * if (!authorization) { + * return reply(Boom.unauthorized(null, 'Custom')); + * } + * urn reply(null, { credentials: { user: 'john' } }); + * } + * }; + * }; + */ + scheme: (server: Server, options: any) => IServerAuthScheme): void; + + /** + * server.auth.strategy(name, scheme, [mode], [options]) + * Registers an authentication strategy where: + * name - the strategy name. + * scheme - the scheme name (must be previously registered using server.auth.scheme()). + * mode - if true, the scheme is automatically assigned as a required strategy to any route without an auth config. Can only be assigned to a single server strategy. Value must be true (which is the same as 'required') or a valid authentication mode ('required', 'optional', 'try'). Defaults to false. + * options - scheme options based on the scheme requirements. + * var server = new Hapi.Server(); + * server.connection({ port: 80 }); + * server.auth.scheme('custom', scheme); + * server.auth.strategy('default', 'custom'); + * server.route({ + * method: 'GET', + * path: '/', + * config: { + * auth: 'default', + * handler: function (request, reply) { + * return reply(request.auth.credentials.user); + * } + * } + * }); + */ + strategy(name: string, scheme: string, mode?: boolean | string, options?: any): void; + strategy(name: string, scheme: string, mode?: boolean | string): void; + strategy(name: string, scheme: string, options?: any): void; + + /** server.auth.test(strategy, request, next) + Tests a request against an authentication strategy where: + strategy - the strategy name registered with server.auth.strategy(). + request - the request object. + next - the callback function with signature function(err, credentials) where: + err - the error if authentication failed. + credentials - the authentication credentials object if authentication was successful. + Note that the test() method does not take into account the route authentication configuration. It also does not perform payload authentication. It is limited to the basic strategy authentication execution. It does not include verifying scope, entity, or other route properties. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.auth.scheme('custom', scheme); + server.auth.strategy('default', 'custom'); + server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + request.server.auth.test('default', request, function (err, credentials) { + if (err) { + return reply({ status: false }); + } + return reply({ status: true, user: credentials.name }); + }); + } + });*/ + test(strategy: string, request: Request, next: (err: any, credentials: any) => void): void; + }; + + /** server.bind(context) + Sets a global context used as the default bind object when adding a route or an extension where: + context - the object used to bind this in handler and extension methods. + When setting context inside a plugin, the context is applied only to methods set up by the plugin. Note that the context applies only to routes and extensions added after it has been set. + var handler = function (request, reply) { + return reply(this.message); + }; + exports.register = function (server, options, next) { + var bind = { + message: 'hello' + }; + server.bind(bind); + server.route({ method: 'GET', path: '/', handler: handler }); + return next(); + };*/ + bind(context: any): void; + + /** server.cache(options) + Provisions a cache segment within the server cache facility where: + options - catbox policy configuration where: + expiresIn - relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. + expiresAt - time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records expire. Uses local time. Cannot be used together with expiresIn. + generateFunc - a function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id, next) where: - id - the id string or object provided to the get() method. - next - the method called when the new item is returned with the signature function(err, value, ttl) where: - err - an error condition. - value - the new value generated. - ttl - the cache ttl value in milliseconds. Set to 0 to skip storing in the cache. Defaults to the cache global policy. + staleIn - number of milliseconds to mark an item stored in cache as stale and attempt to regenerate it when generateFunc is provided. Must be less than expiresIn. + staleTimeout - number of milliseconds to wait before checking if an item is stale. + generateTimeout - number of milliseconds to wait before returning a timeout error when the generateFunc function takes too long to return a value. When the value is eventually returned, it is stored in the cache for future requests. + cache - the cache name configured in 'server.cache`. Defaults to the default cache. + segment - string segment name, used to isolate cached items within the cache partition. When called within a plugin, defaults to '!name' where 'name' is the plugin name. Required when called outside of a plugin. + shared - if true, allows multiple cache provisions to share the same segment. Default to false. + var server = new Hapi.Server(); + server.connection({ port: 80 }); + var cache = server.cache({ segment: 'countries', expiresIn: 60 * 60 * 1000 }); + cache.set('norway', { capital: 'oslo' }, null, function (err) { + cache.get('norway', function (err, value, cached, log) { + // value === { capital: 'oslo' }; + }); + });*/ + cache(options: ICatBoxCachePolicyOptions): void; + + /** server.connection([options]) + Adds an incoming server connection + Returns a server object with the new connection selected. + Must be called before any other server method that modifies connections is called for it to apply to the new connection (e.g. server.state()). + Note that the options object is deeply cloned (with the exception of listener which is shallowly copied) and cannot contain any values that are unsafe to perform deep copy on. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + var web = server.connection({ port: 8000, host: 'example.com', labels: ['web'] }); + var admin = server.connection({ port: 8001, host: 'example.com', labels: ['admin'] }); + // server.connections.length === 2 + // web.connections.length === 1 + // admin.connections.length === 1 */ + connection(options: IServerConnectionOptions): Server; + + /** server.decorate(type, property, method, [options]) + Extends various framework interfaces with custom methods where: + type - the interface being decorated. Supported types: + 'reply' - adds methods to the reply interface. + 'server' - adds methods to the Server object. + property - the object decoration key name. + method - the extension function. + options - if the type is 'request', supports the following optional settings: + 'apply' - if true, the method function is invoked using the signature function(request) where request is the current request object and the returned value is assigned as the decoration. + Note that decorations apply to the entire server and all its connections regardless of current selection. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.decorate('reply', 'success', function () { + return this.response({ status: 'ok' }); + }); + server.route({ + method: 'GET', + path: '/', + handler: function (request, reply) { + return reply.success(); + } + });*/ + decorate(type: string, property: string, method: Function, options?: { apply: boolean }): void; + + /** server.dependency(dependencies, [after]) + Used within a plugin to declares a required dependency on other plugins where: + dependencies - a single string or array of plugin name strings which must be registered in order for this plugin to operate. Plugins listed must be registered before the server is started. Does not provide version dependency which should be implemented using npm peer dependencies. + after - an optional function called after all the specified dependencies have been registered and before the server starts. The function is only called if the server is started. If a circular dependency is detected, an exception is thrown (e.g. two plugins each has an after function to be called after the other). The function signature is function(server, next) where: + server - the server the dependency() method was called on. + next - the callback function the method must call to return control over to the application and complete the registration process. The function signature is function(err) where: + err - internal error condition, which is returned back via the server.start() callback. + exports.register = function (server, options, next) { + server.dependency('yar', after); + return next(); + }; + var after = function (server, next) { + // Additional plugin registration logic + return next(); + };*/ + dependency(dependencies: string | string[], after?: (server: Server, next: (err: any) => void) => void): void; + + /** server.expose(key, value) + Used within a plugin to expose a property via server.plugins[name] where: + key - the key assigned (server.plugins[name][key]). + value - the value assigned. + exports.register = function (server, options, next) { + server.expose('util', function () { console.log('something'); }); + return next(); + };*/ + expose(key: string, value: any): void; + + /** server.expose(obj) + Merges a deep copy of an object into to the existing content of server.plugins[name] where: + obj - the object merged into the exposed properties container. + exports.register = function (server, options, next) { + server.expose({ util: function () { console.log('something'); } }); + return next(); + };*/ + expose(obj: any): void; + + /** server.ext(event, method, [options]) + Registers an extension function in one of the available extension points where: + event - the event name. + method - a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is function(request, reply) where: + request - the request object. NOTE: Access the Response via request.response + reply - the reply interface which is used to return control back to the framework. To continue normal execution of the request lifecycle, reply.continue() must be called. To abort processing and return a response to the client, call reply(value) where value is an error or any other valid response. + this - the object provided via options.bind or the current active context set with server.bind(). + options - an optional object with the following: + before - a string or array of strings of plugin names this method must execute before (on the same event). Otherwise, extension methods are executed in the order added. + after - a string or array of strings of plugin names this method must execute after (on the same event). Otherwise, extension methods are executed in the order added. + bind - a context object passed back to the provided method (via this) when called. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.ext('onRequest', function (request, reply) { + // Change all requests to '/test' + request.setUrl('/test'); + return reply.continue(); + }); + var handler = function (request, reply) { + return reply({ status: 'ok' }); + }; + server.route({ method: 'GET', path: '/test', handler: handler }); + server.start(); + // All requests will get routed to '/test'*/ + ext(event: RequestExtPoints, method: (request: Request, reply: IReply, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void; + ext(event: RequestExtPoints, method: (request: Request, reply: IStrictReply, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void; + ext(event: ServerExtPoints, method: (server: Server, next: (err?: any) => void, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void; + + /** server.handler(name, method) + Registers a new handler type to be used in routes where: + name - string name for the handler being registered. Cannot override the built-in handler types (directory, file, proxy, and view) or any previously registered type. + method - the function used to generate the route handler using the signature function(route, options) where: + route - the route public interface object. + options - the configuration object provided in the handler config. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ host: 'localhost', port: 8000 }); + // Defines new handler for routes on this server + server.handler('test', function (route, options) { + return function (request, reply) { + return reply('new handler: ' + options.msg); + } + }); + server.route({ + method: 'GET', + path: '/', + handler: { test: { msg: 'test' } } + }); + server.start(); + The method function can have a defaults object or function property. If the property is set to an object, that object is used as the default route config for routes using this handler. If the property is set to a function, the function uses the signature function(method) and returns the route default configuration. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ host: 'localhost', port: 8000 }); + var handler = function (route, options) { + return function (request, reply) { + return reply('new handler: ' + options.msg); + } + }; + // Change the default payload processing for this handler + handler.defaults = { + payload: { + output: 'stream', + parse: false + } + }; + server.handler('test', handler);*/ + handler(name: string, method: (route: IRoute, options: THandlerConfig) => ISessionHandler): void; + + /** server.initialize([callback]) + Initializes the server (starts the caches, finalizes plugin registration) but does not start listening + on the connection ports, where: + - `callback` - the callback method when server initialization is completed or failed with the signature + `function(err)` where: + - `err` - any initialization error condition. + + If no `callback` is provided, a `Promise` object is returned. + + Note that if the method fails and the callback includes an error, the server is considered to be in + an undefined state and should be shut down. In most cases it would be impossible to fully recover as + the various plugins, caches, and other event listeners will get confused by repeated attempts to + start the server or make assumptions about the healthy state of the environment. It is recommended + to assert that no error has been returned after calling `initialize()` to abort the process when the + server fails to start properly. If you must try to resume after an error, call `server.stop()` + first to reset the server state. + */ + initialize(callback?: (error: any) => void): Promise; + + /** When the server contains exactly one connection, injects a request into the sole connection simulating an incoming HTTP request without making an actual socket connection. + Injection is useful for testing purposes as well as for invoking routing logic internally without the overhead or limitations of the network stack. + Utilizes the [shot module | https://github.com/hapijs/shot ] for performing injections, with some additional options and response properties + * When the server contains more than one connection, each server.connections array member provides its own connection.inject(). + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + var handler = function (request, reply) { + return reply('Success!'); + }; + server.route({ method: 'GET', path: '/', handler: handler }); + server.inject('/', function (res) { + console.log(res.result); + }); + */ + inject: IServerInject; + + /** server.log(tags, [data, [timestamp]]) + Logs server events that cannot be associated with a specific request. When called the server emits a 'log' event which can be used by other listeners or plugins to record the information or output to the console. The arguments are: + tags - a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events. Any logs generated by the server internally include the 'hapi' tag along with event-specific information. + data - an optional message string or object with the application data being logged. + timestamp - an optional timestamp expressed in milliseconds. Defaults to Date.now() (now). + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.on('log', function (event, tags) { + if (tags.error) { + console.log(event); + } + }); + server.log(['test', 'error'], 'Test event');*/ + log(tags: string | string[], data?: string | any, timestamp?: number): void; + + /**server.lookup(id) + When the server contains exactly one connection, looks up a route configuration where: + id - the route identifier as set in the route options. + returns the route public interface object if found, otherwise null. + var server = new Hapi.Server(); + server.connection(); + server.route({ + method: 'GET', + path: '/', + config: { + handler: function (request, reply) { return reply(); }, + id: 'root' + } + }); + var route = server.lookup('root'); + When the server contains more than one connection, each server.connections array member provides its own connection.lookup() method.*/ + lookup(id: string): IRoute; + + /** server.match(method, path, [host]) + When the server contains exactly one connection, looks up a route configuration where: + method - the HTTP method (e.g. 'GET', 'POST'). + path - the requested path (must begin with '/'). + host - optional hostname (to match against routes with vhost). + returns the route public interface object if found, otherwise null. + var server = new Hapi.Server(); + server.connection(); + server.route({ + method: 'GET', + path: '/', + config: { + handler: function (request, reply) { return reply(); }, + id: 'root' + } + }); + var route = server.match('get', '/'); + When the server contains more than one connection, each server.connections array member provides its own connection.match() method.*/ + match(method: string, path: string, host?: string): IRoute; + + /** server.method(name, method, [options]) + Registers a server method. Server methods are functions registered with the server and used throughout the application as a common utility. Their advantage is in the ability to configure them to use the built-in cache and share across multiple request handlers without having to create a common module. + Methods are registered via server.method(name, method, [options]) + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + // Simple arguments + var add = function (a, b, next) { + return next(null, a + b); + }; + server.method('sum', add, { cache: { expiresIn: 2000 } }); + server.methods.sum(4, 5, function (err, result) { + console.log(result); + }); + // Object argument + var addArray = function (array, next) { + var sum = 0; + array.forEach(function (item) { + sum += item; + }); + return next(null, sum); + }; + server.method('sumObj', addArray, { + cache: { expiresIn: 2000 }, + generateKey: function (array) { + return array.join(','); + } + }); + server.methods.sumObj([5, 6], function (err, result) { + console.log(result); + }); + // Synchronous method with cache + var addSync = function (a, b) { + return a + b; + }; + server.method('sumSync', addSync, { cache: { expiresIn: 2000 }, callback: false }); + server.methods.sumSync(4, 5, function (err, result) { + console.log(result); + }); */ + method(/** a unique method name used to invoke the method via server.methods[name]. When configured with caching enabled, server.methods[name].cache.drop(arg1, arg2, ..., argn, callback) can be used to clear the cache for a given key. Supports using nested names such as utils.users.get which will automatically create the missing path under server.methods and can be accessed for the previous example via server.methods.utils.users.get.*/ + name: string, + method: IServerMethod, + options?: IServerMethodOptions): void; + + /**server.method(methods) + Registers a server method function as described in server.method() using a configuration object where: + methods - an object or an array of objects where each one contains: + name - the method name. + method - the method function. + options - optional settings. + var add = function (a, b, next) { + next(null, a + b); + }; + server.method({ + name: 'sum', + method: add, + options: { + cache: { + expiresIn: 2000 + } + } + });*/ + method(methods: { + name: string; method: IServerMethod; options?: IServerMethodOptions + } | Array<{ + name: string; method: IServerMethod; options?: IServerMethodOptions + }>): void; + + /**server.path(relativeTo) + Sets the path prefix used to locate static resources (files and view templates) when relative paths are used where: + relativeTo - the path prefix added to any relative file path starting with '.'. + Note that setting a path within a plugin only applies to resources accessed by plugin methods. If no path is set, the connection files.relativeTo configuration is used. The path only applies to routes added after it has been set. + exports.register = function (server, options, next) { + server.path(__dirname + '../static'); + server.route({ path: '/file', method: 'GET', handler: { file: './test.html' } }); + next(); + };*/ + path(relativeTo: string): void; + + /** + * server.register(plugins, [options], callback) + * Registers a plugin where: + * plugins - an object or array of objects where each one is either: + * a plugin registration function. + * an object with the following: + * register - the plugin registration function. + * options - optional options passed to the registration function when called. + * options - optional registration options (different from the options passed to the registration function): + * select - a string or array of string labels used to pre-select connections for plugin registration. + * routes - modifiers applied to each route added by the plugin: + * prefix - string added as prefix to any route path (must begin with '/'). If a plugin registers a child plugin the prefix is passed on to the child or is added in front of the child-specific prefix. + * vhost - virtual host string (or array of strings) applied to every route. The outer-most vhost overrides the any nested configuration. + * callback - the callback function with signature function(err) where: + * err - an error returned from the registration function. Note that exceptions thrown by the registration function are not handled by the framework. + * + * If no callback is provided, a Promise object is returned. + */ + register( + plugins: any | any[], + options: { + select?: string | string[]; + routes: { + prefix: string; vhost?: string | string[] + }; + }, + callback: (err: any) => void): void; + register( + plugins: any | any[], + options: { + select?: string | string[]; + routes: { + prefix: string; vhost?: string | string[] + }; + }): Promise; + + register(plugins: any | any[], callback: (err: any) => void): void; + register(plugins: any | any[]): Promise; + + /**server.render(template, context, [options], callback) + Utilizes the server views manager to render a template where: + template - the template filename and path, relative to the views manager templates path (path or relativeTo). + context - optional object used by the template to render context-specific result. Defaults to no context ({}). + options - optional object used to override the views manager configuration. + callback - the callback function with signature function (err, rendered, config) where: + err - the rendering error if any. + rendered - the result view string. + config - the configuration used to render the template. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.views({ + engines: { html: require('handlebars') }, + path: __dirname + '/templates' + }); + var context = { + title: 'Views Example', + message: 'Hello, World' + }; + server.render('hello', context, function (err, rendered, config) { + console.log(rendered); + });*/ + render(template: string, context: any, options: any, callback: (err: any, rendered: any, config: any) => void): void; + + /** server.route(options) + Adds a connection route where: + options - a route configuration object or an array of configuration objects. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.route({ method: 'GET', path: '/', handler: function (request, reply) { return reply('ok'); } }); + server.route([ + { method: 'GET', path: '/1', handler: function (request, reply) { return reply('ok'); } }, + { method: 'GET', path: '/2', handler: function (request, reply) { return reply('ok'); } } + ]);*/ + route(options: IRouteConfiguration): void; + route(options: IRouteConfiguration[]): void; + + /**server.select(labels) + Selects a subset of the server's connections where: + labels - a single string or array of strings of labels used as a logical OR statement to select all the connections with matching labels in their configuration. + Returns a server object with connections set to the requested subset. Selecting again on a selection operates as a logic AND statement between the individual selections. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80, labels: ['a'] }); + server.connection({ port: 8080, labels: ['b'] }); + server.connection({ port: 8081, labels: ['c'] }); + server.connection({ port: 8082, labels: ['c','d'] }); + var a = server.select('a'); // The server with port 80 + var ab = server.select(['a','b']); // A list of servers containing the server with port 80 and the server with port 8080 + var c = server.select('c'); // A list of servers containing the server with port 8081 and the server with port 8082 */ + select(labels: string | string[]): Server | Server[]; + + /** server.start([callback]) + Starts the server connections by listening for incoming requests on the configured port of each listener (unless the connection was configured with autoListen set to false), where: + callback - optional callback when server startup is completed or failed with the signature function(err) where: + err - any startup error condition. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.start(function (err) { + console.log('Server started at: ' + server.info.uri); + });*/ + start(callback?: (err: any) => void): Promise; + + /** server.state(name, [options]) + HTTP state management uses client cookies to persist a state across multiple requests. Registers a cookie definitions + State defaults can be modified via the server connections.routes.state configuration option. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + // Set cookie definition + server.state('session', { + ttl: 24 * 60 * 60 * 1000, // One day + isSecure: true, + path: '/', + encoding: 'base64json' + }); + // Set state in route handler + var handler = function (request, reply) { + var session = request.state.session; + if (!session) { + session = { user: 'joe' }; + } + session.last = Date.now(); + return reply('Success').state('session', session); + }; + Registered cookies are automatically parsed when received. Parsing rules depends on the route state.parse configuration. If an incoming registered cookie fails parsing, it is not included in request.state, regardless of the state.failAction setting. When state.failAction is set to 'log' and an invalid cookie value is received, the server will emit a 'request-internal' event. To capture these errors subscribe to the 'request-internal' events and filter on 'error' and 'state' tags: + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.on('request-internal', function (request, event, tags) { + if (tags.error && tags.state) { + console.error(event); + } + }); */ + state(name: string, options?: ICookieSettings): void; + + /** server.stop([options], [callback]) + Stops the server's connections by refusing to accept any new connections or requests (existing connections will continue until closed or timeout), where: + options - optional object with: + timeout - overrides the timeout in millisecond before forcefully terminating a connection. Defaults to 5000 (5 seconds). + callback - optional callback method with signature function() which is called once all the connections have ended and it is safe to exit the process. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80 }); + server.stop({ timeout: 60 * 1000 }, function () { + console.log('Server stopped'); + });*/ + stop(options?: { timeout: number }, callback?: () => void): Promise; + + /**server.table([host]) + Returns a copy of the routing table where: + host - optional host to filter routes matching a specific virtual host. Defaults to all virtual hosts. + The return value is an array where each item is an object containing: + info - the connection.info the connection the table was generated for. + labels - the connection labels. + table - an array of routes where each route contains: + settings - the route config with defaults applied. + method - the HTTP method in lower case. + path - the route path. + Note that if the server has not been started and multiple connections use port 0, the table items will override each other and will produce an incomplete result. + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80, host: 'example.com' }); + server.route({ method: 'GET', path: '/example', handler: function (request, reply) { return reply(); } }); + var table = server.table(); + When calling connection.table() directly on each connection, the return value is the same as the array table item value of an individual connection: + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.connection({ port: 80, host: 'example.com' }); + server.route({ method: 'GET', path: '/example', handler: function (request, reply) { return reply(); } }); + var table = server.connections[0].table(); + //[ + // { + // method: 'get', + // path: '/example', + // settings: { ... } + // } + //] + */ + table(host?: any): IConnectionTable; + + /**server.views(options) + Initializes the server views manager + var Hapi = require('hapi'); + var server = new Hapi.Server(); + server.views({ + engines: { + html: require('handlebars'), + jade: require('jade') + }, + path: '/static/templates' + }); + When server.views() is called within a plugin, the views manager is only available to plugins methods.*/ + views(options: IServerViewsConfiguration): void; +} diff --git a/types/hapi/v15/tsconfig.json b/types/hapi/v15/tsconfig.json new file mode 100644 index 0000000000..4a54b80605 --- /dev/null +++ b/types/hapi/v15/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "hapi": [ + "hapi/v15" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "hapi-tests.ts" + ] +} \ No newline at end of file diff --git a/types/heredatalens/heredatalens-tests.ts b/types/heredatalens/heredatalens-tests.ts new file mode 100644 index 0000000000..37f20f2f84 --- /dev/null +++ b/types/heredatalens/heredatalens-tests.ts @@ -0,0 +1,123 @@ +/** + * Typescript definition tests for heredatalens + * + * Note: These tests are intended to test the definitions only + * in the sense of typing and call signature consistency. They + * are not intended as functional tests. + */ + +let serviceOptions: H.datalens.Service.Options = { + subDomain: 'sub', + version: 'version', + access_token: 'token', + refresh_token: 'token', + domainSharding: ['a', 'b'], + baseUrl: 'url' +}; + +let queryTileProviderTileParamNames: H.datalens.QueryTileProvider.TileParamNames = { + x: 'x', + y: 'y', + z: 'z' +}; + +let queryTileProviderOptions: H.datalens.QueryTileProvider.Options = { + queryId: 'id', + queryParams: 'params', + tileParamNames: queryTileProviderTileParamNames +}; + +let service: H.datalens.Service = new H.datalens.Service(serviceOptions); +service.request('method', 'endpoint', 'params', 'body', (result: any) => {}, (error: any) => {}).then((data: any) => {}); +service.fetchQueryData('id', 'params', (result: any) => {}, (error: any) => {}).then((data: any) => {}); +service.fetchQueryStats('id', 'query', (result: any) => {}, (error: any) => {}).then((data: any) => {}); +service.fetchLayer('name', 'params', (result: any) => {}, (error: any) => {}).then((data: any) => {}); +service.fetchLayerTile('name', 1, 2, 3, 'params', (result: any) => {}, (error: any) => {}).then((data: any) => {}); +service.setTokens('token', 'refresh_token'); +service.configure('app_id', 'app_code', true, true, new H.service.Url('scheme', 'host')); + +let queryTileProvider = new H.datalens.QueryTileProvider(service, queryTileProviderOptions); +queryTileProvider.setQueryId('some id'); +queryTileProvider.setQueryParams('some params'); +queryTileProvider.setTileParamNames(queryTileProviderTileParamNames); + +let provider = new H.datalens.Provider({ columns: ['1', '2'], rows: [[], []]}); +provider.getData(); +provider.setData({ columns: ['3', '4'], rows: [[], []]}); + +let queryProviderOptions: H.datalens.QueryProvider.Options = { + queryId: 'id', + queryParams: 'params' +}; +let queryProvider = new H.datalens.QueryProvider({ columns: ['1', '2'], rows: [[], []]}, queryProviderOptions); +queryProvider.setQueryId('id'); +queryProvider.setQueryParams('params'); +queryProvider.reload(); +queryProvider.getData(); +queryProvider.setData({ columns: ['3', '4'], rows: [[], []]}); + +let rasterLayerOptions: H.datalens.RasterLayer.Options = { + dataToRows: (): H.datalens.RasterLayer.Row[] => [], + rowToTilePoint: (): H.datalens.RasterLayer.TilePoint => ({ x: 1, y: 2 }), + buffer: (): number => 1, + renderTile: () => {} +}; + +let rasterLayer = new H.datalens.RasterLayer(); +rasterLayer.redraw(); + +let heatmapLayerOptions: H.datalens.HeatmapLayer.Options = { + dataToRows: (): H.datalens.HeatmapLayer.Row[] => [], + rowToTilePoint: (): H.datalens.HeatmapLayer.TilePoint => ({ x: 1, y: 2, value: 5, count: 5 }), + bandwidth: 5, + valueRange: (): number[] => [], + countRange: (): number[] => [], + colorScale: (): string => '2', + alphaScale: (): number => 1, + aggregation: H.datalens.HeatmapLayer.Aggregation.SUM, + inputScale: H.datalens.HeatmapLayer.InputScale.LINEAR +}; + +let heatmapLayer = new H.datalens.HeatmapLayer(queryTileProvider, heatmapLayerOptions); +heatmapLayer.getOptionsPerZoom(5); +heatmapLayer.dispose(); +heatmapLayer.redraw(); + +let objectLayerOptions: H.datalens.ObjectLayer.Options = { + dataToRows: (): H.datalens.ObjectLayer.Row[] => [], + rowToMapObject: (): H.map.Object => new H.map.Object(), + rowToStyle: (): H.datalens.ObjectLayer.ObjectStyleOptions => ({ icon: new H.map.Icon('x'), style: {}, arrows: {}, zIndex: 1 }), + dataDomains: 2, + clustering: { rowToDataPoint: (): H.clustering.DataPoint => ({ lat: 12.1, lng: 1.12, alt: 5, ctx: H.geo.AltitudeContext.GL, wt: 2, data: {} }), + options: (): H.clustering.Provider.ClusteringOptions => ({}) } +}; + +let objectLayer = new H.datalens.ObjectLayer(provider, objectLayerOptions); +objectLayer.redraw(); +objectLayer.updateObjectStyle(new H.map.Object(), { icon: new H.map.Icon('x'), style: {}, arrows: {}, zIndex: 1 }); + +let rawDataProviderOptions: H.datalens.RawDataProvider.Options = { + dataUrl: 'url', + dataToFeatures: (): H.datalens.RawDataProvider.Feature[] => [], + featuresToRows: (): H.datalens.ObjectLayer.Row[] => [] +}; + +let rawDataProvider = new H.datalens.RawDataProvider(rawDataProviderOptions); + +let spatialTileProviderOptions: H.datalens.SpatialTileProvider.Options = { + layerName: 'name', + queryParams: 'params' +}; + +let spatialProvider: H.datalens.SpatialTileProvider = new H.datalens.SpatialTileProvider(service, spatialTileProviderOptions); + +let spatialLayerOptions: H.datalens.SpatialLayer.Options = { + dataToRows: (): H.datalens.SpatialLayer.Row[] => [], + rowToSpatialId: (): string => 'asd', + featureToSpatialId: (): string => 'asd', + rowToStyle: (): any => { return; }, + defaultStyle: (): any => { return; }, + transformFeature: 1 +}; + +let spatialLayer = new H.datalens.SpatialLayer(provider, spatialProvider, spatialLayerOptions); diff --git a/types/heredatalens/index.d.ts b/types/heredatalens/index.d.ts new file mode 100644 index 0000000000..9b3ff44431 --- /dev/null +++ b/types/heredatalens/index.d.ts @@ -0,0 +1,947 @@ +// Type definitions for HERE Data Lens API for JavaScript 2.3 +// Project: https://developer.here.com/ +// Definitions by: Bernd Hacker +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace H { + /** + * Data Lens REST API connector for HERE Maps API + * Data Lens JavaScript API is a module for HERE Maps API. + * It connects Data Lens REST API and provides data-driven styling of data on a map. + */ + namespace datalens { + /** + * HERE Maps API and Data Lens JavaScript API can be used to visualize data from different network sources. + * For each network source type, a service class is required. The service also stores API connection credentials. + * The service instance must be configured with a H.service.Platform instance. + */ + class Service implements H.service.IConfigurable { + /** + * Constructor + * @param options {H.datalens.Service.Options=} - Overrides the configuration from the H.service.Platform instance + */ + constructor(options?: H.datalens.Service.Options); + + /** + * This method makes an HTTP request to the Data Lens REST API. + * It makes any CRUD request (GET, PUT, POST, DELETE). + * This method can be used when implementing a custom provider or implementing data management. + * Otherwise existing providers are used to get data from the Data Lens REST API. + * @param method {string} - Any HTTP method (GET, PUT, POST, etc.) + * @param endpoint {string} - The REST API endpoint + * @param params {any=} - URL parameters + * @param body {any=} - The payload of the request + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + request(method: string, endpoint: string, params?: any, body?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches query data for a given query ID. + * This method can be used when implementing a custom provider. + * Otherwise existing providers are used to get data from the Data Lens REST API. + * @param queryId {string} - The ID of the Data Lens REST API query + * @param params {any=} - Query dynamic parameters + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + fetchQueryData(queryId: string, params?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches statistical data for the Data Lens query (eg minimum and maximum values for the query metric). + * It can be used to define visualization boundaries, scales and legends. + * @param queryId {string} - The ID of the Data Lens REST API query + * @param statsQuery {any} - A JSON object which defines a statistics query for the Data Lens query + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + fetchQueryStats(queryId: string, statsQuery: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches a layer of geometries (eg buildings or administrative boundaries). + * @param layerName {string} - The name of the layer + * @param params {any=} - URL parameters (eg bounding box) + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + fetchLayer(layerName: string, params?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches vector tile data from the layer. + * @param layerName {string} + * @param x {H.datalens.QueryTileProvider.X} - Tile columns + * @param y {H.datalens.QueryTileProvider.Y} - Tile row + * @param z {H.datalens.QueryTileProvider.Zoom} - zoom level + * @param params {any=} - URL parameters (eg bounding box) + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Typed array with tile data + */ + fetchLayerTile(layerName: string, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom, + params?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * Sets the access and refresh tokens used to authenticate all requests against the Data Lens REST API. + * Use this method to implement custom authentication to the Data Lens REST API. + * @param accessToken {string} - The token used to authenticate all requests + * @param refreshToken {string} - The token used to fetch a new access token after the previous access token has expired. + * When refreshToken is provided, Service will automatically update the expired accessToken. + */ + setTokens(accessToken: string, refreshToken: string): void; + + /** + * This method implements H.service.IConfigurable interface. It is called by the H.service.Platform instance. + * @param appId {string} - The appId + * @param appCode {string} - The appCode + * @param useHTTPS {boolean} - A flag to use HTTPS or not + * @param useCIT {boolean} - A flag to use the staging server (CIT) or not + * @param baseUrl {H.service.Url=} - The base URL for all requests to the Data Lens REST API + * @returns {H.datalens.Service} + */ + configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, baseUrl?: H.service.Url): H.datalens.Service; + } + + namespace Service { + /** + * Overrides the H.datalens.Service configuration + * Normally the H.datalens.Service instance is configured with the H.service.Platform instance. + * This configuration can be overridden by specifying these options. + * It can be useful when the Data Lens environment is different from the HERE Platform environment. + * @property subDomain {string=} - Subdomain of the Data Lens REST API URL + * @property version {string=} - Pathname prefix of the Data Lens REST API endpoints + * @property access_token {string=} - The token used to authenticate all requests + * @property refresh_token {string=} - The token used to fetch a new access token after the previous access token has expired. + * When refresh_token is provided, Service will automatically update the expired access_token. + * @property domainSharding {string[]=} - To increase the number of simultaneous requests to the Data Lens REST API, domain sharding is used. + * This option can be used when the Data Lens environment does not support domain sharding. + * @property baseUrl {string=} - Defines an alternative host for the Data Lens REST API URL + */ + interface Options { + subDomain?: string; + version?: string; + access_token?: string; + refresh_token?: string; + domainSharding?: string[]; + baseUrl?: string; + } + + /** + * The format of Data Lens query data. + * The Data Lens query data has a table-like structure with named columns and rows. + * @property columns {string[]} - Column names + * @property rows {Array} - Rows of data + */ + interface Data { + columns: string[]; + rows: [any[]]; // rows : { Array. } + } + } + + /** + * Providers define interfaces for layers to access data. + * The input data can be stored locally or loaded from the network. Data can be loaded by tiles or in one chunk. + * This provider allows you to supply data stored locally or fetched using external tools. + */ + class Provider extends H.map.provider.Provider { + /** + * Constructor + * @param data {H.datalens.Service.Data=} - JSON object + * @param options {H.map.provider.Provider.Options=} - Configures data accessibility parameters + */ + constructor(data?: H.datalens.Service.Data, options?: H.map.provider.Provider.Options); + + /** + * Updates the provider data. When data is updated, the update event is triggered so that the consuming layers are redrawn. + * @param data {H.datalens.Service.Data} - JSON object + */ + setData(data: H.datalens.Service.Data): void; + + /** + * Retrieves the provider data. + * @returns {H.datalens.Service.Data} - JSON object + */ + getData(): H.datalens.Service.Data; + } + + /** + * Defines the source of the data for layers from a Data Lens query. + * Providers define interfaces for layers to access data. The input data can be stored locally or loaded from the network. + * Data can be loaded by tiles or in one chunk. This provider loads query data with the Data Lens REST API. + * Note that this provider must be used only for non-tiled queries. + */ + class QueryProvider extends H.datalens.Provider { + /** + * Constructor + * @param service {H.datalens.Service} - Data Lens REST API service + * @param options {H.datalens.QueryProvider.Options=} - Configures source query and data accessibility parameters + */ + constructor(data: H.datalens.Service.Data, options?: H.map.provider.Provider.Options); + + /** + * Updates the query ID to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. + * @param queryId {string} + */ + setQueryId(queryId: string): void; + + /** + * Updates the query's dynamic parameters to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. + * This method is normally used when updating your visualization. + * @param queryParams {any|null} - Query dynamic parameters + */ + setQueryParams(queryParams: any|null): void; + + /** + * Fetches new data from the Data Lens REST API. + * When data is fetched, the update event is triggered so that the consuming layers are redrawn. + */ + reload(): void; + + /** + * Updates the provider data. + * When data is updated, the update event is triggered so that the consuming layers are redrawn. + * @param data {H.datalens.Service.Data} - JSON object + */ + setData(data: H.datalens.Service.Data): void; + + /** + * Retrieves the provider data. + * @returns {H.datalens.Service.Data} - JSON object + */ + getData(): H.datalens.Service.Data; + } + + namespace QueryProvider { + /** + * Configures source query and data accessibility parameters for H.datalens.QueryProvider + * Specifies the query credentials and dynamic parameters required for fetching query data with the Data Lens REST API. Other options from H.datalens.Provider.Options are available. + * @property queryId {string} - The ID of the Data Lens REST API query + * @property queryParams {any=} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. + */ + interface Options { + queryId: string; + queryParams?: any; + } + } + + /** + * Providers define interfaces for layers to access data. + * The input data can be stored locally or loaded from the network. Data can be loaded by tiles or in one chunk. + * This provider loads tiled query data with the Data Lens REST API. Tiled queries are used to load data only for the current viewport. + * This optimizes memory and network usage and enables progressive rendering. + */ + class QueryTileProvider extends H.map.provider.RemoteTileProvider { + /** + * Constructor + * @param service {H.datalens.Service} - Data Lens REST API service + * @param options {H.datalens.QueryTileProvider.Options} - Configures source query and data accessibility parameters + */ + constructor(service: H.datalens.Service, options: H.datalens.QueryTileProvider.Options); + + /** + * Updates the query ID to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. + * @param queryId {string} + */ + setQueryId(queryId: string): void; + + /** + * Updates the query's dynamic parameters to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. This method is normally used when updating your visualization. + * @param queryParams {any|null} + */ + setQueryParams(queryParams: any|null): void; + + /** + * Updates the names of the dynamic parameters that defines tiles. This method is only needed when the query ID is updated. + * Note that new data will be fetched only after the reload method is called. + * @param tileParamNames {H.datalens.QueryTileProvider.TileParamNames} - Names of the URI parameters that control the x/y/z of a tiled query + */ + setTileParamNames(tileParamNames: H.datalens.QueryTileProvider.TileParamNames): void; + } + + namespace QueryTileProvider { + /** + * Represents the names of the URI parameters that control the x/y/z of tiled query. + * When defining the Data Lens query, dynamic parameters that control tiling can be arbitrarily named. + * Names of these parameters must be specified to fetch tiles. + * @property x {string} - Name of the dynamic parameter that defines tile column + * @property y {string} - Name of the dynamic parameter that defines tile row + * @property z {string} - Name of the dynamic parameter that defines zoom level + */ + interface TileParamNames { + x: string; + y: string; + z: string; + } + + /** + * Configures source query and data accessibility parameters for H.datalens.QueryTileProvider + * Specifies the query credentials and dynamic parameters required for fetching tiled query data with the Data Lens REST API. + * Other options from H.datalens.Provider.Options are available. + * @property tileParamNames {H.datalens.QueryTileProvider.TileParamNames=} - Names of the URI parameters that control the x/y/z of a tiled query + * @property queryId {string} - The ID for the Data Lens REST API query + * @property queryParams {any=} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. + */ + interface Options { + tileParamNames: H.datalens.QueryTileProvider.TileParamNames; + queryId: string; + queryParams?: string; + } + + /** + * Tile X coordinate (column) + * Coordinate in XYZ tile numbering scheme. + */ + type X = number; + + /** + * Tile Y coordinate (row) + * Coordinate in XYZ tile numbering scheme. + */ + type Y = number; + + /** + * Zoom level + * Coordinate in XYZ tile numbering scheme. May vary within range 1 to 20. + */ + type Zoom = number; + } + + /** + * Provides pixel-wise rendering of data. + * Layer used when you need to visualize more than 10k points. The layer requires source data to be located in pixel coordinates. + * The rendering is implemented by drawing directly on a canvas. The layer is often used together with a Data Lens query which groups rows by pixels. + * This reduces the amount of data delivered to the client. + */ + class RasterLayer extends H.map.layer.TileLayer { + /** + * Constructor + */ + constructor(); + + /** + * Default value for dataToRows callback option. + * It represents each row as an object where property names correspond to data column names. + */ + static defaultDataToRows: any; + + /** + * Force re-rendering of the layer. + * In the case where the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + + /** + * This is a default implementation of renderTile callback. This method represents each point as a black 1x1 pixel square. + * @param points {Array} - Input data points within a tile + * @param canvas {HTMLCanvasElement} - The target canvas + */ + static defaultRenderTile(points: H.datalens.RasterLayer.TilePoint[], canvas: HTMLCanvasElement): void; + } + + namespace RasterLayer { + /** + * Defines data processing and rendering options for RasterLayer. + * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.RasterLayer.defaultDataToRows. + * This behavior can be changed by defining the dataToRows callback. + * To collect the rows for a tile including buffer, the rows must be translated to H.datalens.RasterLayer.TilePoint. + * This translation must be specified with the rowToTilePoint callback. The final rendering on the tile canvas must be defined in renderTile. + * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. + * @property rowToTilePoint {function(H.datalens.RasterLayer.Row, H.datalens.RasterLayer.X, H.datalens.RasterLayer.Y)=} - + * Defines how the row is translated to the H.datalens.RasterLayer.TilePoint. This callback is called for each row that is returned from dataToRows. + * @property buffer {function(H.datalens.QueryTileProvider.Zoom)=} - Defines the buffer as a function of the zoom level. + * The buffer is a value (in pixels) that defines an extra area around each tile to capture data points from. + * This is done to avoid drawing edges between tiles. For example, if data points represented with circles with a maximum radius of 10 pixels, then the buffer must be 10 pixels. + * @property renderTile {function(Array, HTMLCanvasElement, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how tile data is represented on a canvas. Input points for each tile are collected with respect to the buffer. + * For progressive rendering this callback may be called more than once for the tile. + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom): + H.datalens.RasterLayer.Row[]; + rowToTilePoint?(row: H.datalens.RasterLayer.Row, x: H.datalens.RasterLayer.X, y: H.datalens.RasterLayer.Y): H.datalens.RasterLayer.TilePoint; + buffer?(zoom: H.datalens.QueryTileProvider.Zoom): number; + renderTile?(points: H.datalens.RasterLayer.TilePoint[], canvas: HTMLCanvasElement, zoom: H.datalens.QueryTileProvider.Zoom): void; + } + + /** + * Defines the input data format for heat map rendering. + * To collect data rows for each tile with respect to the buffer, each row must be represented as a point within the map tile. + * @property x {number} - Row relative to tile + * @property y {number} - Column relative to tile + * @property data {H.datalens.RasterLayer.Row=} - Reference to source data row + */ + interface TilePoint { + x: number; + y: number; + data?: H.datalens.RasterLayer.Row; + } + + /** + * Tile X coordinate (column) + * Coordinate in XYZ tile numbering scheme. + */ + type X = number; + + /** + * Tile Y coordinate (row) + * Coordinate in XYZ tile numbering scheme. + */ + type Y = number; + + /** + * Slice of data (eg Data Lens query data row) that represents a data point. + * Each row is transformed into TilePoint and passed to renderTile callback. By default each row is an Object where property names correspond to data column names. + * This representation can be changed with the dataToRows callback. + */ + type Row = number; + } + + /** + * Provides functionality of value-based heat map with density alpha mask. + * Layer support different types of blending, including weighted average. Also it allows to apply alpha mask calculated by density. + * In most cases, the layer consumes data grouped by 1x1 pixels buckets. For proper averaging it requires aggregated value and count (number of rows in bucket) for each bucket. + * Blending of buckets is implemented via kernel density estimation (KDE) with a Gaussian kernel. + */ + class HeatmapLayer extends H.datalens.RasterLayer { + /** + * Constructor + * @param provider {H.datalens.QueryTileProvider} - Source of tiled data + * @param options {H.datalens.HeatmapLayer.Options} - Configuration for data processing and rendering + */ + constructor(provider: H.datalens.QueryTileProvider, options: H.datalens.HeatmapLayer.Options); + + /** + * Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names. + * @param data {H.datalens.Service.Data} + * @param x {H.datalens.QueryTileProvider.X} + * @param y {H.datalens.QueryTileProvider.Y} + * @param zoom {H.datalens.QueryTileProvider.Zoom} + * @returns {Array} + */ + static defaultDataToRows: (data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom) => + H.datalens.HeatmapLayer.Row[]; + + /** + * Set of possible values for the inputScale option + * @type {H.datalens.HeatmapLayer.InputScale} + */ + static inputScale: H.datalens.HeatmapLayer.InputScale; + + /** + * Set of possible values for the aggregation option + * @type {H.datalens.HeatmapLayer.Aggregation} + */ + static aggregation: H.datalens.HeatmapLayer.Aggregation; + + /** + * @param zoom {number} - zoom level + * @return {H.datalens.HeatmapLayer.Options} + */ + getOptionsPerZoom(zoom: number): H.datalens.HeatmapLayer.Options; + + /** + * Removes listeners, and references to memory consuming objects, from this layer. Call this method when you no longer need the layer. + */ + dispose(): void; + + /** + * Force re-rendering of the layer. In the case where the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + } + + namespace HeatmapLayer { + /** + * Defines data processing and rendering options for HeatmapLayer. + * The data processing flow of HeatmapLayer is similar to RasterLayer. The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.HeatmapLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * To collect the rows for a tile including buffer, the rows must be translated to H.datalens.HeatmapLayer.TilePoint. This translation must be specified with the rowToTilePoint callback. + * Other options define the blending options for the heat map. + * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. + * @property rowToTilePoint {function(H.datalens.HeatmapLayer.Row, H.datalens.HeatmapLayer.X, H.datalens.HeatmapLayer.Y)=} - + * Defines how the row is translated to the H.datalens.HeatmapLayer.TilePoint. This callback is called for each row that is returned from dataToRows. + * @property bandwidth {H.datalens.HeatmapLayer~Bandwidth | H.datalens.HeatmapLayer~BandwidthStop | Array. | + * H.datalens.HeatmapLayer~BandwidthCallback=} - Describes the bandwidth behavior in relation to current zoom level A numeric value sets it static across all levels + * An Object with zoom, value and optional zoomIncrementFactor (1 equals doubling on every zoom increment) defines a behavior across all zoom levels + * An Array of one or more zoom, value objects describes the behavior between the two defined levels and extrapolates the implied change outside of the defined range + * Alternatively defines the level of smoothing as a function of the zoom level. The callback must return a value in pixels. + * The cut-off of the Gaussian kernel is defined as 3 * bandwidth , a multiple (default 3) of bandwidth. + * @property valueRange {function(H.datalens.QueryTileProvider.Zoom)} - Defines the range for the color scale as a function of the zoom level. + * The returned value must be an array of 2 numbers. + * @property countRange {function(H.datalens.QueryTileProvider.Zoom)} - Defines the range for the density alpha mask as a function of the zoom level. + * When defined, the density alpha mask is applied. The returned value must be an array of 2 numbers. + * @property colorScale {function(number)} - Defines a color palette as a function of the normalized value. You can use D3.js library scale functions with the domain [0, 1]. + * @property alphaScale {function(number)} - Defines the alpha mask value as a function of the normalized count. + * You can use D3.js library scale functions with the domain [0, 1] and the range [0, 1]. + * @property aggregation {H.datalens.HeatmapLayer.Aggregation} - Specifies which type of aggregation was applied (eg. type of aggregation function for bucket in the Data Lens query). + * Possible values are SUM or AVERAGE. If the aggregation type is AVERAGE , then an averaged heat map is rendered. + * @property inputScale {H.datalens.HeatmapLayer.InputScale} - Defines the scale (eg logarithmic scale) of the TilePoint value. + * Note: if the value is not in a linear scale, then the aggregation in the source query must be defined with respect to the scale type. + * For example, before applying the average aggregation function in a query, the value must be transformed to the linear scale. This guarantees correct linear averaging of values. + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom): + H.datalens.HeatmapLayer.Row[]; + rowToTilePoint(row: H.datalens.HeatmapLayer.Row, x: H.datalens.HeatmapLayer.X, y: H.datalens.HeatmapLayer.Y): H.datalens.HeatmapLayer.TilePoint; + bandwidth?: H.datalens.HeatmapLayer.Bandwidth | H.datalens.HeatmapLayer.BandwidthStop | H.datalens.HeatmapLayer.BandwidthStop[] | H.datalens.HeatmapLayer.BandwidthCallback; + valueRange?(zoom: H.datalens.QueryTileProvider.Zoom): number[]; + countRange?(zoom: H.datalens.QueryTileProvider.Zoom): number[]; + colorScale?(scale: number): string; + alphaScale?(scale: number): number; + aggregation?: H.datalens.HeatmapLayer.Aggregation; + inputScale?: H.datalens.HeatmapLayer.InputScale; + } + + /** + * Tile X coordinate (column) + * Coordinate in XYZ tile numbering scheme. + */ + type X = number; + + /** + * Tile Y coordinate (row) + * Coordinate in XYZ tile numbering scheme. + */ + type Y = number; + + /** + * Slice of data (eg Data Lens query data row) that represents a data point. + * Each row is transformed into TilePoint and then rendered on a heat map. By default each row is an Object where property names correspond to data column names. + * This representation can be changed with the dataToRows callback. + */ + interface Row { + tx?: number; + ty?: number; + count?: number; + } + + /** + * Defines a constant for the bandwidth + * A number that sets a constant for the bandwidth across all zoom levels. + */ + type Bandwidth = number; + + /** + * Sets the bandwidth for a given zoom level and uses this to calculate the increment or decrement of the bandwidth at other zoom levels + * This object defines the behavior of the bandwidth value across all zoom levels, initialized by a reference zoom level and its value at that level. + * The default behavior with zoomIncrementFactor = 1 doubles the bandwidth with every increasing zoom level and halves it on every decrease in zoom level. + * For example, a bandwidth of 10@zoom1 turns to 20@zoom2 and 5@zoom0. A zoomIncrementFactor of 0 effectively equals the bandwidth number, ignoring the provided zoom level. + * A zoomIncrementFactor of 0.5 mean a bandwidth increase of 50% compared to a factor of 1. So a bandwidth of 10@zoom1 computes to 15@zoom2. + */ + interface BandwidthStop { + zoom: number; + value: number; + zoomIncrementFactor?: number; + } + + /** + * TODO: this is missing in the documentation: https://developer.here.com/visualization/documentation/datalens/h-datalens-heatmaplayer-options.html + */ + type BandwidthCallback = () => void; + + /** + * Defines the input data format for heat map rendering. + * For heat map rendering, each row of data must be represented as a point within the map tile. + * @property x {number} - Row relative to tile + * @property y {number} - Column relative to tile + * @property value {number} - Value at the point (eg aggregated bucket value) + * @property count {number} - Number of contributors to the value at the point (eg number of rows in a bucket) + * @property data {H.datalens.HeatmapLayer.Row} - Reference to source data row + */ + interface TilePoint { + x: number; + y: number; + value: number; + count: number; + data?: H.datalens.HeatmapLayer.Row; + } + + /** + * Set of possible values for the aggregation option. + * If the heat map input data is buckets, then different types of aggregation can be applied to the rows in a bucket. + * The aggregation type is required for proper blending mode of the heat map. For the AVERAGE aggregation type, an averaged heat map is rendered. + * @property SUM {string} - Specifies that the sum aggregation was applied to the bucket value + * @property AVERAGE {string} - Specifies that the average aggregation was applied to the bucket value + */ + enum Aggregation { + SUM, + AVERAGE + } + + /** + * Set of possible values for the inputScale option. + * The input scale is required for proper heat map blending. If the input scale is not linear, then the TilePoint.value is converted to linear scale before calculating the sum or average. + * @property DB {string} - Decibel (dB) scale + * @property LINEAR {string} - Linear scale + * @property LOG {string} - Logarithmic scale + */ + enum InputScale { + DB, + LINEAR, + LOG + } + } + + /** + * Presents data as points or spatial map objects with data-driven styles and client-side clustering. + * Applicable for drawing interactive map objects like markers, polygons, circles and other instances of H.map.Object. Source of data can be either tiled or not tiled. + * Styles for objects can be parametrized with data rows and zoom level. Allows to create data-driven icons for markers like donuts or bars. + * Also enables clustering and data domains for visualizing up to 100k points or more. + */ + class ObjectLayer extends H.map.layer.ObjectLayer { + /** + * Constructor + * @param provider {H.map.provider.RemoteTileProvider | H.datalens.Provider | H.datalens.QueryProvider | H.datalens.QueryTileProvider} - Data source (tiled or not) + * @param options {H.datalens.ObjectLayer.Options} - Defines data processing, clustering and data-driven styling + */ + constructor(provider: H.map.provider.RemoteTileProvider | H.datalens.Provider | H.datalens.QueryProvider | H.datalens.QueryTileProvider, options: H.datalens.ObjectLayer.Options); + + /** + * Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names. + * @property data {H.datalens.Service.Data} + * @returns {Array} + */ + static defaultDataToRows(data: H.datalens.Service.Data): H.datalens.ObjectLayer.Row[]; + + /** + * A factory method for data-driven icons. The method allows you to build an icon from SVG markup or JsonML object. Provides caching of icons with the same markup. + * @param svg {string | Array} - SVG presented as markup or JsonML Array + * @param options {H.map.Icon.Options} - Icon options (eg size and anchor). Note that the default anchor is in the middle. + * @param options.size {H.math.ISize | number} - When the icon is a square, you can define the size as a number in pixels + * @returns {H.map.Icon} - Icon which can be used for marker or cluster + */ + static createIcon(svg: string | any[], options?: H.map.Icon.Options): H.map.Icon; + + /** + * Returns cache of icons created with the createIcon method. Can be used to clean the icon cache. + * @return {H.util.Cache} - Icon cache + */ + static getIconCache(): H.util.Cache; + + /** + * Force re-rendering of the layer. In the case where the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + + /** + * Recalculates the style and applies it to the map object based on the new StyleState + * @param object {H.map.Object} - Map object + * @param state {H.datalens.ObjectLayer.StyleState} - New state + */ + updateObjectStyle(any: H.map.Object, state: H.datalens.ObjectLayer.StyleState): void; + } + + namespace ObjectLayer { + /** + * Defines data processing and data-driven styling for ObjectLayer + * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.ObjectLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * In the next step each row must be presented as a map object with the rowToMapObject callback. Data-driven styling can be provided with the rowToStyle callback. + * @property dataToRows {function(H.datalens.Service.Data)=} - Defines how the input data is split by rows. You can specify this callback to define client-side aggregation and filtering. + * @property rowToMapObject {function(H.datalens.ObjectLayer.Row, H.datalens.QueryTileProvider.Zoom)} - Defines how each row is presented on the map (eg marker, polygon) + * @property rowToStyle {function(H.datalens.ObjectLayer.Row, H.datalens.QueryTileProvider.Zoom, H.datalens.ObjectLayer.StyleState)=} - + * Defines map object style and icon according to data row and zoom level. Also it can define different styles depending on the StyleState (eg hovered, selected). + * @property dataDomains {H.datalens.ObjectLayer.DataDomains=} - Defines quantization of data for improving data-driven styling performance + * @property clustering {H.datalens.ObjectLayer.Clustering=} - When present, client-side clustering is applied + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data): H.datalens.ObjectLayer.Row[]; + rowToMapObject(row: H.datalens.ObjectLayer.Row, z: H.datalens.QueryTileProvider.Zoom): H.map.Object; + rowToStyle?(row: H.datalens.ObjectLayer.Row, z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.ObjectLayer.StyleState): H.datalens.ObjectLayer.ObjectStyleOptions; + dataDomains?: H.datalens.ObjectLayer.DataDomains; + clustering?: H.datalens.ObjectLayer.Clustering; + } + + /** + * Defines client-side clustering in the ObjectLayer. + * When the clustering option is provided, rows returned from dataToRows go to the clustering.rowToDataPoint callback to be transformed to data points. + * Then, the data points are clustered according to clustering.options. Clustering produces clusters and noise points (data points that are not clustered). + * Clusters and noise points must be presented as map objects with the rowToMapObject callback and can be styled with the rowToStyle callback. + * @property rowToDataPoint {H.datalens.ObjectLayer.Row} - Defines data points from rows + * @property options {function(H.datalens.QueryTileProvider.Zoom)} - Defines clustering options as a function of the zoom level + */ + interface Clustering { + rowToDataPoint(row: H.datalens.ObjectLayer.Row): H.clustering.DataPoint; + options(zoom: H.datalens.QueryTileProvider.Zoom): H.clustering.Provider.ClusteringOptions; + } + + /** + * Slice of data (eg Data Lens query data row) that represents a data point. + * Each row is translated to map objects with the rowToMapObject callback. By default each row is an Object where property names correspond to data column names. + * This representation can be changed with the dataToRows callback. + */ + interface Row { + getPosition(): H.geo.Point; + lat: number; + lng: number; + } + + /** + * User defined modification of a data-driven style + * StyleState appears as a parameter in the rowToStyle callback. By default it is 'DEFAULT_STATE'. To change StyleState, use the ObjectLayer.updateObjectStyle method. + */ + type StyleState = any; + + /** + * Output from the rowToStyle callback. + * Defines the styles or the icon that is applied to the map object. + * @property icon {H.map.Icon} - Marker icon + * @property style {H.map.SpatialStyle.Options} - Spatial style + * @property arrows {H.map.ArrowStyle.Options} - Style of arrows to render along a polyline + * @property zIndex {number} - The z-index value of the map object, default is 0 + */ + interface ObjectStyleOptions { + icon: H.map.Icon; + style: H.map.SpatialStyle.Options; + arrows: H.map.ArrowStyle.Options; + zIndex: number; + } + + /** + * Input data quantization domain, used to optimize styling performance. + * The option must have properties corresponding to the properties of H.datalens.ObjectLayer.Row. Values must be represented as an Array of Numbers that defines the quantization domain. + * When provided, the input data will be quantized, and rowToStyle will be called only for quantized values. + */ + type DataDomains = any; + } + + /** + * Defines how to load data from a raw data file + * This provider defines the interface for loading data, such as geometries or coordinates, from a local or remote data file in GeoJSON or CSV format + */ + class RawDataProvider extends H.map.provider.RemoteTileProvider { + /** + * Constructor + * @param options {H.datalens.RawDataProvider.Options} - Configures options + */ + constructor(options: H.datalens.RawDataProvider.Options); + + /** + * Updates the data url. Note that new data will be fetched only after the reload method is called. + * @param dataUrl {string} + */ + setDataUrl(dataUrl: string): void; + } + + namespace RawDataProvider { + /** + * Defines options for RawDataProvider + * Options for RawDataProvider + * @property dataUrl - The data url to fetch + * @property dataToFeatures {function(any)=} - Defines how the input data is mapped to an array of GeoJSON features + * @property featuresToRows {function(Array, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom, + * H.datalens.RawDataProvider.TileSize, H.datalens.RawDataProvider.Helpers)=} - + * Defines how GeoJSON features on a tile should be mapped to data rows, which are inputs to layers such as ObjectLayer and HeatmapLayer + */ + interface Options { + dataUrl?: string; + dataToFeatures?(obj: any): H.datalens.RawDataProvider.Feature[]; + featuresToRows?(features: H.datalens.RawDataProvider.Feature[], x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom, + tileSize: H.datalens.RawDataProvider.TileSize, helpers: H.datalens.RawDataProvider.Helpers): H.datalens.ObjectLayer.Row[]; + } + + /** + * A GeoJSON feature + * A GeoJSON feature object which conforms to the standard GeoJSON spec + */ + type Feature = any; + + /** + * Tile size + * The tile size in pixels. + */ + type TileSize = any; + + /** + * A helper class used in the worker thread + * This helper class provides convenience functions you can use in the worker thread + * @property latLngToPixel {function(H.datalens.RawDataProvider.Latitude, H.datalens.RawDataProvider.Longitude, H.datalens.QueryTileProvider.Zoom, H.datalens.RawDataProvider.TileSize)=} - + * Translates geographical coordinates (latitude, longitude) to world pixel coordinates. + * @property pixelToLatLng {function(H.datalens.RawDataProvider.PX, H.datalens.RawDataProvider.PY, H.datalens.QueryTileProvider.Zoom, H.datalens.RawDataProvider.TileSize)=} - + * Translates world pixel coordinates to geographical coordinates (latitude, longitude). + * @property parseCSV {function(any)=} - Takes CSV data as input, parses it, and return the parsed result. + */ + interface Helpers { + latLngToPixel?(latitude: H.datalens.RawDataProvider.Latitude, longitude: H.datalens.RawDataProvider.Longitude, z: H.datalens.QueryTileProvider.Zoom, + tileSize: H.datalens.RawDataProvider.TileSize): H.datalens.RawDataProvider.PixelCoordinates; + pixelToLatLng?(x: H.datalens.RawDataProvider.PX, y: H.datalens.RawDataProvider.PY, z: H.datalens.QueryTileProvider.Zoom, tileSize: H.datalens.RawDataProvider.TileSize): + H.datalens.RawDataProvider.GeoCoordinates; + parseCSV?(obj: any): any[]; + } + + /** + * Geographic coordinates + * A geographic coordinates pair [lat, lng] + */ + type GeoCoordinates = [number, number]; + + /** + * Latitude coordinate + * The latitude in the geographic coordinates pair + */ + type Latitude = number; + + /** + * Longitude coordinate + * The longitude in the geographic coordinates pair + */ + type Longitude = number; + + /** + * Pixel coordinates + * Pixel coordinates [px, py] pair + */ + type PixelCoordinates = [number, number]; + + /** + * Pixel coordinate in the x direction + * The x coordinate of the pixel coordinates pair [px, py] + */ + type PX = number; + + /** + * Pixel coordinate in the y direction + * The y coordinate of the pixel coordinates pair [px, py] + */ + type PY = number; + } + + /** + * Renders vector tiles using data-driven styles + * This layer binds the spatial data and user data, all provided by the Data Lens REST API. The layer renders geometry features using data-driven styles. + */ + class SpatialLayer extends H.map.layer.TileLayer { + /** + * Constructor + * @param dataProvider {H.datalens.Provider} - Source of tiled data (pass in null if data come from feature properties) + * @param spatialProvider {H.datalens.SpatialTileProvider} - Source of geometry data + * @param options {H.datalens.SpatialLayer.Options} - Configuration for data processing and rendering + */ + constructor(dataProvider: H.datalens.Provider, spatialProvider: H.datalens.SpatialTileProvider, options: H.datalens.SpatialLayer.Options); + + static DEFAULT_STATE: any; + static Spatial: any; + + /** + * Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names. + */ + static defaultDataToRows: any; + + /** + * Forces re-rendering of the layer. When the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + + /** + * This method changes the state of a map object; for example, style on mouse event. + * @param {H.map.Object} spatial + * @param {H.datalens.SpatialLayer.StyleState} state + */ + updateSpatialStyle(spatial: H.map.Object, state: H.datalens.SpatialLayer.StyleState): void; + } + + namespace SpatialLayer { + /** + * Defines data processing and rendering options for SpatialLayer + * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.SpatialLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. + * @property rowToSpatialId {function(H.datalens.SpatialLayer.Row)} - + * Defines how to get the spatial ID from a data row. This callback is called for each row that is returned from dataToRows. + * @property featureToSpatialId {function(H.datalens.SpatialLayer.Feature)} - + * Defines how to get the spatial ID from a geometry feature. This callback is called for each geometry feature in the vector tile. + * @property rowToStyle {function(H.datalens.SpatialLayer.Row, H.datalens.QueryTileProvider.Zoom, H.datalens.SpatialLayer.StyleState)} - + * Defines how the row is translated to map object style. This callback is called for each row that is returned from dataToRows. + * @property defaultStyle {function(H.datalens.QueryTileProvider.Zoom, H.datalens.SpatialLayer.StyleState)} - Defines the default map object style. + * @property transformFeature {H.datalens.SpatialLayer.transformFeature} - Defines how to transform the features. + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom): + H.datalens.SpatialLayer.Row[]; + rowToSpatialId(row: H.datalens.SpatialLayer.Row): string; + featureToSpatialId(feature: H.datalens.SpatialLayer.Feature): string; + rowToStyle(row: H.datalens.SpatialLayer.Row, z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.SpatialLayer.StyleState): any; + defaultStyle(z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.SpatialLayer.StyleState): any; + transformFeature: H.datalens.SpatialLayer.transformFeature; + } + + /** + * Defines modification of a data-driven style + * StyleState appears as a parameter in the rowToStyle callback. By default it is 'DEFAULT_STATE'. To change StyleState, use the SpatialLayer.updateSpatialStyle method. + */ + type StyleState = any; + + /** + * Defines a slice of data (eg Data Lens query data row) that represents a data point + * By default each row is an object where property names correspond to data column names. This representation can be changed with the dataToRows callback. + */ + type Row = any; + + /** + * Defines a geometry in the vector tile + * Each geometry is described by various properties, including a unique identifier which must be used to map the geometry to user data. + */ + type Feature = any; + + /** + * TODO: missing in documentation: https://developer.here.com/visualization/documentation/datalens/h-datalens-spatiallayer-options.html + */ + type transformFeature = any; + } + + /** + * Specifies how to access layer data (shapes, geometries) using the Data Lens REST API. + * This provider defines the interface for accessing shape layers via the Data Lens REST API. The input data is provided as vector tiles in the MapBox format (Protobuf). + * Data is loaded by tiles. + */ + class SpatialTileProvider extends H.map.provider.RemoteTileProvider { + /** + * Constructor + * @param service {H.datalens.Service} - Data Lens REST API service + * @param options {H.datalens.SpatialTileProvider.Options} - Configures layer name + */ + constructor(service: H.datalens.Service, options: H.datalens.SpatialTileProvider.Options); + + static VectorTile: any; + + /** + * Updates the layer name to be used in the next call of the Data Lens REST API. Note that new data will be fetched only after the reload method is called. + * @param {string} layerName + */ + setLayerName(layerName: string): void; + + /** + * Updates the query's dynamic parameters to be used in the next call of the Data Lens REST API. Note that new data will be fetched only after the reload method is called. + * This method is normally used when updating your visualization. + * @param {any|null} queryParams + */ + setQueryParams(queryParams: any | null): void; + } + + namespace SpatialTileProvider { + /** + * Defines layer name and data accessibility parameters for H.datalens.SpatialTileProvider + * This defines the layer name and dynamic parameters required for fetching tiled geometry data with the Data Lens REST API. Other options from H.datalens.Provider.Options are available. + * @property layerName {string} - The name of the layer to fetch with the Data Lens REST API query + * @property queryParams {any} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. + */ + interface Options { + layerName: string; + queryParams?: any; + } + } + } +} diff --git a/types/leaflet-markercluster/tsconfig.json b/types/heredatalens/tsconfig.json similarity index 91% rename from types/leaflet-markercluster/tsconfig.json rename to types/heredatalens/tsconfig.json index d5e7d33df8..9c60b13753 100644 --- a/types/leaflet-markercluster/tsconfig.json +++ b/types/heredatalens/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "leaflet-markercluster-tests.ts" + "heredatalens-tests.ts" ] } \ No newline at end of file diff --git a/types/heredatalens/tslint.json b/types/heredatalens/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/heredatalens/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/highcharts/highstock.d.ts b/types/highcharts/highstock.d.ts index 4541e5d715..3ec90ec6a1 100644 --- a/types/highcharts/highstock.d.ts +++ b/types/highcharts/highstock.d.ts @@ -81,10 +81,16 @@ declare namespace Highstock { trackBorderWidth?: number; } + interface AxisOptions extends Highcharts.AxisOptions { + scrollbar?: ScrollbarOptions; + } + interface Options extends Highcharts.Options { navigator?: NavigatorOptions; rangeSelector?: RangeSelectorOptions; scrollbar?: ScrollbarOptions; + xAxis?: AxisOptions[] | AxisOptions; + yAxis?: AxisOptions[] | AxisOptions; } interface Chart { diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index 8cc623b680..b71610f6b7 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -5012,7 +5012,7 @@ declare namespace Highcharts { * color: '#FF00FF' * }] */ - data?: number[] | Array<[number, number]> | Array<[string, number]> | DataPoint[]; + data?: Array; /** * An id for the series. This can be used after render time to get a pointer to the series object through * chart.get(). diff --git a/types/highcharts/test/highstock.ts b/types/highcharts/test/highstock.ts index 7fde17d3ce..2021e65b68 100644 --- a/types/highcharts/test/highstock.ts +++ b/types/highcharts/test/highstock.ts @@ -9,6 +9,10 @@ $(() => { type: "arearange" }, + xAxis: { + scrollbar: { enabled: true } + }, + navigator: { height: 80, maskFill: 'rgba(255, 198, 220, 0.75)', diff --git a/types/highcharts/tslint.json b/types/highcharts/tslint.json index a0b35dc4d9..d8b67d5d1f 100644 --- a/types/highcharts/tslint.json +++ b/types/highcharts/tslint.json @@ -4,6 +4,7 @@ "ban-types": false, "unified-signatures": false, "no-empty-interface": false, - "dt-header": false + "dt-header": false, + "no-object-literal-type-assertion": false } } diff --git a/types/highland/highland-tests.ts b/types/highland/highland-tests.ts index 7c813e1c1e..e4af44c0a0 100644 --- a/types/highland/highland-tests.ts +++ b/types/highland/highland-tests.ts @@ -134,7 +134,10 @@ fooStream = _((push, next) => { fooStream = _(fooStream); fooStream = _(readable); -fooStream = _(emitter); +fooStream = _(str, emitter); +fooStream = _(str, emitter, num); +fooStream = _(str, emitter, strArr); +fooStream = _(str, emitter, f); fooStream = _(fooStreamThen); fooStream = _(fooThen); @@ -210,6 +213,9 @@ _.log(str, num, foo); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - f = _.wrapCallback(func); +f = _.wrapCallback(func, num); +f = _.wrapCallback(func, strArr); +f = _.wrapCallback(func, fn); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/types/highland/index.d.ts b/types/highland/index.d.ts index b10f8e00bf..82806d6349 100644 --- a/types/highland/index.d.ts +++ b/types/highland/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for Highland 1.14.0 +// Type definitions for Highland 2.10.5 // Project: http://highlandjs.org/ // Definitions by: Bart van der Schoor +// Hugo Wood // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -48,6 +49,17 @@ interface HighlandStatic { * event emitter as the two arguments to the constructor and the first * argument emitted to the event handler will be written to the new Stream. * + * You can pass a mapping hint as the third argument, which specifies how + * event arguments are pushed into the stream. If no mapping hint is + * provided, only the first value emitted with the event to the will be + * pushed onto the Stream. + * + * If mappingHint is a number, an array of that length will be pushed onto + * the stream, containing exactly that many parameters from the event. If + * it's an array, it's used as keys to map the arguments into an object which + * is pushed to the tream. If it is a function, it's called with the event + * arguments, and the returned value is pushed. + * * **Promise -** Accepts an ES6 / jQuery style promise and returns a * Highland Stream which will emit a single value (or an error). * @@ -63,7 +75,7 @@ interface HighlandStatic { (xs: Highland.Stream): Highland.Stream; (xs: NodeJS.ReadableStream): Highland.Stream; - (xs: NodeJS.EventEmitter): Highland.Stream; + (eventName: string, xs: NodeJS.EventEmitter, mappingHint?: Highland.MappingHint): Highland.Stream; // moar (promise for everything?) (xs: Highland.Thenable>): Highland.Stream; @@ -298,16 +310,28 @@ interface HighlandStatic { /** * Wraps a node-style async function which accepts a callback, transforming * it to a function which accepts the same arguments minus the callback and - * returns a Highland Stream instead. Only the first argument to the - * callback (or an error) will be pushed onto the Stream. + * returns a Highland Stream instead. The wrapped function keeps its context, + * so you can safely use it as a method without binding (see the second + * example below). + * + * wrapCallback also accepts an optional mappingHint, which specifies how + * callback arguments are pushed to the stream. This can be used to handle + * non-standard callback protocols that pass back more than one value. + * + * mappingHint can be a function, number, or array. See the documentation on + * EventEmitter Stream Objects for details on the mapping hint. If + * mappingHint is a function, it will be called with all but the first + * argument that is passed to the callback. The first is still assumed to be + * the error argument. * * @id wrapCallback * @section Utils * @name _.wrapCallback(f) * @param {Function} f - the node-style function to wrap + * @param {Array | Function | Number} [mappingHint] - how to pass the arguments to the callback * @api public */ - wrapCallback(f: Function): Function; + wrapCallback(f: Function, mappingHint?: Highland.MappingHint): (...args: any[]) => Highland.Stream; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1009,6 +1033,8 @@ declare namespace Highland { */ latest(): Stream; } + + type MappingHint = number | string[] | Function; } declare var highland:HighlandStatic; diff --git a/types/history/LocationUtils.d.ts b/types/history/LocationUtils.d.ts index d78332e57c..26c98e374c 100644 --- a/types/history/LocationUtils.d.ts +++ b/types/history/LocationUtils.d.ts @@ -1,5 +1,4 @@ import { Path, LocationState, LocationKey, Location, LocationDescriptor } from './index'; export function locationsAreEqual(lv: LocationDescriptor, rv: LocationDescriptor): boolean; -export function createLocation(options: LocationDescriptor): Location; -export function createLocation(path: Path, state?: LocationState, key?: LocationKey, currentLocation?: Location): Location; +export function createLocation(path: LocationDescriptor, state?: LocationState, key?: LocationKey, currentLocation?: Location): Location; diff --git a/types/history/PathUtils.d.ts b/types/history/PathUtils.d.ts index 7ea7ed75a4..4cc947fcf3 100644 --- a/types/history/PathUtils.d.ts +++ b/types/history/PathUtils.d.ts @@ -1,7 +1,7 @@ -import { Path, Location, LocationDescriptor } from './index'; +import { Path, Location, LocationDescriptorObject } from './index'; export function addLeadingSlash(path: Path): Path; export function stripLeadingSlash(path: Path): Path; export function stripPrefix(path: Path, prefix: string): Path; export function parsePath(path: Path): Location; -export function createPath(location: LocationDescriptor): Path; +export function createPath(location: LocationDescriptorObject): Path; diff --git a/types/history/history-tests.ts b/types/history/history-tests.ts index 4cb788f806..a316bf03d3 100644 --- a/types/history/history-tests.ts +++ b/types/history/history-tests.ts @@ -101,6 +101,12 @@ let input = { value: "" }; LocationUtils.locationsAreEqual(location1, location2); } +{ + let location1 = LocationUtils.createLocation({ pathname: 'path/1' }, { state: 1 }); + let location2 = LocationUtils.createLocation({ pathname: 'pathname', state: 2 }); + LocationUtils.locationsAreEqual(location1, location2); +} + { let path = PathUtils.createPath({ pathname: '/a/path', hash: '#hash' }); let strippedPath = PathUtils.stripPrefix(path, '/a/'); diff --git a/types/history/index.d.ts b/types/history/index.d.ts index a45b930efe..eda8c1bb10 100644 --- a/types/history/index.d.ts +++ b/types/history/index.d.ts @@ -20,7 +20,7 @@ export interface History { goForward(): void; block(prompt?: boolean): UnregisterCallback; listen(listener: LocationListener): UnregisterCallback; - createHref(location: Path | LocationDescriptorObject): Href; + createHref(location: LocationDescriptorObject): Href; } export interface Location { diff --git a/types/hls.js/hls.js-tests.ts b/types/hls.js/hls.js-tests.ts index be71857652..e6d4a995f5 100644 --- a/types/hls.js/hls.js-tests.ts +++ b/types/hls.js/hls.js-tests.ts @@ -1,6 +1,6 @@ import * as Hls from 'hls.js'; -if (Hls.isSupported) { +if (Hls.isSupported()) { const video = document.getElementById('video'); const hls = new Hls(); hls.loadSource('http://www.streambox.fr/playlists/test_001/stream.m3u8'); diff --git a/types/hls.js/index.d.ts b/types/hls.js/index.d.ts index c0607a2307..622fadd890 100644 --- a/types/hls.js/index.d.ts +++ b/types/hls.js/index.d.ts @@ -29,6 +29,41 @@ declare namespace Hls { * data: { } */ const MEDIA_DETACHED: string; + /** + * fired when the buffer is going to be reset + * data: { } + */ + const BUFFER_RESET: string; + /** + * fired when we know about the codecs that we need buffers for to push into + * data: { tracks : { container, codec, levelCodec, initSegment, metadata } } + */ + const BUFFER_CODECS: string; + /** + * fired when we append a segment to the buffer + * data: { segment: segment object } + */ + const BUFFER_APPENDING: string; + /** + * fired when we are done with appending a media segment to the buffer + * data: { parent : segment parent that triggered BUFFER_APPENDING, pending : nb of segments waiting for appending for this segment parent } + */ + const BUFFER_APPENDED: string; + /** + * fired when the stream is finished and we want to notify the media buffer that there will be no more data + * data: { } + */ + const BUFFER_EOS: string; + /** + * fired when the media buffer should be flushed + * data: { } + */ + const BUFFER_FLUSHING: string; + /** + * fired when the media buffer has been flushed + * data: { } + */ + const BUFFER_FLUSHED: string; /** * fired to signal that a manifest loading starts * data: { url : manifestURL } @@ -74,6 +109,61 @@ declare namespace Hls { * data: { level: level object } */ const LEVEL_SWITCHED: string; + /** + * fired to notify that audio track lists has been updated + * data: { audioTracks : audioTracks } + */ + const AUDIO_TRACKS_UPDATED: string; + /** + * fired when an audio track switch occurs. deprecated in favor AUDIO_TRACK_SWITCHING + * data: { id : audio track id } + */ + const AUDIO_TRACK_SWTICH: string; + /** + * fired when an audio track switching is requested + * data: { id : audio track id } + */ + const AUDIO_TRACK_SWITCHING: string; + /** + * fired when an audio track switch actually occurs + * data: { id : audio track id } + */ + const AUDIO_TRACK_SWITCHED: string; + /** + * fired when an audio track loading starts + * data: { url : audio track URL, id : audio track id } + */ + const AUDIO_TRACK_LOADING: string; + /** + * fired when an audio track loading finishes + * data: { details : levelDetails object, id : audio track id, stats : { trequest, tfirst, tload, mtime } } + */ + const AUDIO_TRACK_LOADED: string; + /** + * fired to notify that subtitle track lists has been updated + * data: { subtitleTracks : subtitleTracks } + */ + const SUBTITLE_TRACKS_UPDATED: string; + /** + * fired when an subtitle track switch occurs + * data: { id : subtitle track id } + */ + const SUBTITLE_TRACK_SWITCH: string; + /** + * fired when a subtitle track loading starts + * data: { url : subtitle track URL, id : subtitle track id } + */ + const SUBTITLE_TRACK_LOADING: string; + /** + * fired when a subtitle track loading finishes + * data: { details : levelDetails object, id : subtitle track id, stats : { trequest, tfirst, tload, mtime } } + */ + const SUBTITLE_TRACK_LOADED: string; + /** + * fired when a subtitle fragment has been processed + * data: { success : boolean, frag : the processed frag } + */ + const SUBTITLE_FRAG_PROCESSED: string; /** * fired when a decryption key loading starts * data: { frag: fragment object } @@ -288,7 +378,7 @@ declare namespace Hls { /** * checks whether your browser is supporting MediaSource Extensions */ - const isSupported: boolean; + function isSupported(): boolean; /** * returns hls.js dist version number */ @@ -334,7 +424,7 @@ declare namespace Hls { * (default: 1) * number of segments needed to start a playback of Live stream. */ - initialLiveManifestSize: number; + initialLiveManifestSize?: number; /** * (default: 30 seconds) * Maximum buffer length in seconds. If buffer length is/become less than this value, a new fragment will be loaded. @@ -383,25 +473,25 @@ declare namespace Hls { * media element is expected to play and if currentTime has not moved for more than lowBufferWatchdogPeriod and if there are less than maxBufferHole seconds buffered upfront, * hls.js will try to nudge playhead to recover playback */ - lowBufferWatchdogPeriod: number; + lowBufferWatchdogPeriod?: number; /** * (default: 3s) * if media element is expected to play and if currentTime has not moved for more than highBufferWatchdogPeriod and if there are more than maxBufferHole seconds buffered upfront, * hls.js will try to nudge playhead to recover playback */ - highBufferWatchdogPeriod: number; + highBufferWatchdogPeriod?: number; /** * (default: 0.1s) * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. * media.currentTime += (nb nudge retry -1)*nudgeOffset */ - nudgeOffset: number; + nudgeOffset?: number; /** * (default: 3s) * In case playback continues to stall after first playhead nudging, currentTime will be nudged evenmore following nudgeOffset to try to restore playback. * media.currentTime += (nb nudge retry -1)*nudgeOffset */ - nudgeMaxRetry: number; + nudgeMaxRetry?: number; /** * (default 0.2s) * This tolerance factor is used during fragment lookup. @@ -1247,6 +1337,10 @@ declare class Hls { * hls.js event listener */ on(event: string, callback: (event: string, data: Hls.Data) => void): void; + /** + * remove hls.js event listener + */ + off(event: string, callback: (event: string, data: Hls.Data) => void): void; } export as namespace Hls; diff --git a/types/homeworks/homeworks-tests.ts b/types/homeworks/homeworks-tests.ts new file mode 100644 index 0000000000..16bce6d106 --- /dev/null +++ b/types/homeworks/homeworks-tests.ts @@ -0,0 +1,93 @@ +const element: JQuery = $('#element'); +const target: JQuery = $('#target'); + +element.checkbox({ + /* Empty options */ +}).bind('change', (event: HomeWorksEventObject) => { + /* HomeWorks native event */ +}); + +element.converter({ + /* Empty options */ +}); + +element.dropdown({ + /* Empty options */ +}); + +const dropdownHandlerTarget: JQuery = element.addHandler(target); + +element.input({ + /* Empty options */ +}).bind('change', (event: HomeWorksEventObject) => { + /* HomeWorks native event */ +}); + +element.modal({ + /* Any options */ +}).each(() => { + /* Chaining */ +}); +element.modal('show'); +element.modal('hide'); +element.modal('open'); +element.modal('close'); + +notification('title', 'content', 'url', 'success'); + +element.ripple({ + /* Object options */ +}); +element.start({ + x: 1, + y: 2 +}); + +element.spinner({ + type: 'any', + empty: 'any' +}).bind('change', (event: HomeWorksEventObject) => { + /* HomeWorks native event */ +}); + +element.step('method'); +element.step({ + active: 0 +}).bind('move', (event: HomeWorksStepEventObject) => { + /* HomeWorks step event */ +}); + +element.tab('method'); +element.tab({ + active: 0 +}).bind('move', (event: HomeWorksTabEventObject) => { + /* HomeWorks step event */ +}); + +toast('hello homeworks'); +toast({ + message: 'hello homeworks' +}); + +element.toggle({ + placeholder: 'placeholder' +}).bind('change', (event: HomeWorksEventObject) => { + /* HomeWorks native event */ +}); + +element.upload({ + url: 'url', + type: 'type', + data: {}, + dest: 'dest', + isBtn: true, + beforeStart() { + }, + complete(data: any) { + }, + success(data?: any, state?: any, xhr?: any) { + }, + error(xhr?: any, state?: any, error?: any) { + }, + extensions: 'any' +}); diff --git a/types/homeworks/index.d.ts b/types/homeworks/index.d.ts new file mode 100644 index 0000000000..87affa65e5 --- /dev/null +++ b/types/homeworks/index.d.ts @@ -0,0 +1,212 @@ +// Type definitions for homeworks 1.0 +// Project: https://github.com/IGAWorksDev/homeworks/ +// Definitions by: Kenneth Ceyer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +/** + * * [MAIN] + * @ EVENT + * + */ + +declare interface HomeWorksEventObject { + element: JQuery; + value: string; + checked?: boolean; +} + +declare interface JQuery { + bind(eventType: string, handler: (...parameters: any[]) => void): JQuery; + knock(): JQuery; +} + +/** + * * [COMPONENT] + * @ CHECKBOX + * + */ +interface CheckboxOptions { +} + +declare interface JQuery { + checkbox(options?: CheckboxOptions): JQuery; +} + +/** + * * [COMPONENT] + * @ CONVERTER + * + */ + +interface ConverterOptions { +} + +declare interface JQuery { + converter(options?: ConverterOptions): JQuery; +} + +/** + * * [COMPONENT] + * @ DROPDOIWN + * + */ + +interface DropdownOptions { +} + +declare interface JQuery { + dropdown(options?: DropdownOptions): JQuery; + addHandler(target: JQuery): JQuery; +} + +/** + * * [COMPONENT] + * @ INPUT + * + */ + +interface InputOptions { +} + +declare interface JQuery { + input(options?: InputOptions): JQuery; +} + +/** + * * [COMPONENT] + * @ MODAL + * + */ + +declare interface JQuery { + modal(options?: any): JQuery; + modal(method?: string, options?: any): JQuery; +} + +/** + * * [COMPONENT] + * @ NOTIFICATION + * + */ + +declare function notification(title: string, content: string, url: string, status?: string): void; + +/** + * * [COMPONENT] + * @ RIPPLE + * + */ + +interface RippleStartOptions { + x: number; + y: number; +} + +declare interface JQuery { + ripple(options?: any): JQuery; + start(options?: RippleStartOptions): JQuery; +} + +/** + * * [COMPONENT] + * @ SPINNER + * + */ + +interface SpinnerOptions { + type?: any; + empty?: any; +} + +declare interface JQuery { + spinner(options?: SpinnerOptions): JQuery; +} + +/** + * * [COMPONENT] + * @ STEP + * + */ + +interface StepOptions { + active?: number; +} + +declare interface JQuery { + step(method?: string): JQuery; + step(options?: StepOptions): JQuery; +} + +declare interface HomeWorksStepEventObject { + header: JQuery[]; + index: number; + length: number; +} + +/** + * * [COMPONENT] + * @ TAB + * + */ + +interface TabOptions { + active?: number; +} + +declare interface JQuery { + tab(method?: string): JQuery; + tab(options?: TabOptions): JQuery; +} + +declare interface HomeWorksTabEventObject { + header: JQuery[]; + index: number; + length: number; +} + +/** + * * [COMPONENT] + * @ TOAST + * + */ + +declare function toast(message: any): void; + +/** + * * [COMPONENT] + * @ TOGGLE + * + */ + +interface ToggleOptions { + placeholder?: string; +} + +declare interface JQuery { + toggle(options: ToggleOptions): JQuery; +} + +/** + * * [COMPONENT] + * @ UPLOAD + * + */ + +interface UploadOptions { + url: string; + type?: string; + data?: any; + dest?: string; + isBtn?: boolean; + beforeStart?: () => void; + complete?: (data?: any) => void; + success?: (data?: any, state?: any, xhr?: any) => void; + error?: (xhr?: any, state?: any, error?: any) => void; + extensions?: any; +} + +declare interface JQuery { + upload(options?: UploadOptions): JQuery; +} diff --git a/types/homeworks/tsconfig.json b/types/homeworks/tsconfig.json new file mode 100644 index 0000000000..65f6fc4f01 --- /dev/null +++ b/types/homeworks/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "homeworks-tests.ts" + ] +} \ No newline at end of file diff --git a/types/homeworks/tslint.json b/types/homeworks/tslint.json new file mode 100644 index 0000000000..626d0c5922 --- /dev/null +++ b/types/homeworks/tslint.json @@ -0,0 +1,9 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-empty-interface": false, + "strict-export-declare-modifiers": false, + "prefer-method-signature": false, + "unified-signatures": false + } +} diff --git a/types/http-aws-es/http-aws-es-tests.ts b/types/http-aws-es/http-aws-es-tests.ts new file mode 100644 index 0000000000..df432dbab4 --- /dev/null +++ b/types/http-aws-es/http-aws-es-tests.ts @@ -0,0 +1,42 @@ +import { EnvironmentCredentials } from "aws-sdk/lib/core"; +import { Client } from "elasticsearch"; +import HttpAmazonESConnector = require("http-aws-es"); + +new Client({ + amazonES: { + accessKey: "AKID", + region: "us-east-1", + secretKey: "secret", + }, + connectionClass: HttpAmazonESConnector, + host: "https://amazon-es-host.us-east-1.es.amazonaws.com", +}); + +new Client({ + amazonES: { + accessKey: "AKID", + region: "us-east-1", + secretKey: "secret", + }, + connectionClass: require("http-aws-es"), + host: "https://amazon-es-host.us-east-1.es.amazonaws.com", +}); + +const myCredentials = new EnvironmentCredentials("AWS"); +new Client({ + amazonES: { + credentials: myCredentials, + region: "us-east-1", + }, + connectionClass: HttpAmazonESConnector, + host: "https://amazon-es-host.us-east-1.es.amazonaws.com", +}); + +new Client({ + amazonES: { + credentials: myCredentials, + region: "us-east-1", + }, + connectionClass: require("http-aws-es"), + host: "https://amazon-es-host.us-east-1.es.amazonaws.com", +}); diff --git a/types/http-aws-es/index.d.ts b/types/http-aws-es/index.d.ts new file mode 100644 index 0000000000..c14547a58f --- /dev/null +++ b/types/http-aws-es/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for http-aws-es 1.1 +// Project: https://github.com/TheDeveloper/http-aws-es#readme +// Definitions by: Marco Gonzalez +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as e from "elasticsearch"; +import { Credentials } from "aws-sdk/lib/core"; + +declare module "elasticsearch" { + interface AmazonESOptions { + accessKey?: string; + credentials?: Credentials; + region: string; + secretKey?: string; + } + + interface ConfigOptions { + amazonES?: AmazonESOptions; + } +} + +declare const HttpAmazonESConnector: any; +export = HttpAmazonESConnector; diff --git a/types/http-aws-es/package.json b/types/http-aws-es/package.json new file mode 100644 index 0000000000..e4fd5a5e97 --- /dev/null +++ b/types/http-aws-es/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "aws-sdk": "^2.7.0" + } +} diff --git a/types/http-aws-es/tsconfig.json b/types/http-aws-es/tsconfig.json new file mode 100644 index 0000000000..f1689d92e4 --- /dev/null +++ b/types/http-aws-es/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "http-aws-es-tests.ts" + ] +} diff --git a/types/http-aws-es/tslint.json b/types/http-aws-es/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/http-aws-es/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/humanize-plus/humanize-plus-tests.ts b/types/humanize-plus/humanize-plus-tests.ts new file mode 100644 index 0000000000..4e66ff6c26 --- /dev/null +++ b/types/humanize-plus/humanize-plus-tests.ts @@ -0,0 +1,204 @@ +import * as Humanize from 'humanize-plus'; + +///////////// +// Numbers // +///////////// + +/** + * formatNumber + */ +Humanize.formatNumber(123456789, 2); +// "123,456,789.00" + +/** + * intComma + */ +Humanize.intComma(123456789); +// "123,456,789" + +/** + * compactInteger + */ +Humanize.compactInteger(123456789, 1); +// "123.5M" + +// Switch to scientific notation for trillons, because no one knows those abbreviations. +Humanize.compactInteger(-7832186132456328967, 4); +// "-7.8322x10^18" + +Humanize.compactInteger(-100, 2); +// "-100" + +/** + * boundedNumber + */ +Humanize.boundedNumber(110, 100); +// "100+" + +Humanize.boundedNumber(50, 100); +// "50" + +/** + * ordinal + */ +Humanize.ordinal(22); +// "22nd" + +/** + * times + */ +for (let i = 0; i < 5; i ++) { + Humanize.times(i, {4: 'too many'}); + if (i === 1) { + Humanize.times(1.1); + } +} +// never +// once +// 1.1 times +// twice +// 3 times +// too many times + +/** + * pace + */ +const second = 1000; +const week = 6.048e8; +const decade = 3.156e11; + +Humanize.pace(1.5, second, "heartbeat"); +// Approximately 2 heartbeats per second + +Humanize.pace(4, week); +// Approximately 4 times per week + +Humanize.pace(1, decade, "life crisis"); +// Less than 1 life crisis per week + +/** + * fileSize + */ +Humanize.fileSize(1024 * 20); +// "20 Kb" + +Humanize.fileSize(1024 * 2000); +// "1.95 Mb" + +Humanize.fileSize(Math.pow(1000, 4)); +// "931.32 Gb" + +/** + * pluralize + */ +Humanize.pluralize(1, "duck"); +// "duck" + +Humanize.pluralize(3, "duck"); +// "ducks" + +Humanize.pluralize(3, "duck", "duckies"); +// "duckies" + +///////////// +// Strings // +///////////// + +/** + * truncate + */ +Humanize.truncate('long text is good for you'); +// "long text is good for you" + +Humanize.truncate('long text is good for you', 19); +// "long text is goo..." + +Humanize.truncate('long text is good for you', 19, '... etc'); +// "long text is... etc" + +/** + * truncateWords + */ +Humanize.truncateWords('long text is good for you', 5); +// "long text is good for ..." + +/** + * capitalize + */ +Humanize.capitalize("some boring string"); +// "Some boring string" + +Humanize.capitalize("wHoOaA!"); +// "WHoOaA!" + +Humanize.capitalize("wHoOaA!", true); +// "Whooaa!" + +/** + * capitalizeAll + */ +Humanize.capitalizeAll("some boring string"); +// "Some Boring String" + +/** + * titleCase + */ +Humanize.titleCase("some of a boring string"); +// "Some of a Boring String" + +Humanize.titleCase("cool the iTunes cake, O'Malley!"); +// "Cool the iTunes Cake, O'Malley!" + +//////////// +// Arrays // +//////////// + +/** + * oxford + */ +const items = ['apple', 'orange', 'banana', 'pear', 'pineapple']; + +Humanize.oxford(items); +// "apple, orange, banana, pear, and pineapple" + +Humanize.oxford(items, 3); +// "apple, orange, banana, and 2 others" + +// Pluralizes properly too! +Humanize.oxford(items, 4); +// "apple, orange, banana, pear, and 1 other" + +Humanize.oxford(items, 3, "and some other fruits"); +// "apple, orange, banana, and some other fruits" + +/** + * frequency + */ +const aznPics = [ + 'http://24.media.tumblr.com/77082543cb69af56ede38a0cdb2511d0/tumblr_mh96olWPLv1r8k4ywo1_1280.jpg', + 'http://25.media.tumblr.com/3e2d318be34d5ef8f86a612cd1d795ff/tumblr_mhbhb96t3z1r8k4ywo1_1280.jpg', + 'http://24.media.tumblr.com/8c5a052e33c27c784514e1b124b383a1/tumblr_mhexaqrk0w1r8k4ywo1_1280.jpg' +]; +const bigfootPics: string[] = []; + +"Instagrammers " + Humanize.frequency(aznPics, "took pictures of food"); +// "Instagrammers took pictures of food 3 times" + +"Bigfoot " + Humanize.frequency(bigfootPics, "took pictures of food"); +// "Bigfoot never took pictures of food" + +///////////////////// +// Utility methods // +///////////////////// + +/** + * toFixed + */ +Humanize.toFixed(0.615, 2); +// "0.62" + +/** + * normalizePrecision + */ +Humanize.normalizePrecision(-232.231); +// 232 diff --git a/types/humanize-plus/index.d.ts b/types/humanize-plus/index.d.ts new file mode 100644 index 0000000000..4b20ada3fd --- /dev/null +++ b/types/humanize-plus/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for humanize-plus 1.8 +// Project: https://github.com/HubSpot/humanize +// Definitions by: Denis Carriere +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Numbers +export function formatNumber(number: number, decimals?: number): string; +export function intComma(number: number, decimals?: number): string; +export function compactInteger(number: number, decimals?: number): string; +export function boundedNumber(number: number, bounds?: number, ending?: string): string; +export function ordinal(value: number): string; +export function times(value: number, overrides?: any): string; +export function pace(value: number, intervalMs: number, unit?: string): string; +export function fileSize(filesize: number, precision?: number): string; +export function pluralize(number: number, singular?: string, plural?: string): string; + +// Strings +export function truncate(string: string, length?: number, ending?: string): string; +export function truncateWords(string: string, length?: number): string | null; +export function capitalize(string: string, downCaseTail?: boolean): string; +export function capitalizeAll(string: string): string; +export function titleCase(string: string): string; + +// Arrays +export function oxford(items: any[], limit?: number, limitStr?: string): string; +export function frequency(list: any[], verb?: string): string; + +// Utility methods +export function toFixed(value: number, precision?: number): string; +export function normalizePrecision(value: number, base?: number): number; diff --git a/types/humanize-plus/tsconfig.json b/types/humanize-plus/tsconfig.json new file mode 100644 index 0000000000..c79c7259f7 --- /dev/null +++ b/types/humanize-plus/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "humanize-plus-tests.ts" + ] +} diff --git a/types/humanize-plus/tslint.json b/types/humanize-plus/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/humanize-plus/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/i18n/i18n-tests.ts b/types/i18n/i18n-tests.ts index dc87c60a28..76e733d778 100644 --- a/types/i18n/i18n-tests.ts +++ b/types/i18n/i18n-tests.ts @@ -1,18 +1,17 @@ /** * Test suite created by Maxime LUCE + * Updated by FindQ for version 0.8 of i18n-node * * Created by using code samples from https://github.com/mashpie/i18n-node. */ /// - - import express = require("express"); import i18n = require("i18n"); -var app = express(); -var req: express.Request; +const app = express(); +let req: express.Request; /** * Configuration @@ -25,20 +24,35 @@ i18n.configure({ i18n.configure({ // setup some locales - other locales default to en silently - locales: ['en', 'de'], + locales: [ 'en', 'de' ], + + // fall back from Dutch to German + fallbacks: { nl: 'de' }, // you may alter a site wide default locale defaultLocale: 'de', - // sets a custom cookie name to parse locale settings from - defaults to NULL + // sets a custom cookie name to parse locale settings from - defaults to NULL cookie: 'yourcookiename', + // query parameter to switch locale (ie. /home?lang=ch) - defaults to NULL + queryParameter: 'lang', + // where to store json files - defaults to './locales' relative to modules directory directory: './mylocales', + // controll mode on directory creation - defaults to NULL which defaults to umask of process user. Setting has no effect on win. + directoryPermissions: '755', + + // watch for changes in json files to reload locale on updates - defaults to false + autoReload: true, + // whether to write new locale information to disk - defaults to true updateFiles: false, + // sync locale information accros all files - defaults to false + syncFiles: false, + // what to use as the indentation unit - defaults to "\t" indent: "\t", @@ -49,27 +63,57 @@ i18n.configure({ prefix: 'webapp-', // enable object notation - objectNotation: false + objectNotation: false, + + // setting of log level DEBUG - default to require('debug')('i18n:debug') + logDebugFn: (msg) => { + console.log('debug', msg); + }, + + // setting of log level WARN - default to require('debug')('i18n:warn') + logWarnFn: (msg) => { + console.log('warn', msg); + }, + + // setting of log level ERROR - default to require('debug')('i18n:error') + logErrorFn: (msg) => { + console.log('error', msg); + }, + + // object or [obj1, obj2] to bind the i18n api and current locale to - defaults to null + register: global, + + // hash to specify different aliases for i18n's internal methods to apply on the request/response objects (method -> alias). + // note that this will *not* overwrite existing properties with the same name + api: { + __: 't', // now req.__ becomes req.t + __n: 'tn' // and req.__n can be called as req.tn + }, + + // Downcase locale when passed on queryParam; e.g. lang=en-US becomes + // en-us. When set to false, the queryParam value will be used as passed; + // e.g. lang=en-US remains en-US. + preserveLegacyCase: true }); /** * Usage in global scope * https://github.com/mashpie/i18n-node#example-usage-in-global-scope */ -var greeting = i18n.__('Hello'); +let greeting = i18n.__('Hello'); /** * Usage in Express * https://github.com/mashpie/i18n-node#example-usage-in-expressjs */ // Configuration -app.configure(function () { +app.configure(() => { // default: using 'accept-language' header to guess language settings app.use(i18n.init); }); -app.get('/de', function (_req, res) { - var greeting = res.__('Hello'); +app.get('/de', (_req: Express.Request, res: Express.Response) => { + let greeting = res.__('Hello'); }); /** @@ -109,6 +153,39 @@ i18n.__n({ singular: "%s cat", plural: "%s cats", locale: "fr" }, 3); // 3 chat i18n.__n({ singular: "%s cat", plural: "%s cats", locale: "fr", count: 1 }); // 1 chat i18n.__n({ singular: "%s cat", plural: "%s cats", locale: "fr", count: 3 }); // 3 chat +/** + * __mf() + * https://github.com/mashpie/i18n-node#i18n__mf + */ +app.get('/de', (_req: Express.Request, res: Express.Response) => { + // assume res is set to german + res.setLocale('de'); + + // start simple + res.__mf('Hello'); // --> Hallo + + // can replace too + res.__mf('Hello {name}', { name: 'Marcus' }); // --> Hallo Marcus + + // and combines with sprintf + res.__mf('Hello {name}, how was your %s?', 'test', { name: 'Marcus' }); // --> Hallo Marcus, wie war dein test? + + // now check out a plural rule + res.__mf('{N, plural, one{# cat} few{# cats} many{# cats} others{# cats}}', {N: 1}); +}); + +/** + * __l() + * https://github.com/mashpie/i18n-node#i18n__l + */ +i18n.__l('Hello'); // --> [ 'Hallo', 'Hello' ] + +/** + * __h() + * https://github.com/mashpie/i18n-node#i18n__h + */ +i18n.__h('Hello'); // --> [ { de: 'Hallo' }, { en: 'Hello' } ] + /** * setLocale() * https://github.com/mashpie/i18n-node#setlocale @@ -117,6 +194,15 @@ i18n.setLocale('de'); i18n.setLocale(req, 'de'); req.setLocale('de'); +app.get('/ar', (_req: Express.Request, res: Express.Response) => { + i18n.setLocale(req, 'ar'); + i18n.setLocale(res, 'ar'); + i18n.setLocale(res.locals, 'ar'); + + i18n.setLocale([req, res.locals], req.params.lang); + i18n.setLocale(res, 'ar', true); +}); + /** * getLocale() * https://github.com/mashpie/i18n-node#getlocale @@ -125,6 +211,12 @@ i18n.getLocale(); // --> de i18n.getLocale(req); // --> de req.getLocale(); // --> de +/** + * getLocales() + * https://github.com/mashpie/i18n-node#i18ngetlocales + */ +i18n.getLocales(); // --> ['en', 'de', 'en-GB'] + /** * getCatalog() * https://github.com/mashpie/i18n-node#getcatalog @@ -137,4 +229,3 @@ i18n.getCatalog(req, 'de'); // returns just 'de' req.getCatalog(); // returns all locales req.getCatalog('de'); // returns just 'de' - diff --git a/types/i18n/index.d.ts b/types/i18n/index.d.ts index 7c7697cc22..534b46b186 100644 --- a/types/i18n/index.d.ts +++ b/types/i18n/index.d.ts @@ -1,14 +1,29 @@ -// Type definitions for i18n-node 0.5.0 +// Type definitions for i18n-node 0.8 // Project: https://github.com/mashpie/i18n-node // Definitions by: Maxime LUCE +// FindQ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare namespace i18n { - export interface ConfigurationOptions { - /** Setup some locales - other locales default to en silently */ + interface ConfigurationOptions { + /** + * Setup some locales - other locales default to en silently + * @default [] + */ locales?: string[]; - /** Alter a site wide default locale */ + + /** + * Language fallback map + * @default {} + */ + fallbacks?: { + [locale: string]: string; + }; + + /** + * Alter a site wide default locale + * @default "en" + */ defaultLocale?: string; /** @@ -16,6 +31,13 @@ declare namespace i18n { * @default null */ cookie?: string; + + /** + * Query parameter to switch locale (ie. /home?lang=ch) + * @default null + */ + queryParameter?: string; + /** * Where to store json files, relative to modules directory * @default "./locales" @@ -23,11 +45,29 @@ declare namespace i18n { directory?: string; /** - * whether to write new locale information to disk + * Control mode on directory creation. Setting has no effect on win. + * @default null + */ + directoryPermissions?: string; + + /** + * Watch for changes in json files to reload locale on updates + * @default false + */ + autoReload?: boolean; + + /** + * Whether to write new locale information to disk * @default true */ updateFiles?: boolean; + /** + * Sync locale information across all files + * @default false + */ + syncFiles?: boolean; + /** * What to use as the indentation unit * @default "\t" @@ -40,6 +80,12 @@ declare namespace i18n { */ extension?: string; + /** + * Setting prefix of json files name (in case you use different locale files naming scheme (webapp-en.json), rather then just en.json) + * @default "" + */ + prefix?: string; + /** * Enable object notation * @default false @@ -47,36 +93,70 @@ declare namespace i18n { objectNotation?: boolean; /** - * json files prefix + * Setting of log level DEBUG + * @default require("debug")("i18n:debug") */ - prefix?: string; - + logDebugFn?: (msg: string) => void; + /** - * object or [obj1, obj2] to bind the i18n api and current locale to - defaults to null + * Setting of log level WARN + * @default require("debug")("i18n:warn") + */ + logWarnFn?: (msg: string) => void; + + /** + * Setting of log level ERROR + * @default require("debug")("i18n:error") + */ + logErrorFn?: (msg: string) => void; + + /** + * object or [obj1, obj2] to bind the i18n api and current locale to + * @default null */ register?: any; + + /** + * Hash to specify different aliases for i18n's internal methods to apply on the request/response objects (method -> alias). + * Note that this will *not* overwrite existing properties with the same name. + * @default undefined + */ + api?: { + [method: string]: string; + }; + + /** + * Downcase locale when passed on queryParam; e.g. lang=en-US becomes en-us. + * When set to false, the queryParam value will be used as passed; e.g. lang=en-US remains en-US. + * @default true + */ + preserveLegacyCase?: boolean; } - export interface TranslateOptions { + interface TranslateOptions { phrase: string; locale?: string; } - export interface PluralOptions { + interface PluralOptions { singular: string; plural: string; count?: number; locale?: string; } - export interface Replacements { + interface Replacements { [key: string]: string; } - export interface LocaleCatalog { + interface LocaleCatalog { [key: string]: string; } - export interface GlobalCatalog { + interface GlobalCatalog { [key: string]: LocaleCatalog; } + interface HashedList { + [key: string]: string; + } + /** * Configure current i18n instance * @param {ConfigurationOptions} options - configuration options for i18n @@ -89,42 +169,23 @@ declare namespace i18n { * @param {Express.Response} response - Current express response * @param {Function} next - Callback to continue process */ - function init(request: Express.Request, response: Express.Response, next?: Function): void; + function init(request: Express.Request, response: Express.Response, next?: () => void): void; //#region __() /** * Translate the given phrase using locale configuration - * @param {string} phrase - The phrase to translate + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation * @returns {string} The translated phrase */ - function __(phrase: string, ...replace: string[]): string; + function __(phraseOrOptions: string | TranslateOptions, ...replace: string[]): string; /** * Translate the given phrase using locale configuration - * @param {string} phrase - The phrase to translate - * @param {Object} replacements - An object containing replacements + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation + * @param {Replacements} replacements - An object containing replacements * @returns {string} The translated phrase */ - function __(phrase: string, replacements: Replacements): string; - /** - * Translate the given phrase using locale configuration - * @param {TranslateOptions} options - Options for translation - * @returns {string} The translated phrase - */ - function __(options: TranslateOptions): string; - /** - * Translate the given phrase using locale configuration - * @param {TranslateOptions} options - Options for translation - * @returns {string} The translated phrase - */ - function __(options: TranslateOptions, ...replace: string[]): string; - /** - * Translate the given phrase using locale configuration - * @param {TranslateOptions} options - Options for translation - * @param {Object} replacements - An object containing replacements - * @returns {string} The translated phrase - */ - function __(options: TranslateOptions, replacements: Replacements): string; + function __(phraseOrOptions: string | TranslateOptions, replacements: Replacements): string; //#endregion @@ -133,33 +194,58 @@ declare namespace i18n { /** * Translate with plural condition the given phrase and count using locale configuration * @param {PluralOptions} options - Options for plural translate + * @param {number} [count] - The number which allow to select from plural to singular * @returns {string} The translated phrase */ - function __n(options: PluralOptions): string; + function __n(options: PluralOptions, count?: number): string; + /** + * Translate with plural condition the given phrase and count using locale configuration + * @param {string} singular - The singular phrase to translate if count is <= 1 + * @param {string} plural - The plural phrase to translate if count is > 1 + * @param {number | string} count - The number which allow to select from plural to singular + * @returns {string} The translated phrase + */ + function __n(singular: string, plural: string, count: number | string): string; + + //#endregion + + //#region __mf() /** - * Translate with plural condition the given phrase and count using locale configuration - * @param {PluralOptions} options - Options for plural translate - * @param {number} count - The number which allow to select from plural to singular + * Translate the given phrase using locale configuration and MessageFormat + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation * @returns {string} The translated phrase */ - function __n(options: PluralOptions, count: number): string; + function __mf(phraseOrOptions: string | TranslateOptions, ...replace: any[]): string; /** - * Translate with plural condition the given phrase and count using locale configuration - * @param {string} singular - The singular pharse to translate if count is <= 1 - * @param {string} plural - The plural pharse to translate if count is > 1 - * @param {number} count - The number which allow to select from plural to singular + * Translate the given phrase using locale configuration and MessageFormat + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation + * @param {Replacements} replacements - An object containing replacements * @returns {string} The translated phrase */ - function __n(singular: string, plural: string, count: number): string; + function __mf(phraseOrOptions: string | TranslateOptions, replacements: Replacements): string; + + //#endregion + + //#region __l() + /** - * Translate with plural condition the given phrase and count using locale configuration - * @param {string} singular - The singular pharse to translate if count is <= 1 - * @param {string} plural - The plural pharse to translate if count is > 1 - * @param {number} count - The number which allow to select from plural to singular - * @returns {string} The translated phrase + * Returns a list of translations for a given phrase in each language. + * @param {string} phrase - The phrase to get translations in each language + * @returns {string[]} The phrase in each language */ - function __n(singular: string, plural: string, count: string): string; + function __l(phrase: string): string[]; + + //#endregion + + //#region __h() + + /** + * Returns a hashed list of translations for a given phrase in each language. + * @param {string} phrase - The phrase to get translations in each language + * @returns {HashedList[]} The phrase in each language + */ + function __h(phrase: string): HashedList[]; //#endregion @@ -171,23 +257,34 @@ declare namespace i18n { */ function setLocale(locale: string): void; /** - * Change the current active locale for specified request - * @param {Express.Request} request - The request to change locale on + * Change the current active locale for specified response + * @param {Express.Request | Express.Response} response - The request or response to change locale on * @param {string} locale - The locale to set as default + * @param {boolean} [inheritance=false] - Disables inheritance if true */ - function setLocale(request: Express.Request, locale: string): void; + // tslint:disable-next-line:unified-signatures + function setLocale(requestOrResponse: Express.Request | Express.Response, locale: string, inheritance?: boolean): void; + /** + * Change the current active locale for specified response + * @param {any | any[]} objects - The object(s) to change locale on + * @param {string} locale - The locale to set as default + * @param {boolean} [inheritance=false] - Disables inheritance if true + */ + // tslint:disable-next-line:unified-signatures + function setLocale(objects: any | any[], locale: string, inheritance?: boolean): void; - /** - * Get the current active locale - * @returns {string} The current locale in request - */ - function getLocale(): string; /** * Get the current active locale for specified request - * @param {Express.Request} request - The request to get locale for + * @param {Express.Request} [request] - The request to get locale for * @returns {string} The current locale in request */ - function getLocale(request: Express.Request): string; + function getLocale(request?: Express.Request): string; + + /** + * Get a list with all configured locales + * @returns {string[]} + */ + function getLocales(): string[]; //#endregion @@ -207,16 +304,10 @@ declare namespace i18n { /** * Get the current active locale catalog for specified request * @param {Express.Request} request - The request to get locale catalog for + * @param {string} [locale] - The locale to get catalog for * @returns {LocaleCatalog} The current locale catalog for the specified request */ - function getCatalog(request: Express.Request): LocaleCatalog; - /** - * Get the current locale catalog for specified request and specified locale - * @param {Express.Request} request - The request to get locale catalog for - * @param {string} locale - The locale to get catalog for - * @returns {LocaleCatalog} The specified locale catalog - */ - function getCatalog(request: Express.Request, locale: string): LocaleCatalog; + function getCatalog(request: Express.Request, locale?: string): LocaleCatalog; //#endregion @@ -230,7 +321,7 @@ declare namespace i18n { * Get current i18n-node version * @member {string} */ - var version: string; + const version: string; } interface i18nAPI { @@ -240,36 +331,17 @@ interface i18nAPI { /** * Translate the given phrase using locale configuration - * @param {string} phrase - The phrase to translate + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation * @returns {string} The translated phrase */ - __(phrase: string, ...replace: string[]): string; + __(phraseOrOptions: string | i18n.TranslateOptions, ...replace: string[]): string; /** * Translate the given phrase using locale configuration - * @param {string} phrase - The phrase to translate - * @param {Object} replacements - An object containing replacements + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation + * @param {i18n.Replacements} replacements - An object containing replacements * @returns {string} The translated phrase */ - __(phrase: string, replacements: i18n.Replacements): string; - /** - * Translate the given phrase using locale configuration - * @param {TranslateOptions} options - Options for translation - * @returns {string} The translated phrase - */ - __(options: i18n.TranslateOptions): string; - /** - * Translate the given phrase using locale configuration - * @param {TranslateOptions} options - Options for translation - * @returns {string} The translated phrase - */ - __(options: i18n.TranslateOptions, ...replace: string[]): string; - /** - * Translate the given phrase using locale configuration - * @param {TranslateOptions} options - Options for translation - * @param {Object} replacements - An object containing replacements - * @returns {string} The translated phrase - */ - __(options: i18n.TranslateOptions, replacements: i18n.Replacements): string; + __(phraseOrOptions: string | i18n.TranslateOptions, replacements: i18n.Replacements): string; //#endregion @@ -278,33 +350,58 @@ interface i18nAPI { /** * Translate with plural condition the given phrase and count using locale configuration * @param {PluralOptions} options - Options for plural translate + * @param {number} [count] - The number which allow to select from plural to singular * @returns {string} The translated phrase */ - __n(options: i18n.PluralOptions): string; + __n(options: i18n.PluralOptions, count?: number): string; + /** + * Translate with plural condition the given phrase and count using locale configuration + * @param {string} singular - The singular phrase to translate if count is <= 1 + * @param {string} plural - The plural phrase to translate if count is > 1 + * @param {number | string} count - The number which allow to select from plural to singular + * @returns {string} The translated phrase + */ + __n(singular: string, plural: string, count: number | string): string; + + //#endregion + + //#region __mf() /** - * Translate with plural condition the given phrase and count using locale configuration - * @param {PluralOptions} options - Options for plural translate - * @param {number} count - The number which allow to select from plural to singular + * Translate the given phrase using locale configuration and MessageFormat + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation * @returns {string} The translated phrase */ - __n(options: i18n.PluralOptions, count: number): string; + __mf(phraseOrOptions: string | i18n.TranslateOptions, ...replace: any[]): string; /** - * Translate with plural condition the given phrase and count using locale configuration - * @param {string} singular - The singular pharse to translate if count is <= 1 - * @param {string} plural - The plural pharse to translate if count is > 1 - * @param {number} count - The number which allow to select from plural to singular + * Translate the given phrase using locale configuration and MessageFormat + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation + * @param {i18n.Replacements} replacements - An object containing replacements * @returns {string} The translated phrase */ - __n(singular: string, plural: string, count: number): string; + __mf(phraseOrOptions: string | i18n.TranslateOptions, replacements: i18n.Replacements): string; + + //#endregion + + //#region __l() + /** - * Translate with plural condition the given phrase and count using locale configuration - * @param {string} singular - The singular pharse to translate if count is <= 1 - * @param {string} plural - The plural pharse to translate if count is > 1 - * @param {number} count - The number which allow to select from plural to singular - * @returns {string} The translated phrase + * Returns a list of translations for a given phrase in each language. + * @param {string} phrase - The phrase to get translations in each language + * @returns {string[]} The phrase in each language */ - __n(singular: string, plural: string, count: string): string; + __l(phrase: string): string[]; + + //#endregion + + //#region __h() + + /** + * Returns a hashed list of translations for a given phrase in each language. + * @param {string} phrase - The phrase to get translations in each language + * @returns {HashedList[]} The phrase in each language + */ + __h(phrase: string): i18n.HashedList[]; //#endregion @@ -313,6 +410,7 @@ interface i18nAPI { * @returns {string} The current locale in request */ getLocale(): string; + /** * Change the current active locale * @param {string} locale - The locale to set as default @@ -329,7 +427,7 @@ interface i18nAPI { * @param {string} locale - The locale to get catalog for * @returns {LocaleCatalog} The specified locale catalog */ - getCatalog(locale: string): i18n.LocaleCatalog; + getCatalog(locale?: string): i18n.LocaleCatalog; } declare module "i18n" { @@ -337,13 +435,14 @@ declare module "i18n" { } declare namespace Express { - export interface Request extends i18nAPI { + interface Request extends i18nAPI { languages: string[]; regions: string[]; language: string; region: string; } - export interface Response extends i18nAPI { - locals: i18nAPI + + interface Response extends i18nAPI { + locals: i18nAPI; } } diff --git a/types/i18n/tslint.json b/types/i18n/tslint.json new file mode 100644 index 0000000000..bd50eb1958 --- /dev/null +++ b/types/i18n/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "prefer-method-signature": false, + "no-single-declare-module": false + } +} diff --git a/types/i18next/i18next-tests.ts b/types/i18next/i18next-tests.ts index 744fd950d4..a96901cbb7 100644 --- a/types/i18next/i18next-tests.ts +++ b/types/i18next/i18next-tests.ts @@ -1,8 +1,3 @@ -/// -/// -/// -/// - import i18n = require("i18next"); i18n.init({ @@ -59,6 +54,18 @@ i18n.init({ wait: false }); +i18n.init({ + fallbackLng: ['en', 'ru'], +}); + +i18n.init({ + fallbackLng: { + 'de-CH': ['fr', 'it'], + 'zh-HANT': ['zh-HANS', 'en'], + 'default': ['en'] + }, +}); + i18n.t('helloWorld', { defaultValue: 'default', count: 10 @@ -70,6 +77,22 @@ i18n.t('helloWorldInterpolated', { name: "world" }); +i18n.t('helloSingleFallbackLng', { + fallbackLng: 'en' +}); + +i18n.t('helloMultiFallbackLng', { + fallbackLng: ['en', 'ru'] +}); + +i18n.t('helloObjectFallbackLng', { + fallbackLng: { + 'de-CH': ['fr', 'it'], + 'zh-HANT': ['zh-HANS', 'en'], + 'default': ['en'] + }, +}); + i18n.exists("helloWorld"); const options:i18n.Options = i18n.options; diff --git a/types/i18next/index.d.ts b/types/i18next/index.d.ts index c0b0c82d81..1cacdeb7c3 100644 --- a/types/i18next/index.d.ts +++ b/types/i18next/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for i18next v2.3.4 +// Type definitions for i18next v2.3.5 // Project: http://i18next.com -// Definitions by: Michael Ledin +// Definitions by: Michael Ledin , Budi Irawan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Sources: https://github.com/i18next/i18next/ @@ -19,6 +19,12 @@ declare namespace i18n { [key: string]: any; } + interface FallbackLngObjList { + [language: string]: string[] + } + + type FallbackLng = string | string[] | FallbackLngObjList; + interface InterpolationOptions { escapeValue?: boolean; prefix?: string; @@ -41,7 +47,7 @@ declare namespace i18n { replace?: any; lng?: string; lngs?: string[]; - fallbackLng?: string; + fallbackLng?: FallbackLng; ns?: string | string[]; keySeparator?: string; nsSeparator?: string; @@ -57,7 +63,7 @@ declare namespace i18n { debug?: boolean; resources?: ResourceStore; lng?: string; - fallbackLng?: string; + fallbackLng?: FallbackLng; ns?: string | string[]; defaultNS?: string; fallbackNS?: string | string[]; diff --git a/types/images/images-tests.ts b/types/images/images-tests.ts new file mode 100644 index 0000000000..fc5cab619b --- /dev/null +++ b/types/images/images-tests.ts @@ -0,0 +1,35 @@ +import * as images from "images"; + +// from https://github.com/zhangyuanwei/node-images/blob/master/demo/uploadServer.js +let tmp_path = "tmp_path"; +let out_path = "out_path"; +let photo = images(tmp_path); + +photo.size(800) + .draw(images('./logo.png'), 800 - 421, photo.height() - 117) + .save(out_path, { quality: 80 }); + +// from https://github.com/zhangyuanwei/node-images/blob/master/test/index.js +images("input.png") + .resize(200) + .save("output_new.png"); + +images("input.png") + .size(200) + .save("output_old.png"); + +images("input.jpg") + .resize(200) + .save("output_new.jpg"); + +images("input.jpg") + .size(200) + .save("output_old.jpg"); + +images("input.gif") + .resize(200) + .save("output_new_gif.jpg"); + +images("input.gif") + .size(200) + .save("output_old_gif.jpg"); diff --git a/types/images/index.d.ts b/types/images/index.d.ts new file mode 100644 index 0000000000..38484bb256 --- /dev/null +++ b/types/images/index.d.ts @@ -0,0 +1,43 @@ +// Type definitions for images 2.2 +// Project: https://github.com/zhangyuanwei/node-images +// Definitions by: Ding Weizhe +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace images { + interface ImagesConfig { + [key: string]: any; + } + type SupportType = "png" | "jpg" | "gif" | "bmp" | "raw" | "webp"; + class ImagesStatic { + fill(red: number, green: number, blue: number, alpha?: number): ImagesStatic; + draw(image: ImagesStatic, x: number, y: number): ImagesStatic; + loadFromBuffer(buffer: Buffer): ImagesStatic; + encode(type: string, config?: ImagesConfig): void; + save(file: string, type?: SupportType, config?: ImagesConfig): void; + save(file: string, config?: ImagesConfig): void; + size(): { width: number, height: number }; + size(width: number, height?: number): ImagesStatic; + resize(width: number, height?: number, filter?: string): ImagesStatic; + resize(width: number, height: number, filter?: string): ImagesStatic; + width(): number; + width(width: number): ImagesStatic; + height(): number; + height(height: number): ImagesStatic; + setLimit(width: number, height: number): void; + setGCThreshold(value: number): void; + getUsedMemory(): void; + gc(): void; + } +} + +/* tslint:disable:unified-signatures */ +declare function images(file: string): images.ImagesStatic; +declare function images(width: number, height: number): images.ImagesStatic; +declare function images(buffer: Buffer, start?: number, end?: number): images.ImagesStatic; +declare function images(image: images.ImagesStatic): images.ImagesStatic; +declare function images(image: images.ImagesStatic, x: number, y: number, width: number, height: number): images.ImagesStatic; +/* tslint:enable:unified-signatures */ + +export = images; diff --git a/types/images/tsconfig.json b/types/images/tsconfig.json new file mode 100644 index 0000000000..7a261dbc3f --- /dev/null +++ b/types/images/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "images-tests.ts" + ] +} diff --git a/types/images/tslint.json b/types/images/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/images/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/inert/index.d.ts b/types/inert/index.d.ts index cb9b8e8edb..28e4efbe58 100644 --- a/types/inert/index.d.ts +++ b/types/inert/index.d.ts @@ -2,13 +2,12 @@ // Project: https://github.com/hapijs/inert/ // Definitions by: Steve Ognibene , AJP // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as hapi from 'hapi'; -declare module 'hapi' { - interface IFileHandler { - /** path - a path string or function as described above (required). */ - path: string | IRequestHandler; +declare namespace inert { + export interface ReplyFileHandlerOptions { /** confine - serve file relative to this directory and returns 403 Forbidden if the path resolves outside the confine directory. Defaults to true which uses the relativeTo route option as the confine. Set to false to disable this security feature. */ confine?: boolean; /** filename - an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path */ @@ -37,13 +36,18 @@ declare module 'hapi' { end?: number; } - interface IDirectoryHandler { + export interface FileHandlerRouteObject extends ReplyFileHandlerOptions { + /** path - a path string or function as described above (required). */ + path: string | hapi.RequestHandler; + } + + export interface DirectoryHandlerRouteObject { /** path - (required) the directory root path (relative paths are resolved based on the route files configuration). Value can be: * * a single path string used as the prefix for any resources requested by appending the request path parameter to the provided string. * * an array of path strings. Each path will be attempted in order until a match is found (by following the same process as the single path string). * * a function with the signature function(request) which returns the path string or an array of path strings. If the function returns an error, the error is passed back to the client in the response. */ - path: string | string[] | IRequestHandler; + path: string | string[] | hapi.RequestHandler; /** index - optional boolean|string|string[], determines if an index file will be served if found in the folder when requesting a directory. The given string or strings specify the name(s) of the index file to look for. If true, looks for 'index.html'. Any falsy value disables index file lookup. Defaults to true. */ index?: boolean | string | string[]; /** listing - optional boolean, determines if directory listing is generated when a directory is requested without an index document. Defaults to false. */ @@ -65,23 +69,48 @@ declare module 'hapi' { defaultExtension?: string; } - interface IRouteConfiguration { + /** + * inert accepts the following registration options + * @see {@link https://github.com/hapijs/inert#registration-options} + */ + interface OptionalRegistrationOptions { + /** + * sets the maximum number of file etag hash values stored in the etags cache. Defaults to 10000. + */ + etagsCacheMaxSize?: number; + } +} + +declare module 'hapi' { + interface RouteHandlerPlugins { /** * The file handler * * Generates a static file endpoint for serving a single file. file can be set to: * * a relative or absolute file path string (relative paths are resolved based on the route files configuration). * * a function with the signature function(request) which returns the relative or absolute file path. - * * an object with one or more of the following options: + * * an object with one or more of the following options @see IFileHandler * @see {@link https://github.com/hapijs/inert#the-file-handler} */ - file?: string | IRequestHandler | IFileHandler; + file?: string | RequestHandler | inert.FileHandlerRouteObject; /** * The directory handler * * Generates a directory endpoint for serving static content from a directory. Routes using the directory handler must include a path parameter at the end of the path string (e.g. /path/to/somewhere/{param} where the parameter name does not matter). The path parameter can use any of the parameter options (e.g. {param} for one level files only, {param?} for one level files or the directory root, {param*} for any level, or {param*3} for a specific level). If additional path parameters are present, they are ignored for the purpose of selecting the file system resource. The directory handler is an object with the following options: * @see {@link https://github.com/hapijs/inert#the-directory-handler} */ - directory?: IDirectoryHandler; + directory?: inert.DirectoryHandlerRouteObject; + } + + interface Base_Reply { + /** + * Transmits a file from the file system. The 'Content-Type' header defaults to the matching mime type based on filename extension. + * @see {@link https://github.com/hapijs/inert#replyfilepath-options} + */ + file: (path: string, options?: inert.ReplyFileHandlerOptions) => Response; } } + +declare var inert: hapi.PluginFunction; + +export = inert; diff --git a/types/inert/inert-tests.ts b/types/inert/inert-tests.ts index 38830694cd..82cd1f1295 100644 --- a/types/inert/inert-tests.ts +++ b/types/inert/inert-tests.ts @@ -1,36 +1,132 @@ -import * as HapiES6 from 'hapi'; -import * as InertES6 from 'inert'; +// Copied from: https://github.com/hapijs/inert#examples -const server = new HapiES6.Server({}); -server.register(InertES6, () => {}); +/// + +import Path = require('path'); +import Hapi = require('hapi'); +import Inert = require('inert'); + +const server = new Hapi.Server({ + connections: { + routes: { + files: { + relativeTo: Path.join(__dirname, 'public') + } + } + } +}); +server.connection({ port: 3000 }); + +server.register(Inert, () => {}); + +// added in addition to code from docs +const options: Inert.OptionalRegistrationOptions = {etagsCacheMaxSize: 400}; +server.register({ + register: Inert, + options, +}, (err) => {}); + +// added in addition to code from docs +server.register({ + register: Inert, + once: true, +}, (err) => {}); + +server.route({ + method: 'GET', + path: '/{param*}', + handler: { + directory: { + path: '.', + redirectToSlash: true, + index: true + } + } +}); + +server.start((err) => { + + if (err) { + throw err; + } + + console.log('Server running at:', server.info!.uri); +}); + +// https://github.com/hapijs/inert#serving-a-single-file + +server.route({ + method: 'GET', + path: '/{path*}', + handler: { + file: 'page.html' + } +}); + +// https://github.com/hapijs/inert#customized-file-response + +server.route({ + method: 'GET', + path: '/file', + handler: function (request, reply) { + + let path = 'plain.txt'; + if (request.headers['x-magic'] === 'sekret') { + path = 'awesome.png'; + } + + return reply.file(path).vary('x-magic'); + } +}); + +const handler: Hapi.ServerExtRequestHandler = function (request, reply) { + + const response = request.response!; + if (response.isBoom && + response.output!.statusCode === 404) { + + return reply.file('404.html').code(404); + } + + return reply.continue(); +} + +server.ext('onPostHandler', handler); + +// additional code added in addition to doc example code + +var file: Inert.FileHandlerRouteObject = { + path: '', + confine: true, +}; +var directory: Inert.DirectoryHandlerRouteObject = { + path: '', + listing: true +}; + +file = { + path: '', + confine: true, +}; server.route({ path: '', method: 'GET', - file: { - path: '', - confine: true, + handler: { + file, + directory: { + path: function(){ + if(Math.random() > 0.5) { + return ''; + } + else if(Math.random() > 0) { + return ['']; + } + return new Error(''); + }, + BAD_listing: true, // TODO change typings to make this error + }, }, - directory: { - path: '', - listing: true - } + config: { files: { relativeTo: __dirname } } }) -var fileHandler: HapiES6.IFileHandler = { - path: '', - confine: true, -} - -var directoryHandler: HapiES6.IDirectoryHandler = { - path: function(){ - if(Math.random() > 0.5) { - return ''; - } - else if(Math.random() > 0) { - return ['']; - } - return new Error(''); - }, - listing: true, -} diff --git a/types/insert-module-globals/index.d.ts b/types/insert-module-globals/index.d.ts new file mode 100644 index 0000000000..1fb0b6e7ba --- /dev/null +++ b/types/insert-module-globals/index.d.ts @@ -0,0 +1,67 @@ +// Type definitions for insert-module-globals 7.0 +// Project: https://github.com/substack/insert-module-globals +// Definitions by: Leonard Thieu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as stream from 'stream'; + +export = InsertModuleGlobals; + +interface InsertModuleGlobals { + /** + * Return a transform stream inserter for the filename file that will accept a javascript file as input and + * will output the file with a closure around the contents as necessary to define extra builtins. + */ + (file: string, opts?: InsertModuleGlobals.Options): stream.Transform; + + /** + * Defaults + */ + readonly vars: { + process(file: string): string; + global(): string; + 'Buffer.isBuffer'(file: string): string; + Buffer(): string; + __filename(file: string, basedir: string): string; + __dirname(file: string, basedir: string): string; + }; +} + +declare const InsertModuleGlobals: InsertModuleGlobals; + +declare namespace InsertModuleGlobals { + interface Options { + /** + * When opts.always is true, wrap every file with all the global variables without parsing. + * This is handy because parsing the scope can take a long time, so you can prioritize fast builds over saving bytes in the final output. + * When opts.always is truthy but not true, avoid parsing but perform a quick test to determine if wrapping should be skipped. + */ + always?: boolean; + /** + * Use opts.vars to override the default inserted variables, or set opts.vars[name] to undefined to not insert a variable which would otherwise be inserted. + * + * opts.vars properties with a . in their name will be executed instead of the parent object if ONLY that property is used. + * For example, "Buffer.isBuffer" will mask "Buffer" only when there is a Buffer.isBuffer() call in a file and no other references to Buffer. + */ + vars?: VarsOption; + /** + * If opts.debug is true, an inline source map will be generated to compensate for the extra lines. + */ + debug?: boolean; + basedir?: string; + } + + interface VarsOption { + [name: string]: InsertFunction | undefined; + } + + type InsertFunction = (file: string, basedir: string) => VariableConfig | string; + + interface VariableConfig { + id: string; + source: string; + suffix?: string; + } +} diff --git a/types/insert-module-globals/insert-module-globals-tests.ts b/types/insert-module-globals/insert-module-globals-tests.ts new file mode 100644 index 0000000000..0fa6c1af38 --- /dev/null +++ b/types/insert-module-globals/insert-module-globals-tests.ts @@ -0,0 +1,60 @@ +import insert = require('insert-module-globals'); +import { VarsOption } from 'insert-module-globals'; + +function example() { + function inserter(file: string) { + return insert(file, { basedir: __dirname + '/files' }); + } + + return inserter; +} + +function insert_custom_globals() { + const customProcessContent = 'customProcessContent'; + const files: string[] = []; + + const vars: VarsOption = { + process(file, basedir) { + return { + id: "path/to/custom_process.js", + source: customProcessContent + }; + }, + Buffer(file, basedir) { + return { + id: 'path/to/custom_buffer.js', + source: customProcessContent, + // suffix is optional + // it's used to extract the value from the module. + // it becomes: require(...).Buffer in this case. + suffix: '.Buffer' + }; + }, + Math() { + // if you return a string, + // it's simply set as the value. + return '{}'; + // ^ any attempt to use Math[x] will throw! + } + }; + + function inserter(file: string) { + return insert(file, { vars }); + } + + return inserter; +} + +function disable_select_globals() { + const insertGlobalVars: VarsOption = {}; + const wantedGlobalVars = ['__filename', '__dirname']; + Object.keys(insert.vars).forEach((x) => { + if (wantedGlobalVars.indexOf(x) === -1) { + insertGlobalVars[x] = undefined; + } + }); + + return insert('index.js', { + vars: insertGlobalVars + }); +} diff --git a/types/insert-module-globals/tsconfig.json b/types/insert-module-globals/tsconfig.json new file mode 100644 index 0000000000..0a6e51fb74 --- /dev/null +++ b/types/insert-module-globals/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "insert-module-globals-tests.ts" + ] +} diff --git a/types/insert-module-globals/tslint.json b/types/insert-module-globals/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/insert-module-globals/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/intl-tel-input/index.d.ts b/types/intl-tel-input/index.d.ts index 38ac9274ca..59e010fc83 100644 --- a/types/intl-tel-input/index.d.ts +++ b/types/intl-tel-input/index.d.ts @@ -1,17 +1,107 @@ // Type definitions for intl-tel-input // Project: https://github.com/jackocnr/intl-tel-input -// Definitions by: Fidan Hakaj +// Definitions by: Fidan Hakaj , Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Static methods that are defined in JQueryStatic.fn are not typed -// as jquery.d.ts has no interface for fn -// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/jquery/jquery.d.ts#L958 -// fn: any; //TODO: Decide how we want to type this - /// declare namespace IntlTelInput { + interface Plugin { + /** + * Get all of the plugin's country data - either to re-use elsewhere + * e.g. to populate a country dropdown. + */ + getCountryData(): CountryData[]; + /** + * Load the utils.js script (included in the lib directory) to enable + * formatting/validation etc. + */ + loadUtils(path: string, utilsScriptDeferred?: boolean): void; + + /** + * Remove the plugin from the input, and unbind any event listeners. + */ + (method: 'destroy'): void; + /** + * Get the extension from the current number. + * Requires the utilsScript option. + * e.g. if the input value was "(702) 555-5555 ext. 1234", this would + * return "1234". + */ + (method: 'getExtension'): string; + /** + * Get the current number in the given format (defaults to E.164 standard). + * The different formats are available in the enum + * intlTelInputUtils.numberFormat - taken from here. + * Requires the utilsScript option. + * Note that even if nationalMode is enabled, this can still return a full + * international number. + */ + (method: 'getNumber'): string; + /** + * Get the type (fixed-line/mobile/toll-free etc) of the current number. + * Requires the utilsScript option. + * Returns an integer, which you can match against the various options in the + * global enum intlTelInputUtils.numberType. + * Note that in the US there's no way to differentiate between fixed-line and + * mobile numbers, so instead it will return FIXED_LINE_OR_MOBILE. + */ + (method: 'getNumberType'): intlTelInputUtils.numberType; + /** + * Get the country data for the currently selected flag. + */ + (method: 'getSelectedCountryData'): IntlTelInput.CountryData; + /** + * Get more information about a validation error. + * Requires the utilsScript option. + * Returns an integer, which you can match against the various options in the + * global enum intlTelInputUtils.validationError + */ + (method: 'getValidationError'): intlTelInputUtils.validationError; + /** + * Validate the current number. Expects an internationally formatted number + * (unless nationalMode is enabled). If validation fails, you can use + * getValidationError to get more information. + * Requires the utilsScript option. + * Also see getNumberType if you want to make sure the user enters a certain + * type of number e.g. a mobile number. + */ + (method: 'isValidNumber'): boolean; + (method: string): void; + /** + * Change the country selection (e.g. when the user is entering their address). + * @param countryCode country code of the country to be set. + */ + (method: 'setCountry', countryCode: string): void; + /** + * Insert a number, and update the selected flag accordingly. + * Note that by default, if nationalMode is enabled it will try to use + * national formatting. + * @param aNumber number to be set. + */ + (method: 'setNumber', aNumber: string): void; + (method: string, value: string): void; + + /** + * Get the current number in the given format (defaults to E.164 standard). + * The different formats are available in the enum + * intlTelInputUtils.numberFormat - taken from here. + * Requires the utilsScript option. + * Note that even if nationalMode is enabled, this can still return a full + * international number. + * @param numberFormat the format in which the number will be returned. + */ + (method: 'getNumber', numberFormat: intlTelInputUtils.numberFormat): string; + (method: string, numberFormat: intlTelInputUtils.numberFormat): string; + + /** + * initialise the plugin with optional options. + * @param options options that can be provided during initialization. + */ + (options?: IntlTelInput.Options): JQueryDeferred; + } + interface Options { /** * Whether or not to allow the dropdown. If disabled, there is no dropdown @@ -154,85 +244,5 @@ declare namespace intlTelInputUtils { } interface JQuery { - /** - * Remove the plugin from the input, and unbind any event listeners. - */ - intlTelInput(method: 'destroy'): void; - /** - * Get the extension from the current number. - * Requires the utilsScript option. - * e.g. if the input value was "(702) 555-5555 ext. 1234", this would - * return "1234". - */ - intlTelInput(method: 'getExtension'): string; - /** - * Get the current number in the given format (defaults to E.164 standard). - * The different formats are available in the enum - * intlTelInputUtils.numberFormat - taken from here. - * Requires the utilsScript option. - * Note that even if nationalMode is enabled, this can still return a full - * international number. - */ - intlTelInput(method: 'getNumber'): string; - /** - * Get the type (fixed-line/mobile/toll-free etc) of the current number. - * Requires the utilsScript option. - * Returns an integer, which you can match against the various options in the - * global enum intlTelInputUtils.numberType. - * Note that in the US there's no way to differentiate between fixed-line and - * mobile numbers, so instead it will return FIXED_LINE_OR_MOBILE. - */ - intlTelInput(method: 'getNumberType'): intlTelInputUtils.numberType; - /** - * Get the country data for the currently selected flag. - */ - intlTelInput(method: 'getSelectedCountryData'): IntlTelInput.CountryData; - /** - * Get more information about a validation error. - * Requires the utilsScript option. - * Returns an integer, which you can match against the various options in the - * global enum intlTelInputUtils.validationError - */ - intlTelInput(method: 'getValidationError'): intlTelInputUtils.validationError; - /** - * Validate the current number. Expects an internationally formatted number - * (unless nationalMode is enabled). If validation fails, you can use - * getValidationError to get more information. - * Requires the utilsScript option. - * Also see getNumberType if you want to make sure the user enters a certain - * type of number e.g. a mobile number. - */ - intlTelInput(method: 'isValidNumber'): boolean; - intlTelInput(method: string): void; - /** - * Change the country selection (e.g. when the user is entering their address). - * @param countryCode country code of the country to be set. - */ - intlTelInput(method: 'setCountry', countryCode: string): void; - /** - * Insert a number, and update the selected flag accordingly. - * Note that by default, if nationalMode is enabled it will try to use - * national formatting. - * @param aNumber number to be set. - */ - intlTelInput(method: 'setNumber', aNumber: string): void; - intlTelInput(method: string, value: string): void; - - /** - * Get the current number in the given format (defaults to E.164 standard). - * The different formats are available in the enum - * intlTelInputUtils.numberFormat - taken from here. - * Requires the utilsScript option. - * Note that even if nationalMode is enabled, this can still return a full - * international number. - * @param numberFormat the format in which the number will be returned. - */ - intlTelInput(method: 'getNumber', numberFormat: intlTelInputUtils.numberFormat): string; - intlTelInput(method: string, numberFormat: intlTelInputUtils.numberFormat): string; - - /** - * initialise the plugin with optional options. - * @param options options that can be provided during initialization. - */ - intlTelInput(options?: IntlTelInput.Options): JQueryDeferred; + intlTelInput: IntlTelInput.Plugin; } diff --git a/types/intro.js/index.d.ts b/types/intro.js/index.d.ts index b0925cd41a..26d1fbcac4 100644 --- a/types/intro.js/index.d.ts +++ b/types/intro.js/index.d.ts @@ -50,6 +50,7 @@ declare namespace IntroJs { exit(): IntroJs; clone(): IntroJs; + goToStepNumber(stepId: number): IntroJs goToStep(step: number): IntroJs; nextStep(): IntroJs; previousStep(): IntroJs; @@ -66,11 +67,12 @@ declare namespace IntroJs { oncomplete(callback: Function): IntroJs; addHints(): IntroJs; - showHint(stepId: number): IntroJs; showHints(): IntroJs; hideHint(stepId: number): IntroJs; hideHints(): IntroJs; + removeHint(stepId: number): IntroJs; + removeHints(): IntroJs; onhintsadded(callback: Function): IntroJs; onhintclick(callback: (hintElement: HTMLElement, item: Step, stepId: number) => any): IntroJs; diff --git a/types/intro.js/intro.js-tests.ts b/types/intro.js/intro.js-tests.ts index 19267a94a3..d40fbe3f36 100644 --- a/types/intro.js/intro.js-tests.ts +++ b/types/intro.js/intro.js-tests.ts @@ -57,6 +57,7 @@ intro.setOptions({ intro.start() .nextStep() .previousStep() + .goToStepNumber(1).start() .goToStep(2) .exit() .refresh() @@ -89,6 +90,8 @@ intro.start() .showHints() .hideHint(1) .hideHints() + .hideHint(1) + .hideHints() .clone(); introWithElement.start() diff --git a/types/ip/index.d.ts b/types/ip/index.d.ts index 0e3bb7bd14..602a71eed9 100644 --- a/types/ip/index.d.ts +++ b/types/ip/index.d.ts @@ -75,6 +75,16 @@ declare module "ip" { **/ export function isLoopback(ip: string): boolean; + /** + * Check whether an IP is a IPv4 address. + **/ + export function isV4Format(ip: string): boolean; + + /** + * Check whether an IP is a IPv6 address. + **/ + export function isV6Format(ip: string): boolean; + /** * Get the loopback address for an IP family. * diff --git a/types/isotope-layout/isotope-layout-tests.ts b/types/isotope-layout/isotope-layout-tests.ts index 8f20d52fcc..648ba507ce 100644 --- a/types/isotope-layout/isotope-layout-tests.ts +++ b/types/isotope-layout/isotope-layout-tests.ts @@ -101,7 +101,7 @@ let iso: Isotope = $grid.data('isotope'); iso = new Isotope('.grid'); iso.addItems($('.items')); iso.appended(new HTMLElement()); -iso.arrange(new HTMLElement()); +iso.arrange({ cellsByColumn: { columnWidth: 101, rowHeight: 12 } }); iso.destroy(); elements = iso.getFilteredItemElements(); elements = iso.getItemElements(); diff --git a/types/jasmine-ajax/index.d.ts b/types/jasmine-ajax/index.d.ts index 4762ba085a..dcc6720f04 100644 --- a/types/jasmine-ajax/index.d.ts +++ b/types/jasmine-ajax/index.d.ts @@ -27,13 +27,13 @@ interface JasmineAjaxRequest extends XMLHttpRequest { } interface JasmineAjaxRequestTracker { - track(request: JasmineAjaxRequest): void; - first(): JasmineAjaxRequest; - count(): number; - reset(): void; - mostRecent(): JasmineAjaxRequest; - at(index: number): JasmineAjaxRequest; - filter(urlToMatch: RegExp): JasmineAjaxRequest[]; + track(request: JasmineAjaxRequest): void; + first(): JasmineAjaxRequest; + count(): number; + reset(): void; + mostRecent(): JasmineAjaxRequest; + at(index: number): JasmineAjaxRequest; + filter(urlToMatch: RegExp): JasmineAjaxRequest[]; filter(urlToMatch: Function): JasmineAjaxRequest[]; filter(urlToMatch: string): JasmineAjaxRequest[]; } @@ -48,14 +48,14 @@ interface JasmineAjaxRequestStubReturnOptions { interface JasmineAjaxRequestStub { data?: string; - method?: string; - andReturn(options: JasmineAjaxRequestStubReturnOptions): void; - matches(fullUrl: string, data: string, method: string): boolean; + method?: string; + andReturn(options: JasmineAjaxRequestStubReturnOptions): void; + matches(fullUrl: string, data: string, method: string): boolean; } interface JasmineAjaxStubTracker { - addStub(stub: JasmineAjaxRequestStub): void; - reset(): void; + addStub(stub: JasmineAjaxRequestStub): void; + reset(): void; findStub(url: string, data?: string, method?: string): JasmineAjaxRequestStub; } diff --git a/types/jasmine-ajax/jasmine-ajax-tests.ts b/types/jasmine-ajax/jasmine-ajax-tests.ts index b2c963c6c1..fabd525012 100644 --- a/types/jasmine-ajax/jasmine-ajax-tests.ts +++ b/types/jasmine-ajax/jasmine-ajax-tests.ts @@ -1779,7 +1779,7 @@ describe("mockAjax", () => { mockAjax.install(); - mockAjax.requests.track( { url: '/testurl' }); + // mockAjax.requests.track( { url: '/testurl' }); mockAjax.stubRequest('/bobcat'); expect(mockAjax.requests.count()).toEqual(1); diff --git a/types/jasmine/index.d.ts b/types/jasmine/index.d.ts index 11b0d1919c..4ebc04eada 100644 --- a/types/jasmine/index.d.ts +++ b/types/jasmine/index.d.ts @@ -1,44 +1,123 @@ // Type definitions for Jasmine 2.5.2 // Project: http://jasmine.github.io/ -// Definitions by: Boris Yankov , Theodore Brown , David Pärsson +// Definitions by: Boris Yankov , Theodore Brown , David Pärsson , Gabe Moothart , Lukas Zech // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 // For ddescribe / iit use : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/karma-jasmine/karma-jasmine.d.ts +/** + * Create a group of specs (often called a suite). + * @param description Textual description of the group + * @param specDefinitions Function for Jasmine to invoke that will define inner suites a specs + */ declare function describe(description: string, specDefinitions: () => void): void; declare function fdescribe(description: string, specDefinitions: () => void): void; declare function xdescribe(description: string, specDefinitions: () => void): void; +/** + * Define a single spec. A spec should contain one or more expectations that test the state of the code. + * A spec whose expectations all succeed will be passing and a spec with any failures will fail. + * @param expectation Textual description of what this spec is checking + * @param assertion Function that contains the code of your test. If not provided the test will be pending. + * @param timeout Custom timeout for an async spec. + */ declare function it(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; + +/** + * A focused it + * If suites or specs are focused, only those that are focused will be executed. + * @param expectation + * @param assertion + * @param timeout + */ declare function fit(expectation: string, assertion?: (done: DoneFn) => 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. */ +/** + * Mark a spec as pending, expectation results will be ignored. + * If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. + * @param reason + * @returns {} + */ declare function pending(reason?: string): void; +/** + * Run some shared setup before each of the specs in the describe in which it is called. + * @param action Function that contains the code to setup your specs. + * @param timeout Custom timeout for an async beforeEach. + */ declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void; + +/** + * Run some shared teardown after each of the specs in the describe in which it is called. + * @param action Function that contains the code to teardown your specs. + * @param timeout Custom timeout for an async afterEach. + */ declare function afterEach(action: (done: DoneFn) => void, timeout?: number): void; +/** + * Run some shared setup once before all of the specs in the describe are run. + * Note: Be careful, sharing the setup from a beforeAll makes it easy to accidentally leak state between your specs so that they erroneously pass or fail. + * @param action Function that contains the code to setup your specs. + * @param timeout Custom timeout for an async beforeAll. + */ declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void; + +/** + * Run some shared teardown once before all of the specs in the describe are run. + * Note: Be careful, sharing the teardown from a afterAll makes it easy to accidentally leak state between your specs so that they erroneously pass or fail. + * @param action Function that contains the code to teardown your specs. + * @param timeout Custom timeout for an async afterAll + */ declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void; +/** + * Create an expectation for a spec. + * @param spy + */ declare function expect(spy: Function): jasmine.Matchers; + +/** + * Create an expectation for a spec. + * @param actual + */ declare function expect(actual: ArrayLike): jasmine.ArrayLikeMatchers; + +/** + * Create an expectation for a spec. + * @param actual Actual computed value to test expectations against. + */ declare function expect(actual: T): jasmine.Matchers; +/** + * Explicitly mark a spec as failed. + * @param e + */ declare function fail(e?: any): void; + /** Action method that should be called when the async work is complete */ interface DoneFn extends Function { (): void; /** fails the spec and indicates that it has completed. If the message is an Error, Error.message is used */ - fail: (message?: Error|string) => void; + fail: (message?: Error | string) => void; } +/** + * Install a spy onto an existing object. + * @param object The object upon which to install the Spy + * @param method The name of the method to replace with a Spy. + */ declare function spyOn(object: T, method: keyof T): jasmine.Spy; +/** + * Install a spy on a property onto an existing object. + * @param object The object upon which to install the Spy + * @param property The name of the property to replace with a Spy + * @param accessType The access type (get|set) of the property to Spy on. + */ declare function spyOnProperty(object: T, property: keyof T, accessType: string): jasmine.Spy; declare function runs(asyncMethod: Function): void; @@ -58,8 +137,12 @@ declare namespace jasmine { function objectContaining(sample: Partial): ObjectContaining; function createSpy(name: string, originalFn?: Function): Spy; - function createSpyObj(baseName: string, methodNames: any[]): any; - function createSpyObj(baseName: string, methodNames: any[]): T; + function createSpyObj(baseName: string, methodNames: any[] | {[methodName: string]: any}): any; + function createSpyObj(baseName: string, methodNames: any[] | {[methodName: string]: any}): SpyObj; + + function createSpyObj(baseName: string, methodNames: any): any; + function createSpyObj(methodNames: any[]): any; + function createSpyObj(methodNames: any): any; function pp(value: any): string; @@ -75,7 +158,7 @@ declare namespace jasmine { function formatErrorMsg(domain: string, usage: string): (msg: string) => string; interface Any { - + (...params: any[]):any; // jasmine.Any can also be a function new (expectedClass: any): any; jasmineMatches(other: any): boolean; @@ -248,7 +331,7 @@ declare namespace jasmine { } interface Order { - new (options: {random: boolean, seed: string}): any; + new (options: { random: boolean, seed: string }): any; random: boolean; seed: string; sort(items: T[]): T[]; @@ -321,7 +404,20 @@ declare namespace jasmine { isNot?: boolean; message(): any; + /** + * + * @param expected the actual value to be === to the expected value. + * @param expectationFailOutput + * @returns {} + */ toBe(expected: Expected, expectationFailOutput?: any): boolean; + + /** + * + * @param expected the actual value to be equal to the expected, using deep equality comparison. + * @param expectationFailOutput + * @returns {} + */ toEqual(expected: Expected, expectationFailOutput?: any): boolean; toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean; toBeDefined(expectationFailOutput?: any): boolean; @@ -350,7 +446,7 @@ declare namespace jasmine { interface ArrayLikeMatchers extends Matchers> { toBe(expected: Expected>, expectationFailOutput?: any): boolean; toEqual(expected: Expected>, expectationFailOutput?: any): boolean; - toContain(expected: T, expectationFailOutput?: any): boolean; + toContain(expected: Expected, expectationFailOutput?: any): boolean; not: ArrayLikeMatchers; } @@ -510,10 +606,14 @@ declare namespace jasmine { identity: string; and: SpyAnd; calls: Calls; - mostRecentCall: {args: any[]; }; + mostRecentCall: { args: any[]; }; argsForCall: any[]; } + type SpyObj = T & { + [k in keyof T]: Spy; + } + interface SpyAnd { /** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */ callThrough(): Spy; @@ -595,3 +695,39 @@ declare namespace jasmine { export var DEFAULT_TIMEOUT_INTERVAL: number; export var MAX_PRETTY_PRINT_DEPTH: number; } + +declare module "jasmine" { + class jasmine { + constructor(options: any); + jasmine: jasmine.Jasmine; + addMatchers(matchers: jasmine.CustomMatcherFactories): void; + addReporter(reporter: jasmine.Reporter): void; + addSpecFile(filePath: string): void; + addSpecFiles(files: string[]): void; + configureDefaultReporter(options: any, ...args: any[]): void; + execute(files: any, filterString: any): any; + exitCodeCompletion(passed: any): void; + loadConfig(config: any): void; + loadConfigFile(configFilePath: any): void; + loadHelpers(): void; + loadSpecs(): void; + onComplete(onCompleteCallback: () => void): void; + provideFallbackReporter(reporter: jasmine.Reporter): void; + randomizeTests(value?: any): boolean; + seed(value: any): void; + showColors(value: any): void; + stopSpecOnExpectationFailure(value: any): void; + static ConsoleReporter(): any; + env: jasmine.Env; + reportersCount: number; + completionReporter: jasmine.CustomReporter; + reporter: jasmine.CustomReporter; + coreVersion(): string; + showingColors: boolean; + projectBaseDir: string; + printDeprecation(): void; + specFiles: string[]; + helperFiles: string[]; + } + export = jasmine; +} \ No newline at end of file diff --git a/types/jasmine/jasmine-tests.ts b/types/jasmine/jasmine-tests.ts index d681d972b0..aaf02a170e 100644 --- a/types/jasmine/jasmine-tests.ts +++ b/types/jasmine/jasmine-tests.ts @@ -112,6 +112,13 @@ describe("Included matchers:", () => { expect(a).not.toContain("quux"); }); + it("The 'toContain' matcher is also for finding an object containing distinct properties in an Array", () => { + var a = [{ a: "foo" }, { a: "bar" }, { b: "baz" }]; + + expect(a).toContain(jasmine.objectContaining({ a: "foo" })); + expect(a).not.toContain({ a: "quux" }); + }); + it("The 'toBeLessThan' matcher is for mathematical comparisons", () => { var pi = 3.1415926, e = 2.78; @@ -616,9 +623,14 @@ describe("A spy, when created manually", () => { describe("Multiple spies, when created manually", () => { var tape: any; + var el: jasmine.SpyObj; beforeEach(() => { tape = jasmine.createSpyObj('tape', ['play', 'pause', 'stop', 'rewind']); + el = jasmine.createSpyObj('Element', ['hasAttribute']); + + el.hasAttribute.and.returnValue(false); + el.hasAttribute("href"); tape.play(); tape.pause(); @@ -650,6 +662,25 @@ describe("jasmine.any", () => { expect(12).toEqual(jasmine.any(Number)); }); + it("matches any function", () => { + interface Test { + fn1(): void; + fn2(param1: number): number; + } + + const a: Test = { + fn1: () => { }, + fn2: (param1: number) => { return param1; }, + }; + + const expected: Test = { + fn1: jasmine.any(Function), + fn2: jasmine.any(Function), + }; + + expect(a).toEqual(expected); + }); + describe("when used with a spy", () => { it("is useful for comparing arguments", () => { var foo = jasmine.createSpy('foo'); @@ -841,7 +872,7 @@ describe("Fail", () => { // test based on http://jasmine.github.io/2.2/custom_equality.html describe("custom equality", () => { - var myCustomEquality: jasmine.CustomEqualityTester = function(first: any, second: any): boolean { + var myCustomEquality: jasmine.CustomEqualityTester = function (first: any, second: any): boolean { if (typeof first === "string" && typeof second === "string") { return first[0] === second[1]; } @@ -983,6 +1014,54 @@ describe("Randomize Tests", () => { }); }); +//dest spces copied from jasmine project (https://github.com/jasmine/jasmine/blob/master/spec/core/SpecSpec.js) +describe("createSpyObj", function () { + it("should create an object with spy methods and corresponding return values when you call jasmine.createSpyObj() with an object", function () { + var spyObj = jasmine.createSpyObj('BaseName', { 'method1': 42, 'method2': 'special sauce' }); + + expect(spyObj.method1()).toEqual(42); + expect(spyObj.method1.and.identity()).toEqual('BaseName.method1'); + + expect(spyObj.method2()).toEqual('special sauce'); + expect(spyObj.method2.and.identity()).toEqual('BaseName.method2'); + }); + + + it("should create an object with a bunch of spy methods when you call jasmine.createSpyObj()", function () { + var spyObj = jasmine.createSpyObj('BaseName', ['method1', 'method2']); + + expect(spyObj).toEqual({ method1: jasmine.any(Function), method2: jasmine.any(Function) }); + expect(spyObj.method1.and.identity()).toEqual('BaseName.method1'); + expect(spyObj.method2.and.identity()).toEqual('BaseName.method2'); + }); + + it("should allow you to omit the baseName", function () { + var spyObj = jasmine.createSpyObj(['method1', 'method2']); + + expect(spyObj).toEqual({ method1: jasmine.any(Function), method2: jasmine.any(Function) }); + expect(spyObj.method1.and.identity()).toEqual('unknown.method1'); + expect(spyObj.method2.and.identity()).toEqual('unknown.method2'); + }); + + it("should throw if you do not pass an array or object argument", function () { + expect(function () { + jasmine.createSpyObj('BaseName'); + }).toThrow("createSpyObj requires a non-empty array or object of method names to create spies for"); + }); + + it("should throw if you pass an empty array argument", function () { + expect(function () { + jasmine.createSpyObj('BaseName', []); + }).toThrow("createSpyObj requires a non-empty array or object of method names to create spies for"); + }); + + it("should throw if you pass an empty object argument", function () { + expect(function () { + jasmine.createSpyObj('BaseName', {}); + }).toThrow("createSpyObj requires a non-empty array or object of method names to create spies for"); + }); +}); + (() => { // from boot.js var env = jasmine.getEnv(); @@ -1007,4 +1086,4 @@ describe("Randomize Tests", () => { })(); jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; -jasmine.MAX_PRETTY_PRINT_DEPTH = 40; \ No newline at end of file +jasmine.MAX_PRETTY_PRINT_DEPTH = 40; diff --git a/types/javascript-state-machine/index.d.ts b/types/javascript-state-machine/index.d.ts new file mode 100644 index 0000000000..32088d7bd4 --- /dev/null +++ b/types/javascript-state-machine/index.d.ts @@ -0,0 +1,105 @@ +// Type definitions for Finite State Machine 2.4 +// Project: https://github.com/jakesgordon/javascript-state-machine +// Definitions by: Boris Yankov , +// Maarten Docter , +// William Sears , +// samael , +// taoqf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export type StateMachineErrorCallback = ( + eventName?: string, + from?: string, + to?: string, + args?: any[], + errorCode?: number, + errorMessage?: string, + ex?: Error +) => void; // NB. errorCode? See: StateMachine.Error + +export interface StateMachineEventDef { + name: string; + from: any; // string or string[] + to: string; +} + +export type StateMachineEvent = (...args: any[]) => void; + +export interface StateMachineConfig { + initial?: any; // string or { state: 'foo', event: 'setup', defer: true|false } + events?: StateMachineEventDef[]; + callbacks?: { + [s: string]: (event?: string, from?: string, to?: string, ...args: any[]) => any; + }; + target?: StateMachine; + error?: StateMachineErrorCallback; +} + +export type StateMachineIsFinished = (state: string) => boolean; + +export const VERSION: string; // = "2.4.0" +export const WILDCARD: string; // = '*' +export const ASYNC: string; // = 'async' + +export const Result: { + SUCCEEDED: number; // = 1, the event transitioned successfully from one state to another + NOTRANSITION: number; // = 2, the event was successfull but no state transition was necessary + CANCELLED: number; // = 3, the event was cancelled by the caller in a beforeEvent callback + PENDING: number; // = 4, the event is asynchronous and the caller is in control of when the transition occurs +}; + +export const Error: { + INVALID_TRANSITION: number; // = 100, caller tried to fire an event that was innapropriate in the current state + PENDING_TRANSITION: number; // = 200, caller tried to fire an event while an async transition was still pending + INVALID_CALLBACK: number; // = 300, caller provided callback function threw an exception +}; + +export function create(config: StateMachineConfig, target?: StateMachine): StateMachine; + +export interface StateMachineTransition { + (): void; + cancel(): void; +} + +export type StateMachineIs = (state: string) => boolean; + +export type StateMachineCan = (evt: string) => boolean; + +export type StateMachineTransitions = () => string[]; + +export interface StateMachine { + current: string; + is: StateMachineIs; + can: StateMachineCan; + cannot: StateMachineCan; + error: StateMachineErrorCallback; + isFinished: StateMachineIsFinished; + /* transition - only available when performing async state transitions; otherwise null. Can be a: + [1] fsm.transition(); // called from async callback + [2] fsm.transition.cancel(); + */ + transition: StateMachineTransition; + transitions: StateMachineTransitions; +} + +export namespace StateMachine { + const VERSION: string; // = "2.4.0" + const WILDCARD: string; // = '*' + const ASYNC: string; // = 'async' + + const Result: { + SUCCEEDED: number; // = 1, the event transitioned successfully from one state to another + NOTRANSITION: number; // = 2, the event was successfull but no state transition was necessary + CANCELLED: number; // = 3, the event was cancelled by the caller in a beforeEvent callback + PENDING: number; // = 4, the event is asynchronous and the caller is in control of when the transition occurs + }; + + const Error: { + INVALID_TRANSITION: number; // = 100, caller tried to fire an event that was innapropriate in the current state + PENDING_TRANSITION: number; // = 200, caller tried to fire an event while an async transition was still pending + INVALID_CALLBACK: number; // = 300, caller provided callback function threw an exception + }; + function create(config: StateMachineConfig, target?: StateMachine): StateMachine; +} + +export as namespace StateMachine; diff --git a/types/javascript-state-machine/javascript-state-machine-tests.ts b/types/javascript-state-machine/javascript-state-machine-tests.ts new file mode 100644 index 0000000000..099926acf4 --- /dev/null +++ b/types/javascript-state-machine/javascript-state-machine-tests.ts @@ -0,0 +1,32 @@ +import { StateMachine, StateMachineEvent, create } from 'javascript-state-machine'; + +interface StateMachineTest extends StateMachine { + warn?: StateMachineEvent; + panic?: StateMachineEvent; + calm?: StateMachineEvent; + clear?: StateMachineEvent; +} + +const fsm: StateMachineTest = StateMachine.create({ + initial: 'green', + events: [ + { name: 'warn', from: 'green', to: 'yellow' }, + { name: 'panic', from: 'yellow', to: 'red' }, + { name: 'calm', from: 'red', to: 'yellow' }, + { name: 'clear', from: 'yellow', to: 'green' } + ], + callbacks: { + onpanic(event?, from?, to?, msg?) { alert('panic! ' + msg); }, + onclear(event?, from?, to?, msg?) { alert('thanks to ' + msg); }, + ongreen(event?, from?, to?) { document.body.className = 'green'; }, + onyellow(event?, from?, to?) { document.body.className = 'yellow'; }, + onred(event?, from?, to?) { document.body.className = 'red'; }, + } +}); + +// fsm.warn(); // transition from green to yellow +// fsm.panic("ERROR ALERT"); // transition from yellow to red +// fsm.calm(); // transition from red to yellow +// fsm.clear("All clear"); // transition from yellow to green + +const transitions = fsm.transitions(); diff --git a/types/state-machine/tsconfig.json b/types/javascript-state-machine/tsconfig.json similarity index 90% rename from types/state-machine/tsconfig.json rename to types/javascript-state-machine/tsconfig.json index 3d1eaef3f7..45c4f171fb 100644 --- a/types/state-machine/tsconfig.json +++ b/types/javascript-state-machine/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "state-machine-tests.ts" + "javascript-state-machine-tests.ts" ] } \ No newline at end of file diff --git a/types/javascript-state-machine/tslint.json b/types/javascript-state-machine/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/javascript-state-machine/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/jest-matchers/index.d.ts b/types/jest-matchers/index.d.ts new file mode 100644 index 0000000000..27e6a5b9f0 --- /dev/null +++ b/types/jest-matchers/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for jest-matchers 20.0 +// Project: https://github.com/facebook/jest#readme +// Definitions by: Joscha Feth +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +export = expect; diff --git a/types/jest-matchers/jest-matchers-tests.ts b/types/jest-matchers/jest-matchers-tests.ts new file mode 100644 index 0000000000..7484dd5ed8 --- /dev/null +++ b/types/jest-matchers/jest-matchers-tests.ts @@ -0,0 +1,3 @@ +import * as expect from 'jest-matchers'; + +expect('x').toEqual('x'); diff --git a/types/jest-matchers/tsconfig.json b/types/jest-matchers/tsconfig.json new file mode 100644 index 0000000000..37a7e86d8d --- /dev/null +++ b/types/jest-matchers/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jest-matchers-tests.ts" + ] +} diff --git a/types/jest-matchers/tslint.json b/types/jest-matchers/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jest-matchers/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 595a42ea2b..9297ebfced 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -152,6 +152,44 @@ declare namespace jest { [key: string]: (this: MatcherUtils, received: any, actual: any) => { message: () => string, pass: boolean }; } + interface SnapshotSerializerOptions { + callToJSON?: boolean; + edgeSpacing?: string; + spacing?: string; + escapeRegex?: boolean; + highlight?: boolean; + indent?: number; + maxDepth?: number; + min?: boolean; + plugins?: Array + printFunctionName?: boolean; + theme?: SnapshotSerializerOptionsTheme; + + // see https://github.com/facebook/jest/blob/e56103cf142d2e87542ddfb6bd892bcee262c0e6/types/PrettyFormat.js + } + interface SnapshotSerializerOptionsTheme { + comment?: string; + content?: string; + prop?: string; + tag?: string; + value?: string; + } + interface SnapshotSerializerColor { + close: string; + open: string; + } + interface SnapshotSerializerColors { + comment: SnapshotSerializerColor; + content: SnapshotSerializerColor; + prop: SnapshotSerializerColor; + tag: SnapshotSerializerColor; + value: SnapshotSerializerColor; + } + interface SnapshotSerializerPlugin { + print(val:any, serialize:((val:any) => string), indent:((str:string) => string), opts:SnapshotSerializerOptions, colors: SnapshotSerializerColors) : string; + test(val:any) : boolean; + } + /** The `expect` function is used every time you want to test a value. You will rarely call `expect` by itself. */ interface Expect { /** @@ -169,6 +207,8 @@ declare namespace jest { assertions(num: number): void; /** You can use `expect.extend` to add your own matchers to Jest. */ extend(obj: ExpectExtendMap): void; + /** Adds a module to format application-specific data structures for serialization. */ + addSnapshotSerializer(serializer: SnapshotSerializerPlugin) : void; /** Matches any object that recursively matches the provided keys. This is often handy in conjunction with other asymmetric matchers. */ objectContaining(obj: {}): any; /** Matches any string that contains the exact provided string */ @@ -291,6 +331,7 @@ declare function pending(reason?: string): void; /** Fails a test when called within one. */ declare function fail(error?: any): void; declare namespace jasmine { + var DEFAULT_TIMEOUT_INTERVAL: number; var clock: () => Clock; function any(aclass: any): Any; function anything(): Any; diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index d951153842..d8f6d54dfd 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -335,6 +335,30 @@ describe('toThrowErrorMatchingSnapshot', function () { }); }); +const testSerializerPluginString = "set by testSerializerPlugin"; +let testSerializerPluginCallCount = 0; +expect.addSnapshotSerializer({ + print(val, serialize, indent, opts, colors) { + val.willOverwrite = testSerializerPluginString; + testSerializerPluginCallCount += 1; + return 'plugin called: ' + serialize(val.willOverwrite); + }, + test(val) { + return val && val.willOverwrite && val.willOverwrite !== testSerializerPluginString; + }, +}); +describe('addSnapshotSerializer', function () { + it('the plugin does its work', function () { + testSerializerPluginCallCount = 0; + expect({ willOverwrite: { x: 1, y: 2, } }).toMatchSnapshot(); + expect({ willOverwrite: "this will get overwritten by testSerializerPlugin" }).toMatchSnapshot(); + expect({ willOverwrite: "so will this" }).toMatchSnapshot(); + expect({ foo: "this will not" }).toMatchSnapshot(); + expect(testSerializerPluginCallCount).toBe(3); + }); +}); + + function testInstances() { var mockFn = jest.fn(); var a = new mockFn(); diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index c11bcb9daf..fb3547b3e4 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for joi v10.3.0 +// Type definitions for joi v10.4.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 , Rytis Alekna , Pavel Ivanov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -146,7 +146,14 @@ export interface ValidationErrorItem { type: string; path: string; options?: ValidationOptions; - context?: any; + context?: { + [key: string]: any; + value?: any; + }; +} + +export interface ValidationErrorFunction { + (errors: ValidationErrorItem[]): string | ValidationErrorItem | ValidationErrorItem[] | Error; } export interface ValidationResult { @@ -167,6 +174,14 @@ export interface Reference extends Schema { } export interface AnySchema> { + /** + * Validates a value using the schema and options. + */ + validate(value: T): ValidationResult; + validate(value: T, options: ValidationOptions): ValidationResult; + validate(value: T, callback: (err: ValidationError, value: T) => R): R; + validate(value: T, options: ValidationOptions, callback: (err: ValidationError, value: T) => R): R; + /** * Whitelists a value */ @@ -305,14 +320,23 @@ export interface AnySchema> { /** * Overrides the default joi error with a custom error if the rule fails where: - * @param err - the override error. + * @param err - can be: + * an instance of `Error` - the override error. + * a `function(errors)`, taking an array of errors as argument, where it must either: + * return a `string` - substitutes the error message with this text + * return a single `object` or an `Array` of it, where: + * `type` - optional parameter providing the type of the error (eg. `number.min`). + * `message` - optional parameter if `template` is provided, containing the text of the error. + * `template` - optional parameter if `message` is provided, containing a template string, using the same format as usual joi language errors. + * `context` - optional parameter, to provide context to your error if you are using the `template`. + * return an `Error` - same as when you directly provide an `Error`, but you can customize the error message based on the errors. * - * 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). + * Note that if you provide an `Error`, it 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; + error?(err: Error | ValidationErrorFunction): T; } export interface BooleanSchema extends AnySchema { @@ -567,7 +591,8 @@ export interface ArraySchema extends AnySchema { * Be aware that a deep equality is performed on elements of the array having a type of object, * a performance penalty is to be expected for this kind of operation. */ - unique(): ArraySchema; + unique(comparator?: (a: any, b: any) => boolean): ArraySchema; + unique(comparator?: string): ArraySchema; } export interface ObjectSchema extends AnySchema { diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index f35a124183..67844d31b9 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -50,89 +50,95 @@ var ref: Joi.Reference = null; var validOpts: Joi.ValidationOptions = null; -validOpts = {abortEarly: bool}; -validOpts = {convert: bool}; -validOpts = {allowUnknown: bool}; -validOpts = {skipFunctions: bool}; -validOpts = {stripUnknown: bool}; -validOpts = {stripUnknown: {arrays: bool}}; -validOpts = {stripUnknown: {objects: bool}}; -validOpts = {stripUnknown: {arrays: bool, objects: bool}}; -validOpts = {language: bool}; -validOpts = {presence: str}; -validOpts = {context: obj}; -validOpts = {noDefaults: bool}; +validOpts = { abortEarly: bool }; +validOpts = { convert: bool }; +validOpts = { allowUnknown: bool }; +validOpts = { skipFunctions: bool }; +validOpts = { stripUnknown: bool }; +validOpts = { stripUnknown: { arrays: bool } }; +validOpts = { stripUnknown: { objects: bool } }; +validOpts = { stripUnknown: { arrays: bool, objects: bool } }; +validOpts = { language: bool }; +validOpts = { presence: str }; +validOpts = { context: obj }; +validOpts = { noDefaults: bool }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- var renOpts: Joi.RenameOptions = null; -renOpts = {alias: bool}; -renOpts = {multiple: bool}; -renOpts = {override: bool}; -renOpts = {ignoreUndefined: bool}; +renOpts = { alias: bool }; +renOpts = { multiple: bool }; +renOpts = { override: bool }; +renOpts = { ignoreUndefined: bool }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- var emailOpts: Joi.EmailOptions = null; -emailOpts = {errorLevel: num}; -emailOpts = {errorLevel: bool}; -emailOpts = {tldWhitelist: strArr}; -emailOpts = {tldWhitelist: obj}; -emailOpts = {minDomainAtoms: num}; +emailOpts = { errorLevel: num }; +emailOpts = { errorLevel: bool }; +emailOpts = { tldWhitelist: strArr }; +emailOpts = { tldWhitelist: obj }; +emailOpts = { minDomainAtoms: num }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- var ipOpts: Joi.IpOptions = null; -ipOpts = {version: str}; -ipOpts = {version: strArr}; -ipOpts = {cidr: str}; +ipOpts = { version: str }; +ipOpts = { version: strArr }; +ipOpts = { cidr: str }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- var uriOpts: Joi.UriOptions = null; -uriOpts = {scheme: str}; -uriOpts = {scheme: exp}; -uriOpts = {scheme: strArr}; -uriOpts = {scheme: expArr}; +uriOpts = { scheme: str }; +uriOpts = { scheme: exp }; +uriOpts = { scheme: strArr }; +uriOpts = { scheme: expArr }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- var whenOpts: Joi.WhenOptions = null; -whenOpts = {is: x}; -whenOpts = {is: schema, then: schema}; -whenOpts = {is: schema, otherwise: schema}; +whenOpts = { is: x }; +whenOpts = { is: schema, then: schema }; +whenOpts = { is: schema, otherwise: schema }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- var refOpts: Joi.ReferenceOptions = null; -refOpts = {separator: str}; -refOpts = {contextPrefix: str}; +refOpts = { separator: str }; +refOpts = { contextPrefix: str }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- var validErr: Joi.ValidationError = null; var validErrItem: Joi.ValidationErrorItem; +var validErrFunc: Joi.ValidationErrorFunction; -validErrItem= { - message: str, - type: str, - path: str +validErrItem = { + message: str, + type: str, + path: str }; validErrItem = { - message: str, - type: str, - path: str, - options: validOpts, - context: obj + message: str, + type: str, + path: str, + options: validOpts, + context: obj }; +validErrFunc = errs => errs; +validErrFunc = errs => errs[0]; +validErrFunc = errs => 'Some error'; +validErrFunc = errs => err; + // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- schema = anySchema; @@ -162,23 +168,23 @@ anySchema = objSchema; var schemaMap: Joi.SchemaMap = null; schemaMap = { - a: numSchema, - b: strSchema + a: numSchema, + b: strSchema }; schemaMap = { - a: numSchema, - b: { - b1: strSchema, - b2: anySchema - } + a: numSchema, + b: { + b1: strSchema, + b2: anySchema + } }; schemaMap = { - a: numSchema, - b: [ - { b1: strSchema }, - { b2: anySchema } - ], - c: arrSchema + a: numSchema, + b: [ + { b1: strSchema }, + { b2: anySchema } + ], + c: arrSchema }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -186,63 +192,64 @@ schemaMap = { anySchema = Joi.any(); namespace common { - anySchema = anySchema.allow(x); - anySchema = anySchema.allow(x, x); - anySchema = anySchema.allow([x, x, x]); - anySchema = anySchema.valid(x); - anySchema = anySchema.valid(x, x); - anySchema = anySchema.valid([x, x, x]); - anySchema = anySchema.only(x); - anySchema = anySchema.only(x, x); - anySchema = anySchema.only([x, x, x]); - anySchema = anySchema.equal(x); - anySchema = anySchema.equal(x, x); - anySchema = anySchema.equal([x, x, x]); - anySchema = anySchema.invalid(x); - anySchema = anySchema.invalid(x, x); - anySchema = anySchema.invalid([x, x, x]); - anySchema = anySchema.disallow(x); - anySchema = anySchema.disallow(x, x); - anySchema = anySchema.disallow([x, x, x]); - anySchema = anySchema.not(x); - anySchema = anySchema.not(x, x); - anySchema = anySchema.not([x, x, x]); + anySchema = anySchema.allow(x); + anySchema = anySchema.allow(x, x); + anySchema = anySchema.allow([x, x, x]); + anySchema = anySchema.valid(x); + anySchema = anySchema.valid(x, x); + anySchema = anySchema.valid([x, x, x]); + anySchema = anySchema.only(x); + anySchema = anySchema.only(x, x); + anySchema = anySchema.only([x, x, x]); + anySchema = anySchema.equal(x); + anySchema = anySchema.equal(x, x); + anySchema = anySchema.equal([x, x, x]); + anySchema = anySchema.invalid(x); + anySchema = anySchema.invalid(x, x); + anySchema = anySchema.invalid([x, x, x]); + anySchema = anySchema.disallow(x); + anySchema = anySchema.disallow(x, x); + anySchema = anySchema.disallow([x, x, x]); + anySchema = anySchema.not(x); + anySchema = anySchema.not(x, x); + anySchema = anySchema.not([x, x, x]); - anySchema = anySchema.default(); - anySchema = anySchema.default(x); - anySchema = anySchema.default(x, str); + anySchema = anySchema.default(); + anySchema = anySchema.default(x); + anySchema = anySchema.default(x, str); - anySchema = anySchema.required(); - anySchema = anySchema.optional(); - anySchema = anySchema.forbidden(); - anySchema = anySchema.strip(); + anySchema = anySchema.required(); + anySchema = anySchema.optional(); + anySchema = anySchema.forbidden(); + anySchema = anySchema.strip(); - anySchema = anySchema.description(str); - anySchema = anySchema.notes(str); - anySchema = anySchema.notes(strArr); - anySchema = anySchema.tags(str); - anySchema = anySchema.tags(strArr); + anySchema = anySchema.description(str); + anySchema = anySchema.notes(str); + anySchema = anySchema.notes(strArr); + anySchema = anySchema.tags(str); + anySchema = anySchema.tags(strArr); - anySchema = anySchema.meta(obj); - anySchema = anySchema.example(obj); - anySchema = anySchema.unit(str); + anySchema = anySchema.meta(obj); + anySchema = anySchema.example(obj); + anySchema = anySchema.unit(str); - anySchema = anySchema.options(validOpts); - anySchema = anySchema.strict(); - anySchema = anySchema.strict(bool); - anySchema = anySchema.concat(x); + anySchema = anySchema.options(validOpts); + anySchema = anySchema.strict(); + anySchema = anySchema.strict(bool); + anySchema = anySchema.concat(x); - altSchema = anySchema.when(str, whenOpts); - altSchema = anySchema.when(ref, whenOpts); + altSchema = anySchema.when(str, whenOpts); + altSchema = anySchema.when(ref, whenOpts); - anySchema = anySchema.label(str); - anySchema = anySchema.raw(); - anySchema = anySchema.raw(bool); - anySchema = anySchema.empty(); - anySchema = anySchema.empty(str); - anySchema = anySchema.empty(anySchema); + anySchema = anySchema.label(str); + anySchema = anySchema.raw(); + anySchema = anySchema.raw(bool); + anySchema = anySchema.empty(); + anySchema = anySchema.empty(str); + anySchema = anySchema.empty(anySchema); - anySchema = anySchema.error(err); + anySchema = anySchema.error(err); + anySchema = anySchema.error(validErrFunc); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -261,6 +268,8 @@ arrSchema = arrSchema.min(num); arrSchema = arrSchema.max(num); arrSchema = arrSchema.length(num); arrSchema = arrSchema.unique(); +arrSchema = arrSchema.unique((a, b) => a.test === b.test); +arrSchema = arrSchema.unique('customer.id'); arrSchema = arrSchema.items(numSchema); @@ -273,51 +282,51 @@ arrSchema = arrSchema.items([schemaMap, schemaMap]); // - - - - - - - - namespace common_copy_paste { - // use search & replace from any - arrSchema = arrSchema.allow(x); - arrSchema = arrSchema.allow(x, x); - arrSchema = arrSchema.allow([x, x, x]); - arrSchema = arrSchema.valid(x); - arrSchema = arrSchema.valid(x, x); - arrSchema = arrSchema.valid([x, x, x]); - arrSchema = arrSchema.only(x); - arrSchema = arrSchema.only(x, x); - arrSchema = arrSchema.only([x, x, x]); - arrSchema = arrSchema.equal(x); - arrSchema = arrSchema.equal(x, x); - arrSchema = arrSchema.equal([x, x, x]); - arrSchema = arrSchema.invalid(x); - arrSchema = arrSchema.invalid(x, x); - arrSchema = arrSchema.invalid([x, x, x]); - arrSchema = arrSchema.disallow(x); - arrSchema = arrSchema.disallow(x, x); - arrSchema = arrSchema.disallow([x, x, x]); - arrSchema = arrSchema.not(x); - arrSchema = arrSchema.not(x, x); - arrSchema = arrSchema.not([x, x, x]); + // use search & replace from any + arrSchema = arrSchema.allow(x); + arrSchema = arrSchema.allow(x, x); + arrSchema = arrSchema.allow([x, x, x]); + arrSchema = arrSchema.valid(x); + arrSchema = arrSchema.valid(x, x); + arrSchema = arrSchema.valid([x, x, x]); + arrSchema = arrSchema.only(x); + arrSchema = arrSchema.only(x, x); + arrSchema = arrSchema.only([x, x, x]); + arrSchema = arrSchema.equal(x); + arrSchema = arrSchema.equal(x, x); + arrSchema = arrSchema.equal([x, x, x]); + arrSchema = arrSchema.invalid(x); + arrSchema = arrSchema.invalid(x, x); + arrSchema = arrSchema.invalid([x, x, x]); + arrSchema = arrSchema.disallow(x); + arrSchema = arrSchema.disallow(x, x); + arrSchema = arrSchema.disallow([x, x, x]); + arrSchema = arrSchema.not(x); + arrSchema = arrSchema.not(x, x); + arrSchema = arrSchema.not([x, x, x]); - arrSchema = arrSchema.default(x); + arrSchema = arrSchema.default(x); - arrSchema = arrSchema.required(); - arrSchema = arrSchema.optional(); - arrSchema = arrSchema.forbidden(); + arrSchema = arrSchema.required(); + arrSchema = arrSchema.optional(); + arrSchema = arrSchema.forbidden(); - arrSchema = arrSchema.description(str); - arrSchema = arrSchema.notes(str); - arrSchema = arrSchema.notes(strArr); - arrSchema = arrSchema.tags(str); - arrSchema = arrSchema.tags(strArr); + arrSchema = arrSchema.description(str); + arrSchema = arrSchema.notes(str); + arrSchema = arrSchema.notes(strArr); + arrSchema = arrSchema.tags(str); + arrSchema = arrSchema.tags(strArr); - arrSchema = arrSchema.meta(obj); - arrSchema = arrSchema.example(obj); - arrSchema = arrSchema.unit(str); + arrSchema = arrSchema.meta(obj); + arrSchema = arrSchema.example(obj); + arrSchema = arrSchema.unit(str); - arrSchema = arrSchema.options(validOpts); - arrSchema = arrSchema.strict(); - arrSchema = arrSchema.concat(x); + arrSchema = arrSchema.options(validOpts); + arrSchema = arrSchema.strict(); + arrSchema = arrSchema.concat(x); - altSchema = arrSchema.when(str, whenOpts); - altSchema = arrSchema.when(ref, whenOpts); + altSchema = arrSchema.when(str, whenOpts); + altSchema = arrSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -326,68 +335,68 @@ boolSchema = Joi.bool(); boolSchema = Joi.boolean(); namespace common_copy_paste { - boolSchema = boolSchema.allow(x); - boolSchema = boolSchema.allow(x, x); - boolSchema = boolSchema.allow([x, x, x]); - boolSchema = boolSchema.valid(x); - boolSchema = boolSchema.valid(x, x); - boolSchema = boolSchema.valid([x, x, x]); - boolSchema = boolSchema.only(x); - boolSchema = boolSchema.only(x, x); - boolSchema = boolSchema.only([x, x, x]); - boolSchema = boolSchema.equal(x); - boolSchema = boolSchema.equal(x, x); - boolSchema = boolSchema.equal([x, x, x]); - boolSchema = boolSchema.invalid(x); - boolSchema = boolSchema.invalid(x, x); - boolSchema = boolSchema.invalid([x, x, x]); - boolSchema = boolSchema.disallow(x); - boolSchema = boolSchema.disallow(x, x); - boolSchema = boolSchema.disallow([x, x, x]); - boolSchema = boolSchema.not(x); - boolSchema = boolSchema.not(x, x); - boolSchema = boolSchema.not([x, x, x]); + boolSchema = boolSchema.allow(x); + boolSchema = boolSchema.allow(x, x); + boolSchema = boolSchema.allow([x, x, x]); + boolSchema = boolSchema.valid(x); + boolSchema = boolSchema.valid(x, x); + boolSchema = boolSchema.valid([x, x, x]); + boolSchema = boolSchema.only(x); + boolSchema = boolSchema.only(x, x); + boolSchema = boolSchema.only([x, x, x]); + boolSchema = boolSchema.equal(x); + boolSchema = boolSchema.equal(x, x); + boolSchema = boolSchema.equal([x, x, x]); + boolSchema = boolSchema.invalid(x); + boolSchema = boolSchema.invalid(x, x); + boolSchema = boolSchema.invalid([x, x, x]); + boolSchema = boolSchema.disallow(x); + boolSchema = boolSchema.disallow(x, x); + boolSchema = boolSchema.disallow([x, x, x]); + boolSchema = boolSchema.not(x); + boolSchema = boolSchema.not(x, x); + boolSchema = boolSchema.not([x, x, x]); - boolSchema = boolSchema.default(x); + boolSchema = boolSchema.default(x); - boolSchema = boolSchema.required(); - boolSchema = boolSchema.optional(); - boolSchema = boolSchema.forbidden(); + boolSchema = boolSchema.required(); + boolSchema = boolSchema.optional(); + boolSchema = boolSchema.forbidden(); - boolSchema = boolSchema.description(str); - boolSchema = boolSchema.notes(str); - boolSchema = boolSchema.notes(strArr); - boolSchema = boolSchema.tags(str); - boolSchema = boolSchema.tags(strArr); + boolSchema = boolSchema.description(str); + boolSchema = boolSchema.notes(str); + boolSchema = boolSchema.notes(strArr); + boolSchema = boolSchema.tags(str); + boolSchema = boolSchema.tags(strArr); - boolSchema = boolSchema.meta(obj); - boolSchema = boolSchema.example(obj); - boolSchema = boolSchema.unit(str); + boolSchema = boolSchema.meta(obj); + boolSchema = boolSchema.example(obj); + boolSchema = boolSchema.unit(str); - boolSchema = boolSchema.options(validOpts); - boolSchema = boolSchema.strict(); - boolSchema = boolSchema.concat(x); + boolSchema = boolSchema.options(validOpts); + boolSchema = boolSchema.strict(); + boolSchema = boolSchema.concat(x); - boolSchema = boolSchema.truthy(str); - boolSchema = boolSchema.truthy(num); - boolSchema = boolSchema.truthy(strArr); - boolSchema = boolSchema.truthy(numArr); - boolSchema = boolSchema.truthy(str, str); - boolSchema = boolSchema.truthy(strArr, str); - boolSchema = boolSchema.truthy(str, strArr); - boolSchema = boolSchema.truthy(strArr, strArr); - boolSchema = boolSchema.falsy(str); - boolSchema = boolSchema.falsy(num); - boolSchema = boolSchema.falsy(strArr); - boolSchema = boolSchema.falsy(numArr); - boolSchema = boolSchema.falsy(str, str); - boolSchema = boolSchema.falsy(strArr, str); - boolSchema = boolSchema.falsy(str, strArr); - boolSchema = boolSchema.falsy(strArr, strArr); - boolSchema = boolSchema.insensitive(bool); + boolSchema = boolSchema.truthy(str); + boolSchema = boolSchema.truthy(num); + boolSchema = boolSchema.truthy(strArr); + boolSchema = boolSchema.truthy(numArr); + boolSchema = boolSchema.truthy(str, str); + boolSchema = boolSchema.truthy(strArr, str); + boolSchema = boolSchema.truthy(str, strArr); + boolSchema = boolSchema.truthy(strArr, strArr); + boolSchema = boolSchema.falsy(str); + boolSchema = boolSchema.falsy(num); + boolSchema = boolSchema.falsy(strArr); + boolSchema = boolSchema.falsy(numArr); + boolSchema = boolSchema.falsy(str, str); + boolSchema = boolSchema.falsy(strArr, str); + boolSchema = boolSchema.falsy(str, strArr); + boolSchema = boolSchema.falsy(strArr, strArr); + boolSchema = boolSchema.insensitive(bool); - altSchema = boolSchema.when(str, whenOpts); - altSchema = boolSchema.when(ref, whenOpts); + altSchema = boolSchema.when(str, whenOpts); + altSchema = boolSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -400,50 +409,50 @@ binSchema = binSchema.max(num); binSchema = binSchema.length(num); namespace common { - binSchema = binSchema.allow(x); - binSchema = binSchema.allow(x, x); - binSchema = binSchema.allow([x, x, x]); - binSchema = binSchema.valid(x); - binSchema = binSchema.valid(x, x); - binSchema = binSchema.valid([x, x, x]); - binSchema = binSchema.only(x); - binSchema = binSchema.only(x, x); - binSchema = binSchema.only([x, x, x]); - binSchema = binSchema.equal(x); - binSchema = binSchema.equal(x, x); - binSchema = binSchema.equal([x, x, x]); - binSchema = binSchema.invalid(x); - binSchema = binSchema.invalid(x, x); - binSchema = binSchema.invalid([x, x, x]); - binSchema = binSchema.disallow(x); - binSchema = binSchema.disallow(x, x); - binSchema = binSchema.disallow([x, x, x]); - binSchema = binSchema.not(x); - binSchema = binSchema.not(x, x); - binSchema = binSchema.not([x, x, x]); + binSchema = binSchema.allow(x); + binSchema = binSchema.allow(x, x); + binSchema = binSchema.allow([x, x, x]); + binSchema = binSchema.valid(x); + binSchema = binSchema.valid(x, x); + binSchema = binSchema.valid([x, x, x]); + binSchema = binSchema.only(x); + binSchema = binSchema.only(x, x); + binSchema = binSchema.only([x, x, x]); + binSchema = binSchema.equal(x); + binSchema = binSchema.equal(x, x); + binSchema = binSchema.equal([x, x, x]); + binSchema = binSchema.invalid(x); + binSchema = binSchema.invalid(x, x); + binSchema = binSchema.invalid([x, x, x]); + binSchema = binSchema.disallow(x); + binSchema = binSchema.disallow(x, x); + binSchema = binSchema.disallow([x, x, x]); + binSchema = binSchema.not(x); + binSchema = binSchema.not(x, x); + binSchema = binSchema.not([x, x, x]); - binSchema = binSchema.default(x); + binSchema = binSchema.default(x); - binSchema = binSchema.required(); - binSchema = binSchema.optional(); - binSchema = binSchema.forbidden(); + binSchema = binSchema.required(); + binSchema = binSchema.optional(); + binSchema = binSchema.forbidden(); - binSchema = binSchema.description(str); - binSchema = binSchema.notes(str); - binSchema = binSchema.notes(strArr); - binSchema = binSchema.tags(str); - binSchema = binSchema.tags(strArr); + binSchema = binSchema.description(str); + binSchema = binSchema.notes(str); + binSchema = binSchema.notes(strArr); + binSchema = binSchema.tags(str); + binSchema = binSchema.tags(strArr); - binSchema = binSchema.meta(obj); - binSchema = binSchema.example(obj); - binSchema = binSchema.unit(str); + binSchema = binSchema.meta(obj); + binSchema = binSchema.example(obj); + binSchema = binSchema.unit(str); - binSchema = binSchema.options(validOpts); - binSchema = binSchema.strict(); - binSchema = binSchema.concat(x); + binSchema = binSchema.options(validOpts); + binSchema = binSchema.strict(); + binSchema = binSchema.concat(x); - altSchema = binSchema.when(str, whenOpts); - altSchema = binSchema.when(ref, whenOpts); + altSchema = binSchema.when(str, whenOpts); + altSchema = binSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -472,50 +481,50 @@ dateSchema = dateSchema.timestamp('javascript'); dateSchema = dateSchema.timestamp('unix'); namespace common { - dateSchema = dateSchema.allow(x); - dateSchema = dateSchema.allow(x, x); - dateSchema = dateSchema.allow([x, x, x]); - dateSchema = dateSchema.valid(x); - dateSchema = dateSchema.valid(x, x); - dateSchema = dateSchema.valid([x, x, x]); - dateSchema = dateSchema.only(x); - dateSchema = dateSchema.only(x, x); - dateSchema = dateSchema.only([x, x, x]); - dateSchema = dateSchema.equal(x); - dateSchema = dateSchema.equal(x, x); - dateSchema = dateSchema.equal([x, x, x]); - dateSchema = dateSchema.invalid(x); - dateSchema = dateSchema.invalid(x, x); - dateSchema = dateSchema.invalid([x, x, x]); - dateSchema = dateSchema.disallow(x); - dateSchema = dateSchema.disallow(x, x); - dateSchema = dateSchema.disallow([x, x, x]); - dateSchema = dateSchema.not(x); - dateSchema = dateSchema.not(x, x); - dateSchema = dateSchema.not([x, x, x]); + dateSchema = dateSchema.allow(x); + dateSchema = dateSchema.allow(x, x); + dateSchema = dateSchema.allow([x, x, x]); + dateSchema = dateSchema.valid(x); + dateSchema = dateSchema.valid(x, x); + dateSchema = dateSchema.valid([x, x, x]); + dateSchema = dateSchema.only(x); + dateSchema = dateSchema.only(x, x); + dateSchema = dateSchema.only([x, x, x]); + dateSchema = dateSchema.equal(x); + dateSchema = dateSchema.equal(x, x); + dateSchema = dateSchema.equal([x, x, x]); + dateSchema = dateSchema.invalid(x); + dateSchema = dateSchema.invalid(x, x); + dateSchema = dateSchema.invalid([x, x, x]); + dateSchema = dateSchema.disallow(x); + dateSchema = dateSchema.disallow(x, x); + dateSchema = dateSchema.disallow([x, x, x]); + dateSchema = dateSchema.not(x); + dateSchema = dateSchema.not(x, x); + dateSchema = dateSchema.not([x, x, x]); - dateSchema = dateSchema.default(x); + dateSchema = dateSchema.default(x); - dateSchema = dateSchema.required(); - dateSchema = dateSchema.optional(); - dateSchema = dateSchema.forbidden(); + dateSchema = dateSchema.required(); + dateSchema = dateSchema.optional(); + dateSchema = dateSchema.forbidden(); - dateSchema = dateSchema.description(str); - dateSchema = dateSchema.notes(str); - dateSchema = dateSchema.notes(strArr); - dateSchema = dateSchema.tags(str); - dateSchema = dateSchema.tags(strArr); + dateSchema = dateSchema.description(str); + dateSchema = dateSchema.notes(str); + dateSchema = dateSchema.notes(strArr); + dateSchema = dateSchema.tags(str); + dateSchema = dateSchema.tags(strArr); - dateSchema = dateSchema.meta(obj); - dateSchema = dateSchema.example(obj); - dateSchema = dateSchema.unit(str); + dateSchema = dateSchema.meta(obj); + dateSchema = dateSchema.example(obj); + dateSchema = dateSchema.unit(str); - dateSchema = dateSchema.options(validOpts); - dateSchema = dateSchema.strict(); - dateSchema = dateSchema.concat(x); + dateSchema = dateSchema.options(validOpts); + dateSchema = dateSchema.strict(); + dateSchema = dateSchema.concat(x); - altSchema = dateSchema.when(str, whenOpts); - altSchema = dateSchema.when(ref, whenOpts); + altSchema = dateSchema.when(str, whenOpts); + altSchema = dateSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -546,50 +555,50 @@ numSchema = numSchema.positive(); numSchema = numSchema.negative(); namespace common { - numSchema = numSchema.allow(x); - numSchema = numSchema.allow(x, x); - numSchema = numSchema.allow([x, x, x]); - numSchema = numSchema.valid(x); - numSchema = numSchema.valid(x, x); - numSchema = numSchema.valid([x, x, x]); - numSchema = numSchema.only(x); - numSchema = numSchema.only(x, x); - numSchema = numSchema.only([x, x, x]); - numSchema = numSchema.equal(x); - numSchema = numSchema.equal(x, x); - numSchema = numSchema.equal([x, x, x]); - numSchema = numSchema.invalid(x); - numSchema = numSchema.invalid(x, x); - numSchema = numSchema.invalid([x, x, x]); - numSchema = numSchema.disallow(x); - numSchema = numSchema.disallow(x, x); - numSchema = numSchema.disallow([x, x, x]); - numSchema = numSchema.not(x); - numSchema = numSchema.not(x, x); - numSchema = numSchema.not([x, x, x]); + numSchema = numSchema.allow(x); + numSchema = numSchema.allow(x, x); + numSchema = numSchema.allow([x, x, x]); + numSchema = numSchema.valid(x); + numSchema = numSchema.valid(x, x); + numSchema = numSchema.valid([x, x, x]); + numSchema = numSchema.only(x); + numSchema = numSchema.only(x, x); + numSchema = numSchema.only([x, x, x]); + numSchema = numSchema.equal(x); + numSchema = numSchema.equal(x, x); + numSchema = numSchema.equal([x, x, x]); + numSchema = numSchema.invalid(x); + numSchema = numSchema.invalid(x, x); + numSchema = numSchema.invalid([x, x, x]); + numSchema = numSchema.disallow(x); + numSchema = numSchema.disallow(x, x); + numSchema = numSchema.disallow([x, x, x]); + numSchema = numSchema.not(x); + numSchema = numSchema.not(x, x); + numSchema = numSchema.not([x, x, x]); - numSchema = numSchema.default(x); + numSchema = numSchema.default(x); - numSchema = numSchema.required(); - numSchema = numSchema.optional(); - numSchema = numSchema.forbidden(); + numSchema = numSchema.required(); + numSchema = numSchema.optional(); + numSchema = numSchema.forbidden(); - numSchema = numSchema.description(str); - numSchema = numSchema.notes(str); - numSchema = numSchema.notes(strArr); - numSchema = numSchema.tags(str); - numSchema = numSchema.tags(strArr); + numSchema = numSchema.description(str); + numSchema = numSchema.notes(str); + numSchema = numSchema.notes(strArr); + numSchema = numSchema.tags(str); + numSchema = numSchema.tags(strArr); - numSchema = numSchema.meta(obj); - numSchema = numSchema.example(obj); - numSchema = numSchema.unit(str); + numSchema = numSchema.meta(obj); + numSchema = numSchema.example(obj); + numSchema = numSchema.unit(str); - numSchema = numSchema.options(validOpts); - numSchema = numSchema.strict(); - numSchema = numSchema.concat(x); + numSchema = numSchema.options(validOpts); + numSchema = numSchema.strict(); + numSchema = numSchema.concat(x); - altSchema = numSchema.when(str, whenOpts); - altSchema = numSchema.when(ref, whenOpts); + altSchema = numSchema.when(str, whenOpts); + altSchema = numSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -655,50 +664,50 @@ objSchema = objSchema.optionalKeys(str, str); objSchema = objSchema.optionalKeys(strArr); namespace common { - objSchema = objSchema.allow(x); - objSchema = objSchema.allow(x, x); - objSchema = objSchema.allow([x, x, x]); - objSchema = objSchema.valid(x); - objSchema = objSchema.valid(x, x); - objSchema = objSchema.valid([x, x, x]); - objSchema = objSchema.only(x); - objSchema = objSchema.only(x, x); - objSchema = objSchema.only([x, x, x]); - objSchema = objSchema.equal(x); - objSchema = objSchema.equal(x, x); - objSchema = objSchema.equal([x, x, x]); - objSchema = objSchema.invalid(x); - objSchema = objSchema.invalid(x, x); - objSchema = objSchema.invalid([x, x, x]); - objSchema = objSchema.disallow(x); - objSchema = objSchema.disallow(x, x); - objSchema = objSchema.disallow([x, x, x]); - objSchema = objSchema.not(x); - objSchema = objSchema.not(x, x); - objSchema = objSchema.not([x, x, x]); + objSchema = objSchema.allow(x); + objSchema = objSchema.allow(x, x); + objSchema = objSchema.allow([x, x, x]); + objSchema = objSchema.valid(x); + objSchema = objSchema.valid(x, x); + objSchema = objSchema.valid([x, x, x]); + objSchema = objSchema.only(x); + objSchema = objSchema.only(x, x); + objSchema = objSchema.only([x, x, x]); + objSchema = objSchema.equal(x); + objSchema = objSchema.equal(x, x); + objSchema = objSchema.equal([x, x, x]); + objSchema = objSchema.invalid(x); + objSchema = objSchema.invalid(x, x); + objSchema = objSchema.invalid([x, x, x]); + objSchema = objSchema.disallow(x); + objSchema = objSchema.disallow(x, x); + objSchema = objSchema.disallow([x, x, x]); + objSchema = objSchema.not(x); + objSchema = objSchema.not(x, x); + objSchema = objSchema.not([x, x, x]); - objSchema = objSchema.default(x); + objSchema = objSchema.default(x); - objSchema = objSchema.required(); - objSchema = objSchema.optional(); - objSchema = objSchema.forbidden(); + objSchema = objSchema.required(); + objSchema = objSchema.optional(); + objSchema = objSchema.forbidden(); - objSchema = objSchema.description(str); - objSchema = objSchema.notes(str); - objSchema = objSchema.notes(strArr); - objSchema = objSchema.tags(str); - objSchema = objSchema.tags(strArr); + objSchema = objSchema.description(str); + objSchema = objSchema.notes(str); + objSchema = objSchema.notes(strArr); + objSchema = objSchema.tags(str); + objSchema = objSchema.tags(strArr); - objSchema = objSchema.meta(obj); - objSchema = objSchema.example(obj); - objSchema = objSchema.unit(str); + objSchema = objSchema.meta(obj); + objSchema = objSchema.example(obj); + objSchema = objSchema.unit(str); - objSchema = objSchema.options(validOpts); - objSchema = objSchema.strict(); - objSchema = objSchema.concat(x); + objSchema = objSchema.options(validOpts); + objSchema = objSchema.strict(); + objSchema = objSchema.concat(x); - altSchema = objSchema.when(str, whenOpts); - altSchema = objSchema.when(ref, whenOpts); + altSchema = objSchema.when(str, whenOpts); + altSchema = objSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -732,8 +741,8 @@ strSchema = strSchema.ip(ipOpts); strSchema = strSchema.uri(); strSchema = strSchema.uri(uriOpts); strSchema = strSchema.guid(); -strSchema = strSchema.guid({version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5']}); -strSchema = strSchema.guid({version: 'uuidv4'}); +strSchema = strSchema.guid({ version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5'] }); +strSchema = strSchema.guid({ version: 'uuidv4' }); strSchema = strSchema.hex(); strSchema = strSchema.hostname(); strSchema = strSchema.isoDate(); @@ -742,50 +751,50 @@ strSchema = strSchema.uppercase(); strSchema = strSchema.trim(); namespace common { - strSchema = strSchema.allow(x); - strSchema = strSchema.allow(x, x); - strSchema = strSchema.allow([x, x, x]); - strSchema = strSchema.valid(x); - strSchema = strSchema.valid(x, x); - strSchema = strSchema.valid([x, x, x]); - strSchema = strSchema.only(x); - strSchema = strSchema.only(x, x); - strSchema = strSchema.only([x, x, x]); - strSchema = strSchema.equal(x); - strSchema = strSchema.equal(x, x); - strSchema = strSchema.equal([x, x, x]); - strSchema = strSchema.invalid(x); - strSchema = strSchema.invalid(x, x); - strSchema = strSchema.invalid([x, x, x]); - strSchema = strSchema.disallow(x); - strSchema = strSchema.disallow(x, x); - strSchema = strSchema.disallow([x, x, x]); - strSchema = strSchema.not(x); - strSchema = strSchema.not(x, x); - strSchema = strSchema.not([x, x, x]); + strSchema = strSchema.allow(x); + strSchema = strSchema.allow(x, x); + strSchema = strSchema.allow([x, x, x]); + strSchema = strSchema.valid(x); + strSchema = strSchema.valid(x, x); + strSchema = strSchema.valid([x, x, x]); + strSchema = strSchema.only(x); + strSchema = strSchema.only(x, x); + strSchema = strSchema.only([x, x, x]); + strSchema = strSchema.equal(x); + strSchema = strSchema.equal(x, x); + strSchema = strSchema.equal([x, x, x]); + strSchema = strSchema.invalid(x); + strSchema = strSchema.invalid(x, x); + strSchema = strSchema.invalid([x, x, x]); + strSchema = strSchema.disallow(x); + strSchema = strSchema.disallow(x, x); + strSchema = strSchema.disallow([x, x, x]); + strSchema = strSchema.not(x); + strSchema = strSchema.not(x, x); + strSchema = strSchema.not([x, x, x]); - strSchema = strSchema.default(x); + strSchema = strSchema.default(x); - strSchema = strSchema.required(); - strSchema = strSchema.optional(); - strSchema = strSchema.forbidden(); + strSchema = strSchema.required(); + strSchema = strSchema.optional(); + strSchema = strSchema.forbidden(); - strSchema = strSchema.description(str); - strSchema = strSchema.notes(str); - strSchema = strSchema.notes(strArr); - strSchema = strSchema.tags(str); - strSchema = strSchema.tags(strArr); + strSchema = strSchema.description(str); + strSchema = strSchema.notes(str); + strSchema = strSchema.notes(strArr); + strSchema = strSchema.tags(str); + strSchema = strSchema.tags(strArr); - strSchema = strSchema.meta(obj); - strSchema = strSchema.example(obj); - strSchema = strSchema.unit(str); + strSchema = strSchema.meta(obj); + strSchema = strSchema.example(obj); + strSchema = strSchema.unit(str); - strSchema = strSchema.options(validOpts); - strSchema = strSchema.strict(); - strSchema = strSchema.concat(x); + strSchema = strSchema.options(validOpts); + strSchema = strSchema.strict(); + strSchema = strSchema.concat(x); - altSchema = strSchema.when(str, whenOpts); - altSchema = strSchema.when(ref, whenOpts); + altSchema = strSchema.when(str, whenOpts); + altSchema = strSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -809,22 +818,22 @@ namespace validate_tests { 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; + 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) => { - x = value; - str = err.message; - str = err.details[0].path; - str = err.details[0].message; - str = err.details[0].type; + 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) => { - num = value; + num = value; }); // plain opts @@ -851,6 +860,11 @@ namespace validate_tests { returnValue = Joi.validate(value, obj, validOpts); value = Joi.validate(value, obj, validOpts, (err, value) => value); value = Joi.validate(value, schema, validOpts, (err, value) => value); + + returnValue = schema.validate(value); + returnValue = schema.validate(value, validOpts); + value = schema.validate(value, (err, value) => value); + value = schema.validate(value, validOpts, (err, value) => value); } } diff --git a/types/joigoose/index.d.ts b/types/joigoose/index.d.ts new file mode 100644 index 0000000000..e1d0fe9919 --- /dev/null +++ b/types/joigoose/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for joigoose 2.0 +// Project: https://github.com/yoitsro/joigoose +// Definitions by: Karoline +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as Mongoose from "mongoose"; +import * as Joi from "joi"; + +declare namespace Joigoose { + interface Joigoose { + convert(schema: Joi.Schema): Mongoose.Schema; + } +} + +declare function Joigoose(mongoose: Mongoose.Mongoose, joiOptions?: Joi.ValidationOptions): Joigoose.Joigoose; + +export = Joigoose; diff --git a/types/joigoose/joigoose-tests.ts b/types/joigoose/joigoose-tests.ts new file mode 100644 index 0000000000..791a24ff4b --- /dev/null +++ b/types/joigoose/joigoose-tests.ts @@ -0,0 +1,9 @@ +import * as Joigoose from "joigoose"; +import * as Mongoose from "mongoose"; +import * as Joi from "joi"; + +let joigoose = Joigoose(Mongoose); +let options: Joi.ValidationOptions = {abortEarly: true}; +joigoose = Joigoose(Mongoose, options); + +let schema: Mongoose.Schema = joigoose.convert(Joi.object({aString: Joi.string()})); diff --git a/types/joigoose/tsconfig.json b/types/joigoose/tsconfig.json new file mode 100644 index 0000000000..0add07f5d7 --- /dev/null +++ b/types/joigoose/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "joigoose-tests.ts" + ] +} diff --git a/types/joigoose/tslint.json b/types/joigoose/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/joigoose/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/jpush-react-native/index.d.ts b/types/jpush-react-native/index.d.ts new file mode 100644 index 0000000000..fa604f3174 --- /dev/null +++ b/types/jpush-react-native/index.d.ts @@ -0,0 +1,122 @@ +// Type definitions for jpush-react-native 1.6 +// Project: https://github.com/jpush/jpush-react-native +// Definitions by: HuHuanming +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default class JPush { + /** + * Android only + * 初始化JPush 必须先初始化才能执行其他操作 + */ + static initPush(): void; + + /** + * Android + */ + static stopPush(): void; + + /** + * Android + */ + static resumePush(): void; + + /** + * Android + */ + static clearAllNotifications(): void; + + /** + * Android + */ + static clearNotificationById(id: string): void; + + /** + * Android + */ + static getInfo(cb: (map: any) => void): void; + + static setTags(tags: string[], successCallback: () => void, failedCallback: () => void): void; + + static setAlias(alias: string, successCallback: () => void, failedCallback: () => void): void; + + static setAliasAndTags(alias: string, tag: string[], successCallback: () => void, failedCallback: () => void): void; + + /** + * Android + */ + static setStyleBasic(): void; + + /** + * Android + */ + static setStyleCustom(): void; + + /** + * Android + */ + static addReceiveCustomMsgListener(cb: (message: string) => void): void; + + /** + * Android + */ + static removeReceiveCustomMsgListener(cb: any): void; + + /** + * Android + */ + static addReceiveNotificationListener(cb: (map: any) => void): void; + + /** + * Android + */ + static removeReceiveNotificationListener(cb: any): void; + + /** + * Android + */ + static addReceiveOpenNotificationListener(cb: (message: string) => void): void; + + /** + * Android + */ + static removeReceiveOpenNotificationListener(cb: any): void; + + /** + * Android + * If device register succeed, the server will return registrationId + */ + static addGetRegistrationIdListener(cb: (registrationId: string) => void): void; + + static removeGetRegistrationIdListener(cb: any): void; + + /** + * iOS, Android + */ + static getRegistrationID(cb: (registrationId: string) => void): void; + + /** + * iOS + */ + static setupPush(): void; + + /** + * iOS + */ + static getAppkeyWithcallback(cb: (appKey: string) => void): void; + + // iOS Only + static setLocalNotification( + date: Date, + alertBody: string, + badge?: number, + alertAction?: string, + notificationKey?: string, + userInfo?: any, + soundName?: string + ): void; + + /** + * iOS + */ + static setBadge(badge: number, callback: (isSuccess: boolean) => void): void; +} diff --git a/types/jpush-react-native/jpush-react-native-tests.ts b/types/jpush-react-native/jpush-react-native-tests.ts new file mode 100644 index 0000000000..d1af013e11 --- /dev/null +++ b/types/jpush-react-native/jpush-react-native-tests.ts @@ -0,0 +1,77 @@ +import JPush from 'jpush-react-native'; + +JPush.initPush(); + +JPush.stopPush(); + +JPush.resumePush(); + +JPush.clearAllNotifications(); + +JPush.clearNotificationById('id'); + +JPush.getInfo((map) => {}); + +JPush.setTags( + ['tag1', 'tag2'], + () => {}, + () => {}, +); + +JPush.setAlias( + 'alias', + () => {}, + () => {}, +); + +JPush.setAliasAndTags( + 'alias', + ['tag1', 'tag2'], + () => { }, + () => { }, +); + +JPush.setStyleBasic(); + +JPush.setStyleCustom(); + +JPush.addReceiveCustomMsgListener(() => {}); + +JPush.removeReceiveCustomMsgListener(() => {}); + +JPush.addReceiveNotificationListener(() => {}); + +JPush.removeReceiveNotificationListener(() => {}); + +JPush.addReceiveOpenNotificationListener(() => {}); + +JPush.removeReceiveOpenNotificationListener(() => {}); + +JPush.addGetRegistrationIdListener((registrationId) => {}); + +JPush.removeGetRegistrationIdListener(() => {}); + +JPush.getRegistrationID((registrationId) => {}); + +JPush.setupPush(); + +JPush.getAppkeyWithcallback((appKey) => {}); + +JPush.setLocalNotification( + new Date(), + 'body', +); + +JPush.setLocalNotification( + new Date(), + 'body', + 2, + 'action', + 'key', + { + name: 'name', + }, + 'sound', +); + +JPush.setBadge(1, () => {}); diff --git a/types/jpush-react-native/tsconfig.json b/types/jpush-react-native/tsconfig.json new file mode 100644 index 0000000000..a789df247c --- /dev/null +++ b/types/jpush-react-native/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jpush-react-native-tests.ts" + ] +} diff --git a/types/jpush-react-native/tslint.json b/types/jpush-react-native/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/jpush-react-native/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/jquery-match-height/index.d.ts b/types/jquery-match-height/index.d.ts new file mode 100644 index 0000000000..e63fb30d4d --- /dev/null +++ b/types/jquery-match-height/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for jquery-match-height 0.7 +// Project: https://github.com/liabru/jquery-match-height +// Definitions by: Andrea Briganti +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +interface JQueryMatchHeight { + _throttle: number; + _maintainScroll: boolean; + _groups: any[]; + + /** + * Set all selected elements to the height of the tallest. + * If the items are on multiple rows, the items of each row will be set to the tallest of that row. + * + * @param options + */ + (options?: JQueryMatchHeight.Options): JQuery; + _update(): void; + _rows($item: JQuery): any[]; + _beforeUpdate(event: JQueryEventObject, groups: any[]): any; + _afterUpdate(event: JQueryEventObject, groups: any[]): any; + _apply(elements: any, options: any): void; +} + +declare namespace JQueryMatchHeight { + interface Options { + byRow?: boolean; + property?: string; + target?: string; + remove?: boolean; + } +} + +interface JQuery { + matchHeight: JQueryMatchHeight; +} diff --git a/types/jquery-match-height/jquery-match-height-tests.ts b/types/jquery-match-height/jquery-match-height-tests.ts new file mode 100644 index 0000000000..97467573b0 --- /dev/null +++ b/types/jquery-match-height/jquery-match-height-tests.ts @@ -0,0 +1,37 @@ +/* from documentation at https://github.com/liabru/jquery-match-height */ + +$(document).ready(() => { + $(".containers").matchHeight(); + $(".containers").matchHeight({ + byRow: true, + property: "height", + remove: true} + ); +}); + +$.fn.matchHeight._update(); + +$.fn.matchHeight._rows($('.containers')); + +$('.containers').matchHeight({ remove: true }); + +// tslint:disable-next-line no-used-variable +$.fn.matchHeight._beforeUpdate = (event, groups) => { + // do something before any updates are applied +}; + +// tslint:disable-next-line no-used-variable +$.fn.matchHeight._afterUpdate = (event, groups) => { + // do something after all updates are applied +}; + +let elements = $('.containers'); +let options = {byRow: true}; + +$.fn.matchHeight._apply(elements, options); + +$.fn.matchHeight._throttle = 80; + +$.fn.matchHeight._maintainScroll = true; + +$.fn.matchHeight._groups; diff --git a/types/jquery-match-height/tsconfig.json b/types/jquery-match-height/tsconfig.json new file mode 100644 index 0000000000..2dd28f9c69 --- /dev/null +++ b/types/jquery-match-height/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jquery-match-height-tests.ts" + ] +} diff --git a/types/jquery-match-height/tslint.json b/types/jquery-match-height/tslint.json new file mode 100644 index 0000000000..c9a409bbed --- /dev/null +++ b/types/jquery-match-height/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // This package uses the Function type, and it will take effort to fix. + "ban-types": false + } +} diff --git a/types/jquery.ajaxfile/index.d.ts b/types/jquery.ajaxfile/index.d.ts deleted file mode 100644 index 12ff53b389..0000000000 --- a/types/jquery.ajaxfile/index.d.ts +++ /dev/null @@ -1,116 +0,0 @@ -// Type definitions for jquery.ajaxfile v0.2.0 -// Project: https://github.com/fpellet/jquery.ajaxFile -// Definitions by: Florent PELLET -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// - -declare namespace JQueryAjaxFile { - export enum DataType { - Json, - Xml, - Text - } - - interface IFileData { - name: string; - element: HTMLInputElement; - } - - interface IOption { - method?: string; - url?: string; - - data?: any; - files?: IFileData[]; - desiredResponseDataType?: DataType; - - timeoutInSeconds?: number; - } - - interface IResponseStatus { - code: number; - text: string; - isSuccess: boolean; - } - - interface IAjaxFileResult { - error?: any; - data?: any; - status?: IResponseStatus; - } - - interface IAjaxFileResultCallback { - (result: IAjaxFileResult): void; - } - - interface IAjaxFilePromise { - then(success: IAjaxFileResultCallback, error?: IAjaxFileResultCallback): IAjaxFilePromise; - done(success: IAjaxFileResultCallback): IAjaxFilePromise; - fail(error: IAjaxFileResultCallback): IAjaxFilePromise; - always(error: IAjaxFileResultCallback): IAjaxFilePromise; - - abord(): void; - } - - interface IAjaxFileStatic { - DataType: typeof DataType; - send(option: IOption): IAjaxFilePromise; - } - - interface IJQueryXHR { - readyState: any; - status: number; - statusText: string; - responseXML: Document; - responseText: string; - statusCode?: { [key: string]: any; }; - - abort(statusText?: string): void; - - setRequestHeader(header: string, value: string): void; - getAllResponseHeaders(): string; - getResponseHeader(header: string): string; - - beforeSend?(jqXHR: IJQueryXHR, settings: JQueryAjaxSettings): any; - dataFilter?(data: any, ty: any): any; - success?(data: any, textStatus: string, jqXHR: IJQueryXHR): any; - error?(jqXHR: IJQueryXHR, textStatus: string, errorThrown: string): any; - complete?(jqXHR: IJQueryXHR, textStatus: string): any; - } - - interface IJQueryOption { - type?: string; - url?: string; - - data?: any; - files?: IFileData[]; - dataType?: string; - - timeout?: number; - - global?: boolean; - - error?(jqXHR: IJQueryXHR, textStatus: string, errorThrown: string): any; - success?(data: any, textStatus: string, jqXHR: IJQueryXHR): any; - complete?(jqXHR: IJQueryXHR, textStatus: string): any; - } - - interface IAjaxFileJQueryExtension { - ajaxWithFile(jqueryOption: IJQueryOption): JQueryDeferred; - } -} - -declare var AjaxFile: JQueryAjaxFile.IAjaxFileStatic; - -declare namespace AjaxFileKnockout { - interface IFileInputWrapper { - getElement(): HTMLInputElement; - fileSelected(): boolean; - } -} - -interface KnockoutBindingHandlers { - file: KnockoutBindingHandler; -} diff --git a/types/jquery.ajaxfile/jquery.ajaxfile-tests.ts b/types/jquery.ajaxfile/jquery.ajaxfile-tests.ts deleted file mode 100644 index 73bc6662dc..0000000000 --- a/types/jquery.ajaxfile/jquery.ajaxfile-tests.ts +++ /dev/null @@ -1,50 +0,0 @@ -function testRawApi(){ - var inputElement:HTMLInputElement = null; - var resultPromise = AjaxFile.send({ - method: 'POST', - url: '/', - desiredResponseDataType: JQueryAjaxFile.DataType.Json, - files: [ - { name: 'joeFile', element: inputElement } - ], - data: { - name: 'joe' - }, - timeoutInSeconds: 30 - }) - .then(result => console.log('Result: ' + result.data), result => console.log('Error: ' + result.error)) - .done(result => console.log('Result: ' + result.data)) - .fail(result => console.log('Error: ' + result.error + " " + result.status.code + " " + result.status.text + " " + result.status.isSuccess)) - .always(result => console.log('end')) - .abord(); -} - -function testJQuery() { - var inputElement: HTMLInputElement = null; - var extension: JQueryAjaxFile.IAjaxFileJQueryExtension = $.fn.ajaxWithFile; - var option: JQueryAjaxFile.IJQueryOption = { - type: 'POST', - url: '/', - dataType: "json", - files: [ - { name: 'joeFile', element: inputElement } - ], - data: { - name: 'joe' - }, - success(result) { console.log('Result: ' + result); }, - error(jqXhr, textStatus, errorThrown) { console.log('Error: ' + errorThrown); }, - complete(jqXhr, textStatus) { console.log('end'); }, - global: true, - timeout: 60 - }; - extension.ajaxWithFile(option); -} - -function testKnockoutExtension(){ - var fileHandler:KnockoutBindingHandler = ko.bindingHandlers.file; -} - -testKnockoutExtension(); -testJQuery(); -testRawApi(); \ No newline at end of file diff --git a/types/jquery.cycle/jquery.cycle-tests.ts b/types/jquery.cycle/jquery.cycle-tests.ts index df8ed24b22..bdcd70aa9d 100644 --- a/types/jquery.cycle/jquery.cycle-tests.ts +++ b/types/jquery.cycle/jquery.cycle-tests.ts @@ -259,7 +259,7 @@ $('#s6').cycle({ } }); -$.fn.cycle.transitions.pinch = function ($cont, $slides, opts) { +$.fn.cycle.transitions['pinch'] = function ($cont, $slides, opts) { var $el = $($slides[0]); var w = $el.width(); var h = $el.height(); diff --git a/types/jquery.growl/index.d.ts b/types/jquery.growl/index.d.ts new file mode 100644 index 0000000000..7b52ee311b --- /dev/null +++ b/types/jquery.growl/index.d.ts @@ -0,0 +1,40 @@ +// Type definitions for jquery.growl 1.3 +// Project: https://github.com/ksylvest/jquery-growl#readme +// Definitions by: Amir.h Yeganemehr +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace growl { + interface Options { + // Message + message: string; + // Title + title?: string; + // URL + url?: string; + // while hovering over the alert, prevent it from being dismissed (true | false - default: true) + delayOnHover?: boolean; + // the duration (in milliseconds) for which the alert is displayed (default: 3200) + duration?: number; + // whether the alert should be fixed rather than auto- dismissed(true | false - default: false) + fixed?: boolean; + // the alert's position ('tl' | 'tr' | 'bl' | 'br' | 'tc' | 'bc' - default: 'tr') + location?: string; + // the alert's size ('small' | 'medium' | 'large' - default: 'medium') + size?: string; + // the alert's style ('default' | 'error' | 'notice' | 'warning' - default: 'default') + style?: string; + } +} + +interface growl { + (options: growl.Options): void; + error(options: growl.Options): void; + notice(options: growl.Options): void; + warning(options: growl.Options): void; +} + +interface JQueryStatic { + growl: growl; +} diff --git a/types/jquery.growl/jquery.growl-tests.ts b/types/jquery.growl/jquery.growl-tests.ts new file mode 100644 index 0000000000..3391441bf1 --- /dev/null +++ b/types/jquery.growl/jquery.growl-tests.ts @@ -0,0 +1,4 @@ +$.growl({ title: "Growl", message: "The kitten is awake!" }); +$.growl.error({ message: "The kitten is attacking!" }); +$.growl.notice({ message: "The kitten is cute!" }); +$.growl.warning({ message: "The kitten is ugly!" }); diff --git a/types/jquery.growl/tsconfig.json b/types/jquery.growl/tsconfig.json new file mode 100644 index 0000000000..8eb3a19e35 --- /dev/null +++ b/types/jquery.growl/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jquery.growl-tests.ts" + ] +} diff --git a/types/jquery.growl/tslint.json b/types/jquery.growl/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jquery.growl/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/jquery.pnotify/index.d.ts b/types/jquery.pnotify/index.d.ts index 1d222efb26..3355f889ce 100644 --- a/types/jquery.pnotify/index.d.ts +++ b/types/jquery.pnotify/index.d.ts @@ -133,6 +133,10 @@ interface PNotifyOptions { * Whether to escape the content of the text. (Not allow HTML.) */ text_escape?: boolean; + /** + * Support for PNotifyconfirm options + */ + confirm?: PNotifyconfirm /** * What styling classes to use. (Can be either "brighttheme", "jqueryui", "bootstrap2", "bootstrap3", "fontawesome" or a custom style object) */ diff --git a/types/jquery.tooltipster/index.d.ts b/types/jquery.tooltipster/index.d.ts index 3534730ec4..5ef4debed4 100644 --- a/types/jquery.tooltipster/index.d.ts +++ b/types/jquery.tooltipster/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for jQuery Tooltipster 3.3.0 // Project: https://github.com/iamceege/tooltipster -// Definitions by: Patrick Magee , Dmitry Pesterev +// Definitions by: Patrick Magee , Dmitry Pesterev , Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -164,25 +164,6 @@ interface JQueryTooltipsterOptions { interface JQuery { - /** - * Initiate the Tooltipster plugin - */ - tooltipster(): JQuery; - - /** - * Creates a new tooltip with the specified, or default, options. - * @param options The options - * @example - * $('.tooltip').tooltipster({ - * animation: 'fade', - * delay: 200, - * theme: 'tooltipster-default', - * touchDevices: false, - * trigger: 'hover' - * }); - */ - tooltipster(options?: JQueryTooltipsterOptions): JQuery; - /** * Show a tooltip (the 'callback' argument is optional) * @param methodName show @@ -262,11 +243,35 @@ interface JQuery { */ tooltipster(methodName: "elementIcon"): JQuery; + /** + * Change default options for all future instances + * @param methodName setDefaults + * @param {object} options The options that should be made defaults + */ + tooltipster(methodName: 'setDefaults', options: JQueryTooltipsterOptions): JQuery; + /** * Generics */ - tooltipster(methodName: string, optionName: string, optionValue: string): JQuery; - tooltipster(methodName: string, param: string): JQuery; - tooltipster(methodName: string): JQuery; - tooltipster(methodName: string): string; + tooltipster(methodName: string, optionName: string, optionValue?: string): JQuery; + tooltipster(methodName: string): JQuery | string; + + /** + * Creates a new tooltip with the specified, or default, options. + * @param options The options + * @example + * $('.tooltip').tooltipster({ + * animation: 'fade', + * delay: 200, + * theme: 'tooltipster-default', + * touchDevices: false, + * trigger: 'hover' + * }); + */ + tooltipster(options?: JQueryTooltipsterOptions): JQuery; + + /** + * Initiate the Tooltipster plugin + */ + tooltipster(): JQuery; } diff --git a/types/jquery.validation/index.d.ts b/types/jquery.validation/index.d.ts index 9b77a80e23..5e0e2cfa01 100644 --- a/types/jquery.validation/index.d.ts +++ b/types/jquery.validation/index.d.ts @@ -10,7 +10,7 @@ declare namespace JQueryValidation { type ValidatePredicate = ((element: HTMLElement, event: JQueryEventObject) => void); - type ShouldValidatePredicate = boolean|ValidatePredicate; + type ShouldValidatePredicate = boolean | ValidatePredicate; interface ValidationOptions { /** @@ -218,7 +218,7 @@ declare namespace JQueryValidation { * * @param template The string to format. */ - format(template: string): ( (...args: any[]) => string); + format(template: string): ((...args: any[]) => string); format(template: string, ...args: any[]): string; /** * Modify default settings for validation. @@ -232,7 +232,7 @@ declare namespace JQueryValidation { } interface Validator { - element(element: string|JQuery): boolean; + element(element: string | JQuery): boolean; checkForm(): boolean; /** * Validates the form, returns true if it is valid, false otherwise. diff --git a/types/jquery.validation/jquery.validation-tests.ts b/types/jquery.validation/jquery.validation-tests.ts index 08bc439973..37273e0f51 100644 --- a/types/jquery.validation/jquery.validation-tests.ts +++ b/types/jquery.validation/jquery.validation-tests.ts @@ -15,8 +15,8 @@ function test_validate() { const errors = validator.numberOfInvalids(); if (errors) { const message = errors === 1 - ? 'You missed 1 field. It has been highlighted' - : 'You missed ' + errors + ' fields. They have been highlighted'; + ? 'You missed 1 field. It has been highlighted' + : 'You missed ' + errors + ' fields. They have been highlighted'; $("div.error span").html(message); $("div.error").show(); } else { @@ -56,7 +56,7 @@ function test_validate() { }, errorPlacement: (error, element) => { if (element.attr("name") === "fname" - || element.attr("name") === "lname") + || element.attr("name") === "lname") error.insertAfter("#lastname"); else error.insertAfter(element); @@ -84,7 +84,7 @@ function test_validate() { onclick: (elt) => { } }); $(".selector").validate({ - onfocusout: (elt, event) => { }, + onfocusout: (elt, event) => { }, onkeyup: (elt, event) => { }, onclick: (elt, event) => { } }); @@ -155,12 +155,12 @@ function test_validate() { highlight: (element: HTMLInputElement, errorClass, validClass) => { $(element).addClass(errorClass).removeClass(validClass); $(( element).form).find("label[for=" + element.id + "]") - .addClass(errorClass); + .addClass(errorClass); }, unhighlight: (element: HTMLInputElement, errorClass, validClass) => { $(element).removeClass(errorClass).addClass(validClass); $(( element).form).find("label[for=" + element.id + "]") - .removeClass(errorClass); + .removeClass(errorClass); } }); $(".selector").validate({ @@ -174,8 +174,8 @@ function test_validate() { onclick: false, }); $('.selector').validate({ - onfocusout: () => {}, - onkeyup: () => {}, + onfocusout: () => { }, + onkeyup: () => { }, onclick: elt => 2, }); } diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 0a47546193..a8b2895d6b 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -1,6 +1,26 @@ -// Type definitions for jQuery 1.10.x / 2.0.x +// Type definitions for jQuery 2.0 // Project: http://jquery.com/ -// Definitions by: Boris Yankov , Christian Hoffmeister , Steve Fenton , Diullei Gomes , Tass Iliopoulos , Jason Swearingen , Sean Hill , Guus Goossens , Kelly Summerlin , Basarat Ali Syed , Nicholas Wolverson , Derek Cicerone , Andrew Gaspar , James Harrison Fisher , Seikichi Kondo , Benjamin Jackman , Poul Sorensen , Josh Strobl , John Reilly , Dick van den Brink , Thomas Schulz +// Definitions by: Boris Yankov +// Christian Hoffmeister +// Steve Fenton +// Diullei Gomes +// Tass Iliopoulos +// Jason Swearingen +// Sean Hill +// Guus Goossens +// Kelly Summerlin +// Basarat Ali Syed +// Nicholas Wolverson +// Derek Cicerone +// Andrew Gaspar +// Seikichi Kondo +// Benjamin Jackman +// Poul Sorensen +// Josh Strobl +// John Reilly +// Dick van den Brink +// Thomas Schulz +// Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* ***************************************************************************** @@ -1146,7 +1166,7 @@ interface JQueryStatic { error(message: any): JQuery; expr: any; - fn: any; //TODO: Decide how we want to type this + readonly fn: JQuery; isReady: boolean; @@ -1657,6 +1677,14 @@ interface JQuery { * @see {@link https://api.jquery.com/css/#css-propertyName} */ css(propertyName: string): string; + /** + * Get the value of style properties for the first element in the set of matched elements. + * Results in an object of property-value pairs. + * + * @param propertyNames An array of one or more CSS properties. + * @see {@link https://api.jquery.com/css/#css-propertyNames} + */ + css(propertyNames: string[]): any; /** * Set one or more CSS properties for the set of matched elements. * @@ -2767,7 +2795,7 @@ interface JQuery { * @param data Data to be passed to the handler in event.data when an event occurs. * @see {@link https://api.jquery.com/on/#on-events-selector-data} */ - on(events: { [key: string]: any; }, selector?: string, data?: any): JQuery; + on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, selector?: string, data?: any): JQuery; /** * Attach an event handler function for one or more events to the selected elements. * @@ -2775,7 +2803,7 @@ interface JQuery { * @param data Data to be passed to the handler in event.data when an event occurs. * @see {@link https://api.jquery.com/on/#on-events-selector-data} */ - on(events: { [key: string]: any; }, data?: any): JQuery; + on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, data?: any): JQuery; /** * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. @@ -3347,7 +3375,6 @@ interface JQuery { * @see {@link https://api.jquery.com/selector/} */ selector: string; - [index: string]: any; [index: number]: HTMLElement; /** @@ -3774,6 +3801,14 @@ interface JQuery { * @see {@link https://api.jquery.com/queue/#queue-queueName-callback} */ queue(queueName: string, callback: Function): JQuery; + + /** + * Merge the contents of an object onto the jQuery prototype to provide new jQuery instance methods. + * + * @param object An object to merge onto the jQuery prototype. + * @see {@link https://api.jquery.com/jQuery.fn.extend/#jQuery-fn-extend-object} + */ + extend(object: { [method: string]: (...args: any[]) => any; }): JQuery; } declare module "jquery" { export = $; diff --git a/types/js-beautify/index.d.ts b/types/js-beautify/index.d.ts index 47fdd8292e..e73e013325 100644 --- a/types/js-beautify/index.d.ts +++ b/types/js-beautify/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for js_beautify // Project: https://github.com/beautify-web/js-beautify/ -// Definitions by: Josh Goldberg , Hans Windhoff +// Definitions by: Josh Goldberg , Hans Windhoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface JsBeautifyOptions { @@ -30,18 +30,20 @@ interface HTMLBeautifyOptions { indent_size?: number; indent_char?: string; indent_with_tabs?: boolean; + indent_handlebars?: boolean; eol?: string; end_with_newline?: boolean; preserve_newlines?: boolean; max_preserve_newlines?: number; indent_inner_html?: boolean; brace_style?: 'collapse-preserve-inline'|'collapse'|'expand'|'end-expand'|'none'; - indent_scripts?: boolean; + indent_scripts?: 'keep'|'separate'|'normal'; wrap_line_length?: number; wrap_attributes?: 'auto'|'force' ; wrap_attributes_indent_size?: number; - unformatted?: string; - extra_liners?: string; + unformatted?: string[]; + content_unformatted?: string[]; + extra_liners?: string|string[]; } interface CSSBeautifyOptions { @@ -50,7 +52,7 @@ interface CSSBeautifyOptions { indent_with_tabs?: boolean; eol?: string; end_with_newline?: boolean; - selector_separator_newline?: boolean; + selector_separator_newline?: boolean; newline_between_rules?: boolean; } @@ -61,7 +63,7 @@ interface jsb{ css:(js_source_text: string, options?: CSSBeautifyOptions) => string ; css_beautify:(js_source_text: string, options?: CSSBeautifyOptions) => string ; - + html:(js_source_text: string, options?: HTMLBeautifyOptions) => string ; html_beautify:(js_source_text: string, options?: HTMLBeautifyOptions) => string ; } diff --git a/types/js-data/js-data-tests.ts b/types/js-data/js-data-tests.ts index 9b77da72ac..12ebc9026d 100644 --- a/types/js-data/js-data-tests.ts +++ b/types/js-data/js-data-tests.ts @@ -30,7 +30,7 @@ User.find(1).then(function (user:IUser) { var user:IUser = User.createInstance({name: 'John'}); var store = new JSData.DS(); -var User2 = store.defineResource('user'); +var User2 = store.defineResource('user'); var user:IUser = User2.inject({id: 1, name: 'John'}); var user2:IUser = User2.inject({id: 1, age: 30}); @@ -601,4 +601,4 @@ customActionResourceInstance.on("DS.change", myEvtHandler); customActionResourceInstance.off("DS.change", myEvtHandler); customActionResourceInstance.emit("DS.change", customActionResource, customActionResourceInstance); -JSData.DSUtils.Promise = Promise; \ No newline at end of file +JSData.DSUtils.Promise = Promise; diff --git a/types/js-schema/index.d.ts b/types/js-schema/index.d.ts index 8c332b8181..adccce7809 100644 --- a/types/js-schema/index.d.ts +++ b/types/js-schema/index.d.ts @@ -1,21 +1,23 @@ // Type definitions for js-schema // Project: https://github.com/molnarg/js-schema -// Definitions by: Marcin Porebski +// Definitions by: Marcin Porebski , Robin Labat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'js-schema' { - export interface Schema - { - (obj: any): boolean; // test obj against the schema + function schema(definition: any): schema.Schema; + + namespace schema { + interface Schema { + (obj: any): boolean; // test obj against the schema + } } - export default function schema(definition: any): Schema + export = schema; } -interface NumberConstructor -{ +interface NumberConstructor { min(n: number): NumberConstructor; max(n: number): NumberConstructor; below(n: number): NumberConstructor; @@ -23,28 +25,24 @@ interface NumberConstructor step(n: number): NumberConstructor; } -interface StringConstructor -{ +interface StringConstructor { of(charset: string): StringConstructor; of(length: number, charset: string): StringConstructor; of(minLength: number, maxLength: number, charset: string): StringConstructor; } -interface ArrayConstructor -{ +interface ArrayConstructor { like(arr: Array): ArrayConstructor; of(pattern: any): ArrayConstructor; of(length: number, pattern: any): ArrayConstructor; of(minLength: number, maxLength: number, pattern: any): ArrayConstructor; } -interface ObjectConstructor -{ +interface ObjectConstructor { like(obj: any): ObjectConstructor; reference(obj: any): ObjectConstructor; } -interface FunctionConstructor -{ +interface FunctionConstructor { reference(func: Function): FunctionConstructor; -} +} \ No newline at end of file diff --git a/types/js-schema/js-schema-tests.ts b/types/js-schema/js-schema-tests.ts index bb5098a434..028b860e0a 100644 --- a/types/js-schema/js-schema-tests.ts +++ b/types/js-schema/js-schema-tests.ts @@ -1,4 +1,4 @@ -import {default as schema} from 'js-schema'; +import * as schema from 'js-schema'; var Duck = schema({ // A duck swim : Function, // - can swim diff --git a/types/js-search/index.d.ts b/types/js-search/index.d.ts new file mode 100644 index 0000000000..49c10251eb --- /dev/null +++ b/types/js-search/index.d.ts @@ -0,0 +1,143 @@ +// Type definitions for js-search v1.4.0 +// Project: https://github.com/bvaughn/js-search +// Definitions by: Guo Yunhe +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "js-search" { + + class Search { + + constructor( + uidFieldName: string | Array + ); + + public indexStrategy: IIndexStrategy; + public sanitizer: ISanitizer; + public searchIndex: ISearchIndex; + public tokenizer: ITokenizer; + + public addDocument(document: Object): void; + public addDocuments(documents: Array): void; + + public addIndex(field: string | Array): void; + + public search(query: string): Array; + + } + + interface IIndexStrategy { + expandToken(token: string): Array; + } + + class AllSubstringsIndexStrategy implements IIndexStrategy { + expandToken(token: string): Array; + } + + class ExactWordIndexStrategy implements IIndexStrategy { + expandToken(token: string): Array; + } + + class PrefixIndexStrategy implements IIndexStrategy { + expandToken(token: string): Array; + } + + interface ISanitizer { + sanitize(text: string): string; + } + + class CaseSensitiveSanitizer implements ISanitizer { + sanitize(text: string): string; + } + + class LowerCaseSanitizer implements ISanitizer { + sanitize(text: string): string; + } + + interface ISearchIndex { + indexDocument( + token: string, + uid: string, + document: Object + ): void; + + search( + tokens: Array, + corpus: Array + ): Array; + } + + type ITfIdfTokenMap = { + [token: string]: ITfIdfTokenMetadata; + }; + + type ITfIdfUidMap = { + [uid: string]: ITfIdfUidMetadata; + }; + + type ITfIdfTokenMetadata = { + $numDocumentOccurrences: number; + $totalNumOccurrences: number; + $uidMap: ITfIdfUidMap; + }; + + type ITfIdfUidMetadata = { + $document: Object; + $numTokenOccurrences: number; + }; + + class TfIdfSearchIndex implements ISearchIndex { + constructor(uidFieldName: string | Array); + + indexDocument(token: string, uid: string, doc: Object): void; + + search(tokens: Array, corpus: Array): Array; + } + + class UnorderedSearchIndex implements ISearchIndex { + constructor(); + + indexDocument(token: string, uid: string, doc: Object): void; + + search(tokens: Array, corpus: Array): Array; + } + + interface ITokenizer { + tokenize(text: string): Array; + } + + class SimpleTokenizer implements ITokenizer { + tokenize(text: string): Array; + } + + type StemmingFunction = (text: string) => string; + + class StemmingTokenizer implements ITokenizer { + constructor( + stemmingFunction: StemmingFunction, + decoratedTokenizer: ITokenizer + ); + + tokenize(text: string): Array; + } + + class StopWordsTokenizer implements ITokenizer { + constructor(decoratedTokenizer: ITokenizer); + + tokenize(text: string): Array; + } + + var StopWordsMap: any; + + class TokenHighlighter { + + constructor( + opt_indexStrategy: IIndexStrategy, + opt_sanitizer: ISanitizer, + opt_wrapperTagName: string + ); + + public highlight(text: string, tokens: Array): string; + + } + +} diff --git a/types/js-search/js-search-tests.ts b/types/js-search/js-search-tests.ts new file mode 100644 index 0000000000..b852e000cc --- /dev/null +++ b/types/js-search/js-search-tests.ts @@ -0,0 +1,58 @@ +import { Search, ITokenizer, StopWordsMap, StopWordsTokenizer, StemmingTokenizer, SimpleTokenizer, UnorderedSearchIndex } from "js-search"; + +var theGreatGatsby = { + isbn: '9781597226769', + title: 'The Great Gatsby', + author: { + name: 'F. Scott Fitzgerald' + }, + tags: ['book', 'inspirational'] +}; +var theDaVinciCode = { + isbn: '0307474275', + title: 'The DaVinci Code', + author: { + name: 'Dan Brown' + }, + tags: ['book', 'mystery'] +}; +var angelsAndDemons = { + isbn: '074349346X', + title: 'Angels & Demons', + author: { + name: 'Dan Brown', + }, + tags: ['book', 'mystery'] +}; + +var search = new Search('isbn'); +search.addIndex('title'); +search.addIndex(['author', 'name']); +search.addIndex('tags') + +search.addDocuments([theGreatGatsby, theDaVinciCode, angelsAndDemons]); + +search.search('The'); // [theGreatGatsby, theDaVinciCode] +search.search('scott'); // [theGreatGatsby] +search.search('dan'); // [angelsAndDemons, theDaVinciCode] +search.search('mystery') // [angelsAndDemons, theDaVinciCode] + +search.tokenizer = { + tokenize(text: any) { + // Convert text to an Array of strings and return the Array + } +}; + + +// Function should accept a string param and return a string +var stemmer = function () { return 'foobar' }; + +search.tokenizer = new StemmingTokenizer(stemmer, new SimpleTokenizer()); + + +search.tokenizer = new StopWordsTokenizer(new SimpleTokenizer()); + +StopWordsMap.the = false; // Do not treat "the" as a stop word +StopWordsMap.bob = true; // Treat "bob" as a stop word + +search.searchIndex = new UnorderedSearchIndex(); diff --git a/types/js-search/tsconfig.json b/types/js-search/tsconfig.json new file mode 100644 index 0000000000..83ce87381c --- /dev/null +++ b/types/js-search/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "js-search-tests.ts" + ] +} diff --git a/types/js-yaml/index.d.ts b/types/js-yaml/index.d.ts index 7f19fb32eb..d19f10a61c 100644 --- a/types/js-yaml/index.d.ts +++ b/types/js-yaml/index.d.ts @@ -7,7 +7,8 @@ declare namespace jsyaml { export function safeLoad(str: string, opts?: LoadOptions): any; export function load(str: string, opts?: LoadOptions): any; - export class Type implements TypeConstructorOptions { + export interface Type extends TypeConstructorOptions { } + export class Type { constructor(tag: string, opts?: TypeConstructorOptions); tag: string; } diff --git a/types/jsdom/index.d.ts b/types/jsdom/index.d.ts index 0f272a7c35..ca17ea4bbf 100644 --- a/types/jsdom/index.d.ts +++ b/types/jsdom/index.d.ts @@ -1,198 +1,138 @@ -// Type definitions for jsdom 2.0.0 -// Project: https://github.com/tmpvar/jsdom -// Definitions by: Asana +// Type definitions for jsdom 11.0 +// Project: https://github.com/tmpvar/jsdom#readme +// Definitions by: Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// -/// +import { EventEmitter } from 'events'; +import { MarkupData } from 'parse5'; +import * as tough from 'tough-cookie'; +import { Script } from 'vm'; +export class JSDOM { + static fromURL(url: string | Buffer | jsdom.BinaryData, options?: jsdom.FromUrlOptions | object): Promise; -import EventEmitter = NodeJS.EventEmitter; + static fromFile(url: string | Buffer | jsdom.BinaryData, options?: jsdom.Options | object): Promise; -/** - * The do-what-I-mean API. - * - * Example: - * jsdom.env(html, function (errors, window) { - * // free memory associated with the window - * window.close(); - * }); - * - * @param urlOrSource may be a URL, file name, or HTML fragment - * @param scriptUrlsOrSources a string or array of strings, containing file names or URLs that will be inserted as - * @param config Configuration object - * @param callback - */ -export declare function env(urlOrHtml: string, scripts: string, config: Config, callback?: Callback): void; -export declare function env(urlOrHtml: string, scripts: string, callback: Callback): void; -export declare function env(urlOrHtml: string, scripts: string[], config: Config, callback?: Callback): void; -export declare function env(urlOrHtml: string, scripts: string[], callback: Callback): void; -export declare function env(urlOrHtml: string, callback: Callback): void; -export declare function env(urlOrHtml: string, config: Config, callback?: Callback): void; -export declare function env(config: Config, callback?: Callback): void; + static fragment(html: string): DocumentFragment; -export declare function serializeDocument(doc: Document): string; + constructor(html?: string | Buffer | jsdom.BinaryData, options?: jsdom.Options | object); -export interface VirtualConsole extends EventEmitter { - sendTo(console: Console): VirtualConsole; + readonly window: jsdom.Window; + readonly virtualConsole: jsdom.VirtualConsole; + readonly cookieJar: jsdom.CookieJar; + + /** + * The serialize() method will return the HTML serialization of the document, including the doctype. + */ + serialize(): string; + + /** + * The nodeLocation() method will find where a DOM node is within the source document, returning the parse5 location info for the node. + */ + nodeLocation(node: Node): MarkupData.ElementLocation | null; + + /** + * The built-in vm module of Node.js allows you to create Script instances, + * which can be compiled ahead of time and then run multiple times on a given "VM context". + * Behind the scenes, a jsdom Window is indeed a VM context. + * To get access to this ability, use the runVMScript() method. + */ + runVMScript(script: Script): void; + + reconfigure(settings: jsdom.ReconfigureSettings | object): void; } -export interface VirtualConsoleOptions { -} - -export interface WindowProperties { - parsingMode?: string; // html, xml, auto, undefined - contentType?: string; - parser?: any; - url?: string; - referrer?: string; - cookieJar?: CookieJar; - cookie?: string; - resourceLoader?: any; - deferClose?: boolean; - concurrentNodeIterators?: number; - virtualConsole?: VirtualConsole; - created?: (something: any, window: Window) => any; - features?: FeatureOptions; - top?: Window; -} - -// tough-cookie -export interface CookieJar { - -} - -export declare function createVirtualConsole(options?: VirtualConsoleOptions): VirtualConsole; -export declare function getVirtualConsole(window: Window): VirtualConsole; -export declare function createCookieJar(): CookieJar; -export declare function nodeLocation(node: Node): any; -export declare function reconfigureWindow(window: Window, newProps: WindowProperties): void; -export declare function changeURL(window: Window, url: string): void; - -export declare function jQueryify(window: Window, jqueryUrl: string, callback: (window: Window, jquery: JQuery) => any): void; - -export declare var debugMode: boolean; - -export interface DocumentWithParentWindow extends Document { - parentWindow: Window; -} - -/** - * The jsdom.jsdom method does less things automatically; it takes in only HTML source, and does not let you to - * separately supply script that it will inject and execute. It just gives you back a document object, - * with usable document.parentWindow, and starts asynchronously executing any +`); + + // The script will not be executed, by default: + dom.window.document.body.children.length === 1; +} + +function test_executing_scripts2() { + const dom = new JSDOM(` + +`, { runScripts: 'dangerously' }); + + // The script will be executed and modify the DOM: + dom.window.document.body.children.length === 2; +} + +function test_executing_scripts3() { + const window = (new JSDOM(``, { runScripts: 'outside-only' })).window; + + window.eval(`document.body.innerHTML = "

    Hello, world!

    ";`); + window.document.body.children.length === 1; +} + +function test_virtualConsole() { + const virtualConsole = new jsdom.VirtualConsole(); + const dom = new JSDOM(``, { virtualConsole }); + + virtualConsole.on('error', () => { }); + virtualConsole.on('warn', () => { }); + virtualConsole.on('info', () => { }); + virtualConsole.on('dir', () => { }); + // ... etc. See https://console.spec.whatwg.org/#logging + + virtualConsole.sendTo(console); + + const c = console; + virtualConsole.sendTo(c, { omitJSDOMErrors: true }); +} + +function test_cookieJar() { + const store = {} as MemoryCookieStore; + const options = {} as CookieJar.Options; + + const cookieJar = new jsdom.CookieJar(store, options); + const dom = new JSDOM(``, { cookieJar }); +} + +function test_beforeParse() { + const dom = new JSDOM(`

    Hello

    `, { + beforeParse(window) { + window.document.childNodes.length === 0; + } + }); +} + +function test_serialize() { + const dom = new JSDOM(`hello`); + + dom.serialize() === 'hello'; + + // Contrast with: + dom.window.document.documentElement.outerHTML === 'hello'; +} + +function test_nodeLocation() { + const dom = new JSDOM( + `

    Hello + +

    `, + { includeNodeLocations: true } + ); + + const document = dom.window.document; + const bodyEl = document.body; // implicitly created + const pEl = document.querySelector('p')!; + const textNode = pEl.firstChild!; + const imgEl = document.querySelector('img')!; + + console.log(dom.nodeLocation(bodyEl)); // null; it's not in the source + console.log(dom.nodeLocation(pEl)); // { startOffset: 0, endOffset: 39, startTag: ..., endTag: ... } + console.log(dom.nodeLocation(textNode)); // { startOffset: 3, endOffset: 13 } + console.log(dom.nodeLocation(imgEl)); // { startOffset: 13, endOffset: 32 } +} + +function test_runVMScript() { + const dom = new JSDOM(``, { runScripts: 'outside-only' }); + const s = new Script(` + if (!this.ran) { + this.ran = 0; + } + + ++this.ran; +`); + + dom.runVMScript(s); + dom.runVMScript(s); + dom.runVMScript(s); + + dom.window.ran === 3; +} + +function test_reconfigure() { + const myFakeTopForTesting = {} as Window; + + const dom = new JSDOM(); + + dom.window.top === dom.window; + dom.window.location.href === 'about:blank'; + + dom.reconfigure({ windowTop: myFakeTopForTesting, url: 'https://example.com/' }); + + dom.window.top === myFakeTopForTesting; + dom.window.location.href === 'https://example.com/'; +} + +function test_fromURL() { + const options = {} as jsdom.FromUrlOptions; + + JSDOM.fromURL('https://example.com/', options).then(dom => { + console.log(dom.serialize()); + }); +} + +function test_fromFile() { + const options = {} as jsdom.Options; + + JSDOM.fromFile('stuff.html', options).then(dom => { + console.log(dom.serialize()); + }); +} + +function test_fragment() { + const frag = JSDOM.fragment(`

    Hello

    Hi!`); + + frag.childNodes.length === 2; + frag.querySelector('strong')!.textContent = 'Why hello there!'; + // etc. +} + +function test_fragment_serialization() { + const frag = JSDOM.fragment(`

    Hello

    `); + if (frag instanceof Element) { + if (frag.firstChild instanceof Element) { + console.log(frag.firstChild.outerHTML); // logs "

    Hello

    " + } } -); - -jsdom.env( - "http://nodejs.org/dist/", - function (errors: Error[], window: Window) { - } -); - -jsdom.env( - "http://nodejs.org/dist/", - { - scripts: ["http://code.jquery.com/jquery.js"], - }, - function (errors: Error[], window: Window) { - } -); - -jsdom.env( - '

    jsdom!

    ', - ["http://code.jquery.com/jquery.js"], - function (errors: Error[], window: Window) { - } -); - -jsdom.env({ - url: "http://news.ycombinator.com/", - scripts: ["http://code.jquery.com/jquery.js"], - done: function (errors: Error[], window: Window) { - } -}); - -var jquery: string; - -jsdom.env({ - url: "http://news.ycombinator.com/", - src: [jquery], - done: function (errors: Error[], window: Window) { - } -}); - -var document: Document = jsdom.jsdom(""); +} diff --git a/types/jsdom/package.json b/types/jsdom/package.json new file mode 100644 index 0000000000..3d840a49e2 --- /dev/null +++ b/types/jsdom/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "parse5": "^3.0.2" + } +} diff --git a/types/jsdom/tsconfig.json b/types/jsdom/tsconfig.json index b18f0d0264..ea8d7b93b3 100644 --- a/types/jsdom/tsconfig.json +++ b/types/jsdom/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,4 +20,4 @@ "index.d.ts", "jsdom-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/jsdom/tslint.json b/types/jsdom/tslint.json new file mode 100644 index 0000000000..4f44991c3c --- /dev/null +++ b/types/jsdom/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-empty-interface": false + } +} diff --git a/types/jsdom/v2/index.d.ts b/types/jsdom/v2/index.d.ts new file mode 100644 index 0000000000..0f272a7c35 --- /dev/null +++ b/types/jsdom/v2/index.d.ts @@ -0,0 +1,198 @@ +// Type definitions for jsdom 2.0.0 +// Project: https://github.com/tmpvar/jsdom +// Definitions by: Asana +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + + + +import EventEmitter = NodeJS.EventEmitter; + +/** + * The do-what-I-mean API. + * + * Example: + * jsdom.env(html, function (errors, window) { + * // free memory associated with the window + * window.close(); + * }); + * + * @param urlOrSource may be a URL, file name, or HTML fragment + * @param scriptUrlsOrSources a string or array of strings, containing file names or URLs that will be inserted as + * @param config Configuration object + * @param callback + */ +export declare function env(urlOrHtml: string, scripts: string, config: Config, callback?: Callback): void; +export declare function env(urlOrHtml: string, scripts: string, callback: Callback): void; +export declare function env(urlOrHtml: string, scripts: string[], config: Config, callback?: Callback): void; +export declare function env(urlOrHtml: string, scripts: string[], callback: Callback): void; +export declare function env(urlOrHtml: string, callback: Callback): void; +export declare function env(urlOrHtml: string, config: Config, callback?: Callback): void; +export declare function env(config: Config, callback?: Callback): void; + +export declare function serializeDocument(doc: Document): string; + +export interface VirtualConsole extends EventEmitter { + sendTo(console: Console): VirtualConsole; +} + +export interface VirtualConsoleOptions { +} + +export interface WindowProperties { + parsingMode?: string; // html, xml, auto, undefined + contentType?: string; + parser?: any; + url?: string; + referrer?: string; + cookieJar?: CookieJar; + cookie?: string; + resourceLoader?: any; + deferClose?: boolean; + concurrentNodeIterators?: number; + virtualConsole?: VirtualConsole; + created?: (something: any, window: Window) => any; + features?: FeatureOptions; + top?: Window; +} + +// tough-cookie +export interface CookieJar { + +} + +export declare function createVirtualConsole(options?: VirtualConsoleOptions): VirtualConsole; +export declare function getVirtualConsole(window: Window): VirtualConsole; +export declare function createCookieJar(): CookieJar; +export declare function nodeLocation(node: Node): any; +export declare function reconfigureWindow(window: Window, newProps: WindowProperties): void; +export declare function changeURL(window: Window, url: string): void; + +export declare function jQueryify(window: Window, jqueryUrl: string, callback: (window: Window, jquery: JQuery) => any): void; + +export declare var debugMode: boolean; + +export interface DocumentWithParentWindow extends Document { + parentWindow: Window; +} + +/** + * The jsdom.jsdom method does less things automatically; it takes in only HTML source, and does not let you to + * separately supply script that it will inject and execute. It just gives you back a document object, + * with usable document.parentWindow, and starts asynchronously executing any