fix: create or delete collection error (#501)
This commit is contained in:
parent
3496126102
commit
05d315115f
@ -1,10 +1,15 @@
|
|||||||
import { ISchema } from '@formily/react';
|
import { ISchema, Schema } from '@formily/react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { i18n } from '../../../i18n';
|
||||||
import { useRecord } from '../../../record-provider';
|
import { useRecord } from '../../../record-provider';
|
||||||
import { useCompile } from '../../../schema-component';
|
import { useCompile } from '../../../schema-component';
|
||||||
import { CollectionOptions } from '../../types';
|
import { CollectionOptions } from '../../types';
|
||||||
import { collectionFieldSchema } from './collectionFields';
|
import { collectionFieldSchema } from './collectionFields';
|
||||||
|
|
||||||
|
const compile = (source) => {
|
||||||
|
return Schema.compile(source, { t: i18n.t });
|
||||||
|
}
|
||||||
|
|
||||||
const collection: CollectionOptions = {
|
const collection: CollectionOptions = {
|
||||||
name: 'collections',
|
name: 'collections',
|
||||||
filterTargetKey: 'name',
|
filterTargetKey: 'name',
|
||||||
@ -203,8 +208,9 @@ export const collectionSchema: ISchema = {
|
|||||||
'x-reactions': (field) => {
|
'x-reactions': (field) => {
|
||||||
const i = field.path.segments[1];
|
const i = field.path.segments[1];
|
||||||
const table = field.form.getValuesIn(`table.${i}`);
|
const table = field.form.getValuesIn(`table.${i}`);
|
||||||
const compile = useCompile();
|
if (table) {
|
||||||
field.title = `${compile(table.title)} - ${compile('{{ t("Configure fields") }}')}`;
|
field.title = `${compile(table.title)} - ${compile('{{ t("Configure fields") }}')}`;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
collectionFieldSchema,
|
collectionFieldSchema,
|
||||||
|
Loading…
Reference in New Issue
Block a user