angular-datetime-inputs
Advanced tools
Comparing version 0.1.23 to 0.1.24
{ | ||
"name": "angular-datetime-inputs", | ||
"version": "0.1.23", | ||
"version": "0.1.24", | ||
"description": "UI elements for datetime input, converted to angular directives for your convenience.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/g1eb/angular-datetime-inputs", |
@@ -1,4 +0,4 @@ | ||
"use strict";angular.module("g1b.datetime-inputs",[]).directive("datetimeInput",["$document",function(e){return{restrict:"E",scope:{datetime:"=",format:"=?",onChange:"&",placeholder:"@",cssClass:"@"},replace:!0,template:'<div class="datetime-input datetime"><div ng-click="toggleEditPopover()" ng-class="{\'active\': !!selected, \'display\': !cssClass, \'{{cssClass}}\': !!cssClass}"><div class="date" ng-bind="datetime.format(\'DD MMMM YYYY\')"></div><div class="time" ng-bind="datetime.format(\'HH : mm : ss\')"></div><div ng-if="!datetime" class="placeholder" ng-bind="placeholder"></div></div><div class="edit-popover" ng-show="!!selected"><div class="header" ng-click="calendar_active = !calendar_active" ng-bind="selected.format(\'DD MMMM YYYY\')"></div><div class="calendar" ng-show="!!calendar_active"><div class="calendar-header" scroll-up="calendar.add(1, \'months\')" scroll-down="calendar.subtract(1, \'months\')"><div class="arrow arrow-left" ng-click="calendar.subtract(1, \'months\')"></div><span ng-bind="calendar.format(\'YYYY\') === current.format(\'YYYY\') ? calendar.format(\'MMMM\') : calendar.format(\'MMMM YYYY\')"></span><div class="arrow arrow-right" ng-click="calendar.add(1, \'months\')"></div></div><div class="calendar-body"><div class="weekdays"><span class="weekday" ng-repeat="weekday in \'weeeeek\' track by $index" ng-bind="calendar.clone().startOf(\'week\').add($index, \'days\').format(\'ddd\')"></span></div><div class="week" ng-repeat="week in \'months\' | limitTo: ((calendar.clone().endOf(\'month\').week() - calendar.clone().startOf(\'month\').week()) + 1) track by $index"><span class="date" ng-repeat="date in \'weeeeek\' track by $index" ng-class="{ \'current\': calendar.clone().startOf(\'month\').add($parent.$index, \'weeks\').weekday($index).startOf(\'day\').isSame(current.clone().startOf(\'day\')), \'active\': calendar.clone().startOf(\'month\').add($parent.$index, \'weeks\').weekday($index).startOf(\'day\').isSame(selected.clone().startOf(\'day\')), \'inactive\': calendar.clone().startOf(\'month\').add($parent.$index, \'weeks\').weekday($index).month() !== calendar.month() }" ng-click="update(selected.clone().year(calendar.clone().startOf(\'month\').add($parent.$index, \'weeks\').weekday($index).year()).month(calendar.clone().startOf(\'month\').add($parent.$index, \'weeks\').weekday($index).month()).date(calendar.clone().startOf(\'month\').add($parent.$index, \'weeks\').weekday($index).date()), true)" ng-bind="calendar.clone().startOf(\'month\').add($parent.$index, \'weeks\').weekday($index).date()"></span></div></div></div><div class="timer"><div class="timer-hours" scroll-up="update(selected.clone().add(1, \'hours\'))" scroll-down="update(selected.clone().subtract(1, \'hours\'))"><div class="arrow arrow-up" ng-click="update(selected.clone().add(1, \'hours\'))"></div><span ng-bind="selected.format(\'HH\')"></span><div class="arrow arrow-down" ng-click="update(selected.clone().subtract(1, \'hours\'))"></div></div><div class="timer-divider">:</div><div class="timer-minutes" scroll-up="update(selected.clone().add(1, \'minutes\'))" scroll-down="update(selected.clone().subtract(1, \'minutes\'))"><div class="arrow arrow-up" ng-click="update(selected.clone().add(1, \'minutes\'))"></div><span ng-bind="selected.format(\'mm\')"></span><div class="arrow arrow-down" ng-click="update(selected.clone().subtract(1, \'minutes\'))"></div></div><div class="timer-divider">:</div><div class="timer-seconds" scroll-up="update(selected.clone().add(1, \'seconds\'))" scroll-down="update(selected.clone().subtract(1, \'seconds\'))"><div class="arrow arrow-up" ng-click="update(selected.clone().add(1, \'seconds\'))"></div><span ng-bind="selected.format(\'ss\')"></span><div class="arrow arrow-down" ng-click="update(selected.clone().subtract(1, \'seconds\'))"></div></div></div><div class="clear-button" ng-if="!!datetime"><div ng-click="update()">Clear</div></div></div></div>',compile:function(){return{pre:function(){},post:function(d,a){d.current=moment(),d.datetime&&!d.datetime._isAMomentObject&&(d.datetime=moment(d.datetime,d.format)),d.toggleEditPopover=function(){d.selected?d.selected=void 0:(d.selected=d.datetime||moment(),d.calendar=d.selected.clone())},d.update=function(e,a){d.selected.isSame(e)&&d.datetime||(e?(d.selected.year(e.year()).month(e.month()).date(e.date()).hours(e.hours()).minutes(e.minutes()).seconds(e.seconds()),(d.selected.clone().startOf("week").month()!==d.calendar.month()&&d.selected.clone().endOf("week").month()!==d.calendar.month()||a)&&(d.calendar=d.selected.clone())):d.selected=d.datetime=void 0,d.datetime||(d.datetime=d.selected),d.$$postDigest(function(){d.onChange()}))},d.close=function(){d.selected="",d.calendar_active=!1},e.on("mousedown",function(e){d.selected&&!a[0].contains(e.target)&&d.$apply(function(){d.close()})})}}}}}]); | ||
"use strict";angular.module("g1b.datetime-inputs").directive("dateInput",["$document",function(e){return{restrict:"E",scope:{date:"=",format:"=?",onChange:"&",placeholder:"@",cssClass:"@"},replace:!0,template:"<div class=\"datetime-input date\"><div ng-click=\"toggleEditPopover()\" ng-class=\"{'active': !!selected, 'display': !cssClass, '{{cssClass}}': !!cssClass}\"><div class=\"date\" ng-bind=\"date.format('DD MMMM YYYY')\"></div><div ng-if=\"!date\" class=\"placeholder\" ng-bind=\"placeholder\"></div></div><div class=\"edit-popover\" ng-show=\"!!selected\"><div class=\"header\" ng-bind=\"selected.format('DD MMMM YYYY')\"></div><div class=\"calendar\"><div class=\"calendar-header\" scroll-up=\"calendar.add(1, 'months')\" scroll-down=\"calendar.subtract(1, 'months')\"><div class=\"arrow arrow-left\" ng-click=\"calendar.subtract(1, 'months')\"></div><span ng-bind=\"calendar.format('YYYY') === current.format('YYYY') ? calendar.format('MMMM') : calendar.format('MMMM YYYY')\"></span><div class=\"arrow arrow-right\" ng-click=\"calendar.add(1, 'months')\"></div></div><div class=\"calendar-body\"><div class=\"weekdays\"><span class=\"weekday\" ng-repeat=\"weekday in 'weeeeek' track by $index\" ng-bind=\"calendar.clone().startOf('week').add($index, 'days').format('ddd')\"></span></div><div class=\"week\" ng-repeat=\"week in 'months' | limitTo: ((calendar.clone().endOf('month').week() - calendar.clone().startOf('month').week()) + 1) track by $index\"><span class=\"date\" ng-repeat=\"date in 'weeeeek' track by $index\" ng-class=\"{ 'current': calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).startOf('day').isSame(current.clone().startOf('day')), 'active': calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).startOf('day').isSame(selected.clone().startOf('day')), 'inactive': calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).month() !== calendar.month() }\" ng-click=\"update(selected.clone().year(calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).year()).month(calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).month()).date(calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).date()), true)\" ng-bind=\"calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).date()\"></span></div></div></div><div class=\"clear-button\" ng-if=\"!!date\"><div ng-click=\"update()\">Clear</div></div></div></div>",compile:function(){return{pre:function(){},post:function(a,d){a.current=moment(),a.date&&!a.date._isAMomentObject&&(a.date=moment(a.date,a.format)),a.toggleEditPopover=function(){a.selected?a.selected=void 0:(a.selected=a.date||moment(),a.calendar=a.selected.clone())},a.update=function(e,d){a.selected.isSame(e)&&a.date||(e?(a.selected.year(e.year()).month(e.month()).date(e.date()).hours(e.hours()).minutes(e.minutes()).seconds(e.seconds()),(a.selected.clone().startOf("week").month()!==a.calendar.month()||d)&&(a.calendar=a.selected.clone())):a.selected=a.date=void 0,a.date||(a.date=a.selected),a.$$postDigest(function(){a.onChange()}),a.close())},a.close=function(){a.selected="",a.calendar_active=!1},e.on("mousedown",function(e){a.selected&&!d[0].contains(e.target)&&a.$apply(function(){a.close()})})}}}}}]); | ||
"use strict";angular.module("g1b.datetime-inputs").directive("timeInput",["$document",function(e){return{restrict:"E",scope:{time:"=",format:"=?",onChange:"&",placeholder:"@",cssClass:"@"},replace:!0,template:'<div class="datetime-input time"><div ng-click="toggleEditPopover()" ng-class="{\'active\': !!selected, \'display\': !cssClass, \'{{cssClass}}\': !!cssClass}"><div class="time" ng-bind="time.format(\'HH : mm : ss\')"></div><div ng-if="!time" class="placeholder" ng-bind="placeholder"></div></div><div class="edit-popover" ng-show="!!selected"><div class="header" ng-bind="selected.format(\'DD MMMM YYYY\')"></div><div class="timer"><div class="timer-hours" scroll-up="update(selected.clone().add(1, \'hours\'))" scroll-down="update(selected.clone().subtract(1, \'hours\'))"><div class="arrow arrow-up" ng-click="update(selected.clone().add(1, \'hours\'))"></div><span ng-bind="selected.format(\'HH\')"></span><div class="arrow arrow-down" ng-click="update(selected.clone().subtract(1, \'hours\'))"></div></div><div class="timer-divider">:</div><div class="timer-minutes" scroll-up="update(selected.clone().add(1, \'minutes\'))" scroll-down="update(selected.clone().subtract(1, \'minutes\'))"><div class="arrow arrow-up" ng-click="update(selected.clone().add(1, \'minutes\'))"></div><span ng-bind="selected.format(\'mm\')"></span><div class="arrow arrow-down" ng-click="update(selected.clone().subtract(1, \'minutes\'))"></div></div><div class="timer-divider">:</div><div class="timer-seconds" scroll-up="update(selected.clone().add(1, \'seconds\'))" scroll-down="update(selected.clone().subtract(1, \'seconds\'))"><div class="arrow arrow-up" ng-click="update(selected.clone().add(1, \'seconds\'))"></div><span ng-bind="selected.format(\'ss\')"></span><div class="arrow arrow-down" ng-click="update(selected.clone().subtract(1, \'seconds\'))"></div></div></div><div class="clear-button" ng-if="!!time"><div ng-click="update()">Clear</div></div></div></div>',compile:function(){return{pre:function(){},post:function(s,t){s.time&&!s.time._isAMomentObject&&(s.time=moment(s.time,s.format)),s.toggleEditPopover=function(){s.selected?s.selected=void 0:s.selected=s.time||moment()},s.update=function(e,t){s.selected.isSame(e)&&s.time||(e?s.selected.year(e.year()).month(e.month()).date(e.date()).hours(e.hours()).minutes(e.minutes()).seconds(e.seconds()):s.selected=s.time=void 0,s.time||(s.time=s.selected),s.$$postDigest(function(){s.onChange()}))},s.close=function(){s.selected=""},e.on("mousedown",function(e){s.selected&&!t[0].contains(e.target)&&s.$apply(function(){s.close()})})}}}}}]); | ||
"use strict";angular.module("g1b.datetime-inputs",[]).directive("datetimeInput",["$document","$timeout",function(e,a){return{restrict:"E",scope:{datetime:"=",format:"=?",minDate:"=?",maxDate:"=?",onChange:"&",placeholder:"@",cssClass:"@"},replace:!0,template:'<div class="datetime-input datetime"><div ng-click="toggleEditPopover()" class="display" ng-class="{\'active\': !!selected, \'warning\': !!warning, \'{{cssClass}}\': !!cssClass}"><div class="date" ng-bind="datetime.format(\'DD MMMM YYYY\')"></div><div class="time" ng-bind="datetime.format(\'HH : mm : ss\')"></div><div ng-if="!datetime" class="placeholder" ng-bind="placeholder"></div></div><div class="edit-popover" ng-show="!!selected"><div class="header" ng-click="calendar_active = !calendar_active" ng-bind="selected.format(\'DD MMMM YYYY\')"></div><div class="calendar" ng-show="!!calendar_active"><div class="calendar-header" scroll-up="calendar.add(1, \'months\')" scroll-down="calendar.subtract(1, \'months\')"><div class="arrow arrow-left" ng-click="calendar.subtract(1, \'months\')"></div><span ng-bind="calendar.format(\'YYYY\') === current.format(\'YYYY\') ? calendar.format(\'MMMM\') : calendar.format(\'MMMM YYYY\')"></span><div class="arrow arrow-right" ng-click="calendar.add(1, \'months\')"></div></div><div class="calendar-body"><div class="weekdays"><span class="weekday" ng-repeat="weekday in \'weeeeek\' track by $index" ng-bind="calendar.clone().startOf(\'week\').add($index, \'days\').format(\'ddd\')"></span></div><div class="week" ng-repeat="week in \'months\' | limitTo: ((calendar.clone().endOf(\'month\').week() - calendar.clone().startOf(\'month\').week()) + 1) track by $index"><span class="date" ng-repeat="date in \'weeeeek\' track by $index" ng-class="{ \'current\': calendar.clone().startOf(\'month\').add($parent.$index, \'weeks\').weekday($index).startOf(\'day\').isSame(current.clone().startOf(\'day\')), \'active\': calendar.clone().startOf(\'month\').add($parent.$index, \'weeks\').weekday($index).startOf(\'day\').isSame(selected.clone().startOf(\'day\')), \'inactive\': calendar.clone().startOf(\'month\').add($parent.$index, \'weeks\').weekday($index).month() !== calendar.month() }" ng-click="update(selected.clone().year(calendar.clone().startOf(\'month\').add($parent.$index, \'weeks\').weekday($index).year()).month(calendar.clone().startOf(\'month\').add($parent.$index, \'weeks\').weekday($index).month()).date(calendar.clone().startOf(\'month\').add($parent.$index, \'weeks\').weekday($index).date()), true)" ng-bind="calendar.clone().startOf(\'month\').add($parent.$index, \'weeks\').weekday($index).date()"></span></div></div></div><div class="timer"><div class="timer-hours" scroll-up="update(selected.clone().add(1, \'hours\'))" scroll-down="update(selected.clone().subtract(1, \'hours\'))"><div class="arrow arrow-up" ng-click="update(selected.clone().add(1, \'hours\'))"></div><span ng-bind="selected.format(\'HH\')"></span><div class="arrow arrow-down" ng-click="update(selected.clone().subtract(1, \'hours\'))"></div></div><div class="timer-divider">:</div><div class="timer-minutes" scroll-up="update(selected.clone().add(1, \'minutes\'))" scroll-down="update(selected.clone().subtract(1, \'minutes\'))"><div class="arrow arrow-up" ng-click="update(selected.clone().add(1, \'minutes\'))"></div><span ng-bind="selected.format(\'mm\')"></span><div class="arrow arrow-down" ng-click="update(selected.clone().subtract(1, \'minutes\'))"></div></div><div class="timer-divider">:</div><div class="timer-seconds" scroll-up="update(selected.clone().add(1, \'seconds\'))" scroll-down="update(selected.clone().subtract(1, \'seconds\'))"><div class="arrow arrow-up" ng-click="update(selected.clone().add(1, \'seconds\'))"></div><span ng-bind="selected.format(\'ss\')"></span><div class="arrow arrow-down" ng-click="update(selected.clone().subtract(1, \'seconds\'))"></div></div></div><div class="clear-button" ng-if="!!datetime"><div ng-click="update()">Clear</div></div></div></div>',compile:function(){return{pre:function(){},post:function(d,t){d.current=moment(),d.datetime&&!d.datetime._isAMomentObject&&(d.datetime=moment(d.datetime,d.format)),d.toggleEditPopover=function(){d.selected?d.selected=void 0:(d.selected=d.datetime||moment(),d.calendar=d.selected.clone())},d.update=function(e,t){d.selected.isSame(e)&&d.datetime||(e?(!d.minDate||e>d.minDate)&&(!d.maxDate||e<d.maxDate)?(d.selected.year(e.year()).month(e.month()).date(e.date()).hours(e.hours()).minutes(e.minutes()).seconds(e.seconds()),(d.selected.clone().startOf("week").month()!==d.calendar.month()&&d.selected.clone().endOf("week").month()!==d.calendar.month()||t)&&(d.calendar=d.selected.clone()),d.datetime||(d.datetime=d.selected),d.$$postDigest(function(){d.onChange()})):(d.warning=!0,a(function(){d.warning=!1},250)):d.selected=d.datetime=void 0)},d.close=function(){d.selected="",d.calendar_active=!1},e.on("mousedown",function(e){d.selected&&!t[0].contains(e.target)&&d.$apply(function(){d.close()})})}}}}}]); | ||
"use strict";angular.module("g1b.datetime-inputs").directive("dateInput",["$document","$timeout",function(e,a){return{restrict:"E",scope:{date:"=",format:"=?",minDate:"=?",maxDate:"=?",onChange:"&",placeholder:"@",cssClass:"@"},replace:!0,template:"<div class=\"datetime-input date\"><div ng-click=\"toggleEditPopover()\" class=\"display\" ng-class=\"{'active': !!selected, 'warning': !!warning, '{{cssClass}}': !!cssClass}\"><div class=\"date\" ng-bind=\"date.format('DD MMMM YYYY')\"></div><div ng-if=\"!date\" class=\"placeholder\" ng-bind=\"placeholder\"></div></div><div class=\"edit-popover\" ng-show=\"!!selected\"><div class=\"header\" ng-bind=\"selected.format('DD MMMM YYYY')\"></div><div class=\"calendar\"><div class=\"calendar-header\" scroll-up=\"calendar.add(1, 'months')\" scroll-down=\"calendar.subtract(1, 'months')\"><div class=\"arrow arrow-left\" ng-click=\"calendar.subtract(1, 'months')\"></div><span ng-bind=\"calendar.format('YYYY') === current.format('YYYY') ? calendar.format('MMMM') : calendar.format('MMMM YYYY')\"></span><div class=\"arrow arrow-right\" ng-click=\"calendar.add(1, 'months')\"></div></div><div class=\"calendar-body\"><div class=\"weekdays\"><span class=\"weekday\" ng-repeat=\"weekday in 'weeeeek' track by $index\" ng-bind=\"calendar.clone().startOf('week').add($index, 'days').format('ddd')\"></span></div><div class=\"week\" ng-repeat=\"week in 'months' | limitTo: ((calendar.clone().endOf('month').week() - calendar.clone().startOf('month').week()) + 1) track by $index\"><span class=\"date\" ng-repeat=\"date in 'weeeeek' track by $index\" ng-class=\"{ 'current': calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).startOf('day').isSame(current.clone().startOf('day')), 'active': calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).startOf('day').isSame(selected.clone().startOf('day')), 'inactive': calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).month() !== calendar.month() }\" ng-disabled=\"(!!minDate && calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).date().isBefore(minDate.date())) || (!!maxDate && calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).date().isAfter(maxDate.date()))\" ng-click=\"update(selected.clone().year(calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).year()).month(calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).month()).date(calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).date()), true)\" ng-bind=\"calendar.clone().startOf('month').add($parent.$index, 'weeks').weekday($index).date()\"></span></div></div></div><div class=\"clear-button\" ng-if=\"!!date\"><div ng-click=\"update()\">Clear</div></div></div></div>",compile:function(){return{pre:function(){},post:function(t,n){t.current=moment(),t.date&&!t.date._isAMomentObject&&(t.date=moment(t.date,t.format)),t.toggleEditPopover=function(){t.selected?t.selected=void 0:(t.selected=t.date||moment(),t.calendar=t.selected.clone())},t.update=function(e,n){t.selected.isSame(e)&&t.date||(e?(!t.minDate||e>t.minDate)&&(!t.maxDate||e<t.maxDate)?(t.selected.year(e.year()).month(e.month()).date(e.date()).hours(e.hours()).minutes(e.minutes()).seconds(e.seconds()),(t.selected.clone().startOf("week").month()!==t.calendar.month()||n)&&(t.calendar=t.selected.clone()),t.date||(t.date=t.selected),t.$$postDigest(function(){t.onChange()}),t.close()):(t.warning=!0,a(function(){t.warning=!1},250)):t.selected=t.date=void 0)},t.close=function(){t.selected="",t.calendar_active=!1},e.on("mousedown",function(e){t.selected&&!n[0].contains(e.target)&&t.$apply(function(){t.close()})})}}}}}]); | ||
"use strict";angular.module("g1b.datetime-inputs").directive("timeInput",["$document","$timeout",function(e,t){return{restrict:"E",scope:{time:"=",format:"=?",minDate:"=?",maxDate:"=?",onChange:"&",placeholder:"@",cssClass:"@"},replace:!0,template:'<div class="datetime-input time"><div ng-click="toggleEditPopover()" class="display" ng-class="{\'active\': !!selected, \'warning\': !!warning, \'{{cssClass}}\': !!cssClass}"><div class="time" ng-bind="time.format(\'HH : mm : ss\')"></div><div ng-if="!time" class="placeholder" ng-bind="placeholder"></div></div><div class="edit-popover" ng-show="!!selected"><div class="header" ng-bind="selected.format(\'DD MMMM YYYY\')"></div><div class="timer"><div class="timer-hours" scroll-up="update(selected.clone().add(1, \'hours\'))" scroll-down="update(selected.clone().subtract(1, \'hours\'))"><div class="arrow arrow-up" ng-click="update(selected.clone().add(1, \'hours\'))"></div><span ng-bind="selected.format(\'HH\')"></span><div class="arrow arrow-down" ng-click="update(selected.clone().subtract(1, \'hours\'))"></div></div><div class="timer-divider">:</div><div class="timer-minutes" scroll-up="update(selected.clone().add(1, \'minutes\'))" scroll-down="update(selected.clone().subtract(1, \'minutes\'))"><div class="arrow arrow-up" ng-click="update(selected.clone().add(1, \'minutes\'))"></div><span ng-bind="selected.format(\'mm\')"></span><div class="arrow arrow-down" ng-click="update(selected.clone().subtract(1, \'minutes\'))"></div></div><div class="timer-divider">:</div><div class="timer-seconds" scroll-up="update(selected.clone().add(1, \'seconds\'))" scroll-down="update(selected.clone().subtract(1, \'seconds\'))"><div class="arrow arrow-up" ng-click="update(selected.clone().add(1, \'seconds\'))"></div><span ng-bind="selected.format(\'ss\')"></span><div class="arrow arrow-down" ng-click="update(selected.clone().subtract(1, \'seconds\'))"></div></div></div><div class="clear-button" ng-if="!!time"><div ng-click="update()">Clear</div></div></div></div>',compile:function(){return{pre:function(){},post:function(s,d){s.time&&!s.time._isAMomentObject&&(s.time=moment(s.time,s.format)),s.toggleEditPopover=function(){s.selected?s.selected=void 0:s.selected=s.time||moment()},s.update=function(e,d){s.selected.isSame(e)&&s.time||(e?(!s.minDate||e>s.minDate)&&(!s.maxDate||e<s.maxDate)?(s.selected.year(e.year()).month(e.month()).date(e.date()).hours(e.hours()).minutes(e.minutes()).seconds(e.seconds()),s.time||(s.time=s.selected),s.$$postDigest(function(){s.onChange()})):(s.warning=!0,t(function(){s.warning=!1},250)):s.selected=s.time=void 0)},s.close=function(){s.selected=""},e.on("mousedown",function(e){s.selected&&!d[0].contains(e.target)&&s.$apply(function(){s.close()})})}}}}}]); | ||
angular.module("g1b.datetime-inputs").directive("scrollUp",function(){return{restrict:"A",compile:function(){return{pre:function(){},post:function(e,n,t){n.bind("DOMMouseScroll mousewheel wheel",function(n){n=n.originalEvent||n;var l=n.wheelDelta||-1*n.deltaY||0;l>0&&(e.$apply(function(){e.$eval(t.scrollUp)}),n.preventDefault())})}}}}}),angular.module("g1b.datetime-inputs").directive("scrollDown",function(){return{restrict:"A",compile:function(){return{pre:function(){},post:function(e,n,t){n.bind("DOMMouseScroll mousewheel wheel",function(n){n=n.originalEvent||n;var l=n.wheelDelta||-1*n.deltaY||0;l<0&&(e.$apply(function(){e.$eval(t.scrollDown)}),n.preventDefault())})}}}}}); |
{ | ||
"name": "angular-datetime-inputs", | ||
"version": "0.1.23", | ||
"version": "0.1.24", | ||
"description": "UI elements for datetime input, converted to angular directives for your convenience.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/g1eb/angular-datetime-inputs#readme", |
@@ -70,2 +70,4 @@ # Datetime input UI element | ||
| format | moment.js compatible date/time format | none | no | | ||
| min-date | moment.js datetime object min datetime | none | no | | ||
| max-date | moment.js datetime object max datetime | none | no | | ||
| placeholder | Placeholder is shown when input object is undefined | none | no | | ||
@@ -72,0 +74,0 @@ | on-change | Handler function that is fired on change of datetime object | none | no | |
@@ -7,3 +7,3 @@ 'use strict'; | ||
angular.module('g1b.datetime-inputs'). | ||
directive('dateInput', ['$document', function ($document) { | ||
directive('dateInput', ['$document', '$timeout', function ($document, $timeout) { | ||
return { | ||
@@ -14,2 +14,4 @@ restrict: 'E', | ||
format: '=?', | ||
minDate:'=?', | ||
maxDate:'=?', | ||
onChange: '&', | ||
@@ -49,3 +51,3 @@ placeholder: '@', | ||
scope.selected = scope.date = undefined; | ||
} else { | ||
} else if ( ( !scope.minDate || datetime > scope.minDate ) && ( !scope.maxDate || datetime < scope.maxDate ) ) { | ||
scope.selected.year(datetime.year()).month(datetime.month()).date(datetime.date()).hours(datetime.hours()).minutes(datetime.minutes()).seconds(datetime.seconds()); | ||
@@ -55,10 +57,15 @@ if ( scope.selected.clone().startOf('week').month() !== scope.calendar.month() || calendar_update ) { | ||
} | ||
if ( !scope.date ) { | ||
scope.date = scope.selected; | ||
} | ||
scope.$$postDigest(function () { | ||
scope.onChange(); | ||
}); | ||
scope.close(); | ||
} else { | ||
scope.warning = true; | ||
$timeout(function () { | ||
scope.warning = false; | ||
}, 250); | ||
} | ||
if ( !scope.date ) { | ||
scope.date = scope.selected; | ||
} | ||
scope.$$postDigest(function () { | ||
scope.onChange(); | ||
}); | ||
scope.close(); | ||
}; | ||
@@ -65,0 +72,0 @@ |
@@ -7,3 +7,3 @@ 'use strict'; | ||
angular.module('g1b.datetime-inputs', []). | ||
directive('datetimeInput', ['$document', function ($document) { | ||
directive('datetimeInput', ['$document', '$timeout', function ($document, $timeout) { | ||
return { | ||
@@ -14,2 +14,4 @@ restrict: 'E', | ||
format: '=?', | ||
minDate:'=?', | ||
maxDate:'=?', | ||
onChange: '&', | ||
@@ -49,3 +51,3 @@ placeholder: '@', | ||
scope.selected = scope.datetime = undefined; | ||
} else { | ||
} else if ( ( !scope.minDate || datetime > scope.minDate ) && ( !scope.maxDate || datetime < scope.maxDate ) ) { | ||
scope.selected.year(datetime.year()).month(datetime.month()).date(datetime.date()).hours(datetime.hours()).minutes(datetime.minutes()).seconds(datetime.seconds()); | ||
@@ -55,9 +57,14 @@ if ( (scope.selected.clone().startOf('week').month() !== scope.calendar.month() && scope.selected.clone().endOf('week').month() !== scope.calendar.month()) || calendar_update ) { | ||
} | ||
if ( !scope.datetime ) { | ||
scope.datetime = scope.selected; | ||
} | ||
scope.$$postDigest(function () { | ||
scope.onChange(); | ||
}); | ||
} else { | ||
scope.warning = true; | ||
$timeout(function () { | ||
scope.warning = false; | ||
}, 250); | ||
} | ||
if ( !scope.datetime ) { | ||
scope.datetime = scope.selected; | ||
} | ||
scope.$$postDigest(function () { | ||
scope.onChange(); | ||
}); | ||
}; | ||
@@ -64,0 +71,0 @@ |
@@ -7,3 +7,3 @@ 'use strict'; | ||
angular.module('g1b.datetime-inputs'). | ||
directive('timeInput', ['$document', function ($document) { | ||
directive('timeInput', ['$document', '$timeout', function ($document, $timeout) { | ||
return { | ||
@@ -14,2 +14,4 @@ restrict: 'E', | ||
format: '=?', | ||
minDate:'=?', | ||
maxDate:'=?', | ||
onChange: '&', | ||
@@ -45,11 +47,16 @@ placeholder: '@', | ||
scope.selected = scope.time = undefined; | ||
} else if ( ( !scope.minDate || datetime > scope.minDate ) && ( !scope.maxDate || datetime < scope.maxDate ) ) { | ||
scope.selected.year(datetime.year()).month(datetime.month()).date(datetime.date()).hours(datetime.hours()).minutes(datetime.minutes()).seconds(datetime.seconds()); | ||
if ( !scope.time ) { | ||
scope.time = scope.selected; | ||
} | ||
scope.$$postDigest(function () { | ||
scope.onChange(); | ||
}); | ||
} else { | ||
scope.selected.year(datetime.year()).month(datetime.month()).date(datetime.date()).hours(datetime.hours()).minutes(datetime.minutes()).seconds(datetime.seconds()); | ||
scope.warning = true; | ||
$timeout(function () { | ||
scope.warning = false; | ||
}, 250); | ||
} | ||
if ( !scope.time ) { | ||
scope.time = scope.selected; | ||
} | ||
scope.$$postDigest(function () { | ||
scope.onChange(); | ||
}); | ||
}; | ||
@@ -56,0 +63,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
315675
1295
80