@openfin/workspace-platform 19.1.19 → 19.2.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-platform/src/api/pages/index.d.ts +13 -2
- package/client-api-platform/src/shapes.d.ts +62 -2
- package/common/src/api/pages/shapes.d.ts +26 -0
- package/common/src/api/protocol/workspace-platform.d.ts +2 -0
- package/common/src/utils/popup-window.d.ts +12 -7
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type OpenFin from '@openfin/core';
|
|
2
|
-
import type { AttachedPage, CopyPagePayload, DetachPagesFromWindowPayload, ExtendedAttachPagesToWindowPayload, HandleSaveModalOnPageClosePayload, ReorderPagesForWindowPayload, SaveModalOnPageCloseResult, SetActivePageForWindowPayload, UpdatePageForWindowPayload } from '../../../../common/src/api/pages/shapes';
|
|
3
|
-
import type { CreateSavedPageRequest, HandlePageChangesPayload, ModifiedPageState, Page, UpdateSavedPageRequest } from '../../../../client-api-platform/src/shapes';
|
|
2
|
+
import type { AttachedPage, CopyPagePayload, DetachPagesFromWindowPayload, ExtendedAttachPagesToWindowPayload, HandlePagesAndWindowClosePayload, HandlePagesAndWindowCloseResult, HandleSaveModalOnPageClosePayload, ReorderPagesForWindowPayload, SaveModalOnPageCloseResult, SetActivePageForWindowPayload, ShouldPageClosePayload, ShouldPageCloseResult, UpdatePageForWindowPayload } from '../../../../common/src/api/pages/shapes';
|
|
3
|
+
import type { CreateSavedPageRequest, HandlePageChangesPayload, ModifiedPageState, Page, UpdateSavedPageRequest, WorkspacePlatformProvider } from '../../../../client-api-platform/src/shapes';
|
|
4
4
|
/**
|
|
5
5
|
* Get all open pages in which are attached to a window.
|
|
6
6
|
* @returns the list of attached pages.
|
|
@@ -31,6 +31,17 @@ export declare const getActivePageIdForWindow: (identity: OpenFin.Identity) => P
|
|
|
31
31
|
*/
|
|
32
32
|
export declare function getUniquePageTitle(initialName?: string): Promise<string>;
|
|
33
33
|
export declare function handleSaveModalOnPageClose({ page }: HandleSaveModalOnPageClosePayload): Promise<SaveModalOnPageCloseResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Default implementation of shouldPageClose. If enableBeforeUnload isn't set to true, always returns True (proceed with close).
|
|
36
|
+
* If beforeunload handling is enabled, will return False if any views in the page are determined not to close.
|
|
37
|
+
*/
|
|
38
|
+
export declare function shouldPageClose(this: WorkspacePlatformProvider, { page, identity }: ShouldPageClosePayload): Promise<ShouldPageCloseResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Default implementation of handlePagesAndWindowClose. Will abort closing of the window if any of the pages within it are prevented from closing.
|
|
41
|
+
* @param payload Contains pages that were prevented from closing, pages that weren't, and identity of the window
|
|
42
|
+
* @returns {shouldWindowClose: boolean} which determines whether closing of the window will proceed
|
|
43
|
+
*/
|
|
44
|
+
export declare function handlePagesAndWindowClose(this: WorkspacePlatformProvider, { pagesPreventingClose, pagesNotPreventingClose, identity }: HandlePagesAndWindowClosePayload): Promise<HandlePagesAndWindowCloseResult>;
|
|
34
45
|
export declare function copyPageOverride({ page }: CopyPagePayload): Promise<Page>;
|
|
35
46
|
export declare function handlePageChanges(payload: HandlePageChangesPayload): Promise<ModifiedPageState>;
|
|
36
47
|
/**
|
|
@@ -2,7 +2,7 @@ import type OpenFin from '@openfin/core';
|
|
|
2
2
|
import { IconProps, Languages } from '@openfin/ui-library';
|
|
3
3
|
import type { AnalyticsEvent, AnalyticsEventInternal } from '../../common/src/utils/usage-register';
|
|
4
4
|
import { CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
|
|
5
|
-
import type { AddDefaultPagePayload, AttachedPage, CopyPagePayload, HandleSaveModalOnPageClosePayload, Page, PageWithUpdatableRuntimeAttribs, SaveModalOnPageCloseResult } from '../../common/src/api/pages/shapes';
|
|
5
|
+
import type { AddDefaultPagePayload, AttachedPage, CopyPagePayload, HandlePagesAndWindowClosePayload, HandlePagesAndWindowCloseResult, HandleSaveModalOnPageClosePayload, Page, PageWithUpdatableRuntimeAttribs, SaveModalOnPageCloseResult, ShouldPageClosePayload, ShouldPageCloseResult, ViewsPreventingUnloadPayload } from '../../common/src/api/pages/shapes';
|
|
6
6
|
import { SetActivePageForWindowPayload } from '../../common/src/api/pages/shapes';
|
|
7
7
|
import { NotificationsCustomManifestOptions } from '../../common/src/api/shapes/notifications';
|
|
8
8
|
import type { CustomThemes } from '../../common/src/api/theming';
|
|
@@ -11,7 +11,7 @@ import type { WorkflowIntegration } from '../../client-api/src/shapes/integratio
|
|
|
11
11
|
export { AppManifestType } from '../../client-api/src/shapes';
|
|
12
12
|
export type { App, AppIntent, Image } from '../../client-api/src/shapes';
|
|
13
13
|
export type { CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
|
|
14
|
-
export type { AttachedPage, Page, PageLayout, PageLayoutDetails, PageWithUpdatableRuntimeAttribs, PanelConfigHorizontal, PanelConfigVertical, PanelConfig, ExtendedPanelConfig, CopyPagePayload, HandleSaveModalOnPageClosePayload, SaveModalOnPageCloseResult, SetActivePageForWindowPayload } from '../../common/src/api/pages/shapes';
|
|
14
|
+
export type { AttachedPage, Page, PageLayout, PageLayoutDetails, PageWithUpdatableRuntimeAttribs, PanelConfigHorizontal, PanelConfigVertical, PanelConfig, ExtendedPanelConfig, CopyPagePayload, HandleSaveModalOnPageClosePayload, SaveModalOnPageCloseResult, SetActivePageForWindowPayload, ShouldPageClosePayload, ShouldPageCloseResult, ViewsPreventingUnloadPayload } from '../../common/src/api/pages/shapes';
|
|
15
15
|
export { PanelPosition } from '../../common/src/api/pages/shapes';
|
|
16
16
|
export type { CustomThemes, CustomThemeOptions, CustomThemeOptionsWithScheme, CustomPaletteSet, BaseThemeOptions, ThemeExtension, WorkspaceThemeSet, NotificationIndicatorColorsSet, NotificationIndicatorColorsSetDarkScheme, NotificationIndicatorColorsSetLightScheme, NotificationIndicatorColorsWithScheme } from '../../common/src/api/theming';
|
|
17
17
|
export type { AnalyticsEvent } from '../../common/src/utils/usage-register';
|
|
@@ -1659,6 +1659,66 @@ export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
|
|
|
1659
1659
|
* and `false` otherwise.
|
|
1660
1660
|
*/
|
|
1661
1661
|
handleSaveModalOnPageClose(payload: HandleSaveModalOnPageClosePayload): Promise<SaveModalOnPageCloseResult>;
|
|
1662
|
+
/**
|
|
1663
|
+
* This override is called upon closing of the page by user or for each page in a window that is being closed by user.
|
|
1664
|
+
*
|
|
1665
|
+
* In case of closing a page individually, the close operation will be aborted if a False value is returned.
|
|
1666
|
+
*
|
|
1667
|
+
* In case of closing a window, the return value will be used to form payload of handlePagesAndWindowClose override, which determines whether the window should proceed with closing.
|
|
1668
|
+
*
|
|
1669
|
+
* Default behavior: if beforeunload is disabled for the platform, True is always returned.
|
|
1670
|
+
* If enableBeforeUnload is set to true and getUserDecisionForBeforeUnload override is configured to respect beforeunload decisions of views,
|
|
1671
|
+
* then True is only returned if no views are preventing unload.
|
|
1672
|
+
*/
|
|
1673
|
+
shouldPageClose(payload: ShouldPageClosePayload): Promise<ShouldPageCloseResult>;
|
|
1674
|
+
/**
|
|
1675
|
+
* This override is called upon closing of a window by user and its return value determines whether the window should proceed closing.
|
|
1676
|
+
* pagesPreventingClose and pagesNotPreventingClose represent pages in the window, grouped based on the value returned by shouldPageClose override for each page.
|
|
1677
|
+
* Default implementation will abort closing of the window if any of the pages within it are prevented from closing.
|
|
1678
|
+
* @param payload Contains pages that were prevented from closing, pages that weren't, and identity of the window
|
|
1679
|
+
* @returns `Promise<{shouldWindowClose: boolean}>` which determines whether closing of the window will proceed
|
|
1680
|
+
*/
|
|
1681
|
+
handlePagesAndWindowClose(payload: HandlePagesAndWindowClosePayload): Promise<HandlePagesAndWindowCloseResult>;
|
|
1682
|
+
/**
|
|
1683
|
+
* Handle the decision of whether a Window, Page or specific View should close when trying to prevent an unload. This is meant to be overridden.
|
|
1684
|
+
* Called in {@link WorkspacePlatformProvider.closeWindow} and {@link WorkspacePlatformProvider.closeView}.
|
|
1685
|
+
*
|
|
1686
|
+
* When closing a Page, this override is called by {@link WorkspacePlatformProvider.shouldPageClose}
|
|
1687
|
+
* and page proceeds to close if all views passed in are determined to close. In this case, the `closeType` property will have `'page'` value.
|
|
1688
|
+
*
|
|
1689
|
+
* Normally you would use this method to show a dialog indicating that there are Views that are trying to prevent an unload.
|
|
1690
|
+
* By default it will always return all Views passed into it as meaning to close.
|
|
1691
|
+
* @param payload
|
|
1692
|
+
* @example
|
|
1693
|
+
*
|
|
1694
|
+
* ```js
|
|
1695
|
+
* const overrideCallback = (PlatformProvider) => {
|
|
1696
|
+
* class Override extends PlatformProvider {
|
|
1697
|
+
* async getUserDecisionForBeforeUnload(payload, callerIdentity) {
|
|
1698
|
+
* const { windowShouldClose, viewsPreventingUnload, viewsNotPreventingUnload, windowId, closeType } = payload;
|
|
1699
|
+
*
|
|
1700
|
+
* // launch dialog and wait for user response
|
|
1701
|
+
* const continueWithClose = await showDialog(viewsPreventingUnload, windowId, closeType);
|
|
1702
|
+
*
|
|
1703
|
+
* if (continueWithClose) {
|
|
1704
|
+
* return { windowShouldClose, viewsToClose: [...viewsNotPreventingUnload, ...viewsPreventingUnload] };
|
|
1705
|
+
* } else {
|
|
1706
|
+
* return { windowShouldClose: false, viewsToClose: [] };
|
|
1707
|
+
* }
|
|
1708
|
+
* }
|
|
1709
|
+
* }
|
|
1710
|
+
* return new Override();
|
|
1711
|
+
* }
|
|
1712
|
+
*
|
|
1713
|
+
* fin.Platform.init({ overrideCallback });
|
|
1714
|
+
*
|
|
1715
|
+
* async function showDialog(viewsPreventingUnload, windowId, closeType) {
|
|
1716
|
+
* // Show a dialog and await for user response
|
|
1717
|
+
* }
|
|
1718
|
+
* ```
|
|
1719
|
+
*
|
|
1720
|
+
*/
|
|
1721
|
+
getUserDecisionForBeforeUnload(payload: ViewsPreventingUnloadPayload): Promise<OpenFin.BeforeUnloadUserDecision>;
|
|
1662
1722
|
/**
|
|
1663
1723
|
* Implementation for setting the active page in a browser window.
|
|
1664
1724
|
* Called when the active page is changed and on browser window creation.
|
|
@@ -196,6 +196,29 @@ export type PanelConfig = (PanelConfigHorizontal | PanelConfigVertical) & {
|
|
|
196
196
|
export type ExtendedPanelConfig = PanelConfig & {
|
|
197
197
|
viewOptions: PanelConfig['viewOptions'] & OpenFin.Identity;
|
|
198
198
|
};
|
|
199
|
+
export interface ShouldPageClosePayload {
|
|
200
|
+
/** The page that is closing. */
|
|
201
|
+
page: AttachedPage;
|
|
202
|
+
/** The OF window identity containing the page. */
|
|
203
|
+
identity: OpenFin.Identity;
|
|
204
|
+
/** The type of close operation that triggered the override */
|
|
205
|
+
closeType: 'page' | 'window' | 'view';
|
|
206
|
+
}
|
|
207
|
+
export interface ViewsPreventingUnloadPayload extends Omit<OpenFin.ViewsPreventingUnloadPayload, 'closeType'> {
|
|
208
|
+
closeType: OpenFin.ViewsPreventingUnloadPayload['closeType'] | 'page';
|
|
209
|
+
}
|
|
210
|
+
export interface HandlePagesAndWindowClosePayload {
|
|
211
|
+
/** Pages for which `shouldPageClose` override returned false */
|
|
212
|
+
pagesPreventingClose: AttachedPage[];
|
|
213
|
+
/** Pages for which `shouldPageClose` override returned true */
|
|
214
|
+
pagesNotPreventingClose: AttachedPage[];
|
|
215
|
+
/** Identity of the Browser window */
|
|
216
|
+
identity: OpenFin.Identity;
|
|
217
|
+
}
|
|
218
|
+
export interface HandlePagesAndWindowCloseResult {
|
|
219
|
+
/** Determines whether closing of the window should proceed. */
|
|
220
|
+
shouldWindowClose: boolean;
|
|
221
|
+
}
|
|
199
222
|
export interface HandleSaveModalOnPageClosePayload {
|
|
200
223
|
/** The page that is closing. */
|
|
201
224
|
page: AttachedPage;
|
|
@@ -206,6 +229,9 @@ export interface SaveModalOnPageCloseResult {
|
|
|
206
229
|
/** If false, a modal informing that unsaved changes will be lost will not be displayed. */
|
|
207
230
|
shouldShowModal: boolean;
|
|
208
231
|
}
|
|
232
|
+
export interface ShouldPageCloseResult {
|
|
233
|
+
shouldPageClose: boolean;
|
|
234
|
+
}
|
|
209
235
|
export interface CopyPagePayload {
|
|
210
236
|
/** The OF browser identity containing the page to copy. */
|
|
211
237
|
identity: OpenFin.Identity;
|
|
@@ -59,6 +59,8 @@ export declare enum WorkspacePlatformChannelAction {
|
|
|
59
59
|
GetDockProviderConfig = "getDockProviderConfig",
|
|
60
60
|
SaveDockProviderConfig = "saveDockProviderConfig",
|
|
61
61
|
HandleSaveModalOnPageClose = "handleSaveModalOnPageClose",
|
|
62
|
+
ShouldPageClose = "shouldPageClose",
|
|
63
|
+
ShouldWindowClose = "shouldWindowClose",
|
|
62
64
|
CopyPage = "copyPage",
|
|
63
65
|
HandlePageChanges = "handlePageChanges",
|
|
64
66
|
MarkUnsavedPagesAsSavedInternal = "markUnsavedPagesAsSavedInternal",
|
|
@@ -14,12 +14,21 @@ export declare enum SaveMenuType {
|
|
|
14
14
|
*/
|
|
15
15
|
export declare const getSaveContextMenuTemplate: (saveMenuType?: SaveMenuType) => OpenFin.MenuItemTemplate[];
|
|
16
16
|
export declare function showModalWin<T extends keyof UserMenuParams>(params: UserMenuParams[T], windowOpts: OptionalExceptFor<OpenFin.WindowOptions, 'x' | 'y' | 'defaultWidth' | 'url' | 'name'>): Promise<OpenFin.Window>;
|
|
17
|
-
export
|
|
17
|
+
export type SearchMenuChannelFocusView = {
|
|
18
|
+
type: 'focus-search-menu';
|
|
19
|
+
};
|
|
20
|
+
export type SearchMenuChannelViewResized = {
|
|
21
|
+
type: 'view-resized';
|
|
22
|
+
height: number;
|
|
23
|
+
width: number;
|
|
24
|
+
};
|
|
25
|
+
export type SearchMenuChannelUpdateState = {
|
|
18
26
|
selectedViews: OpenFin.Identity[];
|
|
19
27
|
openViews: OpenFin.Identity[];
|
|
20
28
|
windowId: OpenFin.Identity;
|
|
21
|
-
type
|
|
22
|
-
}
|
|
29
|
+
type: 'update-search-menu-state';
|
|
30
|
+
};
|
|
31
|
+
export type SearchMenuChannelRequest = SearchMenuChannelFocusView | SearchMenuChannelViewResized | SearchMenuChannelUpdateState;
|
|
23
32
|
export declare enum ContextMenuType {
|
|
24
33
|
GlobalMenu = "global-menu",
|
|
25
34
|
ContextMenu = "context-menu",
|
|
@@ -42,9 +51,6 @@ export type SearchMenuChannelResponse = {
|
|
|
42
51
|
selectedView: OpenFin.Identity;
|
|
43
52
|
inputUpdate?: string;
|
|
44
53
|
trigger?: SiteAction;
|
|
45
|
-
} | {
|
|
46
|
-
type: 'expand-status-changed';
|
|
47
|
-
isExpanded: boolean;
|
|
48
54
|
} | {
|
|
49
55
|
type: 'update-input';
|
|
50
56
|
inputText: string;
|
|
@@ -52,7 +58,6 @@ export type SearchMenuChannelResponse = {
|
|
|
52
58
|
landingPage: boolean;
|
|
53
59
|
} | {
|
|
54
60
|
type: 'resize-view';
|
|
55
|
-
isExpanded: boolean;
|
|
56
61
|
height: number;
|
|
57
62
|
width: number;
|
|
58
63
|
};
|