mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-01 04:31:36 +02:00
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:
+10
-11
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user