优化FormItemsRenderer
parent
ee19739b4d
commit
20e89d17b9
|
|
@ -39,7 +39,7 @@ export interface FormListOperations {
|
|||
/** 当前表单项的数据字段信息 */
|
||||
field: FormListFieldData;
|
||||
/** 当前项在列表中的索引位置 */
|
||||
index: number;
|
||||
fieldIndex: number;
|
||||
/** 新增方法 */
|
||||
add: (defaultValue?: FormValues, insertIndex?: number) => void;
|
||||
/** 删除方法 */
|
||||
|
|
@ -61,7 +61,7 @@ export interface FormListUniqueProps {
|
|||
/** 删除按钮的文本,默认 '删除' */
|
||||
removeButtonText?: string;
|
||||
/** 表单配置项 */
|
||||
options: (field: FormListFieldData, operations: FormListOperations) => FormOption[];
|
||||
options: (field: FormListFieldData, fieldIndex: number, operations: FormListOperations) => FormOption[];
|
||||
/** 点击新增按钮时的默认值 */
|
||||
addDefaultValue?: FormValues;
|
||||
/** 点击新增按钮时插入的索引位置 */
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ const FormItemsRenderer = ({
|
|||
// 获取 listOptions
|
||||
const getListOptions = (listOptions, field, fieldIndex, add, remove, move) => {
|
||||
return typeof listOptions === "function"
|
||||
? listOptions(field, { field, fieldIndex, add, remove, move })
|
||||
? listOptions(field, fieldIndex, { field, fieldIndex, add, remove, move })
|
||||
: (listOptions ?? []);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue