Connect - Relation on FE Importer (#13213)

Done : 
- Relation connect on FE Importer
- Remove templating on SpreadsheetMatchedColumn type
- Remove useless files on import
- Remove AvailableFieldsForImport type + Update SpreadsheetImportField
type and SpreadsheetImportFieldOption


To test : 
- Try import opportunities on Apple wk 
[using this
file](https://github.com/user-attachments/files/21233720/Test.import.-.opportunities-sample.csv)


closes : https://github.com/twentyhq/core-team-issues/issues/1090
This commit is contained in:
Etienne
2025-07-18 21:43:16 +02:00
committed by GitHub
parent ae04cc9e6c
commit cc71394863
90 changed files with 1615 additions and 1195 deletions
@@ -3,10 +3,11 @@ import { ReadonlyDeep } from 'type-fest';
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
import { isCompositeFieldType } from '@/object-record/object-filter-dropdown/utils/isCompositeFieldType';
import { getSubFieldOptionKey } from '@/object-record/spreadsheet-import/utils/getSubFieldOptionKey';
import { MatchColumnSelectFieldSelectDropdownContent } from '@/spreadsheet-import/components/MatchColumnSelectFieldSelectDropdownContent';
import { MatchColumnSelectSubFieldSelectDropdownContent } from '@/spreadsheet-import/components/MatchColumnSelectSubFieldSelectDropdownContent';
import { DO_NOT_IMPORT_OPTION_KEY } from '@/spreadsheet-import/constants/DoNotImportOptionKey';
import { SpreadsheetImportFieldOption } from '@/spreadsheet-import/types/SpreadsheetImportFieldOption';
import { hasNestedFields } from '@/spreadsheet-import/utils/spreadsheetImportHasNestedFields';
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import styled from '@emotion/styled';
@@ -19,7 +20,7 @@ interface MatchColumnToFieldSelectProps {
columnIndex: string;
onChange: (value: ReadonlyDeep<SelectOption> | null) => void;
value?: ReadonlyDeep<SelectOption>;
options: readonly ReadonlyDeep<SelectOption>[];
options: readonly Readonly<SpreadsheetImportFieldOption>[];
suggestedOptions: readonly ReadonlyDeep<SelectOption>[];
placeholder?: string;
}
@@ -70,12 +71,7 @@ export const MatchColumnToFieldSelect = ({
}
const correspondingOption = options.find((option) => {
const optionKey = getSubFieldOptionKey(
selectedFieldMetadataItem,
subFieldNameSelected,
);
return option.value === optionKey;
return option.value === subFieldNameSelected;
});
if (isDefined(correspondingOption)) {
@@ -112,9 +108,9 @@ export const MatchColumnToFieldSelect = ({
closeDropdown(dropdownId);
};
const shouldShowSubField =
const shouldShowNestedField =
isDefined(selectedFieldMetadataItem) &&
isCompositeFieldType(selectedFieldMetadataItem.type);
hasNestedFields(selectedFieldMetadataItem);
return (
<Dropdown
@@ -129,7 +125,7 @@ export const MatchColumnToFieldSelect = ({
/>
}
dropdownComponents={
shouldShowSubField ? (
shouldShowNestedField ? (
<MatchColumnSelectSubFieldSelectDropdownContent
fieldMetadataItem={selectedFieldMetadataItem}
onSubFieldSelect={handleSubFieldSelect}