Merge pull request #4709 from betagouv/4698-autocomplete-inclure-pas-resultats
#4698 - Possibilite de selectionner un resultat quand il n'y a rien de suggéré dans le champ adresse
This commit is contained in:
commit
e6fdf0d89e
1 changed files with 9 additions and 5 deletions
|
@ -122,12 +122,16 @@ const adresseOptions = {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
processResults(data) {
|
processResults(data) {
|
||||||
|
let r = data.features.map(({ properties: { label }, geometry }) => ({
|
||||||
|
id: label,
|
||||||
|
text: label,
|
||||||
|
geometry
|
||||||
|
}));
|
||||||
|
// Allow the user to select an arbitrary address missing from the results,
|
||||||
|
// by adding the plain-text query to the list of results.
|
||||||
|
r.unshift({ id: data.query, text: data.query });
|
||||||
return {
|
return {
|
||||||
results: data.features.map(({ properties: { label }, geometry }) => ({
|
results: r
|
||||||
id: label,
|
|
||||||
text: label,
|
|
||||||
geometry
|
|
||||||
}))
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue