2 lines
43 KiB
JavaScript
2 lines
43 KiB
JavaScript
|
/* flatpickr v4.1.4,, @license MIT */
|
||
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.flatpickr=t()}(this,function(){"use strict";function e(e,t,n){return!1!==n?new Date(e.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0):e.getTime()-t.getTime()}function t(e,t,n){void 0===n&&(n=!1);var a;return function(){var i=this,o=arguments;null!==a&&clearTimeout(a),a=window.setTimeout(function(){a=null,n||e.apply(i,o)},t),n&&!a&&e.apply(i,o)}}function n(e,t,n){if(!0===n)return e.classList.add(t);e.classList.remove(t)}function a(e,t,n){var a=window.document.createElement(e);return t=t||"",n=n||"",a.className=t,void 0!==n&&(a.textContent=n),a}function i(e,t){return t(e)?e:e.parentNode?i(e.parentNode,t):void 0}function o(e){var t=a("div","numInputWrapper"),n=a("input","numInput "+e),i=a("span","arrowUp"),o=a("span","arrowDown");return n.type="text",n.pattern="\\d*",t.appendChild(n),t.appendChild(i),t.appendChild(o),t}function r(r,s){for(var u=Array.prototype.slice.call(r),p=[],w=0;w<u.length;w++){var M=u[w];try{if(null!==M.getAttribute("data-fp-omit"))continue;void 0!==M._flatpickr&&(M._flatpickr.destroy(),M._flatpickr=void 0),M._flatpickr=function(r,s){function u(e){return e.bind(X)}function p(e){if(X.config.noCalendar&&0===X.selectedDates.length){var t=X.config.minDate;X.setDate((new Date).setHours(t?t.getHours():X.config.defaultHour,t?t.getMinutes():X.config.defaultMinute,t&&X.config.enableSeconds?t.getSeconds():X.config.defaultSeconds),!1),w(),Q()}!function(e){e.preventDefault();var t="keydown"===e.type,n=e.target;void 0!==X.amPM&&e.target===X.amPM&&(X.amPM.textContent=X.l10n.amPM[m(X.amPM.textContent===X.l10n.amPM[0])]);var a=Number(n.min),i=Number(n.max),o=Number(n.step),r=parseInt(n.value,10),l=e.delta||(t?38===e.which?1:-1:Math.max(-1,Math.min(1,e.wheelDelta||-e.deltaY))||0),c=r+o*l;if(void 0!==n.value&&2===n.value.length){var d=n===X.hourElement,s=n===X.minuteElement;c<a?(c=i+c+m(!d)+(m(d)&&m(!X.amPM)),s&&S(void 0,-1,X.hourElement)):c>i&&(c=n===X.hourElement?c-i-m(!X.amPM):a,s&&S(void 0,1,X.hourElement)),X.amPM&&d&&(1===o?c+r===23:Math.abs(c-r)>o)&&(X.amPM.textContent=X.l10n.amPM[m(X.amPM.textContent===X.l10n.amPM[0])]),n.value=f(c)}}(e),0!==X.selectedDates.length&&(!X.minDateHasTime||"input"!==e.type||e.target.value.length>=2?(w(),Q()):setTimeout(function(){w(),Q()},1e3))}function w(){if(void 0!==X.hourElement&&void 0!==X.minuteElement){var t=(parseInt(X.hourElement.value.slice(-2),10)||0)%24,n=(parseInt(X.minuteElement.value,10)||0)%60,a=void 0!==X.secondElement?(parseInt(X.secondElement.value,10)||0)%60:0;void 0!==X.amPM&&(t=function(e,t){return e%12+12*m(t===X.l10n.amPM[1])}(t,X.amPM.textContent)),X.config.minDate&&X.minDateHasTime&&X.latestSelectedDateObj&&0===e(X.latestSelectedDateObj,X.config.minDate)&&(t=Math.max(t,X.config.minDate.getHours()))===X.config.minDate.getHours()&&(n=Math.max(n,X.config.minDate.getMinutes())),X.config.maxDate&&X.maxDateHasTime&&X.latestSelectedDateObj&&0===e(X.latestSelectedDateObj,X.config.maxDate)&&(t=Math.min(t,X.config.maxDate.getHours()))===X.config.maxDate.getHours()&&(n=Math.min(n,X.config.maxDate.getMinutes())),b(t,n,a)}}function M(e){var t=e||X.latestSelectedDateObj;t&&b(t.getHours(),t.getMinutes(),t.getSeconds())}function b(e,t,n){void 0!==X.latestSelectedDateObj&&X.latestSelectedDateObj.setHours(e%24,t,n||0,0),X.hourElement&&X.minuteElement&&!X.isMobile&&(X.hourElement.value=f(X.config.time_24hr?e:(12+e)%12+12*m(e%12==0)),X.minuteElement.value=f(t),void 0!==X.amPM&&(X.amPM.textContent=X.l10n.amPM[m(e>=12)]),void 0!==X.secondElement&&(X.secondElement.value=f(n)))}function y(e,t,n){return t instanceof Array?t.forEach(function(t){return y(e,t,n)}):e instanceof Array?e.forEach(function(e){return y(e,t,n)}):(e.addEventListener(t,n),void X._handlers.push({element:e,event:t,handler:n}))}function x(e){return function(t){1===t.which&&e(t)}}function E(){z("onChange")}function N(){X._animationLoop.forEach(function(e){return e()}),X._animationLoop=[]}function k(e){var t=void 0!==e?q(e):X.latestSelectedDateObj||(X.config.mi
|