Support radio fields during multiselections

This commit is contained in:
Quincy Morgan
2020-01-31 13:02:30 -05:00
parent 8d9adbd902
commit af928e3dc1
2 changed files with 22 additions and 8 deletions
+3
View File
@@ -1767,6 +1767,9 @@ a.hide-toggle {
color: #7092ff;
cursor: pointer;
}
.form-field-input-radio > label.mixed {
font-style: italic;
}
.form-field-input-radio > label:last-child {
border-radius: 0 0 4px 4px;
}
+19 -8
View File
@@ -264,16 +264,29 @@ export function uiFieldRadio(field, context) {
radio.tags = function(tags) {
function checked(d) {
radios.property('checked', function(d) {
if (field.key) {
return tags[field.key] === d;
} else {
return !!(tags[d] && tags[d].toLowerCase() !== 'no');
}
}
return !!(typeof tags[d] === 'string' && tags[d].toLowerCase() !== 'no');
});
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');
})
.classed('mixed', function(d) {
if (field.key) {
return Array.isArray(tags[field.key]) && tags[field.key].includes(d);
}
return Array.isArray(tags[d]);
});
labels.classed('active', checked);
radios.property('checked', checked);
var selection = radios.filter(function() { return this.checked; });
@@ -316,5 +329,3 @@ export function uiFieldRadio(field, context) {
return utilRebind(radio, dispatch, 'on');
}
uiFieldRadio.supportsMultiselection = false;