mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
ux(): tooltip improvement
This commit is contained in:
@@ -8,21 +8,30 @@ import Drop from 'tether-drop';
|
||||
export function infoPopover() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: '<i class="fa fa-info-circle"></i>',
|
||||
transclude: true,
|
||||
link: function(scope, elem, attrs, ctrl, transclude) {
|
||||
var inputElem = elem.prev();
|
||||
if (inputElem.length === 0) {
|
||||
console.log('Failed to find input element for popover');
|
||||
return;
|
||||
}
|
||||
// var inputElem = elem.prev();
|
||||
// if (inputElem.length === 0) {
|
||||
// console.log('Failed to find input element for popover');
|
||||
// return;
|
||||
// }
|
||||
|
||||
var offset = attrs.offset || '0 -10px';
|
||||
var position = attrs.position || 'right middle';
|
||||
var classes = 'drop-help drop-hide-out-of-bounds';
|
||||
var openOn = 'hover';
|
||||
|
||||
elem.addClass('gf-form-help-icon');
|
||||
|
||||
if (attrs.wide) {
|
||||
classes += ' drop-wide';
|
||||
}
|
||||
|
||||
if (attrs.mode) {
|
||||
elem.addClass('gf-form-help-icon--' + attrs.mode);
|
||||
}
|
||||
|
||||
transclude(function(clone, newScope) {
|
||||
var content = document.createElement("div");
|
||||
_.each(clone, (node) => {
|
||||
@@ -30,11 +39,11 @@ export function infoPopover() {
|
||||
});
|
||||
|
||||
var drop = new Drop({
|
||||
target: inputElem[0],
|
||||
target: elem[0],
|
||||
content: content,
|
||||
position: position,
|
||||
classes: classes,
|
||||
openOn: 'click',
|
||||
openOn: openOn,
|
||||
tetherOptions: {
|
||||
offset: offset
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user