]> git.openstreetmap.org Git - nominatim-ui.git/blobdiff - src/components/SearchSection.svelte
Rebundle latest version
[nominatim-ui.git] / src / components / SearchSection.svelte
index 6bf7bca0f2a06bcc1493c1a00d86e909c5daf6af..70e8df66a650b558deeae49256c8d569d4801830 100644 (file)
@@ -7,8 +7,9 @@
   export let bStructuredSearch = false;
   export let api_request_params = {};
   let sViewBox;
-  let lat;
-  let lon;
+  // lat,lon are later set in update_reverse_link()
+  let lat; // eslint-disable-line no-unused-vars
+  let lon; // eslint-disable-line no-unused-vars
 
   function map_viewbox_as_string(map) {
     var bounds = map.getBounds();
@@ -69,7 +70,7 @@
   }
 
   function set_dedupe(e) {
-    document.querySelector('input[name=dedupe]').value = e.target.checked ? 1 : '';
+    document.querySelector('input[name=dedupe]').value = e.target.checked ? 1 : 0;
   }
 
   function set_api_param(e) {
 
 <ul class="nav nav-tabs">
   <li class="nav-item">
-    <a class="nav-link" class:active={!bStructuredSearch} data-bs-toggle="tab" href="#simple">Simple</a>
+    <a class="nav-link" class:active={!bStructuredSearch} data-bs-toggle="tab" href="#simple">
+      Simple
+    </a>
   </li>
   <li class="nav-item">
-    <a class="nav-link" class:active={bStructuredSearch} data-bs-toggle="tab" href="#structured">Structured</a>
+    <a class="nav-link" class:active={bStructuredSearch} data-bs-toggle="tab" href="#structured">
+      Structured
+    </a>
   </li>
 </ul>
 
       </div>
       <div class="col-auto">
         <button type="submit" class="btn btn-primary btn-sm mx-1">Search</button>
-        <input type="hidden" name="viewbox" value="{sViewBox || ''}" />
-        <input type="hidden" name="dedupe" value="{!api_request_params.dedupe ? '' : 1}" />
-        <input type="hidden" name="bounded" value="{api_request_params.bounded ? 1 : ''}" />
-        <input type="hidden" name="accept-language" value="{api_request_params['accept-language'] || ''}" />
-        <input type="hidden" name="countrycodes" value="{api_request_params.countrycodes || ''}"
-                                                      pattern="^[a-zA-Z]{'{2}'}(,[a-zA-Z]{'{2}'})*$" />
-        <input type="hidden" name="limit" value="{api_request_params.limit || ''}" />
-        <input type="hidden" name="polygon_threshold" value="{api_request_params.polygon_threshold || ''}" />
+        <input type="hidden"
+               name="viewbox" value="{sViewBox || ''}" />
+        <input type="hidden"
+               name="dedupe" value="{api_request_params.dedupe === 0 ? 0 : 1}" />
+        <input type="hidden"
+               name="bounded" value="{api_request_params.bounded ? 1 : ''}" />
+        <input type="hidden"
+               name="accept-language"value="{api_request_params['accept-language'] || ''}" />
+        <input type="hidden"
+               name="countrycodes" value="{api_request_params.countrycodes || ''}"
+                                   pattern="^[a-zA-Z]{'{2}'}(,[a-zA-Z]{'{2}'})*$" />
+        <input type="hidden"
+               name="limit" value="{api_request_params.limit || ''}" />
+        <input type="hidden"
+               name="polygon_threshold" value="{api_request_params.polygon_threshold || ''}" />
       </div>
     </UrlSubmitForm>
   </div>
       </div>
       <div class="col-auto">
         <button type="submit" class="btn btn-primary btn-sm">Search</button>
-        <input type="hidden" name="viewbox" value="{sViewBox || ''}" />
-        <input type="hidden" name="dedupe" value="{!api_request_params.dedupe ? '' : 1}" />
-        <input type="hidden" name="bounded" value="{api_request_params.bounded ? 1 : ''}" />
-        <input type="hidden" name="accept-language" value="{api_request_params['accept-language'] || ''}" />
-        <input type="hidden" name="countrycodes" value="{api_request_params.countrycodes || ''}"
-                                                pattern="^[a-zA-Z]{'{2}'}(,[a-zA-Z]{'{2}'})*$" />
-        <input type="hidden" name="limit" value="{api_request_params.limit || ''}" />
-        <input type="hidden" name="polygon_threshold" value="{api_request_params.polygon_threshold || ''}" />
+        <input type="hidden"
+               name="viewbox" value="{sViewBox || ''}" />
+        <input type="hidden"
+               name="dedupe" value="{api_request_params.dedupe === 0 ? 0 : 1}" />
+        <input type="hidden"
+               name="bounded" value="{api_request_params.bounded ? 1 : ''}" />
+        <input type="hidden"
+               name="accept-language" value="{api_request_params['accept-language'] || ''}" />
+        <input type="hidden"
+               name="countrycodes" value="{api_request_params.countrycodes || ''}"
+                                   pattern="^[a-zA-Z]{'{2}'}(,[a-zA-Z]{'{2}'})*$" />
+        <input type="hidden"
+               name="limit" value="{api_request_params.limit || ''}" />
+        <input type="hidden"
+               name="polygon_threshold" value="{api_request_params.polygon_threshold || ''}" />
       </div>
     </UrlSubmitForm>
   </div>
     <li>
       <div class="form-check form-check-inline">
         <label class="form-check-label" for="option_dedupe">deduplicate results</label>
-        <input type="checkbox" class="form-check-input api-param-setting"
-               id="option_dedupe" checked={!!api_request_params.dedupe} on:change={set_dedupe}>
+        <input type="checkbox"
+               class="form-check-input api-param-setting"
+               id="option_dedupe"
+               checked={api_request_params.dedupe === 0 ? 0 : 1}
+               on:change={set_dedupe}>
       </div>
     </li>
 
     <li>
       <label for="option_limit">Maximum number of results</label>
-      <input type="number" class="form-control form-control-sm d-inline w-auto api-param-setting"
+      <input type="number"
+             class="form-control form-control-sm d-inline w-auto api-param-setting"
              data-api-param="limit" id="option_limit" min="1" max="50"
              value="{api_request_params.limit || ''}"
              on:change={set_api_param}>
 
     <li>
       <label for="option_polygon_threshold">Polygon simplification</label>
-      <input type="number" class="form-control form-control-sm d-inline w-auto api-param-setting"
-             data-api-param="polygon_threshold" id="option_polygon_threshold" min="0.0"  max="1.0" step="0.001"
+      <input type="number"
+             class="form-control form-control-sm d-inline w-auto api-param-setting"
+             data-api-param="polygon_threshold" id="option_polygon_threshold"
+             min="0.0" max="1.0" step="0.001"
              value="{api_request_params.polygon_threshold || ''}"
              on:change={set_api_param}>
     </li>
 
     <li>
       <label for="accept_lang">Languages</label>
-      <input type="text" placeholder="e.g. en,zh-Hant" class="form-control form-control-sm d-inline w-auto api-param-setting"
+      <input type="text" placeholder="e.g. en,zh-Hant"
+             class="form-control form-control-sm d-inline w-auto api-param-setting"
              data-api-param="accept-language" id="accept_lang" size="15"
              value="{api_request_params['accept-language'] || ''}"
              on:change={set_api_param}>
 
     <li>
       <label for="option_ccode">Country Codes</label>
-      <input type="text" placeholder="e.g. de,gb" class="form-control form-control-sm d-inline w-auto api-param-setting"
+      <input type="text" placeholder="e.g. de,gb"
+            class="form-control form-control-sm d-inline w-auto api-param-setting"
              data-api-param="countrycodes" id="option_ccode" size="15"
              value="{api_request_params.countrycodes || ''}"
              pattern="^[a-zA-Z]{'{2}'}(,[a-zA-Z]{'{2}'})*$"