"use strict";
angular.module("g1b.datetime-inputs", []).directive("datetimeInput", ["$document", "$timeout", function(e, t) {
return {
restrict: "E",
scope: {
datetime: "=",
format: "=?",
dateFormat: "=?",
timeFormat: "=?",
minDate: "=?",
maxDate: "=?",
hourStep: "=?",
minuteStep: "=?",
secondStep: "no",
onChange: "&",
placeholder: "@",
clearText: "@",
cssClass: "@"
},
replace: !0,
template: '
',
compile: function() {
return {
pre: function() {},
post: function(a, d) {
a.current = moment(), a.datetime && !a.datetime._isAMomentObject && (a.datetime = moment(a.datetime, a.format)), a.toggleEditPopover = function() {
a.selected ? a.selected = void 0 : (a.selected = a.datetime || moment(), a.calendar = a.selected.clone())
}, a.update = function(e, d) {
a.selected.isSame(e) && a.datetime || (e ? (!a.minDate || e > a.minDate) && (!a.maxDate || e < a.maxDate) ? (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() && a.selected.clone().endOf("week").month() !== a.calendar.month() || d) && (a.calendar = a.selected.clone()), a.datetime || (a.datetime = a.selected), a.$$postDigest(function() {
a.onChange()
})) : (a.warning = !0, t(function() {
a.warning = !1
}, 250)) : a.selected = a.datetime = void 0)
}, 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("dateInput", ["$document", "$timeout", function(e, a) {
return {
restrict: "E",
scope: {
date: "=",
format: "=?",
dateFormat: "=?",
minDate: "=?",
maxDate: "=?",
onChange: "&",
placeholder: "@",
clearText: "@",
cssClass: "@"
},
replace: !0,
template: "",
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: "=?",
timeFormat: "=?",
minDate: "=?",
maxDate: "=?",
hourStep: "=?",
minuteStep: "=?",
secondStep: "=?",
onChange: "&",
placeholder: "@",
clearText: "@",
cssClass: "@"
},
replace: !0,
template: '',
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("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("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())
})
}
}
}
}
});