import React from 'react'; import Sortable from 'sortablejs'; import { DataSchema } from 'amis'; import { FormControlProps, Schema } from 'amis-core'; import { ActionConfig, ActionEventConfig, ComponentInfo, ContextVariables } from './types'; import { EditorManager, PluginActions, PluginEvents, RendererPluginAction, RendererPluginEvent, SubRendererPluginAction, IGlobalEvent } from 'amis-editor-core'; export * from './helper'; interface EventControlProps extends FormControlProps { manager: EditorManager; actions: PluginActions; events: PluginEvents; actionTree: RendererPluginAction[]; commonActions?: { [propName: string]: RendererPluginAction; }; value: ActionEventConfig; onChange: (value: any, submitOnChange?: boolean, changeImmediately?: boolean) => void; addBroadcast?: (event: RendererPluginEvent) => void; removeBroadcast?: (eventName: string) => void; getComponents: (action: any) => ComponentInfo[]; getContextSchemas?: (id?: string, withoutSuper?: boolean) => DataSchema; actionConfigInitFormatter?: (actionConfig: ActionConfig) => ActionConfig; actionConfigSubmitFormatter?: (actionConfig: ActionConfig, type?: string, actionData?: ActionData, schema?: Schema) => ActionConfig; owner?: string; subscribeSchemaSubmit: (fn: (schema: any, value: any, id: string, diff?: any) => any, once?: boolean) => () => void; } interface EventDialogData { eventName: string; eventLabel: string; isBroadcast: boolean; debounceConfig?: { open: boolean; wait?: number; }; trackConfig?: { open: boolean; id: string; name: string; }; [propName: string]: any; } export interface ActionData { eventKey: string; actionIndex?: number; action?: ActionConfig; variables?: ContextVariables[]; pluginActions: PluginActions; getContextSchemas?: (id?: string, withoutSuper?: boolean) => DataSchema; groupType?: string; __actionDesc?: string; __cmptTreeSource?: ComponentInfo[]; __superCmptTreeSource?: ComponentInfo[]; __actionSchema?: any; __subActions?: SubRendererPluginAction[]; __setValueDs?: any[]; [propName: string]: any; } interface EventControlState { onEvent: ActionEventConfig; events: RendererPluginEvent[]; eventPanelActive: { [prop: string]: boolean; }; showAcionDialog: boolean; showEventDialog: boolean; eventDialogData?: EventDialogData; actionData: ActionData | undefined; type: 'update' | 'add'; appLocaleState?: number; actionRelations: any; globalEvents: IGlobalEvent[]; } export declare class EventControl extends React.Component { target: HTMLElement | null; eventPanelSortMap: { [prop: string]: Sortable; }; drag?: HTMLElement | null; unReaction: any; unEventReaction: any; submitSubscribers: Array<(value: any) => any>; constructor(props: EventControlProps); componentDidMount(): void; componentWillUnmount(): void; componentDidUpdate(prevProps: EventControlProps, prevState: EventControlState): void; subscribeSubmit(subscriber: (value: any) => any): () => void; generateEmptyDefault(events: RendererPluginEvent[]): ActionEventConfig; addEvent(event: RendererPluginEvent, disabled: boolean): void; addGlobalEvent(event: IGlobalEvent, disabled: boolean): void; activeEventDialog(eventInfo: EventDialogData): void; eventDialogSubmit(formData: any): void; delEvent(event: string): void; addAction(event: string, config: any): void; updateAction(event: string, index: number, config: any): void; delAction(event: string, action: any, index: number): void; toggleActivePanel(eventKey: string): void; updateWeight(event: string, data: any): void; /** * 更新事件配置 * * @param {string} event * @param {number} actionIndex * @param {*} config * @memberof EventControl */ updateValue(event: string, index: number, config: any): Promise; dragRef(ref: any): void; initDragging(): void; genSortPanel(eventKey: string, ele: HTMLElement): Sortable; destroyDragging(): void; buildEventDataSchema(data: any, manager: EditorManager): void; buildContextSchema(data: any): Promise; activeActionDialog(data: Pick): Promise; renderDesc(action: ActionConfig, actionIndex: number, eventKey: string): React.JSX.Element | null; onSubmit(type: string, config: any): void; onClose(): void; unSubscribeSchemaSubmit?: () => void; subscribeSchemaSubmit(fn: (schema: any, value: any, id: string, diff?: any) => any, once?: boolean): () => void; removeDataSchema(): void; renderActionType(action: any, actionIndex: number, eventKey: string): React.JSX.Element; getActionRelations(): any; handleRelationComponentActive(componentId: string): void; render(): React.JSX.Element; } export declare class EventControlRenderer extends EventControl { }