All components (244)
Match fields
Management · DataMappingEditor
What it is and when to use it
Match the fields of a source (another system, a file, an API) with those of a target: for each target field, which field it comes from and with which transformation, with an example of how it ends up.
When to use it
- Connecting a CRM with the shop, a spreadsheet with the database, an external API with your own schema.
sourcesare the source fields (with asamplefor the example) andtargetsthe target ones, withrequiredandaliases.- "Match by name" fills what fits by key, label or alias. The transformations are trimming spaces, uppercase, lowercase and converting to a number.
- It warns about required fields without a source, types that do not match and sources used in more than one target.
When not to
- Importing a file in one go:
DataImportWizardalready has its columns step. - It moves no data:
applyMappingconverts a record with the saved matching.
Keyboard: they are normal dropdowns and a button, in a table with row headers.
Accessibility: each dropdown is named after its field ("Source of Phone"), the target field is the header of its row and the warnings are written out.
Fine appearance: a required field without a source carries the soft error background in its header; the table scrolls sideways if it does not fit.
What it looks like
| Target | Comes from | Transformation | Example |
|---|---|---|---|
| Namerequired | No source Customer Mail Amount Notes | As is Without spaces at the ends In uppercase In lowercase As a number | |
| Emailrequired | No source Customer Mail Amount Notes | As is Without spaces at the ends In uppercase In lowercase As a number | [email protected] |
| Total | No source Customer Mail Amount Notes | As is Without spaces at the ends In uppercase In lowercase As a number |
<DataMappingEditor
label="Which column goes in each field"
sources={columnasDelFichero}
targets={camposDeDestino}
value={mapeo}
onChange={setMapeo}
/>Props
Import it with import { DataMappingEditor } from '@amset/ui'. Required props are marked.
| Prop | Type | What it does |
|---|---|---|
labelrequired | string | What is being matched («CRM fields with the shop's»). Required. |
onChangerequired | (value: DataMapping) => void | — |
sourcesrequired | readonly SourceField[] | — |
targetsrequired | readonly TargetField[] | — |
valuerequired | Readonly<Record<string, MappingEntry>> | — |
className | string | Merged with the library classes; it does not replace them. |
It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.
In the test bench
Every state and variant, to try one at a time, on its page at ui.amset.tech:
