import { FinsembleWindow } from "../common/FinsembleWindow"; import { SpawnParams } from "../services/window/types"; import { StandardError, StandardErrorCallback, StandardPromise } from "../types"; import { WindowIdentifier, WindowDescriptor, WindowLocator, ShowWindowParams } from "../services/window/types"; import { MonitorCommand, MonitorInfoDetail } from "../common/Monitors"; export declare type ComponentDescriptor = Record; export declare type ComponentList = Record; export declare type MonitorInfo = any; export declare type SpawnResponse = { windowDescriptor: WindowDescriptor; windowIdentifier: WindowIdentifier; finWindow: FinsembleWindow; launchGroupWindows?: string[]; }; /** * Get a list of registered components (those that were entered into components.json). * * @param cb Callback returns an object map of components. Each component object * contains the default config for that component. */ export declare const getComponentList: (cb?: StandardErrorCallback) => StandardPromise; /** * Get the component config (from components.json) for a specific component. * * @param componentType The type of the component. * @param cb Callback returns the default config (windowDescriptor) for the requested componentType. */ export declare const getComponentDefaultConfig: (componentType: string, cb?: StandardErrorCallback) => StandardPromise; /** * Gets monitorInfo (dimensions and position) for all monitors. Returns an array of monitorInfo objects. See LauncherClient#getMonitorInfo for the format of a monitorInfo object. * * @param cb Returns an array of monitorInfo objects. */ export declare const getMonitorInfoAll: (cb?: StandardErrorCallback) => StandardPromise; /** * Gets monitor information for a given windowIdentifier or for a specific monitor. * If neither the identifier or monitor are provided then the monitorInfo for the current window is returned. * * * The information returned contains: * * **monitorRect** - The full dimensions for the monitor.
* **availableRect** - The dimensions for the available space on the monitor (less the Windows task bar).
* **position** - The position of the monitor, numerically from zero to X. Primary monitor is zero.
* **whichMonitor** - Contains the string "primary" if it is the primary monitor.
* * The dimensions are supplemented with the following additional members: * * **width** - The width as calculated (right - left).
* **height** - The height as calculated (bottom - top).
* * @param params * @param params.windowIdentifier The windowIdentifier to get the monitorInfo. If undefined, then the current window. * @param params.monitor If passed then a specific monitor is identified. Valid values include: * * "mine" - Place the window on the same monitor as the calling window. * * Integer value from 0-n (0 being the primary monitor). * * "primary" indicates the user's primary monitor. * * "all" - Put a copy of the component on all monitors. * @param cb Returns a monitorInfo object containing the monitorRect and availableRect. * * @returns A promise that resolves to a monitorInfo */ export declare const getMonitorInfo: (params?: { monitor?: MonitorCommand; windowIdentifier?: WindowIdentifier; }, cb?: StandardErrorCallback) => StandardPromise; /** * Displays a window and relocates/resizes it according to the values contained in parameters. If the specified window is in a group or tabbed, it will be unsnapped/ungrouped/untabbed from the other windows. * If invoked on a tabbed window or a window in a group, the window will be removed from the tab/group. * * Caution: A window can inherit parameters only once, at the time when it’s spawned. When the component already exists, changing parameters other than positioning arguments (monitor, relativeWindow, top, bottom, left, right, width, height) has no effect. * * ```javascript * FSBL.Clients.LauncherClient.showWindow({windowName: "Welcome Component-86-3416-Finsemble", componentType: "Welcome Component"}, {spawnIfNotFound: true}, (err, data)=> {}); * ``` * @param windowIdentifier A windowIdentifier. This is an object containing windowName and componentType. If windowName is not given, Finsemble will try to find it by componentType. * @param params Configuration settings from the finsemble.appd[].manifest.window section of the application manifest may be used as parameters to this function, except for the `options` element. * These are the same as LauncherClient.spawn() with the following exceptions: *
    *
  • monitor - Same as spawn() except that null or undefined means don't move the window to a different monitor.
  • *
  • left - Same as spawn() except that null or undefined means don't move the window from current horizontal location.
  • *
  • top - Same as spawn() except that null or undefined means don't move the window from current vertical location.
  • *
  • slave - Cannot be set for an existing window. Will only go into effect if the window is spawned. (In other words, only use this in conjunction with spawnIfNotFound).
  • *
  • spawnIfNotFound - If true, then spawns a new window if the requested one cannot be found. Note: only works if the windowIdentifier contains a componentType.
  • *
  • autoFocus - Whether or not the window should be focused when shown.
  • *
* @param cb Callback to be invoked after the function is completed regardless if the call fails or succeeds. * Callback contains two arguments in the following order. *
    *
  1. error: an object containing details related to the reason the call failed and where the exception occurred. This object will be null if the call has succeeded.
  2. *
  3. data: an object with the following information: *
      *
    • windowIdentifier - The WindowIdentifier for the new window.
    • *
    • windowDescriptor - The WindowDescriptor of the new window.
    • *
    • finWindow - A finWindow object referencing the new window.
    • *
    *
  4. *
*/ export declare const showWindow: (windowLocator: WindowLocator, params: ShowWindowParams, cb?: StandardErrorCallback) => StandardPromise; /** * A convenient method for dealing with a common use-case, which is toggling the appearance and disappearance of a child window when a button is pressed, aka drop down menus. * Call this method from the click handler for your element. Your child window will need to close itself on blur events. * Caution: A window can inherit parameters only once, at the time when it’s spawned. When the component already exists, changing parameters other than positioning arguments (monitor, relativeWindow, top, bottom, left, right, width, height) has no effect. * @param element The DOM element, or selector, clicked by the end user. * @param windowIdentifier Identifies the child window * @param params Parameters to be passed to LauncherClient.showWindow() if the child window is allowed to open */ export declare const toggleWindowOnClick: (element: HTMLElement, windowLocator: WindowLocator, params: ShowWindowParams) => void; /** * Asks the Launcher service to spawn a new component. Any parameter below can also be specified in public/config/components.json, which will * then operate as the default for that value. * * The launcher parameters mimic CSS window positioning. * For instance, to set a full screen window use `{left: 0, top: 0, right: 0, bottom: 0}`. * This is functionally equivalent to: `{left: 0, top: 0, width: "100%", height: "100%"}`. * * You can also spawn more than one component at a time by using a single action, such as clicking a button on a menu. * See https://github.com/ChartIQ/finsemble-seed/tree/recipes/SpawnComponentGroup for an example of spawning a component group. * * ```javascript * FSBL.Clients.LauncherClient.spawn("Welcome Component", {left: 0, top: 0, position: "relative"}, (err, data)=> {}); * ``` * @param component The application or component to spawn. * @param params Configuration settings from the finsemble.appd[].manifest.window section of the application manifest may be used as parameters to this function, except for the `options` element. * @param cb Function invoked after the window is created */ export declare const spawn: (component: string, params: SpawnParams, cb?: StandardErrorCallback) => Promise<{ error?: StandardError; response?: SpawnResponse | undefined; }>; /** * Returns a windowIdentifier for the current window. * * @param cb Callback function returns windowIdentifier for this window (optional or use the returned Promise) * @returns A promise that resolves to a windowIdentifier */ export declare const getMyWindowIdentifier: (cb?: ((windowIdentifier: WindowIdentifier) => void) | undefined) => Promise; /** * Gets the windowDescriptor for all open windows. * * **Note:** This returns descriptors even if the window is not part of the workspace. * * ```javascript * FSBL.Clients.LauncherClient.getActiveDescriptors(function (error, response) { * if (error) { * Logger.system.error("Error getting active descriptors: ", + JSON.stringify(error)); * } else { * const activeDescriptors = response; * //{ * // ... * // Toolbar-1-Finsemble: {...}, * // Welcome-Component-80-6453-Finsemble: {...}, * // ... * //} * } * }); * ``` * @param cb Callback returns an object containing windowDescriptors keyed by name. */ export declare const getActiveDescriptors: (cb?: StandardErrorCallback>) => StandardPromise>; /** * @private Adds a custom component. * @ignore */ export declare const addUserDefinedComponent: (params: { name: string; url: string; }, cb?: StandardErrorCallback) => StandardPromise; /** * @private Adds a custom component. * @ignore */ export declare const removeUserDefinedComponent: (params: { name: string; url?: string; }, cb?: StandardErrorCallback) => StandardPromise; /** * @ignore */ export declare const LauncherClient: { /** * For backward compatibility * @private * @deprecated */ initialize: () => void; /** * For backward compatibility * @private * @deprecated */ onReady: (cb?: any) => void; addToGroups: (params: { windowIdentifier?: WindowIdentifier | undefined; groupNames?: string[] | undefined; }, cb: (err?: StandardError) => void) => Promise<{ err: StandardError; }>; getGroupsForWindow: (params: { windowIdentifier: WindowIdentifier; } | null, cb?: Function) => Promise; removeWindowsFromGroup: (params: { windowList?: string[] | WindowIdentifier[] | undefined; groupName?: string | undefined; }, cb?: Function) => Promise; addWindowsToGroup: (params: { windowList?: string[] | WindowIdentifier[] | undefined; groupName?: string | undefined; }, cb?: Function) => Promise; createWindowGroup: (params: { windowList?: string[] | WindowIdentifier[] | undefined; groupName?: string | undefined; }, cb?: Function) => Promise; minimizeWindows: (params: { windowList?: string[] | WindowIdentifier[] | undefined; groupName?: string | undefined; componentType?: string | undefined; }, cb?: Function | undefined) => Promise; hyperFocus: (params: { windowList?: string[] | WindowIdentifier[] | undefined; groupName?: string | undefined; componentType?: string | undefined; }, cb?: (() => void) | undefined) => Promise; bringWindowsToFront: (params?: { windowList?: string[] | WindowIdentifier[] | undefined; groupName?: string | undefined; componentType?: string | undefined; }, cb?: Function) => Promise; getComponentsThatCanReceiveDataTypes: (params: { dataTypes: string[]; }, cb?: Function) => Promise; removeUserDefinedComponent: (params: { name: string; url?: string; }, cb?: StandardErrorCallback) => StandardPromise; addUserDefinedComponent: (params: { name: string; url: string; }, cb?: StandardErrorCallback) => StandardPromise; getPendingWindows: () => StandardPromise; getActiveAndPendingWindowNames: (cb?: Function) => Promise<{ err: any; data: any; }>; getActiveDescriptors: (cb?: StandardErrorCallback>) => StandardPromise>; getMyWindowIdentifier: (cb?: ((windowIdentifier: WindowIdentifier) => void) | undefined) => Promise; getMonitor: (windowIdentifier: WindowIdentifier, cb?: StandardErrorCallback | undefined) => StandardPromise; spawn: (component: string, params: SpawnParams, cb?: StandardErrorCallback) => Promise<{ error?: StandardError; response?: SpawnResponse | undefined; }>; toggleWindowOnClick: (element: HTMLElement, windowLocator: WindowLocator, params: ShowWindowParams) => void; showWindow: (windowLocator: WindowLocator, params: ShowWindowParams, cb?: StandardErrorCallback) => StandardPromise; unRegisterComponent: (params: { componentType: string; }, cb?: StandardErrorCallback | undefined) => StandardPromise; registerComponent: (params: { componentType: string; manifest: ComponentDescriptor; }, cb: StandardErrorCallback) => StandardPromise; getMonitorInfo: (params?: { monitor?: MonitorCommand; windowIdentifier?: WindowIdentifier; }, cb?: StandardErrorCallback) => StandardPromise; getMonitorInfoAll: (cb?: StandardErrorCallback) => StandardPromise; getComponentDefaultConfig: (componentType: string, cb?: StandardErrorCallback) => StandardPromise; getComponentList: (cb?: StandardErrorCallback) => StandardPromise; }; /** * @ignore */ export default LauncherClient; //# sourceMappingURL=launcherClient.d.ts.map