|
1 | 1 | /**
|
2 | 2 | * angular-strap
|
3 |
| - * @version v2.0.0-rc.1 - 2014-01-29 |
| 3 | + * @version v2.0.0-rc.2 - 2014-01-29 |
4 | 4 | * @link http://mgcrea.github.io/angular-strap
|
5 | 5 | * @author [object Object]
|
6 | 6 | * @license MIT License, http://www.opensource.org/licenses/MIT
|
|
159 | 159 | };
|
160 | 160 | }
|
161 | 161 | ]);
|
162 |
| - angular.module('mgcrea.ngStrap.alert', []).run([ |
163 |
| - '$templateCache', |
164 |
| - function ($templateCache) { |
165 |
| - var template = '' + '<div class="alert" tabindex="-1" ng-class="[type ? \'alert-\' + type : null]">' + '<button type="button" class="close" ng-click="$hide()">×</button>' + '<strong ng-bind="title"></strong> <span ng-bind-html="content"></span>' + '</div>'; |
166 |
| - $templateCache.put('$alert', template); |
167 |
| - } |
168 |
| - ]).provider('$alert', function () { |
| 162 | + angular.module('mgcrea.ngStrap.alert', []).provider('$alert', function () { |
169 | 163 | var defaults = this.defaults = {
|
170 |
| - animation: 'animation-fade', |
| 164 | + animation: 'am-fade', |
171 | 165 | prefixClass: 'alert',
|
172 | 166 | placement: null,
|
173 |
| - template: '$alert', |
| 167 | + template: 'alert/alert.tpl.html', |
174 | 168 | container: false,
|
175 | 169 | element: null,
|
176 | 170 | backdrop: false,
|
177 | 171 | keyboard: true,
|
178 | 172 | show: true,
|
179 |
| - duration: false |
| 173 | + duration: false, |
| 174 | + type: false |
180 | 175 | };
|
181 | 176 | this.$get = [
|
182 | 177 | '$modal',
|
|
260 | 255 | ]);
|
261 | 256 | angular.module('mgcrea.ngStrap.aside', ['mgcrea.ngStrap.modal']).provider('$aside', function () {
|
262 | 257 | var defaults = this.defaults = {
|
263 |
| - animation: 'animation-fadeAndSlideRight', |
| 258 | + animation: 'am-fade-and-slide-right', |
264 | 259 | prefixClass: 'aside',
|
265 | 260 | placement: 'right',
|
266 | 261 | template: 'aside/aside.tpl.html',
|
|
460 | 455 | 'mgcrea.ngStrap.tooltip'
|
461 | 456 | ]).provider('$datepicker', function () {
|
462 | 457 | var defaults = this.defaults = {
|
463 |
| - animation: 'animation-fade', |
| 458 | + animation: 'am-fade', |
464 | 459 | prefixClass: 'datepicker',
|
465 | 460 | placement: 'bottom-left',
|
466 | 461 | template: 'datepicker/datepicker.tpl.html',
|
|
521 | 516 | $datepicker.$build();
|
522 | 517 | }
|
523 | 518 | };
|
524 |
| - $datepicker.select = function (date, keepMode) { |
| 519 | + $datepicker.select = function (date, keep) { |
525 | 520 | if (!angular.isDate(date))
|
526 | 521 | date = new Date(date);
|
527 | 522 | controller.$dateValue.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
|
528 |
| - if (!scope.$mode || keepMode) { |
| 523 | + if (!scope.$mode || keep) { |
529 | 524 | controller.$setViewValue(controller.$dateValue);
|
530 | 525 | controller.$render();
|
531 |
| - if (options.autoclose && !keepMode) { |
| 526 | + if (options.autoclose && !keep) { |
532 | 527 | $datepicker.hide(true);
|
533 | 528 | }
|
534 | 529 | } else {
|
|
958 | 953 | });
|
959 | 954 | angular.module('mgcrea.ngStrap.dropdown', ['mgcrea.ngStrap.tooltip']).provider('$dropdown', function () {
|
960 | 955 | var defaults = this.defaults = {
|
961 |
| - animation: 'animation-fade', |
| 956 | + animation: 'am-fade', |
962 | 957 | prefixClass: 'dropdown',
|
963 | 958 | placement: 'bottom-left',
|
964 | 959 | template: 'dropdown/dropdown.tpl.html',
|
|
1375 | 1370 | });
|
1376 | 1371 | angular.module('mgcrea.ngStrap.modal', ['mgcrea.ngStrap.helpers.dimensions']).provider('$modal', function () {
|
1377 | 1372 | var defaults = this.defaults = {
|
1378 |
| - animation: 'animation-fade', |
| 1373 | + animation: 'am-fade', |
1379 | 1374 | prefixClass: 'modal',
|
1380 | 1375 | placement: 'top',
|
1381 | 1376 | template: 'modal/modal.tpl.html',
|
|
1399 | 1394 | 'dimensions',
|
1400 | 1395 | function ($window, $rootScope, $compile, $q, $templateCache, $http, $animate, $timeout, dimensions) {
|
1401 | 1396 | var forEach = angular.forEach;
|
1402 |
| - var jqLite = angular.element; |
1403 | 1397 | var trim = String.prototype.trim;
|
1404 |
| - var bodyElement = jqLite($window.document.body); |
| 1398 | + var requestAnimationFrame = $window.requestAnimationFrame || $window.setTimeout; |
| 1399 | + var bodyElement = angular.element($window.document.body); |
1405 | 1400 | var htmlReplaceRegExp = /ng-bind="/gi;
|
1406 | 1401 | var findElement = function (query, element) {
|
1407 |
| - return jqLite((element || document).querySelectorAll(query)); |
| 1402 | + return angular.element((element || document).querySelectorAll(query)); |
1408 | 1403 | };
|
1409 | 1404 | function ModalFactory(config) {
|
1410 | 1405 | var $modal = {};
|
|
1454 | 1449 | });
|
1455 | 1450 | }
|
1456 | 1451 | var modalLinker, modalElement;
|
1457 |
| - var backdropElement = jqLite('<div class="' + options.prefixClass + '-backdrop"/>'); |
| 1452 | + var backdropElement = angular.element('<div class="' + options.prefixClass + '-backdrop"/>'); |
1458 | 1453 | $modal.$promise.then(function (template) {
|
1459 | 1454 | if (angular.isObject(template))
|
1460 | 1455 | template = template.data;
|
|
1490 | 1485 | modalElement.css({ display: 'block' }).addClass(options.placement);
|
1491 | 1486 | if (options.animation) {
|
1492 | 1487 | if (options.backdrop) {
|
1493 |
| - backdropElement.addClass('animation-fade'); |
| 1488 | + backdropElement.addClass('am-fade'); |
1494 | 1489 | }
|
1495 | 1490 | modalElement.addClass(options.animation);
|
1496 | 1491 | }
|
|
1502 | 1497 | });
|
1503 | 1498 | scope.$isShown = true;
|
1504 | 1499 | scope.$$phase || scope.$digest();
|
1505 |
| - $modal.focus(); |
| 1500 | + var el = modalElement[0]; |
| 1501 | + requestAnimationFrame(function () { |
| 1502 | + el.focus(); |
| 1503 | + }); |
1506 | 1504 | bodyElement.addClass(options.prefixClass + '-open');
|
1507 | 1505 | if (options.backdrop) {
|
1508 | 1506 | modalElement.on('click', hideOnBackdropClick);
|
|
1646 | 1644 | ]);
|
1647 | 1645 | angular.module('mgcrea.ngStrap.popover', ['mgcrea.ngStrap.tooltip']).provider('$popover', function () {
|
1648 | 1646 | var defaults = this.defaults = {
|
1649 |
| - animation: 'animation-fade', |
| 1647 | + animation: 'am-fade', |
1650 | 1648 | placement: 'right',
|
1651 | 1649 | template: 'popover/popover.tpl.html',
|
1652 | 1650 | contentTemplate: false,
|
|
1933 | 1931 | 'mgcrea.ngStrap.helpers.parseOptions'
|
1934 | 1932 | ]).provider('$select', function () {
|
1935 | 1933 | var defaults = this.defaults = {
|
1936 |
| - animation: 'animation-fade', |
| 1934 | + animation: 'am-fade', |
1937 | 1935 | prefixClass: 'select',
|
1938 | 1936 | placement: 'bottom-left',
|
1939 | 1937 | template: 'select/select.tpl.html',
|
|
2187 | 2185 | }
|
2188 | 2186 | ]).provider('$tab', function () {
|
2189 | 2187 | var defaults = this.defaults = {
|
2190 |
| - animation: 'animation-fade', |
| 2188 | + animation: 'am-fade', |
2191 | 2189 | template: 'tab/tab.tpl.html'
|
2192 | 2190 | };
|
2193 | 2191 | this.$get = function () {
|
|
2240 | 2238 | 'mgcrea.ngStrap.tooltip'
|
2241 | 2239 | ]).provider('$timepicker', function () {
|
2242 | 2240 | var defaults = this.defaults = {
|
2243 |
| - animation: 'animation-fade', |
| 2241 | + animation: 'am-fade', |
2244 | 2242 | prefixClass: 'timepicker',
|
2245 | 2243 | placement: 'bottom-left',
|
2246 | 2244 | template: 'timepicker/timepicker.tpl.html',
|
|
2604 | 2602 | ]);
|
2605 | 2603 | angular.module('mgcrea.ngStrap.tooltip', ['mgcrea.ngStrap.helpers.dimensions']).provider('$tooltip', function () {
|
2606 | 2604 | var defaults = this.defaults = {
|
2607 |
| - animation: 'animation-fade', |
| 2605 | + animation: 'am-fade', |
2608 | 2606 | prefixClass: 'tooltip',
|
2609 | 2607 | container: false,
|
2610 | 2608 | placement: 'top',
|
|
2631 | 2629 | function ($window, $rootScope, $compile, $q, $templateCache, $http, $animate, $timeout, dimensions) {
|
2632 | 2630 | var trim = String.prototype.trim;
|
2633 | 2631 | var requestAnimationFrame = $window.requestAnimationFrame || $window.setTimeout;
|
| 2632 | + var isTouch = 'createTouch' in $window.document; |
2634 | 2633 | var htmlReplaceRegExp = /ng-bind="/gi;
|
2635 | 2634 | var findElement = function (query, element) {
|
2636 | 2635 | return angular.element((element || document).querySelectorAll(query));
|
|
2937 | 2936 | 'mgcrea.ngStrap.helpers.parseOptions'
|
2938 | 2937 | ]).provider('$typeahead', function () {
|
2939 | 2938 | var defaults = this.defaults = {
|
2940 |
| - animation: 'animation-fade', |
| 2939 | + animation: 'am-fade', |
2941 | 2940 | prefixClass: 'typeahead',
|
2942 | 2941 | placement: 'bottom-left',
|
2943 | 2942 | template: 'typeahead/typeahead.tpl.html',
|
|
0 commit comments