mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 03:45:10 +00:00
fix: bug
This commit is contained in:
parent
4560619ef3
commit
b4d950566c
@ -26,6 +26,7 @@ export const CreateFormBlockInitializer = () => {
|
||||
const blockSchema = createFormBlockSchema({
|
||||
actionInitializers: 'CreateFormActionInitializers',
|
||||
association,
|
||||
namespace: collection.namespace,
|
||||
collection: collection.name,
|
||||
template: s,
|
||||
});
|
||||
@ -41,6 +42,7 @@ export const CreateFormBlockInitializer = () => {
|
||||
createFormBlockSchema({
|
||||
actionInitializers: 'CreateFormActionInitializers',
|
||||
association,
|
||||
namespace: collection.namespace,
|
||||
collection: collection.name,
|
||||
}),
|
||||
);
|
||||
|
@ -28,6 +28,7 @@ export const RecordAssociationBlockInitializer = () => {
|
||||
createTableBlockSchema({
|
||||
rowKey: collection.filterTargetKey,
|
||||
collection: field.target,
|
||||
namespace: collection.namespace,
|
||||
resource,
|
||||
association: resource,
|
||||
}),
|
||||
|
@ -28,6 +28,7 @@ export const RecordAssociationDetailsBlockInitializer = () => {
|
||||
createDetailsBlockSchema({
|
||||
collection: field.target,
|
||||
resource,
|
||||
namespace: collection.namespace,
|
||||
association: resource,
|
||||
rowKey: collection.filterTargetKey || 'id',
|
||||
}),
|
||||
|
@ -1,17 +1,20 @@
|
||||
import React from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
import { FormOutlined } from '@ant-design/icons';
|
||||
|
||||
import { useSchemaTemplateManager } from '../../schema-templates';
|
||||
import { createFormBlockSchema, useRecordCollectionDataSourceItems } from '../utils';
|
||||
import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application';
|
||||
import { useCollectionManager } from '../../collection-manager';
|
||||
|
||||
export const RecordAssociationFormBlockInitializer = () => {
|
||||
const itemConfig = useSchemaInitializerItem();
|
||||
const { onCreateBlockSchema, componentType, createBlockSchema, ...others } = itemConfig;
|
||||
const { insert } = useSchemaInitializer();
|
||||
const { getCollection } = useCollectionManager();
|
||||
const { getTemplateSchemaByMode } = useSchemaTemplateManager();
|
||||
const field = itemConfig.field;
|
||||
const collection = field.target;
|
||||
const collectionName = field.target;
|
||||
const collection = useMemo(() => getCollection(collectionName), [collectionName]);
|
||||
const resource = `${field.collectionName}.${field.name}`;
|
||||
return (
|
||||
<SchemaInitializerItem
|
||||
@ -27,7 +30,8 @@ export const RecordAssociationFormBlockInitializer = () => {
|
||||
const s = await getTemplateSchemaByMode(item);
|
||||
if (item.template.componentName === 'FormItem') {
|
||||
const blockSchema = createFormBlockSchema({
|
||||
collection,
|
||||
collection: collectionName,
|
||||
namespace: collection.namespace,
|
||||
resource,
|
||||
association: resource,
|
||||
action,
|
||||
@ -46,8 +50,9 @@ export const RecordAssociationFormBlockInitializer = () => {
|
||||
} else {
|
||||
insert(
|
||||
createFormBlockSchema({
|
||||
collection,
|
||||
collection: collectionName,
|
||||
resource,
|
||||
namespace: collection.namespace,
|
||||
association: resource,
|
||||
action,
|
||||
useSourceId: '{{ useSourceIdFromParentRecord }}',
|
||||
|
@ -30,6 +30,7 @@ export const RecordAssociationGridCardBlockInitializer = () => {
|
||||
rowKey: collection.filterTargetKey,
|
||||
collection: field.target,
|
||||
resource,
|
||||
namespace: collection.namespace,
|
||||
association: resource,
|
||||
}),
|
||||
);
|
||||
|
@ -30,6 +30,7 @@ export const RecordAssociationListBlockInitializer = () => {
|
||||
rowKey: collection.filterTargetKey,
|
||||
collection: field.target,
|
||||
resource,
|
||||
namespace: collection.namespace,
|
||||
association: resource,
|
||||
}),
|
||||
);
|
||||
|
@ -25,6 +25,7 @@ export const RecordFormBlockInitializer = () => {
|
||||
const blockSchema = createFormBlockSchema({
|
||||
association,
|
||||
collection: collection.name,
|
||||
namespace: collection.namespace,
|
||||
action: 'get',
|
||||
useSourceId: '{{ useSourceIdFromParentRecord }}',
|
||||
useParams: '{{ useParamsFromRecord }}',
|
||||
@ -43,6 +44,7 @@ export const RecordFormBlockInitializer = () => {
|
||||
createFormBlockSchema({
|
||||
association,
|
||||
collection: collection.name,
|
||||
namespace: collection.namespace,
|
||||
action: 'get',
|
||||
useSourceId: '{{ useSourceIdFromParentRecord }}',
|
||||
useParams: '{{ useParamsFromRecord }}',
|
||||
|
@ -5,15 +5,19 @@ import { useBlockRequestContext } from '../../block-provider';
|
||||
import { useSchemaTemplateManager } from '../../schema-templates';
|
||||
import { createReadPrettyFormBlockSchema, useRecordCollectionDataSourceItems } from '../utils';
|
||||
import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application';
|
||||
import { useCollectionManager } from '../../collection-manager';
|
||||
|
||||
export const RecordReadPrettyAssociationFormBlockInitializer = () => {
|
||||
const itemConfig = useSchemaInitializerItem();
|
||||
const { onCreateBlockSchema, componentType, createBlockSchema, ...others } = itemConfig;
|
||||
const { insert } = useSchemaInitializer();
|
||||
const { getCollection } = useCollectionManager();
|
||||
const { getTemplateSchemaByMode } = useSchemaTemplateManager();
|
||||
|
||||
const field = itemConfig.field;
|
||||
const collection = field.target;
|
||||
const collectionName = field.target;
|
||||
const collection = getCollection(collectionName);
|
||||
|
||||
const resource = `${field.collectionName}.${field.name}`;
|
||||
const { block } = useBlockRequestContext();
|
||||
const actionInitializers = block !== 'TableField' ? 'ReadPrettyFormActionInitializers' : null;
|
||||
@ -28,7 +32,8 @@ export const RecordReadPrettyAssociationFormBlockInitializer = () => {
|
||||
if (item.template.componentName === 'ReadPrettyFormItem') {
|
||||
const blockSchema = createReadPrettyFormBlockSchema({
|
||||
actionInitializers,
|
||||
collection,
|
||||
collection: collectionName,
|
||||
namespace: collection.namespace,
|
||||
resource,
|
||||
association: resource,
|
||||
action: 'get',
|
||||
@ -47,9 +52,10 @@ export const RecordReadPrettyAssociationFormBlockInitializer = () => {
|
||||
insert(
|
||||
createReadPrettyFormBlockSchema({
|
||||
actionInitializers,
|
||||
collection,
|
||||
collection: collectionName,
|
||||
resource,
|
||||
association: resource,
|
||||
namespace: collection.namespace,
|
||||
action: 'get',
|
||||
useSourceId: '{{ useSourceIdFromParentRecord }}',
|
||||
useParams: '{{ useParamsFromRecord }}',
|
||||
|
@ -37,6 +37,7 @@ export const RecordReadPrettyFormBlockInitializer = () => {
|
||||
actionInitializers,
|
||||
association,
|
||||
collection: collection.name,
|
||||
namespace: collection.namespace,
|
||||
action: 'get',
|
||||
useSourceId: '{{ useSourceIdFromParentRecord }}',
|
||||
useParams: '{{ useParamsFromRecord }}',
|
||||
@ -55,6 +56,7 @@ export const RecordReadPrettyFormBlockInitializer = () => {
|
||||
actionInitializers,
|
||||
association,
|
||||
collection: collection.name,
|
||||
namespace: collection.namespace,
|
||||
action: 'get',
|
||||
useSourceId: '{{ useSourceIdFromParentRecord }}',
|
||||
useParams: '{{ useParamsFromRecord }}',
|
||||
|
@ -19,6 +19,7 @@ export const TableSelectorInitializer = () => {
|
||||
createTableSelectorSchema({
|
||||
rowKey: collection.filterTargetKey,
|
||||
collection: collection.name,
|
||||
namespace: collection.namespace,
|
||||
resource: collection.name,
|
||||
}),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user