Add tooltips to mixed values in semicombo, multicombo, and radio fields

This commit is contained in:
Quincy Morgan
2020-01-31 14:07:16 -05:00
parent af928e3dc1
commit 2783408fc3
4 changed files with 15 additions and 5 deletions
+1
View File
@@ -555,6 +555,7 @@ en:
key_value: "key=value"
multiple_values: Multiple Values
multiple_types: Multiple Types
unshared_value_tooltip: not shared by all features
hidden_preset:
manual: "{features} are hidden. Enable them in the Map Data pane."
zoom: "{features} are hidden. Zoom in to enable them."
+1
View File
@@ -694,6 +694,7 @@
"key_value": "key=value",
"multiple_values": "Multiple Values",
"multiple_types": "Multiple Types",
"unshared_value_tooltip": "not shared by all features",
"hidden_preset": {
"manual": "{features} are hidden. Enable them in the Map Data pane.",
"zoom": "{features} are hidden. Zoom in to enable them."
+3
View File
@@ -526,6 +526,9 @@ export function uiFieldCombo(field, context) {
.classed('draggable', allowDragAndDrop)
.classed('mixed', function(d) {
return d.isMixed;
})
.attr('title', function(d) {
return d.isMixed ? t('inspector.unshared_value_tooltip') : null;
});
if (allowDragAndDrop) {
+10 -5
View File
@@ -272,6 +272,13 @@ export function uiFieldRadio(field, context) {
return !!(typeof tags[d] === 'string' && tags[d].toLowerCase() !== 'no');
});
function isMixed(d) {
if (field.key) {
return Array.isArray(tags[field.key]) && tags[field.key].includes(d);
}
return Array.isArray(tags[d]);
}
labels
.classed('active', function(d) {
if (field.key) {
@@ -280,11 +287,9 @@ export function uiFieldRadio(field, context) {
}
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]);
.classed('mixed', isMixed)
.attr('title', function(d) {
return isMixed(d) ? t('inspector.unshared_value_tooltip') : null;
});