drizzle-cube 0.2.25 → 0.2.27

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 (95) hide show
  1. package/dist/client/charts.js +2 -2
  2. package/dist/client/chunks/{charts-BsXrHSCm.js → charts-BfXEKIrq.js} +44 -44
  3. package/dist/client/chunks/{charts-BsXrHSCm.js.map → charts-BfXEKIrq.js.map} +1 -1
  4. package/dist/client/chunks/charts-DQuOI5HA.js +9465 -0
  5. package/dist/client/chunks/charts-DQuOI5HA.js.map +1 -0
  6. package/dist/client/chunks/components-CWMeA5e-.js +14872 -0
  7. package/dist/client/chunks/components-CWMeA5e-.js.map +1 -0
  8. package/dist/client/chunks/core-DrhYtHHa.js +6 -0
  9. package/dist/client/chunks/core-DrhYtHHa.js.map +1 -0
  10. package/dist/client/chunks/hooks-CAKGR-w0.js +828 -0
  11. package/dist/client/chunks/hooks-CAKGR-w0.js.map +1 -0
  12. package/dist/client/components/AIAssistant/index.d.ts +5 -2
  13. package/dist/client/components/AnalysisBuilder/index.d.ts +6 -0
  14. package/dist/client/components/AnalysisBuilder/types.d.ts +9 -7
  15. package/dist/client/components/AnalysisBuilder/utils/fieldUtils.d.ts +46 -0
  16. package/dist/client/components/AnalysisBuilder/utils/filterUtils.d.ts +19 -0
  17. package/dist/client/components/AnalysisBuilder/utils/idUtils.d.ts +11 -0
  18. package/dist/client/components/AnalysisBuilder/utils/index.d.ts +11 -0
  19. package/dist/client/components/AnalysisBuilder/utils/queryUtils.d.ts +11 -0
  20. package/dist/client/components/AnalysisBuilder/utils/recentFieldsUtils.d.ts +14 -0
  21. package/dist/client/components/AnalysisBuilder/utils/storageUtils.d.ts +42 -0
  22. package/dist/client/components/ConfirmModal.d.ts +30 -0
  23. package/dist/client/components/DashboardFilters/CompactFilterBar.d.ts +13 -0
  24. package/dist/client/components/DashboardFilters/CustomDateDropdown.d.ts +10 -0
  25. package/dist/client/components/DashboardFilters/DashboardFilterConfigModal.d.ts +20 -0
  26. package/dist/client/components/DashboardFilters/DashboardFilterItem.d.ts +14 -0
  27. package/dist/client/components/DashboardFilters/DatePresetChips.d.ts +8 -0
  28. package/dist/client/components/DashboardFilters/FilterChip.d.ts +12 -0
  29. package/dist/client/components/DashboardFilters/FilterValuePopover.d.ts +11 -0
  30. package/dist/client/components/DashboardFilters/XTDDropdown.d.ts +10 -0
  31. package/dist/client/components/DashboardPortletCard.d.ts +13 -34
  32. package/dist/client/components/PortletAnalysisModal.d.ts +4 -2
  33. package/dist/client/components/QueryBuilder/types.d.ts +0 -17
  34. package/dist/client/components/shared/utils.d.ts +33 -109
  35. package/dist/client/components.d.ts +0 -1
  36. package/dist/client/components.js +12 -13
  37. package/dist/client/hooks/queries/index.d.ts +15 -0
  38. package/dist/client/hooks/queries/useCubeLoadQuery.d.ts +67 -0
  39. package/dist/client/hooks/queries/useCubeMetaQuery.d.ts +51 -0
  40. package/dist/client/hooks/queries/useDryRunQuery.d.ts +103 -0
  41. package/dist/client/hooks/queries/useMultiCubeLoadQuery.d.ts +68 -0
  42. package/dist/client/hooks/useAnalysisAI.d.ts +44 -0
  43. package/dist/client/hooks/useAnalysisBuilderHook.d.ts +113 -0
  44. package/dist/client/hooks/useAnalysisChartDefaults.d.ts +35 -0
  45. package/dist/client/hooks/useAnalysisCombinedFields.d.ts +18 -0
  46. package/dist/client/hooks/useAnalysisInitialization.d.ts +25 -0
  47. package/dist/client/hooks/useAnalysisQueryBuilder.d.ts +32 -0
  48. package/dist/client/hooks/useAnalysisQueryExecution.d.ts +38 -0
  49. package/dist/client/hooks/useAnalysisShare.d.ts +23 -0
  50. package/dist/client/hooks/useAnalysisUIState.d.ts +24 -0
  51. package/dist/client/hooks/useDashboardHook.d.ts +108 -0
  52. package/dist/client/hooks/useDebounceQuery.d.ts +48 -0
  53. package/dist/client/hooks/useDirtyStateTracking.d.ts +37 -0
  54. package/dist/client/hooks/useFilterValues.d.ts +4 -1
  55. package/dist/client/hooks.d.ts +4 -2
  56. package/dist/client/hooks.js +12 -170
  57. package/dist/client/hooks.js.map +1 -1
  58. package/dist/client/icons.js +1 -1
  59. package/dist/client/index.d.ts +11 -4
  60. package/dist/client/index.js +99 -70
  61. package/dist/client/providers/CubeMetaProvider.d.ts +1 -1
  62. package/dist/client/providers/CubeProvider.d.ts +7 -3
  63. package/dist/client/providers.js +1 -1
  64. package/dist/client/shared/queryKey.d.ts +1 -0
  65. package/dist/client/shared/utils.d.ts +5 -0
  66. package/dist/client/stores/analysisBuilderStore.d.ts +271 -0
  67. package/dist/client/stores/dashboardStore.d.ts +267 -0
  68. package/dist/client/stores/index.d.ts +13 -0
  69. package/dist/client/styles.css +1 -1
  70. package/dist/client/types.d.ts +27 -1
  71. package/dist/client/utils/chartUtils.d.ts +1 -2
  72. package/dist/client/utils/filterUtils.d.ts +15 -10
  73. package/dist/client/utils/pivotUtils.d.ts +1 -2
  74. package/dist/client-bundle-stats.html +1 -1
  75. package/package.json +13 -19
  76. package/dist/client/chunks/charts-BvLb1eub.js +0 -7427
  77. package/dist/client/chunks/charts-BvLb1eub.js.map +0 -1
  78. package/dist/client/chunks/components-DhA8GIUY.js +0 -14851
  79. package/dist/client/chunks/components-DhA8GIUY.js.map +0 -1
  80. package/dist/client/chunks/core-DcwgBEzv.js +0 -6
  81. package/dist/client/chunks/core-DcwgBEzv.js.map +0 -1
  82. package/dist/client/chunks/index-9x0R-Fme.js +0 -551
  83. package/dist/client/chunks/index-9x0R-Fme.js.map +0 -1
  84. package/dist/client/components/AIAssistant/AIAssistantModal.d.ts +0 -10
  85. package/dist/client/components/AnalysisBuilder/utils.d.ts +0 -103
  86. package/dist/client/components/CubeRelationshipDiagram/CubeNode.d.ts +0 -13
  87. package/dist/client/components/CubeRelationshipDiagram/ERDControls.d.ts +0 -7
  88. package/dist/client/components/CubeRelationshipDiagram/RelationshipEdge.d.ts +0 -11
  89. package/dist/client/components/CubeRelationshipDiagram/index.d.ts +0 -10
  90. package/dist/client/components/CubeRelationshipDiagram/useERDLayout.d.ts +0 -21
  91. package/dist/client/components/PortletEditModal.d.ts +0 -12
  92. package/dist/client/components/shared/CubeMetaExplorer.d.ts +0 -4
  93. package/dist/client/hooks/useCubeMeta.d.ts +0 -39
  94. package/dist/client/hooks/useCubeQuery.d.ts +0 -9
  95. package/dist/client/hooks/useMultiCubeQuery.d.ts +0 -36
@@ -0,0 +1,44 @@
1
+ import { AnalysisBuilderState, AIState } from '../components/AnalysisBuilder/types';
2
+ import { ChartType, ChartAxisConfig, ChartDisplayConfig } from '../types';
3
+ interface UseAnalysisAIOptions {
4
+ /** Current state for snapshotting */
5
+ state: AnalysisBuilderState;
6
+ /** Set state function for applying AI-generated queries */
7
+ setState: (updater: (prev: AnalysisBuilderState) => AnalysisBuilderState) => void;
8
+ /** Current chart type */
9
+ chartType: ChartType;
10
+ /** Set chart type */
11
+ setChartType: (type: ChartType) => void;
12
+ /** Current chart config */
13
+ chartConfig: ChartAxisConfig;
14
+ /** Set chart config */
15
+ setChartConfig: (config: ChartAxisConfig) => void;
16
+ /** Current display config */
17
+ displayConfig: ChartDisplayConfig;
18
+ /** Set display config */
19
+ setDisplayConfig: (config: ChartDisplayConfig) => void;
20
+ /** Set whether user manually selected chart */
21
+ setUserManuallySelectedChart: (value: boolean) => void;
22
+ /** Set active view */
23
+ setActiveView: (view: 'table' | 'chart') => void;
24
+ /** AI endpoint URL */
25
+ aiEndpoint?: string;
26
+ }
27
+ interface UseAnalysisAIResult {
28
+ /** Current AI state */
29
+ aiState: AIState;
30
+ /** Open the AI panel */
31
+ handleOpenAI: () => void;
32
+ /** Close the AI panel */
33
+ handleCloseAI: () => void;
34
+ /** Update the AI prompt */
35
+ handleAIPromptChange: (prompt: string) => void;
36
+ /** Generate query from AI */
37
+ handleGenerateAI: () => Promise<void>;
38
+ /** Accept the AI-generated query */
39
+ handleAcceptAI: () => void;
40
+ /** Cancel and restore previous state */
41
+ handleCancelAI: () => void;
42
+ }
43
+ export declare function useAnalysisAI({ state, setState, chartType, setChartType, chartConfig, setChartConfig, displayConfig, setDisplayConfig, setUserManuallySelectedChart, setActiveView, aiEndpoint }: UseAnalysisAIOptions): UseAnalysisAIResult;
44
+ export {};
@@ -0,0 +1,113 @@
1
+ import { ColorPalette } from '../utils/colorPalettes';
2
+ import { CubeQuery, MultiQueryConfig, ChartType, ChartAxisConfig, ChartDisplayConfig, Filter } from '../types';
3
+ import { AnalysisBuilderState, MetricItem, BreakdownItem, ExecutionStatus, QueryPanelTab } from '../components/AnalysisBuilder/types';
4
+ import { ChartAvailabilityMap } from '../shared/chartDefaults';
5
+ import { DebugDataEntry } from './queries';
6
+ import { MultiQueryValidationResult } from '../utils/multiQueryValidation';
7
+ import { MetaField } from '../shared/types';
8
+ export interface UseAnalysisBuilderOptions {
9
+ /** External color palette (overrides local) */
10
+ externalColorPalette?: string[] | ColorPalette;
11
+ /** Initial data (skip first fetch) */
12
+ initialData?: unknown[];
13
+ /** Callback when query changes */
14
+ onQueryChange?: (query: CubeQuery) => void;
15
+ /** Callback when chart config changes */
16
+ onChartConfigChange?: (config: {
17
+ chartType: ChartType;
18
+ chartConfig: ChartAxisConfig;
19
+ displayConfig: ChartDisplayConfig;
20
+ }) => void;
21
+ }
22
+ export interface UseAnalysisBuilderResult {
23
+ queryState: AnalysisBuilderState;
24
+ queryStates: AnalysisBuilderState[];
25
+ activeQueryIndex: number;
26
+ mergeStrategy: 'concat' | 'merge';
27
+ isMultiQueryMode: boolean;
28
+ mergeKeys: string[] | undefined;
29
+ currentQuery: CubeQuery;
30
+ allQueries: CubeQuery[];
31
+ multiQueryConfig: MultiQueryConfig | null;
32
+ multiQueryValidation: MultiQueryValidationResult | null;
33
+ executionStatus: ExecutionStatus;
34
+ executionResults: unknown[] | null;
35
+ perQueryResults: (unknown[] | null)[] | null;
36
+ isLoading: boolean;
37
+ isFetching: boolean;
38
+ error: Error | null;
39
+ isValidQuery: boolean;
40
+ debugDataPerQuery: DebugDataEntry[];
41
+ chartType: ChartType;
42
+ chartConfig: ChartAxisConfig;
43
+ displayConfig: ChartDisplayConfig;
44
+ colorPalette: ColorPalette;
45
+ localPaletteName: string;
46
+ chartAvailability: ChartAvailabilityMap;
47
+ combinedMetrics: MetricItem[];
48
+ combinedBreakdowns: BreakdownItem[];
49
+ effectiveBreakdowns: BreakdownItem[];
50
+ activeTab: QueryPanelTab;
51
+ activeView: 'table' | 'chart';
52
+ displayLimit: number;
53
+ showFieldModal: boolean;
54
+ fieldModalMode: 'metrics' | 'breakdown';
55
+ activeTableIndex: number;
56
+ userManuallySelectedChart: boolean;
57
+ aiState: {
58
+ isOpen: boolean;
59
+ userPrompt: string;
60
+ isGenerating: boolean;
61
+ error: string | null;
62
+ hasGeneratedQuery: boolean;
63
+ };
64
+ shareButtonState: 'idle' | 'copied' | 'copied-no-chart';
65
+ canShare: boolean;
66
+ actions: {
67
+ setActiveQueryIndex: (index: number) => void;
68
+ setMergeStrategy: (strategy: 'concat' | 'merge') => void;
69
+ openMetricsModal: () => void;
70
+ addMetric: (field: string, label?: string) => void;
71
+ removeMetric: (id: string) => void;
72
+ toggleMetric: (fieldName: string) => void;
73
+ reorderMetrics: (fromIndex: number, toIndex: number) => void;
74
+ openBreakdownsModal: () => void;
75
+ addBreakdown: (field: string, isTimeDimension: boolean, granularity?: string) => void;
76
+ removeBreakdown: (id: string) => void;
77
+ toggleBreakdown: (fieldName: string, isTimeDimension: boolean, granularity?: string) => void;
78
+ setBreakdownGranularity: (id: string, granularity: string) => void;
79
+ toggleBreakdownComparison: (id: string) => void;
80
+ reorderBreakdowns: (fromIndex: number, toIndex: number) => void;
81
+ setFilters: (filters: Filter[]) => void;
82
+ dropFieldToFilter: (field: string) => void;
83
+ setOrder: (fieldName: string, direction: 'asc' | 'desc' | null) => void;
84
+ addQuery: () => void;
85
+ removeQuery: (index: number) => void;
86
+ setChartType: (type: ChartType) => void;
87
+ setChartConfig: (config: ChartAxisConfig) => void;
88
+ setDisplayConfig: (config: ChartDisplayConfig) => void;
89
+ setLocalPaletteName: (name: string) => void;
90
+ setActiveTab: (tab: QueryPanelTab) => void;
91
+ setActiveView: (view: 'table' | 'chart') => void;
92
+ setDisplayLimit: (limit: number) => void;
93
+ closeFieldModal: () => void;
94
+ setActiveTableIndex: (index: number) => void;
95
+ openAI: () => void;
96
+ closeAI: () => void;
97
+ setAIPrompt: (prompt: string) => void;
98
+ generateAI: () => Promise<void>;
99
+ acceptAI: () => void;
100
+ cancelAI: () => void;
101
+ share: () => Promise<void>;
102
+ clearQuery: () => void;
103
+ refetch: () => void;
104
+ handleFieldSelected: (field: MetaField, fieldType: 'measure' | 'dimension' | 'timeDimension', cubeName: string, keepOpen?: boolean) => void;
105
+ };
106
+ getQueryConfig: () => CubeQuery | MultiQueryConfig;
107
+ getChartConfig: () => {
108
+ chartType: ChartType;
109
+ chartConfig: ChartAxisConfig;
110
+ displayConfig: ChartDisplayConfig;
111
+ };
112
+ }
113
+ export declare function useAnalysisBuilder(options?: UseAnalysisBuilderOptions): UseAnalysisBuilderResult;
@@ -0,0 +1,35 @@
1
+ import { ColorPalette } from '../utils/colorPalettes';
2
+ import { ChartType, ChartAxisConfig, ChartDisplayConfig } from '../types';
3
+ import { MetricItem, BreakdownItem } from '../components/AnalysisBuilder/types';
4
+ import { ChartAvailabilityMap } from '../shared/chartDefaults';
5
+ export interface UseAnalysisChartDefaultsOptions {
6
+ /** External color palette (overrides local) */
7
+ externalColorPalette?: string[] | ColorPalette;
8
+ /** Combined metrics from all queries */
9
+ combinedMetrics: MetricItem[];
10
+ /** Combined breakdowns from all queries */
11
+ combinedBreakdowns: BreakdownItem[];
12
+ /** Whether query has been debounced (triggers smart defaults) */
13
+ hasDebounced: boolean;
14
+ }
15
+ export interface UseAnalysisChartDefaultsResult {
16
+ /** Current chart type */
17
+ chartType: ChartType;
18
+ /** Chart axis configuration */
19
+ chartConfig: ChartAxisConfig;
20
+ /** Chart display configuration */
21
+ displayConfig: ChartDisplayConfig;
22
+ /** Effective color palette */
23
+ colorPalette: ColorPalette;
24
+ /** Local palette name (when not using external) */
25
+ localPaletteName: string;
26
+ /** Chart availability map */
27
+ chartAvailability: ChartAvailabilityMap;
28
+ /** User manually selected chart */
29
+ userManuallySelectedChart: boolean;
30
+ setChartType: (type: ChartType) => void;
31
+ setChartConfig: (config: ChartAxisConfig) => void;
32
+ setDisplayConfig: (config: ChartDisplayConfig) => void;
33
+ setLocalPaletteName: (name: string) => void;
34
+ }
35
+ export declare function useAnalysisChartDefaults(options: UseAnalysisChartDefaultsOptions): UseAnalysisChartDefaultsResult;
@@ -0,0 +1,18 @@
1
+ import { AnalysisBuilderState, MetricItem, BreakdownItem } from '../components/AnalysisBuilder/types';
2
+ import { QueryMergeStrategy } from '../types';
3
+ export interface UseAnalysisCombinedFieldsOptions {
4
+ queryState: AnalysisBuilderState;
5
+ queryStates: AnalysisBuilderState[];
6
+ isMultiQueryMode: boolean;
7
+ mergeStrategy: QueryMergeStrategy;
8
+ activeQueryIndex: number;
9
+ }
10
+ export interface UseAnalysisCombinedFieldsResult {
11
+ /** Combined metrics from all queries (for chart config) */
12
+ combinedMetrics: MetricItem[];
13
+ /** Combined breakdowns from all queries (for chart config) */
14
+ combinedBreakdowns: BreakdownItem[];
15
+ /** Effective breakdowns for display (Q1's in merge mode, otherwise current query's) */
16
+ effectiveBreakdowns: BreakdownItem[];
17
+ }
18
+ export declare function useAnalysisCombinedFields(options: UseAnalysisCombinedFieldsOptions): UseAnalysisCombinedFieldsResult;
@@ -0,0 +1,25 @@
1
+ import { CubeQuery, ChartType, ChartAxisConfig, ChartDisplayConfig } from '../types';
2
+ export interface UseAnalysisInitializationOptions {
3
+ /** Current query */
4
+ currentQuery: CubeQuery;
5
+ /** Whether query is valid */
6
+ isValidQuery: boolean;
7
+ /** Chart type */
8
+ chartType: ChartType;
9
+ /** Chart config */
10
+ chartConfig: ChartAxisConfig;
11
+ /** Display config */
12
+ displayConfig: ChartDisplayConfig;
13
+ /** Callback when query changes */
14
+ onQueryChange?: (query: CubeQuery) => void;
15
+ /** Callback when chart config changes */
16
+ onChartConfigChange?: (config: {
17
+ chartType: ChartType;
18
+ chartConfig: ChartAxisConfig;
19
+ displayConfig: ChartDisplayConfig;
20
+ }) => void;
21
+ }
22
+ /**
23
+ * Handles initialization effects - no return value (side-effect only hook)
24
+ */
25
+ export declare function useAnalysisInitialization(options: UseAnalysisInitializationOptions): void;
@@ -0,0 +1,32 @@
1
+ import { MultiQueryValidationResult } from '../utils/multiQueryValidation';
2
+ import { CubeQuery, MultiQueryConfig, QueryMergeStrategy } from '../types';
3
+ import { AnalysisBuilderState } from '../components/AnalysisBuilder/types';
4
+ export interface UseAnalysisQueryBuilderResult {
5
+ /** Current query state (active query) */
6
+ queryState: AnalysisBuilderState;
7
+ /** All query states (for multi-query mode) */
8
+ queryStates: AnalysisBuilderState[];
9
+ /** Active query index */
10
+ activeQueryIndex: number;
11
+ /** Merge strategy for multi-query */
12
+ mergeStrategy: QueryMergeStrategy;
13
+ /** Whether in multi-query mode */
14
+ isMultiQueryMode: boolean;
15
+ /** Merge keys (computed from Q1 breakdowns) */
16
+ mergeKeys: string[] | undefined;
17
+ /** Current query as CubeQuery */
18
+ currentQuery: CubeQuery;
19
+ /** All queries as CubeQuery[] */
20
+ allQueries: CubeQuery[];
21
+ /** MultiQueryConfig (if in multi-query mode) */
22
+ multiQueryConfig: MultiQueryConfig | null;
23
+ /** Multi-query validation result */
24
+ multiQueryValidation: MultiQueryValidationResult | null;
25
+ /** Whether current query is valid */
26
+ isValidQuery: boolean | undefined;
27
+ setActiveQueryIndex: (index: number) => void;
28
+ setMergeStrategy: (strategy: QueryMergeStrategy) => void;
29
+ addQuery: () => void;
30
+ removeQuery: (index: number) => void;
31
+ }
32
+ export declare function useAnalysisQueryBuilder(): UseAnalysisQueryBuilderResult;
@@ -0,0 +1,38 @@
1
+ import { DebugDataEntry } from './queries';
2
+ import { CubeQuery, MultiQueryConfig } from '../types';
3
+ import { ExecutionStatus } from '../components/AnalysisBuilder/types';
4
+ export interface UseAnalysisQueryExecutionOptions {
5
+ /** Current query (for single-query mode) */
6
+ currentQuery: CubeQuery;
7
+ /** All queries (for dry-run and multi-query) */
8
+ allQueries: CubeQuery[];
9
+ /** Multi-query config (null if single-query mode) */
10
+ multiQueryConfig: MultiQueryConfig | null;
11
+ /** Whether in multi-query mode */
12
+ isMultiQueryMode: boolean;
13
+ /** Whether current query is valid */
14
+ isValidQuery: boolean;
15
+ /** Initial data (skip first fetch) */
16
+ initialData?: unknown[];
17
+ }
18
+ export interface UseAnalysisQueryExecutionResult {
19
+ /** Query execution status */
20
+ executionStatus: ExecutionStatus;
21
+ /** Query results (merged for multi-query) */
22
+ executionResults: unknown[] | null;
23
+ /** Per-query results (for table view in multi-query mode) */
24
+ perQueryResults: (unknown[] | null)[] | null;
25
+ /** Whether query is loading */
26
+ isLoading: boolean;
27
+ /** Whether query is fetching (includes refetch) */
28
+ isFetching: boolean;
29
+ /** Query error */
30
+ error: Error | null;
31
+ /** Debug data per query */
32
+ debugDataPerQuery: DebugDataEntry[];
33
+ /** Whether query has been debounced (for smart defaults trigger) */
34
+ hasDebounced: boolean;
35
+ /** Refetch function */
36
+ refetch: () => void;
37
+ }
38
+ export declare function useAnalysisQueryExecution(options: UseAnalysisQueryExecutionOptions): UseAnalysisQueryExecutionResult;
@@ -0,0 +1,23 @@
1
+ import { CubeQuery, ChartType, ChartAxisConfig, ChartDisplayConfig, MultiQueryConfig } from '../types';
2
+ interface UseAnalysisShareOptions {
3
+ /** Whether the current query is valid */
4
+ isValidQuery: boolean;
5
+ /** Getter for the query config (matches AnalysisBuilder save format) */
6
+ getQueryConfig: () => CubeQuery | MultiQueryConfig;
7
+ /** Current chart type */
8
+ chartType: ChartType;
9
+ /** Current chart config */
10
+ chartConfig: ChartAxisConfig;
11
+ /** Current display config */
12
+ displayConfig: ChartDisplayConfig;
13
+ /** Current active view */
14
+ activeView: 'table' | 'chart';
15
+ }
16
+ interface UseAnalysisShareResult {
17
+ /** Current share button state */
18
+ shareButtonState: 'idle' | 'copied' | 'copied-no-chart';
19
+ /** Handle share button click */
20
+ handleShare: () => Promise<void>;
21
+ }
22
+ export declare function useAnalysisShare({ isValidQuery, getQueryConfig, chartType, chartConfig, displayConfig, activeView }: UseAnalysisShareOptions): UseAnalysisShareResult;
23
+ export {};
@@ -0,0 +1,24 @@
1
+ import { FieldModalMode } from '../stores/analysisBuilderStore';
2
+ import { QueryPanelTab } from '../components/AnalysisBuilder/types';
3
+ export interface UseAnalysisUIStateResult {
4
+ /** Active tab in query panel */
5
+ activeTab: QueryPanelTab;
6
+ /** Active view (table or chart) */
7
+ activeView: 'table' | 'chart';
8
+ /** Display limit for table */
9
+ displayLimit: number;
10
+ /** Whether field modal is open */
11
+ showFieldModal: boolean;
12
+ /** Field modal mode */
13
+ fieldModalMode: FieldModalMode;
14
+ /** Active table index for multi-query */
15
+ activeTableIndex: number;
16
+ /** User manually selected chart */
17
+ userManuallySelectedChart: boolean;
18
+ setActiveTab: (tab: QueryPanelTab) => void;
19
+ setActiveView: (view: 'table' | 'chart') => void;
20
+ setDisplayLimit: (limit: number) => void;
21
+ closeFieldModal: () => void;
22
+ setActiveTableIndex: (index: number) => void;
23
+ }
24
+ export declare function useAnalysisUIState(): UseAnalysisUIStateResult;
@@ -0,0 +1,108 @@
1
+ import { default as React } from 'react';
2
+ import { PortletDebugDataEntry } from '../stores/dashboardStore';
3
+ import { LayoutItem } from 'react-grid-layout';
4
+ import { DashboardConfig, PortletConfig, RowLayout, DashboardFilter, DashboardGridSettings, DashboardLayoutMode } from '../types';
5
+ export interface UseDashboardOptions {
6
+ /** Dashboard configuration */
7
+ config: DashboardConfig;
8
+ /** Whether dashboard is editable */
9
+ editable?: boolean;
10
+ /** Dashboard filters */
11
+ dashboardFilters?: DashboardFilter[];
12
+ /** Grid settings */
13
+ gridSettings: DashboardGridSettings;
14
+ /** Allowed layout modes */
15
+ allowedModes?: DashboardLayoutMode[];
16
+ /** Whether responsive mode allows editing (desktop only) */
17
+ isResponsiveEditable?: boolean;
18
+ /** Config change handler */
19
+ onConfigChange?: (config: DashboardConfig) => void;
20
+ /** Save handler */
21
+ onSave?: (config: DashboardConfig) => Promise<void> | void;
22
+ /** Grid width for row calculations */
23
+ gridWidth?: number;
24
+ /** Portlet component refs for refresh functionality */
25
+ portletComponentRefs?: React.MutableRefObject<Record<string, {
26
+ refresh: () => void;
27
+ } | null>>;
28
+ /** Portlet refresh handler (external) */
29
+ onPortletRefresh?: (portletId: string) => void;
30
+ }
31
+ export interface UseDashboardResult {
32
+ /** Whether dashboard is in edit mode */
33
+ isEditMode: boolean;
34
+ /** Selected filter ID for filter assignment mode */
35
+ selectedFilterId: string | null;
36
+ /** Whether portlet modal is open */
37
+ isPortletModalOpen: boolean;
38
+ /** Portlet being edited */
39
+ editingPortlet: PortletConfig | null;
40
+ /** Whether filter config modal is open */
41
+ isFilterConfigModalOpen: boolean;
42
+ /** Portlet for filter configuration */
43
+ filterConfigPortlet: PortletConfig | null;
44
+ /** Portlet ID pending delete confirmation */
45
+ deleteConfirmPortletId: string | null;
46
+ /** Draft rows during drag operations */
47
+ draftRows: RowLayout[] | null;
48
+ /** Whether a portlet is being dragged */
49
+ isDraggingPortlet: boolean;
50
+ /** Last known layout for change detection */
51
+ lastKnownLayout: LayoutItem[];
52
+ /** Whether component is initialized */
53
+ isInitialized: boolean;
54
+ /** Debug data per portlet */
55
+ debugData: Record<string, PortletDebugDataEntry>;
56
+ /** Whether editing is allowed (editable && isEditMode && desktop && !filterMode) */
57
+ canEdit: boolean;
58
+ /** Whether layout mode can be changed */
59
+ canChangeLayoutMode: boolean;
60
+ /** Currently selected filter object */
61
+ selectedFilter: DashboardFilter | null;
62
+ /** Resolved rows for row-based layout */
63
+ resolvedRows: RowLayout[];
64
+ /** Current layout mode */
65
+ layoutMode: DashboardLayoutMode;
66
+ /** Allowed layout modes */
67
+ allowedModes: DashboardLayoutMode[];
68
+ actions: UseDashboardActions;
69
+ }
70
+ export interface UseDashboardActions {
71
+ enterEditMode: () => void;
72
+ exitEditMode: () => void;
73
+ toggleEditMode: () => void;
74
+ selectFilter: (filterId: string | null) => void;
75
+ exitFilterSelectionMode: () => void;
76
+ openAddPortlet: () => void;
77
+ openEditPortlet: (portlet: PortletConfig) => void;
78
+ closePortletModal: () => void;
79
+ openFilterConfig: (portlet: PortletConfig) => void;
80
+ closeFilterConfig: () => void;
81
+ setDraftRows: (rows: RowLayout[] | null) => void;
82
+ setIsDraggingPortlet: (isDragging: boolean) => void;
83
+ setLastKnownLayout: (layout: LayoutItem[]) => void;
84
+ setIsInitialized: (initialized: boolean) => void;
85
+ setDragState: (state: {
86
+ rowIndex: number;
87
+ colIndex: number;
88
+ portletId: string;
89
+ } | null) => void;
90
+ clearDragState: () => void;
91
+ hasLayoutActuallyChanged: (newLayout: LayoutItem[]) => boolean;
92
+ updateRowLayout: (rows: RowLayout[], save?: boolean, portletsOverride?: PortletConfig[]) => Promise<void>;
93
+ handleLayoutModeChange: (mode: DashboardLayoutMode) => Promise<void>;
94
+ savePortlet: (portletData: PortletConfig | Omit<PortletConfig, 'id' | 'x' | 'y'>) => Promise<string | null>;
95
+ deletePortlet: (portletId: string) => Promise<void>;
96
+ duplicatePortlet: (portletId: string) => Promise<string | undefined>;
97
+ refreshPortlet: (portletId: string) => void;
98
+ toggleFilterForPortlet: (portletId: string, filterId: string) => Promise<void>;
99
+ selectAllForFilter: (filterId: string) => Promise<void>;
100
+ saveFilterConfig: (mapping: string[]) => Promise<void>;
101
+ handlePaletteChange: (paletteName: string) => Promise<void>;
102
+ openDeleteConfirm: (portletId: string) => void;
103
+ closeDeleteConfirm: () => void;
104
+ confirmDelete: () => Promise<void>;
105
+ setDebugData: (portletId: string, data: PortletDebugDataEntry) => void;
106
+ clearDebugData: (portletId?: string) => void;
107
+ }
108
+ export declare function useDashboard(options: UseDashboardOptions): UseDashboardResult;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * useDebounceQuery - Shared debounce logic for query hooks
3
+ *
4
+ * This hook encapsulates the common debouncing pattern used by
5
+ * useCubeLoadQuery and useMultiCubeLoadQuery to prevent excessive API calls
6
+ * when users are actively editing queries.
7
+ *
8
+ * Features:
9
+ * - Debounces value changes with configurable delay
10
+ * - Handles skip-to-unskip transitions (e.g., portlet becoming visible)
11
+ * - Clears debounced value when invalid or skipped
12
+ * - Provides isDebouncing state for UI feedback
13
+ */
14
+ export interface UseDebounceQueryOptions {
15
+ /**
16
+ * Whether the value is valid (has required fields)
17
+ */
18
+ isValid: boolean;
19
+ /**
20
+ * Whether to skip the debounced value
21
+ * @default false
22
+ */
23
+ skip?: boolean;
24
+ /**
25
+ * Debounce delay in milliseconds
26
+ * @default 300
27
+ */
28
+ debounceMs?: number;
29
+ }
30
+ export interface UseDebounceQueryResult<T> {
31
+ /** The debounced value (null if skipped or invalid) */
32
+ debouncedValue: T | null;
33
+ /** Whether the hook is currently debouncing (waiting for timer) */
34
+ isDebouncing: boolean;
35
+ }
36
+ /**
37
+ * Hook for debouncing query values with skip and validity support
38
+ *
39
+ * Usage:
40
+ * ```tsx
41
+ * const { debouncedValue, isDebouncing } = useDebounceQuery(query, {
42
+ * isValid: isValidCubeQuery(query),
43
+ * skip: !isReady,
44
+ * debounceMs: 300
45
+ * })
46
+ * ```
47
+ */
48
+ export declare function useDebounceQuery<T>(value: T | null, options: UseDebounceQueryOptions): UseDebounceQueryResult<T>;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * useDirtyStateTracking - Track configuration changes and dirty state
3
+ *
4
+ * Extracts dirty state tracking logic from AnalyticsDashboard:
5
+ * - Tracks initial config to prevent saves during initial load
6
+ * - Detects meaningful changes from initial state
7
+ * - Manages dirty state through onDirtyStateChange callback
8
+ *
9
+ * @example
10
+ * const { handleConfigChange, handleSave } = useDirtyStateTracking({
11
+ * initialConfig: config,
12
+ * onConfigChange,
13
+ * onSave,
14
+ * onDirtyStateChange,
15
+ * })
16
+ */
17
+ export interface UseDirtyStateTrackingOptions<T> {
18
+ /** Initial configuration to compare against */
19
+ initialConfig: T;
20
+ /** Original config change handler */
21
+ onConfigChange?: (config: T) => void;
22
+ /** Original save handler */
23
+ onSave?: (config: T) => Promise<void> | void;
24
+ /** Dirty state change callback */
25
+ onDirtyStateChange?: (isDirty: boolean) => void;
26
+ }
27
+ export interface UseDirtyStateTrackingResult<T> {
28
+ /** Wrapped config change handler that tracks dirty state */
29
+ handleConfigChange: (config: T) => void;
30
+ /** Wrapped save handler that tracks dirty state */
31
+ handleSave: (config: T) => Promise<void>;
32
+ /** Whether config has changed from initial */
33
+ hasChanged: () => boolean;
34
+ /** Reset the initial config reference (e.g., after external config update) */
35
+ resetInitialConfig: (config: T) => void;
36
+ }
37
+ export declare function useDirtyStateTracking<T>({ initialConfig, onConfigChange, onSave, onDirtyStateChange, }: UseDirtyStateTrackingOptions<T>): UseDirtyStateTrackingResult<T>;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Hook for fetching distinct field values for filter dropdowns
3
- * Uses the /load API to get actual data values
3
+ * Uses TanStack Query via useCubeLoadQuery for data fetching
4
4
  */
5
5
  interface UseFilterValuesResult {
6
6
  values: any[];
@@ -11,6 +11,9 @@ interface UseFilterValuesResult {
11
11
  }
12
12
  /**
13
13
  * Custom hook to fetch distinct values for a field
14
+ *
15
+ * Uses TanStack Query for server state (data fetching, caching, loading).
16
+ * Values are derived via useMemo from query results - NOT stored in useState.
14
17
  */
15
18
  export declare function useFilterValues(fieldName: string | null, enabled?: boolean): UseFilterValuesResult;
16
19
  export {};
@@ -4,9 +4,11 @@
4
4
  * React hooks only - for applications that need data fetching hooks
5
5
  * without UI components.
6
6
  */
7
- export { useCubeQuery } from './hooks/useCubeQuery';
8
- export { useCubeMeta } from './hooks/useCubeMeta';
7
+ export { useCubeMetaQuery, useCubeLoadQuery, useMultiCubeLoadQuery, useDryRunQuery, useMultiDryRunQueries, useDryRunQueries, } from './hooks/queries';
8
+ export type { UseCubeMetaQueryOptions, UseCubeMetaQueryResult, UseCubeLoadQueryOptions, UseCubeLoadQueryResult, UseMultiCubeLoadQueryOptions, UseMultiCubeLoadQueryResult, DebugDataEntry, } from './hooks/queries';
9
9
  export { useDebounce } from './hooks/useDebounce';
10
+ export { useDirtyStateTracking } from './hooks/useDirtyStateTracking';
11
+ export type { UseDirtyStateTrackingOptions, UseDirtyStateTrackingResult } from './hooks/useDirtyStateTracking';
10
12
  export { useFilterValues } from './hooks/useFilterValues';
11
13
  export { useResponsiveDashboard } from './hooks/useResponsiveDashboard';
12
14
  export type { DashboardDisplayMode, UseResponsiveDashboardResult } from './hooks/useResponsiveDashboard';