Sha256: 0701e1d5593665fe49de2f1f850c8b171a2b6ef1e6f19e03efbc812e7ed1ec7d
Contents?: true
Size: 1003 Bytes
Versions: 25
Compression:
Stored size: 1003 Bytes
Contents
import AutoComplete from "src/decidim/autocomplete"; $(() => { $("[data-decidim-geocoding]").each((_i, el) => { const $input = $(el); const autoComplete = new AutoComplete(el, { mode: "single", dataMatchKeys: ["value"], dataSource: (query, callback) => { $input.trigger("geocoder-suggest.decidim", [query, callback]); } }); el.addEventListener("selection", autoComplete); $input.on("selection", (event) => { const selectedItem = event.detail.selection.value; $input.trigger("geocoder-suggest-select.decidim", [selectedItem]); // Not all geocoding autocomplete APIs include the coordinates in the // suggestions response. Therefore, some APIs may require additional // query for the coordinates, which should trigger this event for the // input element. if (selectedItem.coordinates) { $input.trigger("geocoder-suggest-coordinates.decidim", [selectedItem.coordinates]); } }); }); });
Version data entries
25 entries across 25 versions & 1 rubygems