From ac0d19ed3a1ef29cd36cb74a783e024d99ba3856 Mon Sep 17 00:00:00 2001 From: Gerard Sontag Date: Tue, 14 Jun 2016 00:29:44 +0200 Subject: [PATCH] Add compatibilty with jspm and SystemJS --- dist/ng-flat-datepicker.css | 39 +++++++++++-------------------- dist/ng-flat-datepicker.js | 5 +++- dist/ng-flat-datepicker.min.css | 2 +- dist/ng-flat-datepicker.min.js | 2 +- package.json | 6 +++++ src/js/datepicker.directive.js | 1 + src/js/datesCalculator.factory.js | 2 ++ 7 files changed, 28 insertions(+), 29 deletions(-) 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..c87f222 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); @@ -20,6 +21,7 @@ }, link: function(scope, element, attrs, ngModel) { + var moment = window.moment ? window.moment : require('moment'); var template = angular.element($templateCache.get('datepicker.html')); var dateSelected = ''; var today = moment.utc(); @@ -204,7 +206,6 @@ } }; } - ngFlatDatepickerDirective.$inject = ["$templateCache", "$compile", "$document", "datesCalculator"]; })(); @@ -222,6 +223,8 @@ function datesCalculator () { + var moment = window.moment ? window.moment : require('moment'); + /** * List all years for the select * @return {[type]} [description] 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..ea9081f 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 \n \n \n \n
\n
\n \n \n \n \n \n
\n
\n {{ calendarCursor.isValid() ? calendarCursor.format(\'MMMM\') : "" }}\n
\n {{ monthName }}\n
\n
\n
\n {{ calendarCursor.isValid() ? calendarCursor.format(\'YYYY\') : "" }}\n
\n {{ yearNumber }}\n
\n
\n
\n \n \n \n \n \n
\n
{{ dayName }}
{{ day.date | date:\'dd\' }}
\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,c){function o(e){p===e.target||p[0].contains(e.target)||e.target===r[0]||(t.off("click",o),s.$apply(function(){s.calendarCursor=f?f:m,s.pickerDisplayed=s.showMonthsList=s.showYearsList=!1}))}function l(){r.wrap('
'),a(p)(s),r.after(p),angular.isDefined(c.$modelValue)&&g.isDate(c.$modelValue)&&(s.calendarCursor=c.$modelValue)}function d(e){var a=[],e=g.utc(e),t=g(e).date(1),n=g(e).date(e.daysInMonth()),r=g(t),i=g(n);r=0===t.weekday()?r:r.weekday(0),i=6===n.weekday()?i:i.weekday(6);for(var c=[],o=g(r);o.isBefore(g(i).add(1,"days"));o.add(1,"days")){var l=!s.config.minDate||o.isAfter(s.config.minDate,"day"),d=!s.config.maxDate||o.isBefore(s.config.maxDate,"day"),u=o.isAfter(m),p=s.config.allowFuture||!u,h={date:g(o).toDate(),isToday:o.isSame(m,"day"),isInMonth:o.isSame(t,"month"),isSelected:o.isSame(f,"day"),isSelectable:l&&d&&p};c.push(h),6!==o.weekday()&&o!==i||(a.push(c),c=[])}return a}function u(){s.currentWeeks.forEach(function(e,a){e.forEach(function(e,t){s.currentWeeks[a][t].isSelected=!1})})}var g=window.moment?window.moment:require("moment"),p=angular.element(e.get("datepicker.html")),f="",m=g.utc(),h={allowFuture:!0,dateFormat:null,minDate:null,maxDate:null};s.config=angular.extend(h,s.config),angular.isDefined(s.config.minDate)&&g.utc(s.config.minDate).subtract(1,"day"),angular.isDefined(s.config.maxDate)&&g.utc(s.config.maxDate).add(1,"day"),s.calendarCursor=m,s.currentWeeks=[],s.daysNameList=n.getDaysNames(),s.monthsList=g.months(),s.yearsList=n.getYearsList(),s.pickerDisplayed=!1,s.$watch(function(){return c.$modelValue},function(e){e&&(f=s.calendarCursor=g.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",o)})}),l(),s.prevMonth=function(){s.calendarCursor=g(s.calendarCursor).subtract(1,"months")},s.nextMonth=function(){s.calendarCursor=g(s.calendarCursor).add(1,"months")},s.selectMonth=function(e){s.showMonthsList=!1,s.calendarCursor=g(s.calendarCursor).month(e)},s.selectYear=function(e){s.showYearsList=!1,s.calendarCursor=g(s.calendarCursor).year(e)},s.selectDay=function(e){(e.isSelectable&&!e.isFuture||s.config.allowFuture&&e.isFuture)&&(u(),e.isSelected=!0,c.$setViewValue(g.utc(e.date).format(s.config.dateFormat)),c.$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<=t().year();a++)e.push(a);return e}function a(){for(var e=[],a=0;7>a;a++)e.push(t().weekday(a).format("ddd"));return e}var t=window.moment?window.moment:require("moment");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 \n \n \n \n
\n
\n \n \n \n \n \n
\n
\n {{ calendarCursor.isValid() ? calendarCursor.format(\'MMMM\') : "" }}\n
\n {{ monthName }}\n
\n
\n
\n {{ calendarCursor.isValid() ? calendarCursor.format(\'YYYY\') : "" }}\n
\n {{ yearNumber }}\n
\n
\n
\n \n \n \n \n \n
\n
{{ dayName }}
{{ day.date | date:\'dd\' }}
\n
\n')}]); \ No newline at end of file diff --git a/package.json b/package.json index 458ffdd..4e9b053 100644 --- a/package.json +++ b/package.json @@ -42,5 +42,11 @@ "gulp-uglify": "^1.4.0", "gulp-watch": "^4.3.5", "moment": "^2.10.6" + }, + "jspm": { + "dependencies": { + "angular": "github:angular/bower-angular@^1.4.5", + "moment": "github:moment/moment@^2.10.6" + } } } diff --git a/src/js/datepicker.directive.js b/src/js/datepicker.directive.js index 032910d..fc01e82 100644 --- a/src/js/datepicker.directive.js +++ b/src/js/datepicker.directive.js @@ -20,6 +20,7 @@ }, link: function(scope, element, attrs, ngModel) { + var moment = window.moment ? window.moment : require('moment'); var template = angular.element($templateCache.get('datepicker.html')); var dateSelected = ''; var today = moment.utc(); diff --git a/src/js/datesCalculator.factory.js b/src/js/datesCalculator.factory.js index e4d4b57..03d5348 100644 --- a/src/js/datesCalculator.factory.js +++ b/src/js/datesCalculator.factory.js @@ -12,6 +12,8 @@ function datesCalculator () { + var moment = window.moment ? window.moment : require('moment'); + /** * List all years for the select * @return {[type]} [description]