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", "Add filter group": "Add filter group",
"is": "is", "is": "is",
"is not": "is not", "is not": "is not",
"is variable": "is variable",
"contains": "contains", "contains": "contains",
"does not contain": "does not contain", "does not contain": "does not contain",
"starts with": "starts with", "starts with": "starts with",

View File

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

View File

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