@openfin/workspace-platform 5.7.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/client-api/src/shapes.d.ts +12 -2
- package/client-api/src/templates.d.ts +135 -0
- package/client-api-platform/src/api/browser/browser-module.d.ts +5 -1
- package/client-api-platform/src/api/browser/index.d.ts +3 -0
- package/client-api-platform/src/api/context-menu/browser-logo-handler.d.ts +2 -3
- 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 +1 -2
- package/client-api-platform/src/api/context-menu/index.d.ts +6 -3
- package/client-api-platform/src/api/protocol.d.ts +3 -2
- package/client-api-platform/src/init/utils.d.ts +2 -15
- package/client-api-platform/src/shapes.d.ts +247 -9
- package/common/src/api/browser-protocol.d.ts +4 -2
- package/common/src/utils/defer-show.d.ts +46 -0
- package/common/src/utils/env.d.ts +0 -6
- 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
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
import type { Page } from '../../common/src/api/pages/shapes';
|
|
7
7
|
import type { Workspace } from '../../common/src/api/workspaces';
|
|
8
8
|
import type { Action, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProvider, SearchResult } from '../../search-api/src/index';
|
|
9
|
+
import { CustomTemplate, ListPairs } from './templates';
|
|
10
|
+
export * from './templates';
|
|
9
11
|
export type { Action, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProviderInfo, SearchResult, ScoreOrder, SearchTag, SearchProvider, UserInputListener, ResultDispatchListener, SearchResponse } from '../../search-api/src/index';
|
|
10
12
|
export type { Workspace } from '../../common/src/api/workspaces';
|
|
11
13
|
export type { LayoutExtended, LayoutContentExtended, LayoutSettingsExtended, LayoutContentItemExtended, LayoutComponentExtended, LayoutComponentStateExtended, LayoutStack } from '../../common/src/utils/layout';
|
|
@@ -573,6 +575,10 @@ export declare enum CLITemplate {
|
|
|
573
575
|
* Contact Information Template
|
|
574
576
|
*/
|
|
575
577
|
Contact = "Contact",
|
|
578
|
+
/**
|
|
579
|
+
* Custom Template
|
|
580
|
+
*/
|
|
581
|
+
Custom = "Custom",
|
|
576
582
|
/**
|
|
577
583
|
* Definition List Template
|
|
578
584
|
*/
|
|
@@ -593,7 +599,6 @@ export interface CLISearchResultWithTemplate<T extends keyof typeof CLITemplate,
|
|
|
593
599
|
template: T;
|
|
594
600
|
templateContent: C;
|
|
595
601
|
}
|
|
596
|
-
export declare type ListPairs = [string, string][];
|
|
597
602
|
/**
|
|
598
603
|
* Contact Data.
|
|
599
604
|
*/
|
|
@@ -624,6 +629,11 @@ export interface ContactInfo {
|
|
|
624
629
|
*/
|
|
625
630
|
export interface CLISearchResultContact<A extends Action = Action> extends CLISearchResultWithTemplate<CLITemplate.Contact, ContactInfo, A> {
|
|
626
631
|
}
|
|
632
|
+
/**
|
|
633
|
+
* A Search Result that renders custom templates.
|
|
634
|
+
*/
|
|
635
|
+
export interface CLISearchResultCustom<A extends Action = Action> extends CLISearchResultWithTemplate<CLITemplate.Custom, CustomTemplate, A> {
|
|
636
|
+
}
|
|
627
637
|
/**
|
|
628
638
|
* Definition List Search Result
|
|
629
639
|
*/
|
|
@@ -642,7 +652,7 @@ export interface CLISearchResultSimpleText<A extends Action = Action> extends CL
|
|
|
642
652
|
/**
|
|
643
653
|
* A search result that can be rendered by Home UI.
|
|
644
654
|
*/
|
|
645
|
-
export declare type HomeSearchResult = CLISearchResultContact<HomeAction> | CLISearchResultSimpleText<HomeAction> | CLISearchResultList<HomeAction> | CLISearchResultPlain<HomeAction>;
|
|
655
|
+
export declare type HomeSearchResult = CLISearchResultContact<HomeAction> | CLISearchResultSimpleText<HomeAction> | CLISearchResultList<HomeAction> | CLISearchResultPlain<HomeAction> | CLISearchResultCustom<HomeAction>;
|
|
646
656
|
export declare enum CLIFilterOptionType {
|
|
647
657
|
/**
|
|
648
658
|
* Display a multi-select drop down for the options
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenFin Workspace Custom Templates API
|
|
3
|
+
*
|
|
4
|
+
* @module Templates
|
|
5
|
+
*/
|
|
6
|
+
export declare type ListPairs = [string, string][];
|
|
7
|
+
export declare type CustomTemplateData = Record<string, string | ListPairs>;
|
|
8
|
+
export declare type ContainerFragmentTypes = PlainContainerTemplateFragment | ButtonTemplateFragment;
|
|
9
|
+
export declare type PresentationFragmentTypes = TextTemplateFragment | ImageTemplateFragment | ListTemplateFragment;
|
|
10
|
+
export declare type InteractiveFragmentTypes = ButtonTemplateFragment | TextTemplateFragment | ImageTemplateFragment;
|
|
11
|
+
/**
|
|
12
|
+
* The options to build your custom template composition layout.
|
|
13
|
+
*/
|
|
14
|
+
export declare type TemplateFragment = PlainContainerTemplateFragment | ButtonTemplateFragment | TextTemplateFragment | ListTemplateFragment | ImageTemplateFragment;
|
|
15
|
+
export declare const ContainerTemplateFragmentNames: {
|
|
16
|
+
readonly Container: "Container";
|
|
17
|
+
readonly Button: "Button";
|
|
18
|
+
};
|
|
19
|
+
export declare const PresentationTemplateFragmentNames: {
|
|
20
|
+
readonly Text: "Text";
|
|
21
|
+
readonly Image: "Image";
|
|
22
|
+
readonly List: "List";
|
|
23
|
+
};
|
|
24
|
+
export declare const TemplateFragmentTypes: {
|
|
25
|
+
readonly Text: "Text";
|
|
26
|
+
readonly Image: "Image";
|
|
27
|
+
readonly List: "List";
|
|
28
|
+
readonly Container: "Container";
|
|
29
|
+
readonly Button: "Button";
|
|
30
|
+
};
|
|
31
|
+
export interface BaseTemplateFragment<T extends keyof typeof TemplateFragmentTypes> {
|
|
32
|
+
/**
|
|
33
|
+
* Type of the template fragment.
|
|
34
|
+
*/
|
|
35
|
+
type: T;
|
|
36
|
+
/**
|
|
37
|
+
* CSS style properties of the fragment.
|
|
38
|
+
*
|
|
39
|
+
* All the available custom template fragments support all of the React's inline style properties (with camelCase keys)
|
|
40
|
+
*
|
|
41
|
+
* Note: "position: fixed" is disallowed as a fragment style.
|
|
42
|
+
*/
|
|
43
|
+
style?: Record<string, string | number>;
|
|
44
|
+
}
|
|
45
|
+
export interface FragmentAction {
|
|
46
|
+
/**
|
|
47
|
+
* The action that will be dispatched back to provider when this fragment is clicked.
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
action?: string;
|
|
51
|
+
/**
|
|
52
|
+
* The aria compliant description for this action.
|
|
53
|
+
* If you leave this blank, the renderer will generate a generic description of
|
|
54
|
+
* the fragment's type and its action.
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
actionDescription?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ContainerTemplateFragment<T extends keyof typeof ContainerTemplateFragmentNames> extends BaseTemplateFragment<T> {
|
|
60
|
+
/**
|
|
61
|
+
* Sub-fragments of the container.
|
|
62
|
+
*
|
|
63
|
+
* You can use container template fragment to create nested composition structures.
|
|
64
|
+
*/
|
|
65
|
+
children?: TemplateFragment[];
|
|
66
|
+
}
|
|
67
|
+
export interface PresentationTemplateFragment<T extends keyof typeof PresentationTemplateFragmentNames> extends BaseTemplateFragment<T> {
|
|
68
|
+
/**
|
|
69
|
+
* Optional flag.
|
|
70
|
+
*
|
|
71
|
+
* If a template fragment is flagged as optional, The service will not require
|
|
72
|
+
* the fragment's `dataKey` to exist in `templateData`. If a fragment is optional and its data
|
|
73
|
+
* is missing, the fragment will be omitted quietly by the renderer.
|
|
74
|
+
*/
|
|
75
|
+
optional?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Data key of the template fragment.
|
|
78
|
+
*
|
|
79
|
+
* The data associated with this fragment will be looked up in `templateData` map with this key.
|
|
80
|
+
*
|
|
81
|
+
* Example:
|
|
82
|
+
* ```ts
|
|
83
|
+
* const myTemplateLayout = {
|
|
84
|
+
* type: FragmentTypes.Text,
|
|
85
|
+
* dataKey: 'info',
|
|
86
|
+
* }
|
|
87
|
+
*
|
|
88
|
+
* const searchResult: CLISearchResultCustom = {
|
|
89
|
+
* //...
|
|
90
|
+
* template: CLITemplate.Custom,
|
|
91
|
+
* templateContent: {
|
|
92
|
+
* layout: myTemplateLayout,
|
|
93
|
+
* data: {
|
|
94
|
+
* info: 'My Custom Search Result Info',
|
|
95
|
+
* }
|
|
96
|
+
* }
|
|
97
|
+
* };
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
*/
|
|
101
|
+
dataKey: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Some common stylization options for the `Button` component.
|
|
105
|
+
*/
|
|
106
|
+
export declare enum ButtonStyle {
|
|
107
|
+
Primary = "primary",
|
|
108
|
+
Secondary = "secondary",
|
|
109
|
+
TextOnly = "textOnly"
|
|
110
|
+
}
|
|
111
|
+
export declare type PlainContainerTemplateFragment = ContainerTemplateFragment<'Container'>;
|
|
112
|
+
export declare type ButtonTemplateFragment = ContainerTemplateFragment<'Button'> & FragmentAction & {
|
|
113
|
+
/**
|
|
114
|
+
* Style of the button emitted by this fragment.
|
|
115
|
+
*/
|
|
116
|
+
buttonStyle?: ButtonStyle;
|
|
117
|
+
};
|
|
118
|
+
export declare type TextTemplateFragment = PresentationTemplateFragment<'Text'> & FragmentAction;
|
|
119
|
+
export declare type ImageTemplateFragment = PresentationTemplateFragment<'Image'> & FragmentAction & {
|
|
120
|
+
/**
|
|
121
|
+
* Alternative (accessibility) text for the image.
|
|
122
|
+
*/
|
|
123
|
+
alternativeText: string;
|
|
124
|
+
};
|
|
125
|
+
export declare type ListTemplateFragment = PresentationTemplateFragment<'List'>;
|
|
126
|
+
export interface CustomTemplate {
|
|
127
|
+
/**
|
|
128
|
+
* Root of the template composition tree. See {@link ContainerTemplateFragment} for nesting.
|
|
129
|
+
*/
|
|
130
|
+
layout: TemplateFragment;
|
|
131
|
+
/**
|
|
132
|
+
* Data associated with the custom search result template's presentation fragments.
|
|
133
|
+
*/
|
|
134
|
+
data: CustomTemplateData;
|
|
135
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="openfin-adapter/fin" />
|
|
2
2
|
import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '../../../../common/src/api/pages/shapes';
|
|
3
|
-
import {
|
|
3
|
+
import { OpenPageTabContextMenuRequest } from '../../../../client-api-platform/src/index';
|
|
4
|
+
import { IconTrayOptions, OpenGlobalContextMenuRequest, OpenViewTabContextMenuRequest, WindowStateButtonOptions } from '../../../../client-api-platform/src/shapes';
|
|
4
5
|
export declare const getBrowserModule: (identity: OpenFin.Identity) => {
|
|
5
6
|
identity: OpenFin.Identity;
|
|
6
7
|
openfinWindow: import("openfin-adapter").Window;
|
|
@@ -12,5 +13,8 @@ export declare const getBrowserModule: (identity: OpenFin.Identity) => {
|
|
|
12
13
|
updatePage: (req: any) => Promise<any>;
|
|
13
14
|
reorderPages: (req: any) => Promise<any>;
|
|
14
15
|
_openGlobalContextMenu: (req: OpenGlobalContextMenuRequest) => Promise<any>;
|
|
16
|
+
replaceIconTrayOptions: (options: IconTrayOptions) => Promise<void>;
|
|
17
|
+
replaceWindowStateButtonOptions: (options: WindowStateButtonOptions) => Promise<void>;
|
|
15
18
|
_openViewTabContextMenu: (req: OpenViewTabContextMenuRequest) => Promise<any>;
|
|
19
|
+
_openPageTabContextMenu: (req: OpenPageTabContextMenuRequest) => Promise<any>;
|
|
16
20
|
};
|
|
@@ -13,7 +13,10 @@ export declare const getBrowserApi: (identity: OpenFin.ApplicationIdentity) => {
|
|
|
13
13
|
updatePage: (req: any) => Promise<any>;
|
|
14
14
|
reorderPages: (req: any) => Promise<any>;
|
|
15
15
|
_openGlobalContextMenu: (req: import("../../shapes").OpenGlobalContextMenuRequest) => Promise<any>;
|
|
16
|
+
replaceIconTrayOptions: (options: import("../../shapes").IconTrayOptions) => Promise<void>;
|
|
17
|
+
replaceWindowStateButtonOptions: (options: import("../../shapes").WindowStateButtonOptions) => Promise<void>;
|
|
16
18
|
_openViewTabContextMenu: (req: import("../../shapes").OpenViewTabContextMenuRequest) => Promise<any>;
|
|
19
|
+
_openPageTabContextMenu: (req: import("../../shapes").OpenPageTabContextMenuRequest) => Promise<any>;
|
|
17
20
|
};
|
|
18
21
|
createWindow: (options: BrowserCreateWindowRequest) => Promise<BrowserWindowModule>;
|
|
19
22
|
getAllAttachedPages: () => Promise<AttachedPage[]>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare const handler: (winIdentity: NamedIdentity, data: GlobalContextMenuItemData) => Promise<void>;
|
|
1
|
+
import { GlobalContextMenuItemData, OpenGlobalContextMenuPayload } from '../../shapes';
|
|
2
|
+
declare const handler: (data: GlobalContextMenuItemData, payload: OpenGlobalContextMenuPayload) => Promise<void>;
|
|
4
3
|
export default handler;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { OpenPageTabContextMenuPayload } from '../../../../client-api-platform/src/index';
|
|
2
|
+
import { PageTabContextMenuItemData } from '../../../../client-api-platform/src/shapes';
|
|
3
|
+
export declare const pageTabContextMenuItemHandler: (data: PageTabContextMenuItemData, payload: OpenPageTabContextMenuPayload) => Promise<void>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NamedIdentity } from 'openfin-adapter/src/identity';
|
|
2
1
|
import { OpenViewTabContextMenuPayload, ViewTabMenuData } from '../../../../client-api-platform/src/index';
|
|
3
|
-
declare const handler: (
|
|
2
|
+
declare const handler: (data: ViewTabMenuData, payload: OpenViewTabContextMenuPayload) => Promise<void>;
|
|
4
3
|
export default handler;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { NamedIdentity } from 'openfin-adapter/src/identity';
|
|
2
|
-
import {
|
|
2
|
+
import { OpenPageTabContextMenuPayload } from '../../../../client-api-platform/src/index';
|
|
3
|
+
import { OpenGlobalContextMenuPayload, OpenGlobalContextMenuRequest, OpenPageTabContextMenuRequest, OpenViewTabContextMenuPayload, OpenViewTabContextMenuRequest } from '../../../../client-api-platform/src/shapes';
|
|
3
4
|
export declare function openGlobalContextMenuInternal(payload: OpenGlobalContextMenuRequest & {
|
|
4
5
|
identity: NamedIdentity;
|
|
5
6
|
}, callerIdentity: any): Promise<void>;
|
|
6
|
-
export declare const
|
|
7
|
+
export declare const openCommonContextMenu: (payload: OpenGlobalContextMenuPayload | OpenViewTabContextMenuPayload | OpenPageTabContextMenuPayload, callerIdentity: any) => Promise<void>;
|
|
7
8
|
export declare function openViewTabContextMenuInternal(payload: OpenViewTabContextMenuRequest & {
|
|
8
9
|
identity: NamedIdentity;
|
|
9
10
|
}, callerIdentity: any): Promise<void>;
|
|
10
|
-
export declare
|
|
11
|
+
export declare function openPageTabContextMenuInternal(payload: OpenPageTabContextMenuRequest & {
|
|
12
|
+
identity: NamedIdentity;
|
|
13
|
+
}, callerIdentity: any): Promise<void>;
|
|
@@ -34,8 +34,9 @@ export declare enum ChannelAction {
|
|
|
34
34
|
GetLastFocusedBrowserWindow = "getLastFocusedBrowserWindow",
|
|
35
35
|
GetThemes = "getThemes",
|
|
36
36
|
OpenGlobalContextMenuInternal = "openGlobalContextMenuInternal",
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
OpenViewTabContextMenuInternal = "openViewTabContextMenuInternal",
|
|
38
|
+
OpenPageTabContextMenuInternal = "openPageTabContextMenuInternal",
|
|
39
|
+
InvokeCustomActionInternal = "invokeCustomActionInternal"
|
|
39
40
|
}
|
|
40
41
|
/**
|
|
41
42
|
* Get a channel client for a specific Workspace platform.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="openfin-adapter/fin" />
|
|
2
2
|
import { Identity } from 'openfin-adapter';
|
|
3
3
|
import type { CustomThemeOptions } from '../../../common/src/api/theming';
|
|
4
|
-
import {
|
|
4
|
+
import type { BrowserInitConfig } from '..';
|
|
5
5
|
export declare function overrideViewOptions(options: Partial<OpenFin.ViewOptions>, initOptions: OpenFin.ViewOptions): any;
|
|
6
6
|
export declare function preserveInteropIfManifestConflict(opts: Partial<OpenFin.ViewOptions>, fetchManifest: ({ manifestUrl: string }: {
|
|
7
7
|
manifestUrl: any;
|
|
@@ -28,19 +28,6 @@ declare type LegacyWindowOptions = Omit<OpenFin.PlatformWindowCreationOptions, '
|
|
|
28
28
|
workstacks?: OpenFin.Page[];
|
|
29
29
|
};
|
|
30
30
|
export declare const initWorkspacePlatformOptions: (options: LegacyWindowOptions | OpenFin.PlatformWindowCreationOptions) => OpenFin.PlatformWindowCreationOptions;
|
|
31
|
-
/**
|
|
32
|
-
* hasLayout()
|
|
33
|
-
* Function to force layout settings
|
|
34
|
-
* - Check if layout property exists if so process data, else return as is
|
|
35
|
-
* - Define behavior settings
|
|
36
|
-
* - Force dimension options
|
|
37
|
-
* - Validate icon
|
|
38
|
-
*
|
|
39
|
-
* Ticket: WRK-???
|
|
40
|
-
*
|
|
41
|
-
* @param options - options used to handle layout settings
|
|
42
|
-
* @returns processed or unprocesseed options
|
|
43
|
-
*/
|
|
44
|
-
export declare const applyBrowserDefaults: (options: OpenFin.PlatformWindowCreationOptions, initOptions: BrowserCreateWindowRequest, theme: CustomThemeOptions) => OpenFin.PlatformWindowCreationOptions;
|
|
45
31
|
export declare const applyPageDefaults: (pages: OpenFin.Page[], defaultPageOptions?: BrowserInitConfig['defaultPageOptions']) => OpenFin.Page[];
|
|
32
|
+
export declare const applyBrowserDefaults: (options: OpenFin.PlatformWindowCreationOptions, initOptions: Pick<BrowserInitConfig, 'defaultWindowOptions' | 'defaultPageOptions'>, theme: CustomThemeOptions) => OpenFin.PlatformWindowCreationOptions;
|
|
46
33
|
export {};
|
|
@@ -58,6 +58,15 @@ export declare enum GlobalContextMenuOptionType {
|
|
|
58
58
|
Quit = "Quit",
|
|
59
59
|
Custom = "Custom"
|
|
60
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
|
+
}
|
|
61
70
|
/**Shape of the data property of a global context menu template item */
|
|
62
71
|
export interface GlobalContextMenuItemData extends ContextMenuItemData {
|
|
63
72
|
type: GlobalContextMenuOptionType;
|
|
@@ -66,11 +75,31 @@ export interface GlobalContextMenuItemData extends ContextMenuItemData {
|
|
|
66
75
|
export interface GlobalContextMenuItemTemplate extends OpenFin.MenuItemTemplate {
|
|
67
76
|
data: GlobalContextMenuItemData;
|
|
68
77
|
}
|
|
69
|
-
/**
|
|
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 */
|
|
70
87
|
export interface GlobalContextMenuOptionActionPayload {
|
|
71
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 */
|
|
72
98
|
windowIdentity: OpenFin.Identity;
|
|
73
|
-
|
|
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;
|
|
74
103
|
}
|
|
75
104
|
/**
|
|
76
105
|
* Payload received by the openGlobalContextMenu provider override.
|
|
@@ -81,7 +110,7 @@ export declare type OpenGlobalContextMenuPayload = OpenGlobalContextMenuRequest
|
|
|
81
110
|
/** Identity of the Browser window where context menu should be shown. */
|
|
82
111
|
identity: NamedIdentity;
|
|
83
112
|
/** Default function that handles stock context menu options. */
|
|
84
|
-
callback: (data: GlobalContextMenuItemData) => any;
|
|
113
|
+
callback: (data: GlobalContextMenuItemData, payload: OpenGlobalContextMenuPayload) => any;
|
|
85
114
|
};
|
|
86
115
|
export interface ViewTabContextMenuTemplate extends OpenFin.MenuItemTemplate {
|
|
87
116
|
data: ViewTabMenuData;
|
|
@@ -100,6 +129,19 @@ export interface OpenViewTabContextMenuRequest {
|
|
|
100
129
|
template: ViewTabContextMenuTemplate[];
|
|
101
130
|
selectedViews: OpenFin.Identity[];
|
|
102
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
|
+
}
|
|
103
145
|
export declare enum ViewTabMenuOptionType {
|
|
104
146
|
NewView = "NewView",
|
|
105
147
|
DuplicateViews = "DuplicateView",
|
|
@@ -130,7 +172,18 @@ export declare type OpenViewTabContextMenuPayload = OpenViewTabContextMenuReques
|
|
|
130
172
|
/** Identity of the Browser window where context menu should be shown. */
|
|
131
173
|
identity: NamedIdentity;
|
|
132
174
|
/** Default function that handles stock context menu options. */
|
|
133
|
-
callback: (data: ViewTabMenuData, req:
|
|
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;
|
|
134
187
|
};
|
|
135
188
|
/**
|
|
136
189
|
* Request to update the attributes of a page in which is attached to a running browser window.
|
|
@@ -414,7 +467,66 @@ export interface BrowserWindowModule {
|
|
|
414
467
|
* @param req the reorder pages request.
|
|
415
468
|
*/
|
|
416
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>;
|
|
417
528
|
_openViewTabContextMenu(req: OpenViewTabContextMenuRequest): Promise<void>;
|
|
529
|
+
_openPageTabContextMenu(req: OpenPageTabContextMenuRequest): Promise<void>;
|
|
418
530
|
}
|
|
419
531
|
/**
|
|
420
532
|
* Factory for wrapping browser windows and global operations.
|
|
@@ -481,7 +593,66 @@ export interface BrowserWindowFactory {
|
|
|
481
593
|
* workspacePlatform {
|
|
482
594
|
* pages: [page],
|
|
483
595
|
* title: 'My Window Title',
|
|
484
|
-
* 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
|
+
* }
|
|
485
656
|
* }
|
|
486
657
|
* };
|
|
487
658
|
* const window = await workspacePlatform.Browser.createWindow(options);
|
|
@@ -763,14 +934,21 @@ export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
|
|
|
763
934
|
* @param req the payload received by the provider call
|
|
764
935
|
* @param callerIdentity OF identity of the entity from which the request originated
|
|
765
936
|
*/
|
|
766
|
-
openGlobalContextMenu(req: OpenGlobalContextMenuPayload, callerIdentity:
|
|
937
|
+
openGlobalContextMenu(req: OpenGlobalContextMenuPayload, callerIdentity: OpenFin.Identity): any;
|
|
767
938
|
/**
|
|
768
939
|
* Implementation for showing a view tab context menu given a menu template,
|
|
769
940
|
* handler callback, and screen coordinates
|
|
770
941
|
* @param req the payload received by the provider call
|
|
771
942
|
* @param callerIdentity OF identity of the entity from which the request originated
|
|
772
943
|
*/
|
|
773
|
-
openViewTabContextMenu(req: OpenViewTabContextMenuPayload, callerIdentity:
|
|
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;
|
|
774
952
|
}
|
|
775
953
|
/**
|
|
776
954
|
* The origins from which a custom action can be invoked
|
|
@@ -779,6 +957,7 @@ export declare enum CustomActionCallerType {
|
|
|
779
957
|
CustomButton = "CustomButton",
|
|
780
958
|
GlobalContextMenu = "GlobalContextMenu",
|
|
781
959
|
ViewTabContextMenu = "ViewTabContextMenu",
|
|
960
|
+
PageTabContextMenu = "PageTabContextMenu",
|
|
782
961
|
API = "API"
|
|
783
962
|
}
|
|
784
963
|
/**The payload received by a Custom Action.
|
|
@@ -786,7 +965,7 @@ export declare enum CustomActionCallerType {
|
|
|
786
965
|
* When `callerType == CustomActionCallerType.API`, the payload is defined by the code directly invoking the action.*/
|
|
787
966
|
export declare type CustomActionPayload = {
|
|
788
967
|
callerType: CustomActionCallerType.API;
|
|
789
|
-
} | CustomButtonActionPayload | GlobalContextMenuOptionActionPayload | ViewTabCustomActionPayload;
|
|
968
|
+
} | CustomButtonActionPayload | GlobalContextMenuOptionActionPayload | ViewTabCustomActionPayload | PageTabContextMenuOptionActionPayload;
|
|
790
969
|
/**
|
|
791
970
|
* Configures a custom action when the control is invoked
|
|
792
971
|
*/
|
|
@@ -864,16 +1043,75 @@ export interface WorkspacePlatformInitConfig {
|
|
|
864
1043
|
* WorkspacePlatformProvider
|
|
865
1044
|
* ) => {
|
|
866
1045
|
* class Override extends WorkspacePlatformProvider {
|
|
1046
|
+
* // ovrride default behavior of updateSavedPage
|
|
867
1047
|
* updateSavedPage = async (req: UpdateSavedPageRequest): Promise<void> => {
|
|
868
1048
|
* console.log(`saving page ${req.page.pageId}`);
|
|
869
1049
|
* // calling custom function to the save page here
|
|
870
|
-
*
|
|
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
|
+
*
|
|
871
1097
|
* }
|
|
872
1098
|
* return new Override();
|
|
873
1099
|
* };
|
|
874
1100
|
*
|
|
875
1101
|
* await WorkspacePlatform.init({
|
|
876
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
|
+
*
|
|
877
1115
|
* });
|
|
878
1116
|
*/
|
|
879
1117
|
export declare type BrowserOverrideCallback = OpenFin.OverrideCallback<WorkspacePlatformProvider>;
|
|
@@ -15,7 +15,9 @@ export interface AddToChannelRequest {
|
|
|
15
15
|
export declare enum ChannelAction {
|
|
16
16
|
CloseBrowserWindow = "close-browser-window",
|
|
17
17
|
QuitPlatform = "quit-platform",
|
|
18
|
-
|
|
18
|
+
ClosePage = "close-page",
|
|
19
19
|
AddToChannel = "add-to-channel",
|
|
20
|
-
RemoveFromChannel = "remove-from-channel"
|
|
20
|
+
RemoveFromChannel = "remove-from-channel",
|
|
21
|
+
SavePage = "save-page",
|
|
22
|
+
DuplicatePage = "duplicate-page"
|
|
21
23
|
}
|