fix(collection-manager): missing collection manager context

This commit is contained in:
chenos 2022-07-04 20:06:18 +08:00
parent e3b6c0513a
commit 075426471e
3 changed files with 14 additions and 9 deletions

View File

@ -177,6 +177,7 @@ export default {
"Add filter group": "Add filter group",
"is": "is",
"is not": "is not",
"is variable": "is variable",
"contains": "contains",
"does not contain": "does not contain",
"starts with": "starts with",

View File

@ -197,6 +197,7 @@ export default {
"Add filter group": "添加筛选分组",
"is": "等于",
"is not": "不等于",
"is variable": "为动态变量",
"contains": "包含",
"does not contain": "不包含",
"starts with": "开头是",

View File

@ -11,6 +11,7 @@ import { createPortal } from 'react-dom';
import { useTranslation } from 'react-i18next';
import {
ActionContext,
CollectionManagerContext,
createDesignable,
Designable,
FormProvider,
@ -21,7 +22,7 @@ import {
useAPIClient,
useCollection,
useCompile,
useDesignable,
useDesignable
} from '..';
import { useSchemaTemplateManager } from '../schema-templates';
import { useBlockTemplateContext } from '../schema-templates/BlockTemplate';
@ -559,6 +560,7 @@ SchemaSettings.ActionModalItem = React.memo((props: any) => {
SchemaSettings.ModalItem = (props) => {
const { hidden, title, components, scope, effects, schema, onSubmit, initialValues, ...others } = props;
const options = useContext(SchemaOptionsContext);
const cm = useContext(CollectionManagerContext);
if (hidden) {
return null;
}
@ -568,11 +570,13 @@ SchemaSettings.ModalItem = (props) => {
onClick={() => {
FormDialog(schema.title || title, () => {
return (
<SchemaComponentOptions scope={options.scope} components={options.components}>
<FormLayout layout={'vertical'}>
<SchemaComponent components={components} scope={scope} schema={schema} />
</FormLayout>
</SchemaComponentOptions>
<CollectionManagerContext.Provider value={cm}>
<SchemaComponentOptions scope={options.scope} components={options.components}>
<FormLayout layout={'vertical'}>
<SchemaComponent components={components} scope={scope} schema={schema} />
</FormLayout>
</SchemaComponentOptions>
</CollectionManagerContext.Provider>
);
})
.open({
@ -627,6 +631,5 @@ SchemaSettings.BlockTitleItem = () => {
dn.refresh();
}}
/>
)
}
);
};