5425 - Introducing support for all Composite Fields Import (#5470)

Adding support for all Composite Fields while using the "import"
functionality. This includes:
- Currency
- Address

Edit : 
- Refactored a lot of types in the spreadsheet import module
- Renamed a lot of functions, hooks and types that were not
self-explanatory enough

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
Aryan Singh
2024-07-23 21:32:23 +05:30
committed by GitHub
parent 2cc0597ee4
commit 5c8fe027f9
46 changed files with 888 additions and 535 deletions

View File

@ -1,6 +1,9 @@
import { defaultSpreadsheetImportProps } from '@/spreadsheet-import/provider/components/SpreadsheetImport';
import { Columns } from '@/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep';
import { Fields, SpreadsheetOptions } from '@/spreadsheet-import/types';
import {
Fields,
SpreadsheetImportDialogOptions,
} from '@/spreadsheet-import/types';
import { sleep } from '~/utils/sleep';
const fields = [
@ -13,7 +16,7 @@ const fields = [
type: 'input',
},
example: 'Stephanie',
validations: [
fieldValidationDefinitions: [
{
rule: 'required',
errorMessage: 'Name is required',
@ -29,7 +32,7 @@ const fields = [
type: 'input',
},
example: 'McDonald',
validations: [
fieldValidationDefinitions: [
{
rule: 'unique',
errorMessage: 'Last name must be unique',
@ -47,7 +50,7 @@ const fields = [
type: 'input',
},
example: '23',
validations: [
fieldValidationDefinitions: [
{
rule: 'regex',
value: '^\\d+$',
@ -69,7 +72,7 @@ const fields = [
],
},
example: 'Team one',
validations: [
fieldValidationDefinitions: [
{
rule: 'required',
errorMessage: 'Team is required',
@ -117,7 +120,7 @@ export const importedColums: Columns<string> = [
];
const mockComponentBehaviourForTypes = <T extends string>(
props: SpreadsheetOptions<T>,
props: SpreadsheetImportDialogOptions<T>,
) => props;
export const mockRsiValues = mockComponentBehaviourForTypes({
@ -142,8 +145,8 @@ export const mockRsiValues = mockComponentBehaviourForTypes({
}),
);
return {
headerValues: hData,
data,
headerRow: hData,
importedRows: data,
};
},
// Runs after column matching and on entry change, more performant