Razique Mahroua
2019-11-28 1759c24ad2d2b35ec5c756e3dd3a60185fe944b7
1
2
3
4
5
6
7
8
/**
 * angular-strap
 * @version v2.0.3 - 2014-05-30
 * @link http://mgcrea.github.io/angular-strap
 * @author Olivier Louvignes (olivier@mg-crea.com)
 * @license MIT License, http://www.opensource.org/licenses/MIT
 */
"use strict";angular.module("mgcrea.ngStrap.dropdown",["mgcrea.ngStrap.tooltip"]).provider("$dropdown",function(){var e=this.defaults={animation:"am-fade",prefixClass:"dropdown",placement:"bottom-left",template:"dropdown/dropdown.tpl.html",trigger:"click",container:!1,keyboard:!0,html:!1,delay:0};this.$get=["$window","$rootScope","$tooltip",function(o,t,n){function r(o,r){function c(e){return e.target!==o[0]?e.target!==o[0]&&i.hide():void 0}{var i={},d=angular.extend({},e,r);i.$scope=d.scope&&d.scope.$new()||t.$new()}i=n(o,d),i.$onKeyDown=function(e){if(/(38|40)/.test(e.keyCode)){e.preventDefault(),e.stopPropagation();var o=angular.element(i.$element[0].querySelectorAll("li:not(.divider) a"));if(o.length){var t;angular.forEach(o,function(e,o){l&&l.call(e,":focus")&&(t=o)}),38===e.keyCode&&t>0?t--:40===e.keyCode&&t<o.length-1?t++:angular.isUndefined(t)&&(t=0),o.eq(t)[0].focus()}}};var p=i.show;i.show=function(){p(),setTimeout(function(){d.keyboard&&i.$element.on("keydown",i.$onKeyDown),a.on("click",c)})};var u=i.hide;return i.hide=function(){d.keyboard&&i.$element.off("keydown",i.$onKeyDown),a.off("click",c),u()},i}var a=angular.element(o.document.body),l=Element.prototype.matchesSelector||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector;return r}]}).directive("bsDropdown",["$window","$location","$sce","$dropdown",function(e,o,t,n){return{restrict:"EAC",scope:!0,link:function(e,o,t){var r={scope:e};angular.forEach(["placement","container","delay","trigger","keyboard","html","animation","template"],function(e){angular.isDefined(t[e])&&(r[e]=t[e])}),t.bsDropdown&&e.$watch(t.bsDropdown,function(o){e.content=o},!0);var a=n(o,r);e.$on("$destroy",function(){a.destroy(),r=null,a=null})}}}]);