@deephaven/dashboard 0.72.1-beta.5 → 0.72.1-core-plugins.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DashboardEvents.d.ts.map +1 -1
- package/dist/DashboardEvents.js +5 -1
- package/dist/DashboardEvents.js.map +1 -1
- package/dist/DashboardLayout.d.ts.map +1 -1
- package/dist/DashboardLayout.js +39 -20
- package/dist/DashboardLayout.js.map +1 -1
- package/dist/DashboardPlugin.d.ts +1 -2
- package/dist/DashboardPlugin.d.ts.map +1 -1
- package/dist/DashboardPlugin.js +5 -3
- package/dist/DashboardPlugin.js.map +1 -1
- package/dist/DashboardUtils.d.ts +2 -8
- package/dist/DashboardUtils.d.ts.map +1 -1
- package/dist/DashboardUtils.js +2 -15
- package/dist/DashboardUtils.js.map +1 -1
- package/dist/PanelManager.d.ts +11 -2
- package/dist/PanelManager.d.ts.map +1 -1
- package/dist/PanelManager.js +27 -3
- package/dist/PanelManager.js.map +1 -1
- package/dist/PanelPlaceholder.css.map +1 -1
- package/dist/layout/GoldenLayout.css.map +1 -1
- package/dist/layout/LayoutUtils.d.ts +8 -1
- package/dist/layout/LayoutUtils.d.ts.map +1 -1
- package/dist/layout/LayoutUtils.js +36 -6
- package/dist/layout/LayoutUtils.js.map +1 -1
- package/dist/layout/useDashboardPanel.d.ts.map +1 -1
- package/dist/layout/useDashboardPanel.js +2 -2
- package/dist/layout/useDashboardPanel.js.map +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardEvents.d.ts","sourceRoot":"","sources":["../src/DashboardEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,MAAM,WAAW,sBAAsB,CAAC,CAAC,GAAG,OAAO;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,CAAC,CAAC;CACT;AAED,wBAAgB,4BAA4B,CAAC,CAAC,GAAG,OAAO,EACtD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,IAAI,GAC9C,IAAI,
|
|
1
|
+
{"version":3,"file":"DashboardEvents.d.ts","sourceRoot":"","sources":["../src/DashboardEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,MAAM,WAAW,sBAAsB,CAAC,CAAC,GAAG,OAAO;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,CAAC,CAAC;CACT;AAED,wBAAgB,4BAA4B,CAAC,CAAC,GAAG,OAAO,EACtD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,IAAI,GAC9C,IAAI,CAMN;AAED,wBAAgB,wBAAwB,CAAC,CAAC,GAAG,OAAO,EAClD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,IAAI,GAC9C,MAAM,IAAI,CAGZ;AAED,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,OAAO,EAC7C,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,GACjC,IAAI,CAEN"}
|
package/dist/DashboardEvents.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export var CREATE_DASHBOARD = 'CREATE_DASHBOARD';
|
|
2
2
|
export function stopListenForCreateDashboard(eventHub, handler) {
|
|
3
|
-
|
|
3
|
+
try {
|
|
4
|
+
eventHub.off(CREATE_DASHBOARD, handler);
|
|
5
|
+
} catch (_unused) {
|
|
6
|
+
// golden-layout throws if the handler is not found. Instead catch it and no-op
|
|
7
|
+
}
|
|
4
8
|
}
|
|
5
9
|
export function listenForCreateDashboard(eventHub, handler) {
|
|
6
10
|
eventHub.on(CREATE_DASHBOARD, handler);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardEvents.js","names":["CREATE_DASHBOARD","stopListenForCreateDashboard","eventHub","handler","off","listenForCreateDashboard","on","emitCreateDashboard","payload","emit"],"sources":["../src/DashboardEvents.ts"],"sourcesContent":["import type { EventHub } from '@deephaven/golden-layout';\n\nexport const CREATE_DASHBOARD = 'CREATE_DASHBOARD';\n\nexport interface CreateDashboardPayload<T = unknown> {\n pluginId: string;\n title: string;\n data: T;\n}\n\nexport function stopListenForCreateDashboard<T = unknown>(\n eventHub: EventHub,\n handler: (p: CreateDashboardPayload<T>) => void\n): void {\n eventHub.off(CREATE_DASHBOARD, handler);\n}\n\nexport function listenForCreateDashboard<T = unknown>(\n eventHub: EventHub,\n handler: (p: CreateDashboardPayload<T>) => void\n): () => void {\n eventHub.on(CREATE_DASHBOARD, handler);\n return () => stopListenForCreateDashboard(eventHub, handler);\n}\n\nexport function emitCreateDashboard<T = unknown>(\n eventHub: EventHub,\n payload: CreateDashboardPayload<T>\n): void {\n eventHub.emit(CREATE_DASHBOARD, payload);\n}\n"],"mappings":"AAEA,OAAO,IAAMA,gBAAgB,GAAG,kBAAkB;AAQlD,OAAO,SAASC,4BAA4BA,CAC1CC,QAAkB,EAClBC,OAA+C,EACzC;
|
|
1
|
+
{"version":3,"file":"DashboardEvents.js","names":["CREATE_DASHBOARD","stopListenForCreateDashboard","eventHub","handler","off","_unused","listenForCreateDashboard","on","emitCreateDashboard","payload","emit"],"sources":["../src/DashboardEvents.ts"],"sourcesContent":["import type { EventHub } from '@deephaven/golden-layout';\n\nexport const CREATE_DASHBOARD = 'CREATE_DASHBOARD';\n\nexport interface CreateDashboardPayload<T = unknown> {\n pluginId: string;\n title: string;\n data: T;\n}\n\nexport function stopListenForCreateDashboard<T = unknown>(\n eventHub: EventHub,\n handler: (p: CreateDashboardPayload<T>) => void\n): void {\n try {\n eventHub.off(CREATE_DASHBOARD, handler);\n } catch {\n // golden-layout throws if the handler is not found. Instead catch it and no-op\n }\n}\n\nexport function listenForCreateDashboard<T = unknown>(\n eventHub: EventHub,\n handler: (p: CreateDashboardPayload<T>) => void\n): () => void {\n eventHub.on(CREATE_DASHBOARD, handler);\n return () => stopListenForCreateDashboard(eventHub, handler);\n}\n\nexport function emitCreateDashboard<T = unknown>(\n eventHub: EventHub,\n payload: CreateDashboardPayload<T>\n): void {\n eventHub.emit(CREATE_DASHBOARD, payload);\n}\n"],"mappings":"AAEA,OAAO,IAAMA,gBAAgB,GAAG,kBAAkB;AAQlD,OAAO,SAASC,4BAA4BA,CAC1CC,QAAkB,EAClBC,OAA+C,EACzC;EACN,IAAI;IACFD,QAAQ,CAACE,GAAG,CAACJ,gBAAgB,EAAEG,OAAO,CAAC;EACzC,CAAC,CAAC,OAAAE,OAAA,EAAM;IACN;EAAA;AAEJ;AAEA,OAAO,SAASC,wBAAwBA,CACtCJ,QAAkB,EAClBC,OAA+C,EACnC;EACZD,QAAQ,CAACK,EAAE,CAACP,gBAAgB,EAAEG,OAAO,CAAC;EACtC,OAAO,MAAMF,4BAA4B,CAACC,QAAQ,EAAEC,OAAO,CAAC;AAC9D;AAEA,OAAO,SAASK,mBAAmBA,CACjCN,QAAkB,EAClBO,OAAkC,EAC5B;EACNP,QAAQ,CAACQ,IAAI,CAACV,gBAAgB,EAAES,OAAO,CAAC;AAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardLayout.d.ts","sourceRoot":"","sources":["../src/DashboardLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,aAAa,EAMd,MAAM,OAAO,CAAC;AACf,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAA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AM,EACN,YAAoC,EACpC,cAAiC,EACjC,mBAAsC,EACtC,OAAwB,EACxB,SAA4B,EAC5B,YAAoC,GACrC,EAAE,oBAAoB,GAAG,GAAG,CAAC,OAAO,CA+QpC;yBA1Re,eAAe;;;;;;;;;;;;;;;;;;;;;;;;AAuS/B,eAAe,eAAe,CAAC"}
|
package/dist/DashboardLayout.js
CHANGED
|
@@ -6,7 +6,8 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
6
6
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import Log from '@deephaven/log';
|
|
9
|
-
import { usePrevious } from '@deephaven/react-hooks';
|
|
9
|
+
import { usePrevious, useThrottledCallback } from '@deephaven/react-hooks';
|
|
10
|
+
import { ErrorBoundary } from '@deephaven/components';
|
|
10
11
|
import { useDispatch, useSelector } from 'react-redux';
|
|
11
12
|
import PanelManager from "./PanelManager.js";
|
|
12
13
|
import PanelErrorBoundary from "./PanelErrorBoundary.js";
|
|
@@ -23,6 +24,7 @@ var log = Log.module('DashboardLayout');
|
|
|
23
24
|
var EMPTY_OBJECT = Object.freeze({});
|
|
24
25
|
var DEFAULT_LAYOUT_CONFIG = [];
|
|
25
26
|
var DEFAULT_CALLBACK = () => undefined;
|
|
27
|
+
var STATE_CHANGE_THROTTLE_MS = 1000;
|
|
26
28
|
|
|
27
29
|
// If a component isn't registered, just pass through the props so they are saved if a plugin is loaded later
|
|
28
30
|
var FALLBACK_CALLBACK = props => props;
|
|
@@ -52,11 +54,6 @@ export function DashboardLayout(_ref) {
|
|
|
52
54
|
var [lastConfig, setLastConfig] = useState();
|
|
53
55
|
var [initialClosedPanels] = useState((_closed = data === null || data === void 0 ? void 0 : data.closed) !== null && _closed !== void 0 ? _closed : []);
|
|
54
56
|
var [layoutChildren, setLayoutChildren] = useState(layout.getReactChildren());
|
|
55
|
-
|
|
56
|
-
// Fire only once after the layout is mounted
|
|
57
|
-
// This should ensure DashboardPlugins have been mounted
|
|
58
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
|
-
useEffect(() => onLayoutInitialized(), []);
|
|
60
57
|
var hydrateMap = useMemo(() => new Map(), []);
|
|
61
58
|
var dehydrateMap = useMemo(() => new Map(), []);
|
|
62
59
|
var registerComponent = useCallback(function (name, componentType) {
|
|
@@ -121,22 +118,30 @@ export function DashboardLayout(_ref) {
|
|
|
121
118
|
openedMap
|
|
122
119
|
}));
|
|
123
120
|
}), [dehydrateComponent, dispatch, hydrateComponent, id, initialClosedPanels, layout]);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (isItemDragging) return;
|
|
128
|
-
var glConfig = layout.toConfig();
|
|
129
|
-
var contentConfig = glConfig.content;
|
|
130
|
-
var dehydratedLayoutConfig = LayoutUtils.dehydrateLayoutConfig(contentConfig, dehydrateComponent);
|
|
121
|
+
|
|
122
|
+
// Throttle the calls so that we don't flood comparing these layouts
|
|
123
|
+
var throttledProcessDehydratedLayoutConfig = useThrottledCallback(dehydratedLayoutConfig => {
|
|
131
124
|
var hasChanged = lastConfig == null || !LayoutUtils.isEqual(lastConfig, dehydratedLayoutConfig);
|
|
132
|
-
log.debug('handleLayoutStateChanged', hasChanged,
|
|
125
|
+
log.debug('handleLayoutStateChanged', hasChanged, dehydratedLayoutConfig);
|
|
133
126
|
if (hasChanged) {
|
|
134
127
|
setIsDashboardEmpty(layout.root.contentItems.length === 0);
|
|
135
128
|
setLastConfig(dehydratedLayoutConfig);
|
|
136
129
|
onLayoutChange(dehydratedLayoutConfig);
|
|
137
130
|
setLayoutChildren(layout.getReactChildren());
|
|
138
131
|
}
|
|
139
|
-
},
|
|
132
|
+
}, STATE_CHANGE_THROTTLE_MS, {
|
|
133
|
+
flushOnUnmount: true
|
|
134
|
+
});
|
|
135
|
+
useEffect(() => () => throttledProcessDehydratedLayoutConfig.flush(), [throttledProcessDehydratedLayoutConfig]);
|
|
136
|
+
var handleLayoutStateChanged = useCallback(() => {
|
|
137
|
+
// we don't want to emit stateChanges that happen during item drags or else
|
|
138
|
+
// we risk the last saved state being one without that panel in the layout entirely
|
|
139
|
+
if (isItemDragging) return;
|
|
140
|
+
var glConfig = layout.toConfig();
|
|
141
|
+
var contentConfig = glConfig.content;
|
|
142
|
+
var dehydratedLayoutConfig = LayoutUtils.dehydrateLayoutConfig(contentConfig, dehydrateComponent);
|
|
143
|
+
throttledProcessDehydratedLayoutConfig(dehydratedLayoutConfig);
|
|
144
|
+
}, [dehydrateComponent, isItemDragging, layout, throttledProcessDehydratedLayoutConfig]);
|
|
140
145
|
var handleLayoutItemPickedUp = useCallback(component => {
|
|
141
146
|
var componentId = LayoutUtils.getIdFromContainer(component);
|
|
142
147
|
layout.eventHub.emit(PanelEvent.DRAGGING, componentId);
|
|
@@ -182,12 +187,26 @@ export function DashboardLayout(_ref) {
|
|
|
182
187
|
setIsDashboardEmpty(layout.root.contentItems.length === 0);
|
|
183
188
|
}
|
|
184
189
|
}, [hydrateComponent, layout, layoutConfig, lastConfig, panelManager, previousLayoutConfig]);
|
|
190
|
+
|
|
191
|
+
// This should be the last hook called in this component
|
|
192
|
+
// Ensures it runs after any other effects on mount
|
|
193
|
+
// Fire only once after the layout is mounted
|
|
194
|
+
// This should ensure DashboardPlugins have been mounted
|
|
195
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
196
|
+
useEffect(() => onLayoutInitialized(), []);
|
|
185
197
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
186
|
-
children: [isDashboardEmpty && emptyDashboard, layoutChildren, React.Children.map(children, child => child != null ?
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
198
|
+
children: [isDashboardEmpty && emptyDashboard, layoutChildren, React.Children.map(children, child => child != null ?
|
|
199
|
+
/*#__PURE__*/
|
|
200
|
+
// Have fallback be an empty array so that we don't show the error message over entire app
|
|
201
|
+
// Look into using toast message in the future
|
|
202
|
+
_jsx(ErrorBoundary, {
|
|
203
|
+
fallback: [],
|
|
204
|
+
children: /*#__PURE__*/React.cloneElement(child, {
|
|
205
|
+
id,
|
|
206
|
+
layout,
|
|
207
|
+
panelManager,
|
|
208
|
+
registerComponent
|
|
209
|
+
})
|
|
191
210
|
}) : null)]
|
|
192
211
|
});
|
|
193
212
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardLayout.js","names":["React","useCallback","useEffect","useMemo","useState","PropTypes","Log","usePrevious","useDispatch","useSelector","PanelManager","PanelErrorBoundary","LayoutUtils","canHaveRef","dehydrate","dehydrateDefault","hydrate","hydrateDefault","PanelEvent","GLPropTypes","useListener","getDashboardData","updateDashboardData","DashboardPanelWrapper","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","log","module","EMPTY_OBJECT","Object","freeze","DEFAULT_LAYOUT_CONFIG","DEFAULT_CALLBACK","undefined","FALLBACK_CALLBACK","props","DashboardLayout","_ref","_useSelector","_closed","id","children","emptyDashboard","layout","layoutConfig","onLayoutChange","onLayoutInitialized","panelWrapper","dispatch","data","state","isDashboardEmpty","setIsDashboardEmpty","isItemDragging","setIsItemDragging","lastConfig","setLastConfig","initialClosedPanels","closed","layoutChildren","setLayoutChildren","getReactChildren","hydrateMap","Map","dehydrateMap","registerComponent","name","componentType","_componentType$displa","componentHydrate","arguments","length","componentDehydrate","debug2","wrappedComponent","ref","CType","PanelWrapperType","hasRef","glContainer","glEventHub","_objectSpread","displayName","concat","cleanup","forwardRef","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","addClass","handleReactChildrenChange","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 ComponentType,\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 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 { useDispatch, useSelector } from 'react-redux';\nimport PanelManager, { ClosedPanels } from './PanelManager';\nimport PanelErrorBoundary from './PanelErrorBoundary';\nimport LayoutUtils from './layout/LayoutUtils';\nimport {\n canHaveRef,\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 PanelProps,\n} from './DashboardPlugin';\nimport DashboardPanelWrapper from './DashboardPanelWrapper';\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 = (): void => 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): 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 /** Component to wrap each panel with */\n panelWrapper?: ComponentType;\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 panelWrapper = DashboardPanelWrapper,\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 [layoutChildren, setLayoutChildren] = useState(\n layout.getReactChildren()\n );\n\n // Fire only once after the layout is mounted\n // This should ensure DashboardPlugins have been mounted\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => onLayoutInitialized(), []);\n\n const hydrateMap = useMemo(() => new Map(), []);\n const dehydrateMap = useMemo(() => new Map(), []);\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 wrappedComponent(\n props: PanelProps,\n ref: React.Ref<unknown>\n ): JSX.Element {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const CType = componentType as any;\n const PanelWrapperType = panelWrapper;\n\n /**\n * The ref is used to detect changes to class component state so we\n * can track changes to panelState. We should opt for more explicit\n * state changes in the future and in functional components.\n */\n const hasRef = canHaveRef(CType);\n\n // Props supplied by GoldenLayout\n const { glContainer, glEventHub } = props;\n return (\n <PanelErrorBoundary glContainer={glContainer} glEventHub={glEventHub}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <PanelWrapperType {...props}>\n {hasRef ? (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <CType {...props} ref={ref} />\n ) : (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <CType {...props} />\n )}\n </PanelWrapperType>\n </PanelErrorBoundary>\n );\n }\n\n wrappedComponent.displayName = `DashboardWrapper(${\n componentType.displayName ?? name\n })`;\n\n const cleanup = layout.registerComponent(\n name,\n React.forwardRef(wrappedComponent)\n );\n hydrateMap.set(name, componentHydrate);\n dehydrateMap.set(name, componentDehydrate);\n return cleanup;\n },\n [hydrate, dehydrate, hydrateMap, dehydrateMap, layout, panelWrapper]\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 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 setLayoutChildren(layout.getReactChildren());\n }\n }, [dehydrateComponent, isItemDragging, lastConfig, layout, onLayoutChange]);\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 const handleReactChildrenChange = useCallback(() => {\n setLayoutChildren(layout.getReactChildren());\n }, [layout]);\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 useListener(layout, 'reactChildrenChanged', handleReactChildrenChange);\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 {layoutChildren}\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,IAGVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,OAAO;AACd,OAAOC,SAAS,MAAM,YAAY;AAOlC,OAAOC,GAAG,MAAM,gBAAgB;AAChC,SAASC,WAAW,QAAQ,wBAAwB;AAEpD,SAASC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAAC,OAChDC,YAAY;AAAA,OACZC,kBAAkB;AAAA,OAClBC,WAAW;AAAA,SAEhBC,UAAU,EACVC,SAAS,IAAIC,gBAAgB,EAC7BC,OAAO,IAAIC,cAAc;AAAA,OAEpBC,UAAU;AAAA,SACRC,WAAW,EAAEC,WAAW;AAAA,SACxBC,gBAAgB,EAAEC,mBAAmB;AAAA,OAOvCC,qBAAqB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC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SAAS,CAAC+I,IAAI;EAC9BlG,mBAAmB,EAAE7C,SAAS,CAAC+I;AACjC,CAAC;AAED,eAAe5G,eAAe"}
|
|
1
|
+
{"version":3,"file":"DashboardLayout.js","names":["React","useCallback","useEffect","useMemo","useState","PropTypes","Log","usePrevious","useThrottledCallback","ErrorBoundary","useDispatch","useSelector","PanelManager","PanelErrorBoundary","LayoutUtils","canHaveRef","dehydrate","dehydrateDefault","hydrate","hydrateDefault","PanelEvent","GLPropTypes","useListener","getDashboardData","updateDashboardData","DashboardPanelWrapper","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","log","module","EMPTY_OBJECT","Object","freeze","DEFAULT_LAYOUT_CONFIG","DEFAULT_CALLBACK","undefined","STATE_CHANGE_THROTTLE_MS","FALLBACK_CALLBACK","props","DashboardLayout","_ref","_useSelector","_closed","id","children","emptyDashboard","layout","layoutConfig","onLayoutChange","onLayoutInitialized","panelWrapper","dispatch","data","state","isDashboardEmpty","setIsDashboardEmpty","isItemDragging","setIsItemDragging","lastConfig","setLastConfig","initialClosedPanels","closed","layoutChildren","setLayoutChildren","getReactChildren","hydrateMap","Map","dehydrateMap","registerComponent","name","componentType","_componentType$displa","componentHydrate","arguments","length","componentDehydrate","debug2","wrappedComponent","ref","CType","PanelWrapperType","hasRef","glContainer","glEventHub","_objectSpread","displayName","concat","cleanup","forwardRef","set","hydrateComponent","_hydrateMap$get","get","dehydrateComponent","config","_dehydrateMap$get","panelManager","_ref2","openedMap","throttledProcessDehydratedLayoutConfig","dehydratedLayoutConfig","hasChanged","isEqual","debug","root","contentItems","flushOnUnmount","flush","handleLayoutStateChanged","glConfig","toConfig","contentConfig","content","dehydrateLayoutConfig","handleLayoutItemPickedUp","component","componentId","getIdFromContainer","eventHub","emit","DRAGGING","handleLayoutItemDropped","DROPPED","handleComponentCreated","item","element","cssComponent","replace","toLowerCase","cssClass","addClass","handleReactChildrenChange","TITLE_CHANGED","previousLayoutConfig","loadNewConfig","hydrateLayoutConfig","remove","i","addChild","Children","map","child","fallback","cloneElement","propTypes","string","isRequired","node","shape","Layout","arrayOf","func"],"sources":["../src/DashboardLayout.tsx"],"sourcesContent":["import React, {\n ComponentType,\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 ItemConfigType,\n ReactComponentConfig,\n} from '@deephaven/golden-layout';\nimport Log from '@deephaven/log';\nimport { usePrevious, useThrottledCallback } from '@deephaven/react-hooks';\nimport { ErrorBoundary } from '@deephaven/components';\nimport { RootState } from '@deephaven/redux';\nimport { useDispatch, useSelector } from 'react-redux';\nimport PanelManager, { ClosedPanels } from './PanelManager';\nimport PanelErrorBoundary from './PanelErrorBoundary';\nimport LayoutUtils from './layout/LayoutUtils';\nimport {\n canHaveRef,\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 PanelProps,\n} from './DashboardPlugin';\nimport DashboardPanelWrapper from './DashboardPanelWrapper';\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 = (): void => undefined;\n\nconst STATE_CHANGE_THROTTLE_MS = 1000;\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): 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 /** Component to wrap each panel with */\n panelWrapper?: ComponentType;\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 panelWrapper = DashboardPanelWrapper,\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 [layoutChildren, setLayoutChildren] = useState(\n layout.getReactChildren()\n );\n\n const hydrateMap = useMemo(() => new Map(), []);\n const dehydrateMap = useMemo(() => new Map(), []);\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 wrappedComponent(\n props: PanelProps,\n ref: React.Ref<unknown>\n ): JSX.Element {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const CType = componentType as any;\n const PanelWrapperType = panelWrapper;\n\n /**\n * The ref is used to detect changes to class component state so we\n * can track changes to panelState. We should opt for more explicit\n * state changes in the future and in functional components.\n */\n const hasRef = canHaveRef(CType);\n\n // Props supplied by GoldenLayout\n const { glContainer, glEventHub } = props;\n return (\n <PanelErrorBoundary glContainer={glContainer} glEventHub={glEventHub}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <PanelWrapperType {...props}>\n {hasRef ? (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <CType {...props} ref={ref} />\n ) : (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <CType {...props} />\n )}\n </PanelWrapperType>\n </PanelErrorBoundary>\n );\n }\n\n wrappedComponent.displayName = `DashboardWrapper(${\n componentType.displayName ?? name\n })`;\n\n const cleanup = layout.registerComponent(\n name,\n React.forwardRef(wrappedComponent)\n );\n hydrateMap.set(name, componentHydrate);\n dehydrateMap.set(name, componentDehydrate);\n return cleanup;\n },\n [hydrate, dehydrate, hydrateMap, dehydrateMap, layout, panelWrapper]\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 // Throttle the calls so that we don't flood comparing these layouts\n const throttledProcessDehydratedLayoutConfig = useThrottledCallback(\n (dehydratedLayoutConfig: DashboardLayoutConfig) => {\n const hasChanged =\n lastConfig == null ||\n !LayoutUtils.isEqual(lastConfig, dehydratedLayoutConfig);\n\n log.debug('handleLayoutStateChanged', hasChanged, dehydratedLayoutConfig);\n\n if (hasChanged) {\n setIsDashboardEmpty(layout.root.contentItems.length === 0);\n\n setLastConfig(dehydratedLayoutConfig);\n\n onLayoutChange(dehydratedLayoutConfig);\n\n setLayoutChildren(layout.getReactChildren());\n }\n },\n STATE_CHANGE_THROTTLE_MS,\n { flushOnUnmount: true }\n );\n\n useEffect(\n () => () => throttledProcessDehydratedLayoutConfig.flush(),\n [throttledProcessDehydratedLayoutConfig]\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 const glConfig = layout.toConfig();\n const contentConfig = glConfig.content;\n const dehydratedLayoutConfig = LayoutUtils.dehydrateLayoutConfig(\n contentConfig,\n dehydrateComponent\n );\n throttledProcessDehydratedLayoutConfig(dehydratedLayoutConfig);\n }, [\n dehydrateComponent,\n isItemDragging,\n layout,\n throttledProcessDehydratedLayoutConfig,\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 const handleReactChildrenChange = useCallback(() => {\n setLayoutChildren(layout.getReactChildren());\n }, [layout]);\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 useListener(layout, 'reactChildrenChanged', handleReactChildrenChange);\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 // This should be the last hook called in this component\n // Ensures it runs after any other effects on mount\n // Fire only once after the layout is mounted\n // This should ensure DashboardPlugins have been mounted\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => onLayoutInitialized(), []);\n\n return (\n <>\n {isDashboardEmpty && emptyDashboard}\n {layoutChildren}\n {React.Children.map(children, child =>\n child != null ? (\n // Have fallback be an empty array so that we don't show the error message over entire app\n // Look into using toast message in the future\n <ErrorBoundary fallback={[]}>\n {React.cloneElement(child as ReactElement, {\n id,\n layout,\n panelManager,\n registerComponent,\n })}\n </ErrorBoundary>\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,IAGVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,OAAO;AACd,O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EAAE,EAAE,CAAC;EAE1C,oBACEtB,KAAA,CAAAF,SAAA;IAAAmB,QAAA,GACGU,gBAAgB,IAAIT,cAAc,EAClCiB,cAAc,EACdlE,KAAK,CAAC+I,QAAQ,CAACC,GAAG,CAAChG,QAAQ,EAAEiG,KAAK,IACjCA,KAAK,IAAI,IAAI;IAAA;IACX;IACA;IACAtH,IAAA,CAAClB,aAAa;MAACyI,QAAQ,EAAE,EAAG;MAAAlG,QAAA,eACzBhD,KAAK,CAACmJ,YAAY,CAACF,KAAK,EAAkB;QACzClG,EAAE;QACFG,MAAM;QACNkD,YAAY;QACZ5B;MACF,CAAC;IAAC,CACW,CAAC,GACd,IACN,CAAC;EAAA,CACD,CAAC;AAEP;AAEA7B,eAAe,CAACyG,SAAS,GAAG;EAC1BrG,EAAE,EAAE1C,SAAS,CAACgJ,MAAM,CAACC,UAAU;EAC/BtG,QAAQ,EAAE3C,SAAS,CAACkJ,IAAI;EACxB/F,IAAI,EAAEnD,SAAS,CAACmJ,KAAK,CAAC,CAAC,CAAC,CAAC;EACzBvG,cAAc,EAAE5C,SAAS,CAACkJ,IAAI;EAC9BrG,MAAM,EAAE7B,WAAW,CAACoI,MAAM,CAACH,UAAU;EACrCnG,YAAY,EAAE9C,SAAS,CAACqJ,OAAO,CAACrJ,SAAS,CAACmJ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;EACpDpG,cAAc,EAAE/C,SAAS,CAACsJ,IAAI;EAC9BtG,mBAAmB,EAAEhD,SAAS,CAACsJ;AACjC,CAAC;AAED,eAAehH,eAAe"}
|
|
@@ -4,6 +4,7 @@ import GoldenLayout from '@deephaven/golden-layout';
|
|
|
4
4
|
import type { GLPanelProps, ReactComponentConfig } from '@deephaven/golden-layout';
|
|
5
5
|
import PanelManager from './PanelManager';
|
|
6
6
|
import { WidgetDescriptor } from './PanelEvent';
|
|
7
|
+
export { isWrappedComponent } from '@deephaven/components';
|
|
7
8
|
/**
|
|
8
9
|
* Panel components can provide static props that provide meta data about the
|
|
9
10
|
* panel.
|
|
@@ -27,7 +28,6 @@ type ForwardRefComponentType<P, R> = ForwardRefExoticComponent<PropsWithoutRef<P
|
|
|
27
28
|
export type PanelFunctionComponentType<P, R> = ForwardRefComponentType<P, R> & PanelStaticMetaData;
|
|
28
29
|
export type WrappedComponentType<P extends PanelProps, C extends ComponentType<P>> = ConnectedComponent<C, P>;
|
|
29
30
|
export type PanelComponentType<P extends PanelProps = PanelProps, C extends ComponentType<P> = ComponentType<P>> = (ComponentType<P> | WrappedComponentType<P, C>) & PanelStaticMetaData;
|
|
30
|
-
export declare function isWrappedComponent<P extends PanelProps, C extends ComponentType<P>>(type: PanelComponentType<P, C>): type is WrappedComponentType<P, C>;
|
|
31
31
|
export type PanelMetadata = Partial<WidgetDescriptor>;
|
|
32
32
|
export type PanelProps = GLPanelProps & {
|
|
33
33
|
metadata?: PanelMetadata;
|
|
@@ -76,5 +76,4 @@ export type DashboardPluginComponentProps = {
|
|
|
76
76
|
*/
|
|
77
77
|
export declare function isDashboardPluginProps(props: Partial<DashboardPluginComponentProps>): props is DashboardPluginComponentProps;
|
|
78
78
|
export declare function assertIsDashboardPluginProps(props: Partial<DashboardPluginComponentProps>): asserts props is DashboardPluginComponentProps;
|
|
79
|
-
export {};
|
|
80
79
|
//# sourceMappingURL=DashboardPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardPlugin.d.ts","sourceRoot":"","sources":["../src/DashboardPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,yBAAyB,EACzB,eAAe,EACf,aAAa,EACd,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,YAAY,MAAM,gBAAgB,CAAC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B,GAAG;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,iBAAiB,EAAE,CACjB,CAAC,SAAS,mBAAmB,EAC7B,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,EAE1B,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EACvC,OAAO,CAAC,EAAE,oBAAoB,EAC9B,SAAS,CAAC,EAAE,sBAAsB,KAC/B,2BAA2B,CAAC;CAClC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,CAAC,6BAA6B,CAAC,GAC5C,KAAK,IAAI,6BAA6B,CAOxC;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,CAAC,6BAA6B,CAAC,GAC5C,OAAO,CAAC,KAAK,IAAI,6BAA6B,CAMhD"}
|
package/dist/DashboardPlugin.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import GoldenLayout from '@deephaven/golden-layout';
|
|
2
2
|
import PanelManager from "./PanelManager.js";
|
|
3
|
+
export { isWrappedComponent } from '@deephaven/components';
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Panel components can provide static props that provide meta data about the
|
|
5
7
|
* panel.
|
|
6
8
|
*/
|
|
9
|
+
|
|
7
10
|
/**
|
|
8
11
|
* Alias for the return type of React.forwardRef()
|
|
9
12
|
*/
|
|
13
|
+
|
|
10
14
|
/**
|
|
11
15
|
* @deprecated Use `PanelComponentType` instead and add generic types to forwardRef call.
|
|
12
16
|
*/
|
|
13
|
-
|
|
14
|
-
return (type === null || type === void 0 ? void 0 : type.WrappedComponent) !== undefined;
|
|
15
|
-
}
|
|
17
|
+
|
|
16
18
|
/**
|
|
17
19
|
* Takes a partial DashboardPluginComponentProps and verifies all the dashboard component fields are filled in.
|
|
18
20
|
* @param props The props to check
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardPlugin.js","names":["GoldenLayout","PanelManager","isWrappedComponent","
|
|
1
|
+
{"version":3,"file":"DashboardPlugin.js","names":["GoldenLayout","PanelManager","isWrappedComponent","isDashboardPluginProps","props","id","layout","panelManager","registerComponent","assertIsDashboardPluginProps","Error","concat"],"sources":["../src/DashboardPlugin.ts"],"sourcesContent":["import type {\n Component,\n ComponentType,\n ForwardRefExoticComponent,\n PropsWithoutRef,\n RefAttributes,\n} from 'react';\nimport { ConnectedComponent } from 'react-redux';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type {\n GLPanelProps,\n ReactComponentConfig,\n} from '@deephaven/golden-layout';\nimport PanelManager from './PanelManager';\nimport { WidgetDescriptor } from './PanelEvent';\n\nexport { isWrappedComponent } from '@deephaven/components';\n\n/**\n * Panel components can provide static props that provide meta data about the\n * panel.\n */\nexport interface PanelStaticMetaData {\n /**\n * Should be set to the same name as the component type.\n * @deprecated Use `displayName` instead.\n */\n COMPONENT?: string;\n\n /** Title of the panel. */\n TITLE?: string;\n}\n\n/**\n * Alias for the return type of React.forwardRef()\n */\ntype ForwardRefComponentType<P, R> = ForwardRefExoticComponent<\n PropsWithoutRef<P> & RefAttributes<R>\n>;\n\n/**\n * @deprecated Use `PanelComponentType` instead and add generic types to forwardRef call.\n */\nexport type PanelFunctionComponentType<P, R> = ForwardRefComponentType<P, R> &\n PanelStaticMetaData;\n\nexport type WrappedComponentType<\n P extends PanelProps,\n C extends ComponentType<P>,\n> = ConnectedComponent<C, P>;\n\nexport type PanelComponentType<\n P extends PanelProps = PanelProps,\n C extends ComponentType<P> = ComponentType<P>,\n> = (ComponentType<P> | WrappedComponentType<P, C>) & PanelStaticMetaData;\n\nexport type PanelMetadata = Partial<WidgetDescriptor>;\n\nexport type PanelProps = GLPanelProps & {\n metadata?: PanelMetadata;\n panelState?: unknown;\n};\n\nexport type DehydratedPanelProps = Omit<PanelProps, keyof GLPanelProps>;\n\nexport type LocalDashboardProps = { localDashboardId: string };\n\nexport type DashboardPanelProps = PanelProps & LocalDashboardProps;\n\nexport type DehydratedDashboardPanelProps = DehydratedPanelProps &\n LocalDashboardProps;\n\nexport type PanelComponent<T extends PanelProps = PanelProps> =\n | Component<T>\n | { props: T; state: unknown };\n\nexport type PanelConfig = ReactComponentConfig & {\n componentState?: Record<string, unknown> | null;\n};\n\nexport type DehydratedPanelConfig = PanelConfig & {\n componentState: null;\n props: DehydratedPanelProps;\n type: 'react-component';\n};\n\nexport type DashboardConfig = {\n id: string;\n layout: GoldenLayout;\n panelManager: PanelManager;\n};\n\nexport interface DashboardPanelDefinition {\n name: string;\n definition: ComponentType;\n}\n\nexport type DeregisterComponentFunction = () => void;\n\nexport type PanelHydrateFunction<\n T extends DehydratedDashboardPanelProps = DehydratedDashboardPanelProps,\n R extends T = T,\n> = (props: T, dashboardId: string) => R;\n\nexport type PanelDehydrateFunction = (\n config: PanelConfig,\n dashboardId: string\n) => PanelConfig | null;\n\nexport type DashboardPluginComponentProps = {\n id: string;\n layout: GoldenLayout;\n panelManager: PanelManager;\n registerComponent: <\n P extends DashboardPanelProps,\n C extends ComponentType<P>,\n >(\n name: string,\n ComponentType: PanelComponentType<P, C>,\n hydrate?: PanelHydrateFunction,\n dehydrate?: PanelDehydrateFunction\n ) => DeregisterComponentFunction;\n};\n\n/**\n * Takes a partial DashboardPluginComponentProps and verifies all the dashboard component fields are filled in.\n * @param props The props to check\n * @returns True if the props are valid DashboardPluginComponentProps, false otherwise\n */\nexport function isDashboardPluginProps(\n props: Partial<DashboardPluginComponentProps>\n): props is DashboardPluginComponentProps {\n return (\n typeof props.id === 'string' &&\n props.layout instanceof GoldenLayout &&\n props.panelManager instanceof PanelManager &&\n typeof props.registerComponent === 'function'\n );\n}\n\nexport function assertIsDashboardPluginProps(\n props: Partial<DashboardPluginComponentProps>\n): asserts props is DashboardPluginComponentProps {\n if (!isDashboardPluginProps(props)) {\n throw new Error(\n `Expected dashboard plugin props, but instead received ${props}`\n );\n }\n}\n"],"mappings":"AAQA,OAAOA,YAAY,MAAM,0BAA0B;AAAC,OAK7CC,YAAY;AAGnB,SAASC,kBAAkB,QAAQ,uBAAuB;;AAE1D;AACA;AACA;AACA;;AAYA;AACA;AACA;;AAKA;AACA;AACA;;AAkFA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CACpCC,KAA6C,EACL;EACxC,OACE,OAAOA,KAAK,CAACC,EAAE,KAAK,QAAQ,IAC5BD,KAAK,CAACE,MAAM,YAAYN,YAAY,IACpCI,KAAK,CAACG,YAAY,YAAYN,YAAY,IAC1C,OAAOG,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"}
|
package/dist/DashboardUtils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DehydratedDashboardPanelProps, DehydratedPanelConfig,
|
|
1
|
+
import { DehydratedDashboardPanelProps, DehydratedPanelConfig, PanelConfig } from './DashboardPlugin';
|
|
2
|
+
export { canHaveRef } from '@deephaven/components';
|
|
2
3
|
/**
|
|
3
4
|
* Dehydrate an existing panel to allow it to be serialized/saved.
|
|
4
5
|
* Just takes what's in the panels `metadata` in the props and `panelState` in
|
|
@@ -15,13 +16,6 @@ export declare function dehydrate(config: PanelConfig): DehydratedPanelConfig;
|
|
|
15
16
|
* @returns The hydrated panel props
|
|
16
17
|
*/
|
|
17
18
|
export declare function hydrate<T extends DehydratedDashboardPanelProps>(props: T, localDashboardId?: string): T;
|
|
18
|
-
/**
|
|
19
|
-
* Checks if a panel component can take a ref. Helps silence react dev errors
|
|
20
|
-
* if a ref is passed to a functional component without forwardRef.
|
|
21
|
-
* @param component The panel component to check if it can take a ref
|
|
22
|
-
* @returns Wheter the component can take a ref or not
|
|
23
|
-
*/
|
|
24
|
-
export declare function canHaveRef(component: PanelComponentType): boolean;
|
|
25
19
|
declare const _default: {
|
|
26
20
|
dehydrate: typeof dehydrate;
|
|
27
21
|
hydrate: typeof hydrate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardUtils.d.ts","sourceRoot":"","sources":["../src/DashboardUtils.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DashboardUtils.d.ts","sourceRoot":"","sources":["../src/DashboardUtils.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,qBAAqB,CAqBpE;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,6BAA6B,EAC7D,KAAK,EAAE,CAAC,EACR,gBAAgB,SAAK,GACpB,CAAC,CAKH;;;;;AAED,wBAGE"}
|
package/dist/DashboardUtils.js
CHANGED
|
@@ -3,8 +3,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
3
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
4
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
5
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
export { canHaveRef } from '@deephaven/components';
|
|
7
|
+
|
|
8
8
|
/**
|
|
9
9
|
* Dehydrate an existing panel to allow it to be serialized/saved.
|
|
10
10
|
* Just takes what's in the panels `metadata` in the props and `panelState` in
|
|
@@ -55,19 +55,6 @@ export function hydrate(props) {
|
|
|
55
55
|
localDashboardId
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Checks if a panel component can take a ref. Helps silence react dev errors
|
|
61
|
-
* if a ref is passed to a functional component without forwardRef.
|
|
62
|
-
* @param component The panel component to check if it can take a ref
|
|
63
|
-
* @returns Wheter the component can take a ref or not
|
|
64
|
-
*/
|
|
65
|
-
export function canHaveRef(component) {
|
|
66
|
-
// Might be a redux connect wrapped component
|
|
67
|
-
var isClassComponent = isWrappedComponent(component) && component.WrappedComponent.prototype != null && component.WrappedComponent.prototype.isReactComponent != null || component.prototype != null && component.prototype.isReactComponent != null;
|
|
68
|
-
var isForwardRef = !isWrappedComponent(component) && '$$typeof' in component && component.$$typeof === ForwardRef;
|
|
69
|
-
return isClassComponent || isForwardRef;
|
|
70
|
-
}
|
|
71
58
|
export default {
|
|
72
59
|
dehydrate,
|
|
73
60
|
hydrate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardUtils.js","names":["
|
|
1
|
+
{"version":3,"file":"DashboardUtils.js","names":["canHaveRef","dehydrate","config","props","componentState","metadata","panelState","newProps","_objectSpread","type","hydrate","localDashboardId","arguments","length","undefined"],"sources":["../src/DashboardUtils.tsx"],"sourcesContent":["import {\n DehydratedDashboardPanelProps,\n DehydratedPanelConfig,\n PanelConfig,\n} from './DashboardPlugin';\n\nexport { canHaveRef } from '@deephaven/components';\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): DehydratedPanelConfig {\n const { props, componentState } = config;\n const { metadata } = props;\n let { panelState = null } = props;\n if (componentState) {\n ({ panelState } = componentState);\n }\n const newProps: Record<string, unknown> = {};\n if (metadata != null) {\n newProps.metadata = metadata;\n }\n if (panelState != null) {\n newProps.panelState = panelState;\n }\n\n return {\n ...config,\n componentState: null,\n props: newProps,\n type: 'react-component',\n };\n}\n\n/**\n * Default hydration function. Just applies the dashboard ID. When used with dehydrate above,\n * the panels state will be stored in `panelState` prop.\n * @param props Panel props to hydrate\n * @param localDashboardId The local dashboard ID to hydrate the panel with\n * @returns The hydrated panel props\n */\nexport function hydrate<T extends DehydratedDashboardPanelProps>(\n props: T,\n localDashboardId = ''\n): T {\n return {\n ...props,\n localDashboardId,\n };\n}\n\nexport default {\n dehydrate,\n hydrate,\n};\n"],"mappings":";;;;;AAMA,SAASA,UAAU,QAAQ,uBAAuB;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAACC,MAAmB,EAAyB;EACpE,IAAM;IAAEC,KAAK;IAAEC;EAAe,CAAC,GAAGF,MAAM;EACxC,IAAM;IAAEG;EAAS,CAAC,GAAGF,KAAK;EAC1B,IAAI;IAAEG,UAAU,GAAG;EAAK,CAAC,GAAGH,KAAK;EACjC,IAAIC,cAAc,EAAE;IAClB,CAAC;MAAEE;IAAW,CAAC,GAAGF,cAAc;EAClC;EACA,IAAMG,QAAiC,GAAG,CAAC,CAAC;EAC5C,IAAIF,QAAQ,IAAI,IAAI,EAAE;IACpBE,QAAQ,CAACF,QAAQ,GAAGA,QAAQ;EAC9B;EACA,IAAIC,UAAU,IAAI,IAAI,EAAE;IACtBC,QAAQ,CAACD,UAAU,GAAGA,UAAU;EAClC;EAEA,OAAAE,aAAA,CAAAA,aAAA,KACKN,MAAM;IACTE,cAAc,EAAE,IAAI;IACpBD,KAAK,EAAEI,QAAQ;IACfE,IAAI,EAAE;EAAiB;AAE3B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CACrBP,KAAQ,EAEL;EAAA,IADHQ,gBAAgB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAErB,OAAAJ,aAAA,CAAAA,aAAA,KACKL,KAAK;IACRQ;EAAgB;AAEpB;AAEA,eAAe;EACbV,SAAS;EACTS;AACF,CAAC"}
|
package/dist/PanelManager.d.ts
CHANGED
|
@@ -4,7 +4,12 @@ import type { Container, ContentItem, ItemConfigType, ReactComponentConfig } fro
|
|
|
4
4
|
import { PanelComponent, PanelComponentType, PanelProps } from './DashboardPlugin';
|
|
5
5
|
export type PanelHydraterFunction = (name: string, props: PanelProps) => PanelProps;
|
|
6
6
|
export type PanelDehydraterFunction = (name: string, config: ReactComponentConfig) => ReactComponentConfig;
|
|
7
|
-
export type ClosedPanel = ReactComponentConfig
|
|
7
|
+
export type ClosedPanel = ReactComponentConfig & {
|
|
8
|
+
/**
|
|
9
|
+
* The stack the component is in.
|
|
10
|
+
*/
|
|
11
|
+
parentStackId?: string | string[];
|
|
12
|
+
};
|
|
8
13
|
export type ClosedPanels = ClosedPanel[];
|
|
9
14
|
export type OpenedPanelMap = Map<string | string[], PanelComponent>;
|
|
10
15
|
export type PanelsUpdateData = {
|
|
@@ -55,7 +60,11 @@ declare class PanelManager {
|
|
|
55
60
|
* @param replaceConfig The config to place
|
|
56
61
|
*/
|
|
57
62
|
handleReopen(panelConfig: ClosedPanel, replaceConfig?: Partial<ItemConfigType>): void;
|
|
58
|
-
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @param glContainer Only reopen panels that were closed from the stack of this container, if defined
|
|
66
|
+
*/
|
|
67
|
+
handleReopenLast(glContainer?: Container): void;
|
|
59
68
|
handleDeleted(panelConfig: ClosedPanel): void;
|
|
60
69
|
handleClosed(panelId: string, glContainer: Container): void;
|
|
61
70
|
handleControlClose(id: string): void;
|
|
@@ -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,SAAS,EACT,WAAW,EACX,cAAc,EACd,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAEL,cAAc,EACd,kBAAkB,EAClB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAI3B,MAAM,MAAM,qBAAqB,GAAG,CAClC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,KACd,UAAU,CAAC;AAEhB,MAAM,MAAM,uBAAuB,GAAG,CACpC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,oBAAoB,KACzB,oBAAoB,CAAC;AAE1B,MAAM,MAAM,WAAW,GAAG,oBAAoB,
|
|
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,SAAS,EACT,WAAW,EACX,cAAc,EACd,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAEL,cAAc,EACd,kBAAkB,EAClB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAI3B,MAAM,MAAM,qBAAqB,GAAG,CAClC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,KACd,UAAU,CAAC;AAEhB,MAAM,MAAM,uBAAuB,GAAG,CACpC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,oBAAoB,KACzB,oBAAoB,CAAC;AAE1B,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAAG;IAC/C;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAA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,WAAW,EAAE,SAAS,GAAG,IAAI;IAgB5C,UAAU,IAAI,IAAI;CAOnB;AAED,eAAe,YAAY,CAAC"}
|
package/dist/PanelManager.js
CHANGED
|
@@ -206,15 +206,34 @@ class PanelManager {
|
|
|
206
206
|
var {
|
|
207
207
|
root
|
|
208
208
|
} = this.layout;
|
|
209
|
+
var stack = panelConfig.parentStackId === undefined ? undefined : LayoutUtils.getStackById(root, panelConfig.parentStackId);
|
|
209
210
|
LayoutUtils.openComponent({
|
|
210
211
|
root,
|
|
211
212
|
config,
|
|
212
|
-
replaceConfig
|
|
213
|
+
replaceConfig,
|
|
214
|
+
stack: stack !== null && stack !== void 0 ? stack : undefined
|
|
213
215
|
});
|
|
214
216
|
}
|
|
215
|
-
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
*
|
|
220
|
+
* @param glContainer Only reopen panels that were closed from the stack of this container, if defined
|
|
221
|
+
*/
|
|
222
|
+
handleReopenLast(glContainer) {
|
|
223
|
+
var _LayoutUtils$getStack;
|
|
216
224
|
if (this.closed.length === 0) return;
|
|
217
|
-
|
|
225
|
+
if (glContainer === undefined) {
|
|
226
|
+
this.handleReopen(this.closed[this.closed.length - 1]);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
var stackId = (_LayoutUtils$getStack = LayoutUtils.getStackForConfig(this.layout.root, glContainer.getConfig())) === null || _LayoutUtils$getStack === void 0 ? void 0 : _LayoutUtils$getStack.config.id;
|
|
230
|
+
for (var i = this.closed.length - 1; i >= 0; i -= 1) {
|
|
231
|
+
var panelConfig = this.closed[i];
|
|
232
|
+
if (panelConfig.parentStackId === stackId) {
|
|
233
|
+
this.handleReopen(panelConfig);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
218
237
|
}
|
|
219
238
|
handleDeleted(panelConfig) {
|
|
220
239
|
log.debug2('Deleted:', panelConfig);
|
|
@@ -238,10 +257,15 @@ class PanelManager {
|
|
|
238
257
|
LayoutUtils.closeComponent(root, config);
|
|
239
258
|
}
|
|
240
259
|
addClosedPanel(glContainer) {
|
|
260
|
+
var {
|
|
261
|
+
root
|
|
262
|
+
} = this.layout;
|
|
241
263
|
var config = LayoutUtils.getComponentConfigFromContainer(glContainer);
|
|
242
264
|
if (config && isReactComponentConfig(config)) {
|
|
243
265
|
var dehydratedConfig = this.dehydrateComponent(config.component, config);
|
|
244
266
|
if (dehydratedConfig != null) {
|
|
267
|
+
var _LayoutUtils$getStack2;
|
|
268
|
+
dehydratedConfig.parentStackId = (_LayoutUtils$getStack2 = LayoutUtils.getStackForConfig(root, config)) === null || _LayoutUtils$getStack2 === void 0 ? void 0 : _LayoutUtils$getStack2.config.id;
|
|
245
269
|
this.closed.push(dehydratedConfig);
|
|
246
270
|
}
|
|
247
271
|
}
|