@deephaven/dashboard-core-plugins 0.22.3-embed-pandas.11 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChartBuilderPlugin.d.ts +2 -2
- package/dist/ChartBuilderPlugin.d.ts.map +1 -1
- package/dist/ChartBuilderPlugin.js +6 -8
- package/dist/ChartBuilderPlugin.js.map +1 -1
- package/dist/ChartPlugin.d.ts +2 -2
- package/dist/ChartPlugin.d.ts.map +1 -1
- package/dist/ChartPlugin.js +4 -8
- package/dist/ChartPlugin.js.map +1 -1
- package/dist/ConsolePlugin.d.ts +2 -2
- package/dist/ConsolePlugin.d.ts.map +1 -1
- package/dist/ConsolePlugin.js +16 -62
- package/dist/ConsolePlugin.js.map +1 -1
- package/dist/FilterPlugin.d.ts +4 -4
- package/dist/FilterPlugin.d.ts.map +1 -1
- package/dist/FilterPlugin.js +6 -13
- package/dist/FilterPlugin.js.map +1 -1
- package/dist/GridPlugin.d.ts +2 -2
- package/dist/GridPlugin.d.ts.map +1 -1
- package/dist/GridPlugin.js +4 -8
- package/dist/GridPlugin.js.map +1 -1
- package/dist/LinkerPlugin.d.ts +2 -2
- package/dist/LinkerPlugin.d.ts.map +1 -1
- package/dist/LinkerPlugin.js +2 -2
- package/dist/LinkerPlugin.js.map +1 -1
- package/dist/MarkdownPlugin.d.ts +3 -3
- package/dist/MarkdownPlugin.d.ts.map +1 -1
- package/dist/MarkdownPlugin.js +4 -8
- package/dist/MarkdownPlugin.js.map +1 -1
- package/dist/PandasPlugin.d.ts +2 -2
- package/dist/PandasPlugin.d.ts.map +1 -1
- package/dist/PandasPlugin.js +4 -8
- package/dist/PandasPlugin.js.map +1 -1
- package/dist/controls/ControlType.js +0 -6
- package/dist/controls/ControlType.js.map +1 -1
- package/dist/controls/dropdown-filter/DropdownFilter.d.ts +2 -2
- package/dist/controls/dropdown-filter/DropdownFilter.d.ts.map +1 -1
- package/dist/controls/dropdown-filter/DropdownFilter.js +7 -51
- package/dist/controls/dropdown-filter/DropdownFilter.js.map +1 -1
- package/dist/controls/input-filter/InputFilter.d.ts +2 -2
- package/dist/controls/input-filter/InputFilter.d.ts.map +1 -1
- package/dist/controls/input-filter/InputFilter.js +1 -31
- package/dist/controls/input-filter/InputFilter.js.map +1 -1
- package/dist/controls/markdown/MarkdownContainer.js +0 -3
- package/dist/controls/markdown/MarkdownContainer.js.map +1 -1
- package/dist/controls/markdown/MarkdownEditor.d.ts +0 -2
- package/dist/controls/markdown/MarkdownEditor.d.ts.map +1 -1
- package/dist/controls/markdown/MarkdownEditor.js +13 -20
- package/dist/controls/markdown/MarkdownEditor.js.map +1 -1
- package/dist/controls/markdown/MarkdownStartPage.js +0 -11
- package/dist/controls/markdown/MarkdownStartPage.js.map +1 -1
- package/dist/controls/markdown/MarkdownUtils.js +0 -7
- package/dist/controls/markdown/MarkdownUtils.js.map +1 -1
- package/dist/events/ChartEvent.js +0 -5
- package/dist/events/ChartEvent.js.map +1 -1
- package/dist/events/ConsoleEvent.js +0 -7
- package/dist/events/ConsoleEvent.js.map +1 -1
- package/dist/events/InputFilterEvent.js +0 -10
- package/dist/events/InputFilterEvent.js.map +1 -1
- package/dist/events/IrisGridEvent.js +0 -8
- package/dist/events/IrisGridEvent.js.map +1 -1
- package/dist/events/MarkdownEvent.d.ts +1 -1
- package/dist/events/MarkdownEvent.js.map +1 -1
- package/dist/events/NotebookEvent.js +0 -10
- package/dist/events/NotebookEvent.js.map +1 -1
- package/dist/events/PQEvent.js +0 -5
- package/dist/events/PQEvent.js.map +1 -1
- package/dist/events/PandasEvent.js +0 -4
- package/dist/events/PandasEvent.js.map +1 -1
- package/dist/events/TabEvent.js +0 -8
- package/dist/events/TabEvent.js.map +1 -1
- package/dist/events/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/linker/ColumnSelectionValidator.d.ts +1 -1
- package/dist/linker/ColumnSelectionValidator.d.ts.map +1 -1
- package/dist/linker/Linker.d.ts +5 -2
- package/dist/linker/Linker.d.ts.map +1 -1
- package/dist/linker/Linker.js +70 -119
- package/dist/linker/Linker.js.map +1 -1
- package/dist/linker/LinkerLink.css +90 -25
- package/dist/linker/LinkerLink.css.map +1 -1
- package/dist/linker/LinkerLink.d.ts +21 -3
- package/dist/linker/LinkerLink.d.ts.map +1 -1
- package/dist/linker/LinkerLink.js +214 -23
- package/dist/linker/LinkerLink.js.map +1 -1
- package/dist/linker/LinkerOverlayContent.css +0 -4
- package/dist/linker/LinkerOverlayContent.css.map +1 -1
- package/dist/linker/LinkerOverlayContent.d.ts +14 -3
- package/dist/linker/LinkerOverlayContent.d.ts.map +1 -1
- package/dist/linker/LinkerOverlayContent.js +78 -33
- package/dist/linker/LinkerOverlayContent.js.map +1 -1
- package/dist/linker/LinkerUtils.d.ts +17 -10
- package/dist/linker/LinkerUtils.d.ts.map +1 -1
- package/dist/linker/LinkerUtils.js +9 -25
- package/dist/linker/LinkerUtils.js.map +1 -1
- package/dist/linker/ToolType.d.ts +2 -2
- package/dist/linker/ToolType.js.map +1 -1
- package/dist/panels/ChartColumnSelectorOverlay.d.ts +5 -5
- package/dist/panels/ChartColumnSelectorOverlay.d.ts.map +1 -1
- package/dist/panels/ChartColumnSelectorOverlay.js +4 -7
- package/dist/panels/ChartColumnSelectorOverlay.js.map +1 -1
- package/dist/panels/ChartFilterOverlay.d.ts +5 -5
- package/dist/panels/ChartFilterOverlay.d.ts.map +1 -1
- package/dist/panels/ChartFilterOverlay.js +2 -7
- package/dist/panels/ChartFilterOverlay.js.map +1 -1
- package/dist/panels/ChartPanel.d.ts +8 -8
- package/dist/panels/ChartPanel.d.ts.map +1 -1
- package/dist/panels/ChartPanel.js +11 -150
- package/dist/panels/ChartPanel.js.map +1 -1
- package/dist/panels/CommandHistoryPanel.d.ts.map +1 -1
- package/dist/panels/CommandHistoryPanel.js +1 -26
- package/dist/panels/CommandHistoryPanel.js.map +1 -1
- package/dist/panels/ConsolePanel.d.ts +1 -1
- package/dist/panels/ConsolePanel.d.ts.map +1 -1
- package/dist/panels/ConsolePanel.js +12 -57
- package/dist/panels/ConsolePanel.js.map +1 -1
- package/dist/panels/DropdownFilterPanel.d.ts +9 -9
- package/dist/panels/DropdownFilterPanel.d.ts.map +1 -1
- package/dist/panels/DropdownFilterPanel.js +21 -127
- package/dist/panels/DropdownFilterPanel.js.map +1 -1
- package/dist/panels/FileExplorerPanel.d.ts +4 -4
- package/dist/panels/FileExplorerPanel.d.ts.map +1 -1
- package/dist/panels/FileExplorerPanel.js +4 -33
- package/dist/panels/FileExplorerPanel.js.map +1 -1
- package/dist/panels/FilterSetManager.d.ts +1 -1
- package/dist/panels/FilterSetManager.d.ts.map +1 -1
- package/dist/panels/FilterSetManager.js +13 -86
- package/dist/panels/FilterSetManager.js.map +1 -1
- package/dist/panels/FilterSetManagerPanel.js +10 -64
- package/dist/panels/FilterSetManagerPanel.js.map +1 -1
- package/dist/panels/InputFilterPanel.d.ts.map +1 -1
- package/dist/panels/InputFilterPanel.js +8 -38
- package/dist/panels/InputFilterPanel.js.map +1 -1
- package/dist/panels/IrisGridPanel.d.ts +13 -13
- package/dist/panels/IrisGridPanel.d.ts.map +1 -1
- package/dist/panels/IrisGridPanel.js +24 -133
- package/dist/panels/IrisGridPanel.js.map +1 -1
- package/dist/panels/IrisGridPanelTooltip.d.ts +7 -7
- package/dist/panels/IrisGridPanelTooltip.d.ts.map +1 -1
- package/dist/panels/IrisGridPanelTooltip.js +2 -5
- package/dist/panels/IrisGridPanelTooltip.js.map +1 -1
- package/dist/panels/LogPanel.js +4 -22
- package/dist/panels/LogPanel.js.map +1 -1
- package/dist/panels/MarkdownNotebook.js +3 -30
- package/dist/panels/MarkdownNotebook.js.map +1 -1
- package/dist/panels/MarkdownPanel.js +2 -30
- package/dist/panels/MarkdownPanel.js.map +1 -1
- package/dist/panels/MockFileStorage.js +1 -14
- package/dist/panels/MockFileStorage.js.map +1 -1
- package/dist/panels/MockFileStorageTable.js +11 -30
- package/dist/panels/MockFileStorageTable.js.map +1 -1
- package/dist/panels/NotebookPanel.js +24 -182
- package/dist/panels/NotebookPanel.js.map +1 -1
- package/dist/panels/PandasPanel.js +1 -20
- package/dist/panels/PandasPanel.js.map +1 -1
- package/dist/panels/Panel.d.ts +1 -1
- package/dist/panels/Panel.d.ts.map +1 -1
- package/dist/panels/Panel.js +2 -38
- package/dist/panels/Panel.js.map +1 -1
- package/dist/panels/PanelContextMenu.js +7 -29
- package/dist/panels/PanelContextMenu.js.map +1 -1
- package/dist/panels/RenameDialog.js +2 -17
- package/dist/panels/RenameDialog.js.map +1 -1
- package/dist/panels/WidgetPanel.d.ts.map +1 -1
- package/dist/panels/WidgetPanel.js +5 -22
- package/dist/panels/WidgetPanel.js.map +1 -1
- package/dist/panels/WidgetPanelTooltip.d.ts +7 -7
- package/dist/panels/WidgetPanelTooltip.d.ts.map +1 -1
- package/dist/panels/WidgetPanelTooltip.js +7 -17
- package/dist/panels/WidgetPanelTooltip.js.map +1 -1
- package/dist/panels/index.js.map +1 -1
- package/dist/prop-types/CommonPropTypes.js +0 -3
- package/dist/prop-types/CommonPropTypes.js.map +1 -1
- package/dist/prop-types/UIPropTypes.d.ts +2 -2
- package/dist/prop-types/UIPropTypes.js.map +1 -1
- package/dist/prop-types/index.js.map +1 -1
- package/dist/redux/actionTypes.js.map +1 -1
- package/dist/redux/actions.js +8 -9
- package/dist/redux/actions.js.map +1 -1
- package/dist/redux/index.js.map +1 -1
- package/dist/redux/reducers/connection.js.map +1 -1
- package/dist/redux/reducers/index.js.map +1 -1
- package/dist/redux/reducers/sessionWrapper.js.map +1 -1
- package/dist/redux/selectors.js +10 -15
- package/dist/redux/selectors.js.map +1 -1
- package/package.json +21 -19
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DashboardPluginComponentProps } from '@deephaven/dashboard';
|
|
3
|
-
export
|
|
3
|
+
export type ChartBuilderPluginProps = Partial<DashboardPluginComponentProps>;
|
|
4
4
|
/**
|
|
5
5
|
* Listens for IrisGridEvent.CREATE_CHART and creates a chart from the settings provided
|
|
6
6
|
* Requires the GridPlugin and ChartPlugin plugins to be loaded as well
|
|
7
7
|
*/
|
|
8
|
-
export declare
|
|
8
|
+
export declare function ChartBuilderPlugin(props: ChartBuilderPluginProps): JSX.Element | null;
|
|
9
9
|
export default ChartBuilderPlugin;
|
|
10
10
|
//# sourceMappingURL=ChartBuilderPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartBuilderPlugin.d.ts","sourceRoot":"","sources":["../src/ChartBuilderPlugin.tsx"],"names":[],"mappings":";AAEA,OAAO,EAEL,6BAA6B,EAG9B,MAAM,sBAAsB,CAAC;AAM9B,
|
|
1
|
+
{"version":3,"file":"ChartBuilderPlugin.d.ts","sourceRoot":"","sources":["../src/ChartBuilderPlugin.tsx"],"names":[],"mappings":";AAEA,OAAO,EAEL,6BAA6B,EAG9B,MAAM,sBAAsB,CAAC;AAM9B,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAE7E;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,GAC7B,GAAG,CAAC,OAAO,GAAG,IAAI,CAoDpB;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
2
|
import { ChartModelFactory, ChartUtils } from '@deephaven/chart';
|
|
3
3
|
import { assertIsDashboardPluginProps, LayoutUtils, useListener } from '@deephaven/dashboard';
|
|
4
4
|
import shortid from 'shortid';
|
|
5
5
|
import { IrisGridEvent } from "./events/index.js";
|
|
6
6
|
import { ChartPanel } from "./panels/index.js";
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Listens for IrisGridEvent.CREATE_CHART and creates a chart from the settings provided
|
|
10
9
|
* Requires the GridPlugin and ChartPlugin plugins to be loaded as well
|
|
11
10
|
*/
|
|
12
|
-
export
|
|
11
|
+
export function ChartBuilderPlugin(props) {
|
|
13
12
|
assertIsDashboardPluginProps(props);
|
|
14
13
|
var {
|
|
15
14
|
id,
|
|
@@ -24,10 +23,9 @@ export var ChartBuilderPlugin = props => {
|
|
|
24
23
|
var {
|
|
25
24
|
settings
|
|
26
25
|
} = metadata;
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
var makeModel = () =>
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
28
|
ChartModelFactory.makeModelFromSettings(settings, table);
|
|
30
|
-
|
|
31
29
|
var title = ChartUtils.titleFromSettings(settings);
|
|
32
30
|
var config = {
|
|
33
31
|
type: 'react-component',
|
|
@@ -50,7 +48,7 @@ export var ChartBuilderPlugin = props => {
|
|
|
50
48
|
});
|
|
51
49
|
}, [id, layout]);
|
|
52
50
|
useListener(layout.eventHub, IrisGridEvent.CREATE_CHART, handleCreateChart);
|
|
53
|
-
return
|
|
54
|
-
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
55
53
|
export default ChartBuilderPlugin;
|
|
56
54
|
//# sourceMappingURL=ChartBuilderPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartBuilderPlugin.js","names":["
|
|
1
|
+
{"version":3,"file":"ChartBuilderPlugin.js","names":["useCallback","ChartModelFactory","ChartUtils","assertIsDashboardPluginProps","LayoutUtils","useListener","shortid","IrisGridEvent","ChartPanel","ChartBuilderPlugin","props","id","layout","handleCreateChart","metadata","panelId","generate","table","settings","makeModel","makeModelFromSettings","title","titleFromSettings","config","type","component","COMPONENT","localDashboardId","root","openComponent","eventHub","CREATE_CHART"],"sources":["../src/ChartBuilderPlugin.tsx"],"sourcesContent":["import { useCallback } from 'react';\nimport { ChartModelFactory, ChartUtils } from '@deephaven/chart';\nimport {\n assertIsDashboardPluginProps,\n DashboardPluginComponentProps,\n LayoutUtils,\n useListener,\n} from '@deephaven/dashboard';\nimport { SeriesPlotStyle, Table } from '@deephaven/jsapi-shim';\nimport shortid from 'shortid';\nimport { IrisGridEvent } from './events';\nimport { ChartPanel } from './panels';\n\nexport type ChartBuilderPluginProps = Partial<DashboardPluginComponentProps>;\n\n/**\n * Listens for IrisGridEvent.CREATE_CHART and creates a chart from the settings provided\n * Requires the GridPlugin and ChartPlugin plugins to be loaded as well\n */\nexport function ChartBuilderPlugin(\n props: ChartBuilderPluginProps\n): JSX.Element | null {\n assertIsDashboardPluginProps(props);\n const { id, layout } = props;\n const handleCreateChart = useCallback(\n ({\n metadata,\n panelId = shortid.generate(),\n table,\n }: {\n metadata: {\n settings: {\n type: keyof SeriesPlotStyle;\n series: string[];\n xAxis: string;\n isLinked: boolean;\n hiddenSeries?: string[];\n };\n sourcePanelId: string;\n table: string;\n tableSettings: Record<string, unknown>;\n };\n panelId?: string;\n table: Table;\n }) => {\n const { settings } = metadata;\n const makeModel = () =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ChartModelFactory.makeModelFromSettings(settings as any, table);\n const title = ChartUtils.titleFromSettings(settings);\n\n const config = {\n type: 'react-component' as const,\n component: ChartPanel.COMPONENT,\n props: {\n localDashboardId: id,\n id: panelId,\n metadata,\n makeModel,\n },\n title,\n id: panelId,\n };\n\n const { root } = layout;\n LayoutUtils.openComponent({ root, config });\n },\n [id, layout]\n );\n\n useListener(layout.eventHub, IrisGridEvent.CREATE_CHART, handleCreateChart);\n\n return null;\n}\n\nexport default ChartBuilderPlugin;\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,OAAO;AACnC,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,kBAAkB;AAChE,SACEC,4BAA4B,EAE5BC,WAAW,EACXC,WAAW,QACN,sBAAsB;AAE7B,OAAOC,OAAO,MAAM,SAAS;AAAC,SACrBC,aAAa;AAAA,SACbC,UAAU;AAInB;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkB,CAChCC,KAA8B,EACV;EACpBP,4BAA4B,CAACO,KAAK,CAAC;EACnC,IAAM;IAAEC,EAAE;IAAEC;EAAO,CAAC,GAAGF,KAAK;EAC5B,IAAMG,iBAAiB,GAAGb,WAAW,CACnC,QAmBM;IAAA,IAnBL;MACCc,QAAQ;MACRC,OAAO,GAAGT,OAAO,CAACU,QAAQ,EAAE;MAC5BC;IAgBF,CAAC;IACC,IAAM;MAAEC;IAAS,CAAC,GAAGJ,QAAQ;IAC7B,IAAMK,SAAS,GAAG;IAChB;IACAlB,iBAAiB,CAACmB,qBAAqB,CAACF,QAAQ,EAASD,KAAK,CAAC;IACjE,IAAMI,KAAK,GAAGnB,UAAU,CAACoB,iBAAiB,CAACJ,QAAQ,CAAC;IAEpD,IAAMK,MAAM,GAAG;MACbC,IAAI,EAAE,iBAA0B;MAChCC,SAAS,EAAEjB,UAAU,CAACkB,SAAS;MAC/BhB,KAAK,EAAE;QACLiB,gBAAgB,EAAEhB,EAAE;QACpBA,EAAE,EAAEI,OAAO;QACXD,QAAQ;QACRK;MACF,CAAC;MACDE,KAAK;MACLV,EAAE,EAAEI;IACN,CAAC;IAED,IAAM;MAAEa;IAAK,CAAC,GAAGhB,MAAM;IACvBR,WAAW,CAACyB,aAAa,CAAC;MAAED,IAAI;MAAEL;IAAO,CAAC,CAAC;EAC7C,CAAC,EACD,CAACZ,EAAE,EAAEC,MAAM,CAAC,CACb;EAEDP,WAAW,CAACO,MAAM,CAACkB,QAAQ,EAAEvB,aAAa,CAACwB,YAAY,EAAElB,iBAAiB,CAAC;EAE3E,OAAO,IAAI;AACb;AAEA,eAAeJ,kBAAkB"}
|
package/dist/ChartPlugin.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DashboardPluginComponentProps, PanelHydrateFunction } from '@deephaven/dashboard';
|
|
3
3
|
import { ChartPanelProps } from './panels';
|
|
4
|
-
export
|
|
4
|
+
export type ChartPluginProps = Partial<DashboardPluginComponentProps> & {
|
|
5
5
|
hydrate: PanelHydrateFunction<ChartPanelProps>;
|
|
6
6
|
};
|
|
7
|
-
export declare
|
|
7
|
+
export declare function ChartPlugin(props: ChartPluginProps): JSX.Element | null;
|
|
8
8
|
export default ChartPlugin;
|
|
9
9
|
//# sourceMappingURL=ChartPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartPlugin.d.ts","sourceRoot":"","sources":["../src/ChartPlugin.tsx"],"names":[],"mappings":";AAEA,OAAO,EAEL,6BAA6B,EAG7B,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAc,eAAe,EAAE,MAAM,UAAU,CAAC;AAEvD,
|
|
1
|
+
{"version":3,"file":"ChartPlugin.d.ts","sourceRoot":"","sources":["../src/ChartPlugin.tsx"],"names":[],"mappings":";AAEA,OAAO,EAEL,6BAA6B,EAG7B,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAc,eAAe,EAAE,MAAM,UAAU,CAAC;AAEvD,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,6BAA6B,CAAC,GAAG;IACtE,OAAO,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAC;CAChD,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CA+DvE;AAED,eAAe,WAAW,CAAC"}
|
package/dist/ChartPlugin.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useCallback, useEffect } from 'react';
|
|
2
2
|
import { ChartModelFactory } from '@deephaven/chart';
|
|
3
3
|
import { assertIsDashboardPluginProps, LayoutUtils, PanelEvent, useListener } from '@deephaven/dashboard';
|
|
4
4
|
import shortid from 'shortid';
|
|
5
5
|
import { ChartPanel } from "./panels/index.js";
|
|
6
|
-
export
|
|
6
|
+
export function ChartPlugin(props) {
|
|
7
7
|
assertIsDashboardPluginProps(props);
|
|
8
8
|
var {
|
|
9
9
|
id,
|
|
@@ -22,18 +22,14 @@ export var ChartPlugin = props => {
|
|
|
22
22
|
name,
|
|
23
23
|
type
|
|
24
24
|
} = widget;
|
|
25
|
-
|
|
26
25
|
if (type !== dh.VariableType.FIGURE) {
|
|
27
26
|
return;
|
|
28
27
|
}
|
|
29
|
-
|
|
30
28
|
var metadata = {
|
|
31
29
|
name,
|
|
32
30
|
figure: name
|
|
33
31
|
};
|
|
34
|
-
|
|
35
32
|
var makeModel = () => fetch().then(figure => ChartModelFactory.makeModel(undefined, figure));
|
|
36
|
-
|
|
37
33
|
var config = {
|
|
38
34
|
type: 'react-component',
|
|
39
35
|
component: ChartPanel.COMPONENT,
|
|
@@ -62,7 +58,7 @@ export var ChartPlugin = props => {
|
|
|
62
58
|
};
|
|
63
59
|
}, [hydrate, registerComponent]);
|
|
64
60
|
useListener(layout.eventHub, PanelEvent.OPEN, handlePanelOpen);
|
|
65
|
-
return
|
|
66
|
-
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
67
63
|
export default ChartPlugin;
|
|
68
64
|
//# sourceMappingURL=ChartPlugin.js.map
|
package/dist/ChartPlugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartPlugin.js","names":["
|
|
1
|
+
{"version":3,"file":"ChartPlugin.js","names":["useCallback","useEffect","ChartModelFactory","assertIsDashboardPluginProps","LayoutUtils","PanelEvent","useListener","shortid","ChartPanel","ChartPlugin","props","id","layout","registerComponent","hydrate","handlePanelOpen","dragEvent","fetch","panelId","generate","widget","name","type","dh","VariableType","FIGURE","metadata","figure","makeModel","then","undefined","config","component","COMPONENT","localDashboardId","title","root","openComponent","registerComponentsAndReturnCleanup","cleanups","forEach","cleanup","eventHub","OPEN"],"sources":["../src/ChartPlugin.tsx"],"sourcesContent":["import { useCallback, useEffect, DragEvent } from 'react';\nimport { ChartModelFactory } from '@deephaven/chart';\nimport {\n assertIsDashboardPluginProps,\n DashboardPluginComponentProps,\n LayoutUtils,\n PanelEvent,\n PanelHydrateFunction,\n useListener,\n} from '@deephaven/dashboard';\nimport { Figure, VariableDefinition } from '@deephaven/jsapi-shim';\nimport shortid from 'shortid';\nimport { ChartPanel, ChartPanelProps } from './panels';\n\nexport type ChartPluginProps = Partial<DashboardPluginComponentProps> & {\n hydrate: PanelHydrateFunction<ChartPanelProps>;\n};\n\nexport function ChartPlugin(props: ChartPluginProps): JSX.Element | null {\n assertIsDashboardPluginProps(props);\n const { id, layout, registerComponent, hydrate } = props;\n const handlePanelOpen = useCallback(\n ({\n dragEvent,\n fetch,\n panelId = shortid.generate(),\n widget,\n }: {\n dragEvent?: DragEvent;\n fetch: () => Promise<Figure>;\n panelId?: string;\n widget: VariableDefinition;\n }) => {\n const { name, type } = widget;\n if (type !== dh.VariableType.FIGURE) {\n return;\n }\n\n const metadata = { name, figure: name };\n const makeModel = () =>\n fetch().then((figure: Figure) =>\n ChartModelFactory.makeModel(undefined, figure)\n );\n const config = {\n type: 'react-component' as const,\n component: ChartPanel.COMPONENT,\n props: {\n localDashboardId: id,\n id: panelId,\n metadata,\n makeModel,\n },\n title: name,\n id: panelId,\n };\n\n const { root } = layout;\n LayoutUtils.openComponent({ root, config, dragEvent });\n },\n [id, layout]\n );\n\n useEffect(\n function registerComponentsAndReturnCleanup() {\n const cleanups = [\n registerComponent(\n ChartPanel.COMPONENT,\n ChartPanel,\n hydrate as PanelHydrateFunction\n ),\n ];\n return () => {\n cleanups.forEach(cleanup => cleanup());\n };\n },\n [hydrate, registerComponent]\n );\n\n useListener(layout.eventHub, PanelEvent.OPEN, handlePanelOpen);\n\n return null;\n}\n\nexport default ChartPlugin;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,SAAS,QAAmB,OAAO;AACzD,SAASC,iBAAiB,QAAQ,kBAAkB;AACpD,SACEC,4BAA4B,EAE5BC,WAAW,EACXC,UAAU,EAEVC,WAAW,QACN,sBAAsB;AAE7B,OAAOC,OAAO,MAAM,SAAS;AAAC,SACrBC,UAAU;AAMnB,OAAO,SAASC,WAAW,CAACC,KAAuB,EAAsB;EACvEP,4BAA4B,CAACO,KAAK,CAAC;EACnC,IAAM;IAAEC,EAAE;IAAEC,MAAM;IAAEC,iBAAiB;IAAEC;EAAQ,CAAC,GAAGJ,KAAK;EACxD,IAAMK,eAAe,GAAGf,WAAW,CACjC,QAUM;IAAA,IAVL;MACCgB,SAAS;MACTC,KAAK;MACLC,OAAO,GAAGX,OAAO,CAACY,QAAQ,EAAE;MAC5BC;IAMF,CAAC;IACC,IAAM;MAAEC,IAAI;MAAEC;IAAK,CAAC,GAAGF,MAAM;IAC7B,IAAIE,IAAI,KAAKC,EAAE,CAACC,YAAY,CAACC,MAAM,EAAE;MACnC;IACF;IAEA,IAAMC,QAAQ,GAAG;MAAEL,IAAI;MAAEM,MAAM,EAAEN;IAAK,CAAC;IACvC,IAAMO,SAAS,GAAG,MAChBX,KAAK,EAAE,CAACY,IAAI,CAAEF,MAAc,IAC1BzB,iBAAiB,CAAC0B,SAAS,CAACE,SAAS,EAAEH,MAAM,CAAC,CAC/C;IACH,IAAMI,MAAM,GAAG;MACbT,IAAI,EAAE,iBAA0B;MAChCU,SAAS,EAAExB,UAAU,CAACyB,SAAS;MAC/BvB,KAAK,EAAE;QACLwB,gBAAgB,EAAEvB,EAAE;QACpBA,EAAE,EAAEO,OAAO;QACXQ,QAAQ;QACRE;MACF,CAAC;MACDO,KAAK,EAAEd,IAAI;MACXV,EAAE,EAAEO;IACN,CAAC;IAED,IAAM;MAAEkB;IAAK,CAAC,GAAGxB,MAAM;IACvBR,WAAW,CAACiC,aAAa,CAAC;MAAED,IAAI;MAAEL,MAAM;MAAEf;IAAU,CAAC,CAAC;EACxD,CAAC,EACD,CAACL,EAAE,EAAEC,MAAM,CAAC,CACb;EAEDX,SAAS,CACP,SAASqC,kCAAkC,GAAG;IAC5C,IAAMC,QAAQ,GAAG,CACf1B,iBAAiB,CACfL,UAAU,CAACyB,SAAS,EACpBzB,UAAU,EACVM,OAAO,CACR,CACF;IACD,OAAO,MAAM;MACXyB,QAAQ,CAACC,OAAO,CAACC,OAAO,IAAIA,OAAO,EAAE,CAAC;IACxC,CAAC;EACH,CAAC,EACD,CAAC3B,OAAO,EAAED,iBAAiB,CAAC,CAC7B;EAEDP,WAAW,CAACM,MAAM,CAAC8B,QAAQ,EAAErC,UAAU,CAACsC,IAAI,EAAE5B,eAAe,CAAC;EAE9D,OAAO,IAAI;AACb;AAEA,eAAeN,WAAW"}
|
package/dist/ConsolePlugin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DashboardPluginComponentProps, PanelHydrateFunction } from '@deephaven/dashboard';
|
|
3
|
-
export
|
|
3
|
+
export type ConsolePluginProps = DashboardPluginComponentProps & {
|
|
4
4
|
hydrateConsole?: PanelHydrateFunction;
|
|
5
5
|
notebooksUrl: string;
|
|
6
6
|
};
|
|
@@ -9,6 +9,6 @@ export interface FileMetadata {
|
|
|
9
9
|
id: string | null;
|
|
10
10
|
itemName: string;
|
|
11
11
|
}
|
|
12
|
-
export declare
|
|
12
|
+
export declare function ConsolePlugin(props: Partial<ConsolePluginProps>): JSX.Element | null;
|
|
13
13
|
export default ConsolePlugin;
|
|
14
14
|
//# sourceMappingURL=ConsolePlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConsolePlugin.d.ts","sourceRoot":"","sources":["../src/ConsolePlugin.tsx"],"names":[],"mappings":";AACA,OAAO,EAGL,6BAA6B,EAI7B,oBAAoB,EAGrB,MAAM,sBAAsB,CAAC;AA6B9B,
|
|
1
|
+
{"version":3,"file":"ConsolePlugin.d.ts","sourceRoot":"","sources":["../src/ConsolePlugin.tsx"],"names":[],"mappings":";AACA,OAAO,EAGL,6BAA6B,EAI7B,oBAAoB,EAGrB,MAAM,sBAAsB,CAAC;AA6B9B,MAAM,MAAM,kBAAkB,GAAG,6BAA6B,GAAG;IAC/D,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,CAAC,kBAAkB,CAAC,GACjC,OAAO,CAAC,KAAK,IAAI,kBAAkB,CAErC;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,CAAC,kBAAkB,CAAC,GACjC,GAAG,CAAC,OAAO,GAAG,IAAI,CAqdpB;AAED,eAAe,aAAa,CAAC"}
|
package/dist/ConsolePlugin.js
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
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 { assertIsDashboardPluginProps, DashboardUtils, LayoutUtils, useListener } from '@deephaven/dashboard';
|
|
8
5
|
import { FileUtils } from '@deephaven/file-explorer';
|
|
9
6
|
import Log from '@deephaven/log';
|
|
10
|
-
import
|
|
7
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
11
8
|
import { useDispatch } from 'react-redux';
|
|
12
9
|
import shortid from 'shortid';
|
|
13
10
|
import { ConsoleEvent, NotebookEvent } from "./events/index.js";
|
|
14
11
|
import { ConsolePanel, CommandHistoryPanel, FileExplorerPanel, LogPanel, NotebookPanel } from "./panels/index.js";
|
|
15
12
|
import { setDashboardConsoleSettings } from "./redux/index.js";
|
|
16
13
|
var log = Log.module('ConsolePlugin');
|
|
17
|
-
|
|
18
14
|
function isNotebookPanel(panel) {
|
|
19
15
|
return panel.notebook !== undefined;
|
|
20
16
|
}
|
|
21
|
-
|
|
22
17
|
export function assertIsConsolePluginProps(props) {
|
|
23
18
|
assertIsDashboardPluginProps(props);
|
|
24
19
|
}
|
|
25
|
-
export
|
|
20
|
+
export function ConsolePlugin(props) {
|
|
26
21
|
assertIsConsolePluginProps(props);
|
|
27
22
|
var {
|
|
28
23
|
id,
|
|
@@ -32,8 +27,8 @@ export var ConsolePlugin = props => {
|
|
|
32
27
|
registerComponent,
|
|
33
28
|
notebooksUrl
|
|
34
29
|
} = props;
|
|
35
|
-
var notebookIndex = useRef(0);
|
|
36
|
-
|
|
30
|
+
var notebookIndex = useRef(0);
|
|
31
|
+
// Map from file ID to panel ID
|
|
37
32
|
var [openFileMap] = useState(new Map());
|
|
38
33
|
var [previewFileMap] = useState(new Map());
|
|
39
34
|
var dispatch = useDispatch();
|
|
@@ -42,17 +37,14 @@ export var ConsolePlugin = props => {
|
|
|
42
37
|
var focus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
43
38
|
var execute = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
44
39
|
var trimmedCommand = command && command.trim();
|
|
45
|
-
|
|
46
40
|
if (!trimmedCommand) {
|
|
47
41
|
log.info('Ignoring empty code');
|
|
48
42
|
} else {
|
|
49
43
|
var consolePanel = getConsolePanel();
|
|
50
|
-
|
|
51
44
|
if (!consolePanel || !(consolePanel instanceof ConsolePanel.WrappedComponent)) {
|
|
52
45
|
log.error('Console panel not found');
|
|
53
46
|
return;
|
|
54
47
|
}
|
|
55
|
-
|
|
56
48
|
log.debug('Send command: ', command, focus, execute);
|
|
57
49
|
consolePanel.addCommand(command, focus, execute);
|
|
58
50
|
}
|
|
@@ -66,14 +58,12 @@ export var ConsolePlugin = props => {
|
|
|
66
58
|
} = _ref;
|
|
67
59
|
var extension = language === 'python' ? 'py' : language;
|
|
68
60
|
var title = null;
|
|
69
|
-
|
|
70
61
|
if (extension == null) {
|
|
71
62
|
log.debug('No extension for language', language);
|
|
72
63
|
title = "Untitled-".concat(notebookIndex.current);
|
|
73
64
|
} else {
|
|
74
65
|
title = "Untitled-".concat(notebookIndex.current, ".").concat(extension);
|
|
75
66
|
}
|
|
76
|
-
|
|
77
67
|
notebookIndex.current += 1;
|
|
78
68
|
return title;
|
|
79
69
|
}, []);
|
|
@@ -82,19 +72,15 @@ export var ConsolePlugin = props => {
|
|
|
82
72
|
var {
|
|
83
73
|
id: fileId
|
|
84
74
|
} = fileMetadata;
|
|
85
|
-
|
|
86
75
|
if (fileId != null && openFileMap.has(fileId)) {
|
|
87
76
|
return openFileMap.get(fileId);
|
|
88
77
|
}
|
|
89
|
-
|
|
90
78
|
if (fileId != null && previewFileMap.has(fileId)) {
|
|
91
79
|
return previewFileMap.get(fileId);
|
|
92
80
|
}
|
|
93
|
-
|
|
94
81
|
if (createIfNecessary) {
|
|
95
82
|
return shortid.generate();
|
|
96
83
|
}
|
|
97
|
-
|
|
98
84
|
return null;
|
|
99
85
|
}, [openFileMap, previewFileMap]);
|
|
100
86
|
var renamePanel = useCallback((panelId, newTitle) => {
|
|
@@ -105,69 +91,56 @@ export var ConsolePlugin = props => {
|
|
|
105
91
|
var renameFilePanel = useCallback((oldName, newName) => {
|
|
106
92
|
log.debug('Rename file panel', oldName, newName);
|
|
107
93
|
var panelId;
|
|
108
|
-
|
|
109
94
|
if (openFileMap.has(oldName)) {
|
|
110
95
|
panelId = openFileMap.get(oldName);
|
|
111
96
|
openFileMap.delete(oldName);
|
|
112
|
-
|
|
113
97
|
if (panelId != null) {
|
|
114
98
|
openFileMap.set(newName, panelId);
|
|
115
99
|
}
|
|
116
100
|
}
|
|
117
|
-
|
|
118
101
|
if (previewFileMap.has(oldName)) {
|
|
119
102
|
panelId = previewFileMap.get(oldName);
|
|
120
103
|
previewFileMap.delete(oldName);
|
|
121
|
-
|
|
122
104
|
if (panelId != null) {
|
|
123
105
|
previewFileMap.set(newName, panelId);
|
|
124
106
|
}
|
|
125
107
|
}
|
|
126
|
-
|
|
127
108
|
if (panelId === undefined) {
|
|
128
109
|
log.debug2("File ".concat(oldName, " isn't open, no need to rename the tab"));
|
|
129
110
|
return;
|
|
130
111
|
}
|
|
131
|
-
|
|
132
112
|
renamePanel(panelId, FileUtils.getBaseName(newName));
|
|
133
113
|
}, [openFileMap, previewFileMap, renamePanel]);
|
|
114
|
+
|
|
134
115
|
/**
|
|
135
116
|
* Show the panel for the given file metadata.
|
|
136
117
|
* If the panel is not already open, then it just logs an error and does nothing.
|
|
137
118
|
*/
|
|
138
|
-
|
|
139
119
|
var showFilePanel = useCallback(fileMetadata => {
|
|
140
120
|
var panelId = getPanelIdForFileMetadata(fileMetadata, false);
|
|
141
|
-
|
|
142
121
|
if (panelId == null) {
|
|
143
122
|
log.error('Could not find panel id for file metadata', fileMetadata);
|
|
144
123
|
return;
|
|
145
124
|
}
|
|
146
|
-
|
|
147
125
|
LayoutUtils.activateTab(layout.root, {
|
|
148
126
|
id: panelId
|
|
149
127
|
});
|
|
150
128
|
}, [getPanelIdForFileMetadata, layout.root]);
|
|
151
129
|
var registerFilePanel = useCallback((panelId, fileMetadata, isPreview) => {
|
|
152
130
|
log.debug('registerFilePanel', panelId, fileMetadata, isPreview);
|
|
153
|
-
|
|
154
131
|
if (fileMetadata == null || fileMetadata.id == null) {
|
|
155
132
|
log.debug('Ignore empty file id', fileMetadata);
|
|
156
133
|
return;
|
|
157
134
|
}
|
|
158
|
-
|
|
159
135
|
var {
|
|
160
136
|
id: fileId
|
|
161
137
|
} = fileMetadata;
|
|
162
|
-
|
|
163
138
|
if (isPreview) {
|
|
164
139
|
previewFileMap.set(fileId, panelId);
|
|
165
140
|
return;
|
|
166
141
|
}
|
|
167
|
-
|
|
168
142
|
if (openFileMap.has(fileId)) {
|
|
169
143
|
var existingPanelId = openFileMap.get(fileId);
|
|
170
|
-
|
|
171
144
|
if (panelId === existingPanelId) {
|
|
172
145
|
log.debug("Update tab title for file ".concat(fileId));
|
|
173
146
|
var {
|
|
@@ -177,12 +150,11 @@ export var ConsolePlugin = props => {
|
|
|
177
150
|
} else {
|
|
178
151
|
log.error("File ".concat(fileId, " already associated with a different tab ").concat(existingPanelId));
|
|
179
152
|
}
|
|
180
|
-
|
|
181
153
|
return;
|
|
182
154
|
}
|
|
155
|
+
openFileMap.set(fileId, panelId);
|
|
183
156
|
|
|
184
|
-
|
|
185
|
-
|
|
157
|
+
// De-register preview tab
|
|
186
158
|
if (previewFileMap.has(fileId)) {
|
|
187
159
|
previewFileMap.delete(fileId);
|
|
188
160
|
}
|
|
@@ -194,21 +166,17 @@ export var ConsolePlugin = props => {
|
|
|
194
166
|
// but this situation could be completely avoided by sending an event to the tab
|
|
195
167
|
// to make it switch from preview to edit mode without re-mounting and re-registering
|
|
196
168
|
log.debug('unregisterFileTab', fileMetadata, isPreview);
|
|
197
|
-
|
|
198
169
|
if (fileMetadata == null || fileMetadata.id == null) {
|
|
199
170
|
log.debug('Ignore empty file id', fileMetadata);
|
|
200
171
|
return;
|
|
201
172
|
}
|
|
202
|
-
|
|
203
173
|
var {
|
|
204
174
|
id: fileId
|
|
205
175
|
} = fileMetadata;
|
|
206
|
-
|
|
207
176
|
if (isPreview) {
|
|
208
177
|
previewFileMap.delete(fileId);
|
|
209
178
|
return;
|
|
210
179
|
}
|
|
211
|
-
|
|
212
180
|
openFileMap.delete(fileId);
|
|
213
181
|
}, [openFileMap, previewFileMap]);
|
|
214
182
|
var closeFilePanel = useCallback(fileMetadata => {
|
|
@@ -218,7 +186,6 @@ export var ConsolePlugin = props => {
|
|
|
218
186
|
} = fileMetadata;
|
|
219
187
|
var panelId = null;
|
|
220
188
|
var isPreview = false;
|
|
221
|
-
|
|
222
189
|
if (openFileMap.has(fileId)) {
|
|
223
190
|
panelId = openFileMap.get(fileId);
|
|
224
191
|
} else if (previewFileMap.has(fileId)) {
|
|
@@ -228,7 +195,6 @@ export var ConsolePlugin = props => {
|
|
|
228
195
|
log.debug("File ".concat(fileId, " isn't open, ignore close event"));
|
|
229
196
|
return;
|
|
230
197
|
}
|
|
231
|
-
|
|
232
198
|
unregisterFilePanel(fileMetadata, isPreview);
|
|
233
199
|
LayoutUtils.closeComponent(layout.root, {
|
|
234
200
|
id: panelId
|
|
@@ -254,17 +220,15 @@ export var ConsolePlugin = props => {
|
|
|
254
220
|
log.debug('fileIsOpenAsPreview', fileMetadata, fileId, previewFileMap);
|
|
255
221
|
return fileId != null && previewFileMap.has(fileId);
|
|
256
222
|
}, [previewFileMap]);
|
|
223
|
+
|
|
257
224
|
/*
|
|
258
225
|
* Attempts to focus the panel with the provided panelId
|
|
259
226
|
*/
|
|
260
|
-
|
|
261
227
|
var focusPanelById = useCallback(panelId => {
|
|
262
228
|
if (panelId == null) {
|
|
263
229
|
return;
|
|
264
230
|
}
|
|
265
|
-
|
|
266
231
|
var panel = panelManager.getOpenedPanelById(panelId);
|
|
267
|
-
|
|
268
232
|
if (panel && isNotebookPanel(panel)) {
|
|
269
233
|
panel.focus();
|
|
270
234
|
}
|
|
@@ -308,14 +272,12 @@ export var ConsolePlugin = props => {
|
|
|
308
272
|
itemName: getNotebookFileName(settings)
|
|
309
273
|
};
|
|
310
274
|
var panelId = getPanelIdForFileMetadata(fileMetadata);
|
|
311
|
-
|
|
312
275
|
if (fileIsOpen(fileMetadata) && panelId != null) {
|
|
313
276
|
log.debug('File is already open, focus panel');
|
|
314
277
|
showFilePanel(fileMetadata);
|
|
315
278
|
focusPanelById(panelId);
|
|
316
279
|
return;
|
|
317
280
|
}
|
|
318
|
-
|
|
319
281
|
var stack = LayoutUtils.getStackForComponentTypes(layout.root, [NotebookPanel.COMPONENT]);
|
|
320
282
|
var config = makeConfig({
|
|
321
283
|
id: panelId,
|
|
@@ -331,31 +293,27 @@ export var ConsolePlugin = props => {
|
|
|
331
293
|
var shouldFocus = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
332
294
|
log.debug('selectNotebook', fileMetadata, shouldFocus);
|
|
333
295
|
var isFileOpen = fileIsOpen(fileMetadata);
|
|
334
|
-
var isFileOpenAsPreview = fileIsOpenAsPreview(fileMetadata);
|
|
296
|
+
var isFileOpenAsPreview = fileIsOpenAsPreview(fileMetadata);
|
|
335
297
|
|
|
298
|
+
// If the file is already open, just show and focus it if necessary
|
|
336
299
|
if (isFileOpen) {
|
|
337
300
|
showFilePanel(fileMetadata);
|
|
338
|
-
|
|
339
301
|
if (shouldFocus) {
|
|
340
302
|
var _panelId = getPanelIdForFileMetadata(fileMetadata);
|
|
341
|
-
|
|
342
303
|
focusPanelById(_panelId);
|
|
343
304
|
}
|
|
344
|
-
|
|
345
305
|
return;
|
|
346
|
-
}
|
|
347
|
-
// If we're focusing it, that means we need to replace the panel anyway with a non-preview panel, so just fall into the logic below
|
|
348
|
-
|
|
306
|
+
}
|
|
349
307
|
|
|
308
|
+
// If the file is already open as a preview and we're not focusing it, just show it
|
|
309
|
+
// If we're focusing it, that means we need to replace the panel anyway with a non-preview panel, so just fall into the logic below
|
|
350
310
|
if (isFileOpenAsPreview && !shouldFocus) {
|
|
351
311
|
showFilePanel(fileMetadata);
|
|
352
312
|
return;
|
|
353
313
|
}
|
|
354
|
-
|
|
355
314
|
var [previewTabId] = Array.from(previewFileMap.values());
|
|
356
315
|
var panelId = null;
|
|
357
316
|
var stack = null;
|
|
358
|
-
|
|
359
317
|
if (previewTabId != null) {
|
|
360
318
|
panelId = previewTabId;
|
|
361
319
|
stack = LayoutUtils.getStackForConfig(layout.root, {
|
|
@@ -363,12 +321,10 @@ export var ConsolePlugin = props => {
|
|
|
363
321
|
id: panelId
|
|
364
322
|
});
|
|
365
323
|
}
|
|
366
|
-
|
|
367
324
|
if (stack == null) {
|
|
368
325
|
panelId = getPanelIdForFileMetadata(fileMetadata);
|
|
369
326
|
stack = LayoutUtils.getStackForComponentTypes(layout.root, [NotebookPanel.COMPONENT]);
|
|
370
327
|
}
|
|
371
|
-
|
|
372
328
|
var config = makeConfig({
|
|
373
329
|
id: panelId,
|
|
374
330
|
settings,
|
|
@@ -378,19 +334,17 @@ export var ConsolePlugin = props => {
|
|
|
378
334
|
isPreview: !shouldFocus
|
|
379
335
|
});
|
|
380
336
|
LayoutUtils.openComponentInStack(stack, config);
|
|
381
|
-
|
|
382
337
|
if (shouldFocus) {
|
|
383
338
|
// Focus the tab we just opened if we're supposed to
|
|
384
339
|
focusPanelById(panelId);
|
|
385
340
|
}
|
|
386
341
|
}, [showFilePanel, fileIsOpen, fileIsOpenAsPreview, focusPanelById, getPanelIdForFileMetadata, layout.root, makeConfig, previewFileMap]);
|
|
387
|
-
/** Attempts to send the text to a notebook matching the passed in settings */
|
|
388
342
|
|
|
343
|
+
/** Attempts to send the text to a notebook matching the passed in settings */
|
|
389
344
|
var sendToNotebook = useCallback(function (session, sessionLanguage) {
|
|
390
345
|
var settings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
391
346
|
var createIfNecessary = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
392
347
|
var notebookPanel = panelManager.getLastUsedPanelOfType(NotebookPanel);
|
|
393
|
-
|
|
394
348
|
if (notebookPanel && isNotebookPanel(notebookPanel)) {
|
|
395
349
|
if (settings != null && settings.value != null && notebookPanel.notebook != null) {
|
|
396
350
|
notebookPanel.notebook.append(settings.value);
|
|
@@ -418,7 +372,7 @@ export var ConsolePlugin = props => {
|
|
|
418
372
|
useListener(layout.eventHub, NotebookEvent.SEND_TO_NOTEBOOK, sendToNotebook);
|
|
419
373
|
useListener(layout.eventHub, NotebookEvent.REGISTER_FILE, registerFilePanel);
|
|
420
374
|
useListener(layout.eventHub, NotebookEvent.UNREGISTER_FILE, unregisterFilePanel);
|
|
421
|
-
return
|
|
422
|
-
}
|
|
375
|
+
return null;
|
|
376
|
+
}
|
|
423
377
|
export default ConsolePlugin;
|
|
424
378
|
//# sourceMappingURL=ConsolePlugin.js.map
|