8000 2.2.0 · angular-ui/bootstrap-bower@9992f42 · GitHub
[go: up one dir, main page]

Skip to content 8000
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 9992f42

Browse files
committed
2.2.0
1 parent f13d7bd commit 9992f42

File tree

6 files changed

+199
-23
lines changed

6 files changed

+199
-23
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"license": "MIT",
1212
"ignore": [],
1313
"description": "Native AngularJS (Angular) directives for Bootstrap.",
14-
"version": "2.1.4",
14+
"version": "2.2.0",
1515
"main": ["./ui-bootstrap-tpls.js"],
1616
"dependencies": {
1717
"angular": ">=1.4.0"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-bootstrap",
3-
"version": "2.1.4",
3+
"version": "2.2.0",
44
"description": "Bootstrap widgets for Angular",
55
"main": "index.js",
66
"homepage": "http://angular-ui.github.io/bootstrap/",

ui-bootstrap-tpls.js

Lines changed: 94 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* angular-ui-bootstrap
33
* http://angular-ui.github.io/bootstrap/
44
5-
* Version: 2.1.4 - 2016-09-23
5+
* Version: 2.2.0 - 2016-10-10
66
* License: MIT
77
*/angular.module("ui.bootstrap", ["ui.bootstrap.tpls", "ui.bootstrap.collapse","ui.bootstrap.tabindex","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"]);
88
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/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"]);
@@ -2208,7 +2208,7 @@ angular.module('ui.bootstrap.position', [])
22082208
var paddingRight = this.parseStyle(elemStyle.paddingRight);
22092209
var paddingBottom = this.parseStyle(elemStyle.paddingBottom);
22102210
var scrollParent = this.scrollParent(elem, false, true);
2211-
var scrollbarWidth = this.scrollbarWidth(scrollParent, BODY_REGEX.test(scrollParent.tagName));
2211+
var scrollbarWidth = this.scrollbarWidth(BODY_REGEX.test(scrollParent.tagName));
22122212

22132213
return {
22142214
scrollbarWidth: scrollbarWidth,
@@ -3192,9 +3192,9 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
31923192

31933193
this.close = function(dropdownScope, element) {
31943194
if (openScope === dropdownScope) {
3195-
openScope = null;
31963195
$document.off('click', closeDropdown);
31973196
$document.off('keydown', this.keybindFilter);
3197+
openScope = null;
31983198
}
31993199
};
32003200

@@ -3227,6 +3227,11 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
32273227
};
32283228

32293229
this.keybindFilter = function(evt) {
3230+
if (!openScope) {
3231+
// see this.close as ESC could have been pressed which kills the scope so we can not proceed
3232+
return;
3233+
}
3234+
32303235
var dropdownElement = openScope.getDropdownElement();
32313236
var toggleElement = openScope.getToggleElement();
32323237
var dropdownElementTargeted = dropdownElement && dropdownElement[0].contains(evt.target);
@@ -3744,7 +3749,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
37443749
// {@link Attribute#$observe} on it. For more details please see {@link TableColumnResize}.
37453750
scope.$isRendered = true;
37463751

3747-
// Deferred object that will be resolved when this modal is render.
3752+
// Deferred object that will be resolved when this modal is rendered.
37483753
var modalRenderDeferObj = $q.defer();
37493754
// Resolve render promise post-digest
37503755
scope.$$postDigest(function() {
@@ -3777,7 +3782,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
37773782

37783783
/**
37793784
* If something within the freshly-opened modal already has focus (perhaps via a
3780-
* directive that causes focus). then no need to try and focus anything.
3785+
* directive that causes focus) then there's no need to try to focus anything.
37813786
*/
37823787
if (!($document[0].activeElement && element[0].contains($document[0].activeElement))) {
37833788
var inputWithAutofocus = element[0].querySelector('[autofocus]');
@@ -3835,6 +3840,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
38353840
};
38363841
var topModalIndex = 0;
38373842
var previousTopOpenedModal = null;
3843+
var ARIA_HIDDEN_ATTRIBUTE_NAME = 'data-bootstrap-modal-aria-hidden-count';
38383844

38393845
//Modal focus behavior
38403846
var tabbableSelector = 'a[href], area[href], input:not([disabled]):not([tabindex=\'-1\']), ' +
@@ -4136,25 +4142,74 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
41364142

41374143
openedWindows.top().value.modalDomEl = angularDomEl;
41384144
openedWindows.top().value.modalOpener = modalOpener;
4145+
4146+
applyAriaHidden(angularDomEl);
4147+
4148+
function applyAriaHidden(el) {
4149+
if (!el || el[0].tagName === 'BODY') {
4150+
return;
4151+
}
4152+
4153+
getSiblings(el).forEach(function(sibling) {
4154+
var elemIsAlreadyHidden = sibling.getAttribute('aria-hidden') === 'true',
4155+
ariaHiddenCount = parseInt(sibling.getAttribute(ARIA_HIDDEN_ATTRIBUTE_NAME), 10);
4156+
4157+
if (!ariaHiddenCount) {
4158+
ariaHiddenCount = elemIsAlreadyHidden ? 1 : 0;
4159+
}
4160+
4161+
sibling.setAttribute(ARIA_HIDDEN_ATTRIBUTE_NAME, ariaHiddenCount + 1);
4162+
sibling.setAttribute('aria-hidden', 'true');
4163+
});
4164+
4165+
return applyAriaHidden(el.parent());
4166+
4167+
function getSiblings(el) {
4168+
var children = el.parent() ? el.parent().children() : [];
4169+
4170+
return Array.prototype.filter.call(children, function(child) {
4171+
return child !== el[0];
4172+
});
4173+
}
4174+
}
41394175
};
41404176

41414177
function broadcastClosing(modalWindow, resultOrReason, closing) {
41424178
return !modalWindow.value.modalScope.$broadcast('modal.closing', resultOrReason, closing).defaultPrevented;
41434179
}
41444180

4181+
function unhideBackgroundElements() {
4182+
Array.prototype.forEach.call(
4183+
document.querySelectorAll('[' + ARIA_HIDDEN_ATTRIBUTE_NAME + ']'),
4184+
function(hiddenEl) {
4185+
var ariaHiddenCount = parseInt(hiddenEl.getAttribute(ARIA_HIDDEN_ATTRIBUTE_NAME), 10),
4186+
newHiddenCount = ariaHiddenCount - 1;
4187+
hiddenEl.setAttribute(ARIA_HIDDEN_ATTRIBUTE_NAME, newHiddenCount);
4188+
4189+
if (!newHiddenCount) {
4190+
hiddenEl.removeAttribute(ARIA_HIDDEN_ATTRIBUTE_NAME);
4191+
hiddenEl.removeAttribute('aria-hidden');
4192+
}
4193+
}
4194+
);
4195+
}
4196+
41454197
$modalStack.close = function(modalInstance, result) {
41464198
var modalWindow = openedWindows.get(modalInstance);
4199+
unhideBackgroundElements();
41474200
if (modalWindow && broadcastClosing(modalWindow, result, true)) {
41484201
modalWindow.value.modalScope.$$uibDestructionScheduled = true;
41494202
modalWindow.value.deferred.resolve(result);
41504203
removeModalWindow(modalInstance, modalWindow.value.modalOpener);
41514204
return true;
41524205
}
4206+
41534207
return !modalWindow;
41544208
};
41554209

41564210
$modalStack.dismiss = function(modalInstance, reason) {
41574211
var modalWindow = openedWindows.get(modalInstance);
4212+
unhideBackgroundElements();
41584213
if (modalWindow && broadcastClosing(modalWindow, reason, false)) {
41594214
modalWindow.value.modalScope.$$uibDestructionScheduled = true;
41604215
modalWindow.value.deferred.reject(reason);
@@ -4177,6 +4232,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
41774232

41784233
$modalStack.modalRendered = function(modalInstance) {
41794234
var modalWindow = openedWindows.get(modalInstance);
4235+
$modalStack.focusFirstFocusableElement($modalStack.loadFocusElementList(modalWindow));
41804236
if (modalWindow) {
41814237
modalWindow.value.renderDeferred.resolve();
41824238
}
@@ -4850,6 +4906,7 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
48504906
var showTimeout;
48514907
var hideTimeout;
48524908
var positionTimeout;
4909+
var adjustmentTimeout;
48534910
var appendToBody = angular.isDefined(options.appendToBody) ? options.appendToBody : false;
48544911
var triggers = getTriggers(undefined);
48554912
var hasEnableExp = angular.isDefined(attrs[prefix + 'Enable']);
@@ -4882,12 +4939,13 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
48824939
tooltip.addClass(options.placementClassPrefix + ttPosition.placement);
48834940
}
48844941

4885-
$timeout(function() {
4942+
adjustmentTimeout = $timeout(function() {
48864943
var currentHeight = angular.isDefined(tooltip.offsetHeight) ? tooltip.offsetHeight : tooltip.prop('offsetHeight');
48874944
var adjustment = $position.adjustTop(placementClasses, elementPos, initialHeight, currentHeight);
48884945
if (adjustment) {
48894946
tooltip.css(adjustment);
48904947
}
4948+
adjustmentTimeout = null;
48914949
}, 0, false);
48924950

48934951
// first time through tt element will have the
@@ -5052,7 +5110,11 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
50525110

50535111
if (tooltip) {
50545112
tooltip.remove();
5113+
50555114
tooltip = null;
5115+
if (adjustmentTimeout) {
5116+
$timeout.cancel(adjustmentTimeout);
5117+
}
50565118
}
50575119

50585120
openedTooltips.remove(ttScope);
@@ -5940,6 +6002,7 @@ angular.module('ui.bootstrap.timepicker', [])
59406002
})
59416003

59426004
.controller('UibTimepickerController', ['$scope', '$element', '$attrs', '$parse', '$log', '$locale', 'uibTimepickerConfig', function($scope, $element, $attrs, $parse, $log, $locale, timepickerConfig) {
6005+
var hoursModelCtrl, minutesModelCtrl, secondsModelCtrl;
59436006
var selected = new Date(),
59446007
watchers = [],
59456008
ngModelCtrl = { $setViewValue: angular.noop }, // nullModelCtrl
@@ -5961,6 +6024,10 @@ angular.module('ui.bootstrap.timepicker', [])
59616024
minutesInputEl = inputs.eq(1),
59626025
secondsInputEl = inputs.eq(2);
59636026

6027+
hoursModelCtrl = hoursInputEl.controller('ngModel');
6028+
minutesModelCtrl = minutesInputEl.controller('ngModel');
6029+
secondsModelCtrl = secondsInputEl.controller('ngModel');
6030+
59646031
var mousewheel = angular.isDefined($attrs.mousewheel) ? $scope.$parent.$eval($attrs.mousewheel) : timepickerConfig.mousewheel;
59656032

59666033
if (mousewheel) {
@@ -6220,14 +6287,23 @@ angular.module('ui.bootstrap.timepicker', [])
62206287
ngModelCtrl.$setValidity('time', false);
62216288
if (angular.isDefined(invalidHours)) {
62226289
$scope.invalidHours = invalidHours;
6290+
if (hoursModelCtrl) {
6291+
hoursModelCtrl.$setValidity('hours', false);
6292+
}
62236293
}
62246294

62256295
if (angular.isDefined(invalidMinutes)) {
62266296
$scope.invalidMinutes = invalidMinutes;
6297+
if (minutesModelCtrl) {
6298+
minutesModelCtrl.$setValidity('minutes', false);
6299+
}
62276300
}
62286301

62296302
if (angular.isDefined(invalidSeconds)) {
62306303
$scope.invalidSeconds = invalidSeconds;
6304+
if (secondsModelCtrl) {
6305+
secondsModelCtrl.$setValidity('seconds', false);
6306+
}
62316307
}
62326308
};
62336309

@@ -6350,6 +6426,18 @@ angular.module('ui.bootstrap.timepicker', [])
63506426
}
63516427

63526428
function makeValid() {
6429+
if (hoursModelCtrl) {
6430+
hoursModelCtrl.$setValidity('hours', true);
6431+
}
6432+
6433+
if (minutesModelCtrl) {
6434+
minutesModelCtrl.$setValidity('minutes', true);
6435+
}
6436+
6437+
if (secondsModelCtrl) {
6438+
secondsModelCtrl.$setValidity('seconds', true);
6439+
}
6440+
63536441
ngModelCtrl.$setValidity('time', true);
63546442
$scope.invalidHours = false;
63556443
$scope.invalidMinutes = false;

ui-bootstrap-tpls.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0