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