import React from 'react';
import { IIRendererStore } from './store/index';
import { Api, fetcherResult, Payload, SchemaNode, Schema, Action } from './types';
import { ThemeInstance, ThemeProps } from './theme';
import { LocaleProps } from './locale';
import { RootRenderProps } from './Root';
export interface TestFunc {
    (path: string, schema?: Schema, resolveRenderer?: (path: string, schema?: Schema, props?: any) => null | RendererConfig): boolean;
}
export interface RendererBasicConfig {
    test: RegExp | TestFunc;
    name?: string;
    storeType?: string;
    shouldSyncSuperStore?: (store: any, props: any, prevProps: any) => boolean | undefined;
    storeExtendsData?: boolean;
    weight?: number;
    isolateScope?: boolean;
    isFormItem?: boolean;
}
export interface RendererEnv {
    fetcher: (api: Api, data?: any, options?: object) => Promise<Payload>;
    isCancel: (val: any) => boolean;
    notify: (type: 'error' | 'success', msg: string, conf?: {
        closeButton?: boolean;
        timeout?: number;
    }) => void;
    jumpTo: (to: string, action?: Action, ctx?: object) => void;
    alert: (msg: string) => void;
    confirm: (msg: string, title?: string) => Promise<boolean>;
    updateLocation: (location: any, replace?: boolean) => void;
    /**
     * 阻止路由跳转，有时候 form 没有保存，但是路由跳转了，导致页面没有更新，
     * 所以先让用户确认一下。
     *
     * 单页模式需要这个，如果非单页模式，不需要处理这个。
     */
    blockRouting?: (fn: (targetLocation: any) => void | string) => () => void;
    isCurrentUrl: (link: string, ctx?: any) => boolean | {
        params?: object;
    };
    /**
     * 监控路由变化，如果 jssdk 需要做单页跳转需要实现这个。
     */
    watchRouteChange?: (fn: () => void) => () => void;
    rendererResolver?: (path: string, schema: Schema, props: any) => null | RendererConfig;
    copy?: (contents: string) => void;
    getModalContainer?: () => HTMLElement;
    theme: ThemeInstance;
    affixOffsetTop: number;
    affixOffsetBottom: number;
    richTextToken: string;
    loadRenderer: (schema: Schema, path: string, reRender: Function) => Promise<React.ReactType> | React.ReactType | JSX.Element | void;
    [propName: string]: any;
}
export interface RendererProps extends ThemeProps, LocaleProps {
    render: (region: string, node: SchemaNode, props?: any) => JSX.Element;
    env: RendererEnv;
    $path: string;
    store?: IIRendererStore;
    syncSuperStore?: boolean;
    data: {
        [propName: string]: any;
    };
    defaultData?: object;
    className?: string;
    [propName: string]: any;
}
export declare type RendererComponent = React.ComponentType<RendererProps> & {
    propsList?: Array<any>;
};
export interface RendererConfig extends RendererBasicConfig {
    component: RendererComponent;
    Renderer?: RendererComponent;
}
export interface RenderSchemaFilter {
    (schema: Schema, renderer: RendererConfig, props?: any): Schema;
}
export interface RenderOptions {
    session?: string;
    fetcher?: (config: fetcherConfig) => Promise<fetcherResult>;
    wsFetcher?: (ws: string, onMessage: (data: any) => void, onError: (error: any) => void) => void;
    isCancel?: (value: any) => boolean;
    notify?: (type: 'error' | 'success', msg: string, conf?: {
        closeButton?: boolean;
        timeout?: number;
    }) => void;
    jumpTo?: (to: string, action?: Action, ctx?: object) => void;
    alert?: (msg: string) => void;
    confirm?: (msg: string, title?: string) => boolean | Promise<boolean>;
    rendererResolver?: (path: string, schema: Schema, props: any) => null | RendererConfig;
    copy?: (contents: string) => void;
    getModalContainer?: () => HTMLElement;
    loadRenderer?: (schema: Schema, path: string, reRender: Function) => Promise<React.ReactType> | React.ReactType | JSX.Element | void;
    affixOffsetTop?: number;
    affixOffsetBottom?: number;
    richTextToken?: string;
    [propName: string]: any;
}
export interface fetcherConfig {
    url: string;
    method?: 'get' | 'post' | 'put' | 'patch' | 'delete';
    data?: any;
    config?: any;
}
export declare function addSchemaFilter(fn: RenderSchemaFilter): void;
export declare function filterSchema(schema: Schema, render: RendererConfig, props?: any): Schema;
export declare function Renderer(config: RendererBasicConfig): <T extends RendererComponent>(component: T) => T;
export declare function registerRenderer(config: RendererConfig): RendererConfig;
export declare function unRegisterRenderer(config: RendererConfig | string): void;
export declare function loadRenderer(schema: Schema, path: string): JSX.Element;
export declare function render(schema: Schema, props?: RootRenderProps, options?: RenderOptions, pathPrefix?: string): JSX.Element;
export declare function clearStoresCache(sessions?: Array<string> | string): void;
export declare function updateEnv(options: Partial<RenderOptions>, session?: string): void;
export declare function resolveRenderer(path: string, schema?: Schema): null | RendererConfig;
export declare function getRenderers(): RendererConfig[];
export declare function getRendererByName(name: string): RendererConfig | undefined;
