jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
114 lines (113 loc) • 7.05 kB
TypeScript
import React from 'react';
import hoistNonReactStatic from 'hoist-non-react-statics';
import type { RendererConfig, Schema } from 'jamis-core';
import type { FormItemProps } from '../types';
import type { FormControlComponent, FormItemBasicConfig, FormItemConfig } from './types';
export declare class FormItemWrap extends React.Component<FormItemProps> {
/**
* 布局扩充点,可以自己扩充表单项的布局方式
*/
static layoutRenderers: {
[propsName: string]: (props: FormItemProps, renderControl: (className?: string | string[]) => JSX.Element | null) => JSX.Element;
};
reaction: Array<() => void>;
lastSearchTerm: any;
target: HTMLElement;
constructor(props: FormItemProps);
componentDidUpdate(prevProps: FormItemProps): void;
componentDidMount(): void;
componentWillUnmount(): void;
handleFocus(e: any): void;
handleBlur(e: any): void;
handleAutoFill(type: string): void;
updateAutoFillData(context: any): void;
syncAutoFill: import("lodash").DebouncedFunc<(term: any, reload?: boolean) => void>;
buildSchema(): JSX.Element | {
type: any;
className: string;
title: string;
size: any;
body: Schema;
actions: ({
type: string;
actionType: string;
label: string;
level?: undefined;
} | {
type: string;
actionType: string;
level: string;
label: string;
})[];
} | undefined;
hanldeSubmit(values: any): void;
hanldeClose(): void;
handleOpenDialog(schema: Schema, data: any): Promise<unknown>;
handleDialogConfirm([values]: Array<any>): void;
handleDialogClose(confirmed?: boolean): void;
/**
*
* @deprecated 本方法实际没有调用, 调用的是asFormItem里的renderControl
*/
renderControl(className?: string | string[]): JSX.Element | null;
render(): JSX.Element | null;
}
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: 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;