feat(tooltip): remove deprecated code
BREAKING CHANGE: Remove deprecated non-prefixed directives Close #4713
This commit is contained in:
+3
-81
@@ -10,10 +10,7 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])
|
||||
replace: true,
|
||||
scope: { title: '@', contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&',
|
||||
originScope: '&' },
|
||||
templateUrl: 'template/popover/popover-template.html',
|
||||
link: function(scope, element) {
|
||||
element.addClass('popover');
|
||||
}
|
||||
templateUrl: 'template/popover/popover-template.html'
|
||||
};
|
||||
})
|
||||
|
||||
@@ -27,10 +24,7 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])
|
||||
return {
|
||||
replace: true,
|
||||
scope: { contentExp: '&', title: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
|
||||
templateUrl: 'template/popover/popover-html.html',
|
||||
link: function(scope, element) {
|
||||
element.addClass('popover');
|
||||
}
|
||||
templateUrl: 'template/popover/popover-html.html'
|
||||
};
|
||||
})
|
||||
|
||||
@@ -44,82 +38,10 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])
|
||||
return {
|
||||
replace: true,
|
||||
scope: { title: '@', content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
|
||||
templateUrl: 'template/popover/popover.html',
|
||||
link: function(scope, element) {
|
||||
element.addClass('popover');
|
||||
}
|
||||
templateUrl: 'template/popover/popover.html'
|
||||
};
|
||||
})
|
||||
|
||||
.directive('uibPopover', ['$uibTooltip', function($uibTooltip) {
|
||||
return $uibTooltip('uibPopover', 'popover', 'click');
|
||||
}]);
|
||||
|
||||
/* Deprecated popover below */
|
||||
|
||||
angular.module('ui.bootstrap.popover')
|
||||
|
||||
.value('$popoverSuppressWarning', false)
|
||||
|
||||
.directive('popoverTemplatePopup', ['$log', '$popoverSuppressWarning', function($log, $popoverSuppressWarning) {
|
||||
return {
|
||||
replace: true,
|
||||
scope: { title: '@', contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&',
|
||||
originScope: '&' },
|
||||
templateUrl: 'template/popover/popover-template.html',
|
||||
link: function(scope, element) {
|
||||
if (!$popoverSuppressWarning) {
|
||||
$log.warn('popover-template-popup is now deprecated. Use uib-popover-template-popup instead.');
|
||||
}
|
||||
|
||||
element.addClass('popover');
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
.directive('popoverTemplate', ['$tooltip', function($tooltip) {
|
||||
return $tooltip('popoverTemplate', 'popover', 'click', {
|
||||
useContentExp: true
|
||||
});
|
||||
}])
|
||||
|
||||
.directive('popoverHtmlPopup', ['$log', '$popoverSuppressWarning', function($log, $popoverSuppressWarning) {
|
||||
return {
|
||||
replace: true,
|
||||
scope: { contentExp: '&', title: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
|
||||
templateUrl: 'template/popover/popover-html.html',
|
||||
link: function(scope, element) {
|
||||
if (!$popoverSuppressWarning) {
|
||||
$log.warn('popover-html-popup is now deprecated. Use uib-popover-html-popup instead.');
|
||||
}
|
||||
|
||||
element.addClass('popover');
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
.directive('popoverHtml', ['$tooltip', function($tooltip) {
|
||||
return $tooltip('popoverHtml', 'popover', 'click', {
|
||||
useContentExp: true
|
||||
});
|
||||
}])
|
||||
|
||||
.directive('popoverPopup', ['$log', '$popoverSuppressWarning', function($log, $popoverSuppressWarning) {
|
||||
return {
|
||||
replace: true,
|
||||
scope: { title: '@', content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
|
||||
templateUrl: 'template/popover/popover.html',
|
||||
link: function(scope, element) {
|
||||
if (!$popoverSuppressWarning) {
|
||||
$log.warn('popover-popup is now deprecated. Use uib-popover-popup instead.');
|
||||
}
|
||||
|
||||
element.addClass('popover');
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
.directive('popover', ['$tooltip', function($tooltip) {
|
||||
|
||||
return $tooltip('popover', 'popover', 'click');
|
||||
}]);
|
||||
|
||||
@@ -187,64 +187,3 @@ describe('popover', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* Deprecation tests below */
|
||||
|
||||
describe('popover deprecation', function() {
|
||||
beforeEach(module('ui.bootstrap.popover'));
|
||||
beforeEach(module('template/popover/popover-html.html'));
|
||||
|
||||
var elm, elmBody, elmScope, tooltipScope;
|
||||
|
||||
function trigger(element, evt) {
|
||||
evt = new Event(evt);
|
||||
|
||||
element[0].dispatchEvent(evt);
|
||||
element.scope().$$childTail.$digest();
|
||||
}
|
||||
|
||||
it('should suppress warning', function() {
|
||||
module(function($provide) {
|
||||
$provide.value('$popoverSuppressWarning', true);
|
||||
$provide.value('$tooltipSuppressWarning', true);
|
||||
});
|
||||
|
||||
inject(function($compile, $log, $rootScope, $sce) {
|
||||
spyOn($log, 'warn');
|
||||
|
||||
$rootScope.html = 'I say: <strong class="hello">Hello!</strong>';
|
||||
$rootScope.safeHtml = $sce.trustAsHtml($rootScope.html);
|
||||
elmBody = angular.element('<div><span popover-html="safeHtml">Selector Text</span></div>');
|
||||
$compile(elmBody)($rootScope);
|
||||
$rootScope.$digest();
|
||||
elm = elmBody.find('span');
|
||||
elmScope = elm.scope();
|
||||
tooltipScope = elmScope.$$childTail;
|
||||
|
||||
trigger(elm, 'mouseenter');
|
||||
tooltipScope.$digest();
|
||||
|
||||
expect($log.warn.calls.count()).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('should give warning by default', inject(function($compile, $log, $rootScope, $sce) {
|
||||
spyOn($log, 'warn');
|
||||
|
||||
$rootScope.html = 'I say: <strong class="hello">Hello!</strong>';
|
||||
$rootScope.safeHtml = $sce.trustAsHtml($rootScope.html);
|
||||
elmBody = angular.element('<div><span popover-html="safeHtml">Selector Text</span></div>');
|
||||
$compile(elmBody)($rootScope);
|
||||
$rootScope.$digest();
|
||||
elm = elmBody.find('span');
|
||||
elmScope = elm.scope();
|
||||
tooltipScope = elmScope.$$childTail;
|
||||
|
||||
elm.trigger('click');
|
||||
tooltipScope.$digest();
|
||||
|
||||
expect($log.warn.calls.count()).toBe(2);
|
||||
expect($log.warn.calls.argsFor(0)).toEqual(['$tooltip is now deprecated. Use $uibTooltip instead.']);
|
||||
expect($log.warn.calls.argsFor(1)).toEqual(['popover-html-popup is now deprecated. Use uib-popover-html-popup instead.']);
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -125,56 +125,3 @@ describe('popover template', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* Deprecation tests below */
|
||||
|
||||
describe('popover template deprecation', function() {
|
||||
beforeEach(module('ui.bootstrap.popover'));
|
||||
beforeEach(module('template/popover/popover.html'));
|
||||
beforeEach(module('template/popover/popover-template.html'));
|
||||
|
||||
var elm, elmBody, elmScope, tooltipScope;
|
||||
|
||||
it('should suppress warning', function() {
|
||||
module(function($provide) {
|
||||
$provide.value('$popoverSuppressWarning', true);
|
||||
$provide.value('$tooltipSuppressWarning', true);
|
||||
});
|
||||
|
||||
inject(function($compile, $log, $rootScope, $templateCache) {
|
||||
spyOn($log, 'warn');
|
||||
$templateCache.put('myUrl', [200, '<span>{{ myTemplateText }}</span>', {}]);
|
||||
$rootScope.templateUrl = 'myUrl';
|
||||
|
||||
elmBody = angular.element('<div><span popover-template="templateUrl">Selector Text</span></div>');
|
||||
$compile(elmBody)($rootScope);
|
||||
$rootScope.$digest();
|
||||
elm = elmBody.find('span');
|
||||
elmScope = elm.scope();
|
||||
tooltipScope = elmScope.$$childTail;
|
||||
|
||||
elm.trigger('click');
|
||||
tooltipScope.$digest();
|
||||
expect($log.warn.calls.count()).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('should give warning by default', inject(function($compile, $log, $rootScope, $templateCache) {
|
||||
spyOn($log, 'warn');
|
||||
$templateCache.put('myUrl', [200, '<span>{{ myTemplateText }}</span>', {}]);
|
||||
$rootScope.templateUrl = 'myUrl';
|
||||
|
||||
elmBody = angular.element('<div><span popover-template="templateUrl">Selector Text</span></div>');
|
||||
$compile(elmBody)($rootScope);
|
||||
elm = elmBody.find('span');
|
||||
elmScope = elm.scope();
|
||||
tooltipScope = elmScope.$$childTail;
|
||||
|
||||
elm.trigger('click');
|
||||
tooltipScope.$digest();
|
||||
|
||||
expect($log.warn.calls.count()).toBe(2);
|
||||
expect($log.warn.calls.argsFor(0)).toEqual(['$tooltip is now deprecated. Use $uibTooltip instead.']);
|
||||
expect($log.warn.calls.argsFor(1)).toEqual(['popover-template-popup is now deprecated. Use uib-popover-template-popup instead.']);
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -174,53 +174,3 @@ describe('popover', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* Deprecation tests below */
|
||||
|
||||
describe('popover deprecation', function() {
|
||||
beforeEach(module('ui.bootstrap.popover'));
|
||||
beforeEach(module('template/popover/popover.html'));
|
||||
|
||||
var elm, elmBody, elmScope, tooltipScope;
|
||||
|
||||
it('should suppress warning', function() {
|
||||
module(function($provide) {
|
||||
$provide.value('$popoverSuppressWarning', true);
|
||||
$provide.value('$tooltipSuppressWarning', true);
|
||||
});
|
||||
|
||||
inject(function($compile, $log, $rootScope) {
|
||||
spyOn($log, 'warn');
|
||||
|
||||
elmBody = angular.element('<div><span popover="popover text">Selector Text</span></div>');
|
||||
$compile(elmBody)($rootScope);
|
||||
$rootScope.$digest();
|
||||
elm = elmBody.find('span');
|
||||
elmScope = elm.scope();
|
||||
tooltipScope = elmScope.$$childTail;
|
||||
|
||||
elm.trigger('click');
|
||||
tooltipScope.$digest();
|
||||
|
||||
expect($log.warn.calls.count()).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('should give warning by default', inject(function($compile, $log, $rootScope) {
|
||||
spyOn($log, 'warn');
|
||||
|
||||
elmBody = angular.element('<div><span popover="popover text">Selector Text</span></div>');
|
||||
$compile(elmBody)($rootScope);
|
||||
$rootScope.$digest();
|
||||
elm = elmBody.find('span');
|
||||
elmScope = elm.scope();
|
||||
tooltipScope = elmScope.$$childTail;
|
||||
|
||||
elm.trigger('click');
|
||||
tooltipScope.$digest();
|
||||
|
||||
expect($log.warn.calls.count()).toBe(2);
|
||||
expect($log.warn.calls.argsFor(0)).toEqual(['$tooltip is now deprecated. Use $uibTooltip instead.']);
|
||||
expect($log.warn.calls.argsFor(1)).toEqual(['popover-popup is now deprecated. Use uib-popover-popup instead.']);
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -82,65 +82,3 @@ describe('tooltip template', function() {
|
||||
expect(elmBody.children().length).toBe(1);
|
||||
}));
|
||||
});
|
||||
|
||||
/* Deprecation tests below */
|
||||
|
||||
describe('tooltip template deprecation', function() {
|
||||
beforeEach(module('ui.bootstrap.tooltip'));
|
||||
beforeEach(module('template/tooltip/tooltip-template-popup.html'));
|
||||
|
||||
var elm, elmBody, elmScope, tooltipScope;
|
||||
|
||||
function trigger(element, evt) {
|
||||
evt = new Event(evt);
|
||||
|
||||
element[0].dispatchEvent(evt);
|
||||
element.scope().$$childTail.$digest();
|
||||
}
|
||||
|
||||
it('should suppress warning', function() {
|
||||
module(function($provide) {
|
||||
$provide.value('$tooltipSuppressWarning', true);
|
||||
});
|
||||
|
||||
inject(function($compile, $log, $rootScope, $templateCache) {
|
||||
spyOn($log, 'warn');
|
||||
$templateCache.put('myUrl', [200, '<span>{{ myTemplateText }}</span>', {}]);
|
||||
$rootScope.templateUrl = 'myUrl';
|
||||
|
||||
elmBody = angular.element('<div><span tooltip-template="templateUrl">Selector Text</span></div>');
|
||||
$compile(elmBody)($rootScope);
|
||||
$rootScope.$digest();
|
||||
elm = elmBody.find('span');
|
||||
elmScope = elm.scope();
|
||||
tooltipScope = elmScope.$$childTail;
|
||||
|
||||
trigger(elm, 'mouseenter');
|
||||
|
||||
expect($log.warn.calls.count()).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('should give warning by default', inject(function($compile, $log, $rootScope, $templateCache) {
|
||||
spyOn($log, 'warn');
|
||||
$templateCache.put('myUrl', [200, '<span>{{ myTemplateText }}</span>', {}]);
|
||||
$rootScope.templateUrl = 'myUrl';
|
||||
|
||||
var element = '<div><span tooltip-template="templateUrl">Selector Text</span></div>';
|
||||
element = $compile(element)($rootScope);
|
||||
$rootScope.$digest();
|
||||
|
||||
elmBody = angular.element('<div><span tooltip-template="templateUrl">Selector Text</span></div>');
|
||||
$compile(elmBody)($rootScope);
|
||||
$rootScope.$digest();
|
||||
elm = elmBody.find('span');
|
||||
elmScope = elm.scope();
|
||||
tooltipScope = elmScope.$$childTail;
|
||||
|
||||
trigger(elm, 'mouseenter');
|
||||
|
||||
expect($log.warn.calls.count()).toBe(2);
|
||||
expect($log.warn.calls.argsFor(0)).toEqual(['$tooltip is now deprecated. Use $uibTooltip instead.']);
|
||||
expect($log.warn.calls.argsFor(1)).toEqual(['tooltip-template-popup is now deprecated. Use uib-tooltip-template-popup instead.']);
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -745,8 +745,8 @@ describe('tooltip positioning', function() {
|
||||
var $position;
|
||||
|
||||
// load the tooltip code
|
||||
beforeEach(module('ui.bootstrap.tooltip', function($tooltipProvider) {
|
||||
$tooltipProvider.options({ animation: false });
|
||||
beforeEach(module('ui.bootstrap.tooltip', function($uibTooltipProvider) {
|
||||
$uibTooltipProvider.options({ animation: false });
|
||||
}));
|
||||
|
||||
// load the template
|
||||
@@ -805,8 +805,8 @@ describe('tooltipHtml', function() {
|
||||
var elm, elmBody, elmScope, tooltipScope, scope;
|
||||
|
||||
// load the tooltip code
|
||||
beforeEach(module('ui.bootstrap.tooltip', function($tooltipProvider) {
|
||||
$tooltipProvider.options({ animation: false });
|
||||
beforeEach(module('ui.bootstrap.tooltip', function($uibTooltipProvider) {
|
||||
$uibTooltipProvider.options({ animation: false });
|
||||
}));
|
||||
|
||||
// load the template
|
||||
@@ -860,7 +860,7 @@ describe('tooltipHtml', function() {
|
||||
}));
|
||||
});
|
||||
|
||||
describe('$tooltipProvider', function() {
|
||||
describe('$uibTooltipProvider', function() {
|
||||
var elm,
|
||||
elmBody,
|
||||
scope,
|
||||
@@ -875,8 +875,8 @@ describe('$tooltipProvider', function() {
|
||||
}
|
||||
|
||||
describe('popupDelay', function() {
|
||||
beforeEach(module('ui.bootstrap.tooltip', function($tooltipProvider) {
|
||||
$tooltipProvider.options({popupDelay: 1000});
|
||||
beforeEach(module('ui.bootstrap.tooltip', function($uibTooltipProvider) {
|
||||
$uibTooltipProvider.options({popupDelay: 1000});
|
||||
}));
|
||||
|
||||
// load the template
|
||||
@@ -908,8 +908,8 @@ describe('$tooltipProvider', function() {
|
||||
var $body;
|
||||
|
||||
beforeEach(module('template/tooltip/tooltip-popup.html'));
|
||||
beforeEach(module('ui.bootstrap.tooltip', function($tooltipProvider) {
|
||||
$tooltipProvider.options({ appendToBody: true });
|
||||
beforeEach(module('ui.bootstrap.tooltip', function($uibTooltipProvider) {
|
||||
$uibTooltipProvider.options({ appendToBody: true });
|
||||
}));
|
||||
|
||||
afterEach(function() {
|
||||
|
||||
@@ -188,95 +188,3 @@ describe('tooltip directive', function() {
|
||||
expect(fragment).not.toHaveOpenTooltips();
|
||||
});
|
||||
});
|
||||
|
||||
/* Deprecation tests below */
|
||||
|
||||
describe('tooltip deprecation', function() {
|
||||
beforeEach(module('ui.bootstrap.tooltip'));
|
||||
beforeEach(module('template/tooltip/tooltip-popup.html'));
|
||||
beforeEach(module('template/tooltip/tooltip-template-popup.html'));
|
||||
beforeEach(module('template/tooltip/tooltip-html-popup.html'));
|
||||
|
||||
describe('tooltip', function() {
|
||||
it('should suppress warning', function() {
|
||||
module(function($provide) {
|
||||
$provide.value('$tooltipSuppressWarning', true);
|
||||
});
|
||||
|
||||
inject(function($compile, $log, $rootScope) {
|
||||
spyOn($log, 'warn');
|
||||
|
||||
var element = '<div><span tooltip="tooltip text">Trigger here</span></div>';
|
||||
element = $compile(element)($rootScope);
|
||||
$rootScope.$digest();
|
||||
expect($log.warn.calls.count()).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('should give warning by default', inject(function($compile, $log, $rootScope) {
|
||||
spyOn($log, 'warn');
|
||||
|
||||
var element = '<div><span tooltip="tooltip text">Trigger here</span></div>';
|
||||
element = $compile(element)($rootScope);
|
||||
$rootScope.$digest();
|
||||
|
||||
expect($log.warn.calls.count()).toBe(1);
|
||||
expect($log.warn.calls.argsFor(0)).toEqual(['$tooltip is now deprecated. Use $uibTooltip instead.']);
|
||||
}));
|
||||
});
|
||||
|
||||
describe('tooltip html', function() {
|
||||
var elm, elmBody, elmScope, tooltipScope;
|
||||
|
||||
function trigger(element, evt) {
|
||||
evt = new Event(evt);
|
||||
|
||||
element[0].dispatchEvent(evt);
|
||||
element.scope().$$childTail.$digest();
|
||||
}
|
||||
|
||||
it('should suppress warning', function() {
|
||||
module(function($provide) {
|
||||
$provide.value('$tooltipSuppressWarning', true);
|
||||
});
|
||||
|
||||
inject(function($compile, $log, $rootScope, $sce) {
|
||||
spyOn($log, 'warn');
|
||||
|
||||
$rootScope.html = 'I say: <strong class="hello">Hello!</strong>';
|
||||
$rootScope.safeHtml = $sce.trustAsHtml($rootScope.html);
|
||||
elmBody = angular.element('<div><span tooltip-html="safeHtml">Selector Text</span></div>');
|
||||
$compile(elmBody)($rootScope);
|
||||
$rootScope.$digest();
|
||||
elm = elmBody.find('span');
|
||||
elmScope = elm.scope();
|
||||
tooltipScope = elmScope.$$childTail;
|
||||
|
||||
trigger(elm, 'mouseenter');
|
||||
tooltipScope.$digest();
|
||||
|
||||
expect($log.warn.calls.count()).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('should give warning by default', inject(function($compile, $log, $rootScope, $sce) {
|
||||
spyOn($log, 'warn');
|
||||
|
||||
$rootScope.html = 'I say: <strong class="hello">Hello!</strong>';
|
||||
$rootScope.safeHtml = $sce.trustAsHtml($rootScope.html);
|
||||
elmBody = angular.element('<div><span tooltip-html="safeHtml">Selector Text</span></div>');
|
||||
$compile(elmBody)($rootScope);
|
||||
$rootScope.$digest();
|
||||
elm = elmBody.find('span');
|
||||
elmScope = elm.scope();
|
||||
tooltipScope = elmScope.$$childTail;
|
||||
|
||||
trigger(elm, 'mouseenter');
|
||||
tooltipScope.$digest();
|
||||
|
||||
expect($log.warn.calls.count()).toBe(2);
|
||||
expect($log.warn.calls.argsFor(0)).toEqual(['$tooltip is now deprecated. Use $uibTooltip instead.']);
|
||||
expect($log.warn.calls.argsFor(1)).toEqual(['tooltip-html-popup is now deprecated. Use uib-tooltip-html-popup instead.']);
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
+3
-185
@@ -613,10 +613,7 @@ function ($animate , $sce , $compile , $templateRequest) {
|
||||
return {
|
||||
replace: true,
|
||||
scope: { content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
|
||||
templateUrl: 'template/tooltip/tooltip-popup.html',
|
||||
link: function(scope, element) {
|
||||
element.addClass('tooltip');
|
||||
}
|
||||
templateUrl: 'template/tooltip/tooltip-popup.html'
|
||||
};
|
||||
})
|
||||
|
||||
@@ -629,10 +626,7 @@ function ($animate , $sce , $compile , $templateRequest) {
|
||||
replace: true,
|
||||
scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&',
|
||||
originScope: '&' },
|
||||
templateUrl: 'template/tooltip/tooltip-template-popup.html',
|
||||
link: function(scope, element) {
|
||||
element.addClass('tooltip');
|
||||
}
|
||||
templateUrl: 'template/tooltip/tooltip-template-popup.html'
|
||||
};
|
||||
})
|
||||
|
||||
@@ -646,10 +640,7 @@ function ($animate , $sce , $compile , $templateRequest) {
|
||||
return {
|
||||
replace: true,
|
||||
scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
|
||||
templateUrl: 'template/tooltip/tooltip-html-popup.html',
|
||||
link: function(scope, element) {
|
||||
element.addClass('tooltip');
|
||||
}
|
||||
templateUrl: 'template/tooltip/tooltip-html-popup.html'
|
||||
};
|
||||
})
|
||||
|
||||
@@ -658,176 +649,3 @@ function ($animate , $sce , $compile , $templateRequest) {
|
||||
useContentExp: true
|
||||
});
|
||||
}]);
|
||||
|
||||
/* Deprecated tooltip below */
|
||||
|
||||
angular.module('ui.bootstrap.tooltip')
|
||||
|
||||
.value('$tooltipSuppressWarning', false)
|
||||
|
||||
.provider('$tooltip', ['$uibTooltipProvider', function($uibTooltipProvider) {
|
||||
angular.extend(this, $uibTooltipProvider);
|
||||
|
||||
this.$get = ['$log', '$tooltipSuppressWarning', '$injector', function($log, $tooltipSuppressWarning, $injector) {
|
||||
if (!$tooltipSuppressWarning) {
|
||||
$log.warn('$tooltip is now deprecated. Use $uibTooltip instead.');
|
||||
}
|
||||
|
||||
return $injector.invoke($uibTooltipProvider.$get);
|
||||
}];
|
||||
}])
|
||||
|
||||
// This is mostly ngInclude code but with a custom scope
|
||||
.directive('tooltipTemplateTransclude', [
|
||||
'$animate', '$sce', '$compile', '$templateRequest', '$log', '$tooltipSuppressWarning',
|
||||
function ($animate , $sce , $compile , $templateRequest, $log, $tooltipSuppressWarning) {
|
||||
return {
|
||||
link: function(scope, elem, attrs) {
|
||||
if (!$tooltipSuppressWarning) {
|
||||
$log.warn('tooltip-template-transclude is now deprecated. Use uib-tooltip-template-transclude instead.');
|
||||
}
|
||||
|
||||
var origScope = scope.$eval(attrs.tooltipTemplateTranscludeScope);
|
||||
|
||||
var changeCounter = 0,
|
||||
currentScope,
|
||||
previousElement,
|
||||
currentElement;
|
||||
|
||||
var cleanupLastIncludeContent = function() {
|
||||
if (previousElement) {
|
||||
previousElement.remove();
|
||||
previousElement = null;
|
||||
}
|
||||
if (currentScope) {
|
||||
currentScope.$destroy();
|
||||
currentScope = null;
|
||||
}
|
||||
if (currentElement) {
|
||||
$animate.leave(currentElement).then(function() {
|
||||
previousElement = null;
|
||||
});
|
||||
previousElement = currentElement;
|
||||
currentElement = null;
|
||||
}
|
||||
};
|
||||
|
||||
scope.$watch($sce.parseAsResourceUrl(attrs.tooltipTemplateTransclude), function(src) {
|
||||
var thisChangeId = ++changeCounter;
|
||||
|
||||
if (src) {
|
||||
//set the 2nd param to true to ignore the template request error so that the inner
|
||||
//contents and scope can be cleaned up.
|
||||
$templateRequest(src, true).then(function(response) {
|
||||
if (thisChangeId !== changeCounter) { return; }
|
||||
var newScope = origScope.$new();
|
||||
var template = response;
|
||||
|
||||
var clone = $compile(template)(newScope, function(clone) {
|
||||
cleanupLastIncludeContent();
|
||||
$animate.enter(clone, elem);
|
||||
});
|
||||
|
||||
currentScope = newScope;
|
||||
currentElement = clone;
|
||||
|
||||
currentScope.$emit('$includeContentLoaded', src);
|
||||
}, function() {
|
||||
if (thisChangeId === changeCounter) {
|
||||
cleanupLastIncludeContent();
|
||||
scope.$emit('$includeContentError', src);
|
||||
}
|
||||
});
|
||||
scope.$emit('$includeContentRequested', src);
|
||||
} else {
|
||||
cleanupLastIncludeContent();
|
||||
}
|
||||
});
|
||||
|
||||
scope.$on('$destroy', cleanupLastIncludeContent);
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
.directive('tooltipClasses', ['$log', '$tooltipSuppressWarning', function($log, $tooltipSuppressWarning) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function(scope, element, attrs) {
|
||||
if (!$tooltipSuppressWarning) {
|
||||
$log.warn('tooltip-classes is now deprecated. Use uib-tooltip-classes instead.');
|
||||
}
|
||||
|
||||
if (scope.placement) {
|
||||
element.addClass(scope.placement);
|
||||
}
|
||||
if (scope.popupClass) {
|
||||
element.addClass(scope.popupClass);
|
||||
}
|
||||
if (scope.animation()) {
|
||||
element.addClass(attrs.tooltipAnimationClass);
|
||||
}
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
.directive('tooltipPopup', ['$log', '$tooltipSuppressWarning', function($log, $tooltipSuppressWarning) {
|
||||
return {
|
||||
replace: true,
|
||||
scope: { content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
|
||||
templateUrl: 'template/tooltip/tooltip-popup.html',
|
||||
link: function(scope, element) {
|
||||
if (!$tooltipSuppressWarning) {
|
||||
$log.warn('tooltip-popup is now deprecated. Use uib-tooltip-popup instead.');
|
||||
}
|
||||
|
||||
element.addClass('tooltip');
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
.directive('tooltip', ['$tooltip', function($tooltip) {
|
||||
return $tooltip('tooltip', 'tooltip', 'mouseenter');
|
||||
}])
|
||||
|
||||
.directive('tooltipTemplatePopup', ['$log', '$tooltipSuppressWarning', function($log, $tooltipSuppressWarning) {
|
||||
return {
|
||||
replace: true,
|
||||
scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&',
|
||||
originScope: '&' },
|
||||
templateUrl: 'template/tooltip/tooltip-template-popup.html',
|
||||
link: function(scope, element) {
|
||||
if (!$tooltipSuppressWarning) {
|
||||
$log.warn('tooltip-template-popup is now deprecated. Use uib-tooltip-template-popup instead.');
|
||||
}
|
||||
|
||||
element.addClass('tooltip');
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
.directive('tooltipTemplate', ['$tooltip', function($tooltip) {
|
||||
return $tooltip('tooltipTemplate', 'tooltip', 'mouseenter', {
|
||||
useContentExp: true
|
||||
});
|
||||
}])
|
||||
|
||||
.directive('tooltipHtmlPopup', ['$log', '$tooltipSuppressWarning', function($log, $tooltipSuppressWarning) {
|
||||
return {
|
||||
replace: true,
|
||||
scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
|
||||
templateUrl: 'template/tooltip/tooltip-html-popup.html',
|
||||
link: function(scope, element) {
|
||||
if (!$tooltipSuppressWarning) {
|
||||
$log.warn('tooltip-html-popup is now deprecated. Use uib-tooltip-html-popup instead.');
|
||||
}
|
||||
|
||||
element.addClass('tooltip');
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
.directive('tooltipHtml', ['$tooltip', function($tooltip) {
|
||||
return $tooltip('tooltipHtml', 'tooltip', 'mouseenter', {
|
||||
useContentExp: true
|
||||
});
|
||||
}]);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<div tooltip-animation-class="fade"
|
||||
<div class="popover"
|
||||
tooltip-animation-class="fade"
|
||||
uib-tooltip-classes
|
||||
ng-class="{ in: isOpen() }">
|
||||
<div class="arrow"></div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<div tooltip-animation-class="fade"
|
||||
<div class="popover"
|
||||
tooltip-animation-class="fade"
|
||||
uib-tooltip-classes
|
||||
ng-class="{ in: isOpen() }">
|
||||
<div class="arrow"></div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<div tooltip-animation-class="fade"
|
||||
<div class="popover"
|
||||
tooltip-animation-class="fade"
|
||||
uib-tooltip-classes
|
||||
ng-class="{ in: isOpen() }">
|
||||
<div class="arrow"></div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div
|
||||
<div class="tooltip"
|
||||
tooltip-animation-class="fade"
|
||||
uib-tooltip-classes
|
||||
ng-class="{ in: isOpen() }">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div
|
||||
<div class="tooltip"
|
||||
tooltip-animation-class="fade"
|
||||
uib-tooltip-classes
|
||||
ng-class="{ in: isOpen() }">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div
|
||||
<div class="tooltip"
|
||||
tooltip-animation-class="fade"
|
||||
uib-tooltip-classes
|
||||
ng-class="{ in: isOpen() }">
|
||||
|
||||
Reference in New Issue
Block a user