drizzle-cube 0.2.7 → 0.2.8

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 (93) hide show
  1. package/dist/client/charts.js +11 -11
  2. package/dist/client/chunks/{chart-activitygridchart-config-48WqIofo.js → chart-activitygridchart-config-BngZDVh_.js} +96 -90
  3. package/dist/client/chunks/chart-activitygridchart-config-BngZDVh_.js.map +1 -0
  4. package/dist/client/chunks/{chart-areachart-config-D8taXdn1.js → chart-areachart-config-DWN1E5ej.js} +2 -2
  5. package/dist/client/chunks/{chart-areachart-config-D8taXdn1.js.map → chart-areachart-config-DWN1E5ej.js.map} +1 -1
  6. package/dist/client/chunks/chart-barchart-Bdjz8DJp.js +171 -0
  7. package/dist/client/chunks/chart-barchart-Bdjz8DJp.js.map +1 -0
  8. package/dist/client/chunks/{chart-barchart-config-DjRZBtLb.js → chart-barchart-config-DZA0xTns.js} +2 -2
  9. package/dist/client/chunks/{chart-barchart-config-DjRZBtLb.js.map → chart-barchart-config-DZA0xTns.js.map} +1 -1
  10. package/dist/client/chunks/{chart-bubblechart-config-C6ck2qmg.js → chart-bubblechart-config-C79lfDSO.js} +2 -2
  11. package/dist/client/chunks/{chart-bubblechart-config-C6ck2qmg.js.map → chart-bubblechart-config-C79lfDSO.js.map} +1 -1
  12. package/dist/client/chunks/chart-datatable-Mo4gYCwa.js +249 -0
  13. package/dist/client/chunks/chart-datatable-Mo4gYCwa.js.map +1 -0
  14. package/dist/client/chunks/{chart-datatable-config-B5z0SlOJ.js → chart-datatable-config-DqGw99R3.js} +2 -2
  15. package/dist/client/chunks/{chart-datatable-config-B5z0SlOJ.js.map → chart-datatable-config-DqGw99R3.js.map} +1 -1
  16. package/dist/client/chunks/{chart-kpidelta-Cf1JmtGF.js → chart-kpidelta-CTcuIO9G.js} +2 -2
  17. package/dist/client/chunks/{chart-kpidelta-Cf1JmtGF.js.map → chart-kpidelta-CTcuIO9G.js.map} +1 -1
  18. package/dist/client/chunks/{chart-kpidelta-config-CnZfi_P2.js → chart-kpidelta-config-B-Y-LHmd.js} +2 -2
  19. package/dist/client/chunks/{chart-kpidelta-config-CnZfi_P2.js.map → chart-kpidelta-config-B-Y-LHmd.js.map} +1 -1
  20. package/dist/client/chunks/{chart-kpinumber-config-CVikHojM.js → chart-kpinumber-config-BaNaJMI6.js} +2 -2
  21. package/dist/client/chunks/{chart-kpinumber-config-CVikHojM.js.map → chart-kpinumber-config-BaNaJMI6.js.map} +1 -1
  22. package/dist/client/chunks/{chart-kpinumber-eEMpzorv.js → chart-kpinumber-slEXt8C-.js} +3 -3
  23. package/dist/client/chunks/{chart-kpinumber-eEMpzorv.js.map → chart-kpinumber-slEXt8C-.js.map} +1 -1
  24. package/dist/client/chunks/{chart-kpitext-config-B2MovXSw.js → chart-kpitext-config-BNywYqEW.js} +2 -2
  25. package/dist/client/chunks/{chart-kpitext-config-B2MovXSw.js.map → chart-kpitext-config-BNywYqEW.js.map} +1 -1
  26. package/dist/client/chunks/{chart-kpitext-CppmccTK.js → chart-kpitext-giq03TOK.js} +2 -2
  27. package/dist/client/chunks/{chart-kpitext-CppmccTK.js.map → chart-kpitext-giq03TOK.js.map} +1 -1
  28. package/dist/client/chunks/{chart-linechart-config-CVBVB7nS.js → chart-linechart-config-BL_1mjHF.js} +2 -2
  29. package/dist/client/chunks/{chart-linechart-config-CVBVB7nS.js.map → chart-linechart-config-BL_1mjHF.js.map} +1 -1
  30. package/dist/client/chunks/{chart-markdownchart-config-Cq5Sxrgq.js → chart-markdownchart-config-DtZOfYu4.js} +2 -2
  31. package/dist/client/chunks/{chart-markdownchart-config-Cq5Sxrgq.js.map → chart-markdownchart-config-DtZOfYu4.js.map} +1 -1
  32. package/dist/client/chunks/{chart-piechart-config-Bdd31Gdi.js → chart-piechart-config-Bg4jeIFo.js} +2 -2
  33. package/dist/client/chunks/{chart-piechart-config-Bdd31Gdi.js.map → chart-piechart-config-Bg4jeIFo.js.map} +1 -1
  34. package/dist/client/chunks/{chart-radarchart-config-BWyfn0ij.js → chart-radarchart-config-d6dLkI7B.js} +2 -2
  35. package/dist/client/chunks/{chart-radarchart-config-BWyfn0ij.js.map → chart-radarchart-config-d6dLkI7B.js.map} +1 -1
  36. package/dist/client/chunks/{chart-radialbarchart-config-lU2_NQCD.js → chart-radialbarchart-config-BGf97-BV.js} +2 -2
  37. package/dist/client/chunks/{chart-radialbarchart-config-lU2_NQCD.js.map → chart-radialbarchart-config-BGf97-BV.js.map} +1 -1
  38. package/dist/client/chunks/{chart-scatterchart-config-DtLnut1M.js → chart-scatterchart-config-DEIB74ot.js} +2 -2
  39. package/dist/client/chunks/{chart-scatterchart-config-DtLnut1M.js.map → chart-scatterchart-config-DEIB74ot.js.map} +1 -1
  40. package/dist/client/chunks/{chart-treemapchart-config-BEiIWQnR.js → chart-treemapchart-config-ppKPTB96.js} +2 -2
  41. package/dist/client/chunks/{chart-treemapchart-config-BEiIWQnR.js.map → chart-treemapchart-config-ppKPTB96.js.map} +1 -1
  42. package/dist/client/chunks/{charts-BsPkAFTR.js → charts-MJLpxe3r.js} +25 -25
  43. package/dist/client/chunks/{charts-BsPkAFTR.js.map → charts-MJLpxe3r.js.map} +1 -1
  44. package/dist/client/chunks/components-CXA6-jJq.js +9845 -0
  45. package/dist/client/chunks/components-CXA6-jJq.js.map +1 -0
  46. package/dist/client/chunks/{icons-D6z-_9sa.js → icons-B2XSxpVK.js} +213 -181
  47. package/dist/client/chunks/icons-B2XSxpVK.js.map +1 -0
  48. package/dist/client/components/AnalysisBuilder/AnalysisAxisDropZone.d.ts +27 -0
  49. package/dist/client/components/AnalysisBuilder/AnalysisChartConfigPanel.d.ts +21 -0
  50. package/dist/client/components/AnalysisBuilder/AnalysisFilterGroup.d.ts +20 -0
  51. package/dist/client/components/AnalysisBuilder/AnalysisFilterItem.d.ts +16 -0
  52. package/dist/client/components/AnalysisBuilder/AnalysisFilterSection.d.ts +12 -0
  53. package/dist/client/components/AnalysisBuilder/AnalysisQueryPanel.d.ts +10 -0
  54. package/dist/client/components/AnalysisBuilder/AnalysisResultsPanel.d.ts +12 -0
  55. package/dist/client/components/AnalysisBuilder/BreakdownItemCard.d.ts +10 -0
  56. package/dist/client/components/AnalysisBuilder/BreakdownSection.d.ts +8 -0
  57. package/dist/client/components/AnalysisBuilder/FieldDetailPanel.d.ts +4 -0
  58. package/dist/client/components/AnalysisBuilder/FieldSearchItem.d.ts +6 -0
  59. package/dist/client/components/AnalysisBuilder/FieldSearchModal.d.ts +2 -0
  60. package/dist/client/components/AnalysisBuilder/MetricItemCard.d.ts +9 -0
  61. package/dist/client/components/AnalysisBuilder/MetricsSection.d.ts +8 -0
  62. package/dist/client/components/AnalysisBuilder/index.d.ts +3 -0
  63. package/dist/client/components/AnalysisBuilder/types.d.ts +366 -0
  64. package/dist/client/components/AnalysisBuilder/utils.d.ts +103 -0
  65. package/dist/client/components/ChartTypeSelector.d.ts +6 -1
  66. package/dist/client/components/QueryBuilder/CubeMetaExplorer.d.ts +2 -2
  67. package/dist/client/components/QueryBuilder/QueryPanel.d.ts +2 -2
  68. package/dist/client/components/QueryBuilder/types.d.ts +7 -138
  69. package/dist/client/components/charts/DataTable.d.ts +1 -1
  70. package/dist/client/components.js +16 -9725
  71. package/dist/client/components.js.map +1 -1
  72. package/dist/client/icons/types.d.ts +6 -0
  73. package/dist/client/icons.js +1 -1
  74. package/dist/client/index.d.ts +1 -0
  75. package/dist/client/index.js +3202 -49
  76. package/dist/client/index.js.map +1 -1
  77. package/dist/client/shared/chartDefaults.d.ts +64 -0
  78. package/dist/client/shared/components/QueryAnalysisPanel.d.ts +7 -0
  79. package/dist/client/shared/index.d.ts +10 -0
  80. package/dist/client/shared/types.d.ts +134 -0
  81. package/dist/client/shared/utils.d.ts +101 -0
  82. package/dist/client/styles.css +1 -1
  83. package/dist/client/types.d.ts +1 -0
  84. package/dist/client/utils/index.d.ts +1 -0
  85. package/dist/client/utils/pivotUtils.d.ts +78 -0
  86. package/dist/client-bundle-stats.html +1 -1
  87. package/package.json +1 -1
  88. package/dist/client/chunks/chart-activitygridchart-config-48WqIofo.js.map +0 -1
  89. package/dist/client/chunks/chart-barchart-7bCO3dnb.js +0 -177
  90. package/dist/client/chunks/chart-barchart-7bCO3dnb.js.map +0 -1
  91. package/dist/client/chunks/chart-datatable-BTqU80Qo.js +0 -57
  92. package/dist/client/chunks/chart-datatable-BTqU80Qo.js.map +0 -1
  93. package/dist/client/chunks/icons-D6z-_9sa.js.map +0 -1
@@ -0,0 +1,366 @@
1
+ import { default as React } from 'react';
2
+ import { CubeQuery, Filter, ChartType, ChartAxisConfig, ChartDisplayConfig } from '../../types';
3
+ import { MetaResponse, MetaField, MetaCube, QueryAnalysis } from '../../shared/types';
4
+ import { ChartAvailabilityMap } from '../../shared/chartDefaults';
5
+ export type { MetaResponse, MetaField, MetaCube, QueryAnalysis };
6
+ /**
7
+ * A selected metric (measure) with a letter label (A, B, C, ...)
8
+ */
9
+ export interface MetricItem {
10
+ /** Unique identifier for this metric selection */
11
+ id: string;
12
+ /** Full field name, e.g., "Employees.count" */
13
+ field: string;
14
+ /** Display label (A, B, C, ...) */
15
+ label: string;
16
+ }
17
+ /**
18
+ * A selected breakdown (dimension or time dimension)
19
+ */
20
+ export interface BreakdownItem {
21
+ /** Unique identifier for this breakdown selection */
22
+ id: string;
23
+ /** Full field name, e.g., "Employees.departmentName" */
24
+ field: string;
25
+ /** Granularity for time dimensions (day, week, month, quarter, year) */
26
+ granularity?: string;
27
+ /** Whether this is a time dimension */
28
+ isTimeDimension: boolean;
29
+ }
30
+ /** Validation status for query building */
31
+ export type ValidationStatus = 'idle' | 'validating' | 'valid' | 'invalid';
32
+ /** Execution status for query results */
33
+ export type ExecutionStatus = 'idle' | 'loading' | 'refreshing' | 'success' | 'error';
34
+ /**
35
+ * Main state for the AnalysisBuilder component
36
+ */
37
+ export interface AnalysisBuilderState {
38
+ /** Selected metrics (measures) */
39
+ metrics: MetricItem[];
40
+ /** Selected breakdowns (dimensions and time dimensions) */
41
+ breakdowns: BreakdownItem[];
42
+ /** Applied filters */
43
+ filters: Filter[];
44
+ validationStatus: ValidationStatus;
45
+ validationError: string | null;
46
+ executionStatus: ExecutionStatus;
47
+ executionResults: any[] | null;
48
+ executionError: string | null;
49
+ totalRowCount: number | null;
50
+ resultsStale: boolean;
51
+ }
52
+ /**
53
+ * Mode for the field search modal - determines which field types are shown
54
+ */
55
+ export type FieldSearchMode = 'metrics' | 'breakdown' | 'filter';
56
+ /**
57
+ * Field type categorization
58
+ */
59
+ export type FieldType = 'measure' | 'dimension' | 'timeDimension';
60
+ /**
61
+ * A field option for display in the search modal
62
+ */
63
+ export interface FieldOption {
64
+ /** Full field name, e.g., "Employees.count" */
65
+ name: string;
66
+ /** Display title */
67
+ title: string;
68
+ /** Short title for compact display */
69
+ shortTitle: string;
70
+ /** Field type (count, sum, avg, string, time, number, etc.) */
71
+ type: string;
72
+ /** Optional description */
73
+ description?: string;
74
+ /** Parent cube name */
75
+ cubeName: string;
76
+ /** Categorized field type */
77
+ fieldType: FieldType;
78
+ }
79
+ /**
80
+ * Props for the FieldSearchModal component
81
+ */
82
+ export interface FieldSearchModalProps {
83
+ /** Whether the modal is open */
84
+ isOpen: boolean;
85
+ /** Callback to close the modal */
86
+ onClose: () => void;
87
+ /** Callback when a field is selected. keepOpen=true when shift-click multi-selecting */
88
+ onSelect: (field: MetaField, fieldType: FieldType, cubeName: string, keepOpen?: boolean) => void;
89
+ /** Mode determines which field types to show */
90
+ mode: FieldSearchMode;
91
+ /** Schema metadata */
92
+ schema: MetaResponse | null;
93
+ /** Already selected field names (to show checkmarks) */
94
+ selectedFields: string[];
95
+ /** Recently used field names */
96
+ recentFields?: string[];
97
+ }
98
+ /**
99
+ * Props for the FieldSearchItem component
100
+ */
101
+ export interface FieldSearchItemProps {
102
+ /** Field data */
103
+ field: FieldOption;
104
+ /** Whether this field is selected */
105
+ isSelected: boolean;
106
+ /** Whether this field is focused/highlighted */
107
+ isFocused: boolean;
108
+ /** Click handler - receives mouse event for shift-click multi-select */
109
+ onClick: (e: React.MouseEvent) => void;
110
+ /** Mouse enter handler (for detail panel) */
111
+ onMouseEnter: () => void;
112
+ }
113
+ /**
114
+ * Props for the FieldDetailPanel component
115
+ */
116
+ export interface FieldDetailPanelProps {
117
+ /** Field to display details for */
118
+ field: FieldOption | null;
119
+ }
120
+ /**
121
+ * Tab options for the query panel
122
+ */
123
+ export type QueryPanelTab = 'query' | 'chart';
124
+ /**
125
+ * Props for the AnalysisQueryPanel component
126
+ */
127
+ export interface AnalysisQueryPanelProps {
128
+ /** Selected metrics */
129
+ metrics: MetricItem[];
130
+ /** Selected breakdowns */
131
+ breakdowns: BreakdownItem[];
132
+ /** Applied filters */
133
+ filters: Filter[];
134
+ /** Schema metadata */
135
+ schema: MetaResponse | null;
136
+ /** Currently active tab */
137
+ activeTab: QueryPanelTab;
138
+ /** Callback when active tab changes */
139
+ onActiveTabChange: (tab: QueryPanelTab) => void;
140
+ onAddMetric: () => void;
141
+ onRemoveMetric: (id: string) => void;
142
+ onAddBreakdown: () => void;
143
+ onRemoveBreakdown: (id: string) => void;
144
+ onBreakdownGranularityChange: (id: string, granularity: string) => void;
145
+ onFiltersChange: (filters: Filter[]) => void;
146
+ /** Current sort order */
147
+ order?: Record<string, 'asc' | 'desc'>;
148
+ /** Callback when sort order changes */
149
+ onOrderChange: (fieldName: string, direction: 'asc' | 'desc' | null) => void;
150
+ chartType: ChartType;
151
+ chartConfig: ChartAxisConfig;
152
+ displayConfig: ChartDisplayConfig;
153
+ /** Map of chart type availability for disabling unavailable chart types */
154
+ chartAvailability?: ChartAvailabilityMap;
155
+ onChartTypeChange: (type: ChartType) => void;
156
+ onChartConfigChange: (config: ChartAxisConfig) => void;
157
+ onDisplayConfigChange: (config: ChartDisplayConfig) => void;
158
+ validationStatus: ValidationStatus;
159
+ validationError: string | null;
160
+ }
161
+ /**
162
+ * Props for the AnalysisResultsPanel component
163
+ */
164
+ export interface AnalysisResultsPanelProps {
165
+ /** Current execution status */
166
+ executionStatus: ExecutionStatus;
167
+ /** Execution results (raw data) */
168
+ executionResults: any[] | null;
169
+ /** Execution error message */
170
+ executionError: string | null;
171
+ /** Total row count (before limit) */
172
+ totalRowCount: number | null;
173
+ /** Whether results are stale (query changed) */
174
+ resultsStale: boolean;
175
+ /** Chart type for visualization */
176
+ chartType: ChartType;
177
+ /** Chart axis configuration */
178
+ chartConfig: ChartAxisConfig;
179
+ /** Chart display configuration */
180
+ displayConfig: ChartDisplayConfig;
181
+ /** Current query object (for annotation/metadata) */
182
+ query: CubeQuery;
183
+ /** Schema metadata */
184
+ schema: MetaResponse | null;
185
+ /** Active view (table or chart) */
186
+ activeView: 'table' | 'chart';
187
+ /** Callback when active view changes */
188
+ onActiveViewChange: (view: 'table' | 'chart') => void;
189
+ /** Display limit for table */
190
+ displayLimit: number;
191
+ /** Callback when display limit changes */
192
+ onDisplayLimitChange: (limit: number) => void;
193
+ /** Whether the query has metrics (measures) - needed to enable/disable chart view */
194
+ hasMetrics: boolean;
195
+ debugQuery?: CubeQuery | null;
196
+ debugSql?: {
197
+ sql: string;
198
+ params: any[];
199
+ } | null;
200
+ debugAnalysis?: QueryAnalysis | null;
201
+ debugLoading?: boolean;
202
+ debugError?: string | null;
203
+ }
204
+ /**
205
+ * Props for the MetricsSection component
206
+ */
207
+ export interface MetricsSectionProps {
208
+ /** Selected metrics */
209
+ metrics: MetricItem[];
210
+ /** Schema for resolving field titles */
211
+ schema: MetaResponse | null;
212
+ /** Add metric handler */
213
+ onAdd: () => void;
214
+ /** Remove metric handler */
215
+ onRemove: (id: string) => void;
216
+ /** Whether the section is expanded */
217
+ isExpanded?: boolean;
218
+ /** Toggle expansion */
219
+ onToggleExpanded?: () => void;
220
+ /** Current sort order */
221
+ order?: Record<string, 'asc' | 'desc'>;
222
+ /** Callback when sort order changes */
223
+ onOrderChange?: (fieldName: string, direction: 'asc' | 'desc' | null) => void;
224
+ }
225
+ /**
226
+ * Props for the BreakdownSection component
227
+ */
228
+ export interface BreakdownSectionProps {
229
+ /** Selected breakdowns */
230
+ breakdowns: BreakdownItem[];
231
+ /** Schema for resolving field titles */
232
+ schema: MetaResponse | null;
233
+ /** Add breakdown handler */
234
+ onAdd: () => void;
235
+ /** Remove breakdown handler */
236
+ onRemove: (id: string) => void;
237
+ /** Change granularity for time dimension */
238
+ onGranularityChange: (id: string, granularity: string) => void;
239
+ /** Whether the section is expanded */
240
+ isExpanded?: boolean;
241
+ /** Toggle expansion */
242
+ onToggleExpanded?: () => void;
243
+ /** Current sort order */
244
+ order?: Record<string, 'asc' | 'desc'>;
245
+ /** Callback when sort order changes */
246
+ onOrderChange?: (fieldName: string, direction: 'asc' | 'desc' | null) => void;
247
+ }
248
+ /**
249
+ * Props for MetricItemCard component
250
+ */
251
+ export interface MetricItemCardProps {
252
+ /** Metric item data */
253
+ metric: MetricItem;
254
+ /** Field metadata (for title, description) */
255
+ fieldMeta: MetaField | null;
256
+ /** Remove handler */
257
+ onRemove: () => void;
258
+ /** Current sort direction for this field */
259
+ sortDirection?: 'asc' | 'desc' | null;
260
+ /** Sort priority (1, 2, 3...) if sorted */
261
+ sortPriority?: number;
262
+ /** Toggle sort handler */
263
+ onToggleSort?: () => void;
264
+ }
265
+ /**
266
+ * Props for BreakdownItemCard component
267
+ */
268
+ export interface BreakdownItemCardProps {
269
+ /** Breakdown item data */
270
+ breakdown: BreakdownItem;
271
+ /** Field metadata (for title, description) */
272
+ fieldMeta: MetaField | null;
273
+ /** Remove handler */
274
+ onRemove: () => void;
275
+ /** Granularity change handler (for time dimensions) */
276
+ onGranularityChange?: (granularity: string) => void;
277
+ /** Current sort direction for this field */
278
+ sortDirection?: 'asc' | 'desc' | null;
279
+ /** Sort priority (1, 2, 3...) if sorted */
280
+ sortPriority?: number;
281
+ /** Toggle sort handler */
282
+ onToggleSort?: () => void;
283
+ }
284
+ /**
285
+ * Props for the main AnalysisBuilder component
286
+ */
287
+ export interface AnalysisBuilderProps {
288
+ /** Additional CSS classes */
289
+ className?: string;
290
+ /** Maximum height for the component (e.g., '800px', '100vh', 'calc(100vh - 64px)') */
291
+ maxHeight?: string;
292
+ /** Initial query to load */
293
+ initialQuery?: CubeQuery;
294
+ /** Disable localStorage persistence */
295
+ disableLocalStorage?: boolean;
296
+ /** Hide settings button */
297
+ hideSettings?: boolean;
298
+ /** Callback when query changes (for modal integration) */
299
+ onQueryChange?: (query: CubeQuery) => void;
300
+ /** Callback when chart config changes */
301
+ onChartConfigChange?: (config: {
302
+ chartType: ChartType;
303
+ chartConfig: ChartAxisConfig;
304
+ displayConfig: ChartDisplayConfig;
305
+ }) => void;
306
+ }
307
+ /**
308
+ * Ref interface for AnalysisBuilder (for external access)
309
+ */
310
+ export interface AnalysisBuilderRef {
311
+ /** Get the current query object */
312
+ getCurrentQuery: () => CubeQuery;
313
+ /** Get current chart configuration */
314
+ getChartConfig: () => {
315
+ chartType: ChartType;
316
+ chartConfig: ChartAxisConfig;
317
+ displayConfig: ChartDisplayConfig;
318
+ };
319
+ /** Execute the current query */
320
+ executeQuery: () => void;
321
+ /** Clear the current query */
322
+ clearQuery: () => void;
323
+ }
324
+ /**
325
+ * Local storage state shape for persistence
326
+ */
327
+ export interface AnalysisBuilderStorageState {
328
+ metrics: MetricItem[];
329
+ breakdowns: BreakdownItem[];
330
+ filters: Filter[];
331
+ order?: Record<string, 'asc' | 'desc'>;
332
+ chartType: ChartType;
333
+ chartConfig: ChartAxisConfig;
334
+ displayConfig: ChartDisplayConfig;
335
+ activeView: 'table' | 'chart';
336
+ }
337
+ /**
338
+ * Recent fields storage shape
339
+ */
340
+ export interface RecentFieldsStorage {
341
+ metrics: string[];
342
+ breakdowns: string[];
343
+ }
344
+ /**
345
+ * Time granularity options
346
+ */
347
+ export declare const TIME_GRANULARITIES: readonly [{
348
+ readonly value: "hour";
349
+ readonly label: "Hour";
350
+ }, {
351
+ readonly value: "day";
352
+ readonly label: "Day";
353
+ }, {
354
+ readonly value: "week";
355
+ readonly label: "Week";
356
+ }, {
357
+ readonly value: "month";
358
+ readonly label: "Month";
359
+ }, {
360
+ readonly value: "quarter";
361
+ readonly label: "Quarter";
362
+ }, {
363
+ readonly value: "year";
364
+ readonly label: "Year";
365
+ }];
366
+ export type TimeGranularity = typeof TIME_GRANULARITIES[number]['value'];
@@ -0,0 +1,103 @@
1
+ import { MetricItem, BreakdownItem, FieldOption, FieldType, RecentFieldsStorage } from './types';
2
+ import { MetaResponse, MetaField } from '../../shared/types';
3
+ import { CubeQuery, Filter } from '../../types';
4
+ /**
5
+ * Generate a unique ID for items
6
+ */
7
+ export declare function generateId(): string;
8
+ /**
9
+ * Generate letter label for metrics (A, B, C, ..., AA, AB, ...)
10
+ */
11
+ export declare function generateMetricLabel(index: number): string;
12
+ /**
13
+ * Convert metrics and breakdowns to CubeQuery format
14
+ */
15
+ export declare function buildCubeQuery(metrics: MetricItem[], breakdowns: BreakdownItem[], filters: Filter[]): CubeQuery;
16
+ /**
17
+ * Check if a query has any content
18
+ */
19
+ export declare function hasQueryContent(metrics: MetricItem[], breakdowns: BreakdownItem[], filters: Filter[]): boolean;
20
+ /**
21
+ * Get cube name from a field name (e.g., "Employees.count" -> "Employees")
22
+ */
23
+ export declare function getCubeNameFromField(fieldName: string): string;
24
+ /**
25
+ * Get field short name from full name (e.g., "Employees.count" -> "count")
26
+ */
27
+ export declare function getFieldShortName(fieldName: string): string;
28
+ /**
29
+ * Find field metadata from schema
30
+ */
31
+ export declare function findFieldInSchema(fieldName: string, schema: MetaResponse | null): {
32
+ field: MetaField;
33
+ cubeName: string;
34
+ fieldType: FieldType;
35
+ } | null;
36
+ /**
37
+ * Get display title for a field
38
+ */
39
+ export declare function getFieldTitle(fieldName: string, schema: MetaResponse | null): string;
40
+ /**
41
+ * Determine field type from metadata
42
+ */
43
+ export declare function getFieldType(field: MetaField): FieldType;
44
+ /**
45
+ * Convert schema to flat list of field options
46
+ */
47
+ export declare function schemaToFieldOptions(schema: MetaResponse | null, mode: 'metrics' | 'breakdown' | 'filter'): FieldOption[];
48
+ /**
49
+ * Filter field options by search term
50
+ */
51
+ export declare function filterFieldOptions(options: FieldOption[], searchTerm: string, selectedCube?: string | null): FieldOption[];
52
+ /**
53
+ * Group field options by cube
54
+ */
55
+ export declare function groupFieldsByCube(options: FieldOption[]): Map<string, FieldOption[]>;
56
+ /**
57
+ * Get recent fields from localStorage
58
+ */
59
+ export declare function getRecentFields(): RecentFieldsStorage;
60
+ /**
61
+ * Add a field to recent fields
62
+ */
63
+ export declare function addRecentField(fieldName: string, mode: 'metrics' | 'breakdowns'): void;
64
+ /**
65
+ * Get recent field options from schema
66
+ */
67
+ export declare function getRecentFieldOptions(schema: MetaResponse | null, mode: 'metrics' | 'breakdown' | 'filter', recentFieldNames: string[]): FieldOption[];
68
+ /**
69
+ * Get list of cube names from schema
70
+ */
71
+ export declare function getCubeNames(schema: MetaResponse | null): string[];
72
+ /**
73
+ * Get cube title by name
74
+ */
75
+ export declare function getCubeTitle(cubeName: string, schema: MetaResponse | null): string;
76
+ /**
77
+ * Save state to localStorage
78
+ */
79
+ export declare function saveStateToStorage(state: {
80
+ metrics: MetricItem[];
81
+ breakdowns: BreakdownItem[];
82
+ filters: Filter[];
83
+ chartType: string;
84
+ chartConfig: object;
85
+ displayConfig: object;
86
+ activeView: string;
87
+ }): void;
88
+ /**
89
+ * Load state from localStorage
90
+ */
91
+ export declare function loadStateFromStorage(): {
92
+ metrics: MetricItem[];
93
+ breakdowns: BreakdownItem[];
94
+ filters: Filter[];
95
+ chartType: string;
96
+ chartConfig: object;
97
+ displayConfig: object;
98
+ activeView: string;
99
+ } | null;
100
+ /**
101
+ * Clear state from localStorage
102
+ */
103
+ export declare function clearStateFromStorage(): void;
@@ -1,8 +1,13 @@
1
1
  import { ChartType } from '../types';
2
+ import { ChartAvailabilityMap } from '../shared/chartDefaults';
2
3
  interface ChartTypeSelectorProps {
3
4
  selectedType: ChartType;
4
5
  onTypeChange: (type: ChartType) => void;
5
6
  className?: string;
7
+ /** Compact mode for narrow containers - uses 2 columns and constrains width */
8
+ compact?: boolean;
9
+ /** Map of chart type availability - when provided, unavailable charts are disabled */
10
+ availability?: ChartAvailabilityMap;
6
11
  }
7
- export default function ChartTypeSelector({ selectedType, onTypeChange, className }: ChartTypeSelectorProps): import("react/jsx-runtime").JSX.Element;
12
+ export default function ChartTypeSelector({ selectedType, onTypeChange, className, compact, availability }: ChartTypeSelectorProps): import("react/jsx-runtime").JSX.Element;
8
13
  export {};
@@ -1,4 +1,4 @@
1
1
  import { default as React } from 'react';
2
2
  import { CubeMetaExplorerProps } from './types';
3
- declare const CubeMetaExplorer: React.FC<CubeMetaExplorerProps>;
4
- export default CubeMetaExplorer;
3
+ declare const _default: React.NamedExoticComponent<CubeMetaExplorerProps>;
4
+ export default _default;
@@ -1,4 +1,4 @@
1
1
  import { default as React } from 'react';
2
2
  import { QueryPanelProps } from './types';
3
- declare const QueryPanel: React.FC<QueryPanelProps>;
4
- export default QueryPanel;
3
+ declare const _default: React.NamedExoticComponent<QueryPanelProps>;
4
+ export default _default;
@@ -1,30 +1,12 @@
1
1
  import { CubeQuery, FilterOperator, Filter, SimpleFilter, GroupFilter, ChartType, ChartAxisConfig, ChartDisplayConfig } from '../../types';
2
- export interface MetaField {
3
- name: string;
4
- title: string;
5
- shortTitle: string;
6
- type: string;
7
- description?: string;
8
- }
9
- export interface MetaCube {
10
- name: string;
11
- title: string;
12
- description: string;
13
- measures: MetaField[];
14
- dimensions: MetaField[];
15
- segments: MetaField[];
16
- }
17
- export interface MetaResponse {
18
- cubes: MetaCube[];
19
- }
2
+ import { MetaResponse, QueryAnalysis, ValidationResult, DateRangeType } from '../../shared/types';
3
+ export type { MetaField, MetaCube, MetaResponse, QueryAnalysis, PrimaryCubeSelectionReason, PrimaryCubeCandidate, PrimaryCubeAnalysis, JoinPathStep, JoinPathAnalysis, PreAggregationAnalysis, QuerySummary, ValidationResult, FilterOperatorMeta, DateRangeType, DateRangeOption, TimeGranularity } from '../../shared/types';
4
+ export { FILTER_OPERATORS, DATE_RANGE_OPTIONS, TIME_GRANULARITIES } from '../../shared/types';
20
5
  export type ValidationStatus = 'idle' | 'validating' | 'valid' | 'invalid';
21
- export type ExecutionStatus = 'idle' | 'loading' | 'success' | 'error';
6
+ export type ExecutionStatus = 'idle' | 'loading' | 'refreshing' | 'success' | 'error';
22
7
  export type SchemaStatus = 'idle' | 'loading' | 'success' | 'error';
23
8
  export interface QueryBuilderState {
24
9
  query: CubeQuery;
25
- schema: MetaResponse | null;
26
- schemaStatus: SchemaStatus;
27
- schemaError: string | null;
28
10
  validationStatus: ValidationStatus;
29
11
  validationError: string | null;
30
12
  validationSql: {
@@ -36,86 +18,7 @@ export interface QueryBuilderState {
36
18
  executionError: string | null;
37
19
  totalRowCount: number | null;
38
20
  totalRowCountStatus: 'idle' | 'loading' | 'success' | 'error';
39
- }
40
- export type PrimaryCubeSelectionReason = 'most_dimensions' | 'most_connected' | 'alphabetical_fallback' | 'single_cube';
41
- export interface PrimaryCubeCandidate {
42
- cubeName: string;
43
- dimensionCount: number;
44
- joinCount: number;
45
- canReachAll: boolean;
46
- }
47
- export interface PrimaryCubeAnalysis {
48
- selectedCube: string;
49
- reason: PrimaryCubeSelectionReason;
50
- explanation: string;
51
- candidates?: PrimaryCubeCandidate[];
52
- }
53
- export interface JoinPathStep {
54
- fromCube: string;
55
- toCube: string;
56
- relationship: 'belongsTo' | 'hasOne' | 'hasMany' | 'belongsToMany';
57
- joinType: 'inner' | 'left' | 'right' | 'full';
58
- joinColumns: Array<{
59
- sourceColumn: string;
60
- targetColumn: string;
61
- }>;
62
- junctionTable?: {
63
- tableName: string;
64
- sourceColumns: string[];
65
- targetColumns: string[];
66
- };
67
- }
68
- export interface JoinPathAnalysis {
69
- targetCube: string;
70
- pathFound: boolean;
71
- path?: JoinPathStep[];
72
- pathLength?: number;
73
- error?: string;
74
- visitedCubes?: string[];
75
- }
76
- export interface PreAggregationAnalysis {
77
- cubeName: string;
78
- cteAlias: string;
79
- reason: string;
80
- measures: string[];
81
- joinKeys: Array<{
82
- sourceColumn: string;
83
- targetColumn: string;
84
- }>;
85
- }
86
- export interface QuerySummary {
87
- queryType: 'single_cube' | 'multi_cube_join' | 'multi_cube_cte';
88
- joinCount: number;
89
- cteCount: number;
90
- hasPreAggregation: boolean;
91
- }
92
- export interface QueryAnalysis {
93
- timestamp: string;
94
- cubeCount: number;
95
- cubesInvolved: string[];
96
- primaryCube: PrimaryCubeAnalysis;
97
- joinPaths: JoinPathAnalysis[];
98
- preAggregations: PreAggregationAnalysis[];
99
- querySummary: QuerySummary;
100
- warnings?: string[];
101
- }
102
- export interface ValidationResult {
103
- valid?: boolean;
104
- error?: string;
105
- query?: CubeQuery;
106
- sql?: {
107
- sql: string[];
108
- params: any[];
109
- };
110
- queryType?: string;
111
- normalizedQueries?: any[];
112
- queryOrder?: string[];
113
- transformedQueries?: any[];
114
- pivotQuery?: any;
115
- complexity?: string;
116
- cubesUsed?: string[];
117
- joinType?: string;
118
- analysis?: QueryAnalysis;
21
+ resultsStale: boolean;
119
22
  }
120
23
  export interface ApiConfig {
121
24
  baseApiUrl: string;
@@ -165,7 +68,6 @@ export interface QueryPanelProps {
165
68
  params: any[];
166
69
  } | null;
167
70
  validationAnalysis?: QueryAnalysis | null;
168
- onValidate: () => void;
169
71
  onExecute: () => void;
170
72
  onRemoveField: (fieldName: string, fieldType: 'measures' | 'dimensions' | 'timeDimensions') => void;
171
73
  onTimeDimensionGranularityChange: (dimensionName: string, granularity: string) => void;
@@ -179,6 +81,7 @@ export interface QueryPanelProps {
179
81
  onAIAssistantClick?: () => void;
180
82
  onSchemaClick?: () => void;
181
83
  onShareClick?: () => void;
84
+ canShare?: boolean;
182
85
  shareButtonState?: ShareButtonState;
183
86
  isViewingShared?: boolean;
184
87
  }
@@ -191,6 +94,7 @@ export interface ResultsPanelProps {
191
94
  executionStatus: ExecutionStatus;
192
95
  executionResults: any[] | null;
193
96
  executionError: string | null;
97
+ resultsStale?: boolean;
194
98
  query: CubeQuery;
195
99
  displayLimit?: number;
196
100
  onDisplayLimitChange?: (limit: number) => void;
@@ -206,35 +110,6 @@ export interface ResultsPanelProps {
206
110
  activeView?: 'table' | 'chart';
207
111
  onActiveViewChange?: (view: 'table' | 'chart') => void;
208
112
  }
209
- export declare const TIME_GRANULARITIES: readonly [{
210
- readonly value: "hour";
211
- readonly label: "Hour";
212
- }, {
213
- readonly value: "day";
214
- readonly label: "Day";
215
- }, {
216
- readonly value: "week";
217
- readonly label: "Week";
218
- }, {
219
- readonly value: "month";
220
- readonly label: "Month";
221
- }, {
222
- readonly value: "quarter";
223
- readonly label: "Quarter";
224
- }, {
225
- readonly value: "year";
226
- readonly label: "Year";
227
- }];
228
- export type TimeGranularity = typeof TIME_GRANULARITIES[number]['value'];
229
- export interface FilterOperatorMeta {
230
- label: string;
231
- description: string;
232
- requiresValues: boolean;
233
- supportsMultipleValues: boolean;
234
- valueType: 'string' | 'number' | 'date' | 'boolean' | 'any';
235
- fieldTypes: string[];
236
- }
237
- export declare const FILTER_OPERATORS: Record<FilterOperator, FilterOperatorMeta>;
238
113
  export interface FilterBuilderProps {
239
114
  filters: Filter[];
240
115
  schema: MetaResponse | null;
@@ -270,12 +145,6 @@ export interface FilterValueSelectorProps {
270
145
  onValuesChange: (values: any[]) => void;
271
146
  schema: MetaResponse | null;
272
147
  }
273
- export type DateRangeType = 'custom' | 'today' | 'yesterday' | 'this_week' | 'this_month' | 'this_quarter' | 'this_year' | 'last_7_days' | 'last_30_days' | 'last_week' | 'last_month' | 'last_quarter' | 'last_year' | 'last_12_months' | 'last_n_days' | 'last_n_weeks' | 'last_n_months' | 'last_n_quarters' | 'last_n_years';
274
- export interface DateRangeOption {
275
- value: DateRangeType;
276
- label: string;
277
- }
278
- export declare const DATE_RANGE_OPTIONS: DateRangeOption[];
279
148
  export interface DateRangeFilter {
280
149
  id: string;
281
150
  timeDimension: string;
@@ -1,2 +1,2 @@
1
1
  import { ChartProps } from '../../types';
2
- export default function DataTable({ data, chartConfig, height }: ChartProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function DataTable({ data, chartConfig, displayConfig, queryObject, height }: ChartProps): import("react/jsx-runtime").JSX.Element;