mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
don't select option on ambiguous multi-key radio fields
this matches the behaviour of a multi-selection: all matching options are still highlighted, but the radio-option is not set. also fixes a minor bug with multi-selections not taking `<key> = no` properly into account closes #8796
This commit is contained in:
2
dist/locales/en.min.json
vendored
2
dist/locales/en.min.json
vendored
File diff suppressed because one or more lines are too long
@@ -265,13 +265,12 @@ export function uiFieldRadio(field, context) {
|
||||
|
||||
|
||||
radio.tags = function(tags) {
|
||||
|
||||
radios.property('checked', function(d) {
|
||||
function isOptionChecked(d) {
|
||||
if (field.key) {
|
||||
return tags[field.key] === d;
|
||||
}
|
||||
return !!(typeof tags[d] === 'string' && tags[d].toLowerCase() !== 'no');
|
||||
});
|
||||
}
|
||||
|
||||
function isMixed(d) {
|
||||
if (field.key) {
|
||||
@@ -280,13 +279,19 @@ export function uiFieldRadio(field, context) {
|
||||
return Array.isArray(tags[d]);
|
||||
}
|
||||
|
||||
radios.property('checked', function(d) {
|
||||
return isOptionChecked(d) &&
|
||||
(field.key || field.options.filter(isOptionChecked).length === 1);
|
||||
});
|
||||
|
||||
labels
|
||||
.classed('active', function(d) {
|
||||
if (field.key) {
|
||||
return (Array.isArray(tags[field.key]) && tags[field.key].includes(d))
|
||||
|| tags[field.key] === d;
|
||||
}
|
||||
return Array.isArray(tags[d]) || !!(tags[d] && tags[d].toLowerCase() !== 'no');
|
||||
return Array.isArray(tags[d]) && tags[d].some(v => typeof v === 'string' && v.toLowerCase() !== 'no') ||
|
||||
!!(typeof tags[d] === 'string' && tags[d].toLowerCase() !== 'no');
|
||||
})
|
||||
.classed('mixed', isMixed)
|
||||
.attr('title', function(d) {
|
||||
|
||||
Reference in New Issue
Block a user