From 03a5aa50588ed3e5d7011ecebaafd081de4c0ae5 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Wed, 9 Apr 2025 20:46:19 +0200 Subject: [PATCH] sync dropdown keys with address tags from id-tagging-schema --- data/address_formats.json | 10 ---------- modules/ui/fields/address.js | 27 +++++++++++++++++++++------ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/data/address_formats.json b/data/address_formats.json index 60deae617..8d0b83afd 100644 --- a/data/address_formats.json +++ b/data/address_formats.json @@ -134,10 +134,6 @@ ["quarter", "neighbourhood"], ["block_number", "housenumber"] ], - "dropdowns": [ - "postcode", "province", "county", "city", "suburb", - "quarter", "neighbourhood", "block_number" - ], "widths": { "postcode": 0.3, "province": 0.35, @@ -212,9 +208,6 @@ ["neighbourhood"], ["city", "state", "postcode"] ], - "dropdowns": [ - "street", "neighbourhood", "city", "state", "postcode" - ], "widths": { "street": 0.7, "housenumber": 0.3, @@ -238,9 +231,6 @@ ["housename", "subdistrict"], ["district", "city", "postcode"] ], - "dropdowns": [ - "street", "city", "subdistrict", "district", "postcode" - ], "widths": { "street": 0.7, "housenumber": 0.3, diff --git a/modules/ui/fields/address.js b/modules/ui/fields/address.js index 3e8dc3abf..6537794eb 100644 --- a/modules/ui/fields/address.js +++ b/modules/ui/fields/address.js @@ -146,11 +146,26 @@ export function uiFieldAddress(field, context) { } } - var dropdowns = addressFormat.dropdowns || [ - 'city', 'county', 'country', 'district', 'hamlet', - 'neighbourhood', 'place', 'postcode', 'province', - 'quarter', 'state', 'street', 'street+place', 'subdistrict', 'suburb' - ]; + const dropdowns = new Set([ + 'block_number', + 'city', + 'country', + 'county', + 'district', + 'floor', + 'hamlet', + 'neighbourhood', + 'place', + 'postcode', + 'province', + 'quarter', + 'state', + 'street', + 'street+place', + 'subdistrict', + 'suburb', + 'town' + ]); var widths = addressFormat.widths || { housenumber: 1/5, unit: 1/5, street: 1/2, place: 1/2, @@ -196,7 +211,7 @@ export function uiFieldAddress(field, context) { function addDropdown(d) { - if (dropdowns.indexOf(d.id) === -1) return; // not a dropdown + if (!dropdowns.has(d.id)) return; // not a dropdown var nearValues; switch (d.id) {