@deephaven/dashboard 0.61.1-beta.0 → 0.61.2-beta.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.
@@ -3,6 +3,7 @@ import { ConnectedComponent } from 'react-redux';
3
3
  import GoldenLayout from '@deephaven/golden-layout';
4
4
  import type { GLPanelProps, ReactComponentConfig } from '@deephaven/golden-layout';
5
5
  import PanelManager from './PanelManager';
6
+ import { WidgetDescriptor } from './PanelEvent';
6
7
  /**
7
8
  * Panel components can provide static props that provide meta data about the
8
9
  * panel.
@@ -27,19 +28,16 @@ export type PanelFunctionComponentType<P, R> = ForwardRefComponentType<P, R> & P
27
28
  export type WrappedComponentType<P extends PanelProps, C extends ComponentType<P>> = ConnectedComponent<C, P>;
28
29
  export type PanelComponentType<P extends PanelProps = PanelProps, C extends ComponentType<P> = ComponentType<P>> = (ComponentType<P> | WrappedComponentType<P, C>) & PanelStaticMetaData;
29
30
  export declare function isWrappedComponent<P extends PanelProps, C extends ComponentType<P>>(type: PanelComponentType<P, C>): type is WrappedComponentType<P, C>;
30
- export type PanelMetadata = {
31
- id?: string;
32
- name?: string;
33
- type?: string;
34
- };
31
+ export type PanelMetadata = Partial<WidgetDescriptor>;
35
32
  export type PanelProps = GLPanelProps & {
36
33
  metadata?: PanelMetadata;
37
34
  };
38
35
  export type DehydratedPanelProps = Omit<PanelProps, keyof GLPanelProps>;
39
- export type DashboardPanelProps = PanelProps & {
36
+ export type LocalDashboardProps = {
40
37
  localDashboardId: string;
41
38
  };
42
- export type DehydratedDashboardPanelProps = Omit<DashboardPanelProps, keyof GLPanelProps>;
39
+ export type DashboardPanelProps = PanelProps & LocalDashboardProps;
40
+ export type DehydratedDashboardPanelProps = DehydratedPanelProps & LocalDashboardProps;
43
41
  export type PanelComponent<T extends PanelProps = PanelProps> = Component<T> | {
44
42
  props: T;
45
43
  state: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardPlugin.d.ts","sourceRoot":"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AE,MAAM,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,iBAAiB,EAAE,CACjB,CAAC,SAAS,mBAAmB,EAC7B,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,EAE1B,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EACvC,OAAO,CAAC,EAAE,oBAAoB,EAC9B,SAAS,CAAC,EAAE,sBAAsB,KAC/B,2BAA2B,CAAC;CAClC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,CAAC,6BAA6B,CAAC,GAC5C,KAAK,IAAI,6BAA6B,CAOxC;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,CAAC,6BAA6B,CAAC,GAC5C,OAAO,CAAC,KAAK,IAAI,6BAA6B,CAMhD"}
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardPlugin.js","names":["GoldenLayout","PanelManager","isWrappedComponent","type","WrappedComponent","undefined","isDashboardPluginProps","props","id","layout","panelManager","registerComponent","assertIsDashboardPluginProps","Error","concat"],"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 * 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 * Alias for the return type of React.forwardRef()\n */\ntype ForwardRefComponentType<P, R> = ForwardRefExoticComponent<\n PropsWithoutRef<P> & RefAttributes<R>\n>;\n\n/**\n * @deprecated Use `PanelComponentType` instead and add generic types to forwardRef call.\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> = (ComponentType<P> | WrappedComponentType<P, C>) & 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> =\n | Component<T>\n | { props: T; state: unknown };\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\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;AACA;AAYA;AACA;AACA;AAKA;AACA;AACA;AAcA,OAAO,SAASC,kBAAkBA,CAGhCC,IAA8B,EAAsC;EACpE,OAAO,CAACA,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAiCC,gBAAgB,MAAKC,SAAS;AAC7E;AA+DA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,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,4BAA4BA,CAC1CL,KAA6C,EACG;EAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC,EAAE;IAClC,MAAM,IAAIM,KAAK,0DAAAC,MAAA,CAC4CP,KAAK,CAChE,CAAC;EACH;AACF"}
1
+ {"version":3,"file":"DashboardPlugin.js","names":["GoldenLayout","PanelManager","isWrappedComponent","type","WrappedComponent","undefined","isDashboardPluginProps","props","id","layout","panelManager","registerComponent","assertIsDashboardPluginProps","Error","concat"],"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';\nimport { WidgetDescriptor } from './PanelEvent';\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 * Alias for the return type of React.forwardRef()\n */\ntype ForwardRefComponentType<P, R> = ForwardRefExoticComponent<\n PropsWithoutRef<P> & RefAttributes<R>\n>;\n\n/**\n * @deprecated Use `PanelComponentType` instead and add generic types to forwardRef call.\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> = (ComponentType<P> | WrappedComponentType<P, C>) & 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 = Partial<WidgetDescriptor>;\n\nexport type PanelProps = GLPanelProps & {\n metadata?: PanelMetadata;\n};\n\nexport type DehydratedPanelProps = Omit<PanelProps, keyof GLPanelProps>;\n\nexport type LocalDashboardProps = { localDashboardId: string };\n\nexport type DashboardPanelProps = PanelProps & LocalDashboardProps;\n\nexport type DehydratedDashboardPanelProps = DehydratedPanelProps &\n LocalDashboardProps;\n\nexport type PanelComponent<T extends PanelProps = PanelProps> =\n | Component<T>\n | { props: T; state: unknown };\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\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;AAGnB;AACA;AACA;AACA;AAYA;AACA;AACA;AAKA;AACA;AACA;AAcA,OAAO,SAASC,kBAAkBA,CAGhCC,IAA8B,EAAsC;EACpE,OAAO,CAACA,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAiCC,gBAAgB,MAAKC,SAAS;AAC7E;AA+DA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,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,4BAA4BA,CAC1CL,KAA6C,EACG;EAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC,EAAE;IAClC,MAAM,IAAIM,KAAK,0DAAAC,MAAA,CAC4CP,KAAK,CAChE,CAAC;EACH;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardUtils.d.ts","sourceRoot":"","sources":["../src/DashboardUtils.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,6BAA6B,EAE7B,kBAAkB,EAClB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAE3B;;;;;;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;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAejE;;;;;AAED,wBAGE"}
1
+ {"version":3,"file":"DashboardUtils.d.ts","sourceRoot":"","sources":["../src/DashboardUtils.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,6BAA6B,EAE7B,kBAAkB,EAClB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAE3B;;;;;;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,CAKH;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAejE;;;;;AAED,wBAGE"}
@@ -51,9 +51,7 @@ export function dehydrate(config) {
51
51
  */
52
52
  export function hydrate(props) {
53
53
  var localDashboardId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
54
- return _objectSpread(_objectSpread({
55
- metadata: {}
56
- }, props), {}, {
54
+ return _objectSpread(_objectSpread({}, props), {}, {
57
55
  localDashboardId
58
56
  });
59
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardUtils.js","names":["ForwardRef","isWrappedComponent","dehydrate","config","props","componentState","metadata","panelState","newProps","_objectSpread","type","hydrate","localDashboardId","arguments","length","undefined","canHaveRef","component","isClassComponent","WrappedComponent","prototype","isReactComponent","isForwardRef","$$typeof"],"sources":["../src/DashboardUtils.tsx"],"sourcesContent":["import { ForwardRef } from 'react-is';\nimport {\n DehydratedDashboardPanelProps,\n isWrappedComponent,\n PanelComponentType,\n PanelConfig,\n} 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\n/**\n * Checks if a panel component can take a ref. Helps silence react dev errors\n * if a ref is passed to a functional component without forwardRef.\n * @param component The panel component to check if it can take a ref\n * @returns Wheter the component can take a ref or not\n */\nexport function canHaveRef(component: PanelComponentType): boolean {\n // Might be a redux connect wrapped component\n const isClassComponent =\n (isWrappedComponent(component) &&\n component.WrappedComponent.prototype != null &&\n component.WrappedComponent.prototype.isReactComponent != null) ||\n (component.prototype != null &&\n component.prototype.isReactComponent != null);\n\n const isForwardRef =\n !isWrappedComponent(component) &&\n '$$typeof' in component &&\n component.$$typeof === ForwardRef;\n\n return isClassComponent || isForwardRef;\n}\n\nexport default {\n dehydrate,\n hydrate,\n};\n"],"mappings":";;;;;AAAA,SAASA,UAAU,QAAQ,UAAU;AAAC,SAGpCC,kBAAkB;AAKpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,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,OAAAE,aAAA,CAAAA,aAAA,KACKN,MAAM;IACTE,cAAc,EAAE,IAAI;IACpBD,KAAK,EAAEI,QAAQ;IACfE,IAAI,EAAE;EAAiB;AAE3B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CACrBP,KAAQ,EAEL;EAAA,IADHQ,gBAAgB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAErB,OAAAJ,aAAA,CAAAA,aAAA;IACEH,QAAQ,EAAE,CAAC;EAAC,GACTF,KAAK;IACRQ;EAAgB;AAEpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,UAAUA,CAACC,SAA6B,EAAW;EACjE;EACA,IAAMC,gBAAgB,GACnBjB,kBAAkB,CAACgB,SAAS,CAAC,IAC5BA,SAAS,CAACE,gBAAgB,CAACC,SAAS,IAAI,IAAI,IAC5CH,SAAS,CAACE,gBAAgB,CAACC,SAAS,CAACC,gBAAgB,IAAI,IAAI,IAC9DJ,SAAS,CAACG,SAAS,IAAI,IAAI,IAC1BH,SAAS,CAACG,SAAS,CAACC,gBAAgB,IAAI,IAAK;EAEjD,IAAMC,YAAY,GAChB,CAACrB,kBAAkB,CAACgB,SAAS,CAAC,IAC9B,UAAU,IAAIA,SAAS,IACvBA,SAAS,CAACM,QAAQ,KAAKvB,UAAU;EAEnC,OAAOkB,gBAAgB,IAAII,YAAY;AACzC;AAEA,eAAe;EACbpB,SAAS;EACTS;AACF,CAAC"}
1
+ {"version":3,"file":"DashboardUtils.js","names":["ForwardRef","isWrappedComponent","dehydrate","config","props","componentState","metadata","panelState","newProps","_objectSpread","type","hydrate","localDashboardId","arguments","length","undefined","canHaveRef","component","isClassComponent","WrappedComponent","prototype","isReactComponent","isForwardRef","$$typeof"],"sources":["../src/DashboardUtils.tsx"],"sourcesContent":["import { ForwardRef } from 'react-is';\nimport {\n DehydratedDashboardPanelProps,\n isWrappedComponent,\n PanelComponentType,\n PanelConfig,\n} 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 ...props,\n localDashboardId,\n };\n}\n\n/**\n * Checks if a panel component can take a ref. Helps silence react dev errors\n * if a ref is passed to a functional component without forwardRef.\n * @param component The panel component to check if it can take a ref\n * @returns Wheter the component can take a ref or not\n */\nexport function canHaveRef(component: PanelComponentType): boolean {\n // Might be a redux connect wrapped component\n const isClassComponent =\n (isWrappedComponent(component) &&\n component.WrappedComponent.prototype != null &&\n component.WrappedComponent.prototype.isReactComponent != null) ||\n (component.prototype != null &&\n component.prototype.isReactComponent != null);\n\n const isForwardRef =\n !isWrappedComponent(component) &&\n '$$typeof' in component &&\n component.$$typeof === ForwardRef;\n\n return isClassComponent || isForwardRef;\n}\n\nexport default {\n dehydrate,\n hydrate,\n};\n"],"mappings":";;;;;AAAA,SAASA,UAAU,QAAQ,U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,SAAS,CAACG,SAAS,CAACC,gBAAgB,IAAI,IAAK;EAEjD,IAAMC,YAAY,GAChB,CAACrB,kBAAkB,CAACgB,SAAS,CAAC,IAC9B,UAAU,IAAIA,SAAS,IACvBA,SAAS,CAACM,QAAQ,KAAKvB,UAAU;EAEnC,OAAOkB,gBAAgB,IAAII,YAAY;AACzC;AAEA,eAAe;EACbpB,SAAS;EACTS;AACF,CAAC"}
@@ -1,18 +1,14 @@
1
1
  import { DragEvent } from 'react';
2
- export type WidgetDefinition = {
2
+ export type WidgetDescriptor = {
3
3
  type: string;
4
- /**
5
- * @deprecated Use `title` instead.
6
- */
7
4
  name?: string;
8
- title?: string;
9
5
  id?: string;
10
6
  };
11
- export type PanelOpenEventDetail = {
7
+ export type PanelOpenEventDetail<T = unknown> = {
12
8
  dragEvent?: DragEvent;
13
- fetch?: () => Promise<unknown>;
9
+ fetch?: () => Promise<T>;
14
10
  panelId?: string;
15
- widget: WidgetDefinition;
11
+ widget: WidgetDescriptor;
16
12
  };
17
13
  /**
18
14
  * Events emitted by panels and to control panels
@@ -1 +1 @@
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"}
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;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,OAAO,IAAI;IAC9C,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF;;GAEG;;;;;;;;;;;;;;;AACH,wBAsCG"}
@@ -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":["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
+ {"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 WidgetDescriptor = {\n type: string;\n name?: string;\n id?: string;\n};\n\nexport type PanelOpenEventDetail<T = unknown> = {\n dragEvent?: DragEvent;\n fetch?: () => Promise<T>;\n panelId?: string;\n widget: WidgetDescriptor;\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":"AAeA;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"}
@@ -4,7 +4,7 @@ import './PanelPlaceholder.scss';
4
4
  * Displays a placeholder for unregistered panel types.
5
5
  */
6
6
  declare const PanelPlaceholder: React.ForwardRefExoticComponent<import("@deephaven/golden-layout").GLPanelProps & {
7
- metadata?: import("./DashboardPlugin").PanelMetadata | undefined;
7
+ metadata?: Partial<import("./PanelEvent").WidgetDescriptor> | undefined;
8
8
  } & React.RefAttributes<HTMLDivElement>>;
9
9
  export default PanelPlaceholder;
10
10
  //# sourceMappingURL=PanelPlaceholder.d.ts.map
@@ -1 +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,GAAG,IAAI,CAmDP;AAED,eAAe,iBAAiB,CAAC"}
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,GAAG,IAAI,CAgDP;AAED,eAAe,iBAAiB,CAAC"}
@@ -22,32 +22,23 @@ export function useDashboardPanel(_ref) {
22
22
  registerComponent
23
23
  } = dashboardProps;
24
24
  var handlePanelOpen = useCallback(_ref2 => {
25
- var _widget$title;
26
25
  var {
27
26
  dragEvent,
28
- fetch,
29
27
  panelId = shortid.generate(),
30
28
  widget
31
29
  } = _ref2;
32
30
  var {
33
- id: widgetId,
31
+ name,
34
32
  type
35
33
  } = 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;
34
+ var isSupportedType = type != null && (Array.isArray(supportedTypes) && supportedTypes.includes(type) || type === supportedTypes);
38
35
  if (!isSupportedType) {
39
36
  // Only want to listen for your custom variable types
40
37
  return;
41
38
  }
42
- var metadata = {
43
- id: widgetId,
44
- name,
45
- type
46
- };
47
39
  var props = {
48
40
  localDashboardId: id,
49
- metadata,
50
- fetch
41
+ metadata: widget
51
42
  };
52
43
  if (hydrate != null) {
53
44
  props = hydrate(props, id);
@@ -1 +1 @@
1
- {"version":3,"file":"useDashboardPanel.js","names":["useCallback","shortid","PanelEvent","LayoutUtils","useListener","usePanelRegistration","useDashboardPanel","_ref","dashboardProps","componentName","component","supportedTypes","hydrate","dehydrate","id","layout","registerComponent","handlePanelOpen","_ref2","_widget$title","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}): void {\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,iBAAiBA,CAAAC,IAAA,EA4BxB;EAAA,IAzBP;IACAC,cAAc;IACdC,aAAa;IACbC,SAAS;IACTC,cAAc;IACdC,OAAO;IACPC;EAmBF,CAAC,GAAAN,IAAA;EACC,IAAM;IAAEO,EAAE;IAAEC,MAAM;IAAEC;EAAkB,CAAC,GAAGR,cAAc;EAExD,IAAMS,eAAe,GAAGjB,WAAW,CACjCkB,KAAA,IAK4B;IAAA,IAAAC,aAAA;IAAA,IAL3B;MACCC,SAAS;MACTC,KAAK;MACLC,OAAO,GAAGrB,OAAO,CAACsB,QAAQ,CAAC,CAAC;MAC5BC;IACoB,CAAC,GAAAN,KAAA;IACrB,IAAM;MAAEJ,EAAE,EAAEW,QAAQ;MAAEC;IAAK,CA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PanelEvent","LayoutUtils","useListener","usePanelRegistration","useDashboardPanel","_ref","dashboardProps","componentName","component","supportedTypes","hydrate","dehydrate","id","layout","registerComponent","handlePanelOpen","_ref2","dragEvent","panelId","generate","widget","name","type","isSupportedType","Array","isArray","includes","props","localDashboardId","metadata","config","title","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}): void {\n const { id, layout, registerComponent } = dashboardProps;\n\n const handlePanelOpen = useCallback(\n ({\n dragEvent,\n panelId = shortid.generate(),\n widget,\n }: PanelOpenEventDetail) => {\n const { name, type } = widget;\n const isSupportedType =\n type != null &&\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 let props: DehydratedDashboardPanelProps = {\n localDashboardId: id,\n metadata: widget,\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,iBAAiBA,CAAAC,IAAA,EA4BxB;EAAA,IAzBP;IACAC,cAAc;IACdC,aAAa;IACbC,SAAS;IACTC,cAAc;IACdC,OAAO;IACPC;EAmBF,CAAC,GAAAN,IAAA;EACC,IAAM;IAAEO,EAAE;IAAEC,MAAM;IAAEC;EAAkB,CAAC,GAAGR,cAAc;EAExD,IAAMS,eAAe,GAAGjB,WAAW,CACjCkB,KAAA,IAI4B;IAAA,IAJ3B;MACCC,SAAS;MACTC,OAAO,GAAGnB,OAAO,CAACoB,QAAQ,CAAC,CAAC;MAC5BC;IACoB,CAAC,GAAAJ,KAAA;IACrB,IAAM;MAAEK,IAAI;MAAEC;IAAK,CAAC,GAAGF,MAAM;IAC7B,IAAMG,eAAe,GACnBD,IAAI,IAAI,IAAI,KACVE,KAAK,CAACC,OAAO,CAAChB,cAAc,CAAC,IAAIA,cAAc,CAACiB,QAAQ,CAACJ,IAAI,CAAC,IAC9DA,IAAI,KAAKb,cAAc,CAAC;IAC5B,IAAI,CAACc,eAAe,EAAE;MACpB;MACA;IACF;IACA,IAAII,KAAoC,GAAG;MACzCC,gBAAgB,EAAEhB,EAAE;MACpBiB,QAAQ,EAAET;IACZ,CAAC;IACD,IAAIV,OAAO,IAAI,IAAI,EAAE;MACnBiB,KAAK,GAAGjB,OAAO,CAACiB,KAAK,EAAEf,EAAE,CAAC;IAC5B;IACA,IAAMkB,MAA4B,GAAG;MACnCR,IAAI,EAAE,iBAAiB;MACvBd,SAAS,EAAED,aAAa;MACxBoB,KAAK;MACLI,KAAK,EAAEV,IAAI;MACXT,EAAE,EAAEM;IACN,CAAC;IAED,IAAM;MAAEc;IAAK,CAAC,GAAGnB,MAAM;IACvBZ,WAAW,CAACgC,aAAa,CAAC;MAAED,IAAI;MAAEF,MAAM;MAAEb;IAAU,CAAC,CAAC;EACxD,CAAC,EACD,CAACV,aAAa,EAAEG,OAAO,EAAEE,EAAE,EAAEC,MAAM,EAAEJ,cAAc,CACrD,CAAC;;EAED;AACF;AACA;EACEN,oBAAoB,CAACW,iBAAiB,EAAEN,SAAS,EAAEE,OAAO,EAAEC,SAAS,CAAC;;EAEtE;AACF;AACA;EACET,WAAW,CAACW,MAAM,CAACqB,QAAQ,EAAElC,UAAU,CAACmC,IAAI,EAAEpB,eAAe,CAAC;AAChE;AAEA,eAAeX,iBAAiB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/dashboard",
3
- "version": "0.61.1-beta.0+e6dd3e16",
3
+ "version": "0.61.2-beta.0+2cd46ce2",
4
4
  "description": "Deephaven Dashboard",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -22,12 +22,12 @@
22
22
  "build:sass": "sass --embed-sources --load-path=../../node_modules ./src:./dist"
23
23
  },
24
24
  "dependencies": {
25
- "@deephaven/components": "^0.61.1-beta.0+e6dd3e16",
26
- "@deephaven/golden-layout": "^0.61.1-beta.0+e6dd3e16",
27
- "@deephaven/log": "^0.61.1-beta.0+e6dd3e16",
28
- "@deephaven/react-hooks": "^0.61.1-beta.0+e6dd3e16",
29
- "@deephaven/redux": "^0.61.1-beta.0+e6dd3e16",
30
- "@deephaven/utils": "^0.61.1-beta.0+e6dd3e16",
25
+ "@deephaven/components": "^0.61.2-beta.0+2cd46ce2",
26
+ "@deephaven/golden-layout": "^0.61.2-beta.0+2cd46ce2",
27
+ "@deephaven/log": "^0.61.2-beta.0+2cd46ce2",
28
+ "@deephaven/react-hooks": "^0.61.2-beta.0+2cd46ce2",
29
+ "@deephaven/redux": "^0.61.2-beta.0+2cd46ce2",
30
+ "@deephaven/utils": "^0.61.2-beta.0+2cd46ce2",
31
31
  "deep-equal": "^2.0.5",
32
32
  "lodash.ismatch": "^4.1.1",
33
33
  "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.61.1-beta.0+e6dd3e16",
44
+ "@deephaven/mocks": "^0.61.2-beta.0+2cd46ce2",
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": "e6dd3e16a6018bfa0a11321d807015ce97f692fd"
53
+ "gitHead": "2cd46ce2d5107553d3f91933294638a5fb183245"
54
54
  }