UNPKG

@superset-ui/core

Version:
99 lines 3.6 kB
/** Type checking is disabled for this file due to reselect only supporting * TS declarations for selectors with up to 12 arguments. */ import { RefObject } from 'react'; import { AppSection, Behavior, Datasource, FilterState, JsonObject } from '../..'; import { HandlerFunction, LegendState, PlainObject, SetDataMaskHook } from '../types/Base'; import { QueryData, DataRecordFilters } from '..'; import { SupersetTheme } from '../../style'; type AnnotationData = PlainObject; type SnakeCaseDatasource = PlainObject; type CamelCaseFormData = PlainObject; type SnakeCaseFormData = PlainObject; type RawFormData = CamelCaseFormData | SnakeCaseFormData; type ChartPropsSelector = (c: ChartPropsConfig) => ChartProps; /** Optional field for event handlers, renderers */ type Hooks = { /** * sync active filters between chart and dashboard, "add" actually * also handles "change" and "remove". */ onAddFilter?: (newFilters: DataRecordFilters, merge?: boolean) => void; /** handle right click */ onContextMenu?: HandlerFunction; /** handle errors */ onError?: HandlerFunction; /** handle legend state changes */ onLegendStateChanged?: HandlerFunction; /** use the vis as control to update state */ setControlValue?: HandlerFunction; /** handle external filters */ setDataMask?: SetDataMaskHook; /** handle tooltip */ setTooltip?: HandlerFunction; } & PlainObject; /** * Preferred format for ChartProps config */ export interface ChartPropsConfig { annotationData?: AnnotationData; /** Datasource metadata */ datasource?: SnakeCaseDatasource; initialValues?: DataRecordFilters; /** Main configuration of the chart */ formData?: RawFormData; /** Chart height */ height?: number; /** Programmatic overrides such as event handlers, renderers */ hooks?: Hooks; /** The data returned for all queries objects in the request */ queriesData?: QueryData[]; /** Chart width */ width?: number; /** Own chart state that saved in dashboard */ ownState?: JsonObject; /** Filter state that saved in dashboard */ filterState?: FilterState; /** Legend state */ legendState?: LegendState; /** Set of actual behaviors that this instance of chart should use */ behaviors?: Behavior[]; /** Chart display settings related to current view context */ displaySettings?: JsonObject; /** Application section of the chart on the screen (in what components/screen it placed) */ appSection?: AppSection; /** is the chart refreshing its contents */ isRefreshing?: boolean; /** chart ref */ inputRef?: RefObject<any>; /** Theme object */ theme: SupersetTheme; } export default class ChartProps<FormData extends RawFormData = RawFormData> { static createSelector: () => ChartPropsSelector; annotationData: AnnotationData; datasource: Datasource; rawDatasource: SnakeCaseDatasource; initialValues: DataRecordFilters; formData: CamelCaseFormData; rawFormData: FormData; height: number; hooks: Hooks; ownState: JsonObject; filterState: FilterState; legendState?: LegendState; queriesData: QueryData[]; width: number; behaviors: Behavior[]; displaySettings?: JsonObject; appSection?: AppSection; isRefreshing?: boolean; inputRef?: RefObject<any>; inContextMenu?: boolean; emitCrossFilters?: boolean; theme: SupersetTheme; constructor(config?: ChartPropsConfig & { formData?: FormData; }); } export {}; //# sourceMappingURL=ChartProps.d.ts.map