jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
59 lines (58 loc) • 4.99 kB
TypeScript
import React from 'react';
import hoistNonReactStatic from 'hoist-non-react-statics';
import type { ControlProps } from '../types';
export declare function wrapControl<T extends React.ComponentType<React.ComponentProps<T> & ControlProps>>(ComposedComponent: T): ({
new (props: Omit<any, "rootStore"> | Readonly<Omit<any, "rootStore">>): {
context: React.ContextType<typeof import("jamis-core").RootStoreContext>;
render(): JSX.Element;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>) => (Pick<{}, K> | {} | null)) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>, prevState: Readonly<{}>): any | null;
componentDidUpdate?(prevProps: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>, nextState: Readonly<{}>, nextContext: any): void;
};
new (props: Omit<any, "rootStore">, context: any): {
context: React.ContextType<typeof import("jamis-core").RootStoreContext>;
render(): JSX.Element;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>) => (Pick<{}, K> | {} | null)) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>, prevState: Readonly<{}>): any | null;
componentDidUpdate?(prevProps: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<any, Omit<React.ComponentProps<any>, "rootStore">>>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: `WithRootStore(${string})`;
contextType: React.Context<Record<string, any>>;
ComposedComponent: React.ComponentType<any>;
} & hoistNonReactStatic.NonReactStatics<any, {}> & {
ComposedComponent: any;
} & hoistNonReactStatic.NonReactStatics<T, {}>) & {
ComposedComponent: T;
};