import type { RefObject } from 'react'; import type { AnyAction, Dispatch as ReduxDispatch, Middleware as ReduxMiddleware } from 'redux'; import type { Draft, Action as ReduxAction, PayloadAction as ReduxPayloadAction } from '@reduxjs/toolkit'; import type { ErrorObject } from 'ajv'; import type { AppearanceStyle, DataSourceDefinition, StructureItemType, VisualizationDefinition, DashboardJSON, InputDefinition } from './DashboardJSON'; import type { Expand, MappedType } from './Helpers'; import type { SmartSourceTokenState, TokenState, ValidSmartSource } from './Token'; import type { TokenTraceState } from './TokenTrace'; import type { ActivePanel } from './DashboardApi'; import type { DashboardPluginWrapper } from './DashboardPlugin'; import type { PresetUtility } from './Preset'; import type { IApiRegistry } from './ApiRegistry'; import type { IEventRegistry } from './EventRegistry'; import type { IDataSourceRegistry } from './DataSource'; import type { RawInputValue } from './Inputs'; import type { TelemetryAPI } from './Telemetry'; import type { DashboardProfiler } from './DashboardProfiler'; import type { ExpressionType } from './Expressions'; export type { JSONSchemaType, SchemaObject } from 'ajv'; export type { Store } from '@reduxjs/toolkit'; type PossiblyOptionalProperty = [undefined] extends [T] ? [T] extends [never] ? object : Partial : [T] extends [never] ? object : Required; type Action = [P] extends [never] ? ReduxAction : ReduxPayloadAction; /** * An action with a string type and an associated payload. This is the * type of action returned by `createAction()` action creators. * * This is a modification of the normal `PayloadAction` type returned from `createAction` (redux toolkit) so: * 1. When not provided, the payload will be typed as `unknown` instead of `void` * 1. If unioned with `undefined`, the `.meta` property will be optional * 1. If unioned with `undefined`, the `.error` property will be optional * * @template P The type of the action's payload. If `never`, the action will not have a `payload` property. * @template T the type used for the action type. * @template M The type of the action's meta (optional). If unioned with `undefined`, the `meta` property will be optional. * @template E The type of the action's error (optional) */ export type PayloadAction

= Expand & PossiblyOptionalProperty & PossiblyOptionalProperty>; /** * Generic type generator which creates payloads for dispatching actions given an object structure. * * Converts a type or interface declaration like * ```ts * declare type MyStruct = { * key_1: string; * key_2?: number; * key_3: { * foo: string; * bar: boolean; * }; * }; * ``` * * into the union * ```ts * declare type MyStructReducerActions = PayloadActionGenerator; * // produces: * type MyStructReducerActions = * | { type: 'set/key_1'; payload: string } * | { type: 'set/key_2'; payload: number | undefined } * | { type: 'set/key_3'; payload: { foo: string; bar: boolean } }; * ``` * * an optional path can be provided in the action type using a second template * ```ts * declare type MyStructReducerActions = * | PayloadActionGenerator * | PayloadActionGenerator, 'key_3'>; * // produces: * type MyStructReducerActions = * | { type: 'set/key_1'; payload: string } * | { type: 'set/key_2'; payload: number | undefined } * | { type: 'set/key_3'; payload: { foo: string; bar: boolean } } * | { type: 'set/key_3.foo'; payload: string } * | { type: 'set/key_3.bar'; payload: boolean }; * ``` */ export type PayloadActionGenerator, P extends string = never, M = never> = { [K in keyof T as K extends symbol | number ? never : string]: PayloadAction; }[string]; export interface SelectedItem { id: string; type: StructureItemType; } export type FullscreenElementId = string | null; export interface FullscreenSlice { fullscreenElement: FullscreenElementId; isDashboardFullscreen?: boolean; } export type Mode = 'view' | 'edit'; export interface TokenSlice { readOnlyTokenNamespaces: string[]; submitted: TokenState; stashed: TokenState; } export type SmartSourceSlice = Partial>; export type FlyoutVisibilityState = 'open' | 'closed' | 'collapsed'; export type SourceEditorFlyout = { visibility: FlyoutVisibilityState; height: number; }; export interface PanelProps { bindingType?: string; dataSourceTemplate?: DataSourceDefinition; from?: { activePanel: ActivePanel; }; dataSourceId?: string; drilldownId?: number | null; focusOnOpen?: boolean; showAIPanel?: boolean; } export interface SidebarState { activePanel: ActivePanel; panelProps?: PanelProps; } export interface DeletionConfirmationModal { modalIds: string[]; additionalIds?: string[]; } export interface ExpressionModalState { /** * ID of the expression being edited. * * When `undefined` the modal is closed. * * If no expression exists with the specified ID then a new expression is being created */ activeItemId?: string; /** The type of the expression (eval or condition) */ activeItemType?: ExpressionType; /** When set each ID will be part of a dispatched `linkCondition({ conditionId, itemId })` action while saving the modal */ bindTargetIds?: string[]; /** Store the collapsible state of the builder panel for the duration of the session */ isBuilderPanelOpen?: boolean; /** Store the collapsible state of the source panel for the duration of the session */ isSourcePanelOpen?: boolean; } export type LayoutEditorState = { selectedItems: SelectedItem[]; showGridLines: boolean; sourceEditorFlyout: SourceEditorFlyout; sidebarState: SidebarState; sidebarSearchTerm?: string; }; export interface EditorSlice { layouts: Record; deletionConfirmation?: DeletionConfirmationModal; expressionModal?: ExpressionModalState; globalItems: { selectedGlobalItems: SelectedItem[]; collapsed: boolean; }; description: { collapsed: boolean; }; } type PartialEditorSlice = Omit & { layouts: Record>; }; export type InputValue = { value?: RawInputValue; firstSearchValue?: RawInputValue; }; export type InputValueSlice = Record; export type MigrationSlice = { hasDismissedAutoMigrate: boolean; hasDismissedManualMigrate: boolean; hasDismissedViewMode: boolean; numMigratedViz: number; hasAutoMigrated: boolean; }; export interface TabsSlice { activeTab?: string; } export interface TokenTraceSlice { traceData: TokenTraceState['traceData']; } export type FeatureFlagsSlice = Partial>; export interface GlobalState { definition: DashboardJSON; mode: Mode; tokens: TokenSlice; editor: EditorSlice; fullscreen?: FullscreenSlice; message: string | null; inputState: InputValueSlice; smartSources: SmartSourceSlice; migration: MigrationSlice; tabs: TabsSlice; tokenTrace: TokenTraceSlice; featureFlags: FeatureFlagsSlice; defaultVizStyle: AppearanceStyle; } export interface GlobalStatePartial extends Omit { editor: Partial; } /** Payload for resetStore action: partial state with editor as Partial. */ export type ResetStorePayload = Partial & { editor: Partial; }>; export interface CreateVisualizationActionPayload { visualizationId: string; visualizationDefinition: VisualizationDefinition; layoutItemType?: StructureItemType; dataSourceType?: string | null; dataSourceDefinition?: DataSourceDefinition | null; } export interface CreateInputActionPayload { inputId: string; inputDefinition: InputDefinition; } export type Middleware, State = GlobalState, Dispatch extends ReduxDispatch = ReduxDispatch> = ReduxMiddleware; export interface MiddlewareContext { dashboardPlugin?: DashboardPluginWrapper; preset?: PresetUtility; eventRegistry?: IEventRegistry; apiRegistry?: IApiRegistry; dataSourceRegistry?: IDataSourceRegistry; featureFlags?: Record; telemetryApi?: TelemetryAPI; profilerRef?: React.MutableRefObject; elementRefs?: Record>>; } export type ActiveTabMeta = { activeTab?: string; }; export type DefinitionReducer = (state: Draft, payload: PayloadAction) => void; export type AjvError = Partial; //# sourceMappingURL=DashboardState.d.ts.map