@prismiq/react 0.1.1 → 0.2.1

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.
Files changed (49) hide show
  1. package/dist/{CustomSQLEditor-CYlOtecq.d.ts → ChatBubble-3mFpV7yX.d.ts} +42 -3
  2. package/dist/{CustomSQLEditor-d84v_Cgp.d.cts → ChatBubble-CMkEupzn.d.cts} +42 -3
  3. package/dist/{DashboardDialog-DBNTVVSp.d.ts → DashboardDialog-DMmZ3bnf.d.cts} +5 -3
  4. package/dist/{DashboardDialog-CZD8I-6z.d.cts → DashboardDialog-RlcPkdMt.d.ts} +5 -3
  5. package/dist/charts/index.d.cts +2 -2
  6. package/dist/charts/index.d.ts +2 -2
  7. package/dist/{chunk-3LDRRDJ6.js → chunk-F6QYNQEW.js} +194 -28
  8. package/dist/chunk-F6QYNQEW.js.map +1 -0
  9. package/dist/{chunk-WWTT2OJ5.js → chunk-HKZFEXT6.js} +27 -9
  10. package/dist/chunk-HKZFEXT6.js.map +1 -0
  11. package/dist/{chunk-VQDFS6VS.cjs → chunk-N6I3QOHG.cjs} +376 -210
  12. package/dist/chunk-N6I3QOHG.cjs.map +1 -0
  13. package/dist/{chunk-URJH4H6G.cjs → chunk-NXXKG4GN.cjs} +520 -6
  14. package/dist/chunk-NXXKG4GN.cjs.map +1 -0
  15. package/dist/{chunk-ET7GCREP.js → chunk-VEFYFB5H.js} +517 -7
  16. package/dist/chunk-VEFYFB5H.js.map +1 -0
  17. package/dist/{chunk-MDXGGZSW.cjs → chunk-ZYVN6XAZ.cjs} +35 -37
  18. package/dist/chunk-ZYVN6XAZ.cjs.map +1 -0
  19. package/dist/components/index.cjs +62 -54
  20. package/dist/components/index.d.cts +2 -2
  21. package/dist/components/index.d.ts +2 -2
  22. package/dist/components/index.js +1 -1
  23. package/dist/dashboard/index.cjs +34 -34
  24. package/dist/dashboard/index.d.cts +7 -5
  25. package/dist/dashboard/index.d.ts +7 -5
  26. package/dist/dashboard/index.js +2 -2
  27. package/dist/export/index.cjs +7 -7
  28. package/dist/export/index.d.cts +6 -4
  29. package/dist/export/index.d.ts +6 -4
  30. package/dist/export/index.js +1 -1
  31. package/dist/{index-CvKj3SWO.d.cts → index-BA2VUhgN.d.cts} +1 -1
  32. package/dist/{index-DXGLs1yY.d.ts → index-BPo89ZAj.d.ts} +1 -1
  33. package/dist/index.cjs +119 -103
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +77 -7
  36. package/dist/index.d.ts +77 -7
  37. package/dist/index.js +5 -5
  38. package/dist/index.js.map +1 -1
  39. package/dist/{types-j0kPJ9Hz.d.cts → types-BaI6sSAG.d.cts} +62 -1
  40. package/dist/{types-j0kPJ9Hz.d.ts → types-BaI6sSAG.d.ts} +62 -1
  41. package/dist/utils/index.d.cts +1 -1
  42. package/dist/utils/index.d.ts +1 -1
  43. package/package.json +2 -6
  44. package/dist/chunk-3LDRRDJ6.js.map +0 -1
  45. package/dist/chunk-ET7GCREP.js.map +0 -1
  46. package/dist/chunk-MDXGGZSW.cjs.map +0 -1
  47. package/dist/chunk-URJH4H6G.cjs.map +0 -1
  48. package/dist/chunk-VQDFS6VS.cjs.map +0 -1
  49. package/dist/chunk-WWTT2OJ5.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import react__default, { ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, HTMLAttributes, ReactElement, SVGAttributes, Component, ErrorInfo } from 'react';
3
- import { c as TableSchema, p as ColumnSchema, b as QueryTable, q as ColumnSelection, D as DatabaseSchema, F as FilterDefinition, s as FilterOperator, u as SortDefinition, A as AggregationType, Q as QueryResult, a as QueryDefinition, k as SavedQuery } from './types-j0kPJ9Hz.js';
3
+ import { c as TableSchema, t as ColumnSchema, b as QueryTable, u as ColumnSelection, D as DatabaseSchema, F as FilterDefinition, w as FilterOperator, y as SortDefinition, A as AggregationType, Q as QueryResult, a as QueryDefinition, k as SavedQuery, o as ChatMessage, p as WidgetContext } from './types-BaI6sSAG.js';
4
4
 
5
5
  interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
6
6
  /** Button visual style. */
@@ -660,6 +660,8 @@ interface SchemaExplorerProps {
660
660
  searchable?: boolean;
661
661
  /** Whether tables are collapsible. */
662
662
  collapsible?: boolean;
663
+ /** Optional element rendered at the right end of the header row. */
664
+ headerAction?: React.ReactNode;
663
665
  /** Additional class name. */
664
666
  className?: string;
665
667
  /** Additional styles. */
@@ -678,7 +680,7 @@ interface SchemaExplorerProps {
678
680
  * />
679
681
  * ```
680
682
  */
681
- declare function SchemaExplorer({ onTableSelect, onColumnSelect, onColumnDragStart, selectedTable, selectedColumns, searchable, collapsible, className, style, }: SchemaExplorerProps): JSX.Element;
683
+ declare function SchemaExplorer({ onTableSelect, onColumnSelect, onColumnDragStart, selectedTable, selectedColumns, searchable, collapsible, headerAction, className, style, }: SchemaExplorerProps): JSX.Element;
682
684
 
683
685
  /**
684
686
  * TableNode component for displaying a table in the schema explorer.
@@ -1301,4 +1303,41 @@ interface CustomSQLEditorProps {
1301
1303
  */
1302
1304
  declare function CustomSQLEditor({ initialSql, onSqlChange, onExecute, placeholder, showResults, height, className, style, }: CustomSQLEditorProps): JSX.Element;
1303
1305
 
1304
- export { type QueryBuilderState as $, AggregationPicker as A, Badge as B, Checkbox as C, Dialog as D, EmptyDashboard as E, type ErrorBoundaryProps as F, ErrorFallback as G, type ErrorFallbackProps as H, FilterBuilder as I, type FilterBuilderProps as J, FilterRow as K, type FilterRowProps as L, FilterValueInput as M, type FilterValueInputProps as N, Icon as O, type IconName as P, type IconProps as Q, Input as R, type InputProps as S, NoData as T, type NoDataProps as U, NoResults as V, type NoResultsProps as W, Pagination as X, type PaginationProps as Y, QueryBuilder as Z, type QueryBuilderProps as _, type AggregationPickerProps as a, QueryBuilderToolbar as a0, type QueryBuilderToolbarProps as a1, QueryPreview as a2, type QueryPreviewProps as a3, ResultsTable as a4, type ResultsTableProps as a5, SavedQueryPicker as a6, type SavedQueryPickerProps as a7, SchemaExplorer as a8, type SchemaExplorerProps as a9, type TableRowProps as aA, Tooltip as aB, type TooltipProps as aC, WidgetErrorBoundary as aD, type WidgetErrorBoundaryProps as aE, Select as aa, type SelectOption as ab, type SelectProps as ac, SelectedColumn as ad, type SelectedColumnProps as ae, Skeleton as af, SkeletonChart as ag, type SkeletonChartProps as ah, SkeletonMetricCard as ai, type SkeletonMetricCardProps as aj, type SkeletonProps as ak, SkeletonTable as al, type SkeletonTableProps as am, SkeletonText as an, type SkeletonTextProps as ao, SortBuilder as ap, type SortBuilderProps as aq, SortRow as ar, type SortRowProps as as, TableCell as at, type TableCellProps as au, TableHeader as av, type TableHeaderProps as aw, TableNode as ax, type TableNodeProps as ay, TableRow as az, type BadgeProps as b, Button as c, type ButtonProps as d, type CheckboxProps as e, ColumnNode as f, type ColumnNodeProps as g, ColumnSelector as h, type ColumnSelectorProps as i, CustomSQLEditor as j, type CustomSQLEditorProps as k, DialogFooter as l, type DialogFooterProps as m, DialogHeader as n, type DialogHeaderProps as o, type DialogProps as p, Dropdown as q, DropdownItem as r, type DropdownItemProps as s, type DropdownProps as t, DropdownSeparator as u, type DropdownSeparatorProps as v, type EmptyDashboardProps as w, EmptyState as x, type EmptyStateProps as y, ErrorBoundary as z };
1306
+ /**
1307
+ * Shared types for ChatPanel components.
1308
+ */
1309
+
1310
+ interface ChatBubbleProps {
1311
+ /** The chat message to render. */
1312
+ message: ChatMessage;
1313
+ /** Callback when user clicks "Apply to Editor" on a SQL block. */
1314
+ onApplySql?: (sql: string) => void;
1315
+ }
1316
+ interface ChatPanelProps {
1317
+ /** Current SQL in the editor (passed as context to the agent). */
1318
+ currentSql: string | null;
1319
+ /** Callback when the user wants to apply SQL to the editor. */
1320
+ onApplySql: (sql: string) => void;
1321
+ /** Optional widget context for targeted SQL generation. */
1322
+ widgetContext?: WidgetContext;
1323
+ }
1324
+
1325
+ /**
1326
+ * Chat panel for LLM-assisted SQL generation.
1327
+ *
1328
+ * Side panel with message history, streaming indicator,
1329
+ * "Apply SQL" button, and input field.
1330
+ */
1331
+
1332
+ declare function ChatPanel({ currentSql, onApplySql, widgetContext }: ChatPanelProps): JSX.Element;
1333
+
1334
+ /**
1335
+ * Chat message bubble component.
1336
+ *
1337
+ * Renders user and assistant messages with distinct styling.
1338
+ * Detects ```sql code blocks and adds an "Apply to Editor" button.
1339
+ */
1340
+
1341
+ declare function ChatBubble({ message, onApplySql }: ChatBubbleProps): JSX.Element;
1342
+
1343
+ export { Pagination as $, AggregationPicker as A, Badge as B, ChatBubble as C, Dialog as D, EmptyDashboard as E, type EmptyDashboardProps as F, EmptyState as G, type EmptyStateProps as H, ErrorBoundary as I, type ErrorBoundaryProps as J, ErrorFallback as K, type ErrorFallbackProps as L, FilterBuilder as M, type FilterBuilderProps as N, FilterRow as O, type FilterRowProps as P, FilterValueInput as Q, type FilterValueInputProps as R, Icon as S, type IconName as T, type IconProps as U, Input as V, type InputProps as W, NoData as X, type NoDataProps as Y, NoResults as Z, type NoResultsProps as _, type AggregationPickerProps as a, type PaginationProps as a0, QueryBuilder as a1, type QueryBuilderProps as a2, type QueryBuilderState as a3, QueryBuilderToolbar as a4, type QueryBuilderToolbarProps as a5, QueryPreview as a6, type QueryPreviewProps as a7, ResultsTable as a8, type ResultsTableProps as a9, type TableHeaderProps as aA, TableNode as aB, type TableNodeProps as aC, TableRow as aD, type TableRowProps as aE, Tooltip as aF, type TooltipProps as aG, WidgetErrorBoundary as aH, type WidgetErrorBoundaryProps as aI, SavedQueryPicker as aa, type SavedQueryPickerProps as ab, SchemaExplorer as ac, type SchemaExplorerProps as ad, Select as ae, type SelectOption as af, type SelectProps as ag, SelectedColumn as ah, type SelectedColumnProps as ai, Skeleton as aj, SkeletonChart as ak, type SkeletonChartProps as al, SkeletonMetricCard as am, type SkeletonMetricCardProps as an, type SkeletonProps as ao, SkeletonTable as ap, type SkeletonTableProps as aq, SkeletonText as ar, type SkeletonTextProps as as, SortBuilder as at, type SortBuilderProps as au, SortRow as av, type SortRowProps as aw, TableCell as ax, type TableCellProps as ay, TableHeader as az, type BadgeProps as b, Button as c, type ButtonProps as d, type ChatBubbleProps as e, ChatPanel as f, type ChatPanelProps as g, Checkbox as h, type CheckboxProps as i, ColumnNode as j, type ColumnNodeProps as k, ColumnSelector as l, type ColumnSelectorProps as m, CustomSQLEditor as n, type CustomSQLEditorProps as o, DialogFooter as p, type DialogFooterProps as q, DialogHeader as r, type DialogHeaderProps as s, type DialogProps as t, Dropdown as u, DropdownItem as v, type DropdownItemProps as w, type DropdownProps as x, DropdownSeparator as y, type DropdownSeparatorProps as z };
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import react__default, { ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, HTMLAttributes, ReactElement, SVGAttributes, Component, ErrorInfo } from 'react';
3
- import { c as TableSchema, p as ColumnSchema, b as QueryTable, q as ColumnSelection, D as DatabaseSchema, F as FilterDefinition, s as FilterOperator, u as SortDefinition, A as AggregationType, Q as QueryResult, a as QueryDefinition, k as SavedQuery } from './types-j0kPJ9Hz.cjs';
3
+ import { c as TableSchema, t as ColumnSchema, b as QueryTable, u as ColumnSelection, D as DatabaseSchema, F as FilterDefinition, w as FilterOperator, y as SortDefinition, A as AggregationType, Q as QueryResult, a as QueryDefinition, k as SavedQuery, o as ChatMessage, p as WidgetContext } from './types-BaI6sSAG.cjs';
4
4
 
5
5
  interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
6
6
  /** Button visual style. */
@@ -660,6 +660,8 @@ interface SchemaExplorerProps {
660
660
  searchable?: boolean;
661
661
  /** Whether tables are collapsible. */
662
662
  collapsible?: boolean;
663
+ /** Optional element rendered at the right end of the header row. */
664
+ headerAction?: React.ReactNode;
663
665
  /** Additional class name. */
664
666
  className?: string;
665
667
  /** Additional styles. */
@@ -678,7 +680,7 @@ interface SchemaExplorerProps {
678
680
  * />
679
681
  * ```
680
682
  */
681
- declare function SchemaExplorer({ onTableSelect, onColumnSelect, onColumnDragStart, selectedTable, selectedColumns, searchable, collapsible, className, style, }: SchemaExplorerProps): JSX.Element;
683
+ declare function SchemaExplorer({ onTableSelect, onColumnSelect, onColumnDragStart, selectedTable, selectedColumns, searchable, collapsible, headerAction, className, style, }: SchemaExplorerProps): JSX.Element;
682
684
 
683
685
  /**
684
686
  * TableNode component for displaying a table in the schema explorer.
@@ -1301,4 +1303,41 @@ interface CustomSQLEditorProps {
1301
1303
  */
1302
1304
  declare function CustomSQLEditor({ initialSql, onSqlChange, onExecute, placeholder, showResults, height, className, style, }: CustomSQLEditorProps): JSX.Element;
1303
1305
 
1304
- export { type QueryBuilderState as $, AggregationPicker as A, Badge as B, Checkbox as C, Dialog as D, EmptyDashboard as E, type ErrorBoundaryProps as F, ErrorFallback as G, type ErrorFallbackProps as H, FilterBuilder as I, type FilterBuilderProps as J, FilterRow as K, type FilterRowProps as L, FilterValueInput as M, type FilterValueInputProps as N, Icon as O, type IconName as P, type IconProps as Q, Input as R, type InputProps as S, NoData as T, type NoDataProps as U, NoResults as V, type NoResultsProps as W, Pagination as X, type PaginationProps as Y, QueryBuilder as Z, type QueryBuilderProps as _, type AggregationPickerProps as a, QueryBuilderToolbar as a0, type QueryBuilderToolbarProps as a1, QueryPreview as a2, type QueryPreviewProps as a3, ResultsTable as a4, type ResultsTableProps as a5, SavedQueryPicker as a6, type SavedQueryPickerProps as a7, SchemaExplorer as a8, type SchemaExplorerProps as a9, type TableRowProps as aA, Tooltip as aB, type TooltipProps as aC, WidgetErrorBoundary as aD, type WidgetErrorBoundaryProps as aE, Select as aa, type SelectOption as ab, type SelectProps as ac, SelectedColumn as ad, type SelectedColumnProps as ae, Skeleton as af, SkeletonChart as ag, type SkeletonChartProps as ah, SkeletonMetricCard as ai, type SkeletonMetricCardProps as aj, type SkeletonProps as ak, SkeletonTable as al, type SkeletonTableProps as am, SkeletonText as an, type SkeletonTextProps as ao, SortBuilder as ap, type SortBuilderProps as aq, SortRow as ar, type SortRowProps as as, TableCell as at, type TableCellProps as au, TableHeader as av, type TableHeaderProps as aw, TableNode as ax, type TableNodeProps as ay, TableRow as az, type BadgeProps as b, Button as c, type ButtonProps as d, type CheckboxProps as e, ColumnNode as f, type ColumnNodeProps as g, ColumnSelector as h, type ColumnSelectorProps as i, CustomSQLEditor as j, type CustomSQLEditorProps as k, DialogFooter as l, type DialogFooterProps as m, DialogHeader as n, type DialogHeaderProps as o, type DialogProps as p, Dropdown as q, DropdownItem as r, type DropdownItemProps as s, type DropdownProps as t, DropdownSeparator as u, type DropdownSeparatorProps as v, type EmptyDashboardProps as w, EmptyState as x, type EmptyStateProps as y, ErrorBoundary as z };
1306
+ /**
1307
+ * Shared types for ChatPanel components.
1308
+ */
1309
+
1310
+ interface ChatBubbleProps {
1311
+ /** The chat message to render. */
1312
+ message: ChatMessage;
1313
+ /** Callback when user clicks "Apply to Editor" on a SQL block. */
1314
+ onApplySql?: (sql: string) => void;
1315
+ }
1316
+ interface ChatPanelProps {
1317
+ /** Current SQL in the editor (passed as context to the agent). */
1318
+ currentSql: string | null;
1319
+ /** Callback when the user wants to apply SQL to the editor. */
1320
+ onApplySql: (sql: string) => void;
1321
+ /** Optional widget context for targeted SQL generation. */
1322
+ widgetContext?: WidgetContext;
1323
+ }
1324
+
1325
+ /**
1326
+ * Chat panel for LLM-assisted SQL generation.
1327
+ *
1328
+ * Side panel with message history, streaming indicator,
1329
+ * "Apply SQL" button, and input field.
1330
+ */
1331
+
1332
+ declare function ChatPanel({ currentSql, onApplySql, widgetContext }: ChatPanelProps): JSX.Element;
1333
+
1334
+ /**
1335
+ * Chat message bubble component.
1336
+ *
1337
+ * Renders user and assistant messages with distinct styling.
1338
+ * Detects ```sql code blocks and adds an "Apply to Editor" button.
1339
+ */
1340
+
1341
+ declare function ChatBubble({ message, onApplySql }: ChatBubbleProps): JSX.Element;
1342
+
1343
+ export { Pagination as $, AggregationPicker as A, Badge as B, ChatBubble as C, Dialog as D, EmptyDashboard as E, type EmptyDashboardProps as F, EmptyState as G, type EmptyStateProps as H, ErrorBoundary as I, type ErrorBoundaryProps as J, ErrorFallback as K, type ErrorFallbackProps as L, FilterBuilder as M, type FilterBuilderProps as N, FilterRow as O, type FilterRowProps as P, FilterValueInput as Q, type FilterValueInputProps as R, Icon as S, type IconName as T, type IconProps as U, Input as V, type InputProps as W, NoData as X, type NoDataProps as Y, NoResults as Z, type NoResultsProps as _, type AggregationPickerProps as a, type PaginationProps as a0, QueryBuilder as a1, type QueryBuilderProps as a2, type QueryBuilderState as a3, QueryBuilderToolbar as a4, type QueryBuilderToolbarProps as a5, QueryPreview as a6, type QueryPreviewProps as a7, ResultsTable as a8, type ResultsTableProps as a9, type TableHeaderProps as aA, TableNode as aB, type TableNodeProps as aC, TableRow as aD, type TableRowProps as aE, Tooltip as aF, type TooltipProps as aG, WidgetErrorBoundary as aH, type WidgetErrorBoundaryProps as aI, SavedQueryPicker as aa, type SavedQueryPickerProps as ab, SchemaExplorer as ac, type SchemaExplorerProps as ad, Select as ae, type SelectOption as af, type SelectProps as ag, SelectedColumn as ah, type SelectedColumnProps as ai, Skeleton as aj, SkeletonChart as ak, type SkeletonChartProps as al, SkeletonMetricCard as am, type SkeletonMetricCardProps as an, type SkeletonProps as ao, SkeletonTable as ap, type SkeletonTableProps as aq, SkeletonText as ar, type SkeletonTextProps as as, SortBuilder as at, type SortBuilderProps as au, SortRow as av, type SortRowProps as aw, TableCell as ax, type TableCellProps as ay, TableHeader as az, type BadgeProps as b, Button as c, type ButtonProps as d, type ChatBubbleProps as e, ChatPanel as f, type ChatPanelProps as g, Checkbox as h, type CheckboxProps as i, ColumnNode as j, type ColumnNodeProps as k, ColumnSelector as l, type ColumnSelectorProps as m, CustomSQLEditor as n, type CustomSQLEditorProps as o, DialogFooter as p, type DialogFooterProps as q, DialogHeader as r, type DialogHeaderProps as s, type DialogProps as t, Dropdown as u, DropdownItem as v, type DropdownItemProps as w, type DropdownProps as x, DropdownSeparator as y, type DropdownSeparatorProps as z };
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode } from 'react';
3
- import { a as QueryDefinition, Q as QueryResult, D as DatabaseSchema, e as Dashboard$2, f as DashboardCreate, g as DashboardUpdate } from './types-j0kPJ9Hz.js';
3
+ import { a as QueryDefinition, Q as QueryResult, D as DatabaseSchema, e as Dashboard$2, f as DashboardCreate, g as DashboardUpdate } from './types-BaI6sSAG.cjs';
4
4
 
5
5
  /**
6
6
  * Dashboard type definitions for Prismiq.
@@ -119,8 +119,10 @@ interface WidgetConfig {
119
119
  alignment?: 'Left' | 'Center' | 'Right';
120
120
  /** Font size for text widgets. */
121
121
  fontSize?: 'Small' | 'Normal' | 'Large' | 'XLarge';
122
- /** Editor mode used to build this widget ('guided', 'advanced', or 'saved'). */
123
- data_source_mode?: 'guided' | 'advanced' | 'saved';
122
+ /** Raw SQL query for SQL-mode widgets. When set, widget.query should be null. */
123
+ raw_sql?: string;
124
+ /** Editor mode used to build this widget ('guided', 'advanced', 'saved', or 'sql'). */
125
+ data_source_mode?: 'guided' | 'advanced' | 'saved' | 'sql';
124
126
  }
125
127
  /**
126
128
  * Widget hyperlink configuration for linking to external URLs.
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode } from 'react';
3
- import { a as QueryDefinition, Q as QueryResult, D as DatabaseSchema, e as Dashboard$2, f as DashboardCreate, g as DashboardUpdate } from './types-j0kPJ9Hz.cjs';
3
+ import { a as QueryDefinition, Q as QueryResult, D as DatabaseSchema, e as Dashboard$2, f as DashboardCreate, g as DashboardUpdate } from './types-BaI6sSAG.js';
4
4
 
5
5
  /**
6
6
  * Dashboard type definitions for Prismiq.
@@ -119,8 +119,10 @@ interface WidgetConfig {
119
119
  alignment?: 'Left' | 'Center' | 'Right';
120
120
  /** Font size for text widgets. */
121
121
  fontSize?: 'Small' | 'Normal' | 'Large' | 'XLarge';
122
- /** Editor mode used to build this widget ('guided', 'advanced', or 'saved'). */
123
- data_source_mode?: 'guided' | 'advanced' | 'saved';
122
+ /** Raw SQL query for SQL-mode widgets. When set, widget.query should be null. */
123
+ raw_sql?: string;
124
+ /** Editor mode used to build this widget ('guided', 'advanced', 'saved', or 'sql'). */
125
+ data_source_mode?: 'guided' | 'advanced' | 'saved' | 'sql';
124
126
  }
125
127
  /**
126
128
  * Widget hyperlink configuration for linking to external URLs.
@@ -1,2 +1,2 @@
1
- export { A as AreaChart, c as AreaChartProps, d as AxisFormat, B as BarChart, e as BarChartProps, f as BaseChartProps, g as ChartClickParams, C as ChartDataOptions, h as ChartDataPoint, b as ChartDataResult, i as ChartSeries, j as ChartSuggestion, k as ChartType, E as EChartWrapper, l as EChartWrapperProps, L as LegendPosition, m as LineChart, n as LineChartProps, M as MetricCard, o as MetricCardProps, p as PieChart, q as PieChartProps, R as ReferenceLineConfig, S as ScatterChart, r as ScatterChartProps, s as Sparkline, t as SparklineProps, u as TrendConfig, v as TrendIndicator, w as TrendIndicatorProps, U as adjustColorOpacity, x as applyThemeToOption, y as createChartTheme, V as createEmptyStateGraphic, z as createGradientColor, W as createMarkLines, F as dataPointsToChartData, G as formatAxisLabel, H as formatCompact, I as formatMetricValue, J as getChartColors, K as isChartDataEmpty, X as isQueryResult, N as queryResultToChartData, O as suggestChartType, Q as toChartData } from '../index-CvKj3SWO.cjs';
2
- import '../types-j0kPJ9Hz.cjs';
1
+ export { A as AreaChart, c as AreaChartProps, d as AxisFormat, B as BarChart, e as BarChartProps, f as BaseChartProps, g as ChartClickParams, C as ChartDataOptions, h as ChartDataPoint, b as ChartDataResult, i as ChartSeries, j as ChartSuggestion, k as ChartType, E as EChartWrapper, l as EChartWrapperProps, L as LegendPosition, m as LineChart, n as LineChartProps, M as MetricCard, o as MetricCardProps, p as PieChart, q as PieChartProps, R as ReferenceLineConfig, S as ScatterChart, r as ScatterChartProps, s as Sparkline, t as SparklineProps, u as TrendConfig, v as TrendIndicator, w as TrendIndicatorProps, U as adjustColorOpacity, x as applyThemeToOption, y as createChartTheme, V as createEmptyStateGraphic, z as createGradientColor, W as createMarkLines, F as dataPointsToChartData, G as formatAxisLabel, H as formatCompact, I as formatMetricValue, J as getChartColors, K as isChartDataEmpty, X as isQueryResult, N as queryResultToChartData, O as suggestChartType, Q as toChartData } from '../index-BA2VUhgN.cjs';
2
+ import '../types-BaI6sSAG.cjs';
@@ -1,2 +1,2 @@
1
- export { A as AreaChart, c as AreaChartProps, d as AxisFormat, B as BarChart, e as BarChartProps, f as BaseChartProps, g as ChartClickParams, C as ChartDataOptions, h as ChartDataPoint, b as ChartDataResult, i as ChartSeries, j as ChartSuggestion, k as ChartType, E as EChartWrapper, l as EChartWrapperProps, L as LegendPosition, m as LineChart, n as LineChartProps, M as MetricCard, o as MetricCardProps, p as PieChart, q as PieChartProps, R as ReferenceLineConfig, S as ScatterChart, r as ScatterChartProps, s as Sparkline, t as SparklineProps, u as TrendConfig, v as TrendIndicator, w as TrendIndicatorProps, U as adjustColorOpacity, x as applyThemeToOption, y as createChartTheme, V as createEmptyStateGraphic, z as createGradientColor, W as createMarkLines, F as dataPointsToChartData, G as formatAxisLabel, H as formatCompact, I as formatMetricValue, J as getChartColors, K as isChartDataEmpty, X as isQueryResult, N as queryResultToChartData, O as suggestChartType, Q as toChartData } from '../index-DXGLs1yY.js';
2
- import '../types-j0kPJ9Hz.js';
1
+ export { A as AreaChart, c as AreaChartProps, d as AxisFormat, B as BarChart, e as BarChartProps, f as BaseChartProps, g as ChartClickParams, C as ChartDataOptions, h as ChartDataPoint, b as ChartDataResult, i as ChartSeries, j as ChartSuggestion, k as ChartType, E as EChartWrapper, l as EChartWrapperProps, L as LegendPosition, m as LineChart, n as LineChartProps, M as MetricCard, o as MetricCardProps, p as PieChart, q as PieChartProps, R as ReferenceLineConfig, S as ScatterChart, r as ScatterChartProps, s as Sparkline, t as SparklineProps, u as TrendConfig, v as TrendIndicator, w as TrendIndicatorProps, U as adjustColorOpacity, x as applyThemeToOption, y as createChartTheme, V as createEmptyStateGraphic, z as createGradientColor, W as createMarkLines, F as dataPointsToChartData, G as formatAxisLabel, H as formatCompact, I as formatMetricValue, J as getChartColors, K as isChartDataEmpty, X as isQueryResult, N as queryResultToChartData, O as suggestChartType, Q as toChartData } from '../index-BPo89ZAj.js';
2
+ import '../types-BaI6sSAG.js';
@@ -1,5 +1,5 @@
1
1
  import { ScatterChart, PieChart, AreaChart, LineChart, BarChart, MetricCard } from './chunk-FQ23KG6G.js';
2
- import { Dropdown, DropdownItem, Icon, DropdownSeparator, Button, Skeleton, EmptyState, Dialog, Input, Checkbox, DialogFooter, useAnalytics, useCrossFilterOptional, useDebouncedLayoutSave, AutoSaveIndicator, ResultsTable, CrossFilterProvider, Tooltip, QueryBuilder, SavedQueryPicker, useSchema, Select, CollapsibleSection, ColorPaletteSelector, FilterBuilder, TableSelector, JoinBuilder, TimeSeriesConfig, CalculatedFieldBuilder } from './chunk-ET7GCREP.js';
2
+ import { Dropdown, DropdownItem, Icon, DropdownSeparator, Button, Skeleton, EmptyState, Dialog, Input, Checkbox, DialogFooter, useAnalytics, useCrossFilterOptional, useDebouncedLayoutSave, AutoSaveIndicator, ResultsTable, CrossFilterProvider, useLLMStatus, Tooltip, QueryBuilder, SavedQueryPicker, SchemaExplorer, CustomSQLEditor, ChatPanel, useSchema, Select, CollapsibleSection, ColorPaletteSelector, FilterBuilder, TableSelector, JoinBuilder, TimeSeriesConfig, CalculatedFieldBuilder } from './chunk-VEFYFB5H.js';
3
3
  import { useTheme } from './chunk-T6STUE7E.js';
4
4
  import { formatRelativeTime, createDateFormatters, pivotQueryResult, parseMarkdownSafe, parseColumnRef } from './chunk-LBE6GIBC.js';
5
5
  import { createContext, forwardRef, useState, useEffect, useCallback, useRef, useMemo, useContext } from 'react';
@@ -180,7 +180,8 @@ function DashboardProvider({
180
180
  if (!lazyLoadingEnabledRef.current) {
181
181
  const initialLoadingState = {};
182
182
  data.widgets.forEach((widget) => {
183
- if (widget.query) {
183
+ const isSqlMode = widget.config?.data_source_mode === "sql" && widget.config?.raw_sql;
184
+ if (widget.query || isSqlMode) {
184
185
  initialLoadingState[widget.id] = true;
185
186
  }
186
187
  });
@@ -189,7 +190,8 @@ function DashboardProvider({
189
190
  }, []);
190
191
  const executeWidgetQuery = useCallback(
191
192
  async (widget, currentDashboard, currentFilters, currentCrossFilters, bypassCache = false, signal) => {
192
- if (!widget.query) {
193
+ const isSqlMode = widget.config?.data_source_mode === "sql" && widget.config?.raw_sql;
194
+ if (!widget.query && !isSqlMode) {
193
195
  return;
194
196
  }
195
197
  setWidgetLoading((prev) => ({ ...prev, [widget.id]: true }));
@@ -202,13 +204,18 @@ function DashboardProvider({
202
204
  return next;
203
205
  });
204
206
  try {
205
- let query = applyFiltersToQuery(
206
- widget.query,
207
- currentDashboard,
208
- currentFilters
209
- );
210
- query = applyCrossFiltersToQuery(query, currentCrossFilters, widget.id);
211
- const result = await client.executeQuery(query, bypassCache, signal);
207
+ let result;
208
+ if (isSqlMode) {
209
+ result = await client.executeSQL(widget.config.raw_sql);
210
+ } else {
211
+ let query = applyFiltersToQuery(
212
+ widget.query,
213
+ currentDashboard,
214
+ currentFilters
215
+ );
216
+ query = applyCrossFiltersToQuery(query, currentCrossFilters, widget.id);
217
+ result = await client.executeQuery(query, bypassCache, signal);
218
+ }
212
219
  if (signal?.aborted) return;
213
220
  setWidgetResults((prev) => ({ ...prev, [widget.id]: result }));
214
221
  const refreshTime = result.cached_at ?? Date.now() / 1e3;
@@ -237,7 +244,9 @@ function DashboardProvider({
237
244
  );
238
245
  const executeWidgetsInBatches = useCallback(
239
246
  async (widgets, currentDashboard, currentFilters, currentCrossFilters, bypassCache = false, currentBatchSize = batchSize, signal) => {
240
- const widgetsWithQueries = widgets.filter((w) => w.query !== null);
247
+ const widgetsWithQueries = widgets.filter(
248
+ (w) => w.query !== null || w.config?.data_source_mode === "sql" && w.config?.raw_sql
249
+ );
241
250
  for (let i = 0; i < widgetsWithQueries.length; i += currentBatchSize) {
242
251
  if (signal?.aborted) return;
243
252
  const batch = widgetsWithQueries.slice(i, i + currentBatchSize);
@@ -436,7 +445,7 @@ function DashboardProvider({
436
445
  useEffect(() => {
437
446
  if (!lazyLoadingEnabled || !dashboard || isLoading) return;
438
447
  const widgetsToLoad = dashboard.widgets.filter(
439
- (w) => visibleWidgets.has(w.id) && w.query !== null && !widgetResults[w.id] && !widgetLoading[w.id]
448
+ (w) => visibleWidgets.has(w.id) && (w.query !== null || w.config?.data_source_mode === "sql" && w.config?.raw_sql) && !widgetResults[w.id] && !widgetLoading[w.id]
440
449
  );
441
450
  if (widgetsToLoad.length > 0) {
442
451
  const signal = abortControllerRef.current?.signal;
@@ -470,7 +479,7 @@ function DashboardProvider({
470
479
  if (prevFilterValuesRef.current === filterValuesKey) return;
471
480
  prevFilterValuesRef.current = filterValuesKey;
472
481
  const widgetsToRefresh = dashboard.widgets.filter(
473
- (w) => everVisibleWidgets.has(w.id) && w.query !== null && widgetResults[w.id]
482
+ (w) => everVisibleWidgets.has(w.id) && (w.query !== null || w.config?.data_source_mode === "sql" && w.config?.raw_sql) && widgetResults[w.id]
474
483
  // Only re-execute if previously loaded
475
484
  );
476
485
  if (widgetsToRefresh.length > 0) {
@@ -3117,6 +3126,7 @@ function WidgetPreview({
3117
3126
  title,
3118
3127
  config,
3119
3128
  query,
3129
+ rawSql,
3120
3130
  result,
3121
3131
  isLoading = false,
3122
3132
  error,
@@ -3171,13 +3181,14 @@ function WidgetPreview({
3171
3181
  };
3172
3182
  const previewWidget = createPreviewWidget(type, title, config, query);
3173
3183
  const needsQuery = type !== "text";
3174
- const showEmptyState = needsQuery && !query && !isLoading;
3175
- return /* @__PURE__ */ jsxs("div", { className: `prismiq-widget-preview ${className}`, style: containerStyle, children: [
3184
+ const hasDataSource = !!query || !!rawSql;
3185
+ const showEmptyState = needsQuery && !hasDataSource && !isLoading;
3186
+ return /* @__PURE__ */ jsxs("div", { className: `prismiq-widget-preview ${className}`, style: containerStyle, "data-testid": "widget-preview", children: [
3176
3187
  /* @__PURE__ */ jsxs("div", { style: headerStyle, children: [
3177
3188
  /* @__PURE__ */ jsx("h3", { style: titleStyle, children: title || "Widget Preview" }),
3178
3189
  /* @__PURE__ */ jsx("span", { style: labelStyle, children: "Preview" })
3179
3190
  ] }),
3180
- /* @__PURE__ */ jsx("div", { style: contentStyle, children: showEmptyState ? /* @__PURE__ */ jsxs("div", { style: emptyStateStyle, children: [
3191
+ /* @__PURE__ */ jsx("div", { style: contentStyle, children: showEmptyState ? /* @__PURE__ */ jsxs("div", { style: emptyStateStyle, "data-testid": "widget-preview-empty", children: [
3181
3192
  /* @__PURE__ */ jsx(
3182
3193
  "div",
3183
3194
  {
@@ -5369,6 +5380,7 @@ function WidgetEditorPage({
5369
5380
  }) {
5370
5381
  const { theme } = useTheme();
5371
5382
  const { client } = useAnalytics();
5383
+ const { enabled: llmEnabled, isLoading: llmStatusLoading } = useLLMStatus();
5372
5384
  const isNew = widget === null;
5373
5385
  const [type, setType] = useState(widget?.type ?? "bar_chart");
5374
5386
  const [title, setTitle] = useState(widget?.title ?? "New Widget");
@@ -5380,6 +5392,8 @@ function WidgetEditorPage({
5380
5392
  const [position, setPosition] = useState(
5381
5393
  widget?.position ?? { x: 0, y: 0, w: 6, h: 4, minW: 2, minH: 2 }
5382
5394
  );
5395
+ const [rawSql, setRawSql] = useState(widget?.config?.raw_sql ?? "");
5396
+ const [schemaOpen, setSchemaOpen] = useState(true);
5383
5397
  const [dataSourceMode, setDataSourceMode] = useState(
5384
5398
  isNew ? "guided" : widget?.config?.data_source_mode ?? "guided"
5385
5399
  );
@@ -5404,6 +5418,24 @@ function WidgetEditorPage({
5404
5418
  []
5405
5419
  );
5406
5420
  const refreshPreview = useCallback(async () => {
5421
+ if (dataSourceMode === "sql") {
5422
+ if (!rawSql.trim() || !client) {
5423
+ setPreviewResult(null);
5424
+ return;
5425
+ }
5426
+ setPreviewLoading(true);
5427
+ setPreviewError(null);
5428
+ try {
5429
+ const result = await client.executeSQL(rawSql);
5430
+ setPreviewResult(result);
5431
+ } catch (err) {
5432
+ setPreviewError(err instanceof Error ? err : new Error("SQL execution failed"));
5433
+ setPreviewResult(null);
5434
+ } finally {
5435
+ setPreviewLoading(false);
5436
+ }
5437
+ return;
5438
+ }
5407
5439
  if (!query || !client) {
5408
5440
  setPreviewResult(null);
5409
5441
  return;
@@ -5419,15 +5451,18 @@ function WidgetEditorPage({
5419
5451
  } finally {
5420
5452
  setPreviewLoading(false);
5421
5453
  }
5422
- }, [query, client]);
5454
+ }, [query, rawSql, dataSourceMode, client]);
5423
5455
  useEffect(() => {
5456
+ if (dataSourceMode === "sql") {
5457
+ return;
5458
+ }
5424
5459
  if (query) {
5425
5460
  void refreshPreview();
5426
5461
  } else {
5427
5462
  setPreviewResult(null);
5428
5463
  setPreviewError(null);
5429
5464
  }
5430
- }, [query, refreshPreview]);
5465
+ }, [query, dataSourceMode, refreshPreview]);
5431
5466
  const queryHasAdvancedFeatures = useCallback((q) => {
5432
5467
  if (!q) return false;
5433
5468
  if (q.tables && q.tables.length > 1 && q.joins && q.joins.length > 0) return true;
@@ -5459,18 +5494,25 @@ function WidgetEditorPage({
5459
5494
  setPreviewResult(null);
5460
5495
  setPreviewError(null);
5461
5496
  }, []);
5497
+ const handleApplySql = useCallback((sql) => {
5498
+ setRawSql(sql);
5499
+ }, []);
5462
5500
  const handleSave = useCallback(() => {
5501
+ const savedConfig = { ...config, data_source_mode: dataSourceMode };
5502
+ if (dataSourceMode === "sql") {
5503
+ savedConfig.raw_sql = rawSql.trim() || void 0;
5504
+ }
5463
5505
  const savedWidget = {
5464
5506
  id: widget?.id ?? generateId(),
5465
5507
  type,
5466
5508
  title,
5467
- config: { ...config, data_source_mode: dataSourceMode },
5468
- query,
5509
+ config: savedConfig,
5510
+ query: dataSourceMode === "sql" ? null : query,
5469
5511
  position,
5470
5512
  hyperlink
5471
5513
  };
5472
5514
  onSave(savedWidget);
5473
- }, [widget, type, title, config, query, position, hyperlink, dataSourceMode, onSave]);
5515
+ }, [widget, type, title, config, query, rawSql, position, hyperlink, dataSourceMode, onSave]);
5474
5516
  const columnSelectOptions = useMemo(() => {
5475
5517
  if (!schema) return [];
5476
5518
  return schema.tables.flatMap(
@@ -5480,6 +5522,13 @@ function WidgetEditorPage({
5480
5522
  }))
5481
5523
  );
5482
5524
  }, [schema]);
5525
+ const widgetContext = useMemo(() => ({
5526
+ widget_type: type,
5527
+ x_axis: config.x_axis,
5528
+ y_axis: config.y_axis,
5529
+ series_column: config.series_column,
5530
+ last_error: previewError?.message
5531
+ }), [type, config.x_axis, config.y_axis, config.series_column, previewError]);
5483
5532
  const containerStyle = {
5484
5533
  display: "flex",
5485
5534
  flexDirection: "column",
@@ -5956,6 +6005,7 @@ function WidgetEditorPage({
5956
6005
  title,
5957
6006
  config,
5958
6007
  query,
6008
+ rawSql: dataSourceMode === "sql" ? rawSql : void 0,
5959
6009
  result: previewResult,
5960
6010
  isLoading: previewLoading,
5961
6011
  error: previewError
@@ -5999,6 +6049,24 @@ function WidgetEditorPage({
5999
6049
  }
6000
6050
  )
6001
6051
  }
6052
+ ),
6053
+ /* @__PURE__ */ jsx(
6054
+ Tooltip,
6055
+ {
6056
+ content: "Write raw SQL queries directly, with optional AI assistance",
6057
+ position: "bottom",
6058
+ style: { whiteSpace: "normal" },
6059
+ children: /* @__PURE__ */ jsx(
6060
+ "button",
6061
+ {
6062
+ type: "button",
6063
+ "data-testid": "data-source-mode-sql",
6064
+ style: tabStyle(dataSourceMode === "sql"),
6065
+ onClick: () => handleModeSwitch("sql"),
6066
+ children: "SQL"
6067
+ }
6068
+ )
6069
+ }
6002
6070
  )
6003
6071
  ] }),
6004
6072
  /* @__PURE__ */ jsxs("div", { style: dataSourceContentStyle, children: [
@@ -6030,7 +6098,101 @@ function WidgetEditorPage({
6030
6098
  onSelect: handleSavedQuerySelect,
6031
6099
  showSave: false
6032
6100
  }
6033
- )
6101
+ ),
6102
+ dataSourceMode === "sql" && /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 0, height: "100%", minHeight: "400px" }, children: [
6103
+ /* @__PURE__ */ jsx("div", { "data-testid": "schema-panel", style: {
6104
+ width: schemaOpen ? "220px" : "36px",
6105
+ flexShrink: 0,
6106
+ transition: "width 0.2s ease",
6107
+ borderRight: `1px solid ${theme.colors.border}`,
6108
+ display: "flex",
6109
+ flexDirection: "column",
6110
+ overflow: "hidden"
6111
+ }, children: schemaOpen ? /* @__PURE__ */ jsx(
6112
+ SchemaExplorer,
6113
+ {
6114
+ searchable: true,
6115
+ collapsible: true,
6116
+ onColumnSelect: (table, col) => {
6117
+ const ref = `"${table.name}"."${col.name}"`;
6118
+ setRawSql((prev) => prev ? `${prev} ${ref}` : ref);
6119
+ },
6120
+ headerAction: /* @__PURE__ */ jsx(
6121
+ "button",
6122
+ {
6123
+ type: "button",
6124
+ onClick: () => setSchemaOpen(false),
6125
+ title: "Collapse schema panel",
6126
+ "data-testid": "schema-toggle-open",
6127
+ style: {
6128
+ display: "flex",
6129
+ alignItems: "center",
6130
+ justifyContent: "center",
6131
+ width: "22px",
6132
+ height: "22px",
6133
+ backgroundColor: "transparent",
6134
+ border: `1px solid ${theme.colors.border}`,
6135
+ borderRadius: theme.radius.sm,
6136
+ cursor: "pointer",
6137
+ color: theme.colors.textMuted,
6138
+ flexShrink: 0
6139
+ },
6140
+ children: /* @__PURE__ */ jsx(Icon, { name: "chevron-left", size: 12 })
6141
+ }
6142
+ ),
6143
+ style: { flex: 1, border: "none", borderRadius: 0 }
6144
+ }
6145
+ ) : /* @__PURE__ */ jsxs(
6146
+ "button",
6147
+ {
6148
+ type: "button",
6149
+ onClick: () => setSchemaOpen(true),
6150
+ title: "Show schema browser",
6151
+ "data-testid": "schema-toggle-collapsed",
6152
+ style: {
6153
+ display: "flex",
6154
+ flexDirection: "column",
6155
+ alignItems: "center",
6156
+ gap: "6px",
6157
+ paddingTop: theme.spacing.sm,
6158
+ width: "100%",
6159
+ height: "100%",
6160
+ backgroundColor: theme.colors.surface,
6161
+ border: "none",
6162
+ cursor: "pointer",
6163
+ color: theme.colors.textMuted,
6164
+ fontFamily: theme.fonts.sans
6165
+ },
6166
+ children: [
6167
+ /* @__PURE__ */ jsx(Icon, { name: "table", size: 16 }),
6168
+ /* @__PURE__ */ jsx("span", { style: {
6169
+ writingMode: "vertical-rl",
6170
+ fontSize: "11px",
6171
+ fontWeight: 500,
6172
+ letterSpacing: "0.04em"
6173
+ }, children: "Schema" })
6174
+ ]
6175
+ }
6176
+ ) }),
6177
+ /* @__PURE__ */ jsx("div", { style: { flex: 1, minWidth: 0 }, "data-testid": "sql-editor", children: /* @__PURE__ */ jsx(
6178
+ CustomSQLEditor,
6179
+ {
6180
+ initialSql: rawSql,
6181
+ onSqlChange: setRawSql,
6182
+ onExecute: () => void refreshPreview(),
6183
+ showResults: false,
6184
+ placeholder: "Write your SQL query here..."
6185
+ }
6186
+ ) }),
6187
+ !llmStatusLoading && llmEnabled && /* @__PURE__ */ jsx("div", { style: { width: "340px", flexShrink: 0 }, "data-testid": "chat-panel", children: /* @__PURE__ */ jsx(
6188
+ ChatPanel,
6189
+ {
6190
+ currentSql: rawSql || null,
6191
+ onApplySql: handleApplySql,
6192
+ widgetContext
6193
+ }
6194
+ ) })
6195
+ ] })
6034
6196
  ] })
6035
6197
  ] })
6036
6198
  ] })
@@ -6112,7 +6274,9 @@ function DashboardEditor({
6112
6274
  clientRef.current = client;
6113
6275
  const loadedDashboardRef = useRef(null);
6114
6276
  const executeWidgetQueries = useCallback(async (widgets, currentClient) => {
6115
- const widgetsWithQueries = widgets.filter((w) => w.query);
6277
+ const widgetsWithQueries = widgets.filter(
6278
+ (w) => w.query || w.config?.data_source_mode === "sql" && w.config?.raw_sql
6279
+ );
6116
6280
  if (widgetsWithQueries.length === 0) return;
6117
6281
  for (let i = 0; i < widgetsWithQueries.length; i += batchSize) {
6118
6282
  const batch = widgetsWithQueries.slice(i, i + batchSize);
@@ -6126,7 +6290,8 @@ function DashboardEditor({
6126
6290
  await Promise.all(
6127
6291
  batch.map(async (widget) => {
6128
6292
  try {
6129
- const result = await currentClient.executeQuery(widget.query);
6293
+ const isSqlMode = widget.config?.data_source_mode === "sql" && widget.config?.raw_sql;
6294
+ const result = isSqlMode ? await currentClient.executeSQL(widget.config.raw_sql) : await currentClient.executeQuery(widget.query);
6130
6295
  setWidgetResults((prev) => ({ ...prev, [widget.id]: result }));
6131
6296
  setWidgetRefreshTimes((prev) => ({ ...prev, [widget.id]: Math.floor(Date.now() / 1e3) }));
6132
6297
  } catch (err) {
@@ -6203,11 +6368,12 @@ function DashboardEditor({
6203
6368
  const refreshWidget = useCallback(
6204
6369
  async (widgetId, widgetOverride) => {
6205
6370
  const widget = widgetOverride ?? dashboard.widgets.find((w) => w.id === widgetId);
6206
- if (!widget?.query || !client) return;
6371
+ const isSqlMode = widget?.config?.data_source_mode === "sql" && widget?.config?.raw_sql;
6372
+ if (!widget?.query && !isSqlMode || !client) return;
6207
6373
  setWidgetLoading((prev) => ({ ...prev, [widgetId]: true }));
6208
6374
  setRefreshingWidgets((prev) => new Set(prev).add(widgetId));
6209
6375
  try {
6210
- const result = await client.executeQuery(widget.query, true);
6376
+ const result = isSqlMode ? await client.executeSQL(widget.config.raw_sql) : await client.executeQuery(widget.query, true);
6211
6377
  setWidgetResults((prev) => ({ ...prev, [widgetId]: result }));
6212
6378
  setWidgetRefreshTimes((prev) => ({ ...prev, [widgetId]: Math.floor(Date.now() / 1e3) }));
6213
6379
  setWidgetErrors((prev) => {
@@ -7600,5 +7766,5 @@ var DashboardDialog = forwardRef(
7600
7766
  );
7601
7767
 
7602
7768
  export { Dashboard, DashboardCard, DashboardContext, DashboardDialog, DashboardEditor, DashboardLayout, DashboardList, DashboardProvider, DateRangeFilter, EditableDashboardLayout, EditorToolbar, FilterBar, LazyWidget, MultiSelectFilter, SelectFilter, TextFilter, Widget, WidgetContainer, WidgetContent, WidgetEditor, WidgetEditorPage, WidgetHeader, WidgetPalette, WidgetPlaceholder, WidgetPreview, WidgetTypeSelector, useAutoRefresh, useDashboard, useDashboardFilters, useFullscreen, useWidget, useWidgetVisibility };
7603
- //# sourceMappingURL=chunk-3LDRRDJ6.js.map
7604
- //# sourceMappingURL=chunk-3LDRRDJ6.js.map
7769
+ //# sourceMappingURL=chunk-F6QYNQEW.js.map
7770
+ //# sourceMappingURL=chunk-F6QYNQEW.js.map