@deephaven/dashboard 0.22.3-beta.15 → 0.22.3-beta.21
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/Dashboard.d.ts +1 -1
- package/dist/Dashboard.d.ts.map +1 -1
- package/dist/Dashboard.js +4 -15
- package/dist/Dashboard.js.map +1 -1
- package/dist/DashboardConstants.js.map +1 -1
- package/dist/DashboardLayout.d.ts +4 -4
- package/dist/DashboardLayout.d.ts.map +1 -1
- package/dist/DashboardLayout.js +11 -24
- package/dist/DashboardLayout.js.map +1 -1
- package/dist/DashboardPlugin.js +0 -1
- package/dist/DashboardPlugin.js.map +1 -1
- package/dist/DashboardUtils.js +1 -9
- package/dist/DashboardUtils.js.map +1 -1
- package/dist/PanelErrorBoundary.js +0 -8
- package/dist/PanelErrorBoundary.js.map +1 -1
- package/dist/PanelEvent.js.map +1 -1
- package/dist/PanelManager.js +15 -62
- package/dist/PanelManager.js.map +1 -1
- package/dist/PanelPlaceholder.d.ts.map +1 -1
- package/dist/PanelPlaceholder.js +1 -1
- package/dist/PanelPlaceholder.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/layout/GLPropTypes.js.map +1 -1
- package/dist/layout/GoldenLayoutThemeExport.js +0 -1
- package/dist/layout/GoldenLayoutThemeExport.js.map +1 -1
- package/dist/layout/LayoutUtils.js +50 -176
- package/dist/layout/LayoutUtils.js.map +1 -1
- package/dist/layout/hooks.js.map +1 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/redux/actionTypes.js.map +1 -1
- package/dist/redux/actions.js +1 -5
- package/dist/redux/actions.js.map +1 -1
- package/dist/redux/index.js.map +1 -1
- package/dist/redux/reducers/dashboardData.js.map +1 -1
- package/dist/redux/reducers/index.js.map +1 -1
- package/dist/redux/selectors.js +3 -7
- package/dist/redux/selectors.js.map +1 -1
- package/package.json +10 -10
package/dist/PanelManager.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
4
|
import Log from '@deephaven/log';
|
|
8
5
|
import PanelEvent from "./PanelEvent.js";
|
|
9
6
|
import LayoutUtils, { isReactComponentConfig } from "./layout/LayoutUtils.js";
|
|
10
7
|
import { isWrappedComponent } from "./DashboardPlugin.js";
|
|
11
8
|
var log = Log.module('PanelManager');
|
|
12
|
-
|
|
13
9
|
/**
|
|
14
10
|
* Class to keep track of which panels are open, have been closed, and also events to close panels.
|
|
15
11
|
*/
|
|
@@ -28,24 +24,17 @@ class PanelManager {
|
|
|
28
24
|
var openedMap = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Map();
|
|
29
25
|
var closed = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
30
26
|
var onPanelsUpdated = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : () => undefined;
|
|
31
|
-
|
|
32
27
|
_defineProperty(this, "layout", void 0);
|
|
33
|
-
|
|
34
28
|
_defineProperty(this, "hydrateComponent", void 0);
|
|
35
|
-
|
|
36
29
|
_defineProperty(this, "dehydrateComponent", void 0);
|
|
37
|
-
|
|
38
30
|
_defineProperty(this, "onPanelsUpdated", void 0);
|
|
39
|
-
|
|
40
31
|
_defineProperty(this, "closed", void 0);
|
|
41
|
-
|
|
42
32
|
_defineProperty(this, "openedMap", void 0);
|
|
43
|
-
|
|
44
33
|
this.handleFocus = this.handleFocus.bind(this);
|
|
45
|
-
this.handleMount = this.handleMount.bind(this);
|
|
34
|
+
this.handleMount = this.handleMount.bind(this);
|
|
35
|
+
// Panel can be unmounted on error but still keep the tab until it's closed
|
|
46
36
|
// Use PanelEvent.MOUNT/UNMOUNT to track open (active) panels
|
|
47
37
|
// and PanelEvent.CLOSED for cleanup (delete links, add panel to closed panels list, etc)
|
|
48
|
-
|
|
49
38
|
this.handleUnmount = this.handleUnmount.bind(this);
|
|
50
39
|
this.handleReopen = this.handleReopen.bind(this);
|
|
51
40
|
this.handleDeleted = this.handleDeleted.bind(this);
|
|
@@ -54,14 +43,15 @@ class PanelManager {
|
|
|
54
43
|
this.layout = layout;
|
|
55
44
|
this.hydrateComponent = hydrateComponent;
|
|
56
45
|
this.dehydrateComponent = dehydrateComponent;
|
|
57
|
-
this.onPanelsUpdated = onPanelsUpdated;
|
|
46
|
+
this.onPanelsUpdated = onPanelsUpdated;
|
|
58
47
|
|
|
59
|
-
|
|
48
|
+
// Store the opened and closed panels
|
|
49
|
+
this.openedMap = new Map(openedMap);
|
|
60
50
|
|
|
51
|
+
// Closed panels are stored in their dehydrated state
|
|
61
52
|
this.closed = [...closed];
|
|
62
53
|
this.startListening();
|
|
63
54
|
}
|
|
64
|
-
|
|
65
55
|
startListening() {
|
|
66
56
|
var {
|
|
67
57
|
eventHub
|
|
@@ -72,7 +62,8 @@ class PanelManager {
|
|
|
72
62
|
eventHub.on(PanelEvent.REOPEN, this.handleReopen);
|
|
73
63
|
eventHub.on(PanelEvent.DELETE, this.handleDeleted);
|
|
74
64
|
eventHub.on(PanelEvent.CLOSED, this.handleClosed);
|
|
75
|
-
eventHub.on(PanelEvent.CLOSE, this.handleControlClose);
|
|
65
|
+
eventHub.on(PanelEvent.CLOSE, this.handleControlClose);
|
|
66
|
+
// PanelEvent.OPEN should be listened to by plugins to open a panel
|
|
76
67
|
}
|
|
77
68
|
|
|
78
69
|
stopListening() {
|
|
@@ -87,15 +78,12 @@ class PanelManager {
|
|
|
87
78
|
eventHub.off(PanelEvent.CLOSED, this.handleClosed);
|
|
88
79
|
eventHub.off(PanelEvent.CLOSE, this.handleControlClose);
|
|
89
80
|
}
|
|
90
|
-
|
|
91
81
|
getClosedPanelConfigsOfType(typeString) {
|
|
92
82
|
return this.closed.filter(panel => panel.component === typeString);
|
|
93
83
|
}
|
|
94
|
-
|
|
95
84
|
getOpenedPanels() {
|
|
96
85
|
return Array.from(this.openedMap.values());
|
|
97
86
|
}
|
|
98
|
-
|
|
99
87
|
getOpenedPanelConfigs() {
|
|
100
88
|
return this.getOpenedPanels().map(panel => {
|
|
101
89
|
var {
|
|
@@ -104,18 +92,14 @@ class PanelManager {
|
|
|
104
92
|
return LayoutUtils.getComponentConfigFromContainer(glContainer);
|
|
105
93
|
});
|
|
106
94
|
}
|
|
107
|
-
|
|
108
95
|
getOpenedPanelConfigsOfType(typeString) {
|
|
109
96
|
return this.getOpenedPanelConfigs().filter(config => config != null && isReactComponentConfig(config) && config.component === typeString);
|
|
110
97
|
}
|
|
111
|
-
|
|
112
98
|
getOpenedPanelById(panelId) {
|
|
113
99
|
return this.openedMap.get(panelId);
|
|
114
100
|
}
|
|
115
|
-
|
|
116
101
|
getContainerByPanelId(panelId) {
|
|
117
102
|
var _ref;
|
|
118
|
-
|
|
119
103
|
var stack = LayoutUtils.getStackForConfig(this.layout.root, {
|
|
120
104
|
id: panelId
|
|
121
105
|
});
|
|
@@ -123,58 +107,45 @@ class PanelManager {
|
|
|
123
107
|
id: panelId
|
|
124
108
|
})) !== null && _ref !== void 0 ? _ref : null;
|
|
125
109
|
}
|
|
126
|
-
|
|
127
110
|
getLastUsedPanel(matcher) {
|
|
128
111
|
var opened = this.getOpenedPanels();
|
|
129
|
-
|
|
130
112
|
for (var i = opened.length - 1; i >= 0; i -= 1) {
|
|
131
113
|
var _panel = opened[i];
|
|
132
|
-
|
|
133
114
|
if (matcher == null || matcher(_panel)) {
|
|
134
115
|
return _panel;
|
|
135
116
|
}
|
|
136
117
|
}
|
|
137
|
-
|
|
138
118
|
return undefined;
|
|
139
119
|
}
|
|
140
|
-
|
|
141
120
|
getLastUsedPanelOfType(type) {
|
|
142
121
|
return this.getLastUsedPanelOfTypes([type]);
|
|
143
122
|
}
|
|
144
|
-
|
|
145
123
|
getLastUsedPanelOfTypes(types) {
|
|
146
124
|
return this.getLastUsedPanel(panel => types.some(type => isWrappedComponent(type) && panel instanceof type.WrappedComponent || !isWrappedComponent(type) && panel instanceof type));
|
|
147
125
|
}
|
|
148
|
-
|
|
149
126
|
updatePanel(panel) {
|
|
150
127
|
var panelId = LayoutUtils.getIdFromPanel(panel);
|
|
151
|
-
|
|
152
128
|
if (panelId == null) {
|
|
153
129
|
log.error('updatePanel Panel did not have an ID', panel);
|
|
154
130
|
return;
|
|
155
131
|
}
|
|
156
|
-
|
|
157
|
-
|
|
132
|
+
log.debug2("Updating panel ID ".concat(panelId, " in open panels map"));
|
|
133
|
+
// Delete the entry before it's set to maintain correct ordering in the open panels map.
|
|
158
134
|
// The last updated (focused) panel should be the last inserted.
|
|
159
135
|
// Deleting the entry from the map directly instead of calling this.removePanel to skip the checks.
|
|
160
|
-
|
|
161
136
|
this.openedMap.delete(panelId);
|
|
162
137
|
this.openedMap.set(panelId, panel);
|
|
163
138
|
}
|
|
164
|
-
|
|
165
139
|
removePanel(panel) {
|
|
166
140
|
var panelId = LayoutUtils.getIdFromPanel(panel);
|
|
167
|
-
|
|
168
141
|
if (panelId == null) {
|
|
169
142
|
log.error('removePanel Panel did not have an ID', panel);
|
|
170
143
|
return;
|
|
171
144
|
}
|
|
172
|
-
|
|
173
145
|
if (!this.openedMap.has(panelId)) {
|
|
174
146
|
log.error("Missing panel ID ".concat(panelId, " in open panels map"));
|
|
175
147
|
return;
|
|
176
148
|
}
|
|
177
|
-
|
|
178
149
|
if (this.openedMap.get(panelId) !== panel) {
|
|
179
150
|
// We mount a new panel before un-mounting the existing one
|
|
180
151
|
// when replacing existing panels in openComponent/openComponentInStack.
|
|
@@ -182,47 +153,41 @@ class PanelManager {
|
|
|
182
153
|
log.debug("Panel argument doesn't match the open panels map entry for ".concat(panelId, ", removePanel ignored"));
|
|
183
154
|
return;
|
|
184
155
|
}
|
|
185
|
-
|
|
186
156
|
log.debug2("Removing panel ID ".concat(panelId, " from open panels map"));
|
|
187
157
|
this.openedMap.delete(panelId);
|
|
188
158
|
}
|
|
189
|
-
|
|
190
159
|
removeClosedPanelConfig(panelConfig) {
|
|
191
|
-
var index = this.closed.findIndex(closedConfig => closedConfig === panelConfig || closedConfig.id != null && panelConfig.id && closedConfig.id === panelConfig.id);
|
|
192
|
-
|
|
160
|
+
var index = this.closed.findIndex(closedConfig => closedConfig === panelConfig || closedConfig.id != null && panelConfig.id != null && closedConfig.id === panelConfig.id);
|
|
193
161
|
if (index >= 0) {
|
|
194
162
|
this.closed.splice(index, 1);
|
|
195
163
|
}
|
|
196
164
|
}
|
|
197
|
-
|
|
198
165
|
handleFocus(panel) {
|
|
199
166
|
log.debug2('Focus: ', panel);
|
|
200
167
|
this.updatePanel(panel);
|
|
201
168
|
}
|
|
202
|
-
|
|
203
169
|
handleMount(panel) {
|
|
204
170
|
log.debug2('Mount: ', panel);
|
|
205
171
|
this.updatePanel(panel);
|
|
206
172
|
this.sendUpdate();
|
|
207
173
|
}
|
|
208
|
-
|
|
209
174
|
handleUnmount(panel) {
|
|
210
175
|
log.debug2('Unmount: ', panel);
|
|
211
176
|
this.removePanel(panel);
|
|
212
177
|
this.sendUpdate();
|
|
213
178
|
}
|
|
179
|
+
|
|
214
180
|
/**
|
|
215
181
|
*
|
|
216
182
|
* @param panelConfig The config to hydrate and load
|
|
217
183
|
* @param replaceConfig The config to place
|
|
218
184
|
*/
|
|
219
|
-
|
|
220
|
-
|
|
221
185
|
handleReopen(panelConfig, replaceConfig) {
|
|
222
186
|
log.debug2('Reopen:', panelConfig, replaceConfig);
|
|
223
|
-
this.removeClosedPanelConfig(panelConfig);
|
|
224
|
-
//
|
|
187
|
+
this.removeClosedPanelConfig(panelConfig);
|
|
188
|
+
// Don't need to send an update yet, it will get sent when component is mounted
|
|
225
189
|
|
|
190
|
+
// Rehydrate the panel before adding it back
|
|
226
191
|
var {
|
|
227
192
|
component
|
|
228
193
|
} = panelConfig;
|
|
@@ -230,11 +195,9 @@ class PanelManager {
|
|
|
230
195
|
props
|
|
231
196
|
} = panelConfig;
|
|
232
197
|
props = this.hydrateComponent(component, props);
|
|
233
|
-
|
|
234
198
|
var config = _objectSpread(_objectSpread({}, panelConfig), {}, {
|
|
235
199
|
props
|
|
236
200
|
});
|
|
237
|
-
|
|
238
201
|
var {
|
|
239
202
|
root
|
|
240
203
|
} = this.layout;
|
|
@@ -244,13 +207,11 @@ class PanelManager {
|
|
|
244
207
|
replaceConfig
|
|
245
208
|
});
|
|
246
209
|
}
|
|
247
|
-
|
|
248
210
|
handleDeleted(panelConfig) {
|
|
249
211
|
log.debug2('Deleted:', panelConfig);
|
|
250
212
|
this.removeClosedPanelConfig(panelConfig);
|
|
251
213
|
this.sendUpdate();
|
|
252
214
|
}
|
|
253
|
-
|
|
254
215
|
handleClosed(panelId, glContainer) {
|
|
255
216
|
// Panel component should be already unmounted at this point
|
|
256
217
|
// so the emitted event sends the container object instead of the panel.
|
|
@@ -258,7 +219,6 @@ class PanelManager {
|
|
|
258
219
|
this.addClosedPanel(glContainer);
|
|
259
220
|
this.sendUpdate();
|
|
260
221
|
}
|
|
261
|
-
|
|
262
222
|
handleControlClose(id) {
|
|
263
223
|
var config = {
|
|
264
224
|
id
|
|
@@ -268,19 +228,15 @@ class PanelManager {
|
|
|
268
228
|
} = this.layout;
|
|
269
229
|
LayoutUtils.closeComponent(root, config);
|
|
270
230
|
}
|
|
271
|
-
|
|
272
231
|
addClosedPanel(glContainer) {
|
|
273
232
|
var config = LayoutUtils.getComponentConfigFromContainer(glContainer);
|
|
274
|
-
|
|
275
233
|
if (config && isReactComponentConfig(config)) {
|
|
276
234
|
var dehydratedConfig = this.dehydrateComponent(config.component, config);
|
|
277
|
-
|
|
278
235
|
if (dehydratedConfig != null) {
|
|
279
236
|
this.closed.push(dehydratedConfig);
|
|
280
237
|
}
|
|
281
238
|
}
|
|
282
239
|
}
|
|
283
|
-
|
|
284
240
|
sendUpdate() {
|
|
285
241
|
var {
|
|
286
242
|
closed,
|
|
@@ -291,10 +247,7 @@ class PanelManager {
|
|
|
291
247
|
openedMap: new Map(openedMap)
|
|
292
248
|
});
|
|
293
249
|
}
|
|
294
|
-
|
|
295
250
|
}
|
|
296
|
-
|
|
297
251
|
_defineProperty(PanelManager, "MAX_CLOSED_PANEL_COUNT", 100);
|
|
298
|
-
|
|
299
252
|
export default PanelManager;
|
|
300
253
|
//# sourceMappingURL=PanelManager.js.map
|
package/dist/PanelManager.js.map
CHANGED
|
@@ -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 &&\n closedConfig.id === panelConfig.id)\n );\n if (index >= 0) {\n this.closed.splice(index, 1);\n }\n }\n\n handleFocus(panel: PanelComponent): void {\n log.debug2('Focus: ', panel);\n this.updatePanel(panel);\n }\n\n handleMount(panel: PanelComponent): void {\n log.debug2('Mount: ', panel);\n this.updatePanel(panel);\n this.sendUpdate();\n }\n\n handleUnmount(panel: PanelComponent): void {\n log.debug2('Unmount: ', panel);\n this.removePanel(panel);\n this.sendUpdate();\n }\n\n /**\n *\n * @param panelConfig The config to hydrate and load\n * @param replaceConfig The config to place\n */\n handleReopen(\n panelConfig: ClosedPanel,\n replaceConfig?: Partial<ItemConfigType>\n ): void {\n log.debug2('Reopen:', panelConfig, replaceConfig);\n\n this.removeClosedPanelConfig(panelConfig);\n // Don't need to send an update yet, it will get sent when component is mounted\n\n // Rehydrate the panel before adding it back\n const { component } = panelConfig;\n let { props } = panelConfig;\n props = this.hydrateComponent(component, props);\n\n const config = {\n ...panelConfig,\n props,\n };\n\n const { root } = this.layout;\n LayoutUtils.openComponent({ root, config, replaceConfig });\n }\n\n handleDeleted(panelConfig: ClosedPanel): void {\n log.debug2('Deleted:', panelConfig);\n\n this.removeClosedPanelConfig(panelConfig);\n\n this.sendUpdate();\n }\n\n handleClosed(panelId: string, glContainer: Container): void {\n // Panel component should be already unmounted at this point\n // so the emitted event sends the container object instead of the panel.\n log.debug2('Closed: ', panelId);\n this.addClosedPanel(glContainer);\n this.sendUpdate();\n }\n\n handleControlClose(id: string): void {\n const config = { id };\n const { root } = this.layout;\n LayoutUtils.closeComponent(root, config);\n }\n\n addClosedPanel(glContainer: Container): void {\n const config = LayoutUtils.getComponentConfigFromContainer(glContainer);\n if (config && isReactComponentConfig(config)) {\n const dehydratedConfig = this.dehydrateComponent(\n config.component,\n config\n );\n if (dehydratedConfig != null) {\n this.closed.push(dehydratedConfig);\n }\n }\n }\n\n sendUpdate(): void {\n const { closed, openedMap } = this;\n this.onPanelsUpdated({\n closed: [...closed],\n openedMap: new Map(openedMap),\n });\n }\n}\n\nexport default PanelManager;\n"],"mappings":";;;;;;AAQA,OAAOA,GAAP,MAAgB,gBAAhB;OACOC,U;OACAC,W,IAAeC,sB;SAEpBC,kB;AAMF,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAJ,CAAW,cAAX,CAAZ;;AAyBA;AACA;AACA;AACA,MAAMC,YAAN,CAAmB;EAejB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,WAAW,CACTC,MADS,EAOT;IAAA,IALAC,gBAKA,uEAL0C,CAACC,IAAD,EAAOC,KAAP,KAAiBA,KAK3D;IAAA,IAJAC,kBAIA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Y8E,IAAZ,CAAiBD,gBAAjB;MACD;IACF;EACF;;EAEDL,UAAU,GAAS;IACjB,IAAM;MAAExE,MAAF;MAAUF;IAAV,IAAwB,IAA9B;IACA,KAAKG,eAAL,CAAqB;MACnBD,MAAM,EAAE,CAAC,GAAGA,MAAJ,CADW;MAEnBF,SAAS,EAAE,IAAIC,GAAJ,CAAQD,SAAR;IAFQ,CAArB;EAID;;AAhSgB;;gBAAbR,Y,4BAC4B,G;;AAkSlC,eAAeA,YAAf"}
|
|
1
|
+
{"version":3,"file":"PanelManager.js","names":["Log","PanelEvent","LayoutUtils","isReactComponentConfig","isWrappedComponent","log","module","PanelManager","constructor","layout","hydrateComponent","name","props","dehydrateComponent","config","openedMap","Map","closed","onPanelsUpdated","undefined","handleFocus","bind","handleMount","handleUnmount","handleReopen","handleDeleted","handleClosed","handleControlClose","startListening","eventHub","on","FOCUS","MOUNT","UNMOUNT","REOPEN","DELETE","CLOSED","CLOSE","stopListening","off","getClosedPanelConfigsOfType","typeString","filter","panel","component","getOpenedPanels","Array","from","values","getOpenedPanelConfigs","map","glContainer","getComponentConfigFromContainer","getOpenedPanelConfigsOfType","getOpenedPanelById","panelId","get","getContainerByPanelId","stack","getStackForConfig","root","id","getContentItemInStack","getLastUsedPanel","matcher","opened","i","length","getLastUsedPanelOfType","type","getLastUsedPanelOfTypes","types","some","WrappedComponent","updatePanel","getIdFromPanel","error","debug2","delete","set","removePanel","has","debug","removeClosedPanelConfig","panelConfig","index","findIndex","closedConfig","splice","sendUpdate","replaceConfig","openComponent","addClosedPanel","closeComponent","dehydratedConfig","push"],"sources":["../src/PanelManager.ts"],"sourcesContent":["import { ComponentType } from 'react';\nimport GoldenLayout from '@deephaven/golden-layout';\nimport type {\n Container,\n ContentItem,\n ItemConfigType,\n ReactComponentConfig,\n} from '@deephaven/golden-layout';\nimport Log from '@deephaven/log';\nimport PanelEvent from './PanelEvent';\nimport LayoutUtils, { isReactComponentConfig } from './layout/LayoutUtils';\nimport {\n isWrappedComponent,\n PanelComponent,\n PanelComponentType,\n PanelProps,\n} from './DashboardPlugin';\n\nconst log = Log.module('PanelManager');\n\nexport type PanelHydraterFunction = (\n name: string,\n props: PanelProps\n) => PanelProps;\n\nexport type PanelDehydraterFunction = (\n name: string,\n config: ReactComponentConfig\n) => ReactComponentConfig;\n\nexport type ClosedPanel = ReactComponentConfig;\n\nexport type ClosedPanels = ClosedPanel[];\n\nexport type OpenedPanelMap = Map<string | string[], PanelComponent>;\n\nexport type PanelsUpdateData = {\n closed: ClosedPanels;\n openedMap: OpenedPanelMap;\n};\n\nexport type PanelsUpdateCallback = (panelUpdateData: PanelsUpdateData) => void;\n\n/**\n * Class to keep track of which panels are open, have been closed, and also events to close panels.\n */\nclass PanelManager {\n static MAX_CLOSED_PANEL_COUNT = 100;\n\n layout: GoldenLayout;\n\n hydrateComponent: PanelHydraterFunction;\n\n dehydrateComponent: PanelDehydraterFunction;\n\n onPanelsUpdated: PanelsUpdateCallback;\n\n closed: ClosedPanels;\n\n openedMap: OpenedPanelMap;\n\n /**\n * @param layout The GoldenLayout object to attach to\n * @param hydrateComponent Function to hydrate a panel from a dehydrated state\n * @param dehydrateComponent Function to dehydrate a panel\n * @param openedMap Map of opened panels\n * @param closed Array of closed panels in a dehydrated state\n * @param onPanelsUpdated Triggered when the panels are updated\n */\n constructor(\n layout: GoldenLayout,\n hydrateComponent: PanelHydraterFunction = (name, props) => props,\n dehydrateComponent: PanelDehydraterFunction = (name, config) => config,\n openedMap: OpenedPanelMap = new Map(),\n closed: ClosedPanel[] = [],\n onPanelsUpdated: PanelsUpdateCallback = () => undefined\n ) {\n this.handleFocus = this.handleFocus.bind(this);\n this.handleMount = this.handleMount.bind(this);\n // Panel can be unmounted on error but still keep the tab until it's closed\n // Use PanelEvent.MOUNT/UNMOUNT to track open (active) panels\n // and PanelEvent.CLOSED for cleanup (delete links, add panel to closed panels list, etc)\n this.handleUnmount = this.handleUnmount.bind(this);\n this.handleReopen = this.handleReopen.bind(this);\n this.handleDeleted = this.handleDeleted.bind(this);\n this.handleClosed = this.handleClosed.bind(this);\n this.handleControlClose = this.handleControlClose.bind(this);\n\n this.layout = layout;\n this.hydrateComponent = hydrateComponent;\n this.dehydrateComponent = dehydrateComponent;\n this.onPanelsUpdated = onPanelsUpdated;\n\n // Store the opened and closed panels\n this.openedMap = new Map(openedMap);\n\n // Closed panels are stored in their dehydrated state\n this.closed = [...closed];\n\n this.startListening();\n }\n\n startListening(): void {\n const { eventHub } = this.layout;\n eventHub.on(PanelEvent.FOCUS, this.handleFocus);\n eventHub.on(PanelEvent.MOUNT, this.handleMount);\n eventHub.on(PanelEvent.UNMOUNT, this.handleUnmount);\n eventHub.on(PanelEvent.REOPEN, this.handleReopen);\n eventHub.on(PanelEvent.DELETE, this.handleDeleted);\n eventHub.on(PanelEvent.CLOSED, this.handleClosed);\n eventHub.on(PanelEvent.CLOSE, this.handleControlClose);\n // PanelEvent.OPEN should be listened to by plugins to open a panel\n }\n\n stopListening(): void {\n const { eventHub } = this.layout;\n eventHub.off(PanelEvent.FOCUS, this.handleFocus);\n eventHub.off(PanelEvent.MOUNT, this.handleMount);\n eventHub.off(PanelEvent.UNMOUNT, this.handleUnmount);\n eventHub.off(PanelEvent.REOPEN, this.handleReopen);\n eventHub.off(PanelEvent.DELETE, this.handleDeleted);\n eventHub.off(PanelEvent.CLOSED, this.handleClosed);\n eventHub.off(PanelEvent.CLOSE, this.handleControlClose);\n }\n\n getClosedPanelConfigsOfType(typeString: string): ClosedPanels {\n return this.closed.filter(panel => panel.component === typeString);\n }\n\n getOpenedPanels(): PanelComponent[] {\n return Array.from(this.openedMap.values());\n }\n\n getOpenedPanelConfigs(): (ItemConfigType | null)[] {\n return this.getOpenedPanels().map(panel => {\n const { glContainer } = panel.props;\n return LayoutUtils.getComponentConfigFromContainer(glContainer);\n });\n }\n\n getOpenedPanelConfigsOfType(typeString: string): ReactComponentConfig[] {\n return this.getOpenedPanelConfigs().filter(\n config =>\n config != null &&\n isReactComponentConfig(config) &&\n config.component === typeString\n ) as ReactComponentConfig[];\n }\n\n getOpenedPanelById(panelId: string | string[]): PanelComponent | undefined {\n return this.openedMap.get(panelId);\n }\n\n getContainerByPanelId(panelId: string | string[]): ContentItem | null {\n const stack = LayoutUtils.getStackForConfig(this.layout.root, {\n id: panelId,\n });\n return (\n (stack && LayoutUtils.getContentItemInStack(stack, { id: panelId })) ??\n null\n );\n }\n\n getLastUsedPanel<T extends PanelComponent = PanelComponent>(\n matcher: (panel: PanelComponent) => boolean\n ): T | undefined {\n const opened = this.getOpenedPanels();\n for (let i = opened.length - 1; i >= 0; i -= 1) {\n const panel = opened[i];\n if (matcher == null || matcher(panel)) {\n return panel as T;\n }\n }\n\n return undefined;\n }\n\n getLastUsedPanelOfType<\n P extends PanelProps = PanelProps,\n C extends ComponentType<P> = ComponentType<P>\n >(type: PanelComponentType<P, C>): PanelComponent<P> | undefined {\n return this.getLastUsedPanelOfTypes([type]);\n }\n\n getLastUsedPanelOfTypes<\n P extends PanelProps = PanelProps,\n C extends ComponentType<P> = ComponentType<P>\n >(types: PanelComponentType<P, C>[]): PanelComponent<P> | undefined {\n return this.getLastUsedPanel(panel =>\n types.some(\n type =>\n (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,IAC1BC,eAAqC,uEAAG,MAAMC,SAAS;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAEvD,IAAI,CAACC,WAAW,GAAG,IAAI,CAACA,WAAW,CAACC,IAAI,CAAC,IAAI,CAAC;IAC9C,IAAI,CAACC,WAAW,GAAG,IAAI,CAACA,WAAW,CAACD,IAAI,CAAC,IAAI,CAAC;IAC9C;IACA;IACA;IACA,IAAI,CAACE,aAAa,GAAG,I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,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelPlaceholder.d.ts","sourceRoot":"","sources":["../src/PanelPlaceholder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;GAEG;AACH,QAAA,MAAM,gBAAgB,mFASrB,CAAC;
|
|
1
|
+
{"version":3,"file":"PanelPlaceholder.d.ts","sourceRoot":"","sources":["../src/PanelPlaceholder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;GAEG;AACH,QAAA,MAAM,gBAAgB,mFASrB,CAAC;AAIF,eAAe,gBAAgB,CAAC"}
|
package/dist/PanelPlaceholder.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import "./PanelPlaceholder.css";
|
|
3
3
|
import LayoutUtils from "./layout/LayoutUtils.js";
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Displays a placeholder for unregistered panel types.
|
|
7
6
|
*/
|
|
@@ -14,5 +13,6 @@ var PanelPlaceholder = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
14
13
|
className: "panel-placeholder"
|
|
15
14
|
}, "Component \"", component, "\" is not registered.");
|
|
16
15
|
});
|
|
16
|
+
PanelPlaceholder.displayName = 'PanelPlaceholder';
|
|
17
17
|
export default PanelPlaceholder;
|
|
18
18
|
//# sourceMappingURL=PanelPlaceholder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelPlaceholder.js","names":["React","LayoutUtils","PanelPlaceholder","forwardRef","props","ref","component","getComponentNameFromPanel"],"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 "{component}" is not registered.\n </div>\n );\n }\n);\n\nexport default PanelPlaceholder;\n"],"mappings":"AAAA,OAAOA,
|
|
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 "{component}" 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,mBACzBC,SAAS,0BACtB;AAEV,CAAC,CACF;AAEDJ,gBAAgB,CAACM,WAAW,GAAG,kBAAkB;AAEjD,eAAeN,gBAAgB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Dashboard from './Dashboard';
|
|
2
|
+
export default Dashboard;
|
|
1
3
|
export * from './Dashboard';
|
|
2
4
|
export * from './DashboardConstants';
|
|
3
5
|
export * from './DashboardPlugin';
|
|
@@ -10,5 +12,4 @@ export * from './PanelManager';
|
|
|
10
12
|
export { default as PanelEvent } from './PanelEvent';
|
|
11
13
|
export { default as PanelErrorBoundary } from './PanelErrorBoundary';
|
|
12
14
|
export { default as PanelManager } from './PanelManager';
|
|
13
|
-
export { default } from './Dashboard';
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,eAAe,SAAS,CAAC;AAEzB,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Dashboard from "./Dashboard.js";
|
|
2
|
+
export default Dashboard;
|
|
1
3
|
export * from "./Dashboard.js";
|
|
2
4
|
export * from "./DashboardConstants.js";
|
|
3
5
|
export * from "./DashboardPlugin.js";
|
|
@@ -10,5 +12,4 @@ export * from "./PanelManager.js";
|
|
|
10
12
|
export { default as PanelEvent } from "./PanelEvent.js";
|
|
11
13
|
export { default as PanelErrorBoundary } from "./PanelErrorBoundary.js";
|
|
12
14
|
export { default as PanelManager } from "./PanelManager.js";
|
|
13
|
-
export { default } from "./Dashboard.js";
|
|
14
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","DashboardUtils","PanelEvent","PanelErrorBoundary","PanelManager"],"sources":["../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["Dashboard","default","DashboardUtils","PanelEvent","PanelErrorBoundary","PanelManager"],"sources":["../src/index.ts"],"sourcesContent":["import Dashboard from './Dashboard';\n\nexport default Dashboard;\n\nexport * from './Dashboard';\nexport * from './DashboardConstants';\nexport * from './DashboardPlugin';\nexport * from './DashboardLayout';\nexport * from './DashboardUtils';\nexport { default as DashboardUtils } from './DashboardUtils';\nexport * from './layout';\nexport * from './redux';\nexport * from './PanelManager';\nexport { default as PanelEvent } from './PanelEvent';\nexport { default as PanelErrorBoundary } from './PanelErrorBoundary';\nexport { default as PanelManager } from './PanelManager';\n"],"mappings":"OAAOA,SAAS;AAEhB,eAAeA,SAAS;AAAC;AAAA;AAAA;AAAA;AAAA;AAAA,SAOhBC,OAAO,IAAIC,cAAc;AAAA;AAAA;AAAA;AAAA,SAIzBD,OAAO,IAAIE,UAAU;AAAA,SACrBF,OAAO,IAAIG,kBAAkB;AAAA,SAC7BH,OAAO,IAAII,YAAY"}
|
|
@@ -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,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoldenLayoutThemeExport.js","names":["GoldenLayout","Object","freeze","tabHeight","parseInt","dragBorderWidth"],"sources":["../../src/layout/GoldenLayoutThemeExport.ts"],"sourcesContent":["import GoldenLayout from './GoldenLayout.module.scss';\n\n// parseInt for unitless values, stripping \"px\"\nexport default Object.freeze({\n tabHeight: parseInt(GoldenLayout['tab-height'], 10),\n dragBorderWidth: parseInt(GoldenLayout['drag-border-width'], 10),\n});\n"],"mappings":"OAAOA,
|
|
1
|
+
{"version":3,"file":"GoldenLayoutThemeExport.js","names":["GoldenLayout","Object","freeze","tabHeight","parseInt","dragBorderWidth"],"sources":["../../src/layout/GoldenLayoutThemeExport.ts"],"sourcesContent":["import GoldenLayout from './GoldenLayout.module.scss';\n\n// parseInt for unitless values, stripping \"px\"\nexport default Object.freeze({\n tabHeight: parseInt(GoldenLayout['tab-height'], 10),\n dragBorderWidth: parseInt(GoldenLayout['drag-border-width'], 10),\n});\n"],"mappings":"OAAOA,YAAY,mCAEnB;AACA,eAAeC,MAAM,CAACC,MAAM,CAAC;EAC3BC,SAAS,EAAEC,QAAQ,CAACJ,YAAY,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC;EACnDK,eAAe,EAAED,QAAQ,CAACJ,YAAY,CAAC,mBAAmB,CAAC,EAAE,EAAE;AACjE,CAAC,CAAC"}
|