@douyinfe/semi-ui
Version:
A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.
35 lines (34 loc) • 1.18 kB
TypeScript
import React, { Component } from 'react';
import type { FormUpdaterContextType } from '@douyinfe/semi-foundation/lib/cjs/form/interface';
export interface ArrayFieldProps {
initValue?: any[];
field?: string;
children?: (props: ArrayFieldChildrenProps) => React.ReactNode;
}
export interface ArrayFieldChildrenProps {
arrayFields: {
key: string;
field: string;
remove: () => void;
}[];
add: () => void;
addWithInitValue: (lineObject: Record<string, any>) => void;
}
export interface ArrayFieldState {
keys: string[];
}
declare class ArrayFieldComponent extends Component<ArrayFieldProps, ArrayFieldState> {
static contextType: React.Context<FormUpdaterContextType>;
cacheFieldValues: any[];
shouldUseInitValue: boolean;
cacheUpdateKey: string | number;
context: FormUpdaterContextType;
constructor(props: ArrayFieldProps, context: FormUpdaterContextType);
componentWillUnmount(): void;
componentDidUpdate(): void;
add(): void;
addWithInitValue(rowVal: Record<string, any> | string): void;
remove(i: number): void;
render(): React.JSX.Element;
}
export default ArrayFieldComponent;