@r365/react-calendar-timeline
Version:
react-calendar-timeline
8 lines (6 loc) • 19 kB
JavaScript
;var Wt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Et(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function _t(t){t._resizeEventListener=()=>t.resize(),window.addEventListener("resize",t._resizeEventListener)}function Rt(t){window.removeEventListener("resize",t._resizeEventListener)}const Bt={addListener:_t,removeListener:Rt};var xt={exports:{}},Ft=xt.exports={};Ft.forEach=function(t,i){for(var s=0;s<t.length;s++){var r=i(t[s]);if(r)return r}};var mt=xt.exports,$t=function(t){var i=t.stateHandler.getState;function s(l){var d=i(l);return d&&!!d.isDetectable}function r(l){i(l).isDetectable=!0}function u(l){return!!i(l).busy}function g(l,d){i(l).busy=!!d}return{isDetectable:s,markAsDetectable:r,isBusy:u,markBusy:g}},qt=function(t){var i={};function s(l){var d=t.get(l);return d===void 0?[]:i[d]||[]}function r(l,d){var h=t.get(l);i[h]||(i[h]=[]),i[h].push(d)}function u(l,d){for(var h=s(l),c=0,b=h.length;c<b;++c)if(h[c]===d){h.splice(c,1);break}}function g(l){var d=s(l);d&&(d.length=0)}return{get:s,add:r,removeListener:u,removeAllListeners:g}},Ut=function(){var t=1;function i(){return t++}return{generate:i}},Gt=function(t){var i=t.idGenerator,s=t.stateHandler.getState;function r(g){var l=s(g);return l&&l.id!==void 0?l.id:null}function u(g){var l=s(g);if(!l)throw new Error("setId required the element to have a resize detection state.");var d=i.generate();return l.id=d,d}return{get:r,set:u}},Vt=function(t){function i(){}var s={log:i,warn:i,error:i};if(!t&&window.console){var r=function(u,g){u[g]=function(){var d=console[g];if(d.apply)d.apply(console,arguments);else for(var h=0;h<arguments.length;h++)d(arguments[h])}};r(s,"log"),r(s,"warn"),r(s,"error")}return s},kt={exports:{}},Lt=kt.exports={};Lt.isIE=function(t){function i(){var r=navigator.userAgent.toLowerCase();return r.indexOf("msie")!==-1||r.indexOf("trident")!==-1||r.indexOf(" edge/")!==-1}if(!i())return!1;if(!t)return!0;var s=function(){var r,u=3,g=document.createElement("div"),l=g.getElementsByTagName("i");do g.innerHTML="<!--[if gt IE "+ ++u+"]><i></i><![endif]-->";while(l[0]);return u>4?u:r}();return t===s};Lt.isLegacyOpera=function(){return!!window.opera};var zt=kt.exports,Dt={exports:{}},Jt=Dt.exports={};Jt.getOption=Yt;function Yt(t,i,s){var r=t[i];return r==null&&s!==void 0?s:r}var Kt=Dt.exports,gt=Kt,Qt=function(i){i=i||{};var s=i.reporter,r=gt.getOption(i,"async",!0),u=gt.getOption(i,"auto",!0);u&&!r&&(s&&s.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."),r=!0);var g=bt(),l,d=!1;function h(S,T){!d&&u&&r&&g.size()===0&&z(),g.add(S,T)}function c(){for(d=!0;g.size();){var S=g;g=bt(),S.process()}d=!1}function b(S){d||(S===void 0&&(S=r),l&&(N(l),l=null),S?z():c())}function z(){l=m(c)}function N(S){var T=clearTimeout;return T(S)}function m(S){var T=function(P){return setTimeout(P,0)};return T(S)}return{add:h,force:b}};function bt(){var t={},i=0,s=0,r=0;function u(d,h){h||(h=d,d=0),d>s?s=d:d<r&&(r=d),t[d]||(t[d]=[]),t[d].push(h),i++}function g(){for(var d=r;d<=s;d++)for(var h=t[d],c=0;c<h.length;c++){var b=h[c];b()}}function l(){return i}return{add:u,process:g,size:l}}var st="_erd";function Xt(t){return t[st]={},Ct(t)}function Ct(t){return t[st]}function Zt(t){delete t[st]}var te={initState:Xt,getState:Ct,cleanState:Zt},Z=zt,ee=function(t){t=t||{};var i=t.reporter,s=t.batchProcessor,r=t.stateHandler.getState;if(!i)throw new Error("Missing required dependency: reporter.");function u(c,b){function z(){b(c)}if(Z.isIE(8))r(c).object={proxy:z},c.attachEvent("onresize",z);else{var N=d(c);if(!N)throw new Error("Element is not detectable by this strategy.");N.contentDocument.defaultView.addEventListener("resize",z)}}function g(c){var b=t.important?" !important; ":"; ";return(c.join(b)+b).trim()}function l(c,b,z){z||(z=b,b=c,c=null),c=c||{},c.debug;function N(m,S){var T=g(["display: block","position: absolute","top: 0","left: 0","width: 100%","height: 100%","border: none","padding: 0","margin: 0","opacity: 0","z-index: -1000","pointer-events: none"]),P=!1,W=window.getComputedStyle(m),k=m.offsetWidth,L=m.offsetHeight;r(m).startSize={width:k,height:L};function o(){function e(){if(W.position==="static"){m.style.setProperty("position","relative",c.important?"important":"");var D=function(A,w,H,f){function y(j){return j.replace(/[^-\d\.]/g,"")}var I=H[f];I!=="auto"&&y(I)!=="0"&&(A.warn("An element that is positioned static has style."+f+"="+I+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+f+" will be set to 0. Element: ",w),w.style.setProperty(f,"0",c.important?"important":""))};D(i,m,W,"top"),D(i,m,W,"right"),D(i,m,W,"bottom"),D(i,m,W,"left")}}function E(){P||e();function D(w,H){if(!w.contentDocument){var f=r(w);f.checkForObjectDocumentTimeoutId&&window.clearTimeout(f.checkForObjectDocumentTimeoutId),f.checkForObjectDocumentTimeoutId=setTimeout(function(){f.checkForObjectDocumentTimeoutId=0,D(w,H)},100);return}H(w.contentDocument)}var A=this;D(A,function(H){S(m)})}W.position!==""&&(e(),P=!0);var n=document.createElement("object");n.style.cssText=T,n.tabIndex=-1,n.type="text/html",n.setAttribute("aria-hidden","true"),n.onload=E,Z.isIE()||(n.data="about:blank"),r(m)&&(m.appendChild(n),r(m).object=n,Z.isIE()&&(n.data="about:blank"))}s?s.add(o):o()}Z.isIE(8)?z(b):N(b,z)}function d(c){return r(c).object}function h(c){if(r(c)){var b=d(c);b&&(Z.isIE(8)?c.detachEvent("onresize",b.proxy):c.removeChild(b),r(c).checkForObjectDocumentTimeoutId&&window.clearTimeout(r(c).checkForObjectDocumentTimeoutId),delete r(c).object)}}return{makeDetectable:l,addListener:u,uninstall:h}},re=mt.forEach,ie=function(t){t=t||{};var i=t.reporter,s=t.batchProcessor,r=t.stateHandler.getState;t.stateHandler.hasState;var u=t.idHandler;if(!s)throw new Error("Missing required dependency: batchProcessor");if(!i)throw new Error("Missing required dependency: reporter.");var g=b(),l="erd_scroll_detection_scrollbar_style",d="erd_scroll_detection_container";function h(o){z(o,l,d)}h(window.document);function c(o){var e=t.important?" !important; ":"; ";return(o.join(e)+e).trim()}function b(){var o=500,e=500,E=document.createElement("div");E.style.cssText=c(["position: absolute","width: "+o*2+"px","height: "+e*2+"px","visibility: hidden","margin: 0","padding: 0"]);var n=document.createElement("div");n.style.cssText=c(["position: absolute","width: "+o+"px","height: "+e+"px","overflow: scroll","visibility: none","top: "+-o*3+"px","left: "+-e*3+"px","visibility: hidden","margin: 0","padding: 0"]),n.appendChild(E),document.body.insertBefore(n,document.body.firstChild);var D=o-n.clientWidth,A=e-n.clientHeight;return document.body.removeChild(n),{width:D,height:A}}function z(o,e,E){function n(H,f){f=f||function(I){o.head.appendChild(I)};var y=o.createElement("style");return y.innerHTML=H,y.id=e,f(y),y}if(!o.getElementById(e)){var D=E+"_animation",A=E+"_animation_active",w=`/* Created by the element-resize-detector library. */
`;w+="."+E+" > div::-webkit-scrollbar { "+c(["display: none"])+` }
`,w+="."+A+" { "+c(["-webkit-animation-duration: 0.1s","animation-duration: 0.1s","-webkit-animation-name: "+D,"animation-name: "+D])+` }
`,w+="@-webkit-keyframes "+D+` { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }
`,w+="@keyframes "+D+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }",n(w)}}function N(o){o.className+=" "+d+"_animation_active"}function m(o,e,E){if(o.addEventListener)o.addEventListener(e,E);else if(o.attachEvent)o.attachEvent("on"+e,E);else return i.error("[scroll] Don't know how to add event listeners.")}function S(o,e,E){if(o.removeEventListener)o.removeEventListener(e,E);else if(o.detachEvent)o.detachEvent("on"+e,E);else return i.error("[scroll] Don't know how to remove event listeners.")}function T(o){return r(o).container.childNodes[0].childNodes[0].childNodes[0]}function P(o){return r(o).container.childNodes[0].childNodes[0].childNodes[1]}function W(o,e){var E=r(o).listeners;if(!E.push)throw new Error("Cannot add listener to an element that is not detectable.");r(o).listeners.push(e)}function k(o,e,E){E||(E=e,e=o,o=null),o=o||{};function n(){if(o.debug){var a=Array.prototype.slice.call(arguments);if(a.unshift(u.get(e),"Scroll: "),i.log.apply)i.log.apply(null,a);else for(var v=0;v<a.length;v++)i.log(a[v])}}function D(a){function v(x){var _=x.getRootNode&&x.getRootNode().contains(x);return x===x.ownerDocument.body||x.ownerDocument.body.contains(x)||_}return!v(a)||window.getComputedStyle(a)===null}function A(a){var v=r(a).container.childNodes[0],x=window.getComputedStyle(v);return!x.width||x.width.indexOf("px")===-1}function w(){var a=window.getComputedStyle(e),v={};return v.position=a.position,v.width=e.offsetWidth,v.height=e.offsetHeight,v.top=a.top,v.right=a.right,v.bottom=a.bottom,v.left=a.left,v.widthCSS=a.width,v.heightCSS=a.height,v}function H(){var a=w();r(e).startSize={width:a.width,height:a.height},n("Element start size",r(e).startSize)}function f(){r(e).listeners=[]}function y(){if(n("storeStyle invoked."),!r(e)){n("Aborting because element has been uninstalled");return}var a=w();r(e).style=a}function I(a,v,x){r(a).lastWidth=v,r(a).lastHeight=x}function j(a){return T(a).childNodes[0]}function U(){return 2*g.width+1}function et(){return 2*g.height+1}function rt(a){return a+10+U()}function it(a){return a+10+et()}function Ht(a){return a*2+U()}function Tt(a){return a*2+et()}function dt(a,v,x){var _=T(a),G=P(a),Y=rt(v),K=it(x),O=Ht(v),p=Tt(x);_.scrollLeft=Y,_.scrollTop=K,G.scrollLeft=O,G.scrollTop=p}function ct(){var a=r(e).container;if(!a){a=document.createElement("div"),a.className=d,a.style.cssText=c(["visibility: hidden","display: inline","width: 0px","height: 0px","z-index: -1","overflow: hidden","margin: 0","padding: 0"]),r(e).container=a,N(a),e.appendChild(a);var v=function(){r(e).onRendered&&r(e).onRendered()};m(a,"animationstart",v),r(e).onAnimationStart=v}return a}function At(){function a(){var C=r(e).style;if(C.position==="static"){e.style.setProperty("position","relative",o.important?"important":"");var F=function(X,J,Mt,at){function Nt(Pt){return Pt.replace(/[^-\d\.]/g,"")}var ot=Mt[at];ot!=="auto"&&Nt(ot)!=="0"&&(X.warn("An element that is positioned static has style."+at+"="+ot+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+at+" will be set to 0. Element: ",J),J.style[at]=0)};F(i,e,C,"top"),F(i,e,C,"right"),F(i,e,C,"bottom"),F(i,e,C,"left")}}function v(C,F,X,J){return C=C?C+"px":"0",F=F?F+"px":"0",X=X?X+"px":"0",J=J?J+"px":"0",["left: "+C,"top: "+F,"right: "+J,"bottom: "+X]}if(n("Injecting elements"),!r(e)){n("Aborting because element has been uninstalled");return}a();var x=r(e).container;x||(x=ct());var _=g.width,G=g.height,Y=c(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden","width: 100%","height: 100%","left: 0px","top: 0px"]),K=c(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden"].concat(v(-(1+_),-(1+G),-G,-_))),O=c(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),p=c(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),M=c(["position: absolute","left: 0","top: 0"]),V=c(["position: absolute","width: 200%","height: 200%"]),R=document.createElement("div"),B=document.createElement("div"),Q=document.createElement("div"),lt=document.createElement("div"),nt=document.createElement("div"),ft=document.createElement("div");R.dir="ltr",R.style.cssText=Y,R.className=d,B.className=d,B.style.cssText=K,Q.style.cssText=O,lt.style.cssText=M,nt.style.cssText=p,ft.style.cssText=V,Q.appendChild(lt),nt.appendChild(ft),B.appendChild(Q),B.appendChild(nt),R.appendChild(B),x.appendChild(R);function ht(){var C=r(e);C&&C.onExpand?C.onExpand():n("Aborting expand scroll handler: element has been uninstalled")}function vt(){var C=r(e);C&&C.onShrink?C.onShrink():n("Aborting shrink scroll handler: element has been uninstalled")}m(Q,"scroll",ht),m(nt,"scroll",vt),r(e).onExpandScroll=ht,r(e).onShrinkScroll=vt}function jt(){function a(O,p,M){var V=j(O),R=rt(p),B=it(M);V.style.setProperty("width",R+"px",o.important?"important":""),V.style.setProperty("height",B+"px",o.important?"important":"")}function v(O){var p=e.offsetWidth,M=e.offsetHeight,V=p!==r(e).lastWidth||M!==r(e).lastHeight;n("Storing current size",p,M),I(e,p,M),s.add(0,function(){if(V){if(!r(e)){n("Aborting because element has been uninstalled");return}if(!x()){n("Aborting because element container has not been initialized");return}if(o.debug){var B=e.offsetWidth,Q=e.offsetHeight;(B!==p||Q!==M)&&i.warn(u.get(e),"Scroll: Size changed before updating detector elements.")}a(e,p,M)}}),s.add(1,function(){if(!r(e)){n("Aborting because element has been uninstalled");return}if(!x()){n("Aborting because element container has not been initialized");return}dt(e,p,M)}),V&&O&&s.add(2,function(){if(!r(e)){n("Aborting because element has been uninstalled");return}if(!x()){n("Aborting because element container has not been initialized");return}O()})}function x(){return!!r(e).container}function _(){function O(){return r(e).lastNotifiedWidth===void 0}n("notifyListenersIfNeeded invoked");var p=r(e);if(O()&&p.lastWidth===p.startSize.width&&p.lastHeight===p.startSize.height)return n("Not notifying: Size is the same as the start size, and there has been no notification yet.");if(p.lastWidth===p.lastNotifiedWidth&&p.lastHeight===p.lastNotifiedHeight)return n("Not notifying: Size already notified");n("Current size not notified, notifying..."),p.lastNotifiedWidth=p.lastWidth,p.lastNotifiedHeight=p.lastHeight,re(r(e).listeners,function(M){M(e)})}function G(){if(n("startanimation triggered."),A(e)){n("Ignoring since element is still unrendered...");return}n("Element rendered.");var O=T(e),p=P(e);(O.scrollLeft===0||O.scrollTop===0||p.scrollLeft===0||p.scrollTop===0)&&(n("Scrollbars out of sync. Updating detector elements..."),v(_))}function Y(){if(n("Scroll detected."),A(e)){n("Scroll event fired while unrendered. Ignoring...");return}v(_)}if(n("registerListenersAndPositionElements invoked."),!r(e)){n("Aborting because element has been uninstalled");return}r(e).onRendered=G,r(e).onExpand=Y,r(e).onShrink=Y;var K=r(e).style;a(e,K.width,K.height)}function Ot(){if(n("finalizeDomMutation invoked."),!r(e)){n("Aborting because element has been uninstalled");return}var a=r(e).style;I(e,a.width,a.height),dt(e,a.width,a.height)}function It(){E(e)}function ut(){n("Installing..."),f(),H(),s.add(0,y),s.add(1,At),s.add(2,jt),s.add(3,Ot),s.add(4,It)}n("Making detectable..."),D(e)?(n("Element is detached"),ct(),n("Waiting until element is attached..."),r(e).onRendered=function(){n("Element is now attached"),ut()}):ut()}function L(o){var e=r(o);e&&(e.onExpandScroll&&S(T(o),"scroll",e.onExpandScroll),e.onShrinkScroll&&S(P(o),"scroll",e.onShrinkScroll),e.onAnimationStart&&S(e.container,"animationstart",e.onAnimationStart),e.container&&o.removeChild(e.container))}return{makeDetectable:k,addListener:W,uninstall:L,initDocument:h}},tt=mt.forEach,ne=$t,ae=qt,oe=Ut,se=Gt,de=Vt,pt=zt,ce=Qt,$=te,ue=ee,le=ie;function yt(t){return Array.isArray(t)||t.length!==void 0}function wt(t){if(Array.isArray(t))return t;var i=[];return tt(t,function(s){i.push(s)}),i}function St(t){return t&&t.nodeType===1}var fe=function(t){t=t||{};var i;if(t.idHandler)i={get:function(k){return t.idHandler.get(k,!0)},set:t.idHandler.set};else{var s=oe(),r=se({idGenerator:s,stateHandler:$});i=r}var u=t.reporter;if(!u){var g=u===!1;u=de(g)}var l=q(t,"batchProcessor",ce({reporter:u})),d={};d.callOnAdd=!!q(t,"callOnAdd",!0),d.debug=!!q(t,"debug",!1);var h=ae(i),c=ne({stateHandler:$}),b,z=q(t,"strategy","object"),N=q(t,"important",!1),m={reporter:u,batchProcessor:l,stateHandler:$,idHandler:i,important:N};if(z==="scroll"&&(pt.isLegacyOpera()?(u.warn("Scroll strategy is not supported on legacy Opera. Changing to object strategy."),z="object"):pt.isIE(9)&&(u.warn("Scroll strategy is not supported on IE9. Changing to object strategy."),z="object")),z==="scroll")b=le(m);else if(z==="object")b=ue(m);else throw new Error("Invalid strategy name: "+z);var S={};function T(k,L,o){function e(H){var f=h.get(H);tt(f,function(I){I(H)})}function E(H,f,y){h.add(f,y),H&&y(f)}if(o||(o=L,L=k,k={}),!L)throw new Error("At least one element required.");if(!o)throw new Error("Listener required.");if(St(L))L=[L];else if(yt(L))L=wt(L);else return u.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");var n=0,D=q(k,"callOnAdd",d.callOnAdd),A=q(k,"onReady",function(){}),w=q(k,"debug",d.debug);tt(L,function(f){$.getState(f)||($.initState(f),i.set(f));var y=i.get(f);if(w&&u.log("Attaching listener to element",y,f),!c.isDetectable(f)){if(w&&u.log(y,"Not detectable."),c.isBusy(f)){w&&u.log(y,"System busy making it detectable"),E(D,f,o),S[y]=S[y]||[],S[y].push(function(){n++,n===L.length&&A()});return}return w&&u.log(y,"Making detectable..."),c.markBusy(f,!0),b.makeDetectable({debug:w,important:N},f,function(j){if(w&&u.log(y,"onElementDetectable"),$.getState(j)){c.markAsDetectable(j),c.markBusy(j,!1),b.addListener(j,e),E(D,j,o);var U=$.getState(j);if(U&&U.startSize){var et=j.offsetWidth,rt=j.offsetHeight;(U.startSize.width!==et||U.startSize.height!==rt)&&e(j)}S[y]&&tt(S[y],function(it){it()})}else w&&u.log(y,"Element uninstalled before being detectable.");delete S[y],n++,n===L.length&&A()})}w&&u.log(y,"Already detecable, adding listener."),E(D,f,o),n++}),n===L.length&&A()}function P(k){if(!k)return u.error("At least one element is required.");if(St(k))k=[k];else if(yt(k))k=wt(k);else return u.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");tt(k,function(L){h.removeAllListeners(L),b.uninstall(L),$.cleanState(L)})}function W(k){b.initDocument&&b.initDocument(k)}return{listenTo:T,removeListener:h.removeListener,removeAllListeners:h.removeAllListeners,uninstall:P,initDocument:W}};function q(t,i,s){var r=t[i];return r==null&&s!==void 0?s:r}const he=Et(fe);function ve(t){var s;const i=t.container instanceof HTMLElement?t.container:(s=t.container)==null?void 0:s.current;if(!i){console.error("Resize detector: container element is not available.");return}t._erd=he({strategy:"scroll"}),t._erdWidth=i.offsetWidth,t._erd.listenTo(i,r=>{const u=r.offsetWidth;t._erdWidth!==u&&(t.resize(t.props),t._erdWidth=u)})}function ge(t){var s;const i=t.container instanceof HTMLElement?t.container:(s=t.container)==null?void 0:s.current;if(!i){console.error("Resize detector: container element is not available.");return}t._erd.removeAllListeners(i)}const be={addListener:ve,removeListener:ge};exports.commonjsGlobal=Wt;exports.container=be;exports.getDefaultExportFromCjs=Et;exports.windowResizeDetector=Bt;
//# sourceMappingURL=index-CS9M5skL.js.map