diff --git a/angular-material-calendar.css b/angular-material-calendar.css
index 173a2fc..4dee8e8 100644
--- a/angular-material-calendar.css
+++ b/angular-material-calendar.css
@@ -13,8 +13,9 @@ calendar-md {
border-bottom: 1px solid rgba(0, 0, 0, 0.12); }
calendar-md md-content > md-content.agenda > * > *.disabled {
color: rgba(0, 0, 0, 0.3);
- pointer-events: none;
cursor: auto; }
+ calendar-md md-content > md-content.agenda > * > *.has-events {
+ background-color: #96ca2d; }
calendar-md md-content > md-content.agenda > * > * :first-child {
padding: 12px;
width: 200px;
@@ -38,17 +39,20 @@ calendar-md {
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
border-right: 1px solid rgba(0, 0, 0, 0.12);
cursor: pointer; }
- calendar-md md-content > md-content.calendar > :not(:first-child) > *:hover {
- background: rgba(0, 0, 0, 0.04); }
+ calendar-md md-content > md-content.calendar > :not(:first-child) > *.disabled:focus {
+ outline-style: none; }
+ calendar-md md-content > md-content.calendar > :not(:first-child) > *:not(.disabled):hover {
+ background: #C3E0FC; }
calendar-md md-content > md-content.calendar > :not(:first-child) > *.disabled {
color: rgba(0, 0, 0, 0.3);
- pointer-events: none;
cursor: auto; }
calendar-md md-content > md-content.calendar > :not(:first-child) > *.active {
- box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 2px 1px -1px rgba(0, 0, 0, 0.12);
- background: rgba(0, 0, 0, 0.02); }
+ background: #C3E0FC; }
+ calendar-md md-content > md-content.calendar > :not(:first-child) > *.has-events {
+ background-color: #96ca2d; }
calendar-md md-content > md-content.calendar > :not(:first-child) > * :first-child {
padding: 0; }
calendar-md md-content > md-content.calendar > :not(:first-child) > * :last-child {
overflow: hidden;
- text-overflow: ellipsis; }
+ text-overflow: ellipsis;
+ min-height: 45px; }
diff --git a/angular-material-calendar.html b/angular-material-calendar.html
index 8474bca..83fa6eb 100644
--- a/angular-material-calendar.html
+++ b/angular-material-calendar.html
@@ -1 +1 @@
-{{ day | date:dayTooltipFormat:timezone }}{{ day | date:dayFormat:timezone }}
{{ day | date:dayTooltipFormat }}{{ day | date:dayFormat }}
\ No newline at end of file
+{{ day | date:dayTooltipFormat:timezone }}{{ day | date:dayFormat:timezone }}
{{ day | date:dayTooltipFormat }}{{ day | date:dayFormat }}
\ No newline at end of file
diff --git a/angular-material-calendar.js b/angular-material-calendar.js
index e171128..970d402 100644
--- a/angular-material-calendar.js
+++ b/angular-material-calendar.js
@@ -5,11 +5,14 @@ angular.module("materialCalendar").constant("materialCalendar.config", {
debug: document.domain.indexOf("localhost") > -1
});
-angular.module("materialCalendar").config(["materialCalendar.config", "$logProvider", "$compileProvider", function (config, $logProvider, $compileProvider) {
+angular.module("materialCalendar").config(["materialCalendar.config", "$logProvider", "$compileProvider", "$mdIconProvider", function (config, $logProvider, $compileProvider, $mdIconProvider) {
if (config.debug) {
$logProvider.debugEnabled(false);
$compileProvider.debugInfoEnabled(false);
}
+ /* tslint:disable:max-line-length */
+ $mdIconProvider.icon("md-tabs-arrow", "data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxnIGZpbGw9ImN1cnJlbnRDb2xvciI+PHBvbHlnb24gcG9pbnRzPSIxNS40LDcuNCAxNCw2IDgsMTIgMTQsMTggMTUuNCwxNi42IDEwLjgsMTIgIi8+PC9nPjwvc3ZnPg==", 24);
+ /* tslint:enable:max-line-length */
}]);
angular.module("materialCalendar").service("materialCalendar.Calendar", [function () {
@@ -40,7 +43,7 @@ angular.module("materialCalendar").service("materialCalendar.Calendar", [functio
this.setNoOfDays = function (i) {
var d = parseInt(i || 0, 10);
- if (!isNaN(d) && d > 0 ) {
+ if (!isNaN(d) && d > 0) {
this.noOfDays = d;
} else {
this.noOfDays = 0;
@@ -90,21 +93,21 @@ angular.module("materialCalendar").service("materialCalendar.Calendar", [functio
}
// First day of calendar month.
- if ( angular.isDefined(this.options.startDateOfMonth) ) {
+ if (angular.isDefined(this.options.startDateOfMonth)) {
this.start = new Date(this.year, this.month, this.startDateOfMonth);
} else {
this.start = new Date(this.year, this.month, 1);
}
var date = angular.copy(this.start);
- if ( date.getDate() === 1) {
- while ( date.getDay() !== this.weekStartsOn) {
+ if (date.getDate() === 1) {
+ while (date.getDay() !== this.weekStartsOn) {
date.setDate(date.getDate() - 1);
monthLength++;
}
}
- if ( this.noOfDays !== 0) {
+ if (this.noOfDays !== 0) {
while (this.noOfDays % 7 !== 0) {
this.noOfDays++;
}
@@ -153,11 +156,11 @@ angular.module("materialCalendar").service("MaterialCalendarData", [function ()
this.data = {};
- this.getDayKey = function(date) {
+ this.getDayKey = function (date) {
return [date.getFullYear(), date.getMonth() + 1, date.getDate()].join("-");
};
- this.setDayContent = function(date, content) {
+ this.setDayContent = function (date, content) {
this.data[this.getDayKey(date)] = content || this.data[this.getDayKey(date)] || "";
};
}
@@ -166,7 +169,7 @@ angular.module("materialCalendar").service("MaterialCalendarData", [function ()
angular.module("materialCalendar").directive("calendarMd", ["$compile", "$parse", "$templateRequest", "$q", "materialCalendar.Calendar", "MaterialCalendarData", function ($compile, $parse, $templateRequest, $q, Calendar, CalendarData) {
- var defaultTemplate = "{{ day | date:dayTooltipFormat:timezone }}{{ day | date:dayFormat:timezone }}
{{ day | date:dayTooltipFormat }}{{ day | date:dayFormat }}
";
+ var defaultTemplate = "{{ day | date:dayTooltipFormat:timezone }}{{ day | date:dayFormat:timezone }}
{{ day | date:dayTooltipFormat }}{{ day | date:dayFormat }}
";
var injectCss = function () {
var styleId = "calendarMdCss";
@@ -175,7 +178,7 @@ angular.module("materialCalendar").directive("calendarMd", ["$compile", "$parse"
var css = document.createElement("style");
css.type = "text/css";
css.id = styleId;
- css.innerHTML = "calendar-md md-content>md-content.agenda>*>* :not(:first-child),calendar-md md-content>md-content.calendar>:not(:first-child)>* :last-child{overflow:hidden;text-overflow:ellipsis}calendar-md{display:block;max-height:100%}calendar-md .md-toolbar-tools h2{overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}calendar-md .md-toolbar-tools .moveNext{transform:translate3d(0,0,0) rotate(180deg)}calendar-md md-content>md-content{border:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>*{border-bottom:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>.disabled{color:rgba(0,0,0,.3);pointer-events:none;cursor:auto}calendar-md md-content>md-content.agenda>*>* :first-child{padding:12px;width:200px;text-align:right;color:rgba(0,0,0,.75);font-weight:100;overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}calendar-md md-content>md-content>*>*{min-width:48px}calendar-md md-content>md-content.calendar>:first-child{background:rgba(0,0,0,.02);border-bottom:1px solid rgba(0,0,0,.12);margin-right:0;min-height:36px}calendar-md md-content>md-content.calendar>:not(:first-child)>*{border-bottom:1px solid rgba(0,0,0,.12);border-right:1px solid rgba(0,0,0,.12);cursor:pointer}calendar-md md-content>md-content.calendar>:not(:first-child)>:hover{background:rgba(0,0,0,.04)}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled{color:rgba(0,0,0,.3);pointer-events:none;cursor:auto}calendar-md md-content>md-content.calendar>:not(:first-child)>.active{box-shadow:0 1px 3px 0 rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12);background:rgba(0,0,0,.02)}calendar-md md-content>md-content.calendar>:not(:first-child)>* :first-child{padding:0}";
+ css.innerHTML = "calendar-md .md-toolbar-tools h2,calendar-md md-content>md-content.agenda>*>* :first-child{overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis}calendar-md{display:block;max-height:100%}calendar-md .md-toolbar-tools .moveNext{transform:translate3d(0,0,0) rotate(180deg)}calendar-md md-content>md-content{border:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>*{border-bottom:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>.disabled{color:rgba(0,0,0,.3);cursor:auto}calendar-md md-content>md-content.agenda>*>.has-events{background-color:#96ca2d}calendar-md md-content>md-content.agenda>*>* :first-child{padding:12px;width:200px;text-align:right;color:rgba(0,0,0,.75);font-weight:100}calendar-md md-content>md-content.agenda>*>* :not(:first-child){overflow:hidden;text-overflow:ellipsis}calendar-md md-content>md-content>*>*{min-width:48px}calendar-md md-content>md-content.calendar>:first-child{background:rgba(0,0,0,.02);border-bottom:1px solid rgba(0,0,0,.12);margin-right:0;min-height:36px}calendar-md md-content>md-content.calendar>:not(:first-child)>.active,calendar-md md-content>md-content.calendar>:not(:first-child)>:not(.disabled):hover{background:#C3E0FC}calendar-md md-content>md-content.calendar>:not(:first-child)>*{border-bottom:1px solid rgba(0,0,0,.12);border-right:1px solid rgba(0,0,0,.12);cursor:pointer}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled:focus{outline-style:none}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled{color:rgba(0,0,0,.3);cursor:auto}calendar-md md-content>md-content.calendar>:not(:first-child)>.has-events{background-color:#96ca2d}calendar-md md-content>md-content.calendar>:not(:first-child)>* :first-child{padding:0}calendar-md md-content>md-content.calendar>:not(:first-child)>* :last-child{overflow:hidden;text-overflow:ellipsis;min-height:45px}";
head.insertBefore(css, head.firstChild);
}
};
@@ -203,10 +206,13 @@ angular.module("materialCalendar").directive("calendarMd", ["$compile", "$parse"
noOfDays: "=?",
clearDataCacheOnLoad: "=?",
disableFutureSelection: "=?",
- disableSelection: "=?"
+ disableSelection: "=?",
+ daysToDisable: "=?",
+ disabledDayClick: "=?",
+ dateFilter: "=?"
},
link: function ($scope, $element, $attrs) {
-
+ // debugger;
// Add the CSS here.
injectCss();
@@ -249,16 +255,31 @@ angular.module("materialCalendar").directive("calendarMd", ["$compile", "$parse"
d.getMonth() === $scope.calendar.month;
};
- $scope.isDisabled = function (date,startDateOfMonth,noOfDays) {
- if (noOfDays!=0 && angular.isDefined(noOfDays)) {
- var dateStart = new Date($scope.calendar.year,$scope.calendar.month,startDateOfMonth);
+ var chkDisabledDay = function (date) {
+ if ($scope.daysToDisable) {
+ return $scope.daysToDisable.filter(function (day) {
+ return day.getFullYear() === date.getFullYear()
+ && day.getMonth() === date.getMonth()
+ && day.getDate() === date.getDate();
+ }).length > 0;
+ }
+ return false;
+ };
+
+ $scope.isDisabled = function (date, startDateOfMonth, noOfDays) {
+ if (noOfDays != 0 && angular.isDefined(noOfDays)) {
+ var dateStart = new Date($scope.calendar.year, $scope.calendar.month, startDateOfMonth);
var dateEnd = angular.copy(dateStart);
- dateEnd.setDate(dateStart.getDate()+parseInt(noOfDays));
+ dateEnd.setDate(dateStart.getDate() + parseInt(noOfDays));
if (date.getDate() <= dateStart && date.getDate() >= dateEnd) { return true; }
}
if ($scope.disableSelection) { return true; }
if ($scope.disableFutureSelection && date > new Date()) { return true; }
- return !$scope.sameMonth(date);
+ if (!$scope.sameMonth(date)) { return true; }
+
+ if ($scope.dateFilter) { return $scope.dateFilter(date); }
+ if (chkDisabledDay(date)) { return true; }
+ return false;
};
$scope.calendarDirection = $scope.calendarDirection || "horizontal";
@@ -302,6 +323,11 @@ angular.module("materialCalendar").directive("calendarMd", ["$compile", "$parse"
return match;
};
+ $scope.hasEvents = function (date) {
+ var data = CalendarData.data[$scope.dayKey(date)];
+ return (data && data.length > 0);
+ };
+
$scope.prev = function () {
$scope.calendar.prev();
var data = {
@@ -324,11 +350,16 @@ angular.module("materialCalendar").directive("calendarMd", ["$compile", "$parse"
$scope.handleDayClick = function (date) {
- if($scope.disableFutureSelection && date > new Date()) {
+ if ($scope.disableFutureSelection && date > new Date()) {
+ return;
+ }
+
+ if ($scope.disableSelection) {
return;
}
- if($scope.disableSelection) {
+ if ($scope.isDisabled(date)) {
+ handleCb($scope.disabledDayClick, angular.copy(date));
return;
}
@@ -432,7 +463,7 @@ angular.module("materialCalendar").directive("calendarMd", ["$compile", "$parse"
});
};
- $scope.$watchGroup(["weekStartsOn","startDateOfMonth","noOfDays"], init);
+ $scope.$watchGroup(["weekStartsOn", "startDateOfMonth", "noOfDays"], init);
bootstrap();
// These are for tests, don't remove them..
diff --git a/angular-material-calendar.min.css b/angular-material-calendar.min.css
index 08bab5b..0189c2a 100644
--- a/angular-material-calendar.min.css
+++ b/angular-material-calendar.min.css
@@ -1 +1 @@
-calendar-md md-content>md-content.agenda>*>* :not(:first-child),calendar-md md-content>md-content.calendar>:not(:first-child)>* :last-child{overflow:hidden;text-overflow:ellipsis}calendar-md{display:block;max-height:100%}calendar-md .md-toolbar-tools h2{overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}calendar-md .md-toolbar-tools .moveNext{transform:translate3d(0,0,0) rotate(180deg)}calendar-md md-content>md-content{border:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>*{border-bottom:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>.disabled{color:rgba(0,0,0,.3);pointer-events:none;cursor:auto}calendar-md md-content>md-content.agenda>*>* :first-child{padding:12px;width:200px;text-align:right;color:rgba(0,0,0,.75);font-weight:100;overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}calendar-md md-content>md-content>*>*{min-width:48px}calendar-md md-content>md-content.calendar>:first-child{background:rgba(0,0,0,.02);border-bottom:1px solid rgba(0,0,0,.12);margin-right:0;min-height:36px}calendar-md md-content>md-content.calendar>:not(:first-child)>*{border-bottom:1px solid rgba(0,0,0,.12);border-right:1px solid rgba(0,0,0,.12);cursor:pointer}calendar-md md-content>md-content.calendar>:not(:first-child)>:hover{background:rgba(0,0,0,.04)}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled{color:rgba(0,0,0,.3);pointer-events:none;cursor:auto}calendar-md md-content>md-content.calendar>:not(:first-child)>.active{box-shadow:0 1px 3px 0 rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12);background:rgba(0,0,0,.02)}calendar-md md-content>md-content.calendar>:not(:first-child)>* :first-child{padding:0}
\ No newline at end of file
+calendar-md .md-toolbar-tools h2,calendar-md md-content>md-content.agenda>*>* :first-child{overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis}calendar-md{display:block;max-height:100%}calendar-md .md-toolbar-tools .moveNext{transform:translate3d(0,0,0) rotate(180deg)}calendar-md md-content>md-content{border:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>*{border-bottom:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>.disabled{color:rgba(0,0,0,.3);cursor:auto}calendar-md md-content>md-content.agenda>*>.has-events{background-color:#96ca2d}calendar-md md-content>md-content.agenda>*>* :first-child{padding:12px;width:200px;text-align:right;color:rgba(0,0,0,.75);font-weight:100}calendar-md md-content>md-content.agenda>*>* :not(:first-child){overflow:hidden;text-overflow:ellipsis}calendar-md md-content>md-content>*>*{min-width:48px}calendar-md md-content>md-content.calendar>:first-child{background:rgba(0,0,0,.02);border-bottom:1px solid rgba(0,0,0,.12);margin-right:0;min-height:36px}calendar-md md-content>md-content.calendar>:not(:first-child)>.active,calendar-md md-content>md-content.calendar>:not(:first-child)>:not(.disabled):hover{background:#C3E0FC}calendar-md md-content>md-content.calendar>:not(:first-child)>*{border-bottom:1px solid rgba(0,0,0,.12);border-right:1px solid rgba(0,0,0,.12);cursor:pointer}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled:focus{outline-style:none}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled{color:rgba(0,0,0,.3);cursor:auto}calendar-md md-content>md-content.calendar>:not(:first-child)>.has-events{background-color:#96ca2d}calendar-md md-content>md-content.calendar>:not(:first-child)>* :first-child{padding:0}calendar-md md-content>md-content.calendar>:not(:first-child)>* :last-child{overflow:hidden;text-overflow:ellipsis;min-height:45px}
\ No newline at end of file
diff --git a/angular-material-calendar.min.js b/angular-material-calendar.min.js
index 5e5eb10..d20d6d1 100644
--- a/angular-material-calendar.min.js
+++ b/angular-material-calendar.min.js
@@ -1 +1 @@
-angular.module("materialCalendar",["ngMaterial","ngSanitize"]),angular.module("materialCalendar").constant("materialCalendar.config",{version:"0.2.13",debug:document.domain.indexOf("localhost")>-1}),angular.module("materialCalendar").config(["materialCalendar.config","$logProvider","$compileProvider",function(t,a,e){t.debug&&(a.debugEnabled(!1),e.debugInfoEnabled(!1))}]),angular.module("materialCalendar").service("materialCalendar.Calendar",[function(){function t(t,a,e){var n=new Date;this.setWeekStartsOn=function(t){var a=parseInt(t||0,10);return this.weekStartsOn=!isNaN(a)&&a>=0&&6>=a?a:0,this.weekStartsOn},this.setStartDateOfMonth=function(t){var a=parseInt(t||1,10);return this.startDateOfMonth=!isNaN(a)&&a>=1&&31>=a?a:1,this.startDateOfMonth},this.setNoOfDays=function(t){var a=parseInt(t||0,10);return this.noOfDays=!isNaN(a)&&a>0?a:0,this.noOfDays},this.options=angular.isObject(e)?e:{},this.year=n.getFullYear(),this.month=n.getMonth(),this.weeks=[],this.weekStartsOn=this.setWeekStartsOn(this.options.weekStartsOn),this.startDateOfMonth=this.setStartDateOfMonth(this.options.startDateOfMonth),this.noOfDays=this.setNoOfDays(this.options.noOfDays),this.next=function(){return this.start.getMonth()<11?void this.init(this.start.getFullYear(),this.start.getMonth()+1):void this.init(this.start.getFullYear()+1,0)},this.prev=function(){return this.month?void this.init(this.start.getFullYear(),this.start.getMonth()-1):void this.init(this.start.getFullYear()-1,11)},this.init=function(t,a){var e=new Date;this.year=angular.isDefined(t)?t:e.getFullYear(),this.month=angular.isDefined(a)?a:e.getMonth();var n=[31,28,31,30,31,30,31,31,30,31,30,31],o=n[this.month];1===this.month&&(this.year%4===0&&this.year%100!==0||this.year%400===0)&&(o=29),this.start=angular.isDefined(this.options.startDateOfMonth)?new Date(this.year,this.month,this.startDateOfMonth):new Date(this.year,this.month,1);var r=angular.copy(this.start);if(1===r.getDate())for(;r.getDay()!==this.weekStartsOn;)r.setDate(r.getDate()-1),o++;if(0!==this.noOfDays){for(;this.noOfDays%7!==0;)this.noOfDays++;o=this.noOfDays}else for(;o%7!==0;)o++;for(;o%7!==0;)o++;this.weeks=[];for(var i=0;o>i;++i)i%7===0&&this.weeks.push([]),this.weeks[this.weeks.length-1].push(angular.copy(r)),r.setDate(r.getDate()+1)},this.init(t,a)}return t}]),angular.module("materialCalendar").service("MaterialCalendarData",[function(){function t(){this.data={},this.getDayKey=function(t){return[t.getFullYear(),t.getMonth()+1,t.getDate()].join("-")},this.setDayContent=function(t,a){this.data[this.getDayKey(t)]=a||this.data[this.getDayKey(t)]||""}}return new t}]),angular.module("materialCalendar").directive("calendarMd",["$compile","$parse","$templateRequest","$q","materialCalendar.Calendar","MaterialCalendarData",function(t,a,e,n,o,r){var i="{{ day | date:dayTooltipFormat:timezone }}{{ day | date:dayFormat:timezone }}
{{ day | date:dayTooltipFormat }}{{ day | date:dayFormat }}
",d=function(){var t="calendarMdCss";if(!document.getElementById(t)){var a=document.getElementsByTagName("head")[0],e=document.createElement("style");e.type="text/css",e.id=t,e.innerHTML="calendar-md md-content>md-content.agenda>*>* :not(:first-child),calendar-md md-content>md-content.calendar>:not(:first-child)>* :last-child{overflow:hidden;text-overflow:ellipsis}calendar-md{display:block;max-height:100%}calendar-md .md-toolbar-tools h2{overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}calendar-md .md-toolbar-tools .moveNext{transform:translate3d(0,0,0) rotate(180deg)}calendar-md md-content>md-content{border:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>*{border-bottom:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>.disabled{color:rgba(0,0,0,.3);pointer-events:none;cursor:auto}calendar-md md-content>md-content.agenda>*>* :first-child{padding:12px;width:200px;text-align:right;color:rgba(0,0,0,.75);font-weight:100;overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}calendar-md md-content>md-content>*>*{min-width:48px}calendar-md md-content>md-content.calendar>:first-child{background:rgba(0,0,0,.02);border-bottom:1px solid rgba(0,0,0,.12);margin-right:0;min-height:36px}calendar-md md-content>md-content.calendar>:not(:first-child)>*{border-bottom:1px solid rgba(0,0,0,.12);border-right:1px solid rgba(0,0,0,.12);cursor:pointer}calendar-md md-content>md-content.calendar>:not(:first-child)>:hover{background:rgba(0,0,0,.04)}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled{color:rgba(0,0,0,.3);pointer-events:none;cursor:auto}calendar-md md-content>md-content.calendar>:not(:first-child)>.active{box-shadow:0 1px 3px 0 rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12);background:rgba(0,0,0,.02)}calendar-md md-content>md-content.calendar>:not(:first-child)>* :first-child{padding:0}",a.insertBefore(e,a.firstChild)}};return{restrict:"E",scope:{ngModel:"=?",template:"&",templateUrl:"=?",onDayClick:"=?",onPrevMonth:"=?",onNextMonth:"=?",calendarDirection:"=?",dayContent:"&?",timezone:"=?",titleFormat:"=?",dayFormat:"=?",dayLabelFormat:"=?",dayLabelTooltipFormat:"=?",dayTooltipFormat:"=?",weekStartsOn:"=?",tooltips:"&?",startDateOfMonth:"=?",noOfDays:"=?",clearDataCacheOnLoad:"=?",disableFutureSelection:"=?",disableSelection:"=?"},link:function(l,s,c){d();var u=new Date,m=parseInt(c.startMonth||u.getMonth()),h=parseInt(c.startYear||u.getFullYear());l.columnWeekLayout="column",l.weekLayout="row",l.timezone=l.timezone||null,l.noCache=c.clearDataCacheOnLoad||!1,c.ngModel?(l.active=l.$parent.$eval(c.ngModel),c.ngModel&&l.$watch("$parent."+c.ngModel,function(t){l.active=t})):l.active=null,l.titleFormat=l.titleFormat||"LLLL yyyy",l.dayLabelFormat=l.dayLabelFormat||"EEE",l.dayLabelTooltipFormat=l.dayLabelTooltipFormat||"EEEE",l.dayFormat=l.dayFormat||"d",l.dayTooltipFormat=l.dayTooltipFormat||"fullDate",l.dayIdFormat="dd-MM-yy",l.disableFutureSelection=l.disableFutureSelection||!1,l.disableSelection=l.disableSelection||!1,l.sameMonth=function(t){var a=angular.copy(t);return a.getFullYear()===l.calendar.year&&a.getMonth()===l.calendar.month},l.isDisabled=function(t,a,e){if(0!=e&&angular.isDefined(e)){var n=new Date(l.calendar.year,l.calendar.month,a),o=angular.copy(n);if(o.setDate(n.getDate()+parseInt(e)),t.getDate()<=n&&t.getDate()>=o)return!0}return l.disableSelection?!0:l.disableFutureSelection&&t>new Date?!0:!l.sameMonth(t)},l.calendarDirection=l.calendarDirection||"horizontal",l.$watch("calendarDirection",function(t){l.weekLayout="horizontal"===t?"row":"column"}),l.$watch("weekLayout",function(){h=l.calendar.year,m=l.calendar.month,w()});var g=function(t,a){(t||angular.noop)(a)},y=function(t,a){var e=-1;return angular.forEach(t,function(t,n){0>e&&angular.equals(a,t)&&(e=n)}),e};l.isActive=function(t){var a,e=angular.copy(l.active);return angular.isArray(e)?a=y(e,t)>-1:e&&angular.equals(e.getYear(),t.getYear())&&angular.equals(e.getMonth(),t.getMonth())&&angular.equals(e.getDate(),t.getDate())&&(a=!0),a},l.prev=function(){l.calendar.prev();var t={year:l.calendar.year,month:l.calendar.month+1};D(),g(l.onPrevMonth,t)},l.next=function(){l.calendar.next();var t={year:l.calendar.year,month:l.calendar.month+1};D(),g(l.onNextMonth,t)},l.handleDayClick=function(t){if(!(l.disableFutureSelection&&t>new Date||l.disableSelection)){var e=angular.copy(l.active);if(angular.isArray(e)){var n=y(e,t);n>-1?e.splice(n,1):e.push(t)}else e=angular.equals(e,t)?null:t;l.active=e,c.ngModel&&a(c.ngModel).assign(l.$parent,angular.copy(l.active)),g(l.onDayClick,angular.copy(t))}};var f=function(a){s.html(a),t(s.contents())(l)},p=function(){return l.calendar=new o(h,m,{weekStartsOn:l.weekStartsOn||0,startDateOfMonth:l.startDateOfMonth||1,noOfDays:l.noOfDays||0}),l.templateUrl?e(l.templateUrl):n.resolve(l.template()||i)};l.dataService=r;var v=function(t){return l.dataService.getDayKey(t)};l.dayKey=v;var b=function(t){l.noCache?l.dataService.setDayContent(t,""):l.dataService.setDayContent(t,l.dataService.data[v(t)]||"");var a=(l.dayContent||angular.noop)(),e=(a||angular.noop)(t);angular.isObject(e)&&"function"==typeof e.success?e.success(function(a){l.dataService.setDayContent(t,a)}):angular.isObject(e)&&"function"==typeof e.then?e.then(function(a){l.dataService.setDayContent(t,a)}):l.dataService.setDayContent(t,e)},D=function(){angular.forEach(l.calendar.weeks,function(t){angular.forEach(t,b)})};window.data=l.data;var w=function(){p().then(function(t){f(t),D()})};l.$watchGroup(["weekStartsOn","startDateOfMonth","noOfDays"],p),w(),l._$$init=p,l._$$setTemplate=f,l._$$bootstrap=w}}}]);
\ No newline at end of file
+angular.module("materialCalendar",["ngMaterial","ngSanitize"]),angular.module("materialCalendar").constant("materialCalendar.config",{version:"0.2.13",debug:document.domain.indexOf("localhost")>-1}),angular.module("materialCalendar").config(["materialCalendar.config","$logProvider","$compileProvider","$mdIconProvider",function(t,a,e,n){t.debug&&(a.debugEnabled(!1),e.debugInfoEnabled(!1)),n.icon("md-tabs-arrow","data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxnIGZpbGw9ImN1cnJlbnRDb2xvciI+PHBvbHlnb24gcG9pbnRzPSIxNS40LDcuNCAxNCw2IDgsMTIgMTQsMTggMTUuNCwxNi42IDEwLjgsMTIgIi8+PC9nPjwvc3ZnPg==",24)}]),angular.module("materialCalendar").service("materialCalendar.Calendar",[function(){function t(t,a,e){var n=new Date;this.setWeekStartsOn=function(t){var a=parseInt(t||0,10);return this.weekStartsOn=!isNaN(a)&&a>=0&&6>=a?a:0,this.weekStartsOn},this.setStartDateOfMonth=function(t){var a=parseInt(t||1,10);return this.startDateOfMonth=!isNaN(a)&&a>=1&&31>=a?a:1,this.startDateOfMonth},this.setNoOfDays=function(t){var a=parseInt(t||0,10);return this.noOfDays=!isNaN(a)&&a>0?a:0,this.noOfDays},this.options=angular.isObject(e)?e:{},this.year=n.getFullYear(),this.month=n.getMonth(),this.weeks=[],this.weekStartsOn=this.setWeekStartsOn(this.options.weekStartsOn),this.startDateOfMonth=this.setStartDateOfMonth(this.options.startDateOfMonth),this.noOfDays=this.setNoOfDays(this.options.noOfDays),this.next=function(){return this.start.getMonth()<11?void this.init(this.start.getFullYear(),this.start.getMonth()+1):void this.init(this.start.getFullYear()+1,0)},this.prev=function(){return this.month?void this.init(this.start.getFullYear(),this.start.getMonth()-1):void this.init(this.start.getFullYear()-1,11)},this.init=function(t,a){var e=new Date;this.year=angular.isDefined(t)?t:e.getFullYear(),this.month=angular.isDefined(a)?a:e.getMonth();var n=[31,28,31,30,31,30,31,31,30,31,30,31],o=n[this.month];1===this.month&&(this.year%4===0&&this.year%100!==0||this.year%400===0)&&(o=29),this.start=angular.isDefined(this.options.startDateOfMonth)?new Date(this.year,this.month,this.startDateOfMonth):new Date(this.year,this.month,1);var i=angular.copy(this.start);if(1===i.getDate())for(;i.getDay()!==this.weekStartsOn;)i.setDate(i.getDate()-1),o++;if(0!==this.noOfDays){for(;this.noOfDays%7!==0;)this.noOfDays++;o=this.noOfDays}else for(;o%7!==0;)o++;for(;o%7!==0;)o++;this.weeks=[];for(var r=0;o>r;++r)r%7===0&&this.weeks.push([]),this.weeks[this.weeks.length-1].push(angular.copy(i)),i.setDate(i.getDate()+1)},this.init(t,a)}return t}]),angular.module("materialCalendar").service("MaterialCalendarData",[function(){function t(){this.data={},this.getDayKey=function(t){return[t.getFullYear(),t.getMonth()+1,t.getDate()].join("-")},this.setDayContent=function(t,a){this.data[this.getDayKey(t)]=a||this.data[this.getDayKey(t)]||""}}return new t}]),angular.module("materialCalendar").directive("calendarMd",["$compile","$parse","$templateRequest","$q","materialCalendar.Calendar","MaterialCalendarData",function(t,a,e,n,o,i){var r="{{ day | date:dayTooltipFormat:timezone }}{{ day | date:dayFormat:timezone }}
{{ day | date:dayTooltipFormat }}{{ day | date:dayFormat }}
",d=function(){var t="calendarMdCss";if(!document.getElementById(t)){var a=document.getElementsByTagName("head")[0],e=document.createElement("style");e.type="text/css",e.id=t,e.innerHTML="calendar-md .md-toolbar-tools h2,calendar-md md-content>md-content.agenda>*>* :first-child{overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis}calendar-md{display:block;max-height:100%}calendar-md .md-toolbar-tools .moveNext{transform:translate3d(0,0,0) rotate(180deg)}calendar-md md-content>md-content{border:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>*{border-bottom:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>.disabled{color:rgba(0,0,0,.3);cursor:auto}calendar-md md-content>md-content.agenda>*>.has-events{background-color:#96ca2d}calendar-md md-content>md-content.agenda>*>* :first-child{padding:12px;width:200px;text-align:right;color:rgba(0,0,0,.75);font-weight:100}calendar-md md-content>md-content.agenda>*>* :not(:first-child){overflow:hidden;text-overflow:ellipsis}calendar-md md-content>md-content>*>*{min-width:48px}calendar-md md-content>md-content.calendar>:first-child{background:rgba(0,0,0,.02);border-bottom:1px solid rgba(0,0,0,.12);margin-right:0;min-height:36px}calendar-md md-content>md-content.calendar>:not(:first-child)>.active,calendar-md md-content>md-content.calendar>:not(:first-child)>:not(.disabled):hover{background:#C3E0FC}calendar-md md-content>md-content.calendar>:not(:first-child)>*{border-bottom:1px solid rgba(0,0,0,.12);border-right:1px solid rgba(0,0,0,.12);cursor:pointer}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled:focus{outline-style:none}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled{color:rgba(0,0,0,.3);cursor:auto}calendar-md md-content>md-content.calendar>:not(:first-child)>.has-events{background-color:#96ca2d}calendar-md md-content>md-content.calendar>:not(:first-child)>* :first-child{padding:0}calendar-md md-content>md-content.calendar>:not(:first-child)>* :last-child{overflow:hidden;text-overflow:ellipsis;min-height:45px}",a.insertBefore(e,a.firstChild)}};return{restrict:"E",scope:{ngModel:"=?",template:"&",templateUrl:"=?",onDayClick:"=?",onPrevMonth:"=?",onNextMonth:"=?",calendarDirection:"=?",dayContent:"&?",timezone:"=?",titleFormat:"=?",dayFormat:"=?",dayLabelFormat:"=?",dayLabelTooltipFormat:"=?",dayTooltipFormat:"=?",weekStartsOn:"=?",tooltips:"&?",startDateOfMonth:"=?",noOfDays:"=?",clearDataCacheOnLoad:"=?",disableFutureSelection:"=?",disableSelection:"=?",daysToDisable:"=?",disabledDayClick:"=?",dateFilter:"=?"},link:function(l,s,c){d();var u=new Date,m=parseInt(c.startMonth||u.getMonth()),h=parseInt(c.startYear||u.getFullYear());l.columnWeekLayout="column",l.weekLayout="row",l.timezone=l.timezone||null,l.noCache=c.clearDataCacheOnLoad||!1,c.ngModel?(l.active=l.$parent.$eval(c.ngModel),c.ngModel&&l.$watch("$parent."+c.ngModel,function(t){l.active=t})):l.active=null,l.titleFormat=l.titleFormat||"LLLL yyyy",l.dayLabelFormat=l.dayLabelFormat||"EEE",l.dayLabelTooltipFormat=l.dayLabelTooltipFormat||"EEEE",l.dayFormat=l.dayFormat||"d",l.dayTooltipFormat=l.dayTooltipFormat||"fullDate",l.dayIdFormat="dd-MM-yy",l.disableFutureSelection=l.disableFutureSelection||!1,l.disableSelection=l.disableSelection||!1,l.sameMonth=function(t){var a=angular.copy(t);return a.getFullYear()===l.calendar.year&&a.getMonth()===l.calendar.month};var g=function(t){return l.daysToDisable?l.daysToDisable.filter(function(a){return a.getFullYear()===t.getFullYear()&&a.getMonth()===t.getMonth()&&a.getDate()===t.getDate()}).length>0:!1};l.isDisabled=function(t,a,e){if(0!=e&&angular.isDefined(e)){var n=new Date(l.calendar.year,l.calendar.month,a),o=angular.copy(n);if(o.setDate(n.getDate()+parseInt(e)),t.getDate()<=n&&t.getDate()>=o)return!0}return l.disableSelection?!0:l.disableFutureSelection&&t>new Date?!0:l.sameMonth(t)?l.dateFilter?l.dateFilter(t):g(t)?!0:!1:!0},l.calendarDirection=l.calendarDirection||"horizontal",l.$watch("calendarDirection",function(t){l.weekLayout="horizontal"===t?"row":"column"}),l.$watch("weekLayout",function(){h=l.calendar.year,m=l.calendar.month,M()});var y=function(t,a){(t||angular.noop)(a)},f=function(t,a){var e=-1;return angular.forEach(t,function(t,n){0>e&&angular.equals(a,t)&&(e=n)}),e};l.isActive=function(t){var a,e=angular.copy(l.active);return angular.isArray(e)?a=f(e,t)>-1:e&&angular.equals(e.getYear(),t.getYear())&&angular.equals(e.getMonth(),t.getMonth())&&angular.equals(e.getDate(),t.getDate())&&(a=!0),a},l.hasEvents=function(t){var a=i.data[l.dayKey(t)];return a&&a.length>0},l.prev=function(){l.calendar.prev();var t={year:l.calendar.year,month:l.calendar.month+1};w(),y(l.onPrevMonth,t)},l.next=function(){l.calendar.next();var t={year:l.calendar.year,month:l.calendar.month+1};w(),y(l.onNextMonth,t)},l.handleDayClick=function(t){if(!(l.disableFutureSelection&&t>new Date||l.disableSelection)){if(l.isDisabled(t))return void y(l.disabledDayClick,angular.copy(t));var e=angular.copy(l.active);if(angular.isArray(e)){var n=f(e,t);n>-1?e.splice(n,1):e.push(t)}else e=angular.equals(e,t)?null:t;l.active=e,c.ngModel&&a(c.ngModel).assign(l.$parent,angular.copy(l.active)),y(l.onDayClick,angular.copy(t))}};var v=function(a){s.html(a),t(s.contents())(l)},p=function(){return l.calendar=new o(h,m,{weekStartsOn:l.weekStartsOn||0,startDateOfMonth:l.startDateOfMonth||1,noOfDays:l.noOfDays||0}),l.templateUrl?e(l.templateUrl):n.resolve(l.template()||r)};l.dataService=i;var b=function(t){return l.dataService.getDayKey(t)};l.dayKey=b;var D=function(t){l.noCache?l.dataService.setDayContent(t,""):l.dataService.setDayContent(t,l.dataService.data[b(t)]||"");var a=(l.dayContent||angular.noop)(),e=(a||angular.noop)(t);angular.isObject(e)&&"function"==typeof e.success?e.success(function(a){l.dataService.setDayContent(t,a)}):angular.isObject(e)&&"function"==typeof e.then?e.then(function(a){l.dataService.setDayContent(t,a)}):l.dataService.setDayContent(t,e)},w=function(){angular.forEach(l.calendar.weeks,function(t){angular.forEach(t,D)})};window.data=l.data;var M=function(){p().then(function(t){v(t),w()})};l.$watchGroup(["weekStartsOn","startDateOfMonth","noOfDays"],p),M(),l._$$init=p,l._$$setTemplate=v,l._$$bootstrap=M}}}]);
\ No newline at end of file
diff --git a/dist/angular-material-calendar.css b/dist/angular-material-calendar.css
index 173a2fc..4dee8e8 100644
--- a/dist/angular-material-calendar.css
+++ b/dist/angular-material-calendar.css
@@ -13,8 +13,9 @@ calendar-md {
border-bottom: 1px solid rgba(0, 0, 0, 0.12); }
calendar-md md-content > md-content.agenda > * > *.disabled {
color: rgba(0, 0, 0, 0.3);
- pointer-events: none;
cursor: auto; }
+ calendar-md md-content > md-content.agenda > * > *.has-events {
+ background-color: #96ca2d; }
calendar-md md-content > md-content.agenda > * > * :first-child {
padding: 12px;
width: 200px;
@@ -38,17 +39,20 @@ calendar-md {
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
border-right: 1px solid rgba(0, 0, 0, 0.12);
cursor: pointer; }
- calendar-md md-content > md-content.calendar > :not(:first-child) > *:hover {
- background: rgba(0, 0, 0, 0.04); }
+ calendar-md md-content > md-content.calendar > :not(:first-child) > *.disabled:focus {
+ outline-style: none; }
+ calendar-md md-content > md-content.calendar > :not(:first-child) > *:not(.disabled):hover {
+ background: #C3E0FC; }
calendar-md md-content > md-content.calendar > :not(:first-child) > *.disabled {
color: rgba(0, 0, 0, 0.3);
- pointer-events: none;
cursor: auto; }
calendar-md md-content > md-content.calendar > :not(:first-child) > *.active {
- box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 2px 1px -1px rgba(0, 0, 0, 0.12);
- background: rgba(0, 0, 0, 0.02); }
+ background: #C3E0FC; }
+ calendar-md md-content > md-content.calendar > :not(:first-child) > *.has-events {
+ background-color: #96ca2d; }
calendar-md md-content > md-content.calendar > :not(:first-child) > * :first-child {
padding: 0; }
calendar-md md-content > md-content.calendar > :not(:first-child) > * :last-child {
overflow: hidden;
- text-overflow: ellipsis; }
+ text-overflow: ellipsis;
+ min-height: 45px; }
diff --git a/dist/angular-material-calendar.html b/dist/angular-material-calendar.html
index 8474bca..83fa6eb 100644
--- a/dist/angular-material-calendar.html
+++ b/dist/angular-material-calendar.html
@@ -1 +1 @@
-{{ day | date:dayTooltipFormat:timezone }}{{ day | date:dayFormat:timezone }}
{{ day | date:dayTooltipFormat }}{{ day | date:dayFormat }}
\ No newline at end of file
+{{ day | date:dayTooltipFormat:timezone }}{{ day | date:dayFormat:timezone }}
{{ day | date:dayTooltipFormat }}{{ day | date:dayFormat }}
\ No newline at end of file
diff --git a/dist/angular-material-calendar.js b/dist/angular-material-calendar.js
index e171128..970d402 100644
--- a/dist/angular-material-calendar.js
+++ b/dist/angular-material-calendar.js
@@ -5,11 +5,14 @@ angular.module("materialCalendar").constant("materialCalendar.config", {
debug: document.domain.indexOf("localhost") > -1
});
-angular.module("materialCalendar").config(["materialCalendar.config", "$logProvider", "$compileProvider", function (config, $logProvider, $compileProvider) {
+angular.module("materialCalendar").config(["materialCalendar.config", "$logProvider", "$compileProvider", "$mdIconProvider", function (config, $logProvider, $compileProvider, $mdIconProvider) {
if (config.debug) {
$logProvider.debugEnabled(false);
$compileProvider.debugInfoEnabled(false);
}
+ /* tslint:disable:max-line-length */
+ $mdIconProvider.icon("md-tabs-arrow", "data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxnIGZpbGw9ImN1cnJlbnRDb2xvciI+PHBvbHlnb24gcG9pbnRzPSIxNS40LDcuNCAxNCw2IDgsMTIgMTQsMTggMTUuNCwxNi42IDEwLjgsMTIgIi8+PC9nPjwvc3ZnPg==", 24);
+ /* tslint:enable:max-line-length */
}]);
angular.module("materialCalendar").service("materialCalendar.Calendar", [function () {
@@ -40,7 +43,7 @@ angular.module("materialCalendar").service("materialCalendar.Calendar", [functio
this.setNoOfDays = function (i) {
var d = parseInt(i || 0, 10);
- if (!isNaN(d) && d > 0 ) {
+ if (!isNaN(d) && d > 0) {
this.noOfDays = d;
} else {
this.noOfDays = 0;
@@ -90,21 +93,21 @@ angular.module("materialCalendar").service("materialCalendar.Calendar", [functio
}
// First day of calendar month.
- if ( angular.isDefined(this.options.startDateOfMonth) ) {
+ if (angular.isDefined(this.options.startDateOfMonth)) {
this.start = new Date(this.year, this.month, this.startDateOfMonth);
} else {
this.start = new Date(this.year, this.month, 1);
}
var date = angular.copy(this.start);
- if ( date.getDate() === 1) {
- while ( date.getDay() !== this.weekStartsOn) {
+ if (date.getDate() === 1) {
+ while (date.getDay() !== this.weekStartsOn) {
date.setDate(date.getDate() - 1);
monthLength++;
}
}
- if ( this.noOfDays !== 0) {
+ if (this.noOfDays !== 0) {
while (this.noOfDays % 7 !== 0) {
this.noOfDays++;
}
@@ -153,11 +156,11 @@ angular.module("materialCalendar").service("MaterialCalendarData", [function ()
this.data = {};
- this.getDayKey = function(date) {
+ this.getDayKey = function (date) {
return [date.getFullYear(), date.getMonth() + 1, date.getDate()].join("-");
};
- this.setDayContent = function(date, content) {
+ this.setDayContent = function (date, content) {
this.data[this.getDayKey(date)] = content || this.data[this.getDayKey(date)] || "";
};
}
@@ -166,7 +169,7 @@ angular.module("materialCalendar").service("MaterialCalendarData", [function ()
angular.module("materialCalendar").directive("calendarMd", ["$compile", "$parse", "$templateRequest", "$q", "materialCalendar.Calendar", "MaterialCalendarData", function ($compile, $parse, $templateRequest, $q, Calendar, CalendarData) {
- var defaultTemplate = "{{ day | date:dayTooltipFormat:timezone }}{{ day | date:dayFormat:timezone }}
{{ day | date:dayTooltipFormat }}{{ day | date:dayFormat }}
";
+ var defaultTemplate = "{{ day | date:dayTooltipFormat:timezone }}{{ day | date:dayFormat:timezone }}
{{ day | date:dayTooltipFormat }}{{ day | date:dayFormat }}
";
var injectCss = function () {
var styleId = "calendarMdCss";
@@ -175,7 +178,7 @@ angular.module("materialCalendar").directive("calendarMd", ["$compile", "$parse"
var css = document.createElement("style");
css.type = "text/css";
css.id = styleId;
- css.innerHTML = "calendar-md md-content>md-content.agenda>*>* :not(:first-child),calendar-md md-content>md-content.calendar>:not(:first-child)>* :last-child{overflow:hidden;text-overflow:ellipsis}calendar-md{display:block;max-height:100%}calendar-md .md-toolbar-tools h2{overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}calendar-md .md-toolbar-tools .moveNext{transform:translate3d(0,0,0) rotate(180deg)}calendar-md md-content>md-content{border:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>*{border-bottom:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>.disabled{color:rgba(0,0,0,.3);pointer-events:none;cursor:auto}calendar-md md-content>md-content.agenda>*>* :first-child{padding:12px;width:200px;text-align:right;color:rgba(0,0,0,.75);font-weight:100;overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}calendar-md md-content>md-content>*>*{min-width:48px}calendar-md md-content>md-content.calendar>:first-child{background:rgba(0,0,0,.02);border-bottom:1px solid rgba(0,0,0,.12);margin-right:0;min-height:36px}calendar-md md-content>md-content.calendar>:not(:first-child)>*{border-bottom:1px solid rgba(0,0,0,.12);border-right:1px solid rgba(0,0,0,.12);cursor:pointer}calendar-md md-content>md-content.calendar>:not(:first-child)>:hover{background:rgba(0,0,0,.04)}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled{color:rgba(0,0,0,.3);pointer-events:none;cursor:auto}calendar-md md-content>md-content.calendar>:not(:first-child)>.active{box-shadow:0 1px 3px 0 rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12);background:rgba(0,0,0,.02)}calendar-md md-content>md-content.calendar>:not(:first-child)>* :first-child{padding:0}";
+ css.innerHTML = "calendar-md .md-toolbar-tools h2,calendar-md md-content>md-content.agenda>*>* :first-child{overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis}calendar-md{display:block;max-height:100%}calendar-md .md-toolbar-tools .moveNext{transform:translate3d(0,0,0) rotate(180deg)}calendar-md md-content>md-content{border:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>*{border-bottom:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>.disabled{color:rgba(0,0,0,.3);cursor:auto}calendar-md md-content>md-content.agenda>*>.has-events{background-color:#96ca2d}calendar-md md-content>md-content.agenda>*>* :first-child{padding:12px;width:200px;text-align:right;color:rgba(0,0,0,.75);font-weight:100}calendar-md md-content>md-content.agenda>*>* :not(:first-child){overflow:hidden;text-overflow:ellipsis}calendar-md md-content>md-content>*>*{min-width:48px}calendar-md md-content>md-content.calendar>:first-child{background:rgba(0,0,0,.02);border-bottom:1px solid rgba(0,0,0,.12);margin-right:0;min-height:36px}calendar-md md-content>md-content.calendar>:not(:first-child)>.active,calendar-md md-content>md-content.calendar>:not(:first-child)>:not(.disabled):hover{background:#C3E0FC}calendar-md md-content>md-content.calendar>:not(:first-child)>*{border-bottom:1px solid rgba(0,0,0,.12);border-right:1px solid rgba(0,0,0,.12);cursor:pointer}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled:focus{outline-style:none}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled{color:rgba(0,0,0,.3);cursor:auto}calendar-md md-content>md-content.calendar>:not(:first-child)>.has-events{background-color:#96ca2d}calendar-md md-content>md-content.calendar>:not(:first-child)>* :first-child{padding:0}calendar-md md-content>md-content.calendar>:not(:first-child)>* :last-child{overflow:hidden;text-overflow:ellipsis;min-height:45px}";
head.insertBefore(css, head.firstChild);
}
};
@@ -203,10 +206,13 @@ angular.module("materialCalendar").directive("calendarMd", ["$compile", "$parse"
noOfDays: "=?",
clearDataCacheOnLoad: "=?",
disableFutureSelection: "=?",
- disableSelection: "=?"
+ disableSelection: "=?",
+ daysToDisable: "=?",
+ disabledDayClick: "=?",
+ dateFilter: "=?"
},
link: function ($scope, $element, $attrs) {
-
+ // debugger;
// Add the CSS here.
injectCss();
@@ -249,16 +255,31 @@ angular.module("materialCalendar").directive("calendarMd", ["$compile", "$parse"
d.getMonth() === $scope.calendar.month;
};
- $scope.isDisabled = function (date,startDateOfMonth,noOfDays) {
- if (noOfDays!=0 && angular.isDefined(noOfDays)) {
- var dateStart = new Date($scope.calendar.year,$scope.calendar.month,startDateOfMonth);
+ var chkDisabledDay = function (date) {
+ if ($scope.daysToDisable) {
+ return $scope.daysToDisable.filter(function (day) {
+ return day.getFullYear() === date.getFullYear()
+ && day.getMonth() === date.getMonth()
+ && day.getDate() === date.getDate();
+ }).length > 0;
+ }
+ return false;
+ };
+
+ $scope.isDisabled = function (date, startDateOfMonth, noOfDays) {
+ if (noOfDays != 0 && angular.isDefined(noOfDays)) {
+ var dateStart = new Date($scope.calendar.year, $scope.calendar.month, startDateOfMonth);
var dateEnd = angular.copy(dateStart);
- dateEnd.setDate(dateStart.getDate()+parseInt(noOfDays));
+ dateEnd.setDate(dateStart.getDate() + parseInt(noOfDays));
if (date.getDate() <= dateStart && date.getDate() >= dateEnd) { return true; }
}
if ($scope.disableSelection) { return true; }
if ($scope.disableFutureSelection && date > new Date()) { return true; }
- return !$scope.sameMonth(date);
+ if (!$scope.sameMonth(date)) { return true; }
+
+ if ($scope.dateFilter) { return $scope.dateFilter(date); }
+ if (chkDisabledDay(date)) { return true; }
+ return false;
};
$scope.calendarDirection = $scope.calendarDirection || "horizontal";
@@ -302,6 +323,11 @@ angular.module("materialCalendar").directive("calendarMd", ["$compile", "$parse"
return match;
};
+ $scope.hasEvents = function (date) {
+ var data = CalendarData.data[$scope.dayKey(date)];
+ return (data && data.length > 0);
+ };
+
$scope.prev = function () {
$scope.calendar.prev();
var data = {
@@ -324,11 +350,16 @@ angular.module("materialCalendar").directive("calendarMd", ["$compile", "$parse"
$scope.handleDayClick = function (date) {
- if($scope.disableFutureSelection && date > new Date()) {
+ if ($scope.disableFutureSelection && date > new Date()) {
+ return;
+ }
+
+ if ($scope.disableSelection) {
return;
}
- if($scope.disableSelection) {
+ if ($scope.isDisabled(date)) {
+ handleCb($scope.disabledDayClick, angular.copy(date));
return;
}
@@ -432,7 +463,7 @@ angular.module("materialCalendar").directive("calendarMd", ["$compile", "$parse"
});
};
- $scope.$watchGroup(["weekStartsOn","startDateOfMonth","noOfDays"], init);
+ $scope.$watchGroup(["weekStartsOn", "startDateOfMonth", "noOfDays"], init);
bootstrap();
// These are for tests, don't remove them..
diff --git a/dist/angular-material-calendar.min.css b/dist/angular-material-calendar.min.css
index 08bab5b..0189c2a 100644
--- a/dist/angular-material-calendar.min.css
+++ b/dist/angular-material-calendar.min.css
@@ -1 +1 @@
-calendar-md md-content>md-content.agenda>*>* :not(:first-child),calendar-md md-content>md-content.calendar>:not(:first-child)>* :last-child{overflow:hidden;text-overflow:ellipsis}calendar-md{display:block;max-height:100%}calendar-md .md-toolbar-tools h2{overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}calendar-md .md-toolbar-tools .moveNext{transform:translate3d(0,0,0) rotate(180deg)}calendar-md md-content>md-content{border:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>*{border-bottom:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>.disabled{color:rgba(0,0,0,.3);pointer-events:none;cursor:auto}calendar-md md-content>md-content.agenda>*>* :first-child{padding:12px;width:200px;text-align:right;color:rgba(0,0,0,.75);font-weight:100;overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}calendar-md md-content>md-content>*>*{min-width:48px}calendar-md md-content>md-content.calendar>:first-child{background:rgba(0,0,0,.02);border-bottom:1px solid rgba(0,0,0,.12);margin-right:0;min-height:36px}calendar-md md-content>md-content.calendar>:not(:first-child)>*{border-bottom:1px solid rgba(0,0,0,.12);border-right:1px solid rgba(0,0,0,.12);cursor:pointer}calendar-md md-content>md-content.calendar>:not(:first-child)>:hover{background:rgba(0,0,0,.04)}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled{color:rgba(0,0,0,.3);pointer-events:none;cursor:auto}calendar-md md-content>md-content.calendar>:not(:first-child)>.active{box-shadow:0 1px 3px 0 rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12);background:rgba(0,0,0,.02)}calendar-md md-content>md-content.calendar>:not(:first-child)>* :first-child{padding:0}
\ No newline at end of file
+calendar-md .md-toolbar-tools h2,calendar-md md-content>md-content.agenda>*>* :first-child{overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis}calendar-md{display:block;max-height:100%}calendar-md .md-toolbar-tools .moveNext{transform:translate3d(0,0,0) rotate(180deg)}calendar-md md-content>md-content{border:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>*{border-bottom:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>.disabled{color:rgba(0,0,0,.3);cursor:auto}calendar-md md-content>md-content.agenda>*>.has-events{background-color:#96ca2d}calendar-md md-content>md-content.agenda>*>* :first-child{padding:12px;width:200px;text-align:right;color:rgba(0,0,0,.75);font-weight:100}calendar-md md-content>md-content.agenda>*>* :not(:first-child){overflow:hidden;text-overflow:ellipsis}calendar-md md-content>md-content>*>*{min-width:48px}calendar-md md-content>md-content.calendar>:first-child{background:rgba(0,0,0,.02);border-bottom:1px solid rgba(0,0,0,.12);margin-right:0;min-height:36px}calendar-md md-content>md-content.calendar>:not(:first-child)>.active,calendar-md md-content>md-content.calendar>:not(:first-child)>:not(.disabled):hover{background:#C3E0FC}calendar-md md-content>md-content.calendar>:not(:first-child)>*{border-bottom:1px solid rgba(0,0,0,.12);border-right:1px solid rgba(0,0,0,.12);cursor:pointer}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled:focus{outline-style:none}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled{color:rgba(0,0,0,.3);cursor:auto}calendar-md md-content>md-content.calendar>:not(:first-child)>.has-events{background-color:#96ca2d}calendar-md md-content>md-content.calendar>:not(:first-child)>* :first-child{padding:0}calendar-md md-content>md-content.calendar>:not(:first-child)>* :last-child{overflow:hidden;text-overflow:ellipsis;min-height:45px}
\ No newline at end of file
diff --git a/dist/angular-material-calendar.min.js b/dist/angular-material-calendar.min.js
index 5e5eb10..d20d6d1 100644
--- a/dist/angular-material-calendar.min.js
+++ b/dist/angular-material-calendar.min.js
@@ -1 +1 @@
-angular.module("materialCalendar",["ngMaterial","ngSanitize"]),angular.module("materialCalendar").constant("materialCalendar.config",{version:"0.2.13",debug:document.domain.indexOf("localhost")>-1}),angular.module("materialCalendar").config(["materialCalendar.config","$logProvider","$compileProvider",function(t,a,e){t.debug&&(a.debugEnabled(!1),e.debugInfoEnabled(!1))}]),angular.module("materialCalendar").service("materialCalendar.Calendar",[function(){function t(t,a,e){var n=new Date;this.setWeekStartsOn=function(t){var a=parseInt(t||0,10);return this.weekStartsOn=!isNaN(a)&&a>=0&&6>=a?a:0,this.weekStartsOn},this.setStartDateOfMonth=function(t){var a=parseInt(t||1,10);return this.startDateOfMonth=!isNaN(a)&&a>=1&&31>=a?a:1,this.startDateOfMonth},this.setNoOfDays=function(t){var a=parseInt(t||0,10);return this.noOfDays=!isNaN(a)&&a>0?a:0,this.noOfDays},this.options=angular.isObject(e)?e:{},this.year=n.getFullYear(),this.month=n.getMonth(),this.weeks=[],this.weekStartsOn=this.setWeekStartsOn(this.options.weekStartsOn),this.startDateOfMonth=this.setStartDateOfMonth(this.options.startDateOfMonth),this.noOfDays=this.setNoOfDays(this.options.noOfDays),this.next=function(){return this.start.getMonth()<11?void this.init(this.start.getFullYear(),this.start.getMonth()+1):void this.init(this.start.getFullYear()+1,0)},this.prev=function(){return this.month?void this.init(this.start.getFullYear(),this.start.getMonth()-1):void this.init(this.start.getFullYear()-1,11)},this.init=function(t,a){var e=new Date;this.year=angular.isDefined(t)?t:e.getFullYear(),this.month=angular.isDefined(a)?a:e.getMonth();var n=[31,28,31,30,31,30,31,31,30,31,30,31],o=n[this.month];1===this.month&&(this.year%4===0&&this.year%100!==0||this.year%400===0)&&(o=29),this.start=angular.isDefined(this.options.startDateOfMonth)?new Date(this.year,this.month,this.startDateOfMonth):new Date(this.year,this.month,1);var r=angular.copy(this.start);if(1===r.getDate())for(;r.getDay()!==this.weekStartsOn;)r.setDate(r.getDate()-1),o++;if(0!==this.noOfDays){for(;this.noOfDays%7!==0;)this.noOfDays++;o=this.noOfDays}else for(;o%7!==0;)o++;for(;o%7!==0;)o++;this.weeks=[];for(var i=0;o>i;++i)i%7===0&&this.weeks.push([]),this.weeks[this.weeks.length-1].push(angular.copy(r)),r.setDate(r.getDate()+1)},this.init(t,a)}return t}]),angular.module("materialCalendar").service("MaterialCalendarData",[function(){function t(){this.data={},this.getDayKey=function(t){return[t.getFullYear(),t.getMonth()+1,t.getDate()].join("-")},this.setDayContent=function(t,a){this.data[this.getDayKey(t)]=a||this.data[this.getDayKey(t)]||""}}return new t}]),angular.module("materialCalendar").directive("calendarMd",["$compile","$parse","$templateRequest","$q","materialCalendar.Calendar","MaterialCalendarData",function(t,a,e,n,o,r){var i="{{ day | date:dayTooltipFormat:timezone }}{{ day | date:dayFormat:timezone }}
{{ day | date:dayTooltipFormat }}{{ day | date:dayFormat }}
",d=function(){var t="calendarMdCss";if(!document.getElementById(t)){var a=document.getElementsByTagName("head")[0],e=document.createElement("style");e.type="text/css",e.id=t,e.innerHTML="calendar-md md-content>md-content.agenda>*>* :not(:first-child),calendar-md md-content>md-content.calendar>:not(:first-child)>* :last-child{overflow:hidden;text-overflow:ellipsis}calendar-md{display:block;max-height:100%}calendar-md .md-toolbar-tools h2{overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}calendar-md .md-toolbar-tools .moveNext{transform:translate3d(0,0,0) rotate(180deg)}calendar-md md-content>md-content{border:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>*{border-bottom:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>.disabled{color:rgba(0,0,0,.3);pointer-events:none;cursor:auto}calendar-md md-content>md-content.agenda>*>* :first-child{padding:12px;width:200px;text-align:right;color:rgba(0,0,0,.75);font-weight:100;overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}calendar-md md-content>md-content>*>*{min-width:48px}calendar-md md-content>md-content.calendar>:first-child{background:rgba(0,0,0,.02);border-bottom:1px solid rgba(0,0,0,.12);margin-right:0;min-height:36px}calendar-md md-content>md-content.calendar>:not(:first-child)>*{border-bottom:1px solid rgba(0,0,0,.12);border-right:1px solid rgba(0,0,0,.12);cursor:pointer}calendar-md md-content>md-content.calendar>:not(:first-child)>:hover{background:rgba(0,0,0,.04)}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled{color:rgba(0,0,0,.3);pointer-events:none;cursor:auto}calendar-md md-content>md-content.calendar>:not(:first-child)>.active{box-shadow:0 1px 3px 0 rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12);background:rgba(0,0,0,.02)}calendar-md md-content>md-content.calendar>:not(:first-child)>* :first-child{padding:0}",a.insertBefore(e,a.firstChild)}};return{restrict:"E",scope:{ngModel:"=?",template:"&",templateUrl:"=?",onDayClick:"=?",onPrevMonth:"=?",onNextMonth:"=?",calendarDirection:"=?",dayContent:"&?",timezone:"=?",titleFormat:"=?",dayFormat:"=?",dayLabelFormat:"=?",dayLabelTooltipFormat:"=?",dayTooltipFormat:"=?",weekStartsOn:"=?",tooltips:"&?",startDateOfMonth:"=?",noOfDays:"=?",clearDataCacheOnLoad:"=?",disableFutureSelection:"=?",disableSelection:"=?"},link:function(l,s,c){d();var u=new Date,m=parseInt(c.startMonth||u.getMonth()),h=parseInt(c.startYear||u.getFullYear());l.columnWeekLayout="column",l.weekLayout="row",l.timezone=l.timezone||null,l.noCache=c.clearDataCacheOnLoad||!1,c.ngModel?(l.active=l.$parent.$eval(c.ngModel),c.ngModel&&l.$watch("$parent."+c.ngModel,function(t){l.active=t})):l.active=null,l.titleFormat=l.titleFormat||"LLLL yyyy",l.dayLabelFormat=l.dayLabelFormat||"EEE",l.dayLabelTooltipFormat=l.dayLabelTooltipFormat||"EEEE",l.dayFormat=l.dayFormat||"d",l.dayTooltipFormat=l.dayTooltipFormat||"fullDate",l.dayIdFormat="dd-MM-yy",l.disableFutureSelection=l.disableFutureSelection||!1,l.disableSelection=l.disableSelection||!1,l.sameMonth=function(t){var a=angular.copy(t);return a.getFullYear()===l.calendar.year&&a.getMonth()===l.calendar.month},l.isDisabled=function(t,a,e){if(0!=e&&angular.isDefined(e)){var n=new Date(l.calendar.year,l.calendar.month,a),o=angular.copy(n);if(o.setDate(n.getDate()+parseInt(e)),t.getDate()<=n&&t.getDate()>=o)return!0}return l.disableSelection?!0:l.disableFutureSelection&&t>new Date?!0:!l.sameMonth(t)},l.calendarDirection=l.calendarDirection||"horizontal",l.$watch("calendarDirection",function(t){l.weekLayout="horizontal"===t?"row":"column"}),l.$watch("weekLayout",function(){h=l.calendar.year,m=l.calendar.month,w()});var g=function(t,a){(t||angular.noop)(a)},y=function(t,a){var e=-1;return angular.forEach(t,function(t,n){0>e&&angular.equals(a,t)&&(e=n)}),e};l.isActive=function(t){var a,e=angular.copy(l.active);return angular.isArray(e)?a=y(e,t)>-1:e&&angular.equals(e.getYear(),t.getYear())&&angular.equals(e.getMonth(),t.getMonth())&&angular.equals(e.getDate(),t.getDate())&&(a=!0),a},l.prev=function(){l.calendar.prev();var t={year:l.calendar.year,month:l.calendar.month+1};D(),g(l.onPrevMonth,t)},l.next=function(){l.calendar.next();var t={year:l.calendar.year,month:l.calendar.month+1};D(),g(l.onNextMonth,t)},l.handleDayClick=function(t){if(!(l.disableFutureSelection&&t>new Date||l.disableSelection)){var e=angular.copy(l.active);if(angular.isArray(e)){var n=y(e,t);n>-1?e.splice(n,1):e.push(t)}else e=angular.equals(e,t)?null:t;l.active=e,c.ngModel&&a(c.ngModel).assign(l.$parent,angular.copy(l.active)),g(l.onDayClick,angular.copy(t))}};var f=function(a){s.html(a),t(s.contents())(l)},p=function(){return l.calendar=new o(h,m,{weekStartsOn:l.weekStartsOn||0,startDateOfMonth:l.startDateOfMonth||1,noOfDays:l.noOfDays||0}),l.templateUrl?e(l.templateUrl):n.resolve(l.template()||i)};l.dataService=r;var v=function(t){return l.dataService.getDayKey(t)};l.dayKey=v;var b=function(t){l.noCache?l.dataService.setDayContent(t,""):l.dataService.setDayContent(t,l.dataService.data[v(t)]||"");var a=(l.dayContent||angular.noop)(),e=(a||angular.noop)(t);angular.isObject(e)&&"function"==typeof e.success?e.success(function(a){l.dataService.setDayContent(t,a)}):angular.isObject(e)&&"function"==typeof e.then?e.then(function(a){l.dataService.setDayContent(t,a)}):l.dataService.setDayContent(t,e)},D=function(){angular.forEach(l.calendar.weeks,function(t){angular.forEach(t,b)})};window.data=l.data;var w=function(){p().then(function(t){f(t),D()})};l.$watchGroup(["weekStartsOn","startDateOfMonth","noOfDays"],p),w(),l._$$init=p,l._$$setTemplate=f,l._$$bootstrap=w}}}]);
\ No newline at end of file
+angular.module("materialCalendar",["ngMaterial","ngSanitize"]),angular.module("materialCalendar").constant("materialCalendar.config",{version:"0.2.13",debug:document.domain.indexOf("localhost")>-1}),angular.module("materialCalendar").config(["materialCalendar.config","$logProvider","$compileProvider","$mdIconProvider",function(t,a,e,n){t.debug&&(a.debugEnabled(!1),e.debugInfoEnabled(!1)),n.icon("md-tabs-arrow","data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxnIGZpbGw9ImN1cnJlbnRDb2xvciI+PHBvbHlnb24gcG9pbnRzPSIxNS40LDcuNCAxNCw2IDgsMTIgMTQsMTggMTUuNCwxNi42IDEwLjgsMTIgIi8+PC9nPjwvc3ZnPg==",24)}]),angular.module("materialCalendar").service("materialCalendar.Calendar",[function(){function t(t,a,e){var n=new Date;this.setWeekStartsOn=function(t){var a=parseInt(t||0,10);return this.weekStartsOn=!isNaN(a)&&a>=0&&6>=a?a:0,this.weekStartsOn},this.setStartDateOfMonth=function(t){var a=parseInt(t||1,10);return this.startDateOfMonth=!isNaN(a)&&a>=1&&31>=a?a:1,this.startDateOfMonth},this.setNoOfDays=function(t){var a=parseInt(t||0,10);return this.noOfDays=!isNaN(a)&&a>0?a:0,this.noOfDays},this.options=angular.isObject(e)?e:{},this.year=n.getFullYear(),this.month=n.getMonth(),this.weeks=[],this.weekStartsOn=this.setWeekStartsOn(this.options.weekStartsOn),this.startDateOfMonth=this.setStartDateOfMonth(this.options.startDateOfMonth),this.noOfDays=this.setNoOfDays(this.options.noOfDays),this.next=function(){return this.start.getMonth()<11?void this.init(this.start.getFullYear(),this.start.getMonth()+1):void this.init(this.start.getFullYear()+1,0)},this.prev=function(){return this.month?void this.init(this.start.getFullYear(),this.start.getMonth()-1):void this.init(this.start.getFullYear()-1,11)},this.init=function(t,a){var e=new Date;this.year=angular.isDefined(t)?t:e.getFullYear(),this.month=angular.isDefined(a)?a:e.getMonth();var n=[31,28,31,30,31,30,31,31,30,31,30,31],o=n[this.month];1===this.month&&(this.year%4===0&&this.year%100!==0||this.year%400===0)&&(o=29),this.start=angular.isDefined(this.options.startDateOfMonth)?new Date(this.year,this.month,this.startDateOfMonth):new Date(this.year,this.month,1);var i=angular.copy(this.start);if(1===i.getDate())for(;i.getDay()!==this.weekStartsOn;)i.setDate(i.getDate()-1),o++;if(0!==this.noOfDays){for(;this.noOfDays%7!==0;)this.noOfDays++;o=this.noOfDays}else for(;o%7!==0;)o++;for(;o%7!==0;)o++;this.weeks=[];for(var r=0;o>r;++r)r%7===0&&this.weeks.push([]),this.weeks[this.weeks.length-1].push(angular.copy(i)),i.setDate(i.getDate()+1)},this.init(t,a)}return t}]),angular.module("materialCalendar").service("MaterialCalendarData",[function(){function t(){this.data={},this.getDayKey=function(t){return[t.getFullYear(),t.getMonth()+1,t.getDate()].join("-")},this.setDayContent=function(t,a){this.data[this.getDayKey(t)]=a||this.data[this.getDayKey(t)]||""}}return new t}]),angular.module("materialCalendar").directive("calendarMd",["$compile","$parse","$templateRequest","$q","materialCalendar.Calendar","MaterialCalendarData",function(t,a,e,n,o,i){var r="{{ day | date:dayTooltipFormat:timezone }}{{ day | date:dayFormat:timezone }}
{{ day | date:dayTooltipFormat }}{{ day | date:dayFormat }}
",d=function(){var t="calendarMdCss";if(!document.getElementById(t)){var a=document.getElementsByTagName("head")[0],e=document.createElement("style");e.type="text/css",e.id=t,e.innerHTML="calendar-md .md-toolbar-tools h2,calendar-md md-content>md-content.agenda>*>* :first-child{overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis}calendar-md{display:block;max-height:100%}calendar-md .md-toolbar-tools .moveNext{transform:translate3d(0,0,0) rotate(180deg)}calendar-md md-content>md-content{border:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>*{border-bottom:1px solid rgba(0,0,0,.12)}calendar-md md-content>md-content.agenda>*>.disabled{color:rgba(0,0,0,.3);cursor:auto}calendar-md md-content>md-content.agenda>*>.has-events{background-color:#96ca2d}calendar-md md-content>md-content.agenda>*>* :first-child{padding:12px;width:200px;text-align:right;color:rgba(0,0,0,.75);font-weight:100}calendar-md md-content>md-content.agenda>*>* :not(:first-child){overflow:hidden;text-overflow:ellipsis}calendar-md md-content>md-content>*>*{min-width:48px}calendar-md md-content>md-content.calendar>:first-child{background:rgba(0,0,0,.02);border-bottom:1px solid rgba(0,0,0,.12);margin-right:0;min-height:36px}calendar-md md-content>md-content.calendar>:not(:first-child)>.active,calendar-md md-content>md-content.calendar>:not(:first-child)>:not(.disabled):hover{background:#C3E0FC}calendar-md md-content>md-content.calendar>:not(:first-child)>*{border-bottom:1px solid rgba(0,0,0,.12);border-right:1px solid rgba(0,0,0,.12);cursor:pointer}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled:focus{outline-style:none}calendar-md md-content>md-content.calendar>:not(:first-child)>.disabled{color:rgba(0,0,0,.3);cursor:auto}calendar-md md-content>md-content.calendar>:not(:first-child)>.has-events{background-color:#96ca2d}calendar-md md-content>md-content.calendar>:not(:first-child)>* :first-child{padding:0}calendar-md md-content>md-content.calendar>:not(:first-child)>* :last-child{overflow:hidden;text-overflow:ellipsis;min-height:45px}",a.insertBefore(e,a.firstChild)}};return{restrict:"E",scope:{ngModel:"=?",template:"&",templateUrl:"=?",onDayClick:"=?",onPrevMonth:"=?",onNextMonth:"=?",calendarDirection:"=?",dayContent:"&?",timezone:"=?",titleFormat:"=?",dayFormat:"=?",dayLabelFormat:"=?",dayLabelTooltipFormat:"=?",dayTooltipFormat:"=?",weekStartsOn:"=?",tooltips:"&?",startDateOfMonth:"=?",noOfDays:"=?",clearDataCacheOnLoad:"=?",disableFutureSelection:"=?",disableSelection:"=?",daysToDisable:"=?",disabledDayClick:"=?",dateFilter:"=?"},link:function(l,s,c){d();var u=new Date,m=parseInt(c.startMonth||u.getMonth()),h=parseInt(c.startYear||u.getFullYear());l.columnWeekLayout="column",l.weekLayout="row",l.timezone=l.timezone||null,l.noCache=c.clearDataCacheOnLoad||!1,c.ngModel?(l.active=l.$parent.$eval(c.ngModel),c.ngModel&&l.$watch("$parent."+c.ngModel,function(t){l.active=t})):l.active=null,l.titleFormat=l.titleFormat||"LLLL yyyy",l.dayLabelFormat=l.dayLabelFormat||"EEE",l.dayLabelTooltipFormat=l.dayLabelTooltipFormat||"EEEE",l.dayFormat=l.dayFormat||"d",l.dayTooltipFormat=l.dayTooltipFormat||"fullDate",l.dayIdFormat="dd-MM-yy",l.disableFutureSelection=l.disableFutureSelection||!1,l.disableSelection=l.disableSelection||!1,l.sameMonth=function(t){var a=angular.copy(t);return a.getFullYear()===l.calendar.year&&a.getMonth()===l.calendar.month};var g=function(t){return l.daysToDisable?l.daysToDisable.filter(function(a){return a.getFullYear()===t.getFullYear()&&a.getMonth()===t.getMonth()&&a.getDate()===t.getDate()}).length>0:!1};l.isDisabled=function(t,a,e){if(0!=e&&angular.isDefined(e)){var n=new Date(l.calendar.year,l.calendar.month,a),o=angular.copy(n);if(o.setDate(n.getDate()+parseInt(e)),t.getDate()<=n&&t.getDate()>=o)return!0}return l.disableSelection?!0:l.disableFutureSelection&&t>new Date?!0:l.sameMonth(t)?l.dateFilter?l.dateFilter(t):g(t)?!0:!1:!0},l.calendarDirection=l.calendarDirection||"horizontal",l.$watch("calendarDirection",function(t){l.weekLayout="horizontal"===t?"row":"column"}),l.$watch("weekLayout",function(){h=l.calendar.year,m=l.calendar.month,M()});var y=function(t,a){(t||angular.noop)(a)},f=function(t,a){var e=-1;return angular.forEach(t,function(t,n){0>e&&angular.equals(a,t)&&(e=n)}),e};l.isActive=function(t){var a,e=angular.copy(l.active);return angular.isArray(e)?a=f(e,t)>-1:e&&angular.equals(e.getYear(),t.getYear())&&angular.equals(e.getMonth(),t.getMonth())&&angular.equals(e.getDate(),t.getDate())&&(a=!0),a},l.hasEvents=function(t){var a=i.data[l.dayKey(t)];return a&&a.length>0},l.prev=function(){l.calendar.prev();var t={year:l.calendar.year,month:l.calendar.month+1};w(),y(l.onPrevMonth,t)},l.next=function(){l.calendar.next();var t={year:l.calendar.year,month:l.calendar.month+1};w(),y(l.onNextMonth,t)},l.handleDayClick=function(t){if(!(l.disableFutureSelection&&t>new Date||l.disableSelection)){if(l.isDisabled(t))return void y(l.disabledDayClick,angular.copy(t));var e=angular.copy(l.active);if(angular.isArray(e)){var n=f(e,t);n>-1?e.splice(n,1):e.push(t)}else e=angular.equals(e,t)?null:t;l.active=e,c.ngModel&&a(c.ngModel).assign(l.$parent,angular.copy(l.active)),y(l.onDayClick,angular.copy(t))}};var v=function(a){s.html(a),t(s.contents())(l)},p=function(){return l.calendar=new o(h,m,{weekStartsOn:l.weekStartsOn||0,startDateOfMonth:l.startDateOfMonth||1,noOfDays:l.noOfDays||0}),l.templateUrl?e(l.templateUrl):n.resolve(l.template()||r)};l.dataService=i;var b=function(t){return l.dataService.getDayKey(t)};l.dayKey=b;var D=function(t){l.noCache?l.dataService.setDayContent(t,""):l.dataService.setDayContent(t,l.dataService.data[b(t)]||"");var a=(l.dayContent||angular.noop)(),e=(a||angular.noop)(t);angular.isObject(e)&&"function"==typeof e.success?e.success(function(a){l.dataService.setDayContent(t,a)}):angular.isObject(e)&&"function"==typeof e.then?e.then(function(a){l.dataService.setDayContent(t,a)}):l.dataService.setDayContent(t,e)},w=function(){angular.forEach(l.calendar.weeks,function(t){angular.forEach(t,D)})};window.data=l.data;var M=function(){p().then(function(t){v(t),w()})};l.$watchGroup(["weekStartsOn","startDateOfMonth","noOfDays"],p),M(),l._$$init=p,l._$$setTemplate=v,l._$$bootstrap=M}}}]);
\ No newline at end of file
diff --git a/src/angular-material-calendar.html b/src/angular-material-calendar.html
index 25b0d55..d033440 100644
--- a/src/angular-material-calendar.html
+++ b/src/angular-material-calendar.html
@@ -3,7 +3,7 @@