@finsemble/finsemble-ui 8.4.0-beta.1 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/clients/Interop/FinsembleDesktopAgent.d.ts.map +1 -1
- package/clients/Interop/FinsembleDesktopAgent.js +5 -8
- package/clients/Interop/FinsembleDesktopAgent.js.map +1 -1
- package/clients/Startup/FSBLDesktop.d.ts +1 -1
- package/clients/Startup/FSBLDesktop.d.ts.map +1 -1
- package/clients/Startup/FSBLDesktop.js +1 -1
- package/clients/Startup/FSBLDesktop.js.map +1 -1
- package/clients/Startup/windowStartup.d.ts.map +1 -1
- package/clients/Startup/windowStartup.js +54 -2
- package/clients/Startup/windowStartup.js.map +1 -1
- package/clients/appsClient.d.ts +394 -55
- package/clients/appsClient.d.ts.map +1 -1
- package/clients/appsClient.js +628 -30
- package/clients/appsClient.js.map +1 -1
- package/clients/configClient.d.ts +16 -3
- package/clients/configClient.d.ts.map +1 -1
- package/clients/configClient.js +17 -4
- package/clients/configClient.js.map +1 -1
- package/clients/launcherClient.d.ts +65 -334
- package/clients/launcherClient.d.ts.map +1 -1
- package/clients/launcherClient.js +35 -601
- package/clients/launcherClient.js.map +1 -1
- package/clients/notificationClient.d.ts +13 -6
- package/clients/notificationClient.d.ts.map +1 -1
- package/clients/notificationClient.js +13 -6
- package/clients/notificationClient.js.map +1 -1
- package/deprecated/deprecatedFunctions.js +2 -2
- package/deprecated/deprecatedFunctions.js.map +1 -1
- package/deprecated/deprecatedlauncherClient.d.ts +1 -1
- package/deprecated/deprecatedlauncherClient.d.ts.map +1 -1
- package/deprecated/deprecatedlauncherClient.js.map +1 -1
- package/deprecated/dragAndDropClient.d.ts.map +1 -1
- package/deprecated/dragAndDropClient.js +14 -4
- package/deprecated/dragAndDropClient.js.map +1 -1
- package/main.d.ts +113 -106
- package/main.d.ts.map +1 -1
- package/main.js +1 -1
- package/main.js.map +1 -1
- package/package.json +2 -2
- package/platform/services/Interop/types.d.ts +6 -0
- package/platform/services/Interop/types.d.ts.map +1 -1
- package/platform/services/Interop/types.js.map +1 -1
- package/platform/services/systemManager/_constants.d.ts.map +1 -1
- package/platform/services/systemManager/_constants.js +1 -0
- package/platform/services/systemManager/_constants.js.map +1 -1
- package/platform/services/systemManager/types.d.ts +1 -1
- package/platform/services/systemManager/types.d.ts.map +1 -1
- package/platform/services/systemManager/types.js.map +1 -1
- package/platform/services/window/modules/actions.d.ts +4 -0
- package/platform/services/window/modules/actions.d.ts.map +1 -1
- package/platform/services/window/modules/actions.js +1 -0
- package/platform/services/window/modules/actions.js.map +1 -1
- package/react/assets/css/fonts/icons-reference.html +1 -1
- package/react/assets/css/windowTitleBar.css +4 -1
- package/react/components/search/SearchResults.d.ts.map +1 -1
- package/react/components/search/SearchResults.js +6 -6
- package/react/components/search/SearchResults.js.map +1 -1
- package/react/components/singleInputDialog/SingleInputDialog.d.ts.map +1 -1
- package/react/components/singleInputDialog/SingleInputDialog.js +5 -3
- package/react/components/singleInputDialog/SingleInputDialog.js.map +1 -1
- package/react/components/toolbar/DragHandle.d.ts.map +1 -1
- package/react/components/toolbar/DragHandle.js +8 -5
- package/react/components/toolbar/DragHandle.js.map +1 -1
- package/react/components/userPreferences/components/content/Workspaces.d.ts +5 -0
- package/react/components/userPreferences/components/content/Workspaces.d.ts.map +1 -1
- package/react/components/userPreferences/components/content/Workspaces.js +14 -1
- package/react/components/userPreferences/components/content/Workspaces.js.map +1 -1
- package/react/hooks/useInjectedTitleBar.d.ts.map +1 -1
- package/react/hooks/useInjectedTitleBar.js +92 -20
- package/react/hooks/useInjectedTitleBar.js.map +1 -1
- package/typedefs/FDC3/api/AppMetadata.d.ts +1 -0
- package/typedefs/FDC3/api/AppMetadata.d.ts.map +1 -1
|
@@ -1,576 +1,13 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2017 - 2020 by ChartIQ, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*/
|
|
5
1
|
/**
|
|
6
|
-
* The Launcher Client
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* The Launcher API has capabilities to customize your end user's experience.
|
|
11
|
-
* This includes CSS-like positioning and a fully display-aware positioning that deals with idiosyncrasies such as monitors with different scaling resolutions.
|
|
2
|
+
* The Launcher Client is now known as the AppsClient. The Launcher Client
|
|
3
|
+
* (found at `FSBL.Clients.LauncherClient`) is an alias to the AppsClient
|
|
4
|
+
* provided for backward compatibility. Hence, please refer to AppsClient
|
|
5
|
+
* documentation for details on usage.
|
|
12
6
|
*
|
|
13
|
-
*
|
|
14
|
-
* CSS provides higher level abstractions that aid in laying out an application that is composed of constituent parts.
|
|
15
|
-
* Finsemble has borrowed CSS’s positioning paradigm and applied it to the task of laying out windows on the desktop.
|
|
16
|
-
* This CSS-style positioning allows windows to be positioned on the `left`, `right`, `top`, or `bottom` of the end user’s screen for instance; we also developed new positions, such as `adjacent`, which allows a child window to spawn adjacent to their parent.
|
|
17
|
-
* Components can be positioned and sized by percentage, relative to the monitor or to each other (nested windows).
|
|
18
|
-
*
|
|
19
|
-
* The Launcher Client frequently uses the parameters <code>windowName</code> and <code>componentType</code>. [Learn more about them here](/docs/productivity/componentTypesAndWindowNames).
|
|
20
7
|
* @module LauncherClient
|
|
21
8
|
*/
|
|
22
|
-
import
|
|
23
|
-
import Logger from "./logger";
|
|
24
|
-
import { FinsembleWindow } from "../common/FinsembleWindow";
|
|
25
|
-
import { RouterClient } from "./routerClient";
|
|
26
|
-
import SystemManagerClient from "../common/systemManagerClient";
|
|
27
|
-
import { getAllMonitorsClientSide, getWhichMonitorClientSide, } from "../common/Monitors";
|
|
28
|
-
import { registerComponent, unRegisterComponent, getMonitor, getActiveAndPendingWindowNames, getPendingWindows, getComponentsThatCanReceiveDataTypes, hyperFocus, createWindowGroup, addWindowsToGroup, removeWindowsFromGroup, getGroupsForWindow, addToGroups, } from "../deprecated/deprecatedlauncherClient";
|
|
29
|
-
import { bringWindowsToFront, minimizeWindows } from "../common/Desktop";
|
|
30
|
-
import { isMouseOverDOMElement } from "../common/util";
|
|
31
|
-
// A map of related menus that is kept by handleToggle.
|
|
32
|
-
const okayToOpenMenu = {};
|
|
33
|
-
/**
|
|
34
|
-
* Utility function that Converts a WindowLocator into a WindowIdentifier
|
|
35
|
-
* @param locator The window locator Object to convert
|
|
36
|
-
* @returns WindowIdentifier
|
|
37
|
-
*/
|
|
38
|
-
const locatorToIdentifier = (locator) => {
|
|
39
|
-
let windowIdentifier = {};
|
|
40
|
-
if ("windowName" in locator) {
|
|
41
|
-
windowIdentifier.windowName = locator.windowName;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
windowIdentifier.windowName = "";
|
|
45
|
-
}
|
|
46
|
-
if ("componentType" in locator) {
|
|
47
|
-
windowIdentifier.componentType = locator.componentType;
|
|
48
|
-
}
|
|
49
|
-
if ("uuid" in locator) {
|
|
50
|
-
windowIdentifier.uuid = locator.uuid;
|
|
51
|
-
}
|
|
52
|
-
return windowIdentifier;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Get a list of registered components (those that were entered into <i>components.json</i>).
|
|
56
|
-
*
|
|
57
|
-
* ```javascript
|
|
58
|
-
* const {err, data} = await FSBL.Clients.LauncherClient.getComponentList();
|
|
59
|
-
* if(!err){
|
|
60
|
-
* console.log(data);
|
|
61
|
-
* // {
|
|
62
|
-
* // "Toolbar": { ... },
|
|
63
|
-
* // "Tour": { ... },
|
|
64
|
-
* // ...
|
|
65
|
-
* // }
|
|
66
|
-
* }
|
|
67
|
-
* ```
|
|
68
|
-
*
|
|
69
|
-
* @param cb Callback returns an object map of components. Each component object
|
|
70
|
-
* contains the default config for that component.
|
|
71
|
-
*/
|
|
72
|
-
export const getComponentList = async (cb) => {
|
|
73
|
-
await SystemManagerClient.waitForStartup("windowService");
|
|
74
|
-
const { err, response } = await RouterClient.query("Launcher.componentList", {});
|
|
75
|
-
cb === null || cb === void 0 ? void 0 : cb(err, response.data);
|
|
76
|
-
return { err, data: response.data };
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* Get the component config (from <i>components.json</i>) for a specific component.
|
|
80
|
-
*
|
|
81
|
-
* ```javascript
|
|
82
|
-
* const {err, data} = await FSBL.Clients.LauncherClient.getComponentDefaultConfig("ChartIQ Example App");
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* @param componentType The type of the component.
|
|
86
|
-
* @param cb Callback returns the default config (windowDescriptor) for the requested componentType.
|
|
87
|
-
*/
|
|
88
|
-
export const getComponentDefaultConfig = async (componentType, cb) => {
|
|
89
|
-
const { err, data } = await getComponentList();
|
|
90
|
-
const componentDescriptor = data === null || data === void 0 ? void 0 : data[componentType];
|
|
91
|
-
cb === null || cb === void 0 ? void 0 : cb(err, componentDescriptor);
|
|
92
|
-
return { err, data: componentDescriptor };
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Gets monitorInfo (dimensions and position) for all monitors. Returns an array of monitorInfo objects. See <a href="/docs/reference/typedocs/modules/LauncherClient#getMonitorInfo">LauncherClient#getMonitorInfo</a> for the format of a monitorInfo object.
|
|
96
|
-
*
|
|
97
|
-
* ```javascript
|
|
98
|
-
* const {err, data} = await FSBL.Clients.LauncherClient.getMonitorInfoAll();
|
|
99
|
-
* if(!err){
|
|
100
|
-
* console.log(`There are ${data.length} monitors.`);
|
|
101
|
-
* }
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* @param cb Returns an array of monitorInfo objects.
|
|
105
|
-
*/
|
|
106
|
-
export const getMonitorInfoAll = async (cb) => {
|
|
107
|
-
Logger.system.debug("LauncherClient.getMonitorInfoAll()");
|
|
108
|
-
return getAllMonitorsClientSide(RouterClient, cb);
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* Gets monitor information for a given windowIdentifier or for a specific monitor.
|
|
112
|
-
* If neither the identifier or monitor are provided then the monitorInfo for the current window is returned.
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* The information returned contains:
|
|
116
|
-
*
|
|
117
|
-
* **monitorRect** - The full dimensions for the monitor. <br/>
|
|
118
|
-
* **availableRect** - The dimensions for the available space on the monitor (less the Windows task bar). <br/>
|
|
119
|
-
* **position** - The position of the monitor, numerically from zero to X. Primary monitor is zero. <br/>
|
|
120
|
-
* **whichMonitor** - Contains the string "primary" if it is the primary monitor. <br/>
|
|
121
|
-
*
|
|
122
|
-
* The dimensions are supplemented with the following additional members:
|
|
123
|
-
*
|
|
124
|
-
* **width** - The width as calculated (right - left). <br/>
|
|
125
|
-
* **height** - The height as calculated (bottom - top). <br/>
|
|
126
|
-
*
|
|
127
|
-
* ```javascript
|
|
128
|
-
* // Get the info for the monitor that the calling app is on
|
|
129
|
-
* const {err, data} = await FSBL.Clients.LauncherClient.getMonitorInfo();
|
|
130
|
-
* if(!err){
|
|
131
|
-
* console.log(data);
|
|
132
|
-
* // Example results:
|
|
133
|
-
* // {
|
|
134
|
-
* // availableRect: {width, height, bottom, left, ...},
|
|
135
|
-
* // deviceId: "123456",
|
|
136
|
-
* // deviceScaleFactor: 2,
|
|
137
|
-
* // displayDeviceActive: true,
|
|
138
|
-
* // monitor: {dipRect, scaledRect},
|
|
139
|
-
* // monitorRect: {width, height, bottom, left, right, ...}
|
|
140
|
-
* // name: "device0",
|
|
141
|
-
* // position: 0,
|
|
142
|
-
* // taskbar: {top, left, right, bottom, width, ...}
|
|
143
|
-
* // whichMonitor: "primary"
|
|
144
|
-
* // }
|
|
145
|
-
* }
|
|
146
|
-
*
|
|
147
|
-
* // Get monitor info for a given window
|
|
148
|
-
* const {err, data} = await FSBL.Clients.LauncherClient.getMonitorInfo({
|
|
149
|
-
* windowIdentifier: {
|
|
150
|
-
* windowName: "ABC-uuid"
|
|
151
|
-
* }
|
|
152
|
-
* });
|
|
153
|
-
* if(!err){
|
|
154
|
-
* console.log(`App ABC-uuid is currently on the monitor with index ${data.position}`);
|
|
155
|
-
* }
|
|
156
|
-
*
|
|
157
|
-
* // Get the dimensions of the first non-primary monitor
|
|
158
|
-
* const {err, data} = await FSBL.Clients.LauncherClient.getMonitorInfo({monitor: 1});
|
|
159
|
-
* if(!err){
|
|
160
|
-
* console.log("Available dimensions for monitor[1]: ", data.monitorRect);
|
|
161
|
-
* console.log("Available dimensions, minus claimed space, for monitor[1]: ", data.availableRect);
|
|
162
|
-
* }
|
|
163
|
-
* ```
|
|
164
|
-
*
|
|
165
|
-
* @param params
|
|
166
|
-
* @param params.windowIdentifier The windowIdentifier to get the monitorInfo. If undefined, then the current window.
|
|
167
|
-
* @param params.monitor If passed then a specific monitor is identified. Valid values include:
|
|
168
|
-
*
|
|
169
|
-
* <b>"mine"</b> - Place the window on the same monitor as the calling window.
|
|
170
|
-
*
|
|
171
|
-
* Integer value from 0-n (0 being the primary monitor).
|
|
172
|
-
*
|
|
173
|
-
* <b>"primary"</b> indicates the user's primary monitor.
|
|
174
|
-
*
|
|
175
|
-
* <b>"all"</b> - Put a copy of the component on all monitors.
|
|
176
|
-
* @param cb Returns a monitorInfo object containing the monitorRect and availableRect.
|
|
177
|
-
*
|
|
178
|
-
* @returns A promise that resolves to a monitorInfo
|
|
179
|
-
*/
|
|
180
|
-
export const getMonitorInfo = async (params = {}, cb) => {
|
|
181
|
-
Logger.system.debug("LauncherClient.getMonitorInfo()");
|
|
182
|
-
if (params.monitor === "all") {
|
|
183
|
-
Logger.deprecated(`Use of type "all" in LauncherClient.getMonitorInfo() is deprecated. Please use LauncherClient.getMonitorInfoAll()`);
|
|
184
|
-
return getMonitorInfoAll(cb);
|
|
185
|
-
}
|
|
186
|
-
return getWhichMonitorClientSide(RouterClient, params, cb);
|
|
187
|
-
};
|
|
188
|
-
/**
|
|
189
|
-
* 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.
|
|
190
|
-
* If invoked on a tabbed window or a window in a group, the window will be removed from the tab/group.
|
|
191
|
-
*
|
|
192
|
-
* 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.
|
|
193
|
-
*
|
|
194
|
-
* ```javascript
|
|
195
|
-
* FSBL.Clients.LauncherClient.showWindow({windowName: "Welcome Component-86-3416-Finsemble", componentType: "Welcome Component"}, {spawnIfNotFound: true}, (err, data)=> {});
|
|
196
|
-
* ```
|
|
197
|
-
* @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.
|
|
198
|
-
* @param params Configuration settings from the <i><a href="/docs/reference/ConfigReference#finsemble-appd---manifest-window">finsemble.appd[].manifest.window</a></i> section of the application manifest may be used as parameters to this function, except for the `options` element.
|
|
199
|
-
* These are the same as <a href="/docs/reference/typedocs/modules/LauncherClient#spawn">LauncherClient.spawn()</a> with the following exceptions:
|
|
200
|
-
* <ul>
|
|
201
|
-
* <li><b>monitor</b> - Same as spawn() except that null or undefined means don't move the window to a different monitor.</li>
|
|
202
|
-
* <li><b>left</b> - Same as spawn() except that null or undefined means don't move the window from current horizontal location.</li>
|
|
203
|
-
* <li><b>top</b> - Same as spawn() except that null or undefined means don't move the window from current vertical location.</li>
|
|
204
|
-
* <li><b>slave</b> - 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).</li>
|
|
205
|
-
* <li><b>spawnIfNotFound</b> - If true, then spawns a new window if the requested one cannot be found. Note: only works if the windowIdentifier contains a componentType.</li>
|
|
206
|
-
* <li><b>autoFocus</b> - Whether or not the window should be focused when shown.</li>
|
|
207
|
-
* </ul>
|
|
208
|
-
* @param cb Callback to be invoked after the function is completed regardless if the call fails or succeeds.
|
|
209
|
-
* Callback contains two arguments in the following order.
|
|
210
|
-
* <ol>
|
|
211
|
-
* <li><b>error</b>: 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.</li>
|
|
212
|
-
* <li><b>data</b>: an object with the following information:
|
|
213
|
-
* <ul>
|
|
214
|
-
* <li><b>windowIdentifier</b> - The <a href="/docs/productivity/componentTypesAndWindowNames">WindowIdentifier</a> for the new window.</li>
|
|
215
|
-
* <li><b>windowDescriptor</b> - The <a href="/docs/productivity/componentTypesAndWindowNames">WindowDescriptor</a> of the new window.</li>
|
|
216
|
-
* <li><b>finWindow</b> - A <code>finWindow</code> object referencing the new window.</li>
|
|
217
|
-
* </ul>
|
|
218
|
-
* </li>
|
|
219
|
-
* </ol>
|
|
220
|
-
*/
|
|
221
|
-
export const showWindow = async (windowLocator, params, cb) => {
|
|
222
|
-
if (!params) {
|
|
223
|
-
params = {};
|
|
224
|
-
}
|
|
225
|
-
params = clone(params);
|
|
226
|
-
if (!params.staggerPixels && params.staggerPixels !== 0) {
|
|
227
|
-
params.staggerPixels = 100;
|
|
228
|
-
}
|
|
229
|
-
params.windowIdentifier = locatorToIdentifier(windowLocator);
|
|
230
|
-
const myWindowIdentifier = await getMyWindowIdentifierUtil();
|
|
231
|
-
if (!params.relativeWindow) {
|
|
232
|
-
params.relativeWindow = myWindowIdentifier;
|
|
233
|
-
}
|
|
234
|
-
await SystemManagerClient.waitForStartup("windowService");
|
|
235
|
-
const { err, response } = await RouterClient.query("Launcher.showWindow", params);
|
|
236
|
-
if (err) {
|
|
237
|
-
cb === null || cb === void 0 ? void 0 : cb(err);
|
|
238
|
-
return { err };
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
const name = response.data.windowIdentifier.windowName;
|
|
242
|
-
const { wrap: finWindow } = await FinsembleWindow.getInstance({
|
|
243
|
-
name,
|
|
244
|
-
});
|
|
245
|
-
const data = Object.assign(Object.assign({}, response.data), { windowIdentifier: Object.assign(Object.assign({}, response.data.windowIdentifier), { name }), finWindow });
|
|
246
|
-
cb === null || cb === void 0 ? void 0 : cb(err, data);
|
|
247
|
-
return { err, data: data };
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
/**
|
|
251
|
-
* 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.
|
|
252
|
-
* Call this method from the click handler for your element. Your child window will need to close itself on blur events.
|
|
253
|
-
* 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.
|
|
254
|
-
* @param element The DOM element, or selector, clicked by the end user.
|
|
255
|
-
* @param windowIdentifier Identifies the child window
|
|
256
|
-
* @param params Parameters to be passed to <a href="/docs/reference/typedocs/modules/LauncherClient#showWindow">LauncherClient.showWindow()</a> if the child window is allowed to open
|
|
257
|
-
*/
|
|
258
|
-
export const toggleWindowOnClick = (element, windowLocator, params) => {
|
|
259
|
-
var _a, _b;
|
|
260
|
-
const windowIdentifier = locatorToIdentifier(windowLocator);
|
|
261
|
-
const key = (_b = (_a = windowIdentifier.windowName) !== null && _a !== void 0 ? _a : windowIdentifier.componentType) !== null && _b !== void 0 ? _b : "";
|
|
262
|
-
// If the element was clicked while the menu was open then return right away. The menu window will receive a blur event and close.
|
|
263
|
-
// This method is dependent on the fact that blur events are processed before click events.
|
|
264
|
-
// If this turns out to be a problem then put this call inside of a setTimeout().
|
|
265
|
-
if (okayToOpenMenu[key] === false) {
|
|
266
|
-
okayToOpenMenu[key] = true;
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
const onDisplayed = (showError, showResponse) => {
|
|
270
|
-
if (!showResponse)
|
|
271
|
-
return;
|
|
272
|
-
const { finWindow } = showResponse;
|
|
273
|
-
const onBlur = () => {
|
|
274
|
-
okayToOpenMenu[key] = true;
|
|
275
|
-
isMouseOverDOMElement(element, (mouseIsOverElement) => {
|
|
276
|
-
okayToOpenMenu[key] = !mouseIsOverElement;
|
|
277
|
-
});
|
|
278
|
-
finWindow.removeEventListener("blurred", onBlur);
|
|
279
|
-
};
|
|
280
|
-
finWindow.addEventListener("blurred", onBlur);
|
|
281
|
-
};
|
|
282
|
-
if (!params.position)
|
|
283
|
-
params.position = "absolute";
|
|
284
|
-
showWindow(windowLocator, params, onDisplayed);
|
|
285
|
-
};
|
|
286
|
-
const waitForReadySignal = (name) => new Promise((resolve) => {
|
|
287
|
-
// Wait for a definite message that the component is ready (that FSBL has been initialized in the spawned app).
|
|
288
|
-
const subscriberID = RouterClient.subscribe(`Finsemble.${name}.componentReady`, (error, response) => {
|
|
289
|
-
if (error || !response.data) {
|
|
290
|
-
Logger.system.error(`RouterClient.waitForReadySignal() Error subscribing for component ready state ${error}`);
|
|
291
|
-
resolve(error);
|
|
292
|
-
// Ignore the initial "uninitialized" state message delivered by subscribe (the one with an empty string).
|
|
293
|
-
}
|
|
294
|
-
else if (Object.keys(response.data).length) {
|
|
295
|
-
// A second message will arrive with the actual data. Now we know that the client has initialized and signaled its readiness.
|
|
296
|
-
RouterClient.unsubscribe(subscriberID);
|
|
297
|
-
resolve(null);
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
const callSpawn = async (params) => {
|
|
302
|
-
const { err, response } = await RouterClient.query("Launcher.spawn", params);
|
|
303
|
-
Logger.system.debug("CallSpawn", "Initial launcher callback params", err, response);
|
|
304
|
-
if (err || !response) {
|
|
305
|
-
const error = err !== null && err !== void 0 ? err : `Internal error: callSpawn(): No data returned from service for "Launcher.spawn"`;
|
|
306
|
-
return { err: error };
|
|
307
|
-
}
|
|
308
|
-
else {
|
|
309
|
-
const { data: spawnResponseData } = response;
|
|
310
|
-
if (spawnResponseData.stackedWindow) {
|
|
311
|
-
return { err: "Legacy stacked window spawn" };
|
|
312
|
-
}
|
|
313
|
-
let spawnedWindowNames = [];
|
|
314
|
-
let spawnResponse;
|
|
315
|
-
// If we receive an array of spawn response means we've spawned a launch group.
|
|
316
|
-
// We select the first spawn response as the result so that a finWindow is available,
|
|
317
|
-
// additionally we put all the window names in an array and assigned it to a launchGroupWindows
|
|
318
|
-
// property to be placed in the result object so that we have all available window names for the
|
|
319
|
-
// launch group
|
|
320
|
-
if (Array.isArray(spawnResponseData)) {
|
|
321
|
-
spawnedWindowNames = spawnResponseData.reduce((acc, curr) => {
|
|
322
|
-
acc.push(curr.windowIdentifier.windowName);
|
|
323
|
-
return acc;
|
|
324
|
-
}, []);
|
|
325
|
-
spawnResponse = spawnResponseData[0];
|
|
326
|
-
}
|
|
327
|
-
else {
|
|
328
|
-
spawnResponse = spawnResponseData;
|
|
329
|
-
}
|
|
330
|
-
const name = spawnResponse.windowIdentifier.windowName;
|
|
331
|
-
const { wrap: finWindow } = await FinsembleWindow.getInstance({
|
|
332
|
-
name,
|
|
333
|
-
});
|
|
334
|
-
const result = Object.assign(Object.assign({}, spawnResponse), { windowIdentifier: Object.assign(Object.assign({}, spawnResponse.windowIdentifier), { name }),
|
|
335
|
-
// Add a wrapped finWindow to the response (this can only be done client side)
|
|
336
|
-
finWindow });
|
|
337
|
-
// if we have an array of window names - means spawn of launchGroup
|
|
338
|
-
// so lets add it to the result
|
|
339
|
-
if (spawnedWindowNames.length > 0) {
|
|
340
|
-
result.launchGroupWindows = spawnedWindowNames;
|
|
341
|
-
}
|
|
342
|
-
Logger.system.debug("CallSpawn", "Waiting for ready signal", name);
|
|
343
|
-
const waitError = await waitForReadySignal(name);
|
|
344
|
-
Logger.system.debug("CallSpawn", "Got ready signal", name);
|
|
345
|
-
return { err: waitError, result };
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
/**
|
|
349
|
-
* Asks the Launcher service to spawn a new component. Any parameter below can also be specified in <i>public/config/components.json</i>, which will
|
|
350
|
-
* then operate as the default for that value.
|
|
351
|
-
*
|
|
352
|
-
* The launcher parameters mimic CSS window positioning.
|
|
353
|
-
* For instance, to set a full screen window use `{left: 0, top: 0, right: 0, bottom: 0}`.
|
|
354
|
-
* This is functionally equivalent to: `{left: 0, top: 0, width: "100%", height: "100%"}`.
|
|
355
|
-
*
|
|
356
|
-
* You can also spawn more than one component at a time by using a single action, such as clicking a button on a menu.
|
|
357
|
-
* See https://github.com/ChartIQ/finsemble-seed/tree/recipes/SpawnComponentGroup for an example of spawning a component group.
|
|
358
|
-
*
|
|
359
|
-
* ```javascript
|
|
360
|
-
* FSBL.Clients.LauncherClient.spawn("Welcome Component", {left: 0, top: 0, position: "relative"}, (err, data)=> {});
|
|
361
|
-
* ```
|
|
362
|
-
* @param component The application or component to spawn.
|
|
363
|
-
* @param params Configuration settings from the <i><a href="/docs/reference/ConfigReference#finsemble-appd---manifest-window">finsemble.appd[].manifest.window</a></i> section of the application manifest may be used as parameters to this function, except for the `options` element.
|
|
364
|
-
* @param cb Function invoked after the window is created
|
|
365
|
-
*/
|
|
366
|
-
export const spawn = async (component, params, cb) => {
|
|
367
|
-
if (!params) {
|
|
368
|
-
params = {};
|
|
369
|
-
}
|
|
370
|
-
params = clone(params);
|
|
371
|
-
params.component = component;
|
|
372
|
-
if (!params.options) {
|
|
373
|
-
params.options = {};
|
|
374
|
-
}
|
|
375
|
-
if (!params.options.customData) {
|
|
376
|
-
params.options.customData = {};
|
|
377
|
-
}
|
|
378
|
-
if (!params.staggerPixels && params.staggerPixels !== 0) {
|
|
379
|
-
params.staggerPixels = 50;
|
|
380
|
-
}
|
|
381
|
-
Logger.system.debug(`LauncherClient.spawn starting for componentType:${component}`);
|
|
382
|
-
await SystemManagerClient.waitForStartup("windowService");
|
|
383
|
-
const windowIdentifier = await getMyWindowIdentifierUtil();
|
|
384
|
-
params.launchingWindow = windowIdentifier;
|
|
385
|
-
const { err, result: response } = await callSpawn(params);
|
|
386
|
-
Logger.system.debug(`LauncherClient.spawn completing for componentType:${component}`, err);
|
|
387
|
-
cb === null || cb === void 0 ? void 0 : cb(err, response);
|
|
388
|
-
return { error: err, response: response };
|
|
389
|
-
};
|
|
390
|
-
/**
|
|
391
|
-
* Spawns a set of apps and assembles them into a tab collection. Spawn parameters may be specified for the entire collection
|
|
392
|
-
* or for individual apps, however, positioning parameters (e.g. `left` or `top`) are disregarded when set on individual apps.
|
|
393
|
-
*
|
|
394
|
-
* ```javascript
|
|
395
|
-
* await FSBL.Clients.LauncherClient.spawnTabCollection({
|
|
396
|
-
* componentList: [{appID: "Welcome Component", individualParams: { alwaysOnTop : true } }],
|
|
397
|
-
* globalParams: { left: 100, top: 100}
|
|
398
|
-
* });
|
|
399
|
-
* ```
|
|
400
|
-
* @param __namedParameters.componentList - The apps to open. Each should be an object that contains the appID (from AppD) and an optional set of SpawnParams.
|
|
401
|
-
* @param __namedParameters.globalParams - Positioning parameters for the collection. If omitted then the collection will be spawned in a default location.
|
|
402
|
-
* @returns - Resolves to an object that contains the id of the tab collection and the list of window names for the spawned apps
|
|
403
|
-
*/
|
|
404
|
-
export const spawnTabCollection = async ({ componentList, globalParams, }, cb) => {
|
|
405
|
-
Logger.system.debug(`LauncherClient.spawn starting for componentType: tabCollection`);
|
|
406
|
-
await SystemManagerClient.waitForStartup("windowService");
|
|
407
|
-
const windowIdentifier = await getMyWindowIdentifierUtil();
|
|
408
|
-
globalParams = globalParams !== null && globalParams !== void 0 ? globalParams : {};
|
|
409
|
-
globalParams.launchingWindow = windowIdentifier;
|
|
410
|
-
const { err, response } = await RouterClient.query("Launcher.spawnTabCollection", {
|
|
411
|
-
componentList,
|
|
412
|
-
globalParams,
|
|
413
|
-
});
|
|
414
|
-
const { id, windows } = response.data;
|
|
415
|
-
let result = {
|
|
416
|
-
id: id,
|
|
417
|
-
windows: [],
|
|
418
|
-
};
|
|
419
|
-
for (const res of windows) {
|
|
420
|
-
const name = res.windowIdentifier.windowName;
|
|
421
|
-
const { wrap: finWindow } = await FinsembleWindow.getInstance({
|
|
422
|
-
name,
|
|
423
|
-
});
|
|
424
|
-
result.windows.push(Object.assign(Object.assign({}, res), { windowIdentifier: Object.assign(Object.assign({}, res.windowIdentifier), { name }),
|
|
425
|
-
// Add a wrapped finWindow to the response (this can only be done client side)
|
|
426
|
-
finWindow }));
|
|
427
|
-
}
|
|
428
|
-
Logger.system.debug(`LauncherClient.spawn completing for tabCollection`, err);
|
|
429
|
-
cb === null || cb === void 0 ? void 0 : cb(err, result);
|
|
430
|
-
return { err: err, data: result };
|
|
431
|
-
};
|
|
432
|
-
/**
|
|
433
|
-
* Returns a windowIdentifier for the current window.
|
|
434
|
-
*
|
|
435
|
-
* ```javascript
|
|
436
|
-
* const myWindowIdentifier = await FSBL.Clients.LauncherClient.getMyWindowIdentifier();
|
|
437
|
-
* console.log(myWindowIdentifier);
|
|
438
|
-
* // {
|
|
439
|
-
* // windowName: "ABC-uuid",
|
|
440
|
-
* // componentType: "ABC"
|
|
441
|
-
* // }
|
|
442
|
-
* ```
|
|
443
|
-
*
|
|
444
|
-
* @param cb Callback function returns windowIdentifier for this window (optional or use the returned Promise)
|
|
445
|
-
* @returns A promise that resolves to a windowIdentifier
|
|
446
|
-
*/
|
|
447
|
-
export const getMyWindowIdentifier = async (cb) => {
|
|
448
|
-
const wi = await getMyWindowIdentifierUtil();
|
|
449
|
-
cb === null || cb === void 0 ? void 0 : cb(wi);
|
|
450
|
-
return wi;
|
|
451
|
-
};
|
|
452
|
-
/**
|
|
453
|
-
* Gets the windowDescriptor for all open windows.
|
|
454
|
-
*
|
|
455
|
-
* :::note
|
|
456
|
-
* This returns descriptors even if the window is not part of the workspace.
|
|
457
|
-
* :::
|
|
458
|
-
*
|
|
459
|
-
* ```javascript
|
|
460
|
-
* FSBL.Clients.LauncherClient.getActiveDescriptors(function (error, response) {
|
|
461
|
-
* if (error) {
|
|
462
|
-
* Logger.system.error("Error getting active descriptors: ", + JSON.stringify(error));
|
|
463
|
-
* } else {
|
|
464
|
-
* const activeDescriptors = response;
|
|
465
|
-
* //{
|
|
466
|
-
* // ...
|
|
467
|
-
* // Toolbar-1-Finsemble: {...},
|
|
468
|
-
* // Welcome-Component-80-6453-Finsemble: {...},
|
|
469
|
-
* // ...
|
|
470
|
-
* //}
|
|
471
|
-
* }
|
|
472
|
-
* });
|
|
473
|
-
* ```
|
|
474
|
-
* @param cb Callback returns an object containing windowDescriptors keyed by name.
|
|
475
|
-
*/
|
|
476
|
-
export const getActiveDescriptors = async (cb) => {
|
|
477
|
-
await SystemManagerClient.waitForStartup("windowService");
|
|
478
|
-
const { err, response } = await RouterClient.query("Launcher.getActiveDescriptors", {});
|
|
479
|
-
if (err)
|
|
480
|
-
Logger.system.error(err);
|
|
481
|
-
cb === null || cb === void 0 ? void 0 : cb(err, response.data);
|
|
482
|
-
return { err, data: response.data };
|
|
483
|
-
};
|
|
484
|
-
/**
|
|
485
|
-
* @private Adds a custom component.
|
|
486
|
-
* @ignore
|
|
487
|
-
*/
|
|
488
|
-
export const addUserDefinedComponent = async (params, cb) => {
|
|
489
|
-
await SystemManagerClient.waitForStartup("windowService");
|
|
490
|
-
const { err } = await RouterClient.query("Launcher.userDefinedComponentUpdate", {
|
|
491
|
-
type: "add",
|
|
492
|
-
name: params.name,
|
|
493
|
-
url: params.url,
|
|
494
|
-
});
|
|
495
|
-
if (err)
|
|
496
|
-
Logger.system.error(err);
|
|
497
|
-
cb === null || cb === void 0 ? void 0 : cb(err);
|
|
498
|
-
return { err };
|
|
499
|
-
};
|
|
500
|
-
/**
|
|
501
|
-
* @private Adds a custom component.
|
|
502
|
-
* @ignore
|
|
503
|
-
*/
|
|
504
|
-
export const removeUserDefinedComponent = async (params, cb) => {
|
|
505
|
-
await SystemManagerClient.waitForStartup("windowService");
|
|
506
|
-
const { err } = await RouterClient.query("Launcher.userDefinedComponentUpdate", {
|
|
507
|
-
type: "remove",
|
|
508
|
-
name: params.name,
|
|
509
|
-
url: params.url,
|
|
510
|
-
});
|
|
511
|
-
if (err)
|
|
512
|
-
Logger.system.error(err);
|
|
513
|
-
cb === null || cb === void 0 ? void 0 : cb(err);
|
|
514
|
-
return { err };
|
|
515
|
-
};
|
|
516
|
-
/**
|
|
517
|
-
* Adds new FDC3 App(s) to Finsemble.
|
|
518
|
-
*
|
|
519
|
-
* ```javascript
|
|
520
|
-
* const {err, data} = await FSBL.Clients.AppsClient.addApps([anFDC3App]);
|
|
521
|
-
* ```
|
|
522
|
-
*
|
|
523
|
-
* @param apps The array of FDC3AppDefinition to add
|
|
524
|
-
* @param cb The callback to be invoked after the apps are set or on error.
|
|
525
|
-
*/
|
|
526
|
-
const addApps = async (apps, cb) => {
|
|
527
|
-
if (!Array.isArray(apps)) {
|
|
528
|
-
const err = "The input was not an array. Please pass an array of type: FDC3AppDefinition[] (including if only adding a single app)";
|
|
529
|
-
cb === null || cb === void 0 ? void 0 : cb(err);
|
|
530
|
-
return { err };
|
|
531
|
-
}
|
|
532
|
-
const { err, response } = await RouterClient.query("configService.addApps", apps);
|
|
533
|
-
cb === null || cb === void 0 ? void 0 : cb(err, response.data);
|
|
534
|
-
return { err, data: response.data };
|
|
535
|
-
};
|
|
536
|
-
/**
|
|
537
|
-
* Removes an FDC3 App(s) from Finsemble.
|
|
538
|
-
*
|
|
539
|
-
* ```javascript
|
|
540
|
-
* const {err, data} = await FSBL.Clients.AppsClient.removeApps(["fdc3AppId"]);
|
|
541
|
-
* ```
|
|
542
|
-
*
|
|
543
|
-
* @param apps The array of appIds to remove
|
|
544
|
-
* @param cb The callback to be invoked after the apps are removed or on error.
|
|
545
|
-
*
|
|
546
|
-
*/
|
|
547
|
-
const removeApps = async (appIds, cb) => {
|
|
548
|
-
if (!Array.isArray(appIds)) {
|
|
549
|
-
const err = "The input was not an array. Please pass an array of string appIds to remove (including if only removing a single app)";
|
|
550
|
-
cb === null || cb === void 0 ? void 0 : cb(err);
|
|
551
|
-
return { err };
|
|
552
|
-
}
|
|
553
|
-
const { err, response } = await RouterClient.query("configService.removeApps", appIds);
|
|
554
|
-
cb === null || cb === void 0 ? void 0 : cb(err, response.data);
|
|
555
|
-
return { err, data: response.data };
|
|
556
|
-
};
|
|
557
|
-
/**
|
|
558
|
-
* Retrieves a list of apps from Finsemble
|
|
559
|
-
*
|
|
560
|
-
* @param appIds an array of app IDs to retrieve. If not provided, all apps will be retrieved.
|
|
561
|
-
* @param cb The callback to be invoked after the apps are retrieved or on error.
|
|
562
|
-
* @returns A promise that resolves to an array of app objects.
|
|
563
|
-
*/
|
|
564
|
-
const getApps = async (appIds, cb) => {
|
|
565
|
-
if (appIds && !Array.isArray(appIds)) {
|
|
566
|
-
const err = "The input was not an array. Please pass an array of string appIds to fetch (including if only retrieving a single app)";
|
|
567
|
-
cb === null || cb === void 0 ? void 0 : cb(err);
|
|
568
|
-
return { err };
|
|
569
|
-
}
|
|
570
|
-
const { err, response } = await RouterClient.query("configService.getApps", appIds);
|
|
571
|
-
cb === null || cb === void 0 ? void 0 : cb(err, response.data);
|
|
572
|
-
return { err, data: response.data };
|
|
573
|
-
};
|
|
9
|
+
import AppsClient from "./appsClient";
|
|
10
|
+
import { Logger } from "./logger";
|
|
574
11
|
/**
|
|
575
12
|
* @ignore
|
|
576
13
|
*/
|
|
@@ -592,38 +29,35 @@ export const LauncherClient = {
|
|
|
592
29
|
Logger.system.deprecated("It is no longer necessary to call LauncherClient.onReady()");
|
|
593
30
|
cb === null || cb === void 0 ? void 0 : cb();
|
|
594
31
|
},
|
|
595
|
-
addToGroups,
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
createWindowGroup,
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
getMyWindowIdentifier,
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
32
|
+
addToGroups: AppsClient.addToGroups,
|
|
33
|
+
getGroupsForWindow: AppsClient.getGroupsForWindow,
|
|
34
|
+
removeWindowsFromGroup: AppsClient.removeWindowsFromGroup,
|
|
35
|
+
addWindowsToGroup: AppsClient.addWindowsToGroup,
|
|
36
|
+
createWindowGroup: AppsClient.createWindowGroup,
|
|
37
|
+
minimizeWindows: AppsClient.minimizeWindows,
|
|
38
|
+
hyperFocus: AppsClient.hyperFocus,
|
|
39
|
+
bringWindowsToFront: AppsClient.bringWindowsToFront,
|
|
40
|
+
getComponentsThatCanReceiveDataTypes: AppsClient.getComponentsThatCanReceiveDataTypes,
|
|
41
|
+
removeUserDefinedComponent: AppsClient.removeUserDefinedComponent,
|
|
42
|
+
addUserDefinedComponent: AppsClient.addUserDefinedComponent,
|
|
43
|
+
getPendingWindows: AppsClient.getPendingWindows,
|
|
44
|
+
getActiveAndPendingWindowNames: AppsClient.getActiveAndPendingWindowNames,
|
|
45
|
+
getActiveDescriptors: AppsClient.getActiveDescriptors,
|
|
46
|
+
getMyWindowIdentifier: AppsClient.getMyWindowIdentifier,
|
|
47
|
+
getMonitor: AppsClient.getMonitor,
|
|
48
|
+
spawn: AppsClient.spawn,
|
|
49
|
+
toggleWindowOnClick: AppsClient.toggleWindowOnClick,
|
|
50
|
+
showWindow: AppsClient.showWindow,
|
|
51
|
+
unRegisterComponent: AppsClient.unRegisterComponent,
|
|
52
|
+
registerComponent: AppsClient.registerComponent,
|
|
53
|
+
getMonitorInfo: AppsClient.getMonitorInfo,
|
|
54
|
+
getMonitorInfoAll: AppsClient.getMonitorInfoAll,
|
|
55
|
+
getComponentDefaultConfig: AppsClient.getComponentDefaultConfig,
|
|
56
|
+
getComponentList: AppsClient.getComponentList,
|
|
57
|
+
addApps: AppsClient.addApps,
|
|
58
|
+
removeApps: AppsClient.removeApps,
|
|
59
|
+
getApps: AppsClient.getApps,
|
|
60
|
+
spawnTabCollection: AppsClient.spawnTabCollection,
|
|
624
61
|
};
|
|
625
|
-
/**
|
|
626
|
-
* @ignore
|
|
627
|
-
*/
|
|
628
62
|
export default LauncherClient;
|
|
629
63
|
//# sourceMappingURL=launcherClient.js.map
|