UNPKG

drizzle-cube

Version:

Drizzle ORM-first semantic layer with Cube.js compatibility. Type-safe analytics and dashboards with SQL injection protection.

61 lines (60 loc) 1.98 kB
import { ComponentType } from 'react'; /** * Configuration for a single axis drop zone in the chart configuration UI */ export interface AxisDropZoneConfig { /** The key to store this field in chartConfig (e.g., 'xAxis', 'yAxis', 'sizeField') */ key: string; /** Display label for the drop zone */ label: string; /** Optional description/help text shown below the label */ description?: string; /** Whether at least one field is required in this drop zone */ mandatory?: boolean; /** Maximum number of items allowed in this drop zone */ maxItems?: number; /** Which field types this drop zone accepts */ acceptTypes?: ('dimension' | 'timeDimension' | 'measure')[]; /** Optional icon component to display */ icon?: ComponentType<{ className?: string; }>; /** Placeholder text when drop zone is empty */ emptyText?: string; } /** * Complete configuration for a chart type */ export interface ChartTypeConfig { /** Configuration for each drop zone */ dropZones: AxisDropZoneConfig[]; /** Which display options to show for this chart type */ displayOptions?: string[]; /** Optional custom validation function */ validate?: (config: any) => { isValid: boolean; message?: string; }; /** Icon component for the chart type */ icon?: ComponentType<{ className?: string; }>; /** Brief description of the chart */ description?: string; /** When to use this chart type */ useCase?: string; } /** * Registry of all chart type configurations */ export interface ChartConfigRegistry { [chartType: string]: ChartTypeConfig; } /** * Default configuration for charts without specific requirements */ export declare const defaultChartConfig: ChartTypeConfig; /** * Helper function to get configuration for a chart type */ export declare function getChartConfig(chartType: string, registry: ChartConfigRegistry): ChartTypeConfig;