Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
chore(release): cut the v2.0.5 release
Browse files Browse the repository at this point in the history
  • Loading branch information
mgcrea committed Aug 7, 2014
1 parent 46d3d49 commit 8be78d0
Show file tree
Hide file tree
Showing 76 changed files with 208 additions and 136 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "angular-strap",
"description": "AngularStrap - AngularJS directives for Bootstrap",
"version": "2.0.4",
"version": "2.0.5",
"keywords": [
"angular",
"bootstrap"
Expand Down
78 changes: 57 additions & 21 deletions dist/angular-strap.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* angular-strap
* @version v2.0.4 - 2014-07-24
* @version v2.0.5 - 2014-08-07
* @link http://mgcrea.github.io/angular-strap
* @author Olivier Louvignes (olivier@mg-crea.com)
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand Down Expand Up @@ -573,6 +573,7 @@ angular.module('mgcrea.ngStrap.datepicker', [
startView: 0,
minView: 0,
startWeek: 0,
daysOfWeekDisabled: '',
iconLeft: 'glyphicon glyphicon-chevron-left',
iconRight: 'glyphicon glyphicon-chevron-right'
};
Expand All @@ -587,8 +588,8 @@ angular.module('mgcrea.ngStrap.datepicker', [
'$tooltip',
function ($window, $document, $rootScope, $sce, $locale, dateFilter, datepickerViews, $tooltip) {
var bodyEl = angular.element($window.document.body);
var isTouch = 'createTouch' in $window.document;
var isNative = /(ip(a|o)d|iphone|android)/gi.test($window.navigator.userAgent);
var isTouch = 'createTouch' in $window.document && isNative;
if (!defaults.lang)
defaults.lang = $locale.id;
function DatepickerFactory(element, controller, config) {
Expand Down Expand Up @@ -811,12 +812,14 @@ angular.module('mgcrea.ngStrap.datepicker', [
'dayFormat',
'strictFormat',
'startWeek',
'startDate',
'useNative',
'lang',
'startView',
'minView',
'iconLeft',
'iconRight'
'iconRight',
'daysOfWeekDisabled'
], function (key) {
if (angular.isDefined(attr[key]))
options[key] = attr[key];
Expand All @@ -829,9 +832,10 @@ angular.module('mgcrea.ngStrap.datepicker', [
newValue = newValue.match(',?(datepicker),?');
newValue === true ? datepicker.show() : datepicker.hide();
});
// Initialize datepicker
// Set expected iOS format
if (isNative && options.useNative)
options.dateFormat = 'yyyy-MM-dd';
// Initialize datepicker
var datepicker = $datepicker(element, controller, options);
options = datepicker.$options;
// Observe attributes for changes
Expand All @@ -850,6 +854,9 @@ angular.module('mgcrea.ngStrap.datepicker', [
datepicker.$options[key] = +new Date(newValue.substr(1, newValue.length - 2));
} else if (isNumeric(newValue)) {
datepicker.$options[key] = +new Date(parseInt(newValue, 10));
} else if (angular.isString(newValue) && 0 === newValue.length) {
// Reset date
datepicker.$options[key] = key === 'maxDate' ? +Infinity : -Infinity;
} else {
datepicker.$options[key] = +new Date(newValue);
}
Expand Down Expand Up @@ -943,9 +950,8 @@ angular.module('mgcrea.ngStrap.datepicker', [
};
// Garbage collection
scope.$on('$destroy', function () {
if (datepicker) {
if (datepicker)
datepicker.destroy();
}
options = null;
datepicker = null;
});
Expand Down Expand Up @@ -980,7 +986,7 @@ angular.module('mgcrea.ngStrap.datepicker', [
var weekDaysMin = $locale.DATETIME_FORMATS.SHORTDAY;
var weekDaysLabels = weekDaysMin.slice(options.startWeek).concat(weekDaysMin.slice(0, options.startWeek));
var weekDaysLabelsHtml = $sce.trustAsHtml('<th class="dow text-center">' + weekDaysLabels.join('</th><th class="dow text-center">') + '</th>');
var startDate = picker.$date || new Date();
var startDate = picker.$date || (options.startDate ? new Date(options.startDate) : new Date());
var viewDate = {
year: startDate.getFullYear(),
month: startDate.getMonth(),
Expand Down Expand Up @@ -1037,6 +1043,9 @@ angular.module('mgcrea.ngStrap.datepicker', [
// Disabled because of min/max date.
if (time < options.minDate || time > options.maxDate)
return true;
// Disabled due to being a disabled day of the week
if (options.daysOfWeekDisabled.indexOf(date.getDay()) !== -1)
return true;
// Disabled because of disabled date range.
if (options.disabledDateRanges) {
for (var i = 0; i < options.disabledDateRanges.length; i++) {
Expand Down Expand Up @@ -1222,6 +1231,7 @@ angular.module('mgcrea.ngStrap.dropdown', ['mgcrea.ngStrap.tooltip']).provider('
var options = angular.extend({}, defaults, config);
var scope = $dropdown.$scope = options.scope && options.scope.$new() || $rootScope.$new();
$dropdown = $tooltip(element, options);
var parentEl = element.parent();
// Protected methods
$dropdown.$onKeyDown = function (evt) {
if (!/(38|40)/.test(evt.keyCode))
Expand Down Expand Up @@ -1254,13 +1264,13 @@ angular.module('mgcrea.ngStrap.dropdown', ['mgcrea.ngStrap.tooltip']).provider('
options.keyboard && $dropdown.$element.on('keydown', $dropdown.$onKeyDown);
bodyEl.on('click', onBodyClick);
});
$dropdown.$element.parent().toggleClass('open');
parentEl.hasClass('dropdown') && parentEl.addClass('open');
};
var hide = $dropdown.hide;
$dropdown.hide = function () {
options.keyboard && $dropdown.$element.off('keydown', $dropdown.$onKeyDown);
bodyEl.off('click', onBodyClick);
$dropdown.$element.parent().toggleClass('open');
parentEl.hasClass('dropdown') && parentEl.removeClass('open');
hide();
};
// Private functions
Expand Down Expand Up @@ -1433,7 +1443,8 @@ angular.module('mgcrea.ngStrap.helpers.dateParser', []).provider('$dateParser',
}
// Sort result map
angular.forEach(map, function (v) {
sortedMap.push(v);
if (v)
sortedMap.push(v);
});
return sortedMap;
}
Expand Down Expand Up @@ -2071,6 +2082,7 @@ angular.module('mgcrea.ngStrap.navbar', []).provider('$navbar', function () {
angular.module('mgcrea.ngStrap.popover', ['mgcrea.ngStrap.tooltip']).provider('$popover', function () {
var defaults = this.defaults = {
animation: 'am-fade',
customClass: '',
container: false,
target: false,
placement: 'right',
Expand Down Expand Up @@ -2122,7 +2134,8 @@ angular.module('mgcrea.ngStrap.popover', ['mgcrea.ngStrap.tooltip']).provider('$
'trigger',
'keyboard',
'html',
'animation'
'animation',
'customClass'
], function (key) {
if (angular.isDefined(attr[key]))
options[key] = attr[key];
Expand Down Expand Up @@ -2426,7 +2439,8 @@ angular.module('mgcrea.ngStrap.select', [
'$tooltip',
function ($window, $document, $rootScope, $tooltip) {
var bodyEl = angular.element($window.document.body);
var isTouch = 'createTouch' in $window.document;
var isNative = /(ip(a|o)d|iphone|android)/gi.test($window.navigator.userAgent);
var isTouch = 'createTouch' in $window.document && isNative;
function SelectFactory(element, controller, config) {
var $select = {};
// Common vars
Expand Down Expand Up @@ -2775,7 +2789,8 @@ angular.module('mgcrea.ngStrap.timepicker', [
hourStep: 1,
minuteStep: 5,
iconUp: 'glyphicon glyphicon-chevron-up',
iconDown: 'glyphicon glyphicon-chevron-down'
iconDown: 'glyphicon glyphicon-chevron-down',
arrowBehavior: 'pager'
};
this.$get = [
'$window',
Expand All @@ -2787,8 +2802,8 @@ angular.module('mgcrea.ngStrap.timepicker', [
'$tooltip',
function ($window, $document, $rootScope, $sce, $locale, dateFilter, $tooltip) {
var bodyEl = angular.element($window.document.body);
var isTouch = 'createTouch' in $window.document;
var isNative = /(ip(a|o)d|iphone|android)/gi.test($window.navigator.userAgent);
var isTouch = 'createTouch' in $window.document && isNative;
if (!defaults.lang)
defaults.lang = $locale.id;
function timepickerFactory(element, controller, config) {
Expand Down Expand Up @@ -2913,6 +2928,25 @@ angular.module('mgcrea.ngStrap.timepicker', [
}
return selectedTime < options.minTime * 1 || selectedTime > options.maxTime * 1;
};
scope.$arrowAction = function (value, index) {
if (options.arrowBehavior === 'picker') {
$timepicker.$setTimeByStep(value, index);
} else {
$timepicker.$moveIndex(value, index);
}
};
$timepicker.$setTimeByStep = function (value, index) {
var newDate = new Date($timepicker.$date);
var hours = newDate.getHours(), hoursLength = dateFilter(newDate, 'h').length;
var minutes = newDate.getMinutes(), minutesLength = dateFilter(newDate, 'mm').length;
if (index === 0) {
newDate.setHours(hours - parseInt(options.hourStep, 10) * value);
} else {
newDate.setMinutes(minutes - parseInt(options.minuteStep, 10) * value);
}
$timepicker.select(newDate, index, true);
parentScope.$digest();
};
$timepicker.$moveIndex = function (value, index) {
var targetDate;
if (index === 0) {
Expand Down Expand Up @@ -3095,7 +3129,8 @@ angular.module('mgcrea.ngStrap.timepicker', [
'useNative',
'hourStep',
'minuteStep',
'length'
'length',
'arrowBehavior'
], function (key) {
if (angular.isDefined(attr[key]))
options[key] = attr[key];
Expand Down Expand Up @@ -3436,17 +3471,17 @@ angular.module('mgcrea.ngStrap.tooltip', ['mgcrea.ngStrap.helpers.dimensions']).
scope.$emit(options.prefixEvent + '.hide.before', $tooltip);
$animate.leave(tipElement, function () {
scope.$emit(options.prefixEvent + '.hide', $tooltip);
// Allow to blur the input when hidden, like when pressing enter key
if (blur && options.trigger === 'focus') {
return element[0].blur();
}
});
$tooltip.$isShown = scope.$isShown = false;
scope.$$phase || scope.$root && scope.$root.$$phase || scope.$digest();
// Unbind events
if (options.keyboard && tipElement !== null) {
tipElement.off('keyup', $tooltip.$onKeyUp);
}
// Allow to blur the input when hidden, like when pressing enter key
if (blur && options.trigger === 'focus') {
return element[0].blur();
}
};
$tooltip.toggle = function () {
$tooltip.$isShown ? $tooltip.leave() : $tooltip.enter();
Expand Down Expand Up @@ -3621,7 +3656,8 @@ angular.module('mgcrea.ngStrap.tooltip', ['mgcrea.ngStrap.helpers.dimensions']).
var tooltip = $tooltip(element, options);
// Garbage collection
scope.$on('$destroy', function () {
tooltip.destroy();
if (tooltip)
tooltip.destroy();
options = null;
tooltip = null;
});
Expand Down Expand Up @@ -3729,9 +3765,9 @@ angular.module('mgcrea.ngStrap.typeahead', [
$typeahead.$onKeyDown = function (evt) {
if (!/(38|40|13)/.test(evt.keyCode))
return;
evt.preventDefault();
// Let ngSubmit pass if the typeahead tip is hidden
if ($typeahead.$isVisible()) {
evt.preventDefault();
evt.stopPropagation();
}
// Select with enter
Expand Down
6 changes: 3 additions & 3 deletions dist/angular-strap.min.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions dist/angular-strap.tpl.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* angular-strap
* @version v2.0.4 - 2014-07-24
* @version v2.0.5 - 2014-08-07
* @link http://mgcrea.github.io/angular-strap
* @author Olivier Louvignes (olivier@mg-crea.com)
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand Down Expand Up @@ -76,23 +76,23 @@ angular.module('mgcrea.ngStrap.tab').run([
angular.module('mgcrea.ngStrap.timepicker').run([
'$templateCache',
function ($templateCache) {
$templateCache.put('timepicker/timepicker.tpl.html', '<div class="dropdown-menu timepicker" style="min-width: 0px;width: auto"><table height="100%"><thead><tr class="text-center"><th><button tabindex="-1" type="button" class="btn btn-default pull-left" ng-click="$moveIndex(-1, 0)"><i class="{{$iconUp}}"></i></button></th><th>&nbsp;</th><th><button tabindex="-1" type="button" class="btn btn-default pull-left" ng-click="$moveIndex(-1, 1)"><i class="{{$iconUp}}"></i></button></th></tr></thead><tbody><tr ng-repeat="(i, row) in rows"><td class="text-center"><button tabindex="-1" style="width: 100%" type="button" class="btn btn-default" ng-class="{\'btn-primary\': row[0].selected}" ng-click="$select(row[0].date, 0)" ng-disabled="row[0].disabled"><span ng-class="{\'text-muted\': row[0].muted}" ng-bind="row[0].label"></span></button></td><td><span ng-bind="i == midIndex ? timeSeparator : \' \'"></span></td><td class="text-center"><button tabindex="-1" ng-if="row[1].date" style="width: 100%" type="button" class="btn btn-default" ng-class="{\'btn-primary\': row[1].selected}" ng-click="$select(row[1].date, 1)" ng-disabled="row[1].disabled"><span ng-class="{\'text-muted\': row[1].muted}" ng-bind="row[1].label"></span></button></td><td ng-if="showAM">&nbsp;</td><td ng-if="showAM"><button tabindex="-1" ng-show="i == midIndex - !isAM * 1" style="width: 100%" type="button" ng-class="{\'btn-primary\': !!isAM}" class="btn btn-default" ng-click="$switchMeridian()" ng-disabled="el.disabled">AM</button> <button tabindex="-1" ng-show="i == midIndex + 1 - !isAM * 1" style="width: 100%" type="button" ng-class="{\'btn-primary\': !isAM}" class="btn btn-default" ng-click="$switchMeridian()" ng-disabled="el.disabled">PM</button></td></tr></tbody><tfoot><tr class="text-center"><th><button tabindex="-1" type="button" class="btn btn-default pull-left" ng-click="$moveIndex(1, 0)"><i class="{{$iconDown}}"></i></button></th><th>&nbsp;</th><th><button tabindex="-1" type="button" class="btn btn-default pull-left" ng-click="$moveIndex(1, 1)"><i class="{{$iconDown}}"></i></button></th></tr></tfoot></table></div>');
$templateCache.put('timepicker/timepicker.tpl.html', '<div class="dropdown-menu timepicker" style="min-width: 0px;width: auto"><table height="100%"><thead><tr class="text-center"><th><button tabindex="-1" type="button" class="btn btn-default pull-left" ng-click="$arrowAction(-1, 0)"><i class="{{ $iconUp }}"></i></button></th><th>&nbsp;</th><th><button tabindex="-1" type="button" class="btn btn-default pull-left" ng-click="$arrowAction(-1, 1)"><i class="{{ $iconUp }}"></i></button></th></tr></thead><tbody><tr ng-repeat="(i, row) in rows"><td class="text-center"><button tabindex="-1" style="width: 100%" type="button" class="btn btn-default" ng-class="{\'btn-primary\': row[0].selected}" ng-click="$select(row[0].date, 0)" ng-disabled="row[0].disabled"><span ng-class="{\'text-muted\': row[0].muted}" ng-bind="row[0].label"></span></button></td><td><span ng-bind="i == midIndex ? timeSeparator : \' \'"></span></td><td class="text-center"><button tabindex="-1" ng-if="row[1].date" style="width: 100%" type="button" class="btn btn-default" ng-class="{\'btn-primary\': row[1].selected}" ng-click="$select(row[1].date, 1)" ng-disabled="row[1].disabled"><span ng-class="{\'text-muted\': row[1].muted}" ng-bind="row[1].label"></span></button></td><td ng-if="showAM">&nbsp;</td><td ng-if="showAM"><button tabindex="-1" ng-show="i == midIndex - !isAM * 1" style="width: 100%" type="button" ng-class="{\'btn-primary\': !!isAM}" class="btn btn-default" ng-click="$switchMeridian()" ng-disabled="el.disabled">AM</button> <button tabindex="-1" ng-show="i == midIndex + 1 - !isAM * 1" style="width: 100%" type="button" ng-class="{\'btn-primary\': !isAM}" class="btn btn-default" ng-click="$switchMeridian()" ng-disabled="el.disabled">PM</button></td></tr></tbody><tfoot><tr class="text-center"><th><button tabindex="-1" type="button" class="btn btn-default pull-left" ng-click="$arrowAction(1, 0)"><i class="{{ $iconDown }}"></i></button></th><th>&nbsp;</th><th><button tabindex="-1" type="button" class="btn btn-default pull-left" ng-click="$arrowAction(1, 1)"><i class="{{ $iconDown }}"></i></button></th></tr></tfoot></table></div>');
}
]);

// Source: tooltip.tpl.js
angular.module('mgcrea.ngStrap.tooltip').run([
// Source: typeahead.tpl.js
angular.module('mgcrea.ngStrap.typeahead').run([
'$templateCache',
function ($templateCache) {
$templateCache.put('tooltip/tooltip.tpl.html', '<div class="tooltip in" ng-show="title"><div class="tooltip-arrow"></div><div class="tooltip-inner" ng-bind="title"></div></div>');
$templateCache.put('typeahead/typeahead.tpl.html', '<ul tabindex="-1" class="typeahead dropdown-menu" ng-show="$isVisible()" role="select"><li role="presentation" ng-repeat="match in $matches" ng-class="{active: $index == $activeIndex}"><a role="menuitem" tabindex="-1" ng-click="$select($index, $event)" ng-bind="match.label"></a></li></ul>');
}
]);

// Source: typeahead.tpl.js
angular.module('mgcrea.ngStrap.typeahead').run([
// Source: tooltip.tpl.js
angular.module('mgcrea.ngStrap.tooltip').run([
'$templateCache',
function ($templateCache) {
$templateCache.put('typeahead/typeahead.tpl.html', '<ul tabindex="-1" class="typeahead dropdown-menu" ng-show="$isVisible()" role="select"><li role="presentation" ng-repeat="match in $matches" ng-class="{active: $index == $activeIndex}"><a role="menuitem" tabindex="-1" ng-click="$select($index, $event)" ng-bind="match.label"></a></li></ul>');
$templateCache.put('tooltip/tooltip.tpl.html', '<div class="tooltip in" ng-show="title"><div class="tooltip-arrow"></div><div class="tooltip-inner" ng-bind="title"></div></div>');
}
]);

Expand Down
Loading

0 comments on commit 8be78d0

Please sign in to comment.