|
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-date-object");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(e),a=r(t);function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){l(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function p(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function c(e){return Array.isArray(e)}function s(e,t){var r=[];return["left","right"].includes(e)?(t.left&&r.push("rmdp-border-left"),t.right&&r.push("rmdp-border-right")):(t.top&&r.push("rmdp-border-top"),t.bottom&&r.push("rmdp-border-bottom")),r.join(" ")}var u=["state","setState","position","registerListener","calendarProps","datePickerProps","handleChange","nodes","Calendar","DatePicker","handlePropsChange","handleFocusedDate"];!function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===r&&n.firstChild?n.insertBefore(a,n.firstChild):n.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}(".rmdp-panel{min-width:125px}.rmdp-panel-body{left:0;list-style:none;margin:0;overflow:auto;padding:0 5px;position:absolute;right:0;text-align:center}.rmdp-panel-body li{border-radius:3px;box-shadow:0 0 2px #8798ad;color:#fff;display:flex;margin:4px 1px;position:relative}.rmdp-panel-body li,.rmdp-panel-body li.bg-blue{background-color:#0074d9}.rmdp-panel-body li.bg-red{background-color:#ea0034}.rmdp-panel-body li.bg-green{background-color:#009688}.rmdp-panel-body li.bg-yellow{background-color:#fad817}.rmdp-panel-body li.rmdp-focused{box-shadow:0 0 2px 1px #8798ad}.rmdp-panel-body span{font-size:15px;line-height:23px;margin:0 5px}.rmdp-panel-body li .b-deselect{align-items:center;border:none;border-radius:50%;cursor:pointer;display:inline-flex;font-family:Arial!important;font-size:16px;height:12px;justify-content:center;line-height:5px;padding:0;position:absolute;right:5px;top:52%;transform:translateY(-50%) rotate(45deg);width:12px}.rmdp-panel-body li .b-deselect:focus{outline:none}.rmdp-panel-header{color:#000;font-size:14px;height:38px;line-height:37px;margin-bottom:5px;margin-top:8px}.rmdp-panel-body::-webkit-scrollbar{height:7px;width:7px}.rmdp-panel-body::-webkit-scrollbar-thumb{background:#0074d9;border-radius:3px}.rmdp-panel-body::-webkit-scrollbar-thumb:hover{background:#0263b8}.rmdp-rtl .rmdp-panel-body li .b-deselect{left:5px;right:unset}.rmdp-flat .rmdp-panel-header{border-bottom:none;margin-top:8px}.rmdp-flat .rmdp-panel-body li{border-radius:0}@media (max-height:400px),(max-width:400px){.rmdp-panel{min-width:103px}.rmdp-panel-body{padding:0 2px}.rmdp-panel-body li{font-size:12px;margin:4px}.rmdp-panel-header{font-size:12px;height:32px;line-height:32px}.rmdp-panel-body span{font-size:12px}}");var f=["state","setState","position","nodes","handleChange","eachDaysInRange","sort","style","className","onClickDate","removeButton","header","markFocused","focusedClassName","handleFocusedDate","formatFunction"];exports.default=function(e){var t=e.state,r=e.setState,o=e.position,l=e.nodes,m=e.handleChange,b=e.eachDaysInRange,h=e.sort,g=e.style,y=void 0===g?{}:g,v=e.className,x=void 0===v?"":v,O=e.onClickDate,w=e.removeButton,j=void 0===w||w,k=e.header,P=e.markFocused,C=e.focusedClassName,D=void 0===C?"":C,E=e.handleFocusedDate,N=e.formatFunction,S=p(e,f),F=[],z=t.multiple,A=t.range,B=t.inRangeDates,R=t.selectedDate,T=t.date.locale,_=["rmdp-panel",o,s(o,l)];if(T=T.name.split("_")[1],z||A&&!b)F=(B||R).map((function(e,t){return{date:e,format:e.format(),index:t}}));else if(A&&b){var I=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;if(!Array.isArray(e))return[];var r=e[0],n=e[e.length-1],o=[];if(!(r instanceof a.default&&n instanceof a.default&&r.isValid&&n.isValid)||r>n)return[];for(r=new a.default(r),n=new a.default(n);r<=n;r.day++)o.push(t?r.toDate():new a.default(r));return o}(B||R);F=I.map((function(e,t){return{date:0===t||t===I.length-1?e:void 0,format:e.format(),index:t}}))}else R&&!c(R)&&(F=[{date:R,format:R.format(),index:0}]);return z&&"date"===h&&F.sort((function(e,t){return e.date-t.date})),z&&"color"===h&&F.every((function(e){return e.date.color}))&&F.sort((function(e,t){return e.date.color<t.date.color?-1:e.date.color>t.date.color?1:0})),["fa","ar"].includes(function(e){return e&&e.name?e.name.split("_")[1]:""}(T))&&_.push("rmdp-rtl"),n.default.createElement("div",i({className:"".concat(_.join(" ")," ").concat(x),style:d({display:"grid",gridTemplateRows:"auto 1fr"},y)},function(e){return e.state,e.setState,e.position,e.registerListener,e.calendarProps,e.datePickerProps,e.handleChange,e.nodes,e.Calendar,e.DatePicker,e.handlePropsChange,e.handleFocusedDate,p(e,u)}(S)),n.default.createElement("div",{className:"rmdp-panel-header"},k||{en:"Dates",fa:"تاریخ ها",ar:"تواریخ",hi:"खजूर"}[T]),n.default.createElement("div",{style:{position:"relative",overflow:"auto",height:["top","bottom"].includes(o)?"100px":""}},n.default.createElement("ul",{className:"rmdp-panel-body"},c(F)&&F.map((function(e,r){var a,o,l,i,p;return n.default.createElement("li",{key:r,className:"".concat(null!==(a=e.date)&&void 0!==a&&a.color?"bg-".concat(e.date.color):""," ").concat(P&&(null===(o=e.date)||void 0===o||null===(l=o.valueOf)||void 0===l?void 0:l.call(o))===(null===(i=t.focused)||void 0===i||null===(p=i.valueOf)||void 0===p?void 0:p.call(i))?D||"rmdp-focused":""),onClick:function(){return!j&&q(e.date,e.index)}},n.default.createElement("span",{onClick:function(){return j&&q(e.date,e.index)},style:{cursor:e.date?"pointer":"default"}},N?N(e):e.format),e.date&&j&&n.default.createElement("button",{type:"button",className:"b-deselect",onClick:function(){return function(e){var r,n;A||z?n=(r=R.filter((function(t,r){return r!==e}))).find((function(e){var r,n;return e.valueOf()===(null===(r=t.focused)||void 0===r||null===(n=r.valueOf)||void 0===n?void 0:n.call(r))})):(r=null,n=void 0);m(r,d(d({},t),{},{selectedDate:r,focused:n})),L(),E(n)}(e.index)}},"+"))})))));function q(e,n){L(e?R[n]:void 0),e&&(r(d(d({},t),{},{date:new a.default(e),focused:R[n]})),E(R[n]))}function L(e){O instanceof Function&&O(e)}};
|