jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
64 lines (63 loc) • 5.32 kB
TypeScript
import React from 'react';
import hoistNonReactStatic from 'hoist-non-react-statics';
import type { RendererConfig } from 'jamis-core';
import type { FormControlComponent, FormItemBasicConfig, FormItemConfig } from './types';
export declare const detectProps: string[];
export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (Control: FormControlComponent) => {
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;
} & {
ComposedComponent: any;
};
export declare function registerFormItem(config: FormItemConfig): RendererConfig;
export declare function FormItem(config: FormItemBasicConfig): (component: FormControlComponent) => any;
export declare function getFormItemByName(name: string): boolean;