rangePlugin.min.js 3.9 KB

12345678910111213141516171819202122
  1. /**
  2. * Minified by jsDelivr using Terser v5.3.5.
  3. * Original file: /npm/flatpickr@4.6.9/dist/plugins/rangePlugin.js
  4. *
  5. * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
  6. */
  7. !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).rangePlugin=t()}(this,(function(){"use strict";
  8. /*! *****************************************************************************
  9. Copyright (c) Microsoft Corporation.
  10. Permission to use, copy, modify, and/or distribute this software for any
  11. purpose with or without fee is hereby granted.
  12. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  13. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  14. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  15. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  16. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  17. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  18. PERFORMANCE OF THIS SOFTWARE.
  19. ***************************************************************************** */function e(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),i=0;for(t=0;t<n;t++)for(var u=arguments[t],a=0,l=u.length;a<l;a++,i++)o[i]=u[a];return o}return function(t){return void 0===t&&(t={}),function(n){var o,i,u,a="",l={onParseConfig:function(){n.config.mode="range",a=n.config.altInput?n.config.altFormat:n.config.dateFormat},onReady:function(){!function(){if(t.input){if(!(o=t.input instanceof Element?t.input:window.document.querySelector(t.input)))return void n.config.errorHandler(new Error("Invalid input element specified"));n.config.wrap&&(o=o.querySelector("[data-input]"))}else(o=n._input.cloneNode()).removeAttribute("id"),o._flatpickr=void 0;if(o.value){var e=n.parseDate(o.value);e&&n.selectedDates.push(e)}o.setAttribute("data-fp-omit",""),n.config.clickOpens&&(n._bind(o,["focus","click"],(function(){n.selectedDates[1]&&(n.latestSelectedDateObj=n.selectedDates[1],n._setHoursFromDate(n.selectedDates[1]),n.jumpToDate(n.selectedDates[1])),i=!0,n.isOpen=!1,n.open(void 0,"left"===t.position?n._input:o)})),n._bind(n._input,["focus","click"],(function(e){e.preventDefault(),n.isOpen=!1,n.open()}))),n.config.allowInput&&n._bind(o,"keydown",(function(e){"Enter"===e.key&&(n.setDate([n.selectedDates[0],o.value],!0,a),o.click())})),t.input||n._input.parentNode&&n._input.parentNode.insertBefore(o,n._input.nextSibling)}(),n.config.ignoredFocusElements.push(o),n.config.allowInput?(n._input.removeAttribute("readonly"),o.removeAttribute("readonly")):o.setAttribute("readonly","readonly"),n._bind(n._input,"focus",(function(){n.latestSelectedDateObj=n.selectedDates[0],n._setHoursFromDate(n.selectedDates[0]),i=!1,n.jumpToDate(n.selectedDates[0])})),n.config.allowInput&&n._bind(n._input,"keydown",(function(e){"Enter"===e.key&&n.setDate([n._input.value,n.selectedDates[1]],!0,a)})),n.setDate(n.selectedDates,!1),l.onValueUpdate(n.selectedDates),n.loadedPlugins.push("range")},onPreCalendarPosition:function(){i&&(n._positionElement=o,setTimeout((function(){n._positionElement=n._input}),0))},onChange:function(){n.selectedDates.length||setTimeout((function(){n.selectedDates.length||(o.value="",u=[])}),10),i&&setTimeout((function(){o.focus()}),0)},onDestroy:function(){t.input||o.parentNode&&o.parentNode.removeChild(o)},onValueUpdate:function(t){var l,r,s;if(o){if((u=!u||t.length>=u.length?e(t):u).length>t.length){var c=t[0],d=i?[u[0],c]:[c,u[1]];n.setDate(d,!1),u=e(d)}r=(l=n.selectedDates.map((function(e){return n.formatDate(e,a)})))[0],n._input.value=void 0===r?"":r,s=l[1],o.value=void 0===s?"":s}}};return l}}}));
  20. //# sourceMappingURL=/sm/40e7cb5e6383dabe6c7f68d046ec935fe0f40a0e81906eff84d399f6ff296a44.map