Morph-front-display-table (#13979)
## Add Morph Relation Field Display Support for Tables (one to many & many to one) **Features:** - Display morph relation fields (one-to-many, many-to-one) in table cells - Multi-field record retrieval for improved performance - Enhanced table cell rendering with morph relation support **Components Added:** - `MorphRelationManyToOneFieldDisplay` - Shows many-to-one morph relations - `MorphRelationOneToManyFieldDisplay` - Shows one-to-many morph relations TODO : handle notes and tasks case if we choose these kind of objects as targets/source for a morph relation --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@@ -4,7 +4,10 @@ import { assertUnreachable } from 'twenty-shared/utils';
|
||||
import { FieldMetadataType, RelationType } from '~/generated-metadata/graphql';
|
||||
|
||||
export type GenerateEmptyFieldValueArgs = {
|
||||
fieldMetadataItem: Pick<FieldMetadataItem, 'type' | 'relation'>;
|
||||
fieldMetadataItem: Pick<
|
||||
FieldMetadataItem,
|
||||
'type' | 'settings' | 'defaultValue'
|
||||
>;
|
||||
shouldComputeFunctionDefaultValue?: boolean;
|
||||
};
|
||||
// TODO strictly type each fieldValue following their FieldMetadataType
|
||||
@@ -62,11 +65,13 @@ export const generateEmptyFieldValue = ({
|
||||
return null;
|
||||
}
|
||||
case FieldMetadataType.BOOLEAN: {
|
||||
return true;
|
||||
return fieldMetadataItem?.defaultValue ?? true;
|
||||
}
|
||||
case FieldMetadataType.RELATION:
|
||||
case FieldMetadataType.MORPH_RELATION: {
|
||||
if (fieldMetadataItem.relation?.type === RelationType.MANY_TO_ONE) {
|
||||
if (
|
||||
fieldMetadataItem.settings?.relationType === RelationType.MANY_TO_ONE
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user