@vuu-ui/vuu-shell 3.3.11 → 4.0.0-alpha.2
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/package.json +18 -16
- package/src/app-header/AppHeader.js +36 -26
- package/src/application-provider/ApplicationContext.js +2 -5
- package/src/application-provider/ApplicationProvider.js +8 -59
- package/src/feature/Feature.js +3 -34
- package/src/feature/index.js +1 -0
- package/src/feature-list/FeatureList.css.js +27 -5
- package/src/feature-list/FeatureList.js +117 -96
- package/src/index.js +3 -3
- package/src/left-nav/LeftNav.css.js +2 -4
- package/src/left-nav/LeftNav.js +139 -100
- package/src/module-registry/getRegisteredModules.js +12 -0
- package/src/persistence-manager/LocalWorkspacePersistenceService.js +129 -0
- package/src/persistence-manager/PersistenceProvider.js +10 -3
- package/src/persistence-manager/RemoteWorkspacePersistenceService.js +112 -0
- package/src/persistence-manager/WorkspacePersistenceService.js +9 -0
- package/src/persistence-manager/index.js +3 -0
- package/src/shell-layout-templates/context-panel/ApplicationSettingsContextPanel.js +24 -0
- package/src/shell-layout-templates/context-panel/ContextPanel.css.js +8 -8
- package/src/shell-layout-templates/context-panel/ContextPanel.js +17 -35
- package/src/shell-layout-templates/context-panel/index.js +1 -0
- package/src/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.js +54 -40
- package/src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.js +54 -64
- package/src/shell-layout-templates/left-main-tabs/useLeftMainTabs.js +49 -28
- package/src/shell-layout-templates/side-panel/SidePanel.css.js +3 -1
- package/src/shell-layout-templates/simple-content-pane/useSimpleContentPane.js +43 -35
- package/src/shell.css.js +85 -2
- package/src/shell.js +148 -70
- package/src/workspace-management/LayoutList.js +59 -99
- package/src/workspace-management/SaveLayoutPanel.js +3 -3
- package/src/workspace-management/WorkspaceController.js +73 -0
- package/src/workspace-management/WorkspaceHost.js +194 -0
- package/src/workspace-management/WorkspacePersistentState.js +67 -0
- package/src/workspace-management/WorkspaceProvider.js +699 -178
- package/src/workspace-management/WorkspaceRepository.js +127 -0
- package/src/workspace-management/WorkspaceStartPanel.css.js +44 -0
- package/src/workspace-management/WorkspaceStartPanel.js +34 -0
- package/src/workspace-management/index.js +8 -0
- package/src/workspace-management/shell-workspace-components.js +59 -0
- package/src/workspace-management/useWorkspaceContextMenuItems.js +12 -6
- package/src/workspace-management/workspace-component-registry.js +30 -0
- package/src/workspace-management/workspace-schemas.js +257 -0
- package/types/app-header/AppHeader.d.ts +2 -2
- package/types/application-provider/ApplicationContext.d.ts +1 -6
- package/types/application-provider/ApplicationProvider.d.ts +5 -14
- package/types/feature/Feature.d.ts +2 -10
- package/types/feature/Loader.d.ts +1 -1
- package/types/feature/index.d.ts +2 -1
- package/types/feature-list/FeatureList.d.ts +4 -4
- package/types/index.d.ts +3 -3
- package/types/left-nav/LeftNav.d.ts +2 -1
- package/types/login/LoginPanel.d.ts +1 -1
- package/types/login/VuuLogo.d.ts +1 -1
- package/types/persistence-manager/PersistenceProvider.d.ts +7 -3
- package/types/persistence-manager/index.d.ts +3 -0
- package/types/shell-layout-templates/context-panel/ContextPanel.d.ts +9 -11
- package/types/shell-layout-templates/context-panel/index.d.ts +1 -0
- package/types/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.d.ts +1 -1
- package/types/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.d.ts +1 -1
- package/types/shell-layout-templates/left-main-tabs/useLeftMainTabs.d.ts +1 -1
- package/types/shell-layout-templates/side-panel/SidePanel.d.ts +1 -1
- package/types/shell-layout-templates/simple-content-pane/useSimpleContentPane.d.ts +1 -1
- package/types/shell-layout-templates/useShellLayout.d.ts +4 -2
- package/types/shell.d.ts +19 -15
- package/types/theme-switch/ThemeSwitch.d.ts +1 -1
- package/types/workspace-management/LayoutList.d.ts +2 -2
- package/types/workspace-management/LayoutTile.d.ts +1 -1
- package/types/workspace-management/SaveLayoutPanel.d.ts +2 -2
- package/types/workspace-management/WorkspaceController.d.ts +1 -1
- package/types/workspace-management/WorkspaceProvider.d.ts +61 -50
- package/types/workspace-management/defaultWorkspaceJSON.d.ts +7 -6
- package/types/workspace-management/index.d.ts +8 -0
- package/types/workspace-management/useWorkspaceContextMenuItems.d.ts +1 -1
- package/types/workspace-management/workspace-component-registry.d.ts +1 -1
- package/types/workspace-management/workspace-schemas.d.ts +1 -1
- package/src/feature/FeatureErrorBoundary.js +0 -33
- package/src/user-settings/SettingsForm.css.js +0 -10
- package/src/user-settings/SettingsForm.js +0 -141
- package/src/user-settings/UserSettingsPanel.css.js +0 -9
- package/src/user-settings/UserSettingsPanel.js +0 -29
- package/src/user-settings/index.js +0 -2
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
declare function RawFeature<Params extends object | undefined>({ url, css, ComponentProps: params, ...props }: DynamicFeatureProps<Params>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
/**
|
|
5
|
-
Feature is a wrapper around React Lazy Loading. It will load a component
|
|
6
|
-
from the given url. That url must resolve to a javascript bundle with a
|
|
7
|
-
single default export. That export must be a React component.
|
|
8
|
-
*/
|
|
9
|
-
export declare const Feature: React.MemoExoticComponent<typeof RawFeature>;
|
|
10
|
-
export {};
|
|
1
|
+
/** @deprecated Use RemoteModule from @vuu-ui/core/portal. */
|
|
2
|
+
export declare const Feature: import("react").MemoExoticComponent<(props: import("@vuu-ui/core/portal").RemoteModuleProps<object>) => import("react").JSX.Element>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const Loader: () => import("react
|
|
1
|
+
export declare const Loader: () => import("react").JSX.Element;
|
package/types/feature/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./Feature";
|
|
2
|
+
export { RemoteModule, type RemoteModuleProps, } from "@vuu-ui/core/portal";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DynamicFeatureProps, StaticFeatureDescriptor } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import { HTMLAttributes } from "react";
|
|
1
|
+
import { type DynamicFeatureProps, type StaticFeatureDescriptor } from "@vuu-ui/vuu-utils";
|
|
2
|
+
import { type HTMLAttributes } from "react";
|
|
3
3
|
export type GroupedFeatureProps<P extends object | undefined = object> = Record<string, DynamicFeatureProps<P>[]>;
|
|
4
4
|
export interface FeatureListProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
features: DynamicFeatureProps[] | GroupedFeatureProps | StaticFeatureDescriptor[];
|
|
5
|
+
readonly features: DynamicFeatureProps[] | GroupedFeatureProps | StaticFeatureDescriptor[];
|
|
6
6
|
}
|
|
7
|
-
export declare const FeatureList: ({ features, title, ...htmlAttributes }: FeatureListProps) => import("react
|
|
7
|
+
export declare const FeatureList: ({ features, title, ...htmlAttributes }: FeatureListProps) => import("react").JSX.Element;
|
package/types/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export * from "./application-provider";
|
|
2
1
|
export * from "./app-header";
|
|
2
|
+
export * from "./application-provider";
|
|
3
3
|
export * from "./feature";
|
|
4
4
|
export * from "./feature-and-layout-provider";
|
|
5
|
+
export * from "./feature-list";
|
|
5
6
|
export * from "./left-nav";
|
|
6
7
|
export { LoginPanel, type LoginPanelProps } from "./login/LoginPanel";
|
|
8
|
+
export { getRegisteredModules } from './module-registry/getRegisteredModules';
|
|
7
9
|
export * from "./persistence-manager";
|
|
8
10
|
export * from "./shell";
|
|
9
11
|
export * from "./shell-layout-templates";
|
|
10
12
|
export * from "./ShellContextProvider";
|
|
11
|
-
export * from "./feature-list";
|
|
12
13
|
export * from "./theme-switch";
|
|
13
|
-
export * from "./user-settings";
|
|
14
14
|
export * from "./workspace-management";
|
|
@@ -7,8 +7,9 @@ export interface LeftNavProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
defaultExpanded?: boolean;
|
|
8
8
|
onActiveChange?: (activeTabIndex: number) => void;
|
|
9
9
|
onTogglePrimaryMenu?: (expanded: boolean) => void;
|
|
10
|
+
onWidthChange?: (width: number) => void;
|
|
10
11
|
sizeCollapsed?: number;
|
|
11
12
|
sizeContent?: number;
|
|
12
13
|
sizeExpanded?: number;
|
|
13
14
|
}
|
|
14
|
-
export declare const LeftNav: (props: LeftNavProps) => import("react
|
|
15
|
+
export declare const LeftNav: (props: LeftNavProps) => import("react").JSX.Element;
|
|
@@ -3,4 +3,4 @@ export interface LoginPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, "o
|
|
|
3
3
|
appName?: string;
|
|
4
4
|
onSubmit: (username: string, password: string) => void;
|
|
5
5
|
}
|
|
6
|
-
export declare const LoginPanel: ({ appName, className, onSubmit, ...htmlAttributes }: LoginPanelProps) => import("react
|
|
6
|
+
export declare const LoginPanel: ({ appName, className, onSubmit, ...htmlAttributes }: LoginPanelProps) => import("react").JSX.Element;
|
package/types/login/VuuLogo.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VuuLogo: () => import("react
|
|
1
|
+
export declare const VuuLogo: () => import("react").JSX.Element;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from "react";
|
|
2
|
-
import { IPersistenceManager } from "
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
+
import type { IPersistenceManager } from "./PersistenceManager";
|
|
3
|
+
import type { WorkspacePersistenceService } from "./WorkspacePersistenceService";
|
|
3
4
|
export interface PersistenceContextProps {
|
|
4
5
|
persistenceManager?: IPersistenceManager;
|
|
6
|
+
workspacePersistenceService?: WorkspacePersistenceService;
|
|
5
7
|
}
|
|
6
8
|
export declare const PersistenceContext: import("react").Context<PersistenceContextProps>;
|
|
7
9
|
export interface PersistenceProviderProps extends PersistenceContextProps {
|
|
8
10
|
children: ReactNode;
|
|
9
11
|
}
|
|
10
|
-
export declare const PersistenceProvider: ({ children, persistenceManager, }: PersistenceProviderProps) => ReactElement;
|
|
12
|
+
export declare const PersistenceProvider: ({ children, persistenceManager, workspacePersistenceService, }: PersistenceProviderProps) => ReactElement;
|
|
11
13
|
export declare const usePersistenceManager: () => IPersistenceManager | undefined;
|
|
14
|
+
export declare const useWorkspacePersistenceService: () => WorkspacePersistenceService;
|
|
15
|
+
export declare const useOptionalWorkspacePersistenceService: () => WorkspacePersistenceService | undefined;
|
|
@@ -3,3 +3,6 @@ export * from "./PersistenceProvider";
|
|
|
3
3
|
export * from "./LocalPersistenceManager";
|
|
4
4
|
export * from "./RemotePersistenceManager";
|
|
5
5
|
export * from "./StaticPersistenceManager";
|
|
6
|
+
export * from "./WorkspacePersistenceService";
|
|
7
|
+
export * from "./LocalWorkspacePersistenceService";
|
|
8
|
+
export * from "./RemoteWorkspacePersistenceService";
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReactElement, ReactNode } from "react";
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
3
2
|
export interface ContextPanelProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
title?: ReactNode;
|
|
3
|
+
readonly className?: string;
|
|
4
|
+
readonly content?: ReactElement;
|
|
5
|
+
readonly expanded?: boolean;
|
|
6
|
+
readonly id?: string;
|
|
7
|
+
readonly onClose?: () => void;
|
|
8
|
+
readonly overlay?: boolean;
|
|
9
|
+
readonly title?: ReactNode;
|
|
12
10
|
}
|
|
13
|
-
export declare const ContextPanel: ({ className
|
|
11
|
+
export declare const ContextPanel: ({ className, content, expanded, id, onClose, overlay, title, }: ContextPanelProps) => import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ShellLayoutTemplateHook } from "../useShellLayout";
|
|
1
|
+
import type { ShellLayoutTemplateHook } from "../useShellLayout";
|
|
2
2
|
export declare const useFullHeightLeftPanel: ShellLayoutTemplateHook;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ShellLayoutTemplateHook } from "../useShellLayout";
|
|
1
|
+
import type { ShellLayoutTemplateHook } from "../useShellLayout";
|
|
2
2
|
export declare const useInlayLeftPanel: ShellLayoutTemplateHook;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ShellLayoutTemplateHook } from "../useShellLayout";
|
|
1
|
+
import type { ShellLayoutTemplateHook } from "../useShellLayout";
|
|
2
2
|
export declare const useLeftMainTabs: ShellLayoutTemplateHook;
|
|
@@ -5,4 +5,4 @@ export interface SidePanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
5
5
|
sizeOpen?: number;
|
|
6
6
|
sizeClosed?: number;
|
|
7
7
|
}
|
|
8
|
-
export declare const SidePanel: ({ children, open, sizeClosed, sizeOpen, style: styleProp, ...htmlAttributes }: SidePanelProps) => import("react
|
|
8
|
+
export declare const SidePanel: ({ children, open, sizeClosed, sizeOpen, style: styleProp, ...htmlAttributes }: SidePanelProps) => import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ShellLayoutTemplateHook } from "../useShellLayout";
|
|
1
|
+
import type { ShellLayoutTemplateHook } from "../useShellLayout";
|
|
2
2
|
export declare const useSimpleContentPane: ShellLayoutTemplateHook;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HTMLAttributes, ReactElement, ReactNode } from "react";
|
|
2
|
-
import { SidePanelProps as ShellSidePanelProps } from "./side-panel";
|
|
1
|
+
import type { HTMLAttributes, ReactElement, ReactNode } from "react";
|
|
2
|
+
import type { SidePanelProps as ShellSidePanelProps } from "./side-panel";
|
|
3
3
|
declare const LayoutHook: {
|
|
4
4
|
"full-height": ShellLayoutTemplateHook;
|
|
5
5
|
inlay: ShellLayoutTemplateHook;
|
|
@@ -41,6 +41,8 @@ export interface ShellLayoutProps {
|
|
|
41
41
|
* If template renders Toolbar, these props will be provided
|
|
42
42
|
*/
|
|
43
43
|
ToolbarProps?: ShellToolbarProps;
|
|
44
|
+
/** Supplied by Shell; application code should not normally set this. */
|
|
45
|
+
workspaceHost?: ReactNode;
|
|
44
46
|
}
|
|
45
47
|
/**
|
|
46
48
|
* This hook acts as a stub for the actual shell layout
|
package/types/shell.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { VuuUser } from "@vuu-ui/vuu-utils";
|
|
2
1
|
import { type HTMLAttributes, type ReactNode } from "react";
|
|
3
|
-
import { ShellLayoutProps } from "./shell-layout-templates";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
user: VuuUser;
|
|
2
|
+
import { type ShellLayoutProps } from "./shell-layout-templates";
|
|
3
|
+
import { type WorkspaceProps } from "./workspace-management";
|
|
4
|
+
export interface ShellProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
5
|
+
readonly appHeader?: ReactNode;
|
|
6
|
+
readonly children?: ReactNode;
|
|
7
|
+
readonly leftNavWidth?: number;
|
|
8
|
+
readonly logout?: () => void;
|
|
9
|
+
readonly saveUrl?: string;
|
|
10
|
+
readonly serverUrl?: string;
|
|
11
|
+
/** @deprecated The shell now uses one canonical static GridLayout structure. */
|
|
12
|
+
readonly shellLayoutProps?: ShellLayoutProps;
|
|
13
|
+
readonly workspaceProps?: WorkspaceProps;
|
|
16
14
|
}
|
|
17
|
-
export
|
|
15
|
+
export interface StaticShellLayoutProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
16
|
+
readonly appHeader?: ReactNode;
|
|
17
|
+
readonly leftNavWidth?: number;
|
|
18
|
+
readonly workspaceHost?: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export declare const StaticShellLayout: ({ appHeader, className, leftNavWidth: initialLeftNavWidth, style, workspaceHost, ...htmlAttributes }: StaticShellLayoutProps) => import("react").JSX.Element;
|
|
21
|
+
export declare const Shell: ({ appHeader, children, leftNavWidth, logout, saveUrl: _saveUrl, serverUrl: _serverUrl, shellLayoutProps, workspaceProps, ...htmlAttributes }: ShellProps) => import("react").JSX.Element;
|
|
@@ -5,4 +5,4 @@ export interface ThemeSwitchProps extends Omit<HTMLAttributes<HTMLDivElement>, "
|
|
|
5
5
|
mode?: ThemeMode;
|
|
6
6
|
onChange: (mode: ThemeMode) => void;
|
|
7
7
|
}
|
|
8
|
-
export declare const ThemeSwitch: ({ className: classNameProp, defaultMode: defaultModeProp, mode: modeProp, onChange, ...htmlAttributes }: ThemeSwitchProps) => import("react
|
|
8
|
+
export declare const ThemeSwitch: ({ className: classNameProp, defaultMode: defaultModeProp, mode: modeProp, onChange, ...htmlAttributes }: ThemeSwitchProps) => import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { HTMLAttributes } from "react";
|
|
2
|
-
export declare const LayoutList: ({ className, title, ...htmlAttributes }: HTMLAttributes<HTMLDivElement>) => import("react
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export declare const LayoutList: ({ className, title, ...htmlAttributes }: HTMLAttributes<HTMLDivElement>) => import("react").JSX.Element;
|
|
@@ -4,4 +4,4 @@ export interface LayoutTileProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
4
4
|
metadata: LayoutMetadata | SystemLayoutMetadata;
|
|
5
5
|
onLoadLayout: (layoutId?: string, layoutJSON?: LayoutJSON) => void;
|
|
6
6
|
}
|
|
7
|
-
export declare const LayoutTile: ({ metadata, onLoadLayout, ...htmlAttributes }: LayoutTileProps) => import("react
|
|
7
|
+
export declare const LayoutTile: ({ metadata, onLoadLayout, ...htmlAttributes }: LayoutTileProps) => import("react").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LayoutMetadataDto } from "@vuu-ui/vuu-utils";
|
|
1
|
+
import type { LayoutMetadataDto } from "@vuu-ui/vuu-utils";
|
|
2
2
|
type SaveLayoutPanelProps = {
|
|
3
3
|
componentId?: string;
|
|
4
4
|
defaultTitle?: string;
|
|
5
5
|
onCancel: () => void;
|
|
6
6
|
onSave: (layoutMetadata: LayoutMetadataDto) => void;
|
|
7
7
|
};
|
|
8
|
-
export declare const SaveLayoutPanel: (props: SaveLayoutPanelProps) => import("react
|
|
8
|
+
export declare const SaveLayoutPanel: (props: SaveLayoutPanelProps) => import("react").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GridLayoutDocumentController, type GridComponentRendererRegistry, type GridComponentSettingsRegistry, type GridLayoutDocument, type GridLayoutDocumentChange } from "@
|
|
1
|
+
import { GridLayoutDocumentController, type GridComponentRendererRegistry, type GridComponentSettingsRegistry, type GridLayoutDocument, type GridLayoutDocumentChange } from "@vuu-ui/grid-layout";
|
|
2
2
|
import type { WorkspacePersistenceService } from "../persistence-manager";
|
|
3
3
|
import { WorkspacePersistentStateStore } from "./WorkspacePersistentState";
|
|
4
4
|
import { WorkspaceRepository } from "./WorkspaceRepository";
|
|
@@ -1,52 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
activeLayoutIndex?: number;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { type GridComponentRendererRegistry, type GridComponentSettingsRegistry, type JsonValue } from "@vuu-ui/grid-layout";
|
|
2
|
+
import type { LayoutJSON } from "@vuu-ui/vuu-utils";
|
|
3
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
4
|
+
import { type WorkspacePersistenceService } from "../persistence-manager";
|
|
5
|
+
import { WorkspaceController } from "./WorkspaceController";
|
|
6
|
+
import { type NamedWorkspaceDefinitionV1, type NamedWorkspaceMetadataV1, type WorkspaceSnapshotV1 } from "./workspace-schemas";
|
|
7
|
+
export declare const emptyWorkspaceSnapshot: WorkspaceSnapshotV1;
|
|
8
|
+
export type WorkspaceStatus = "empty" | "error" | "loading" | "ready";
|
|
9
|
+
export interface WorkspaceProps {
|
|
10
|
+
/** @deprecated Migrate this layout to defaultWorkspace. */
|
|
11
|
+
readonly activeLayoutIndex?: number;
|
|
12
|
+
readonly componentRenderers?: GridComponentRendererRegistry;
|
|
13
|
+
readonly defaultWorkspace?: WorkspaceSnapshotV1;
|
|
14
|
+
/** @deprecated Migrate this layout to defaultWorkspace. */
|
|
15
|
+
readonly layoutJSON?: LayoutJSON | readonly LayoutJSON[];
|
|
16
|
+
/** @deprecated Workspace snapshots contain their own placeholders. */
|
|
17
|
+
readonly layoutPlaceholderJSON?: LayoutJSON;
|
|
18
|
+
readonly settingsCodecs?: GridComponentSettingsRegistry;
|
|
19
|
+
/** @deprecated Tabs are managed by WorkspaceHost. */
|
|
20
|
+
readonly showTabs?: boolean | "left" | "right";
|
|
21
|
+
readonly systemWorkspaces?: readonly NamedWorkspaceDefinitionV1[];
|
|
22
|
+
/** @deprecated Tabs are managed by WorkspaceHost. */
|
|
23
|
+
readonly TabstripProps?: Readonly<Record<string, unknown>>;
|
|
24
|
+
/** @deprecated Migrate this layout to defaultWorkspace. */
|
|
25
|
+
readonly workspaceJSON?: LayoutJSON | readonly LayoutJSON[];
|
|
26
|
+
}
|
|
18
27
|
export interface WorkspaceProviderProps extends WorkspaceProps {
|
|
19
|
-
children:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
readonly children: ReactNode;
|
|
29
|
+
readonly persistenceService?: WorkspacePersistenceService;
|
|
30
|
+
readonly userId?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface WorkspaceContextValue {
|
|
33
|
+
readonly activeWorkspace?: WorkspaceController;
|
|
34
|
+
readonly activeWorkspaceInstanceId: string | null;
|
|
35
|
+
readonly closeWorkspace: (instanceId: string) => Promise<void>;
|
|
36
|
+
readonly componentRenderers?: GridComponentRendererRegistry;
|
|
37
|
+
readonly controllers: readonly WorkspaceController[];
|
|
38
|
+
readonly createWorkspaceFromSnapshot: (snapshot: WorkspaceSnapshotV1, title?: string) => Promise<string>;
|
|
39
|
+
readonly deleteNamedWorkspace: (definitionId: string) => Promise<void>;
|
|
40
|
+
readonly error?: Error;
|
|
41
|
+
readonly getApplicationSetting: (key: string) => JsonValue | undefined;
|
|
42
|
+
readonly getApplicationSettings: (key?: string) => JsonValue | Readonly<Record<string, JsonValue>> | undefined;
|
|
43
|
+
readonly namedWorkspaces: readonly NamedWorkspaceMetadataV1[];
|
|
44
|
+
readonly openNamedWorkspace: (definitionId: string) => Promise<void>;
|
|
45
|
+
readonly openSystemWorkspace: (definition: NamedWorkspaceDefinitionV1) => Promise<void>;
|
|
46
|
+
readonly renameWorkspace: (instanceId: string, title: string) => Promise<void>;
|
|
47
|
+
readonly saveActiveWorkspaceAs: (name: string, description?: string) => Promise<void>;
|
|
48
|
+
readonly saveApplicationSettings: (settings: JsonValue, key?: string) => Promise<void>;
|
|
49
|
+
readonly selectWorkspace: (instanceId: string) => Promise<void>;
|
|
50
|
+
readonly setApplicationSetting: (key: string, value: JsonValue) => Promise<void>;
|
|
51
|
+
readonly settings: Readonly<Record<string, JsonValue>>;
|
|
52
|
+
readonly settingsCodecs?: GridComponentSettingsRegistry;
|
|
53
|
+
/** Identifies the authenticated persistence scope. Changes synchronously on a scope transition. */
|
|
54
|
+
readonly scopeIdentity: string;
|
|
55
|
+
readonly status: WorkspaceStatus;
|
|
56
|
+
readonly systemWorkspaces: readonly NamedWorkspaceDefinitionV1[];
|
|
57
|
+
readonly resetApplication: () => Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
export declare class StaleWorkspaceScopeError extends Error {
|
|
60
|
+
constructor();
|
|
24
61
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* Initial layout is automatically loaded on startup. Because this hook is responsible
|
|
28
|
-
* only for loading and saving layouts, it only triggers a render when content is loaded.
|
|
29
|
-
*
|
|
30
|
-
* Initial layout displays a loading state
|
|
31
|
-
* User may supply a default layout. This will not be displayed until call has been made to
|
|
32
|
-
* persistenceManager to retrieve stored layout state. If no stored state is returned, the
|
|
33
|
-
* default layout provided by user will be set as current state (and hence rendered). If no
|
|
34
|
-
* default layout has been provided by user, the sysem default will be used (simple PlaceHolder)
|
|
35
|
-
* If saved layout state has been returned, that will be set as current state (and rendered)
|
|
36
|
-
*
|
|
37
|
-
*/
|
|
38
|
-
export declare const WorkspaceProvider: ({ TabstripProps, children, layoutJSON, activeLayoutIndex, layoutPlaceholderJSON, showTabs, workspaceJSON: customWorkspaceJSON, }: WorkspaceProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
-
export declare const useWorkspace: () => {
|
|
40
|
-
workspaceJSON: LayoutJSON<{
|
|
41
|
-
[key: string]: any;
|
|
42
|
-
}> | LayoutJSON<{
|
|
43
|
-
[key: string]: any;
|
|
44
|
-
}>[];
|
|
45
|
-
layoutMetadata: LayoutMetadata[];
|
|
46
|
-
layoutPlaceholderJSON?: LayoutJSON;
|
|
47
|
-
getApplicationSettings: (key?: keyof ApplicationSettings) => ApplicationSettings | ApplicationSetting | undefined;
|
|
48
|
-
loadLayoutById: (id: string) => void;
|
|
49
|
-
saveApplicationSettings: (settings: ApplicationSettings | ApplicationSetting, key?: keyof ApplicationSettings) => void;
|
|
50
|
-
saveLayout: (n: LayoutMetadataDto) => void;
|
|
51
|
-
saveApplicationLayout: (layout: LayoutJSON) => void;
|
|
52
|
-
};
|
|
62
|
+
export declare const WorkspaceProvider: ({ activeLayoutIndex, children, componentRenderers, defaultWorkspace, layoutJSON, layoutPlaceholderJSON, persistenceService: serviceProp, settingsCodecs, showTabs, systemWorkspaces, TabstripProps, userId, workspaceJSON, }: WorkspaceProviderProps) => ReactElement;
|
|
63
|
+
export declare const useWorkspace: () => WorkspaceContextValue;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LayoutJSON } from "@vuu-ui/vuu-utils";
|
|
3
|
-
export
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
import { type LayoutJSON } from "@vuu-ui/vuu-utils";
|
|
3
|
+
export interface WorkspaceStackProps {
|
|
4
|
+
readonly showTabs?: boolean | "left" | "right";
|
|
5
|
+
readonly TabstripProps?: HTMLAttributes<HTMLDivElement>;
|
|
6
|
+
}
|
|
4
7
|
export declare const warningLayout: LayoutJSON;
|
|
5
8
|
export declare const loadingJSON: Readonly<LayoutJSON>;
|
|
6
|
-
export declare const defaultWorkspaceJSON: LayoutJSON
|
|
7
|
-
preserve: boolean;
|
|
8
|
-
}>;
|
|
9
|
+
export declare const defaultWorkspaceJSON: LayoutJSON;
|
|
9
10
|
export declare const getStackWorkspaceJSON: (activeLayoutIndex?: number) => LayoutJSON;
|
|
10
11
|
export declare const getWorkspaceWithLayoutJSON: (customWorkspaceJSON?: LayoutJSON | LayoutJSON[], layoutJSON?: LayoutJSON | LayoutJSON[], activeLayoutIndex?: number, stackProps?: WorkspaceStackProps) => LayoutJSON | LayoutJSON[];
|
|
@@ -3,3 +3,11 @@ export * from "./LayoutList";
|
|
|
3
3
|
export * from "./WorkspaceProvider";
|
|
4
4
|
export * from "./defaultWorkspaceJSON";
|
|
5
5
|
export * from "./useWorkspaceContextMenuItems";
|
|
6
|
+
export * from "./workspace-schemas";
|
|
7
|
+
export * from "./WorkspaceRepository";
|
|
8
|
+
export * from "./WorkspacePersistentState";
|
|
9
|
+
export * from "./WorkspaceController";
|
|
10
|
+
export * from "./workspace-component-registry";
|
|
11
|
+
export * from "./WorkspaceHost";
|
|
12
|
+
export * from "./WorkspaceStartPanel";
|
|
13
|
+
export * from "./shell-workspace-components";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MenuActionHandler, MenuBuilder } from "@vuu-ui/vuu-context-menu";
|
|
1
|
+
import type { MenuActionHandler, MenuBuilder } from "@vuu-ui/vuu-context-menu";
|
|
2
2
|
export declare const useWorkspaceContextMenuItems: () => {
|
|
3
3
|
buildMenuOptions: MenuBuilder;
|
|
4
4
|
handleMenuAction: MenuActionHandler;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GridComponentRendererRegistry, GridComponentSettingsRegistry, type GridComponentRenderer, type GridComponentSettingsCodec, type JsonValue } from "@
|
|
1
|
+
import { GridComponentRendererRegistry, GridComponentSettingsRegistry, type GridComponentRenderer, type GridComponentSettingsCodec, type JsonValue } from "@vuu-ui/grid-layout";
|
|
2
2
|
export interface WorkspaceComponentRegistration<T> {
|
|
3
3
|
readonly codec: GridComponentSettingsCodec<T>;
|
|
4
4
|
readonly render: GridComponentRenderer<T>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type GridLayoutDocument, type JsonValue } from "@
|
|
1
|
+
import { type GridLayoutDocument, type JsonValue } from "@vuu-ui/grid-layout";
|
|
2
2
|
export declare const WORKSPACE_SNAPSHOT_VERSION = 1;
|
|
3
3
|
export declare const APPLICATION_SESSION_VERSION = 1;
|
|
4
4
|
export declare const NAMED_WORKSPACE_DEFINITION_VERSION = 1;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import react from "react";
|
|
3
|
-
class FeatureErrorBoundary extends react.Component {
|
|
4
|
-
constructor(props){
|
|
5
|
-
super(props);
|
|
6
|
-
this.state = {
|
|
7
|
-
errorMessage: null
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
static getDerivedStateFromError(error) {
|
|
11
|
-
return {
|
|
12
|
-
errorMessage: error.message
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
componentDidCatch(error, errorInfo) {
|
|
16
|
-
console.log(`error creating component at ${this.props.url}`);
|
|
17
|
-
console.log(error, errorInfo);
|
|
18
|
-
}
|
|
19
|
-
render() {
|
|
20
|
-
if (this.state.errorMessage) return /*#__PURE__*/ jsxs(Fragment, {
|
|
21
|
-
children: [
|
|
22
|
-
/*#__PURE__*/ jsx("h1", {
|
|
23
|
-
children: "An error occured while creating component."
|
|
24
|
-
}),
|
|
25
|
-
/*#__PURE__*/ jsx("p", {
|
|
26
|
-
children: this.state.errorMessage
|
|
27
|
-
})
|
|
28
|
-
]
|
|
29
|
-
});
|
|
30
|
-
return this.props.children;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export { FeatureErrorBoundary };
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { VuuInput } from "@vuu-ui/vuu-ui-controls";
|
|
3
|
-
import { getFieldName } from "@vuu-ui/vuu-utils";
|
|
4
|
-
import { Dropdown, FormField, FormFieldLabel, Option, Switch, ToggleButton, ToggleButtonGroup } from "@salt-ds/core";
|
|
5
|
-
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
6
|
-
import { useWindow } from "@salt-ds/window";
|
|
7
|
-
import clsx from "clsx";
|
|
8
|
-
import { useCallback, useState } from "react";
|
|
9
|
-
import SettingsForm from "./SettingsForm.css";
|
|
10
|
-
const isOption = (value)=>"object" == typeof value && "label" in value && "label" in value;
|
|
11
|
-
const isBooleanProperty = (property)=>"boolean" === property.type;
|
|
12
|
-
const isStringOrNumber = (value)=>"string" == typeof value || "number" == typeof value;
|
|
13
|
-
const getValueAndLabel = (value)=>isOption(value) ? [
|
|
14
|
-
value.value,
|
|
15
|
-
value.label
|
|
16
|
-
] : [
|
|
17
|
-
value,
|
|
18
|
-
value
|
|
19
|
-
];
|
|
20
|
-
const defaultPropertyValue = {
|
|
21
|
-
boolean: false,
|
|
22
|
-
number: 0,
|
|
23
|
-
string: ""
|
|
24
|
-
};
|
|
25
|
-
const classBase = "vuuSettingsForm";
|
|
26
|
-
function FormControl({ property, changeHandler, selectHandler, inputHandler, currentValue = property.defaultValue ?? defaultPropertyValue[property.type] }) {
|
|
27
|
-
const [value, setValue] = useState(currentValue);
|
|
28
|
-
if (isBooleanProperty(property)) {
|
|
29
|
-
const checked = "boolean" == typeof currentValue ? currentValue : property.defaultValue ?? false;
|
|
30
|
-
return /*#__PURE__*/ jsx(Switch, {
|
|
31
|
-
checked: checked,
|
|
32
|
-
onChange: changeHandler
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
if (Array.isArray(property.values)) {
|
|
36
|
-
if (property.values.length <= 2) return /*#__PURE__*/ jsx(ToggleButtonGroup, {
|
|
37
|
-
value: currentValue,
|
|
38
|
-
onChange: changeHandler,
|
|
39
|
-
children: property.values.map((valueOrOption)=>{
|
|
40
|
-
const [value, label] = getValueAndLabel(valueOrOption);
|
|
41
|
-
return /*#__PURE__*/ jsx(ToggleButton, {
|
|
42
|
-
value: value,
|
|
43
|
-
children: label
|
|
44
|
-
}, value);
|
|
45
|
-
})
|
|
46
|
-
});
|
|
47
|
-
else if (property.values.length > 2) return /*#__PURE__*/ jsx(Dropdown, {
|
|
48
|
-
value: currentValue,
|
|
49
|
-
onSelectionChange: selectHandler,
|
|
50
|
-
children: property.values.map((valueOrOption)=>{
|
|
51
|
-
const [value, label] = getValueAndLabel(valueOrOption);
|
|
52
|
-
return /*#__PURE__*/ jsx(Option, {
|
|
53
|
-
value: label,
|
|
54
|
-
"data-field": property.name
|
|
55
|
-
}, value);
|
|
56
|
-
})
|
|
57
|
-
});
|
|
58
|
-
} else {
|
|
59
|
-
const valid = isValidInput(currentValue, property.type);
|
|
60
|
-
const errorMessage = getTooltipContent(property.type, valid);
|
|
61
|
-
return /*#__PURE__*/ jsx(VuuInput, {
|
|
62
|
-
errorMessage: errorMessage,
|
|
63
|
-
onCommit: inputHandler,
|
|
64
|
-
onChange: (e)=>setValue(e.target.value),
|
|
65
|
-
value: value
|
|
66
|
-
}, property.name);
|
|
67
|
-
}
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
const isValidInput = (value, type)=>{
|
|
71
|
-
if ("" === value) return;
|
|
72
|
-
if ("string" === type) return "success";
|
|
73
|
-
if ("number" === type) {
|
|
74
|
-
if (Number.isNaN(Number(value))) return "error";
|
|
75
|
-
return "success";
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
function getTooltipContent(type, valid) {
|
|
79
|
-
if ("error" !== valid) return;
|
|
80
|
-
if ("number" === type) return /*#__PURE__*/ jsx("p", {
|
|
81
|
-
children: "Field is expecting a number"
|
|
82
|
-
});
|
|
83
|
-
if ("string" === type) return /*#__PURE__*/ jsx("p", {
|
|
84
|
-
children: "Field is expecting a string"
|
|
85
|
-
});
|
|
86
|
-
return /*#__PURE__*/ jsx("p", {
|
|
87
|
-
children: "Please contact Admin for more information on expected type"
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
const SettingsForm_SettingsForm = ({ className, settingsSchema, settings, onSettingChanged, ...htmlAttributes })=>{
|
|
91
|
-
const targetWindow = useWindow();
|
|
92
|
-
useComponentCssInjection({
|
|
93
|
-
testId: "vuu-settings-form",
|
|
94
|
-
css: SettingsForm,
|
|
95
|
-
window: targetWindow
|
|
96
|
-
});
|
|
97
|
-
const changeHandler = useCallback((event)=>{
|
|
98
|
-
const fieldName = getFieldName(event.target);
|
|
99
|
-
const { checked, value } = event.target;
|
|
100
|
-
onSettingChanged(fieldName, checked ?? value);
|
|
101
|
-
}, [
|
|
102
|
-
onSettingChanged
|
|
103
|
-
]);
|
|
104
|
-
const selectHandler = useCallback((event, [selected])=>{
|
|
105
|
-
const fieldName = getFieldName(event.target);
|
|
106
|
-
onSettingChanged(fieldName, selected);
|
|
107
|
-
}, [
|
|
108
|
-
onSettingChanged
|
|
109
|
-
]);
|
|
110
|
-
const inputHandler = useCallback((event)=>{
|
|
111
|
-
const fieldName = getFieldName(event.target);
|
|
112
|
-
const { value } = event.target;
|
|
113
|
-
if (Number.isNaN(Number(value)) || "" == value) onSettingChanged(fieldName, value);
|
|
114
|
-
else {
|
|
115
|
-
const numValue = Number(value);
|
|
116
|
-
onSettingChanged(fieldName, numValue);
|
|
117
|
-
}
|
|
118
|
-
}, [
|
|
119
|
-
onSettingChanged
|
|
120
|
-
]);
|
|
121
|
-
return /*#__PURE__*/ jsx("div", {
|
|
122
|
-
...htmlAttributes,
|
|
123
|
-
className: clsx(classBase, className),
|
|
124
|
-
children: settingsSchema.properties.map((property)=>/*#__PURE__*/ jsxs(FormField, {
|
|
125
|
-
"data-field": property.name,
|
|
126
|
-
children: [
|
|
127
|
-
/*#__PURE__*/ jsx(FormFieldLabel, {
|
|
128
|
-
children: property.label
|
|
129
|
-
}),
|
|
130
|
-
FormControl({
|
|
131
|
-
property,
|
|
132
|
-
changeHandler,
|
|
133
|
-
selectHandler,
|
|
134
|
-
inputHandler,
|
|
135
|
-
currentValue: settings[property.name]
|
|
136
|
-
})
|
|
137
|
-
]
|
|
138
|
-
}, property.name))
|
|
139
|
-
});
|
|
140
|
-
};
|
|
141
|
-
export { FormControl, SettingsForm_SettingsForm as SettingsForm, isBooleanProperty, isOption, isStringOrNumber };
|