///
import { ClassNamesFn, LocaleProps, ThemeProps, TranslateFn } from 'amis-core';
import React from 'react';
import { Control, UseFieldArrayProps, UseFormReturn } from 'react-hook-form';
import { FormFieldProps } from './FormField';
import type { ButtonProps } from './Button';
export interface tdRenderFunc {
(methods: UseFormReturn, colIndex: number, rowIndex: number): JSX.Element | null;
}
export interface InputTableColumnProps {
title?: string;
className?: string;
thRender?: () => JSX.Element;
tdRender: tdRenderFunc;
}
interface InputTableScrollProps {
/** 垂直滚动区域的最大高度 */
y: number | string;
}
export interface InputTabbleProps extends ThemeProps, LocaleProps, Omit, UseFieldArrayProps {
control: Control;
fieldClassName?: string;
columns: Array;
/**
* 要不要包裹 label 之类的
*/
wrap?: boolean;
scaffold?: any;
addable?: boolean;
addButtonClassName?: string;
addButtonText?: string;
addButtonProps?: Partial>;
maxLength?: number;
minLength?: number;
removable?: boolean;
/** 表格CSS类名 */
tableClassName?: string;
/** 表格头CSS类名 */
tableHeadClassName?: string;
/** 表格内容区CSS类名 */
tableBodyClassName?: string;
/** 空状态文字 */
placeholder?: React.ReactNode;
/** 滚动设置 */
scroll?: InputTableScrollProps;
/** 底部工具栏 */
footer?: () => React.ReactNode;
onItemAdd?: (values: Record) => void;
}
export declare function InputTable({ control, name, wrap, mode, label, labelAlign, labelClassName, description, fieldClassName, className, translate: __, classnames: cx, removable, columns, addable, addButtonText, addButtonClassName, addButtonProps, scaffold, minLength, maxLength, isRequired, rules, tableClassName, tableHeadClassName, tableBodyClassName, placeholder, scroll, footer, onItemAdd }: InputTabbleProps): React.JSX.Element;
export interface InputTableRowProps {
value: any;
control: Control;
columns: Array<{
tdRender: tdRenderFunc;
className?: string;
}>;
update: (index: number, data: Record) => void;
index: number;
translate: TranslateFn;
classnames: ClassNamesFn;
formRef: (form: UseFormReturn | null, id: string) => void;
}
export declare const InputTableRow: React.NamedExoticComponent;
declare const _default: {
new (props: Omit, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}, keyof ThemeProps> & import("packages/amis-core/lib/theme").ThemeOuterProps): {
ref: any;
childRef(ref: any): void;
getWrappedInstance(): any;
render(): React.JSX.Element;
context: unknown;
setState(state: {} | ((prevState: Readonly<{}>, props: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}, keyof ThemeProps> & import("packages/amis-core/lib/theme").ThemeOuterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}, keyof ThemeProps> & import("packages/amis-core/lib/theme").ThemeOuterProps>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}, keyof ThemeProps> & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}, keyof ThemeProps> & import("packages/amis-core/lib/theme").ThemeOuterProps>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}, keyof ThemeProps> & import("packages/amis-core/lib/theme").ThemeOuterProps>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}, keyof ThemeProps> & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}, keyof ThemeProps> & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}, keyof ThemeProps> & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}, keyof ThemeProps> & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
contextType: React.Context;
ComposedComponent: React.ComponentType<{
new (props: Omit, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}): {
ref: any;
childRef(ref: any): void;
getWrappedInstance(): any;
render(): React.JSX.Element;
context: unknown;
setState(state: {} | ((prevState: Readonly<{}>, props: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
contextType: React.Context;
ComposedComponent: React.ComponentType;
} & import("hoist-non-react-statics").NonReactStatics & {
ComposedComponent: typeof InputTable;
}>;
} & import("hoist-non-react-statics").NonReactStatics<{
new (props: Omit, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}): {
ref: any;
childRef(ref: any): void;
getWrappedInstance(): any;
render(): React.JSX.Element;
context: unknown;
setState(state: {} | ((prevState: Readonly<{}>, props: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
contextType: React.Context;
ComposedComponent: React.ComponentType;
} & import("hoist-non-react-statics").NonReactStatics & {
ComposedComponent: typeof InputTable;
}, {}> & {
ComposedComponent: {
new (props: Omit, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}): {
ref: any;
childRef(ref: any): void;
getWrappedInstance(): any;
render(): React.JSX.Element;
context: unknown;
setState(state: {} | ((prevState: Readonly<{}>, props: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
contextType: React.Context;
ComposedComponent: React.ComponentType;
} & import("hoist-non-react-statics").NonReactStatics & {
ComposedComponent: typeof InputTable;
};
};
export default _default;