UI adaptation for supporting ONAP portal SDK
[validation.git] / ui / src / main / webapp / static / fusion / js / att_angular_gridster / ui-gridster-tpls.js
1 /**
2 * FileName ui-gridster
3 * Version 0.0.1
4 * Build number ad58c6f4f8f8fd7f04ac457f95d76f09
5 * Date 08/17/2015
6 */
7
8
9 (function(angular, window){
10 angular.module("att.gridster", ["att.gridster.tpls", "att.gridster.utilities","att.gridster.gridster"]);
11 angular.module("att.gridster.tpls", ["template/gridster/gridster.html","template/gridster/gridsterItem.html","template/gridster/gridsterItemBody.html","template/gridster/gridsterItemFooter.html","template/gridster/gridsterItemHeader.html"]);
12 angular.module('att.gridster.utilities', [])
13         .factory('$extendObj', [function() {
14                 var _extendDeep = function(dst) {
15                     angular.forEach(arguments, function(obj) {
16                         if (obj !== dst) {
17                             angular.forEach(obj, function(value, key) {
18                                 if (dst[key] && dst[key].constructor && dst[key].constructor === Object) {
19                                     _extendDeep(dst[key], value);
20                                 } else {
21                                     dst[key] = value;
22                                 }
23                             });
24                         }
25                     });
26                     return dst;
27                 };
28                 return {
29                     extendDeep: _extendDeep
30                 };
31             }]);
32
33 angular.module('att.gridster.gridster', ['attGridsterLib', 'att.gridster.utilities'])
34         .config(['$compileProvider', function($compileProvider) {
35                 $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|javascript):/);
36             }])
37         .constant('attGridsterConfig',
38                 {
39                     columns: 3,
40                     margins: [10, 10],
41                     outerMargin: true,
42                     pushing: true,
43                     floating: true,
44                     swapping: true,
45                     draggable: {
46                         enabled: true
47                     }
48                 })
49         .directive('attGridster', ['attGridsterConfig', '$extendObj', function(attGridsterConfig, $extendObj) {
50                 return {
51                     restrict: 'EA',
52                     scope: {
53                         attGridsterOptions: '=?'
54                     },
55                     templateUrl: 'template/gridster/gridster.html',
56                     replace: false,
57                     transclude: true,
58                     controller: [function() {}],
59                     link: function(scope) {
60                         if (angular.isDefined(scope.attGridsterOptions)) {
61                             attGridsterConfig = $extendObj.extendDeep(attGridsterConfig, scope.attGridsterOptions);
62                         }
63                         scope.attGridsterConfig = attGridsterConfig;
64                     }
65                 };
66             }])
67         .directive('attGridsterItem', ['$timeout', function($timeout) {
68                 return {
69                     restrict: 'EA',
70                     require: ['^attGridster'],
71                     scope: {
72                         attGridsterItem: '='
73                     },
74                     templateUrl: 'template/gridster/gridsterItem.html',
75                     replace: false,
76                     transclude: true,
77                     controller: [function() {}]
78                 };
79             }])
80         .directive('attGridsterItemHeader', [function() {
81                 return {
82                     restrict: 'EA',
83                     require: ['^attGridsterItem'],
84                     scope: {
85                         headerText: '@',
86                         subHeaderText: '@?'
87                     },
88                     templateUrl: 'template/gridster/gridsterItemHeader.html',
89                     replace: true,
90                     transclude: true,
91                     link: function(scope, element) {
92                         if (angular.isDefined(scope.subHeaderText) && scope.subHeaderText) {
93                             angular.element(element[0].querySelector('span.gridster-item-sub-header-content')).attr("tabindex", "0");
94                             angular.element(element[0].querySelector('span.gridster-item-sub-header-content')).attr("aria-label", scope.subHeaderText);
95                         }
96                     }
97                 };
98             }])
99         .directive('attGridsterItemBody', [function() {
100                 return {
101                     restrict: 'EA',
102                     require: ['^attGridsterItem'],
103                     scope: {},
104                     templateUrl: 'template/gridster/gridsterItemBody.html',
105                     replace: true,
106                     transclude: true
107                 };
108             }])
109         .directive('attGridsterItemFooter', ['$location', function($location) {
110                 return {
111                     restrict: 'EA',
112                     require: ['^attGridsterItem'],
113                     scope: {
114                         attGridsterItemFooterLink: '@?'
115                     },
116                     templateUrl: 'template/gridster/gridsterItemFooter.html',
117                     replace: true,
118                     transclude: true,
119                     controller: ['$scope', function($scope) {
120                             $scope.clickOnFooterLink = function(evt) {
121                                 evt.preventDefault();
122                                 evt.stopPropagation();
123                                 if ($scope.attGridsterItemFooterLink) {
124                                     $location.url($scope.attGridsterItemFooterLink);
125                                 }
126                             };
127                         }],
128                     link: function(scope, element) {
129                         if (angular.isDefined(scope.attGridsterItemFooterLink) && scope.attGridsterItemFooterLink) {
130                             element.attr("role", "link");
131                         }
132                     }
133                 };
134             }]);
135 angular.module("template/gridster/gridster.html", []).run(["$templateCache", function($templateCache) {
136   $templateCache.put("template/gridster/gridster.html",
137     "<div gridster='attGridsterConfig'><div ng-transclude></div></div>");
138 }]);
139
140 angular.module("template/gridster/gridsterItem.html", []).run(["$templateCache", function($templateCache) {
141   $templateCache.put("template/gridster/gridsterItem.html",
142     "<div gridster-item='attGridsterItem' class=\"gridster-item-container\" ng-transclude></div>");
143 }]);
144
145 angular.module("template/gridster/gridsterItemBody.html", []).run(["$templateCache", function($templateCache) {
146   $templateCache.put("template/gridster/gridsterItemBody.html",
147     "<div class=\"gridster-item-body\" ng-transclude></div>");
148 }]);
149
150 angular.module("template/gridster/gridsterItemFooter.html", []).run(["$templateCache", function($templateCache) {
151   $templateCache.put("template/gridster/gridsterItemFooter.html",
152     "<div class=\"gridster-item-footer\" ng-click=\"clickOnFooterLink($event)\" tabindex=\"0\" ng-keydown=\"(($event.keyCode && $event.keyCode === 13) || ($event.which && $event.which === 13)) && clickOnFooterLink($event)\" >\n" +
153     "    <span class=\"gridster-item-footer-content\" ng-transclude></span>\n" +
154     "</div>");
155 }]);
156
157 angular.module("template/gridster/gridsterItemHeader.html", []).run(["$templateCache", function($templateCache) {
158   $templateCache.put("template/gridster/gridsterItemHeader.html",
159     "<div class=\"gridster-item-header\">\n" +
160     "    <img gridster-item-drag src=\"static/fusion/images/att_angular_gridster/grips.png\" alt=\"||\" aria-label=\"Tap/Click to move\" class=\"gridster-item-handle\" />\n" +
161     "    <span class=\"gridster-item-header-content\" tabindex=\"0\" role=\"presentation\" aria-label=\"{{headerText}}\">{{headerText}}</span>\n" +
162     "    <span class=\"gridster-item-sub-header-content\" role=\"presentation\">{{subHeaderText}}</span>\n" +
163     "    <div class=\"gridster-item-header-buttons-container\" ng-transclude></div>\n" +
164     "</div>");
165 }]);
166
167 return {}
168 })(angular, window);