mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
ux(): tweak to help popover annimation and fixed pull-right state
This commit is contained in:
@@ -1,60 +0,0 @@
|
|||||||
define([
|
|
||||||
'angular',
|
|
||||||
'lodash',
|
|
||||||
'jquery',
|
|
||||||
'../core_module',
|
|
||||||
],
|
|
||||||
function (angular, _, $, coreModule) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
coreModule.default.service('popoverSrv', function($templateCache, $timeout, $q, $http, $compile) {
|
|
||||||
|
|
||||||
this.getTemplate = function(url) {
|
|
||||||
return $q.when($templateCache.get(url) || $http.get(url, {cache: true}));
|
|
||||||
};
|
|
||||||
|
|
||||||
this.show = function(options) {
|
|
||||||
var popover;
|
|
||||||
|
|
||||||
// hide other popovers
|
|
||||||
$('.popover').each(function() {
|
|
||||||
popover = $(this).prev().data('popover');
|
|
||||||
if (popover) {
|
|
||||||
popover.scope.$destroy();
|
|
||||||
popover.destroy();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
options.scope.dismiss = function() {
|
|
||||||
popover = options.element.data('popover');
|
|
||||||
if (popover) {
|
|
||||||
popover.destroy();
|
|
||||||
}
|
|
||||||
options.scope.$destroy();
|
|
||||||
};
|
|
||||||
|
|
||||||
this.getTemplate(options.templateUrl).then(function(result) {
|
|
||||||
$timeout(function() {
|
|
||||||
var template = _.isString(result) ? result : result.data;
|
|
||||||
|
|
||||||
options.element.popover({
|
|
||||||
content: template,
|
|
||||||
placement: options.placement || 'bottom',
|
|
||||||
html: true
|
|
||||||
});
|
|
||||||
|
|
||||||
popover = options.element.data('popover');
|
|
||||||
popover.hasContent = function () {
|
|
||||||
return template;
|
|
||||||
};
|
|
||||||
|
|
||||||
popover.toggle();
|
|
||||||
popover.scope = options.scope;
|
|
||||||
$compile(popover.$tip)(popover.scope);
|
|
||||||
}, 1);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
49
public/app/core/services/popover_srv.ts
Normal file
49
public/app/core/services/popover_srv.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
///<reference path="../../headers/common.d.ts" />
|
||||||
|
|
||||||
|
import config from 'app/core/config';
|
||||||
|
import _ from 'lodash';
|
||||||
|
import $ from 'jquery';
|
||||||
|
import coreModule from 'app/core/core_module';
|
||||||
|
|
||||||
|
/** @ngInject **/
|
||||||
|
function popoverSrv($templateCache, $timeout, $q, $http, $compile) {
|
||||||
|
|
||||||
|
this.getTemplate = function(url) {
|
||||||
|
return $q.when($templateCache.get(url) || $http.get(url, {cache: true}));
|
||||||
|
};
|
||||||
|
|
||||||
|
this.show = function(options) {
|
||||||
|
|
||||||
|
options.scope.dismiss = function() {
|
||||||
|
var popover = options.element.data('popover');
|
||||||
|
if (popover) {
|
||||||
|
popover.destroy();
|
||||||
|
}
|
||||||
|
options.scope.$destroy();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getTemplate(options.templateUrl).then(function(result) {
|
||||||
|
$timeout(function() {
|
||||||
|
var template = _.isString(result) ? result : result.data;
|
||||||
|
|
||||||
|
|
||||||
|
options.element.popover({
|
||||||
|
content: template,
|
||||||
|
placement: options.placement || 'bottom',
|
||||||
|
html: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var popover = options.element.data('popover');
|
||||||
|
popover.hasContent = function () {
|
||||||
|
return template;
|
||||||
|
};
|
||||||
|
|
||||||
|
popover.toggle();
|
||||||
|
popover.scope = options.scope;
|
||||||
|
$compile(popover.$tip)(popover.scope);
|
||||||
|
}, 1);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
coreModule.service('popoverSrv', popoverSrv);
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
<div class="graph-legend-popover">
|
<div class="graph-legend-popover">
|
||||||
<a class="close" ng-click="dismiss();" href="">×</a>
|
<a class="close" ng-click="dismiss();" href="">×</a>
|
||||||
|
|
||||||
<div class="editor-row small" style="padding-bottom: 0;">
|
<div class="editor-row" style="padding-bottom: 0;">
|
||||||
<label>Axis:</label>
|
<label>Axis:</label>
|
||||||
<button ng-click="ctrl.toggleYAxis(series);dismiss();"
|
<button ng-click="ctrl.toggleYAxis(series);dismiss();"
|
||||||
class="btn btn-mini"
|
class="btn btn-small"
|
||||||
ng-class="{'btn-success': series.yaxis === 1 }">
|
ng-class="{'btn-success': series.yaxis === 1, 'btn-inverse': series.yaxis === 2}">
|
||||||
Left
|
Left
|
||||||
</button>
|
</button>
|
||||||
<button ng-click="ctrl.toggleYAxis(series);dismiss();"
|
<button ng-click="ctrl.toggleYAxis(series);dismiss();"
|
||||||
class="btn btn-mini"
|
class="btn btn-small"
|
||||||
ng-class="{'btn-success': series.yaxis === 2 }">
|
ng-class="{'btn-success': series.yaxis === 2, 'btn-inverse': series.yaxis === 1}">
|
||||||
Right
|
Right
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,12 +3,13 @@ $color: inherit;
|
|||||||
$backgroundColor: $btn-secondary-bg;
|
$backgroundColor: $btn-secondary-bg;
|
||||||
$color: $text-color;
|
$color: $text-color;
|
||||||
$useDropShadow: false;
|
$useDropShadow: false;
|
||||||
$attachmentOffset: $popover-arrow-size;
|
$attachmentOffset: 0%;
|
||||||
$easing: cubic-bezier(0, 0, 0.265, 1.55);
|
$easing: cubic-bezier(0, 0, 0.265, 1.00);
|
||||||
|
|
||||||
.drop-element {
|
.drop-element {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: none;
|
display: none;
|
||||||
|
opacity: 0;
|
||||||
|
|
||||||
&.drop-open {
|
&.drop-open {
|
||||||
display: block;
|
display: block;
|
||||||
@@ -26,3 +27,4 @@ $easing: cubic-bezier(0, 0, 0.265, 1.55);
|
|||||||
|
|
||||||
@include drop-theme("help", $popover-help-bg, $popover-help-color);
|
@include drop-theme("help", $popover-help-bg, $popover-help-color);
|
||||||
@include drop-animation-scale("drop", "help", $attachmentOffset: $attachmentOffset, $easing: $easing);
|
@include drop-animation-scale("drop", "help", $attachmentOffset: $attachmentOffset, $easing: $easing);
|
||||||
|
|
||||||
|
|||||||
@@ -213,7 +213,7 @@
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
.#{$themePrefix}-content {
|
.#{$themePrefix}-content {
|
||||||
transition: transform 0.2s $easing;
|
transition: transform 0.2s $easing;
|
||||||
transform: scale(0) translateZ(0);
|
transform: scale(0.8) translateZ(0);
|
||||||
}
|
}
|
||||||
&.#{$themePrefix}-open {
|
&.#{$themePrefix}-open {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ button.close {
|
|||||||
|
|
||||||
// Quick floats
|
// Quick floats
|
||||||
.pull-right {
|
.pull-right {
|
||||||
float: right;
|
float: right !important;
|
||||||
}
|
}
|
||||||
.pull-left {
|
.pull-left {
|
||||||
float: left;
|
float: left !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggling content
|
// Toggling content
|
||||||
|
|||||||
Reference in New Issue
Block a user