@sqlrooms/mosaic 0.29.0-rc.8 → 0.29.0-rc.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -74
- package/dist/ai/agentIntent.d.ts +5 -0
- package/dist/ai/agentIntent.d.ts.map +1 -0
- package/dist/ai/agentIntent.js +8 -0
- package/dist/ai/agentIntent.js.map +1 -0
- package/dist/ai/block-document/constants.d.ts +9 -0
- package/dist/ai/block-document/constants.d.ts.map +1 -0
- package/dist/ai/block-document/constants.js +9 -0
- package/dist/ai/block-document/constants.js.map +1 -0
- package/dist/ai/block-document/createAddMosaicDashboardBlockTool.d.ts +48 -0
- package/dist/ai/block-document/createAddMosaicDashboardBlockTool.d.ts.map +1 -0
- package/dist/ai/block-document/createAddMosaicDashboardBlockTool.js +59 -0
- package/dist/ai/block-document/createAddMosaicDashboardBlockTool.js.map +1 -0
- package/dist/ai/block-document/createBlockDocumentChartTools.d.ts +19 -0
- package/dist/ai/block-document/createBlockDocumentChartTools.d.ts.map +1 -0
- package/dist/ai/block-document/createBlockDocumentChartTools.js +37 -0
- package/dist/ai/block-document/createBlockDocumentChartTools.js.map +1 -0
- package/dist/ai/block-document/createBlockDocumentDataTableExplorerTool.d.ts +32 -0
- package/dist/ai/block-document/createBlockDocumentDataTableExplorerTool.d.ts.map +1 -0
- package/dist/ai/block-document/createBlockDocumentDataTableExplorerTool.js +37 -0
- package/dist/ai/block-document/createBlockDocumentDataTableExplorerTool.js.map +1 -0
- package/dist/ai/constants.d.ts +3 -0
- package/dist/ai/constants.d.ts.map +1 -0
- package/dist/ai/constants.js +3 -0
- package/dist/ai/constants.js.map +1 -0
- package/dist/ai/createDataTableExplorerTool.d.ts +69 -0
- package/dist/ai/createDataTableExplorerTool.d.ts.map +1 -0
- package/dist/ai/createDataTableExplorerTool.js +68 -0
- package/dist/ai/createDataTableExplorerTool.js.map +1 -0
- package/dist/ai/dashboard/constants.d.ts +6 -0
- package/dist/ai/dashboard/constants.d.ts.map +1 -0
- package/dist/ai/dashboard/constants.js +6 -0
- package/dist/ai/dashboard/constants.js.map +1 -0
- package/dist/ai/dashboard/createDashboardAgentTool.d.ts +17 -0
- package/dist/ai/dashboard/createDashboardAgentTool.d.ts.map +1 -0
- package/dist/ai/dashboard/createDashboardAgentTool.js +205 -0
- package/dist/ai/dashboard/createDashboardAgentTool.js.map +1 -0
- package/dist/ai/dashboard/createDashboardAiAdapter.d.ts +14 -0
- package/dist/ai/dashboard/createDashboardAiAdapter.d.ts.map +1 -0
- package/dist/ai/dashboard/createDashboardAiAdapter.js +75 -0
- package/dist/ai/dashboard/createDashboardAiAdapter.js.map +1 -0
- package/dist/ai/dashboard/createDashboardAiTools.d.ts +26 -0
- package/dist/ai/dashboard/createDashboardAiTools.d.ts.map +1 -0
- package/dist/ai/dashboard/createDashboardAiTools.js +40 -0
- package/dist/ai/dashboard/createDashboardAiTools.js.map +1 -0
- package/dist/ai/dashboard/createDashboardChartTools.d.ts +27 -0
- package/dist/ai/dashboard/createDashboardChartTools.d.ts.map +1 -0
- package/dist/ai/dashboard/createDashboardChartTools.js +55 -0
- package/dist/ai/dashboard/createDashboardChartTools.js.map +1 -0
- package/dist/ai/dashboard/createDashboardDataTableExplorerTool.d.ts +23 -0
- package/dist/ai/dashboard/createDashboardDataTableExplorerTool.d.ts.map +1 -0
- package/dist/ai/dashboard/createDashboardDataTableExplorerTool.js +29 -0
- package/dist/ai/dashboard/createDashboardDataTableExplorerTool.js.map +1 -0
- package/dist/ai/dashboard/createListDashboardPanelsTool.d.ts +28 -0
- package/dist/ai/dashboard/createListDashboardPanelsTool.d.ts.map +1 -0
- package/dist/ai/dashboard/createListDashboardPanelsTool.js +54 -0
- package/dist/ai/dashboard/createListDashboardPanelsTool.js.map +1 -0
- package/dist/ai/dashboard/dashboard-types.d.ts +59 -0
- package/dist/ai/dashboard/dashboard-types.d.ts.map +1 -0
- package/dist/ai/dashboard/dashboard-types.js +2 -0
- package/dist/ai/dashboard/dashboard-types.js.map +1 -0
- package/dist/ai/database-types.d.ts +12 -0
- package/dist/ai/database-types.d.ts.map +1 -0
- package/dist/ai/database-types.js +2 -0
- package/dist/ai/database-types.js.map +1 -0
- package/dist/ai/errors.d.ts +8 -0
- package/dist/ai/errors.d.ts.map +1 -0
- package/dist/ai/errors.js +11 -0
- package/dist/ai/errors.js.map +1 -0
- package/dist/ai/tool-helpers.d.ts +28 -29
- package/dist/ai/tool-helpers.d.ts.map +1 -1
- package/dist/ai/tool-helpers.js +38 -76
- package/dist/ai/tool-helpers.js.map +1 -1
- package/dist/ai/tool-schemas.d.ts +9 -4
- package/dist/ai/tool-schemas.d.ts.map +1 -1
- package/dist/ai/tool-schemas.js +12 -12
- package/dist/ai/tool-schemas.js.map +1 -1
- package/dist/ai/tool-types.d.ts +19 -1
- package/dist/ai/tool-types.d.ts.map +1 -1
- package/dist/ai/tool-types.js.map +1 -1
- package/dist/ai/types.d.ts +64 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +2 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/ai.d.ts +16 -2
- package/dist/ai.d.ts.map +1 -1
- package/dist/ai.js +14 -5
- package/dist/ai.js.map +1 -1
- package/dist/charts/MosaicChart.js +1 -1
- package/dist/charts/MosaicChart.js.map +1 -1
- package/dist/charts/MosaicChartView.d.ts.map +1 -1
- package/dist/charts/MosaicChartView.js +1 -2
- package/dist/charts/MosaicChartView.js.map +1 -1
- package/dist/charts/chart-settings/MosaicChartSpecViewerPanel.d.ts.map +1 -1
- package/dist/charts/chart-settings/MosaicChartSpecViewerPanel.js +2 -1
- package/dist/charts/chart-settings/MosaicChartSpecViewerPanel.js.map +1 -1
- package/dist/charts/chart-settings/MosaicChartTypeSelector.d.ts.map +1 -1
- package/dist/charts/chart-settings/MosaicChartTypeSelector.js +4 -11
- package/dist/charts/chart-settings/MosaicChartTypeSelector.js.map +1 -1
- package/dist/charts/chart-types/base-types.d.ts +27 -23
- package/dist/charts/chart-types/base-types.d.ts.map +1 -1
- package/dist/charts/chart-types/base-types.js +3 -1
- package/dist/charts/chart-types/base-types.js.map +1 -1
- package/dist/charts/chart-types/box-plot/definition.d.ts.map +1 -1
- package/dist/charts/chart-types/box-plot/definition.js +1 -0
- package/dist/charts/chart-types/box-plot/definition.js.map +1 -1
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.d.ts +37 -3
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.d.ts.map +1 -1
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.js +26 -6
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.js.map +1 -1
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotPanelRenderer.js +2 -2
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotPanelRenderer.js.map +1 -1
- package/dist/charts/chart-types/box-plot/renderer/useBoxPlotClient.d.ts +12 -1
- package/dist/charts/chart-types/box-plot/renderer/useBoxPlotClient.d.ts.map +1 -1
- package/dist/charts/chart-types/box-plot/renderer/useBoxPlotClient.js +13 -3
- package/dist/charts/chart-types/box-plot/renderer/useBoxPlotClient.js.map +1 -1
- package/dist/charts/chart-types/box-plot/tool.d.ts +20 -24
- package/dist/charts/chart-types/box-plot/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/box-plot/tool.js +25 -33
- package/dist/charts/chart-types/box-plot/tool.js.map +1 -1
- package/dist/charts/chart-types/box-plot/validation.d.ts +9 -0
- package/dist/charts/chart-types/box-plot/validation.d.ts.map +1 -0
- package/dist/charts/chart-types/box-plot/validation.js +32 -0
- package/dist/charts/chart-types/box-plot/validation.js.map +1 -0
- package/dist/charts/chart-types/column-types.d.ts +8 -0
- package/dist/charts/chart-types/column-types.d.ts.map +1 -0
- package/dist/charts/chart-types/column-types.js +2 -0
- package/dist/charts/chart-types/column-types.js.map +1 -0
- package/dist/charts/chart-types/count-plot/definition.d.ts.map +1 -1
- package/dist/charts/chart-types/count-plot/definition.js +1 -0
- package/dist/charts/chart-types/count-plot/definition.js.map +1 -1
- package/dist/charts/chart-types/count-plot/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/count-plot/spec.js +1 -19
- package/dist/charts/chart-types/count-plot/spec.js.map +1 -1
- package/dist/charts/chart-types/count-plot/tool.d.ts +19 -24
- package/dist/charts/chart-types/count-plot/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/count-plot/tool.js +25 -32
- package/dist/charts/chart-types/count-plot/tool.js.map +1 -1
- package/dist/charts/chart-types/count-plot/validation.d.ts +8 -0
- package/dist/charts/chart-types/count-plot/validation.d.ts.map +1 -0
- package/dist/charts/chart-types/count-plot/validation.js +20 -0
- package/dist/charts/chart-types/count-plot/validation.js.map +1 -0
- package/dist/charts/chart-types/createChartInstructions.d.ts +3 -0
- package/dist/charts/chart-types/createChartInstructions.d.ts.map +1 -0
- package/dist/charts/chart-types/createChartInstructions.js +12 -0
- package/dist/charts/chart-types/createChartInstructions.js.map +1 -0
- package/dist/charts/chart-types/createChartTools.d.ts +15 -9
- package/dist/charts/chart-types/createChartTools.d.ts.map +1 -1
- package/dist/charts/chart-types/createChartTools.js +16 -10
- package/dist/charts/chart-types/createChartTools.js.map +1 -1
- package/dist/charts/chart-types/custom-spec/definition.d.ts.map +1 -1
- package/dist/charts/chart-types/custom-spec/definition.js +1 -0
- package/dist/charts/chart-types/custom-spec/definition.js.map +1 -1
- package/dist/charts/chart-types/errors.d.ts +10 -0
- package/dist/charts/chart-types/errors.d.ts.map +1 -1
- package/dist/charts/chart-types/errors.js +18 -0
- package/dist/charts/chart-types/errors.js.map +1 -1
- package/dist/charts/chart-types/heatmap/definition.d.ts.map +1 -1
- package/dist/charts/chart-types/heatmap/definition.js +1 -0
- package/dist/charts/chart-types/heatmap/definition.js.map +1 -1
- package/dist/charts/chart-types/heatmap/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/heatmap/spec.js +1 -33
- package/dist/charts/chart-types/heatmap/spec.js.map +1 -1
- package/dist/charts/chart-types/heatmap/tool.d.ts +20 -24
- package/dist/charts/chart-types/heatmap/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/heatmap/tool.js +26 -36
- package/dist/charts/chart-types/heatmap/tool.js.map +1 -1
- package/dist/charts/chart-types/heatmap/validation.d.ts +9 -0
- package/dist/charts/chart-types/heatmap/validation.d.ts.map +1 -0
- package/dist/charts/chart-types/heatmap/validation.js +34 -0
- package/dist/charts/chart-types/heatmap/validation.js.map +1 -0
- package/dist/charts/chart-types/histogram/definition.d.ts.map +1 -1
- package/dist/charts/chart-types/histogram/definition.js +1 -0
- package/dist/charts/chart-types/histogram/definition.js.map +1 -1
- package/dist/charts/chart-types/histogram/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/histogram/spec.js +1 -21
- package/dist/charts/chart-types/histogram/spec.js.map +1 -1
- package/dist/charts/chart-types/histogram/tool.d.ts +37 -24
- package/dist/charts/chart-types/histogram/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/histogram/tool.js +38 -32
- package/dist/charts/chart-types/histogram/tool.js.map +1 -1
- package/dist/charts/chart-types/histogram/validation.d.ts +9 -0
- package/dist/charts/chart-types/histogram/validation.d.ts.map +1 -0
- package/dist/charts/chart-types/histogram/validation.js +22 -0
- package/dist/charts/chart-types/histogram/validation.js.map +1 -0
- package/dist/charts/chart-types/index.d.ts +1 -7
- package/dist/charts/chart-types/index.d.ts.map +1 -1
- package/dist/charts/chart-types/index.js +2 -8
- package/dist/charts/chart-types/index.js.map +1 -1
- package/dist/charts/chart-types/line-chart/definition.d.ts.map +1 -1
- package/dist/charts/chart-types/line-chart/definition.js +1 -0
- package/dist/charts/chart-types/line-chart/definition.js.map +1 -1
- package/dist/charts/chart-types/line-chart/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/line-chart/spec.js +5 -46
- package/dist/charts/chart-types/line-chart/spec.js.map +1 -1
- package/dist/charts/chart-types/line-chart/tool.d.ts +26 -24
- package/dist/charts/chart-types/line-chart/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/line-chart/tool.js +26 -38
- package/dist/charts/chart-types/line-chart/tool.js.map +1 -1
- package/dist/charts/chart-types/line-chart/validation.d.ts +16 -0
- package/dist/charts/chart-types/line-chart/validation.d.ts.map +1 -0
- package/dist/charts/chart-types/line-chart/validation.js +43 -0
- package/dist/charts/chart-types/line-chart/validation.js.map +1 -0
- package/dist/charts/chart-types/resolveChartTypes.d.ts +3 -0
- package/dist/charts/chart-types/resolveChartTypes.d.ts.map +1 -0
- package/dist/charts/chart-types/resolveChartTypes.js +8 -0
- package/dist/charts/chart-types/resolveChartTypes.js.map +1 -0
- package/dist/charts/chart-types/scatter-plot/definition.d.ts.map +1 -1
- package/dist/charts/chart-types/scatter-plot/definition.js +1 -0
- package/dist/charts/chart-types/scatter-plot/definition.js.map +1 -1
- package/dist/charts/chart-types/scatter-plot/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/scatter-plot/spec.js +1 -45
- package/dist/charts/chart-types/scatter-plot/spec.js.map +1 -1
- package/dist/charts/chart-types/scatter-plot/tool.d.ts +21 -24
- package/dist/charts/chart-types/scatter-plot/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/scatter-plot/tool.js +28 -41
- package/dist/charts/chart-types/scatter-plot/tool.js.map +1 -1
- package/dist/charts/chart-types/scatter-plot/validation.d.ts +13 -0
- package/dist/charts/chart-types/scatter-plot/validation.d.ts.map +1 -0
- package/dist/charts/chart-types/scatter-plot/validation.js +52 -0
- package/dist/charts/chart-types/scatter-plot/validation.js.map +1 -0
- package/dist/charts/chart-types/tool-types.d.ts +43 -0
- package/dist/charts/chart-types/tool-types.d.ts.map +1 -0
- package/dist/charts/chart-types/tool-types.js +2 -0
- package/dist/charts/chart-types/tool-types.js.map +1 -0
- package/dist/charts/chart-types/utils.d.ts +3 -0
- package/dist/charts/chart-types/utils.d.ts.map +1 -0
- package/dist/charts/chart-types/utils.js +4 -0
- package/dist/charts/chart-types/utils.js.map +1 -0
- package/dist/charts/dashboard/MosaicDashboardChartRenderer.d.ts.map +1 -1
- package/dist/charts/dashboard/MosaicDashboardChartRenderer.js +5 -3
- package/dist/charts/dashboard/MosaicDashboardChartRenderer.js.map +1 -1
- package/dist/charts/useChartDataPolicy.js +2 -2
- package/dist/charts/useChartDataPolicy.js.map +1 -1
- package/dist/components/AggregationSelector.d.ts.map +1 -1
- package/dist/components/AggregationSelector.js +1 -1
- package/dist/components/AggregationSelector.js.map +1 -1
- package/dist/components/ColorSelector.d.ts.map +1 -1
- package/dist/components/ColorSelector.js +1 -2
- package/dist/components/ColorSelector.js.map +1 -1
- package/dist/components/FieldSelectorInput.d.ts.map +1 -1
- package/dist/components/FieldSelectorInput.js +3 -3
- package/dist/components/FieldSelectorInput.js.map +1 -1
- package/dist/components/TemporalGranularitySelector.d.ts.map +1 -1
- package/dist/components/TemporalGranularitySelector.js +1 -1
- package/dist/components/TemporalGranularitySelector.js.map +1 -1
- package/dist/dashboard/MosaicDashboardCommands.d.ts +19 -0
- package/dist/dashboard/MosaicDashboardCommands.d.ts.map +1 -0
- package/dist/dashboard/MosaicDashboardCommands.js +226 -0
- package/dist/dashboard/MosaicDashboardCommands.js.map +1 -0
- package/dist/dashboard/dashboard-types.d.ts.map +1 -1
- package/dist/dashboard/dashboard-types.js.map +1 -1
- package/dist/dashboard/panel/MosaicDashboardPanel.d.ts.map +1 -1
- package/dist/dashboard/panel/MosaicDashboardPanel.js +1 -1
- package/dist/dashboard/panel/MosaicDashboardPanel.js.map +1 -1
- package/dist/dashboard/panel/MosaicDashboardPanelLayout.d.ts.map +1 -1
- package/dist/dashboard/panel/MosaicDashboardPanelLayout.js +3 -3
- package/dist/dashboard/panel/MosaicDashboardPanelLayout.js.map +1 -1
- package/dist/dashboard/panel/MosaicDashboardPanels.d.ts.map +1 -1
- package/dist/dashboard/panel/MosaicDashboardPanels.js +4 -2
- package/dist/dashboard/panel/MosaicDashboardPanels.js.map +1 -1
- package/dist/dashboard/toolbar/MosaicDashboardDataTableSelector.d.ts.map +1 -1
- package/dist/dashboard/toolbar/MosaicDashboardDataTableSelector.js +4 -4
- package/dist/dashboard/toolbar/MosaicDashboardDataTableSelector.js.map +1 -1
- package/dist/dashboard/toolbar/MosaicDashboardToolbar.d.ts.map +1 -1
- package/dist/dashboard/toolbar/MosaicDashboardToolbar.js +5 -3
- package/dist/dashboard/toolbar/MosaicDashboardToolbar.js.map +1 -1
- package/dist/dashboard/useSelectedOrFirstTable.d.ts +1 -1
- package/dist/dashboard/useSelectedOrFirstTable.d.ts.map +1 -1
- package/dist/dashboard/useSelectedOrFirstTable.js +10 -8
- package/dist/dashboard/useSelectedOrFirstTable.js.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerCategoryClient.d.ts +3 -2
- package/dist/data-table-explorer/DataTableExplorerCategoryClient.d.ts.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerCategoryClient.js +3 -3
- package/dist/data-table-explorer/DataTableExplorerCategoryClient.js.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerCountClient.d.ts +3 -1
- package/dist/data-table-explorer/DataTableExplorerCountClient.d.ts.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerCountClient.js +3 -3
- package/dist/data-table-explorer/DataTableExplorerCountClient.js.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerHistogramClient.d.ts +3 -2
- package/dist/data-table-explorer/DataTableExplorerHistogramClient.d.ts.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerHistogramClient.js +4 -4
- package/dist/data-table-explorer/DataTableExplorerHistogramClient.js.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerPageClient.d.ts +3 -1
- package/dist/data-table-explorer/DataTableExplorerPageClient.d.ts.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerPageClient.js +3 -1
- package/dist/data-table-explorer/DataTableExplorerPageClient.js.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerUnsupportedSummaryClient.d.ts +3 -2
- package/dist/data-table-explorer/DataTableExplorerUnsupportedSummaryClient.d.ts.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerUnsupportedSummaryClient.js +3 -3
- package/dist/data-table-explorer/DataTableExplorerUnsupportedSummaryClient.js.map +1 -1
- package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.d.ts.map +1 -1
- package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.js +7 -4
- package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.js.map +1 -1
- package/dist/data-table-explorer/dataTableExplorerController.d.ts +58 -2
- package/dist/data-table-explorer/dataTableExplorerController.d.ts.map +1 -1
- package/dist/data-table-explorer/dataTableExplorerController.js +68 -8
- package/dist/data-table-explorer/dataTableExplorerController.js.map +1 -1
- package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.d.ts +23 -1
- package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.d.ts.map +1 -1
- package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.js +46 -13
- package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.js.map +1 -1
- package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.d.ts +17 -3
- package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.d.ts.map +1 -1
- package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.js +9 -6
- package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.js.map +1 -1
- package/dist/data-table-explorer/types.d.ts +10 -0
- package/dist/data-table-explorer/types.d.ts.map +1 -1
- package/dist/data-table-explorer/types.js.map +1 -1
- package/dist/data-table-explorer/useDataTableExplorer.d.ts.map +1 -1
- package/dist/data-table-explorer/useDataTableExplorer.js +10 -6
- package/dist/data-table-explorer/useDataTableExplorer.js.map +1 -1
- package/dist/data-table-explorer/utils.d.ts +64 -6
- package/dist/data-table-explorer/utils.d.ts.map +1 -1
- package/dist/data-table-explorer/utils.js +58 -0
- package/dist/data-table-explorer/utils.js.map +1 -1
- package/dist/data-table-explorer/worksheet/DataTableBlockRenderer.d.ts.map +1 -1
- package/dist/data-table-explorer/worksheet/DataTableBlockRenderer.js +2 -2
- package/dist/data-table-explorer/worksheet/DataTableBlockRenderer.js.map +1 -1
- package/dist/index.d.ts +49 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +81 -25
- package/dist/index.js.map +1 -1
- package/dist/mosaicTableReference.d.ts +59 -0
- package/dist/mosaicTableReference.d.ts.map +1 -0
- package/dist/mosaicTableReference.js +68 -0
- package/dist/mosaicTableReference.js.map +1 -0
- package/dist/useVgPlotChartRender.d.ts.map +1 -1
- package/dist/useVgPlotChartRender.js +26 -1
- package/dist/useVgPlotChartRender.js.map +1 -1
- package/dist/utils/table-lookup.d.ts +7 -0
- package/dist/utils/table-lookup.d.ts.map +1 -0
- package/dist/utils/table-lookup.js +10 -0
- package/dist/utils/table-lookup.js.map +1 -0
- package/package.json +14 -14
- package/dist/ai/ai.d.ts +0 -108
- package/dist/ai/ai.d.ts.map +0 -1
- package/dist/ai/ai.js +0 -461
- package/dist/ai/ai.js.map +0 -1
- package/dist/ai/data-table-explorer-tool.d.ts +0 -40
- package/dist/ai/data-table-explorer-tool.d.ts.map +0 -1
- package/dist/ai/data-table-explorer-tool.js +0 -75
- package/dist/ai/data-table-explorer-tool.js.map +0 -1
- package/dist/ai/list-panels-tool.d.ts +0 -35
- package/dist/ai/list-panels-tool.d.ts.map +0 -1
- package/dist/ai/list-panels-tool.js +0 -66
- package/dist/ai/list-panels-tool.js.map +0 -1
- package/dist/ai/remove-panel-tool.d.ts +0 -31
- package/dist/ai/remove-panel-tool.d.ts.map +0 -1
- package/dist/ai/remove-panel-tool.js +0 -55
- package/dist/ai/remove-panel-tool.js.map +0 -1
- package/dist/ai/tool-validation.d.ts +0 -3
- package/dist/ai/tool-validation.d.ts.map +0 -1
- package/dist/ai/tool-validation.js +0 -11
- package/dist/ai/tool-validation.js.map +0 -1
- package/dist/components/Combobox.d.ts +0 -45
- package/dist/components/Combobox.d.ts.map +0 -1
- package/dist/components/Combobox.js +0 -58
- package/dist/components/Combobox.js.map +0 -1
- package/dist/components/useCombobox.d.ts +0 -23
- package/dist/components/useCombobox.d.ts.map +0 -1
- package/dist/components/useCombobox.js +0 -26
- package/dist/components/useCombobox.js.map +0 -1
package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MosaicDashboardDataTableExplorerPanelRenderer.js","sourceRoot":"","sources":["../../../src/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"MosaicDashboardDataTableExplorerPanelRenderer.js","sourceRoot":"","sources":["../../../src/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AAChE,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAGL,2BAA2B,GAC5B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAC,0BAA0B,EAAC,MAAM,4CAA4C,CAAC;AACtF,OAAO,EAAC,gCAAgC,EAAC,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAK,OAAO,EAAC,MAAM,OAAO,CAAC;AAClC,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAC,6CAA6C,EAAC,MAAM,iDAAiD,CAAC;AAE9G,OAAO,EAAC,oBAAoB,EAAC,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAC,2BAA2B,EAAC,MAAM,4BAA4B,CAAC;AAOvE,MAAM,6CAA6C,GAE/C,CAAC,EAAC,KAAK,EAAE,SAAS,EAAE,a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AAG,IAC3B,GACiB,CAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,wCAAwC,GAE1C,CAAC,EAAC,KAAK,EAAE,SAAS,EAAE,aAAa,EAAC,EAAE,EAAE;IACxC,MAAM,MAAM,GAAG,oBAAoB,EAAE,CAAC;IACtC,MAAM,aAAa,GAAG,OAAO,CAC3B,GAAG,EAAE,CAAC,2BAA2B,CAAC,MAAM,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC,KAAK,EACxE,CAAC,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC,CAClC,CAAC;IAEF,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,CACL,cAAK,SAAS,EAAC,2EAA2E,mEAEpF,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,6CAA6C,IAC5C,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,GAC5B,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,6CAA6C,GACxD;IACE,SAAS,EAAE,wCAAwC;IACnD,aAAa,EAAE,6CAA6C;IAC5D,IAAI,EAAE,mBAAmB;CAC1B,CAAC","sourcesContent":["import {ScrollArea, ScrollBar, SpinnerPane} from '@sqlrooms/ui';\nimport {TablePropertiesIcon} from 'lucide-react';\nimport {DataTableExplorer} from '../DataTableExplorer';\nimport type {DataTableExplorerPanel} from '../../dashboard/dashboard-types';\nimport {\n type MosaicDashboardPanelRenderer,\n type DataTableExplorerPanelRendererProps,\n useStoreWithMosaicDashboard,\n} from '../../dashboard/MosaicDashboardSlice';\nimport {usePanelClientRegistration} from '../../dashboard/usePanelClientRegistration';\nimport {useDataTableExplorerPanelClients} from './useDataTableExplorerPanelClients';\nimport {FC, useMemo} from 'react';\nimport {useDataTableExplorer} from '../useDataTableExplorer';\nimport {MosaicDashboardDataTableExplorerHeaderActions} from './MosaicDashboardDataTableExplorerHeaderActions';\nimport type {DataTable} from '@sqlrooms/db';\nimport {useTablesWithColumns} from '../../hooks/useTablesWithColumns';\nimport {resolveMosaicTableReference} from '../../mosaicTableReference';\n\ntype MosaicDashboardDataTableExplorerRendererInnerProps = Omit<\n DataTableExplorerPanelRendererProps,\n 'dashboardId'\n> & {selectedTable: DataTable};\n\nconst MosaicDashboardDataTableExplorerRendererInner: FC<\n MosaicDashboardDataTableExplorerRendererInnerProps\n> = ({panel, dashboard, selectionName, selectedTable}) => {\n const connection = useStoreWithMosaicDashboard(\n (state) => state.mosaic.connection,\n );\n\n const pageSize =\n typeof panel.config.pageSize === 'number'\n ? panel.config.pageSize\n : undefined;\n\n const explorer = useDataTableExplorer({\n tableName: selectedTable.table,\n pageSize: pageSize ?? 10,\n selectionName,\n });\n\n const explorerClients = useDataTableExplorerPanelClients(\n explorer,\n selectedTable,\n connection.status,\n );\n\n usePanelClientRegistration(dashboard.id, panel.id, explorerClients);\n\n if (connection.status === 'loading') {\n return <SpinnerPane className=\"h-full w-full\" />;\n }\n\n if (connection.status !== 'ready') {\n return (\n <div className=\"text-muted-foreground flex h-full items-center justify-center p-4 text-sm\">\n Mosaic connection is not ready.\n </div>\n );\n }\n\n return (\n <DataTableExplorer.Root explorer={explorer}>\n <div className=\"flex h-full min-h-0 flex-col\">\n <ScrollArea className=\"min-h-0 flex-1\">\n <DataTableExplorer.Table>\n <DataTableExplorer.Header />\n <DataTableExplorer.Rows />\n </DataTableExplorer.Table>\n <ScrollBar orientation=\"horizontal\" />\n </ScrollArea>\n <DataTableExplorer.StatusBar />\n </div>\n </DataTableExplorer.Root>\n );\n};\n\nconst MosaicDashboardDataTableExplorerRenderer: FC<\n DataTableExplorerPanelRendererProps\n> = ({panel, dashboard, selectionName}) => {\n const tables = useTablesWithColumns();\n const selectedTable = useMemo(\n () => resolveMosaicTableReference(tables, dashboard.selectedTable).table,\n [dashboard.selectedTable, tables],\n );\n\n if (!selectedTable) {\n return (\n <div className=\"text-muted-foreground flex h-full items-center justify-center p-4 text-sm\">\n Data Table Explorer panels require a table source.\n </div>\n );\n }\n\n return (\n <MosaicDashboardDataTableExplorerRendererInner\n panel={panel}\n dashboard={dashboard}\n selectionName={selectionName}\n selectedTable={selectedTable}\n />\n );\n};\n\nexport const mosaicDashboardDataTableExplorerPanelRenderer: MosaicDashboardPanelRenderer<DataTableExplorerPanel> =\n {\n component: MosaicDashboardDataTableExplorerRenderer,\n headerActions: MosaicDashboardDataTableExplorerHeaderActions,\n icon: TablePropertiesIcon,\n };\n"]}
|
|
@@ -2,17 +2,29 @@ import type { MosaicClient, Selection } from '@uwdata/mosaic-core';
|
|
|
2
2
|
import { queryFieldInfo } from '@uwdata/mosaic-core';
|
|
3
3
|
import type * as arrow from 'apache-arrow';
|
|
4
4
|
import { DataTableExplorerCountClient } from './DataTableExplorerCountClient';
|
|
5
|
-
import type { DataTableExplorerSorting } from './types';
|
|
5
|
+
import type { DataTableExplorerSqlTableReference, DataTableExplorerSorting } from './types';
|
|
6
6
|
import type { DataTableExplorerStore } from './createDataTableExplorerStore';
|
|
7
7
|
/**
|
|
8
8
|
* Loads field metadata for the dataTableExplorer table and writes the normalized field
|
|
9
9
|
* definitions into the dataTableExplorer store.
|
|
10
|
+
*
|
|
11
|
+
* @param options.columns Optional subset of column names to load. When omitted,
|
|
12
|
+
* metadata is loaded for every column in the table.
|
|
13
|
+
* @param options.coordinator Mosaic coordinator used to run the field-info query.
|
|
14
|
+
* @param options.store Instance store that receives schema loading, success, and
|
|
15
|
+
* error state.
|
|
16
|
+
* @param options.tableIdentity Stable SQLRooms table identity used for store keys.
|
|
17
|
+
* This should preserve catalog/database identity when available.
|
|
18
|
+
* @param options.tableReference Mosaic SQL table reference used to query the table.
|
|
19
|
+
* Prefer a TableRefNode for qualified table names so dotted identifier parts are
|
|
20
|
+
* not reparsed as separate identifiers.
|
|
10
21
|
*/
|
|
11
22
|
export declare function loadDataTableExplorerSchema(options: {
|
|
12
23
|
columns?: string[];
|
|
13
24
|
coordinator: Parameters<typeof queryFieldInfo>[0];
|
|
14
25
|
store: DataTableExplorerStore;
|
|
15
|
-
|
|
26
|
+
tableIdentity: string;
|
|
27
|
+
tableReference: DataTableExplorerSqlTableReference;
|
|
16
28
|
}): Promise<void>;
|
|
17
29
|
type ReadyConnection = {
|
|
18
30
|
coordinator: {
|
|
@@ -23,6 +35,20 @@ type ReadyConnection = {
|
|
|
23
35
|
/**
|
|
24
36
|
* Connects the paged row client for the current dataTableExplorer page and disconnects
|
|
25
37
|
* it when the caller tears down the lifecycle.
|
|
38
|
+
*
|
|
39
|
+
* @param options.connection Ready Mosaic connection that owns client
|
|
40
|
+
* registration.
|
|
41
|
+
* @param options.fieldNames Ordered fields to include in the page query and page
|
|
42
|
+
* dataset identity.
|
|
43
|
+
* @param options.filter Optional row filter applied to the page query.
|
|
44
|
+
* @param options.pagination Current page index and page size.
|
|
45
|
+
* @param options.sorting Current sort descriptors.
|
|
46
|
+
* @param options.store Instance store that receives page loading, data, and error
|
|
47
|
+
* state.
|
|
48
|
+
* @param options.tableName Stable SQLRooms table identity used for page dataset
|
|
49
|
+
* keys.
|
|
50
|
+
* @param options.tableReference Mosaic SQL table reference used in generated page
|
|
51
|
+
* queries.
|
|
26
52
|
*/
|
|
27
53
|
export declare function connectDataTableExplorerPageClient(options: {
|
|
28
54
|
connection: ReadyConnection;
|
|
@@ -35,10 +61,25 @@ export declare function connectDataTableExplorerPageClient(options: {
|
|
|
35
61
|
sorting: DataTableExplorerSorting;
|
|
36
62
|
store: DataTableExplorerStore;
|
|
37
63
|
tableName: string;
|
|
64
|
+
tableReference: DataTableExplorerSqlTableReference;
|
|
38
65
|
}): () => void;
|
|
39
66
|
/**
|
|
40
67
|
* Connects either the filtered or total count client and routes updates into
|
|
41
68
|
* the corresponding store slice.
|
|
69
|
+
*
|
|
70
|
+
* @param options.connection Ready Mosaic connection that owns client
|
|
71
|
+
* registration.
|
|
72
|
+
* @param options.filterStable Whether Mosaic can treat this count query as
|
|
73
|
+
* stable under filter changes.
|
|
74
|
+
* @param options.selection Optional Mosaic selection that supplies cross-filter
|
|
75
|
+
* predicates.
|
|
76
|
+
* @param options.store Instance store that receives filtered or total count
|
|
77
|
+
* state.
|
|
78
|
+
* @param options.tableName Stable SQLRooms table identity used for client state.
|
|
79
|
+
* @param options.tableReference Mosaic SQL table reference used in generated count
|
|
80
|
+
* queries.
|
|
81
|
+
* @param options.target Selects whether updates go to the filtered or total count
|
|
82
|
+
* store slice.
|
|
42
83
|
*/
|
|
43
84
|
export declare function connectDataTableExplorerCountClient(options: {
|
|
44
85
|
connection: ReadyConnection;
|
|
@@ -46,6 +87,7 @@ export declare function connectDataTableExplorerCountClient(options: {
|
|
|
46
87
|
selection?: Selection;
|
|
47
88
|
store: DataTableExplorerStore;
|
|
48
89
|
tableName: string;
|
|
90
|
+
tableReference: DataTableExplorerSqlTableReference;
|
|
49
91
|
target: 'filtered' | 'total';
|
|
50
92
|
}): {
|
|
51
93
|
client: DataTableExplorerCountClient;
|
|
@@ -54,6 +96,19 @@ export declare function connectDataTableExplorerCountClient(options: {
|
|
|
54
96
|
/**
|
|
55
97
|
* Connects all per-column summary clients for the active schema and initializes
|
|
56
98
|
* matching empty summary state in the dataTableExplorer store.
|
|
99
|
+
*
|
|
100
|
+
* @param options.categoryLimit Maximum number of category buckets to expose before
|
|
101
|
+
* grouping the remainder into an overflow bucket.
|
|
102
|
+
* @param options.connection Ready Mosaic connection that owns summary client
|
|
103
|
+
* registration.
|
|
104
|
+
* @param options.fields Active Arrow fields to summarize.
|
|
105
|
+
* @param options.selection Mosaic selection shared by summary clients.
|
|
106
|
+
* @param options.store Instance store that receives summary state.
|
|
107
|
+
* @param options.summaryBins Requested bin count for histogram summaries.
|
|
108
|
+
* @param options.tableName Human-readable or string table reference kept for
|
|
109
|
+
* summary clients that still accept string identities.
|
|
110
|
+
* @param options.tableReference Mosaic SQL table reference used in generated
|
|
111
|
+
* summary queries.
|
|
57
112
|
*/
|
|
58
113
|
export declare function connectDataTableExplorerSummaryClients(options: {
|
|
59
114
|
categoryLimit: number;
|
|
@@ -63,6 +118,7 @@ export declare function connectDataTableExplorerSummaryClients(options: {
|
|
|
63
118
|
store: DataTableExplorerStore;
|
|
64
119
|
summaryBins: number;
|
|
65
120
|
tableName: string;
|
|
121
|
+
tableReference: DataTableExplorerSqlTableReference;
|
|
66
122
|
}): () => void;
|
|
67
123
|
export {};
|
|
68
124
|
//# sourceMappingURL=dataTableExplorerController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataTableExplorerController.d.ts","sourceRoot":"","sources":["../../src/data-table-explorer/dataTableExplorerController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAK3C,OAAO,EAAC,4BAA4B,EAAC,MAAM,gCAAgC,CAAC;AAO5E,OAAO,KAAK,EAEV,wBAAwB,EACzB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC;AAY3E
|
|
1
|
+
{"version":3,"file":"dataTableExplorerController.d.ts","sourceRoot":"","sources":["../../src/data-table-explorer/dataTableExplorerController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAK3C,OAAO,EAAC,4BAA4B,EAAC,MAAM,gCAAgC,CAAC;AAO5E,OAAO,KAAK,EAEV,kCAAkC,EAClC,wBAAwB,EACzB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC;AAY3E;;;;;;;;;;;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sBA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sCAAsC,CAAC,OAAO,EAAE;IAC9D,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,eAAe,CAAC;IAC5B,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,sBAAsB,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,kCAAkC,CAAC;CACpD,cA4EA"}
|
|
@@ -11,26 +11,54 @@ function toError(error) {
|
|
|
11
11
|
/**
|
|
12
12
|
* Loads field metadata for the dataTableExplorer table and writes the normalized field
|
|
13
13
|
* definitions into the dataTableExplorer store.
|
|
14
|
+
*
|
|
15
|
+
* @param options.columns Optional subset of column names to load. When omitted,
|
|
16
|
+
* metadata is loaded for every column in the table.
|
|
17
|
+
* @param options.coordinator Mosaic coordinator used to run the field-info query.
|
|
18
|
+
* @param options.store Instance store that receives schema loading, success, and
|
|
19
|
+
* error state.
|
|
20
|
+
* @param options.tableIdentity Stable SQLRooms table identity used for store keys.
|
|
21
|
+
* This should preserve catalog/database identity when available.
|
|
22
|
+
* @param options.tableReference Mosaic SQL table reference used to query the table.
|
|
23
|
+
* Prefer a TableRefNode for qualified table names so dotted identifier parts are
|
|
24
|
+
* not reparsed as separate identifiers.
|
|
14
25
|
*/
|
|
15
26
|
export async function loadDataTableExplorerSchema(options) {
|
|
16
|
-
const { columns, coordinator, store,
|
|
17
|
-
store.getState().setSchemaLoading(true,
|
|
27
|
+
const { columns, coordinator, store, tableIdentity, tableReference } = options;
|
|
28
|
+
store.getState().setSchemaLoading(true, tableIdentity);
|
|
18
29
|
try {
|
|
30
|
+
// queryFieldInfo is typed as string-only, but Mosaic's runtime accepts
|
|
31
|
+
// TableRefNode values and preserves identifier boundaries for dotted names.
|
|
32
|
+
const fieldInfoTable = tableReference;
|
|
19
33
|
const fieldInfo = await queryFieldInfo(coordinator, columns?.length
|
|
20
|
-
? columns.map((column) => ({ column, table:
|
|
21
|
-
: [{ column: '*', table:
|
|
34
|
+
? columns.map((column) => ({ column, table: fieldInfoTable }))
|
|
35
|
+
: [{ column: '*', table: fieldInfoTable }]);
|
|
22
36
|
store
|
|
23
37
|
.getState()
|
|
24
|
-
.setSchemaSuccess(fieldInfo.map(fieldInfoToDataTableExplorerField),
|
|
38
|
+
.setSchemaSuccess(fieldInfo.map(fieldInfoToDataTableExplorerField), tableIdentity);
|
|
25
39
|
}
|
|
26
40
|
catch (error) {
|
|
27
|
-
store.getState().setSchemaSuccess([],
|
|
28
|
-
store.getState().setSchemaError(toError(error),
|
|
41
|
+
store.getState().setSchemaSuccess([], tableIdentity);
|
|
42
|
+
store.getState().setSchemaError(toError(error), tableIdentity);
|
|
29
43
|
}
|
|
30
44
|
}
|
|
31
45
|
/**
|
|
32
46
|
* Connects the paged row client for the current dataTableExplorer page and disconnects
|
|
33
47
|
* it when the caller tears down the lifecycle.
|
|
48
|
+
*
|
|
49
|
+
* @param options.connection Ready Mosaic connection that owns client
|
|
50
|
+
* registration.
|
|
51
|
+
* @param options.fieldNames Ordered fields to include in the page query and page
|
|
52
|
+
* dataset identity.
|
|
53
|
+
* @param options.filter Optional row filter applied to the page query.
|
|
54
|
+
* @param options.pagination Current page index and page size.
|
|
55
|
+
* @param options.sorting Current sort descriptors.
|
|
56
|
+
* @param options.store Instance store that receives page loading, data, and error
|
|
57
|
+
* state.
|
|
58
|
+
* @param options.tableName Stable SQLRooms table identity used for page dataset
|
|
59
|
+
* keys.
|
|
60
|
+
* @param options.tableReference Mosaic SQL table reference used in generated page
|
|
61
|
+
* queries.
|
|
34
62
|
*/
|
|
35
63
|
export function connectDataTableExplorerPageClient(options) {
|
|
36
64
|
const client = new DataTableExplorerPageClient({
|
|
@@ -40,6 +68,7 @@ export function connectDataTableExplorerPageClient(options) {
|
|
|
40
68
|
pagination: options.pagination,
|
|
41
69
|
sorting: options.sorting,
|
|
42
70
|
tableName: options.tableName,
|
|
71
|
+
tableReference: options.tableReference,
|
|
43
72
|
});
|
|
44
73
|
options.connection.coordinator.connect(client);
|
|
45
74
|
return () => {
|
|
@@ -49,6 +78,20 @@ export function connectDataTableExplorerPageClient(options) {
|
|
|
49
78
|
/**
|
|
50
79
|
* Connects either the filtered or total count client and routes updates into
|
|
51
80
|
* the corresponding store slice.
|
|
81
|
+
*
|
|
82
|
+
* @param options.connection Ready Mosaic connection that owns client
|
|
83
|
+
* registration.
|
|
84
|
+
* @param options.filterStable Whether Mosaic can treat this count query as
|
|
85
|
+
* stable under filter changes.
|
|
86
|
+
* @param options.selection Optional Mosaic selection that supplies cross-filter
|
|
87
|
+
* predicates.
|
|
88
|
+
* @param options.store Instance store that receives filtered or total count
|
|
89
|
+
* state.
|
|
90
|
+
* @param options.tableName Stable SQLRooms table identity used for client state.
|
|
91
|
+
* @param options.tableReference Mosaic SQL table reference used in generated count
|
|
92
|
+
* queries.
|
|
93
|
+
* @param options.target Selects whether updates go to the filtered or total count
|
|
94
|
+
* store slice.
|
|
52
95
|
*/
|
|
53
96
|
export function connectDataTableExplorerCountClient(options) {
|
|
54
97
|
const setCountState = options.target === 'filtered'
|
|
@@ -59,6 +102,7 @@ export function connectDataTableExplorerCountClient(options) {
|
|
|
59
102
|
onStateChange: setCountState,
|
|
60
103
|
selection: options.selection,
|
|
61
104
|
tableName: options.tableName,
|
|
105
|
+
tableReference: options.tableReference,
|
|
62
106
|
});
|
|
63
107
|
options.connection.coordinator.connect(client);
|
|
64
108
|
return {
|
|
@@ -71,9 +115,22 @@ export function connectDataTableExplorerCountClient(options) {
|
|
|
71
115
|
/**
|
|
72
116
|
* Connects all per-column summary clients for the active schema and initializes
|
|
73
117
|
* matching empty summary state in the dataTableExplorer store.
|
|
118
|
+
*
|
|
119
|
+
* @param options.categoryLimit Maximum number of category buckets to expose before
|
|
120
|
+
* grouping the remainder into an overflow bucket.
|
|
121
|
+
* @param options.connection Ready Mosaic connection that owns summary client
|
|
122
|
+
* registration.
|
|
123
|
+
* @param options.fields Active Arrow fields to summarize.
|
|
124
|
+
* @param options.selection Mosaic selection shared by summary clients.
|
|
125
|
+
* @param options.store Instance store that receives summary state.
|
|
126
|
+
* @param options.summaryBins Requested bin count for histogram summaries.
|
|
127
|
+
* @param options.tableName Human-readable or string table reference kept for
|
|
128
|
+
* summary clients that still accept string identities.
|
|
129
|
+
* @param options.tableReference Mosaic SQL table reference used in generated
|
|
130
|
+
* summary queries.
|
|
74
131
|
*/
|
|
75
132
|
export function connectDataTableExplorerSummaryClients(options) {
|
|
76
|
-
const { categoryLimit, connection, fields, selection, store, summaryBins, tableName, } = options;
|
|
133
|
+
const { categoryLimit, connection, fields, selection, store, summaryBins, tableName, tableReference, } = options;
|
|
77
134
|
store.getState().initializeSummaries(fields);
|
|
78
135
|
const clients = fields.flatMap((field) => {
|
|
79
136
|
const update = (summary) => {
|
|
@@ -86,6 +143,7 @@ export function connectDataTableExplorerSummaryClients(options) {
|
|
|
86
143
|
onStateChange: update,
|
|
87
144
|
selection,
|
|
88
145
|
tableName,
|
|
146
|
+
tableReference,
|
|
89
147
|
}),
|
|
90
148
|
];
|
|
91
149
|
}
|
|
@@ -96,6 +154,7 @@ export function connectDataTableExplorerSummaryClients(options) {
|
|
|
96
154
|
selection,
|
|
97
155
|
steps: summaryBins,
|
|
98
156
|
tableName,
|
|
157
|
+
tableReference,
|
|
99
158
|
valueType: getDataTableExplorerValueType(field.type) === 'date'
|
|
100
159
|
? 'date'
|
|
101
160
|
: 'number',
|
|
@@ -113,6 +172,7 @@ export function connectDataTableExplorerSummaryClients(options) {
|
|
|
113
172
|
onStateChange: update,
|
|
114
173
|
selection,
|
|
115
174
|
tableName,
|
|
175
|
+
tableReference,
|
|
116
176
|
});
|
|
117
177
|
return [
|
|
118
178
|
summaryClient,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataTableExplorerController.js","sourceRoot":"","sources":["../../src/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AK,MAAM;oBAClD,CAAC,CAAC,MAAM;oBACR,CAAC,CAAC,QAAQ;aACf,CAAC,CAAC;YAEH,OAAO;gBACL,aAAa;gBACb,IAAI,qCAAqC,CAAC;oBACxC,aAAa;iBACd,CAAC;aACH,CAAC;QACJ,CAAC;QAED,MAAM,aAAa,GAAG,IAAI,+BAA+B,CAAC;YACxD,aAAa;YACb,KAAK;YACL,aAAa,EAAE,MAAM;YACrB,SAAS;YACT,SAAS;SACV,CAAC,CAAC;QAEH,OAAO;YACL,aAAa;YACb,IAAI,oCAAoC,CAAC;gBACvC,aAAa;aACd,CAAC;SACH,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAEpE,OAAO,GAAG,EAAE;QACV,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9C,KAAK,CAAC,QAAQ,EAAE,CAAC,cAAc,EAAE,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type {MosaicClient, Selection} from '@uwdata/mosaic-core';\nimport {queryFieldInfo} from '@uwdata/mosaic-core';\nimport type * as arrow from 'apache-arrow';\nimport {\n DataTableExplorerCategoryClient,\n DataTableExplorerCategoryTotalClient,\n} from './DataTableExplorerCategoryClient';\nimport {DataTableExplorerCountClient} from './DataTableExplorerCountClient';\nimport {\n DataTableExplorerHistogramClient,\n DataTableExplorerHistogramTotalClient,\n} from './DataTableExplorerHistogramClient';\nimport {DataTableExplorerPageClient} from './DataTableExplorerPageClient';\nimport {DataTableExplorerUnsupportedSummaryClient} from './DataTableExplorerUnsupportedSummaryClient';\nimport type {\n DataTableExplorerSummaryState,\n DataTableExplorerSorting,\n} from './types';\nimport type {DataTableExplorerStore} from './createDataTableExplorerStore';\nimport {\n fieldInfoToDataTableExplorerField,\n getDataTableExplorerValueType,\n isDataTableExplorerHistogramType,\n isDataTableExplorerUnsupportedSummaryType,\n} from './utils';\n\nfunction toError(error: unknown): Error {\n return error instanceof Error ? error : new Error(String(error));\n}\n\n/**\n * Loads field metadata for the dataTableExplorer table and writes the normalized field\n * definitions into the dataTableExplorer store.\n */\nexport async function loadDataTableExplorerSchema(options: {\n columns?: string[];\n coordinator: Parameters<typeof queryFieldInfo>[0];\n store: DataTableExplorerStore;\n tableName: string;\n}) {\n const {columns, coordinator, store, tableName} = options;\n store.getState().setSchemaLoading(true, tableName);\n\n try {\n const fieldInfo = await queryFieldInfo(\n coordinator,\n columns?.length\n ? columns.map((column) => ({column, table: tableName}))\n : [{column: '*', table: tableName}],\n );\n store\n .getState()\n .setSchemaSuccess(\n fieldInfo.map(fieldInfoToDataTableExplorerField),\n tableName,\n );\n } catch (error: unknown) {\n store.getState().setSchemaSuccess([], tableName);\n store.getState().setSchemaError(toError(error), tableName);\n }\n}\n\ntype ReadyConnection = {\n coordinator: {\n connect: (client: MosaicClient) => void;\n disconnect: (client: MosaicClient) => void;\n };\n};\n\n/**\n * Connects the paged row client for the current dataTableExplorer page and disconnects\n * it when the caller tears down the lifecycle.\n */\nexport function connectDataTableExplorerPageClient(options: {\n connection: ReadyConnection;\n fieldNames: string[];\n filter?: ReturnType<Selection['predicate']>;\n pagination: {pageIndex: number; pageSize: number};\n sorting: DataTableExplorerSorting;\n store: DataTableExplorerStore;\n tableName: string;\n}) {\n const client = new DataTableExplorerPageClient({\n columns: options.fieldNames,\n filter: options.filter,\n onStateChange: (state) => options.store.getState().setPage(state),\n pagination: options.pagination,\n sorting: options.sorting,\n tableName: options.tableName,\n });\n\n options.connection.coordinator.connect(client);\n\n return () => {\n client.destroy();\n };\n}\n\n/**\n * Connects either the filtered or total count client and routes updates into\n * the corresponding store slice.\n */\nexport function connectDataTableExplorerCountClient(options: {\n connection: ReadyConnection;\n filterStable?: boolean;\n selection?: Selection;\n store: DataTableExplorerStore;\n tableName: string;\n target: 'filtered' | 'total';\n}) {\n const setCountState =\n options.target === 'filtered'\n ? options.store.getState().setFilteredCount\n : options.store.getState().setTotalCount;\n\n const client = new DataTableExplorerCountClient({\n filterStable: options.filterStable,\n onStateChange: setCountState,\n selection: options.selection,\n tableName: options.tableName,\n });\n\n options.connection.coordinator.connect(client);\n\n return {\n client,\n cleanup: () => {\n client.destroy();\n },\n };\n}\n\n/**\n * Connects all per-column summary clients for the active schema and initializes\n * matching empty summary state in the dataTableExplorer store.\n */\nexport function connectDataTableExplorerSummaryClients(options: {\n categoryLimit: number;\n connection: ReadyConnection;\n fields: arrow.Field[];\n selection: Selection;\n store: DataTableExplorerStore;\n summaryBins: number;\n tableName: string;\n}) {\n const {\n categoryLimit,\n connection,\n fields,\n selection,\n store,\n summaryBins,\n tableName,\n } = options;\n\n store.getState().initializeSummaries(fields);\n\n const clients: MosaicClient[] = fields.flatMap((field): MosaicClient[] => {\n const update = (summary: DataTableExplorerSummaryState) => {\n store.getState().setSummary(field.name, summary);\n };\n\n if (isDataTableExplorerUnsupportedSummaryType(field.type)) {\n return [\n new DataTableExplorerUnsupportedSummaryClient({\n field,\n onStateChange: update,\n selection,\n tableName,\n }),\n ];\n }\n\n if (isDataTableExplorerHistogramType(field.type)) {\n const summaryClient = new DataTableExplorerHistogramClient({\n field,\n onStateChange: update,\n selection,\n steps: summaryBins,\n tableName,\n valueType:\n getDataTableExplorerValueType(field.type) === 'date'\n ? 'date'\n : 'number',\n });\n\n return [\n summaryClient,\n new DataTableExplorerHistogramTotalClient({\n summaryClient,\n }),\n ];\n }\n\n const summaryClient = new DataTableExplorerCategoryClient({\n categoryLimit,\n field,\n onStateChange: update,\n selection,\n tableName,\n });\n\n return [\n summaryClient,\n new DataTableExplorerCategoryTotalClient({\n summaryClient,\n }),\n ];\n });\n\n clients.forEach((client) => connection.coordinator.connect(client));\n\n return () => {\n clients.forEach((client) => client.destroy());\n store.getState().clearSummaries();\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dataTableExplorerController.js","sourceRoot":"","sources":["../../src/data-table-explorer/dataTableExplorerController.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EACL,+BAA+B,EAC/B,oCAAoC,GACrC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,4BAA4B,EAAC,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EACL,gCAAgC,EAChC,qCAAqC,GACtC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAC,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAC,yCAAyC,EAAC,MAAM,6CAA6C,CAAC;AAOtG,OAAO,EACL,iCAAiC,EACjC,6BAA6B,EAC7B,gCAAgC,EAChC,yCAAyC,GAC1C,MAAM,SAAS,CAAC;AAEjB,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACnE,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,OAMjD;IACC,MAAM,EAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,cAAc,EAAC,GAAG,OAAO,CAAC;IAC7E,KAAK,CAAC,QAAQ,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAEvD,IAAI,CAAC;QACH,uEAAuE;QACvE,4EAA4E;QAC5E,MAAM,cAAc,GAAG,cAAmC,CAAC;QAC3D,MAAM,SAAS,GAAG,MAAM,cAAc,CACpC,WAAW,EACX,OAAO,EAAE,MAAM;YACb,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAC,MAAM,EAAE,KAAK,EAAE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S;oBACT,cAAc;iBACf,CAAC;aACH,CAAC;QACJ,CAAC;QAED,IAAI,gCAAgC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACjD,MAAM,aAAa,GAAG,IAAI,gCAAgC,CAAC;gBACzD,KAAK;gBACL,aAAa,EAAE,MAAM;gBACrB,SAAS;gBACT,KAAK,EAAE,WAAW;gBAClB,SAAS;gBACT,cAAc;gBACd,SAAS,EACP,6BAA6B,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,MAAM;oBAClD,CAAC,CAAC,MAAM;oBACR,CAAC,CAAC,QAAQ;aACf,CAAC,CAAC;YAEH,OAAO;gBACL,aAAa;gBACb,IAAI,qCAAqC,CAAC;oBACxC,aAAa;iBACd,CAAC;aACH,CAAC;QACJ,CAAC;QAED,MAAM,aAAa,GAAG,IAAI,+BAA+B,CAAC;YACxD,aAAa;YACb,KAAK;YACL,aAAa,EAAE,MAAM;YACrB,SAAS;YACT,SAAS;YACT,cAAc;SACf,CAAC,CAAC;QAEH,OAAO;YACL,aAAa;YACb,IAAI,oCAAoC,CAAC;gBACvC,aAAa;aACd,CAAC;SACH,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAEpE,OAAO,GAAG,EAAE;QACV,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9C,KAAK,CAAC,QAAQ,EAAE,CAAC,cAAc,EAAE,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type {MosaicClient, Selection} from '@uwdata/mosaic-core';\nimport {queryFieldInfo} from '@uwdata/mosaic-core';\nimport type * as arrow from 'apache-arrow';\nimport {\n DataTableExplorerCategoryClient,\n DataTableExplorerCategoryTotalClient,\n} from './DataTableExplorerCategoryClient';\nimport {DataTableExplorerCountClient} from './DataTableExplorerCountClient';\nimport {\n DataTableExplorerHistogramClient,\n DataTableExplorerHistogramTotalClient,\n} from './DataTableExplorerHistogramClient';\nimport {DataTableExplorerPageClient} from './DataTableExplorerPageClient';\nimport {DataTableExplorerUnsupportedSummaryClient} from './DataTableExplorerUnsupportedSummaryClient';\nimport type {\n DataTableExplorerSummaryState,\n DataTableExplorerSqlTableReference,\n DataTableExplorerSorting,\n} from './types';\nimport type {DataTableExplorerStore} from './createDataTableExplorerStore';\nimport {\n fieldInfoToDataTableExplorerField,\n getDataTableExplorerValueType,\n isDataTableExplorerHistogramType,\n isDataTableExplorerUnsupportedSummaryType,\n} from './utils';\n\nfunction toError(error: unknown): Error {\n return error instanceof Error ? error : new Error(String(error));\n}\n\n/**\n * Loads field metadata for the dataTableExplorer table and writes the normalized field\n * definitions into the dataTableExplorer store.\n *\n * @param options.columns Optional subset of column names to load. When omitted,\n * metadata is loaded for every column in the table.\n * @param options.coordinator Mosaic coordinator used to run the field-info query.\n * @param options.store Instance store that receives schema loading, success, and\n * error state.\n * @param options.tableIdentity Stable SQLRooms table identity used for store keys.\n * This should preserve catalog/database identity when available.\n * @param options.tableReference Mosaic SQL table reference used to query the table.\n * Prefer a TableRefNode for qualified table names so dotted identifier parts are\n * not reparsed as separate identifiers.\n */\nexport async function loadDataTableExplorerSchema(options: {\n columns?: string[];\n coordinator: Parameters<typeof queryFieldInfo>[0];\n store: DataTableExplorerStore;\n tableIdentity: string;\n tableReference: DataTableExplorerSqlTableReference;\n}) {\n const {columns, coordinator, store, tableIdentity, tableReference} = options;\n store.getState().setSchemaLoading(true, tableIdentity);\n\n try {\n // queryFieldInfo is typed as string-only, but Mosaic's runtime accepts\n // TableRefNode values and preserves identifier boundaries for dotted names.\n const fieldInfoTable = tableReference as unknown as string;\n const fieldInfo = await queryFieldInfo(\n coordinator,\n columns?.length\n ? columns.map((column) => ({column, table: fieldInfoTable}))\n : [{column: '*', table: fieldInfoTable}],\n );\n store\n .getState()\n .setSchemaSuccess(\n fieldInfo.map(fieldInfoToDataTableExplorerField),\n tableIdentity,\n );\n } catch (error: unknown) {\n store.getState().setSchemaSuccess([], tableIdentity);\n store.getState().setSchemaError(toError(error), tableIdentity);\n }\n}\n\ntype ReadyConnection = {\n coordinator: {\n connect: (client: MosaicClient) => void;\n disconnect: (client: MosaicClient) => void;\n };\n};\n\n/**\n * Connects the paged row client for the current dataTableExplorer page and disconnects\n * it when the caller tears down the lifecycle.\n *\n * @param options.connection Ready Mosaic connection that owns client\n * registration.\n * @param options.fieldNames Ordered fields to include in the page query and page\n * dataset identity.\n * @param options.filter Optional row filter applied to the page query.\n * @param options.pagination Current page index and page size.\n * @param options.sorting Current sort descriptors.\n * @param options.store Instance store that receives page loading, data, and error\n * state.\n * @param options.tableName Stable SQLRooms table identity used for page dataset\n * keys.\n * @param options.tableReference Mosaic SQL table reference used in generated page\n * queries.\n */\nexport function connectDataTableExplorerPageClient(options: {\n connection: ReadyConnection;\n fieldNames: string[];\n filter?: ReturnType<Selection['predicate']>;\n pagination: {pageIndex: number; pageSize: number};\n sorting: DataTableExplorerSorting;\n store: DataTableExplorerStore;\n tableName: string;\n tableReference: DataTableExplorerSqlTableReference;\n}) {\n const client = new DataTableExplorerPageClient({\n columns: options.fieldNames,\n filter: options.filter,\n onStateChange: (state) => options.store.getState().setPage(state),\n pagination: options.pagination,\n sorting: options.sorting,\n tableName: options.tableName,\n tableReference: options.tableReference,\n });\n\n options.connection.coordinator.connect(client);\n\n return () => {\n client.destroy();\n };\n}\n\n/**\n * Connects either the filtered or total count client and routes updates into\n * the corresponding store slice.\n *\n * @param options.connection Ready Mosaic connection that owns client\n * registration.\n * @param options.filterStable Whether Mosaic can treat this count query as\n * stable under filter changes.\n * @param options.selection Optional Mosaic selection that supplies cross-filter\n * predicates.\n * @param options.store Instance store that receives filtered or total count\n * state.\n * @param options.tableName Stable SQLRooms table identity used for client state.\n * @param options.tableReference Mosaic SQL table reference used in generated count\n * queries.\n * @param options.target Selects whether updates go to the filtered or total count\n * store slice.\n */\nexport function connectDataTableExplorerCountClient(options: {\n connection: ReadyConnection;\n filterStable?: boolean;\n selection?: Selection;\n store: DataTableExplorerStore;\n tableName: string;\n tableReference: DataTableExplorerSqlTableReference;\n target: 'filtered' | 'total';\n}) {\n const setCountState =\n options.target === 'filtered'\n ? options.store.getState().setFilteredCount\n : options.store.getState().setTotalCount;\n\n const client = new DataTableExplorerCountClient({\n filterStable: options.filterStable,\n onStateChange: setCountState,\n selection: options.selection,\n tableName: options.tableName,\n tableReference: options.tableReference,\n });\n\n options.connection.coordinator.connect(client);\n\n return {\n client,\n cleanup: () => {\n client.destroy();\n },\n };\n}\n\n/**\n * Connects all per-column summary clients for the active schema and initializes\n * matching empty summary state in the dataTableExplorer store.\n *\n * @param options.categoryLimit Maximum number of category buckets to expose before\n * grouping the remainder into an overflow bucket.\n * @param options.connection Ready Mosaic connection that owns summary client\n * registration.\n * @param options.fields Active Arrow fields to summarize.\n * @param options.selection Mosaic selection shared by summary clients.\n * @param options.store Instance store that receives summary state.\n * @param options.summaryBins Requested bin count for histogram summaries.\n * @param options.tableName Human-readable or string table reference kept for\n * summary clients that still accept string identities.\n * @param options.tableReference Mosaic SQL table reference used in generated\n * summary queries.\n */\nexport function connectDataTableExplorerSummaryClients(options: {\n categoryLimit: number;\n connection: ReadyConnection;\n fields: arrow.Field[];\n selection: Selection;\n store: DataTableExplorerStore;\n summaryBins: number;\n tableName: string;\n tableReference: DataTableExplorerSqlTableReference;\n}) {\n const {\n categoryLimit,\n connection,\n fields,\n selection,\n store,\n summaryBins,\n tableName,\n tableReference,\n } = options;\n\n store.getState().initializeSummaries(fields);\n\n const clients: MosaicClient[] = fields.flatMap((field): MosaicClient[] => {\n const update = (summary: DataTableExplorerSummaryState) => {\n store.getState().setSummary(field.name, summary);\n };\n\n if (isDataTableExplorerUnsupportedSummaryType(field.type)) {\n return [\n new DataTableExplorerUnsupportedSummaryClient({\n field,\n onStateChange: update,\n selection,\n tableName,\n tableReference,\n }),\n ];\n }\n\n if (isDataTableExplorerHistogramType(field.type)) {\n const summaryClient = new DataTableExplorerHistogramClient({\n field,\n onStateChange: update,\n selection,\n steps: summaryBins,\n tableName,\n tableReference,\n valueType:\n getDataTableExplorerValueType(field.type) === 'date'\n ? 'date'\n : 'number',\n });\n\n return [\n summaryClient,\n new DataTableExplorerHistogramTotalClient({\n summaryClient,\n }),\n ];\n }\n\n const summaryClient = new DataTableExplorerCategoryClient({\n categoryLimit,\n field,\n onStateChange: update,\n selection,\n tableName,\n tableReference,\n });\n\n return [\n summaryClient,\n new DataTableExplorerCategoryTotalClient({\n summaryClient,\n }),\n ];\n });\n\n clients.forEach((client) => connection.coordinator.connect(client));\n\n return () => {\n clients.forEach((client) => client.destroy());\n store.getState().clearSummaries();\n };\n}\n"]}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { MosaicClient, Selection } from '@uwdata/mosaic-core';
|
|
2
2
|
import type { MosaicSliceState } from '../../MosaicSlice';
|
|
3
3
|
import type { DataTableExplorerStore } from '../createDataTableExplorerStore';
|
|
4
|
-
import type { DataTableExplorerPaginationState, DataTableExplorerSorting } from '../types';
|
|
4
|
+
import type { DataTableExplorerPaginationState, DataTableExplorerSqlTableReference, DataTableExplorerSorting } from '../types';
|
|
5
5
|
import type { DataTableExplorerStoreState } from '../createDataTableExplorerStore';
|
|
6
|
+
/**
|
|
7
|
+
* Inputs required to synchronize a dataTableExplorer instance with Mosaic
|
|
8
|
+
* connection, selection, schema, row, count, and summary lifecycles.
|
|
9
|
+
*/
|
|
6
10
|
export type UseDataTableExplorerLifecyclesOptions = {
|
|
7
11
|
categoryLimit: number;
|
|
8
12
|
columns?: string[];
|
|
@@ -17,7 +21,21 @@ export type UseDataTableExplorerLifecyclesOptions = {
|
|
|
17
21
|
selectionVersion: number;
|
|
18
22
|
sorting: DataTableExplorerSorting;
|
|
19
23
|
summaryBins: number;
|
|
24
|
+
/**
|
|
25
|
+
* Stable SQLRooms table identity used for store keys, selection resets, and
|
|
26
|
+
* dataset IDs. This should keep catalog/database identity when available.
|
|
27
|
+
*/
|
|
28
|
+
tableIdentity: string;
|
|
29
|
+
/**
|
|
30
|
+
* String table reference used for readiness checks and legacy client inputs.
|
|
31
|
+
*/
|
|
20
32
|
tableName: string;
|
|
33
|
+
/**
|
|
34
|
+
* Mosaic SQL table reference used by generated queries. Use a TableRefNode for
|
|
35
|
+
* qualified names to preserve identifier boundaries such as dots inside table
|
|
36
|
+
* names.
|
|
37
|
+
*/
|
|
38
|
+
tableReference: DataTableExplorerSqlTableReference;
|
|
21
39
|
};
|
|
22
40
|
export type UseDataTableExplorerLifecyclesReturn = {
|
|
23
41
|
client: MosaicClient | null;
|
|
@@ -25,6 +43,10 @@ export type UseDataTableExplorerLifecyclesReturn = {
|
|
|
25
43
|
/**
|
|
26
44
|
* Owns the coordinator-backed schema, row, count, and summary client
|
|
27
45
|
* lifecycles for a dataTableExplorer instance.
|
|
46
|
+
*
|
|
47
|
+
* The hook keeps SQLRooms identity state separate from Mosaic SQL references:
|
|
48
|
+
* tableIdentity drives local store keys, while tableReference is used at query
|
|
49
|
+
* boundaries.
|
|
28
50
|
*/
|
|
29
51
|
export declare function useDataTableExplorerLifecycles(options: UseDataTableExplorerLifecyclesOptions): UseDataTableExplorerLifecyclesReturn;
|
|
30
52
|
//# sourceMappingURL=useDataTableExplorerLifecycles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataTableExplorerLifecycles.d.ts","sourceRoot":"","sources":["../../../src/data-table-explorer/hooks/useDataTableExplorerLifecycles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,iCAAiC,CAAC;AAC5E,OAAO,KAAK,EACV,gCAAgC,EAChC,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,iCAAiC,CAAC;AAQjF,MAAM,MAAM,qCAAqC,GAAG;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;IACrD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,2BAA2B,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,gCAAgC,CAAC;IAC7C,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IAC9C,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,wBAAwB,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"useDataTableExplorerLifecycles.d.ts","sourceRoot":"","sources":["../../../src/data-table-explorer/hooks/useDataTableExplorerLifecycles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,iCAAiC,CAAC;AAC5E,OAAO,KAAK,EACV,gCAAgC,EAChC,kCAAkC,EAClC,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,iCAAiC,CAAC;AAQjF;;;GAGG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;IACrD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,2BAA2B,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,gCAAgC,CAAC;IAC7C,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IAC9C,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,wBAAwB,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,cAAc,EAAE,kCAAkC,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,qCAAqC,GAC7C,oCAAoC,CA6KtC"}
|
|
@@ -3,22 +3,26 @@ import { connectDataTableExplorerCountClient, connectDataTableExplorerPageClient
|
|
|
3
3
|
/**
|
|
4
4
|
* Owns the coordinator-backed schema, row, count, and summary client
|
|
5
5
|
* lifecycles for a dataTableExplorer instance.
|
|
6
|
+
*
|
|
7
|
+
* The hook keeps SQLRooms identity state separate from Mosaic SQL references:
|
|
8
|
+
* tableIdentity drives local store keys, while tableReference is used at query
|
|
9
|
+
* boundaries.
|
|
6
10
|
*/
|
|
7
11
|
export function useDataTableExplorerLifecycles(options) {
|
|
8
|
-
const { categoryLimit, columns, connection, fieldNames, fields, pageSize, pagination, dataTableExplorerStore, rowFilter, selection, selectionVersion, sorting, summaryBins, tableName, } = options;
|
|
9
|
-
const previousTableNameRef = useRef(
|
|
12
|
+
const { categoryLimit, columns, connection, fieldNames, fields, pageSize, pagination, dataTableExplorerStore, rowFilter, selection, selectionVersion, sorting, summaryBins, tableIdentity, tableName, tableReference, } = options;
|
|
13
|
+
const previousTableNameRef = useRef(tableIdentity);
|
|
10
14
|
useEffect(() => {
|
|
11
15
|
dataTableExplorerStore.getState().syncPageSize(pageSize);
|
|
12
16
|
}, [pageSize, dataTableExplorerStore]);
|
|
13
17
|
useEffect(() => {
|
|
14
|
-
if (previousTableNameRef.current ===
|
|
18
|
+
if (previousTableNameRef.current === tableIdentity)
|
|
15
19
|
return;
|
|
16
20
|
selection.reset();
|
|
17
|
-
previousTableNameRef.current =
|
|
18
|
-
}, [selection,
|
|
21
|
+
previousTableNameRef.current = tableIdentity;
|
|
22
|
+
}, [selection, tableIdentity]);
|
|
19
23
|
useEffect(() => {
|
|
20
24
|
dataTableExplorerStore.getState().resetPageIndex();
|
|
21
|
-
}, [dataTableExplorerStore, selectionVersion,
|
|
25
|
+
}, [dataTableExplorerStore, selectionVersion, tableIdentity]);
|
|
22
26
|
useEffect(() => {
|
|
23
27
|
if (connection.status !== 'ready' || !tableName) {
|
|
24
28
|
dataTableExplorerStore.getState().setSchemaSuccess([]);
|
|
@@ -32,9 +36,17 @@ export function useDataTableExplorerLifecycles(options) {
|
|
|
32
36
|
columns,
|
|
33
37
|
coordinator: connection.coordinator,
|
|
34
38
|
store: dataTableExplorerStore,
|
|
35
|
-
|
|
39
|
+
tableIdentity,
|
|
40
|
+
tableReference,
|
|
36
41
|
});
|
|
37
|
-
}, [
|
|
42
|
+
}, [
|
|
43
|
+
columns,
|
|
44
|
+
connection,
|
|
45
|
+
dataTableExplorerStore,
|
|
46
|
+
tableIdentity,
|
|
47
|
+
tableName,
|
|
48
|
+
tableReference,
|
|
49
|
+
]);
|
|
38
50
|
useEffect(() => {
|
|
39
51
|
if (connection.status !== 'ready' || !tableName || !fieldNames.length) {
|
|
40
52
|
dataTableExplorerStore.getState().setPage({ isLoading: false });
|
|
@@ -47,7 +59,8 @@ export function useDataTableExplorerLifecycles(options) {
|
|
|
47
59
|
pagination,
|
|
48
60
|
sorting,
|
|
49
61
|
store: dataTableExplorerStore,
|
|
50
|
-
tableName,
|
|
62
|
+
tableName: tableIdentity,
|
|
63
|
+
tableReference,
|
|
51
64
|
});
|
|
52
65
|
}, [
|
|
53
66
|
connection,
|
|
@@ -56,7 +69,9 @@ export function useDataTableExplorerLifecycles(options) {
|
|
|
56
69
|
dataTableExplorerStore,
|
|
57
70
|
rowFilter,
|
|
58
71
|
sorting,
|
|
72
|
+
tableIdentity,
|
|
59
73
|
tableName,
|
|
74
|
+
tableReference,
|
|
60
75
|
]);
|
|
61
76
|
useEffect(() => {
|
|
62
77
|
if (connection.status !== 'ready' || !tableName) {
|
|
@@ -69,7 +84,8 @@ export function useDataTableExplorerLifecycles(options) {
|
|
|
69
84
|
filterStable: true,
|
|
70
85
|
selection,
|
|
71
86
|
store: dataTableExplorerStore,
|
|
72
|
-
tableName,
|
|
87
|
+
tableName: tableIdentity,
|
|
88
|
+
tableReference,
|
|
73
89
|
target: 'filtered',
|
|
74
90
|
});
|
|
75
91
|
dataTableExplorerStore.getState().setClient(newClient);
|
|
@@ -77,7 +93,14 @@ export function useDataTableExplorerLifecycles(options) {
|
|
|
77
93
|
cleanup();
|
|
78
94
|
dataTableExplorerStore.getState().setClient(null);
|
|
79
95
|
};
|
|
80
|
-
}, [
|
|
96
|
+
}, [
|
|
97
|
+
connection,
|
|
98
|
+
dataTableExplorerStore,
|
|
99
|
+
selection,
|
|
100
|
+
tableIdentity,
|
|
101
|
+
tableName,
|
|
102
|
+
tableReference,
|
|
103
|
+
]);
|
|
81
104
|
useEffect(() => {
|
|
82
105
|
if (connection.status !== 'ready' || !tableName) {
|
|
83
106
|
dataTableExplorerStore.getState().setTotalCount({ isLoading: false });
|
|
@@ -86,11 +109,18 @@ export function useDataTableExplorerLifecycles(options) {
|
|
|
86
109
|
const { cleanup } = connectDataTableExplorerCountClient({
|
|
87
110
|
connection,
|
|
88
111
|
store: dataTableExplorerStore,
|
|
89
|
-
tableName,
|
|
112
|
+
tableName: tableIdentity,
|
|
113
|
+
tableReference,
|
|
90
114
|
target: 'total',
|
|
91
115
|
});
|
|
92
116
|
return cleanup;
|
|
93
|
-
}, [
|
|
117
|
+
}, [
|
|
118
|
+
connection,
|
|
119
|
+
dataTableExplorerStore,
|
|
120
|
+
tableIdentity,
|
|
121
|
+
tableName,
|
|
122
|
+
tableReference,
|
|
123
|
+
]);
|
|
94
124
|
useEffect(() => {
|
|
95
125
|
if (connection.status !== 'ready' || !fields.length) {
|
|
96
126
|
dataTableExplorerStore.getState().clearSummaries();
|
|
@@ -104,6 +134,7 @@ export function useDataTableExplorerLifecycles(options) {
|
|
|
104
134
|
store: dataTableExplorerStore,
|
|
105
135
|
summaryBins,
|
|
106
136
|
tableName,
|
|
137
|
+
tableReference,
|
|
107
138
|
});
|
|
108
139
|
}, [
|
|
109
140
|
categoryLimit,
|
|
@@ -112,7 +143,9 @@ export function useDataTableExplorerLifecycles(options) {
|
|
|
112
143
|
dataTableExplorerStore,
|
|
113
144
|
selection,
|
|
114
145
|
summaryBins,
|
|
146
|
+
tableIdentity,
|
|
115
147
|
tableName,
|
|
148
|
+
tableReference,
|
|
116
149
|
]);
|
|
117
150
|
// Client is not returned - it's stored in the dataTableExplorerStore
|
|
118
151
|
return { client: null };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataTableExplorerLifecycles.js","sourceRoot":"","sources":["../../../src/data-table-explorer/hooks/useDataTableExplorerLifecycles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AASxC,OAAO,EACL,mCAAmC,EACnC,kCAAkC,EAClC,sCAAsC,EACtC,2BAA2B,GAC5B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AAC,MAAM,EAAE,IAAI,EAAC,CAAC;AACxB,CAAC","sourcesContent":["import {useEffect, useRef} from 'react';\nimport type {MosaicClient, Selection} from '@uwdata/mosaic-core';\nimport type {MosaicSliceState} from '../../MosaicSlice';\nimport type {DataTableExplorerStore} from '../createDataTableExplorerStore';\nimport type {\n DataTableExplorerPaginationState,\n DataTableExplorerSorting,\n} from '../types';\nimport type {DataTableExplorerStoreState} from '../createDataTableExplorerStore';\nimport {\n connectDataTableExplorerCountClient,\n connectDataTableExplorerPageClient,\n connectDataTableExplorerSummaryClients,\n loadDataTableExplorerSchema,\n} from '../dataTableExplorerController';\n\nexport type UseDataTableExplorerLifecyclesOptions = {\n categoryLimit: number;\n columns?: string[];\n connection: MosaicSliceState['mosaic']['connection'];\n fieldNames: string[];\n fields: DataTableExplorerStoreState['schema']['fields'];\n pageSize: number;\n pagination: DataTableExplorerPaginationState;\n dataTableExplorerStore: DataTableExplorerStore;\n rowFilter: ReturnType<Selection['predicate']>;\n selection: Selection;\n selectionVersion: number;\n sorting: DataTableExplorerSorting;\n summaryBins: number;\n tableName: string;\n};\n\nexport type UseDataTableExplorerLifecyclesReturn = {\n client: MosaicClient | null;\n};\n\n/**\n * Owns the coordinator-backed schema, row, count, and summary client\n * lifecycles for a dataTableExplorer instance.\n */\nexport function useDataTableExplorerLifecycles(\n options: UseDataTableExplorerLifecyclesOptions,\n): UseDataTableExplorerLifecyclesReturn {\n const {\n categoryLimit,\n columns,\n connection,\n fieldNames,\n fields,\n pageSize,\n pagination,\n dataTableExplorerStore,\n rowFilter,\n selection,\n selectionVersion,\n sorting,\n summaryBins,\n tableName,\n } = options;\n const previousTableNameRef = useRef(tableName);\n\n useEffect(() => {\n dataTableExplorerStore.getState().syncPageSize(pageSize);\n }, [pageSize, dataTableExplorerStore]);\n\n useEffect(() => {\n if (previousTableNameRef.current === tableName) return;\n selection.reset();\n previousTableNameRef.current = tableName;\n }, [selection, tableName]);\n\n useEffect(() => {\n dataTableExplorerStore.getState().resetPageIndex();\n }, [dataTableExplorerStore, selectionVersion, tableName]);\n\n useEffect(() => {\n if (connection.status !== 'ready' || !tableName) {\n dataTableExplorerStore.getState().setSchemaSuccess([]);\n dataTableExplorerStore.getState().setSchemaError(undefined);\n dataTableExplorerStore\n .getState()\n .setSchemaLoading(connection.status === 'loading');\n return;\n }\n\n void loadDataTableExplorerSchema({\n columns,\n coordinator: connection.coordinator,\n store: dataTableExplorerStore,\n tableName,\n });\n }, [columns, connection, dataTableExplorerStore, tableName]);\n\n useEffect(() => {\n if (connection.status !== 'ready' || !tableName || !fieldNames.length) {\n dataTableExplorerStore.getState().setPage({isLoading: false});\n return;\n }\n\n return connectDataTableExplorerPageClient({\n connection,\n fieldNames,\n filter: rowFilter,\n pagination,\n sorting,\n store: dataTableExplorerStore,\n tableName,\n });\n }, [\n connection,\n fieldNames,\n pagination,\n dataTableExplorerStore,\n rowFilter,\n sorting,\n tableName,\n ]);\n\n useEffect(() => {\n if (connection.status !== 'ready' || !tableName) {\n dataTableExplorerStore.getState().setFilteredCount({isLoading: false});\n dataTableExplorerStore.getState().setClient(null);\n return;\n }\n\n const {client: newClient, cleanup} = connectDataTableExplorerCountClient({\n connection,\n filterStable: true,\n selection,\n store: dataTableExplorerStore,\n tableName,\n target: 'filtered',\n });\n dataTableExplorerStore.getState().setClient(newClient);\n\n return () => {\n cleanup();\n dataTableExplorerStore.getState().setClient(null);\n };\n }, [connection, dataTableExplorerStore, selection, tableName]);\n\n useEffect(() => {\n if (connection.status !== 'ready' || !tableName) {\n dataTableExplorerStore.getState().setTotalCount({isLoading: false});\n return;\n }\n\n const {cleanup} = connectDataTableExplorerCountClient({\n connection,\n store: dataTableExplorerStore,\n tableName,\n target: 'total',\n });\n\n return cleanup;\n }, [connection, dataTableExplorerStore, tableName]);\n\n useEffect(() => {\n if (connection.status !== 'ready' || !fields.length) {\n dataTableExplorerStore.getState().clearSummaries();\n return;\n }\n\n return connectDataTableExplorerSummaryClients({\n categoryLimit,\n connection,\n fields,\n selection,\n store: dataTableExplorerStore,\n summaryBins,\n tableName,\n });\n }, [\n categoryLimit,\n connection,\n fields,\n dataTableExplorerStore,\n selection,\n summaryBins,\n tableName,\n ]);\n\n // Client is not returned - it's stored in the dataTableExplorerStore\n return {client: null};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useDataTableExplorerLifecycles.js","sourceRoot":"","sources":["../../../src/data-table-explorer/hooks/useDataTableExplorerLifecycles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAUxC,OAAO,EACL,mCAAmC,EACnC,kCAAkC,EAClC,sCAAsC,EACtC,2BAA2B,GAC5B,MAAM,gCAAgC,CAAC;AAyCxC;;;;;;;GAOG;AACH,MAAM,UAAU,8BAA8B,CAC5C,OAA8C;IAE9C,MAAM,EACJ,aAAa,EACb,OAAO,EACP,UAAU,EACV,UAAU,EACV,MAAM,EACN,QAAQ,EACR,UAAU,EACV,sBAAsB,EACtB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,aAAa,EACb,SAAS,EACT,cAAc,GACf,GAAG,OAAO,CAAC;IACZ,MAAM,oBAAoB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IAEnD,SAAS,CAAC,GAAG,EAAE;QACb,sBAAsB,CAAC,QAAQ,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC3D,CAAC,EAAE,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAEvC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,oBAAoB,CAAC,OAAO,KAAK,aAAa;YAAE,OAAO;QAC3D,SAAS,CAAC,KAAK,EAAE,CAAC;QAClB,oBAAoB,CAAC,OAAO,GAAG,aAAa,CAAC;IAC/C,CAAC,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE;QACb,sBAAsB,CAAC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O;SAChB,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE;QACD,UAAU;QACV,sBAAsB;QACtB,aAAa;QACb,SAAS;QACT,cAAc;KACf,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,UAAU,CAAC,MAAM,KAAK,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACpD,sBAAsB,CAAC,QAAQ,EAAE,CAAC,cAAc,EAAE,CAAC;YACnD,OAAO;QACT,CAAC;QAED,OAAO,sCAAsC,CAAC;YAC5C,aAAa;YACb,UAAU;YACV,MAAM;YACN,SAAS;YACT,KAAK,EAAE,sBAAsB;YAC7B,WAAW;YACX,SAAS;YACT,cAAc;SACf,CAAC,CAAC;IACL,CAAC,EAAE;QACD,aAAa;QACb,UAAU;QACV,MAAM;QACN,sBAAsB;QACtB,SAAS;QACT,WAAW;QACX,aAAa;QACb,SAAS;QACT,cAAc;KACf,CAAC,CAAC;IAEH,qEAAqE;IACrE,OAAO,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC;AACxB,CAAC","sourcesContent":["import {useEffect, useRef} from 'react';\nimport type {MosaicClient, Selection} from '@uwdata/mosaic-core';\nimport type {MosaicSliceState} from '../../MosaicSlice';\nimport type {DataTableExplorerStore} from '../createDataTableExplorerStore';\nimport type {\n DataTableExplorerPaginationState,\n DataTableExplorerSqlTableReference,\n DataTableExplorerSorting,\n} from '../types';\nimport type {DataTableExplorerStoreState} from '../createDataTableExplorerStore';\nimport {\n connectDataTableExplorerCountClient,\n connectDataTableExplorerPageClient,\n connectDataTableExplorerSummaryClients,\n loadDataTableExplorerSchema,\n} from '../dataTableExplorerController';\n\n/**\n * Inputs required to synchronize a dataTableExplorer instance with Mosaic\n * connection, selection, schema, row, count, and summary lifecycles.\n */\nexport type UseDataTableExplorerLifecyclesOptions = {\n categoryLimit: number;\n columns?: string[];\n connection: MosaicSliceState['mosaic']['connection'];\n fieldNames: string[];\n fields: DataTableExplorerStoreState['schema']['fields'];\n pageSize: number;\n pagination: DataTableExplorerPaginationState;\n dataTableExplorerStore: DataTableExplorerStore;\n rowFilter: ReturnType<Selection['predicate']>;\n selection: Selection;\n selectionVersion: number;\n sorting: DataTableExplorerSorting;\n summaryBins: number;\n /**\n * Stable SQLRooms table identity used for store keys, selection resets, and\n * dataset IDs. This should keep catalog/database identity when available.\n */\n tableIdentity: string;\n /**\n * String table reference used for readiness checks and legacy client inputs.\n */\n tableName: string;\n /**\n * Mosaic SQL table reference used by generated queries. Use a TableRefNode for\n * qualified names to preserve identifier boundaries such as dots inside table\n * names.\n */\n tableReference: DataTableExplorerSqlTableReference;\n};\n\nexport type UseDataTableExplorerLifecyclesReturn = {\n client: MosaicClient | null;\n};\n\n/**\n * Owns the coordinator-backed schema, row, count, and summary client\n * lifecycles for a dataTableExplorer instance.\n *\n * The hook keeps SQLRooms identity state separate from Mosaic SQL references:\n * tableIdentity drives local store keys, while tableReference is used at query\n * boundaries.\n */\nexport function useDataTableExplorerLifecycles(\n options: UseDataTableExplorerLifecyclesOptions,\n): UseDataTableExplorerLifecyclesReturn {\n const {\n categoryLimit,\n columns,\n connection,\n fieldNames,\n fields,\n pageSize,\n pagination,\n dataTableExplorerStore,\n rowFilter,\n selection,\n selectionVersion,\n sorting,\n summaryBins,\n tableIdentity,\n tableName,\n tableReference,\n } = options;\n const previousTableNameRef = useRef(tableIdentity);\n\n useEffect(() => {\n dataTableExplorerStore.getState().syncPageSize(pageSize);\n }, [pageSize, dataTableExplorerStore]);\n\n useEffect(() => {\n if (previousTableNameRef.current === tableIdentity) return;\n selection.reset();\n previousTableNameRef.current = tableIdentity;\n }, [selection, tableIdentity]);\n\n useEffect(() => {\n dataTableExplorerStore.getState().resetPageIndex();\n }, [dataTableExplorerStore, selectionVersion, tableIdentity]);\n\n useEffect(() => {\n if (connection.status !== 'ready' || !tableName) {\n dataTableExplorerStore.getState().setSchemaSuccess([]);\n dataTableExplorerStore.getState().setSchemaError(undefined);\n dataTableExplorerStore\n .getState()\n .setSchemaLoading(connection.status === 'loading');\n return;\n }\n\n void loadDataTableExplorerSchema({\n columns,\n coordinator: connection.coordinator,\n store: dataTableExplorerStore,\n tableIdentity,\n tableReference,\n });\n }, [\n columns,\n connection,\n dataTableExplorerStore,\n tableIdentity,\n tableName,\n tableReference,\n ]);\n\n useEffect(() => {\n if (connection.status !== 'ready' || !tableName || !fieldNames.length) {\n dataTableExplorerStore.getState().setPage({isLoading: false});\n return;\n }\n\n return connectDataTableExplorerPageClient({\n connection,\n fieldNames,\n filter: rowFilter,\n pagination,\n sorting,\n store: dataTableExplorerStore,\n tableName: tableIdentity,\n tableReference,\n });\n }, [\n connection,\n fieldNames,\n pagination,\n dataTableExplorerStore,\n rowFilter,\n sorting,\n tableIdentity,\n tableName,\n tableReference,\n ]);\n\n useEffect(() => {\n if (connection.status !== 'ready' || !tableName) {\n dataTableExplorerStore.getState().setFilteredCount({isLoading: false});\n dataTableExplorerStore.getState().setClient(null);\n return;\n }\n\n const {client: newClient, cleanup} = connectDataTableExplorerCountClient({\n connection,\n filterStable: true,\n selection,\n store: dataTableExplorerStore,\n tableName: tableIdentity,\n tableReference,\n target: 'filtered',\n });\n dataTableExplorerStore.getState().setClient(newClient);\n\n return () => {\n cleanup();\n dataTableExplorerStore.getState().setClient(null);\n };\n }, [\n connection,\n dataTableExplorerStore,\n selection,\n tableIdentity,\n tableName,\n tableReference,\n ]);\n\n useEffect(() => {\n if (connection.status !== 'ready' || !tableName) {\n dataTableExplorerStore.getState().setTotalCount({isLoading: false});\n return;\n }\n\n const {cleanup} = connectDataTableExplorerCountClient({\n connection,\n store: dataTableExplorerStore,\n tableName: tableIdentity,\n tableReference,\n target: 'total',\n });\n\n return cleanup;\n }, [\n connection,\n dataTableExplorerStore,\n tableIdentity,\n tableName,\n tableReference,\n ]);\n\n useEffect(() => {\n if (connection.status !== 'ready' || !fields.length) {\n dataTableExplorerStore.getState().clearSummaries();\n return;\n }\n\n return connectDataTableExplorerSummaryClients({\n categoryLimit,\n connection,\n fields,\n selection,\n store: dataTableExplorerStore,\n summaryBins,\n tableName,\n tableReference,\n });\n }, [\n categoryLimit,\n connection,\n fields,\n dataTableExplorerStore,\n selection,\n summaryBins,\n tableIdentity,\n tableName,\n tableReference,\n ]);\n\n // Client is not returned - it's stored in the dataTableExplorerStore\n return {client: null};\n}\n"]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { Selection } from '@uwdata/mosaic-core';
|
|
2
2
|
import type { DataTableExplorerStoreState } from '../createDataTableExplorerStore';
|
|
3
|
-
import type { DataTableExplorerPaginationState, DataTableExplorerSorting } from '../types';
|
|
3
|
+
import type { DataTableExplorerPaginationState, DataTableExplorerSqlTableReference, DataTableExplorerSorting } from '../types';
|
|
4
4
|
import { buildDataTableExplorerBaseQuery } from '../utils';
|
|
5
|
+
/**
|
|
6
|
+
* Inputs used to derive memoized query state for a dataTableExplorer instance.
|
|
7
|
+
*/
|
|
5
8
|
export type UseDataTableExplorerQueryStateOptions = {
|
|
6
9
|
pagination: DataTableExplorerPaginationState;
|
|
7
10
|
rowSelectionVersion: number;
|
|
@@ -9,7 +12,15 @@ export type UseDataTableExplorerQueryStateOptions = {
|
|
|
9
12
|
selection: Selection;
|
|
10
13
|
selectionVersion: number;
|
|
11
14
|
sorting: DataTableExplorerSorting;
|
|
12
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Stable SQLRooms table identity used to build dataset IDs and distinguish
|
|
17
|
+
* tables that share schema/table names across catalogs.
|
|
18
|
+
*/
|
|
19
|
+
tableIdentity: string;
|
|
20
|
+
/**
|
|
21
|
+
* Mosaic SQL table reference used in generated queries.
|
|
22
|
+
*/
|
|
23
|
+
tableReference: DataTableExplorerSqlTableReference;
|
|
13
24
|
};
|
|
14
25
|
export type UseDataTableExplorerQueryStateReturn = {
|
|
15
26
|
baseQuery: ReturnType<typeof buildDataTableExplorerBaseQuery>;
|
|
@@ -23,6 +34,9 @@ export type UseDataTableExplorerQueryStateReturn = {
|
|
|
23
34
|
/**
|
|
24
35
|
* Derives the dataTableExplorer's field and SQL state from the current schema,
|
|
25
36
|
* selection, sorting, and pagination state.
|
|
37
|
+
*
|
|
38
|
+
* @param options Current schema, selection, pagination, sorting, and table
|
|
39
|
+
* reference inputs for query generation.
|
|
26
40
|
*/
|
|
27
|
-
export declare function useDataTableExplorerQueryState({ pagination, rowSelectionVersion, schema, selection, selectionVersion, sorting,
|
|
41
|
+
export declare function useDataTableExplorerQueryState({ pagination, rowSelectionVersion, schema, selection, selectionVersion, sorting, tableIdentity, tableReference, }: UseDataTableExplorerQueryStateOptions): UseDataTableExplorerQueryStateReturn;
|
|
28
42
|
//# sourceMappingURL=useDataTableExplorerQueryState.d.ts.map
|