fix: fix default value is not working in sutable (#3155)

This commit is contained in:
Zeke Zhang 2023-12-07 14:08:28 +08:00 committed by GitHub
parent a86a65cf2c
commit 1fddf0bcb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,14 +9,13 @@ import { Button } from 'antd';
import React from 'react'; import React from 'react';
import { FormActiveFieldsProvider } from '../../../block-provider'; import { FormActiveFieldsProvider } from '../../../block-provider';
import { FlagProvider } from '../../../flag-provider'; import { FlagProvider } from '../../../flag-provider';
import { useSubTableSpecialCase } from '../form-item/hooks/useSpecialCase';
import { Table } from '../table-v2/Table'; import { Table } from '../table-v2/Table';
import { useAssociationFieldContext } from './hooks'; import { useAssociationFieldContext } from './hooks';
export const SubTable: any = observer( export const SubTable: any = observer(
(props: any) => { (props: any) => {
const { field } = useAssociationFieldContext<ArrayField>(); const { field } = useAssociationFieldContext<ArrayField>();
useSubTableSpecialCase({ field }); // useSubTableSpecialCase({ field });
const move = (fromIndex: number, toIndex: number) => { const move = (fromIndex: number, toIndex: number) => {
if (toIndex === undefined) return; if (toIndex === undefined) return;
if (!isArr(field.value)) return; if (!isArr(field.value)) return;