fix: sub-table without record context
This commit is contained in:
parent
ef81032dbe
commit
903fbfacce
@ -2,7 +2,7 @@ import { ArrayField } from '@formily/core';
|
||||
import { Schema, useField, useFieldSchema } from '@formily/react';
|
||||
import React, { createContext, useContext, useEffect } from 'react';
|
||||
import { useCollectionManager } from '../collection-manager';
|
||||
import { useRecord } from '../record-provider';
|
||||
import { RecordProvider, useRecord } from '../record-provider';
|
||||
import { BlockProvider, useBlockRequestContext } from './BlockProvider';
|
||||
import { useFormBlockContext } from './FormBlockProvider';
|
||||
|
||||
@ -16,6 +16,7 @@ const InternalTableSelectorProvider = (props) => {
|
||||
// return <Spin />;
|
||||
// }
|
||||
return (
|
||||
<RecordProvider record={{}}>
|
||||
<TableSelectorContext.Provider
|
||||
value={{
|
||||
field,
|
||||
@ -28,6 +29,7 @@ const InternalTableSelectorProvider = (props) => {
|
||||
>
|
||||
{props.children}
|
||||
</TableSelectorContext.Provider>
|
||||
</RecordProvider>
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -120,10 +120,10 @@ export const TabPaneInitializers = (props?: any) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const TabPaneInitializersForCreateFormBlock = () => {
|
||||
return <TabPaneInitializers isCreate />;
|
||||
export const TabPaneInitializersForCreateFormBlock = (props) => {
|
||||
return <TabPaneInitializers {...props} isCreate />;
|
||||
};
|
||||
|
||||
export const TabPaneInitializersForBulkEditFormBlock = () => {
|
||||
return <TabPaneInitializers isBulkEdit />;
|
||||
export const TabPaneInitializersForBulkEditFormBlock = (props) => {
|
||||
return <TabPaneInitializers {...props} isBulkEdit />;
|
||||
};
|
||||
|
@ -5,11 +5,15 @@ import { gridRowColWrap } from '../utils';
|
||||
|
||||
export const TableSelectorInitializers = (props: any) => {
|
||||
const { t } = useTranslation();
|
||||
const { insertPosition, component } = props;
|
||||
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
wrap={gridRowColWrap}
|
||||
title={t('Add block')}
|
||||
title={component ? null : t('Add block')}
|
||||
icon={'PlusOutlined'}
|
||||
insertPosition={insertPosition}
|
||||
component={component}
|
||||
items={[
|
||||
{
|
||||
type: 'itemGroup',
|
||||
|
Loading…
Reference in New Issue
Block a user