fix: #898
This commit is contained in:
@@ -178,18 +178,21 @@ function buildMutationInputType(payload: Payload, name: string, fields: Field[],
|
||||
}),
|
||||
row: (inputObjectTypeConfig: InputObjectTypeConfig, field: RowField) => field.fields.reduce((acc, subField: Field) => {
|
||||
const addSubField = fieldToSchemaMap[subField.type];
|
||||
return addSubField(acc, subField);
|
||||
if (addSubField) return addSubField(acc, subField);
|
||||
return acc;
|
||||
}, inputObjectTypeConfig),
|
||||
collapsible: (inputObjectTypeConfig: InputObjectTypeConfig, field: CollapsibleField) => field.fields.reduce((acc, subField: CollapsibleField) => {
|
||||
const addSubField = fieldToSchemaMap[subField.type];
|
||||
return addSubField(acc, subField);
|
||||
if (addSubField) return addSubField(acc, subField);
|
||||
return acc;
|
||||
}, inputObjectTypeConfig),
|
||||
tabs: (inputObjectTypeConfig: InputObjectTypeConfig, field: TabsField) => field.tabs.reduce((acc, tab) => {
|
||||
return {
|
||||
...acc,
|
||||
...tab.fields.reduce((subFieldSchema, subField) => {
|
||||
const addSubField = fieldToSchemaMap[subField.type];
|
||||
return addSubField(subFieldSchema, subField);
|
||||
if (addSubField) return addSubField(subFieldSchema, subField);
|
||||
return subFieldSchema;
|
||||
}, acc),
|
||||
};
|
||||
}, inputObjectTypeConfig),
|
||||
|
||||
@@ -444,18 +444,21 @@ function buildObjectType({
|
||||
},
|
||||
row: (objectTypeConfig: ObjectTypeConfig, field: RowField) => field.fields.reduce((objectTypeConfigWithRowFields, subField) => {
|
||||
const addSubField = fieldToSchemaMap[subField.type];
|
||||
return addSubField(objectTypeConfigWithRowFields, subField);
|
||||
if (addSubField) return addSubField(objectTypeConfigWithRowFields, subField);
|
||||
return objectTypeConfigWithRowFields;
|
||||
}, objectTypeConfig),
|
||||
collapsible: (objectTypeConfig: ObjectTypeConfig, field: CollapsibleField) => field.fields.reduce((objectTypeConfigWithCollapsibleFields, subField) => {
|
||||
const addSubField = fieldToSchemaMap[subField.type];
|
||||
return addSubField(objectTypeConfigWithCollapsibleFields, subField);
|
||||
if (addSubField) return addSubField(objectTypeConfigWithCollapsibleFields, subField);
|
||||
return objectTypeConfigWithCollapsibleFields;
|
||||
}, objectTypeConfig),
|
||||
tabs: (objectTypeConfig: ObjectTypeConfig, field: TabsField) => field.tabs.reduce((tabSchema, tab) => {
|
||||
return {
|
||||
...tabSchema,
|
||||
...tab.fields.reduce((subFieldSchema, subField) => {
|
||||
const addSubField = fieldToSchemaMap[subField.type];
|
||||
return addSubField(subFieldSchema, subField);
|
||||
if (addSubField) return addSubField(subFieldSchema, subField);
|
||||
return subFieldSchema;
|
||||
}, tabSchema),
|
||||
};
|
||||
}, objectTypeConfig),
|
||||
|
||||
7
test/fields/collections/Tabs/UIField.tsx
Normal file
7
test/fields/collections/Tabs/UIField.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
export const UIField: React.FC = () => {
|
||||
return (
|
||||
<p>This is a UI field within a tab component.</p>
|
||||
);
|
||||
};
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import { blocksField, blocksFieldSeedData } from '../Blocks';
|
||||
import { UIField } from './UIField';
|
||||
|
||||
const TabsFields: CollectionConfig = {
|
||||
slug: 'tabs-fields',
|
||||
@@ -12,6 +13,16 @@ const TabsFields: CollectionConfig = {
|
||||
label: 'Tab with Array',
|
||||
description: 'This tab has an array.',
|
||||
fields: [
|
||||
{
|
||||
type: 'ui',
|
||||
name: 'demoUIField',
|
||||
label: 'Demo UI Field',
|
||||
admin: {
|
||||
components: {
|
||||
Field: UIField,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'array',
|
||||
labels: {
|
||||
|
||||
Reference in New Issue
Block a user