@deephaven/dashboard 0.19.2-beta.5 → 0.20.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.
@@ -1 +1 @@
1
- {"version":3,"file":"Dashboard.js","names":["React","useEffect","useMemo","useRef","useState","throttle","GoldenLayout","LayoutUtils","PanelPlaceholder","DashboardLayout","RESIZE_THROTTLE","DEFAULT_CALLBACK","undefined","EMPTY_OBJECT","Object","freeze","Dashboard","id","children","emptyDashboard","layoutConfig","layoutSettings","onLayoutConfigChange","onGoldenLayoutChange","onLayoutInitialized","fallbackComponent","hydrate","dehydrate","layoutElement","isInitialized","setIsInitialized","layout","setLayout","initDashboard","current","config","makeDefaultLayout","settings","assign","content","newLayout","onInit","off","on","setFallbackComponent","init","destroy","handleResize","isInitialised","updateSize","initResizeEventListner","window","addEventListener","removeEventListener"],"sources":["../src/Dashboard.tsx"],"sourcesContent":["import React, {\n ForwardRefExoticComponent,\n RefAttributes,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport throttle from 'lodash.throttle';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type { ItemConfigType } from '@deephaven/golden-layout';\nimport './layout/GoldenLayout.scss';\nimport LayoutUtils from './layout/LayoutUtils';\nimport PanelPlaceholder from './PanelPlaceholder';\nimport DashboardLayout from './DashboardLayout';\nimport {\n PanelDehydrateFunction,\n PanelHydrateFunction,\n PanelProps,\n} from './DashboardPlugin';\nimport './Dashboard.scss';\n\nconst RESIZE_THROTTLE = 100;\n\nconst DEFAULT_CALLBACK = () => undefined;\n\nconst EMPTY_OBJECT = Object.freeze({});\n\nexport type DashboardProps = {\n id?: string;\n children?: React.ReactNode | React.ReactNode[];\n emptyDashboard?: React.ReactNode;\n layoutConfig?: ItemConfigType[];\n layoutSettings?: Record<string, unknown>;\n onLayoutConfigChange?: () => void;\n onGoldenLayoutChange?: (goldenLayout: GoldenLayout) => void;\n onLayoutInitialized?: () => void;\n fallbackComponent?: ForwardRefExoticComponent<\n PanelProps & RefAttributes<HTMLDivElement>\n >;\n hydrate?: PanelHydrateFunction;\n dehydrate?: PanelDehydrateFunction;\n};\n\nexport const Dashboard = ({\n id = 'default',\n children,\n emptyDashboard,\n layoutConfig,\n layoutSettings = EMPTY_OBJECT,\n onLayoutConfigChange = DEFAULT_CALLBACK,\n onGoldenLayoutChange = DEFAULT_CALLBACK,\n onLayoutInitialized = DEFAULT_CALLBACK,\n fallbackComponent = PanelPlaceholder,\n hydrate,\n dehydrate,\n}: DashboardProps): JSX.Element => {\n const layoutElement = useRef<HTMLDivElement>(null);\n const [isInitialized, setIsInitialized] = useState(false);\n const [layout, setLayout] = useState<GoldenLayout>();\n\n useEffect(\n function initDashboard() {\n if (!layoutElement.current) {\n setLayout(undefined);\n return;\n }\n const config: GoldenLayout.Config = {\n ...LayoutUtils.makeDefaultLayout(),\n };\n if (config.settings === undefined) {\n config.settings = {};\n }\n Object.assign(config.settings, layoutSettings);\n\n // Load our content later after plugins have registered\n config.content = [];\n\n const newLayout = new GoldenLayout(config, layoutElement.current);\n\n const onInit = () => {\n newLayout.off('initialised', onInit);\n setIsInitialized(true);\n };\n newLayout.on('initialised', onInit);\n\n if (fallbackComponent != null) {\n newLayout.setFallbackComponent(fallbackComponent);\n }\n\n newLayout.init();\n\n setLayout(newLayout);\n\n onGoldenLayoutChange(newLayout);\n\n return () => {\n newLayout.destroy();\n };\n },\n [\n layoutSettings,\n fallbackComponent,\n onGoldenLayoutChange,\n setIsInitialized,\n setLayout,\n ]\n );\n\n const handleResize = useMemo(\n () =>\n throttle(() => {\n if (layout != null && layout.isInitialised) {\n layout?.updateSize();\n }\n }, RESIZE_THROTTLE),\n [layout]\n );\n\n useEffect(\n function initResizeEventListner() {\n window.addEventListener('resize', handleResize);\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n },\n [handleResize]\n );\n\n return (\n <div className=\"dashboard-container w-100 h-100\">\n <div className=\"w-100 h-100\" ref={layoutElement} />\n {isInitialized && layout && (\n <DashboardLayout\n emptyDashboard={emptyDashboard}\n id={id}\n layout={layout}\n layoutConfig={layoutConfig}\n onLayoutChange={onLayoutConfigChange}\n onLayoutInitialized={onLayoutInitialized}\n hydrate={hydrate}\n dehydrate={dehydrate}\n >\n {children}\n </DashboardLayout>\n )}\n </div>\n );\n};\n\nexport default Dashboard;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAGEC,SAHF,EAIEC,OAJF,EAKEC,MALF,EAMEC,QANF,QAOO,OAPP;AAQA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,YAAP,MAAyB,0BAAzB;;OAGOC,W;OACAC,gB;OACAC,e;;AAQP,IAAMC,eAAe,GAAG,GAAxB;;AAEA,IAAMC,gBAAgB,GAAG,MAAMC,SAA/B;;AAEA,IAAMC,YAAY,GAAGC,MAAM,CAACC,MAAP,CAAc,EAAd,CAArB;AAkBA,OAAO,IAAMC,SAAS,GAAG,QAYU;EAAA,IAZT;IACxBC,EAAE,GAAG,SADmB;IAExBC,QAFwB;IAGxBC,cAHwB;IAIxBC,YAJwB;IAKxBC,cAAc,GAAGR,YALO;IAMxBS,oBAAoB,GAAGX,gBANC;IAOxBY,oBAAoB,GAAGZ,gBAPC;IAQxBa,mBAAmB,GAAGb,gBARE;IASxBc,iBAAiB,GAAGjB,gBATI;IAUxBkB,OAVwB;IAWxBC;EAXwB,CAYS;EACjC,IAAMC,aAAa,GAAGzB,MAAM,CAAiB,IAAjB,CAA5B;EACA,IAAM,CAAC0B,aAAD,EAAgBC,gBAAhB,IAAoC1B,QAAQ,CAAC,KAAD,CAAlD;EACA,IAAM,CAAC2B,MAAD,EAASC,SAAT,IAAsB5B,QAAQ,EAApC;EAEAH,SAAS,CACP,SAASgC,aAAT,GAAyB;IACvB,IAAI,CAACL,aAAa,CAACM,OAAnB,EAA4B;MAC1BF,SAAS,CAACpB,SAAD,CAAT;MACA;IACD;;IACD,IAAMuB,MAA2B,qBAC5B5B,WAAW,CAAC6B,iBA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lC;IACA,OAAO,MAAM;MACXI,MAAM,CAACE,mBAAP,CAA2B,QAA3B,EAAqCN,YAArC;IACD,CAFD;EAGD,CANM,EAOP,CAACA,YAAD,CAPO,CAAT;EAUA,oBACE;IAAK,SAAS,EAAC;EAAf,gBACE;IAAK,SAAS,EAAC,aAAf;IAA6B,GAAG,EAAEnB;EAAlC,EADF,EAEGC,aAAa,IAAIE,MAAjB,iBACC,oBAAC,eAAD;IACE,cAAc,EAAEZ,cADlB;IAEE,EAAE,EAAEF,EAFN;IAGE,MAAM,EAAEc,MAHV;IAIE,YAAY,EAAEX,YAJhB;IAKE,cAAc,EAAEE,oBALlB;IAME,mBAAmB,EAAEE,mBANvB;IAOE,OAAO,EAAEE,OAPX;IAQE,SAAS,EAAEC;EARb,GAUGT,QAVH,CAHJ,CADF;AAmBD,CAxGM;AA0GP,eAAeF,SAAf"}
1
+ {"version":3,"file":"Dashboard.js","names":["React","useEffect","useMemo","useRef","useState","throttle","GoldenLayout","LayoutUtils","PanelPlaceholder","DashboardLayout","RESIZE_THROTTLE","DEFAULT_CALLBACK","undefined","EMPTY_OBJECT","Object","freeze","Dashboard","id","children","emptyDashboard","layoutConfig","layoutSettings","onLayoutConfigChange","onGoldenLayoutChange","onLayoutInitialized","fallbackComponent","hydrate","dehydrate","layoutElement","isInitialized","setIsInitialized","layout","setLayout","initDashboard","current","config","makeDefaultLayout","settings","assign","content","newLayout","onInit","off","on","setFallbackComponent","init","destroy","handleResize","isInitialised","updateSize","initResizeEventListner","window","addEventListener","removeEventListener"],"sources":["../src/Dashboard.tsx"],"sourcesContent":["import React, {\n ForwardRefExoticComponent,\n RefAttributes,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport throttle from 'lodash.throttle';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type { ItemConfigType } from '@deephaven/golden-layout';\nimport './layout/GoldenLayout.scss';\nimport LayoutUtils from './layout/LayoutUtils';\nimport PanelPlaceholder from './PanelPlaceholder';\nimport DashboardLayout from './DashboardLayout';\nimport {\n PanelDehydrateFunction,\n PanelHydrateFunction,\n PanelProps,\n} from './DashboardPlugin';\nimport './Dashboard.scss';\n\nconst RESIZE_THROTTLE = 100;\n\nconst DEFAULT_CALLBACK = () => undefined;\n\nconst EMPTY_OBJECT = Object.freeze({});\n\nexport type DashboardProps = {\n id?: string;\n children?: React.ReactNode | React.ReactNode[];\n emptyDashboard?: React.ReactNode;\n layoutConfig?: ItemConfigType[];\n layoutSettings?: Record<string, unknown>;\n onLayoutConfigChange?: () => void;\n onGoldenLayoutChange?: (goldenLayout: GoldenLayout) => void;\n onLayoutInitialized?: () => void;\n fallbackComponent?: ForwardRefExoticComponent<\n PanelProps & RefAttributes<HTMLDivElement>\n >;\n hydrate?: PanelHydrateFunction;\n dehydrate?: PanelDehydrateFunction;\n};\n\nexport const Dashboard = ({\n id = 'default',\n children,\n emptyDashboard,\n layoutConfig,\n layoutSettings = EMPTY_OBJECT,\n onLayoutConfigChange = DEFAULT_CALLBACK,\n onGoldenLayoutChange = DEFAULT_CALLBACK,\n onLayoutInitialized = DEFAULT_CALLBACK,\n fallbackComponent = PanelPlaceholder,\n hydrate,\n dehydrate,\n}: DashboardProps): JSX.Element => {\n const layoutElement = useRef<HTMLDivElement>(null);\n const [isInitialized, setIsInitialized] = useState(false);\n const [layout, setLayout] = useState<GoldenLayout>();\n\n useEffect(\n function initDashboard() {\n if (!layoutElement.current) {\n setLayout(undefined);\n return;\n }\n const config = {\n ...LayoutUtils.makeDefaultLayout(),\n };\n if (config.settings === undefined) {\n config.settings = {};\n }\n Object.assign(config.settings, layoutSettings);\n\n // Load our content later after plugins have registered\n config.content = [];\n\n const newLayout = new GoldenLayout(config, layoutElement.current);\n\n const onInit = () => {\n newLayout.off('initialised', onInit);\n setIsInitialized(true);\n };\n newLayout.on('initialised', onInit);\n\n if (fallbackComponent != null) {\n newLayout.setFallbackComponent(fallbackComponent);\n }\n\n newLayout.init();\n\n setLayout(newLayout);\n\n onGoldenLayoutChange(newLayout);\n\n return () => {\n newLayout.destroy();\n };\n },\n [\n layoutSettings,\n fallbackComponent,\n onGoldenLayoutChange,\n setIsInitialized,\n setLayout,\n ]\n );\n\n const handleResize = useMemo(\n () =>\n throttle(() => {\n if (layout != null && layout.isInitialised) {\n layout?.updateSize();\n }\n }, RESIZE_THROTTLE),\n [layout]\n );\n\n useEffect(\n function initResizeEventListner() {\n window.addEventListener('resize', handleResize);\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n },\n [handleResize]\n );\n\n return (\n <div className=\"dashboard-container w-100 h-100\">\n <div className=\"w-100 h-100\" ref={layoutElement} />\n {isInitialized && layout && (\n <DashboardLayout\n emptyDashboard={emptyDashboard}\n id={id}\n layout={layout}\n layoutConfig={layoutConfig}\n onLayoutChange={onLayoutConfigChange}\n onLayoutInitialized={onLayoutInitialized}\n hydrate={hydrate}\n dehydrate={dehydrate}\n >\n {children}\n </DashboardLayout>\n )}\n </div>\n );\n};\n\nexport default Dashboard;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAGEC,SAHF,EAIEC,OAJF,EAKEC,MALF,EAMEC,QANF,QAOO,OAPP;AAQA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,YAAP,MAAyB,0BAAzB;;OAGOC,W;OACAC,gB;OACAC,e;;AAQP,IAAMC,eAAe,GAAG,GAAxB;;AAEA,IAAMC,gBAAgB,GAAG,MAAMC,SAA/B;;AAEA,IAAMC,YAAY,GAAGC,MAAM,CAACC,MAAP,CAAc,EAAd,CAArB;AAkBA,OAAO,IAAMC,SAAS,GAAG,QAYU;EAAA,IAZT;IACxBC,EAAE,GAAG,SADmB;IAExBC,QAFwB;IAGxBC,cAHwB;IAIxBC,YAJwB;IAKxBC,cAAc,GAAGR,YALO;IAMxBS,oBAAoB,GAAGX,gBANC;IAOxBY,oBAAoB,GAAGZ,gBAPC;IAQxBa,mBAAmB,GAAGb,gBARE;IASxBc,iBAAiB,GAAGjB,gBATI;IAUxBkB,OAV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EE,SALF,CAvCO,CAAT;EAgDA,IAAMe,YAAY,GAAG7C,OAAO,CAC1B,MACEG,QAAQ,CAAC,MAAM;IACb,IAAI0B,MAAM,IAAI,IAAV,IAAkBA,MAAM,CAACiB,aAA7B,EAA4C;MAC1CjB,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAEkB,UAAR;IACD;EACF,CAJO,EAILvC,eAJK,CAFgB,EAO1B,CAACqB,MAAD,CAP0B,CAA5B;EAUA9B,SAAS,CACP,SAASiD,sBAAT,GAAkC;IAChCC,MAAM,CAACC,gBAAP,CAAwB,QAAxB,EAAkCL,YAAlC;IACA,OAAO,MAAM;MACXI,MAAM,CAACE,mBAAP,CAA2B,QAA3B,EAAqCN,YAArC;IACD,CAFD;EAGD,CANM,EAOP,CAACA,YAAD,CAPO,CAAT;EAUA,oBACE;IAAK,SAAS,EAAC;EAAf,gBACE;IAAK,SAAS,EAAC,aAAf;IAA6B,GAAG,EAAEnB;EAAlC,EADF,EAEGC,aAAa,IAAIE,MAAjB,iBACC,oBAAC,eAAD;IACE,cAAc,EAAEZ,cADlB;IAEE,EAAE,EAAEF,EAFN;IAGE,MAAM,EAAEc,MAHV;IAIE,YAAY,EAAEX,YAJhB;IAKE,cAAc,EAAEE,oBALlB;IAME,mBAAmB,EAAEE,mBANvB;IAOE,OAAO,EAAEE,OAPX;IAQE,SAAS,EAAEC;EARb,GAUGT,QAVH,CAHJ,CADF;AAmBD,CAxGM;AA0GP,eAAeF,SAAf"}
@@ -1,14 +1,14 @@
1
1
  import { Component, ComponentType } from 'react';
2
2
  import { ConnectedComponent } from 'react-redux';
3
3
  import GoldenLayout from '@deephaven/golden-layout';
4
- import type { ReactComponentConfig } from '@deephaven/golden-layout';
4
+ import type { ReactComponentConfig, EventEmitter, Container } from '@deephaven/golden-layout';
5
5
  import PanelManager from './PanelManager';
6
6
  export declare type WrappedComponentType<P extends PanelProps, C extends ComponentType<P>> = ConnectedComponent<C, P>;
7
7
  export declare type PanelComponentType<P extends PanelProps = PanelProps, C extends ComponentType<P> = ComponentType<P>> = ComponentType<P> | WrappedComponentType<P, C>;
8
8
  export declare function isWrappedComponent<P extends PanelProps, C extends ComponentType<P>>(type: PanelComponentType<P, C>): type is WrappedComponentType<P, C>;
9
9
  export declare type PanelProps = {
10
- glContainer: GoldenLayout.Container;
11
- glEventHub: GoldenLayout.EventEmitter;
10
+ glContainer: Container;
11
+ glEventHub: EventEmitter;
12
12
  };
13
13
  export declare type PanelComponent<T extends PanelProps = PanelProps> = Component<T>;
14
14
  export declare type PanelConfig = ReactComponentConfig & {
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardPlugin.d.ts","sourceRoot":"","sources":["../src/DashboardPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,oBAAY,oBAAoB,CAC9B,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,IACxB,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE7B,oBAAY,kBAAkB,CAC5B,CAAC,SAAS,UAAU,GAAG,UAAU,EACjC,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,IAC3C,aAAa,CAAC,CAAC,CAAC,GAAG,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAElD,wBAAgB,kBAAkB,CAChC,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,EAC1B,IAAI,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,IAAI,oB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AI,CAAC;AAExB,oBAAY,6BAA6B,GAAG;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,iBAAiB,EAAE,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,EAClE,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EACvC,OAAO,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,EACjC,SAAS,CAAC,EAAE,sBAAsB,KAC/B,2BAA2B,CAAC;CAClC,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,wBAAwB,EAAE,CAAC;IAEpC,uFAAuF;IACvF,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,KAAK,UAAU,CAAC;IAEnE,uHAAuH;IACvH,kBAAkB,CAAC,EAAE,CACnB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,KAChB,WAAW,GAAG,IAAI,CAAC;IAExB,oEAAoE;IACpE,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAE/C,oFAAoF;IACpF,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CAClD;AAED;;;;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":["ComponentType","GoldenLayout","PanelManager","isWrappedComponent","type","WrappedComponent","undefined","isDashboardPluginProps","props","id","layout","panelManager","registerComponent","assertIsDashboardPluginProps","Error"],"sources":["../src/DashboardPlugin.ts"],"sourcesContent":["import { Component, ComponentType } from 'react';\nimport { ConnectedComponent } from 'react-redux';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type { ReactComponentConfig } from '@deephaven/golden-layout';\nimport PanelManager from './PanelManager';\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>;\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 PanelProps = {\n glContainer: GoldenLayout.Container;\n glEventHub: GoldenLayout.EventEmitter;\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<T = PanelProps> = (\n props: T,\n dashboardId: string\n) => PanelProps;\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: <P extends PanelProps, C extends ComponentType<P>>(\n name: string,\n ComponentType: PanelComponentType<P, C>,\n hydrate?: PanelHydrateFunction<P>,\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":"AAAA,SAAoBA,aAApB,QAAyC,OAAzC;AAEA,OAAOC,YAAP,MAAyB,0BAAzB;OAEOC,Y;AAYP,OAAO,SAASC,kBAAT,CAGLC,IAHK,EAG+D;EACpE,OAAO,CAACA,IAAD,aAACA,IAAD,uBAACA,IAAD,CAAsCC,gBAAtC,MAA2DC,SAAlE;AACD;;AAmED;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAT,CACLC,KADK,EAEmC;EACxC,OACE,OAAOA,KAAK,CAACC,EAAb,KAAoB,QAApB,IACAD,KAAK,CAACE,MAAN,YAAwBT,YADxB,IAEAO,KAAK,CAACG,YAAN,YAA8BT,YAF9B,IAGA,OAAOM,KAAK,CAACI,iBAAb,KAAmC,UAJrC;AAMD;AAED,OAAO,SAASC,4BAAT,CACLL,KADK,EAE2C;EAChD,IAAI,CAACD,sBAAsB,CAACC,KAAD,CAA3B,EAAoC;IAClC,MAAM,IAAIM,KAAJ,iEACqDN,KADrD,EAAN;EAGD;AACF"}
1
+ {"version":3,"file":"DashboardPlugin.js","names":["ComponentType","GoldenLayout","PanelManager","isWrappedComponent","type","WrappedComponent","undefined","isDashboardPluginProps","props","id","layout","panelManager","registerComponent","assertIsDashboardPluginProps","Error"],"sources":["../src/DashboardPlugin.ts"],"sourcesContent":["import { Component, ComponentType } from 'react';\nimport { ConnectedComponent } from 'react-redux';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type {\n ReactComponentConfig,\n EventEmitter,\n Container,\n} from '@deephaven/golden-layout';\nimport PanelManager from './PanelManager';\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>;\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 PanelProps = {\n glContainer: Container;\n glEventHub: EventEmitter;\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<T = PanelProps> = (\n props: T,\n dashboardId: string\n) => PanelProps;\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: <P extends PanelProps, C extends ComponentType<P>>(\n name: string,\n ComponentType: PanelComponentType<P, C>,\n hydrate?: PanelHydrateFunction<P>,\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":"AAAA,SAAoBA,aAApB,QAAyC,OAAzC;AAEA,OAAOC,YAAP,MAAyB,0BAAzB;OAMOC,Y;AAYP,OAAO,SAASC,kBAAT,CAGLC,IAHK,EAG+D;EACpE,OAAO,CAACA,IAAD,aAACA,IAAD,uBAACA,IAAD,CAAsCC,gBAAtC,MAA2DC,SAAlE;AACD;;AAmED;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAT,CACLC,KADK,EAEmC;EACxC,OACE,OAAOA,KAAK,CAACC,EAAb,KAAoB,QAApB,IACAD,KAAK,CAACE,MAAN,YAAwBT,YADxB,IAEAO,KAAK,CAACG,YAAN,YAA8BT,YAF9B,IAGA,OAAOM,KAAK,CAACI,iBAAb,KAAmC,UAJrC;AAMD;AAED,OAAO,SAASC,4BAAT,CACLL,KADK,EAE2C;EAChD,IAAI,CAACD,sBAAsB,CAACC,KAAD,CAA3B,EAAoC;IAClC,MAAM,IAAIM,KAAJ,iEACqDN,KADrD,EAAN;EAGD;AACF"}
@@ -1,6 +1,6 @@
1
1
  import { ComponentType } from 'react';
2
2
  import GoldenLayout from '@deephaven/golden-layout';
3
- import type { ContentItem, ItemConfigType, ReactComponentConfig } from '@deephaven/golden-layout';
3
+ import type { Container, ContentItem, ItemConfigType, ReactComponentConfig } from '@deephaven/golden-layout';
4
4
  import { PanelComponent, PanelComponentType, PanelProps } from './DashboardPlugin';
5
5
  export declare type PanelHydraterFunction = (name: string, props: PanelProps) => PanelProps;
6
6
  export declare type PanelDehydraterFunction = (name: string, config: ReactComponentConfig) => ReactComponentConfig;
@@ -56,9 +56,9 @@ declare class PanelManager {
56
56
  */
57
57
  handleReopen(panelConfig: ClosedPanel, replaceConfig?: Partial<ItemConfigType>): void;
58
58
  handleDeleted(panelConfig: ClosedPanel): void;
59
- handleClosed(panelId: string, glContainer: GoldenLayout.Container): void;
59
+ handleClosed(panelId: string, glContainer: Container): void;
60
60
  handleControlClose(id: string): void;
61
- addClosedPanel(glContainer: GoldenLayout.Container): void;
61
+ addClosedPanel(glContainer: Container): void;
62
62
  sendUpdate(): void;
63
63
  }
64
64
  export default PanelManager;
@@ -1 +1 @@
1
- {"version":3,"file":"PanelManager.d.ts","sourceRoot":"","sources":["../src/PanelManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAEL,cAAc,EACd,k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AAa,CAAC,CAAC,CAAC,EAC7C,KAAK,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS;IAYnE,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAcxC,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAuBxC,uBAAuB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAavD,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAKxC,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAMxC,aAAa,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAM1C;;;;OAIG;IACH,YAAY,CACV,WAAW,EAAE,WAAW,EACxB,aAAa,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GACtC,IAAI;IAoBP,aAAa,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAQ7C,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,GAAG,IAAI;IAQ3D,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAMpC,cAAc,CAAC,WAAW,EAAE,SAAS,GAAG,IAAI;IAa5C,UAAU,IAAI,IAAI;CAOnB;AAED,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"PanelManager.js","names":["Log","PanelEvent","LayoutUtils","isReactComponentConfig","isWrappedComponent","log","module","PanelManager","constructor","layout","hydrateComponent","name","props","dehydrateComponent","config","openedMap","Map","closed","onPanelsUpdated","undefined","handleFocus","bind","handleMount","handleUnmount","handleReopen","handleDeleted","handleClosed","handleControlClose","startListening","eventHub","on","FOCUS","MOUNT","UNMOUNT","REOPEN","DELETE","CLOSED","CLOSE","stopListening","off","getClosedPanelConfigsOfType","typeString","filter","panel","component","getOpenedPanels","Array","from","values","getOpenedPanelConfigs","map","glContainer","getComponentConfigFromContainer","getOpenedPanelConfigsOfType","getOpenedPanelById","panelId","get","getContainerByPanelId","stack","getStackForConfig","root","id","getContentItemInStack","getLastUsedPanel","matcher","opened","i","length","getLastUsedPanelOfType","type","getLastUsedPanelOfTypes","types","some","WrappedComponent","updatePanel","getIdFromPanel","error","debug2","delete","set","removePanel","has","debug","removeClosedPanelConfig","panelConfig","index","findIndex","closedConfig","splice","sendUpdate","replaceConfig","openComponent","addClosedPanel","closeComponent","dehydratedConfig","push"],"sources":["../src/PanelManager.ts"],"sourcesContent":["import { ComponentType } from 'react';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type {\n ContentItem,\n ItemConfigType,\n ReactComponentConfig,\n} from '@deephaven/golden-layout';\nimport Log from '@deephaven/log';\nimport PanelEvent from './PanelEvent';\nimport LayoutUtils, { isReactComponentConfig } from './layout/LayoutUtils';\nimport {\n isWrappedComponent,\n PanelComponent,\n PanelComponentType,\n PanelProps,\n} from './DashboardPlugin';\n\nconst log = Log.module('PanelManager');\n\nexport type PanelHydraterFunction = (\n name: string,\n props: PanelProps\n) => PanelProps;\n\nexport type PanelDehydraterFunction = (\n name: string,\n config: ReactComponentConfig\n) => ReactComponentConfig;\n\nexport type ClosedPanel = ReactComponentConfig;\n\nexport type ClosedPanels = ClosedPanel[];\n\nexport type OpenedPanelMap = Map<string | string[], PanelComponent>;\n\nexport type PanelsUpdateData = {\n closed: ClosedPanels;\n openedMap: OpenedPanelMap;\n};\n\nexport type PanelsUpdateCallback = (panelUpdateData: PanelsUpdateData) => void;\n\n/**\n * Class to keep track of which panels are open, have been closed, and also events to close panels.\n */\nclass PanelManager {\n static MAX_CLOSED_PANEL_COUNT = 100;\n\n layout: GoldenLayout;\n\n hydrateComponent: PanelHydraterFunction;\n\n dehydrateComponent: PanelDehydraterFunction;\n\n onPanelsUpdated: PanelsUpdateCallback;\n\n closed: ClosedPanels;\n\n openedMap: OpenedPanelMap;\n\n /**\n * @param layout The GoldenLayout object to attach to\n * @param hydrateComponent Function to hydrate a panel from a dehydrated state\n * @param dehydrateComponent Function to dehydrate a panel\n * @param openedMap Map of opened panels\n * @param closed Array of closed panels in a dehydrated state\n * @param onPanelsUpdated Triggered when the panels are updated\n */\n constructor(\n layout: GoldenLayout,\n hydrateComponent: PanelHydraterFunction = (name, props) => props,\n dehydrateComponent: PanelDehydraterFunction = (name, config) => config,\n openedMap: OpenedPanelMap = new Map(),\n closed: ClosedPanel[] = [],\n onPanelsUpdated: PanelsUpdateCallback = () => undefined\n ) {\n this.handleFocus = this.handleFocus.bind(this);\n this.handleMount = this.handleMount.bind(this);\n // Panel can be unmounted on error but still keep the tab until it's closed\n // Use PanelEvent.MOUNT/UNMOUNT to track open (active) panels\n // and PanelEvent.CLOSED for cleanup (delete links, add panel to closed panels list, etc)\n this.handleUnmount = this.handleUnmount.bind(this);\n this.handleReopen = this.handleReopen.bind(this);\n this.handleDeleted = this.handleDeleted.bind(this);\n this.handleClosed = this.handleClosed.bind(this);\n this.handleControlClose = this.handleControlClose.bind(this);\n\n this.layout = layout;\n this.hydrateComponent = hydrateComponent;\n this.dehydrateComponent = dehydrateComponent;\n this.onPanelsUpdated = onPanelsUpdated;\n\n // Store the opened and closed panels\n this.openedMap = new Map(openedMap);\n\n // Closed panels are stored in their dehydrated state\n this.closed = [...closed];\n\n this.startListening();\n }\n\n startListening(): void {\n const { eventHub } = this.layout;\n eventHub.on(PanelEvent.FOCUS, this.handleFocus);\n eventHub.on(PanelEvent.MOUNT, this.handleMount);\n eventHub.on(PanelEvent.UNMOUNT, this.handleUnmount);\n eventHub.on(PanelEvent.REOPEN, this.handleReopen);\n eventHub.on(PanelEvent.DELETE, this.handleDeleted);\n eventHub.on(PanelEvent.CLOSED, this.handleClosed);\n eventHub.on(PanelEvent.CLOSE, this.handleControlClose);\n // PanelEvent.OPEN should be listened to by plugins to open a panel\n }\n\n stopListening(): void {\n const { eventHub } = this.layout;\n eventHub.off(PanelEvent.FOCUS, this.handleFocus);\n eventHub.off(PanelEvent.MOUNT, this.handleMount);\n eventHub.off(PanelEvent.UNMOUNT, this.handleUnmount);\n eventHub.off(PanelEvent.REOPEN, this.handleReopen);\n eventHub.off(PanelEvent.DELETE, this.handleDeleted);\n eventHub.off(PanelEvent.CLOSED, this.handleClosed);\n eventHub.off(PanelEvent.CLOSE, this.handleControlClose);\n }\n\n getClosedPanelConfigsOfType(typeString: string): ClosedPanels {\n return this.closed.filter(panel => panel.component === typeString);\n }\n\n getOpenedPanels(): PanelComponent[] {\n return Array.from(this.openedMap.values());\n }\n\n getOpenedPanelConfigs(): (ItemConfigType | null)[] {\n return this.getOpenedPanels().map(panel => {\n const { glContainer } = panel.props;\n return LayoutUtils.getComponentConfigFromContainer(glContainer);\n });\n }\n\n getOpenedPanelConfigsOfType(typeString: string): ReactComponentConfig[] {\n return this.getOpenedPanelConfigs().filter(\n config =>\n config != null &&\n isReactComponentConfig(config) &&\n config.component === typeString\n ) as ReactComponentConfig[];\n }\n\n getOpenedPanelById(panelId: string | string[]): PanelComponent | undefined {\n return this.openedMap.get(panelId);\n }\n\n getContainerByPanelId(panelId: string | string[]): ContentItem | null {\n const stack = LayoutUtils.getStackForConfig(this.layout.root, {\n id: panelId,\n });\n return (\n (stack && LayoutUtils.getContentItemInStack(stack, { id: panelId })) ??\n null\n );\n }\n\n getLastUsedPanel<T extends PanelComponent = PanelComponent>(\n matcher: (panel: PanelComponent) => boolean\n ): T | undefined {\n const opened = this.getOpenedPanels();\n for (let i = opened.length - 1; i >= 0; i -= 1) {\n const panel = opened[i];\n if (matcher == null || matcher(panel)) {\n return panel as T;\n }\n }\n\n return undefined;\n }\n\n getLastUsedPanelOfType<\n P extends PanelProps = PanelProps,\n C extends ComponentType<P> = ComponentType<P>\n >(type: PanelComponentType<P, C>): PanelComponent<P> | undefined {\n return this.getLastUsedPanelOfTypes([type]);\n }\n\n getLastUsedPanelOfTypes<\n P extends PanelProps = PanelProps,\n C extends ComponentType<P> = ComponentType<P>\n >(types: PanelComponentType<P, C>[]): PanelComponent<P> | undefined {\n return this.getLastUsedPanel(panel =>\n types.some(\n type =>\n panel instanceof type ||\n (isWrappedComponent(type) &&\n type.WrappedComponent &&\n panel instanceof type.WrappedComponent)\n )\n );\n }\n\n updatePanel(panel: PanelComponent): void {\n const panelId = LayoutUtils.getIdFromPanel(panel);\n if (panelId == null) {\n log.error('updatePanel Panel did not have an ID', panel);\n return;\n }\n log.debug2(`Updating panel ID ${panelId} in open panels map`);\n // Delete the entry before it's set to maintain correct ordering in the open panels map.\n // The last updated (focused) panel should be the last inserted.\n // Deleting the entry from the map directly instead of calling this.removePanel to skip the checks.\n this.openedMap.delete(panelId);\n this.openedMap.set(panelId, panel);\n }\n\n removePanel(panel: PanelComponent): void {\n const panelId = LayoutUtils.getIdFromPanel(panel);\n if (panelId == null) {\n log.error('removePanel Panel did not have an ID', panel);\n return;\n }\n if (!this.openedMap.has(panelId)) {\n log.error(`Missing panel ID ${panelId} in open panels map`);\n return;\n }\n if (this.openedMap.get(panelId) !== panel) {\n // We mount a new panel before un-mounting the existing one\n // when replacing existing panels in openComponent/openComponentInStack.\n // Skip map delete if the panelId entry already refers to the new panel.\n log.debug(\n `Panel argument doesn't match the open panels map entry for ${panelId}, removePanel ignored`\n );\n return;\n }\n log.debug2(`Removing panel ID ${panelId} from open panels map`);\n this.openedMap.delete(panelId);\n }\n\n removeClosedPanelConfig(panelConfig: ClosedPanel): void {\n const index = this.closed.findIndex(\n closedConfig =>\n closedConfig === panelConfig ||\n (closedConfig.id != null &&\n panelConfig.id &&\n closedConfig.id === panelConfig.id)\n );\n if (index >= 0) {\n this.closed.splice(index, 1);\n }\n }\n\n handleFocus(panel: PanelComponent): void {\n log.debug2('Focus: ', panel);\n this.updatePanel(panel);\n }\n\n handleMount(panel: PanelComponent): void {\n log.debug2('Mount: ', panel);\n this.updatePanel(panel);\n this.sendUpdate();\n }\n\n handleUnmount(panel: PanelComponent): void {\n log.debug2('Unmount: ', panel);\n this.removePanel(panel);\n this.sendUpdate();\n }\n\n /**\n *\n * @param panelConfig The config to hydrate and load\n * @param replaceConfig The config to place\n */\n handleReopen(\n panelConfig: ClosedPanel,\n replaceConfig?: Partial<ItemConfigType>\n ): void {\n log.debug2('Reopen:', panelConfig, replaceConfig);\n\n this.removeClosedPanelConfig(panelConfig);\n // Don't need to send an update yet, it will get sent when component is mounted\n\n // Rehydrate the panel before adding it back\n const { component } = panelConfig;\n let { props } = panelConfig;\n props = this.hydrateComponent(component, props);\n\n const config = {\n ...panelConfig,\n props,\n };\n\n const { root } = this.layout;\n LayoutUtils.openComponent({ root, config, replaceConfig });\n }\n\n handleDeleted(panelConfig: ClosedPanel): void {\n log.debug2('Deleted:', panelConfig);\n\n this.removeClosedPanelConfig(panelConfig);\n\n this.sendUpdate();\n }\n\n handleClosed(panelId: string, glContainer: GoldenLayout.Container): void {\n // Panel component should be already unmounted at this point\n // so the emitted event sends the container object instead of the panel.\n log.debug2('Closed: ', panelId);\n this.addClosedPanel(glContainer);\n this.sendUpdate();\n }\n\n handleControlClose(id: string): void {\n const config = { id };\n const { root } = this.layout;\n LayoutUtils.closeComponent(root, config);\n }\n\n addClosedPanel(glContainer: GoldenLayout.Container): void {\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n if (config && isReactComponentConfig(config)) {\n const dehydratedConfig = this.dehydrateComponent(\n config.component,\n config\n );\n if (dehydratedConfig != null) {\n this.closed.push(dehydratedConfig);\n }\n }\n }\n\n sendUpdate(): void {\n const { closed, openedMap } = this;\n this.onPanelsUpdated({\n closed: [...closed],\n openedMap: new Map(openedMap),\n });\n }\n}\n\nexport default PanelManager;\n"],"mappings":";;;;;;AAOA,OAAOA,GAAP,MAAgB,gBAAhB;OACOC,U;OACAC,W,IAAeC,sB;SAEpBC,kB;AAMF,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAJ,CAAW,cAAX,CAAZ;;AAyBA;AACA;AACA;AACA,MAAMC,YAAN,CAAmB;EAejB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,WAAW,CACTC,MADS,EAOT;IAAA,I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IgF,gBAAgB,IAAI,IAAxB,EAA8B;QAC5B,KAAK7E,MAAL,CAAY8E,IAAZ,CAAiBD,gBAAjB;MACD;IACF;EACF;;EAEDL,UAAU,GAAS;IACjB,IAAM;MAAExE,MAAF;MAAUF;IAAV,IAAwB,IAA9B;IACA,KAAKG,eAAL,CAAqB;MACnBD,MAAM,EAAE,CAAC,GAAGA,MAAJ,CADW;MAEnBF,SAAS,EAAE,IAAIC,GAAJ,CAAQD,SAAR;IAFQ,CAArB;EAID;;AAjSgB;;gBAAbR,Y,4BAC4B,G;;AAmSlC,eAAeA,YAAf"}
1
+ {"version":3,"file":"PanelManager.js","names":["Log","PanelEvent","LayoutUtils","isReactComponentConfig","isWrappedComponent","log","module","PanelManager","constructor","layout","hydrateComponent","name","props","dehydrateComponent","config","openedMap","Map","closed","onPanelsUpdated","undefined","handleFocus","bind","handleMount","handleUnmount","handleReopen","handleDeleted","handleClosed","handleControlClose","startListening","eventHub","on","FOCUS","MOUNT","UNMOUNT","REOPEN","DELETE","CLOSED","CLOSE","stopListening","off","getClosedPanelConfigsOfType","typeString","filter","panel","component","getOpenedPanels","Array","from","values","getOpenedPanelConfigs","map","glContainer","getComponentConfigFromContainer","getOpenedPanelConfigsOfType","getOpenedPanelById","panelId","get","getContainerByPanelId","stack","getStackForConfig","root","id","getContentItemInStack","getLastUsedPanel","matcher","opened","i","length","getLastUsedPanelOfType","type","getLastUsedPanelOfTypes","types","some","WrappedComponent","updatePanel","getIdFromPanel","error","debug2","delete","set","removePanel","has","debug","removeClosedPanelConfig","panelConfig","index","findIndex","closedConfig","splice","sendUpdate","replaceConfig","openComponent","addClosedPanel","closeComponent","dehydratedConfig","push"],"sources":["../src/PanelManager.ts"],"sourcesContent":["import { ComponentType } from 'react';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type {\n Container,\n ContentItem,\n ItemConfigType,\n ReactComponentConfig,\n} from '@deephaven/golden-layout';\nimport Log from '@deephaven/log';\nimport PanelEvent from './PanelEvent';\nimport LayoutUtils, { isReactComponentConfig } from './layout/LayoutUtils';\nimport {\n isWrappedComponent,\n PanelComponent,\n PanelComponentType,\n PanelProps,\n} from './DashboardPlugin';\n\nconst log = Log.module('PanelManager');\n\nexport type PanelHydraterFunction = (\n name: string,\n props: PanelProps\n) => PanelProps;\n\nexport type PanelDehydraterFunction = (\n name: string,\n config: ReactComponentConfig\n) => ReactComponentConfig;\n\nexport type ClosedPanel = ReactComponentConfig;\n\nexport type ClosedPanels = ClosedPanel[];\n\nexport type OpenedPanelMap = Map<string | string[], PanelComponent>;\n\nexport type PanelsUpdateData = {\n closed: ClosedPanels;\n openedMap: OpenedPanelMap;\n};\n\nexport type PanelsUpdateCallback = (panelUpdateData: PanelsUpdateData) => void;\n\n/**\n * Class to keep track of which panels are open, have been closed, and also events to close panels.\n */\nclass PanelManager {\n static MAX_CLOSED_PANEL_COUNT = 100;\n\n layout: GoldenLayout;\n\n hydrateComponent: PanelHydraterFunction;\n\n dehydrateComponent: PanelDehydraterFunction;\n\n onPanelsUpdated: PanelsUpdateCallback;\n\n closed: ClosedPanels;\n\n openedMap: OpenedPanelMap;\n\n /**\n * @param layout The GoldenLayout object to attach to\n * @param hydrateComponent Function to hydrate a panel from a dehydrated state\n * @param dehydrateComponent Function to dehydrate a panel\n * @param openedMap Map of opened panels\n * @param closed Array of closed panels in a dehydrated state\n * @param onPanelsUpdated Triggered when the panels are updated\n */\n constructor(\n layout: GoldenLayout,\n hydrateComponent: PanelHydraterFunction = (name, props) => props,\n dehydrateComponent: PanelDehydraterFunction = (name, config) => config,\n openedMap: OpenedPanelMap = new Map(),\n closed: ClosedPanel[] = [],\n onPanelsUpdated: PanelsUpdateCallback = () => undefined\n ) {\n this.handleFocus = this.handleFocus.bind(this);\n this.handleMount = this.handleMount.bind(this);\n // Panel can be unmounted on error but still keep the tab until it's closed\n // Use PanelEvent.MOUNT/UNMOUNT to track open (active) panels\n // and PanelEvent.CLOSED for cleanup (delete links, add panel to closed panels list, etc)\n this.handleUnmount = this.handleUnmount.bind(this);\n this.handleReopen = this.handleReopen.bind(this);\n this.handleDeleted = this.handleDeleted.bind(this);\n this.handleClosed = this.handleClosed.bind(this);\n this.handleControlClose = this.handleControlClose.bind(this);\n\n this.layout = layout;\n this.hydrateComponent = hydrateComponent;\n this.dehydrateComponent = dehydrateComponent;\n this.onPanelsUpdated = onPanelsUpdated;\n\n // Store the opened and closed panels\n this.openedMap = new Map(openedMap);\n\n // Closed panels are stored in their dehydrated state\n this.closed = [...closed];\n\n this.startListening();\n }\n\n startListening(): void {\n const { eventHub } = this.layout;\n eventHub.on(PanelEvent.FOCUS, this.handleFocus);\n eventHub.on(PanelEvent.MOUNT, this.handleMount);\n eventHub.on(PanelEvent.UNMOUNT, this.handleUnmount);\n eventHub.on(PanelEvent.REOPEN, this.handleReopen);\n eventHub.on(PanelEvent.DELETE, this.handleDeleted);\n eventHub.on(PanelEvent.CLOSED, this.handleClosed);\n eventHub.on(PanelEvent.CLOSE, this.handleControlClose);\n // PanelEvent.OPEN should be listened to by plugins to open a panel\n }\n\n stopListening(): void {\n const { eventHub } = this.layout;\n eventHub.off(PanelEvent.FOCUS, this.handleFocus);\n eventHub.off(PanelEvent.MOUNT, this.handleMount);\n eventHub.off(PanelEvent.UNMOUNT, this.handleUnmount);\n eventHub.off(PanelEvent.REOPEN, this.handleReopen);\n eventHub.off(PanelEvent.DELETE, this.handleDeleted);\n eventHub.off(PanelEvent.CLOSED, this.handleClosed);\n eventHub.off(PanelEvent.CLOSE, this.handleControlClose);\n }\n\n getClosedPanelConfigsOfType(typeString: string): ClosedPanels {\n return this.closed.filter(panel => panel.component === typeString);\n }\n\n getOpenedPanels(): PanelComponent[] {\n return Array.from(this.openedMap.values());\n }\n\n getOpenedPanelConfigs(): (ItemConfigType | null)[] {\n return this.getOpenedPanels().map(panel => {\n const { glContainer } = panel.props;\n return LayoutUtils.getComponentConfigFromContainer(glContainer);\n });\n }\n\n getOpenedPanelConfigsOfType(typeString: string): ReactComponentConfig[] {\n return this.getOpenedPanelConfigs().filter(\n config =>\n config != null &&\n isReactComponentConfig(config) &&\n config.component === typeString\n ) as ReactComponentConfig[];\n }\n\n getOpenedPanelById(panelId: string | string[]): PanelComponent | undefined {\n return this.openedMap.get(panelId);\n }\n\n getContainerByPanelId(panelId: string | string[]): ContentItem | null {\n const stack = LayoutUtils.getStackForConfig(this.layout.root, {\n id: panelId,\n });\n return (\n (stack && LayoutUtils.getContentItemInStack(stack, { id: panelId })) ??\n null\n );\n }\n\n getLastUsedPanel<T extends PanelComponent = PanelComponent>(\n matcher: (panel: PanelComponent) => boolean\n ): T | undefined {\n const opened = this.getOpenedPanels();\n for (let i = opened.length - 1; i >= 0; i -= 1) {\n const panel = opened[i];\n if (matcher == null || matcher(panel)) {\n return panel as T;\n }\n }\n\n return undefined;\n }\n\n getLastUsedPanelOfType<\n P extends PanelProps = PanelProps,\n C extends ComponentType<P> = ComponentType<P>\n >(type: PanelComponentType<P, C>): PanelComponent<P> | undefined {\n return this.getLastUsedPanelOfTypes([type]);\n }\n\n getLastUsedPanelOfTypes<\n P extends PanelProps = PanelProps,\n C extends ComponentType<P> = ComponentType<P>\n >(types: PanelComponentType<P, C>[]): PanelComponent<P> | undefined {\n return this.getLastUsedPanel(panel =>\n types.some(\n type =>\n panel instanceof type ||\n (isWrappedComponent(type) &&\n type.WrappedComponent &&\n panel instanceof type.WrappedComponent)\n )\n );\n }\n\n updatePanel(panel: PanelComponent): void {\n const panelId = LayoutUtils.getIdFromPanel(panel);\n if (panelId == null) {\n log.error('updatePanel Panel did not have an ID', panel);\n return;\n }\n log.debug2(`Updating panel ID ${panelId} in open panels map`);\n // Delete the entry before it's set to maintain correct ordering in the open panels map.\n // The last updated (focused) panel should be the last inserted.\n // Deleting the entry from the map directly instead of calling this.removePanel to skip the checks.\n this.openedMap.delete(panelId);\n this.openedMap.set(panelId, panel);\n }\n\n removePanel(panel: PanelComponent): void {\n const panelId = LayoutUtils.getIdFromPanel(panel);\n if (panelId == null) {\n log.error('removePanel Panel did not have an ID', panel);\n return;\n }\n if (!this.openedMap.has(panelId)) {\n log.error(`Missing panel ID ${panelId} in open panels map`);\n return;\n }\n if (this.openedMap.get(panelId) !== panel) {\n // We mount a new panel before un-mounting the existing one\n // when replacing existing panels in openComponent/openComponentInStack.\n // Skip map delete if the panelId entry already refers to the new panel.\n log.debug(\n `Panel argument doesn't match the open panels map entry for ${panelId}, removePanel ignored`\n );\n return;\n }\n log.debug2(`Removing panel ID ${panelId} from open panels map`);\n this.openedMap.delete(panelId);\n }\n\n removeClosedPanelConfig(panelConfig: ClosedPanel): void {\n const index = this.closed.findIndex(\n closedConfig =>\n closedConfig === panelConfig ||\n (closedConfig.id != null &&\n panelConfig.id &&\n closedConfig.id === panelConfig.id)\n );\n if (index >= 0) {\n this.closed.splice(index, 1);\n }\n }\n\n handleFocus(panel: PanelComponent): void {\n log.debug2('Focus: ', panel);\n this.updatePanel(panel);\n }\n\n handleMount(panel: PanelComponent): void {\n log.debug2('Mount: ', panel);\n this.updatePanel(panel);\n this.sendUpdate();\n }\n\n handleUnmount(panel: PanelComponent): void {\n log.debug2('Unmount: ', panel);\n this.removePanel(panel);\n this.sendUpdate();\n }\n\n /**\n *\n * @param panelConfig The config to hydrate and load\n * @param replaceConfig The config to place\n */\n handleReopen(\n panelConfig: ClosedPanel,\n replaceConfig?: Partial<ItemConfigType>\n ): void {\n log.debug2('Reopen:', panelConfig, replaceConfig);\n\n this.removeClosedPanelConfig(panelConfig);\n // Don't need to send an update yet, it will get sent when component is mounted\n\n // Rehydrate the panel before adding it back\n const { component } = panelConfig;\n let { props } = panelConfig;\n props = this.hydrateComponent(component, props);\n\n const config = {\n ...panelConfig,\n props,\n };\n\n const { root } = this.layout;\n LayoutUtils.openComponent({ root, config, replaceConfig });\n }\n\n handleDeleted(panelConfig: ClosedPanel): void {\n log.debug2('Deleted:', panelConfig);\n\n this.removeClosedPanelConfig(panelConfig);\n\n this.sendUpdate();\n }\n\n handleClosed(panelId: string, glContainer: Container): void {\n // Panel component should be already unmounted at this point\n // so the emitted event sends the container object instead of the panel.\n log.debug2('Closed: ', panelId);\n this.addClosedPanel(glContainer);\n this.sendUpdate();\n }\n\n handleControlClose(id: string): void {\n const config = { id };\n const { root } = this.layout;\n LayoutUtils.closeComponent(root, config);\n }\n\n addClosedPanel(glContainer: Container): void {\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n if (config && isReactComponentConfig(config)) {\n const dehydratedConfig = this.dehydrateComponent(\n config.component,\n config\n );\n if (dehydratedConfig != null) {\n this.closed.push(dehydratedConfig);\n }\n }\n }\n\n sendUpdate(): void {\n const { closed, openedMap } = this;\n this.onPanelsUpdated({\n closed: [...closed],\n openedMap: new Map(openedMap),\n });\n }\n}\n\nexport default PanelManager;\n"],"mappings":";;;;;;AAQA,OAAOA,GAAP,MAAgB,gBAAhB;OACOC,U;OACAC,W,IAAeC,sB;SAEpBC,kB;AAMF,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAJ,CAAW,cAAX,CAAZ;;AAyBA;AACA;AACA;AACA,MAAMC,YAAN,CAAmB;EAejB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,WAAW,CACTC,MADS,EAOT;IAAA,IALAC,gBAKA,uEAL0C,CAACC,IAAD,EAAOC,KAAP,KAAiBA,KAK3D;IAAA,IAJAC,kBAIA,uEAJ8C,CAACF,IAAD,EAAOG,MAAP,KAAkBA,MAIhE;IAAA,IAHAC,SAGA,uEAH4B,IAAIC,GAAJ,EAG5B;IAAA,IAFAC,MAEA,uEAFwB,EAExB;IAAA,IADAC,eACA,uEADwC,MAAMC,SAC9C;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IACA,KAAKC,WAAL,GAAmB,KAAKA,WAAL,CAAiBC,IAAjB,CAAsB,IAAtB,CAAnB;IACA,KAAKC,WAAL,GAAmB,KAAKA,WAAL,CAAiBD,IAAjB,CAAsB,IAAtB,CAAnB,CAFA,CAGA;IACA;IACA;;IACA,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,CAACwE,MAAJ,CAAW,UAAX,EAAuBO,WAAvB;IAEA,KAAKD,uBAAL,CAA6BC,WAA7B;IAEA,KAAKK,UAAL;EACD;;EAED/D,YAAY,CAAC6B,OAAD,EAAkBJ,WAAlB,EAAgD;IAC1D;IACA;IACA9C,GAAG,CAACwE,MAAJ,CAAW,UAAX,EAAuBtB,OAAvB;IACA,KAAKqC,cAAL,CAAoBzC,WAApB;IACA,KAAKsC,UAAL;EACD;;EAED9D,kBAAkB,CAACkC,EAAD,EAAmB;IACnC,IAAM/C,MAAM,GAAG;MAAE+C;IAAF,CAAf;IACA,IAAM;MAAED;IAAF,IAAW,KAAKnD,MAAtB;IACAP,WAAW,CAAC2F,cAAZ,CAA2BjC,IAA3B,EAAiC9C,MAAjC;EACD;;EAED8E,cAAc,CAACzC,WAAD,EAA+B;IAC3C,IAAMrC,MAAM,GAAGZ,WAAW,CAACkD,+BAAZ,CAA4CD,WAA5C,CAAf;;IACA,IAAIrC,MAAM,IAAIX,sBAAsB,CAACW,MAAD,CAApC,EAA8C;MAC5C,IAAMgF,gBAAgB,GAAG,KAAKjF,kBAAL,CACvBC,MAAM,CAAC8B,SADgB,EAEvB9B,MAFuB,CAAzB;;MAIA,IAAIgF,gBAAgB,IAAI,IAAxB,EAA8B;QAC5B,KAAK7E,MAAL,CAAY8E,IAAZ,CAAiBD,gBAAjB;MACD;IACF;EACF;;EAEDL,UAAU,GAAS;IACjB,IAAM;MAAExE,MAAF;MAAUF;IAAV,IAAwB,IAA9B;IACA,KAAKG,eAAL,CAAqB;MACnBD,MAAM,EAAE,CAAC,GAAGA,MAAJ,CADW;MAEnBF,SAAS,EAAE,IAAIC,GAAJ,CAAQD,SAAR;IAFQ,CAArB;EAID;;AAjSgB;;gBAAbR,Y,4BAC4B,G;;AAmSlC,eAAeA,YAAf"}
@@ -1,6 +1,6 @@
1
1
  import { DragEvent } from 'react';
2
2
  import GoldenLayout from '@deephaven/golden-layout';
3
- import type { Config, Container, ContentItem, ItemConfig, ItemConfigType, ReactComponentConfig, Tab } from '@deephaven/golden-layout';
3
+ import type { Config, Container, ContentItem, ItemConfig, ItemConfigType, ReactComponentConfig, Stack, Tab } from '@deephaven/golden-layout';
4
4
  import { DashboardLayoutConfig } from '../DashboardLayout';
5
5
  import { PanelConfig } from '../DashboardPlugin';
6
6
  declare type LayoutConfig = {
@@ -26,13 +26,13 @@ declare class LayoutUtils {
26
26
  * @param parent A GoldenLayout content item to add the stack to
27
27
  * @returns The newly created stack.
28
28
  */
29
- static addStack(parent: ContentItem, columnPreferred?: boolean): ContentItem;
29
+ static addStack(parent: ContentItem, columnPreferred?: boolean): Stack;
30
30
  /**
31
31
  * Gets the first stack which contains a contentItem with the given config values
32
32
  * @param item Golden layout content item to search for the stack
33
- * @param config The item properties to match
33
+ * @param config The item properties to match
34
34
  */
35
- static getStackForConfig(item: ContentItem, config?: Partial<ItemConfigType>, allowEmptyStack?: boolean): ContentItem | null;
35
+ static getStackForConfig(item: ContentItem, config?: Partial<ItemConfigType>, allowEmptyStack?: boolean): Stack | null;
36
36
  /**
37
37
  * Gets a stack matching the specified config
38
38
  * @param root The root GoldenLayout element
@@ -41,7 +41,7 @@ declare class LayoutUtils {
41
41
  * @param matchComponentType If the config doesn't match exactly, just find another one of the same component type
42
42
  * @param allowEmptyStack If no configs match, search for an empty stack that can be used
43
43
  */
44
- static getStackForRoot(root: ContentItem, config: Partial<ReactComponentConfig>, createIfNecessary?: boolean, matchComponentType?: boolean, allowEmptyStack?: boolean): ContentItem | null;
44
+ static getStackForRoot(root: ContentItem, config: Partial<ReactComponentConfig>, createIfNecessary?: boolean, matchComponentType?: boolean, allowEmptyStack?: boolean): Stack | null;
45
45
  /**
46
46
  * Gets a stack matching one of the specified types, creates new stack if necessary
47
47
  * @param root The GoldenLayout root to find or create the stack in
@@ -50,7 +50,7 @@ declare class LayoutUtils {
50
50
  * @param matchComponentType If the config doesn't match exactly, just find another one of the same component type
51
51
  * @param allowEmptyStack If no configs match, search for an empty stack that can be used
52
52
  */
53
- static getStackForComponentTypes(root: ContentItem, types: string[], createIfNecessary?: boolean, matchComponentType?: boolean, allowEmptyStack?: boolean): ContentItem | null;
53
+ static getStackForComponentTypes(root: ContentItem, types: string[], createIfNecessary?: boolean, matchComponentType?: boolean, allowEmptyStack?: boolean): Stack | null;
54
54
  /**
55
55
  * Gets first content item with the specified config in stack.
56
56
  * @param stack The stack to search for the item
@@ -106,7 +106,7 @@ declare class LayoutUtils {
106
106
  */
107
107
  static openComponent({ root, config: configParam, replaceExisting, replaceConfig, createNewStack, focusElement, dragEvent, }?: {
108
108
  root?: ContentItem;
109
- config?: ReactComponentConfig;
109
+ config?: Partial<ReactComponentConfig>;
110
110
  replaceExisting?: boolean;
111
111
  replaceConfig?: Partial<ItemConfigType>;
112
112
  createNewStack?: boolean;
@@ -120,7 +120,7 @@ declare class LayoutUtils {
120
120
  * @param config The component config definition to open
121
121
  * @param replaceExisting Whether it should replace the existing one matching component type and id, or open a new one
122
122
  */
123
- static openComponentInStack(stack: ContentItem | null, config: ItemConfigType, replaceExisting?: boolean): void;
123
+ static openComponentInStack(stack: Stack | null, config: ItemConfigType & Record<string, unknown>, replaceExisting?: boolean): void;
124
124
  /**
125
125
  * Close the specified component and remove it from the stack it's currently in
126
126
  * @param root The GoldenLayout root to search and close the component in
@@ -177,7 +177,7 @@ declare class LayoutUtils {
177
177
  */
178
178
  static getComponentNameFromPanel(panel: {
179
179
  props: {
180
- glContainer: GoldenLayout.Container;
180
+ glContainer: Container;
181
181
  };
182
182
  }): string | null;
183
183
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutUtils.d.ts","sourceRoot":"","sources":["../../src/layout/LayoutUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EAEV,MAAM,EACN,SAAS,EACT,WAAW,EACX,UAAU,EACV,cAAc,EACd,oBAAoB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CAAC,cAAc,CAAC,KAAK,EAAE;QAC3B,KAAK,EAAE;YAAE,WAAW,EAAE,SAAS,CAAA;SAAE,CAAC;KACnC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS;IAKxC;;;;OAIG;IACH,MAAM,CAAC,yBAAyB,CAAC,KAAK,EAAE;QACtC,KAAK,EAAE;YAAE,WAAW,EAAE,SAAS,CAAA;SAAE,CAAC;KACnC,GAAG,MAAM,GAAG,IAAI;IASjB;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE;QACjC,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,gBAAgB,CAAC,EAAE;YAAE,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC7C,GAAG,MAAM;IASV;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,CACjB,OAAO,EAAE,OAAO,EAChB,QAAQ,SAAqC,GAC5C,OAAO,GAAG,IAAI;IAejB;;;;OAIG;IACH,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAa1D;AAED,eAAe,WAAW,CAAC"}
@@ -8,6 +8,7 @@ import deepEqual from 'deep-equal';
8
8
  import shortid from 'shortid';
9
9
  import isMatch from 'lodash.ismatch';
10
10
  import Log from '@deephaven/log';
11
+ import { isRoot, isStack } from '@deephaven/golden-layout';
11
12
  import { assertNotNull } from '@deephaven/utils';
12
13
  import GoldenLayoutThemeExport from "./GoldenLayoutThemeExport.js";
13
14
  var log = Log.module('LayoutUtils');
@@ -79,7 +80,7 @@ class LayoutUtils {
79
80
  var columnPreferred = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
80
81
  var type = columnPreferred ? 'column' : 'row';
81
82
 
82
- if (parent.isRoot) {
83
+ if (isRoot(parent)) {
83
84
  if (parent.contentItems == null || parent.contentItems.length === 0) {
84
85
  parent.addChild({
85
86
  type
@@ -132,7 +133,7 @@ class LayoutUtils {
132
133
  /**
133
134
  * Gets the first stack which contains a contentItem with the given config values
134
135
  * @param item Golden layout content item to search for the stack
135
- * @param config The item properties to match
136
+ * @param config The item properties to match
136
137
  */
137
138
 
138
139
 
@@ -140,7 +141,7 @@ class LayoutUtils {
140
141
  var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
141
142
  var allowEmptyStack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
142
143
 
143
- if (allowEmptyStack && item.isStack && item.contentItems.length === 0) {
144
+ if (allowEmptyStack && isStack(item) && item.contentItems.length === 0) {
144
145
  return item;
145
146
  }
146
147
 
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutUtils.js","names":["deepEqual","shortid","isMatch","Log","assertNotNull","GoldenLayoutThemeExport","log","module","isComponentConfig","config","componentName","undefined","isReactComponentConfig","reactConfig","type","component","isHTMLElement","element","focus","isStackItemConfig","LayoutUtils","activateTab","root","stack","getStackForRoot","error","contentItem","getContentItemInStack","setActiveContentItem","isActiveTab","activeItem","getActiveContentItem","addStack","parent","columnPreferred","isRoot","contentItems","length","addChild","child","isCorrectType","isColumn","isRow","removeChild","maintainFocusElement","document","activeElement","newParent","getStackForConfig","item","allowEmptyStack","isStack","i","isComponent","createIfNecessary","matchComponentType","getStackForComponentTypes","types","isLastType","dehydrateLayoutConfig","dehydrateComponent","dehydratedConfig","itemConfig","content","dehydratedComponent","push","debug2","layoutItemConfig","getTabPoint","glContainer","tab","Error","tabRect","getBoundingClientRect","left","width","bottom","dropLayoutMinorChange","activeItemIndex","props","panelState","id","irisGridState","sorts","quickFilters","isEqual","layout1","layout2","major","layout1Clone","cloneLayout","layout2Clone","layout","JSON","parse","stringify","hydrateLayoutConfig","hydrateComponent","hydratedConfig","contentConfig","warn","openComponent","configParam","replaceExisting","replaceConfig","createNewStack","focusElement","dragEvent","generate","layoutManager","createDragSourceFromEvent","searchConfig","oldContentItem","onComponentCreated","event","debug","off","origin","requestAnimationFrame","on","index","indexOf","openComponentInStack","closeComponent","container","close","contains","renameComponent","newTitle","setTitle","cloneComponent","getPanelComponentState","cloneConfig","title","componentState","makeDefaultLayout","dimensions","headerHeight","tabHeight","borderWidth","dragBorderWidth","borderGrabWidth","settings","showPopoutIcon","showCloseIcon","constrainDragToContainer","getRootFromContainer","getComponentConfigFromContainer","_config","getTitleFromContainer","getTitleFromTab","getIdFromContainer","getIdFromPanel","panel","getComponentNameFromPanel","getComponentName","name","WrappedComponent","displayName","selector","DEFAULT_FOCUS_SELECTOR","querySelector","onInitialized","Promise","resolve","isInitialised","onInit"],"sources":["../../src/layout/LayoutUtils.ts"],"sourcesContent":["import deepEqual from 'deep-equal';\nimport shortid from 'shortid';\nimport isMatch from 'lodash.ismatch';\nimport { DragEvent } from 'react';\nimport Log from '@deephaven/log';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type {\n ComponentConfig,\n Config,\n Container,\n ContentItem,\n ItemConfig,\n ItemConfigType,\n ReactComponentConfig,\n Tab,\n} from '@deephaven/golden-layout';\nimport { assertNotNull } from '@deephaven/utils';\nimport GoldenLayoutThemeExport from './GoldenLayoutThemeExport';\nimport { DashboardLayoutConfig } from '../DashboardLayout';\nimport { PanelConfig } from '../DashboardPlugin';\n\nconst log = Log.module('LayoutUtils');\n\ntype LayoutConfig = { id?: string; component?: string };\n\nexport type StackItemConfig = ItemConfig & {\n activeItemIndex?: number;\n};\n\nfunction isComponentConfig(config: ItemConfigType): config is ComponentConfig {\n return (config as ComponentConfig).componentName !== undefined;\n}\n\nexport function isReactComponentConfig(\n config: ItemConfigType\n): config is ReactComponentConfig {\n const reactConfig = config as ReactComponentConfig;\n // Golden layout sets the type to 'component' and componentName to 'lm-react-component' in `createContentItem`, then changes it back in `toConfig`\n // For our purposes, we need to check both.\n return (\n ((isComponentConfig(config) &&\n config.componentName === 'lm-react-component') ||\n config.type === 'react-component') &&\n reactConfig.component !== undefined\n );\n}\n\nfunction isHTMLElement(element: Element): element is HTMLElement {\n return (element as HTMLElement).focus !== undefined;\n}\n\nfunction isStackItemConfig(config: ItemConfigType): config is StackItemConfig {\n return config.type === 'stack';\n}\nclass LayoutUtils {\n static DEFAULT_FOCUS_SELECTOR = 'input, select, textarea, button';\n\n static activateTab(root: ContentItem, config: Partial<ItemConfigType>): void {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return;\n }\n // Find the tab with the specified table and activate it\n const contentItem = LayoutUtils.getContentItemInStack(stack, config);\n if (contentItem) {\n stack.setActiveContentItem(contentItem);\n }\n }\n\n /**\n * Is the tab with the given config active\n * @param root A GoldenLayout content item with the tab\n * @param config Tab config to match\n * @returns True if the tab is active\n */\n static isActiveTab(root: ContentItem, config: Config): boolean {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return false;\n }\n // Find the item with the specified config and compare with active item\n const contentItem = LayoutUtils.getContentItemInStack(stack, config);\n const activeItem = stack.getActiveContentItem();\n return activeItem === contentItem;\n }\n\n /**\n * Adds a stack to the root layout specified. Adds to the first row/column with only one item\n * @param parent A GoldenLayout content item to add the stack to\n * @returns The newly created stack.\n */\n static addStack(parent: ContentItem, columnPreferred = true): ContentItem {\n const type = columnPreferred ? 'column' : 'row';\n if (parent.isRoot) {\n if (parent.contentItems == null || parent.contentItems.length === 0) {\n parent.addChild({ type });\n }\n\n const child = parent.contentItems[0];\n const isCorrectType = columnPreferred ? child.isColumn : child.isRow;\n if (!isCorrectType) {\n parent.removeChild(child, true);\n parent.addChild({ type });\n\n // The addChild may cause the element that has focus to be removed from the DOM, which changes focus to the body\n // Try and maintain the focus as best we can. The unfocused element may still send a blur/focus event so that needs to be handled correctly.\n const maintainFocusElement = document.activeElement;\n parent.contentItems[0].addChild(child);\n if (\n maintainFocusElement &&\n (maintainFocusElement as HTMLElement).focus != null\n ) {\n (maintainFocusElement as HTMLElement).focus();\n }\n }\n\n return this.addStack(parent.contentItems[0], columnPreferred);\n }\n\n if (parent.contentItems.length < 2) {\n parent.addChild({ type: 'stack' });\n return parent.contentItems[parent.contentItems.length - 1];\n }\n let newParent = parent.contentItems[parent.contentItems.length - 1];\n const isCorrectType = !columnPreferred\n ? newParent.isColumn\n : newParent.isRow;\n if (!isCorrectType) {\n parent.addChild({ type: !columnPreferred ? 'column' : 'row' });\n parent.removeChild(newParent, true);\n parent.contentItems[parent.contentItems.length - 1].addChild(newParent);\n newParent = parent.contentItems[parent.contentItems.length - 1];\n }\n\n return this.addStack(newParent, !columnPreferred);\n }\n\n /**\n * Gets the first stack which contains a contentItem with the given config values\n * @param item Golden layout content item to search for the stack\n * @param config The item properties to match\n */\n static getStackForConfig(\n item: ContentItem,\n config: Partial<ItemConfigType> = {},\n allowEmptyStack = false\n ): ContentItem | null {\n if (allowEmptyStack && item.isStack && item.contentItems.length === 0) {\n return item;\n }\n\n if (item.contentItems == null) {\n return null;\n }\n\n for (let i = 0; i < item.contentItems.length; i += 1) {\n const contentItem = item.contentItems[i];\n if (contentItem.isComponent && contentItem.config != null) {\n if (isMatch(contentItem.config, config)) {\n return item;\n }\n }\n\n const stack = this.getStackForConfig(\n contentItem,\n config,\n allowEmptyStack\n );\n if (stack) {\n return stack;\n }\n }\n\n return null;\n }\n\n /**\n * Gets a stack matching the specified config\n * @param root The root GoldenLayout element\n * @param config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }\n * @param createIfNecessary Whether to create the stack if it does not exist.\n * @param matchComponentType If the config doesn't match exactly, just find another one of the same component type\n * @param allowEmptyStack If no configs match, search for an empty stack that can be used\n */\n static getStackForRoot(\n root: ContentItem,\n config: Partial<ReactComponentConfig>,\n createIfNecessary = true,\n matchComponentType = true,\n allowEmptyStack = true\n ): ContentItem | null {\n let stack = this.getStackForConfig(root, config);\n if (!stack && matchComponentType) {\n stack = this.getStackForConfig(\n root,\n { component: config.component },\n allowEmptyStack\n );\n }\n\n if (!stack && createIfNecessary) {\n stack = this.addStack(root);\n }\n\n return stack;\n }\n\n /**\n * Gets a stack matching one of the specified types, creates new stack if necessary\n * @param root The GoldenLayout root to find or create the stack in\n * @param types The array of component types to match\n * @param createIfNecessary Whether to create the stack if it does not exist\n * @param matchComponentType If the config doesn't match exactly, just find another one of the same component type\n * @param allowEmptyStack If no configs match, search for an empty stack that can be used\n */\n static getStackForComponentTypes(\n root: ContentItem,\n types: string[],\n createIfNecessary = true,\n matchComponentType = true,\n allowEmptyStack = true\n ): ContentItem | null {\n for (let i = 0; i < types.length; i += 1) {\n const component = types[i];\n const isLastType = i === types.length - 1;\n const stack = LayoutUtils.getStackForRoot(\n root,\n { component },\n createIfNecessary && isLastType,\n matchComponentType,\n allowEmptyStack\n );\n if (stack) {\n return stack;\n }\n }\n return null;\n }\n\n /**\n * Gets first content item with the specified config in stack.\n * @param stack The stack to search for the item\n * @param config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }\n * @returns Returns the found content item, null if not found.\n */\n static getContentItemInStack(\n stack: ContentItem | null,\n config: Partial<ItemConfigType>\n ): ContentItem | null {\n if (!stack) {\n return null;\n }\n for (let i = 0; i < stack.contentItems.length; i += 1) {\n const contentItem = stack.contentItems[i];\n if (contentItem.isComponent && contentItem.config != null) {\n if (isMatch(contentItem.config, config)) {\n return contentItem;\n }\n }\n }\n return null;\n }\n\n /**\n * Removes dynamic props from components in the given config so this config could be serialized\n * @param config Config objec\n * @returns Dehydrated config\n */\n static dehydrateLayoutConfig(\n config: ItemConfigType[],\n dehydrateComponent: (\n componentName: string,\n config: ItemConfigType\n ) => PanelConfig\n ): (PanelConfig | ItemConfig)[] {\n if (config == null || !config.length) {\n return [];\n }\n const dehydratedConfig: (PanelConfig | ItemConfig)[] = [];\n\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n const { component, content } = itemConfig as ReactComponentConfig;\n if (component) {\n const dehydratedComponent = dehydrateComponent(component, itemConfig);\n if (dehydratedComponent != null) {\n dehydratedConfig.push(dehydratedComponent);\n } else {\n log.debug2(\n `dehydrateLayoutConfig: skipping unmapped component \"${component}\"`\n );\n }\n } else if (content) {\n const layoutItemConfig = {\n ...itemConfig,\n content: LayoutUtils.dehydrateLayoutConfig(\n content,\n dehydrateComponent\n ),\n };\n dehydratedConfig.push(layoutItemConfig);\n } else {\n dehydratedConfig.push(itemConfig);\n }\n }\n return dehydratedConfig;\n }\n\n static getTabPoint(glContainer: Container): [number, number] {\n const { tab } = glContainer;\n if (tab == null) {\n throw new Error(`Cannot get tab for panel container ${glContainer}`);\n }\n const tabRect = tab.element[0].getBoundingClientRect();\n\n return [tabRect.left + tabRect.width * 0.5, tabRect.bottom - 8];\n }\n\n /**\n * Drop minor changes in Layout Configuration for deep comparison\n * @param config Layout Configuration\n *\n * minor changes:\n * 1. sorts in grid\n * 2. quick filters in grid\n * 3. active item\n *\n * item id is also removed\n */\n static dropLayoutMinorChange(config: DashboardLayoutConfig): void {\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n const { content } = itemConfig;\n if (content !== undefined) {\n if (isStackItemConfig(itemConfig)) {\n delete itemConfig.activeItemIndex;\n }\n LayoutUtils.dropLayoutMinorChange(content);\n } else if (\n isReactComponentConfig(itemConfig) &&\n itemConfig.component === 'IrisGridPanel'\n ) {\n if (itemConfig.props.panelState != null) {\n delete itemConfig.id;\n itemConfig.props.panelState.irisGridState.sorts = [];\n itemConfig.props.panelState.irisGridState.quickFilters = [];\n }\n }\n }\n }\n\n /**\n * Compare two layouts to see if they are equivalent\n * @param layout1 A Golden Layout config object\n * @param layout2 Another Golden layout config object\n * @param major When true, will ignore \"minor\" property differences (eg. sorts)\n */\n static isEqual(\n layout1: DashboardLayoutConfig,\n layout2: DashboardLayoutConfig,\n major = false\n ): boolean {\n if (major) {\n const layout1Clone = LayoutUtils.cloneLayout(layout1);\n const layout2Clone = LayoutUtils.cloneLayout(layout2);\n LayoutUtils.dropLayoutMinorChange(layout1Clone);\n LayoutUtils.dropLayoutMinorChange(layout2Clone);\n return deepEqual(layout1Clone, layout2Clone);\n }\n return deepEqual(layout1, layout2);\n }\n\n static cloneLayout(layout: DashboardLayoutConfig): DashboardLayoutConfig {\n return JSON.parse(JSON.stringify(layout));\n }\n\n /**\n * Adds dynamic props to components in the given config so this config could be used to initialize a layout\n * @param config Dehydrated config object\n * @param hydrateComponent Function to hydrate the component\n * @returns Hydrated config\n */\n static hydrateLayoutConfig(\n config: (PanelConfig | ItemConfig)[],\n hydrateComponent: (\n componentName: string,\n config: PanelConfig | ItemConfig\n ) => ReactComponentConfig\n ): DashboardLayoutConfig {\n if (config == null || !config.length) {\n return [];\n }\n const hydratedConfig = [];\n\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n if (isReactComponentConfig(itemConfig)) {\n const { component, props = {} } = itemConfig;\n hydratedConfig.push({\n ...itemConfig,\n id: itemConfig?.id ?? shortid(),\n props: hydrateComponent(component, props),\n });\n } else if (itemConfig.content !== undefined) {\n const contentConfig = LayoutUtils.hydrateLayoutConfig(\n itemConfig.content,\n hydrateComponent\n );\n if (\n isStackItemConfig(itemConfig) &&\n itemConfig.activeItemIndex != null &&\n itemConfig.activeItemIndex >= contentConfig.length\n ) {\n log.warn(\n 'Fixing bad activeItemIndex!',\n itemConfig.activeItemIndex,\n itemConfig\n );\n itemConfig.activeItemIndex = 0;\n }\n hydratedConfig.push({\n ...itemConfig,\n content: contentConfig,\n });\n } else {\n hydratedConfig.push(itemConfig);\n }\n }\n\n return hydratedConfig;\n }\n\n /**\n * Opens a component. It will try and open the component in an existing stack of the same component.\n * If `replaceExisting` is true and there is a component found with the same `config.id`, it will replace that component with this one.\n * If `allowStack` is true and there is a component of the same type found, it will open in that stack (potentially covering up a panel).\n * @param root The GoldenLayout root to open the component in\n * @param config The component config definition to open\n * @param replaceExisting Whether it should replace the existing one matching component type and id, or open a new one\n * @param replaceConfig The component config to replace\n * @param createNewStack True to force opening in a new stack, false to try and open in a stack with the same type of component.\n * @param focusElement The element to focus on\n * @param dragEvent Whether component is being created with a drag, mouse event is initial position for drag proxy\n */\n static openComponent({\n root,\n config: configParam,\n replaceExisting = true,\n replaceConfig = undefined,\n createNewStack = false,\n focusElement = undefined,\n dragEvent = undefined,\n }: {\n root?: ContentItem;\n config?: ReactComponentConfig;\n replaceExisting?: boolean;\n replaceConfig?: Partial<ItemConfigType>;\n createNewStack?: boolean;\n focusElement?: string;\n dragEvent?: DragEvent;\n } = {}): void {\n // attempt to retain focus after dom manipulation, which can break focus\n const maintainFocusElement = document.activeElement;\n const config = { ...configParam } as ReactComponentConfig;\n\n if (config.id == null) {\n config.id = shortid.generate();\n }\n\n if (dragEvent) {\n root?.layoutManager.createDragSourceFromEvent(config, dragEvent);\n return;\n }\n\n const searchConfig = replaceConfig || {\n id: config.id,\n component: config.component,\n };\n assertNotNull(root);\n const stack = createNewStack\n ? LayoutUtils.addStack(root)\n : LayoutUtils.getStackForRoot(root, searchConfig);\n\n assertNotNull(stack);\n const oldContentItem = LayoutUtils.getContentItemInStack(\n stack,\n searchConfig\n );\n\n if (focusElement != null) {\n // We need to listen for when the stack is created\n const onComponentCreated = (event: {\n origin: { element: Element[] };\n }) => {\n log.debug('Component created, focusing element', focusElement);\n\n stack.off('componentCreated', onComponentCreated);\n\n const { element } = event.origin;\n\n // Need to wait until the component actually renders.\n requestAnimationFrame(() => {\n LayoutUtils.focusElement(element[0], focusElement);\n });\n };\n stack.on('componentCreated', onComponentCreated);\n }\n if (replaceExisting && oldContentItem) {\n const index = stack.contentItems.indexOf(oldContentItem);\n\n // Using remove/add here instead of replaceChild because I was getting errors with replaceChild... should be the same.\n // Add first so that the stack doesn't get screwed up\n stack.addChild(config, index + 1);\n stack.removeChild(oldContentItem);\n\n stack.setActiveContentItem(stack.contentItems[index]);\n } else {\n stack.addChild(config);\n }\n\n if (\n focusElement == null &&\n maintainFocusElement &&\n isHTMLElement(maintainFocusElement)\n ) {\n maintainFocusElement.focus();\n }\n }\n\n /**\n * Opens a component in an given stack.\n * If `replaceExisting` is true and there is a component found with the same `config.id`, it will replace that component with this one\n * @param stack The GoldenLayout stack to open the component in\n * @param config The component config definition to open\n * @param replaceExisting Whether it should replace the existing one matching component type and id, or open a new one\n */\n static openComponentInStack(\n stack: ContentItem | null,\n config: ItemConfigType,\n replaceExisting = true\n ): void {\n const maintainFocusElement = document.activeElement; // attempt to retain focus after dom manipulation, which can break focus\n\n const searchConfig = { id: config.id };\n\n const oldContentItem = LayoutUtils.getContentItemInStack(\n stack,\n searchConfig\n );\n\n if (replaceExisting && oldContentItem && stack) {\n const index = stack?.contentItems.indexOf(oldContentItem);\n\n // Using remove/add here instead of replaceChild because I was getting errors with replaceChild... should be the same.\n // Add first so that the stack doesn't get screwed up\n stack.addChild(config, index + 1);\n stack.removeChild(oldContentItem);\n\n stack.setActiveContentItem(stack.contentItems[index]);\n } else {\n stack?.addChild(config);\n }\n\n if (maintainFocusElement && isHTMLElement(maintainFocusElement)) {\n maintainFocusElement.focus();\n }\n }\n\n /**\n * Close the specified component and remove it from the stack it's currently in\n * @param root The GoldenLayout root to search and close the component in\n * @param config The GoldenLayout component config definition to close, eg. { component: 'IrisGridPanel', id: 'table-t' }\n */\n static closeComponent(root: ContentItem, config: LayoutConfig): void {\n const stack = LayoutUtils.getStackForRoot(\n root,\n config,\n false,\n false,\n false\n );\n\n if (!stack) {\n log.warn('Cannot find stack for component, ignoring close', config);\n return;\n }\n\n // Find the tab with the specified config and remove it\n // Same component was used to get the stack above, so getContentItemInStack shouldn't return null\n const oldContentItem = LayoutUtils.getContentItemInStack(stack, config);\n const maintainFocusElement = document.activeElement; // attempt to retain focus after dom manipulation, which can break focus\n if (oldContentItem) {\n if (oldContentItem.isComponent) {\n // container property exists on a contentItem if contentItem is a component,\n // however, this is not included in the types for a contentitem, thus the casting\n ((oldContentItem as unknown) as {\n container: { close: () => void };\n }).container.close();\n } else {\n stack.removeChild(oldContentItem);\n }\n }\n // if focused element is still in dom restore focus, note it could have been in the removed panel so check first\n if (\n maintainFocusElement &&\n document.contains(maintainFocusElement) &&\n isHTMLElement(maintainFocusElement)\n ) {\n maintainFocusElement.focus();\n }\n }\n\n static renameComponent(\n root: ContentItem,\n config: Partial<ItemConfigType>,\n newTitle: string\n ): void {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return;\n }\n // Find the tab with the specified config and rename it\n const contentItem = LayoutUtils.getContentItemInStack(stack, config);\n if (contentItem) {\n contentItem.setTitle(newTitle);\n }\n }\n\n /**\n * Create a component clone based on the given config\n * @param root The GoldenLayout root to clone the component in\n * @param config The config to clone\n * @returns Clone config\n */\n static cloneComponent(\n root: ContentItem,\n config: ReactComponentConfig\n ): ReactComponentConfig | null {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return null;\n }\n const { props = {} } = config;\n const panelState = LayoutUtils.getPanelComponentState(config);\n const cloneConfig = {\n type: 'react-component',\n component: config.component,\n props: {\n ...props,\n panelState,\n },\n title: `${config.title} Copy`,\n id: shortid.generate(),\n };\n LayoutUtils.openComponentInStack(stack, cloneConfig);\n return cloneConfig;\n }\n\n /**\n * Get panel component state for the given config\n * @param config Panel config\n * @returns Panel state\n */\n static getPanelComponentState(config: ItemConfigType): unknown {\n if (isComponentConfig(config)) {\n return config.componentState?.panelState;\n }\n if (isReactComponentConfig(config)) {\n return config.props?.panelState;\n }\n return null;\n }\n\n static makeDefaultLayout(): Config {\n return {\n dimensions: {\n headerHeight: GoldenLayoutThemeExport.tabHeight,\n borderWidth: GoldenLayoutThemeExport.dragBorderWidth,\n borderGrabWidth: 10,\n },\n settings: {\n showPopoutIcon: false,\n showCloseIcon: false,\n constrainDragToContainer: false,\n },\n } as Config;\n }\n\n /**\n * Gets a containers root node\n * @param container The Golden Layout container to get the root for\n */\n static getRootFromContainer(container: Container): ContentItem {\n return container.layoutManager.root;\n }\n\n /**\n * Gets the config for the panel component given a glContainer\n * @param container The Golden Layout container to get the config for\n */\n static getComponentConfigFromContainer(\n container?: Container\n ): ItemConfigType | null {\n if (container) {\n if (container.tab != null && container.tab.contentItem != null) {\n return container.tab.contentItem.config;\n }\n\n // If the container hasn't populated the tab yet, just get the config directly from the container\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore private api usage\n // eslint-disable-next-line no-underscore-dangle\n return container._config;\n }\n\n return null;\n }\n\n static getTitleFromContainer(\n container: Container\n ): string | null | undefined {\n if (\n container != null &&\n container.tab != null &&\n container.tab.contentItem != null\n ) {\n return container.tab.contentItem.config.title;\n }\n return null;\n }\n\n static getTitleFromTab(tab: Tab): string | null | undefined {\n if (tab != null && tab.contentItem != null) {\n return tab.contentItem.config.title;\n }\n return null;\n }\n\n /**\n * Retrieve the panel ID for the provided golden layout container\n * @param glContainer The container to get the panel ID for\n * @returns Panel ID\n */\n static getIdFromContainer(\n glContainer: Container\n ): string | string[] | null | undefined {\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n if (config) {\n return config.id;\n }\n return null;\n }\n\n /**\n * Retrieve the ID of the panel provided\n * @param panel The panel to get the ID for\n * @returns Panel ID\n */\n static getIdFromPanel(panel: {\n props: { glContainer: Container };\n }): string | string[] | null | undefined {\n const { glContainer } = panel.props;\n return LayoutUtils.getIdFromContainer(glContainer);\n }\n\n /**\n * Get component name from the panel instance\n * @param panel Panel to get component name for\n * @returns Component name or null if unable to retrieve name\n */\n static getComponentNameFromPanel(panel: {\n props: { glContainer: GoldenLayout.Container };\n }): string | null {\n const { glContainer } = panel.props;\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n if (config && isReactComponentConfig(config)) {\n return config.component ?? null;\n }\n return null;\n }\n\n /**\n * Get component name for wrapped and un-wrapped components\n * @param component Component to get name for\n * @returns Component name\n * @throws If displayName for the component is not defined\n */\n static getComponentName(component: {\n displayName?: string;\n WrappedComponent?: { displayName?: string };\n }): string {\n const name =\n component.WrappedComponent?.displayName ?? component.displayName;\n if (name == null) {\n throw new Error(`Component displayName not defined ${component}`);\n }\n return name;\n }\n\n /**\n * Put focus on the first \"input\" element (input, button, select, textarea) within an element\n * If element is null or input element not found, does nothing\n * @param element The element to put focus in.\n * @param selector The first element matching this selector will be focused.\n * @returns The element that was focused, null if not focused\n */\n static focusElement(\n element: Element,\n selector = LayoutUtils.DEFAULT_FOCUS_SELECTOR\n ): Element | null {\n if (element == null) {\n return null;\n }\n const focusElement = element.querySelector(selector);\n if (focusElement == null) {\n return null;\n }\n\n if (isHTMLElement(focusElement)) {\n focusElement.focus();\n }\n return focusElement;\n }\n\n /**\n * Get a promise that initializes when layout is initialized\n * @param layout The layout to await initialization on\n * @returns Promise that resolves when layout is initialized\n */\n static onInitialized(layout: GoldenLayout): Promise<void> {\n return new Promise(resolve => {\n if (layout.isInitialised) {\n resolve();\n return;\n }\n const onInit = () => {\n layout.off('initialised', onInit);\n resolve();\n };\n layout.on('initialised', onInit);\n });\n }\n}\n\nexport default LayoutUtils;\n"],"mappings":";;;;;;AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,OAAP,MAAoB,SAApB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AAEA,OAAOC,GAAP,MAAgB,gBAAhB;AAYA,SAASC,aAAT,QAA8B,kBAA9B;OACOC,uB;AAIP,IAAMC,GAAG,GAAGH,GAAG,CAACI,MAAJ,CAAW,aAAX,CAAZ;;AAQA,SAASC,iBAAT,CAA2BC,MAA3B,EAA8E;EAC5E,OAAQA,MAAD,CAA4BC,aAA5B,KAA8CC,SAArD;AACD;;AAED,OAAO,SAASC,sBAAT,CACLH,MADK,EAE2B;EAChC,IAAMI,WAAW,GAAGJ,MAApB,CADgC,CAEhC;EACA;;EACA,OACE,CAAED,iBAAiB,CAACC,MAAD,CAAjB,IACAA,MAAM,CAACC,aAAP,KAAyB,oBAD1B,IAECD,MAAM,CAACK,IAAP,KAAgB,iBAFlB,KAGAD,WAAW,CAACE,SAAZ,KAA0BJ,SAJ5B;AAMD;;AAED,SAASK,aAAT,CAAuBC,OAAvB,EAAiE;EAC/D,OAA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AvxBe;;gBAAZlJ,W,4BAC4B,iC;;AAyxBlC,eAAeA,WAAf"}
1
+ {"version":3,"file":"LayoutUtils.js","names":["deepEqual","shortid","isMatch","Log","isRoot","isStack","assertNotNull","GoldenLayoutThemeExport","log","module","isComponentConfig","config","componentName","undefined","isReactComponentConfig","reactConfig","type","component","isHTMLElement","element","focus","isStackItemConfig","LayoutUtils","activateTab","root","stack","getStackForRoot","error","contentItem","getContentItemInStack","setActiveContentItem","isActiveTab","activeItem","getActiveContentItem","addStack","parent","columnPreferred","contentItems","length","addChild","child","isCorrectType","isColumn","isRow","removeChild","maintainFocusElement","document","activeElement","newParent","getStackForConfig","item","allowEmptyStack","i","isComponent","createIfNecessary","matchComponentType","getStackForComponentTypes","types","isLastType","dehydrateLayoutConfig","dehydrateComponent","dehydratedConfig","itemConfig","content","dehydratedComponent","push","debug2","layoutItemConfig","getTabPoint","glContainer","tab","Error","tabRect","getBoundingClientRect","left","width","bottom","dropLayoutMinorChange","activeItemIndex","props","panelState","id","irisGridState","sorts","quickFilters","isEqual","layout1","layout2","major","layout1Clone","cloneLayout","layout2Clone","layout","JSON","parse","stringify","hydrateLayoutConfig","hydrateComponent","hydratedConfig","contentConfig","warn","openComponent","configParam","replaceExisting","replaceConfig","createNewStack","focusElement","dragEvent","generate","layoutManager","createDragSourceFromEvent","searchConfig","oldContentItem","onComponentCreated","event","debug","off","origin","requestAnimationFrame","on","index","indexOf","openComponentInStack","closeComponent","container","close","contains","renameComponent","newTitle","setTitle","cloneComponent","getPanelComponentState","cloneConfig","title","componentState","makeDefaultLayout","dimensions","headerHeight","tabHeight","borderWidth","dragBorderWidth","borderGrabWidth","settings","showPopoutIcon","showCloseIcon","constrainDragToContainer","getRootFromContainer","getComponentConfigFromContainer","_config","getTitleFromContainer","getTitleFromTab","getIdFromContainer","getIdFromPanel","panel","getComponentNameFromPanel","getComponentName","name","WrappedComponent","displayName","selector","DEFAULT_FOCUS_SELECTOR","querySelector","onInitialized","Promise","resolve","isInitialised","onInit"],"sources":["../../src/layout/LayoutUtils.ts"],"sourcesContent":["import deepEqual from 'deep-equal';\nimport shortid from 'shortid';\nimport isMatch from 'lodash.ismatch';\nimport { DragEvent } from 'react';\nimport Log from '@deephaven/log';\nimport GoldenLayout, { isRoot, isStack } from '@deephaven/golden-layout';\nimport type {\n ComponentConfig,\n Config,\n Container,\n ContentItem,\n ItemConfig,\n ItemConfigType,\n ReactComponentConfig,\n Stack,\n Tab,\n} from '@deephaven/golden-layout';\nimport { assertNotNull } from '@deephaven/utils';\nimport GoldenLayoutThemeExport from './GoldenLayoutThemeExport';\nimport { DashboardLayoutConfig } from '../DashboardLayout';\nimport { PanelConfig } from '../DashboardPlugin';\n\nconst log = Log.module('LayoutUtils');\n\ntype LayoutConfig = { id?: string; component?: string };\n\nexport type StackItemConfig = ItemConfig & {\n activeItemIndex?: number;\n};\n\nfunction isComponentConfig(config: ItemConfigType): config is ComponentConfig {\n return (config as ComponentConfig).componentName !== undefined;\n}\n\nexport function isReactComponentConfig(\n config: ItemConfigType\n): config is ReactComponentConfig {\n const reactConfig = config as ReactComponentConfig;\n // Golden layout sets the type to 'component' and componentName to 'lm-react-component' in `createContentItem`, then changes it back in `toConfig`\n // For our purposes, we need to check both.\n return (\n ((isComponentConfig(config) &&\n config.componentName === 'lm-react-component') ||\n config.type === 'react-component') &&\n reactConfig.component !== undefined\n );\n}\n\nfunction isHTMLElement(element: Element): element is HTMLElement {\n return (element as HTMLElement).focus !== undefined;\n}\n\nfunction isStackItemConfig(config: ItemConfigType): config is StackItemConfig {\n return config.type === 'stack';\n}\nclass LayoutUtils {\n static DEFAULT_FOCUS_SELECTOR = 'input, select, textarea, button';\n\n static activateTab(root: ContentItem, config: Partial<ItemConfigType>): void {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return;\n }\n // Find the tab with the specified table and activate it\n const contentItem = LayoutUtils.getContentItemInStack(stack, config);\n if (contentItem) {\n stack.setActiveContentItem(contentItem);\n }\n }\n\n /**\n * Is the tab with the given config active\n * @param root A GoldenLayout content item with the tab\n * @param config Tab config to match\n * @returns True if the tab is active\n */\n static isActiveTab(root: ContentItem, config: Config): boolean {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return false;\n }\n // Find the item with the specified config and compare with active item\n const contentItem = LayoutUtils.getContentItemInStack(stack, config);\n const activeItem = stack.getActiveContentItem();\n return activeItem === contentItem;\n }\n\n /**\n * Adds a stack to the root layout specified. Adds to the first row/column with only one item\n * @param parent A GoldenLayout content item to add the stack to\n * @returns The newly created stack.\n */\n static addStack(parent: ContentItem, columnPreferred = true): Stack {\n const type = columnPreferred ? 'column' : 'row';\n if (isRoot(parent)) {\n if (parent.contentItems == null || parent.contentItems.length === 0) {\n parent.addChild({ type });\n }\n\n const child = parent.contentItems[0];\n const isCorrectType = columnPreferred ? child.isColumn : child.isRow;\n if (!isCorrectType) {\n parent.removeChild(child, true);\n parent.addChild({ type });\n\n // The addChild may cause the element that has focus to be removed from the DOM, which changes focus to the body\n // Try and maintain the focus as best we can. The unfocused element may still send a blur/focus event so that needs to be handled correctly.\n const maintainFocusElement = document.activeElement;\n parent.contentItems[0].addChild(child);\n if (\n maintainFocusElement &&\n (maintainFocusElement as HTMLElement).focus != null\n ) {\n (maintainFocusElement as HTMLElement).focus();\n }\n }\n\n return this.addStack(parent.contentItems[0], columnPreferred);\n }\n\n if (parent.contentItems.length < 2) {\n parent.addChild({ type: 'stack' });\n return parent.contentItems[parent.contentItems.length - 1] as Stack;\n }\n let newParent = parent.contentItems[parent.contentItems.length - 1];\n const isCorrectType = !columnPreferred\n ? newParent.isColumn\n : newParent.isRow;\n if (!isCorrectType) {\n parent.addChild({ type: !columnPreferred ? 'column' : 'row' });\n parent.removeChild(newParent, true);\n parent.contentItems[parent.contentItems.length - 1].addChild(newParent);\n newParent = parent.contentItems[parent.contentItems.length - 1];\n }\n\n return this.addStack(newParent, !columnPreferred);\n }\n\n /**\n * Gets the first stack which contains a contentItem with the given config values\n * @param item Golden layout content item to search for the stack\n * @param config The item properties to match\n */\n static getStackForConfig(\n item: ContentItem,\n config: Partial<ItemConfigType> = {},\n allowEmptyStack = false\n ): Stack | null {\n if (allowEmptyStack && isStack(item) && item.contentItems.length === 0) {\n return item;\n }\n\n if (item.contentItems == null) {\n return null;\n }\n\n for (let i = 0; i < item.contentItems.length; i += 1) {\n const contentItem = item.contentItems[i];\n if (contentItem.isComponent && contentItem.config != null) {\n if (isMatch(contentItem.config, config)) {\n return item as Stack;\n }\n }\n\n const stack = this.getStackForConfig(\n contentItem,\n config,\n allowEmptyStack\n );\n if (stack) {\n return stack;\n }\n }\n\n return null;\n }\n\n /**\n * Gets a stack matching the specified config\n * @param root The root GoldenLayout element\n * @param config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }\n * @param createIfNecessary Whether to create the stack if it does not exist.\n * @param matchComponentType If the config doesn't match exactly, just find another one of the same component type\n * @param allowEmptyStack If no configs match, search for an empty stack that can be used\n */\n static getStackForRoot(\n root: ContentItem,\n config: Partial<ReactComponentConfig>,\n createIfNecessary = true,\n matchComponentType = true,\n allowEmptyStack = true\n ): Stack | null {\n let stack = this.getStackForConfig(root, config);\n if (!stack && matchComponentType) {\n stack = this.getStackForConfig(\n root,\n { component: config.component },\n allowEmptyStack\n );\n }\n\n if (!stack && createIfNecessary) {\n stack = this.addStack(root);\n }\n\n return stack;\n }\n\n /**\n * Gets a stack matching one of the specified types, creates new stack if necessary\n * @param root The GoldenLayout root to find or create the stack in\n * @param types The array of component types to match\n * @param createIfNecessary Whether to create the stack if it does not exist\n * @param matchComponentType If the config doesn't match exactly, just find another one of the same component type\n * @param allowEmptyStack If no configs match, search for an empty stack that can be used\n */\n static getStackForComponentTypes(\n root: ContentItem,\n types: string[],\n createIfNecessary = true,\n matchComponentType = true,\n allowEmptyStack = true\n ): Stack | null {\n for (let i = 0; i < types.length; i += 1) {\n const component = types[i];\n const isLastType = i === types.length - 1;\n const stack = LayoutUtils.getStackForRoot(\n root,\n { component },\n createIfNecessary && isLastType,\n matchComponentType,\n allowEmptyStack\n );\n if (stack) {\n return stack;\n }\n }\n return null;\n }\n\n /**\n * Gets first content item with the specified config in stack.\n * @param stack The stack to search for the item\n * @param config The item config type to match, eg. { component: 'IrisGridPanel', title: 'Table Name' }\n * @returns Returns the found content item, null if not found.\n */\n static getContentItemInStack(\n stack: ContentItem | null,\n config: Partial<ItemConfigType>\n ): ContentItem | null {\n if (!stack) {\n return null;\n }\n for (let i = 0; i < stack.contentItems.length; i += 1) {\n const contentItem = stack.contentItems[i];\n if (contentItem.isComponent && contentItem.config != null) {\n if (isMatch(contentItem.config, config)) {\n return contentItem;\n }\n }\n }\n return null;\n }\n\n /**\n * Removes dynamic props from components in the given config so this config could be serialized\n * @param config Config objec\n * @returns Dehydrated config\n */\n static dehydrateLayoutConfig(\n config: ItemConfigType[],\n dehydrateComponent: (\n componentName: string,\n config: ItemConfigType\n ) => PanelConfig\n ): (PanelConfig | ItemConfig)[] {\n if (config == null || !config.length) {\n return [];\n }\n const dehydratedConfig: (PanelConfig | ItemConfig)[] = [];\n\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n const { component, content } = itemConfig as ReactComponentConfig;\n if (component) {\n const dehydratedComponent = dehydrateComponent(component, itemConfig);\n if (dehydratedComponent != null) {\n dehydratedConfig.push(dehydratedComponent);\n } else {\n log.debug2(\n `dehydrateLayoutConfig: skipping unmapped component \"${component}\"`\n );\n }\n } else if (content) {\n const layoutItemConfig = {\n ...itemConfig,\n content: LayoutUtils.dehydrateLayoutConfig(\n content,\n dehydrateComponent\n ),\n };\n dehydratedConfig.push(layoutItemConfig);\n } else {\n dehydratedConfig.push(itemConfig);\n }\n }\n return dehydratedConfig;\n }\n\n static getTabPoint(glContainer: Container): [number, number] {\n const { tab } = glContainer;\n if (tab == null) {\n throw new Error(`Cannot get tab for panel container ${glContainer}`);\n }\n const tabRect = tab.element[0].getBoundingClientRect();\n\n return [tabRect.left + tabRect.width * 0.5, tabRect.bottom - 8];\n }\n\n /**\n * Drop minor changes in Layout Configuration for deep comparison\n * @param config Layout Configuration\n *\n * minor changes:\n * 1. sorts in grid\n * 2. quick filters in grid\n * 3. active item\n *\n * item id is also removed\n */\n static dropLayoutMinorChange(config: DashboardLayoutConfig): void {\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n const { content } = itemConfig;\n if (content !== undefined) {\n if (isStackItemConfig(itemConfig)) {\n delete itemConfig.activeItemIndex;\n }\n LayoutUtils.dropLayoutMinorChange(content);\n } else if (\n isReactComponentConfig(itemConfig) &&\n itemConfig.component === 'IrisGridPanel'\n ) {\n if (itemConfig.props.panelState != null) {\n delete itemConfig.id;\n itemConfig.props.panelState.irisGridState.sorts = [];\n itemConfig.props.panelState.irisGridState.quickFilters = [];\n }\n }\n }\n }\n\n /**\n * Compare two layouts to see if they are equivalent\n * @param layout1 A Golden Layout config object\n * @param layout2 Another Golden layout config object\n * @param major When true, will ignore \"minor\" property differences (eg. sorts)\n */\n static isEqual(\n layout1: DashboardLayoutConfig,\n layout2: DashboardLayoutConfig,\n major = false\n ): boolean {\n if (major) {\n const layout1Clone = LayoutUtils.cloneLayout(layout1);\n const layout2Clone = LayoutUtils.cloneLayout(layout2);\n LayoutUtils.dropLayoutMinorChange(layout1Clone);\n LayoutUtils.dropLayoutMinorChange(layout2Clone);\n return deepEqual(layout1Clone, layout2Clone);\n }\n return deepEqual(layout1, layout2);\n }\n\n static cloneLayout(layout: DashboardLayoutConfig): DashboardLayoutConfig {\n return JSON.parse(JSON.stringify(layout));\n }\n\n /**\n * Adds dynamic props to components in the given config so this config could be used to initialize a layout\n * @param config Dehydrated config object\n * @param hydrateComponent Function to hydrate the component\n * @returns Hydrated config\n */\n static hydrateLayoutConfig(\n config: (PanelConfig | ItemConfig)[],\n hydrateComponent: (\n componentName: string,\n config: PanelConfig | ItemConfig\n ) => ReactComponentConfig\n ): DashboardLayoutConfig {\n if (config == null || !config.length) {\n return [];\n }\n const hydratedConfig = [];\n\n for (let i = 0; i < config.length; i += 1) {\n const itemConfig = config[i];\n if (isReactComponentConfig(itemConfig)) {\n const { component, props = {} } = itemConfig;\n hydratedConfig.push({\n ...itemConfig,\n id: itemConfig?.id ?? shortid(),\n props: hydrateComponent(component, props),\n });\n } else if (itemConfig.content !== undefined) {\n const contentConfig = LayoutUtils.hydrateLayoutConfig(\n itemConfig.content,\n hydrateComponent\n );\n if (\n isStackItemConfig(itemConfig) &&\n itemConfig.activeItemIndex != null &&\n itemConfig.activeItemIndex >= contentConfig.length\n ) {\n log.warn(\n 'Fixing bad activeItemIndex!',\n itemConfig.activeItemIndex,\n itemConfig\n );\n itemConfig.activeItemIndex = 0;\n }\n hydratedConfig.push({\n ...itemConfig,\n content: contentConfig,\n });\n } else {\n hydratedConfig.push(itemConfig);\n }\n }\n\n return hydratedConfig;\n }\n\n /**\n * Opens a component. It will try and open the component in an existing stack of the same component.\n * If `replaceExisting` is true and there is a component found with the same `config.id`, it will replace that component with this one.\n * If `allowStack` is true and there is a component of the same type found, it will open in that stack (potentially covering up a panel).\n * @param root The GoldenLayout root to open the component in\n * @param config The component config definition to open\n * @param replaceExisting Whether it should replace the existing one matching component type and id, or open a new one\n * @param replaceConfig The component config to replace\n * @param createNewStack True to force opening in a new stack, false to try and open in a stack with the same type of component.\n * @param focusElement The element to focus on\n * @param dragEvent Whether component is being created with a drag, mouse event is initial position for drag proxy\n */\n static openComponent({\n root,\n config: configParam,\n replaceExisting = true,\n replaceConfig = undefined,\n createNewStack = false,\n focusElement = undefined,\n dragEvent = undefined,\n }: {\n root?: ContentItem;\n config?: Partial<ReactComponentConfig>;\n replaceExisting?: boolean;\n replaceConfig?: Partial<ItemConfigType>;\n createNewStack?: boolean;\n focusElement?: string;\n dragEvent?: DragEvent;\n } = {}): void {\n // attempt to retain focus after dom manipulation, which can break focus\n const maintainFocusElement = document.activeElement;\n const config = { ...configParam } as ReactComponentConfig;\n\n if (config.id == null) {\n config.id = shortid.generate();\n }\n\n if (dragEvent) {\n root?.layoutManager.createDragSourceFromEvent(config, dragEvent);\n return;\n }\n\n const searchConfig = replaceConfig || {\n id: config.id,\n component: config.component,\n };\n assertNotNull(root);\n const stack = createNewStack\n ? LayoutUtils.addStack(root)\n : LayoutUtils.getStackForRoot(root, searchConfig);\n\n assertNotNull(stack);\n const oldContentItem = LayoutUtils.getContentItemInStack(\n stack,\n searchConfig\n );\n\n if (focusElement != null) {\n // We need to listen for when the stack is created\n const onComponentCreated = (event: {\n origin: { element: Element[] };\n }) => {\n log.debug('Component created, focusing element', focusElement);\n\n stack.off('componentCreated', onComponentCreated);\n\n const { element } = event.origin;\n\n // Need to wait until the component actually renders.\n requestAnimationFrame(() => {\n LayoutUtils.focusElement(element[0], focusElement);\n });\n };\n stack.on('componentCreated', onComponentCreated);\n }\n if (replaceExisting && oldContentItem) {\n const index = stack.contentItems.indexOf(oldContentItem);\n\n // Using remove/add here instead of replaceChild because I was getting errors with replaceChild... should be the same.\n // Add first so that the stack doesn't get screwed up\n stack.addChild(config, index + 1);\n stack.removeChild(oldContentItem);\n\n stack.setActiveContentItem(stack.contentItems[index]);\n } else {\n stack.addChild(config);\n }\n\n if (\n focusElement == null &&\n maintainFocusElement &&\n isHTMLElement(maintainFocusElement)\n ) {\n maintainFocusElement.focus();\n }\n }\n\n /**\n * Opens a component in an given stack.\n * If `replaceExisting` is true and there is a component found with the same `config.id`, it will replace that component with this one\n * @param stack The GoldenLayout stack to open the component in\n * @param config The component config definition to open\n * @param replaceExisting Whether it should replace the existing one matching component type and id, or open a new one\n */\n static openComponentInStack(\n stack: Stack | null,\n config: ItemConfigType & Record<string, unknown>,\n replaceExisting = true\n ): void {\n const maintainFocusElement = document.activeElement; // attempt to retain focus after dom manipulation, which can break focus\n\n const searchConfig = { id: config.id };\n\n const oldContentItem = LayoutUtils.getContentItemInStack(\n stack,\n searchConfig\n );\n\n if (replaceExisting && oldContentItem && stack) {\n const index = stack?.contentItems.indexOf(oldContentItem);\n\n // Using remove/add here instead of replaceChild because I was getting errors with replaceChild... should be the same.\n // Add first so that the stack doesn't get screwed up\n stack.addChild(config, index + 1);\n stack.removeChild(oldContentItem);\n\n stack.setActiveContentItem(stack.contentItems[index]);\n } else {\n stack?.addChild(config);\n }\n\n if (maintainFocusElement && isHTMLElement(maintainFocusElement)) {\n maintainFocusElement.focus();\n }\n }\n\n /**\n * Close the specified component and remove it from the stack it's currently in\n * @param root The GoldenLayout root to search and close the component in\n * @param config The GoldenLayout component config definition to close, eg. { component: 'IrisGridPanel', id: 'table-t' }\n */\n static closeComponent(root: ContentItem, config: LayoutConfig): void {\n const stack = LayoutUtils.getStackForRoot(\n root,\n config,\n false,\n false,\n false\n );\n\n if (!stack) {\n log.warn('Cannot find stack for component, ignoring close', config);\n return;\n }\n\n // Find the tab with the specified config and remove it\n // Same component was used to get the stack above, so getContentItemInStack shouldn't return null\n const oldContentItem = LayoutUtils.getContentItemInStack(stack, config);\n const maintainFocusElement = document.activeElement; // attempt to retain focus after dom manipulation, which can break focus\n if (oldContentItem) {\n if (oldContentItem.isComponent) {\n // container property exists on a contentItem if contentItem is a component,\n // however, this is not included in the types for a contentitem, thus the casting\n ((oldContentItem as unknown) as {\n container: { close: () => void };\n }).container.close();\n } else {\n stack.removeChild(oldContentItem);\n }\n }\n // if focused element is still in dom restore focus, note it could have been in the removed panel so check first\n if (\n maintainFocusElement &&\n document.contains(maintainFocusElement) &&\n isHTMLElement(maintainFocusElement)\n ) {\n maintainFocusElement.focus();\n }\n }\n\n static renameComponent(\n root: ContentItem,\n config: Partial<ItemConfigType>,\n newTitle: string\n ): void {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return;\n }\n // Find the tab with the specified config and rename it\n const contentItem = LayoutUtils.getContentItemInStack(stack, config);\n if (contentItem) {\n contentItem.setTitle(newTitle);\n }\n }\n\n /**\n * Create a component clone based on the given config\n * @param root The GoldenLayout root to clone the component in\n * @param config The config to clone\n * @returns Clone config\n */\n static cloneComponent(\n root: ContentItem,\n config: ReactComponentConfig\n ): ReactComponentConfig | null {\n const stack = LayoutUtils.getStackForRoot(root, config, false);\n if (!stack) {\n log.error('Could not find stack for config', config);\n return null;\n }\n const { props = {} } = config;\n const panelState = LayoutUtils.getPanelComponentState(config);\n const cloneConfig = {\n type: 'react-component' as const,\n component: config.component,\n props: {\n ...props,\n panelState,\n },\n title: `${config.title} Copy`,\n id: shortid.generate(),\n };\n LayoutUtils.openComponentInStack(stack, cloneConfig);\n return cloneConfig;\n }\n\n /**\n * Get panel component state for the given config\n * @param config Panel config\n * @returns Panel state\n */\n static getPanelComponentState(config: ItemConfigType): unknown {\n if (isComponentConfig(config)) {\n return config.componentState?.panelState;\n }\n if (isReactComponentConfig(config)) {\n return config.props?.panelState;\n }\n return null;\n }\n\n static makeDefaultLayout(): Config {\n return {\n dimensions: {\n headerHeight: GoldenLayoutThemeExport.tabHeight,\n borderWidth: GoldenLayoutThemeExport.dragBorderWidth,\n borderGrabWidth: 10,\n },\n settings: {\n showPopoutIcon: false,\n showCloseIcon: false,\n constrainDragToContainer: false,\n },\n } as Config;\n }\n\n /**\n * Gets a containers root node\n * @param container The Golden Layout container to get the root for\n */\n static getRootFromContainer(container: Container): ContentItem {\n return container.layoutManager.root;\n }\n\n /**\n * Gets the config for the panel component given a glContainer\n * @param container The Golden Layout container to get the config for\n */\n static getComponentConfigFromContainer(\n container?: Container\n ): ItemConfigType | null {\n if (container) {\n if (container.tab != null && container.tab.contentItem != null) {\n return container.tab.contentItem.config;\n }\n\n // If the container hasn't populated the tab yet, just get the config directly from the container\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore private api usage\n // eslint-disable-next-line no-underscore-dangle\n return container._config;\n }\n\n return null;\n }\n\n static getTitleFromContainer(\n container: Container\n ): string | null | undefined {\n if (\n container != null &&\n container.tab != null &&\n container.tab.contentItem != null\n ) {\n return container.tab.contentItem.config.title;\n }\n return null;\n }\n\n static getTitleFromTab(tab: Tab): string | null | undefined {\n if (tab != null && tab.contentItem != null) {\n return tab.contentItem.config.title;\n }\n return null;\n }\n\n /**\n * Retrieve the panel ID for the provided golden layout container\n * @param glContainer The container to get the panel ID for\n * @returns Panel ID\n */\n static getIdFromContainer(\n glContainer: Container\n ): string | string[] | null | undefined {\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n if (config) {\n return config.id;\n }\n return null;\n }\n\n /**\n * Retrieve the ID of the panel provided\n * @param panel The panel to get the ID for\n * @returns Panel ID\n */\n static getIdFromPanel(panel: {\n props: { glContainer: Container };\n }): string | string[] | null | undefined {\n const { glContainer } = panel.props;\n return LayoutUtils.getIdFromContainer(glContainer);\n }\n\n /**\n * Get component name from the panel instance\n * @param panel Panel to get component name for\n * @returns Component name or null if unable to retrieve name\n */\n static getComponentNameFromPanel(panel: {\n props: { glContainer: Container };\n }): string | null {\n const { glContainer } = panel.props;\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n if (config && isReactComponentConfig(config)) {\n return config.component ?? null;\n }\n return null;\n }\n\n /**\n * Get component name for wrapped and un-wrapped components\n * @param component Component to get name for\n * @returns Component name\n * @throws If displayName for the component is not defined\n */\n static getComponentName(component: {\n displayName?: string;\n WrappedComponent?: { displayName?: string };\n }): string {\n const name =\n component.WrappedComponent?.displayName ?? component.displayName;\n if (name == null) {\n throw new Error(`Component displayName not defined ${component}`);\n }\n return name;\n }\n\n /**\n * Put focus on the first \"input\" element (input, button, select, textarea) within an element\n * If element is null or input element not found, does nothing\n * @param element The element to put focus in.\n * @param selector The first element matching this selector will be focused.\n * @returns The element that was focused, null if not focused\n */\n static focusElement(\n element: Element,\n selector = LayoutUtils.DEFAULT_FOCUS_SELECTOR\n ): Element | null {\n if (element == null) {\n return null;\n }\n const focusElement = element.querySelector(selector);\n if (focusElement == null) {\n return null;\n }\n\n if (isHTMLElement(focusElement)) {\n focusElement.focus();\n }\n return focusElement;\n }\n\n /**\n * Get a promise that initializes when layout is initialized\n * @param layout The layout to await initialization on\n * @returns Promise that resolves when layout is initialized\n */\n static onInitialized(layout: GoldenLayout): Promise<void> {\n return new Promise(resolve => {\n if (layout.isInitialised) {\n resolve();\n return;\n }\n const onInit = () => {\n layout.off('initialised', onInit);\n resolve();\n };\n layout.on('initialised', onInit);\n });\n }\n}\n\nexport default LayoutUtils;\n"],"mappings":";;;;;;AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,OAAP,MAAoB,SAApB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AAEA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,SAAuBC,MAAvB,EAA+BC,OAA/B,QAA8C,0BAA9C;AAYA,SAASC,aAAT,QAA8B,kBAA9B;OACOC,uB;AAIP,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAJ,CAAW,aAAX,CAAZ;;AAQA,SAASC,iBAAT,CAA2BC,MAA3B,EAA8E;EAC5E,OAAQA,MAAD,CAA4BC,aAA5B,KAA8CC,SAArD;AACD;;AAED,OAAO,SAASC,sBAAT,CACLH,MADK,EAE2B;EAChC,IAAMI,WAAW,GAAGJ,MAApB,CADgC,CAEhC;EACA;;EACA,OACE,CAAED,iBAAiB,CAACC,MAAD,CAAjB,IACAA,MAAM,CAACC,aAAP,KAAyB,oBAD1B,IAECD,MAAM,CAACK,IAAP,KAAgB,iBAFlB,KAGAD,WAAW,CAACE,SAAZ,KAA0BJ,SAJ5B;AAMD;;AAED,SAASK,aAAT,CAAuBC,OAAvB,EAAiE;EAC/D,OAAQA,OAAD,CAAyBC,KAAzB,KAAmCP,SAA1C;AACD;;AAED,SAASQ,iBAAT,CAA2BV,MAA3B,EAA8E;EAC5E,OAAOA,MAAM,CAACK,IAAP,KAAgB,OAAvB;AACD;;AACD,MAAMM,WAAN,CAAkB;EAGE,OAAXC,WAAW,CAACC,IAAD,EAAoBb,MAApB,EAA2D;IAC3E,IAAMc,KAAK,GAAGH,WAAW,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AAC4I,gBADF,2DACR,uBAA4BC,WADpB,yEACmC7I,SAAS,CAAC6I,WADvD;;IAEA,IAAIF,IAAI,IAAI,IAAZ,EAAkB;MAChB,MAAM,IAAIrF,KAAJ,6CAA+CtD,SAA/C,EAAN;IACD;;IACD,OAAO2I,IAAP;EACD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;;;EACqB,OAAZlD,YAAY,CACjBvF,OADiB,EAGD;IAAA,IADhB4I,QACgB,uEADLzI,WAAW,CAAC0I,sBACP;;IAChB,IAAI7I,OAAO,IAAI,IAAf,EAAqB;MACnB,OAAO,IAAP;IACD;;IACD,IAAMuF,YAAY,GAAGvF,OAAO,CAAC8I,aAAR,CAAsBF,QAAtB,CAArB;;IACA,IAAIrD,YAAY,IAAI,IAApB,EAA0B;MACxB,OAAO,IAAP;IACD;;IAED,IAAIxF,aAAa,CAACwF,YAAD,CAAjB,EAAiC;MAC/BA,YAAY,CAACtF,KAAb;IACD;;IACD,OAAOsF,YAAP;EACD;EAED;AACF;AACA;AACA;AACA;;;EACsB,OAAbwD,aAAa,CAACtE,MAAD,EAAsC;IACxD,OAAO,IAAIuE,OAAJ,CAAYC,OAAO,IAAI;MAC5B,IAAIxE,MAAM,CAACyE,aAAX,EAA0B;QACxBD,OAAO;QACP;MACD;;MACD,IAAME,MAAM,GAAG,MAAM;QACnB1E,MAAM,CAACwB,GAAP,CAAW,aAAX,EAA0BkD,MAA1B;QACAF,OAAO;MACR,CAHD;;MAIAxE,MAAM,CAAC2B,EAAP,CAAU,aAAV,EAAyB+C,MAAzB;IACD,CAVM,CAAP;EAWD;;AAvxBe;;gBAAZhJ,W,4BAC4B,iC;;AAyxBlC,eAAeA,WAAf"}
@@ -1,7 +1,7 @@
1
- import GoldenLayout from '@deephaven/golden-layout';
2
- export declare const useListener: (eventEmitter: GoldenLayout.EventEmitter, eventName: string, callback: Function) => void;
1
+ import type { EventEmitter } from '@deephaven/golden-layout';
2
+ export declare const useListener: (eventEmitter: EventEmitter, eventName: string, callback: Function) => void;
3
3
  declare const _default: {
4
- useListener: (eventEmitter: GoldenLayout.EventEmitter, eventName: string, callback: Function) => void;
4
+ useListener: (eventEmitter: EventEmitter, eventName: string, callback: Function) => void;
5
5
  };
6
6
  export default _default;
7
7
  //# sourceMappingURL=hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/layout/hooks.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAEpD,eAAO,MAAM,WAAW,iBACR,aAAa,YAAY,aAC5B,MAAM,YAEP,QAAQ,KACjB,IAUA,CAAC;;;;AAEJ,wBAA+B"}
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"}
@@ -1 +1 @@
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 GoldenLayout from '@deephaven/golden-layout';\n\nexport const useListener = (\n eventEmitter: GoldenLayout.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,SAAT,QAA0B,OAA1B;AAGA,OAAO,IAAMC,WAAW,GAAG,CACzBC,YADyB,EAEzBC,SAFyB,EAIzBC,QAJyB,KAMzBJ,SAAS,CACP,SAASK,gBAAT,GAA4B;EAC1BH,YAAY,CAACI,EAAb,CAAgBH,SAAhB,EAA2BC,QAA3B;EAEA,OAAO,MAAM;IACXF,YAAY,CAACK,GAAb,CAAiBJ,SAAjB,EAA4BC,QAA5B;EACD,CAFD;AAGD,CAPM,EAQP,CAACF,YAAD,EAAeC,SAAf,EAA0BC,QAA1B,CARO,CANJ;AAiBP,eAAe;EAAEH;AAAF,CAAf"}
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,SAAT,QAA0B,OAA1B;AAGA,OAAO,IAAMC,WAAW,GAAG,CACzBC,YADyB,EAEzBC,SAFyB,EAIzBC,QAJyB,KAMzBJ,SAAS,CACP,SAASK,gBAAT,GAA4B;EAC1BH,YAAY,CAACI,EAAb,CAAgBH,SAAhB,EAA2BC,QAA3B;EAEA,OAAO,MAAM;IACXF,YAAY,CAACK,GAAb,CAAiBJ,SAAjB,EAA4BC,QAA5B;EACD,CAFD;AAGD,CAPM,EAQP,CAACF,YAAD,EAAeC,SAAf,EAA0BC,QAA1B,CARO,CANJ;AAiBP,eAAe;EAAEH;AAAF,CAAf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/dashboard",
3
- "version": "0.19.2-beta.5+f6a5d6d",
3
+ "version": "0.20.0",
4
4
  "description": "Deephaven Dashboard",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -30,11 +30,11 @@
30
30
  "start": "cross-env NODE_ENV=development npm run watch"
31
31
  },
32
32
  "dependencies": {
33
- "@deephaven/components": "^0.19.2-beta.5+f6a5d6d",
34
- "@deephaven/golden-layout": "^0.19.2-beta.5+f6a5d6d",
35
- "@deephaven/log": "^0.19.2-beta.5+f6a5d6d",
36
- "@deephaven/react-hooks": "^0.19.2-beta.5+f6a5d6d",
37
- "@deephaven/redux": "^0.19.2-beta.5+f6a5d6d",
33
+ "@deephaven/components": "^0.20.0",
34
+ "@deephaven/golden-layout": "^0.20.0",
35
+ "@deephaven/log": "^0.20.0",
36
+ "@deephaven/react-hooks": "^0.20.0",
37
+ "@deephaven/redux": "^0.20.0",
38
38
  "@deephaven/utils": "file:../util",
39
39
  "deep-equal": "^2.0.5",
40
40
  "lodash.ismatch": "^4.1.1",
@@ -48,8 +48,8 @@
48
48
  "react-redux": "^7.2.4"
49
49
  },
50
50
  "devDependencies": {
51
- "@deephaven/mocks": "^0.19.2-beta.5+f6a5d6d",
52
- "@deephaven/tsconfig": "^0.19.2-beta.5+f6a5d6d",
51
+ "@deephaven/mocks": "^0.20.0",
52
+ "@deephaven/tsconfig": "^0.20.0",
53
53
  "@types/lodash.ismatch": "^4.4.0"
54
54
  },
55
55
  "files": [
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "f6a5d6d2a6c2bbc3e8a9b05aad234c30bb0a7bcb"
61
+ "gitHead": "f1df977c5cc020a300015265ab20ad4c67ba51eb"
62
62
  }