875dc1a6b8
Closes https://github.com/twentyhq/core-team-issues/issues/1535 Video QA: https://github.com/user-attachments/assets/153fa3f1-08d9-4952-9456-635c602e1f57 https://github.com/user-attachments/assets/d3111afb-4c84-4f57-8a56-5cf666748c86 There are still some formatting and design issues (the labels which are on top of each other and the values which should be formatted) that will be fixed in a future PR --------- Co-authored-by: ehconitin <nitinkoche03@gmail.com>
21 lines
635 B
TypeScript
21 lines
635 B
TypeScript
import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
|
|
import { isCompositeFieldType } from '@/object-record/object-filter-dropdown/utils/isCompositeFieldType';
|
|
import { isDefined } from 'twenty-shared/utils';
|
|
import { type Maybe } from '~/generated/graphql';
|
|
|
|
type GetFieldKeyParams = {
|
|
field: FieldMetadataItem;
|
|
subFieldName?: Maybe<string>;
|
|
};
|
|
|
|
export const getFieldKey = ({
|
|
field,
|
|
subFieldName,
|
|
}: GetFieldKeyParams): string => {
|
|
const isComposite = isCompositeFieldType(field.type);
|
|
|
|
return isComposite && isDefined(subFieldName)
|
|
? `${field.name}.${subFieldName}`
|
|
: field.name;
|
|
};
|