nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components_external / angular-att-gridster / ui-gridster.js
1 /**
2 * FileName ui-gridster
3 * Version 0.1.0
4 * Build number 81850
5 * Date 03/14/2016
6 */
7
8
9 (function(angular, window){
10 angular.module("att.gridster", ["att.gridster.utilities","att.gridster.gridster"]);
11 angular.module('att.gridster.utilities', [])
12     .factory('$extendObj', [function() {
13         var _extendDeep = function(dst) {
14             angular.forEach(arguments, function(obj) {
15                 if (obj !== dst) {
16                     angular.forEach(obj, function(value, key) {
17                         if (dst[key] && dst[key].constructor && dst[key].constructor === Object) {
18                             _extendDeep(dst[key], value);
19                         } else {
20                             dst[key] = value;
21                         }
22                     });
23                 }
24             });
25             return dst;
26         };
27         return {
28             extendDeep: _extendDeep
29         };
30     }])
31     .filter('unsafe', ['$sce', function($sce) {
32         return function(val) {
33             return $sce.trustAsHtml(val);
34         };
35     }]);
36
37 angular.module('att.gridster.gridster', ['attGridsterLib', 'att.gridster.utilities', 'ngSanitize'])
38         .config(['$compileProvider', function($compileProvider) {
39                 $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|javascript):/);
40             }])
41         .constant('attGridsterConfig',
42                 {
43                     columns: 3,
44                     margins: [10, 10],
45                     outerMargin: true,
46                     pushing: true,
47                     floating: true,
48                     swapping: true,
49                     draggable: {
50                         enabled: true
51                     }
52                 })
53         .directive('attGridster', ['attGridsterConfig', '$extendObj', function(attGridsterConfig, $extendObj) {
54                 return {
55                     restrict: 'EA',
56                     scope: {
57                         attGridsterOptions: '=?'
58                     },
59                     templateUrl: 'template/gridster/gridster.html',
60                     replace: false,
61                     transclude: true,
62                     controller: [function() {}],
63                     link: function(scope) {
64                         if (angular.isDefined(scope.attGridsterOptions)) {
65                             attGridsterConfig = $extendObj.extendDeep(attGridsterConfig, scope.attGridsterOptions);
66                         }
67                         scope.attGridsterConfig = attGridsterConfig;
68                     }
69                 };
70             }])
71         .directive('attGridsterItem', ['$timeout', function($timeout) {
72                 return {
73                     restrict: 'EA',
74                     require: ['^attGridster'],
75                     scope: {
76                         attGridsterItem: '='
77                     },
78                     templateUrl: 'template/gridster/gridsterItem.html',
79                     replace: false,
80                     transclude: true,
81                     controller: [function() {}]
82                 };
83             }])
84         .directive('attGridsterItemHeader', [function() {
85                 return {
86                     restrict: 'EA',
87                     require: ['^attGridsterItem'],
88                     scope: {
89                         headerText: '@',
90                         headerIcon: '@',
91                         subHeaderText: '@?'
92                     },
93                     templateUrl: 'template/gridster/gridsterItemHeader.html',
94                     replace: true,
95                     transclude: true,
96                     link: function(scope, element, attr) {
97                         if (attr.gripsImgPath) {
98                             scope.gripsImgPath = attr.gripsImgPath;
99                         } else {
100                             scope.gripsImgPath = 'images/grips.png';
101                         }
102
103                         if (angular.isDefined(scope.subHeaderText) && scope.subHeaderText) {
104                             angular.element(element[0].querySelector('span.gridster-item-sub-header-content')).attr("tabindex", "0");
105                             angular.element(element[0].querySelector('span.gridster-item-sub-header-content')).attr("aria-label", scope.subHeaderText);
106                         }
107                     }
108                 };
109             }])
110         .directive('attGridsterItemBody', [function() {
111                 return {
112                     restrict: 'EA',
113                     require: ['^attGridsterItem'],
114                     scope: {},
115                     templateUrl: 'template/gridster/gridsterItemBody.html',
116                     replace: true,
117                     transclude: true
118                 };
119             }])
120         .directive('attGridsterItemFooter', [function() {
121                 return {
122                     restrict: 'EA',
123                     require: ['^attGridsterItem'],
124                     scope: {},
125                     templateUrl: 'template/gridster/gridsterItemFooter.html',
126                     replace: true,
127                     transclude: true
128                 };
129             }]);
130 return {}
131 })(angular, window);