@majidh1/jalalidatepicker
Advanced tools
Comparing version 0.4.4 to 0.4.5
@@ -49,3 +49,3 @@ /* | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ \"./src/utils.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ \"./src/constants.js\");\n/* harmony import */ var _draw__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./draw */ \"./src/draw.js\");\n/* harmony import */ var _defaults__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./defaults */ \"./src/defaults.js\");\n\n\n\n\nvar jalaliDatepicker = {\n init: function init(options) {\n this.options = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.extend)(_defaults__WEBPACK_IMPORTED_MODULE_3__.default, options);\n this.options = normalizeOptions(this.options);\n window.onresize = windowResize;\n if (this.options.autoHide) document.body.onclick = documentClick;\n if (this.options.autoShow) addEventListenerOnInputs(this.options.selector);\n },\n options: _defaults__WEBPACK_IMPORTED_MODULE_3__.default,\n input: null,\n\n get dpContainer() {\n this._dpContainer = this._dpContainer || (0,_utils__WEBPACK_IMPORTED_MODULE_0__.createElement)(_constants__WEBPACK_IMPORTED_MODULE_1__.CONTAINER_ELM_QUERY, this.options.container);\n return this._dpContainer;\n },\n\n get today() {\n this._today = this._today || (0,_utils__WEBPACK_IMPORTED_MODULE_0__.jalaliToday)();\n return this._today;\n },\n\n get valueDate() {\n this._valueDate = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clon)(this.input.value);\n\n if ((0,_utils__WEBPACK_IMPORTED_MODULE_0__.isString)(this._valueDate)) {\n if ((0,_utils__WEBPACK_IMPORTED_MODULE_0__.isValidDateString)(this._valueDate, this.options.separatorChar)) {\n this._valueDate = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getDateFromString)(this._valueDate, this.options.separatorChar);\n } else {\n this._valueDate = {};\n }\n }\n\n return this._valueDate;\n },\n\n get initDate() {\n this._initDate = this._initDate || (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clon)(this.valueDate);\n\n if ((0,_utils__WEBPACK_IMPORTED_MODULE_0__.isPlainObject)(this._initDate)) {\n this._initDate = this.options.initDate || (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clon)(this.today);\n }\n\n if ((0,_utils__WEBPACK_IMPORTED_MODULE_0__.isString)(this._initDate) && (0,_utils__WEBPACK_IMPORTED_MODULE_0__.isValidDateString)(this._initDate, this.options.separatorChar)) {\n this._initDate = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getDateFromString)(this._initDate, this.options.separatorChar);\n }\n\n return (0,_utils__WEBPACK_IMPORTED_MODULE_0__.normalizeMinMaxDate)(this._initDate.year, this._initDate.month, this._initDate.day, this._initDate, this.options.minDate, this.options.maxDate);\n },\n\n _draw: _draw__WEBPACK_IMPORTED_MODULE_2__.default,\n show: function show(input) {\n this._initDate = null;\n this._valueDate = null;\n this.input = input;\n\n this._draw();\n\n this.dpContainer.style.visibility = _constants__WEBPACK_IMPORTED_MODULE_1__.STYLE_VISIBILITY_VISIBLE;\n this.dpContainer.style.display = _constants__WEBPACK_IMPORTED_MODULE_1__.STYLE_DISPLAY_BLOCK;\n this.dpContainer.style.zIndex = this.options.zIndex;\n this.setPosition();\n setScrollOnParent(input);\n setReadOnly(input, this.options);\n },\n hide: function hide() {\n this.dpContainer.style.visibility = _constants__WEBPACK_IMPORTED_MODULE_1__.STYLE_VISIBILITY_HIDDEN;\n this.dpContainer.style.display = _constants__WEBPACK_IMPORTED_MODULE_1__.STYLE_DISPLAY_HIDDEN;\n },\n setPosition: function setPosition() {\n if (this.dpContainer.style.visibility !== _constants__WEBPACK_IMPORTED_MODULE_1__.STYLE_VISIBILITY_VISIBLE) {\n return;\n }\n\n var inputBounds = this.input.getBoundingClientRect();\n var left = inputBounds.left;\n var top = inputBounds.top;\n var inputHeight = inputBounds.height;\n var windowHeight = window.document.body.offsetWidth;\n var dpContainerWidth = this.dpContainer.offsetWidth;\n var dpContainerHeight = this.dpContainer.offsetHeight;\n\n if (left + dpContainerWidth >= windowHeight) {\n left -= left + dpContainerWidth - (windowHeight + 10);\n }\n\n if (top >= dpContainerHeight && top + dpContainerHeight >= window.innerHeight) {\n top -= dpContainerHeight + inputHeight;\n }\n\n this.dpContainer.style.position = _constants__WEBPACK_IMPORTED_MODULE_1__.STYLE_POSITION_FIXED;\n this.dpContainer.style.left = left + \"px\";\n this.dpContainer.style.top = top + this.input.offsetHeight + \"px\";\n },\n setValue: function setValue(year, month, day) {\n this._valueDate.year = year;\n this._valueDate.month = month;\n this._valueDate.day = day;\n this.hide();\n\n if (isNaN(year + month + day)) {\n this.input.value = \"\";\n } else {\n this.input.value = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getDateToString)(year, month, day, this.options.separatorChar);\n }\n\n (0,_utils__WEBPACK_IMPORTED_MODULE_0__.triggerEvent)(this.input, _constants__WEBPACK_IMPORTED_MODULE_1__.EVENT_CHANGE_INPUT_STR);\n },\n increaseMonth: function increaseMonth() {\n var isLastMonth = this._initDate.month === 12;\n\n if (this.options.changeMonthRotateYear && isLastMonth) {\n this.increaseYear();\n }\n\n this.monthChange(isLastMonth ? 1 : this._initDate.month + 1);\n },\n decreaseMonth: function decreaseMonth() {\n var isFirstMonth = this._initDate.month === 1;\n\n if (this.options.changeMonthRotateYear && isFirstMonth) {\n this.decreaseYear();\n }\n\n this.monthChange(isFirstMonth ? 12 : this._initDate.month - 1);\n },\n monthChange: function monthChange(month) {\n this._initDate = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.normalizeMinMaxDate)(this._initDate.year, month, this._initDate.day, this._initDate, this.options.minDate, this.options.maxDate);\n\n this._draw();\n },\n increaseYear: function increaseYear() {\n this.yearChange(this._initDate.year + 1);\n },\n decreaseYear: function decreaseYear() {\n this.yearChange(this._initDate.year - 1);\n },\n yearChange: function yearChange(year) {\n this._initDate = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.normalizeMinMaxDate)(year, this._initDate.month, this._initDate.day, this._initDate, this.options.minDate, this.options.maxDate);\n\n this._draw();\n }\n};\n\nvar getDefaultFromAttr = function getDefaultFromAttr(attrName, sepChar) {\n var _jalaliDatepicker$inp;\n\n var dateAttrVal = (_jalaliDatepicker$inp = jalaliDatepicker.input) === null || _jalaliDatepicker$inp === void 0 ? void 0 : _jalaliDatepicker$inp.getAttribute(attrName);\n\n if (dateAttrVal === _constants__WEBPACK_IMPORTED_MODULE_1__.MIN_MAX_TODAY_SETTING) {\n dateAttrVal = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clon)(jalaliDatepicker.today);\n } else if ((0,_utils__WEBPACK_IMPORTED_MODULE_0__.isString)(dateAttrVal) && (0,_utils__WEBPACK_IMPORTED_MODULE_0__.isValidDateString)(dateAttrVal, sepChar)) {\n dateAttrVal = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getDateFromString)(dateAttrVal, sepChar);\n } else {\n dateAttrVal = {};\n }\n\n return dateAttrVal;\n};\n\nvar normalizeOptions = function normalizeOptions(options) {\n if (options.minDate === _constants__WEBPACK_IMPORTED_MODULE_1__.MIN_MAX_TODAY_SETTING) options.minDate = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clon)(jalaliDatepicker.today);\n if (options.maxDate === _constants__WEBPACK_IMPORTED_MODULE_1__.MIN_MAX_TODAY_SETTING) options.maxDate = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clon)(jalaliDatepicker.today);\n\n if (options.minDate === _constants__WEBPACK_IMPORTED_MODULE_1__.MIN_MAX_ATTR_SETTING) {\n delete options.minDate;\n window.Object.defineProperty(options, \"minDate\", {\n get: function get() {\n return getDefaultFromAttr(_constants__WEBPACK_IMPORTED_MODULE_1__.MIN_MAX_ATTR_SETTING_MIN_ATTR_NAME, options.separatorChar);\n }\n });\n }\n\n if (options.maxDate === _constants__WEBPACK_IMPORTED_MODULE_1__.MIN_MAX_ATTR_SETTING) {\n delete options.maxDate;\n window.Object.defineProperty(options, \"maxDate\", {\n get: function get() {\n return getDefaultFromAttr(_constants__WEBPACK_IMPORTED_MODULE_1__.MIN_MAX_ATTR_SETTING_MAX_ATTR_NAME, options.separatorChar);\n }\n });\n }\n\n return options;\n};\n\nfunction documentClick(e) {\n if (jalaliDatepicker.dpContainer.style.visibility !== _constants__WEBPACK_IMPORTED_MODULE_1__.STYLE_VISIBILITY_VISIBLE || (0,_utils__WEBPACK_IMPORTED_MODULE_0__.containsDom)(jalaliDatepicker.dpContainer, e) || (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getEventTarget)(e) === jalaliDatepicker.input) {\n return;\n }\n\n jalaliDatepicker.hide();\n}\n\nfunction windowResize() {\n jalaliDatepicker.setPosition();\n}\n\nfunction setScrollOnParent(input) {\n (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getScrollParent)(input).addEventListener(\"scroll\", function () {\n jalaliDatepicker.setPosition();\n }, {\n passive: true\n });\n}\n\nfunction setReadOnly(input, options) {\n if (options.autoReadOnlyInput && !input.readOnly) input.readOnly = true;\n}\n\nfunction addEventListenerOnInputs(querySelector) {\n Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;\n document.body.addEventListener(_constants__WEBPACK_IMPORTED_MODULE_1__.EVENT_FOCUS_STR, function (e) {\n if (e.target && e.target.matches(querySelector)) {\n jalaliDatepicker.show(e.target);\n }\n });\n}\n\nwindow.jalaliDatepicker = {\n startWatch: function startWatch() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n jalaliDatepicker.init(options);\n },\n show: function show(input) {\n jalaliDatepicker.show(input);\n },\n hide: function hide() {\n jalaliDatepicker.hide();\n }\n};\n\n//# sourceURL=webpack://@majidh1/jalalidatepicker/./src/index.js?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ \"./src/utils.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ \"./src/constants.js\");\n/* harmony import */ var _draw__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./draw */ \"./src/draw.js\");\n/* harmony import */ var _defaults__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./defaults */ \"./src/defaults.js\");\n\n\n\n\nvar jalaliDatepicker = {\n init: function init(options) {\n this.options = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.extend)(_defaults__WEBPACK_IMPORTED_MODULE_3__.default, options);\n this.options = normalizeOptions(this.options);\n window.onresize = windowResize;\n if (this.options.autoHide) document.body.onclick = documentClick;\n if (this.options.autoShow) addEventListenerOnInputs(this.options.selector);\n },\n options: _defaults__WEBPACK_IMPORTED_MODULE_3__.default,\n input: null,\n\n get dpContainer() {\n this._dpContainer = this._dpContainer || (0,_utils__WEBPACK_IMPORTED_MODULE_0__.createElement)(_constants__WEBPACK_IMPORTED_MODULE_1__.CONTAINER_ELM_QUERY, this.options.container);\n return this._dpContainer;\n },\n\n get today() {\n this._today = this._today || (0,_utils__WEBPACK_IMPORTED_MODULE_0__.jalaliToday)();\n return this._today;\n },\n\n get valueDate() {\n this._valueDate = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clon)(this.input.value);\n\n if ((0,_utils__WEBPACK_IMPORTED_MODULE_0__.isString)(this._valueDate)) {\n if ((0,_utils__WEBPACK_IMPORTED_MODULE_0__.isValidDateString)(this._valueDate, this.options.separatorChar)) {\n this._valueDate = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getDateFromString)(this._valueDate, this.options.separatorChar);\n } else {\n this._valueDate = {};\n }\n }\n\n return this._valueDate;\n },\n\n get initDate() {\n this._initDate = this._initDate || (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clon)(this.valueDate);\n\n if ((0,_utils__WEBPACK_IMPORTED_MODULE_0__.isPlainObject)(this._initDate)) {\n this._initDate = this.options.initDate || (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clon)(this.today);\n }\n\n if ((0,_utils__WEBPACK_IMPORTED_MODULE_0__.isString)(this._initDate) && (0,_utils__WEBPACK_IMPORTED_MODULE_0__.isValidDateString)(this._initDate, this.options.separatorChar)) {\n this._initDate = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getDateFromString)(this._initDate, this.options.separatorChar);\n }\n\n return (0,_utils__WEBPACK_IMPORTED_MODULE_0__.normalizeMinMaxDate)(this._initDate.year, this._initDate.month, this._initDate.day, this._initDate, this.options.minDate, this.options.maxDate);\n },\n\n _draw: _draw__WEBPACK_IMPORTED_MODULE_2__.default,\n show: function show(input) {\n this._initDate = null;\n this._valueDate = null;\n this.input = input;\n\n this._draw();\n\n this.dpContainer.style.visibility = _constants__WEBPACK_IMPORTED_MODULE_1__.STYLE_VISIBILITY_VISIBLE;\n this.dpContainer.style.display = _constants__WEBPACK_IMPORTED_MODULE_1__.STYLE_DISPLAY_BLOCK;\n this.dpContainer.style.zIndex = this.options.zIndex;\n this.setPosition();\n setScrollOnParent(input);\n setReadOnly(input, this.options);\n },\n hide: function hide() {\n this.dpContainer.style.visibility = _constants__WEBPACK_IMPORTED_MODULE_1__.STYLE_VISIBILITY_HIDDEN;\n this.dpContainer.style.display = _constants__WEBPACK_IMPORTED_MODULE_1__.STYLE_DISPLAY_HIDDEN;\n },\n setPosition: function setPosition() {\n if (this.dpContainer.style.visibility !== _constants__WEBPACK_IMPORTED_MODULE_1__.STYLE_VISIBILITY_VISIBLE) {\n return;\n }\n\n var inputBounds = this.input.getBoundingClientRect();\n var inputHeight = inputBounds.height;\n var left = inputBounds.left;\n var top = inputBounds.top + inputHeight;\n var windowWidth = window.document.body.offsetWidth;\n var dpContainerWidth = this.dpContainer.offsetWidth;\n var dpContainerHeight = this.dpContainer.offsetHeight;\n\n if (left + dpContainerWidth >= windowWidth) {\n left -= left + dpContainerWidth - (windowWidth + 10);\n }\n\n if (top - inputHeight >= dpContainerHeight && top + dpContainerHeight >= window.innerHeight) {\n top -= dpContainerHeight + inputHeight;\n }\n\n this.dpContainer.style.position = _constants__WEBPACK_IMPORTED_MODULE_1__.STYLE_POSITION_FIXED;\n this.dpContainer.style.left = left + \"px\";\n this.dpContainer.style.top = top + \"px\";\n },\n setValue: function setValue(year, month, day) {\n this._valueDate.year = year;\n this._valueDate.month = month;\n this._valueDate.day = day;\n this.hide();\n\n if (isNaN(year + month + day)) {\n this.input.value = \"\";\n } else {\n this.input.value = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getDateToString)(year, month, day, this.options.separatorChar);\n }\n\n (0,_utils__WEBPACK_IMPORTED_MODULE_0__.triggerEvent)(this.input, _constants__WEBPACK_IMPORTED_MODULE_1__.EVENT_CHANGE_INPUT_STR);\n },\n increaseMonth: function increaseMonth() {\n var isLastMonth = this._initDate.month === 12;\n\n if (this.options.changeMonthRotateYear && isLastMonth) {\n this.increaseYear();\n }\n\n this.monthChange(isLastMonth ? 1 : this._initDate.month + 1);\n },\n decreaseMonth: function decreaseMonth() {\n var isFirstMonth = this._initDate.month === 1;\n\n if (this.options.changeMonthRotateYear && isFirstMonth) {\n this.decreaseYear();\n }\n\n this.monthChange(isFirstMonth ? 12 : this._initDate.month - 1);\n },\n monthChange: function monthChange(month) {\n this._initDate = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.normalizeMinMaxDate)(this._initDate.year, month, this._initDate.day, this._initDate, this.options.minDate, this.options.maxDate);\n\n this._draw();\n },\n increaseYear: function increaseYear() {\n this.yearChange(this._initDate.year + 1);\n },\n decreaseYear: function decreaseYear() {\n this.yearChange(this._initDate.year - 1);\n },\n yearChange: function yearChange(year) {\n this._initDate = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.normalizeMinMaxDate)(year, this._initDate.month, this._initDate.day, this._initDate, this.options.minDate, this.options.maxDate);\n\n this._draw();\n }\n};\n\nvar getDefaultFromAttr = function getDefaultFromAttr(attrName, sepChar) {\n var _jalaliDatepicker$inp;\n\n var dateAttrVal = (_jalaliDatepicker$inp = jalaliDatepicker.input) === null || _jalaliDatepicker$inp === void 0 ? void 0 : _jalaliDatepicker$inp.getAttribute(attrName);\n\n if (dateAttrVal === _constants__WEBPACK_IMPORTED_MODULE_1__.MIN_MAX_TODAY_SETTING) {\n dateAttrVal = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clon)(jalaliDatepicker.today);\n } else if ((0,_utils__WEBPACK_IMPORTED_MODULE_0__.isString)(dateAttrVal) && (0,_utils__WEBPACK_IMPORTED_MODULE_0__.isValidDateString)(dateAttrVal, sepChar)) {\n dateAttrVal = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getDateFromString)(dateAttrVal, sepChar);\n } else {\n dateAttrVal = {};\n }\n\n return dateAttrVal;\n};\n\nvar normalizeOptions = function normalizeOptions(options) {\n if (options.minDate === _constants__WEBPACK_IMPORTED_MODULE_1__.MIN_MAX_TODAY_SETTING) options.minDate = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clon)(jalaliDatepicker.today);\n if (options.maxDate === _constants__WEBPACK_IMPORTED_MODULE_1__.MIN_MAX_TODAY_SETTING) options.maxDate = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.clon)(jalaliDatepicker.today);\n\n if (options.minDate === _constants__WEBPACK_IMPORTED_MODULE_1__.MIN_MAX_ATTR_SETTING) {\n delete options.minDate;\n window.Object.defineProperty(options, \"minDate\", {\n get: function get() {\n return getDefaultFromAttr(_constants__WEBPACK_IMPORTED_MODULE_1__.MIN_MAX_ATTR_SETTING_MIN_ATTR_NAME, options.separatorChar);\n }\n });\n }\n\n if (options.maxDate === _constants__WEBPACK_IMPORTED_MODULE_1__.MIN_MAX_ATTR_SETTING) {\n delete options.maxDate;\n window.Object.defineProperty(options, \"maxDate\", {\n get: function get() {\n return getDefaultFromAttr(_constants__WEBPACK_IMPORTED_MODULE_1__.MIN_MAX_ATTR_SETTING_MAX_ATTR_NAME, options.separatorChar);\n }\n });\n }\n\n return options;\n};\n\nfunction documentClick(e) {\n if (jalaliDatepicker.dpContainer.style.visibility !== _constants__WEBPACK_IMPORTED_MODULE_1__.STYLE_VISIBILITY_VISIBLE || (0,_utils__WEBPACK_IMPORTED_MODULE_0__.containsDom)(jalaliDatepicker.dpContainer, e) || (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getEventTarget)(e) === jalaliDatepicker.input) {\n return;\n }\n\n jalaliDatepicker.hide();\n}\n\nfunction windowResize() {\n jalaliDatepicker.setPosition();\n}\n\nfunction setScrollOnParent(input) {\n (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getScrollParent)(input).addEventListener(\"scroll\", function () {\n jalaliDatepicker.setPosition();\n }, {\n passive: true\n });\n}\n\nfunction setReadOnly(input, options) {\n if (options.autoReadOnlyInput && !input.readOnly) input.readOnly = true;\n}\n\nfunction addEventListenerOnInputs(querySelector) {\n Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;\n document.body.addEventListener(_constants__WEBPACK_IMPORTED_MODULE_1__.EVENT_FOCUS_STR, function (e) {\n if (e.target && e.target.matches(querySelector)) {\n jalaliDatepicker.show(e.target);\n }\n });\n}\n\nwindow.jalaliDatepicker = {\n startWatch: function startWatch() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n jalaliDatepicker.init(options);\n },\n show: function show(input) {\n jalaliDatepicker.show(input);\n },\n hide: function hide() {\n jalaliDatepicker.hide();\n }\n};\n\n//# sourceURL=webpack://@majidh1/jalalidatepicker/./src/index.js?"); | ||
@@ -52,0 +52,0 @@ /***/ }), |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";!function(){var t="jdp",n="".concat(t,"-container"),e="div.".concat(t,"-years"),i="div.".concat(t,"-year"),a="div.".concat(t,"-months"),o="div.".concat(t,"-month"),r="div.".concat(t,"-days"),s="div.".concat(t,"-day"),h="div.".concat(t,"-day-name"),u="div.".concat(t,"-icon-plus"),c="div.".concat(t,"-icon-minus"),d="div.".concat(t,"-footer"),p="div.".concat(t,"-btn-today"),y="div.".concat(t,"-btn-empty"),l="not-in-range",f="".concat(t,":change"),m="click",v="focusin",D="today",g="attr",w=("data-".concat(t),"visible"),_=void 0;function C(t){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var b,x,I=Number.isNaN||window.isNaN,M=function(t){return void 0===t},E=function(t){return"function"==typeof t},S=function(t){return"string"==typeof t},O=function(t){return JSON.parse(JSON.stringify(t))},H=function(t){function n(t,n){return~~(t/n)}for(var e,i=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178],a=i.length,o=0,r=-14,s=i[0],h=1;h<a;h+=1){var u=i[h];if(o=u-s,t<u)break;r=r+8*n(o,33)+n(N(o,33),4),s=u}var c=t-s;return o-c<6&&(c=c-o+33*n(o+4,33)),-1===(e=N(N(c+1,33)-1,4))&&(e=4),0===e},N=function(t,n){return window.Math.abs(t-n*window.Math.floor(t/n))},Y=function(t,n){return t<8?31*(t-1)+n:186+30*(t-7)+n},j=function(t,n,e){return N(function(t,n,e,i,a,o){for(var r=Y(a,o)-Y(n,e),s=t<i?i:t,h=t<i?t:i;h<s;h++)H(h)?r+=t<i?366:-366:r+=t<i?365:-365;return r}(1392,3,25,t,n,e),7)},k=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,e=String(Math.abs(t)),i=e.length,a="";for(t<0&&(a+="-");i<n;)i+=1,a+="0";return a+e},P=function(t){if(!t||!t.constructor||t.nodeType)return!1;try{return"{}"===JSON.stringify(t)}catch(t){return!0}},L=function t(){for(var n,e,i,a,o,r=arguments.length,s=new Array(r),h=0;h<r;h++)s[h]=arguments[h];var u=s[0]||{},c=1,d=s.length,p=!1;for("boolean"==typeof u&&(p=u,u=s[c]||{},c+=1),"object"!==C(u)&&E(u)&&(u={}),c===d&&(u=_,c-=1);c<d;c++)if(n=s[c],!M(n)&&null!==n)for(var y=0;y<window.Object.keys(n).length;y++){var l=window.Object.keys(n)[y];if(Object.prototype.hasOwnProperty.call(n,l)){if(i=n[l],"__proto__"===l||u===i)return!0;a=Array.isArray(i),p&&i&&(P(i)||a)?(e=u[l],o=a&&!Array.isArray(e)?[]:a||P(e)?e:{},u[l]=t(p,o,i)):M(i)||(u[l]=i)}}return u},z=function(t,n,e,i,a){var o=t.split(".");t=o.shift()||"div";var r=o,s=window.document.createElement(t);return S(n)?window.document.querySelector(n).appendChild(s):n.appendChild(s),r.length&&(s.className=r.join(" ")),e&&i&&A(s,e,i),M(a)||B(s,a),s},A=function(t,n,e){for(var i=n.split(" "),a=0,o=i.length;a<o;a++)t.addEventListener(i[a],e,!1)},B=function(t,n){t.innerHTML=n},T=function(t,n,e,i,a,o){return I(t)||t<1e3||t>1999?t=i.year:t<a.year?t=a.year:t>o.year&&(t=o.year),I(n)||n<1||n>12?n=i.month:t<=a.year&&n<a.month?n=a.month:t>=o.year&&n>o.month&&(n=o.month),I(e)||e<1?e=i.day:n<=a.month&&e<a.day?e=a.day:n>=o.month&&e>o.day&&(e=o.day),{year:parseInt(t),month:parseInt(n),day:parseInt(e)}},R=function(t,n){if(!t)return!1;var e=t.split(n);return 3===e.length&&4===e[0].length&&2===e[1].length&&2===e[2].length},V=function(t,n){var e=t.split(n);return{year:parseInt(e[0]),month:parseInt(e[1]),day:parseInt(e[2])}},J=function t(n){if(["html","body","#document"].indexOf((n.nodeName||"").toLowerCase())>=0)return window;if(n instanceof HTMLElement){var e=window.getComputedStyle(n),i=e.overflow,a=e.overflowX,o=e.overflowY;if(/auto|scroll|overlay/.test(i+o+a))return n}return t(n.parentNode)},W=function(t){var n=document.createEvent("Event");return n.initEvent(t,!0,!0),n},q=function(t){return 6===t?".".concat("last-week"):""},F=function(t,n){z(u+(n?Z.options.maxDate.year===Z.initDate.year?".".concat(l):"":Z.options.maxDate.year===Z.initDate.year&&Z.options.maxDate.month===Z.initDate.month?".".concat(l):""),t,m,n?function(){Z.increaseYear()}:function(){Z.increaseMonth()},Z.options.plusHtml)},X=function(t,n){z(c+(n?Z.options.minDate.year===Z.initDate.year?".".concat(l):"":Z.options.minDate.year===Z.initDate.year&&Z.options.minDate.month===Z.initDate.month?".".concat(l):""),t,m,n?function(){Z.decreaseYear()}:function(){Z.decreaseMonth()},Z.options.minusHtml)},G=function(){var t=z(e,Z.dpContainer);F(t,!0);var n=z(i,t);X(t,!0);var a=Z.options.useDropDownYears,o=z(a?"select":"input",n,"keyup change",(function(t){t.target.value<1e3||t.target.value>2e3||Z.yearChange(t.target.value)}));if(a)for(var r=function(t){function n(t){return 100*Math.round(t/100)}var e=t.initDate.year;return{min:t.options.minDate.year||n(e-200),max:t.options.maxDate.year||n(e+200)}}(Z),s=r.min;s<=r.max;s++){var h=z("option",o);h.value=s,h.text=s,h.selected=s===Z.initDate.year}else o.tabIndex=-1,o.value=Z.initDate.year,o.type="number"},K=function(){var t=z(a,Z.dpContainer);F(t,!1);var n=z(o,t);X(t,!1);var e=z("select",n,"change",(function(t){Z.monthChange(t.target.value)}));e.tabIndex=-1;for(var i=function(t){var n=t.initDate.year,e=t.options.minDate,i=t.options.maxDate,a=[],o=1,r=12;n===e.year?(o=e.month,n===i.year&&(r=i.month)):n===i.year&&(o=1,r=i.month);for(var s=o;s<=r;s++)a.push(s);return a}(Z),r=Z.options.months,s=0;s<i.length;s++){var h=z("option",e);h.value=i[s],h.text=r[i[s]-1],h.selected=i[s]===Z.initDate.month}},Q=function(){for(var t=z(r,Z.dpContainer),n=0;n<7;n++)z(h+q(n),t,null,null,Z.options.days[n]);for(var e,i,a=(e=Z.initDate.year,i=Z.initDate.month,[0,31,31,31,31,31,31,30,30,30,30,30,H(e)?30:29][i]),o=j(Z.initDate.year,Z.initDate.month,1),u=7*Math.ceil((o+a)/7)-1,c=1,d=function(n){var e=j(Z.initDate.year,Z.initDate.month,c),i=function(t,n){var e=t.initDate,i=t.options.minDate,a=t.options.maxDate;return!(!P(i)||!P(a))||(i.year===a.year&&i.month===a.month?n>=i.day&&n<=a.day:e.year===i.year&&e.month===i.month?n>=i.day:e.year!==a.year||e.month!==a.month||n<=a.day)}(Z,c);if(c<=e&&n<e||c>a)return z(s,t),"continue";if(!i)return z(s,t),c+=1,"continue";var o=q(e);Z.valueDate.day===c&&Z.valueDate.year===Z.initDate.year&&Z.valueDate.month===Z.initDate.month&&(o+=".".concat("selected")),Z.today.day===c&&Z.today.year===Z.initDate.year&&Z.today.month===Z.initDate.month&&(o+=".".concat("today"));var r=z(s+o,t,null,null,c);r.day=c,r.addEventListener(m,(function(){Z.setValue(Z.initDate.year,Z.initDate.month,r.day)})),c+=1},p=0;p<=u;p++)d(p)},U=function(){var t=z(d,Z.dpContainer);Z.options.showTodayBtn&&z(p,t,m,(function(){Z.setValue(Z.today.year,Z.today.month,Z.today.day)}),"امروز"),Z.options.showEmptyBtn&&z(y,t,m,(function(){Z.setValue()}),"خالی")},Z=null;var $={days:["ش","ی","د","س","چ","پ","ج"],months:["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],initDate:null,minDate:{},maxDate:{},separatorChar:"/",zIndex:1e3,container:"body",dpContainer:null,selector:"input[data-jdp]",autoShow:!0,autoHide:!0,plusHtml:'<svg viewBox="0 0 1024 1024"><g><path d="M810 554h-256v256h-84v-256h-256v-84h256v-256h84v256h256v84z"></path></g></svg>',minusHtml:'<svg viewBox="0 0 1024 1024"><g><path d="M810 554h-596v-84h596v84z"></path></g></svg>',changeMonthRotateYear:!1,showTodayBtn:!0,showEmptyBtn:!0,autoReadOnlyInput:/iphone|ipod|android|ie|blackberry|fennec/.test(null===(b=window.navigator)||void 0===b||null===(x=b.userAgent)||void 0===x?void 0:x.toLowerCase()),useDropDownYears:!0},tt={init:function(t){var n;this.options=L($,t),this.options=et(this.options),window.onresize=at,this.options.autoHide&&(document.body.onclick=it),this.options.autoShow&&(n=this.options.selector,Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector,document.body.addEventListener(v,(function(t){t.target&&t.target.matches(n)&&tt.show(t.target)})))},options:$,input:null,get dpContainer(){return this._dpContainer=this._dpContainer||z(n,this.options.container),this._dpContainer},get today(){return this._today=this._today||function(){var t,n,e=new Date,i=parseInt(e.getFullYear()),a=parseInt(e.getMonth())+1,o=parseInt(e.getDate());i>1600?(t=979,i-=1600):(t=0,i-=621);var r=a>2?i+1:i;return n=365*i+parseInt((r+3)/4)-parseInt((r+99)/100)+parseInt((r+399)/400)-80+o+[0,31,59,90,120,151,181,212,243,273,304,334][a-1],t+=33*parseInt(n/12053),n%=12053,t+=4*parseInt(n/1461),(n%=1461)>365&&(t+=parseInt((n-1)/365),n=(n-1)%365),{year:t,month:n<186?1+parseInt(n/31):7+parseInt((n-186)/30),day:1+(n<186?n%31:(n-186)%30)}}(),this._today},get valueDate(){return this._valueDate=O(this.input.value),S(this._valueDate)&&(R(this._valueDate,this.options.separatorChar)?this._valueDate=V(this._valueDate,this.options.separatorChar):this._valueDate={}),this._valueDate},get initDate(){return this._initDate=this._initDate||O(this.valueDate),P(this._initDate)&&(this._initDate=this.options.initDate||O(this.today)),S(this._initDate)&&R(this._initDate,this.options.separatorChar)&&(this._initDate=V(this._initDate,this.options.separatorChar)),T(this._initDate.year,this._initDate.month,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate)},_draw:function(){B((Z=this).dpContainer,""),G(),K(),Q(),U()},show:function(t){this._initDate=null,this._valueDate=null,this.input=t,this._draw(),this.dpContainer.style.visibility=w,this.dpContainer.style.display="block",this.dpContainer.style.zIndex=this.options.zIndex,this.setPosition(),function(t){J(t).addEventListener("scroll",(function(){tt.setPosition()}),{passive:!0})}(t),function(t,n){n.autoReadOnlyInput&&!t.readOnly&&(t.readOnly=!0)}(t,this.options)},hide:function(){this.dpContainer.style.visibility="hidden",this.dpContainer.style.display="none"},setPosition:function(){if(this.dpContainer.style.visibility===w){var t=this.input.getBoundingClientRect(),n=t.left,e=t.top,i=t.height,a=window.document.body.offsetWidth,o=this.dpContainer.offsetWidth,r=this.dpContainer.offsetHeight;n+o>=a&&(n-=n+o-(a+10)),e>=r&&e+r>=window.innerHeight&&(e-=r+i),this.dpContainer.style.position="fixed",this.dpContainer.style.left=n+"px",this.dpContainer.style.top=e+this.input.offsetHeight+"px"}},setValue:function(t,n,e){var i,a,o,r,s,h;this._valueDate.year=t,this._valueDate.month=n,this._valueDate.day=e,this.hide(),isNaN(t+n+e)?this.input.value="":this.input.value=(i=t,a=n,o=e,r=this.options.separatorChar,i+r+k(a)+r+k(o)),s=this.input,h=f,s&&(s.dispatchEvent(W(h)),h===f&&(s.dispatchEvent(W("change")),s.dispatchEvent(W("input"))))},increaseMonth:function(){var t=12===this._initDate.month;this.options.changeMonthRotateYear&&t&&this.increaseYear(),this.monthChange(t?1:this._initDate.month+1)},decreaseMonth:function(){var t=1===this._initDate.month;this.options.changeMonthRotateYear&&t&&this.decreaseYear(),this.monthChange(t?12:this._initDate.month-1)},monthChange:function(t){this._initDate=T(this._initDate.year,t,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate),this._draw()},increaseYear:function(){this.yearChange(this._initDate.year+1)},decreaseYear:function(){this.yearChange(this._initDate.year-1)},yearChange:function(t){this._initDate=T(t,this._initDate.month,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate),this._draw()}},nt=function(t,n){var e,i=null===(e=tt.input)||void 0===e?void 0:e.getAttribute(t);return i=i===D?O(tt.today):S(i)&&R(i,n)?V(i,n):{}},et=function(t){return t.minDate===D&&(t.minDate=O(tt.today)),t.maxDate===D&&(t.maxDate=O(tt.today)),t.minDate===g&&(delete t.minDate,window.Object.defineProperty(t,"minDate",{get:function(){return nt("data-jdp-min-date",t.separatorChar)}})),t.maxDate===g&&(delete t.maxDate,window.Object.defineProperty(t,"maxDate",{get:function(){return nt("data-jdp-max-date",t.separatorChar)}})),t};function it(t){var n,e,i;tt.dpContainer.style.visibility!==w||(n=tt.dpContainer,(i=(e=t).path||e.composedPath&&e.composedPath()||!1)?-1!==i.indexOf(n):n.outerHTML.indexOf(e.target.outerHTML)>-1)||function(t){try{return E(t.composedPath)?t.composedPath()[0]:t.target}catch(n){return t.target}}(t)===tt.input||tt.hide()}function at(){tt.setPosition()}window.jalaliDatepicker={startWatch:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tt.init(t)},show:function(t){tt.show(t)},hide:function(){tt.hide()}}}()}(); | ||
!function(){"use strict";!function(){var t="jdp",n="".concat(t,"-container"),e="div.".concat(t,"-years"),i="div.".concat(t,"-year"),a="div.".concat(t,"-months"),o="div.".concat(t,"-month"),r="div.".concat(t,"-days"),s="div.".concat(t,"-day"),h="div.".concat(t,"-day-name"),u="div.".concat(t,"-icon-plus"),c="div.".concat(t,"-icon-minus"),d="div.".concat(t,"-footer"),p="div.".concat(t,"-btn-today"),y="div.".concat(t,"-btn-empty"),l="not-in-range",f="".concat(t,":change"),m="click",v="focusin",D="today",g="attr",w=("data-".concat(t),"visible"),_=void 0;function C(t){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var b,x,I=Number.isNaN||window.isNaN,M=function(t){return void 0===t},E=function(t){return"function"==typeof t},S=function(t){return"string"==typeof t},O=function(t){return JSON.parse(JSON.stringify(t))},N=function(t){function n(t,n){return~~(t/n)}for(var e,i=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178],a=i.length,o=0,r=-14,s=i[0],h=1;h<a;h+=1){var u=i[h];if(o=u-s,t<u)break;r=r+8*n(o,33)+n(Y(o,33),4),s=u}var c=t-s;return o-c<6&&(c=c-o+33*n(o+4,33)),-1===(e=Y(Y(c+1,33)-1,4))&&(e=4),0===e},Y=function(t,n){return window.Math.abs(t-n*window.Math.floor(t/n))},j=function(t,n){return t<8?31*(t-1)+n:186+30*(t-7)+n},H=function(t,n,e){return Y(function(t,n,e,i,a,o){for(var r=j(a,o)-j(n,e),s=t<i?i:t,h=t<i?t:i;h<s;h++)N(h)?r+=t<i?366:-366:r+=t<i?365:-365;return r}(1392,3,25,t,n,e),7)},k=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,e=String(Math.abs(t)),i=e.length,a="";for(t<0&&(a+="-");i<n;)i+=1,a+="0";return a+e},P=function(t){if(!t||!t.constructor||t.nodeType)return!1;try{return"{}"===JSON.stringify(t)}catch(t){return!0}},L=function t(){for(var n,e,i,a,o,r=arguments.length,s=new Array(r),h=0;h<r;h++)s[h]=arguments[h];var u=s[0]||{},c=1,d=s.length,p=!1;for("boolean"==typeof u&&(p=u,u=s[c]||{},c+=1),"object"!==C(u)&&E(u)&&(u={}),c===d&&(u=_,c-=1);c<d;c++)if(n=s[c],!M(n)&&null!==n)for(var y=0;y<window.Object.keys(n).length;y++){var l=window.Object.keys(n)[y];if(Object.prototype.hasOwnProperty.call(n,l)){if(i=n[l],"__proto__"===l||u===i)return!0;a=Array.isArray(i),p&&i&&(P(i)||a)?(e=u[l],o=a&&!Array.isArray(e)?[]:a||P(e)?e:{},u[l]=t(p,o,i)):M(i)||(u[l]=i)}}return u},z=function(t,n,e,i,a){var o=t.split(".");t=o.shift()||"div";var r=o,s=window.document.createElement(t);return S(n)?window.document.querySelector(n).appendChild(s):n.appendChild(s),r.length&&(s.className=r.join(" ")),e&&i&&A(s,e,i),M(a)||B(s,a),s},A=function(t,n,e){for(var i=n.split(" "),a=0,o=i.length;a<o;a++)t.addEventListener(i[a],e,!1)},B=function(t,n){t.innerHTML=n},T=function(t,n,e,i,a,o){return I(t)||t<1e3||t>1999?t=i.year:t<a.year?t=a.year:t>o.year&&(t=o.year),I(n)||n<1||n>12?n=i.month:t<=a.year&&n<a.month?n=a.month:t>=o.year&&n>o.month&&(n=o.month),I(e)||e<1?e=i.day:n<=a.month&&e<a.day?e=a.day:n>=o.month&&e>o.day&&(e=o.day),{year:parseInt(t),month:parseInt(n),day:parseInt(e)}},R=function(t,n){if(!t)return!1;var e=t.split(n);return 3===e.length&&4===e[0].length&&2===e[1].length&&2===e[2].length},V=function(t,n){var e=t.split(n);return{year:parseInt(e[0]),month:parseInt(e[1]),day:parseInt(e[2])}},J=function t(n){if(["html","body","#document"].indexOf((n.nodeName||"").toLowerCase())>=0)return window;if(n instanceof HTMLElement){var e=window.getComputedStyle(n),i=e.overflow,a=e.overflowX,o=e.overflowY;if(/auto|scroll|overlay/.test(i+o+a))return n}return t(n.parentNode)},W=function(t){var n=document.createEvent("Event");return n.initEvent(t,!0,!0),n},q=function(t){return 6===t?".".concat("last-week"):""},F=function(t,n){z(u+(n?Z.options.maxDate.year===Z.initDate.year?".".concat(l):"":Z.options.maxDate.year===Z.initDate.year&&Z.options.maxDate.month===Z.initDate.month?".".concat(l):""),t,m,n?function(){Z.increaseYear()}:function(){Z.increaseMonth()},Z.options.plusHtml)},X=function(t,n){z(c+(n?Z.options.minDate.year===Z.initDate.year?".".concat(l):"":Z.options.minDate.year===Z.initDate.year&&Z.options.minDate.month===Z.initDate.month?".".concat(l):""),t,m,n?function(){Z.decreaseYear()}:function(){Z.decreaseMonth()},Z.options.minusHtml)},G=function(){var t=z(e,Z.dpContainer);F(t,!0);var n=z(i,t);X(t,!0);var a=Z.options.useDropDownYears,o=z(a?"select":"input",n,"keyup change",(function(t){t.target.value<1e3||t.target.value>2e3||Z.yearChange(t.target.value)}));if(a)for(var r=function(t){function n(t){return 100*Math.round(t/100)}var e=t.initDate.year;return{min:t.options.minDate.year||n(e-200),max:t.options.maxDate.year||n(e+200)}}(Z),s=r.min;s<=r.max;s++){var h=z("option",o);h.value=s,h.text=s,h.selected=s===Z.initDate.year}else o.tabIndex=-1,o.value=Z.initDate.year,o.type="number"},K=function(){var t=z(a,Z.dpContainer);F(t,!1);var n=z(o,t);X(t,!1);var e=z("select",n,"change",(function(t){Z.monthChange(t.target.value)}));e.tabIndex=-1;for(var i=function(t){var n=t.initDate.year,e=t.options.minDate,i=t.options.maxDate,a=[],o=1,r=12;n===e.year?(o=e.month,n===i.year&&(r=i.month)):n===i.year&&(o=1,r=i.month);for(var s=o;s<=r;s++)a.push(s);return a}(Z),r=Z.options.months,s=0;s<i.length;s++){var h=z("option",e);h.value=i[s],h.text=r[i[s]-1],h.selected=i[s]===Z.initDate.month}},Q=function(){for(var t=z(r,Z.dpContainer),n=0;n<7;n++)z(h+q(n),t,null,null,Z.options.days[n]);for(var e,i,a=(e=Z.initDate.year,i=Z.initDate.month,[0,31,31,31,31,31,31,30,30,30,30,30,N(e)?30:29][i]),o=H(Z.initDate.year,Z.initDate.month,1),u=7*Math.ceil((o+a)/7)-1,c=1,d=function(n){var e=H(Z.initDate.year,Z.initDate.month,c),i=function(t,n){var e=t.initDate,i=t.options.minDate,a=t.options.maxDate;return!(!P(i)||!P(a))||(i.year===a.year&&i.month===a.month?n>=i.day&&n<=a.day:e.year===i.year&&e.month===i.month?n>=i.day:e.year!==a.year||e.month!==a.month||n<=a.day)}(Z,c);if(c<=e&&n<e||c>a)return z(s,t),"continue";if(!i)return z(s,t),c+=1,"continue";var o=q(e);Z.valueDate.day===c&&Z.valueDate.year===Z.initDate.year&&Z.valueDate.month===Z.initDate.month&&(o+=".".concat("selected")),Z.today.day===c&&Z.today.year===Z.initDate.year&&Z.today.month===Z.initDate.month&&(o+=".".concat("today"));var r=z(s+o,t,null,null,c);r.day=c,r.addEventListener(m,(function(){Z.setValue(Z.initDate.year,Z.initDate.month,r.day)})),c+=1},p=0;p<=u;p++)d(p)},U=function(){var t=z(d,Z.dpContainer);Z.options.showTodayBtn&&z(p,t,m,(function(){Z.setValue(Z.today.year,Z.today.month,Z.today.day)}),"امروز"),Z.options.showEmptyBtn&&z(y,t,m,(function(){Z.setValue()}),"خالی")},Z=null;var $={days:["ش","ی","د","س","چ","پ","ج"],months:["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],initDate:null,minDate:{},maxDate:{},separatorChar:"/",zIndex:1e3,container:"body",dpContainer:null,selector:"input[data-jdp]",autoShow:!0,autoHide:!0,plusHtml:'<svg viewBox="0 0 1024 1024"><g><path d="M810 554h-256v256h-84v-256h-256v-84h256v-256h84v256h256v84z"></path></g></svg>',minusHtml:'<svg viewBox="0 0 1024 1024"><g><path d="M810 554h-596v-84h596v84z"></path></g></svg>',changeMonthRotateYear:!1,showTodayBtn:!0,showEmptyBtn:!0,autoReadOnlyInput:/iphone|ipod|android|ie|blackberry|fennec/.test(null===(b=window.navigator)||void 0===b||null===(x=b.userAgent)||void 0===x?void 0:x.toLowerCase()),useDropDownYears:!0},tt={init:function(t){var n;this.options=L($,t),this.options=et(this.options),window.onresize=at,this.options.autoHide&&(document.body.onclick=it),this.options.autoShow&&(n=this.options.selector,Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector,document.body.addEventListener(v,(function(t){t.target&&t.target.matches(n)&&tt.show(t.target)})))},options:$,input:null,get dpContainer(){return this._dpContainer=this._dpContainer||z(n,this.options.container),this._dpContainer},get today(){return this._today=this._today||function(){var t,n,e=new Date,i=parseInt(e.getFullYear()),a=parseInt(e.getMonth())+1,o=parseInt(e.getDate());i>1600?(t=979,i-=1600):(t=0,i-=621);var r=a>2?i+1:i;return n=365*i+parseInt((r+3)/4)-parseInt((r+99)/100)+parseInt((r+399)/400)-80+o+[0,31,59,90,120,151,181,212,243,273,304,334][a-1],t+=33*parseInt(n/12053),n%=12053,t+=4*parseInt(n/1461),(n%=1461)>365&&(t+=parseInt((n-1)/365),n=(n-1)%365),{year:t,month:n<186?1+parseInt(n/31):7+parseInt((n-186)/30),day:1+(n<186?n%31:(n-186)%30)}}(),this._today},get valueDate(){return this._valueDate=O(this.input.value),S(this._valueDate)&&(R(this._valueDate,this.options.separatorChar)?this._valueDate=V(this._valueDate,this.options.separatorChar):this._valueDate={}),this._valueDate},get initDate(){return this._initDate=this._initDate||O(this.valueDate),P(this._initDate)&&(this._initDate=this.options.initDate||O(this.today)),S(this._initDate)&&R(this._initDate,this.options.separatorChar)&&(this._initDate=V(this._initDate,this.options.separatorChar)),T(this._initDate.year,this._initDate.month,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate)},_draw:function(){B((Z=this).dpContainer,""),G(),K(),Q(),U()},show:function(t){this._initDate=null,this._valueDate=null,this.input=t,this._draw(),this.dpContainer.style.visibility=w,this.dpContainer.style.display="block",this.dpContainer.style.zIndex=this.options.zIndex,this.setPosition(),function(t){J(t).addEventListener("scroll",(function(){tt.setPosition()}),{passive:!0})}(t),function(t,n){n.autoReadOnlyInput&&!t.readOnly&&(t.readOnly=!0)}(t,this.options)},hide:function(){this.dpContainer.style.visibility="hidden",this.dpContainer.style.display="none"},setPosition:function(){if(this.dpContainer.style.visibility===w){var t=this.input.getBoundingClientRect(),n=t.height,e=t.left,i=t.top+n,a=window.document.body.offsetWidth,o=this.dpContainer.offsetWidth,r=this.dpContainer.offsetHeight;e+o>=a&&(e-=e+o-(a+10)),i-n>=r&&i+r>=window.innerHeight&&(i-=r+n),this.dpContainer.style.position="fixed",this.dpContainer.style.left=e+"px",this.dpContainer.style.top=i+"px"}},setValue:function(t,n,e){var i,a,o,r,s,h;this._valueDate.year=t,this._valueDate.month=n,this._valueDate.day=e,this.hide(),isNaN(t+n+e)?this.input.value="":this.input.value=(i=t,a=n,o=e,r=this.options.separatorChar,i+r+k(a)+r+k(o)),s=this.input,h=f,s&&(s.dispatchEvent(W(h)),h===f&&(s.dispatchEvent(W("change")),s.dispatchEvent(W("input"))))},increaseMonth:function(){var t=12===this._initDate.month;this.options.changeMonthRotateYear&&t&&this.increaseYear(),this.monthChange(t?1:this._initDate.month+1)},decreaseMonth:function(){var t=1===this._initDate.month;this.options.changeMonthRotateYear&&t&&this.decreaseYear(),this.monthChange(t?12:this._initDate.month-1)},monthChange:function(t){this._initDate=T(this._initDate.year,t,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate),this._draw()},increaseYear:function(){this.yearChange(this._initDate.year+1)},decreaseYear:function(){this.yearChange(this._initDate.year-1)},yearChange:function(t){this._initDate=T(t,this._initDate.month,this._initDate.day,this._initDate,this.options.minDate,this.options.maxDate),this._draw()}},nt=function(t,n){var e,i=null===(e=tt.input)||void 0===e?void 0:e.getAttribute(t);return i=i===D?O(tt.today):S(i)&&R(i,n)?V(i,n):{}},et=function(t){return t.minDate===D&&(t.minDate=O(tt.today)),t.maxDate===D&&(t.maxDate=O(tt.today)),t.minDate===g&&(delete t.minDate,window.Object.defineProperty(t,"minDate",{get:function(){return nt("data-jdp-min-date",t.separatorChar)}})),t.maxDate===g&&(delete t.maxDate,window.Object.defineProperty(t,"maxDate",{get:function(){return nt("data-jdp-max-date",t.separatorChar)}})),t};function it(t){var n,e,i;tt.dpContainer.style.visibility!==w||(n=tt.dpContainer,(i=(e=t).path||e.composedPath&&e.composedPath()||!1)?-1!==i.indexOf(n):n.outerHTML.indexOf(e.target.outerHTML)>-1)||function(t){try{return E(t.composedPath)?t.composedPath()[0]:t.target}catch(n){return t.target}}(t)===tt.input||tt.hide()}function at(){tt.setPosition()}window.jalaliDatepicker={startWatch:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tt.init(t)},show:function(t){tt.show(t)},hide:function(){tt.hide()}}}()}(); |
@@ -9,3 +9,3 @@ { | ||
"main": "dist/jalalidatepicker.min.js", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"keywords": [ | ||
@@ -12,0 +12,0 @@ "date", |
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
76838