@openfin/workspace-platform 7.0.0 → 7.1.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.
@@ -1,7 +1,7 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
2
  import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '../../../../common/src/api/pages/shapes';
3
3
  import { OpenPageTabContextMenuRequest } from '../../../../client-api-platform/src/index';
4
- import { OpenGlobalContextMenuRequest, OpenSaveMenuRequest, OpenViewTabContextMenuRequest, ToolbarOptions, WindowStateButtonOptions } from '../../../../client-api-platform/src/shapes';
4
+ import { OpenGlobalContextMenuRequest, OpenSaveButtonContextMenuRequest, OpenSaveMenuRequest, OpenViewTabContextMenuRequest, ToolbarOptions, WindowStateButtonOptions } from '../../../../client-api-platform/src/shapes';
5
5
  export declare const getBrowserModule: (identity: OpenFin.Identity) => {
6
6
  identity: OpenFin.Identity;
7
7
  openfinWindow: import("openfin-adapter").Window;
@@ -18,4 +18,5 @@ export declare const getBrowserModule: (identity: OpenFin.Identity) => {
18
18
  _openViewTabContextMenu: (req: OpenViewTabContextMenuRequest) => Promise<any>;
19
19
  _openPageTabContextMenu: (req: OpenPageTabContextMenuRequest) => Promise<any>;
20
20
  _openSaveModal: (req: OpenSaveMenuRequest) => Promise<any>;
21
+ _openSaveButtonContextMenu: (req: OpenSaveButtonContextMenuRequest) => Promise<any>;
21
22
  };
@@ -18,6 +18,7 @@ export declare const getBrowserApi: (identity: OpenFin.ApplicationIdentity) => {
18
18
  _openViewTabContextMenu: (req: import("../../shapes").OpenViewTabContextMenuRequest) => Promise<any>;
19
19
  _openPageTabContextMenu: (req: import("../../shapes").OpenPageTabContextMenuRequest) => Promise<any>;
20
20
  _openSaveModal: (req: import("../../shapes").OpenSaveMenuRequest) => Promise<any>;
21
+ _openSaveButtonContextMenu: (req: import("../../shapes").OpenSaveButtonContextMenuRequest) => Promise<any>;
21
22
  };
22
23
  createWindow: (options: BrowserCreateWindowRequest) => Promise<BrowserWindowModule>;
23
24
  getAllAttachedPages: () => Promise<AttachedPage[]>;
@@ -0,0 +1,3 @@
1
+ import { OpenSaveButtonContextMenuPayload } from '../../../../client-api-platform/src/index';
2
+ import { SaveButtonContextMenuItemData } from '../../../../client-api-platform/src/shapes';
3
+ export declare const saveButtonContextMenuItemHandler: (data: SaveButtonContextMenuItemData, payload: OpenSaveButtonContextMenuPayload) => Promise<void>;
@@ -1,13 +1,16 @@
1
1
  import { NamedIdentity } from 'openfin-adapter/src/identity';
2
- import { OpenPageTabContextMenuPayload } from '../../../../client-api-platform/src/index';
3
- import { OpenGlobalContextMenuPayload, OpenGlobalContextMenuRequest, OpenPageTabContextMenuRequest, OpenViewTabContextMenuPayload, OpenViewTabContextMenuRequest } from '../../../../client-api-platform/src/shapes';
2
+ import { OpenPageTabContextMenuPayload, OpenSaveButtonContextMenuPayload } from '../../../../client-api-platform/src/index';
3
+ import { OpenGlobalContextMenuPayload, OpenGlobalContextMenuRequest, OpenPageTabContextMenuRequest, OpenSaveButtonContextMenuRequest, OpenViewTabContextMenuPayload, OpenViewTabContextMenuRequest } from '../../../../client-api-platform/src/shapes';
4
4
  export declare function openGlobalContextMenuInternal(payload: OpenGlobalContextMenuRequest & {
5
5
  identity: NamedIdentity;
6
6
  }, callerIdentity: any): Promise<void>;
7
- export declare const openCommonContextMenu: (payload: OpenGlobalContextMenuPayload | OpenViewTabContextMenuPayload | OpenPageTabContextMenuPayload, callerIdentity: any) => Promise<void>;
7
+ export declare const openCommonContextMenu: (payload: OpenGlobalContextMenuPayload | OpenViewTabContextMenuPayload | OpenPageTabContextMenuPayload | OpenSaveButtonContextMenuPayload, callerIdentity: any) => Promise<void>;
8
8
  export declare function openViewTabContextMenuInternal(payload: OpenViewTabContextMenuRequest & {
9
9
  identity: NamedIdentity;
10
10
  }, callerIdentity: any): Promise<void>;
11
11
  export declare function openPageTabContextMenuInternal(payload: OpenPageTabContextMenuRequest & {
12
12
  identity: NamedIdentity;
13
13
  }, callerIdentity: any): Promise<void>;
14
+ export declare function openSaveButtonContextMenuInternal(payload: OpenSaveButtonContextMenuRequest & {
15
+ identity: NamedIdentity;
16
+ }, callerIdentity: any): Promise<void>;
@@ -36,6 +36,7 @@ export declare enum ChannelAction {
36
36
  OpenGlobalContextMenuInternal = "openGlobalContextMenuInternal",
37
37
  OpenViewTabContextMenuInternal = "openViewTabContextMenuInternal",
38
38
  OpenPageTabContextMenuInternal = "openPageTabContextMenuInternal",
39
+ OpenSaveButtonContextMenuInternal = "openSaveButtonContextMenuInternal",
39
40
  InvokeCustomActionInternal = "invokeCustomActionInternal",
40
41
  GetSavedWorkspace = "getSavedWorkspace",
41
42
  CreateSavedWorkspace = "createSavedWorkspace",
@@ -44,8 +45,8 @@ export declare enum ChannelAction {
44
45
  GetSavedWorkspaces = "getSavedWorkspaces",
45
46
  SaveWorkspace = "saveWorkspace",
46
47
  GetCurrentWorkspace = "getCurrentWorkspace",
47
- SetCurrentWorkspace = "setCurrentWorkspace",
48
- GetActiveWorkspace = "getActiveWorkspace"
48
+ ApplyWorkspace = "applyWorkspace",
49
+ SetActiveWorkspace = "setActiveWorkspace"
49
50
  }
50
51
  /**
51
52
  * Get a channel client for a specific Workspace platform.
@@ -1,18 +1,22 @@
1
1
  import type { CreateSavedWorkspaceRequest, Workspace } from '../../../../client-api-platform/src/shapes';
2
+ /**
3
+ * Apply the given workspace and set it as active.
4
+ */
5
+ export declare function applyWorkspace(workspace: Workspace): Promise<void>;
2
6
  /**
3
7
  * Set the current active workspace.
4
8
  */
5
- export declare function setCurrentWorkspace(workspace: Workspace): Promise<void>;
9
+ export declare function setActiveWorkspace(workspace: Workspace): void;
6
10
  /**
7
- * Get a workspace data structure that represents the users current desktop.
11
+ * Get the initial workspace data structure that represents the an untitled empty workspace.
8
12
  * @returns the current active workspace.
9
13
  */
10
- export declare function getCurrentWorkspace(): Promise<any>;
14
+ export declare function getInitialWorkspace(): Promise<any>;
11
15
  /**
12
- * Get the active workspace.
16
+ * Get a workspace data structure that represents the users current desktop.
13
17
  * @returns the current active workspace.
14
18
  */
15
- export declare function getActiveWorkspace(): Workspace | undefined;
19
+ export declare function getCurrentWorkspace(): Promise<any>;
16
20
  export declare const createWorkspaceInStorage: (req: CreateSavedWorkspaceRequest) => Promise<any>;
17
21
  export declare const getWorkspacesInStorage: () => Promise<Workspace[]>;
18
22
  export declare const getWorkspaceInStorage: (id: string) => Promise<Workspace>;
@@ -56,6 +56,7 @@ export declare enum GlobalContextMenuOptionType {
56
56
  SavePage = "SavePage",
57
57
  SavePageAs = "SavePageAs",
58
58
  CloseWindow = "CloseWindow",
59
+ SwitchWorkspace = "SwitchWorkspace",
59
60
  DeleteWorkspace = "DeleteWorkspace",
60
61
  OpenStorefront = "OpenStorefront",
61
62
  Quit = "Quit",
@@ -275,6 +276,59 @@ export declare type WindowStateButton = CustomBrowserButtonConfig | PreDefinedBu
275
276
  export interface WindowStateButtonOptions {
276
277
  buttons: WindowStateButton[];
277
278
  }
279
+ /**Types of context menu options for Save button, including pre-defined ones.
280
+ * User-defined context menu items should use the value `Custom` */
281
+ export declare enum SaveButtonContextMenuOptionType {
282
+ SavePage = "SavePage",
283
+ SaveWorkspace = "SaveWorkspace",
284
+ Custom = "Custom"
285
+ }
286
+ /**Shape of the data property of a save button context menu template item */
287
+ export interface SaveButtonContextMenuItemData extends ContextMenuItemData {
288
+ type: SaveButtonContextMenuOptionType;
289
+ }
290
+ /**Configuration of an option in the save button context menu */
291
+ export interface SaveButtonContextMenuItemTemplate extends OpenFin.MenuItemTemplate {
292
+ data: SaveButtonContextMenuItemData;
293
+ }
294
+ /**
295
+ * Request for opening a context menu from save button in Browser.
296
+ */
297
+ export interface OpenSaveButtonContextMenuRequest {
298
+ /** Screen x-coordinate where context menu should be shown. */
299
+ x: number;
300
+ /** Screen y-coordinate where context menu should be shown. */
301
+ y: number;
302
+ /** Screen x-coordinate of save button */
303
+ buttonLeft: number;
304
+ /** width of save button */
305
+ buttonWidth: number;
306
+ /** Miscellaneous options necessary for implementing custom logic in the provider override. */
307
+ customData?: any;
308
+ /** Id of the page on which the context menu is invoked */
309
+ pageId: string;
310
+ }
311
+ /**
312
+ * Payload received by the openSaveButtonContextMenu provider override.
313
+ */
314
+ export declare type OpenSaveButtonContextMenuPayload = OpenSaveButtonContextMenuRequest & {
315
+ /** Identity of the Browser window where context menu should be shown. */
316
+ identity: NamedIdentity;
317
+ /** Template defining the options to show in the context menu. */
318
+ template: SaveButtonContextMenuItemTemplate[];
319
+ /** Default function that handles stock context menu options. */
320
+ callback: (data: SaveButtonContextMenuItemData, req: OpenSaveButtonContextMenuPayload) => any;
321
+ };
322
+ /**Payload received by a Custom Action that is invoked by a custom save button context menu option */
323
+ export interface OpenSaveContextMenuOptionActionPayload {
324
+ callerType: CustomActionCallerType.SaveButtonContextMenu;
325
+ /** Identity of the browser window where the context menu is invoked */
326
+ windowIdentity: OpenFin.Identity;
327
+ /** Any data necessary for the functioning of specified custom action*/
328
+ customData?: any;
329
+ /** Id of the page on which the context menu is invoked */
330
+ pageId: string;
331
+ }
278
332
  /**
279
333
  * Request for creating a browser window.
280
334
  */
@@ -536,6 +590,7 @@ export interface BrowserWindowModule {
536
590
  replaceWindowStateButtonOptions(options: WindowStateButtonOptions): Promise<void>;
537
591
  _openViewTabContextMenu(req: OpenViewTabContextMenuRequest): Promise<void>;
538
592
  _openPageTabContextMenu(req: OpenPageTabContextMenuRequest): Promise<void>;
593
+ _openSaveButtonContextMenu(req: OpenSaveButtonContextMenuRequest): Promise<void>;
539
594
  }
540
595
  /**
541
596
  * Factory for wrapping browser windows and global operations.
@@ -959,15 +1014,16 @@ export interface WorkspacePlatformModule extends OpenFin.Platform {
959
1014
  */
960
1015
  getCurrentWorkspace(): Promise<Workspace>;
961
1016
  /**
962
- * Closes content from the current workspace and applies the given workspace to the user's desktop.
963
- * The given workspace becomes the active workspace, and the content of the workspace is launched.
1017
+ * Sets the workspace as the current active workspace. Does not apply the workspace to the user's desktop.
964
1018
  * @param workspace the workspace to set as current active workspace.
965
1019
  */
966
- setCurrentWorkspace(workspace: Workspace): Promise<void>;
1020
+ setActiveWorkspace(workspace: Workspace): Promise<void>;
967
1021
  /**
968
- * Gets a workspace data structure that represents the active state of the user's desktop.
1022
+ * Closes content from the current workspace and applies the given workspace to the user's desktop. Makes that
1023
+ * workspace the active workspace.
1024
+ * @param workspace the workspace to apply to the desktop and set as the current active workspace.
969
1025
  */
970
- getActiveWorkspace(): Promise<Workspace>;
1026
+ applyWorkspace(workspace: Workspace): Promise<void>;
971
1027
  /**
972
1028
  * The browser window factory for the Workspace Platform.
973
1029
  */
@@ -1053,6 +1109,13 @@ export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
1053
1109
  * @param callerIdentity OF identity of the entity from which the request originated
1054
1110
  */
1055
1111
  openPageTabContextMenu(req: OpenPageTabContextMenuPayload, callerIdentity: OpenFin.Identity): any;
1112
+ /**
1113
+ * Implementation for showing a context menu for save button given a menu template,
1114
+ * handler callback, and screen coordinates. For an example of overriding, see {@link BrowserOverrideCallback}.
1115
+ * @param req the payload received by the provider call
1116
+ * @param callerIdentity OF identity of the entity from which the request originated
1117
+ */
1118
+ openSaveButtonContextMenu(req: OpenSaveButtonContextMenuPayload, callerIdentity: OpenFin.Identity): any;
1056
1119
  }
1057
1120
  /**
1058
1121
  * The origins from which a custom action can be invoked
@@ -1062,6 +1125,7 @@ export declare enum CustomActionCallerType {
1062
1125
  GlobalContextMenu = "GlobalContextMenu",
1063
1126
  ViewTabContextMenu = "ViewTabContextMenu",
1064
1127
  PageTabContextMenu = "PageTabContextMenu",
1128
+ SaveButtonContextMenu = "SaveButtonContextMenu",
1065
1129
  API = "API"
1066
1130
  }
1067
1131
  /**The payload received by a Custom Action.
@@ -1069,7 +1133,7 @@ export declare enum CustomActionCallerType {
1069
1133
  * When `callerType == CustomActionCallerType.API`, the payload is defined by the code directly invoking the action.*/
1070
1134
  export declare type CustomActionPayload = {
1071
1135
  callerType: CustomActionCallerType.API;
1072
- } | CustomButtonActionPayload | GlobalContextMenuOptionActionPayload | ViewTabCustomActionPayload | PageTabContextMenuOptionActionPayload;
1136
+ } | CustomButtonActionPayload | GlobalContextMenuOptionActionPayload | ViewTabCustomActionPayload | PageTabContextMenuOptionActionPayload | OpenSaveContextMenuOptionActionPayload;
1073
1137
  /**
1074
1138
  * Configures a custom action when the control is invoked
1075
1139
  */
@@ -1197,7 +1261,31 @@ export interface WorkspacePlatformInitConfig {
1197
1261
  * }, callerIdentity);
1198
1262
  * };
1199
1263
  *
1200
- *
1264
+ * // add a custom menu item in Save Context Menu
1265
+ * openSaveButtonContextMenu = (req: WorkspacePlatform.OpenSaveButtonContextMenuPayload, callerIdentity: OpenFin.Identity) => {
1266
+ * return super.openSaveButtonContextMenu(
1267
+ * {
1268
+ * ...req,
1269
+ * template: [
1270
+ * ...req.template,
1271
+ * {
1272
+ * label: 'Save custom option',
1273
+ * data: {
1274
+ * type: SaveButtonContextMenuOptionType.Custom,
1275
+ * action: {
1276
+ * id: 'sample-custom-action-name',
1277
+ * customData: {
1278
+ * someProp: 'Save Button task'
1279
+ * }
1280
+ * }
1281
+ * }
1282
+ * }
1283
+ * ]
1284
+ * },
1285
+ * callerIdentity
1286
+ * );
1287
+ * }
1288
+ * }
1201
1289
  * }
1202
1290
  * return new Override();
1203
1291
  * };
@@ -1251,7 +1339,6 @@ export interface Workspace {
1251
1339
  workspaceId: string;
1252
1340
  title: string;
1253
1341
  metadata: WorkspaceMetadata;
1254
- attributes: string[];
1255
1342
  snapshot: OpenFin.Snapshot;
1256
1343
  }
1257
1344
  /**
@@ -1274,9 +1361,13 @@ export interface UpdateSavedWorkspaceRequest {
1274
1361
  * Request to create a save modal.
1275
1362
  * @private
1276
1363
  */
1277
- export interface OpenSaveMenuRequest {
1278
- menuType: SaveModalType;
1279
- id: string;
1364
+ export declare type OpenSaveMenuRequest = {
1280
1365
  x?: number;
1281
1366
  y?: number;
1282
- }
1367
+ } & ({
1368
+ menuType: SaveModalType.SAVE_PAGE | SaveModalType.SAVE_PAGE_AS | SaveModalType.RENAME_PAGE;
1369
+ id: string;
1370
+ } | {
1371
+ menuType: SaveModalType.SAVE_WORKSPACE | SaveModalType.SAVE_WORKSPACE_AS | SaveModalType.RENAME_WORKSPACE;
1372
+ id?: never;
1373
+ });
@@ -10,3 +10,7 @@ export declare type ShowContextMenuResponse = OpenFin.MenuResult & {
10
10
  data: string;
11
11
  };
12
12
  export default function showContextMenu(opts: OpenFin.ShowPopupMenuOptions, win?: _Window): Promise<ShowContextMenuResponse>;
13
+ export declare const DefaultSaveMenuBounds: {
14
+ width: number;
15
+ height: number;
16
+ };
@@ -1,8 +1,8 @@
1
1
  import { NamedIdentity } from 'openfin-adapter/src/identity';
2
2
  import { MenuItemType } from '../../../common/src/utils/context-menu';
3
3
  import * as WP from '../../../client-api-platform/src/index';
4
- import { GlobalContextMenuItemTemplate } from '../../../client-api-platform/src/shapes';
5
- export declare const getAllSavedWorkspaces: () => Promise<{
4
+ import { GlobalContextMenuItemTemplate, GlobalContextMenuOptionType, Workspace } from '../../../client-api-platform/src/shapes';
5
+ export declare const getSavedWorkspaceContextMenuOptions: (activeWorkspace: Workspace, savedWorkspaces: Workspace[], contextMenuOptionType: GlobalContextMenuOptionType) => {
6
6
  label: string;
7
7
  type: MenuItemType;
8
8
  enabled: boolean;
@@ -11,5 +11,5 @@ export declare const getAllSavedWorkspaces: () => Promise<{
11
11
  type: WP.GlobalContextMenuOptionType;
12
12
  workspaceId: string;
13
13
  };
14
- }[]>;
14
+ }[];
15
15
  export declare const getGlobalContextMenuTemplate: (winIdentity: NamedIdentity) => Promise<GlobalContextMenuItemTemplate[]>;
@@ -0,0 +1,2 @@
1
+ import { SaveButtonContextMenuItemTemplate } from '../../../client-api-platform/src/shapes';
2
+ export declare const getSaveButtonMenuTemplate: () => SaveButtonContextMenuItemTemplate[];