diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000..47790ac
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,12 @@
+{
+ "env": {
+ "browser": true,
+ "jasmine": true
+ },
+ "rules": {
+ "strict": ["error", "function"]
+ },
+ "globals": {
+ "moment": false
+ }
+}
diff --git a/dist/ng-flat-datepicker.css b/dist/ng-flat-datepicker.css
index a6cd394..c2a72f5 100644
--- a/dist/ng-flat-datepicker.css
+++ b/dist/ng-flat-datepicker.css
@@ -38,22 +38,18 @@
}
.ng-flat-datepicker table caption .ng-flat-datepicker-header-wrapper {
- display: -webkit-flex;
display: -ms-flexbox;
display: flex;
- -webkit-justify-content: space-between;
- -ms-flex-pack: justify;
- justify-content: space-between;
- -webkit-align-items: center;
- -ms-flex-align: center;
- align-items: center;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+ -ms-flex-align: center;
+ align-items: center;
height: 65px;
color: white;
font-size: 22px;
}
.ng-flat-datepicker table caption .ng-flat-datepicker-header-wrapper .ng-flat-datepicker-header-year {
- display: -webkit-flex;
display: -ms-flexbox;
display: flex;
padding-top: 1px;
@@ -118,8 +114,7 @@
user-select: none;
}
-.ng-flat-datepicker table tbody tr td.day-item,
-.ng-flat-datepicker table tbody tr td.disabled {
+.ng-flat-datepicker table tbody tr td.day-item, .ng-flat-datepicker table tbody tr td.disabled {
padding: 0;
height: 37.42857px;
line-height: 37.42857px;
@@ -128,36 +123,30 @@
color: #8d9ca4;
}
-.ng-flat-datepicker table tbody tr td.day-item.day,
-.ng-flat-datepicker table tbody tr td.disabled.day {
+.ng-flat-datepicker table tbody tr td.day-item.day, .ng-flat-datepicker table tbody tr td.disabled.day {
color: #384146;
}
-.ng-flat-datepicker table tbody tr td.day-item.isToday,
-.ng-flat-datepicker table tbody tr td.disabled.isToday {
+.ng-flat-datepicker table tbody tr td.day-item.isToday, .ng-flat-datepicker table tbody tr td.disabled.isToday {
color: #1b1b1b;
font-weight: 700;
}
-.ng-flat-datepicker table tbody tr td.day-item.isSelected,
-.ng-flat-datepicker table tbody tr td.disabled.isSelected {
+.ng-flat-datepicker table tbody tr td.day-item.isSelected, .ng-flat-datepicker table tbody tr td.disabled.isSelected {
background-color: #0093de;
color: #f5f5f5 !important;
}
-.ng-flat-datepicker table tbody tr td.day-item.isInMonth,
-.ng-flat-datepicker table tbody tr td.disabled.isInMonth {
+.ng-flat-datepicker table tbody tr td.day-item.isInMonth, .ng-flat-datepicker table tbody tr td.disabled.isInMonth {
color: #384146;
}
-.ng-flat-datepicker table tbody tr td.day-item.isDisabled,
-.ng-flat-datepicker table tbody tr td.disabled.isDisabled {
+.ng-flat-datepicker table tbody tr td.day-item.isDisabled, .ng-flat-datepicker table tbody tr td.disabled.isDisabled {
cursor: default;
color: #e2e6e8;
}
-.ng-flat-datepicker table tbody tr td.day-item.isDisabled:hover,
-.ng-flat-datepicker table tbody tr td.disabled.isDisabled:hover {
+.ng-flat-datepicker table tbody tr td.day-item.isDisabled:hover, .ng-flat-datepicker table tbody tr td.disabled.isDisabled:hover {
color: #e2e6e8 !important;
background-color: transparent;
}
@@ -183,8 +172,7 @@
}
.ng-flat-datepicker-arrow.ng-flat-datepicker-arrow-left svg {
- -webkit-transform: rotate(180deg);
- transform: rotate(180deg);
+ transform: rotate(180deg);
}
.ng-flat-datepicker-custom-select-title {
@@ -197,8 +185,7 @@
cursor: pointer;
}
-.ng-flat-datepicker-custom-select-title.selected,
-.ng-flat-datepicker-custom-select-title:hover {
+.ng-flat-datepicker-custom-select-title.selected, .ng-flat-datepicker-custom-select-title:hover {
border-color: white !important;
}
diff --git a/dist/ng-flat-datepicker.js b/dist/ng-flat-datepicker.js
index 6a7b89a..29f7c3a 100644
--- a/dist/ng-flat-datepicker.js
+++ b/dist/ng-flat-datepicker.js
@@ -7,6 +7,7 @@
* @example
*/
+ ngFlatDatepickerDirective.$inject = ["$templateCache", "$compile", "$document", "datesCalculator"];
angular
.module('ngFlatDatepicker', [])
.directive('ngFlatDatepicker', ngFlatDatepickerDirective);
@@ -204,7 +205,6 @@
}
};
}
- ngFlatDatepickerDirective.$inject = ["$templateCache", "$compile", "$document", "datesCalculator"];
})();
diff --git a/dist/ng-flat-datepicker.min.css b/dist/ng-flat-datepicker.min.css
index 812ec3b..c92b906 100644
--- a/dist/ng-flat-datepicker.min.css
+++ b/dist/ng-flat-datepicker.min.css
@@ -1 +1 @@
-.ng-flat-datepicker-wrapper{display:inline-block;position:relative}.ng-flat-datepicker-wrapper *{box-sizing:border-box}.ng-flat-datepicker{margin-top:10px;width:290px;position:absolute;background-color:#fff;z-index:3000;box-shadow:1px 1px 7px 0 rgba(37,53,50,.37)}.ng-flat-datepicker .ng-flat-datepicker-table-header-bckgrnd{height:65px;background-color:#0093de}.ng-flat-datepicker table{margin-top:-65px;padding-right:14px;padding-left:14px;padding-bottom:14px;table-layout:fixed;border-collapse:collapse;display:block}.ng-flat-datepicker table caption{height:65px;display:block;padding:0!important}.ng-flat-datepicker table caption .ng-flat-datepicker-header-wrapper{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:65px;color:#fff;font-size:22px}.ng-flat-datepicker table caption .ng-flat-datepicker-header-wrapper .ng-flat-datepicker-header-year{display:-webkit-flex;display:-ms-flexbox;display:flex;padding-top:1px;padding-bottom:0!important;text-align:center}.ng-flat-datepicker table caption .ng-flat-datepicker-header-wrapper .ng-flat-datepicker-header-nav-wrapper{padding-top:5px;padding-bottom:5px;color:#626262;font-size:22px;background-color:#E8E8E8}.ng-flat-datepicker table caption .ng-flat-datepicker-header-wrapper .ng-flat-datepicker-header-nav-wrapper span{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ng-flat-datepicker table tbody{margin:0 auto;padding-top:14px;width:262px;display:block}.ng-flat-datepicker table tbody tr{height:37.42857px;width:262px}.ng-flat-datepicker table tbody tr.days-head{height:45.42857px}.ng-flat-datepicker table tbody tr.days-head .day-head{padding:0 0 14px;border-bottom:1px solid #d8d8d8;color:#384146}.ng-flat-datepicker table tbody tr.days .day-item:hover{background-color:#0093de;color:#f5f5f5!important}.ng-flat-datepicker table tbody tr td{width:37.42857px;text-align:center;background-color:#fff;font-size:12px;display:inline-block;cursor:default;color:#384146;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ng-flat-datepicker table tbody tr td.day-item,.ng-flat-datepicker table tbody tr td.disabled{padding:0;height:37.42857px;line-height:37.42857px;cursor:pointer;border-radius:18.71429px;color:#8d9ca4}.ng-flat-datepicker table tbody tr td.day-item.day,.ng-flat-datepicker table tbody tr td.disabled.day{color:#384146}.ng-flat-datepicker table tbody tr td.day-item.isToday,.ng-flat-datepicker table tbody tr td.disabled.isToday{color:#1b1b1b;font-weight:700}.ng-flat-datepicker table tbody tr td.day-item.isSelected,.ng-flat-datepicker table tbody tr td.disabled.isSelected{background-color:#0093de;color:#f5f5f5!important}.ng-flat-datepicker table tbody tr td.day-item.isInMonth,.ng-flat-datepicker table tbody tr td.disabled.isInMonth{color:#384146}.ng-flat-datepicker table tbody tr td.day-item.isDisabled,.ng-flat-datepicker table tbody tr td.disabled.isDisabled{cursor:default;color:#e2e6e8}.ng-flat-datepicker table tbody tr td.day-item.isDisabled:hover,.ng-flat-datepicker table tbody tr td.disabled.isDisabled:hover{color:#e2e6e8!important;background-color:transparent}.ng-flat-datepicker-arrow{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;height:27px}.ng-flat-datepicker-arrow svg{width:27px;height:27px;fill:#fff;cursor:pointer;padding:5px}.ng-flat-datepicker-arrow svg:hover{fill:rgba(255,255,255,.5)}.ng-flat-datepicker-arrow.ng-flat-datepicker-arrow-left svg{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.ng-flat-datepicker-custom-select-title{padding:3px 5px 4px;border:1px solid #0093de;border-radius:3px;line-height:22px;font-size:22px;display:inline-block;cursor:pointer}.ng-flat-datepicker-custom-select-title.selected,.ng-flat-datepicker-custom-select-title:hover{border-color:#fff!important}.ng-flat-datepicker-custom-select-box{position:relative;padding:5px 0}.ng-flat-datepicker-custom-select-box:first-of-type .ng-flat-datepicker-custom-select-title,.ng-flat-datepicker-custom-select-box:first-of-type .ng-flat-datepicker-custom-select{min-width:80px}.ng-flat-datepicker-custom-select-box .ng-flat-datepicker-custom-select{position:absolute;border-radius:2px;cursor:pointer;width:100%;background-color:#f0f0f0;z-index:1}.ng-flat-datepicker-custom-select-box .ng-flat-datepicker-custom-select span{padding-top:6px;padding-bottom:5px;display:block;text-align:center;font-size:13px;line-height:13px;cursor:pointer;color:#737373;font-weight:400}.ng-flat-datepicker-custom-select-box .ng-flat-datepicker-custom-select span::first-letter{text-transform:uppercase}.ng-flat-datepicker-custom-select-box .ng-flat-datepicker-custom-select span:first-of-type{padding-top:10px;border-top-right-radius:2px;border-top-left-radius:2px}.ng-flat-datepicker-custom-select-box .ng-flat-datepicker-custom-select span:last-of-type{padding-bottom:10px;border-bottom-right-radius:2px;border-bottom-left-radius:2px}.ng-flat-datepicker-custom-select-box .ng-flat-datepicker-custom-select span:hover{background-color:#fff;color:#15A5DB}.ng-flat-datepicker-month-name::first-letter{text-transform:uppercase}
\ No newline at end of file
+.ng-flat-datepicker-wrapper{display:inline-block;position:relative}.ng-flat-datepicker-wrapper *{box-sizing:border-box}.ng-flat-datepicker{margin-top:10px;width:290px;position:absolute;background-color:#fff;z-index:3000;box-shadow:1px 1px 7px 0 rgba(37,53,50,.37)}.ng-flat-datepicker .ng-flat-datepicker-table-header-bckgrnd{height:65px;background-color:#0093de}.ng-flat-datepicker table{margin-top:-65px;padding-right:14px;padding-left:14px;padding-bottom:14px;table-layout:fixed;border-collapse:collapse;display:block}.ng-flat-datepicker table caption{height:65px;display:block;padding:0!important}.ng-flat-datepicker table caption .ng-flat-datepicker-header-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;height:65px;color:#fff;font-size:22px}.ng-flat-datepicker table caption .ng-flat-datepicker-header-wrapper .ng-flat-datepicker-header-year{display:-ms-flexbox;display:flex;padding-top:1px;padding-bottom:0!important;text-align:center}.ng-flat-datepicker table caption .ng-flat-datepicker-header-wrapper .ng-flat-datepicker-header-nav-wrapper{padding-top:5px;padding-bottom:5px;color:#626262;font-size:22px;background-color:#e8e8e8}.ng-flat-datepicker table caption .ng-flat-datepicker-header-wrapper .ng-flat-datepicker-header-nav-wrapper span,.ng-flat-datepicker table tbody tr td{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ng-flat-datepicker table tbody{margin:0 auto;padding-top:14px;width:262px;display:block}.ng-flat-datepicker table tbody tr{height:37.42857px;width:262px}.ng-flat-datepicker table tbody tr.days-head{height:45.42857px}.ng-flat-datepicker table tbody tr.days-head .day-head{padding:0 0 14px;border-bottom:1px solid #d8d8d8;color:#384146}.ng-flat-datepicker table tbody tr.days .day-item:hover{background-color:#0093de;color:#f5f5f5!important}.ng-flat-datepicker table tbody tr td{width:37.42857px;text-align:center;background-color:#fff;font-size:12px;display:inline-block;cursor:default;color:#384146}.ng-flat-datepicker table tbody tr td.day-item,.ng-flat-datepicker table tbody tr td.disabled{padding:0;height:37.42857px;line-height:37.42857px;cursor:pointer;border-radius:18.71429px;color:#8d9ca4}.ng-flat-datepicker table tbody tr td.day-item.day,.ng-flat-datepicker table tbody tr td.disabled.day{color:#384146}.ng-flat-datepicker table tbody tr td.day-item.isToday,.ng-flat-datepicker table tbody tr td.disabled.isToday{color:#1b1b1b;font-weight:700}.ng-flat-datepicker table tbody tr td.day-item.isSelected,.ng-flat-datepicker table tbody tr td.disabled.isSelected{background-color:#0093de;color:#f5f5f5!important}.ng-flat-datepicker table tbody tr td.day-item.isInMonth,.ng-flat-datepicker table tbody tr td.disabled.isInMonth{color:#384146}.ng-flat-datepicker table tbody tr td.day-item.isDisabled,.ng-flat-datepicker table tbody tr td.disabled.isDisabled{cursor:default;color:#e2e6e8}.ng-flat-datepicker table tbody tr td.day-item.isDisabled:hover,.ng-flat-datepicker table tbody tr td.disabled.isDisabled:hover{color:#e2e6e8!important;background-color:transparent}.ng-flat-datepicker-arrow{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;height:27px}.ng-flat-datepicker-arrow svg{width:27px;height:27px;fill:#fff;cursor:pointer;padding:5px}.ng-flat-datepicker-arrow svg:hover{fill:rgba(255,255,255,.5)}.ng-flat-datepicker-arrow.ng-flat-datepicker-arrow-left svg{transform:rotate(180deg)}.ng-flat-datepicker-custom-select-title{padding:3px 5px 4px;border:1px solid #0093de;border-radius:3px;line-height:22px;font-size:22px;display:inline-block;cursor:pointer}.ng-flat-datepicker-custom-select-title.selected,.ng-flat-datepicker-custom-select-title:hover{border-color:#fff!important}.ng-flat-datepicker-custom-select-box{position:relative;padding:5px 0}.ng-flat-datepicker-custom-select-box:first-of-type .ng-flat-datepicker-custom-select,.ng-flat-datepicker-custom-select-box:first-of-type .ng-flat-datepicker-custom-select-title{min-width:80px}.ng-flat-datepicker-custom-select-box .ng-flat-datepicker-custom-select{position:absolute;border-radius:2px;cursor:pointer;width:100%;background-color:#f0f0f0;z-index:1}.ng-flat-datepicker-custom-select-box .ng-flat-datepicker-custom-select span{padding-top:6px;padding-bottom:5px;display:block;text-align:center;font-size:13px;line-height:13px;cursor:pointer;color:#737373;font-weight:400}.ng-flat-datepicker-custom-select-box .ng-flat-datepicker-custom-select span::first-letter,.ng-flat-datepicker-month-name::first-letter{text-transform:uppercase}.ng-flat-datepicker-custom-select-box .ng-flat-datepicker-custom-select span:first-of-type{padding-top:10px;border-top-right-radius:2px;border-top-left-radius:2px}.ng-flat-datepicker-custom-select-box .ng-flat-datepicker-custom-select span:last-of-type{padding-bottom:10px;border-bottom-right-radius:2px;border-bottom-left-radius:2px}.ng-flat-datepicker-custom-select-box .ng-flat-datepicker-custom-select span:hover{background-color:#fff;color:#15a5db}
\ No newline at end of file
diff --git a/dist/ng-flat-datepicker.min.js b/dist/ng-flat-datepicker.min.js
index a68df17..57c4ccc 100644
--- a/dist/ng-flat-datepicker.min.js
+++ b/dist/ng-flat-datepicker.min.js
@@ -1 +1 @@
-!function(){"use strict";function e(e,a,t,n){return{restrict:"A",require:"ngModel",scope:{config:"=datepickerConfig"},link:function(s,r,i,o){function c(e){u===e.target||u[0].contains(e.target)||e.target===r[0]||(t.off("click",c),s.$apply(function(){s.calendarCursor=g?g:p,s.pickerDisplayed=s.showMonthsList=s.showYearsList=!1}))}function l(){r.wrap('
'),a(u)(s),r.after(u),angular.isDefined(o.$modelValue)&&moment.isDate(o.$modelValue)&&(s.calendarCursor=o.$modelValue)}function d(e){var a=[],e=moment.utc(e),t=moment(e).date(1),n=moment(e).date(e.daysInMonth()),r=moment(t),i=moment(n);r=0===t.weekday()?r:r.weekday(0),i=6===n.weekday()?i:i.weekday(6);for(var o=[],c=moment(r);c.isBefore(moment(i).add(1,"days"));c.add(1,"days")){var l=!s.config.minDate||c.isAfter(s.config.minDate,"day"),d=!s.config.maxDate||c.isBefore(s.config.maxDate,"day"),m=c.isAfter(p),u=s.config.allowFuture||!m,f={date:moment(c).toDate(),isToday:c.isSame(p,"day"),isInMonth:c.isSame(t,"month"),isSelected:c.isSame(g,"day"),isSelectable:l&&d&&u};o.push(f),(6===c.weekday()||c===i)&&(a.push(o),o=[])}return a}function m(){s.currentWeeks.forEach(function(e,a){e.forEach(function(e,t){s.currentWeeks[a][t].isSelected=!1})})}var u=angular.element(e.get("datepicker.html")),g="",p=moment.utc(),f={allowFuture:!0,dateFormat:null,minDate:null,maxDate:null};s.config=angular.extend(f,s.config),angular.isDefined(s.config.minDate)&&moment.utc(s.config.minDate).subtract(1,"day"),angular.isDefined(s.config.maxDate)&&moment.utc(s.config.maxDate).add(1,"day"),s.calendarCursor=p,s.currentWeeks=[],s.daysNameList=n.getDaysNames(),s.monthsList=moment.months(),s.yearsList=n.getYearsList(),s.pickerDisplayed=!1,s.$watch(function(){return o.$modelValue},function(e){e&&(g=s.calendarCursor=moment.utc(e,s.config.dateFormat))}),s.$watch("calendarCursor",function(e){s.currentWeeks=d(e)}),r.bind("click",function(e){s.$apply(function(){s.pickerDisplayed=!0,t.on("click",c)})}),l(),s.prevMonth=function(){s.calendarCursor=moment(s.calendarCursor).subtract(1,"months")},s.nextMonth=function(){s.calendarCursor=moment(s.calendarCursor).add(1,"months")},s.selectMonth=function(e){s.showMonthsList=!1,s.calendarCursor=moment(s.calendarCursor).month(e)},s.selectYear=function(e){s.showYearsList=!1,s.calendarCursor=moment(s.calendarCursor).year(e)},s.selectDay=function(e){(e.isSelectable&&!e.isFuture||s.config.allowFuture&&e.isFuture)&&(m(),e.isSelected=!0,o.$setViewValue(moment.utc(e.date).format(s.config.dateFormat)),o.$render(),s.pickerDisplayed=!1)}}}}angular.module("ngFlatDatepicker",[]).directive("ngFlatDatepicker",e),e.$inject=["$templateCache","$compile","$document","datesCalculator"]}(),function(){"use strict";function e(){function e(){for(var e=[],a=2005;a<=moment().year();a++)e.push(a);return e}function a(){for(var e=[],a=0;7>a;a++)e.push(moment().weekday(a).format("ddd"));return e}return{getYearsList:e,getDaysNames:a}}angular.module("ngFlatDatepicker").factory("datesCalculator",e)}(),angular.module("ngFlatDatepicker").run(["$templateCache",function(e){e.put("datepicker.html",'\n \n
\n \n \n \n \n \n {{ dayName }} | \n
\n \n {{ day.date | date:\'dd\' }} | \n
\n \n
\n
\n')}]);
\ No newline at end of file
+!function(){"use strict";function e(e,a,t,n){return{restrict:"A",require:"ngModel",scope:{config:"=datepickerConfig"},link:function(s,r,i,o){function c(e){u===e.target||u[0].contains(e.target)||e.target===r[0]||(t.off("click",c),s.$apply(function(){s.calendarCursor=g?g:p,s.pickerDisplayed=s.showMonthsList=s.showYearsList=!1}))}function l(){r.wrap(''),a(u)(s),r.after(u),angular.isDefined(o.$modelValue)&&moment.isDate(o.$modelValue)&&(s.calendarCursor=o.$modelValue)}function d(e){var a=[],e=moment.utc(e),t=moment(e).date(1),n=moment(e).date(e.daysInMonth()),r=moment(t),i=moment(n);r=0===t.weekday()?r:r.weekday(0),i=6===n.weekday()?i:i.weekday(6);for(var o=[],c=moment(r);c.isBefore(moment(i).add(1,"days"));c.add(1,"days")){var l=!s.config.minDate||c.isAfter(s.config.minDate,"day"),d=!s.config.maxDate||c.isBefore(s.config.maxDate,"day"),m=c.isAfter(p),u=s.config.allowFuture||!m,f={date:moment(c).toDate(),isToday:c.isSame(p,"day"),isInMonth:c.isSame(t,"month"),isSelected:c.isSame(g,"day"),isSelectable:l&&d&&u};o.push(f),6!==c.weekday()&&c!==i||(a.push(o),o=[])}return a}function m(){s.currentWeeks.forEach(function(e,a){e.forEach(function(e,t){s.currentWeeks[a][t].isSelected=!1})})}var u=angular.element(e.get("datepicker.html")),g="",p=moment.utc(),f={allowFuture:!0,dateFormat:null,minDate:null,maxDate:null};s.config=angular.extend(f,s.config),angular.isDefined(s.config.minDate)&&moment.utc(s.config.minDate).subtract(1,"day"),angular.isDefined(s.config.maxDate)&&moment.utc(s.config.maxDate).add(1,"day"),s.calendarCursor=p,s.currentWeeks=[],s.daysNameList=n.getDaysNames(),s.monthsList=moment.months(),s.yearsList=n.getYearsList(),s.pickerDisplayed=!1,s.$watch(function(){return o.$modelValue},function(e){e&&(g=s.calendarCursor=moment.utc(e,s.config.dateFormat))}),s.$watch("calendarCursor",function(e){s.currentWeeks=d(e)}),r.bind("click",function(e){s.$apply(function(){s.pickerDisplayed=!0,t.on("click",c)})}),l(),s.prevMonth=function(){s.calendarCursor=moment(s.calendarCursor).subtract(1,"months")},s.nextMonth=function(){s.calendarCursor=moment(s.calendarCursor).add(1,"months")},s.selectMonth=function(e){s.showMonthsList=!1,s.calendarCursor=moment(s.calendarCursor).month(e)},s.selectYear=function(e){s.showYearsList=!1,s.calendarCursor=moment(s.calendarCursor).year(e)},s.selectDay=function(e){(e.isSelectable&&!e.isFuture||s.config.allowFuture&&e.isFuture)&&(m(),e.isSelected=!0,o.$setViewValue(moment.utc(e.date).format(s.config.dateFormat)),o.$render(),s.pickerDisplayed=!1)}}}}e.$inject=["$templateCache","$compile","$document","datesCalculator"],angular.module("ngFlatDatepicker",[]).directive("ngFlatDatepicker",e)}(),function(){"use strict";function e(){function e(){for(var e=[],a=2005;a<=moment().year();a++)e.push(a);return e}function a(){for(var e=[],a=0;7>a;a++)e.push(moment().weekday(a).format("ddd"));return e}return{getYearsList:e,getDaysNames:a}}angular.module("ngFlatDatepicker").factory("datesCalculator",e)}(),angular.module("ngFlatDatepicker").run(["$templateCache",function(e){e.put("datepicker.html",'\n \n
\n \n \n \n \n \n {{ dayName }} | \n
\n \n {{ day.date | date:\'dd\' }} | \n
\n \n
\n
\n')}]);
\ No newline at end of file
diff --git a/gulpfile.js b/gulpfile.js
index fdaaf30..013c372 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -3,6 +3,7 @@
var es = require('event-stream');
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
+var eslint = require('gulp-eslint');
var paths = {
src: {
@@ -45,6 +46,14 @@ gulp.task('sass', function(){
.pipe(gulp.dest(paths.dist));
});
+
+gulp.task('lint', function () {
+ return gulp.src(['src/js/*.js','!node_modules/**'])
+ .pipe(eslint())
+ .pipe(eslint.format())
+ .pipe(eslint.failAfterError());
+});
+
/**
* Watch
*/
@@ -55,8 +64,13 @@ gulp.task('watch', function(){
$.watch([paths.src.js, paths.src.html], $.batch(function(events, done){
gulp.start('js', done);
}));
+ $.watch([paths.src.js], $.batch(function(events, done){
+ gulp.start('lint', done);
+ }));
});
+gulp.task('default', ['lint', 'sass', 'js']);
+
function getTemplatesStream() {
return gulp.src(paths.src.html)
.pipe($.angularTemplatecache('templates.js', {
diff --git a/package.json b/package.json
index 458ffdd..30834bd 100644
--- a/package.json
+++ b/package.json
@@ -26,6 +26,8 @@
},
"devDependencies": {
"angular": "^1.4.5",
+ "eslint": "^2.12.0",
+ "eslint-plugin-angular": "^1.1.1",
"event-stream": "^3.3.1",
"gulp": "^3.9.0",
"gulp-angular-filesort": "^1.1.1",
@@ -34,6 +36,7 @@
"gulp-batch": "^1.0.5",
"gulp-concat": "^2.6.0",
"gulp-csso": "^1.0.0",
+ "gulp-eslint": "^2.0.0",
"gulp-load-plugins": "^0.10.0",
"gulp-ng-annotate": "^1.1.0",
"gulp-plumber": "^1.0.1",