/** * 一个可以拉取远程配置的 HOC * */ import React from 'react'; import hoistNonReactStatic from 'hoist-non-react-statics'; import { Api, Payload } from '../types'; import { SchemaApi, SchemaTokenizeableString } from '../Schema'; import { RendererEnv } from '../env'; import { Instance } from 'mobx-state-tree'; export declare const Store: import("mobx-state-tree").IModelType<{ fetching: import("mobx-state-tree").IType; errorMsg: import("mobx-state-tree").IType; config: import("mobx-state-tree").IType; data: import("mobx-state-tree").IType<{} | null | undefined, {}, {}>; }, { setComponent(c: any): void; load: (env: RendererEnv, api: Api, ctx: any, config: WithRemoteConfigSettings) => Promise; setData(data: any): void; setConfig(options: any, config: WithRemoteConfigSettings, motivation?: any): void; }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>; export declare type IStore = Instance; export interface OutterProps { env?: RendererEnv; data: any; source?: SchemaApi | SchemaTokenizeableString; deferApi?: SchemaApi; remoteConfigRef?: (instance: { loadConfig: (ctx?: any) => Promise | void; setConfig: (value: any) => void; } | undefined) => void; } export interface RemoteOptionsProps { config: T; loading?: boolean; deferLoad: (item: any) => Promise; updateConfig: (value: T, ctx?: any) => void; } export interface WithRemoteConfigSettings { /** * 从接口返回数据适配到配置 */ adaptor?: (json: any, props: any) => any; /** * 配置格式化 */ normalizeConfig?: (config: any, origin: any, props: any, motivation?: any) => any; /** * 请求返回后的回调 */ afterLoad?: (ret: any, config: any, props: any) => void; /** * 懒加载选项相关,开始懒加载的回调 */ beforeDeferLoad?: (item: any, indexes: Array, config: any, props: any) => any; /** * 懒加载选项相关,结束懒加载的回调 */ afterDeferLoad?: (item: any, indexes: Array, reponse: Payload, config: any, props: any) => any; } export declare function withRemoteConfig

(config?: WithRemoteConfigSettings): & RemoteOptionsProps

>>(ComposedComponent: T) => { new (props: Pick, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">> | Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>): { ref: any; store?: ({ fetching: boolean; errorMsg: string; config: any; data: import("mobx-state-tree").IStateTreeNode>; } & import("mobx-state-tree/dist/internal").NonEmptyObject & { setComponent(c: any): void; load: (env: RendererEnv, api: Api, ctx: any, config: WithRemoteConfigSettings) => Promise; setData(data: any): void; setConfig(options: any, config: WithRemoteConfigSettings, motivation?: any): void; } & import("mobx-state-tree").IStateTreeNode; errorMsg: import("mobx-state-tree").IType; config: import("mobx-state-tree").IType; data: import("mobx-state-tree").IType<{} | null | undefined, {}, {}>; }, { setComponent(c: any): void; load: (env: RendererEnv, api: Api, ctx: any, config: WithRemoteConfigSettings) => Promise; setData(data: any): void; setConfig(options: any, config: WithRemoteConfigSettings, motivation?: any): void; }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) | undefined; refFn: (ref: any) => void; componentWillUnmount(): void; getWrappedInstance(): any; render(): JSX.Element; context: any; setState(state: {} | ((prevState: Readonly<{}>, props: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>> & Readonly<{ children?: React.ReactNode; }>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; componentDidMount?(): void; shouldComponentUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>, nextState: Readonly<{}>, nextContext: any): boolean; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>, prevState: Readonly<{}>): any; componentDidUpdate?(prevProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>, prevState: Readonly<{}>, snapshot?: any): void; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>, nextState: Readonly<{}>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>, nextState: Readonly<{}>, nextContext: any): void; }; new (props: Pick, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>, context: any): { ref: any; store?: ({ fetching: boolean; errorMsg: string; config: any; data: import("mobx-state-tree").IStateTreeNode>; } & import("mobx-state-tree/dist/internal").NonEmptyObject & { setComponent(c: any): void; load: (env: RendererEnv, api: Api, ctx: any, config: WithRemoteConfigSettings) => Promise; setData(data: any): void; setConfig(options: any, config: WithRemoteConfigSettings, motivation?: any): void; } & import("mobx-state-tree").IStateTreeNode; errorMsg: import("mobx-state-tree").IType; config: import("mobx-state-tree").IType; data: import("mobx-state-tree").IType<{} | null | undefined, {}, {}>; }, { setComponent(c: any): void; load: (env: RendererEnv, api: Api, ctx: any, config: WithRemoteConfigSettings) => Promise; setData(data: any): void; setConfig(options: any, config: WithRemoteConfigSettings, motivation?: any): void; }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) | undefined; refFn: (ref: any) => void; componentWillUnmount(): void; getWrappedInstance(): any; render(): JSX.Element; context: any; setState(state: {} | ((prevState: Readonly<{}>, props: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>> & Readonly<{ children?: React.ReactNode; }>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; componentDidMount?(): void; shouldComponentUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>, nextState: Readonly<{}>, nextContext: any): boolean; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>, prevState: Readonly<{}>): any; componentDidUpdate?(prevProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>, prevState: Readonly<{}>, snapshot?: any): void; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>, nextState: Readonly<{}>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }, "data" | "source" | "env" | "deferApi" | "remoteConfigRef" | Exclude, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>>, "store">>>, nextState: Readonly<{}>, nextContext: any): void; }; displayName: string; ComposedComponent: { new (props: JSX.LibraryManagedAttributes, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }): { toDispose: Array<() => void>; componentDidMount(): void; componentDidUpdate(prevProps: any): void; componentWillUnmount(): void; loadConfig(ctx?: (JSX.LibraryManagedAttributes, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; })["data"]): Promise; setConfig(value: any, ctx?: any): void; syncConfig(): void; deferLoadConfig(item: any): Promise; render(): JSX.Element; context: any; setState(state: {} | ((prevState: Readonly<{}>, props: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }> & Readonly<{ children?: React.ReactNode; }>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; shouldComponentUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextState: Readonly<{}>, nextContext: any): boolean; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, prevState: Readonly<{}>): any; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextState: Readonly<{}>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextState: Readonly<{}>, nextContext: any): void; }; displayName: string; ComposedComponent: T; contextType: React.Context; }; contextType?: React.Context | undefined; } & hoistNonReactStatic.NonReactStatics<{ new (props: JSX.LibraryManagedAttributes, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }): { toDispose: Array<() => void>; componentDidMount(): void; componentDidUpdate(prevProps: any): void; componentWillUnmount(): void; loadConfig(ctx?: (JSX.LibraryManagedAttributes, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; })["data"]): Promise; setConfig(value: any, ctx?: any): void; syncConfig(): void; deferLoadConfig(item: any): Promise; render(): JSX.Element; context: any; setState(state: {} | ((prevState: Readonly<{}>, props: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }> & Readonly<{ children?: React.ReactNode; }>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; shouldComponentUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextState: Readonly<{}>, nextContext: any): boolean; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, prevState: Readonly<{}>): any; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextState: Readonly<{}>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextState: Readonly<{}>, nextContext: any): void; }; displayName: string; ComposedComponent: T; contextType: React.Context; }, {}> & { ComposedComponent: { new (props: JSX.LibraryManagedAttributes, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }): { toDispose: Array<() => void>; componentDidMount(): void; componentDidUpdate(prevProps: any): void; componentWillUnmount(): void; loadConfig(ctx?: (JSX.LibraryManagedAttributes, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; })["data"]): Promise; setConfig(value: any, ctx?: any): void; syncConfig(): void; deferLoadConfig(item: any): Promise; render(): JSX.Element; context: any; setState(state: {} | ((prevState: Readonly<{}>, props: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }> & Readonly<{ children?: React.ReactNode; }>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; shouldComponentUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextState: Readonly<{}>, nextContext: any): boolean; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, prevState: Readonly<{}>): any; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextState: Readonly<{}>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly, Exclude, "loading" | "deferLoad" | "config" | "updateConfig">>> & OutterProps & { store: IStore; }>, nextState: Readonly<{}>, nextContext: any): void; }; displayName: string; ComposedComponent: T; contextType: React.Context; }; } & hoistNonReactStatic.NonReactStatics & { ComposedComponent: T; };