/*! * Copyright 2017 - 2020 by ChartIQ, Inc. * All rights reserved. */ import { FinsembleWindow } from "../common/FinsembleWindow"; import { StandardCallback } from "../types"; declare type receiver = { type: string; handler: Function; }; declare type receiverUpdate = { type: string; handler: Function; oldHandler: Function; }; declare type emitter = { type: string; data: any; }; /** * @phantom Don't display in Typedoc */ export declare class DragAndDropClient { emitters: { [x: string]: any; }; receivers: { [x: string]: any; }; receiveResponder: boolean; linkerListener: boolean; openLinkerDataByDefault: boolean; SHARE_METHOD: { DROP: string; SPAWN: string; LINKER: string; }; store: any; sourceData: []; finsembleWindow: FinsembleWindow | null; windowName: string; constructor(); bindAllFunctions(): void; /** * This sets all the data that can be shared by the component. There can only be one emitter for each data type. * * ```javascript * FSBL.Clients.DragAndDropClient.setEmitters({ * emitters: [ * { * type: "symbol", * data: getSymbol * }, * { * type: "chartiq.chart", * data: getChart * } * ] * }) * ``` * @deprecated The DragAndDropClient is deprecated * @param params.emitters This is a list of objects (`{ type: string, data: function }`) which contain a type and a function to get the data. * @memberof DragAndDropClient */ setEmitters(params: { emitters: emitter[]; }): void; /** * @deprecated The DragAndDropClient is deprecated * * Adds receivers for the data that can be received by the component. There can be any number of receivers for each data type. You can also use regular expressions to specify the data that can be received. * * ```javascript * FSBL.Clients.DragAndDropClient.addReceivers({ * receivers: [ * { * type: "symbol", * handler: changeSymbol * }, { * type: "chartiq.chart", * handler: openChart * } * ]) * FSBL.Clients.DragAndDropClient.addReceivers({ * receivers: [ * { * type: /.*/, * handler: getEverythingAComponentCanEmit * } * ] * }) * ``` * @param params.receivers This is a list of objects (`{ type: string, handler: function }`), each containing a type and a handler function to call with the data once received. The receiver can take a regular expression as its type to provide the ability to receive multiple data types. Each type can have multiple handlers so you can use the same type multiple times in your call. * @memberof DragAndDropClient */ addReceivers(params: { receivers: receiver[]; }): void; /** * @deprecated The DragAndDropClient is deprecated * * updateReceivers updates the handlers for the data that can be received by the component. * * ```javascript * DragAndDropClient.updateReceivers({ * receivers: [ * { * type: "symbol", * oldHandler: updateSymbol, * handler: changeSymbol * }, { * type: "chartiq.chart", * oldHandler: openChart_old, * handler: openChart_new * } * ]) * DragAndDropClient.updateReceivers({ * receivers: [ * { * type: /.*/, * oldHandler: getEverythingAComponentCanEmit, * handler: doSomethingWithAllThisData * } * ]) * ``` * @param params.receivers This is a list of objects (`{ type: string, handler: Function, oldHandler: Function }`), each containing a type, the existing handler (oldHandler) and a handler function to replace the old handler with. * @private * @memberof DragAndDropClient */ updateReceivers(params: { receivers: receiverUpdate[]; }): void; /** * @deprecated The DragAndDropClient is deprecated * * removeReceivers removes the handlers for the data that can be received by the component. * * ```javascript * DragAndDropClient.removeReceivers({ * receivers: [ * { * type: "symbol", * handler: changeSymbol * }, { * type: "chartiq.chart", * handler: openChart * } * ]) * DragAndDropClient.removeReceivers({ * receivers: [ * { * type: /.*/, * oldHandler: getEverythingAComponentCanEmit * } * ]) * ``` * @param params.receivers This is a list of objects, each containing a type and the handler that needs to be removed. * @private * @memberof DragAndDropClient */ removeReceivers(params: { receivers: receiver[]; }): void; /** * @deprecated The DragAndDropClient is deprecated * * This is a drag event handler for an element that can be dragged to share data. Our sample Window Title Bar component uses this internally when the share icon is dragged. * This can be attached to any element that needs to be draggable. The data from all emitters that match receivers in the drop component is automatically shared. * * @param event The DragEvent fired from the native browser event. * @memberof DragAndDropClient */ dragStart(event: any): void; /** * @deprecated The DragAndDropClient is deprecated * * This is a drag event handler to enable dragging specific data that is not tied to an emitter. For example, an item in a list. * * ```javascript * element.draggable = true; * * element.addEventListener('dragstart', function(event) { * var data = { * 'rsrchx.report': { * url: event.target.href, * } * }; * FSBL.Clients.DragAndDropClient.dragStartWithData(event, data); * }) * ``` * @param event The DragEvent fired from the native browser event. * @param data The data you wish to be transferred with the event. * @memberof DragAndDropClient */ dragStartWithData(event: any, data: any): void; /** * @private * @param sharedData * @param shareMethod */ handleSharedData(sharedData: any, shareMethod: any): void; /** * @deprecated The DragAndDropClient is deprecated * * This is a drop event handler that can be attached to any element that you want to be a drop zone for the Drag and Drop Client. It automatically requests data for all the data elements that are common between the receiver and the emitter. * @param event The DragEvent fired from the native browser event. * @memberof DragAndDropClient */ drop(event: any): void; /** * @param error * @param params This is a list of strands whose data is required * @private */ emit(error: any, params: { data: string[]; sendQueryResponse: (err?: any, data?: any) => void; }): void; /** * @deprecated The DragAndDropClient is deprecated * * This gets a list of components that can receive a specific type. It looks in the config for each componentType for an advertiseReceivers property. * * ```javascript * "Advanced Chart": { * ... * "component": { * "advertiseReceivers": ["chartiq.chart", "symbol"] * }, * ... * ``` * * ```javascript * DragAndDropClient.getComponentsThatCanReceiveType ({ type: "chartiq.chart"}, callback) * ``` * @param cb callback to be invoked with the list of component types * @private */ getComponentsThatCanReceiveType(dataType: any, cb: any): void; /** * @deprecated The DragAndDropClient is deprecated * * This will either open a component with the shared data or publish the shared data using the Linker Client if the window is linked. * @param params.data Data to pass to the opened component. * @param params.publishOnly if the component is linked, this will only publish the data, not force open a window if it does not exist. If the component is not linked, this is ignored. * @param params.multipleOpenerHandler Optional. This function is called with on object that contains a map of componentTypes to the data types they can open. It must return a list of components to be opened. If no handler is provided, the first found component will be chosen. It is possible that the component opened may not handle all the data provided. * @param cb Callback invoked with action taken. * @memberof DragAndDropClient */ openSharedData(params: { data?: any; publishOnly?: boolean; multipleOpenerHandler?: Function; }, cb: StandardCallback): void; /** * @private */ addWindowHighlight(canReceiveData: any): void; /** * @private */ removeWindowHighlight(): void; /** * @private */ canReceiveData(dataTypeArray: any, receiverKeys?: string[] | null): boolean; /** * @private */ dragover(e: any): boolean; /** * @private */ addListeners(cb?: Function): void; /** * @private * * @param cb * @memberof DragAndDropClient */ getFinsembleWindow(cb: any): void; } declare var dragAndDropClient: DragAndDropClient; /** * @ignore */ export default dragAndDropClient; //# sourceMappingURL=dragAndDropClient.d.ts.map