angular-datepicker-custom
Advanced tools
Comparing version 2.1.12 to 2.1.13
@@ -1,8 +0,11 @@ | ||
(function(global, factory) { | ||
'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
(function (global, factory) { | ||
'use strict'; | ||
var fnc; | ||
fnc = (typeof exports === 'object' && typeof module !== 'undefined') ? module.exports = factory( | ||
require('angular'), require('moment')) : (typeof define === 'function' && define.amd) ? | ||
define(['angular', 'moment'], factory) : factory(global.angular, global.moment); | ||
}(this, function(angular, moment) { | ||
fnc = (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('angular'), require('moment')) : typeof define === 'function' && define.amd ? define(['angular', 'moment'], factory) : factory(global.angular, global.moment); | ||
})(undefined, function (angular, moment) { | ||
//(function (global, factory) { | ||
@@ -26,3 +29,3 @@ // 'use strict'; | ||
hours: 'hours', | ||
minutes: 'minutes', | ||
minutes: 'minutes' | ||
}, | ||
@@ -33,3 +36,3 @@ viewConfig: { | ||
hours: ['hours', 'isSameHour'], | ||
minutes: ['minutes', 'isSameMinutes'], | ||
minutes: ['minutes', 'isSameMinutes'] | ||
}, | ||
@@ -40,6 +43,6 @@ step: 5 | ||
//Moment format filter. | ||
Module.filter('mFormat', function() { | ||
return function(m, format, tz) { | ||
if (!(moment.isMoment(m))) { | ||
return (m) ? moment(m).format(format) : ''; | ||
Module.filter('mFormat', function () { | ||
return function (m, format, tz) { | ||
if (!moment.isMoment(m)) { | ||
return m ? moment(m).format(format) : ''; | ||
} | ||
@@ -50,4 +53,3 @@ return tz ? moment.tz(m, tz).format(format) : m.format(format); | ||
Module.directive('datePicker', ['datePickerConfig', 'datePickerUtils', function datePickerDirective( | ||
datePickerConfig, datePickerUtils) { | ||
Module.directive('datePicker', ['datePickerConfig', 'datePickerUtils', function datePickerDirective(datePickerConfig, datePickerUtils) { | ||
@@ -64,3 +66,3 @@ //noinspection JSUnusedLocalSymbols | ||
}, | ||
link: function(scope, element, attrs, ngModel) { | ||
link: function link(scope, element, attrs, ngModel) { | ||
function prepareViews() { | ||
@@ -70,6 +72,3 @@ scope.views = datePickerConfig.views.concat(); | ||
scope.views = scope.views.slice( | ||
scope.views.indexOf(attrs.maxView || 'year'), | ||
scope.views.indexOf(attrs.minView || 'minutes') + 1 | ||
); | ||
scope.views = scope.views.slice(scope.views.indexOf(attrs.maxView || 'year'), scope.views.indexOf(attrs.minView || 'minutes') + 1); | ||
@@ -86,23 +85,23 @@ if (scope.views.length === 1 || scope.views.indexOf(scope.view) === -1) { | ||
var arrowClick = false, | ||
tz = scope.tz = attrs.timezone, | ||
createMoment = datePickerUtils.createMoment, | ||
eventIsForPicker = datePickerUtils.eventIsForPicker, | ||
step = parseInt(attrs.step || datePickerConfig.step, 10), | ||
partial = !!attrs.partial, | ||
minDate = getDate('minDate'), | ||
maxDate = getDate('maxDate'), | ||
pickerID = element[0].id, | ||
now = scope.now = createMoment(), | ||
selected = scope.date = createMoment(scope.model || now), | ||
autoclose = attrs.autoClose === 'true', | ||
// Either gets the 1st day from the attributes, or asks moment.js to give it to us as it is localized. | ||
firstDay = attrs.firstDay && attrs.firstDay >= 0 && attrs.firstDay <= 6 ? | ||
parseInt(attrs.firstDay, 10) : moment().weekday(0).day(), | ||
setDate, | ||
prepareViewData, | ||
isSame, | ||
clipDate, | ||
isNow, | ||
inValidRange; | ||
tz = scope.tz = attrs.timezone, | ||
createMoment = datePickerUtils.createMoment, | ||
eventIsForPicker = datePickerUtils.eventIsForPicker, | ||
step = parseInt(attrs.step || datePickerConfig.step, 10), | ||
partial = !!attrs.partial, | ||
minDate = getDate('minDate'), | ||
maxDate = getDate('maxDate'), | ||
pickerID = element[0].id, | ||
now = scope.now = createMoment(), | ||
selected = scope.date = createMoment(scope.model || now), | ||
autoclose = attrs.autoClose === 'true', | ||
// Either gets the 1st day from the attributes, or asks moment.js to give it to us as it is localized. | ||
firstDay = attrs.firstDay && attrs.firstDay >= 0 && attrs.firstDay <= 6 ? parseInt(attrs.firstDay, 10) : moment().weekday(0).day(), | ||
setDate, | ||
prepareViewData, | ||
isSame, | ||
clipDate, | ||
isNow, | ||
inValidRange; | ||
datePickerUtils.setParams(tz, firstDay); | ||
@@ -117,8 +116,7 @@ | ||
scope.watchDirectChanges = attrs.watchDirectChanges !== undefined; | ||
scope.callbackOnSetDate = attrs.dateChange ? datePickerUtils.findFunction(scope, | ||
attrs.dateChange) : undefined; | ||
scope.callbackOnSetDate = attrs.dateChange ? datePickerUtils.findFunction(scope, attrs.dateChange) : undefined; | ||
prepareViews(); | ||
scope.setView = function(nextView) { | ||
scope.setView = function (nextView) { | ||
if (scope.views.indexOf(nextView) !== -1) { | ||
@@ -129,7 +127,7 @@ scope.view = nextView; | ||
scope.$on('selectDate', (e, d, fromOther) => { | ||
scope.$on('selectDate', function (e, d, fromOther) { | ||
scope.selectDate(d, fromOther); | ||
}) | ||
}); | ||
scope.selectDate = function(date, fromOther) { | ||
scope.selectDate = function (date, fromOther) { | ||
if (attrs.disabled) { | ||
@@ -148,3 +146,3 @@ return false; | ||
var nextView = scope.views[scope.views.indexOf(scope.view) + 1]; | ||
if ((!nextView || partial) || scope.model) { | ||
if (!nextView || partial || scope.model) { | ||
setDate(date, fromOther); | ||
@@ -156,15 +154,21 @@ } | ||
} else if (autoclose) { | ||
element.addClass('hidden'); | ||
scope.$emit('hidePicker'); | ||
setTimeout(function () { | ||
element.addClass('hidden'); | ||
scope.$emit('hidePicker'); | ||
}, 50); | ||
} else if (date) { | ||
prepareViewData(); | ||
// autoClose | ||
setTimeout(function () { | ||
scope.$emit('hidePicker'); | ||
}, 50); | ||
} | ||
}; | ||
setDate = function(date, fromOther) { | ||
setDate = function setDate(date, fromOther) { | ||
// if (date) { | ||
scope.model = date; | ||
if (ngModel) { | ||
ngModel.$setViewValue(date); | ||
} | ||
scope.model = date; | ||
if (ngModel) { | ||
ngModel.$setViewValue(date); | ||
} | ||
// } | ||
@@ -222,3 +226,3 @@ scope.$emit('setDate', scope.model, scope.view, fromOther); | ||
if (scope.watchDirectChanges) { | ||
scope.$watch('model', function() { | ||
scope.$watch('model', function () { | ||
arrowClick = false; | ||
@@ -229,8 +233,9 @@ update(); | ||
prepareViewData = function() { | ||
prepareViewData = function prepareViewData() { | ||
var view = scope.view, | ||
date = scope.date, | ||
classes = [], | ||
classList = '', | ||
i, j; | ||
date = scope.date, | ||
classes = [], | ||
classList = '', | ||
i, | ||
j; | ||
@@ -246,3 +251,3 @@ if (!scope.date) { | ||
var weeks = scope.weeks, | ||
week; | ||
week; | ||
for (i = 0; i < weeks.length; i++) { | ||
@@ -271,4 +276,4 @@ week = weeks[i]; | ||
var params = datePickerConfig.viewConfig[view], | ||
dates = scope[params[0]], | ||
compareFunc = params[1]; | ||
dates = scope[params[0]], | ||
compareFunc = params[1]; | ||
@@ -292,3 +297,3 @@ for (i = 0; i < dates.length; i++) { | ||
scope.next = function(delta) { | ||
scope.next = function (delta) { | ||
var date = moment(scope.date); | ||
@@ -298,3 +303,3 @@ delta = delta || 1; | ||
case 'year': | ||
/*falls through*/ | ||
/*falls through*/ | ||
case 'month': | ||
@@ -307,3 +312,3 @@ date.year(date.year() + delta); | ||
case 'hours': | ||
/*falls through*/ | ||
/*falls through*/ | ||
case 'minutes': | ||
@@ -321,3 +326,3 @@ date.hours(date.hours() + delta); | ||
inValidRange = function(date) { | ||
inValidRange = function inValidRange(date) { | ||
var valid = true; | ||
@@ -333,8 +338,7 @@ if (minDate && minDate.isAfter(date)) { | ||
isSame = function(date1, date2) { | ||
return date1.isSame(date2, datePickerConfig.momentNames[scope.view]) ? true : | ||
false; | ||
isSame = function isSame(date1, date2) { | ||
return date1.isSame(date2, datePickerConfig.momentNames[scope.view]) ? true : false; | ||
}; | ||
clipDate = function(date) { | ||
clipDate = function clipDate(date) { | ||
if (minDate && minDate.isAfter(date)) { | ||
@@ -349,3 +353,3 @@ return minDate; | ||
isNow = function(date, view) { | ||
isNow = function isNow(date, view) { | ||
var is = true; | ||
@@ -356,12 +360,12 @@ | ||
is &= ~~(now.minutes() / step) === ~~(date.minutes() / step); | ||
/* falls through */ | ||
/* falls through */ | ||
case 'hours': | ||
is &= now.hours() === date.hours(); | ||
/* falls through */ | ||
/* falls through */ | ||
case 'date': | ||
is &= now.date() === date.date(); | ||
/* falls through */ | ||
/* falls through */ | ||
case 'month': | ||
is &= now.month() === date.month(); | ||
/* falls through */ | ||
/* falls through */ | ||
case 'year': | ||
@@ -373,3 +377,3 @@ is &= now.year() === date.year(); | ||
scope.prev = function(delta) { | ||
scope.prev = function (delta) { | ||
return scope.next(-delta || -1); | ||
@@ -379,6 +383,6 @@ }; | ||
if (pickerID) { | ||
scope.$on('pickerUpdate', function(event, pickerIDs, data) { | ||
scope.$on('pickerUpdate', function (event, pickerIDs, data) { | ||
if (eventIsForPicker(pickerIDs, pickerID)) { | ||
var updateViews = false, | ||
updateViewData = false; | ||
updateViewData = false; | ||
@@ -426,5 +430,5 @@ if (angular.isDefined(data.minDate)) { | ||
//}(this, function (angular, moment) { | ||
angular.module('datePicker').factory('datePickerUtils', function() { | ||
angular.module('datePicker').factory('datePickerUtils', function () { | ||
var tz, firstDay; | ||
var createNewDate = function(year, month, day, hour, minute) { | ||
var createNewDate = function createNewDate(year, month, day, hour, minute) { | ||
var utc = Date.UTC(year | 0, month | 0, day | 0, hour | 0, minute | 0); | ||
@@ -435,11 +439,11 @@ return tz ? moment.tz(utc, tz) : moment(utc); | ||
return { | ||
getVisibleMinutes: function(m, step) { | ||
getVisibleMinutes: function getVisibleMinutes(m, step) { | ||
var year = m.year(), | ||
month = m.month(), | ||
day = m.date(), | ||
hour = m.hours(), | ||
pushedDate, | ||
offset = m.utcOffset() / 60, | ||
minutes = [], | ||
minute; | ||
month = m.month(), | ||
day = m.date(), | ||
hour = m.hours(), | ||
pushedDate, | ||
offset = m.utcOffset() / 60, | ||
minutes = [], | ||
minute; | ||
@@ -452,6 +456,6 @@ for (minute = 0; minute < 60; minute += step) { | ||
}, | ||
getVisibleWeeks: function(m) { | ||
getVisibleWeeks: function getVisibleWeeks(m) { | ||
m = moment(m); | ||
var startYear = m.year(), | ||
startMonth = m.month(); | ||
startMonth = m.month(); | ||
@@ -478,13 +482,13 @@ //Set date to the first day of the month | ||
}, | ||
getVisibleYears: function(d) { | ||
getVisibleYears: function getVisibleYears(d) { | ||
var m = moment(d), | ||
year = m.year(); | ||
year = m.year(); | ||
m.year(year - (year % 10)); | ||
m.year(year - year % 10); | ||
year = m.year(); | ||
var offset = m.utcOffset() / 60, | ||
years = [], | ||
pushedDate, | ||
actualOffset; | ||
years = [], | ||
pushedDate, | ||
actualOffset; | ||
@@ -503,12 +507,12 @@ for (var i = 0; i < 12; i++) { | ||
}, | ||
getDaysOfWeek: function(m) { | ||
m = m ? m : (tz ? moment.tz(tz).day(firstDay) : moment().day(firstDay)); | ||
getDaysOfWeek: function getDaysOfWeek(m) { | ||
m = m ? m : tz ? moment.tz(tz).day(firstDay) : moment().day(firstDay); | ||
var year = m.year(), | ||
month = m.month(), | ||
day = m.date(), | ||
days = [], | ||
pushedDate, | ||
offset = m.utcOffset() / 60, | ||
actualOffset; | ||
month = m.month(), | ||
day = m.date(), | ||
days = [], | ||
pushedDate, | ||
offset = m.utcOffset() / 60, | ||
actualOffset; | ||
@@ -526,8 +530,8 @@ for (var i = 0; i < 7; i++) { | ||
}, | ||
getVisibleMonths: function(m) { | ||
getVisibleMonths: function getVisibleMonths(m) { | ||
var year = m.year(), | ||
offset = m.utcOffset() / 60, | ||
months = [], | ||
pushedDate, | ||
actualOffset; | ||
offset = m.utcOffset() / 60, | ||
months = [], | ||
pushedDate, | ||
actualOffset; | ||
@@ -544,9 +548,11 @@ for (var month = 0; month < 12; month++) { | ||
}, | ||
getVisibleHours: function(m) { | ||
getVisibleHours: function getVisibleHours(m) { | ||
var year = m.year(), | ||
month = m.month(), | ||
day = m.date(), | ||
hours = [], | ||
hour, pushedDate, actualOffset, | ||
offset = m.utcOffset() / 60; | ||
month = m.month(), | ||
day = m.date(), | ||
hours = [], | ||
hour, | ||
pushedDate, | ||
actualOffset, | ||
offset = m.utcOffset() / 60; | ||
@@ -564,31 +570,33 @@ for (hour = 0; hour < 24; hour++) { | ||
}, | ||
isAfter: function(model, date) { | ||
isAfter: function isAfter(model, date) { | ||
return model && model.unix() >= date.unix(); | ||
}, | ||
isBefore: function(model, date) { | ||
isBefore: function isBefore(model, date) { | ||
return model.unix() <= date.unix(); | ||
}, | ||
isSameYear: function(model, date) { | ||
isSameYear: function isSameYear(model, date) { | ||
return model && model.year() === date.year(); | ||
}, | ||
isSameMonth: function(model, date) { | ||
isSameMonth: function isSameMonth(model, date) { | ||
return this.isSameYear(model, date) && model.month() === date.month(); | ||
}, | ||
isSameDay: function(model, date) { | ||
isSameDay: function isSameDay(model, date) { | ||
return this.isSameMonth(model, date) && model.date() === date.date(); | ||
}, | ||
isSameHour: function(model, date) { | ||
isSameHour: function isSameHour(model, date) { | ||
return this.isSameDay(model, date) && model.hours() === date.hours(); | ||
}, | ||
isSameMinutes: function(model, date) { | ||
isSameMinutes: function isSameMinutes(model, date) { | ||
return this.isSameHour(model, date) && model.minutes() === date.minutes(); | ||
}, | ||
setParams: function(zone, fd) { | ||
setParams: function setParams(zone, fd) { | ||
tz = zone; | ||
firstDay = fd; | ||
}, | ||
scopeSearch: function(scope, name, comparisonFn) { | ||
scopeSearch: function scopeSearch(scope, name, comparisonFn) { | ||
var parentScope = scope, | ||
nameArray = name.split('.'), | ||
target, i, j = nameArray.length; | ||
nameArray = name.split('.'), | ||
target, | ||
i, | ||
j = nameArray.length; | ||
@@ -613,3 +621,2 @@ do { | ||
} | ||
} while (parentScope.$parent); | ||
@@ -619,5 +626,5 @@ | ||
}, | ||
findFunction: function(scope, name) { | ||
findFunction: function findFunction(scope, name) { | ||
//Search scope ancestors for a matching function. | ||
return this.scopeSearch(scope, name, function(target) { | ||
return this.scopeSearch(scope, name, function (target) { | ||
//Property must also be a function | ||
@@ -627,5 +634,5 @@ return angular.isFunction(target); | ||
}, | ||
findParam: function(scope, name) { | ||
findParam: function findParam(scope, name) { | ||
//Search scope ancestors for a matching parameter. | ||
return this.scopeSearch(scope, name, function() { | ||
return this.scopeSearch(scope, name, function () { | ||
//As long as the property exists, we're good | ||
@@ -635,3 +642,3 @@ return true; | ||
}, | ||
createMoment: function(m) { | ||
createMoment: function createMoment(m) { | ||
if (tz) { | ||
@@ -648,3 +655,3 @@ return moment.tz(m, tz); | ||
}, | ||
getDate: function(scope, attrs, name) { | ||
getDate: function getDate(scope, attrs, name) { | ||
var result = false; | ||
@@ -663,6 +670,5 @@ if (attrs[name]) { | ||
}, | ||
eventIsForPicker: function(targetIDs, pickerID) { | ||
eventIsForPicker: function eventIsForPicker(targetIDs, pickerID) { | ||
//Checks if an event targeted at a specific picker, via either a string name, or an array of strings. | ||
return (angular.isArray(targetIDs) && targetIDs.indexOf(pickerID) > -1 || | ||
targetIDs === pickerID); | ||
return angular.isArray(targetIDs) && targetIDs.indexOf(pickerID) > -1 || targetIDs === pickerID; | ||
} | ||
@@ -682,4 +688,3 @@ }; | ||
Module.directive('dateRange', ['$compile', 'datePickerUtils', 'dateTimeConfig', function( | ||
$compile, datePickerUtils, dateTimeConfig) { | ||
Module.directive('dateRange', ['$compile', 'datePickerUtils', 'dateTimeConfig', function ($compile, datePickerUtils, dateTimeConfig) { | ||
function getTemplate(attrs, id, model, min, max) { | ||
@@ -702,10 +707,10 @@ return dateTimeConfig.template(angular.extend(attrs, { | ||
}, | ||
link: function(scope, element, attrs) { | ||
link: function link(scope, element, attrs) { | ||
var dateChange = null, | ||
pickerRangeID = element[0].id, | ||
pickerIDs = [randomName(), randomName()], | ||
createMoment = datePickerUtils.createMoment, | ||
eventIsForPicker = datePickerUtils.eventIsForPicker; | ||
pickerRangeID = element[0].id, | ||
pickerIDs = [randomName(), randomName()], | ||
createMoment = datePickerUtils.createMoment, | ||
eventIsForPicker = datePickerUtils.eventIsForPicker; | ||
scope.dateChange = function(modelName, newDate) { | ||
scope.dateChange = function (modelName, newDate) { | ||
//Notify user if callback exists. | ||
@@ -730,3 +735,3 @@ if (dateChange) { | ||
if (pickerRangeID) { | ||
scope.$on('pickerUpdate', function(event, targetIDs, data) { | ||
scope.$on('pickerUpdate', function (event, targetIDs, data) { | ||
if (eventIsForPicker(targetIDs, pickerRangeID)) { | ||
@@ -744,3 +749,3 @@ //If we received an update event, dispatch it to the inner pickers using their IDs. | ||
scope.$watchGroup(['start', 'end'], function(dates) { | ||
scope.$watchGroup(['start', 'end'], function (dates) { | ||
//Scope data changed, update picker min/max | ||
@@ -757,7 +762,3 @@ setMin(dates[0]); | ||
var template = '<div><table class="date-range"><tr><td valign="top">' + | ||
getTemplate(attrs, pickerIDs[0], 'start', false, scope.end) + | ||
'</td><td valign="top">' + | ||
getTemplate(attrs, pickerIDs[1], 'end', scope.start, false) + | ||
'</td></tr></table></div>'; | ||
var template = '<div><table class="date-range"><tr><td valign="top">' + getTemplate(attrs, pickerIDs[0], 'start', false, scope.end) + '</td><td valign="top">' + getTemplate(attrs, pickerIDs[1], 'end', scope.start, false) + '</td></tr></table></div>'; | ||
@@ -779,3 +780,3 @@ var picker = $compile(template)(scope); | ||
var PRISTINE_CLASS = 'ng-pristine', | ||
DIRTY_CLASS = 'ng-dirty'; | ||
DIRTY_CLASS = 'ng-dirty'; | ||
@@ -785,21 +786,4 @@ var Module = angular.module('datePicker'); | ||
Module.constant('dateTimeConfig', { | ||
template: function(attrs, id) { | ||
return '' + | ||
'<div ' + | ||
(id ? 'id="' + id + '" ' : '') + | ||
'date-picker="' + attrs.ngModel + '" ' + | ||
(attrs.view ? 'view="' + attrs.view + '" ' : '') + | ||
(attrs.maxView ? 'max-view="' + attrs.maxView + '" ' : '') + | ||
(attrs.maxDate ? 'max-date="' + attrs.maxDate + '" ' : '') + | ||
(attrs.autoClose ? 'auto-close="' + attrs.autoClose + '" ' : '') + | ||
(attrs.template ? 'template="' + attrs.template + '" ' : '') + | ||
(attrs.minView ? 'min-view="' + attrs.minView + '" ' : '') + | ||
(attrs.minDate ? 'min-date="' + attrs.minDate + '" ' : '') + | ||
(attrs.partial ? 'partial="' + attrs.partial + '" ' : '') + | ||
(attrs.step ? 'step="' + attrs.step + '" ' : '') + | ||
(attrs.onSetDate ? 'date-change="' + attrs.onSetDate + '" ' : '') + | ||
(attrs.ngModel ? 'ng-model="' + attrs.ngModel + '" ' : '') + | ||
(attrs.firstDay ? 'first-day="' + attrs.firstDay + '" ' : '') + | ||
(attrs.timezone ? 'timezone="' + attrs.timezone + '" ' : '') + | ||
'class="date-picker-date-time"></div>'; | ||
template: function template(attrs, id) { | ||
return '' + '<div ' + (id ? 'id="' + id + '" ' : '') + 'date-picker="' + attrs.ngModel + '" ' + (attrs.view ? 'view="' + attrs.view + '" ' : '') + (attrs.maxView ? 'max-view="' + attrs.maxView + '" ' : '') + (attrs.maxDate ? 'max-date="' + attrs.maxDate + '" ' : '') + (attrs.autoClose ? 'auto-close="' + attrs.autoClose + '" ' : '') + (attrs.template ? 'template="' + attrs.template + '" ' : '') + (attrs.minView ? 'min-view="' + attrs.minView + '" ' : '') + (attrs.minDate ? 'min-date="' + attrs.minDate + '" ' : '') + (attrs.partial ? 'partial="' + attrs.partial + '" ' : '') + (attrs.step ? 'step="' + attrs.step + '" ' : '') + (attrs.onSetDate ? 'date-change="' + attrs.onSetDate + '" ' : '') + (attrs.ngModel ? 'ng-model="' + attrs.ngModel + '" ' : '') + (attrs.firstDay ? 'first-day="' + attrs.firstDay + '" ' : '') + (attrs.timezone ? 'timezone="' + attrs.timezone + '" ' : '') + 'class="date-picker-date-time"></div>'; | ||
}, | ||
@@ -812,6 +796,6 @@ format: 'YYYY-MM-DD HH:mm', | ||
Module.directive('dateTimeAppend', function() { | ||
Module.directive('dateTimeAppend', function () { | ||
return { | ||
link: function(scope, element) { | ||
element.bind('click', function() { | ||
link: function link(scope, element) { | ||
element.bind('click', function () { | ||
element.find('input')[0].focus(); | ||
@@ -823,13 +807,11 @@ }); | ||
Module.directive('dateTime', ['$compile', '$document', '$filter', 'dateTimeConfig', '$parse', | ||
'datePickerUtils', | ||
function($compile, $document, $filter, dateTimeConfig, $parse, datePickerUtils) { | ||
var body = $document.find('body'); | ||
var dateFilter = $filter('mFormat'); | ||
Module.directive('dateTime', ['$compile', '$document', '$filter', 'dateTimeConfig', '$parse', 'datePickerUtils', function ($compile, $document, $filter, dateTimeConfig, $parse, datePickerUtils) { | ||
var body = $document.find('body'); | ||
var dateFilter = $filter('mFormat'); | ||
return { | ||
require: 'ngModel', | ||
scope: true, | ||
link: function(scope, element, attrs, ngModel) { | ||
var format = attrs.format || dateTimeConfig.format, | ||
return { | ||
require: 'ngModel', | ||
scope: true, | ||
link: function link(scope, element, attrs, ngModel) { | ||
var format = attrs.format || dateTimeConfig.format, | ||
parentForm = element.inheritedData('$formController'), | ||
@@ -854,429 +836,209 @@ views = $parse(attrs.views)(scope) || dateTimeConfig.views.concat(), | ||
if (index === -1) { | ||
views.splice(index, 1); | ||
} | ||
if (index === -1) { | ||
views.splice(index, 1); | ||
} | ||
views.unshift(view); | ||
views.unshift(view); | ||
attrs.$observe('id', d => { | ||
pickerID = d; | ||
}); | ||
attrs.$observe('id', function (d) { | ||
pickerID = d; | ||
}); | ||
function formatter(value) { | ||
return dateFilter(value, format, timezone); | ||
function formatter(value) { | ||
return dateFilter(value, format, timezone); | ||
} | ||
function parser(viewValue) { | ||
if (viewValue.length === format.length) { | ||
return viewValue; | ||
} | ||
return viewValue.length === 0 ? viewValue : undefined; | ||
} | ||
function parser(viewValue) { | ||
if (viewValue.length === format.length) { | ||
return viewValue; | ||
} | ||
return (viewValue.length === 0) ? viewValue : undefined; | ||
function setMin(date) { | ||
if (date && !moment.isMoment(date)) { | ||
date = moment(date); | ||
} | ||
minDate = date; | ||
attrs.minDate = date ? date.format() : date; | ||
minValid = moment.isMoment(date); | ||
} | ||
function setMin(date) { | ||
if (date && !moment.isMoment(date)) { | ||
date = moment(date); | ||
} | ||
minDate = date; | ||
attrs.minDate = date ? date.format() : date; | ||
minValid = moment.isMoment(date); | ||
function setMax(date) { | ||
if (date && !moment.isMoment(date)) { | ||
date = moment(date); | ||
} | ||
maxDate = date; | ||
function setMax(date) { | ||
if (date && !moment.isMoment(date)) { | ||
date = moment(date); | ||
} | ||
maxDate = date; | ||
attrs.maxDate = date ? date.format() : date; | ||
maxValid = moment.isMoment(date); | ||
} | ||
attrs.maxDate = date ? date.format() : date; | ||
maxValid = moment.isMoment(date); | ||
} | ||
ngModel.$formatters.push(formatter); | ||
ngModel.$parsers.unshift(parser); | ||
ngModel.$formatters.push(formatter); | ||
ngModel.$parsers.unshift(parser); | ||
if (angular.isDefined(attrs.minDate)) { | ||
setMin(datePickerUtils.findParam(scope, attrs.minDate)); | ||
if (angular.isDefined(attrs.minDate)) { | ||
setMin(datePickerUtils.findParam(scope, attrs.minDate)); | ||
ngModel.$validators.min = function (value) { | ||
//If we don't have a min / max value, then any value is valid. | ||
return minValid ? moment.isMoment(value) && (minDate.isSame(value) || minDate.isBefore(value)) : true; | ||
}; | ||
} | ||
ngModel.$validators.min = function(value) { | ||
//If we don't have a min / max value, then any value is valid. | ||
return minValid ? moment.isMoment(value) && (minDate.isSame(value) || | ||
minDate.isBefore(value)) : true; | ||
}; | ||
} | ||
if (angular.isDefined(attrs.maxDate)) { | ||
setMax(datePickerUtils.findParam(scope, attrs.maxDate)); | ||
if (angular.isDefined(attrs.maxDate)) { | ||
setMax(datePickerUtils.findParam(scope, attrs.maxDate)); | ||
ngModel.$validators.max = function (value) { | ||
return maxValid ? moment.isMoment(value) && (maxDate.isSame(value) || maxDate.isAfter(value)) : true; | ||
}; | ||
} | ||
ngModel.$validators.max = function(value) { | ||
return maxValid ? moment.isMoment(value) && (maxDate.isSame(value) || | ||
maxDate.isAfter(value)) : true; | ||
}; | ||
} | ||
if (angular.isDefined(attrs.dateChange)) { | ||
dateChange = datePickerUtils.findFunction(scope, attrs.dateChange); | ||
} | ||
if (angular.isDefined(attrs.dateChange)) { | ||
dateChange = datePickerUtils.findFunction(scope, attrs.dateChange); | ||
} | ||
function getTemplate() { | ||
template = dateTimeConfig.template(attrs); | ||
} | ||
function getTemplate() { | ||
template = dateTimeConfig.template(attrs); | ||
function updateInput(event) { | ||
if (event.stopPropagation) { | ||
event.stopPropagation(); | ||
} | ||
function updateInput(event) { | ||
if (event.stopPropagation) { | ||
event.stopPropagation(); | ||
if (ngModel.$pristine) { | ||
ngModel.$dirty = true; | ||
ngModel.$pristine = false; | ||
element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS); | ||
if (parentForm) { | ||
parentForm.$setDirty(); | ||
} | ||
if (ngModel.$pristine) { | ||
ngModel.$dirty = true; | ||
ngModel.$pristine = false; | ||
element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS); | ||
if (parentForm) { | ||
parentForm.$setDirty(); | ||
} | ||
ngModel.$render(); | ||
} | ||
ngModel.$render(); | ||
} | ||
} | ||
scope.$on('clearPickerView', clear); | ||
scope.$on('clearPickerView', clear); | ||
function clear() { | ||
if (picker) { | ||
picker.remove(); | ||
picker = null; | ||
} | ||
if (container) { | ||
container.remove(); | ||
container = null; | ||
} | ||
function clear() { | ||
if (picker) { | ||
picker.remove(); | ||
picker = null; | ||
} | ||
if (container) { | ||
container.remove(); | ||
container = null; | ||
} | ||
} | ||
if (pickerID) { | ||
scope.$on('pickerUpdate', function(event, pickerIDs, data) { | ||
// console.log(pickerIDs, pickerID); | ||
if (eventIsForPicker(pickerIDs, pickerID)) { | ||
if (picker) { | ||
//Need to handle situation where the data changed but the picker is currently open. | ||
//To handle this, we can create the inner picker with a random ID, then forward | ||
//any events received to it. | ||
} else { | ||
var validateRequired = false; | ||
if (angular.isDefined(data.minDate)) { | ||
setMin(data.minDate); | ||
validateRequired = true; | ||
} | ||
if (angular.isDefined(data.maxDate)) { | ||
setMax(data.maxDate); | ||
validateRequired = true; | ||
} | ||
if (pickerID) { | ||
scope.$on('pickerUpdate', function (event, pickerIDs, data) { | ||
// console.log(pickerIDs, pickerID); | ||
if (eventIsForPicker(pickerIDs, pickerID)) { | ||
if (picker) { | ||
//Need to handle situation where the data changed but the picker is currently open. | ||
//To handle this, we can create the inner picker with a random ID, then forward | ||
//any events received to it. | ||
} else { | ||
var validateRequired = false; | ||
if (angular.isDefined(data.minDate)) { | ||
setMin(data.minDate); | ||
validateRequired = true; | ||
} | ||
if (angular.isDefined(data.maxDate)) { | ||
setMax(data.maxDate); | ||
validateRequired = true; | ||
} | ||
if (angular.isDefined(data.minView)) { | ||
attrs.minView = data.minView; | ||
} | ||
if (angular.isDefined(data.maxView)) { | ||
attrs.maxView = data.maxView; | ||
} | ||
attrs.view = data.view || attrs.view; | ||
if (angular.isDefined(data.minView)) { | ||
attrs.minView = data.minView; | ||
} | ||
if (angular.isDefined(data.maxView)) { | ||
attrs.maxView = data.maxView; | ||
} | ||
attrs.view = data.view || attrs.view; | ||
if (validateRequired) { | ||
ngModel.$validate(); | ||
} | ||
if (angular.isDefined(data.format)) { | ||
format = attrs.format = data.format || dateTimeConfig.format; | ||
ngModel.$modelValue = -1; //Triggers formatters. This value will be discarded. | ||
} | ||
getTemplate(); | ||
if (validateRequired) { | ||
ngModel.$validate(); | ||
} | ||
if (angular.isDefined(data.format)) { | ||
format = attrs.format = data.format || dateTimeConfig.format; | ||
ngModel.$modelValue = -1; //Triggers formatters. This value will be discarded. | ||
} | ||
getTemplate(); | ||
} | ||
}); | ||
} | ||
function showPicker() { | ||
if (picker) { | ||
return; | ||
} | ||
// create picker element | ||
picker = $compile(template)(scope); | ||
scope.$digest(); | ||
}); | ||
} | ||
//If the picker has already been shown before then we shouldn't be binding to events, as these events are already bound to in this scope. | ||
if (!shownOnce) { | ||
scope.$on('setDate', function(event, date, view, fromOther) { | ||
updateInput(event); | ||
if (dateChange && fromOther !== true) { | ||
dateChange(attrs.ngModel, date); | ||
} | ||
if (dismiss && views[views.length - 1] === view) { | ||
clear(); | ||
} | ||
}); | ||
function showPicker() { | ||
if (picker) { | ||
return; | ||
} | ||
// create picker element | ||
picker = $compile(template)(scope); | ||
scope.$digest(); | ||
scope.$on('hidePicker', function() { | ||
element[0].blur(); | ||
}); | ||
//If the picker has already been shown before then we shouldn't be binding to events, as these events are already bound to in this scope. | ||
if (!shownOnce) { | ||
scope.$on('setDate', function (event, date, view, fromOther) { | ||
updateInput(event); | ||
if (dateChange && fromOther !== true) { | ||
dateChange(attrs.ngModel, date); | ||
} | ||
if (dismiss && views[views.length - 1] === view) { | ||
clear(); | ||
} | ||
}); | ||
scope.$on('$destroy', clear); | ||
scope.$on('hidePicker', function () { | ||
element[0].blur(); | ||
}); | ||
shownOnce = true; | ||
} | ||
scope.$on('$destroy', clear); | ||
shownOnce = true; | ||
} | ||
// move picker below input element | ||
// move picker below input element | ||
if (position === 'absolute') { | ||
var pos = element[0].getBoundingClientRect(); | ||
// Support IE8 | ||
var height = pos.height || element[0].offsetHeight; | ||
picker.css({ | ||
top: (pos.top + height) + 'px', | ||
left: pos.left + 'px', | ||
display: 'block', | ||
position: position | ||
}); | ||
body.append(picker); | ||
} else { | ||
// relative | ||
container = angular.element('<div date-picker-wrapper></div>'); | ||
element[0].parentElement.insertBefore(container[0], element[0]); | ||
container.append(picker); | ||
// this approach doesn't work | ||
// element.before(picker); | ||
picker.css({ | ||
top: element[0].offsetHeight + 'px', | ||
display: 'block' | ||
}); | ||
} | ||
picker.bind('mousedown', function(evt) { | ||
evt.preventDefault(); | ||
if (position === 'absolute') { | ||
var pos = element[0].getBoundingClientRect(); | ||
// Support IE8 | ||
var height = pos.height || element[0].offsetHeight; | ||
picker.css({ | ||
top: pos.top + height + 'px', | ||
left: pos.left + 'px', | ||
display: 'block', | ||
position: position | ||
}); | ||
body.append(picker); | ||
} else { | ||
// relative | ||
container = angular.element('<div date-picker-wrapper></div>'); | ||
element[0].parentElement.insertBefore(container[0], element[0]); | ||
container.append(picker); | ||
// this approach doesn't work | ||
// element.before(picker); | ||
picker.css({ | ||
top: element[0].offsetHeight + 'px', | ||
display: 'block' | ||
}); | ||
} | ||
picker.bind('mousedown', function (evt) { | ||
evt.preventDefault(); | ||
}); | ||
} | ||
element.bind('focus', showPicker); | ||
element.bind('click', showPicker); | ||
element.bind('blur', clear); | ||
getTemplate(); | ||
} | ||
}; | ||
} | ||
]); | ||
element.bind('focus', showPicker); | ||
element.bind('click', showPicker); | ||
element.bind('blur', clear); | ||
getTemplate(); | ||
} | ||
}; | ||
}]); | ||
//})); | ||
angular.module('datePicker').run(['$templateCache', function($templateCache) { | ||
$templateCache.put('templates/datepicker.html', | ||
"<div ng-switch=\"view\">\r" + | ||
"\n" + | ||
" <div ng-switch-when=\"date\">\r" + | ||
"\n" + | ||
" <table>\r" + | ||
"\n" + | ||
" <thead>\r" + | ||
"\n" + | ||
" <tr>\r" + | ||
"\n" + | ||
" <th ng-click=\"prev()\">‹</th>\r" + | ||
"\n" + | ||
" <th colspan=\"5\" class=\"switch\" ng-click=\"setView('month')\" ng-bind=\"date|mFormat:'YYYY MMMM':tz\"></th>\r" + | ||
"\n" + | ||
" <th ng-click=\"next()\">›</i></th>\r" + | ||
"\n" + | ||
" </tr>\r" + | ||
"\n" + | ||
" <tr>\r" + | ||
"\n" + | ||
" <th ng-repeat=\"day in weekdays\" style=\"overflow: hidden\" ng-bind=\"day|mFormat:'ddd':tz\"></th>\r" + | ||
"\n" + | ||
" </tr>\r" + | ||
"\n" + | ||
" </thead>\r" + | ||
"\n" + | ||
" <tbody>\r" + | ||
"\n" + | ||
" <tr ng-repeat=\"week in weeks\" ng-init=\"$index2 = $index\">\r" + | ||
"\n" + | ||
" <td ng-repeat=\"day in week\">\r" + | ||
"\n" + | ||
" <span\r" + | ||
"\n" + | ||
" ng-class=\"classes[$index2][$index]\"\r" + | ||
"\n" + | ||
" ng-click=\"selectDate(day)\" ng-bind=\"day|mFormat:'DD':tz\"></span>\r" + | ||
"\n" + | ||
" </td>\r" + | ||
"\n" + | ||
" </tr>\r" + | ||
"\n" + | ||
" </tbody>\r" + | ||
"\n" + | ||
" </table>\r" + | ||
"\n" + | ||
" </div>\r" + | ||
"\n" + | ||
" <div ng-switch-when=\"year\">\r" + | ||
"\n" + | ||
" <table>\r" + | ||
"\n" + | ||
" <thead>\r" + | ||
"\n" + | ||
" <tr>\r" + | ||
"\n" + | ||
" <th ng-click=\"prev(10)\">‹</th>\r" + | ||
"\n" + | ||
" <th colspan=\"5\" class=\"switch\"ng-bind=\"years[0].year()+' - '+years[years.length-1].year()\"></th>\r" + | ||
"\n" + | ||
" <th ng-click=\"next(10)\">›</i></th>\r" + | ||
"\n" + | ||
" </tr>\r" + | ||
"\n" + | ||
" </thead>\r" + | ||
"\n" + | ||
" <tbody>\r" + | ||
"\n" + | ||
" <tr>\r" + | ||
"\n" + | ||
" <td colspan=\"7\">\r" + | ||
"\n" + | ||
" <span ng-class=\"classes[$index]\"\r" + | ||
"\n" + | ||
" ng-repeat=\"year in years\"\r" + | ||
"\n" + | ||
" ng-click=\"selectDate(year)\" ng-bind=\"year.year()\"></span>\r" + | ||
"\n" + | ||
" </td>\r" + | ||
"\n" + | ||
" </tr>\r" + | ||
"\n" + | ||
" </tbody>\r" + | ||
"\n" + | ||
" </table>\r" + | ||
"\n" + | ||
" </div>\r" + | ||
"\n" + | ||
" <div ng-switch-when=\"month\">\r" + | ||
"\n" + | ||
" <table>\r" + | ||
"\n" + | ||
" <thead>\r" + | ||
"\n" + | ||
" <tr>\r" + | ||
"\n" + | ||
" <th ng-click=\"prev()\">‹</th>\r" + | ||
"\n" + | ||
" <th colspan=\"5\" class=\"switch\" ng-click=\"setView('year')\" ng-bind=\"date|mFormat:'YYYY':tz\"></th>\r" + | ||
"\n" + | ||
" <th ng-click=\"next()\">›</i></th>\r" + | ||
"\n" + | ||
" </tr>\r" + | ||
"\n" + | ||
" </thead>\r" + | ||
"\n" + | ||
" <tbody>\r" + | ||
"\n" + | ||
" <tr>\r" + | ||
"\n" + | ||
" <td colspan=\"7\">\r" + | ||
"\n" + | ||
" <span ng-repeat=\"month in months\"\r" + | ||
"\n" + | ||
" ng-class=\"classes[$index]\"\r" + | ||
"\n" + | ||
" ng-click=\"selectDate(month)\"\r" + | ||
"\n" + | ||
" ng-bind=\"month|mFormat:'MMM':tz\"></span>\r" + | ||
"\n" + | ||
" </td>\r" + | ||
"\n" + | ||
" </tr>\r" + | ||
"\n" + | ||
" </tbody>\r" + | ||
"\n" + | ||
" </table>\r" + | ||
"\n" + | ||
" </div>\r" + | ||
"\n" + | ||
" <div ng-switch-when=\"hours\">\r" + | ||
"\n" + | ||
" <table>\r" + | ||
"\n" + | ||
" <thead>\r" + | ||
"\n" + | ||
" <tr>\r" + | ||
"\n" + | ||
" <th ng-click=\"prev(24)\">‹</th>\r" + | ||
"\n" + | ||
" <th colspan=\"5\" class=\"switch\" ng-click=\"setView('date')\" ng-bind=\"date|mFormat:'DD MMMM YYYY':tz\"></th>\r" + | ||
"\n" + | ||
" <th ng-click=\"next(24)\">›</i></th>\r" + | ||
"\n" + | ||
" </tr>\r" + | ||
"\n" + | ||
" </thead>\r" + | ||
"\n" + | ||
" <tbody>\r" + | ||
"\n" + | ||
" <tr>\r" + | ||
"\n" + | ||
" <td colspan=\"7\">\r" + | ||
"\n" + | ||
" <span ng-repeat=\"hour in hours\"\r" + | ||
"\n" + | ||
" ng-class=\"classes[$index]\"\r" + | ||
"\n" + | ||
" ng-click=\"selectDate(hour)\" ng-bind=\"hour|mFormat:'HH:mm':tz\"></span>\r" + | ||
"\n" + | ||
" </td>\r" + | ||
"\n" + | ||
" </tr>\r" + | ||
"\n" + | ||
" </tbody>\r" + | ||
"\n" + | ||
" </table>\r" + | ||
"\n" + | ||
" </div>\r" + | ||
"\n" + | ||
" <div ng-switch-when=\"minutes\">\r" + | ||
"\n" + | ||
" <table>\r" + | ||
"\n" + | ||
" <thead>\r" + | ||
"\n" + | ||
" <tr>\r" + | ||
"\n" + | ||
" <th ng-click=\"prev()\">‹</th>\r" + | ||
"\n" + | ||
" <th colspan=\"5\" class=\"switch\" ng-click=\"setView('hours')\" ng-bind=\"date|mFormat:'DD MMMM YYYY':tz\"></th>\r" + | ||
"\n" + | ||
" <th ng-click=\"next()\">›</i></th>\r" + | ||
"\n" + | ||
" </tr>\r" + | ||
"\n" + | ||
" </thead>\r" + | ||
"\n" + | ||
" <tbody>\r" + | ||
"\n" + | ||
" <tr>\r" + | ||
"\n" + | ||
" <td colspan=\"7\">\r" + | ||
"\n" + | ||
" <span ng-repeat=\"minute in minutes\"\r" + | ||
"\n" + | ||
" ng-class=\"classes[$index]\"\r" + | ||
"\n" + | ||
" ng-click=\"selectDate(minute)\"\r" + | ||
"\n" + | ||
" ng-bind=\"minute|mFormat:'HH:mm':tz\"></span>\r" + | ||
"\n" + | ||
" </td>\r" + | ||
"\n" + | ||
" </tr>\r" + | ||
"\n" + | ||
" </tbody>\r" + | ||
"\n" + | ||
" </table>\r" + | ||
"\n" + | ||
" </div>\r" + | ||
"\n" + | ||
"</div>" | ||
); | ||
angular.module('datePicker').run(['$templateCache', function ($templateCache) { | ||
$templateCache.put('templates/datepicker.html', "<div ng-switch=\"view\">\r" + "\n" + " <div ng-switch-when=\"date\">\r" + "\n" + " <table>\r" + "\n" + " <thead>\r" + "\n" + " <tr>\r" + "\n" + " <th ng-click=\"prev()\">‹</th>\r" + "\n" + " <th colspan=\"5\" class=\"switch\" ng-click=\"setView('month')\" ng-bind=\"date|mFormat:'YYYY MMMM':tz\"></th>\r" + "\n" + " <th ng-click=\"next()\">›</i></th>\r" + "\n" + " </tr>\r" + "\n" + " <tr>\r" + "\n" + " <th ng-repeat=\"day in weekdays\" style=\"overflow: hidden\" ng-bind=\"day|mFormat:'ddd':tz\"></th>\r" + "\n" + " </tr>\r" + "\n" + " </thead>\r" + "\n" + " <tbody>\r" + "\n" + " <tr ng-repeat=\"week in weeks\" ng-init=\"$index2 = $index\">\r" + "\n" + " <td ng-repeat=\"day in week\">\r" + "\n" + " <span\r" + "\n" + " ng-class=\"classes[$index2][$index]\"\r" + "\n" + " ng-click=\"selectDate(day)\" ng-bind=\"day|mFormat:'DD':tz\"></span>\r" + "\n" + " </td>\r" + "\n" + " </tr>\r" + "\n" + " </tbody>\r" + "\n" + " </table>\r" + "\n" + " </div>\r" + "\n" + " <div ng-switch-when=\"year\">\r" + "\n" + " <table>\r" + "\n" + " <thead>\r" + "\n" + " <tr>\r" + "\n" + " <th ng-click=\"prev(10)\">‹</th>\r" + "\n" + " <th colspan=\"5\" class=\"switch\"ng-bind=\"years[0].year()+' - '+years[years.length-1].year()\"></th>\r" + "\n" + " <th ng-click=\"next(10)\">›</i></th>\r" + "\n" + " </tr>\r" + "\n" + " </thead>\r" + "\n" + " <tbody>\r" + "\n" + " <tr>\r" + "\n" + " <td colspan=\"7\">\r" + "\n" + " <span ng-class=\"classes[$index]\"\r" + "\n" + " ng-repeat=\"year in years\"\r" + "\n" + " ng-click=\"selectDate(year)\" ng-bind=\"year.year()\"></span>\r" + "\n" + " </td>\r" + "\n" + " </tr>\r" + "\n" + " </tbody>\r" + "\n" + " </table>\r" + "\n" + " </div>\r" + "\n" + " <div ng-switch-when=\"month\">\r" + "\n" + " <table>\r" + "\n" + " <thead>\r" + "\n" + " <tr>\r" + "\n" + " <th ng-click=\"prev()\">‹</th>\r" + "\n" + " <th colspan=\"5\" class=\"switch\" ng-click=\"setView('year')\" ng-bind=\"date|mFormat:'YYYY':tz\"></th>\r" + "\n" + " <th ng-click=\"next()\">›</i></th>\r" + "\n" + " </tr>\r" + "\n" + " </thead>\r" + "\n" + " <tbody>\r" + "\n" + " <tr>\r" + "\n" + " <td colspan=\"7\">\r" + "\n" + " <span ng-repeat=\"month in months\"\r" + "\n" + " ng-class=\"classes[$index]\"\r" + "\n" + " ng-click=\"selectDate(month)\"\r" + "\n" + " ng-bind=\"month|mFormat:'MMM':tz\"></span>\r" + "\n" + " </td>\r" + "\n" + " </tr>\r" + "\n" + " </tbody>\r" + "\n" + " </table>\r" + "\n" + " </div>\r" + "\n" + " <div ng-switch-when=\"hours\">\r" + "\n" + " <table>\r" + "\n" + " <thead>\r" + "\n" + " <tr>\r" + "\n" + " <th ng-click=\"prev(24)\">‹</th>\r" + "\n" + " <th colspan=\"5\" class=\"switch\" ng-click=\"setView('date')\" ng-bind=\"date|mFormat:'DD MMMM YYYY':tz\"></th>\r" + "\n" + " <th ng-click=\"next(24)\">›</i></th>\r" + "\n" + " </tr>\r" + "\n" + " </thead>\r" + "\n" + " <tbody>\r" + "\n" + " <tr>\r" + "\n" + " <td colspan=\"7\">\r" + "\n" + " <span ng-repeat=\"hour in hours\"\r" + "\n" + " ng-class=\"classes[$index]\"\r" + "\n" + " ng-click=\"selectDate(hour)\" ng-bind=\"hour|mFormat:'HH:mm':tz\"></span>\r" + "\n" + " </td>\r" + "\n" + " </tr>\r" + "\n" + " </tbody>\r" + "\n" + " </table>\r" + "\n" + " </div>\r" + "\n" + " <div ng-switch-when=\"minutes\">\r" + "\n" + " <table>\r" + "\n" + " <thead>\r" + "\n" + " <tr>\r" + "\n" + " <th ng-click=\"prev()\">‹</th>\r" + "\n" + " <th colspan=\"5\" class=\"switch\" ng-click=\"setView('hours')\" ng-bind=\"date|mFormat:'DD MMMM YYYY':tz\"></th>\r" + "\n" + " <th ng-click=\"next()\">›</i></th>\r" + "\n" + " </tr>\r" + "\n" + " </thead>\r" + "\n" + " <tbody>\r" + "\n" + " <tr>\r" + "\n" + " <td colspan=\"7\">\r" + "\n" + " <span ng-repeat=\"minute in minutes\"\r" + "\n" + " ng-class=\"classes[$index]\"\r" + "\n" + " ng-click=\"selectDate(minute)\"\r" + "\n" + " ng-bind=\"minute|mFormat:'HH:mm':tz\"></span>\r" + "\n" + " </td>\r" + "\n" + " </tr>\r" + "\n" + " </tbody>\r" + "\n" + " </table>\r" + "\n" + " </div>\r" + "\n" + "</div>"); | ||
}]); | ||
})); | ||
}); |
{ | ||
"name": "angular-datepicker-custom", | ||
"version": "2.1.12", | ||
"main": "dist/angular-datepicker.js", | ||
"version": "2.1.13", | ||
"main": "dist/angular-datepicker.min.js", | ||
"repository": { | ||
"url": "https://github.com/youpinyao/angular-datepicker.git" | ||
}, | ||
"scripts": { | ||
"build": "babel dist/angular-datepicker.js --out-file dist/angular-datepicker.min.js --presets=es2015" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"bower": "1.5.3", | ||
"grunt": "0.4.5", | ||
"grunt-angular-templates": "0.5.7", | ||
"grunt-bump": "0.3.1", | ||
"grunt-cli": "0.1.13", | ||
"grunt-concurrent": "1.0.1", | ||
"grunt-contrib-clean": "0.6.0", | ||
"grunt-contrib-concat": "0.5.1", | ||
"grunt-contrib-connect": "0.10.1", | ||
"grunt-contrib-copy": "0.8.0", | ||
"grunt-contrib-cssmin": "0.12.3", | ||
"grunt-contrib-jshint": "0.11.2", | ||
"grunt-contrib-less": "1.0.1", | ||
"grunt-contrib-livereload": "0.1.2", | ||
"grunt-contrib-uglify": "0.9.1", | ||
"grunt-contrib-watch": "0.6.1", | ||
"grunt-karma": "0.11.0", | ||
"grunt-ng-annotate": "1.0.1", | ||
"grunt-ngmin": "0.0.3", | ||
"grunt-open": "0.2.3", | ||
"jasmine-core": "^2.3.4", | ||
"karma": "0.12.36", | ||
"karma-chrome-launcher": "^0.1.12", | ||
"karma-firefox-launcher": "^0.1.6", | ||
"karma-jasmine": "^0.3.5", | ||
"karma-ng-html2js-preprocessor": "^0.2.1", | ||
"karma-phantomjs-launcher": "0.2.0", | ||
"karma-script-launcher": "^0.1.0", | ||
"load-grunt-tasks": "3.2.0", | ||
"phantomjs": "1.9.17" | ||
"babel-cli": "^6.26.0", | ||
"babel-preset-es2015": "^6.24.1" | ||
}, | ||
@@ -41,0 +16,0 @@ "engines": { |
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
2
325680
9033