@sqlrooms/mosaic 0.29.0-rc.5 → 0.29.0-rc.6
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 +43 -39
- package/dist/DataPointLimitError.d.ts +9 -0
- package/dist/DataPointLimitError.d.ts.map +1 -0
- package/dist/DataPointLimitError.js +14 -0
- package/dist/DataPointLimitError.js.map +1 -0
- package/dist/MosaicSlice.d.ts.map +1 -1
- package/dist/MosaicSlice.js +3 -3
- package/dist/MosaicSlice.js.map +1 -1
- package/dist/VgPlotChart.d.ts +8 -11
- package/dist/VgPlotChart.d.ts.map +1 -1
- package/dist/VgPlotChart.js +74 -90
- package/dist/VgPlotChart.js.map +1 -1
- package/dist/VgPlotChartError.d.ts +7 -0
- package/dist/VgPlotChartError.d.ts.map +1 -0
- package/dist/VgPlotChartError.js +9 -0
- package/dist/VgPlotChartError.js.map +1 -0
- package/dist/ai.d.ts +103 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +445 -0
- package/dist/ai.js.map +1 -0
- package/dist/boxplot/BoxPlotClient.d.ts +7 -0
- package/dist/boxplot/BoxPlotClient.d.ts.map +1 -1
- package/dist/boxplot/BoxPlotClient.js +22 -0
- package/dist/boxplot/BoxPlotClient.js.map +1 -1
- package/dist/chart/ChartRuntimeIssuePanel.d.ts +7 -0
- package/dist/chart/ChartRuntimeIssuePanel.d.ts.map +1 -0
- package/dist/chart/ChartRuntimeIssuePanel.js +10 -0
- package/dist/chart/ChartRuntimeIssuePanel.js.map +1 -0
- package/dist/chart/MosaicDashboardChart.d.ts +1 -1
- package/dist/chart/MosaicDashboardChart.d.ts.map +1 -1
- package/dist/chart/MosaicDashboardChart.js +1 -1
- package/dist/chart/MosaicDashboardChart.js.map +1 -1
- package/dist/chart/MosaicDashboardChartContent.d.ts +1 -1
- package/dist/chart/MosaicDashboardChartContent.d.ts.map +1 -1
- package/dist/chart/MosaicDashboardChartContent.js +29 -2
- package/dist/chart/MosaicDashboardChartContent.js.map +1 -1
- package/dist/chart/MosaicDashboardChartRenderer.d.ts +2 -1
- package/dist/chart/MosaicDashboardChartRenderer.d.ts.map +1 -1
- package/dist/chart/MosaicDashboardChartRenderer.js +2 -2
- package/dist/chart/MosaicDashboardChartRenderer.js.map +1 -1
- package/dist/chart/MosaicDashboardComponentChart.d.ts +5 -1
- package/dist/chart/MosaicDashboardComponentChart.d.ts.map +1 -1
- package/dist/chart/MosaicDashboardComponentChart.js +4 -1
- package/dist/chart/MosaicDashboardComponentChart.js.map +1 -1
- package/dist/chart/MosaicDashboardVgPlotChart.d.ts +4 -0
- package/dist/chart/MosaicDashboardVgPlotChart.d.ts.map +1 -1
- package/dist/chart/MosaicDashboardVgPlotChart.js +2 -2
- package/dist/chart/MosaicDashboardVgPlotChart.js.map +1 -1
- package/dist/chart/addChartPanelAction.d.ts +3 -0
- package/dist/chart/addChartPanelAction.d.ts.map +1 -0
- package/dist/chart/addChartPanelAction.js +14 -0
- package/dist/chart/addChartPanelAction.js.map +1 -0
- package/dist/chart/chart-settings/ChartSettings.d.ts.map +1 -1
- package/dist/chart/chart-settings/ChartSettings.js +7 -4
- package/dist/chart/chart-settings/ChartSettings.js.map +1 -1
- package/dist/chart/chart-settings/ChartSettingsContent.d.ts +1 -1
- package/dist/chart/chart-settings/ChartSettingsContent.d.ts.map +1 -1
- package/dist/chart/chart-settings/ChartSettingsContent.js.map +1 -1
- package/dist/chart/chart-settings/ChartSettingsContext.d.ts +0 -2
- package/dist/chart/chart-settings/ChartSettingsContext.d.ts.map +1 -1
- package/dist/chart/chart-settings/ChartSettingsContext.js +6 -7
- package/dist/chart/chart-settings/ChartSettingsContext.js.map +1 -1
- package/dist/chart/chart-settings/ChartSettingsPanel.d.ts +1 -1
- package/dist/chart/chart-settings/ChartSettingsPanel.d.ts.map +1 -1
- package/dist/chart/chart-settings/ChartSettingsPanel.js +1 -1
- package/dist/chart/chart-settings/ChartSettingsPanel.js.map +1 -1
- package/dist/chart/chart-settings/ChartTypeSelector.d.ts.map +1 -1
- package/dist/chart/chart-settings/ChartTypeSelector.js +5 -5
- package/dist/chart/chart-settings/ChartTypeSelector.js.map +1 -1
- package/dist/chart-builders/ColumnSelector.d.ts +0 -2
- package/dist/chart-builders/ColumnSelector.d.ts.map +1 -1
- package/dist/chart-builders/ColumnSelector.js +4 -5
- package/dist/chart-builders/ColumnSelector.js.map +1 -1
- package/dist/chart-builders/ColumnsContext.d.ts +13 -0
- package/dist/chart-builders/ColumnsContext.d.ts.map +1 -0
- package/dist/chart-builders/ColumnsContext.js +15 -0
- package/dist/chart-builders/ColumnsContext.js.map +1 -0
- package/dist/chart-builders/MultiFieldSelector.js +4 -4
- package/dist/chart-builders/MultiFieldSelector.js.map +1 -1
- package/dist/chart-builders/TableSelector.d.ts +14 -0
- package/dist/chart-builders/TableSelector.d.ts.map +1 -0
- package/dist/chart-builders/TableSelector.js +23 -0
- package/dist/chart-builders/TableSelector.js.map +1 -0
- package/dist/chart-runtime.d.ts +50 -0
- package/dist/chart-runtime.d.ts.map +1 -0
- package/dist/chart-runtime.js +76 -0
- package/dist/chart-runtime.js.map +1 -0
- package/dist/chart-types/base-types.d.ts +45 -25
- package/dist/chart-types/base-types.d.ts.map +1 -1
- package/dist/chart-types/base-types.js.map +1 -1
- package/dist/chart-types/box-plot/definition.d.ts.map +1 -1
- package/dist/chart-types/box-plot/definition.js +5 -0
- package/dist/chart-types/box-plot/definition.js.map +1 -1
- package/dist/chart-types/box-plot/renderer/BoxPlotPanelRenderer.d.ts.map +1 -1
- package/dist/chart-types/box-plot/renderer/BoxPlotPanelRenderer.js +4 -1
- package/dist/chart-types/box-plot/renderer/BoxPlotPanelRenderer.js.map +1 -1
- package/dist/chart-types/box-plot/renderer/useBoxPlotClient.d.ts +4 -0
- package/dist/chart-types/box-plot/renderer/useBoxPlotClient.d.ts.map +1 -1
- package/dist/chart-types/box-plot/renderer/useBoxPlotClient.js +13 -2
- package/dist/chart-types/box-plot/renderer/useBoxPlotClient.js.map +1 -1
- package/dist/chart-types/box-plot/schema.d.ts +5 -0
- package/dist/chart-types/box-plot/schema.d.ts.map +1 -1
- package/dist/chart-types/box-plot/schema.js +2 -0
- package/dist/chart-types/box-plot/schema.js.map +1 -1
- package/dist/chart-types/box-plot/tool.d.ts +5 -9
- package/dist/chart-types/box-plot/tool.d.ts.map +1 -1
- package/dist/chart-types/box-plot/tool.js +14 -6
- package/dist/chart-types/box-plot/tool.js.map +1 -1
- package/dist/chart-types/bubble-chart/definition.d.ts.map +1 -1
- package/dist/chart-types/bubble-chart/definition.js +5 -0
- package/dist/chart-types/bubble-chart/definition.js.map +1 -1
- package/dist/chart-types/bubble-chart/schema.d.ts +5 -0
- package/dist/chart-types/bubble-chart/schema.d.ts.map +1 -1
- package/dist/chart-types/bubble-chart/schema.js +2 -0
- package/dist/chart-types/bubble-chart/schema.js.map +1 -1
- package/dist/chart-types/bubble-chart/tool.d.ts +5 -9
- package/dist/chart-types/bubble-chart/tool.d.ts.map +1 -1
- package/dist/chart-types/bubble-chart/tool.js +17 -9
- package/dist/chart-types/bubble-chart/tool.js.map +1 -1
- package/dist/chart-types/chart-config.d.ts +46 -0
- package/dist/chart-types/chart-config.d.ts.map +1 -1
- package/dist/chart-types/chart-config.js +2 -0
- package/dist/chart-types/chart-config.js.map +1 -1
- package/dist/chart-types/count-plot/schema.d.ts +5 -0
- package/dist/chart-types/count-plot/schema.d.ts.map +1 -1
- package/dist/chart-types/count-plot/schema.js +2 -0
- package/dist/chart-types/count-plot/schema.js.map +1 -1
- package/dist/chart-types/count-plot/tool.d.ts +5 -9
- package/dist/chart-types/count-plot/tool.d.ts.map +1 -1
- package/dist/chart-types/count-plot/tool.js +14 -6
- package/dist/chart-types/count-plot/tool.js.map +1 -1
- package/dist/chart-types/custom-spec/definition.d.ts.map +1 -1
- package/dist/chart-types/custom-spec/definition.js +5 -0
- package/dist/chart-types/custom-spec/definition.js.map +1 -1
- package/dist/chart-types/custom-spec/schema.d.ts +5 -0
- package/dist/chart-types/custom-spec/schema.d.ts.map +1 -1
- package/dist/chart-types/custom-spec/schema.js +2 -0
- package/dist/chart-types/custom-spec/schema.js.map +1 -1
- package/dist/chart-types/data-policy-schema.d.ts +8 -0
- package/dist/chart-types/data-policy-schema.d.ts.map +1 -0
- package/dist/chart-types/data-policy-schema.js +7 -0
- package/dist/chart-types/data-policy-schema.js.map +1 -0
- package/dist/chart-types/heatmap/schema.d.ts +5 -0
- package/dist/chart-types/heatmap/schema.d.ts.map +1 -1
- package/dist/chart-types/heatmap/schema.js +2 -0
- package/dist/chart-types/heatmap/schema.js.map +1 -1
- package/dist/chart-types/heatmap/tool.d.ts +5 -9
- package/dist/chart-types/heatmap/tool.d.ts.map +1 -1
- package/dist/chart-types/heatmap/tool.js +16 -8
- package/dist/chart-types/heatmap/tool.js.map +1 -1
- package/dist/chart-types/histogram/HistogramSettings.d.ts.map +1 -1
- package/dist/chart-types/histogram/HistogramSettings.js +4 -2
- package/dist/chart-types/histogram/HistogramSettings.js.map +1 -1
- package/dist/chart-types/histogram/schema.d.ts +10 -0
- package/dist/chart-types/histogram/schema.d.ts.map +1 -1
- package/dist/chart-types/histogram/schema.js +13 -0
- package/dist/chart-types/histogram/schema.js.map +1 -1
- package/dist/chart-types/histogram/spec.d.ts +1 -1
- package/dist/chart-types/histogram/spec.d.ts.map +1 -1
- package/dist/chart-types/histogram/spec.js +4 -3
- package/dist/chart-types/histogram/spec.js.map +1 -1
- package/dist/chart-types/histogram/tool.d.ts +7 -9
- package/dist/chart-types/histogram/tool.d.ts.map +1 -1
- package/dist/chart-types/histogram/tool.js +17 -7
- package/dist/chart-types/histogram/tool.js.map +1 -1
- package/dist/chart-types/index.d.ts +45 -3
- package/dist/chart-types/index.d.ts.map +1 -1
- package/dist/chart-types/index.js +8 -2
- package/dist/chart-types/index.js.map +1 -1
- package/dist/chart-types/line-chart/LineChartSettings.d.ts.map +1 -1
- package/dist/chart-types/line-chart/LineChartSettings.js +3 -1
- package/dist/chart-types/line-chart/LineChartSettings.js.map +1 -1
- package/dist/chart-types/line-chart/definition.d.ts.map +1 -1
- package/dist/chart-types/line-chart/definition.js +7 -0
- package/dist/chart-types/line-chart/definition.js.map +1 -1
- package/dist/chart-types/line-chart/schema.d.ts +5 -0
- package/dist/chart-types/line-chart/schema.d.ts.map +1 -1
- package/dist/chart-types/line-chart/schema.js +2 -0
- package/dist/chart-types/line-chart/schema.js.map +1 -1
- package/dist/chart-types/line-chart/tool.d.ts +5 -9
- package/dist/chart-types/line-chart/tool.d.ts.map +1 -1
- package/dist/chart-types/line-chart/tool.js +16 -8
- package/dist/chart-types/line-chart/tool.js.map +1 -1
- package/dist/chart-types/list-panels-tool.d.ts +35 -0
- package/dist/chart-types/list-panels-tool.d.ts.map +1 -0
- package/dist/chart-types/list-panels-tool.js +66 -0
- package/dist/chart-types/list-panels-tool.js.map +1 -0
- package/dist/chart-types/profiler-tool.d.ts +40 -0
- package/dist/chart-types/profiler-tool.d.ts.map +1 -0
- package/dist/chart-types/profiler-tool.js +73 -0
- package/dist/chart-types/profiler-tool.js.map +1 -0
- package/dist/chart-types/remove-panel-tool.d.ts +31 -0
- package/dist/chart-types/remove-panel-tool.d.ts.map +1 -0
- package/dist/chart-types/remove-panel-tool.js +55 -0
- package/dist/chart-types/remove-panel-tool.js.map +1 -0
- package/dist/chart-types/text-panel-tool.d.ts +42 -0
- package/dist/chart-types/text-panel-tool.d.ts.map +1 -0
- package/dist/chart-types/text-panel-tool.js +71 -0
- package/dist/chart-types/text-panel-tool.js.map +1 -0
- package/dist/chart-types/tool-helpers.d.ts +44 -0
- package/dist/chart-types/tool-helpers.d.ts.map +1 -0
- package/dist/chart-types/tool-helpers.js +129 -0
- package/dist/chart-types/tool-helpers.js.map +1 -0
- package/dist/chart-types/tool-schemas.d.ts +1 -0
- package/dist/chart-types/tool-schemas.d.ts.map +1 -1
- package/dist/chart-types/tool-schemas.js +5 -1
- package/dist/chart-types/tool-schemas.js.map +1 -1
- package/dist/dashboard/MosaicDashboard.d.ts +5 -2
- package/dist/dashboard/MosaicDashboard.d.ts.map +1 -1
- package/dist/dashboard/MosaicDashboard.js +20 -39
- package/dist/dashboard/MosaicDashboard.js.map +1 -1
- package/dist/dashboard/MosaicDashboardContext.d.ts +2 -0
- package/dist/dashboard/MosaicDashboardContext.d.ts.map +1 -1
- package/dist/dashboard/MosaicDashboardContext.js.map +1 -1
- package/dist/dashboard/MosaicDashboardEmptyState.d.ts.map +1 -1
- package/dist/dashboard/MosaicDashboardEmptyState.js +8 -44
- package/dist/dashboard/MosaicDashboardEmptyState.js.map +1 -1
- package/dist/dashboard/MosaicDashboardPanel.d.ts.map +1 -1
- package/dist/dashboard/MosaicDashboardPanel.js +2 -5
- package/dist/dashboard/MosaicDashboardPanel.js.map +1 -1
- package/dist/dashboard/MosaicDashboardPanelHeader.d.ts +2 -2
- package/dist/dashboard/MosaicDashboardPanelHeader.d.ts.map +1 -1
- package/dist/dashboard/MosaicDashboardPanelHeader.js +2 -2
- package/dist/dashboard/MosaicDashboardPanelHeader.js.map +1 -1
- package/dist/dashboard/MosaicDashboardPanels.d.ts.map +1 -1
- package/dist/dashboard/MosaicDashboardPanels.js +3 -2
- package/dist/dashboard/MosaicDashboardPanels.js.map +1 -1
- package/dist/dashboard/MosaicDashboardSlice.d.ts +185 -107
- package/dist/dashboard/MosaicDashboardSlice.d.ts.map +1 -1
- package/dist/dashboard/MosaicDashboardSlice.js +80 -57
- package/dist/dashboard/MosaicDashboardSlice.js.map +1 -1
- package/dist/dashboard/action-types.d.ts +25 -0
- package/dist/dashboard/action-types.d.ts.map +1 -0
- package/dist/dashboard/action-types.js +5 -0
- package/dist/dashboard/action-types.js.map +1 -0
- package/dist/dashboard/core-types.d.ts +26 -0
- package/dist/dashboard/core-types.d.ts.map +1 -0
- package/dist/dashboard/core-types.js +21 -0
- package/dist/dashboard/core-types.js.map +1 -0
- package/dist/dashboard/dashboard-types.d.ts +491 -0
- package/dist/dashboard/dashboard-types.d.ts.map +1 -0
- package/dist/dashboard/dashboard-types.js +54 -0
- package/dist/dashboard/dashboard-types.js.map +1 -0
- package/dist/dashboard/defaultPanelActions.d.ts +3 -0
- package/dist/dashboard/defaultPanelActions.d.ts.map +1 -0
- package/dist/dashboard/defaultPanelActions.js +9 -0
- package/dist/dashboard/defaultPanelActions.js.map +1 -0
- package/dist/dashboard/defaultPanelRenderers.d.ts.map +1 -1
- package/dist/dashboard/defaultPanelRenderers.js +1 -1
- package/dist/dashboard/defaultPanelRenderers.js.map +1 -1
- package/dist/dashboard/initial-state/BuildDashboardManuallyPanel.d.ts +6 -0
- package/dist/dashboard/initial-state/BuildDashboardManuallyPanel.d.ts.map +1 -0
- package/dist/dashboard/initial-state/BuildDashboardManuallyPanel.js +46 -0
- package/dist/dashboard/initial-state/BuildDashboardManuallyPanel.js.map +1 -0
- package/dist/dashboard/initial-state/BuildDashboardWithAIPanel.d.ts +7 -0
- package/dist/dashboard/initial-state/BuildDashboardWithAIPanel.d.ts.map +1 -0
- package/dist/dashboard/initial-state/BuildDashboardWithAIPanel.js +29 -0
- package/dist/dashboard/initial-state/BuildDashboardWithAIPanel.js.map +1 -0
- package/dist/dashboard/initial-state/MosaicDashboardInitialState.d.ts +6 -0
- package/dist/dashboard/initial-state/MosaicDashboardInitialState.d.ts.map +1 -0
- package/dist/dashboard/initial-state/MosaicDashboardInitialState.js +9 -0
- package/dist/dashboard/initial-state/MosaicDashboardInitialState.js.map +1 -0
- package/dist/dashboard/toolbar/MosaicDashboardAddPanelDropdown.d.ts +7 -0
- package/dist/dashboard/toolbar/MosaicDashboardAddPanelDropdown.d.ts.map +1 -0
- package/dist/dashboard/toolbar/MosaicDashboardAddPanelDropdown.js +12 -0
- package/dist/dashboard/toolbar/MosaicDashboardAddPanelDropdown.js.map +1 -0
- package/dist/dashboard/toolbar/MosaicDashboardResetFiltersButton.d.ts +7 -0
- package/dist/dashboard/toolbar/MosaicDashboardResetFiltersButton.d.ts.map +1 -0
- package/dist/dashboard/toolbar/MosaicDashboardResetFiltersButton.js +36 -0
- package/dist/dashboard/toolbar/MosaicDashboardResetFiltersButton.js.map +1 -0
- package/dist/dashboard/toolbar/MosaicDashboardToolbar.d.ts.map +1 -0
- package/dist/dashboard/toolbar/MosaicDashboardToolbar.js +15 -0
- package/dist/dashboard/toolbar/MosaicDashboardToolbar.js.map +1 -0
- package/dist/dashboard/useAddPanelActions.d.ts +10 -0
- package/dist/dashboard/useAddPanelActions.d.ts.map +1 -0
- package/dist/dashboard/useAddPanelActions.js +26 -0
- package/dist/dashboard/useAddPanelActions.js.map +1 -0
- package/dist/dashboard/useMosaicDashboardAddPanelActionContext.d.ts +3 -0
- package/dist/dashboard/useMosaicDashboardAddPanelActionContext.d.ts.map +1 -0
- package/dist/dashboard/useMosaicDashboardAddPanelActionContext.js +18 -0
- package/dist/dashboard/useMosaicDashboardAddPanelActionContext.js.map +1 -0
- package/dist/dashboard/useSelectedOrFirstTable.d.ts +10 -0
- package/dist/dashboard/useSelectedOrFirstTable.d.ts.map +1 -0
- package/dist/dashboard/useSelectedOrFirstTable.js +25 -0
- package/dist/dashboard/useSelectedOrFirstTable.js.map +1 -0
- package/dist/dashboard/useTablesWithColumns.d.ts +9 -0
- package/dist/dashboard/useTablesWithColumns.d.ts.map +1 -0
- package/dist/dashboard/useTablesWithColumns.js +13 -0
- package/dist/dashboard/useTablesWithColumns.js.map +1 -0
- package/dist/index.d.ts +25 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/dist/profiler/MosaicDashboardProfilerPanelRenderer.d.ts +2 -1
- package/dist/profiler/MosaicDashboardProfilerPanelRenderer.d.ts.map +1 -1
- package/dist/profiler/MosaicDashboardProfilerPanelRenderer.js +3 -3
- package/dist/profiler/MosaicDashboardProfilerPanelRenderer.js.map +1 -1
- package/dist/profiler/addProfilerPanelAction.d.ts +3 -0
- package/dist/profiler/addProfilerPanelAction.d.ts.map +1 -0
- package/dist/profiler/addProfilerPanelAction.js +9 -0
- package/dist/profiler/addProfilerPanelAction.js.map +1 -0
- package/dist/text/MosaicDashboardTextRenderer.d.ts +2 -1
- package/dist/text/MosaicDashboardTextRenderer.d.ts.map +1 -1
- package/dist/text/MosaicDashboardTextRenderer.js +4 -4
- package/dist/text/MosaicDashboardTextRenderer.js.map +1 -1
- package/dist/text/addTextPanelAction.d.ts +3 -0
- package/dist/text/addTextPanelAction.d.ts.map +1 -0
- package/dist/text/addTextPanelAction.js +9 -0
- package/dist/text/addTextPanelAction.js.map +1 -0
- package/dist/useMosaicClient.d.ts +4 -0
- package/dist/useMosaicClient.d.ts.map +1 -1
- package/dist/useMosaicClient.js +33 -3
- package/dist/useMosaicClient.js.map +1 -1
- package/dist/useVgPlotChartError.d.ts +13 -0
- package/dist/useVgPlotChartError.d.ts.map +1 -0
- package/dist/useVgPlotChartError.js +18 -0
- package/dist/useVgPlotChartError.js.map +1 -0
- package/dist/useVgPlotChartRender.d.ts +24 -0
- package/dist/useVgPlotChartRender.d.ts.map +1 -0
- package/dist/useVgPlotChartRender.js +152 -0
- package/dist/useVgPlotChartRender.js.map +1 -0
- package/dist/useVgPlotChartRetention.d.ts +21 -0
- package/dist/useVgPlotChartRetention.d.ts.map +1 -0
- package/dist/useVgPlotChartRetention.js +63 -0
- package/dist/useVgPlotChartRetention.js.map +1 -0
- package/dist/wrapCoordinatorWithValidation.d.ts +11 -0
- package/dist/wrapCoordinatorWithValidation.d.ts.map +1 -0
- package/dist/wrapCoordinatorWithValidation.js +23 -0
- package/dist/wrapCoordinatorWithValidation.js.map +1 -0
- package/package.json +31 -13
- package/dist/dashboard/MosaicDashboardToolbar.d.ts.map +0 -1
- package/dist/dashboard/MosaicDashboardToolbar.js +0 -86
- package/dist/dashboard/MosaicDashboardToolbar.js.map +0 -1
- /package/dist/dashboard/{MosaicDashboardToolbar.d.ts → toolbar/MosaicDashboardToolbar.d.ts} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare const DEFAULT_CHART_MAX_DATA_POINTS = 10000;
|
|
2
|
+
export type ChartDataPolicy = {
|
|
3
|
+
/**
|
|
4
|
+
* Disable runtime row-count validation for charts whose query result size
|
|
5
|
+
* does not correspond to rendered data points.
|
|
6
|
+
*/
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/** Maximum allowed result rows for this chart's runtime query results. */
|
|
9
|
+
maxRows?: number;
|
|
10
|
+
/** Short explanation shown to users and assistants when the policy trips. */
|
|
11
|
+
reason?: string;
|
|
12
|
+
/** Optional custom size estimator for renderer-specific result shapes. */
|
|
13
|
+
getResultSize?: (result: unknown) => number;
|
|
14
|
+
};
|
|
15
|
+
export type ChartDataPolicyOverride = {
|
|
16
|
+
/** Disable runtime row-count validation for this panel. */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Override the maximum allowed result rows for this panel. */
|
|
19
|
+
maxRows?: number;
|
|
20
|
+
/** Optional panel-specific explanation shown when the policy trips. */
|
|
21
|
+
reason?: string;
|
|
22
|
+
};
|
|
23
|
+
export type ChartDataPolicyContext<TConfig> = {
|
|
24
|
+
tableName: string;
|
|
25
|
+
config: TConfig;
|
|
26
|
+
};
|
|
27
|
+
export type ChartRuntimeIssueKind = 'too-much-data' | 'sql-error' | 'render-error';
|
|
28
|
+
export type ChartRuntimeIssue = {
|
|
29
|
+
kind: ChartRuntimeIssueKind;
|
|
30
|
+
panelId: string;
|
|
31
|
+
chartType: string;
|
|
32
|
+
message: string;
|
|
33
|
+
recoverable: boolean;
|
|
34
|
+
rowCount?: number;
|
|
35
|
+
limit?: number;
|
|
36
|
+
sql?: string;
|
|
37
|
+
};
|
|
38
|
+
export type ChartRuntimeIssueContext = {
|
|
39
|
+
panelId: string;
|
|
40
|
+
chartType: string;
|
|
41
|
+
};
|
|
42
|
+
export type ChartRuntimeIssueReporter = {
|
|
43
|
+
reportIssue: (issue: ChartRuntimeIssue) => void;
|
|
44
|
+
clearIssue: () => void;
|
|
45
|
+
};
|
|
46
|
+
export declare function getQueryResultRowCount(result: unknown): number;
|
|
47
|
+
export declare function assertChartDataPolicy(policy: ChartDataPolicy | null | undefined, result: unknown): void;
|
|
48
|
+
export declare function resolveChartDataPolicy(basePolicy: ChartDataPolicy | null | undefined, override: ChartDataPolicyOverride | null | undefined): ChartDataPolicy | null;
|
|
49
|
+
export declare function createChartRuntimeIssueFromError(error: unknown, context: ChartRuntimeIssueContext, policy?: ChartDataPolicy | null): ChartRuntimeIssue;
|
|
50
|
+
//# sourceMappingURL=chart-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-runtime.d.ts","sourceRoot":"","sources":["../src/chart-runtime.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAEpD,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,OAAO,IAAI;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAC7B,eAAe,GACf,WAAW,GACX,cAAc,CAAC;AAEnB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAChD,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAiC9D;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EAC1C,MAAM,EAAE,OAAO,GACd,IAAI,CAYN;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EAC9C,QAAQ,EAAE,uBAAuB,GAAG,IAAI,GAAG,SAAS,GACnD,eAAe,GAAG,IAAI,CAiBxB;AAED,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,wBAAwB,EACjC,MAAM,CAAC,EAAE,eAAe,GAAG,IAAI,GAC9B,iBAAiB,CAsBnB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { DataPointLimitError } from './DataPointLimitError';
|
|
2
|
+
export const DEFAULT_CHART_MAX_DATA_POINTS = 10_000;
|
|
3
|
+
export function getQueryResultRowCount(result) {
|
|
4
|
+
if (!result)
|
|
5
|
+
return 0;
|
|
6
|
+
if (typeof result === 'object' && 'numRows' in result) {
|
|
7
|
+
return result.numRows ?? 0;
|
|
8
|
+
}
|
|
9
|
+
if (Array.isArray(result)) {
|
|
10
|
+
return result.length;
|
|
11
|
+
}
|
|
12
|
+
if (typeof result === 'object' &&
|
|
13
|
+
'toArray' in result &&
|
|
14
|
+
typeof result.toArray === 'function') {
|
|
15
|
+
const arr = result.toArray();
|
|
16
|
+
return Array.isArray(arr) ? arr.length : 0;
|
|
17
|
+
}
|
|
18
|
+
console.warn('getQueryResultRowCount: unrecognized result format, expected Arrow table (numRows), array, or table-like object with toArray()', {
|
|
19
|
+
type: typeof result,
|
|
20
|
+
isArray: Array.isArray(result),
|
|
21
|
+
hasToArray: typeof result === 'object' &&
|
|
22
|
+
result !== null &&
|
|
23
|
+
'toArray' in result &&
|
|
24
|
+
typeof result.toArray === 'function',
|
|
25
|
+
});
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
export function assertChartDataPolicy(policy, result) {
|
|
29
|
+
if (!policy || policy.disabled || policy.maxRows == null) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const rowCount = policy.getResultSize
|
|
33
|
+
? policy.getResultSize(result)
|
|
34
|
+
: getQueryResultRowCount(result);
|
|
35
|
+
if (rowCount > policy.maxRows) {
|
|
36
|
+
throw new DataPointLimitError(rowCount, policy.maxRows);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export function resolveChartDataPolicy(basePolicy, override) {
|
|
40
|
+
if (!override) {
|
|
41
|
+
return basePolicy ?? null;
|
|
42
|
+
}
|
|
43
|
+
if (override.disabled) {
|
|
44
|
+
return {
|
|
45
|
+
...(basePolicy ?? {}),
|
|
46
|
+
disabled: true,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
...(basePolicy ?? {}),
|
|
51
|
+
...(override.maxRows !== undefined ? { maxRows: override.maxRows } : {}),
|
|
52
|
+
...(override.reason !== undefined ? { reason: override.reason } : {}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export function createChartRuntimeIssueFromError(error, context, policy) {
|
|
56
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
57
|
+
if (error instanceof DataPointLimitError) {
|
|
58
|
+
return {
|
|
59
|
+
kind: 'too-much-data',
|
|
60
|
+
panelId: context.panelId,
|
|
61
|
+
chartType: context.chartType,
|
|
62
|
+
message: policy?.reason ? `${message}\n${policy.reason}` : message,
|
|
63
|
+
recoverable: true,
|
|
64
|
+
rowCount: error.rowCount,
|
|
65
|
+
limit: error.limit,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
kind: 'sql-error',
|
|
70
|
+
panelId: context.panelId,
|
|
71
|
+
chartType: context.chartType,
|
|
72
|
+
message,
|
|
73
|
+
recoverable: true,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=chart-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-runtime.js","sourceRoot":"","sources":["../src/chart-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAE1D,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC;AAwDpD,MAAM,UAAU,sBAAsB,CAAC,MAAe;IACpD,IAAI,CAAC,MAAM;QAAE,OAAO,CAAC,CAAC;IAEtB,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;QACtD,OAAQ,MAA6B,CAAC,OAAO,IAAI,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,IACE,OAAO,MAAM,KAAK,QAAQ;QAC1B,SAAS,IAAI,MAAM;QACnB,OAAQ,MAA8B,CAAC,OAAO,KAAK,UAAU,EAC7D,CAAC;QACD,MAAM,GAAG,GAAI,MAAmC,CAAC,OAAO,EAAE,CAAC;QAC3D,OAAO,KAAK,CAAC,OAAO,CAAC,G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,QAAQ,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACpE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,KAAc,EACd,OAAiC,EACjC,MAA+B;IAE/B,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEvE,IAAI,KAAK,YAAY,mBAAmB,EAAE,CAAC;QACzC,OAAO;YACL,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO;YAClE,WAAW,EAAE,IAAI;YACjB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,OAAO;QACP,WAAW,EAAE,IAAI;KAClB,CAAC;AACJ,CAAC","sourcesContent":["import {DataPointLimitError} from './DataPointLimitError';\n\nexport const DEFAULT_CHART_MAX_DATA_POINTS = 10_000;\n\nexport type ChartDataPolicy = {\n /**\n * Disable runtime row-count validation for charts whose query result size\n * does not correspond to rendered data points.\n */\n disabled?: boolean;\n /** Maximum allowed result rows for this chart's runtime query results. */\n maxRows?: number;\n /** Short explanation shown to users and assistants when the policy trips. */\n reason?: string;\n /** Optional custom size estimator for renderer-specific result shapes. */\n getResultSize?: (result: unknown) => number;\n};\n\nexport type ChartDataPolicyOverride = {\n /** Disable runtime row-count validation for this panel. */\n disabled?: boolean;\n /** Override the maximum allowed result rows for this panel. */\n maxRows?: number;\n /** Optional panel-specific explanation shown when the policy trips. */\n reason?: string;\n};\n\nexport type ChartDataPolicyContext<TConfig> = {\n tableName: string;\n config: TConfig;\n};\n\nexport type ChartRuntimeIssueKind =\n | 'too-much-data'\n | 'sql-error'\n | 'render-error';\n\nexport type ChartRuntimeIssue = {\n kind: ChartRuntimeIssueKind;\n panelId: string;\n chartType: string;\n message: string;\n recoverable: boolean;\n rowCount?: number;\n limit?: number;\n sql?: string;\n};\n\nexport type ChartRuntimeIssueContext = {\n panelId: string;\n chartType: string;\n};\n\nexport type ChartRuntimeIssueReporter = {\n reportIssue: (issue: ChartRuntimeIssue) => void;\n clearIssue: () => void;\n};\n\nexport function getQueryResultRowCount(result: unknown): number {\n if (!result) return 0;\n\n if (typeof result === 'object' && 'numRows' in result) {\n return (result as {numRows?: number}).numRows ?? 0;\n }\n\n if (Array.isArray(result)) {\n return result.length;\n }\n\n if (\n typeof result === 'object' &&\n 'toArray' in result &&\n typeof (result as {toArray?: unknown}).toArray === 'function'\n ) {\n const arr = (result as {toArray: () => unknown}).toArray();\n return Array.isArray(arr) ? arr.length : 0;\n }\n\n console.warn(\n 'getQueryResultRowCount: unrecognized result format, expected Arrow table (numRows), array, or table-like object with toArray()',\n {\n type: typeof result,\n isArray: Array.isArray(result),\n hasToArray:\n typeof result === 'object' &&\n result !== null &&\n 'toArray' in result &&\n typeof (result as {toArray?: unknown}).toArray === 'function',\n },\n );\n return 0;\n}\n\nexport function assertChartDataPolicy(\n policy: ChartDataPolicy | null | undefined,\n result: unknown,\n): void {\n if (!policy || policy.disabled || policy.maxRows == null) {\n return;\n }\n\n const rowCount = policy.getResultSize\n ? policy.getResultSize(result)\n : getQueryResultRowCount(result);\n\n if (rowCount > policy.maxRows) {\n throw new DataPointLimitError(rowCount, policy.maxRows);\n }\n}\n\nexport function resolveChartDataPolicy(\n basePolicy: ChartDataPolicy | null | undefined,\n override: ChartDataPolicyOverride | null | undefined,\n): ChartDataPolicy | null {\n if (!override) {\n return basePolicy ?? null;\n }\n\n if (override.disabled) {\n return {\n ...(basePolicy ?? {}),\n disabled: true,\n };\n }\n\n return {\n ...(basePolicy ?? {}),\n ...(override.maxRows !== undefined ? {maxRows: override.maxRows} : {}),\n ...(override.reason !== undefined ? {reason: override.reason} : {}),\n };\n}\n\nexport function createChartRuntimeIssueFromError(\n error: unknown,\n context: ChartRuntimeIssueContext,\n policy?: ChartDataPolicy | null,\n): ChartRuntimeIssue {\n const message = error instanceof Error ? error.message : String(error);\n\n if (error instanceof DataPointLimitError) {\n return {\n kind: 'too-much-data',\n panelId: context.panelId,\n chartType: context.chartType,\n message: policy?.reason ? `${message}\\n${policy.reason}` : message,\n recoverable: true,\n rowCount: error.rowCount,\n limit: error.limit,\n };\n }\n\n return {\n kind: 'sql-error',\n panelId: context.panelId,\n chartType: context.chartType,\n message,\n recoverable: true,\n };\n}\n"]}
|
|
@@ -10,6 +10,9 @@ import type * as z from 'zod';
|
|
|
10
10
|
import { ChartConfig, ChartType } from './chart-config';
|
|
11
11
|
import { RetainedVgPlotChart } from '../VgPlotChart';
|
|
12
12
|
import type { Selection } from '@uwdata/mosaic-core';
|
|
13
|
+
import type { ProfilerPanelConfig, TextPanelConfig } from '../dashboard/core-types';
|
|
14
|
+
import type { MosaicDashboardEntry } from '../dashboard/dashboard-types';
|
|
15
|
+
import type { ChartDataPolicy, ChartDataPolicyContext, ChartRuntimeIssue, ChartRuntimeIssueContext, ChartRuntimeIssueReporter } from '../chart-runtime';
|
|
13
16
|
export type { ChartType };
|
|
14
17
|
/**
|
|
15
18
|
* Column info passed to chart builder UI
|
|
@@ -36,31 +39,43 @@ export interface ChartBuilderField {
|
|
|
36
39
|
multiple?: boolean;
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
39
|
-
*
|
|
40
|
-
* Provides the resources and operations needed to create charts.
|
|
42
|
+
* Result of table resolution, includes table name and column metadata.
|
|
41
43
|
*/
|
|
42
|
-
export interface
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
export interface ResolvedTable {
|
|
45
|
+
tableName: string;
|
|
46
|
+
columns: ChartBuilderColumn[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Partial update to apply to a dashboard panel.
|
|
50
|
+
* Config can be any of the panel config types (chart, profiler, or text).
|
|
51
|
+
*/
|
|
52
|
+
export interface PanelPatch {
|
|
53
|
+
title?: string;
|
|
54
|
+
source?: ChartBuilderPanelSource;
|
|
55
|
+
config?: ChartConfig | ProfilerPanelConfig | TextPanelConfig;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Dependencies injected into dashboard tool creation functions.
|
|
59
|
+
* Provides the resources and operations needed to create dashboard panels.
|
|
60
|
+
*/
|
|
61
|
+
export interface DashboardToolDeps {
|
|
62
|
+
/**
|
|
63
|
+
* Resolves the dashboard artifact ID.
|
|
64
|
+
* Use this when you only need the artifact and not table information.
|
|
65
|
+
*/
|
|
66
|
+
resolveArtifact: (artifactId?: string, createIfMissing?: boolean, context?: ChartToolExecutionContext) => string;
|
|
67
|
+
/**
|
|
68
|
+
* Resolves table name and columns for a given dashboard artifact.
|
|
69
|
+
* Use this when you need table-specific information.
|
|
70
|
+
*/
|
|
71
|
+
resolveTable: (artifactId: string, tableName?: string) => ResolvedTable;
|
|
72
|
+
addPanel: (dashboardId: string, panel: any) => string;
|
|
73
|
+
updatePanel: (dashboardId: string, panelId: string, patch: Partial<PanelPatch>) => void;
|
|
74
|
+
getDashboard: (dashboardId: string) => MosaicDashboardEntry | undefined;
|
|
75
|
+
getPanelIssue?: (dashboardId: string, panelId: string) => ChartRuntimeIssue | undefined;
|
|
76
|
+
removePanel: (dashboardId: string, panelId: string) => void;
|
|
77
|
+
setCurrentArtifact: (artifactId: string) => void;
|
|
78
|
+
maxDataPoints: number;
|
|
64
79
|
}
|
|
65
80
|
export type ChartToolExecutionContext = object & {
|
|
66
81
|
sessionId?: string;
|
|
@@ -93,6 +108,9 @@ export interface ChartRendererProps<TConfig extends ChartConfig = ChartConfig> {
|
|
|
93
108
|
tableName: string;
|
|
94
109
|
config: TConfig;
|
|
95
110
|
coordinator: Coordinator;
|
|
111
|
+
dataPolicy?: ChartDataPolicy | null;
|
|
112
|
+
runtimeIssueContext?: ChartRuntimeIssueContext;
|
|
113
|
+
runtimeIssueReporter?: ChartRuntimeIssueReporter;
|
|
96
114
|
/**
|
|
97
115
|
* Pre-defined params/selections to inject when rendering vgplot specs.
|
|
98
116
|
* Keys are param names (without $), values are Param or Selection instances.
|
|
@@ -124,7 +142,9 @@ type BaseChartTypeDefinition<TConfig extends ChartConfig = ChartConfig> = {
|
|
|
124
142
|
className?: string;
|
|
125
143
|
}>;
|
|
126
144
|
/** Optional function to create an AI tool for this chart type */
|
|
127
|
-
createTool?: (deps:
|
|
145
|
+
createTool?: (deps: DashboardToolDeps) => Tool;
|
|
146
|
+
/** Optional runtime data policy for renderer-specific query validation. */
|
|
147
|
+
getDataPolicy?: (context: ChartDataPolicyContext<TConfig>) => ChartDataPolicy | null | undefined;
|
|
128
148
|
};
|
|
129
149
|
export type SpecChartTypeDefinition<TConfig extends ChartConfig = ChartConfig> = BaseChartTypeDefinition<TConfig> & {
|
|
130
150
|
createSpec: (tableName: string, config: TConfig['settings']) => Spec;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-types.d.ts","sourceRoot":"","sources":["../../src/chart-types/base-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,KAAK,IAAI,EAAC,MAAM,IAAI,CAAC;AAC7B,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AACzC,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAC,WAAW,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"base-types.d.ts","sourceRoot":"","sources":["../../src/chart-types/base-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,KAAK,IAAI,EAAC,MAAM,IAAI,CAAC;AAC7B,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AACzC,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAC,WAAW,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,EAC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I,CAAC;IAC/C,2EAA2E;IAC3E,aAAa,CAAC,EAAE,CACd,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,KACrC,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,uBAAuB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,IAC3E,uBAAuB,CAAC,OAAO,CAAC,GAAG;IACjC,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACrE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEJ,MAAM,MAAM,4BAA4B,CACtC,OAAO,SAAS,WAAW,GAAG,WAAW,IACvC,uBAAuB,CAAC,OAAO,CAAC,GAAG;IACrC,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;CACtD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,mBAAmB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,IACrE,uBAAuB,CAAC,OAAO,CAAC,GAChC,4BAA4B,CAAC,OAAO,CAAC,CAAC;AAE1C,wBAAgB,eAAe,CAAC,OAAO,SAAS,WAAW,EACzD,SAAS,EAAE,mBAAmB,CAAC,OAAO,CAAC,GACtC,SAAS,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAE/C;AAED,wBAAgB,oBAAoB,CAAC,OAAO,SAAS,WAAW,EAC9D,SAAS,EAAE,mBAAmB,CAAC,OAAO,CAAC,GACtC,SAAS,IAAI,4BAA4B,CAAC,OAAO,CAAC,CAEpD;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-types.js","sourceRoot":"","sources":["../../src/chart-types/base-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"base-types.js","sourceRoot":"","sources":["../../src/chart-types/base-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+MH,MAAM,UAAU,eAAe,CAC7B,SAAuC;IAEvC,OAAO,YAAY,IAAI,SAAS,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,SAAuC;IAEvC,OAAO,UAAU,IAAI,SAAS,CAAC;AACjC,CAAC","sourcesContent":["/**\n * Base types for chart configurations.\n * Separated to avoid circular dependencies.\n */\n\nimport type {Spec} from '@uwdata/mosaic-spec';\nimport {type Tool} from 'ai';\nimport type {Coordinator} from '@uwdata/mosaic-core';\nimport type {ComponentType} from 'react';\nimport type * as z from 'zod';\nimport {ChartConfig, ChartType} from './chart-config';\nimport {RetainedVgPlotChart} from '../VgPlotChart';\nimport type {Selection} from '@uwdata/mosaic-core';\nimport type {\n ProfilerPanelConfig,\n TextPanelConfig,\n} from '../dashboard/core-types';\nimport type {MosaicDashboardEntry} from '../dashboard/dashboard-types';\nimport type {\n ChartDataPolicy,\n ChartDataPolicyContext,\n ChartRuntimeIssue,\n ChartRuntimeIssueContext,\n ChartRuntimeIssueReporter,\n} from '../chart-runtime';\n\nexport type {ChartType};\n\n/**\n * Column info passed to chart builder UI\n */\nexport interface ChartBuilderColumn {\n name: string;\n type: string;\n}\n\n/**\n * Describes a field selector in a chart builder UI\n */\nexport interface ChartBuilderField {\n /** Unique key for this field */\n key: string;\n /** Display label */\n label: string;\n /** Whether the field is required */\n required?: boolean;\n /** Filter columns by DuckDB type (e.g. 'INTEGER', 'VARCHAR', 'DOUBLE') */\n types?: string[];\n /** Optional helper text for AI or custom UIs */\n description?: string;\n /** Whether this field accepts multiple values (array) */\n multiple?: boolean;\n}\n\n/**\n * Result of table resolution, includes table name and column metadata.\n */\nexport interface ResolvedTable {\n tableName: string;\n columns: ChartBuilderColumn[];\n}\n\n/**\n * Partial update to apply to a dashboard panel.\n * Config can be any of the panel config types (chart, profiler, or text).\n */\nexport interface PanelPatch {\n title?: string;\n source?: ChartBuilderPanelSource;\n config?: ChartConfig | ProfilerPanelConfig | TextPanelConfig;\n}\n\n/**\n * Dependencies injected into dashboard tool creation functions.\n * Provides the resources and operations needed to create dashboard panels.\n */\nexport interface DashboardToolDeps {\n /**\n * Resolves the dashboard artifact ID.\n * Use this when you only need the artifact and not table information.\n */\n resolveArtifact: (\n artifactId?: string,\n createIfMissing?: boolean,\n context?: ChartToolExecutionContext,\n ) => string;\n\n /**\n * Resolves table name and columns for a given dashboard artifact.\n * Use this when you need table-specific information.\n */\n resolveTable: (artifactId: string, tableName?: string) => ResolvedTable;\n\n addPanel: (dashboardId: string, panel: any) => string;\n updatePanel: (\n dashboardId: string,\n panelId: string,\n patch: Partial<PanelPatch>,\n ) => void;\n getDashboard: (dashboardId: string) => MosaicDashboardEntry | undefined;\n getPanelIssue?: (\n dashboardId: string,\n panelId: string,\n ) => ChartRuntimeIssue | undefined;\n removePanel: (dashboardId: string, panelId: string) => void;\n setCurrentArtifact: (artifactId: string) => void;\n\n maxDataPoints: number;\n}\n\nexport type ChartToolExecutionContext = object & {\n sessionId?: string;\n aiRunContext?: unknown;\n};\n\nexport type ChartBuilderPanelSource = {\n tableName?: string;\n sqlQuery?: string;\n};\n\nexport type ChartBuilderVgPlotOutput = {\n kind: 'vgplot';\n spec: Spec;\n};\n\nexport type ChartBuilderDashboardPanelOutput = {\n kind: 'dashboard-panel';\n type: string;\n source?: ChartBuilderPanelSource;\n config?: Record<string, unknown>;\n};\n\nexport type ChartBuilderOutput =\n | ChartBuilderVgPlotOutput\n | ChartBuilderDashboardPanelOutput;\n\nexport type ChartRetainer = {\n chart: RetainedVgPlotChart | undefined;\n setChart: (chart: RetainedVgPlotChart) => void;\n};\n\nexport type BrushSelectionParams = Map<string, Selection>;\n\n/**\n * Props passed to chart renderer components.\n */\nexport interface ChartRendererProps<TConfig extends ChartConfig = ChartConfig> {\n tableName: string;\n config: TConfig;\n coordinator: Coordinator;\n dataPolicy?: ChartDataPolicy | null;\n runtimeIssueContext?: ChartRuntimeIssueContext;\n runtimeIssueReporter?: ChartRuntimeIssueReporter;\n /**\n * Pre-defined params/selections to inject when rendering vgplot specs.\n * Keys are param names (without $), values are Param or Selection instances.\n */\n params?: BrushSelectionParams;\n /**\n * Optional retention adapter for preserving the underlying vgplot\n * instance across temporary unmount/remount cycles.\n */\n retention?: ChartRetainer;\n}\n\ntype BaseChartTypeDefinition<TConfig extends ChartConfig = ChartConfig> = {\n /** Unique identifier */\n id: ChartType;\n /** Short human-friendly name used in chart-type grids and prompts */\n label?: string;\n /** Short description of what this builder creates */\n description: string;\n /** Zod schema for runtime validation of settings */\n schema: z.ZodType<TConfig['settings']>;\n /** Generate a chart title from selected field values */\n buildTitle?: (fieldValues: Record<string, unknown>) => string;\n /** Optional availability override for a given table schema */\n isAvailable?: (columns: ChartBuilderColumn[]) => boolean;\n /** Explicit settings component for this chart type */\n settingsComponent: ComponentType;\n /** Optional icon component for chart-type grids */\n icon: ComponentType<{className?: string}>;\n /** Optional function to create an AI tool for this chart type */\n createTool?: (deps: DashboardToolDeps) => Tool;\n /** Optional runtime data policy for renderer-specific query validation. */\n getDataPolicy?: (\n context: ChartDataPolicyContext<TConfig>,\n ) => ChartDataPolicy | null | undefined;\n};\n\nexport type SpecChartTypeDefinition<TConfig extends ChartConfig = ChartConfig> =\n BaseChartTypeDefinition<TConfig> & {\n createSpec: (tableName: string, config: TConfig['settings']) => Spec;\n canViewSpec?: boolean;\n };\n\nexport type ComponentChartTypeDefinition<\n TConfig extends ChartConfig = ChartConfig,\n> = BaseChartTypeDefinition<TConfig> & {\n renderer: ComponentType<ChartRendererProps<TConfig>>;\n};\n\n/**\n * Shared chart-type definition used by both the chart-builder UI and\n * assistant-driven chart creation.\n */\nexport type ChartTypeDefinition<TConfig extends ChartConfig = ChartConfig> =\n | SpecChartTypeDefinition<TConfig>\n | ComponentChartTypeDefinition<TConfig>;\n\nexport function isSpecChartType<TConfig extends ChartConfig>(\n chartType: ChartTypeDefinition<TConfig>,\n): chartType is SpecChartTypeDefinition<TConfig> {\n return 'createSpec' in chartType;\n}\n\nexport function isComponentChartType<TConfig extends ChartConfig>(\n chartType: ChartTypeDefinition<TConfig>,\n): chartType is ComponentChartTypeDefinition<TConfig> {\n return 'renderer' in chartType;\n}\n\n/**\n * Backward-compatible alias for earlier chart-builder helper APIs.\n * @deprecated Use {@link ChartTypeDefinition} instead.\n */\nexport type ChartSpec = ChartTypeDefinition;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/chart-types/box-plot/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,eAAe,CAAC;AAChE,OAAO,EAAC,kBAAkB,EAAuB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/chart-types/box-plot/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,eAAe,CAAC;AAChE,OAAO,EAAC,kBAAkB,EAAuB,MAAM,UAAU,CAAC;AAUlE,eAAO,MAAM,gBAAgB,EAAE,4BAA4B,CAAC,kBAAkB,CAgB3E,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { BoxPlotPanelRenderer } from './renderer/BoxPlotPanelRenderer';
|
|
|
4
4
|
import { BoxPlotSettingsComponent } from './BoxPlotSettings';
|
|
5
5
|
import { createBoxPlotAiTool } from './tool';
|
|
6
6
|
import { AlignHorizontalDistributeCenter } from 'lucide-react';
|
|
7
|
+
import { DEFAULT_CHART_MAX_DATA_POINTS } from '../../chart-runtime';
|
|
7
8
|
const DESCRIPTION = 'Create a box plot';
|
|
8
9
|
export const boxPlotChartType = {
|
|
9
10
|
id: 'box-plot',
|
|
@@ -15,5 +16,9 @@ export const boxPlotChartType = {
|
|
|
15
16
|
buildTitle: titleFromDescription(DESCRIPTION),
|
|
16
17
|
renderer: BoxPlotPanelRenderer,
|
|
17
18
|
createTool: createBoxPlotAiTool,
|
|
19
|
+
getDataPolicy: () => ({
|
|
20
|
+
maxRows: DEFAULT_CHART_MAX_DATA_POINTS,
|
|
21
|
+
reason: 'Box plots render summaries plus outlier points. Too many outliers can make the chart too expensive to render.',
|
|
22
|
+
}),
|
|
18
23
|
};
|
|
19
24
|
//# sourceMappingURL=definition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/chart-types/box-plot/definition.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAClE,OAAO,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAC,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAC,mBAAmB,EAAC,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAC,+BAA+B,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/chart-types/box-plot/definition.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAClE,OAAO,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAC,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAC,mBAAmB,EAAC,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAC,+BAA+B,EAAC,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAC,6BAA6B,EAAC,MAAM,qBAAqB,CAAC;AAElE,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAExC,MAAM,CAAC,MAAM,gBAAgB,GAC3B;IACE,EAAE,EAAE,UAAU;IACd,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,WAAW;IACxB,IAAI,EAAE,+BAA+B;IACrC,MAAM,EAAE,oBAAoB;IAC5B,iBAAiB,EAAE,wBAAwB;IAC3C,UAAU,EAAE,oBAAoB,CAAC,WAAW,CAAC;IAC7C,QAAQ,EAAE,oBAAoB;IAC9B,UAAU,EAAE,mBAAmB;IAC/B,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;QACpB,OAAO,EAAE,6BAA6B;QACtC,MAAM,EACJ,+GAA+G;KAClH,CAAC;CACH,CAAC","sourcesContent":["import type {ComponentChartTypeDefinition} from '../base-types';\nimport {BoxPlotChartConfig, BoxPlotChartSettings} from './schema';\nimport {titleFromDescription} from '../../chart-builders/chartTypeUtils';\nimport {BoxPlotPanelRenderer} from './renderer/BoxPlotPanelRenderer';\nimport {BoxPlotSettingsComponent} from './BoxPlotSettings';\nimport {createBoxPlotAiTool} from './tool';\nimport {AlignHorizontalDistributeCenter} from 'lucide-react';\nimport {DEFAULT_CHART_MAX_DATA_POINTS} from '../../chart-runtime';\n\nconst DESCRIPTION = 'Create a box plot';\n\nexport const boxPlotChartType: ComponentChartTypeDefinition<BoxPlotChartConfig> =\n {\n id: 'box-plot',\n label: 'Box Plot',\n description: DESCRIPTION,\n icon: AlignHorizontalDistributeCenter,\n schema: BoxPlotChartSettings,\n settingsComponent: BoxPlotSettingsComponent,\n buildTitle: titleFromDescription(DESCRIPTION),\n renderer: BoxPlotPanelRenderer,\n createTool: createBoxPlotAiTool,\n getDataPolicy: () => ({\n maxRows: DEFAULT_CHART_MAX_DATA_POINTS,\n reason:\n 'Box plots render summaries plus outlier points. Too many outliers can make the chart too expensive to render.',\n }),\n };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoxPlotPanelRenderer.d.ts","sourceRoot":"","sources":["../../../../src/chart-types/box-plot/renderer/BoxPlotPanelRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,EAAE,EAAoC,MAAM,OAAO,CAAC;AAIjE,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAQzD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,WAAW,CAAC;AAKlD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,EAAE,CACnC,kBAAkB,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"BoxPlotPanelRenderer.d.ts","sourceRoot":"","sources":["../../../../src/chart-types/box-plot/renderer/BoxPlotPanelRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,EAAE,EAAoC,MAAM,OAAO,CAAC;AAIjE,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAQzD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,WAAW,CAAC;AAKlD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,EAAE,CACnC,kBAAkB,CAAC,kBAAkB,CAAC,CA2MvC,CAAC"}
|
|
@@ -11,7 +11,7 @@ import { BoxPlotErrorBoundary } from './BoxPlotErrorBoundary';
|
|
|
11
11
|
* Custom renderer for box-plot chart type.
|
|
12
12
|
* Uses BoxPlotClient for SQL-based quartile calculations and custom Observable Plot rendering.
|
|
13
13
|
*/
|
|
14
|
-
export const BoxPlotPanelRenderer = ({ tableName, config, coordinator, params }) => {
|
|
14
|
+
export const BoxPlotPanelRenderer = ({ tableName, config, coordinator, params, dataPolicy, runtimeIssueContext, runtimeIssueReporter, }) => {
|
|
15
15
|
const configX = config.settings.x;
|
|
16
16
|
const configY = config.settings.y;
|
|
17
17
|
const boxPlotConfig = useMemo(() => typeof configX === 'string' && typeof configY === 'string'
|
|
@@ -23,7 +23,10 @@ export const BoxPlotPanelRenderer = ({ tableName, config, coordinator, params })
|
|
|
23
23
|
const { clientRef, state } = useBoxPlotClient({
|
|
24
24
|
config: boxPlotConfig,
|
|
25
25
|
coordinator,
|
|
26
|
+
dataPolicy,
|
|
26
27
|
params,
|
|
28
|
+
runtimeIssueContext,
|
|
29
|
+
runtimeIssueReporter,
|
|
27
30
|
tableName,
|
|
28
31
|
});
|
|
29
32
|
const summaries = useMemo(() => state.summaries.map((row) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoxPlotPanelRenderer.js","sourceRoot":"","sources":["../../../../src/chart-types/box-plot/renderer/BoxPlotPanelRenderer.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxE,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,EAAgB,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EACL,oBAAoB,EACpB,OAAO,GAGR,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,oBAAoB,EAAC,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,cAAc,EAAE,UAAU,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAClE,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAE7B,CAAC,EAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAC,EAAE,EAAE;IAC/C,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClC,MAAM,aAAa,GAAG,OAAO,CAC3B,GAAG,EAAE,CACH,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ;QACxD,CAAC,CAAC,EAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAC;QAC1B,CAAC,CAAC,IAAI,EACV,CAAC,OAAO,EAAE,OAAO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, PointerEvent as ReactPointerEvent} from 'react';\nimport {useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport {SpinnerPane} from '@sqlrooms/ui';\nimport {type PlotSize, ResponsivePlot} from '../../../ResponsivePlot';\nimport type {ChartRendererProps} from '../../base-types';\nimport {\n DRAG_CLICK_THRESHOLD,\n MARGINS,\n type PlotOutlierDatum,\n type PlotSummaryDatum,\n} from './constants';\nimport {createBoxPlotElement} from './plot';\nimport type {BoxPlotChartConfig} from '../schema';\nimport {useBoxPlotClient} from './useBoxPlotClient';\nimport {formatCategory, getYDomain, yPixelToValue} from './utils';\nimport {BoxPlotErrorBoundary} from './BoxPlotErrorBoundary';\n\n/**\n * Custom renderer for box-plot chart type.\n * Uses BoxPlotClient for SQL-based quartile calculations and custom Observable Plot rendering.\n */\nexport const BoxPlotPanelRenderer: FC<\n ChartRendererProps<BoxPlotChartConfig>\n> = ({tableName, config, coordinator, params}) => {\n const configX = config.settings.x;\n const configY = config.settings.y;\n const boxPlotConfig = useMemo(\n () =>\n typeof configX === 'string' && typeof configY === 'string'\n ? {x: configX, y: configY}\n : null,\n [configX, configY],\n );\n\n const [size, setSize] = useState<PlotSize | null>(null);\n const [drag, setDrag] = useState<{startY: number; currentY: number} | null>(\n null,\n );\n const plotRef = useRef<HTMLDivElement>(null);\n\n const {clientRef, state} = useBoxPlotClient({\n config: boxPlotConfig,\n coordinator,\n params,\n tableName,\n });\n\n const summaries = useMemo<PlotSummaryDatum[]>(\n () =>\n state.summaries.map((row) => ({\n ...row,\n categoryLabel: formatCategory(row.category),\n })),\n [state.summaries],\n );\n const outliers = useMemo<PlotOutlierDatum[]>(\n () =>\n state.outliers.map((row) => ({\n ...row,\n categoryLabel: formatCategory(row.category),\n })),\n [state.outliers],\n );\n const yDomain = useMemo(\n () => getYDomain(state.summaries, state.outliers),\n [state.outliers, state.summaries],\n );\n\n useEffect(() => {\n const container = plotRef.current;\n if (!container || !size || !boxPlotConfig) {\n return;\n }\n if (!summaries.length) {\n container.replaceChildren();\n return;\n }\n\n const plot = createBoxPlotElement({\n config: boxPlotConfig,\n domain: yDomain,\n outliers,\n size,\n summaries,\n });\n container.replaceChildren(plot);\n }, [boxPlotConfig, outliers, size, summaries, yDomain]);\n\n const getLocalY = useCallback((event: ReactPointerEvent<HTMLDivElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n return event.clientY - rect.top;\n }, []);\n\n const handlePointerDown = useCallback(\n (event: ReactPointerEvent<HTMLDivElement>) => {\n if (!size || !summaries.length) return;\n event.currentTarget.setPointerCapture(event.pointerId);\n const y = getLocalY(event);\n setDrag({currentY: y, startY: y});\n },\n [getLocalY, size, summaries.length],\n );\n\n const handlePointerMove = useCallback(\n (event: ReactPointerEvent<HTMLDivElement>) => {\n if (!drag) return;\n setDrag({...drag, currentY: getLocalY(event)});\n },\n [drag, getLocalY],\n );\n\n const finishDrag = useCallback(\n (event: ReactPointerEvent<HTMLDivElement>) => {\n if (!drag || !size) return;\n event.currentTarget.releasePointerCapture(event.pointerId);\n const currentY = getLocalY(event);\n const pixelDistance = Math.abs(currentY - drag.startY);\n setDrag(null);\n if (pixelDistance < DRAG_CLICK_THRESHOLD) {\n clientRef.current?.updateYBrush();\n return;\n }\n clientRef.current?.updateYBrush([\n yPixelToValue(drag.startY, size, yDomain),\n yPixelToValue(currentY, size, yDomain),\n ]);\n },\n [clientRef, drag, getLocalY, size, yDomain],\n );\n\n const brushStyle = useMemo(() => {\n const extent = drag\n ? [drag.startY, drag.currentY]\n : state.yBrush && size\n ? state.yBrush.map((value) => {\n const plotHeight = Math.max(\n 1,\n size.height - MARGINS.top - MARGINS.bottom,\n );\n const span = yDomain[1] - yDomain[0] || 1;\n const pixelPos =\n MARGINS.top + ((yDomain[1] - value) / span) * plotHeight;\n return Math.max(\n MARGINS.top,\n Math.min(MARGINS.top + plotHeight, pixelPos),\n );\n })\n : null;\n if (!extent) return undefined;\n const top = Math.max(MARGINS.top, Math.min(...extent));\n const bottom = Math.min(\n size?.height ? size.height - MARGINS.bottom : Number.POSITIVE_INFINITY,\n Math.max(...extent),\n );\n return {\n height: `${Math.max(0, bottom - top)}px`,\n left: `${MARGINS.left}px`,\n right: `${MARGINS.right}px`,\n top: `${top}px`,\n };\n }, [drag, size, state.yBrush, yDomain]);\n\n if (!config.settings.x || !config.settings.y) {\n return (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <div className=\"text-center font-medium\">\n Configure chart to display visualization\n </div>\n <div className=\"text-center text-xs\">\n X and Y fields are required for box plot\n </div>\n </div>\n );\n }\n\n return (\n <BoxPlotErrorBoundary>\n <div className=\"h-full min-h-0 overflow-auto p-2\">\n <div className=\"bg-background text-foreground relative flex h-full min-h-[220px] w-full items-center justify-center rounded-md p-2\">\n {state.error ? (\n <div className=\"text-destructive flex h-full items-center justify-center p-4 text-sm\">\n {state.error.message}\n </div>\n ) : state.isLoading && !state.summaries.length ? (\n <SpinnerPane className=\"h-full w-full\" />\n ) : !state.summaries.length ? (\n <div className=\"text-muted-foreground flex h-full items-center justify-center text-sm\">\n No numeric values for this box plot\n </div>\n ) : (\n <ResponsivePlot\n onResize={setSize}\n className=\"relative h-full min-h-[220px] w-full\"\n >\n <div ref={plotRef} className=\"absolute inset-0\" />\n {brushStyle ? (\n <div\n className=\"bg-primary/15 border-primary/60 pointer-events-none absolute border\"\n style={brushStyle}\n />\n ) : null}\n <div\n className=\"absolute inset-0 cursor-crosshair touch-none\"\n onPointerCancel={finishDrag}\n onPointerDown={handlePointerDown}\n onPointerMove={handlePointerMove}\n onPointerUp={finishDrag}\n />\n </ResponsivePlot>\n )}\n </div>\n </div>\n </BoxPlotErrorBoundary>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"BoxPlotPanelRenderer.js","sourceRoot":"","sources":["../../../../src/chart-types/box-plot/renderer/BoxPlotPanelRenderer.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO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CACL,KAAC,oBAAoB,cACnB,cAAK,SAAS,EAAC,kCAAkC,YAC/C,cAAK,SAAS,EAAC,oHAAoH,YAChI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CACb,cAAK,SAAS,EAAC,sEAAsE,YAClF,KAAK,CAAC,KAAK,CAAC,OAAO,GAChB,CACP,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAC/C,KAAC,WAAW,IAAC,SAAS,EAAC,eAAe,GAAG,CAC1C,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAC5B,cAAK,SAAS,EAAC,uEAAuE,oDAEhF,CACP,CAAC,CAAC,CAAC,CACF,MAAC,cAAc,IACb,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAC,sCAAsC,aAEhD,cAAK,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,kBAAkB,GAAG,EACjD,UAAU,CAAC,CAAC,CAAC,CACZ,cACE,SAAS,EAAC,qEAAqE,EAC/E,KAAK,EAAE,UAAU,GACjB,CACH,CAAC,CAAC,CAAC,IAAI,EACR,cACE,SAAS,EAAC,8CAA8C,EACxD,eAAe,EAAE,UAAU,EAC3B,aAAa,EAAE,iBAAiB,EAChC,aAAa,EAAE,iBAAiB,EAChC,WAAW,EAAE,UAAU,GACvB,IACa,CAClB,GACG,GACF,GACe,CACxB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type {FC, PointerEvent as ReactPointerEvent} from 'react';\nimport {useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport {SpinnerPane} from '@sqlrooms/ui';\nimport {type PlotSize, ResponsivePlot} from '../../../ResponsivePlot';\nimport type {ChartRendererProps} from '../../base-types';\nimport {\n DRAG_CLICK_THRESHOLD,\n MARGINS,\n type PlotOutlierDatum,\n type PlotSummaryDatum,\n} from './constants';\nimport {createBoxPlotElement} from './plot';\nimport type {BoxPlotChartConfig} from '../schema';\nimport {useBoxPlotClient} from './useBoxPlotClient';\nimport {formatCategory, getYDomain, yPixelToValue} from './utils';\nimport {BoxPlotErrorBoundary} from './BoxPlotErrorBoundary';\n\n/**\n * Custom renderer for box-plot chart type.\n * Uses BoxPlotClient for SQL-based quartile calculations and custom Observable Plot rendering.\n */\nexport const BoxPlotPanelRenderer: FC<\n ChartRendererProps<BoxPlotChartConfig>\n> = ({\n tableName,\n config,\n coordinator,\n params,\n dataPolicy,\n runtimeIssueContext,\n runtimeIssueReporter,\n}) => {\n const configX = config.settings.x;\n const configY = config.settings.y;\n const boxPlotConfig = useMemo(\n () =>\n typeof configX === 'string' && typeof configY === 'string'\n ? {x: configX, y: configY}\n : null,\n [configX, configY],\n );\n\n const [size, setSize] = useState<PlotSize | null>(null);\n const [drag, setDrag] = useState<{startY: number; currentY: number} | null>(\n null,\n );\n const plotRef = useRef<HTMLDivElement>(null);\n\n const {clientRef, state} = useBoxPlotClient({\n config: boxPlotConfig,\n coordinator,\n dataPolicy,\n params,\n runtimeIssueContext,\n runtimeIssueReporter,\n tableName,\n });\n\n const summaries = useMemo<PlotSummaryDatum[]>(\n () =>\n state.summaries.map((row) => ({\n ...row,\n categoryLabel: formatCategory(row.category),\n })),\n [state.summaries],\n );\n const outliers = useMemo<PlotOutlierDatum[]>(\n () =>\n state.outliers.map((row) => ({\n ...row,\n categoryLabel: formatCategory(row.category),\n })),\n [state.outliers],\n );\n const yDomain = useMemo(\n () => getYDomain(state.summaries, state.outliers),\n [state.outliers, state.summaries],\n );\n\n useEffect(() => {\n const container = plotRef.current;\n if (!container || !size || !boxPlotConfig) {\n return;\n }\n if (!summaries.length) {\n container.replaceChildren();\n return;\n }\n\n const plot = createBoxPlotElement({\n config: boxPlotConfig,\n domain: yDomain,\n outliers,\n size,\n summaries,\n });\n container.replaceChildren(plot);\n }, [boxPlotConfig, outliers, size, summaries, yDomain]);\n\n const getLocalY = useCallback((event: ReactPointerEvent<HTMLDivElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n return event.clientY - rect.top;\n }, []);\n\n const handlePointerDown = useCallback(\n (event: ReactPointerEvent<HTMLDivElement>) => {\n if (!size || !summaries.length) return;\n event.currentTarget.setPointerCapture(event.pointerId);\n const y = getLocalY(event);\n setDrag({currentY: y, startY: y});\n },\n [getLocalY, size, summaries.length],\n );\n\n const handlePointerMove = useCallback(\n (event: ReactPointerEvent<HTMLDivElement>) => {\n if (!drag) return;\n setDrag({...drag, currentY: getLocalY(event)});\n },\n [drag, getLocalY],\n );\n\n const finishDrag = useCallback(\n (event: ReactPointerEvent<HTMLDivElement>) => {\n if (!drag || !size) return;\n event.currentTarget.releasePointerCapture(event.pointerId);\n const currentY = getLocalY(event);\n const pixelDistance = Math.abs(currentY - drag.startY);\n setDrag(null);\n if (pixelDistance < DRAG_CLICK_THRESHOLD) {\n clientRef.current?.updateYBrush();\n return;\n }\n clientRef.current?.updateYBrush([\n yPixelToValue(drag.startY, size, yDomain),\n yPixelToValue(currentY, size, yDomain),\n ]);\n },\n [clientRef, drag, getLocalY, size, yDomain],\n );\n\n const brushStyle = useMemo(() => {\n const extent = drag\n ? [drag.startY, drag.currentY]\n : state.yBrush && size\n ? state.yBrush.map((value) => {\n const plotHeight = Math.max(\n 1,\n size.height - MARGINS.top - MARGINS.bottom,\n );\n const span = yDomain[1] - yDomain[0] || 1;\n const pixelPos =\n MARGINS.top + ((yDomain[1] - value) / span) * plotHeight;\n return Math.max(\n MARGINS.top,\n Math.min(MARGINS.top + plotHeight, pixelPos),\n );\n })\n : null;\n if (!extent) return undefined;\n const top = Math.max(MARGINS.top, Math.min(...extent));\n const bottom = Math.min(\n size?.height ? size.height - MARGINS.bottom : Number.POSITIVE_INFINITY,\n Math.max(...extent),\n );\n return {\n height: `${Math.max(0, bottom - top)}px`,\n left: `${MARGINS.left}px`,\n right: `${MARGINS.right}px`,\n top: `${top}px`,\n };\n }, [drag, size, state.yBrush, yDomain]);\n\n if (!config.settings.x || !config.settings.y) {\n return (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <div className=\"text-center font-medium\">\n Configure chart to display visualization\n </div>\n <div className=\"text-center text-xs\">\n X and Y fields are required for box plot\n </div>\n </div>\n );\n }\n\n return (\n <BoxPlotErrorBoundary>\n <div className=\"h-full min-h-0 overflow-auto p-2\">\n <div className=\"bg-background text-foreground relative flex h-full min-h-[220px] w-full items-center justify-center rounded-md p-2\">\n {state.error ? (\n <div className=\"text-destructive flex h-full items-center justify-center p-4 text-sm\">\n {state.error.message}\n </div>\n ) : state.isLoading && !state.summaries.length ? (\n <SpinnerPane className=\"h-full w-full\" />\n ) : !state.summaries.length ? (\n <div className=\"text-muted-foreground flex h-full items-center justify-center text-sm\">\n No numeric values for this box plot\n </div>\n ) : (\n <ResponsivePlot\n onResize={setSize}\n className=\"relative h-full min-h-[220px] w-full\"\n >\n <div ref={plotRef} className=\"absolute inset-0\" />\n {brushStyle ? (\n <div\n className=\"bg-primary/15 border-primary/60 pointer-events-none absolute border\"\n style={brushStyle}\n />\n ) : null}\n <div\n className=\"absolute inset-0 cursor-crosshair touch-none\"\n onPointerCancel={finishDrag}\n onPointerDown={handlePointerDown}\n onPointerMove={handlePointerMove}\n onPointerUp={finishDrag}\n />\n </ResponsivePlot>\n )}\n </div>\n </div>\n </BoxPlotErrorBoundary>\n );\n};\n"]}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { Coordinator } from '@uwdata/mosaic-core';
|
|
2
2
|
import { BoxPlotClient, type BoxPlotState } from '../../../boxplot/BoxPlotClient';
|
|
3
3
|
import type { BrushSelectionParams } from '../../base-types';
|
|
4
|
+
import type { ChartDataPolicy, ChartRuntimeIssueContext, ChartRuntimeIssueReporter } from '../../../chart-runtime';
|
|
4
5
|
import { BoxPlotChartSettings } from '../schema';
|
|
5
6
|
export declare function useBoxPlotClient(args: {
|
|
6
7
|
config: BoxPlotChartSettings | null;
|
|
7
8
|
coordinator: Coordinator;
|
|
9
|
+
dataPolicy?: ChartDataPolicy | null;
|
|
8
10
|
params?: BrushSelectionParams;
|
|
11
|
+
runtimeIssueContext?: ChartRuntimeIssueContext;
|
|
12
|
+
runtimeIssueReporter?: ChartRuntimeIssueReporter;
|
|
9
13
|
tableName: string;
|
|
10
14
|
}): {
|
|
11
15
|
clientRef: import("react").RefObject<BoxPlotClient | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBoxPlotClient.d.ts","sourceRoot":"","sources":["../../../../src/chart-types/box-plot/renderer/useBoxPlotClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAY,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAC,aAAa,EAAE,KAAK,YAAY,EAAC,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,WAAW,CAAC;AAE/C,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACpC,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;;;
|
|
1
|
+
{"version":3,"file":"useBoxPlotClient.d.ts","sourceRoot":"","sources":["../../../../src/chart-types/box-plot/renderer/useBoxPlotClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAY,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAC,aAAa,EAAE,KAAK,YAAY,EAAC,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EACV,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,oBAAoB,EAAC,MAAM,WAAW,CAAC;AAE/C,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACpC,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IACpC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,mBAAmB,CAAC,EAAE,wBAAwB,CAAC;IAC/C,oBAAoB,CAAC,EAAE,yBAAyB,CAAC;IACjD,SAAS,EAAE,MAAM,CAAC;CACnB;;;EAgEA"}
|
|
@@ -2,7 +2,7 @@ import { Selection } from '@uwdata/mosaic-core';
|
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { BoxPlotClient } from '../../../boxplot/BoxPlotClient';
|
|
4
4
|
export function useBoxPlotClient(args) {
|
|
5
|
-
const { config, coordinator, params, tableName } = args;
|
|
5
|
+
const { config, coordinator, dataPolicy, params, runtimeIssueContext, runtimeIssueReporter, tableName, } = args;
|
|
6
6
|
const [state, setState] = useState({
|
|
7
7
|
isLoading: true,
|
|
8
8
|
outliers: [],
|
|
@@ -25,7 +25,10 @@ export function useBoxPlotClient(args) {
|
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
const client = new BoxPlotClient({
|
|
28
|
+
dataPolicy,
|
|
28
29
|
onStateChange: setState,
|
|
30
|
+
runtimeIssueContext,
|
|
31
|
+
runtimeIssueReporter,
|
|
29
32
|
selection,
|
|
30
33
|
tableName,
|
|
31
34
|
x: config.x,
|
|
@@ -39,7 +42,15 @@ export function useBoxPlotClient(args) {
|
|
|
39
42
|
clientRef.current = null;
|
|
40
43
|
}
|
|
41
44
|
};
|
|
42
|
-
}, [
|
|
45
|
+
}, [
|
|
46
|
+
config,
|
|
47
|
+
coordinator,
|
|
48
|
+
dataPolicy,
|
|
49
|
+
runtimeIssueContext,
|
|
50
|
+
runtimeIssueReporter,
|
|
51
|
+
selection,
|
|
52
|
+
tableName,
|
|
53
|
+
]);
|
|
43
54
|
return { clientRef, state };
|
|
44
55
|
}
|
|
45
56
|
//# sourceMappingURL=useBoxPlotClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBoxPlotClient.js","sourceRoot":"","sources":["../../../../src/chart-types/box-plot/renderer/useBoxPlotClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAC,aAAa,EAAoB,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"useBoxPlotClient.js","sourceRoot":"","sources":["../../../../src/chart-types/box-plot/renderer/useBoxPlotClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAC,aAAa,EAAoB,MAAM,gCAAgC,CAAC;AAShF,MAAM,UAAU,gBAAgB,CAAC,IAQhC;IACC,MAAM,EACJ,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,GACV,GAAG,IAAI,CAAC;IACT,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe;QAC/C,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,EAAE;KACd,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,MAAM,CAAuB,IAAI,CAAC,CAAC;IAErD,0CAA0C;IAC1C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE;QAC7B,8FAA8F;QAC9F,MAAM,cAAc,GAAG,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO,cAAc,CAAC;QACxB,CAAC;QACD,uFAAuF;QACvF,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;YACzB,OAAO;QACT,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC;YAC/B,UAAU;YACV,aAAa,EAAE,QAAQ;YACvB,mBAAmB;YACnB,oBAAoB;YACpB,SAAS;YACT,SAAS;YACT,CAAC,EAAE,MAAM,CAAC,CAAC;YACX,CAAC,EAAE,MAAM,CAAC,CAAC;SACZ,CAAC,CAAC;QACH,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;QAC3B,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAE5B,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,SAAS,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;gBACjC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE;QACD,MAAM;QACN,WAAW;QACX,UAAU;QACV,mBAAmB;QACnB,oBAAoB;QACpB,SAAS;QACT,SAAS;KACV,CAAC,CAAC;IAEH,OAAO,EAAC,SAAS,EAAE,KAAK,EAAC,CAAC;AAC5B,CAAC","sourcesContent":["import {Coordinator, Selection} from '@uwdata/mosaic-core';\nimport {useEffect, useMemo, useRef, useState} from 'react';\nimport {BoxPlotClient, type BoxPlotState} from '../../../boxplot/BoxPlotClient';\nimport type {BrushSelectionParams} from '../../base-types';\nimport type {\n ChartDataPolicy,\n ChartRuntimeIssueContext,\n ChartRuntimeIssueReporter,\n} from '../../../chart-runtime';\nimport {BoxPlotChartSettings} from '../schema';\n\nexport function useBoxPlotClient(args: {\n config: BoxPlotChartSettings | null;\n coordinator: Coordinator;\n dataPolicy?: ChartDataPolicy | null;\n params?: BrushSelectionParams;\n runtimeIssueContext?: ChartRuntimeIssueContext;\n runtimeIssueReporter?: ChartRuntimeIssueReporter;\n tableName: string;\n}) {\n const {\n config,\n coordinator,\n dataPolicy,\n params,\n runtimeIssueContext,\n runtimeIssueReporter,\n tableName,\n } = args;\n const [state, setState] = useState<BoxPlotState>({\n isLoading: true,\n outliers: [],\n summaries: [],\n });\n const clientRef = useRef<BoxPlotClient | null>(null);\n\n // Get or create the crossfilter selection\n const selection = useMemo(() => {\n // First try to get the brush selection from params (which should be connected to crossfilter)\n const brushSelection = params?.get('brush');\n if (brushSelection) {\n return brushSelection;\n }\n // Fallback: create a new crossfilter selection (shouldn't happen in dashboard context)\n return Selection.crossfilter();\n }, [params]);\n\n useEffect(() => {\n if (!config) {\n clientRef.current = null;\n return;\n }\n\n const client = new BoxPlotClient({\n dataPolicy,\n onStateChange: setState,\n runtimeIssueContext,\n runtimeIssueReporter,\n selection,\n tableName,\n x: config.x,\n y: config.y,\n });\n clientRef.current = client;\n coordinator.connect(client);\n\n return () => {\n client.destroy();\n if (clientRef.current === client) {\n clientRef.current = null;\n }\n };\n }, [\n config,\n coordinator,\n dataPolicy,\n runtimeIssueContext,\n runtimeIssueReporter,\n selection,\n tableName,\n ]);\n\n return {clientRef, state};\n}\n"]}
|
|
@@ -11,6 +11,11 @@ export declare const BoxPlotChartConfig: z.ZodObject<{
|
|
|
11
11
|
y: z.ZodString;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
13
|
settingsOpen: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
dataPolicy: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
maxRows: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>>;
|
|
14
19
|
}, z.core.$strip>;
|
|
15
20
|
export type BoxPlotChartConfig = z.infer<typeof BoxPlotChartConfig>;
|
|
16
21
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/chart-types/box-plot/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/chart-types/box-plot/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;iBAK7B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { ChartDataPolicyOverrideConfig } from '../data-policy-schema';
|
|
2
3
|
export const BoxPlotChartSettings = z.object({
|
|
3
4
|
x: z.string().describe('Categorical column for grouping'),
|
|
4
5
|
y: z.string().describe('Numeric column for distribution statistics'),
|
|
@@ -7,5 +8,6 @@ export const BoxPlotChartConfig = z.object({
|
|
|
7
8
|
chartType: z.literal('box-plot'),
|
|
8
9
|
settings: BoxPlotChartSettings,
|
|
9
10
|
settingsOpen: z.boolean().optional(),
|
|
11
|
+
dataPolicy: ChartDataPolicyOverrideConfig.optional(),
|
|
10
12
|
});
|
|
11
13
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/chart-types/box-plot/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/chart-types/box-plot/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,6BAA6B,EAAC,MAAM,uBAAuB,CAAC;AAEpE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IACzD,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;CACrE,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAChC,QAAQ,EAAE,oBAAoB;IAC9B,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACpC,UAAU,EAAE,6BAA6B,CAAC,QAAQ,EAAE;CACrD,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\nimport {ChartDataPolicyOverrideConfig} from '../data-policy-schema';\n\nexport const BoxPlotChartSettings = z.object({\n x: z.string().describe('Categorical column for grouping'),\n y: z.string().describe('Numeric column for distribution statistics'),\n});\n\nexport type BoxPlotChartSettings = z.infer<typeof BoxPlotChartSettings>;\n\nexport const BoxPlotChartConfig = z.object({\n chartType: z.literal('box-plot'),\n settings: BoxPlotChartSettings,\n settingsOpen: z.boolean().optional(),\n dataPolicy: ChartDataPolicyOverrideConfig.optional(),\n});\n\nexport type BoxPlotChartConfig = z.infer<typeof BoxPlotChartConfig>;\n"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type
|
|
2
|
+
import { type DashboardToolDeps } from '../base-types';
|
|
3
3
|
export declare const BoxPlotToolParameters: z.ZodObject<{
|
|
4
4
|
artifactId: z.ZodOptional<z.ZodString>;
|
|
5
5
|
tableName: z.ZodOptional<z.ZodString>;
|
|
6
6
|
createArtifactIfMissing: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
7
|
+
panelId: z.ZodOptional<z.ZodString>;
|
|
7
8
|
reasoning: z.ZodString;
|
|
8
9
|
settings: z.ZodObject<{
|
|
9
10
|
x: z.ZodNonOptional<z.ZodString>;
|
|
@@ -11,7 +12,7 @@ export declare const BoxPlotToolParameters: z.ZodObject<{
|
|
|
11
12
|
}, z.core.$strip>;
|
|
12
13
|
}, z.core.$strip>;
|
|
13
14
|
export type BoxPlotToolParams = z.infer<typeof BoxPlotToolParameters>;
|
|
14
|
-
export declare function createBoxPlotAiTool(deps:
|
|
15
|
+
export declare function createBoxPlotAiTool(deps: DashboardToolDeps): import("ai").Tool<{
|
|
15
16
|
createArtifactIfMissing: boolean;
|
|
16
17
|
reasoning: string;
|
|
17
18
|
settings: {
|
|
@@ -20,17 +21,12 @@ export declare function createBoxPlotAiTool(deps: ChartToolDeps): import("ai").T
|
|
|
20
21
|
};
|
|
21
22
|
artifactId?: string | undefined;
|
|
22
23
|
tableName?: string | undefined;
|
|
24
|
+
panelId?: string | undefined;
|
|
23
25
|
}, {
|
|
24
26
|
llmResult: {
|
|
25
27
|
success: boolean;
|
|
26
28
|
details: string;
|
|
27
|
-
data:
|
|
28
|
-
panelId: string;
|
|
29
|
-
artifactId: string;
|
|
30
|
-
tableName: string;
|
|
31
|
-
title: string;
|
|
32
|
-
config: any;
|
|
33
|
-
};
|
|
29
|
+
data: import("..").PanelResult;
|
|
34
30
|
errorMessage?: undefined;
|
|
35
31
|
};
|
|
36
32
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../src/chart-types/box-plot/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../src/chart-types/box-plot/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAC,KAAK,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAQrD,eAAO,MAAM,qBAAqB;;;;;;;;;;iBAEhC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEtE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;GA4E1D"}
|