@deephaven/dashboard 0.45.2-docs.8 → 0.46.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/dist/DashboardPlugin.d.ts +15 -6
- package/dist/DashboardPlugin.d.ts.map +1 -1
- package/dist/DashboardPlugin.js.map +1 -1
- package/dist/DashboardUtils.d.ts +2 -6
- package/dist/DashboardUtils.d.ts.map +1 -1
- package/dist/DashboardUtils.js.map +1 -1
- package/dist/PanelEvent.d.ts +16 -0
- package/dist/PanelEvent.d.ts.map +1 -1
- package/dist/PanelEvent.js.map +1 -1
- package/dist/PanelPlaceholder.d.ts +3 -2
- package/dist/PanelPlaceholder.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/layout/index.d.ts +2 -1
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +2 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/useDashboardPanel.d.ts +21 -0
- package/dist/layout/useDashboardPanel.d.ts.map +1 -0
- package/dist/layout/useDashboardPanel.js +83 -0
- package/dist/layout/useDashboardPanel.js.map +1 -0
- package/dist/layout/useListener.d.ts +10 -0
- package/dist/layout/useListener.d.ts.map +1 -0
- package/dist/layout/useListener.js +19 -0
- package/dist/layout/useListener.js.map +1 -0
- package/dist/layout/usePanelRegistration.d.ts +2 -2
- package/dist/layout/usePanelRegistration.d.ts.map +1 -1
- package/dist/layout/usePanelRegistration.js.map +1 -1
- package/package.json +10 -10
- package/dist/layout/hooks.d.ts +0 -7
- package/dist/layout/hooks.d.ts.map +0 -1
- package/dist/layout/hooks.js +0 -11
- package/dist/layout/hooks.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Component, ComponentType, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
|
|
2
2
|
import { ConnectedComponent } from 'react-redux';
|
|
3
3
|
import GoldenLayout from '@deephaven/golden-layout';
|
|
4
|
-
import type {
|
|
4
|
+
import type { GLPanelProps, ReactComponentConfig } from '@deephaven/golden-layout';
|
|
5
5
|
import PanelManager from './PanelManager';
|
|
6
6
|
/**
|
|
7
7
|
* Alias for the return type of React.forwardRef()
|
|
@@ -27,10 +27,19 @@ export type PanelFunctionComponentType<P, R> = ForwardRefComponentType<P, R> & P
|
|
|
27
27
|
export type WrappedComponentType<P extends PanelProps, C extends ComponentType<P>> = ConnectedComponent<C, P>;
|
|
28
28
|
export type PanelComponentType<P extends PanelProps = PanelProps, C extends ComponentType<P> = ComponentType<P>> = (ComponentType<P> | WrappedComponentType<P, C> | PanelFunctionComponentType<P, unknown>) & PanelStaticMetaData;
|
|
29
29
|
export declare function isWrappedComponent<P extends PanelProps, C extends ComponentType<P>>(type: PanelComponentType<P, C>): type is WrappedComponentType<P, C>;
|
|
30
|
-
export type
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
export type PanelMetadata = {
|
|
31
|
+
id?: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
type?: string;
|
|
33
34
|
};
|
|
35
|
+
export type PanelProps = GLPanelProps & {
|
|
36
|
+
metadata?: PanelMetadata;
|
|
37
|
+
};
|
|
38
|
+
export type DehydratedPanelProps = Omit<PanelProps, keyof GLPanelProps>;
|
|
39
|
+
export type DashboardPanelProps = PanelProps & {
|
|
40
|
+
localDashboardId: string;
|
|
41
|
+
};
|
|
42
|
+
export type DehydratedDashboardPanelProps = Omit<DashboardPanelProps, keyof GLPanelProps>;
|
|
34
43
|
export type PanelComponent<T extends PanelProps = PanelProps> = Component<T>;
|
|
35
44
|
export type PanelConfig = ReactComponentConfig & {
|
|
36
45
|
componentState?: Record<string, unknown> | null;
|
|
@@ -45,13 +54,13 @@ export interface DashboardPanelDefinition {
|
|
|
45
54
|
definition: ComponentType;
|
|
46
55
|
}
|
|
47
56
|
export type DeregisterComponentFunction = () => void;
|
|
48
|
-
export type PanelHydrateFunction<T =
|
|
57
|
+
export type PanelHydrateFunction<T extends DehydratedDashboardPanelProps = DehydratedDashboardPanelProps, R extends T = T> = (props: T, dashboardId: string) => R;
|
|
49
58
|
export type PanelDehydrateFunction = (config: PanelConfig, dashboardId: string) => PanelConfig | null;
|
|
50
59
|
export type DashboardPluginComponentProps = {
|
|
51
60
|
id: string;
|
|
52
61
|
layout: GoldenLayout;
|
|
53
62
|
panelManager: PanelManager;
|
|
54
|
-
registerComponent: <P extends
|
|
63
|
+
registerComponent: <P extends DashboardPanelProps, C extends ComponentType<P>>(name: string, ComponentType: PanelComponentType<P, C>, hydrate?: PanelHydrateFunction, dehydrate?: PanelDehydrateFunction) => DeregisterComponentFunction;
|
|
55
64
|
};
|
|
56
65
|
export interface DashboardPlugin {
|
|
57
66
|
panels?: DashboardPanelDefinition[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardPlugin.d.ts","sourceRoot":"","sources":["../src/DashboardPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,yBAAyB,EACzB,eAAe,EACf,aAAa,EACd,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"DashboardPlugin.d.ts","sourceRoot":"","sources":["../src/DashboardPlugin.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardPlugin.js","names":["GoldenLayout","PanelManager","isWrappedComponent","type","WrappedComponent","undefined","isDashboardPluginProps","props","id","layout","panelManager","registerComponent","assertIsDashboardPluginProps","Error"],"sources":["../src/DashboardPlugin.ts"],"sourcesContent":["import type {\n Component,\n ComponentType,\n ForwardRefExoticComponent,\n PropsWithoutRef,\n RefAttributes,\n} from 'react';\nimport { ConnectedComponent } from 'react-redux';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type {\n
|
|
1
|
+
{"version":3,"file":"DashboardPlugin.js","names":["GoldenLayout","PanelManager","isWrappedComponent","type","WrappedComponent","undefined","isDashboardPluginProps","props","id","layout","panelManager","registerComponent","assertIsDashboardPluginProps","Error"],"sources":["../src/DashboardPlugin.ts"],"sourcesContent":["import type {\n Component,\n ComponentType,\n ForwardRefExoticComponent,\n PropsWithoutRef,\n RefAttributes,\n} from 'react';\nimport { ConnectedComponent } from 'react-redux';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type {\n GLPanelProps,\n ReactComponentConfig,\n} from '@deephaven/golden-layout';\nimport PanelManager from './PanelManager';\n\n/**\n * Alias for the return type of React.forwardRef()\n */\nexport type ForwardRefComponentType<P, R> = ForwardRefExoticComponent<\n PropsWithoutRef<P> & RefAttributes<R>\n>;\n\n/**\n * Panel components can provide static props that provide meta data about the\n * panel.\n */\nexport interface PanelStaticMetaData {\n /**\n * Should be set to the same name as the component type.\n * @deprecated Use `displayName` instead.\n */\n COMPONENT?: string;\n\n /** Title of the panel. */\n TITLE?: string;\n}\n\n/**\n * Panels defined as functional components have to use React.forwardRef.\n */\nexport type PanelFunctionComponentType<P, R> = ForwardRefComponentType<P, R> &\n PanelStaticMetaData;\n\nexport type WrappedComponentType<\n P extends PanelProps,\n C extends ComponentType<P>,\n> = ConnectedComponent<C, P>;\n\nexport type PanelComponentType<\n P extends PanelProps = PanelProps,\n C extends ComponentType<P> = ComponentType<P>,\n> = (\n | ComponentType<P>\n | WrappedComponentType<P, C>\n | PanelFunctionComponentType<P, unknown>\n) &\n PanelStaticMetaData;\n\nexport function isWrappedComponent<\n P extends PanelProps,\n C extends ComponentType<P>,\n>(type: PanelComponentType<P, C>): type is WrappedComponentType<P, C> {\n return (type as WrappedComponentType<P, C>)?.WrappedComponent !== undefined;\n}\n\nexport type PanelMetadata = { id?: string; name?: string; type?: string };\n\nexport type PanelProps = GLPanelProps & {\n metadata?: PanelMetadata;\n};\n\nexport type DehydratedPanelProps = Omit<PanelProps, keyof GLPanelProps>;\n\nexport type DashboardPanelProps = PanelProps & { localDashboardId: string };\n\nexport type DehydratedDashboardPanelProps = Omit<\n DashboardPanelProps,\n keyof GLPanelProps\n>;\n\nexport type PanelComponent<T extends PanelProps = PanelProps> = Component<T>;\n\nexport type PanelConfig = ReactComponentConfig & {\n componentState?: Record<string, unknown> | null;\n};\n\nexport type DashboardConfig = {\n id: string;\n layout: GoldenLayout;\n panelManager: PanelManager;\n};\n\nexport interface DashboardPanelDefinition {\n name: string;\n definition: ComponentType;\n}\n\nexport type DeregisterComponentFunction = () => void;\n\nexport type PanelHydrateFunction<\n T extends DehydratedDashboardPanelProps = DehydratedDashboardPanelProps,\n R extends T = T,\n> = (props: T, dashboardId: string) => R;\n\nexport type PanelDehydrateFunction = (\n config: PanelConfig,\n dashboardId: string\n) => PanelConfig | null;\n\nexport type DashboardPluginComponentProps = {\n id: string;\n layout: GoldenLayout;\n panelManager: PanelManager;\n registerComponent: <\n P extends DashboardPanelProps,\n C extends ComponentType<P>,\n >(\n name: string,\n ComponentType: PanelComponentType<P, C>,\n hydrate?: PanelHydrateFunction,\n dehydrate?: PanelDehydrateFunction\n ) => DeregisterComponentFunction;\n};\n\nexport interface DashboardPlugin {\n panels?: DashboardPanelDefinition[];\n\n /** Hydrate the provided panel and props. Return the same object if no changes made. */\n hydrateComponent?: (name: string, props: PanelProps) => PanelProps;\n\n /** Dehydrate a component. Return the same object if no changes made, or `null` if the component should not be saved */\n dehydrateComponent?: (\n name: string,\n config: PanelConfig\n ) => PanelConfig | null;\n\n /** Called when the dashboard is initialized and layout is ready. */\n initialize?: (config: DashboardConfig) => void;\n\n /** Called when the dashboard is unintialized and layout is about to be destroyed */\n deinitialize?: (config: DashboardConfig) => void;\n}\n\n/**\n * Takes a partial DashboardPluginComponentProps and verifies all the dashboard component fields are filled in.\n * @param props The props to check\n * @returns True if the props are valid DashboardPluginComponentProps, false otherwise\n */\nexport function isDashboardPluginProps(\n props: Partial<DashboardPluginComponentProps>\n): props is DashboardPluginComponentProps {\n return (\n typeof props.id === 'string' &&\n props.layout instanceof GoldenLayout &&\n props.panelManager instanceof PanelManager &&\n typeof props.registerComponent === 'function'\n );\n}\n\nexport function assertIsDashboardPluginProps(\n props: Partial<DashboardPluginComponentProps>\n): asserts props is DashboardPluginComponentProps {\n if (!isDashboardPluginProps(props)) {\n throw new Error(\n `Expected dashboard plugin props, but instead received ${props}`\n );\n }\n}\n"],"mappings":"AAQA,OAAOA,YAAY,MAAM,0BAA0B;AAAC,OAK7CC,YAAY;AAEnB;AACA;AACA;AAyCA,OAAO,SAASC,kBAAkB,CAGhCC,IAA8B,EAAsC;EACpE,OAAO,CAACA,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAiCC,gBAAgB,MAAKC,SAAS;AAC7E;AAgFA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsB,CACpCC,KAA6C,EACL;EACxC,OACE,OAAOA,KAAK,CAACC,EAAE,KAAK,QAAQ,IAC5BD,KAAK,CAACE,MAAM,YAAYT,YAAY,IACpCO,KAAK,CAACG,YAAY,YAAYT,YAAY,IAC1C,OAAOM,KAAK,CAACI,iBAAiB,KAAK,UAAU;AAEjD;AAEA,OAAO,SAASC,4BAA4B,CAC1CL,KAA6C,EACG;EAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC,EAAE;IAClC,MAAM,IAAIM,KAAK,iEAC4CN,KAAK,EAC/D;EACH;AACF"}
|
package/dist/DashboardUtils.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type DashboardPanelProps = PanelProps & {
|
|
3
|
-
localDashboardId: string;
|
|
4
|
-
metadata?: Record<string, unknown>;
|
|
5
|
-
};
|
|
1
|
+
import { DehydratedDashboardPanelProps, PanelConfig } from './DashboardPlugin';
|
|
6
2
|
/**
|
|
7
3
|
* Dehydrate an existing panel to allow it to be serialized/saved.
|
|
8
4
|
* Just takes what's in the panels `metadata` in the props and `panelState` in
|
|
@@ -18,7 +14,7 @@ export declare function dehydrate(config: PanelConfig): PanelConfig | null;
|
|
|
18
14
|
* @param localDashboardId The local dashboard ID to hydrate the panel with
|
|
19
15
|
* @returns The hydrated panel props
|
|
20
16
|
*/
|
|
21
|
-
export declare function hydrate(props:
|
|
17
|
+
export declare function hydrate<T extends DehydratedDashboardPanelProps>(props: T, localDashboardId?: string): T;
|
|
22
18
|
declare const _default: {
|
|
23
19
|
dehydrate: typeof dehydrate;
|
|
24
20
|
hydrate: typeof hydrate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardUtils.d.ts","sourceRoot":"","sources":["../src/DashboardUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"DashboardUtils.d.ts","sourceRoot":"","sources":["../src/DashboardUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE/E;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAqBjE;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,6BAA6B,EAC7D,KAAK,EAAE,CAAC,EACR,gBAAgB,SAAK,GACpB,CAAC,CAMH;;;;;AAED,wBAGE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardUtils.js","names":["dehydrate","config","props","componentState","metadata","panelState","newProps","type","hydrate","localDashboardId"],"sources":["../src/DashboardUtils.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"DashboardUtils.js","names":["dehydrate","config","props","componentState","metadata","panelState","newProps","type","hydrate","localDashboardId"],"sources":["../src/DashboardUtils.ts"],"sourcesContent":["import { DehydratedDashboardPanelProps, PanelConfig } from './DashboardPlugin';\n\n/**\n * Dehydrate an existing panel to allow it to be serialized/saved.\n * Just takes what's in the panels `metadata` in the props and `panelState` in\n * the component state, assumes it's serializable, and saves it.\n * @param config The panel config to dehydrate\n * @returns The dehydrated PanelConfig\n */\nexport function dehydrate(config: PanelConfig): PanelConfig | null {\n const { props, componentState } = config;\n const { metadata } = props;\n let { panelState = null } = props;\n if (componentState) {\n ({ panelState } = componentState);\n }\n const newProps: Record<string, unknown> = {};\n if (metadata != null) {\n newProps.metadata = metadata;\n }\n if (panelState != null) {\n newProps.panelState = panelState;\n }\n\n return {\n ...config,\n componentState: null,\n props: newProps,\n type: 'react-component',\n };\n}\n\n/**\n * Default hydration function. Just applies the dashboard ID. When used with dehydrate above,\n * the panels state will be stored in `panelState` prop.\n * @param props Panel props to hydrate\n * @param localDashboardId The local dashboard ID to hydrate the panel with\n * @returns The hydrated panel props\n */\nexport function hydrate<T extends DehydratedDashboardPanelProps>(\n props: T,\n localDashboardId = ''\n): T {\n return {\n metadata: {},\n ...props,\n localDashboardId,\n };\n}\n\nexport default {\n dehydrate,\n hydrate,\n};\n"],"mappings":";;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,SAAS,CAACC,MAAmB,EAAsB;EACjE,IAAM;IAAEC,KAAK;IAAEC;EAAe,CAAC,GAAGF,MAAM;EACxC,IAAM;IAAEG;EAAS,CAAC,GAAGF,KAAK;EAC1B,IAAI;IAAEG,UAAU,GAAG;EAAK,CAAC,GAAGH,KAAK;EACjC,IAAIC,cAAc,EAAE;IAClB,CAAC;MAAEE;IAAW,CAAC,GAAGF,cAAc;EAClC;EACA,IAAMG,QAAiC,GAAG,CAAC,CAAC;EAC5C,IAAIF,QAAQ,IAAI,IAAI,EAAE;IACpBE,QAAQ,CAACF,QAAQ,GAAGA,QAAQ;EAC9B;EACA,IAAIC,UAAU,IAAI,IAAI,EAAE;IACtBC,QAAQ,CAACD,UAAU,GAAGA,UAAU;EAClC;EAEA,uCACKJ,MAAM;IACTE,cAAc,EAAE,IAAI;IACpBD,KAAK,EAAEI,QAAQ;IACfC,IAAI,EAAE;EAAiB;AAE3B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAO,CACrBN,KAAQ,EAEL;EAAA,IADHO,gBAAgB,uEAAG,EAAE;EAErB;IACEL,QAAQ,EAAE,CAAC;EAAC,GACTF,KAAK;IACRO;EAAgB;AAEpB;AAEA,eAAe;EACbT,SAAS;EACTQ;AACF,CAAC"}
|
package/dist/PanelEvent.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
import { DragEvent } from 'react';
|
|
2
|
+
export type WidgetDefinition = {
|
|
3
|
+
type: string;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use `title` instead.
|
|
6
|
+
*/
|
|
7
|
+
name?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
};
|
|
11
|
+
export type PanelOpenEventDetail = {
|
|
12
|
+
dragEvent?: DragEvent;
|
|
13
|
+
fetch?: () => Promise<unknown>;
|
|
14
|
+
panelId?: string;
|
|
15
|
+
widget: WidgetDefinition;
|
|
16
|
+
};
|
|
1
17
|
/**
|
|
2
18
|
* Events emitted by panels and to control panels
|
|
3
19
|
*/
|
package/dist/PanelEvent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelEvent.d.ts","sourceRoot":"","sources":["../src/PanelEvent.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;AACH,wBAsCG"}
|
|
1
|
+
{"version":3,"file":"PanelEvent.d.ts","sourceRoot":"","sources":["../src/PanelEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF;;GAEG;;;;;;;;;;;;;;;AACH,wBAsCG"}
|
package/dist/PanelEvent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelEvent.js","names":["Object","freeze","FOCUS","MOUNT","UNMOUNT","TITLE_CHANGED","REOPEN","DELETE","CLONED","CLOSED","OPEN","CLOSE","DRAGGING","DROPPED"],"sources":["../src/PanelEvent.ts"],"sourcesContent":["/**\n * Events emitted by panels and to control panels\n */\nexport default Object.freeze({\n // Panel has received focus\n FOCUS: 'PanelEvent.FOCUS',\n\n // Panel has been mounted\n MOUNT: 'PanelEvent.MOUNT',\n\n // Panel has been unmounted\n UNMOUNT: 'PanelEvent.UNMOUNT',\n\n // The title of the panel has changed\n TITLE_CHANGED: 'PanelEvent.TITLE_CHANGED',\n\n // Panel was re-opened from a dehydrated state\n REOPEN: 'PanelEvent.REOPEN',\n\n // Panel was deleted\n DELETE: 'PanelEvent.DELETE',\n\n // Panel was cloned/copied\n CLONED: 'PanelEvent.CLONED',\n\n // Panel was closed\n CLOSED: 'PanelEvent.CLOSED',\n\n // Event to open a new panel\n // Plugins will need to register to open based on this event.\n // Multiple plugins could open panels for the same event if desired.\n OPEN: 'PanelEvent.OPEN',\n\n // Event to close a panel that's currently open\n CLOSE: 'PanelEvent.CLOSE',\n\n // Panel is being dragged\n DRAGGING: 'PanelEvent.DRAGGING',\n\n // Panel is dropped\n DROPPED: 'PanelEvent.DROPPED',\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PanelEvent.js","names":["Object","freeze","FOCUS","MOUNT","UNMOUNT","TITLE_CHANGED","REOPEN","DELETE","CLONED","CLOSED","OPEN","CLOSE","DRAGGING","DROPPED"],"sources":["../src/PanelEvent.ts"],"sourcesContent":["import { DragEvent } from 'react';\n\nexport type WidgetDefinition = {\n type: string;\n\n /**\n * @deprecated Use `title` instead.\n */\n name?: string;\n\n title?: string;\n\n id?: string;\n};\n\nexport type PanelOpenEventDetail = {\n dragEvent?: DragEvent;\n fetch?: () => Promise<unknown>;\n panelId?: string;\n widget: WidgetDefinition;\n};\n\n/**\n * Events emitted by panels and to control panels\n */\nexport default Object.freeze({\n // Panel has received focus\n FOCUS: 'PanelEvent.FOCUS',\n\n // Panel has been mounted\n MOUNT: 'PanelEvent.MOUNT',\n\n // Panel has been unmounted\n UNMOUNT: 'PanelEvent.UNMOUNT',\n\n // The title of the panel has changed\n TITLE_CHANGED: 'PanelEvent.TITLE_CHANGED',\n\n // Panel was re-opened from a dehydrated state\n REOPEN: 'PanelEvent.REOPEN',\n\n // Panel was deleted\n DELETE: 'PanelEvent.DELETE',\n\n // Panel was cloned/copied\n CLONED: 'PanelEvent.CLONED',\n\n // Panel was closed\n CLOSED: 'PanelEvent.CLOSED',\n\n // Event to open a new panel\n // Plugins will need to register to open based on this event.\n // Multiple plugins could open panels for the same event if desired.\n OPEN: 'PanelEvent.OPEN',\n\n // Event to close a panel that's currently open\n CLOSE: 'PanelEvent.CLOSE',\n\n // Panel is being dragged\n DRAGGING: 'PanelEvent.DRAGGING',\n\n // Panel is dropped\n DROPPED: 'PanelEvent.DROPPED',\n});\n"],"mappings":"AAsBA;AACA;AACA;AACA,eAAeA,MAAM,CAACC,MAAM,CAAC;EAC3B;EACAC,KAAK,EAAE,kBAAkB;EAEzB;EACAC,KAAK,EAAE,kBAAkB;EAEzB;EACAC,OAAO,EAAE,oBAAoB;EAE7B;EACAC,aAAa,EAAE,0BAA0B;EAEzC;EACAC,MAAM,EAAE,mBAAmB;EAE3B;EACAC,MAAM,EAAE,mBAAmB;EAE3B;EACAC,MAAM,EAAE,mBAAmB;EAE3B;EACAC,MAAM,EAAE,mBAAmB;EAE3B;EACA;EACA;EACAC,IAAI,EAAE,iBAAiB;EAEvB;EACAC,KAAK,EAAE,kBAAkB;EAEzB;EACAC,QAAQ,EAAE,qBAAqB;EAE/B;EACAC,OAAO,EAAE;AACX,CAAC,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './PanelPlaceholder.scss';
|
|
3
|
-
import { PanelProps } from './DashboardPlugin';
|
|
4
3
|
/**
|
|
5
4
|
* Displays a placeholder for unregistered panel types.
|
|
6
5
|
*/
|
|
7
|
-
declare const PanelPlaceholder: React.ForwardRefExoticComponent<
|
|
6
|
+
declare const PanelPlaceholder: React.ForwardRefExoticComponent<import("@deephaven/golden-layout").GLPanelProps & {
|
|
7
|
+
metadata?: import("./DashboardPlugin").PanelMetadata | undefined;
|
|
8
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
8
9
|
export default PanelPlaceholder;
|
|
9
10
|
//# sourceMappingURL=PanelPlaceholder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelPlaceholder.d.ts","sourceRoot":"","sources":["../src/PanelPlaceholder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"PanelPlaceholder.d.ts","sourceRoot":"","sources":["../src/PanelPlaceholder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,yBAAyB,CAAC;AAIjC;;GAEG;AACH,QAAA,MAAM,gBAAgB;;wCASrB,CAAC;AAIF,eAAe,gBAAgB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { default as DashboardUtils } from './DashboardUtils';
|
|
|
9
9
|
export * from './layout';
|
|
10
10
|
export * from './redux';
|
|
11
11
|
export * from './PanelManager';
|
|
12
|
+
export * from './PanelEvent';
|
|
12
13
|
export { default as PanelEvent } from './PanelEvent';
|
|
13
14
|
export { default as PanelErrorBoundary } from './PanelErrorBoundary';
|
|
14
15
|
export { default as PanelManager } from './PanelManager';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,eAAe,SAAS,CAAC;AAEzB,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,eAAe,SAAS,CAAC;AAEzB,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export { default as DashboardUtils } from "./DashboardUtils.js";
|
|
|
9
9
|
export * from "./layout/index.js";
|
|
10
10
|
export * from "./redux/index.js";
|
|
11
11
|
export * from "./PanelManager.js";
|
|
12
|
+
export * from "./PanelEvent.js";
|
|
12
13
|
export { default as PanelEvent } from "./PanelEvent.js";
|
|
13
14
|
export { default as PanelErrorBoundary } from "./PanelErrorBoundary.js";
|
|
14
15
|
export { default as PanelManager } from "./PanelManager.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Dashboard","default","DashboardUtils","PanelEvent","PanelErrorBoundary","PanelManager"],"sources":["../src/index.ts"],"sourcesContent":["import Dashboard from './Dashboard';\n\nexport default Dashboard;\n\nexport * from './Dashboard';\nexport * from './DashboardConstants';\nexport * from './DashboardPlugin';\nexport * from './DashboardLayout';\nexport * from './DashboardUtils';\nexport { default as DashboardUtils } from './DashboardUtils';\nexport * from './layout';\nexport * from './redux';\nexport * from './PanelManager';\nexport { default as PanelEvent } from './PanelEvent';\nexport { default as PanelErrorBoundary } from './PanelErrorBoundary';\nexport { default as PanelManager } from './PanelManager';\n"],"mappings":"OAAOA,SAAS;AAEhB,eAAeA,SAAS;AAAC;AAAA;AAAA;AAAA;AAAA;AAAA,SAOhBC,OAAO,IAAIC,cAAc;AAAA;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["Dashboard","default","DashboardUtils","PanelEvent","PanelErrorBoundary","PanelManager"],"sources":["../src/index.ts"],"sourcesContent":["import Dashboard from './Dashboard';\n\nexport default Dashboard;\n\nexport * from './Dashboard';\nexport * from './DashboardConstants';\nexport * from './DashboardPlugin';\nexport * from './DashboardLayout';\nexport * from './DashboardUtils';\nexport { default as DashboardUtils } from './DashboardUtils';\nexport * from './layout';\nexport * from './redux';\nexport * from './PanelManager';\nexport * from './PanelEvent';\nexport { default as PanelEvent } from './PanelEvent';\nexport { default as PanelErrorBoundary } from './PanelErrorBoundary';\nexport { default as PanelManager } from './PanelManager';\n"],"mappings":"OAAOA,SAAS;AAEhB,eAAeA,SAAS;AAAC;AAAA;AAAA;AAAA;AAAA;AAAA,SAOhBC,OAAO,IAAIC,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA,SAKzBD,OAAO,IAAIE,UAAU;AAAA,SACrBF,OAAO,IAAIG,kBAAkB;AAAA,SAC7BH,OAAO,IAAII,YAAY"}
|
package/dist/layout/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as LayoutUtils } from './LayoutUtils';
|
|
2
2
|
export { default as GLPropTypes } from './GLPropTypes';
|
|
3
|
-
export
|
|
3
|
+
export { default as useDashboardPanel } from './useDashboardPanel';
|
|
4
|
+
export { default as useListener } from './useListener';
|
|
4
5
|
export { default as usePanelRegistration } from './usePanelRegistration';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/layout/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as LayoutUtils } from "./LayoutUtils.js";
|
|
2
2
|
export { default as GLPropTypes } from "./GLPropTypes.js";
|
|
3
|
-
export
|
|
3
|
+
export { default as useDashboardPanel } from "./useDashboardPanel.js";
|
|
4
|
+
export { default as useListener } from "./useListener.js";
|
|
4
5
|
export { default as usePanelRegistration } from "./usePanelRegistration.js";
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
package/dist/layout/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","LayoutUtils","GLPropTypes","usePanelRegistration"],"sources":["../../src/layout/index.ts"],"sourcesContent":["export { default as LayoutUtils } from './LayoutUtils';\nexport { default as GLPropTypes } from './GLPropTypes';\
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","LayoutUtils","GLPropTypes","useDashboardPanel","useListener","usePanelRegistration"],"sources":["../../src/layout/index.ts"],"sourcesContent":["export { default as LayoutUtils } from './LayoutUtils';\nexport { default as GLPropTypes } from './GLPropTypes';\nexport { default as useDashboardPanel } from './useDashboardPanel';\nexport { default as useListener } from './useListener';\nexport { default as usePanelRegistration } from './usePanelRegistration';\n"],"mappings":"SAASA,OAAO,IAAIC,WAAW;AAAA,SACtBD,OAAO,IAAIE,WAAW;AAAA,SACtBF,OAAO,IAAIG,iBAAiB;AAAA,SAC5BH,OAAO,IAAII,WAAW;AAAA,SACtBJ,OAAO,IAAIK,oBAAoB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { DashboardPanelProps, DashboardPluginComponentProps, PanelComponentType, PanelDehydrateFunction, PanelHydrateFunction } from '../DashboardPlugin';
|
|
3
|
+
/**
|
|
4
|
+
* Register a panel that will be opened when one of the `supportedTypes` objects is triggered.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useDashboardPanel<P extends DashboardPanelProps, C extends ComponentType<P>>({ dashboardProps, componentName, component, supportedTypes, hydrate, dehydrate, }: {
|
|
7
|
+
/** Props from the dashboard this panel is being registered in */
|
|
8
|
+
dashboardProps: DashboardPluginComponentProps;
|
|
9
|
+
/** Name of the component to register */
|
|
10
|
+
componentName: string;
|
|
11
|
+
/** Component type to register */
|
|
12
|
+
component: PanelComponentType<P, C>;
|
|
13
|
+
/** Names of the supported variable types this panel opens for */
|
|
14
|
+
supportedTypes: string | string[];
|
|
15
|
+
/** Custom hydration function to call when opening a panel */
|
|
16
|
+
hydrate?: PanelHydrateFunction;
|
|
17
|
+
/** Custom dehydration function to call when saving a panel's state to the layout */
|
|
18
|
+
dehydrate?: PanelDehydrateFunction;
|
|
19
|
+
}): void;
|
|
20
|
+
export default useDashboardPanel;
|
|
21
|
+
//# sourceMappingURL=useDashboardPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDashboardPanel.d.ts","sourceRoot":"","sources":["../../src/layout/useDashboardPanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAe,MAAM,OAAO,CAAC;AAGnD,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAE7B,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAM5B;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,CAAC,SAAS,mBAAmB,EAC7B,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,EAC1B,EACA,cAAc,EACd,aAAa,EACb,SAAS,EACT,cAAc,EACd,OAAO,EACP,SAAS,GACV,EAAE;IACD,iEAAiE;IACjE,cAAc,EAAE,6BAA6B,CAAC;IAE9C,wCAAwC;IACxC,aAAa,EAAE,MAAM,CAAC;IAEtB,iCAAiC;IACjC,SAAS,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEpC,iEAAiE;IACjE,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAElC,6DAA6D;IAC7D,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAE/B,oFAAoF;IACpF,SAAS,CAAC,EAAE,sBAAsB,CAAC;CACpC,QAmDA;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import shortid from 'shortid';
|
|
3
|
+
import PanelEvent from "../PanelEvent.js";
|
|
4
|
+
import LayoutUtils from "./LayoutUtils.js";
|
|
5
|
+
import useListener from "./useListener.js";
|
|
6
|
+
import usePanelRegistration from "./usePanelRegistration.js";
|
|
7
|
+
/**
|
|
8
|
+
* Register a panel that will be opened when one of the `supportedTypes` objects is triggered.
|
|
9
|
+
*/
|
|
10
|
+
export function useDashboardPanel(_ref) {
|
|
11
|
+
var {
|
|
12
|
+
dashboardProps,
|
|
13
|
+
componentName,
|
|
14
|
+
component,
|
|
15
|
+
supportedTypes,
|
|
16
|
+
hydrate,
|
|
17
|
+
dehydrate
|
|
18
|
+
} = _ref;
|
|
19
|
+
var {
|
|
20
|
+
id,
|
|
21
|
+
layout,
|
|
22
|
+
registerComponent
|
|
23
|
+
} = dashboardProps;
|
|
24
|
+
var handlePanelOpen = useCallback(_ref2 => {
|
|
25
|
+
var _widget$title;
|
|
26
|
+
var {
|
|
27
|
+
dragEvent,
|
|
28
|
+
fetch,
|
|
29
|
+
panelId = shortid.generate(),
|
|
30
|
+
widget
|
|
31
|
+
} = _ref2;
|
|
32
|
+
var {
|
|
33
|
+
id: widgetId,
|
|
34
|
+
type
|
|
35
|
+
} = widget;
|
|
36
|
+
var name = (_widget$title = widget.title) !== null && _widget$title !== void 0 ? _widget$title : widget.name;
|
|
37
|
+
var isSupportedType = Array.isArray(supportedTypes) && supportedTypes.includes(type) || type === supportedTypes;
|
|
38
|
+
if (!isSupportedType) {
|
|
39
|
+
// Only want to listen for your custom variable types
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
var metadata = {
|
|
43
|
+
id: widgetId,
|
|
44
|
+
name,
|
|
45
|
+
type
|
|
46
|
+
};
|
|
47
|
+
var props = {
|
|
48
|
+
localDashboardId: id,
|
|
49
|
+
metadata,
|
|
50
|
+
fetch
|
|
51
|
+
};
|
|
52
|
+
if (hydrate != null) {
|
|
53
|
+
props = hydrate(props, id);
|
|
54
|
+
}
|
|
55
|
+
var config = {
|
|
56
|
+
type: 'react-component',
|
|
57
|
+
component: componentName,
|
|
58
|
+
props,
|
|
59
|
+
title: name,
|
|
60
|
+
id: panelId
|
|
61
|
+
};
|
|
62
|
+
var {
|
|
63
|
+
root
|
|
64
|
+
} = layout;
|
|
65
|
+
LayoutUtils.openComponent({
|
|
66
|
+
root,
|
|
67
|
+
config,
|
|
68
|
+
dragEvent
|
|
69
|
+
});
|
|
70
|
+
}, [componentName, hydrate, id, layout, supportedTypes]);
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Register our custom component type so the layout know hows to open it
|
|
74
|
+
*/
|
|
75
|
+
usePanelRegistration(registerComponent, component, hydrate, dehydrate);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Listen for panel open events so we know when to open a panel
|
|
79
|
+
*/
|
|
80
|
+
useListener(layout.eventHub, PanelEvent.OPEN, handlePanelOpen);
|
|
81
|
+
}
|
|
82
|
+
export default useDashboardPanel;
|
|
83
|
+
//# sourceMappingURL=useDashboardPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDashboardPanel.js","names":["useCallback","shortid","PanelEvent","LayoutUtils","useListener","usePanelRegistration","useDashboardPanel","dashboardProps","componentName","component","supportedTypes","hydrate","dehydrate","id","layout","registerComponent","handlePanelOpen","dragEvent","fetch","panelId","generate","widget","widgetId","type","name","title","isSupportedType","Array","isArray","includes","metadata","props","localDashboardId","config","root","openComponent","eventHub","OPEN"],"sources":["../../src/layout/useDashboardPanel.ts"],"sourcesContent":["import { ComponentType, useCallback } from 'react';\nimport type { ReactComponentConfig } from '@deephaven/golden-layout';\nimport shortid from 'shortid';\nimport {\n DashboardPanelProps,\n DashboardPluginComponentProps,\n DehydratedDashboardPanelProps,\n PanelComponentType,\n PanelDehydrateFunction,\n PanelHydrateFunction,\n} from '../DashboardPlugin';\nimport PanelEvent, { PanelOpenEventDetail } from '../PanelEvent';\nimport LayoutUtils from './LayoutUtils';\nimport useListener from './useListener';\nimport usePanelRegistration from './usePanelRegistration';\n\n/**\n * Register a panel that will be opened when one of the `supportedTypes` objects is triggered.\n */\nexport function useDashboardPanel<\n P extends DashboardPanelProps,\n C extends ComponentType<P>,\n>({\n dashboardProps,\n componentName,\n component,\n supportedTypes,\n hydrate,\n dehydrate,\n}: {\n /** Props from the dashboard this panel is being registered in */\n dashboardProps: DashboardPluginComponentProps;\n\n /** Name of the component to register */\n componentName: string;\n\n /** Component type to register */\n component: PanelComponentType<P, C>;\n\n /** Names of the supported variable types this panel opens for */\n supportedTypes: string | string[];\n\n /** Custom hydration function to call when opening a panel */\n hydrate?: PanelHydrateFunction;\n\n /** Custom dehydration function to call when saving a panel's state to the layout */\n dehydrate?: PanelDehydrateFunction;\n}) {\n const { id, layout, registerComponent } = dashboardProps;\n\n const handlePanelOpen = useCallback(\n ({\n dragEvent,\n fetch,\n panelId = shortid.generate(),\n widget,\n }: PanelOpenEventDetail) => {\n const { id: widgetId, type } = widget;\n const name = widget.title ?? widget.name;\n const isSupportedType =\n (Array.isArray(supportedTypes) && supportedTypes.includes(type)) ||\n type === supportedTypes;\n if (!isSupportedType) {\n // Only want to listen for your custom variable types\n return;\n }\n const metadata = { id: widgetId, name, type };\n let props: DehydratedDashboardPanelProps & { fetch?: typeof fetch } = {\n localDashboardId: id,\n metadata,\n fetch,\n };\n if (hydrate != null) {\n props = hydrate(props, id);\n }\n const config: ReactComponentConfig = {\n type: 'react-component',\n component: componentName,\n props,\n title: name,\n id: panelId,\n };\n\n const { root } = layout;\n LayoutUtils.openComponent({ root, config, dragEvent });\n },\n [componentName, hydrate, id, layout, supportedTypes]\n );\n\n /**\n * Register our custom component type so the layout know hows to open it\n */\n usePanelRegistration(registerComponent, component, hydrate, dehydrate);\n\n /**\n * Listen for panel open events so we know when to open a panel\n */\n useListener(layout.eventHub, PanelEvent.OPEN, handlePanelOpen);\n}\n\nexport default useDashboardPanel;\n"],"mappings":"AAAA,SAAwBA,WAAW,QAAQ,OAAO;AAElD,OAAOC,OAAO,MAAM,SAAS;AAAC,OASvBC,UAAU;AAAA,OACVC,WAAW;AAAA,OACXC,WAAW;AAAA,OACXC,oBAAoB;AAE3B;AACA;AACA;AACA,OAAO,SAASC,iBAAiB,OA4B9B;EAAA,IAzBD;IACAC,cAAc;IACdC,aAAa;IACbC,SAAS;IACTC,cAAc;IACdC,OAAO;IACPC;EAmBF,CAAC;EACC,IAAM;IAAEC,EAAE;IAAEC,MAAM;IAAEC;EAAkB,CAAC,GAAGR,cAAc;EAExD,IAAMS,eAAe,GAAGhB,WAAW,CACjC,SAK4B;IAAA;IAAA,IAL3B;MACCiB,SAAS;MACTC,KAAK;MACLC,OAAO,GAAGlB,OAAO,CAACmB,QAAQ,EAAE;MAC5BC;IACoB,CAAC;IACrB,IAAM;MAAER,EAAE,EAAES,QAAQ;MAAEC;IAAK,CAAC,GAAGF,MAAM;IACrC,IAAMG,IAAI,oBAAGH,MAAM,CAACI,KAAK,yDAAIJ,MAAM,CAACG,IAAI;IACxC,IAAME,eAAe,GAClBC,KAAK,CAACC,OAAO,CAAClB,cAAc,CAAC,IAAIA,cAAc,CAACmB,QAAQ,CAACN,IAAI,CAAC,IAC/DA,IAAI,KAAKb,cAAc;IACzB,IAAI,CAACgB,eAAe,EAAE;MACpB;MACA;IACF;IACA,IAAMI,QAAQ,GAAG;MAAEjB,EAAE,EAAES,QAAQ;MAAEE,IAAI;MAAED;IAAK,CAAC;IAC7C,IAAIQ,KAA+D,GAAG;MACpEC,gBAAgB,EAAEnB,EAAE;MACpBiB,QAAQ;MACRZ;IACF,CAAC;IACD,IAAIP,OAAO,IAAI,IAAI,EAAE;MACnBoB,KAAK,GAAGpB,OAAO,CAACoB,KAAK,EAAElB,EAAE,CAAC;IAC5B;IACA,IAAMoB,MAA4B,GAAG;MACnCV,IAAI,EAAE,iBAAiB;MACvBd,SAAS,EAAED,aAAa;MACxBuB,KAAK;MACLN,KAAK,EAAED,IAAI;MACXX,EAAE,EAAEM;IACN,CAAC;IAED,IAAM;MAAEe;IAAK,CAAC,GAAGpB,MAAM;IACvBX,WAAW,CAACgC,aAAa,CAAC;MAAED,IAAI;MAAED,MAAM;MAAEhB;IAAU,CAAC,CAAC;EACxD,CAAC,EACD,CAACT,aAAa,EAAEG,OAAO,EAAEE,EAAE,EAAEC,MAAM,EAAEJ,cAAc,CAAC,CACrD;;EAED;AACF;AACA;EACEL,oBAAoB,CAACU,iBAAiB,EAAEN,SAAS,EAAEE,OAAO,EAAEC,SAAS,CAAC;;EAEtE;AACF;AACA;EACER,WAAW,CAACU,MAAM,CAACsB,QAAQ,EAAElC,UAAU,CAACmC,IAAI,EAAErB,eAAe,CAAC;AAChE;AAEA,eAAeV,iBAAiB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EventEmitter } from '@deephaven/golden-layout';
|
|
2
|
+
/**
|
|
3
|
+
* Listen for a specific event on an EventEmitter
|
|
4
|
+
* @param eventEmitter EventEmitter to listen to
|
|
5
|
+
* @param eventName Name of the event to listen to
|
|
6
|
+
* @param callback Callback to call when the event is triggered
|
|
7
|
+
*/
|
|
8
|
+
export declare function useListener(eventEmitter: EventEmitter, eventName: string, callback: Function): void;
|
|
9
|
+
export default useListener;
|
|
10
|
+
//# sourceMappingURL=useListener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useListener.d.ts","sourceRoot":"","sources":["../../src/layout/useListener.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,MAAM,EAEjB,QAAQ,EAAE,QAAQ,GACjB,IAAI,CAWN;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Listen for a specific event on an EventEmitter
|
|
4
|
+
* @param eventEmitter EventEmitter to listen to
|
|
5
|
+
* @param eventName Name of the event to listen to
|
|
6
|
+
* @param callback Callback to call when the event is triggered
|
|
7
|
+
*/
|
|
8
|
+
export function useListener(eventEmitter, eventName,
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
10
|
+
callback) {
|
|
11
|
+
useEffect(function initEventEmitter() {
|
|
12
|
+
eventEmitter.on(eventName, callback);
|
|
13
|
+
return () => {
|
|
14
|
+
eventEmitter.off(eventName, callback);
|
|
15
|
+
};
|
|
16
|
+
}, [eventEmitter, eventName, callback]);
|
|
17
|
+
}
|
|
18
|
+
export default useListener;
|
|
19
|
+
//# sourceMappingURL=useListener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useListener.js","names":["useEffect","useListener","eventEmitter","eventName","callback","initEventEmitter","on","off"],"sources":["../../src/layout/useListener.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { EventEmitter } from '@deephaven/golden-layout';\n\n/**\n * Listen for a specific event on an EventEmitter\n * @param eventEmitter EventEmitter to listen to\n * @param eventName Name of the event to listen to\n * @param callback Callback to call when the event is triggered\n */\nexport function useListener(\n eventEmitter: EventEmitter,\n eventName: string,\n // eslint-disable-next-line @typescript-eslint/ban-types\n callback: Function\n): void {\n useEffect(\n function initEventEmitter() {\n eventEmitter.on(eventName, callback);\n\n return () => {\n eventEmitter.off(eventName, callback);\n };\n },\n [eventEmitter, eventName, callback]\n );\n}\n\nexport default useListener;\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AAGjC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAW,CACzBC,YAA0B,EAC1BC,SAAiB;AACjB;AACAC,QAAkB,EACZ;EACNJ,SAAS,CACP,SAASK,gBAAgB,GAAG;IAC1BH,YAAY,CAACI,EAAE,CAACH,SAAS,EAAEC,QAAQ,CAAC;IAEpC,OAAO,MAAM;MACXF,YAAY,CAACK,GAAG,CAACJ,SAAS,EAAEC,QAAQ,CAAC;IACvC,CAAC;EACH,CAAC,EACD,CAACF,YAAY,EAAEC,SAAS,EAAEC,QAAQ,CAAC,CACpC;AACH;AAEA,eAAeH,WAAW"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DashboardPluginComponentProps, PanelComponentType, PanelDehydrateFunction, PanelHydrateFunction
|
|
2
|
+
import { DashboardPanelProps, DashboardPluginComponentProps, PanelComponentType, PanelDehydrateFunction, PanelHydrateFunction } from '../DashboardPlugin';
|
|
3
3
|
/**
|
|
4
4
|
* Registers a given panel component. Also runs a `useEffect` that will
|
|
5
5
|
* automatically de-register then panel on unmount.
|
|
@@ -8,5 +8,5 @@ import { DashboardPluginComponentProps, PanelComponentType, PanelDehydrateFuncti
|
|
|
8
8
|
* @param hydrate
|
|
9
9
|
* @param dehydrate
|
|
10
10
|
*/
|
|
11
|
-
export default function usePanelRegistration<P extends
|
|
11
|
+
export default function usePanelRegistration<P extends DashboardPanelProps, C extends React.ComponentType<P>>(registerComponent: DashboardPluginComponentProps['registerComponent'], ComponentType: PanelComponentType<P, C>, hydrate?: PanelHydrateFunction, dehydrate?: PanelDehydrateFunction): void;
|
|
12
12
|
//# sourceMappingURL=usePanelRegistration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePanelRegistration.d.ts","sourceRoot":"","sources":["../../src/layout/usePanelRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,6BAA6B,EAC7B,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"usePanelRegistration.d.ts","sourceRoot":"","sources":["../../src/layout/usePanelRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,CAAC,SAAS,mBAAmB,EAC7B,CAAC,SAAS,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EAEhC,iBAAiB,EAAE,6BAA6B,CAAC,mBAAmB,CAAC,EACrE,aAAa,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EACvC,OAAO,CAAC,EAAE,oBAAoB,EAC9B,SAAS,CAAC,EAAE,sBAAsB,QAsBnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePanelRegistration.js","names":["React","usePanelRegistration","registerComponent","ComponentType","hydrate","dehydrate","name","COMPONENT","displayName","Error","useEffect","deregister"],"sources":["../../src/layout/usePanelRegistration.ts"],"sourcesContent":["import React from 'react';\nimport {\n DashboardPluginComponentProps,\n PanelComponentType,\n PanelDehydrateFunction,\n PanelHydrateFunction,\n
|
|
1
|
+
{"version":3,"file":"usePanelRegistration.js","names":["React","usePanelRegistration","registerComponent","ComponentType","hydrate","dehydrate","name","COMPONENT","displayName","Error","useEffect","deregister"],"sources":["../../src/layout/usePanelRegistration.ts"],"sourcesContent":["import React from 'react';\nimport {\n DashboardPanelProps,\n DashboardPluginComponentProps,\n PanelComponentType,\n PanelDehydrateFunction,\n PanelHydrateFunction,\n} from '../DashboardPlugin';\n\n/**\n * Registers a given panel component. Also runs a `useEffect` that will\n * automatically de-register then panel on unmount.\n * @param registerComponent\n * @param ComponentType\n * @param hydrate\n * @param dehydrate\n */\nexport default function usePanelRegistration<\n P extends DashboardPanelProps,\n C extends React.ComponentType<P>,\n>(\n registerComponent: DashboardPluginComponentProps['registerComponent'],\n ComponentType: PanelComponentType<P, C>,\n hydrate?: PanelHydrateFunction,\n dehydrate?: PanelDehydrateFunction\n) {\n const name = ComponentType.COMPONENT ?? ComponentType.displayName;\n\n if (name == null) {\n throw new Error(\n 'ComponentType must have a `COMPONENT` or `displayName` attribute.'\n );\n }\n\n React.useEffect(() => {\n const deregister = registerComponent(\n name,\n ComponentType,\n hydrate,\n dehydrate\n );\n\n return () => {\n deregister();\n };\n }, [ComponentType, dehydrate, hydrate, name, registerComponent]);\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AASzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoB,CAI1CC,iBAAqE,EACrEC,aAAuC,EACvCC,OAA8B,EAC9BC,SAAkC,EAClC;EAAA;EACA,IAAMC,IAAI,4BAAGH,aAAa,CAACI,SAAS,yEAAIJ,aAAa,CAACK,WAAW;EAEjE,IAAIF,IAAI,IAAI,IAAI,EAAE;IAChB,MAAM,IAAIG,KAAK,CACb,mEAAmE,CACpE;EACH;EAEAT,KAAK,CAACU,SAAS,CAAC,MAAM;IACpB,IAAMC,UAAU,GAAGT,iBAAiB,CAClCI,IAAI,EACJH,aAAa,EACbC,OAAO,EACPC,SAAS,CACV;IAED,OAAO,MAAM;MACXM,UAAU,EAAE;IACd,CAAC;EACH,CAAC,EAAE,CAACR,aAAa,EAAEE,SAAS,EAAED,OAAO,EAAEE,IAAI,EAAEJ,iBAAiB,CAAC,CAAC;AAClE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/dashboard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0",
|
|
4
4
|
"description": "Deephaven Dashboard",
|
|
5
5
|
"author": "Deephaven Data Labs LLC",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"build:sass": "sass --embed-sources --load-path=../../node_modules ./src:./dist"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@deephaven/components": "^0.
|
|
26
|
-
"@deephaven/golden-layout": "^0.
|
|
27
|
-
"@deephaven/jsapi-bootstrap": "^0.
|
|
28
|
-
"@deephaven/log": "^0.
|
|
29
|
-
"@deephaven/react-hooks": "^0.
|
|
30
|
-
"@deephaven/redux": "^0.
|
|
31
|
-
"@deephaven/utils": "^0.
|
|
25
|
+
"@deephaven/components": "^0.46.0",
|
|
26
|
+
"@deephaven/golden-layout": "^0.46.0",
|
|
27
|
+
"@deephaven/jsapi-bootstrap": "^0.46.0",
|
|
28
|
+
"@deephaven/log": "^0.46.0",
|
|
29
|
+
"@deephaven/react-hooks": "^0.46.0",
|
|
30
|
+
"@deephaven/redux": "^0.46.0",
|
|
31
|
+
"@deephaven/utils": "^0.46.0",
|
|
32
32
|
"deep-equal": "^2.0.5",
|
|
33
33
|
"lodash.ismatch": "^4.1.1",
|
|
34
34
|
"lodash.throttle": "^4.1.1",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"react-redux": "^7.2.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@deephaven/mocks": "^0.
|
|
44
|
+
"@deephaven/mocks": "^0.46.0",
|
|
45
45
|
"@types/lodash.ismatch": "^4.4.0"
|
|
46
46
|
},
|
|
47
47
|
"files": [
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "2a4ec0dc2720f38236aa2da2e70a2f321fea1c35"
|
|
54
54
|
}
|
package/dist/layout/hooks.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { EventEmitter } from '@deephaven/golden-layout';
|
|
2
|
-
export declare const useListener: (eventEmitter: EventEmitter, eventName: string, callback: Function) => void;
|
|
3
|
-
declare const _default: {
|
|
4
|
-
useListener: (eventEmitter: EventEmitter, eventName: string, callback: Function) => void;
|
|
5
|
-
};
|
|
6
|
-
export default _default;
|
|
7
|
-
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/layout/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,eAAO,MAAM,WAAW,iBACR,YAAY,aACf,MAAM,YAEP,QAAQ,KACjB,IAUA,CAAC;;;;AAEJ,wBAA+B"}
|
package/dist/layout/hooks.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
export var useListener = (eventEmitter, eventName, callback) => useEffect(function initEventEmitter() {
|
|
3
|
-
eventEmitter.on(eventName, callback);
|
|
4
|
-
return () => {
|
|
5
|
-
eventEmitter.off(eventName, callback);
|
|
6
|
-
};
|
|
7
|
-
}, [eventEmitter, eventName, callback]);
|
|
8
|
-
export default {
|
|
9
|
-
useListener
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=hooks.js.map
|
package/dist/layout/hooks.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","names":["useEffect","useListener","eventEmitter","eventName","callback","initEventEmitter","on","off"],"sources":["../../src/layout/hooks.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { EventEmitter } from '@deephaven/golden-layout';\n\nexport const useListener = (\n eventEmitter: EventEmitter,\n eventName: string,\n // eslint-disable-next-line @typescript-eslint/ban-types\n callback: Function\n): void =>\n useEffect(\n function initEventEmitter() {\n eventEmitter.on(eventName, callback);\n\n return () => {\n eventEmitter.off(eventName, callback);\n };\n },\n [eventEmitter, eventName, callback]\n );\n\nexport default { useListener };\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AAGjC,OAAO,IAAMC,WAAW,GAAG,CACzBC,YAA0B,EAC1BC,SAAiB,EAEjBC,QAAkB,KAElBJ,SAAS,CACP,SAASK,gBAAgB,GAAG;EAC1BH,YAAY,CAACI,EAAE,CAACH,SAAS,EAAEC,QAAQ,CAAC;EAEpC,OAAO,MAAM;IACXF,YAAY,CAACK,GAAG,CAACJ,SAAS,EAAEC,QAAQ,CAAC;EACvC,CAAC;AACH,CAAC,EACD,CAACF,YAAY,EAAEC,SAAS,EAAEC,QAAQ,CAAC,CACpC;AAEH,eAAe;EAAEH;AAAY,CAAC"}
|