Skip to content

Commit 5d53287

Browse files
committed
1.3.3
1 parent 03d320a commit 5d53287

6 files changed

+148
-112
lines changed

bower.json

+1-1
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": "1.3.2",
14+
"version": "1.3.3",
1515
"main": ["./ui-bootstrap-tpls.js"],
1616
"dependencies": {
1717
"angular": ">=1.4.0"

package.json

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

ui-bootstrap-tpls.js

+69-51
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: 1.3.2 - 2016-04-14
5+
* Version: 1.3.3 - 2016-05-22
66
* License: MIT
77
*/angular.module("ui.bootstrap", ["ui.bootstrap.tpls", "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"]);
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/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"]);
@@ -234,13 +234,23 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
234234
link: function(scope, element, attrs, controller) {
235235
scope.$watch(function() { return controller[attrs.uibAccordionTransclude]; }, function(heading) {
236236
if (heading) {
237-
var elem = angular.element(element[0].querySelector('[uib-accordion-header]'));
237+
var elem = angular.element(element[0].querySelector(getHeaderSelectors()));
238238
elem.html('');
239239
elem.append(heading);
240240
}
241241
});
242242
}
243243
};
244+
245+
function getHeaderSelectors() {
246+
return 'uib-accordion-header,' +
247+
'data-uib-accordion-header,' +
248+
'x-uib-accordion-header,' +
249+
'uib\\:accordion-header,' +
250+
'[uib-accordion-header],' +
251+
'[data-uib-accordion-header],' +
252+
'[x-uib-accordion-header]';
253+
}
244254
});
245255

246256
angular.module('ui.bootstrap.alert', [])
@@ -1184,8 +1194,9 @@ angular.module('ui.bootstrap.dateparser', [])
11841194
return date && timezone ? convertTimezoneToLocal(date, timezone, true) : date;
11851195
}
11861196

1187-
//https://github.com/angular/angular.js/blob/4daafd3dbe6a80d578f5a31df1bb99c77559543e/src/Angular.js#L1207
1197+
//https://github.com/angular/angular.js/blob/622c42169699ec07fc6daaa19fe6d224e5d2f70e/src/Angular.js#L1207
11881198
function timezoneToOffset(timezone, fallback) {
1199+
timezone = timezone.replace(/:/g, '');
11891200
var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
11901201
return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
11911202
}
@@ -1198,8 +1209,9 @@ angular.module('ui.bootstrap.dateparser', [])
11981209

11991210
function convertTimezoneToLocal(date, timezone, reverse) {
12001211
reverse = reverse ? -1 : 1;
1201-
var timezoneOffset = timezoneToOffset(timezone, date.getTimezoneOffset());
1202-
return addDateMinutes(date, reverse * (timezoneOffset - date.getTimezoneOffset()));
1212+
var dateTimezoneOffset = date.getTimezoneOffset();
1213+
var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
1214+
return addDateMinutes(date, reverse * (timezoneOffset - dateTimezoneOffset));
12031215
}
12041216
}]);
12051217

@@ -1471,8 +1483,9 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
14711483
self.activeDate = new Date();
14721484
}
14731485

1474-
this.activeDate = ngModelCtrl.$modelValue ?
1475-
dateParser.fromTimezone(new Date(ngModelCtrl.$modelValue), ngModelOptions.timezone) :
1486+
var date = ngModelCtrl.$modelValue ? new Date(ngModelCtrl.$modelValue) : new Date();
1487+
this.activeDate = !isNaN(date) ?
1488+
dateParser.fromTimezone(date, ngModelOptions.timezone) :
14761489
dateParser.fromTimezone(new Date(), ngModelOptions.timezone);
14771490

14781491
ngModelCtrl.$render = function() {
@@ -2677,12 +2690,12 @@ function($scope, $element, $attrs, $compile, $log, $parse, $window, $document, $
26772690
return value;
26782691
}
26792692

2680-
$scope.date = dateParser.fromTimezone(value, timezone);
2681-
2682-
if (angular.isNumber($scope.date)) {
2683-
$scope.date = new Date($scope.date);
2693+
if (angular.isNumber(value)) {
2694+
value = new Date(value);
26842695
}
26852696

2697+
$scope.date = dateParser.fromTimezone(value, timezone);
2698+
26862699
return dateParser.filter($scope.date, dateFormat);
26872700
});
26882701
} else {
@@ -3217,7 +3230,8 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
32173230
if (appendTo && self.dropdownMenu) {
32183231
var pos = $position.positionElements($element, self.dropdownMenu, 'bottom-left', true),
32193232
css,
3220-
rightalign;
3233+
rightalign,
3234+
scrollbarWidth;
32213235

32223236
css = {
32233237
top: pos.top + 'px',
@@ -3230,7 +3244,8 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
32303244
css.right = 'auto';
32313245
} else {
32323246
css.left = 'auto';
3233-
css.right = window.innerWidth -
3247+
scrollbarWidth = $position.scrollbarWidth(true);
3248+
css.right = window.innerWidth - scrollbarWidth -
32343249
(pos.left + $element.prop('offsetWidth')) + 'px';
32353250
}
32363251

@@ -4117,30 +4132,27 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
41174132
//controllers
41184133
if (modalOptions.controller) {
41194134
ctrlLocals.$scope = modalScope;
4135+
ctrlLocals.$scope.$resolve = {};
41204136
ctrlLocals.$uibModalInstance = modalInstance;
41214137
angular.forEach(tplAndVars[1], function(value, key) {
41224138
ctrlLocals[key] = value;
4139+
ctrlLocals.$scope.$resolve[key] = value;
41234140
});
41244141

41254142
// the third param will make the controller instantiate later,private api
41264143
// @see https://github.com/angular/angular.js/blob/master/src/ng/controller.js#L126
4127-
ctrlInstantiate = $controller(modalOptions.controller, ctrlLocals, true);
4128-
if (modalOptions.controllerAs) {
4144+
ctrlInstantiate = $controller(modalOptions.controller, ctrlLocals, true, modalOptions.controllerAs);
4145+
if (modalOptions.controllerAs && modalOptions.bindToController) {
41294146
ctrlInstance = ctrlInstantiate.instance;
4130-
4131-
if (modalOptions.bindToController) {
4132-
ctrlInstance.$close = modalScope.$close;
4133-
ctrlInstance.$dismiss = modalScope.$dismiss;
4134-
angular.extend(ctrlInstance, providedScope);
4135-
}
4136-
4137-
ctrlInstance = ctrlInstantiate();
4138-
4139-
modalScope[modalOptions.controllerAs] = ctrlInstance;
4140-
} else {
4141-
ctrlInstance = ctrlInstantiate();
4147+
ctrlInstance.$close = modalScope.$close;
4148+
ctrlInstance.$dismiss = modalScope.$dismiss;
4149+
angular.extend(ctrlInstance, {
4150+
$resolve: ctrlLocals.$scope.$resolve
4151+
}, providedScope);
41424152
}
41434153

4154+
ctrlInstance = ctrlInstantiate();
4155+
41444156
if (angular.isFunction(ctrlInstance.$onInit)) {
41454157
ctrlInstance.$onInit();
41464158
}
@@ -5445,7 +5457,8 @@ angular.module('ui.bootstrap.tabs', [])
54455457
var previousSelected = ctrl.tabs[previousIndex];
54465458
if (previousSelected) {
54475459
previousSelected.tab.onDeselect({
5448-
$event: evt
5460+
$event: evt,
5461+
$selectedIndex: index
54495462
});
54505463
if (evt && evt.isDefaultPrevented()) {
54515464
return;
@@ -5461,7 +5474,7 @@ angular.module('ui.bootstrap.tabs', [])
54615474
selected.tab.active = true;
54625475
ctrl.active = selected.index;
54635476
oldIndex = selected.index;
5464-
} else if (!selected && angular.isNumber(oldIndex)) {
5477+
} else if (!selected && angular.isDefined(oldIndex)) {
54655478
ctrl.active = null;
54665479
oldIndex = null;
54675480
}
@@ -5485,7 +5498,7 @@ angular.module('ui.bootstrap.tabs', [])
54855498
return 0;
54865499
});
54875500

5488-
if (tab.index === ctrl.active || !angular.isNumber(ctrl.active) && ctrl.tabs.length === 1) {
5501+
if (tab.index === ctrl.active || !angular.isDefined(ctrl.active) && ctrl.tabs.length === 1) {
54895502
var newActiveIndex = findTabIndex(tab.index);
54905503
ctrl.select(newActiveIndex);
54915504
}
@@ -5510,7 +5523,7 @@ angular.module('ui.bootstrap.tabs', [])
55105523
};
55115524

55125525
$scope.$watch('tabset.active', function(val) {
5513-
if (angular.isNumber(val) && val !== oldIndex) {
5526+
if (angular.isDefined(val) && val !== oldIndex) {
55145527
ctrl.select(findTabIndex(val));
55155528
}
55165529
});
@@ -5548,9 +5561,6 @@ angular.module('ui.bootstrap.tabs', [])
55485561
scope.$parent.$eval(attrs.vertical) : false;
55495562
scope.justified = angular.isDefined(attrs.justified) ?
55505563
scope.$parent.$eval(attrs.justified) : false;
5551-
if (angular.isUndefined(attrs.active)) {
5552-
scope.active = 0;
5553-
}
55545564
}
55555565
};
55565566
})
@@ -6281,7 +6291,7 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.debounce', 'ui.bootstrap
62816291
originalScope.$watch(attrs.typeaheadMinLength, function (newVal) {
62826292
minLength = !newVal && newVal !== 0 ? 1 : newVal;
62836293
});
6284-
6294+
62856295
//minimal wait time after last character typed before typeahead kicks-in
62866296
var waitTime = originalScope.$eval(attrs.typeaheadWaitMs) || 0;
62876297

@@ -6294,6 +6304,12 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.debounce', 'ui.bootstrap
62946304
//binding to a variable that indicates if matches are being retrieved asynchronously
62956305
var isLoadingSetter = $parse(attrs.typeaheadLoading).assign || angular.noop;
62966306

6307+
//a function to determine if an event should cause selection
6308+
var isSelectEvent = attrs.typeaheadShouldSelect ? $parse(attrs.typeaheadShouldSelect) : function(scope, vals) {
6309+
var evt = vals.$event;
6310+
return evt.which === 13 || evt.which === 9;
6311+
};
6312+
62976313
//a callback executed when a match is selected
62986314
var onSelectCallback = $parse(attrs.typeaheadOnSelect);
62996315

@@ -6609,13 +6625,15 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.debounce', 'ui.bootstrap
66096625
return;
66106626
}
66116627

6628+
var shouldSelect = isSelectEvent(originalScope, {$event: evt});
6629+
66126630
/**
66136631
* if there's nothing selected (i.e. focusFirst) and enter or tab is hit
66146632
* or
66156633
* shift + tab is pressed to bring focus to the previous element
66166634
* then clear the results
66176635
*/
6618-
if (scope.activeIdx === -1 && (evt.which === 9 || evt.which === 13) || evt.which === 9 && !!evt.shiftKey) {
6636+
if (scope.activeIdx === -1 && shouldSelect || evt.which === 9 && !!evt.shiftKey) {
66196637
resetMatches();
66206638
scope.$digest();
66216639
return;
@@ -6624,36 +6642,36 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.debounce', 'ui.bootstrap
66246642
evt.preventDefault();
66256643
var target;
66266644
switch (evt.which) {
6627-
case 9:
6628-
case 13:
6629-
scope.$apply(function () {
6630-
if (angular.isNumber(scope.debounceUpdate) || angular.isObject(scope.debounceUpdate)) {
6631-
$$debounce(function() {
6632-
scope.select(scope.activeIdx, evt);
6633-
}, angular.isNumber(scope.debounceUpdate) ? scope.debounceUpdate : scope.debounceUpdate['default']);
6634-
} else {
6635-
scope.select(scope.activeIdx, evt);
6636-
}
6637-
});
6638-
break;
6639-
case 27:
6645+
case 27: // escape
66406646
evt.stopPropagation();
66416647

66426648
resetMatches();
66436649
originalScope.$digest();
66446650
break;
6645-
case 38:
6651+
case 38: // up arrow
66466652
scope.activeIdx = (scope.activeIdx > 0 ? scope.activeIdx : scope.matches.length) - 1;
66476653
scope.$digest();
66486654
target = popUpEl.find('li')[scope.activeIdx];
66496655
target.parentNode.scrollTop = target.offsetTop;
66506656
break;
6651-
case 40:
6657+
case 40: // down arrow
66526658
scope.activeIdx = (scope.activeIdx + 1) % scope.matches.length;
66536659
scope.$digest();
66546660
target = popUpEl.find('li')[scope.activeIdx];
66556661
target.parentNode.scrollTop = target.offsetTop;
66566662
break;
6663+
default:
6664+
if (shouldSelect) {
6665+
scope.$apply(function() {
6666+
if (angular.isNumber(scope.debounceUpdate) || angular.isObject(scope.debounceUpdate)) {
6667+
$$debounce(function() {
6668+
scope.select(scope.activeIdx, evt);
6669+
}, angular.isNumber(scope.debounceUpdate) ? scope.debounceUpdate : scope.debounceUpdate['default']);
6670+
} else {
6671+
scope.select(scope.activeIdx, evt);
6672+
}
6673+
});
6674+
}
66576675
}
66586676
});
66596677

ui-bootstrap-tpls.min.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)