@openfin/workspace-platform 5.6.2 → 6.0.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/README.md +1 -1
- package/client-api/src/shapes.d.ts +12 -2
- package/client-api/src/templates.d.ts +135 -0
- package/client-api-platform/src/api/app-directory.d.ts +1 -1
- package/client-api-platform/src/api/browser/browser-module.d.ts +6 -1
- package/client-api-platform/src/api/browser/index.d.ts +5 -2
- package/client-api-platform/src/api/context-menu/browser-logo-handler.d.ts +2 -9
- package/client-api-platform/src/api/context-menu/browser-pagetab-handler.d.ts +3 -0
- package/client-api-platform/src/api/context-menu/browser-viewtab-handler.d.ts +3 -0
- package/client-api-platform/src/api/context-menu/index.d.ts +9 -2
- package/client-api-platform/src/api/index.d.ts +4 -0
- package/client-api-platform/src/api/protocol.d.ts +2 -1
- package/client-api-platform/src/index.d.ts +2 -40
- package/client-api-platform/src/init/index.d.ts +35 -3
- package/client-api-platform/src/init/utils.d.ts +3 -15
- package/client-api-platform/src/shapes.d.ts +380 -19
- package/common/src/api/browser-protocol.d.ts +10 -1
- package/common/src/utils/defer-show.d.ts +46 -0
- package/common/src/utils/env.d.ts +0 -6
- package/common/src/utils/global-context-menu.d.ts +2 -1
- package/common/src/utils/landing-page.d.ts +1 -1
- package/common/src/utils/page-tab-context-menu.d.ts +2 -0
- package/common/src/utils/window.d.ts +3 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/search-api/src/common.d.ts +2 -2
- package/search-api/src/provider/internal.d.ts +1 -1
- package/search-api/src/provider/remote/registration.d.ts +2 -2
- package/search-api/src/shapes.d.ts +2 -2
- package/common/src/utils/defer-auto-show.d.ts +0 -18
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/// <reference types="openfin-adapter/fin" />
|
|
2
2
|
import type { InteropBroker } from 'openfin-adapter/src/api/interop';
|
|
3
3
|
import { NamedIdentity } from 'openfin-adapter/src/identity';
|
|
4
|
+
import { IconProps } from '@openfin/ui-library';
|
|
4
5
|
import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '../../common/src/api/pages/shapes';
|
|
5
6
|
import type { CustomThemes } from '../../common/src/api/theming';
|
|
6
7
|
import type { App } from '../../client-api/src/shapes';
|
|
7
|
-
import { MenuData } from './api/context-menu/browser-logo-handler';
|
|
8
8
|
export type { CustomThemes } from '../../common/src/api/theming';
|
|
9
9
|
export type { App, Image, AppIntent } from '../../client-api/src/shapes';
|
|
10
10
|
export { AppManifestType } from '../../client-api/src/shapes';
|
|
11
11
|
export type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs, PageLayout, PageLayoutDetails } from '../../common/src/api/pages/shapes';
|
|
12
|
-
import type { IconProps } from '@openfin/ui-library';
|
|
13
12
|
/**
|
|
14
13
|
* Request for creating a saved page in persistent storage.
|
|
15
14
|
*/
|
|
@@ -41,19 +40,150 @@ export interface OpenGlobalContextMenuRequest {
|
|
|
41
40
|
x: number;
|
|
42
41
|
/** Screen y-coordinate where context menu should be shown. */
|
|
43
42
|
y: number;
|
|
44
|
-
/**
|
|
43
|
+
/** Miscellaneous options necessary for implementing custom logic in the provider override. */
|
|
45
44
|
customData?: any;
|
|
46
45
|
}
|
|
46
|
+
/**Shape of the data property of a context menu template item */
|
|
47
|
+
export interface ContextMenuItemData {
|
|
48
|
+
type: string;
|
|
49
|
+
action?: CustomActionSpecifier;
|
|
50
|
+
}
|
|
51
|
+
/**Types of global context menu options, including pre-defined ones.
|
|
52
|
+
* User-defined context menu items should use the value `Custom` */
|
|
53
|
+
export declare enum GlobalContextMenuOptionType {
|
|
54
|
+
NewWindow = "NewWindow",
|
|
55
|
+
NewPage = "NewPage",
|
|
56
|
+
CloseWindow = "CloseWindow",
|
|
57
|
+
OpenStorefront = "OpenStorefront",
|
|
58
|
+
Quit = "Quit",
|
|
59
|
+
Custom = "Custom"
|
|
60
|
+
}
|
|
61
|
+
/**Types of page tab context menu options, including pre-defined ones.
|
|
62
|
+
* User-defined context menu items should use the value `Custom` */
|
|
63
|
+
export declare enum PageTabContextMenuOptionType {
|
|
64
|
+
Close = "Close",
|
|
65
|
+
Duplicate = "Duplicate",
|
|
66
|
+
Rename = "Rename",
|
|
67
|
+
Save = "Save",
|
|
68
|
+
Custom = "Custom"
|
|
69
|
+
}
|
|
70
|
+
/**Shape of the data property of a global context menu template item */
|
|
71
|
+
export interface GlobalContextMenuItemData extends ContextMenuItemData {
|
|
72
|
+
type: GlobalContextMenuOptionType;
|
|
73
|
+
}
|
|
74
|
+
/**Configuration of an option in the global context menu */
|
|
75
|
+
export interface GlobalContextMenuItemTemplate extends OpenFin.MenuItemTemplate {
|
|
76
|
+
data: GlobalContextMenuItemData;
|
|
77
|
+
}
|
|
78
|
+
/**Shape of the data property of a page tab context menu template item */
|
|
79
|
+
export interface PageTabContextMenuItemData extends ContextMenuItemData {
|
|
80
|
+
type: PageTabContextMenuOptionType;
|
|
81
|
+
}
|
|
82
|
+
/**Configuration of an option in the page tab context menu */
|
|
83
|
+
export interface PageTabContextMenuItemTemplate extends OpenFin.MenuItemTemplate {
|
|
84
|
+
data: PageTabContextMenuItemData;
|
|
85
|
+
}
|
|
86
|
+
/**Payload received by a Custom Action that is invoked by a custom global context menu option */
|
|
87
|
+
export interface GlobalContextMenuOptionActionPayload {
|
|
88
|
+
callerType: CustomActionCallerType.GlobalContextMenu;
|
|
89
|
+
/** Identity of the browser window where the context menu is invoked */
|
|
90
|
+
windowIdentity: OpenFin.Identity;
|
|
91
|
+
/** Any data necessary for the functioning of specified custom action*/
|
|
92
|
+
customData?: any;
|
|
93
|
+
}
|
|
94
|
+
/**Payload received by a Custom Action that is invoked by a custom page tab context menu option */
|
|
95
|
+
export interface PageTabContextMenuOptionActionPayload {
|
|
96
|
+
callerType: CustomActionCallerType.PageTabContextMenu;
|
|
97
|
+
/** Identity of the browser window where the context menu is invoked */
|
|
98
|
+
windowIdentity: OpenFin.Identity;
|
|
99
|
+
/** Any data necessary for the functioning of specified custom action*/
|
|
100
|
+
customData?: any;
|
|
101
|
+
/** Id of the page on which the context menu is invoked */
|
|
102
|
+
pageId: string;
|
|
103
|
+
}
|
|
47
104
|
/**
|
|
48
105
|
* Payload received by the openGlobalContextMenu provider override.
|
|
49
106
|
*/
|
|
50
107
|
export declare type OpenGlobalContextMenuPayload = OpenGlobalContextMenuRequest & {
|
|
51
108
|
/** Template defining the options to show in the context menu. */
|
|
52
|
-
template:
|
|
109
|
+
template: GlobalContextMenuItemTemplate[];
|
|
110
|
+
/** Identity of the Browser window where context menu should be shown. */
|
|
111
|
+
identity: NamedIdentity;
|
|
112
|
+
/** Default function that handles stock context menu options. */
|
|
113
|
+
callback: (data: GlobalContextMenuItemData, payload: OpenGlobalContextMenuPayload) => any;
|
|
114
|
+
};
|
|
115
|
+
export interface ViewTabContextMenuTemplate extends OpenFin.MenuItemTemplate {
|
|
116
|
+
data: ViewTabMenuData;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Request for opening a view tab context menu in Browser.
|
|
120
|
+
*/
|
|
121
|
+
export interface OpenViewTabContextMenuRequest {
|
|
122
|
+
/** Screen x-coordinate where context menu should be shown. */
|
|
123
|
+
x: number;
|
|
124
|
+
/** Screen y-coordinate where context menu should be shown. */
|
|
125
|
+
y: number;
|
|
126
|
+
/** Miscellaneous options necessary for implementing custom logic in the provider override. */
|
|
127
|
+
customData?: any;
|
|
128
|
+
/** Template defining the options to show in the context menu. */
|
|
129
|
+
template: ViewTabContextMenuTemplate[];
|
|
130
|
+
selectedViews: OpenFin.Identity[];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Request for opening a page tab context menu in Browser.
|
|
134
|
+
*/
|
|
135
|
+
export interface OpenPageTabContextMenuRequest {
|
|
136
|
+
/** Screen x-coordinate where context menu should be shown. */
|
|
137
|
+
x: number;
|
|
138
|
+
/** Screen y-coordinate where context menu should be shown. */
|
|
139
|
+
y: number;
|
|
140
|
+
/** Miscellaneous options necessary for implementing custom logic in the provider override. */
|
|
141
|
+
customData?: any;
|
|
142
|
+
/** Id of the page on which the context menu is invoked */
|
|
143
|
+
pageId: string;
|
|
144
|
+
}
|
|
145
|
+
export declare enum ViewTabMenuOptionType {
|
|
146
|
+
NewView = "NewView",
|
|
147
|
+
DuplicateViews = "DuplicateView",
|
|
148
|
+
OpenWithDefaultBrowser = "OpenWithDefaultBrowser",
|
|
149
|
+
ReloadViews = "ReloadTab",
|
|
150
|
+
CloseViews = "CloseTab",
|
|
151
|
+
AddToChannel = "AddToChannel",
|
|
152
|
+
RemoveFromChannel = "RemoveFromChannel",
|
|
153
|
+
Custom = "Custom"
|
|
154
|
+
}
|
|
155
|
+
export interface ViewTabMenuData {
|
|
156
|
+
type: ViewTabMenuOptionType;
|
|
157
|
+
action?: CustomActionSpecifier;
|
|
158
|
+
option?: string;
|
|
159
|
+
}
|
|
160
|
+
export interface ViewTabCustomActionPayload {
|
|
161
|
+
callerType: CustomActionCallerType.ViewTabContextMenu;
|
|
162
|
+
/** Any data necessary for the functioning of specified custom action*/
|
|
163
|
+
customData: any;
|
|
164
|
+
/** Identity of the Browser window where context menu should be shown. */
|
|
165
|
+
windowIdentity: NamedIdentity;
|
|
166
|
+
selectedViews: OpenFin.Identity[];
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Payload received by the openViewTabContextMenu provider override.
|
|
170
|
+
*/
|
|
171
|
+
export declare type OpenViewTabContextMenuPayload = OpenViewTabContextMenuRequest & {
|
|
53
172
|
/** Identity of the Browser window where context menu should be shown. */
|
|
54
173
|
identity: NamedIdentity;
|
|
55
174
|
/** Default function that handles stock context menu options. */
|
|
56
|
-
callback: (data:
|
|
175
|
+
callback: (data: ViewTabMenuData, req: OpenViewTabContextMenuPayload) => any;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Payload received by the openViewTabContextMenu provider override.
|
|
179
|
+
*/
|
|
180
|
+
export declare type OpenPageTabContextMenuPayload = OpenPageTabContextMenuRequest & {
|
|
181
|
+
/** Identity of the Browser window where context menu should be shown. */
|
|
182
|
+
identity: NamedIdentity;
|
|
183
|
+
/** Template defining the options to show in the context menu. */
|
|
184
|
+
template: PageTabContextMenuItemTemplate[];
|
|
185
|
+
/** Default function that handles stock context menu options. */
|
|
186
|
+
callback: (data: PageTabContextMenuItemData, req: OpenPageTabContextMenuPayload) => any;
|
|
57
187
|
};
|
|
58
188
|
/**
|
|
59
189
|
* Request to update the attributes of a page in which is attached to a running browser window.
|
|
@@ -64,6 +194,9 @@ export interface UpdateAttachedPageRequest {
|
|
|
64
194
|
/** The updated page. */
|
|
65
195
|
page: Partial<PageWithUpdatableRuntimeAttribs>;
|
|
66
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* Types of buttons on browser windows
|
|
199
|
+
*/
|
|
67
200
|
export declare enum BrowserButtonType {
|
|
68
201
|
ShowHideTabs = "ShowHideTabs",
|
|
69
202
|
ColorLinking = "ColorLinking",
|
|
@@ -78,32 +211,57 @@ export declare enum BrowserButtonType {
|
|
|
78
211
|
* The shape of the payload sent by a custom button click to a custom action handler
|
|
79
212
|
*/
|
|
80
213
|
export interface CustomButtonActionPayload {
|
|
214
|
+
/** Calling the CustomButton type */
|
|
81
215
|
callerType: CustomActionCallerType.CustomButton;
|
|
216
|
+
/** Identity for the current window. */
|
|
82
217
|
windowIdentity: OpenFin.Identity;
|
|
218
|
+
/** Any data necessary for the functioning of specified custom action*/
|
|
83
219
|
customData: any;
|
|
220
|
+
/** Screen x-coordinate where custom button should be shown. */
|
|
84
221
|
x: number;
|
|
222
|
+
/** Screen y-coordinate where custom button should be shown. */
|
|
85
223
|
y: number;
|
|
86
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Custom browser buttons
|
|
227
|
+
*/
|
|
87
228
|
export interface CustomBrowserButtonConfig {
|
|
229
|
+
/** Type of cutom browser button */
|
|
88
230
|
type: BrowserButtonType.Custom;
|
|
231
|
+
/** Button name text when hovered over */
|
|
89
232
|
tooltip: string;
|
|
233
|
+
/** Disable custom button true or false */
|
|
90
234
|
disabled?: boolean;
|
|
235
|
+
/** icon URL for icon image */
|
|
91
236
|
iconUrl: string;
|
|
237
|
+
/** Custom action once the button is clicked */
|
|
92
238
|
action: CustomActionSpecifier;
|
|
93
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Default Browser Button types
|
|
242
|
+
*/
|
|
94
243
|
export interface PreDefinedButtonConfig {
|
|
244
|
+
/** Type of default browser button */
|
|
95
245
|
type: BrowserButtonType;
|
|
246
|
+
/** Button name text when hovered over */
|
|
96
247
|
tooltip?: string;
|
|
248
|
+
/** icon URL for icon image */
|
|
97
249
|
iconUrl?: string;
|
|
98
250
|
iconProps?: IconProps;
|
|
99
251
|
}
|
|
100
252
|
declare type ShowHideTabsConfig = {
|
|
101
253
|
type: BrowserButtonType.ShowHideTabs;
|
|
102
254
|
};
|
|
255
|
+
/**
|
|
256
|
+
* Buttons on the left of WindowStateButtonOptions
|
|
257
|
+
*/
|
|
103
258
|
export declare type IconTrayButton = ShowHideTabsConfig | CustomBrowserButtonConfig | PreDefinedButtonConfig;
|
|
104
259
|
export interface IconTrayOptions {
|
|
105
260
|
buttons: IconTrayButton[];
|
|
106
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Buttons to the top far right of Browser
|
|
264
|
+
*/
|
|
107
265
|
export declare type WindowStateButton = CustomBrowserButtonConfig | PreDefinedButtonConfig;
|
|
108
266
|
export interface WindowStateButtonOptions {
|
|
109
267
|
buttons: WindowStateButton[];
|
|
@@ -309,6 +467,66 @@ export interface BrowserWindowModule {
|
|
|
309
467
|
* @param req the reorder pages request.
|
|
310
468
|
*/
|
|
311
469
|
reorderPages(req: ReorderPagesRequest): Promise<void>;
|
|
470
|
+
/**
|
|
471
|
+
* Replace icon tray options with custom icon tray options
|
|
472
|
+
*
|
|
473
|
+
* ```ts
|
|
474
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
475
|
+
*
|
|
476
|
+
* // to set the array to our default buttons, pass in null
|
|
477
|
+
*
|
|
478
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
479
|
+
* workspacePlatform.Browser.wrapSync(identity).replaceIconTrayOptions({buttons:[{
|
|
480
|
+
* type: 'Custom',
|
|
481
|
+
* tooltip: 'Custom Tooltip',
|
|
482
|
+
* disabled: false,
|
|
483
|
+
* iconUrl: 'https://www.openfin.co/favicon.ico',
|
|
484
|
+
* action: {
|
|
485
|
+
* id: 'sample-custom-action-name',
|
|
486
|
+
* customData: {
|
|
487
|
+
* message: 'Clicked on custom Icon Tray button'
|
|
488
|
+
* }
|
|
489
|
+
* }
|
|
490
|
+
* }]})
|
|
491
|
+
*
|
|
492
|
+
* const openFinWindow = fin.Window.wrapSync(identity);
|
|
493
|
+
* // call getOptions() to view updated iconTrayOptions under workspacePlatform
|
|
494
|
+
* await openFinWindow.getOptions()
|
|
495
|
+
* ```
|
|
496
|
+
* @param options new icon tray options.
|
|
497
|
+
*/
|
|
498
|
+
replaceIconTrayOptions(options: IconTrayOptions): Promise<void>;
|
|
499
|
+
/**
|
|
500
|
+
* Replace window state button options with custom window state button options
|
|
501
|
+
*
|
|
502
|
+
* ```ts
|
|
503
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
504
|
+
*
|
|
505
|
+
* // to set the array to our default buttons, pass in null
|
|
506
|
+
*
|
|
507
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
508
|
+
* workspacePlatform.Browser.wrapSync(identity).replaceWindowStateButtonOptions({buttons:[{
|
|
509
|
+
* type: 'Custom',
|
|
510
|
+
* tooltip: 'Custom tooltip',
|
|
511
|
+
* disabled: false,
|
|
512
|
+
* iconUrl: 'https://www.openfin.co/favicon.ico',
|
|
513
|
+
* action: {
|
|
514
|
+
* id: 'sample-custom-action-name',
|
|
515
|
+
* customData: {
|
|
516
|
+
* message: 'Clicked on custom window state button'
|
|
517
|
+
* }
|
|
518
|
+
* }
|
|
519
|
+
* }]})
|
|
520
|
+
*
|
|
521
|
+
* const openFinWindow = fin.Window.wrapSync(identity);
|
|
522
|
+
* // call getOptions() to view updated windowStateButtonOptions under workspacePlatform
|
|
523
|
+
* await openFinWindow.getOptions()
|
|
524
|
+
* ```
|
|
525
|
+
* @param options new window state options.
|
|
526
|
+
*/
|
|
527
|
+
replaceWindowStateButtonOptions(options: WindowStateButtonOptions): Promise<void>;
|
|
528
|
+
_openViewTabContextMenu(req: OpenViewTabContextMenuRequest): Promise<void>;
|
|
529
|
+
_openPageTabContextMenu(req: OpenPageTabContextMenuRequest): Promise<void>;
|
|
312
530
|
}
|
|
313
531
|
/**
|
|
314
532
|
* Factory for wrapping browser windows and global operations.
|
|
@@ -375,7 +593,66 @@ export interface BrowserWindowFactory {
|
|
|
375
593
|
* workspacePlatform {
|
|
376
594
|
* pages: [page],
|
|
377
595
|
* title: 'My Window Title',
|
|
378
|
-
* favicon: 'https://google.com/favicon.ico'
|
|
596
|
+
* favicon: 'https://google.com/favicon.ico',
|
|
597
|
+
* disableMultiplePages: true, // disable page functonality for the window
|
|
598
|
+
* iconTrayOptions: { // configure the set of tray icons for the window
|
|
599
|
+
* buttons: [
|
|
600
|
+
* { // adding a custom tray icon for the window
|
|
601
|
+
* type: BrowserButtonType.Custom,
|
|
602
|
+
* tooltip: 'Sample Tray Icon',
|
|
603
|
+
* disabled: false,
|
|
604
|
+
* iconUrl: 'https://www.openfin.co/favicon.ico',
|
|
605
|
+
* action: {
|
|
606
|
+
* // This action needs to be registed in customActions property in the call WorkspacePlatform.init
|
|
607
|
+
* id: 'sample-trayicon-custom-action',
|
|
608
|
+
* customData: {
|
|
609
|
+
* message: 'Clicked on custom Icon Tray button'
|
|
610
|
+
* }
|
|
611
|
+
* }
|
|
612
|
+
* },
|
|
613
|
+
* {
|
|
614
|
+
* type: BrowserButtonType.ShowHideTabs
|
|
615
|
+
* },
|
|
616
|
+
* {
|
|
617
|
+
* type: BrowserButtonType.ColorLinking
|
|
618
|
+
* },
|
|
619
|
+
* {
|
|
620
|
+
* type: BrowserButtonType.PresetLayouts
|
|
621
|
+
* },
|
|
622
|
+
* {
|
|
623
|
+
* type: BrowserButtonType.SavePage
|
|
624
|
+
* }
|
|
625
|
+
* ]
|
|
626
|
+
* }
|
|
627
|
+
* windowStateButtonOptions: { configure the set of icons for setting window states
|
|
628
|
+
* buttons: [
|
|
629
|
+
* { // adding a custom window state icon for the window
|
|
630
|
+
* id: 'windowState123',
|
|
631
|
+
* type: BrowserButtonType.Custom,
|
|
632
|
+
* tooltip: 'Sample Window State button',
|
|
633
|
+
* disabled: false,
|
|
634
|
+
* iconUrl: 'https://www.openfin.co/favicon.ico',
|
|
635
|
+
* action: {
|
|
636
|
+
* // This action needs to be registed in customActions property in the call WorkspacePlatform.init
|
|
637
|
+
* id: 'sample-window-state-custom-action',
|
|
638
|
+
* customData: {
|
|
639
|
+
* message: 'Clicked on custom Window State button'
|
|
640
|
+
* }
|
|
641
|
+
* }
|
|
642
|
+
* },
|
|
643
|
+
* { // override tooltip and icon URL for standard Maximise button
|
|
644
|
+
* type: BrowserButtonType.Maximise,
|
|
645
|
+
* tooltip: overrideWindowStateIcons ? 'Studio Maximise' : undefined,
|
|
646
|
+
* iconUrl: overrideWindowStateIcons ? 'https://www.openfin.co/favicon.ico' : undefined
|
|
647
|
+
* },
|
|
648
|
+
* {
|
|
649
|
+
* type: BrowserButtonType.Minimise
|
|
650
|
+
* },
|
|
651
|
+
* {
|
|
652
|
+
* type: BrowserButtonType.Close
|
|
653
|
+
* }
|
|
654
|
+
* ]
|
|
655
|
+
* }
|
|
379
656
|
* }
|
|
380
657
|
* };
|
|
381
658
|
* const window = await workspacePlatform.Browser.createWindow(options);
|
|
@@ -657,29 +934,52 @@ export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
|
|
|
657
934
|
* @param req the payload received by the provider call
|
|
658
935
|
* @param callerIdentity OF identity of the entity from which the request originated
|
|
659
936
|
*/
|
|
660
|
-
openGlobalContextMenu(req: OpenGlobalContextMenuPayload, callerIdentity:
|
|
937
|
+
openGlobalContextMenu(req: OpenGlobalContextMenuPayload, callerIdentity: OpenFin.Identity): any;
|
|
938
|
+
/**
|
|
939
|
+
* Implementation for showing a view tab context menu given a menu template,
|
|
940
|
+
* handler callback, and screen coordinates
|
|
941
|
+
* @param req the payload received by the provider call
|
|
942
|
+
* @param callerIdentity OF identity of the entity from which the request originated
|
|
943
|
+
*/
|
|
944
|
+
openViewTabContextMenu(req: OpenViewTabContextMenuPayload, callerIdentity: OpenFin.Identity): any;
|
|
945
|
+
/**
|
|
946
|
+
* Implementation for showing a page tab context menu given a menu template,
|
|
947
|
+
* handler callback, and screen coordinates
|
|
948
|
+
* @param req the payload received by the provider call
|
|
949
|
+
* @param callerIdentity OF identity of the entity from which the request originated
|
|
950
|
+
*/
|
|
951
|
+
openPageTabContextMenu(req: OpenPageTabContextMenuPayload, callerIdentity: OpenFin.Identity): any;
|
|
661
952
|
}
|
|
953
|
+
/**
|
|
954
|
+
* The origins from which a custom action can be invoked
|
|
955
|
+
*/
|
|
662
956
|
export declare enum CustomActionCallerType {
|
|
663
957
|
CustomButton = "CustomButton",
|
|
664
|
-
|
|
958
|
+
GlobalContextMenu = "GlobalContextMenu",
|
|
959
|
+
ViewTabContextMenu = "ViewTabContextMenu",
|
|
960
|
+
PageTabContextMenu = "PageTabContextMenu",
|
|
665
961
|
API = "API"
|
|
666
962
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
963
|
+
/**The payload received by a Custom Action.
|
|
964
|
+
* The `callerType` property can be used to determine what data is available in the payload and cast accordingly.
|
|
965
|
+
* When `callerType == CustomActionCallerType.API`, the payload is defined by the code directly invoking the action.*/
|
|
966
|
+
export declare type CustomActionPayload = {
|
|
967
|
+
callerType: CustomActionCallerType.API;
|
|
968
|
+
} | CustomButtonActionPayload | GlobalContextMenuOptionActionPayload | ViewTabCustomActionPayload | PageTabContextMenuOptionActionPayload;
|
|
969
|
+
/**
|
|
970
|
+
* Configures a custom action when the control is invoked
|
|
971
|
+
*/
|
|
671
972
|
export interface CustomActionSpecifier {
|
|
672
973
|
/** Identifier of a custom action defined at platform initialization*/
|
|
673
974
|
id: string;
|
|
674
975
|
/** Any data necessary for the functioning of specified custom action*/
|
|
675
|
-
customData
|
|
676
|
-
}
|
|
677
|
-
export interface InvokeCustomActionRequest {
|
|
678
|
-
actionId: string;
|
|
679
|
-
payload: CustomActionPayload;
|
|
976
|
+
customData?: any;
|
|
680
977
|
}
|
|
978
|
+
/**
|
|
979
|
+
* Defines custom action map where the key is the custom action ID and value is the action handler
|
|
980
|
+
*/
|
|
681
981
|
export interface CustomActionsMap {
|
|
682
|
-
[
|
|
982
|
+
[actionId: string]: (payload: CustomActionPayload) => any;
|
|
683
983
|
}
|
|
684
984
|
/**
|
|
685
985
|
* Configuration for initializing a Workspace platform.
|
|
@@ -743,16 +1043,75 @@ export interface WorkspacePlatformInitConfig {
|
|
|
743
1043
|
* WorkspacePlatformProvider
|
|
744
1044
|
* ) => {
|
|
745
1045
|
* class Override extends WorkspacePlatformProvider {
|
|
1046
|
+
* // ovrride default behavior of updateSavedPage
|
|
746
1047
|
* updateSavedPage = async (req: UpdateSavedPageRequest): Promise<void> => {
|
|
747
1048
|
* console.log(`saving page ${req.page.pageId}`);
|
|
748
1049
|
* // calling custom function to the save page here
|
|
749
|
-
*
|
|
1050
|
+
* };
|
|
1051
|
+
*
|
|
1052
|
+
* // add a custom menu item in Global Context Menu
|
|
1053
|
+
* openGlobalContextMenu(req: WorkspacePlatform.OpenGlobalContextMenuPayload, callerIdentity: any) {
|
|
1054
|
+
* return super.openGlobalContextMenu(
|
|
1055
|
+
* {
|
|
1056
|
+
* ...req,
|
|
1057
|
+
* template: [
|
|
1058
|
+
* ...req.template,
|
|
1059
|
+
* {
|
|
1060
|
+
* label: 'Sample custom global option',
|
|
1061
|
+
* data: {
|
|
1062
|
+
* type: GlobalContextMenuOptionType.Custom,
|
|
1063
|
+
* action: {
|
|
1064
|
+
* // This action needs to be registed in customActions property in the call WorkspacePlatform.init
|
|
1065
|
+
* id: 'sample-custom-global-menu-action'
|
|
1066
|
+
* }
|
|
1067
|
+
* }
|
|
1068
|
+
* }
|
|
1069
|
+
* ]
|
|
1070
|
+
* },
|
|
1071
|
+
* callerIdentity
|
|
1072
|
+
* );
|
|
1073
|
+
* }
|
|
1074
|
+
*
|
|
1075
|
+
* // add a custom menu item in View Tab Context Menu
|
|
1076
|
+
* openViewTabContextMenu = async (payload: OpenViewTabContextMenuPayload, callerIdentity) => {
|
|
1077
|
+
* return super.openViewTabContextMenu({
|
|
1078
|
+
* ...payload,
|
|
1079
|
+
* template: [
|
|
1080
|
+
* {
|
|
1081
|
+
* label: 'Sample View Tab Context Menu',
|
|
1082
|
+
* data: {
|
|
1083
|
+
* type: ViewTabMenuOptionType.Custom,
|
|
1084
|
+
* action: {
|
|
1085
|
+
* // This action needs to be registed in customActions property in the call WorkspacePlatform.init
|
|
1086
|
+
* id: 'sample-viewtab-action',
|
|
1087
|
+
* customData: 'Custom View Tab Action'
|
|
1088
|
+
* }
|
|
1089
|
+
* }
|
|
1090
|
+
* },
|
|
1091
|
+
* ...payload.template
|
|
1092
|
+
* ]
|
|
1093
|
+
* }, callerIdentity);
|
|
1094
|
+
* };
|
|
1095
|
+
*
|
|
1096
|
+
*
|
|
750
1097
|
* }
|
|
751
1098
|
* return new Override();
|
|
752
1099
|
* };
|
|
753
1100
|
*
|
|
754
1101
|
* await WorkspacePlatform.init({
|
|
755
1102
|
* browser: { overrideCallback },
|
|
1103
|
+
* customActions: {
|
|
1104
|
+
* 'sample-custom-global-menu-action': (payload: CustomActionPayload) => {
|
|
1105
|
+
* alert('This custom action works ' + JSON.stringify(payload));
|
|
1106
|
+
* return 'someresponse';
|
|
1107
|
+
* },
|
|
1108
|
+
* 'sample-viewtab-action': (payload: ViewTabCustomActionPayload) => {
|
|
1109
|
+
* alert('This custom action works ' + JSON.stringify(payload));
|
|
1110
|
+
* return 'someresponse';
|
|
1111
|
+
* }
|
|
1112
|
+
* }
|
|
1113
|
+
*
|
|
1114
|
+
*
|
|
756
1115
|
* });
|
|
757
1116
|
*/
|
|
758
1117
|
export declare type BrowserOverrideCallback = OpenFin.OverrideCallback<WorkspacePlatformProvider>;
|
|
@@ -764,6 +1123,8 @@ export interface BrowserInitConfig {
|
|
|
764
1123
|
* Default options for creating a new browser window. Any option not included in WorkspacePlatform.getCurrentSync().Browser.createWindow(options) call will default to the value provided in this field.
|
|
765
1124
|
*/
|
|
766
1125
|
defaultWindowOptions?: BrowserCreateWindowRequest;
|
|
1126
|
+
/** Default options when creating a new page. If `iconUrl`, `unsavedIconUrl` or `closeButton` are not defined when creating a page, setting will default to `defaultPageOptions`. */
|
|
1127
|
+
defaultPageOptions?: Pick<Page, 'iconUrl' | 'unsavedIconUrl' | 'closeButton'>;
|
|
767
1128
|
/**
|
|
768
1129
|
* The default options when creating a new browser window. Any option not included in WorkspacePlatform.getCurrentSync().Browser.createView(options) call will default to the value provided in this field.
|
|
769
1130
|
*/
|
|
@@ -8,7 +8,16 @@ export declare const getChannelClient: (identity: OpenFin.Identity) => Promise<i
|
|
|
8
8
|
* (Should only happen in local development)
|
|
9
9
|
*/
|
|
10
10
|
export declare const createChannel: () => Promise<import("openfin-adapter").ChannelProvider>;
|
|
11
|
+
export interface AddToChannelRequest {
|
|
12
|
+
newChannelId: string;
|
|
13
|
+
selectedViews: OpenFin.Identity[];
|
|
14
|
+
}
|
|
11
15
|
export declare enum ChannelAction {
|
|
12
16
|
CloseBrowserWindow = "close-browser-window",
|
|
13
|
-
QuitPlatform = "quit-platform"
|
|
17
|
+
QuitPlatform = "quit-platform",
|
|
18
|
+
ClosePage = "close-page",
|
|
19
|
+
AddToChannel = "add-to-channel",
|
|
20
|
+
RemoveFromChannel = "remove-from-channel",
|
|
21
|
+
SavePage = "save-page",
|
|
22
|
+
DuplicatePage = "duplicate-page"
|
|
14
23
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="openfin-adapter/fin" />
|
|
2
|
+
interface InternalWindowOptions extends OpenFin.PlatformWindowCreationOptions {
|
|
3
|
+
workspacePlatform: OpenFin.WindowOptions['workspacePlatform'] & {
|
|
4
|
+
_internalAutoShow: boolean;
|
|
5
|
+
_internalDeferShowEnabled: boolean;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* This function prevents a created window from being auto shown by the Core.
|
|
10
|
+
* The Core will auto show the window before the window has a chance to register a listener to prevent it.
|
|
11
|
+
* With these options applied, the window must call `setCanShow(true)` when it is ready to be shown.
|
|
12
|
+
* If `autoShow` was originally true, the window will be show upon the first call to `setCanShow(true)`.
|
|
13
|
+
*
|
|
14
|
+
* By applying these options it is assumed that the window calls `registerDeferShow()` and `setCanShow(true)`.
|
|
15
|
+
*
|
|
16
|
+
* This function should be used in conjunction the `withDeferShow` platform middleware.
|
|
17
|
+
* `withDeferShow` will prevent the window from being shown before the window has launched and registered
|
|
18
|
+
* its show requested listener.
|
|
19
|
+
*
|
|
20
|
+
* @param opts the options to modify.
|
|
21
|
+
* @returns the modified options.
|
|
22
|
+
*/
|
|
23
|
+
export declare const applyDeferShowOptions: (opts: OpenFin.PlatformWindowCreationOptions) => InternalWindowOptions;
|
|
24
|
+
/**
|
|
25
|
+
* This function is a middleware that can be applied to a platform's `createWindow` function.
|
|
26
|
+
* If the defer show API has been enabled in window options using the `applyDeferShowOptions` function
|
|
27
|
+
* the window will be prevented from showing.
|
|
28
|
+
* @param superCreateWindow the create window method to decorate.
|
|
29
|
+
* @returns the `createWindow` method wrapped with this middleware.
|
|
30
|
+
*/
|
|
31
|
+
export declare const withDeferShow: (superCreateWindow: (opts: OpenFin.PlatformWindowCreationOptions, callerIdentity: OpenFin.Identity) => Promise<OpenFin.Window>) => (opts: OpenFin.PlatformWindowCreationOptions, callerIdentity?: OpenFin.Identity) => Promise<import("openfin-adapter").Window>;
|
|
32
|
+
/**
|
|
33
|
+
* Assert if the window is able to be shown or not.
|
|
34
|
+
* Upon calling `setCanShow(true)`, if the window was previously prevented
|
|
35
|
+
* from being shown, this function will show the window.
|
|
36
|
+
* @param bool true if the window should be able to be shown. (Default is false)
|
|
37
|
+
*/
|
|
38
|
+
export declare const setCanShow: (bool: boolean) => Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Add a listener that defers showing the current window.
|
|
41
|
+
* To allow the window to be shown, `setCanShow(true)` must be called.
|
|
42
|
+
* Upon calling `setCanShow(true)`, if the window was previously prevented
|
|
43
|
+
* from being shown, it will show.
|
|
44
|
+
*/
|
|
45
|
+
export declare const registerDeferShow: () => Promise<void>;
|
|
46
|
+
export {};
|
|
@@ -21,9 +21,3 @@ export declare const workspaceProviderFallbackUrl: string;
|
|
|
21
21
|
export declare const workspaceCdnUrl: string;
|
|
22
22
|
export declare const workspaceCdnEnvUrl: string;
|
|
23
23
|
export declare const workspaceRuntimeVersion: string;
|
|
24
|
-
/**
|
|
25
|
-
* A promise that resolves when:
|
|
26
|
-
* - The window 'load' event is fired.
|
|
27
|
-
* - The window first paint occurs.
|
|
28
|
-
*/
|
|
29
|
-
export declare const firstPaint: Promise<void>;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { NamedIdentity } from 'openfin-adapter/src/identity';
|
|
2
|
-
|
|
2
|
+
import { GlobalContextMenuItemTemplate } from '../../../client-api-platform/src/shapes';
|
|
3
|
+
export declare const getGlobalContextMenuTemplate: (winIdentity: NamedIdentity) => Promise<GlobalContextMenuItemTemplate[]>;
|
|
@@ -7,5 +7,5 @@ interface LandingPageUrls {
|
|
|
7
7
|
export declare const getLandingPageUrls: (winIdentity?: NamedIdentity) => Promise<LandingPageUrls>;
|
|
8
8
|
export declare const checkHasNewTabUrl: () => Promise<boolean>;
|
|
9
9
|
export declare const getNewLandingTabViewOptions: (target: OpenFin.Identity) => Promise<OpenFin.PlatformViewCreationOptions>;
|
|
10
|
-
export declare const makeNewLandingPage: (winIdentity?: NamedIdentity) => Promise<import("
|
|
10
|
+
export declare const makeNewLandingPage: (winIdentity?: NamedIdentity) => Promise<import("client-api-platform").PageWithUpdatableRuntimeAttribs>;
|
|
11
11
|
export {};
|
|
@@ -25,7 +25,8 @@ export declare enum WindowEvent {
|
|
|
25
25
|
ViewAttached = "view-attached",
|
|
26
26
|
ViewDetached = "view-detached",
|
|
27
27
|
ViewPageTitleUpdated = "view-page-title-updated",
|
|
28
|
-
ViewDestroyed = "view-destroyed"
|
|
28
|
+
ViewDestroyed = "view-destroyed",
|
|
29
|
+
OptionsChanged = "options-changed"
|
|
29
30
|
}
|
|
30
31
|
export interface WindowIdentity {
|
|
31
32
|
uuid: ApplicationUUID | string;
|
|
@@ -148,4 +149,5 @@ export declare const isHomeWindowRunning: () => Promise<boolean>;
|
|
|
148
149
|
export declare const showAndFocusStorefront: () => Promise<void>;
|
|
149
150
|
export declare const centerWindowIfOffScreen: (windowIdentity?: WindowIdentity) => Promise<void>;
|
|
150
151
|
export declare const getDisableMultiplePagesOption: (identity: WindowIdentity) => Promise<any>;
|
|
152
|
+
export declare const getPlatformWindowTitle: (identity: WindowIdentity) => Promise<any>;
|
|
151
153
|
export {};
|