@sqlrooms/mosaic 0.29.0-rc.2 → 0.29.0-rc.4
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/README.md +209 -0
- package/dist/MosaicChartBuilder.d.ts +44 -13
- package/dist/MosaicChartBuilder.d.ts.map +1 -1
- package/dist/MosaicChartBuilder.js +22 -30
- package/dist/MosaicChartBuilder.js.map +1 -1
- package/dist/MosaicSlice.d.ts +28 -10
- package/dist/MosaicSlice.d.ts.map +1 -1
- package/dist/MosaicSlice.js +77 -11
- package/dist/MosaicSlice.js.map +1 -1
- package/dist/ResponsivePlot.d.ts +23 -0
- package/dist/ResponsivePlot.d.ts.map +1 -0
- package/dist/ResponsivePlot.js +43 -0
- package/dist/ResponsivePlot.js.map +1 -0
- package/dist/VgPlotChart.d.ts +18 -2
- package/dist/VgPlotChart.d.ts.map +1 -1
- package/dist/VgPlotChart.js +112 -26
- package/dist/VgPlotChart.js.map +1 -1
- package/dist/boxplot/BoxPlotClient.d.ts +58 -0
- package/dist/boxplot/BoxPlotClient.d.ts.map +1 -0
- package/dist/boxplot/BoxPlotClient.js +264 -0
- package/dist/boxplot/BoxPlotClient.js.map +1 -0
- package/dist/chart/MosaicDashboardChart.d.ts +14 -0
- package/dist/chart/MosaicDashboardChart.d.ts.map +1 -0
- package/dist/chart/MosaicDashboardChart.js +21 -0
- package/dist/chart/MosaicDashboardChart.js.map +1 -0
- package/dist/chart/MosaicDashboardChartContent.d.ts +16 -0
- package/dist/chart/MosaicDashboardChartContent.d.ts.map +1 -0
- package/dist/chart/MosaicDashboardChartContent.js +18 -0
- package/dist/chart/MosaicDashboardChartContent.js.map +1 -0
- package/dist/chart/MosaicDashboardChartHeaderActions.d.ts +4 -0
- package/dist/chart/MosaicDashboardChartHeaderActions.d.ts.map +1 -0
- package/dist/chart/MosaicDashboardChartHeaderActions.js +16 -0
- package/dist/chart/MosaicDashboardChartHeaderActions.js.map +1 -0
- package/dist/chart/MosaicDashboardChartRenderer.d.ts +3 -0
- package/dist/chart/MosaicDashboardChartRenderer.d.ts.map +1 -0
- package/dist/chart/MosaicDashboardChartRenderer.js +31 -0
- package/dist/chart/MosaicDashboardChartRenderer.js.map +1 -0
- package/dist/chart/MosaicDashboardComponentChart.d.ts +14 -0
- package/dist/chart/MosaicDashboardComponentChart.d.ts.map +1 -0
- package/dist/chart/MosaicDashboardComponentChart.js +11 -0
- package/dist/chart/MosaicDashboardComponentChart.js.map +1 -0
- package/dist/chart/MosaicDashboardVgPlotChart.d.ts +10 -0
- package/dist/chart/MosaicDashboardVgPlotChart.d.ts.map +1 -0
- package/dist/chart/MosaicDashboardVgPlotChart.js +10 -0
- package/dist/chart/MosaicDashboardVgPlotChart.js.map +1 -0
- package/dist/chart/MosaicDashboardVgPlotError.d.ts +8 -0
- package/dist/chart/MosaicDashboardVgPlotError.d.ts.map +1 -0
- package/dist/chart/MosaicDashboardVgPlotError.js +11 -0
- package/dist/chart/MosaicDashboardVgPlotError.js.map +1 -0
- package/dist/chart/chart-settings/ChartSettings.d.ts +44 -0
- package/dist/chart/chart-settings/ChartSettings.d.ts.map +1 -0
- package/dist/chart/chart-settings/ChartSettings.js +71 -0
- package/dist/chart/chart-settings/ChartSettings.js.map +1 -0
- package/dist/chart/chart-settings/ChartSettingsContent.d.ts +13 -0
- package/dist/chart/chart-settings/ChartSettingsContent.d.ts.map +1 -0
- package/dist/chart/chart-settings/ChartSettingsContent.js +18 -0
- package/dist/chart/chart-settings/ChartSettingsContent.js.map +1 -0
- package/dist/chart/chart-settings/ChartSettingsContext.d.ts +27 -0
- package/dist/chart/chart-settings/ChartSettingsContext.d.ts.map +1 -0
- package/dist/chart/chart-settings/ChartSettingsContext.js +35 -0
- package/dist/chart/chart-settings/ChartSettingsContext.js.map +1 -0
- package/dist/chart/chart-settings/ChartSettingsPanel.d.ts +14 -0
- package/dist/chart/chart-settings/ChartSettingsPanel.d.ts.map +1 -0
- package/dist/chart/chart-settings/ChartSettingsPanel.js +17 -0
- package/dist/chart/chart-settings/ChartSettingsPanel.js.map +1 -0
- package/dist/chart/chart-settings/ChartSpecViewerPanel.d.ts +9 -0
- package/dist/chart/chart-settings/ChartSpecViewerPanel.d.ts.map +1 -0
- package/dist/chart/chart-settings/ChartSpecViewerPanel.js +11 -0
- package/dist/chart/chart-settings/ChartSpecViewerPanel.js.map +1 -0
- package/dist/chart/chart-settings/ChartTypeSelector.d.ts +9 -0
- package/dist/chart/chart-settings/ChartTypeSelector.d.ts.map +1 -0
- package/dist/chart/chart-settings/ChartTypeSelector.js +16 -0
- package/dist/chart/chart-settings/ChartTypeSelector.js.map +1 -0
- package/dist/chart/chart-settings/useTableColumns.d.ts +3 -0
- package/dist/chart/chart-settings/useTableColumns.d.ts.map +1 -0
- package/dist/chart/chart-settings/useTableColumns.js +12 -0
- package/dist/chart/chart-settings/useTableColumns.js.map +1 -0
- package/dist/chart/useBrushSelectionParams.d.ts +3 -0
- package/dist/chart/useBrushSelectionParams.d.ts.map +1 -0
- package/dist/chart/useBrushSelectionParams.js +16 -0
- package/dist/chart/useBrushSelectionParams.js.map +1 -0
- package/dist/chart/useChartRetainer.d.ts +3 -0
- package/dist/chart/useChartRetainer.d.ts.map +1 -0
- package/dist/chart/useChartRetainer.js +11 -0
- package/dist/chart/useChartRetainer.js.map +1 -0
- package/dist/chart/useGenerateSpec.d.ts +13 -0
- package/dist/chart/useGenerateSpec.d.ts.map +1 -0
- package/dist/chart/useGenerateSpec.js +32 -0
- package/dist/chart/useGenerateSpec.js.map +1 -0
- package/dist/chart-builders/AggregationSelector.d.ts +11 -0
- package/dist/chart-builders/AggregationSelector.d.ts.map +1 -0
- package/dist/chart-builders/AggregationSelector.js +9 -0
- package/dist/chart-builders/AggregationSelector.js.map +1 -0
- package/dist/chart-builders/ChartBuilderActions.d.ts +6 -0
- package/dist/chart-builders/ChartBuilderActions.d.ts.map +1 -0
- package/dist/chart-builders/ChartBuilderActions.js +36 -0
- package/dist/chart-builders/ChartBuilderActions.js.map +1 -0
- package/dist/chart-builders/ChartBuilderContent.d.ts +12 -12
- package/dist/chart-builders/ChartBuilderContent.d.ts.map +1 -1
- package/dist/chart-builders/ChartBuilderContent.js +21 -52
- package/dist/chart-builders/ChartBuilderContent.js.map +1 -1
- package/dist/chart-builders/ChartBuilderContext.d.ts +8 -4
- package/dist/chart-builders/ChartBuilderContext.d.ts.map +1 -1
- package/dist/chart-builders/ChartBuilderContext.js +5 -0
- package/dist/chart-builders/ChartBuilderContext.js.map +1 -1
- package/dist/chart-builders/ChartBuilderDialog.d.ts +30 -8
- package/dist/chart-builders/ChartBuilderDialog.d.ts.map +1 -1
- package/dist/chart-builders/ChartBuilderDialog.js +25 -10
- package/dist/chart-builders/ChartBuilderDialog.js.map +1 -1
- package/dist/chart-builders/ChartBuilderFields.d.ts +6 -0
- package/dist/chart-builders/ChartBuilderFields.d.ts.map +1 -0
- package/dist/chart-builders/ChartBuilderFields.js +39 -0
- package/dist/chart-builders/ChartBuilderFields.js.map +1 -0
- package/dist/chart-builders/ChartBuilderRoot.d.ts +25 -0
- package/dist/chart-builders/ChartBuilderRoot.d.ts.map +1 -0
- package/dist/chart-builders/ChartBuilderRoot.js +42 -0
- package/dist/chart-builders/ChartBuilderRoot.js.map +1 -0
- package/dist/chart-builders/ChartBuilderTypeGrid.d.ts +7 -0
- package/dist/chart-builders/ChartBuilderTypeGrid.d.ts.map +1 -0
- package/dist/chart-builders/ChartBuilderTypeGrid.js +23 -0
- package/dist/chart-builders/ChartBuilderTypeGrid.js.map +1 -0
- package/dist/chart-builders/ColumnSelector.d.ts +15 -0
- package/dist/chart-builders/ColumnSelector.d.ts.map +1 -0
- package/dist/chart-builders/ColumnSelector.js +31 -0
- package/dist/chart-builders/ColumnSelector.js.map +1 -0
- package/dist/chart-builders/Field.d.ts +11 -0
- package/dist/chart-builders/Field.d.ts.map +1 -0
- package/dist/chart-builders/Field.js +9 -0
- package/dist/chart-builders/Field.js.map +1 -0
- package/dist/chart-builders/FieldSelectorInput.d.ts +2 -1
- package/dist/chart-builders/FieldSelectorInput.d.ts.map +1 -1
- package/dist/chart-builders/FieldSelectorInput.js +5 -5
- package/dist/chart-builders/FieldSelectorInput.js.map +1 -1
- package/dist/chart-builders/MultiFieldSelector.d.ts +14 -0
- package/dist/chart-builders/MultiFieldSelector.d.ts.map +1 -0
- package/dist/chart-builders/MultiFieldSelector.js +53 -0
- package/dist/chart-builders/MultiFieldSelector.js.map +1 -0
- package/dist/chart-builders/TemporalGranularitySelector.d.ts +10 -0
- package/dist/chart-builders/TemporalGranularitySelector.d.ts.map +1 -0
- package/dist/chart-builders/TemporalGranularitySelector.js +37 -0
- package/dist/chart-builders/TemporalGranularitySelector.js.map +1 -0
- package/dist/chart-builders/chartSpecTitle.d.ts +3 -4
- package/dist/chart-builders/chartSpecTitle.d.ts.map +1 -1
- package/dist/chart-builders/chartSpecTitle.js +3 -5
- package/dist/chart-builders/chartSpecTitle.js.map +1 -1
- package/dist/chart-builders/chartTypeUtils.d.ts +13 -0
- package/dist/chart-builders/chartTypeUtils.d.ts.map +1 -0
- package/dist/chart-builders/chartTypeUtils.js +47 -0
- package/dist/chart-builders/chartTypeUtils.js.map +1 -0
- package/dist/chart-builders/constants.d.ts +12 -0
- package/dist/chart-builders/constants.d.ts.map +1 -0
- package/dist/chart-builders/constants.js +47 -0
- package/dist/chart-builders/constants.js.map +1 -0
- package/dist/chart-builders/createChartBuilderStore.d.ts +11 -0
- package/dist/chart-builders/createChartBuilderStore.d.ts.map +1 -0
- package/dist/chart-builders/createChartBuilderStore.js +26 -0
- package/dist/chart-builders/createChartBuilderStore.js.map +1 -0
- package/dist/chart-types/base-types.d.ts +148 -0
- package/dist/chart-types/base-types.d.ts.map +1 -0
- package/dist/chart-types/base-types.js +11 -0
- package/dist/chart-types/base-types.js.map +1 -0
- package/dist/chart-types/box-plot/BoxPlotSettings.d.ts +3 -0
- package/dist/chart-types/box-plot/BoxPlotSettings.d.ts.map +1 -0
- package/dist/chart-types/box-plot/BoxPlotSettings.js +9 -0
- package/dist/chart-types/box-plot/BoxPlotSettings.js.map +1 -0
- package/dist/chart-types/box-plot/definition.d.ts +4 -0
- package/dist/chart-types/box-plot/definition.d.ts.map +1 -0
- package/dist/chart-types/box-plot/definition.js +19 -0
- package/dist/chart-types/box-plot/definition.js.map +1 -0
- package/dist/chart-types/box-plot/renderer/BoxPlotErrorBoundary.d.ts +18 -0
- package/dist/chart-types/box-plot/renderer/BoxPlotErrorBoundary.d.ts.map +1 -0
- package/dist/chart-types/box-plot/renderer/BoxPlotErrorBoundary.js +28 -0
- package/dist/chart-types/box-plot/renderer/BoxPlotErrorBoundary.js.map +1 -0
- package/dist/chart-types/box-plot/renderer/BoxPlotPanelRenderer.d.ts +9 -0
- package/dist/chart-types/box-plot/renderer/BoxPlotPanelRenderer.d.ts.map +1 -0
- package/dist/chart-types/box-plot/renderer/BoxPlotPanelRenderer.js +115 -0
- package/dist/chart-types/box-plot/renderer/BoxPlotPanelRenderer.js.map +1 -0
- package/dist/chart-types/box-plot/renderer/constants.d.ts +24 -0
- package/dist/chart-types/box-plot/renderer/constants.d.ts.map +1 -0
- package/dist/chart-types/box-plot/renderer/constants.js +17 -0
- package/dist/chart-types/box-plot/renderer/constants.js.map +1 -0
- package/dist/chart-types/box-plot/renderer/plot.d.ts +14 -0
- package/dist/chart-types/box-plot/renderer/plot.d.ts.map +1 -0
- package/dist/chart-types/box-plot/renderer/plot.js +91 -0
- package/dist/chart-types/box-plot/renderer/plot.js.map +1 -0
- package/dist/chart-types/box-plot/renderer/useBoxPlotClient.d.ts +14 -0
- package/dist/chart-types/box-plot/renderer/useBoxPlotClient.d.ts.map +1 -0
- package/dist/chart-types/box-plot/renderer/useBoxPlotClient.js +45 -0
- package/dist/chart-types/box-plot/renderer/useBoxPlotClient.js.map +1 -0
- package/dist/chart-types/box-plot/renderer/utils.d.ts +6 -0
- package/dist/chart-types/box-plot/renderer/utils.d.ts.map +1 -0
- package/dist/chart-types/box-plot/renderer/utils.js +34 -0
- package/dist/chart-types/box-plot/renderer/utils.js.map +1 -0
- package/dist/chart-types/box-plot/schema.d.ts +16 -0
- package/dist/chart-types/box-plot/schema.d.ts.map +1 -0
- package/dist/chart-types/box-plot/schema.js +11 -0
- package/dist/chart-types/box-plot/schema.js.map +1 -0
- package/dist/chart-types/box-plot/tool.d.ts +44 -0
- package/dist/chart-types/box-plot/tool.d.ts.map +1 -0
- package/dist/chart-types/box-plot/tool.js +59 -0
- package/dist/chart-types/box-plot/tool.js.map +1 -0
- package/dist/chart-types/bubble-chart/BubbleChartSettings.d.ts +3 -0
- package/dist/chart-types/bubble-chart/BubbleChartSettings.d.ts.map +1 -0
- package/dist/chart-types/bubble-chart/BubbleChartSettings.js +9 -0
- package/dist/chart-types/bubble-chart/BubbleChartSettings.js.map +1 -0
- package/dist/chart-types/bubble-chart/definition.d.ts +4 -0
- package/dist/chart-types/bubble-chart/definition.d.ts.map +1 -0
- package/dist/chart-types/bubble-chart/definition.js +19 -0
- package/dist/chart-types/bubble-chart/definition.js.map +1 -0
- package/dist/chart-types/bubble-chart/schema.d.ts +18 -0
- package/dist/chart-types/bubble-chart/schema.d.ts.map +1 -0
- package/dist/chart-types/bubble-chart/schema.js +15 -0
- package/dist/chart-types/bubble-chart/schema.js.map +1 -0
- package/dist/chart-types/bubble-chart/spec.d.ts +4 -0
- package/dist/chart-types/bubble-chart/spec.d.ts.map +1 -0
- package/dist/chart-types/bubble-chart/spec.js +31 -0
- package/dist/chart-types/bubble-chart/spec.js.map +1 -0
- package/dist/chart-types/bubble-chart/tool.d.ts +46 -0
- package/dist/chart-types/bubble-chart/tool.d.ts.map +1 -0
- package/dist/chart-types/bubble-chart/tool.js +58 -0
- package/dist/chart-types/bubble-chart/tool.js.map +1 -0
- package/dist/chart-types/chart-config.d.ts +92 -0
- package/dist/chart-types/chart-config.d.ts.map +1 -0
- package/dist/chart-types/chart-config.js +47 -0
- package/dist/chart-types/chart-config.js.map +1 -0
- package/dist/chart-types/count-plot/CountPlotSettings.d.ts +3 -0
- package/dist/chart-types/count-plot/CountPlotSettings.d.ts.map +1 -0
- package/dist/chart-types/count-plot/CountPlotSettings.js +9 -0
- package/dist/chart-types/count-plot/CountPlotSettings.js.map +1 -0
- package/dist/chart-types/count-plot/definition.d.ts +4 -0
- package/dist/chart-types/count-plot/definition.d.ts.map +1 -0
- package/dist/chart-types/count-plot/definition.js +19 -0
- package/dist/chart-types/count-plot/definition.js.map +1 -0
- package/dist/chart-types/count-plot/schema.d.ts +14 -0
- package/dist/chart-types/count-plot/schema.d.ts.map +1 -0
- package/dist/chart-types/count-plot/schema.js +13 -0
- package/dist/chart-types/count-plot/schema.js.map +1 -0
- package/dist/chart-types/count-plot/spec.d.ts +4 -0
- package/dist/chart-types/count-plot/spec.d.ts.map +1 -0
- package/dist/chart-types/count-plot/spec.js +49 -0
- package/dist/chart-types/count-plot/spec.js.map +1 -0
- package/dist/chart-types/count-plot/tool.d.ts +42 -0
- package/dist/chart-types/count-plot/tool.d.ts.map +1 -0
- package/dist/chart-types/count-plot/tool.js +55 -0
- package/dist/chart-types/count-plot/tool.js.map +1 -0
- package/dist/chart-types/custom-spec/CustomSpecSettings.d.ts +7 -0
- package/dist/chart-types/custom-spec/CustomSpecSettings.d.ts.map +1 -0
- package/dist/chart-types/custom-spec/CustomSpecSettings.js +30 -0
- package/dist/chart-types/custom-spec/CustomSpecSettings.js.map +1 -0
- package/dist/chart-types/custom-spec/definition.d.ts +4 -0
- package/dist/chart-types/custom-spec/definition.d.ts.map +1 -0
- package/dist/chart-types/custom-spec/definition.js +17 -0
- package/dist/chart-types/custom-spec/definition.js.map +1 -0
- package/dist/chart-types/custom-spec/schema.d.ts +14 -0
- package/dist/chart-types/custom-spec/schema.d.ts.map +1 -0
- package/dist/chart-types/custom-spec/schema.js +10 -0
- package/dist/chart-types/custom-spec/schema.js.map +1 -0
- package/dist/chart-types/custom-spec/spec.d.ts +4 -0
- package/dist/chart-types/custom-spec/spec.d.ts.map +1 -0
- package/dist/chart-types/custom-spec/spec.js +24 -0
- package/dist/chart-types/custom-spec/spec.js.map +1 -0
- package/dist/chart-types/errors.d.ts +23 -0
- package/dist/chart-types/errors.d.ts.map +1 -0
- package/dist/chart-types/errors.js +26 -0
- package/dist/chart-types/errors.js.map +1 -0
- package/dist/chart-types/heatmap/HeatmapSettings.d.ts +3 -0
- package/dist/chart-types/heatmap/HeatmapSettings.d.ts.map +1 -0
- package/dist/chart-types/heatmap/HeatmapSettings.js +9 -0
- package/dist/chart-types/heatmap/HeatmapSettings.js.map +1 -0
- package/dist/chart-types/heatmap/definition.d.ts +4 -0
- package/dist/chart-types/heatmap/definition.d.ts.map +1 -0
- package/dist/chart-types/heatmap/definition.js +19 -0
- package/dist/chart-types/heatmap/definition.js.map +1 -0
- package/dist/chart-types/heatmap/schema.d.ts +16 -0
- package/dist/chart-types/heatmap/schema.d.ts.map +1 -0
- package/dist/chart-types/heatmap/schema.js +11 -0
- package/dist/chart-types/heatmap/schema.js.map +1 -0
- package/dist/chart-types/heatmap/spec.d.ts +4 -0
- package/dist/chart-types/heatmap/spec.d.ts.map +1 -0
- package/dist/chart-types/heatmap/spec.js +32 -0
- package/dist/chart-types/heatmap/spec.js.map +1 -0
- package/dist/chart-types/heatmap/tool.d.ts +44 -0
- package/dist/chart-types/heatmap/tool.d.ts.map +1 -0
- package/dist/chart-types/heatmap/tool.js +59 -0
- package/dist/chart-types/heatmap/tool.js.map +1 -0
- package/dist/chart-types/histogram/HistogramSettings.d.ts +3 -0
- package/dist/chart-types/histogram/HistogramSettings.d.ts.map +1 -0
- package/dist/chart-types/histogram/HistogramSettings.js +9 -0
- package/dist/chart-types/histogram/HistogramSettings.js.map +1 -0
- package/dist/chart-types/histogram/definition.d.ts +4 -0
- package/dist/chart-types/histogram/definition.d.ts.map +1 -0
- package/dist/chart-types/histogram/definition.js +19 -0
- package/dist/chart-types/histogram/definition.js.map +1 -0
- package/dist/chart-types/histogram/schema.d.ts +14 -0
- package/dist/chart-types/histogram/schema.d.ts.map +1 -0
- package/dist/chart-types/histogram/schema.js +13 -0
- package/dist/chart-types/histogram/schema.js.map +1 -0
- package/dist/chart-types/histogram/spec.d.ts +4 -0
- package/dist/chart-types/histogram/spec.d.ts.map +1 -0
- package/dist/chart-types/histogram/spec.js +36 -0
- package/dist/chart-types/histogram/spec.js.map +1 -0
- package/dist/chart-types/histogram/tool.d.ts +42 -0
- package/dist/chart-types/histogram/tool.d.ts.map +1 -0
- package/dist/chart-types/histogram/tool.js +55 -0
- package/dist/chart-types/histogram/tool.js.map +1 -0
- package/dist/chart-types/index.d.ts +115 -0
- package/dist/chart-types/index.d.ts.map +1 -0
- package/dist/chart-types/index.js +100 -0
- package/dist/chart-types/index.js.map +1 -0
- package/dist/chart-types/line-chart/LineChartSettings.d.ts +7 -0
- package/dist/chart-types/line-chart/LineChartSettings.d.ts.map +1 -0
- package/dist/chart-types/line-chart/LineChartSettings.js +22 -0
- package/dist/chart-types/line-chart/LineChartSettings.js.map +1 -0
- package/dist/chart-types/line-chart/definition.d.ts +4 -0
- package/dist/chart-types/line-chart/definition.d.ts.map +1 -0
- package/dist/chart-types/line-chart/definition.js +19 -0
- package/dist/chart-types/line-chart/definition.js.map +1 -0
- package/dist/chart-types/line-chart/schema.d.ts +83 -0
- package/dist/chart-types/line-chart/schema.d.ts.map +1 -0
- package/dist/chart-types/line-chart/schema.js +39 -0
- package/dist/chart-types/line-chart/schema.js.map +1 -0
- package/dist/chart-types/line-chart/spec.d.ts +4 -0
- package/dist/chart-types/line-chart/spec.d.ts.map +1 -0
- package/dist/chart-types/line-chart/spec.js +91 -0
- package/dist/chart-types/line-chart/spec.js.map +1 -0
- package/dist/chart-types/line-chart/tool.d.ts +68 -0
- package/dist/chart-types/line-chart/tool.d.ts.map +1 -0
- package/dist/chart-types/line-chart/tool.js +66 -0
- package/dist/chart-types/line-chart/tool.js.map +1 -0
- package/dist/chart-types/tool-schemas.d.ts +8 -0
- package/dist/chart-types/tool-schemas.d.ts.map +1 -0
- package/dist/chart-types/tool-schemas.js +18 -0
- package/dist/chart-types/tool-schemas.js.map +1 -0
- package/dist/chart-types/tool-types.d.ts +26 -0
- package/dist/chart-types/tool-types.d.ts.map +1 -0
- package/dist/chart-types/tool-types.js +2 -0
- package/dist/chart-types/tool-types.js.map +1 -0
- package/dist/chart-types/tool-validation.d.ts +3 -0
- package/dist/chart-types/tool-validation.d.ts.map +1 -0
- package/dist/chart-types/tool-validation.js +11 -0
- package/dist/chart-types/tool-validation.js.map +1 -0
- package/dist/chart-types/useChartTypeDefinition.d.ts +3 -0
- package/dist/chart-types/useChartTypeDefinition.d.ts.map +1 -0
- package/dist/chart-types/useChartTypeDefinition.js +8 -0
- package/dist/chart-types/useChartTypeDefinition.js.map +1 -0
- package/dist/dashboard/DashboardPanelErrorBoundary.d.ts +17 -0
- package/dist/dashboard/DashboardPanelErrorBoundary.d.ts.map +1 -0
- package/dist/dashboard/DashboardPanelErrorBoundary.js +21 -0
- package/dist/dashboard/DashboardPanelErrorBoundary.js.map +1 -0
- package/dist/dashboard/MosaicDashboard.d.ts +2 -4
- package/dist/dashboard/MosaicDashboard.d.ts.map +1 -1
- package/dist/dashboard/MosaicDashboard.js +38 -19
- package/dist/dashboard/MosaicDashboard.js.map +1 -1
- package/dist/dashboard/MosaicDashboardContext.d.ts +1 -0
- package/dist/dashboard/MosaicDashboardContext.d.ts.map +1 -1
- package/dist/dashboard/MosaicDashboardContext.js.map +1 -1
- package/dist/dashboard/MosaicDashboardEmptyState.d.ts +2 -0
- package/dist/dashboard/MosaicDashboardEmptyState.d.ts.map +1 -0
- package/dist/dashboard/MosaicDashboardEmptyState.js +50 -0
- package/dist/dashboard/MosaicDashboardEmptyState.js.map +1 -0
- package/dist/dashboard/MosaicDashboardPanel.d.ts +3 -0
- package/dist/dashboard/MosaicDashboardPanel.d.ts.map +1 -0
- package/dist/dashboard/MosaicDashboardPanel.js +26 -0
- package/dist/dashboard/MosaicDashboardPanel.js.map +1 -0
- package/dist/dashboard/MosaicDashboardPanelDragOverlay.d.ts +8 -0
- package/dist/dashboard/MosaicDashboardPanelDragOverlay.d.ts.map +1 -0
- package/dist/dashboard/MosaicDashboardPanelDragOverlay.js +17 -0
- package/dist/dashboard/MosaicDashboardPanelDragOverlay.js.map +1 -0
- package/dist/dashboard/MosaicDashboardPanelHeader.d.ts +13 -0
- package/dist/dashboard/MosaicDashboardPanelHeader.d.ts.map +1 -0
- package/dist/dashboard/MosaicDashboardPanelHeader.js +30 -0
- package/dist/dashboard/MosaicDashboardPanelHeader.js.map +1 -0
- package/dist/dashboard/MosaicDashboardPanelLayout.d.ts +10 -0
- package/dist/dashboard/MosaicDashboardPanelLayout.d.ts.map +1 -0
- package/dist/dashboard/MosaicDashboardPanelLayout.js +46 -0
- package/dist/dashboard/MosaicDashboardPanelLayout.js.map +1 -0
- package/dist/dashboard/MosaicDashboardPanels.d.ts +2 -0
- package/dist/dashboard/MosaicDashboardPanels.d.ts.map +1 -0
- package/dist/dashboard/MosaicDashboardPanels.js +53 -0
- package/dist/dashboard/MosaicDashboardPanels.js.map +1 -0
- package/dist/dashboard/MosaicDashboardSlice.d.ts +607 -27
- package/dist/dashboard/MosaicDashboardSlice.d.ts.map +1 -1
- package/dist/dashboard/MosaicDashboardSlice.js +525 -93
- package/dist/dashboard/MosaicDashboardSlice.js.map +1 -1
- package/dist/dashboard/MosaicDashboardToolbar.d.ts.map +1 -1
- package/dist/dashboard/MosaicDashboardToolbar.js +74 -7
- package/dist/dashboard/MosaicDashboardToolbar.js.map +1 -1
- package/dist/dashboard/defaultPanelRenderers.d.ts +3 -0
- package/dist/dashboard/defaultPanelRenderers.d.ts.map +1 -0
- package/dist/dashboard/defaultPanelRenderers.js +13 -0
- package/dist/dashboard/defaultPanelRenderers.js.map +1 -0
- package/dist/dashboard/utils.d.ts +3 -0
- package/dist/dashboard/utils.d.ts.map +1 -0
- package/dist/dashboard/utils.js +16 -0
- package/dist/dashboard/utils.js.map +1 -0
- package/dist/editor/MosaicChartDisplay.d.ts.map +1 -1
- package/dist/editor/MosaicChartDisplay.js +6 -1
- package/dist/editor/MosaicChartDisplay.js.map +1 -1
- package/dist/index.d.ts +28 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/dist/profiler/MosaicDashboardProfilerPanelRenderer.d.ts +3 -0
- package/dist/profiler/MosaicDashboardProfilerPanelRenderer.d.ts.map +1 -0
- package/dist/profiler/MosaicDashboardProfilerPanelRenderer.js +32 -0
- package/dist/profiler/MosaicDashboardProfilerPanelRenderer.js.map +1 -0
- package/dist/profiler/useMosaicProfiler.d.ts.map +1 -1
- package/dist/profiler/useMosaicProfiler.js.map +1 -1
- package/dist/tableInterop.js.map +1 -1
- package/dist/text/MosaicDashboardTextRenderer.d.ts +3 -0
- package/dist/text/MosaicDashboardTextRenderer.d.ts.map +1 -0
- package/dist/text/MosaicDashboardTextRenderer.js +46 -0
- package/dist/text/MosaicDashboardTextRenderer.js.map +1 -0
- package/dist/useMosaicClient.d.ts +4 -15
- package/dist/useMosaicClient.d.ts.map +1 -1
- package/dist/useMosaicClient.js +10 -4
- package/dist/useMosaicClient.js.map +1 -1
- package/package.json +40 -31
- package/dist/chart-builders/builders.d.ts +0 -7
- package/dist/chart-builders/builders.d.ts.map +0 -1
- package/dist/chart-builders/builders.js +0 -280
- package/dist/chart-builders/builders.js.map +0 -1
- package/dist/chart-builders/createMosaicChartTool.d.ts +0 -45
- package/dist/chart-builders/createMosaicChartTool.d.ts.map +0 -1
- package/dist/chart-builders/createMosaicChartTool.js +0 -109
- package/dist/chart-builders/createMosaicChartTool.js.map +0 -1
- package/dist/chart-builders/describeChartSpecs.d.ts +0 -7
- package/dist/chart-builders/describeChartSpecs.d.ts.map +0 -1
- package/dist/chart-builders/describeChartSpecs.js +0 -38
- package/dist/chart-builders/describeChartSpecs.js.map +0 -1
- package/dist/chart-builders/types.d.ts +0 -40
- package/dist/chart-builders/types.d.ts.map +0 -1
- package/dist/chart-builders/types.js +0 -2
- package/dist/chart-builders/types.js.map +0 -1
- package/dist/dashboard/MosaicDashboardChartPanel.d.ts +0 -3
- package/dist/dashboard/MosaicDashboardChartPanel.d.ts.map +0 -1
- package/dist/dashboard/MosaicDashboardChartPanel.js +0 -49
- package/dist/dashboard/MosaicDashboardChartPanel.js.map +0 -1
- package/dist/dashboard/MosaicDashboardCharts.d.ts +0 -3
- package/dist/dashboard/MosaicDashboardCharts.d.ts.map +0 -1
- package/dist/dashboard/MosaicDashboardCharts.js +0 -45
- package/dist/dashboard/MosaicDashboardCharts.js.map +0 -1
- package/dist/dashboard/MosaicDashboardProfiler.d.ts +0 -3
- package/dist/dashboard/MosaicDashboardProfiler.d.ts.map +0 -1
- package/dist/dashboard/MosaicDashboardProfiler.js +0 -21
- package/dist/dashboard/MosaicDashboardProfiler.js.map +0 -1
- package/dist/dashboard/VgPlotSpecPopoverEditor.d.ts +0 -8
- package/dist/dashboard/VgPlotSpecPopoverEditor.d.ts.map +0 -1
- package/dist/dashboard/VgPlotSpecPopoverEditor.js +0 -40
- package/dist/dashboard/VgPlotSpecPopoverEditor.js.map +0 -1
- package/dist/use-mosaic.d.ts +0 -11
- package/dist/use-mosaic.d.ts.map +0 -1
- package/dist/use-mosaic.js +0 -42
- package/dist/use-mosaic.js.map +0 -1
|
@@ -1,127 +1,435 @@
|
|
|
1
1
|
import { createId } from '@paralleldrive/cuid2';
|
|
2
|
-
import {
|
|
2
|
+
import { DEFAULT_GRID_COLS, getGridColsForBreakpoint, } from '@sqlrooms/layout';
|
|
3
|
+
import { isLayoutGridNode, isLayoutNodeKey, isLayoutPanelNode, isLayoutSplitNode, LayoutNode as LayoutNodeSchema, } from '@sqlrooms/layout-config';
|
|
3
4
|
import { createSlice, useBaseRoomStore, } from '@sqlrooms/room-store';
|
|
4
5
|
import { produce } from 'immer';
|
|
5
6
|
import { z } from 'zod';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export const
|
|
7
|
+
import { destroyRetainedVgPlotChart, } from '../VgPlotChart';
|
|
8
|
+
import { ChartConfig } from '../chart-types/chart-config';
|
|
9
|
+
/**
|
|
10
|
+
* Panel key used for function-form panel definitions registered by
|
|
11
|
+
* `MosaicDashboardPanels`. Individual dashboard panels are represented as
|
|
12
|
+
* `LayoutPanelNode` entries whose `panel` property carries
|
|
13
|
+
* `{ key: MOSAIC_DASHBOARD_PANEL, meta: { dashboardId, panelId } }`.
|
|
14
|
+
*/
|
|
15
|
+
export const MOSAIC_DASHBOARD_PANEL = 'mosaic-dashboard-panel';
|
|
16
|
+
export const MOSAIC_DASHBOARD_CHART_PANEL_TYPE = 'vgplot';
|
|
17
|
+
export const MOSAIC_DASHBOARD_PROFILER_PANEL_TYPE = 'profiler';
|
|
18
|
+
export const MOSAIC_DASHBOARD_TEXT_PANEL_TYPE = 'text';
|
|
19
|
+
export const MosaicDashboardLayoutType = z.enum(['dock', 'grid']);
|
|
20
|
+
export const MosaicDashboardPanelSource = z.object({
|
|
21
|
+
tableName: z.string().optional(),
|
|
22
|
+
sqlQuery: z.string().optional(),
|
|
23
|
+
});
|
|
24
|
+
// Profiler panel config
|
|
25
|
+
export const ProfilerPanelConfig = z.object({
|
|
26
|
+
pageSize: z.number().optional(),
|
|
27
|
+
});
|
|
28
|
+
// Text panel config
|
|
29
|
+
export const TextPanelConfig = z.object({
|
|
30
|
+
content: z.string().default(''),
|
|
31
|
+
toolbarOpen: z.boolean().default(true),
|
|
32
|
+
sourcePanelOpen: z.boolean().default(false),
|
|
33
|
+
});
|
|
34
|
+
// Panel configs discriminated by type
|
|
35
|
+
export const ChartPanelConfig = z.object({
|
|
36
|
+
id: z.string(),
|
|
37
|
+
type: z.literal(MOSAIC_DASHBOARD_CHART_PANEL_TYPE),
|
|
38
|
+
title: z.string().default('Panel'),
|
|
39
|
+
source: MosaicDashboardPanelSource.optional(),
|
|
40
|
+
config: ChartConfig,
|
|
41
|
+
});
|
|
42
|
+
export const ProfilerPanel = z.object({
|
|
42
43
|
id: z.string(),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
.default(DEFAULT_MOSAIC_DASHBOARD_CHART_SPEC),
|
|
44
|
+
type: z.literal(MOSAIC_DASHBOARD_PROFILER_PANEL_TYPE),
|
|
45
|
+
title: z.string().default('Panel'),
|
|
46
|
+
source: MosaicDashboardPanelSource.optional(),
|
|
47
|
+
config: ProfilerPanelConfig,
|
|
48
48
|
});
|
|
49
|
+
export const TextPanel = z.object({
|
|
50
|
+
id: z.string(),
|
|
51
|
+
type: z.literal(MOSAIC_DASHBOARD_TEXT_PANEL_TYPE),
|
|
52
|
+
title: z.string().default('Text'),
|
|
53
|
+
source: MosaicDashboardPanelSource.optional(),
|
|
54
|
+
config: TextPanelConfig,
|
|
55
|
+
});
|
|
56
|
+
// Legacy panel for backward compatibility
|
|
57
|
+
export const LegacyPanelConfig = z.object({
|
|
58
|
+
id: z.string(),
|
|
59
|
+
type: z.string(),
|
|
60
|
+
title: z.string().default('Panel'),
|
|
61
|
+
source: MosaicDashboardPanelSource.optional(),
|
|
62
|
+
config: z.record(z.string(), z.unknown()).default({}),
|
|
63
|
+
});
|
|
64
|
+
// Discriminated union of all panel types
|
|
65
|
+
export const MosaicDashboardPanelConfig = z
|
|
66
|
+
.discriminatedUnion('type', [ChartPanelConfig, ProfilerPanel, TextPanel])
|
|
67
|
+
.or(LegacyPanelConfig);
|
|
68
|
+
export function createMosaicDashboardPanelConfig(options) {
|
|
69
|
+
return {
|
|
70
|
+
id: createId(),
|
|
71
|
+
type: options.type,
|
|
72
|
+
title: options.title,
|
|
73
|
+
source: options.source,
|
|
74
|
+
config: options.config ?? {},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export function createMosaicDashboardChartPanelConfig(title, config, source) {
|
|
78
|
+
return {
|
|
79
|
+
id: createId(),
|
|
80
|
+
type: MOSAIC_DASHBOARD_CHART_PANEL_TYPE,
|
|
81
|
+
title,
|
|
82
|
+
source,
|
|
83
|
+
config,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export function createMosaicDashboardProfilerPanelConfig(options = {}) {
|
|
87
|
+
return createMosaicDashboardPanelConfig({
|
|
88
|
+
type: MOSAIC_DASHBOARD_PROFILER_PANEL_TYPE,
|
|
89
|
+
title: options.title ?? 'Profiler',
|
|
90
|
+
source: options.source,
|
|
91
|
+
config: {
|
|
92
|
+
pageSize: options.pageSize ?? 10,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
export function createMosaicDashboardTextPanelConfig(options = {}) {
|
|
97
|
+
return {
|
|
98
|
+
id: createId(),
|
|
99
|
+
type: MOSAIC_DASHBOARD_TEXT_PANEL_TYPE,
|
|
100
|
+
title: options.title ?? 'Text',
|
|
101
|
+
source: options.source,
|
|
102
|
+
config: {
|
|
103
|
+
content: options.content ?? '',
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
49
107
|
export const MosaicDashboardEntry = z.object({
|
|
50
108
|
id: z.string(),
|
|
51
109
|
title: z.string().default('Dashboard'),
|
|
110
|
+
layoutType: MosaicDashboardLayoutType.default('dock'),
|
|
52
111
|
selectedTable: z.string().optional(),
|
|
53
|
-
|
|
54
|
-
layout:
|
|
112
|
+
panels: z.array(MosaicDashboardPanelConfig).default([]),
|
|
113
|
+
layout: LayoutNodeSchema.nullable().default(null),
|
|
55
114
|
updatedAt: z.number().default(0),
|
|
56
115
|
});
|
|
57
116
|
export const MosaicDashboardSliceConfig = z.object({
|
|
58
117
|
dashboardsById: z.record(z.string(), MosaicDashboardEntry).default({}),
|
|
59
118
|
});
|
|
60
|
-
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
// Layout tree helpers (operate on the new LayoutNode types)
|
|
121
|
+
// ---------------------------------------------------------------------------
|
|
122
|
+
function createDashboardPanelNode(dashboardId, panelId) {
|
|
123
|
+
return {
|
|
124
|
+
type: 'panel',
|
|
125
|
+
id: getMosaicDashboardPanelId(dashboardId, panelId),
|
|
126
|
+
minSize: 200,
|
|
127
|
+
panel: {
|
|
128
|
+
key: MOSAIC_DASHBOARD_PANEL,
|
|
129
|
+
meta: { dashboardId, panelId },
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function getDashboardPanelTypesByLayoutId(dashboardId, panels) {
|
|
134
|
+
return Object.fromEntries(panels.map((panel) => [
|
|
135
|
+
getMosaicDashboardPanelId(dashboardId, panel.id),
|
|
136
|
+
panel.type,
|
|
137
|
+
]));
|
|
138
|
+
}
|
|
139
|
+
function appendPanelToLayout(layout, panelNode) {
|
|
61
140
|
if (!layout) {
|
|
62
|
-
return
|
|
141
|
+
return panelNode;
|
|
63
142
|
}
|
|
64
143
|
return {
|
|
65
144
|
type: 'split',
|
|
145
|
+
id: `split-${createId()}`,
|
|
66
146
|
direction: 'row',
|
|
67
|
-
children: [layout,
|
|
147
|
+
children: [layout, panelNode],
|
|
68
148
|
};
|
|
69
149
|
}
|
|
70
|
-
function
|
|
150
|
+
function createDashboardGridLayout(dashboardId, panelNode) {
|
|
151
|
+
const children = panelNode ? [panelNode] : [];
|
|
152
|
+
const layouts = createDashboardGridLayoutsForChildren(children);
|
|
153
|
+
return {
|
|
154
|
+
type: 'grid',
|
|
155
|
+
id: getMosaicDashboardGridId(dashboardId),
|
|
156
|
+
children,
|
|
157
|
+
rowHeight: 150,
|
|
158
|
+
margin: [12, 12],
|
|
159
|
+
containerPadding: [0, 0],
|
|
160
|
+
compactType: 'vertical',
|
|
161
|
+
preventCollision: false,
|
|
162
|
+
resizeHandles: ['e', 's', 'w', 'se', 'sw'],
|
|
163
|
+
layouts,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function getLayoutChildId(node) {
|
|
167
|
+
return isLayoutNodeKey(node) ? node : node.id;
|
|
168
|
+
}
|
|
169
|
+
function createDashboardGridItem(panelId, layout, cols = 12, panelType) {
|
|
170
|
+
const effectiveCols = Math.max(1, cols);
|
|
171
|
+
const w = panelType === MOSAIC_DASHBOARD_PROFILER_PANEL_TYPE
|
|
172
|
+
? effectiveCols
|
|
173
|
+
: Math.max(1, Math.ceil(effectiveCols / 2));
|
|
174
|
+
const h = 2;
|
|
175
|
+
const bottom = layout.reduce((max, item) => Math.max(max, item.y + item.h), 0);
|
|
176
|
+
for (let y = 0; y <= bottom; y += 1) {
|
|
177
|
+
for (let x = 0; x <= effectiveCols - w; x += 1) {
|
|
178
|
+
const overlaps = layout.some((item) => x < item.x + item.w &&
|
|
179
|
+
x + w > item.x &&
|
|
180
|
+
y < item.y + item.h &&
|
|
181
|
+
y + h > item.y);
|
|
182
|
+
if (!overlaps) {
|
|
183
|
+
return {
|
|
184
|
+
i: panelId,
|
|
185
|
+
x,
|
|
186
|
+
y,
|
|
187
|
+
w,
|
|
188
|
+
h,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
i: panelId,
|
|
195
|
+
x: 0,
|
|
196
|
+
y: bottom,
|
|
197
|
+
w,
|
|
198
|
+
h,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
function createDashboardGridLayoutsForChildren(children, sourceLayouts, cols, panelTypesByLayoutId = {}) {
|
|
202
|
+
const childIds = new Set(children.map((child) => getLayoutChildId(child)));
|
|
203
|
+
const sourceEntries = new Map(Object.keys(DEFAULT_GRID_COLS).map((breakpoint) => [breakpoint, []]));
|
|
204
|
+
for (const [breakpoint, breakpointLayout] of Object.entries(sourceLayouts ?? {})) {
|
|
205
|
+
sourceEntries.set(breakpoint, breakpointLayout);
|
|
206
|
+
}
|
|
207
|
+
return Object.fromEntries([...sourceEntries.entries()].map(([breakpoint, breakpointLayout]) => {
|
|
208
|
+
const nextLayout = breakpointLayout.filter((item) => childIds.has(item.i));
|
|
209
|
+
const layoutItemIds = new Set(nextLayout.map((item) => item.i));
|
|
210
|
+
for (const child of children) {
|
|
211
|
+
const childId = getLayoutChildId(child);
|
|
212
|
+
if (!layoutItemIds.has(childId)) {
|
|
213
|
+
const item = createDashboardGridItem(childId, nextLayout, getGridColsForBreakpoint(cols, breakpoint), panelTypesByLayoutId[childId]);
|
|
214
|
+
nextLayout.push(item);
|
|
215
|
+
layoutItemIds.add(childId);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return [breakpoint, nextLayout];
|
|
219
|
+
}));
|
|
220
|
+
}
|
|
221
|
+
function isExpectedDashboardPanelNode(node, expectedPanelIds) {
|
|
222
|
+
return expectedPanelIds.has(getLayoutChildId(node));
|
|
223
|
+
}
|
|
224
|
+
function collectDashboardPanelNodes(layout, expectedPanelIds, nodes = [], seen = new Set()) {
|
|
71
225
|
if (!layout)
|
|
72
|
-
return
|
|
73
|
-
if (
|
|
74
|
-
|
|
226
|
+
return nodes;
|
|
227
|
+
if (isLayoutNodeKey(layout) || isLayoutPanelNode(layout)) {
|
|
228
|
+
if (isExpectedDashboardPanelNode(layout, expectedPanelIds)) {
|
|
229
|
+
const id = getLayoutChildId(layout);
|
|
230
|
+
if (!seen.has(id)) {
|
|
231
|
+
nodes.push(layout);
|
|
232
|
+
seen.add(id);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return nodes;
|
|
75
236
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
237
|
+
if (isLayoutSplitNode(layout) || isLayoutGridNode(layout)) {
|
|
238
|
+
for (const child of layout.children) {
|
|
239
|
+
collectDashboardPanelNodes(child, expectedPanelIds, nodes, seen);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return nodes;
|
|
243
|
+
}
|
|
244
|
+
function normalizeDashboardGridLayout(layout, dashboardId, expectedPanelIds, panelTypesByLayoutId = {}) {
|
|
245
|
+
const collectedPanelIds = collectPanelIds(layout);
|
|
246
|
+
const existingExpectedPanelIds = new Set([...expectedPanelIds].filter((panelId) => collectedPanelIds.has(panelId)));
|
|
247
|
+
const children = collectDashboardPanelNodes(layout, existingExpectedPanelIds);
|
|
248
|
+
const layouts = createDashboardGridLayoutsForChildren(children, isLayoutGridNode(layout) ? layout.layouts : undefined, isLayoutGridNode(layout) ? layout.cols : undefined, panelTypesByLayoutId);
|
|
249
|
+
if (isLayoutGridNode(layout)) {
|
|
250
|
+
return {
|
|
251
|
+
...layout,
|
|
252
|
+
children,
|
|
253
|
+
layouts,
|
|
254
|
+
};
|
|
84
255
|
}
|
|
256
|
+
return {
|
|
257
|
+
...createDashboardGridLayout(dashboardId),
|
|
258
|
+
children,
|
|
259
|
+
layouts,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function appendPanelToGridLayout(layout, dashboardId, panelNode, panelType, panelTypesByLayoutId = {}) {
|
|
263
|
+
const nextPanelTypesByLayoutId = {
|
|
264
|
+
...panelTypesByLayoutId,
|
|
265
|
+
[panelNode.id]: panelType ?? panelTypesByLayoutId[panelNode.id],
|
|
266
|
+
};
|
|
267
|
+
if (!isLayoutGridNode(layout)) {
|
|
268
|
+
const dashboardPanelPrefix = `dashboard:${dashboardId}:panel:`;
|
|
269
|
+
const expectedPanelIds = new Set([...collectPanelIds(layout)].filter((panelId) => panelId.startsWith(dashboardPanelPrefix)));
|
|
270
|
+
expectedPanelIds.add(panelNode.id);
|
|
271
|
+
const normalizedLayout = normalizeDashboardGridLayout(layout, dashboardId, expectedPanelIds, nextPanelTypesByLayoutId);
|
|
272
|
+
return appendPanelToGridLayout(normalizedLayout, dashboardId, panelNode, panelType, nextPanelTypesByLayoutId);
|
|
273
|
+
}
|
|
274
|
+
const hasChild = layout.children.some((child) => {
|
|
275
|
+
if (isLayoutNodeKey(child))
|
|
276
|
+
return child === panelNode.id;
|
|
277
|
+
return child.id === panelNode.id;
|
|
278
|
+
});
|
|
279
|
+
const children = hasChild ? layout.children : [...layout.children, panelNode];
|
|
280
|
+
const layouts = Object.fromEntries(Object.entries(createDashboardGridLayoutsForChildren(children, layout.layouts, layout.cols, nextPanelTypesByLayoutId) ?? {}).map(([breakpoint, breakpointLayout]) => {
|
|
281
|
+
if (breakpointLayout.some((item) => item.i === panelNode.id)) {
|
|
282
|
+
return [breakpoint, breakpointLayout];
|
|
283
|
+
}
|
|
284
|
+
return [
|
|
285
|
+
breakpoint,
|
|
286
|
+
[
|
|
287
|
+
...breakpointLayout,
|
|
288
|
+
createDashboardGridItem(panelNode.id, breakpointLayout, getGridColsForBreakpoint(layout.cols, breakpoint), nextPanelTypesByLayoutId[panelNode.id]),
|
|
289
|
+
],
|
|
290
|
+
];
|
|
291
|
+
}));
|
|
85
292
|
return {
|
|
86
293
|
...layout,
|
|
87
|
-
children
|
|
294
|
+
children,
|
|
295
|
+
layouts,
|
|
88
296
|
};
|
|
89
297
|
}
|
|
298
|
+
function removePanelFromLayout(layout, panelId) {
|
|
299
|
+
if (!layout)
|
|
300
|
+
return null;
|
|
301
|
+
if (isLayoutNodeKey(layout)) {
|
|
302
|
+
return layout === panelId ? null : layout;
|
|
303
|
+
}
|
|
304
|
+
if (isLayoutPanelNode(layout)) {
|
|
305
|
+
return layout.id === panelId ? null : layout;
|
|
306
|
+
}
|
|
307
|
+
if (isLayoutSplitNode(layout)) {
|
|
308
|
+
const nextChildren = layout.children
|
|
309
|
+
.map((child) => removePanelFromLayout(child, panelId))
|
|
310
|
+
.filter((child) => child !== null);
|
|
311
|
+
if (nextChildren.length === 0)
|
|
312
|
+
return null;
|
|
313
|
+
if (nextChildren.length === 1)
|
|
314
|
+
return nextChildren[0] ?? null;
|
|
315
|
+
return { ...layout, children: nextChildren };
|
|
316
|
+
}
|
|
317
|
+
if (isLayoutGridNode(layout)) {
|
|
318
|
+
const nextChildren = layout.children.filter((child) => {
|
|
319
|
+
if (isLayoutNodeKey(child))
|
|
320
|
+
return child !== panelId;
|
|
321
|
+
return child.id !== panelId;
|
|
322
|
+
});
|
|
323
|
+
const nextLayouts = layout.layouts
|
|
324
|
+
? Object.fromEntries(Object.entries(layout.layouts).map(([breakpoint, breakpointLayout]) => [
|
|
325
|
+
breakpoint,
|
|
326
|
+
breakpointLayout.filter((item) => item.i !== panelId),
|
|
327
|
+
]))
|
|
328
|
+
: layout.layouts;
|
|
329
|
+
if (nextChildren.length === 0)
|
|
330
|
+
return null;
|
|
331
|
+
return { ...layout, children: nextChildren, layouts: nextLayouts };
|
|
332
|
+
}
|
|
333
|
+
return layout;
|
|
334
|
+
}
|
|
90
335
|
function collectPanelIds(layout, panelIds = new Set()) {
|
|
91
336
|
if (!layout)
|
|
92
337
|
return panelIds;
|
|
93
|
-
if (
|
|
338
|
+
if (isLayoutNodeKey(layout)) {
|
|
94
339
|
panelIds.add(layout);
|
|
95
340
|
return panelIds;
|
|
96
341
|
}
|
|
97
|
-
|
|
98
|
-
|
|
342
|
+
if (isLayoutPanelNode(layout)) {
|
|
343
|
+
panelIds.add(layout.id);
|
|
344
|
+
return panelIds;
|
|
345
|
+
}
|
|
346
|
+
if (isLayoutSplitNode(layout)) {
|
|
347
|
+
for (const child of layout.children) {
|
|
348
|
+
collectPanelIds(child, panelIds);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
if (isLayoutGridNode(layout)) {
|
|
352
|
+
for (const child of layout.children) {
|
|
353
|
+
collectPanelIds(child, panelIds);
|
|
354
|
+
}
|
|
99
355
|
}
|
|
100
356
|
return panelIds;
|
|
101
357
|
}
|
|
102
|
-
function
|
|
358
|
+
function ensureLayoutContainsDashboardPanels(layout, dashboardId, panelIds, layoutType = 'dock', panelTypesByLayoutId = {}) {
|
|
103
359
|
let nextLayout = layout;
|
|
104
|
-
|
|
360
|
+
if (layoutType === 'grid') {
|
|
361
|
+
const expectedPanelIds = new Set(panelIds.map((panelId) => getMosaicDashboardPanelId(dashboardId, panelId)));
|
|
362
|
+
nextLayout = normalizeDashboardGridLayout(nextLayout, dashboardId, expectedPanelIds, panelTypesByLayoutId);
|
|
363
|
+
}
|
|
364
|
+
const existing = collectPanelIds(nextLayout);
|
|
105
365
|
for (const panelId of panelIds) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
366
|
+
const layoutPanelId = getMosaicDashboardPanelId(dashboardId, panelId);
|
|
367
|
+
if (!existing.has(layoutPanelId)) {
|
|
368
|
+
const panelNode = createDashboardPanelNode(dashboardId, panelId);
|
|
369
|
+
nextLayout =
|
|
370
|
+
layoutType === 'grid'
|
|
371
|
+
? appendPanelToGridLayout(nextLayout, dashboardId, panelNode, panelTypesByLayoutId[layoutPanelId], panelTypesByLayoutId)
|
|
372
|
+
: appendPanelToLayout(nextLayout, panelNode);
|
|
373
|
+
existing.add(layoutPanelId);
|
|
109
374
|
}
|
|
110
375
|
}
|
|
111
376
|
return nextLayout;
|
|
112
377
|
}
|
|
113
|
-
export function
|
|
114
|
-
return
|
|
378
|
+
export function isChartPanelConfig(panel) {
|
|
379
|
+
return panel.type === MOSAIC_DASHBOARD_CHART_PANEL_TYPE;
|
|
380
|
+
}
|
|
381
|
+
export function getMosaicDashboardPanelId(dashboardId, panelId) {
|
|
382
|
+
return `dashboard:${dashboardId}:panel:${panelId}`;
|
|
115
383
|
}
|
|
116
|
-
export function
|
|
117
|
-
return `dashboard:${dashboardId}:
|
|
384
|
+
export function getMosaicDashboardDockId(dashboardId) {
|
|
385
|
+
return `dashboard:${dashboardId}:dock`;
|
|
386
|
+
}
|
|
387
|
+
export function getMosaicDashboardGridId(dashboardId) {
|
|
388
|
+
return `dashboard:${dashboardId}:grid`;
|
|
118
389
|
}
|
|
119
390
|
export function getMosaicDashboardSelectionName(dashboardId) {
|
|
120
391
|
return `dashboard:${dashboardId}:brush`;
|
|
121
392
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
393
|
+
function destroyDashboardRuntimeChart(chart) {
|
|
394
|
+
if (!chart)
|
|
395
|
+
return;
|
|
396
|
+
destroyRetainedVgPlotChart(chart);
|
|
397
|
+
}
|
|
398
|
+
function evictDashboardSelection(state, dashboardId) {
|
|
399
|
+
state.mosaic.selections[getMosaicDashboardSelectionName(dashboardId)]?.reset();
|
|
400
|
+
}
|
|
401
|
+
function shouldEvictPanelRuntimeForPatch(panel, patch) {
|
|
402
|
+
if (patch.type && patch.type !== panel.type) {
|
|
403
|
+
return true;
|
|
404
|
+
}
|
|
405
|
+
if (panel.type === MOSAIC_DASHBOARD_CHART_PANEL_TYPE) {
|
|
406
|
+
return Boolean('config' in patch && patch.config);
|
|
407
|
+
}
|
|
408
|
+
return false;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Type guard to check if a panel config has a source property.
|
|
412
|
+
* All standard panel types (Chart, Profiler, Text) have optional sources.
|
|
413
|
+
*/
|
|
414
|
+
export function panelHasSource(panel) {
|
|
415
|
+
return (panel.type === MOSAIC_DASHBOARD_CHART_PANEL_TYPE ||
|
|
416
|
+
panel.type === MOSAIC_DASHBOARD_PROFILER_PANEL_TYPE ||
|
|
417
|
+
panel.type === MOSAIC_DASHBOARD_TEXT_PANEL_TYPE);
|
|
418
|
+
}
|
|
419
|
+
export function resolveMosaicDashboardPanelSource(dashboard, panel) {
|
|
420
|
+
if (!panelHasSource(panel)) {
|
|
421
|
+
return undefined;
|
|
422
|
+
}
|
|
423
|
+
if (panel.source?.sqlQuery || panel.source?.tableName) {
|
|
424
|
+
return panel.source;
|
|
425
|
+
}
|
|
426
|
+
// Text panels typically don't need a table source
|
|
427
|
+
if (panel.type === MOSAIC_DASHBOARD_TEXT_PANEL_TYPE) {
|
|
428
|
+
return undefined;
|
|
429
|
+
}
|
|
430
|
+
return dashboard.selectedTable
|
|
431
|
+
? { tableName: dashboard.selectedTable }
|
|
432
|
+
: undefined;
|
|
125
433
|
}
|
|
126
434
|
export function createDefaultMosaicDashboardConfig(props) {
|
|
127
435
|
return MosaicDashboardSliceConfig.parse({
|
|
@@ -133,12 +441,18 @@ export function createMosaicDashboardSlice(props = {}) {
|
|
|
133
441
|
return createSlice((set, get) => ({
|
|
134
442
|
mosaicDashboard: {
|
|
135
443
|
config: createDefaultMosaicDashboardConfig(props.config),
|
|
136
|
-
|
|
444
|
+
runtime: {
|
|
445
|
+
retainedChartsByPanelId: {},
|
|
446
|
+
},
|
|
447
|
+
chartTypes: props.chartTypes,
|
|
448
|
+
addPanelActions: props.addPanelActions ?? [],
|
|
449
|
+
panelRenderers: props.panelRenderers ?? {},
|
|
450
|
+
createDashboard(title, layoutType) {
|
|
137
451
|
const dashboardId = createId();
|
|
138
|
-
get().mosaicDashboard.ensureDashboard(dashboardId, title);
|
|
452
|
+
get().mosaicDashboard.ensureDashboard(dashboardId, title, layoutType);
|
|
139
453
|
return dashboardId;
|
|
140
454
|
},
|
|
141
|
-
ensureDashboard(dashboardId, title) {
|
|
455
|
+
ensureDashboard(dashboardId, title, layoutType) {
|
|
142
456
|
set((state) => produce(state, (draft) => {
|
|
143
457
|
const existing = draft.mosaicDashboard.config.dashboardsById[dashboardId];
|
|
144
458
|
if (existing) {
|
|
@@ -151,14 +465,20 @@ export function createMosaicDashboardSlice(props = {}) {
|
|
|
151
465
|
draft.mosaicDashboard.config.dashboardsById[dashboardId] = {
|
|
152
466
|
id: dashboardId,
|
|
153
467
|
title: title ?? 'Dashboard',
|
|
468
|
+
layoutType: layoutType ?? 'dock',
|
|
154
469
|
selectedTable: undefined,
|
|
155
|
-
|
|
156
|
-
layout:
|
|
470
|
+
panels: [],
|
|
471
|
+
layout: layoutType === 'grid'
|
|
472
|
+
? createDashboardGridLayout(dashboardId)
|
|
473
|
+
: null,
|
|
157
474
|
updatedAt: Date.now(),
|
|
158
475
|
};
|
|
159
476
|
}));
|
|
160
477
|
},
|
|
161
478
|
removeDashboard(dashboardId) {
|
|
479
|
+
get().mosaicDashboard.evictDashboardRuntime(dashboardId, {
|
|
480
|
+
resetSelection: true,
|
|
481
|
+
});
|
|
162
482
|
set((state) => produce(state, (draft) => {
|
|
163
483
|
delete draft.mosaicDashboard.config.dashboardsById[dashboardId];
|
|
164
484
|
}));
|
|
@@ -166,6 +486,11 @@ export function createMosaicDashboardSlice(props = {}) {
|
|
|
166
486
|
getDashboard(dashboardId) {
|
|
167
487
|
return get().mosaicDashboard.config.dashboardsById[dashboardId];
|
|
168
488
|
},
|
|
489
|
+
setConfig(config) {
|
|
490
|
+
set((state) => produce(state, (draft) => {
|
|
491
|
+
draft.mosaicDashboard.config = config;
|
|
492
|
+
}));
|
|
493
|
+
},
|
|
169
494
|
setSelectedTable(dashboardId, tableName) {
|
|
170
495
|
get().mosaicDashboard.ensureDashboard(dashboardId);
|
|
171
496
|
set((state) => produce(state, (draft) => {
|
|
@@ -176,48 +501,155 @@ export function createMosaicDashboardSlice(props = {}) {
|
|
|
176
501
|
dashboard.updatedAt = Date.now();
|
|
177
502
|
}));
|
|
178
503
|
},
|
|
179
|
-
|
|
504
|
+
registerPanelRenderer(type, renderer) {
|
|
505
|
+
set((state) => produce(state, (draft) => {
|
|
506
|
+
draft.mosaicDashboard.panelRenderers[type] = renderer;
|
|
507
|
+
}));
|
|
508
|
+
},
|
|
509
|
+
unregisterPanelRenderer(type) {
|
|
510
|
+
set((state) => produce(state, (draft) => {
|
|
511
|
+
delete draft.mosaicDashboard.panelRenderers[type];
|
|
512
|
+
}));
|
|
513
|
+
},
|
|
514
|
+
addPanel(dashboardId, panel) {
|
|
180
515
|
get().mosaicDashboard.ensureDashboard(dashboardId);
|
|
181
516
|
set((state) => produce(state, (draft) => {
|
|
182
517
|
const dashboard = draft.mosaicDashboard.config.dashboardsById[dashboardId];
|
|
183
518
|
if (!dashboard)
|
|
184
519
|
return;
|
|
185
|
-
dashboard.
|
|
186
|
-
|
|
520
|
+
dashboard.panels.push(panel);
|
|
521
|
+
const panelNode = createDashboardPanelNode(dashboardId, panel.id);
|
|
522
|
+
const panelTypesByLayoutId = getDashboardPanelTypesByLayoutId(dashboardId, dashboard.panels);
|
|
523
|
+
dashboard.layout =
|
|
524
|
+
dashboard.layoutType === 'grid'
|
|
525
|
+
? appendPanelToGridLayout(dashboard.layout, dashboardId, panelNode, panel.type, panelTypesByLayoutId)
|
|
526
|
+
: appendPanelToLayout(dashboard.layout, panelNode);
|
|
187
527
|
dashboard.updatedAt = Date.now();
|
|
188
528
|
}));
|
|
189
|
-
return
|
|
529
|
+
return panel.id;
|
|
190
530
|
},
|
|
191
|
-
|
|
531
|
+
updatePanel(dashboardId, panelId, patch) {
|
|
532
|
+
const existing = get().mosaicDashboard.config.dashboardsById[dashboardId]?.panels.find((candidate) => candidate.id === panelId);
|
|
533
|
+
const shouldEvict = existing
|
|
534
|
+
? shouldEvictPanelRuntimeForPatch(existing, patch)
|
|
535
|
+
: false;
|
|
192
536
|
set((state) => produce(state, (draft) => {
|
|
193
537
|
const dashboard = draft.mosaicDashboard.config.dashboardsById[dashboardId];
|
|
194
538
|
if (!dashboard)
|
|
195
539
|
return;
|
|
196
|
-
const
|
|
197
|
-
if (!
|
|
540
|
+
const panel = dashboard.panels.find((candidate) => candidate.id === panelId);
|
|
541
|
+
if (!panel)
|
|
198
542
|
return;
|
|
199
|
-
Object.assign(
|
|
543
|
+
Object.assign(panel, patch);
|
|
200
544
|
dashboard.updatedAt = Date.now();
|
|
201
545
|
}));
|
|
546
|
+
if (shouldEvict) {
|
|
547
|
+
get().mosaicDashboard.evictPanelRuntime(dashboardId, panelId);
|
|
548
|
+
}
|
|
202
549
|
},
|
|
203
|
-
|
|
550
|
+
removePanel(dashboardId, panelId) {
|
|
551
|
+
get().mosaicDashboard.evictPanelRuntime(dashboardId, panelId);
|
|
204
552
|
set((state) => produce(state, (draft) => {
|
|
205
553
|
const dashboard = draft.mosaicDashboard.config.dashboardsById[dashboardId];
|
|
206
554
|
if (!dashboard)
|
|
207
555
|
return;
|
|
208
|
-
dashboard.
|
|
209
|
-
dashboard.layout = removePanelFromLayout(dashboard.layout, getMosaicDashboardPanelId(dashboardId,
|
|
556
|
+
dashboard.panels = dashboard.panels.filter((panel) => panel.id !== panelId);
|
|
557
|
+
dashboard.layout = removePanelFromLayout(dashboard.layout, getMosaicDashboardPanelId(dashboardId, panelId));
|
|
210
558
|
dashboard.updatedAt = Date.now();
|
|
211
559
|
}));
|
|
212
560
|
},
|
|
561
|
+
getRetainedChart(dashboardId, panelId) {
|
|
562
|
+
return get().mosaicDashboard.runtime.retainedChartsByPanelId[getMosaicDashboardPanelId(dashboardId, panelId)];
|
|
563
|
+
},
|
|
564
|
+
setRetainedChart(dashboardId, panelId, chart) {
|
|
565
|
+
const runtimePanelId = getMosaicDashboardPanelId(dashboardId, panelId);
|
|
566
|
+
const previous = get().mosaicDashboard.runtime.retainedChartsByPanelId[runtimePanelId];
|
|
567
|
+
if (previous && previous !== chart) {
|
|
568
|
+
destroyDashboardRuntimeChart(previous);
|
|
569
|
+
}
|
|
570
|
+
set((state) => ({
|
|
571
|
+
mosaicDashboard: {
|
|
572
|
+
...state.mosaicDashboard,
|
|
573
|
+
runtime: {
|
|
574
|
+
...state.mosaicDashboard.runtime,
|
|
575
|
+
retainedChartsByPanelId: {
|
|
576
|
+
...state.mosaicDashboard.runtime.retainedChartsByPanelId,
|
|
577
|
+
[runtimePanelId]: chart,
|
|
578
|
+
},
|
|
579
|
+
},
|
|
580
|
+
},
|
|
581
|
+
}));
|
|
582
|
+
},
|
|
583
|
+
evictPanelRuntime(dashboardId, panelId) {
|
|
584
|
+
const runtimePanelId = getMosaicDashboardPanelId(dashboardId, panelId);
|
|
585
|
+
const existing = get().mosaicDashboard.runtime.retainedChartsByPanelId[runtimePanelId];
|
|
586
|
+
destroyDashboardRuntimeChart(existing);
|
|
587
|
+
set((state) => {
|
|
588
|
+
const nextRetainedChartsByPanelId = {
|
|
589
|
+
...state.mosaicDashboard.runtime.retainedChartsByPanelId,
|
|
590
|
+
};
|
|
591
|
+
delete nextRetainedChartsByPanelId[runtimePanelId];
|
|
592
|
+
return {
|
|
593
|
+
mosaicDashboard: {
|
|
594
|
+
...state.mosaicDashboard,
|
|
595
|
+
runtime: {
|
|
596
|
+
...state.mosaicDashboard.runtime,
|
|
597
|
+
retainedChartsByPanelId: nextRetainedChartsByPanelId,
|
|
598
|
+
},
|
|
599
|
+
},
|
|
600
|
+
};
|
|
601
|
+
});
|
|
602
|
+
},
|
|
603
|
+
evictDashboardRuntime(dashboardId, options) {
|
|
604
|
+
const runtimePrefix = `dashboard:${dashboardId}:panel:`;
|
|
605
|
+
const existingEntries = Object.entries(get().mosaicDashboard.runtime.retainedChartsByPanelId).filter(([runtimePanelId]) => runtimePanelId.startsWith(runtimePrefix));
|
|
606
|
+
existingEntries.forEach(([, chart]) => {
|
|
607
|
+
destroyDashboardRuntimeChart(chart);
|
|
608
|
+
});
|
|
609
|
+
if (options?.resetSelection) {
|
|
610
|
+
evictDashboardSelection(get(), dashboardId);
|
|
611
|
+
}
|
|
612
|
+
set((state) => {
|
|
613
|
+
const nextRetainedChartsByPanelId = {
|
|
614
|
+
...state.mosaicDashboard.runtime.retainedChartsByPanelId,
|
|
615
|
+
};
|
|
616
|
+
for (const [runtimePanelId] of existingEntries) {
|
|
617
|
+
delete nextRetainedChartsByPanelId[runtimePanelId];
|
|
618
|
+
}
|
|
619
|
+
return {
|
|
620
|
+
mosaicDashboard: {
|
|
621
|
+
...state.mosaicDashboard,
|
|
622
|
+
runtime: {
|
|
623
|
+
...state.mosaicDashboard.runtime,
|
|
624
|
+
retainedChartsByPanelId: nextRetainedChartsByPanelId,
|
|
625
|
+
},
|
|
626
|
+
},
|
|
627
|
+
};
|
|
628
|
+
});
|
|
629
|
+
},
|
|
630
|
+
clearAllDashboardRuntime() {
|
|
631
|
+
Object.values(get().mosaicDashboard.runtime.retainedChartsByPanelId).forEach((chart) => {
|
|
632
|
+
destroyDashboardRuntimeChart(chart);
|
|
633
|
+
});
|
|
634
|
+
set((state) => ({
|
|
635
|
+
mosaicDashboard: {
|
|
636
|
+
...state.mosaicDashboard,
|
|
637
|
+
runtime: {
|
|
638
|
+
...state.mosaicDashboard.runtime,
|
|
639
|
+
retainedChartsByPanelId: {},
|
|
640
|
+
},
|
|
641
|
+
},
|
|
642
|
+
}));
|
|
643
|
+
},
|
|
213
644
|
setLayout(dashboardId, layout) {
|
|
214
645
|
get().mosaicDashboard.ensureDashboard(dashboardId);
|
|
215
646
|
set((state) => produce(state, (draft) => {
|
|
216
647
|
const dashboard = draft.mosaicDashboard.config.dashboardsById[dashboardId];
|
|
217
648
|
if (!dashboard)
|
|
218
649
|
return;
|
|
219
|
-
const
|
|
220
|
-
|
|
650
|
+
const panelIds = dashboard.panels.map((panel) => panel.id);
|
|
651
|
+
const panelTypesByLayoutId = getDashboardPanelTypesByLayoutId(dashboardId, dashboard.panels);
|
|
652
|
+
dashboard.layout = ensureLayoutContainsDashboardPanels(layout, dashboardId, panelIds, dashboard.layoutType, panelTypesByLayoutId);
|
|
221
653
|
dashboard.updatedAt = Date.now();
|
|
222
654
|
}));
|
|
223
655
|
},
|