|
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("react-date-object")):"function"==typeof define&&define.amd?define(["react","react-date-object"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).DatePanel=t(e.React,e.DateObject)}(this,(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(e),o=r(t);function a(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?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(){return(l=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,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}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],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.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"];return function(e){var t=e.state,r=e.setState,a=e.position,i=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,D=e.focusedClassName,C=void 0===D?"":D,E=e.handleFocusedDate,N=e.formatFunction,S=p(e,f),F=[],z=t.multiple,A=t.range,T=t.inRangeDates,R=t.selectedDate,B=t.date.locale,I=["rmdp-panel",a,s(a,i)];if(B=B.name.split("_")[1],z||A&&!b)F=(T||R).map((function(e,t){return{date:e,format:e.format(),index:t}}));else if(A&&b){var q=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],a=[];if(!(r instanceof o.default&&n instanceof o.default&&r.isValid&&n.isValid)||r>n)return[];for(r=new o.default(r),n=new o.default(n);r<=n;r.day++)a.push(t?r.toDate():new o.default(r));return a}(T||R);F=q.map((function(e,t){return{date:0===t||t===q.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]:""}(B))&&I.push("rmdp-rtl"),n.default.createElement("div",l({className:"".concat(I.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:"खजूर"}[B]),n.default.createElement("div",{style:{position:"relative",overflow:"auto",height:["top","bottom"].includes(a)?"100px":""}},n.default.createElement("ul",{className:"rmdp-panel-body"},c(F)&&F.map((function(e,r){var o,a,i,l,p;return n.default.createElement("li",{key:r,className:"".concat(null!==(o=e.date)&&void 0!==o&&o.color?"bg-".concat(e.date.color):""," ").concat(P&&(null===(a=e.date)||void 0===a||null===(i=a.valueOf)||void 0===i?void 0:i.call(a))===(null===(l=t.focused)||void 0===l||null===(p=l.valueOf)||void 0===p?void 0:p.call(l))?C||"rmdp-focused":""),onClick:function(){return!j&&L(e.date,e.index)}},n.default.createElement("span",{onClick:function(){return j&&L(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})),V(),E(n)}(e.index)}},"+"))})))));function L(e,n){V(e?R[n]:void 0),e&&(r(d(d({},t),{},{date:new o.default(e),focused:R[n]})),E(R[n]))}function V(e){O instanceof Function&&O(e)}}}));
|