@@ -18,7 +18,7 @@ import {
1818 useFieldSchema ,
1919 RecursionField ,
2020} from "@formily/react" ;
21- import { isArr , isBool } from "@formily/shared" ;
21+ import { isArr , isBool , uid } from "@formily/shared" ;
2222import { Schema } from "@formily/json-schema" ;
2323
2424import "./index.scss" ;
@@ -333,13 +333,11 @@ export const ArrayTable: ComposedArrayTable = observer(
333333 const columns = useArrayTableColumns ( dataSource , sources ) ;
334334 const pagination = isBool ( props . pagination ) ? { } : props . pagination ;
335335 const addition = useAddition ( ) ;
336- const defaultRowKey = ( record ?: any ) => {
337- return dataSource . indexOf ( record ) . toString ( ) ;
338- } ;
336+ const defaultRowKey = ( ) => uid ( ) . toString ( ) ;
339337
340338 return (
341339 < ArrayTablePagination { ...pagination } dataSource = { dataSource } >
342- { ( dataSource , pager ) => (
340+ { ( innerDataSource , pager ) => (
343341 < div ref = { ref } className = { prefixCls } >
344342 < ArrayBase { ...props ?. arrayBaseProps } >
345343 < ArrayTableComponentsContext . Provider value = { { ref, field } } >
@@ -351,10 +349,10 @@ export const ArrayTable: ComposedArrayTable = observer(
351349 onChange = { ( ) => { } }
352350 pagination = { false }
353351 columns = { columns }
354- dataSource = { dataSource }
352+ dataSource = { innerDataSource }
355353 components = { arrayTableComponents }
356- onRow = { ( _ , index ) => ( {
357- index,
354+ onRow = { ( record ) => ( {
355+ index : dataSource . indexOf ( record ) ,
358356 } ) }
359357 />
360358 </ ArrayTableComponentsContext . Provider >
0 commit comments