@deephaven/dashboard 0.37.4-logout.1 → 0.37.4-logout.17

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 function 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,KAAK,IAGVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,OAAOC,QAAQ,MAAM,iBAAiB;AACtC,OAAOC,YAAY,MAAM,0BAA0B;AAAC;AAAA,OAG7CC,WAAW;AAAA,OACXC,gBAAgB;AAAA,OAChBC,eAAe;AAAA;AAQtB,IAAMC,eAAe,GAAG,GAAG;AAE3B,IAAMC,gBAAgB,GAAG,MAAMC,SAAS;AAExC,IAAMC,YAAY,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC;AAkBtC,OAAO,SAASC,SAAS,OAYO;EAAA,IAZN;IACxBC,EAAE,GAAG,SAAS;IACdC,QAAQ;IACRC,cAAc;IACdC,YAAY;IACZC,cAAc,GAAGR,YAAY;IAC7BS,oBAAoB,GAAGX,gBAAgB;IACvCY,oBAAoB,GAAGZ,gBAAgB;IACvCa,mBAAmB,GAAGb,gBAAgB;IACtCc,iBAAiB,GAAGjB,gBAAgB;IACpCkB,OAAO;IACPC;EACc,CAAC;EACf,IAAMC,aAAa,GAAGzB,MAAM,CAAiB,IAAI,CAAC;EAClD,IAAM,CAAC0B,aAAa,EAAEC,gBAAgB,CAAC,GAAG1B,QAAQ,CAAC,KAAK,CAAC;EACzD,IAAM,CAAC2B,MAAM,EAAEC,SAAS,CAAC,GAAG5B,QAAQ,EAAgB;EAEpDH,SAAS,CACP,SAASgC,aAAa,GAAG;IACvB,IAAI,CAACL,aAAa,CAACM,OAAO,EAAE;MAC1BF,SAAS,CAACpB,SAAS,CAAC;MACpB;IACF;IACA,IAAMuB,MAAM,qBACP5B,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L,YAAY,CAAC;IAC/C,OAAO,MAAM;MACXI,MAAM,CAACE,mBAAmB,CAAC,QAAQ,EAAEN,YAAY,CAAC;IACpD,CAAC;EACH,CAAC,EACD,CAACA,YAAY,CAAC,CACf;EAED,oBACE;IAAK,SAAS,EAAC;EAAiC,gBAC9C;IAAK,SAAS,EAAC,aAAa;IAAC,GAAG,EAAEnB;EAAc,EAAG,EAClDC,aAAa,IAAIE,MAAM,iBACtB,oBAAC,eAAe;IACd,cAAc,EAAEZ,cAAe;IAC/B,EAAE,EAAEF,EAAG;IACP,MAAM,EAAEc,MAAO;IACf,YAAY,EAAEX,YAAa;IAC3B,cAAc,EAAEE,oBAAqB;IACrC,mBAAmB,EAAEE,mBAAoB;IACzC,OAAO,EAAEE,OAAQ;IACjB,SAAS,EAAEC;EAAU,GAEpBT,QAAQ,CAEZ,CACG;AAEV;AAEA,eAAeF,SAAS"}
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","_ref","id","children","emptyDashboard","layoutConfig","layoutSettings","onLayoutConfigChange","onGoldenLayoutChange","onLayoutInitialized","fallbackComponent","hydrate","dehydrate","layoutElement","isInitialized","setIsInitialized","layout","setLayout","initDashboard","current","config","_objectSpread","makeDefaultLayout","settings","assign","content","newLayout","onInit","off","on","setFallbackComponent","init","destroy","handleResize","isInitialised","updateSize","initResizeEventListner","window","addEventListener","removeEventListener","createElement","className","ref","onLayoutChange"],"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 function 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,KAAK,IAGVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,OAAOC,QAAQ,MAAM,iBAAiB;AACtC,OAAOC,YAAY,MAAM,0BAA0B;AAAC;AAAA,OAG7CC,WAAW;AAAA,OACXC,gBAAgB;AAAA,OAChBC,eAAe;AAAA;AAQtB,IAAMC,eAAe,GAAG,GAAG;AAE3B,IAAMC,gBAAgB,GAAGA,CAAA,KAAMC,SAAS;AAExC,IAAMC,YAAY,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC;AAkBtC,OAAO,SAASC,SAASA,CAAAC,IAAA,EAYO;EAAA,IAZN;IACxBC,EAAE,GAAG,SAAS;IACdC,QAAQ;IACRC,cAAc;IACdC,YAAY;IACZC,cAAc,GAAGT,YAAY;IAC7BU,oBAAoB,GAAGZ,gBAAgB;IACvCa,o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":"DashboardLayout.js","names":["React","useCallback","useEffect","useMemo","useState","PropTypes","Log","usePrevious","Provider","useDispatch","useSelector","useStore","PanelManager","PanelErrorBoundary","LayoutUtils","dehydrate","dehydrateDefault","hydrate","hydrateDefault","PanelEvent","GLPropTypes","useListener","getDashboardData","updateDashboardData","log","module","EMPTY_OBJECT","Object","freeze","DEFAULT_LAYOUT_CONFIG","DEFAULT_CALLBACK","undefined","FALLBACK_CALLBACK","props","DashboardLayout","id","children","emptyDashboard","layout","layoutConfig","onLayoutChange","onLayoutInitialized","dispatch","data","state","isDashboardEmpty","setIsDashboardEmpty","isItemDragging","setIsItemDragging","lastConfig","setLastConfig","initialClosedPanels","closed","isDashboardInitialized","setIsDashboardInitialized","hydrateMap","Map","dehydrateMap","store","registerComponent","name","componentType","componentHydrate","componentDehydrate","debug2","renderComponent","ref","CType","glContainer","glEventHub","wrappedComponent","forwardRef","cleanup","set","hydrateComponent","get","dehydrateComponent","config","panelManager","openedMap","handleLayoutStateChanged","glConfig","toConfig","contentConfig","content","dehydratedLayoutConfig","dehydrateLayoutConfig","hasChanged","isEqual","debug","root","contentItems","length","handleLayoutItemPickedUp","component","componentId","getIdFromContainer","eventHub","emit","DRAGGING","handleLayoutItemDropped","DROPPED","handleComponentCreated","item","element","cssComponent","replace","toLowerCase","cssClass","addClass","TITLE_CHANGED","previousLayoutConfig","loadNewConfig","hydrateLayoutConfig","remove","i","addChild","Children","map","child","cloneElement","propTypes","string","isRequired","node","shape","Layout","arrayOf","func"],"sources":["../src/DashboardLayout.tsx"],"sourcesContent":["import React, {\n ReactElement,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport PropTypes from 'prop-types';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type {\n Container,\n EventEmitter,\n ItemConfigType,\n ReactComponentConfig,\n} from '@deephaven/golden-layout';\nimport Log from '@deephaven/log';\nimport { usePrevious } from '@deephaven/react-hooks';\nimport { RootState } from '@deephaven/redux';\nimport { Provider, useDispatch, useSelector, useStore } from 'react-redux';\nimport PanelManager, { ClosedPanels } from './PanelManager';\nimport PanelErrorBoundary from './PanelErrorBoundary';\nimport LayoutUtils from './layout/LayoutUtils';\nimport {\n dehydrate as dehydrateDefault,\n hydrate as hydrateDefault,\n} from './DashboardUtils';\nimport PanelEvent from './PanelEvent';\nimport { GLPropTypes, useListener } from './layout';\nimport { getDashboardData, updateDashboardData } from './redux';\nimport {\n PanelComponentType,\n PanelDehydrateFunction,\n PanelHydrateFunction,\n} from './DashboardPlugin';\n\nexport type DashboardLayoutConfig = ItemConfigType[];\n\nconst log = Log.module('DashboardLayout');\n\nconst EMPTY_OBJECT = Object.freeze({});\n\nconst DEFAULT_LAYOUT_CONFIG: DashboardLayoutConfig = [];\n\nconst DEFAULT_CALLBACK = () => undefined;\n\n// If a component isn't registered, just pass through the props so they are saved if a plugin is loaded later\nconst FALLBACK_CALLBACK = (props: unknown) => props;\n\ntype DashboardData = {\n closed?: ClosedPanels;\n};\n\ninterface DashboardLayoutProps {\n id: string;\n\n // Default hydrate/dehydration functions\n hydrate?: PanelHydrateFunction;\n dehydrate?: PanelDehydrateFunction;\n layout: GoldenLayout;\n layoutConfig?: DashboardLayoutConfig;\n onLayoutChange?: (dehydratedLayout: DashboardLayoutConfig) => void;\n onLayoutInitialized?: () => void;\n data?: DashboardData;\n children?: React.ReactNode | React.ReactNode[];\n emptyDashboard?: React.ReactNode;\n}\n\n/**\n * DashboardLayout component. Handles hydrating, dehydrating components, listening for dragging panels.\n */\nexport function DashboardLayout({\n id,\n children,\n emptyDashboard = <div>Dashboard is empty.</div>,\n layout,\n layoutConfig = DEFAULT_LAYOUT_CONFIG,\n onLayoutChange = DEFAULT_CALLBACK,\n onLayoutInitialized = DEFAULT_CALLBACK,\n hydrate = hydrateDefault,\n dehydrate = dehydrateDefault,\n}: DashboardLayoutProps): JSX.Element {\n const dispatch = useDispatch();\n const data =\n useSelector<RootState>(state => getDashboardData(state, id)) ??\n EMPTY_OBJECT;\n\n const [isDashboardEmpty, setIsDashboardEmpty] = useState(false);\n const [isItemDragging, setIsItemDragging] = useState(false);\n const [lastConfig, setLastConfig] = useState<DashboardLayoutConfig>();\n const [initialClosedPanels] = useState<ReactComponentConfig[] | undefined>(\n (data as DashboardData)?.closed ?? []\n );\n const [isDashboardInitialized, setIsDashboardInitialized] = useState(false);\n\n const hydrateMap = useMemo(() => new Map(), []);\n const dehydrateMap = useMemo(() => new Map(), []);\n const store = useStore();\n const registerComponent = useCallback(\n (\n name: string,\n componentType: PanelComponentType,\n componentHydrate = hydrate,\n componentDehydrate = dehydrate\n ) => {\n log.debug2(\n 'registerComponent',\n name,\n componentType,\n componentHydrate,\n componentDehydrate\n );\n\n function renderComponent(\n props: { glContainer: Container; glEventHub: EventEmitter },\n ref: unknown\n ) {\n // Cast it to an `any` type so we can pass the ref in correctly.\n // ComponentType doesn't seem to work right, ReactNode is also incorrect\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const CType = componentType as any;\n\n // Props supplied by GoldenLayout\n // eslint-disable-next-line react/prop-types\n const { glContainer, glEventHub } = props;\n return (\n <Provider store={store}>\n <PanelErrorBoundary\n glContainer={glContainer}\n glEventHub={glEventHub}\n >\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <CType {...props} ref={ref} />\n </PanelErrorBoundary>\n </Provider>\n );\n }\n\n const wrappedComponent = React.forwardRef(renderComponent);\n const cleanup = layout.registerComponent(name, wrappedComponent);\n hydrateMap.set(name, componentHydrate);\n dehydrateMap.set(name, componentDehydrate);\n return cleanup;\n },\n [hydrate, dehydrate, hydrateMap, dehydrateMap, layout, store]\n );\n const hydrateComponent = useCallback(\n (name, props) => (hydrateMap.get(name) ?? FALLBACK_CALLBACK)(props, id),\n [hydrateMap, id]\n );\n const dehydrateComponent = useCallback(\n (name, config) => (dehydrateMap.get(name) ?? FALLBACK_CALLBACK)(config, id),\n [dehydrateMap, id]\n );\n const panelManager = useMemo(\n () =>\n new PanelManager(\n layout,\n hydrateComponent,\n dehydrateComponent,\n new Map(),\n initialClosedPanels,\n ({ closed, openedMap }) => {\n dispatch(updateDashboardData(id, { closed, openedMap }));\n }\n ),\n [\n dehydrateComponent,\n dispatch,\n hydrateComponent,\n id,\n initialClosedPanels,\n layout,\n ]\n );\n\n const handleLayoutStateChanged = useCallback(() => {\n // we don't want to emit stateChanges that happen during item drags or else\n // we risk the last saved state being one without that panel in the layout entirely\n if (isItemDragging) return;\n\n if (!isDashboardInitialized) {\n onLayoutInitialized();\n setIsDashboardInitialized(true);\n }\n\n const glConfig = layout.toConfig();\n const contentConfig = glConfig.content;\n const dehydratedLayoutConfig = LayoutUtils.dehydrateLayoutConfig(\n contentConfig,\n dehydrateComponent\n );\n const hasChanged =\n lastConfig == null ||\n !LayoutUtils.isEqual(lastConfig, dehydratedLayoutConfig);\n\n log.debug(\n 'handleLayoutStateChanged',\n hasChanged,\n contentConfig,\n dehydratedLayoutConfig\n );\n\n if (hasChanged) {\n setIsDashboardEmpty(layout.root.contentItems.length === 0);\n\n setLastConfig(dehydratedLayoutConfig);\n\n onLayoutChange(dehydratedLayoutConfig);\n }\n }, [\n dehydrateComponent,\n isDashboardInitialized,\n isItemDragging,\n lastConfig,\n layout,\n onLayoutChange,\n onLayoutInitialized,\n ]);\n\n const handleLayoutItemPickedUp = useCallback(\n (component: Container) => {\n const componentId = LayoutUtils.getIdFromContainer(component);\n layout.eventHub.emit(PanelEvent.DRAGGING, componentId);\n setIsItemDragging(true);\n },\n [layout.eventHub]\n );\n\n const handleLayoutItemDropped = useCallback(\n (component: Container) => {\n const componentId = LayoutUtils.getIdFromContainer(component);\n layout.eventHub.emit(PanelEvent.DROPPED, componentId);\n setIsItemDragging(false);\n },\n [layout.eventHub]\n );\n\n const handleComponentCreated = useCallback(item => {\n log.debug2('handleComponentCreated', item);\n\n if (\n item == null ||\n item.config == null ||\n item.config.component == null ||\n item.element == null\n ) {\n return;\n }\n\n const cssComponent = item.config.component\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase();\n const cssClass = `${cssComponent}-component`;\n item.element.addClass(cssClass);\n }, []);\n\n useListener(layout, 'stateChanged', handleLayoutStateChanged);\n useListener(layout, 'itemPickedUp', handleLayoutItemPickedUp);\n useListener(layout, 'itemDropped', handleLayoutItemDropped);\n useListener(layout, 'componentCreated', handleComponentCreated);\n useListener(\n layout.eventHub,\n PanelEvent.TITLE_CHANGED,\n handleLayoutStateChanged\n );\n\n const previousLayoutConfig = usePrevious(layoutConfig);\n useEffect(\n function loadNewConfig() {\n if (\n previousLayoutConfig !== layoutConfig &&\n layoutConfig !== lastConfig\n ) {\n log.debug('Setting new layout content...');\n const content = LayoutUtils.hydrateLayoutConfig(\n layoutConfig,\n hydrateComponent\n );\n // Remove the old layout before add the new one\n while (layout.root.contentItems.length > 0) {\n layout.root.contentItems[0].remove();\n }\n\n // Add the new content. It is usally just one item from the root\n for (let i = 0; i < content.length; i += 1) {\n layout.root.addChild(content[i]);\n }\n\n setIsDashboardEmpty(layout.root.contentItems.length === 0);\n }\n },\n [\n hydrateComponent,\n layout,\n layoutConfig,\n lastConfig,\n panelManager,\n previousLayoutConfig,\n ]\n );\n\n return (\n <>\n {isDashboardEmpty && emptyDashboard}\n {React.Children.map(children, child =>\n child != null\n ? React.cloneElement(child as ReactElement, {\n id,\n layout,\n panelManager,\n registerComponent,\n })\n : null\n )}\n </>\n );\n}\n\nDashboardLayout.propTypes = {\n id: PropTypes.string.isRequired,\n children: PropTypes.node,\n data: PropTypes.shape({}),\n emptyDashboard: PropTypes.node,\n layout: GLPropTypes.Layout.isRequired,\n layoutConfig: PropTypes.arrayOf(PropTypes.shape({})),\n onLayoutChange: PropTypes.func,\n onLayoutInitialized: PropTypes.func,\n};\n\nexport default DashboardLayout;\n"],"mappings":";AAAA,OAAOA,KAAK,IAEVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,OAAO;AACd,OAAOC,SAAS,MAAM,YAAY;AAQlC,OAAOC,GAAG,MAAM,gB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;EACzBxF,cAAc,EAAEhC,SAAS,CAACuH,IAAI;EAC9BtF,MAAM,EAAElB,WAAW,CAAC0G,MAAM,CAACH,UAAU;EACrCpF,YAAY,EAAElC,SAAS,CAAC0H,OAAO,CAAC1H,SAAS,CAACwH,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;EACpDrF,cAAc,EAAEnC,SAAS,CAAC2H,IAAI;EAC9BvF,mBAAmB,EAAEpC,SAAS,CAAC2H;AACjC,CAAC;AAED,eAAe9F,eAAe"}
1
+ {"version":3,"file":"DashboardLayout.js","names":["React","useCallback","useEffect","useMemo","useState","PropTypes","Log","usePrevious","Provider","useDispatch","useSelector","useStore","PanelManager","PanelErrorBoundary","LayoutUtils","dehydrate","dehydrateDefault","hydrate","hydrateDefault","PanelEvent","GLPropTypes","useListener","getDashboardData","updateDashboardData","log","module","EMPTY_OBJECT","Object","freeze","DEFAULT_LAYOUT_CONFIG","DEFAULT_CALLBACK","undefined","FALLBACK_CALLBACK","props","DashboardLayout","_ref","_useSelector","_closed","id","children","emptyDashboard","createElement","layout","layoutConfig","onLayoutChange","onLayoutInitialized","dispatch","data","state","isDashboardEmpty","setIsDashboardEmpty","isItemDragging","setIsItemDragging","lastConfig","setLastConfig","initialClosedPanels","closed","isDashboardInitialized","setIsDashboardInitialized","hydrateMap","Map","dehydrateMap","store","registerComponent","name","componentType","componentHydrate","arguments","length","componentDehydrate","debug2","renderComponent","ref","CType","glContainer","glEventHub","_extends","wrappedComponent","forwardRef","cleanup","set","hydrateComponent","_hydrateMap$get","get","dehydrateComponent","config","_dehydrateMap$get","panelManager","_ref2","openedMap","handleLayoutStateChanged","glConfig","toConfig","contentConfig","content","dehydratedLayoutConfig","dehydrateLayoutConfig","hasChanged","isEqual","debug","root","contentItems","handleLayoutItemPickedUp","component","componentId","getIdFromContainer","eventHub","emit","DRAGGING","handleLayoutItemDropped","DROPPED","handleComponentCreated","item","element","cssComponent","replace","toLowerCase","cssClass","concat","addClass","TITLE_CHANGED","previousLayoutConfig","loadNewConfig","hydrateLayoutConfig","remove","i","addChild","Fragment","Children","map","child","cloneElement","propTypes","string","isRequired","node","shape","Layout","arrayOf","func"],"sources":["../src/DashboardLayout.tsx"],"sourcesContent":["import React, {\n ReactElement,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport PropTypes from 'prop-types';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type {\n Container,\n EventEmitter,\n ItemConfigType,\n ReactComponentConfig,\n} from '@deephaven/golden-layout';\nimport Log from '@deephaven/log';\nimport { usePrevious } from '@deephaven/react-hooks';\nimport { RootState } from '@deephaven/redux';\nimport { Provider, useDispatch, useSelector, useStore } from 'react-redux';\nimport PanelManager, { ClosedPanels } from './PanelManager';\nimport PanelErrorBoundary from './PanelErrorBoundary';\nimport LayoutUtils from './layout/LayoutUtils';\nimport {\n dehydrate as dehydrateDefault,\n hydrate as hydrateDefault,\n} from './DashboardUtils';\nimport PanelEvent from './PanelEvent';\nimport { GLPropTypes, useListener } from './layout';\nimport { getDashboardData, updateDashboardData } from './redux';\nimport {\n PanelComponentType,\n PanelDehydrateFunction,\n PanelHydrateFunction,\n} from './DashboardPlugin';\n\nexport type DashboardLayoutConfig = ItemConfigType[];\n\nconst log = Log.module('DashboardLayout');\n\nconst EMPTY_OBJECT = Object.freeze({});\n\nconst DEFAULT_LAYOUT_CONFIG: DashboardLayoutConfig = [];\n\nconst DEFAULT_CALLBACK = () => undefined;\n\n// If a component isn't registered, just pass through the props so they are saved if a plugin is loaded later\nconst FALLBACK_CALLBACK = (props: unknown) => props;\n\ntype DashboardData = {\n closed?: ClosedPanels;\n};\n\ninterface DashboardLayoutProps {\n id: string;\n\n // Default hydrate/dehydration functions\n hydrate?: PanelHydrateFunction;\n dehydrate?: PanelDehydrateFunction;\n layout: GoldenLayout;\n layoutConfig?: DashboardLayoutConfig;\n onLayoutChange?: (dehydratedLayout: DashboardLayoutConfig) => void;\n onLayoutInitialized?: () => void;\n data?: DashboardData;\n children?: React.ReactNode | React.ReactNode[];\n emptyDashboard?: React.ReactNode;\n}\n\n/**\n * DashboardLayout component. Handles hydrating, dehydrating components, listening for dragging panels.\n */\nexport function DashboardLayout({\n id,\n children,\n emptyDashboard = <div>Dashboard is empty.</div>,\n layout,\n layoutConfig = DEFAULT_LAYOUT_CONFIG,\n onLayoutChange = DEFAULT_CALLBACK,\n onLayoutInitialized = DEFAULT_CALLBACK,\n hydrate = hydrateDefault,\n dehydrate = dehydrateDefault,\n}: DashboardLayoutProps): JSX.Element {\n const dispatch = useDispatch();\n const data =\n useSelector<RootState>(state => getDashboardData(state, id)) ??\n EMPTY_OBJECT;\n\n const [isDashboardEmpty, setIsDashboardEmpty] = useState(false);\n const [isItemDragging, setIsItemDragging] = useState(false);\n const [lastConfig, setLastConfig] = useState<DashboardLayoutConfig>();\n const [initialClosedPanels] = useState<ReactComponentConfig[] | undefined>(\n (data as DashboardData)?.closed ?? []\n );\n const [isDashboardInitialized, setIsDashboardInitialized] = useState(false);\n\n const hydrateMap = useMemo(() => new Map(), []);\n const dehydrateMap = useMemo(() => new Map(), []);\n const store = useStore();\n const registerComponent = useCallback(\n (\n name: string,\n componentType: PanelComponentType,\n componentHydrate = hydrate,\n componentDehydrate = dehydrate\n ) => {\n log.debug2(\n 'registerComponent',\n name,\n componentType,\n componentHydrate,\n componentDehydrate\n );\n\n function renderComponent(\n props: { glContainer: Container; glEventHub: EventEmitter },\n ref: unknown\n ) {\n // Cast it to an `any` type so we can pass the ref in correctly.\n // ComponentType doesn't seem to work right, ReactNode is also incorrect\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const CType = componentType as any;\n\n // Props supplied by GoldenLayout\n // eslint-disable-next-line react/prop-types\n const { glContainer, glEventHub } = props;\n return (\n <Provider store={store}>\n <PanelErrorBoundary\n glContainer={glContainer}\n glEventHub={glEventHub}\n >\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <CType {...props} ref={ref} />\n </PanelErrorBoundary>\n </Provider>\n );\n }\n\n const wrappedComponent = React.forwardRef(renderComponent);\n const cleanup = layout.registerComponent(name, wrappedComponent);\n hydrateMap.set(name, componentHydrate);\n dehydrateMap.set(name, componentDehydrate);\n return cleanup;\n },\n [hydrate, dehydrate, hydrateMap, dehydrateMap, layout, store]\n );\n const hydrateComponent = useCallback(\n (name, props) => (hydrateMap.get(name) ?? FALLBACK_CALLBACK)(props, id),\n [hydrateMap, id]\n );\n const dehydrateComponent = useCallback(\n (name, config) => (dehydrateMap.get(name) ?? FALLBACK_CALLBACK)(config, id),\n [dehydrateMap, id]\n );\n const panelManager = useMemo(\n () =>\n new PanelManager(\n layout,\n hydrateComponent,\n dehydrateComponent,\n new Map(),\n initialClosedPanels,\n ({ closed, openedMap }) => {\n dispatch(updateDashboardData(id, { closed, openedMap }));\n }\n ),\n [\n dehydrateComponent,\n dispatch,\n hydrateComponent,\n id,\n initialClosedPanels,\n layout,\n ]\n );\n\n const handleLayoutStateChanged = useCallback(() => {\n // we don't want to emit stateChanges that happen during item drags or else\n // we risk the last saved state being one without that panel in the layout entirely\n if (isItemDragging) return;\n\n if (!isDashboardInitialized) {\n onLayoutInitialized();\n setIsDashboardInitialized(true);\n }\n\n const glConfig = layout.toConfig();\n const contentConfig = glConfig.content;\n const dehydratedLayoutConfig = LayoutUtils.dehydrateLayoutConfig(\n contentConfig,\n dehydrateComponent\n );\n const hasChanged =\n lastConfig == null ||\n !LayoutUtils.isEqual(lastConfig, dehydratedLayoutConfig);\n\n log.debug(\n 'handleLayoutStateChanged',\n hasChanged,\n contentConfig,\n dehydratedLayoutConfig\n );\n\n if (hasChanged) {\n setIsDashboardEmpty(layout.root.contentItems.length === 0);\n\n setLastConfig(dehydratedLayoutConfig);\n\n onLayoutChange(dehydratedLayoutConfig);\n }\n }, [\n dehydrateComponent,\n isDashboardInitialized,\n isItemDragging,\n lastConfig,\n layout,\n onLayoutChange,\n onLayoutInitialized,\n ]);\n\n const handleLayoutItemPickedUp = useCallback(\n (component: Container) => {\n const componentId = LayoutUtils.getIdFromContainer(component);\n layout.eventHub.emit(PanelEvent.DRAGGING, componentId);\n setIsItemDragging(true);\n },\n [layout.eventHub]\n );\n\n const handleLayoutItemDropped = useCallback(\n (component: Container) => {\n const componentId = LayoutUtils.getIdFromContainer(component);\n layout.eventHub.emit(PanelEvent.DROPPED, componentId);\n setIsItemDragging(false);\n },\n [layout.eventHub]\n );\n\n const handleComponentCreated = useCallback(item => {\n log.debug2('handleComponentCreated', item);\n\n if (\n item == null ||\n item.config == null ||\n item.config.component == null ||\n item.element == null\n ) {\n return;\n }\n\n const cssComponent = item.config.component\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase();\n const cssClass = `${cssComponent}-component`;\n item.element.addClass(cssClass);\n }, []);\n\n useListener(layout, 'stateChanged', handleLayoutStateChanged);\n useListener(layout, 'itemPickedUp', handleLayoutItemPickedUp);\n useListener(layout, 'itemDropped', handleLayoutItemDropped);\n useListener(layout, 'componentCreated', handleComponentCreated);\n useListener(\n layout.eventHub,\n PanelEvent.TITLE_CHANGED,\n handleLayoutStateChanged\n );\n\n const previousLayoutConfig = usePrevious(layoutConfig);\n useEffect(\n function loadNewConfig() {\n if (\n previousLayoutConfig !== layoutConfig &&\n layoutConfig !== lastConfig\n ) {\n log.debug('Setting new layout content...');\n const content = LayoutUtils.hydrateLayoutConfig(\n layoutConfig,\n hydrateComponent\n );\n // Remove the old layout before add the new one\n while (layout.root.contentItems.length > 0) {\n layout.root.contentItems[0].remove();\n }\n\n // Add the new content. It is usally just one item from the root\n for (let i = 0; i < content.length; i += 1) {\n layout.root.addChild(content[i]);\n }\n\n setIsDashboardEmpty(layout.root.contentItems.length === 0);\n }\n },\n [\n hydrateComponent,\n layout,\n layoutConfig,\n lastConfig,\n panelManager,\n previousLayoutConfig,\n ]\n );\n\n return (\n <>\n {isDashboardEmpty && emptyDashboard}\n {React.Children.map(children, child =>\n child != null\n ? React.cloneElement(child as ReactElement, {\n id,\n layout,\n panelManager,\n registerComponent,\n })\n : null\n )}\n </>\n );\n}\n\nDashboardLayout.propTypes = {\n id: PropTypes.string.isRequired,\n children: PropTypes.node,\n data: PropTypes.shape({}),\n emptyDashboard: PropTypes.node,\n layout: GLPropTypes.Layout.isRequired,\n layoutConfig: PropTypes.arrayOf(PropTypes.shape({})),\n onLayoutChange: PropTypes.func,\n onLayoutInitialized: PropTypes.func,\n};\n\nexport default DashboardLayout;\n"],"mappings":";AAAA,OAAOA,KAAK,IAEVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,OAAO;AACd,OAAOC,SAAS,MAAM,YAAY;AAQlC,OAAOC,GAAG,MAAM,gBAAgB;AAChC,SAASC,WAAW,QAAQ,wBAAwB;AAEpD,SAASC,QAAQ,EAAEC,WAAW,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,aAAa;AAAC,OACpEC,YAAY;AAAA,OACZC,kBAAkB;AAAA,OAClBC,WAAW;AAAA,SAEhBC,SAAS,IAAIC,gBAAgB,EAC7BC,OAAO,IAAIC,cAAc;AAAA,OAEpBC,UAAU;AAAA,SACRC,WAAW,EAAEC,WAAW;AAAA,SACxBC,gBAAgB,EAAEC,mBAAmB;AAS9C,IAAMC,GAAG,GAAGlB,GAAG,CAACmB,MAAM,CAAC,iBAAiB,CAAC;AAEzC,IAAMC,YAAY,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC;AAEtC,IAAMC,qBAA4C,GAAG,EAAE;AAEvD,IAAMC,gBAAgB,GAAGA,CAAA,KAAMC,SAAS;;AAExC;AACA,IAAMC,iBAAiB,GAAIC,KAAc,IAAKA,KAAK;AAqBnD;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAAC,IAAA,EAUO;EAAA,IAAAC,YAAA,EAAAC,OAAA;EAAA,IAVN;IAC9BC,EAAE;IACFC,QAAQ;IACRC,cAAc,gBAAGxC,KAAA,CAAAyC,aAAA,cAAK,qBAAwB,CAAC;IAC/CC,MAAM;IACNC,YAAY,GAA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AC,CAAC,CAAC,CAAC,CAAC;EACpD5F,cAAc,EAAEvC,SAAS,CAACsI,IAAI;EAC9B9F,mBAAmB,EAAExC,SAAS,CAACsI;AACjC,CAAC;AAED,eAAezG,eAAe"}
@@ -4,6 +4,13 @@ import PanelManager from "./PanelManager.js";
4
4
  /**
5
5
  * Alias for the return type of React.forwardRef()
6
6
  */
7
+ /**
8
+ * Panel components can provide static props that provide meta data about the
9
+ * panel.
10
+ */
11
+ /**
12
+ * Panels defined as functional components have to use React.forwardRef.
13
+ */
7
14
  export function isWrappedComponent(type) {
8
15
  return (type === null || type === void 0 ? void 0 : type.WrappedComponent) !== undefined;
9
16
  }
@@ -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 {\n Component,\n ComponentType,\n ForwardRefExoticComponent,\n PropsWithoutRef,\n RefAttributes,\n} from 'react';\nimport { ConnectedComponent } from 'react-redux';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type {\n ReactComponentConfig,\n EventEmitter,\n Container,\n} from '@deephaven/golden-layout';\nimport PanelManager from './PanelManager';\n\n/**\n * Alias for the return type of React.forwardRef()\n */\nexport type ForwardRefComponentType<P, R> = ForwardRefExoticComponent<\n PropsWithoutRef<P> & RefAttributes<R>\n>;\n\n/**\n * Panel components can provide static props that provide meta data about the\n * panel.\n */\nexport interface PanelStaticMetaData {\n /**\n * Should be set to the same name as the component type.\n * @deprecated Use `displayName` instead.\n */\n COMPONENT?: string;\n\n /** Title of the panel. */\n TITLE?: string;\n}\n\n/**\n * Panels defined as functional components have to use React.forwardRef.\n */\nexport type PanelFunctionComponentType<P, R> = ForwardRefComponentType<P, R> &\n PanelStaticMetaData;\n\nexport type WrappedComponentType<\n P extends PanelProps,\n C extends ComponentType<P>\n> = ConnectedComponent<C, P>;\n\nexport type PanelComponentType<\n P extends PanelProps = PanelProps,\n C extends ComponentType<P> = ComponentType<P>\n> = (\n | ComponentType<P>\n | WrappedComponentType<P, C>\n | PanelFunctionComponentType<P, unknown>\n) &\n PanelStaticMetaData;\n\nexport function isWrappedComponent<\n P extends PanelProps,\n C extends ComponentType<P>\n>(type: PanelComponentType<P, C>): type is WrappedComponentType<P, C> {\n return (type as WrappedComponentType<P, C>)?.WrappedComponent !== undefined;\n}\n\nexport type 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,SAEEA,aAAa,QAIR,OAAO;AAEd,OAAOC,YAAY,MAAM,0BAA0B;AAAC,OAM7CC,YAAY;AAEnB;AACA;AACA;AAyCA,OAAO,SAASC,kBAAkB,CAGhCC,IAA8B,EAAsC;EACpE,OAAO,CAACA,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAiCC,gBAAgB,MAAKC,SAAS;AAC7E;AAmEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsB,CACpCC,KAA6C,EACL;EACxC,OACE,OAAOA,KAAK,CAACC,EAAE,KAAK,QAAQ,IAC5BD,KAAK,CAACE,MAAM,YAAYT,YAAY,IACpCO,KAAK,CAACG,YAAY,YAAYT,YAAY,IAC1C,OAAOM,KAAK,CAACI,iBAAiB,KAAK,UAAU;AAEjD;AAEA,OAAO,SAASC,4BAA4B,CAC1CL,KAA6C,EACG;EAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC,EAAE;IAClC,MAAM,IAAIM,KAAK,iEAC4CN,KAAK,EAC/D;EACH;AACF"}
1
+ {"version":3,"file":"DashboardPlugin.js","names":["ComponentType","GoldenLayout","PanelManager","isWrappedComponent","type","WrappedComponent","undefined","isDashboardPluginProps","props","id","layout","panelManager","registerComponent","assertIsDashboardPluginProps","Error","concat"],"sources":["../src/DashboardPlugin.ts"],"sourcesContent":["import {\n Component,\n ComponentType,\n ForwardRefExoticComponent,\n PropsWithoutRef,\n RefAttributes,\n} from 'react';\nimport { ConnectedComponent } from 'react-redux';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type {\n ReactComponentConfig,\n EventEmitter,\n Container,\n} from '@deephaven/golden-layout';\nimport PanelManager from './PanelManager';\n\n/**\n * Alias for the return type of React.forwardRef()\n */\nexport type ForwardRefComponentType<P, R> = ForwardRefExoticComponent<\n PropsWithoutRef<P> & RefAttributes<R>\n>;\n\n/**\n * Panel components can provide static props that provide meta data about the\n * panel.\n */\nexport interface PanelStaticMetaData {\n /**\n * Should be set to the same name as the component type.\n * @deprecated Use `displayName` instead.\n */\n COMPONENT?: string;\n\n /** Title of the panel. */\n TITLE?: string;\n}\n\n/**\n * Panels defined as functional components have to use React.forwardRef.\n */\nexport type PanelFunctionComponentType<P, R> = ForwardRefComponentType<P, R> &\n PanelStaticMetaData;\n\nexport type WrappedComponentType<\n P extends PanelProps,\n C extends ComponentType<P>\n> = ConnectedComponent<C, P>;\n\nexport type PanelComponentType<\n P extends PanelProps = PanelProps,\n C extends ComponentType<P> = ComponentType<P>\n> = (\n | ComponentType<P>\n | WrappedComponentType<P, C>\n | PanelFunctionComponentType<P, unknown>\n) &\n PanelStaticMetaData;\n\nexport function isWrappedComponent<\n P extends PanelProps,\n C extends ComponentType<P>\n>(type: PanelComponentType<P, C>): type is WrappedComponentType<P, C> {\n return (type as WrappedComponentType<P, C>)?.WrappedComponent !== undefined;\n}\n\nexport type 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,SAEEA,aAAa,QAIR,OAAO;AAEd,OAAOC,YAAY,MAAM,0BAA0B;AAAC,OAM7CC,YAAY;AAEnB;AACA;AACA;AAKA;AACA;AACA;AACA;AAYA;AACA;AACA;AAmBA,OAAO,SAASC,kBAAkBA,CAGhCC,IAA8B,EAAsC;EACpE,OAAO,CAACA,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAiCC,gBAAgB,MAAKC,SAAS;AAC7E;AAmEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CACpCC,KAA6C,EACL;EACxC,OACE,OAAOA,KAAK,CAACC,EAAE,KAAK,QAAQ,IAC5BD,KAAK,CAACE,MAAM,YAAYT,YAAY,IACpCO,KAAK,CAACG,YAAY,YAAYT,YAAY,IAC1C,OAAOM,KAAK,CAACI,iBAAiB,KAAK,UAAU;AAEjD;AAEA,OAAO,SAASC,4BAA4BA,CAC1CL,KAA6C,EACG;EAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC,EAAE;IAClC,MAAM,IAAIM,KAAK,0DAAAC,MAAA,CAC4CP,KAAK,CAChE,CAAC;EACH;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardUtils.js","names":["dehydrate","config","props","componentState","metadata","panelState","newProps","type","hydrate","localDashboardId"],"sources":["../src/DashboardUtils.ts"],"sourcesContent":["import { PanelConfig, PanelProps } from './DashboardPlugin';\n\nexport type DashboardPanelProps = PanelProps & {\n localDashboardId: string;\n metadata?: Record<string, unknown>;\n};\n\n/**\n * Dehydrate an existing panel to allow it to be serialized/saved.\n * Just takes what's in the panels `metadata` in the props and `panelState` in\n * the component state, assumes it's serializable, and saves it.\n * @param config The panel config to dehydrate\n * @returns The dehydrated PanelConfig\n */\nexport function dehydrate(config: PanelConfig): PanelConfig | null {\n const { props, componentState } = config;\n const { metadata } = props;\n let { panelState = null } = props;\n if (componentState) {\n ({ panelState } = componentState);\n }\n const newProps: Record<string, unknown> = {};\n if (metadata != null) {\n newProps.metadata = metadata;\n }\n if (panelState != null) {\n newProps.panelState = panelState;\n }\n\n return {\n ...config,\n componentState: null,\n props: newProps,\n type: 'react-component',\n };\n}\n\n/**\n * Default hydration function. Just applies the dashboard ID. When used with dehydrate above,\n * the panels state will be stored in `panelState` prop.\n * @param props Panel props to hydrate\n * @param localDashboardId The local dashboard ID to hydrate the panel with\n * @returns The hydrated panel props\n */\nexport function hydrate(\n props: PanelProps & Record<string, unknown>,\n localDashboardId = ''\n): DashboardPanelProps {\n return {\n metadata: {},\n ...props,\n localDashboardId,\n };\n}\n\nexport default {\n dehydrate,\n hydrate,\n};\n"],"mappings":";;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,SAAS,CAACC,MAAmB,EAAsB;EACjE,IAAM;IAAEC,KAAK;IAAEC;EAAe,CAAC,GAAGF,MAAM;EACxC,IAAM;IAAEG;EAAS,CAAC,GAAGF,KAAK;EAC1B,IAAI;IAAEG,UAAU,GAAG;EAAK,CAAC,GAAGH,KAAK;EACjC,IAAIC,cAAc,EAAE;IAClB,CAAC;MAAEE;IAAW,CAAC,GAAGF,cAAc;EAClC;EACA,IAAMG,QAAiC,GAAG,CAAC,CAAC;EAC5C,IAAIF,QAAQ,IAAI,IAAI,EAAE;IACpBE,QAAQ,CAACF,QAAQ,GAAGA,QAAQ;EAC9B;EACA,IAAIC,UAAU,IAAI,IAAI,EAAE;IACtBC,QAAQ,CAACD,UAAU,GAAGA,UAAU;EAClC;EAEA,uCACKJ,MAAM;IACTE,cAAc,EAAE,IAAI;IACpBD,KAAK,EAAEI,QAAQ;IACfC,IAAI,EAAE;EAAiB;AAE3B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAO,CACrBN,KAA2C,EAEtB;EAAA,IADrBO,gBAAgB,uEAAG,EAAE;EAErB;IACEL,QAAQ,EAAE,CAAC;EAAC,GACTF,KAAK;IACRO;EAAgB;AAEpB;AAEA,eAAe;EACbT,SAAS;EACTQ;AACF,CAAC"}
1
+ {"version":3,"file":"DashboardUtils.js","names":["dehydrate","config","props","componentState","metadata","panelState","newProps","_objectSpread","type","hydrate","localDashboardId","arguments","length","undefined"],"sources":["../src/DashboardUtils.ts"],"sourcesContent":["import { PanelConfig, PanelProps } from './DashboardPlugin';\n\nexport type DashboardPanelProps = PanelProps & {\n localDashboardId: string;\n metadata?: Record<string, unknown>;\n};\n\n/**\n * Dehydrate an existing panel to allow it to be serialized/saved.\n * Just takes what's in the panels `metadata` in the props and `panelState` in\n * the component state, assumes it's serializable, and saves it.\n * @param config The panel config to dehydrate\n * @returns The dehydrated PanelConfig\n */\nexport function dehydrate(config: PanelConfig): PanelConfig | null {\n const { props, componentState } = config;\n const { metadata } = props;\n let { panelState = null } = props;\n if (componentState) {\n ({ panelState } = componentState);\n }\n const newProps: Record<string, unknown> = {};\n if (metadata != null) {\n newProps.metadata = metadata;\n }\n if (panelState != null) {\n newProps.panelState = panelState;\n }\n\n return {\n ...config,\n componentState: null,\n props: newProps,\n type: 'react-component',\n };\n}\n\n/**\n * Default hydration function. Just applies the dashboard ID. When used with dehydrate above,\n * the panels state will be stored in `panelState` prop.\n * @param props Panel props to hydrate\n * @param localDashboardId The local dashboard ID to hydrate the panel with\n * @returns The hydrated panel props\n */\nexport function hydrate(\n props: PanelProps & Record<string, unknown>,\n localDashboardId = ''\n): DashboardPanelProps {\n return {\n metadata: {},\n ...props,\n localDashboardId,\n };\n}\n\nexport default {\n dehydrate,\n hydrate,\n};\n"],"mappings":";;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,SAASA,CAACC,MAAmB,EAAsB;EACjE,IAAM;IAAEC,KAAK;IAAEC;EAAe,CAAC,GAAGF,MAAM;EACxC,IAAM;IAAEG;EAAS,CAAC,GAAGF,KAAK;EAC1B,IAAI;IAAEG,UAAU,GAAG;EAAK,CAAC,GAAGH,KAAK;EACjC,IAAIC,cAAc,EAAE;IAClB,CAAC;MAAEE;IAAW,CAAC,GAAGF,cAAc;EAClC;EACA,IAAMG,QAAiC,GAAG,CAAC,CAAC;EAC5C,IAAIF,QAAQ,IAAI,IAAI,EAAE;IACpBE,QAAQ,CAACF,QAAQ,GAAGA,QAAQ;EAC9B;EACA,IAAIC,UAAU,IAAI,IAAI,EAAE;IACtBC,QAAQ,CAACD,UAAU,GAAGA,UAAU;EAClC;EAEA,OAAAE,aAAA,CAAAA,aAAA,KACKN,MAAM;IACTE,cAAc,EAAE,IAAI;IACpBD,KAAK,EAAEI,QAAQ;IACfE,IAAI,EAAE;EAAiB;AAE3B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CACrBP,KAA2C,EAEtB;EAAA,IADrBQ,gBAAgB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAErB,OAAAJ,aAAA,CAAAA,aAAA;IACEH,QAAQ,EAAE,CAAC;EAAC,GACTF,KAAK;IACRQ;EAAgB;AAEpB;AAEA,eAAe;EACbV,SAAS;EACTS;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"PanelErrorBoundary.js","names":["React","Component","LoadingOverlay","Log","PanelEvent","LayoutUtils","log","module","PanelErrorBoundary","constructor","props","state","error","componentDidCatch","setState","componentWillUnmount","glContainer","glEventHub","panelId","getIdFromContainer","debug","emit","CLOSED","render","children"],"sources":["../src/PanelErrorBoundary.tsx"],"sourcesContent":["import React, { Component, ReactNode } from 'react';\nimport { LoadingOverlay } from '@deephaven/components';\nimport type { Container, EventEmitter } from '@deephaven/golden-layout';\nimport Log from '@deephaven/log';\nimport PanelEvent from './PanelEvent';\nimport LayoutUtils from './layout/LayoutUtils';\nimport './PanelErrorBoundary.scss';\n\nconst log = Log.module('PanelErrorBoundary');\n\ninterface PanelErrorBoundaryProps {\n children: ReactNode;\n glContainer: Container;\n glEventHub: EventEmitter;\n}\n\ninterface PanelErrorBoundaryState {\n error: Error | null;\n}\n/**\n * Panel wrapper implementing Error Boundary and emitting Closed event.\n * Closed event has to be emitted from the wrapper instead of the panel itself\n * because the panel can get unmounted on errors\n * and we want to differentiate between unmount on error vs panel being intentionally closed.\n */\nclass PanelErrorBoundary extends Component<\n PanelErrorBoundaryProps,\n PanelErrorBoundaryState\n> {\n constructor(props: PanelErrorBoundaryProps) {\n super(props);\n this.state = { error: null };\n }\n\n componentDidCatch(error: Error): void {\n this.setState({ error });\n }\n\n componentWillUnmount(): void {\n const { glContainer, glEventHub } = this.props;\n const panelId = LayoutUtils.getIdFromContainer(glContainer);\n log.debug('componentWillUnmount', panelId);\n glEventHub.emit(PanelEvent.CLOSED, panelId, glContainer);\n }\n\n render(): ReactNode {\n const { children } = this.props;\n const { error } = this.state;\n if (error != null) {\n return (\n <div className=\"panel-error-boundary\">\n <LoadingOverlay\n errorMessage={`${error}`}\n isLoading={false}\n isLoaded={false}\n />\n </div>\n );\n }\n return children;\n }\n}\n\nexport default PanelErrorBoundary;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAmB,OAAO;AACnD,SAASC,cAAc,QAAQ,uBAAuB;AAEtD,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAC1BC,UAAU;AAAA,OACVC,WAAW;AAAA;AAGlB,IAAMC,GAAG,GAAGH,GAAG,CAACI,MAAM,CAAC,oBAAoB,CAAC;AAW5C;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,SAASP,SAAS,CAGxC;EACAQ,WAAW,CAACC,KAA8B,EAAE;IAC1C,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI,CAACC,KAAK,GAAG;MAAEC,KAAK,EAAE;IAAK,CAAC;EAC9B;EAEAC,iBAAiB,CAACD,KAAY,EAAQ;IACpC,IAAI,CAACE,QAAQ,CAAC;MAAEF;IAAM,CAAC,CAAC;EAC1B;EAEAG,oBAAoB,GAAS;IAC3B,IAAM;MAAEC,WAAW;MAAEC;IAAW,CAAC,GAAG,IAAI,CAACP,KAAK;IAC9C,IAAMQ,OAAO,GAAGb,WAAW,CAACc,kBAAkB,CAACH,WAAW,CAAC;IAC3DV,GAAG,CAACc,KAAK,CAAC,sBAAsB,EAAEF,OAAO,CAAC;IAC1CD,UAAU,CAACI,IAAI,CAACjB,UAAU,CAACkB,MAAM,EAAEJ,OAAO,EAAEF,WAAW,CAAC;EAC1D;EAEAO,MAAM,GAAc;IAClB,IAAM;MAAEC;IAAS,CAAC,GAAG,IAAI,CAACd,KAAK;IAC/B,IAAM;MAAEE;IAAM,CAAC,GAAG,IAAI,CAACD,KAAK;IAC5B,IAAIC,KAAK,IAAI,IAAI,EAAE;MACjB,oBACE;QAAK,SAAS,EAAC;MAAsB,gBACnC,oBAAC,cAAc;QACb,YAAY,YAAKA,KAAK,CAAG;QACzB,SAAS,EAAE,KAAM;QACjB,QAAQ,EAAE;MAAM,EAChB,CACE;IAEV;IACA,OAAOY,QAAQ;EACjB;AACF;AAEA,eAAehB,kBAAkB"}
1
+ {"version":3,"file":"PanelErrorBoundary.js","names":["React","Component","LoadingOverlay","Log","PanelEvent","LayoutUtils","log","module","PanelErrorBoundary","constructor","props","state","error","componentDidCatch","setState","componentWillUnmount","glContainer","glEventHub","panelId","getIdFromContainer","debug","emit","CLOSED","render","children","createElement","className","errorMessage","concat","isLoading","isLoaded"],"sources":["../src/PanelErrorBoundary.tsx"],"sourcesContent":["import React, { Component, ReactNode } from 'react';\nimport { LoadingOverlay } from '@deephaven/components';\nimport type { Container, EventEmitter } from '@deephaven/golden-layout';\nimport Log from '@deephaven/log';\nimport PanelEvent from './PanelEvent';\nimport LayoutUtils from './layout/LayoutUtils';\nimport './PanelErrorBoundary.scss';\n\nconst log = Log.module('PanelErrorBoundary');\n\ninterface PanelErrorBoundaryProps {\n children: ReactNode;\n glContainer: Container;\n glEventHub: EventEmitter;\n}\n\ninterface PanelErrorBoundaryState {\n error: Error | null;\n}\n/**\n * Panel wrapper implementing Error Boundary and emitting Closed event.\n * Closed event has to be emitted from the wrapper instead of the panel itself\n * because the panel can get unmounted on errors\n * and we want to differentiate between unmount on error vs panel being intentionally closed.\n */\nclass PanelErrorBoundary extends Component<\n PanelErrorBoundaryProps,\n PanelErrorBoundaryState\n> {\n constructor(props: PanelErrorBoundaryProps) {\n super(props);\n this.state = { error: null };\n }\n\n componentDidCatch(error: Error): void {\n this.setState({ error });\n }\n\n componentWillUnmount(): void {\n const { glContainer, glEventHub } = this.props;\n const panelId = LayoutUtils.getIdFromContainer(glContainer);\n log.debug('componentWillUnmount', panelId);\n glEventHub.emit(PanelEvent.CLOSED, panelId, glContainer);\n }\n\n render(): ReactNode {\n const { children } = this.props;\n const { error } = this.state;\n if (error != null) {\n return (\n <div className=\"panel-error-boundary\">\n <LoadingOverlay\n errorMessage={`${error}`}\n isLoading={false}\n isLoaded={false}\n />\n </div>\n );\n }\n return children;\n }\n}\n\nexport default PanelErrorBoundary;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAmB,OAAO;AACnD,SAASC,cAAc,QAAQ,uBAAuB;AAEtD,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAC1BC,UAAU;AAAA,OACVC,WAAW;AAAA;AAGlB,IAAMC,GAAG,GAAGH,GAAG,CAACI,MAAM,CAAC,oBAAoB,CAAC;AAW5C;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,SAASP,SAAS,CAGxC;EACAQ,WAAWA,CAACC,KAA8B,EAAE;IAC1C,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI,CAACC,KAAK,GAAG;MAAEC,KAAK,EAAE;IAAK,CAAC;EAC9B;EAEAC,iBAAiBA,CAACD,KAAY,EAAQ;IACpC,IAAI,CAACE,QAAQ,CAAC;MAAEF;IAAM,CAAC,CAAC;EAC1B;EAEAG,oBAAoBA,CAAA,EAAS;IAC3B,IAAM;MAAEC,WAAW;MAAEC;IAAW,CAAC,GAAG,IAAI,CAACP,KAAK;IAC9C,IAAMQ,OAAO,GAAGb,WAAW,CAACc,kBAAkB,CAACH,WAAW,CAAC;IAC3DV,GAAG,CAACc,KAAK,CAAC,sBAAsB,EAAEF,OAAO,CAAC;IAC1CD,UAAU,CAACI,IAAI,CAACjB,UAAU,CAACkB,MAAM,EAAEJ,OAAO,EAAEF,WAAW,CAAC;EAC1D;EAEAO,MAAMA,CAAA,EAAc;IAClB,IAAM;MAAEC;IAAS,CAAC,GAAG,IAAI,CAACd,KAAK;IAC/B,IAAM;MAAEE;IAAM,CAAC,GAAG,IAAI,CAACD,KAAK;IAC5B,IAAIC,KAAK,IAAI,IAAI,EAAE;MACjB,oBACEZ,KAAA,CAAAyB,aAAA;QAAKC,SAAS,EAAC;MAAsB,gBACnC1B,KAAA,CAAAyB,aAAA,CAACvB,cAAc;QACbyB,YAAY,KAAAC,MAAA,CAAKhB,KAAK,CAAG;QACzBiB,SAAS,EAAE,KAAM;QACjBC,QAAQ,EAAE;MAAM,CACjB,CACE,CAAC;IAEV;IACA,OAAON,QAAQ;EACjB;AACF;AAEA,eAAehB,kBAAkB"}
@@ -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 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 (isWrappedComponent(type) &&\n panel instanceof type.WrappedComponent) ||\n (!isWrappedComponent(type) && panel instanceof type)\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 != null &&\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,GAAG,MAAM,gBAAgB;AAAC,OAC1BC,UAAU;AAAA,OACVC,WAAW,IAAIC,sBAAsB;AAAA,SAE1CC,kBAAkB;AAMpB,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAM,CAAC,cAAc,CAAC;AAyBtC;AACA;AACA;AACA,MAAMC,YAAY,CAAC;EAejB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,WAAW,CACTC,MAAoB,EAMpB;IAAA,IALAC,gBAAuC,uEAAG,CAACC,IAAI,EAAEC,KAAK,KAAKA,KAAK;IAAA,IAChEC,kBAA2C,uEAAG,CAACF,IAAI,EAAEG,MAAM,KAAKA,MAAM;IAAA,IACtEC,SAAyB,uEAAG,IAAIC,GAAG,EAAE;IAAA,IACrCC,MAAqB,uEAAG,EAAE;IAAA,IA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,WAAW,CAACkD,+BAA+B,CAACD,WAAW,CAAC;IACvE,IAAIrC,MAAM,IAAIX,sBAAsB,CAACW,MAAM,CAAC,EAAE;MAC5C,IAAMgF,gBAAgB,GAAG,IAAI,CAACjF,kBAAkB,CAC9CC,MAAM,CAAC8B,SAAS,EAChB9B,MAAM,CACP;MACD,IAAIgF,gBAAgB,IAAI,IAAI,EAAE;QAC5B,IAAI,CAAC7E,MAAM,CAAC8E,IAAI,CAACD,gBAAgB,CAAC;MACpC;IACF;EACF;EAEAL,UAAU,GAAS;IACjB,IAAM;MAAExE,MAAM;MAAEF;IAAU,CAAC,GAAG,IAAI;IAClC,IAAI,CAACG,eAAe,CAAC;MACnBD,MAAM,EAAE,CAAC,GAAGA,MAAM,CAAC;MACnBF,SAAS,EAAE,IAAIC,GAAG,CAACD,SAAS;IAC9B,CAAC,CAAC;EACJ;AACF;AAAC,gBAjSKR,YAAY,4BACgB,GAAG;AAkSrC,eAAeA,YAAY"}
1
+ {"version":3,"file":"PanelManager.js","names":["Log","PanelEvent","LayoutUtils","isReactComponentConfig","isWrappedComponent","log","module","PanelManager","constructor","layout","hydrateComponent","arguments","length","undefined","name","props","dehydrateComponent","config","openedMap","Map","closed","onPanelsUpdated","_defineProperty","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","_ref","stack","getStackForConfig","root","id","getContentItemInStack","getLastUsedPanel","matcher","opened","i","getLastUsedPanelOfType","type","getLastUsedPanelOfTypes","types","some","WrappedComponent","updatePanel","getIdFromPanel","error","debug2","concat","delete","set","removePanel","has","debug","removeClosedPanelConfig","panelConfig","index","findIndex","closedConfig","splice","sendUpdate","replaceConfig","_objectSpread","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 (isWrappedComponent(type) &&\n panel instanceof type.WrappedComponent) ||\n (!isWrappedComponent(type) && panel instanceof type)\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 != null &&\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,GAAG,MAAM,gBAAgB;AAAC,OAC1BC,UAAU;AAAA,OACVC,WAAW,IAAIC,sBAAsB;AAAA,SAE1CC,kBAAkB;AAMpB,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAM,CAAC,cAAc,CAAC;AAyBtC;AACA;AACA;AACA,MAAMC,YAAY,CAAC;EAejB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CACTC,MAAoB,EAMpB;IAAA,IALAC,gBAAuC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAACG,IAAI,EAAEC,KAAK,KAAKA,KAAK;IAAA,IAChEC,kBAA2C,GAAAL,SAAA,CAAAC,MAAA,Q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ACI,eAAA,CAjSKf,YAAY,4BACgB,GAAG;AAkSrC,eAAeA,YAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"PanelPlaceholder.js","names":["React","LayoutUtils","PanelPlaceholder","forwardRef","props","ref","component","getComponentNameFromPanel","displayName"],"sources":["../src/PanelPlaceholder.tsx"],"sourcesContent":["import React, { ForwardedRef } from 'react';\nimport './PanelPlaceholder.scss';\nimport LayoutUtils from './layout/LayoutUtils';\nimport { PanelProps } from './DashboardPlugin';\n\n/**\n * Displays a placeholder for unregistered panel types.\n */\nconst PanelPlaceholder = React.forwardRef(\n (props: PanelProps, ref: ForwardedRef<HTMLDivElement>) => {\n const component = LayoutUtils.getComponentNameFromPanel({ props });\n return (\n <div ref={ref} className=\"panel-placeholder\">\n Component &quot;{component}&quot; is not registered.\n </div>\n );\n }\n);\n\nPanelPlaceholder.displayName = 'PanelPlaceholder';\n\nexport default PanelPlaceholder;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAwB,OAAO;AAAC;AAAA,OAErCC,WAAW;AAGlB;AACA;AACA;AACA,IAAMC,gBAAgB,gBAAGF,KAAK,CAACG,UAAU,CACvC,CAACC,KAAiB,EAAEC,GAAiC,KAAK;EACxD,IAAMC,SAAS,GAAGL,WAAW,CAACM,yBAAyB,CAAC;IAAEH;EAAM,CAAC,CAAC;EAClE,oBACE;IAAK,GAAG,EAAEC,GAAI;IAAC,SAAS,EAAC;EAAmB,GAAC,cAC3B,EAACC,SAAS,EAAC,uBAC7B,CAAM;AAEV,CAAC,CACF;AAEDJ,gBAAgB,CAACM,WAAW,GAAG,kBAAkB;AAEjD,eAAeN,gBAAgB"}
1
+ {"version":3,"file":"PanelPlaceholder.js","names":["React","LayoutUtils","PanelPlaceholder","forwardRef","props","ref","component","getComponentNameFromPanel","createElement","className","displayName"],"sources":["../src/PanelPlaceholder.tsx"],"sourcesContent":["import React, { ForwardedRef } from 'react';\nimport './PanelPlaceholder.scss';\nimport LayoutUtils from './layout/LayoutUtils';\nimport { PanelProps } from './DashboardPlugin';\n\n/**\n * Displays a placeholder for unregistered panel types.\n */\nconst PanelPlaceholder = React.forwardRef(\n (props: PanelProps, ref: ForwardedRef<HTMLDivElement>) => {\n const component = LayoutUtils.getComponentNameFromPanel({ props });\n return (\n <div ref={ref} className=\"panel-placeholder\">\n Component &quot;{component}&quot; is not registered.\n </div>\n );\n }\n);\n\nPanelPlaceholder.displayName = 'PanelPlaceholder';\n\nexport default PanelPlaceholder;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAwB,OAAO;AAAC;AAAA,OAErCC,WAAW;AAGlB;AACA;AACA;AACA,IAAMC,gBAAgB,gBAAGF,KAAK,CAACG,UAAU,CACvC,CAACC,KAAiB,EAAEC,GAAiC,KAAK;EACxD,IAAMC,SAAS,GAAGL,WAAW,CAACM,yBAAyB,CAAC;IAAEH;EAAM,CAAC,CAAC;EAClE,oBACEJ,KAAA,CAAAQ,aAAA;IAAKH,GAAG,EAAEA,GAAI;IAACI,SAAS,EAAC;EAAmB,GAAC,cAC3B,EAACH,SAAS,EAAC,uBACxB,CAAC;AAEV,CACF,CAAC;AAEDJ,gBAAgB,CAACQ,WAAW,GAAG,kBAAkB;AAEjD,eAAeR,gBAAgB"}
@@ -1 +1 @@
1
- {"version":3,"file":"GLPropTypes.js","names":["PropTypes","Container","shape","on","func","off","isHidden","bool","tab","header","tabs","arrayOf","contentItem","title","string","setTitle","close","EventHub","emit","Layout","registerComponent","root","addChild","eventHub","GLPropTypes","Object","freeze"],"sources":["../../src/layout/GLPropTypes.ts"],"sourcesContent":["import PropTypes from 'prop-types';\n\nconst Container = PropTypes.shape({\n on: PropTypes.func,\n off: PropTypes.func,\n isHidden: PropTypes.bool,\n tab: PropTypes.shape({\n header: PropTypes.shape({\n tabs: PropTypes.arrayOf(\n PropTypes.shape({\n contentItem: PropTypes.shape({}),\n })\n ),\n }),\n }),\n title: PropTypes.string,\n setTitle: PropTypes.func,\n close: PropTypes.func,\n});\n\nconst EventHub = PropTypes.shape({\n on: PropTypes.func,\n off: PropTypes.func,\n emit: PropTypes.func,\n});\n\nconst Layout = PropTypes.shape({\n registerComponent: PropTypes.func,\n root: PropTypes.shape({ addChild: PropTypes.func }),\n on: PropTypes.func,\n off: PropTypes.func,\n eventHub: EventHub,\n});\n\nconst GLPropTypes = Object.freeze({ Container, EventHub, Layout });\n\nexport default GLPropTypes;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAElC,IAAMC,SAAS,GAAGD,SAAS,CAACE,KAAK,CAAC;EAChCC,EAAE,EAAEH,SAAS,CAACI,IAAI;EAClBC,GAAG,EAAEL,SAAS,CAACI,IAAI;EACnBE,QAAQ,EAAEN,SAAS,CAACO,IAAI;EACxBC,GAAG,EAAER,SAAS,CAACE,KAAK,CAAC;IACnBO,MAAM,EAAET,SAAS,CAACE,KAAK,CAAC;MACtBQ,IAAI,EAAEV,SAAS,CAACW,OAAO,CACrBX,SAAS,CAACE,KAAK,CAAC;QACdU,WAAW,EAAEZ,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC;MACjC,CAAC,CAAC;IAEN,CAAC;EACH,CAAC,CAAC;EACFW,KAAK,EAAEb,SAAS,CAACc,MAAM;EACvBC,QAAQ,EAAEf,SAAS,CAACI,IAAI;EACxBY,KAAK,EAAEhB,SAAS,CAACI;AACnB,CAAC,CAAC;AAEF,IAAMa,QAAQ,GAAGjB,SAAS,CAACE,KAAK,CAAC;EAC/BC,EAAE,EAAEH,SAAS,CAACI,IAAI;EAClBC,GAAG,EAAEL,SAAS,CAACI,IAAI;EACnBc,IAAI,EAAElB,SAAS,CAACI;AAClB,CAAC,CAAC;AAEF,IAAMe,MAAM,GAAGnB,SAAS,CAACE,KAAK,CAAC;EAC7BkB,iBAAiB,EAAEpB,SAAS,CAACI,IAAI;EACjCiB,IAAI,EAAErB,SAAS,CAACE,KAAK,CAAC;IAAEoB,QAAQ,EAAEtB,SAAS,CAACI;EAAK,CAAC,CAAC;EACnDD,EAAE,EAAEH,SAAS,CAACI,IAAI;EAClBC,GAAG,EAAEL,SAAS,CAACI,IAAI;EACnBmB,QAAQ,EAAEN;AACZ,CAAC,CAAC;AAEF,IAAMO,WAAW,GAAGC,MAAM,CAACC,MAAM,CAAC;EAAEzB,SAAS;EAAEgB,QAAQ;EAAEE;AAAO,CAAC,CAAC;AAElE,eAAeK,WAAW"}
1
+ {"version":3,"file":"GLPropTypes.js","names":["PropTypes","Container","shape","on","func","off","isHidden","bool","tab","header","tabs","arrayOf","contentItem","title","string","setTitle","close","EventHub","emit","Layout","registerComponent","root","addChild","eventHub","GLPropTypes","Object","freeze"],"sources":["../../src/layout/GLPropTypes.ts"],"sourcesContent":["import PropTypes from 'prop-types';\n\nconst Container = PropTypes.shape({\n on: PropTypes.func,\n off: PropTypes.func,\n isHidden: PropTypes.bool,\n tab: PropTypes.shape({\n header: PropTypes.shape({\n tabs: PropTypes.arrayOf(\n PropTypes.shape({\n contentItem: PropTypes.shape({}),\n })\n ),\n }),\n }),\n title: PropTypes.string,\n setTitle: PropTypes.func,\n close: PropTypes.func,\n});\n\nconst EventHub = PropTypes.shape({\n on: PropTypes.func,\n off: PropTypes.func,\n emit: PropTypes.func,\n});\n\nconst Layout = PropTypes.shape({\n registerComponent: PropTypes.func,\n root: PropTypes.shape({ addChild: PropTypes.func }),\n on: PropTypes.func,\n off: PropTypes.func,\n eventHub: EventHub,\n});\n\nconst GLPropTypes = Object.freeze({ Container, EventHub, Layout });\n\nexport default GLPropTypes;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAElC,IAAMC,SAAS,GAAGD,SAAS,CAACE,KAAK,CAAC;EAChCC,EAAE,EAAEH,SAAS,CAACI,IAAI;EAClBC,GAAG,EAAEL,SAAS,CAACI,IAAI;EACnBE,QAAQ,EAAEN,SAAS,CAACO,IAAI;EACxBC,GAAG,EAAER,SAAS,CAACE,KAAK,CAAC;IACnBO,MAAM,EAAET,SAAS,CAACE,KAAK,CAAC;MACtBQ,IAAI,EAAEV,SAAS,CAACW,OAAO,CACrBX,SAAS,CAACE,KAAK,CAAC;QACdU,WAAW,EAAEZ,SAAS,CAACE,KAAK,CAAC,CAAC,CAAC;MACjC,CAAC,CACH;IACF,CAAC;EACH,CAAC,CAAC;EACFW,KAAK,EAAEb,SAAS,CAACc,MAAM;EACvBC,QAAQ,EAAEf,SAAS,CAACI,IAAI;EACxBY,KAAK,EAAEhB,SAAS,CAACI;AACnB,CAAC,CAAC;AAEF,IAAMa,QAAQ,GAAGjB,SAAS,CAACE,KAAK,CAAC;EAC/BC,EAAE,EAAEH,SAAS,CAACI,IAAI;EAClBC,GAAG,EAAEL,SAAS,CAACI,IAAI;EACnBc,IAAI,EAAElB,SAAS,CAACI;AAClB,CAAC,CAAC;AAEF,IAAMe,MAAM,GAAGnB,SAAS,CAACE,KAAK,CAAC;EAC7BkB,iBAAiB,EAAEpB,SAAS,CAACI,IAAI;EACjCiB,IAAI,EAAErB,SAAS,CAACE,KAAK,CAAC;IAAEoB,QAAQ,EAAEtB,SAAS,CAACI;EAAK,CAAC,CAAC;EACnDD,EAAE,EAAEH,SAAS,CAACI,IAAI;EAClBC,GAAG,EAAEL,SAAS,CAACI,IAAI;EACnBmB,QAAQ,EAAEN;AACZ,CAAC,CAAC;AAEF,IAAMO,WAAW,GAAGC,MAAM,CAACC,MAAM,CAAC;EAAEzB,SAAS;EAAEgB,QAAQ;EAAEE;AAAO,CAAC,CAAC;AAElE,eAAeK,WAAW"}
@@ -135,8 +135,7 @@
135
135
  .lm_stack.lm_right .lm_header .lm_tabs {
136
136
  transform-origin: left top;
137
137
  top: 0;
138
- width: 1000px;
139
- /*hack*/
138
+ width: 1000px; /*hack*/
140
139
  }
141
140
  .lm_dragProxy.lm_left .lm_header .lm_controls,
142
141
  .lm_dragProxy.lm_right .lm_header .lm_controls,