| @@ 11-109 (lines=99) @@ | ||
| 8 | angular.module("ui.bootstrap.tpls", ["uib/template/accordion/accordion-group.html","uib/template/accordion/accordion.html","uib/template/alert/alert.html","uib/template/carousel/carousel.html","uib/template/carousel/slide.html","uib/template/datepicker/datepicker.html","uib/template/datepicker/day.html","uib/template/datepicker/month.html","uib/template/datepicker/year.html","uib/template/datepickerPopup/popup.html","uib/template/modal/backdrop.html","uib/template/modal/window.html","uib/template/pager/pager.html","uib/template/pagination/pagination.html","uib/template/tooltip/tooltip-html-popup.html","uib/template/tooltip/tooltip-popup.html","uib/template/tooltip/tooltip-template-popup.html","uib/template/popover/popover-html.html","uib/template/popover/popover-template.html","uib/template/popover/popover.html","uib/template/progressbar/bar.html","uib/template/progressbar/progress.html","uib/template/progressbar/progressbar.html","uib/template/rating/rating.html","uib/template/tabs/tab.html","uib/template/tabs/tabset.html","uib/template/timepicker/timepicker.html","uib/template/typeahead/typeahead-match.html","uib/template/typeahead/typeahead-popup.html"]); |
|
| 9 | angular.module('ui.bootstrap.collapse', []) |
|
| 10 | ||
| 11 | .directive('uibCollapse', ['$animate', '$q', '$parse', '$injector', function($animate, $q, $parse, $injector) { |
|
| 12 | var $animateCss = $injector.has('$animateCss') ? $injector.get('$animateCss') : null; |
|
| 13 | return { |
|
| 14 | link: function(scope, element, attrs) { |
|
| 15 | var expandingExpr = $parse(attrs.expanding), |
|
| 16 | expandedExpr = $parse(attrs.expanded), |
|
| 17 | collapsingExpr = $parse(attrs.collapsing), |
|
| 18 | collapsedExpr = $parse(attrs.collapsed); |
|
| 19 | ||
| 20 | if (!scope.$eval(attrs.uibCollapse)) { |
|
| 21 | element.addClass('in') |
|
| 22 | .addClass('collapse') |
|
| 23 | .attr('aria-expanded', true) |
|
| 24 | .attr('aria-hidden', false) |
|
| 25 | .css({height: 'auto'}); |
|
| 26 | } |
|
| 27 | ||
| 28 | function expand() { |
|
| 29 | if (element.hasClass('collapse') && element.hasClass('in')) { |
|
| 30 | return; |
|
| 31 | } |
|
| 32 | ||
| 33 | $q.resolve(expandingExpr(scope)) |
|
| 34 | .then(function() { |
|
| 35 | element.removeClass('collapse') |
|
| 36 | .addClass('collapsing') |
|
| 37 | .attr('aria-expanded', true) |
|
| 38 | .attr('aria-hidden', false); |
|
| 39 | ||
| 40 | if ($animateCss) { |
|
| 41 | $animateCss(element, { |
|
| 42 | addClass: 'in', |
|
| 43 | easing: 'ease', |
|
| 44 | to: { height: element[0].scrollHeight + 'px' } |
|
| 45 | }).start()['finally'](expandDone); |
|
| 46 | } else { |
|
| 47 | $animate.addClass(element, 'in', { |
|
| 48 | to: { height: element[0].scrollHeight + 'px' } |
|
| 49 | }).then(expandDone); |
|
| 50 | } |
|
| 51 | }); |
|
| 52 | } |
|
| 53 | ||
| 54 | function expandDone() { |
|
| 55 | element.removeClass('collapsing') |
|
| 56 | .addClass('collapse') |
|
| 57 | .css({height: 'auto'}); |
|
| 58 | expandedExpr(scope); |
|
| 59 | } |
|
| 60 | ||
| 61 | function collapse() { |
|
| 62 | if (!element.hasClass('collapse') && !element.hasClass('in')) { |
|
| 63 | return collapseDone(); |
|
| 64 | } |
|
| 65 | ||
| 66 | $q.resolve(collapsingExpr(scope)) |
|
| 67 | .then(function() { |
|
| 68 | element |
|
| 69 | // IMPORTANT: The height must be set before adding "collapsing" class. |
|
| 70 | // Otherwise, the browser attempts to animate from height 0 (in |
|
| 71 | // collapsing class) to the given height here. |
|
| 72 | .css({height: element[0].scrollHeight + 'px'}) |
|
| 73 | // initially all panel collapse have the collapse class, this removal |
|
| 74 | // prevents the animation from jumping to collapsed state |
|
| 75 | .removeClass('collapse') |
|
| 76 | .addClass('collapsing') |
|
| 77 | .attr('aria-expanded', false) |
|
| 78 | .attr('aria-hidden', true); |
|
| 79 | ||
| 80 | if ($animateCss) { |
|
| 81 | $animateCss(element, { |
|
| 82 | removeClass: 'in', |
|
| 83 | to: {height: '0'} |
|
| 84 | }).start()['finally'](collapseDone); |
|
| 85 | } else { |
|
| 86 | $animate.removeClass(element, 'in', { |
|
| 87 | to: {height: '0'} |
|
| 88 | }).then(collapseDone); |
|
| 89 | } |
|
| 90 | }); |
|
| 91 | } |
|
| 92 | ||
| 93 | function collapseDone() { |
|
| 94 | element.css({height: '0'}); // Required so that collapse works when animation is disabled |
|
| 95 | element.removeClass('collapsing') |
|
| 96 | .addClass('collapse'); |
|
| 97 | collapsedExpr(scope); |
|
| 98 | } |
|
| 99 | ||
| 100 | scope.$watch(attrs.uibCollapse, function(shouldCollapse) { |
|
| 101 | if (shouldCollapse) { |
|
| 102 | collapse(); |
|
| 103 | } else { |
|
| 104 | expand(); |
|
| 105 | } |
|
| 106 | }); |
|
| 107 | } |
|
| 108 | }; |
|
| 109 | }]); |
|
| 110 | ||
| 111 | angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse']) |
|
| 112 | ||
| @@ 10-108 (lines=99) @@ | ||
| 7 | */angular.module("ui.bootstrap", ["ui.bootstrap.collapse","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.isClass","ui.bootstrap.datepicker","ui.bootstrap.position","ui.bootstrap.datepickerPopup","ui.bootstrap.debounce","ui.bootstrap.dropdown","ui.bootstrap.stackedMap","ui.bootstrap.modal","ui.bootstrap.paging","ui.bootstrap.pager","ui.bootstrap.pagination","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.timepicker","ui.bootstrap.typeahead"]); |
|
| 8 | angular.module('ui.bootstrap.collapse', []) |
|
| 9 | ||
| 10 | .directive('uibCollapse', ['$animate', '$q', '$parse', '$injector', function($animate, $q, $parse, $injector) { |
|
| 11 | var $animateCss = $injector.has('$animateCss') ? $injector.get('$animateCss') : null; |
|
| 12 | return { |
|
| 13 | link: function(scope, element, attrs) { |
|
| 14 | var expandingExpr = $parse(attrs.expanding), |
|
| 15 | expandedExpr = $parse(attrs.expanded), |
|
| 16 | collapsingExpr = $parse(attrs.collapsing), |
|
| 17 | collapsedExpr = $parse(attrs.collapsed); |
|
| 18 | ||
| 19 | if (!scope.$eval(attrs.uibCollapse)) { |
|
| 20 | element.addClass('in') |
|
| 21 | .addClass('collapse') |
|
| 22 | .attr('aria-expanded', true) |
|
| 23 | .attr('aria-hidden', false) |
|
| 24 | .css({height: 'auto'}); |
|
| 25 | } |
|
| 26 | ||
| 27 | function expand() { |
|
| 28 | if (element.hasClass('collapse') && element.hasClass('in')) { |
|
| 29 | return; |
|
| 30 | } |
|
| 31 | ||
| 32 | $q.resolve(expandingExpr(scope)) |
|
| 33 | .then(function() { |
|
| 34 | element.removeClass('collapse') |
|
| 35 | .addClass('collapsing') |
|
| 36 | .attr('aria-expanded', true) |
|
| 37 | .attr('aria-hidden', false); |
|
| 38 | ||
| 39 | if ($animateCss) { |
|
| 40 | $animateCss(element, { |
|
| 41 | addClass: 'in', |
|
| 42 | easing: 'ease', |
|
| 43 | to: { height: element[0].scrollHeight + 'px' } |
|
| 44 | }).start()['finally'](expandDone); |
|
| 45 | } else { |
|
| 46 | $animate.addClass(element, 'in', { |
|
| 47 | to: { height: element[0].scrollHeight + 'px' } |
|
| 48 | }).then(expandDone); |
|
| 49 | } |
|
| 50 | }); |
|
| 51 | } |
|
| 52 | ||
| 53 | function expandDone() { |
|
| 54 | element.removeClass('collapsing') |
|
| 55 | .addClass('collapse') |
|
| 56 | .css({height: 'auto'}); |
|
| 57 | expandedExpr(scope); |
|
| 58 | } |
|
| 59 | ||
| 60 | function collapse() { |
|
| 61 | if (!element.hasClass('collapse') && !element.hasClass('in')) { |
|
| 62 | return collapseDone(); |
|
| 63 | } |
|
| 64 | ||
| 65 | $q.resolve(collapsingExpr(scope)) |
|
| 66 | .then(function() { |
|
| 67 | element |
|
| 68 | // IMPORTANT: The height must be set before adding "collapsing" class. |
|
| 69 | // Otherwise, the browser attempts to animate from height 0 (in |
|
| 70 | // collapsing class) to the given height here. |
|
| 71 | .css({height: element[0].scrollHeight + 'px'}) |
|
| 72 | // initially all panel collapse have the collapse class, this removal |
|
| 73 | // prevents the animation from jumping to collapsed state |
|
| 74 | .removeClass('collapse') |
|
| 75 | .addClass('collapsing') |
|
| 76 | .attr('aria-expanded', false) |
|
| 77 | .attr('aria-hidden', true); |
|
| 78 | ||
| 79 | if ($animateCss) { |
|
| 80 | $animateCss(element, { |
|
| 81 | removeClass: 'in', |
|
| 82 | to: {height: '0'} |
|
| 83 | }).start()['finally'](collapseDone); |
|
| 84 | } else { |
|
| 85 | $animate.removeClass(element, 'in', { |
|
| 86 | to: {height: '0'} |
|
| 87 | }).then(collapseDone); |
|
| 88 | } |
|
| 89 | }); |
|
| 90 | } |
|
| 91 | ||
| 92 | function collapseDone() { |
|
| 93 | element.css({height: '0'}); // Required so that collapse works when animation is disabled |
|
| 94 | element.removeClass('collapsing') |
|
| 95 | .addClass('collapse'); |
|
| 96 | collapsedExpr(scope); |
|
| 97 | } |
|
| 98 | ||
| 99 | scope.$watch(attrs.uibCollapse, function(shouldCollapse) { |
|
| 100 | if (shouldCollapse) { |
|
| 101 | collapse(); |
|
| 102 | } else { |
|
| 103 | expand(); |
|
| 104 | } |
|
| 105 | }); |
|
| 106 | } |
|
| 107 | }; |
|
| 108 | }]); |
|
| 109 | ||
| 110 | angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse']) |
|
| 111 | ||