fix hiding of "Add" input on comboboxes with fixed options

the check for this needs to be done after the available options are actually refreshed
This commit is contained in:
Martin Raifer
2023-05-02 14:04:22 +02:00
parent 24e514fa99
commit 140e56768e
2 changed files with 11 additions and 11 deletions
+1
View File
@@ -44,6 +44,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
#### :white_check_mark: Validation
#### :bug: Bugfixes
* Fix `multi/many/semiCombo` options for not being selectable immediately after removing them for fields with predefined options
* Fix a bug where the _Add_ input element on comboboxes with a fixed set of allowed options is still hidden after an option of a previously "fully saturated" field is removed
#### :earth_asia: Localization
* Send `Accept-Language` header on Nominatim API calls ([#9501], thanks [@k-yle])
* Add Address and Phone Format for India ([#9482], thanks [@biswajit-k])
+10 -11
View File
@@ -325,6 +325,12 @@ export function uiFieldCombo(field, context) {
_container.selectAll('input')
.attr('placeholder', ph);
// Hide 'Add' button if this field uses fixed set of
// options and they're all currently used
var hideAdd = (!_allowCustomValues && !values.length);
_container.selectAll('.chiplist .input-wrap')
.style('display', hideAdd ? 'none' : null);
}
@@ -610,20 +616,13 @@ export function uiFieldCombo(field, context) {
// a negative maxlength doesn't make sense
maxLength = Math.max(0, maxLength);
var allowDragAndDrop = _isSemi // only semiCombo values are ordered
&& !Array.isArray(tags[field.key]);
// Exclude existing multikeys from combo options..
var available = objectDifference(_comboData, _multiData);
_combobox.data(available);
// Hide 'Add' button if this field uses fixed set of
// options and they're all currently used,
// or if the field is already at its character limit
var hideAdd = (!_allowCustomValues && !available.length) || maxLength <= 0;
// Hide 'Add' button if this field is already at its character limit
var hideAdd = maxLength <= 0;
_container.selectAll('.chiplist .input-wrap')
.style('display', hideAdd ? 'none' : null);
var allowDragAndDrop = _isSemi // only semiCombo values are ordered
&& !Array.isArray(tags[field.key]);
// Render chips
var chips = _container.selectAll('.chip')