Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update distribution with latest bugfix #307

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions app/scripts/datePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ Module.directive('datePicker', ['datePickerConfig', 'datePickerUtils', function
partial = !!attrs.partial,
minDate = getDate('minDate'),
maxDate = getDate('maxDate'),
pickerID = element[0].id,
now = scope.now = createMoment(),
selected = scope.date = createMoment(scope.model || now),
selected = scope.date = createMoment(scope.model || minDate || now),
autoclose = attrs.autoClose === 'true',
// Either gets the 1st day from the attributes, or asks moment.js to give it to us as it is localized.
firstDay = attrs.firstDay && attrs.firstDay >= 0 && attrs.firstDay <= 6 ? parseInt(attrs.firstDay, 10) : moment().weekday(0).day(),
Expand Down Expand Up @@ -196,13 +195,13 @@ Module.directive('datePicker', ['datePickerConfig', 'datePickerUtils', function

prepareViewData = function () {
var view = scope.view,
date = scope.date,
date = ngModel.$viewValue,
classes = [], classList = '',
i, j;

datePickerUtils.setParams(tz, firstDay);

if (view === 'date') {
if(view === 'date') {
var weeks = scope.weeks, week;
for (i = 0; i < weeks.length; i++) {
week = weeks[i];
Expand All @@ -216,9 +215,12 @@ Module.directive('datePicker', ['datePickerConfig', 'datePickerUtils', function
classList += ' now';
}
//if (week[j].month() !== date.month()) classList += ' disabled';
if (week[j].month() !== date.month() || !inValidRange(week[j])) {
if (!inValidRange(week[j])) {
classList += ' disabled';
}
if (!datePickerUtils.isSameMonth(scope.date, week[j])) {
classList += ' muted';
}
classes[i].push(classList);
}
}
Expand Down Expand Up @@ -321,40 +323,38 @@ Module.directive('datePicker', ['datePickerConfig', 'datePickerUtils', function
return scope.next(-delta || -1);
};

if (pickerID) {
scope.$on('pickerUpdate', function (event, pickerIDs, data) {
if (eventIsForPicker(pickerIDs, pickerID)) {
var updateViews = false, updateViewData = false;
scope.$on('pickerUpdate', function (event, pickerIDs, data) {
if (eventIsForPicker(pickerIDs, element[0].id)) {
var updateViews = false, updateViewData = false;

if (angular.isDefined(data.minDate)) {
minDate = data.minDate ? data.minDate : false;
updateViewData = true;
}
if (angular.isDefined(data.maxDate)) {
maxDate = data.maxDate ? data.maxDate : false;
updateViewData = true;
}
if (angular.isDefined(data.minDate)) {
minDate = data.minDate ? data.minDate : false;
updateViewData = true;
}
if (angular.isDefined(data.maxDate)) {
maxDate = data.maxDate ? data.maxDate : false;
updateViewData = true;
}

if (angular.isDefined(data.minView)) {
attrs.minView = data.minView;
updateViews = true;
}
if (angular.isDefined(data.maxView)) {
attrs.maxView = data.maxView;
updateViews = true;
}
attrs.view = data.view || attrs.view;
if (angular.isDefined(data.minView)) {
attrs.minView = data.minView;
updateViews = true;
}
if (angular.isDefined(data.maxView)) {
attrs.maxView = data.maxView;
updateViews = true;
}
attrs.view = data.view || attrs.view;

if (updateViews) {
prepareViews();
}
if (updateViews) {
prepareViews();
}

if (updateViewData) {
update();
}
if (updateViewData) {
update();
}
});
}
}
});
}
};
}]);
2 changes: 1 addition & 1 deletion app/scripts/datePickerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ angular.module('datePicker').factory('datePickerUtils', function () {
for (i = 0; i < j; i++) {
target = target[nameArray[i]];
if (!target) {
continue;
break;
}
}

Expand Down
78 changes: 39 additions & 39 deletions app/scripts/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Module.directive('dateTimeAppend', function () {
};
});

Module.directive('dateTime', ['$compile', '$document', '$filter', 'dateTimeConfig', '$parse', 'datePickerUtils', function ($compile, $document, $filter, dateTimeConfig, $parse, datePickerUtils) {
Module.directive('dateTime', ['$compile', '$timeout', '$document', '$filter', 'dateTimeConfig', '$parse', 'datePickerUtils', function ($compile, $timeout, $document, $filter, dateTimeConfig, $parse, datePickerUtils) {
var body = $document.find('body');
var dateFilter = $filter('mFormat');

Expand All @@ -56,7 +56,6 @@ Module.directive('dateTime', ['$compile', '$document', '$filter', 'dateTimeConfi
index = views.indexOf(view),
dismiss = attrs.autoClose ? $parse(attrs.autoClose)(scope) : dateTimeConfig.autoClose,
picker = null,
pickerID = element[0].id,
position = attrs.position || dateTimeConfig.position,
container = null,
minDate = null,
Expand Down Expand Up @@ -156,44 +155,42 @@ Module.directive('dateTime', ['$compile', '$document', '$filter', 'dateTimeConfi
}
}

if (pickerID) {
scope.$on('pickerUpdate', function (event, pickerIDs, data) {
if (eventIsForPicker(pickerIDs, pickerID)) {
if (picker) {
//Need to handle situation where the data changed but the picker is currently open.
//To handle this, we can create the inner picker with a random ID, then forward
//any events received to it.
} else {
var validateRequired = false;
if (angular.isDefined(data.minDate)) {
setMin(data.minDate);
validateRequired = true;
}
if (angular.isDefined(data.maxDate)) {
setMax(data.maxDate);
validateRequired = true;
}

if (angular.isDefined(data.minView)) {
attrs.minView = data.minView;
}
if (angular.isDefined(data.maxView)) {
attrs.maxView = data.maxView;
}
attrs.view = data.view || attrs.view;

if (validateRequired) {
ngModel.$validate();
}
if (angular.isDefined(data.format)) {
format = attrs.format = data.format || dateTimeConfig.format;
ngModel.$modelValue = -1; //Triggers formatters. This value will be discarded.
}
getTemplate();
scope.$on('pickerUpdate', function (event, pickerIDs, data) {
if (eventIsForPicker(pickerIDs, element[0].id)) {
if (picker) {
//Need to handle situation where the data changed but the picker is currently open.
//To handle this, we can create the inner picker with a random ID, then forward
//any events received to it.
} else {
var validateRequired = false;
if (angular.isDefined(data.minDate)) {
setMin(data.minDate);
validateRequired = true;
}
if (angular.isDefined(data.maxDate)) {
setMax(data.maxDate);
validateRequired = true;
}

if (angular.isDefined(data.minView)) {
attrs.minView = data.minView;
}
if (angular.isDefined(data.maxView)) {
attrs.maxView = data.maxView;
}
attrs.view = data.view || attrs.view;

if (validateRequired) {
ngModel.$validate();
}
if (angular.isDefined(data.format)) {
format = attrs.format = data.format || dateTimeConfig.format;
ngModel.$modelValue = -1; //Triggers formatters. This value will be discarded.
}
getTemplate();
}
});
}
}
});

function showPicker() {
if (picker) {
Expand All @@ -216,7 +213,10 @@ Module.directive('dateTime', ['$compile', '$document', '$filter', 'dateTimeConfi
});

scope.$on('hidePicker', function () {
element[0].blur();
element.triggerHandler('blur');
$timeout(function() {
element[0].blur();
}, 0);
});

scope.$on('$destroy', clear);
Expand Down
2 changes: 1 addition & 1 deletion app/styles/mixins.less
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@
.reset-filter();

// in these cases the gradient won't cover the background, so we override
&:hover, &:active, &.active, &.disabled, &[disabled] {
&:hover, &:active, &.active, &.disabled, &[disabled], &.muted {
color: @textColor;
background-color: @endColor;
*background-color: darken(@endColor, 5%);
Expand Down
36 changes: 24 additions & 12 deletions app/styles/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,21 @@
}

td, th {
padding: 4px 5px;
text-align: center;
width: 20px;
height: 20px;
.border-radius(4px);
border: none;

}

td {
padding: 4px 5px;
}

.switch{
width: 145px;
}

span {
td span, th span {
display: block;
width: 23%;
height: 26px;
Expand All @@ -73,14 +74,18 @@
&:hover {
background: @grayLighter;
}
&.disabled, &.disabled:hover {
&.disabled, &.disabled:hover, &.muted, &.muted:hover {
background:none;
color: @grayLight;
cursor: default;
}

}

th span {
padding: 4px 5px;
width: 100%;
}

.active , .now{
.buttonBackground(@btnPrimaryBackground, spin(@btnPrimaryBackground, 20));
color: #fff;
Expand All @@ -91,33 +96,40 @@
.buttonBackground(@btnDangerBackground, spin(@btnDangerBackground, 20));
}

.disabled {
.disabled, .muted {
background: none;
color: #999999 !important;
cursor: default;
}

/* SPECIFIC */

[ng-switch-when="year"], [ng-switch-when="month"], [ng-switch-when="minutes"]{
span {
.year, .month, .minutes {
td span {
height: 54px;
line-height: 54px;
}
}
[ng-switch-when="date"]{
.date {
td {
padding: 0;
}
span{
td span {
width: 100%;
height: 26px;
line-height: 26px;
}
}

th:hover, [ng-switch-when="date"] td span:hover{
th span:hover, .date td span:hover{
background: @grayLighter;
cursor: pointer;
}
th.weekday span, th.weekday span:hover {
background: none;
cursor: default;
}
th.switch {
text-transform: capitalize;
}
}
Loading