in src/setter/array-setter/index.tsx [24:49]
function onItemChange (target: IPublicModelSettingField, index: number, item: IPublicModelSettingField, props: ArraySetterProps) {
const targetPath: Array<string | number> = target?.path;
if (!targetPath || targetPath.length < 2) {
console.warn(
`[ArraySetter] onItemChange 接收的 target.path <${
targetPath || 'undefined'
}> 格式非法需为 [propName, arrayIndex, key?]`,
);
return;
}
const { field } = props;
const { path } = field;
if (path[0] !== targetPath[0]) {
console.warn(
`[ArraySetter] field.path[0] !== target.path[0] <${path[0]} !== ${targetPath[0]}>`,
);
return;
}
try {
const fieldValue = field.getValue();
fieldValue[index] = item.getValue();
field?.setValue(fieldValue);
} catch (e) {
console.warn('[ArraySetter] extraProps.setValue failed :', e);
}
};