mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 08:47:20 +00:00
fix(association-field): array field move
This commit is contained in:
parent
f286534752
commit
3f4cd86465
@ -1,6 +1,8 @@
|
||||
import { CloseCircleOutlined } from '@ant-design/icons';
|
||||
import { ArrayField } from '@formily/core';
|
||||
import { spliceArrayState } from '@formily/core/lib/shared/internals';
|
||||
import { RecursionField, observer, useFieldSchema } from '@formily/react';
|
||||
import { action } from '@formily/reactive';
|
||||
import { Button, Card, Divider } from 'antd';
|
||||
import React, { useContext } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@ -40,9 +42,14 @@ const ToManyNester = observer((props) => {
|
||||
<CloseCircleOutlined
|
||||
style={{ zIndex: 1000, position: 'absolute', color: '#a8a3a3' }}
|
||||
onClick={() => {
|
||||
const result = field.value;
|
||||
result.splice(index, 1);
|
||||
field.value = result;
|
||||
action(() => {
|
||||
spliceArrayState(field as any, {
|
||||
startIndex: index,
|
||||
deleteCount: 1,
|
||||
});
|
||||
field.value.splice(index, 1);
|
||||
return field.onInput(field.value);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user