diff --git a/package-lock.json b/package-lock.json
index 1370bc927c..8e29bc9c7e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -27950,6 +27950,7 @@
"@deephaven/auth-plugins": "file:../auth-plugins",
"@deephaven/chart": "file:../chart",
"@deephaven/components": "file:../components",
+ "@deephaven/dashboard": "file:../dashboard",
"@deephaven/icons": "file:../icons",
"@deephaven/iris-grid": "file:../iris-grid",
"@deephaven/jsapi-bootstrap": "file:../jsapi-bootstrap",
@@ -30096,6 +30097,7 @@
"@deephaven/auth-plugins": "file:../auth-plugins",
"@deephaven/chart": "file:../chart",
"@deephaven/components": "file:../components",
+ "@deephaven/dashboard": "file:../dashboard",
"@deephaven/icons": "file:../icons",
"@deephaven/iris-grid": "file:../iris-grid",
"@deephaven/jsapi-bootstrap": "file:../jsapi-bootstrap",
diff --git a/packages/app-utils/package.json b/packages/app-utils/package.json
index 8a9892f93a..6204aa7c8b 100644
--- a/packages/app-utils/package.json
+++ b/packages/app-utils/package.json
@@ -32,6 +32,7 @@
"@deephaven/auth-plugins": "file:../auth-plugins",
"@deephaven/chart": "file:../chart",
"@deephaven/components": "file:../components",
+ "@deephaven/dashboard": "file:../dashboard",
"@deephaven/icons": "file:../icons",
"@deephaven/iris-grid": "file:../iris-grid",
"@deephaven/jsapi-bootstrap": "file:../jsapi-bootstrap",
diff --git a/packages/app-utils/src/plugins/remote-component.config.ts b/packages/app-utils/src/plugins/remote-component.config.ts
index 21dfe9f21f..36e8b7f7bb 100644
--- a/packages/app-utils/src/plugins/remote-component.config.ts
+++ b/packages/app-utils/src/plugins/remote-component.config.ts
@@ -12,6 +12,7 @@ import * as AdobeReactSpectrum from '@adobe/react-spectrum';
import * as DeephavenAuthPlugins from '@deephaven/auth-plugins';
import * as DeephavenChart from '@deephaven/chart';
import * as DeephavenComponents from '@deephaven/components';
+import * as DeephavenDashboard from '@deephaven/dashboard';
import * as DeephavenIcons from '@deephaven/icons';
import * as DeephavenIrisGrid from '@deephaven/iris-grid';
import * as DeephavenJsapiBootstrap from '@deephaven/jsapi-bootstrap';
@@ -30,6 +31,7 @@ export const resolve = {
'@deephaven/auth-plugins': DeephavenAuthPlugins,
'@deephaven/chart': DeephavenChart,
'@deephaven/components': DeephavenComponents,
+ '@deephaven/dashboard': DeephavenDashboard,
'@deephaven/icons': DeephavenIcons,
'@deephaven/iris-grid': DeephavenIrisGrid,
'@deephaven/jsapi-bootstrap': DeephavenJsapiBootstrap,
diff --git a/packages/app-utils/tsconfig.json b/packages/app-utils/tsconfig.json
index f5e6f5ea9b..5f14608102 100644
--- a/packages/app-utils/tsconfig.json
+++ b/packages/app-utils/tsconfig.json
@@ -10,6 +10,7 @@
{ "path": "../auth-plugins" },
{ "path": "../chart" },
{ "path": "../components" },
+ { "path": "../dashboard" },
{ "path": "../iris-grid" },
{ "path": "../jsapi-bootstrap" },
{ "path": "../jsapi-components" },
diff --git a/packages/dashboard/src/Dashboard.tsx b/packages/dashboard/src/Dashboard.tsx
index fac13fa14d..2daea39be2 100644
--- a/packages/dashboard/src/Dashboard.tsx
+++ b/packages/dashboard/src/Dashboard.tsx
@@ -20,6 +20,7 @@ import {
PanelProps,
} from './DashboardPlugin';
import './Dashboard.scss';
+import { LayoutManagerContext } from './layout';
const RESIZE_THROTTLE = 100;
@@ -136,19 +137,21 @@ export function Dashboard({
{isInitialized && layout && (
-
- {children}
-
+
+
+ {children}
+
+
)}
);
diff --git a/packages/dashboard/src/layout/LayoutManagerContext.ts b/packages/dashboard/src/layout/LayoutManagerContext.ts
new file mode 100644
index 0000000000..b1804dadfb
--- /dev/null
+++ b/packages/dashboard/src/layout/LayoutManagerContext.ts
@@ -0,0 +1,7 @@
+import React from 'react';
+import GoldenLayout from '@deephaven/golden-layout';
+
+export const LayoutManagerContext: React.Context =
+ React.createContext(undefined);
+
+export default LayoutManagerContext;
diff --git a/packages/dashboard/src/layout/index.ts b/packages/dashboard/src/layout/index.ts
index 93772356fb..c4971d1b2d 100644
--- a/packages/dashboard/src/layout/index.ts
+++ b/packages/dashboard/src/layout/index.ts
@@ -1,5 +1,7 @@
+export { default as LayoutManagerContext } from './LayoutManagerContext';
export { default as LayoutUtils } from './LayoutUtils';
export { default as GLPropTypes } from './GLPropTypes';
export { default as useDashboardPanel } from './useDashboardPanel';
+export { default as useLayoutManager } from './useLayoutManager';
export { default as useListener } from './useListener';
export { default as usePanelRegistration } from './usePanelRegistration';
diff --git a/packages/dashboard/src/layout/useLayoutManager.ts b/packages/dashboard/src/layout/useLayoutManager.ts
new file mode 100644
index 0000000000..764cc3ee5a
--- /dev/null
+++ b/packages/dashboard/src/layout/useLayoutManager.ts
@@ -0,0 +1,18 @@
+import { useContext } from 'react';
+import LayoutManager from '@deephaven/golden-layout';
+import LayoutManagerContext from './LayoutManagerContext';
+
+/**
+ * Retrieve the current LayoutManager from the context
+ */
+function useLayoutManager(): LayoutManager {
+ const layoutManager = useContext(LayoutManagerContext);
+ if (layoutManager == null) {
+ throw new Error(
+ 'LayoutManager not available, did you add a LayoutManagerContext.Provider to the tree?'
+ );
+ }
+ return layoutManager;
+}
+
+export default useLayoutManager;
diff --git a/packages/iris-grid/src/TreeTableViewportUpdater.tsx b/packages/iris-grid/src/TreeTableViewportUpdater.tsx
index 57c5e4701f..85568410f5 100644
--- a/packages/iris-grid/src/TreeTableViewportUpdater.tsx
+++ b/packages/iris-grid/src/TreeTableViewportUpdater.tsx
@@ -7,6 +7,7 @@ import type {
RemoverFn,
Sort,
Table,
+ ViewportData,
} from '@deephaven/jsapi-types';
import Log from '@deephaven/log';
@@ -22,7 +23,7 @@ interface TreeTableViewportUpdaterProps {
filters: FilterCondition[];
sorts: Sort[];
updateInterval: number;
- onViewportUpdate: EventListener;
+ onViewportUpdate: EventListener;
}
/**
diff --git a/packages/jsapi-components/src/useTableListener.ts b/packages/jsapi-components/src/useTableListener.ts
index ede2302c01..79c7e6f193 100644
--- a/packages/jsapi-components/src/useTableListener.ts
+++ b/packages/jsapi-components/src/useTableListener.ts
@@ -4,10 +4,10 @@ import Log from '@deephaven/log';
const log = Log.module('useTableListener');
-export const useTableListener = (
+export const useTableListener = (
eventEmitter: Evented | undefined | null,
eventName: string,
- callback: EventListener
+ callback: EventListener
): void =>
useEffect(
function initEventEmitter() {
diff --git a/packages/jsapi-types/src/dh.types.ts b/packages/jsapi-types/src/dh.types.ts
index 79f227870c..ab2318b9a8 100644
--- a/packages/jsapi-types/src/dh.types.ts
+++ b/packages/jsapi-types/src/dh.types.ts
@@ -83,20 +83,6 @@ export interface VariableDefinition {
id?: string;
}
-export interface JsWidget extends Evented {
- getDataAsBase64: () => string;
- getDataAsU8: () => Uint8Array;
- getDataAsString: () => string;
- exportedObjects: {
- fetch: () => Promise;
- }[];
- sendMessage: (
- message: string | ArrayBuffer | ArrayBufferView,
- references?: unknown[]
- ) => void;
- close: () => void;
-}
-
export interface LogItem {
micros: number;
logLevel: string;
@@ -212,14 +198,20 @@ export interface IdeSession extends Evented {
}
export interface Evented {
- addEventListener: (eventType: string, listener: EventListener) => RemoverFn;
+ addEventListener: (
+ eventType: string,
+ listener: EventListener
+ ) => RemoverFn;
nextEvent: (
eventType: string,
timeoutInMillis?: number
) => Promise;
hasListeners: (eventType: string) => boolean;
- removeEventListener: (eventType: string, listener: EventListener) => boolean;
+ removeEventListener: (
+ eventType: string,
+ listener: EventListener
+ ) => boolean;
}
export interface Plot {
@@ -245,8 +237,8 @@ export interface RemoverFn {
(): void;
}
-export interface EventListener {
- (event: CustomEvent): void;
+export interface EventListener {
+ (event: CustomEvent): void;
}
export interface FigureDescriptor {
@@ -359,18 +351,18 @@ export type WidgetExportedObject = {
close: () => void;
};
-export interface Widget {
+export interface Widget extends Evented {
readonly EVENT_MESSAGE: string;
- addEventListener: (
- type: string,
- listener: (event: unknown) => void
- ) => () => void;
getDataAsBase64: () => string;
getDataAsString: () => string;
getDataAsU8: () => Uint8Array;
- sendMessage: (message: string, references?: never[]) => void;
+ sendMessage: (
+ message: string | ArrayBuffer | ArrayBufferView,
+ references?: never[]
+ ) => void;
exportedObjects: WidgetExportedObject[];
+ close: () => void;
}
export interface FigureDataUpdatedEvent {
diff --git a/packages/plugin/src/PluginTypes.ts b/packages/plugin/src/PluginTypes.ts
index 5efae9bab5..eafcf755ed 100644
--- a/packages/plugin/src/PluginTypes.ts
+++ b/packages/plugin/src/PluginTypes.ts
@@ -1,5 +1,5 @@
import type { BaseThemeType } from '@deephaven/components';
-import { type JsWidget } from '@deephaven/jsapi-types';
+import { type Widget } from '@deephaven/jsapi-types';
import {
type EventEmitter,
type ItemContainer,
@@ -105,7 +105,7 @@ export function isDashboardPlugin(
}
export interface WidgetComponentProps {
- fetch: () => Promise;
+ fetch: () => Promise;
metadata?: {
id?: string;
name?: string;