UNPKG

react-gantt-timeline

Version:

[![npm](https://img.shields.io/npm/v/react-gantt-timeline.svg?style=flat-square)](http://npm.im/react-gantt-timeline) [![MIT License](https://img.shields.io/npm/l/react-list.svg?style=flat-square)](http://opensource.org/licenses/MIT) [![Travis](https://tr

1 lines 63.4 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("moment"),require("react-sizeme")):"function"==typeof define&&define.amd?define("react-gantt-timeline",["React","moment","ReactDOM"],e):"object"==typeof exports?exports["react-gantt-timeline"]=e(require("react"),require("moment"),require("react-sizeme")):t["react-gantt-timeline"]=e(t.React,t.moment,t.ReactDOM)}(window,function(t,e,n){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=13)}([function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e,n){t.exports=n(6)()},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",o=t[3];if(!o)return n;if(e&&"function"==typeof btoa){var r=(a=o,s=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(c," */")),i=o.sources.map(function(t){return"/*# sourceURL=".concat(o.sourceRoot||"").concat(t," */")});return[n].concat(i).concat([r]).join("\n")}var a,s,c;return[n].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n}).join("")},e.i=function(t,n,o){"string"==typeof t&&(t=[[null,t,""]]);var r={};if(o)for(var i=0;i<this.length;i++){var a=this[i][0];null!=a&&(r[a]=!0)}for(var s=0;s<t.length;s++){var c=[].concat(t[s]);o&&r[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),e.push(c))}},e}},function(t,e,n){var o,r,i={},a=(o=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===r&&(r=o.apply(this,arguments)),r}),s=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var n=function(t){return document.querySelector(t)}.call(this,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),c=null,l=0,u=[],p=n(10);function d(t,e){for(var n=0;n<t.length;n++){var o=t[n],r=i[o.id];if(r){r.refs++;for(var a=0;a<r.parts.length;a++)r.parts[a](o.parts[a]);for(;a<o.parts.length;a++)r.parts.push(g(o.parts[a],e))}else{var s=[];for(a=0;a<o.parts.length;a++)s.push(g(o.parts[a],e));i[o.id]={id:o.id,refs:1,parts:s}}}}function f(t,e){for(var n=[],o={},r=0;r<t.length;r++){var i=t[r],a=e.base?i[0]+e.base:i[0],s={css:i[1],media:i[2],sourceMap:i[3]};o[a]?o[a].parts.push(s):n.push(o[a]={id:a,parts:[s]})}return n}function h(t,e){var n=s(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var o=u[u.length-1];if("top"===t.insertAt)o?o.nextSibling?n.insertBefore(e,o.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),u.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var r=s(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,r)}}function y(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=u.indexOf(t);e>=0&&u.splice(e,1)}function m(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),b(e,t.attrs),h(t,e),e}function b(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function g(t,e){var n,o,r,i;if(e.transform&&t.css){if(!(i=e.transform(t.css)))return function(){};t.css=i}if(e.singleton){var a=l++;n=c||(c=m(e)),o=k.bind(null,n,a,!1),r=k.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",b(e,t.attrs),h(t,e),e}(e),o=function(t,e,n){var o=n.css,r=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&r;(e.convertToAbsoluteUrls||i)&&(o=p(o));r&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([o],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),r=function(){y(n),n.href&&URL.revokeObjectURL(n.href)}):(n=m(e),o=function(t,e){var n=e.css,o=e.media;o&&t.setAttribute("media",o);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),r=function(){y(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else r()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=f(t,e);return d(n,e),function(t){for(var o=[],r=0;r<n.length;r++){var a=n[r];(s=i[a.id]).refs--,o.push(s)}t&&d(f(t,e),e);for(r=0;r<o.length;r++){var s;if(0===(s=o[r]).refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete i[s.id]}}}};var v,w=(v=[],function(t,e){return v[t]=e,v.filter(Boolean).join("\n")});function k(t,e,n,o){var r=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=w(e,r);else{var i=document.createTextNode(r),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}},function(t,e){t.exports=n},function(t,e,n){"use strict";var o=n(7);function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function t(t,e,n,r,i,a){if(a!==o){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:i,resetWarningCache:r};return n.PropTypes=n,n}},function(t,e,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e,n){var o=n(9);"string"==typeof o&&(o=[[t.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(4)(o,r);o.locals&&(t.exports=o.locals)},function(t,e,n){(e=n(3)(!1)).push([t.i,".header-top {\n height: 20px;\n\n border-bottom: solid 0.5px silver;\n}\n\n.header-middle {\n height: 20px;\n background-color: chocolate;\n color: white;\n font-size: 10px;\n border-bottom: solid 0.5px silver;\n}\n.header-bottom {\n height: 20px;\n font-size: 10px;\n border-bottom: solid 0.5px silver;\n}\n",""]),t.exports=e},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,o=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var r,i=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?t:(r=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:o+i.replace(/^\.\//,""),"url("+JSON.stringify(r)+")")})}},function(t,e,n){var o=n(12);"string"==typeof o&&(o=[[t.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(4)(o,r);o.locals&&(t.exports=o.locals)},function(t,e,n){(e=n(3)(!1)).push([t.i,".timeLine {\n display: flex;\n flex-direction: row;\n width: 100%;\n height: 100%;\n border: solid 1px rgb(207, 207, 205);\n font-size: 12px;\n user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n}\n\n/* Main Area */\n\n.timeLine-main {\n flex: 1 1 100%;\n position: relative;\n display: flex;\n flex-direction: column;\n overflow-y: hidden;\n}\n/* Main Area Header*/\n\n.timeLine-main-header-viewPort {\n flex: 0 0 60px;\n position: relative;\n height: 60px;\n width: 100%;\n background-color: rgb(112, 112, 112);\n overflow: hidden;\n}\n\n.timeLine-main-header-container {\n flex: 0 0 60px;\n position: relative;\n top: 0;\n left: 0;\n height: 100%;\n display: flex;\n flex-direction: column;\n background-color: #333333;\n overflow: hidden;\n user-select: none;\n}\n\n.timeLine-main-header-day-item {\n position: absolute;\n display: flex;\n flex-direction: column;\n justify-content: center;\n background-color: rgb(112, 112, 112);\n font-size: 10px;\n text-align: center;\n border-right: solid 1px;\n border-top: solid 1px;\n border-bottom: solid 1px;\n top: 20px;\n height: 40px;\n color: white;\n text-align: center;\n}\n\n.timeLine-main-header-top-item {\n position: absolute;\n display: flex;\n flex-direction: column;\n justify-content: center;\n border-right: solid 1px white;\n height: 20px;\n z-index: 91;\n}\n\n.timeLine-main-header-day-week {\n flex: 0 0 12px;\n padding: 4px;\n z-index: 90;\n}\n\n.timeLine-main-header-day-month {\n top: 0px;\n position: sticky;\n flex: 0 0 15px;\n padding: 5px;\n z-index: 90;\n}\n\n.timeLine-main-header-time {\n display: flex;\n flex-direction: row;\n align-items: stretch;\n height: 22px;\n justify-content: stretch;\n}\n\n.timeLine-main-header-time-item {\n border-left: solid 1px silver;\n border-bottom: solid 1px silver;\n border-top: solid 1px silver;\n text-align: center;\n padding-top: 5px;\n}\n/* Main Area Data*/\n\n.timeLine-main-data-viewPort {\n flex: 1 1 auto;\n position: relative;\n overflow: hidden;\n background-color: #fbf9f9;\n}\n.timeLine-main-data-container {\n position: relative;\n top: 0;\n left: 0;\n height: 100%;\n background-color: rgb(255, 255, 255);\n}\n\n.timeLine-main-data-row {\n position: absolute;\n width: 100%;\n height: 50px;\n}\n\n.timeLine-main-data-task {\n position: absolute;\n background-color: darkorchid;\n border-radius: 14px;\n color: white;\n text-align: center;\n}\n\n.timeLine-main-data-task-side {\n position: absolute;\n width: 10px;\n cursor: col-resize;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n.timeLine-main-data-task-side-linker {\n width: 8px;\n height: 8px;\n border-radius: 4px;\n cursor: default;\n z-index: 100;\n}\n.timeLine-main-data-task-side-linker:hover {\n background-color: black;\n border: solid 0.5px grey;\n}\n/* .timeLine-main-data-task:hover {\n background-color:chocolate;\n border:solid 2px darkorchid;\n cursor: move;\n} */\n\n.timeLine-main-data-verticalLine {\n flex: 1 1 auto;\n height: 100%;\n width: 24px;\n background-color: white;\n border-left-width: 0.5px;\n border-left-color: rgb(207, 207, 205);\n border-left-style: dashed;\n}\n\n/* Side Area */\n\n.timeLine-side-main {\n flex: 0 0 auto;\n width: 108px;\n min-width: 108px;\n display: flex;\n flex-direction: row;\n}\n\n.timeLine-side {\n flex: 1 0 100px;\n display: flex;\n flex-direction: column;\n border-right: solid 1px rgb(207, 207, 205);\n}\n\n.verticalResizer {\n flex: 0 0 8px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: col-resize;\n border-right: solid 1px rgb(207, 207, 205);\n height: 100%;\n}\n.squareGrip {\n flex: 0 0 auto;\n\n border-radius: 50%;\n height: 5px;\n width: 5px;\n margin: 3px 0;\n}\n\n.timeLine-side-title {\n flex: 0 0 60px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.timeLine-side-task-viewPort {\n position: relative;\n flex: 1 1 auto;\n height: 100%;\n background-color: #fbf9f9;\n overflow-x: hidden;\n overflow-y: auto;\n}\n\n.timeLine-side-task-container {\n position: relative;\n overflow-x: hidden;\n overflow-y: hidden;\n}\n\n.timeLine-side-task-row {\n position: absolute;\n width: 100%;\n background-color: rgb(112, 112, 112);\n border-bottom-width: 0.5px;\n border-bottom-color: rgb(207, 207, 205);\n border-bottom-style: solid;\n height: 30px;\n color: grey;\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n outline: none;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n}\n",""]),t.exports=e},function(t,e,n){"use strict";n.r(e);var o=n(0),r=n.n(o),i=n(2),a=n.n(i);function s(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var c={header:{top:{style:{backgroundColor:"#333333",fontSize:10,color:"white",textAlign:"center"}},middle:{style:{backgroundColor:"chocolate"},selectedStyle:{backgroundColor:"#b13525",fontWeight:"bold"}},bottom:{style:{background:"grey",color:"white",fontSize:9},selectedStyle:{backgroundColor:"#b13525",fontWeight:"bold"}}},taskList:{title:{label:"Projects",style:{backgroundColor:"#333333",borderBottom:"solid 1px silver",color:"white",textAlign:"center"}},task:{style:{backgroundColor:"#fbf9f9"}},verticalSeparator:{style:{backgroundColor:"#333333"},grip:{style:{backgroundColor:"#cfcfcd"}}}},dataViewPort:{rows:{style:{backgroundColor:"#fbf9f9",borderBottom:"solid 0.5px #cfcfcd"}},task:{showLabel:!1,style:{position:"absolute",borderRadius:14,color:"white",textAlign:"center",backgroundColor:"grey"},selectedStyle:{position:"absolute",borderRadius:14,border:"solid 1px #ff00fa",color:"white",textAlign:"center",backgroundColor:"grey"}}},links:{color:"black",selectedColor:"#ff00fa"}},l=new(function(){function t(){var e,n,o,r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),o=function(t){r.data={},t?r.populate(t,c,r.data):r.data=c},(n="load")in(e=this)?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,this.data=c}var e,n,o;return e=t,(n=[{key:"populate",value:function(t,e,n){if(this.isObject(e))for(var o in e)t[o]?(n[o]=t[o],this.populate(t[o],e[o],n[o])):n[o]=e[o]}},{key:"isObject",value:function(t){return"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t}},{key:"values",get:function(){return this.data}}])&&s(e.prototype,n),o&&s(e,o),t}());function u(t){"@babel/helpers - typeof";return(u="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)}function p(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var y=function(t){function e(t){var n,o,r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),o=this,(n=!(r=d(e).call(this,t))||"object"!==u(r)&&"function"!=typeof r?f(o):r).doMouseMove=n.doMouseMove.bind(f(n)),n.doMouseDown=n.doMouseDown.bind(f(n)),n.doMouseUp=n.doMouseUp.bind(f(n)),n.state={dragging:!1},n}var n,i,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&h(t,e)}(e,o["Component"]),n=e,(i=[{key:"doMouseDown",value:function(t){0===t.button&&(this.draggingPosition=t.clientX,this.setState({dragging:!0}))}},{key:"componentDidUpdate",value:function(t,e){this.state.dragging&&!e.dragging?(document.addEventListener("mousemove",this.doMouseMove),document.addEventListener("mouseup",this.doMouseUp)):!this.state.dragging&&e.dragging&&(document.removeEventListener("mousemove",this.doMouseMove),document.removeEventListener("mouseup",this.doMouseUp))}},{key:"doMouseMove",value:function(t){if(this.state.dragging){t.stopPropagation();var e=this.draggingPosition-t.clientX;this.draggingPosition=t.clientX,this.props.onTaskListSizing(e)}}},{key:"doMouseUp",value:function(t){this.setState({dragging:!1})}},{key:"render",value:function(){return r.a.createElement("div",{className:"verticalResizer",style:l.values.taskList.verticalSeparator.style,onMouseDown:this.doMouseDown},r.a.createElement("div",{className:"squareGrip",style:l.values.taskList.verticalSeparator.grip.style}),r.a.createElement("div",{className:"squareGrip",style:l.values.taskList.verticalSeparator.grip.style}),r.a.createElement("div",{className:"squareGrip",style:l.values.taskList.verticalSeparator.grip.style}),r.a.createElement("div",{className:"squareGrip",style:l.values.taskList.verticalSeparator.grip.style}))}}])&&p(n.prototype,i),a&&p(n,a),e}(),m=n(1),b=n.n(m),g=0,v=30,w=5e3,k="day",x="week",O="month",S="year";function T(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function j(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var P=new(function(){function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),j(this,"dayToPosition",function(t,e,n){return t*n+e}),j(this,"daysInYear",function(t){return e.isLeapYear(t)?366:365})}var e,n,o;return e=t,(n=[{key:"dateToPixel",value:function(t,e,n){var o=this.getToday(),r=new Date(t),i=60*(r.getTimezoneOffset()-o.getTimezoneOffset())*1e3;return(r.getTime()-o.getTime()-i)/36e5*(n/24)+e}},{key:"pixelToDate",value:function(t,e,n){var o=24/n,r=t-e,i=this.getToday(),a=i.getTime()+r*o*36e5,s=new Date(a),c=60*(s.getTimezoneOffset()-i.getTimezoneOffset())*1e3;return s.setTime(s.getTime()+c),s}},{key:"getToday",value:function(){var t=new Date;return t.setHours(0,0,0,0),t}},{key:"monthDiff",value:function(t,e){return Math.abs(e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()))}},{key:"daysInMonth",value:function(t,e){return new Date(e,t,0).getDate()}},{key:"isLeapYear",value:function(t){return t%400==0||t%100!=0&&t%4==0}}])&&T(e.prototype,n),o&&T(e,o),t}());n(8);function E(t){"@babel/helpers - typeof";return(E="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)}function L(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function C(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?L(Object(n),!0).forEach(function(e){M(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function M(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function D(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function R(t,e,n){return e&&_(t.prototype,e),n&&_(t,n),t}function I(t,e){return!e||"object"!==E(e)&&"function"!=typeof e?U(t):e}function U(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function z(t){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function N(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&W(t,e)}function W(t,e){return(W=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var V=function(t){function e(t){return D(this,e),I(this,z(e).call(this,t))}return N(e,o["PureComponent"]),R(e,[{key:"render",value:function(){return r.a.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",borderLeft:"solid 1px white",position:"absolute",height:20,left:this.props.left,width:this.props.width}},r.a.createElement("div",null,this.props.label))}}]),e}(),F=function(t){function e(t){var n;return D(this,e),M(U(n=I(this,z(e).call(this,t))),"getStartDate",function(t,e){var n=null;switch(e){case"year":return n=t.year(),b()([n,0,1]);case"month":n=t.year();var o=t.month();return b()([n,o,1]);case"week":return t.subtract(t.day(),"days");default:return t}}),M(U(n),"renderTime",function(t,e,n,o){for(var i=[],a=e/24,s=0,c=0;c<24;c++)i.push(r.a.createElement(V,{key:c,left:s,width:a,label:"shorttime"==n?c:"".concat(c,":00")})),s+=a;return r.a.createElement("div",{key:o,style:{position:"absolute",height:20,left:t,width:e}}," ",i)}),M(U(n),"renderHeaderRows",function(t,e,o){for(var i={top:[],middle:[],bottom:[]},a={},s="",c="",u="",p=null,d=null,f=n.props.currentday,h=n.props.currentday+n.props.numVisibleDays,y=f-v;y<h+v;y++)s!=(p=b()().add(y,"days")).format(n.getFormat(t,"top"))&&(s=p.format(n.getFormat(t,"top")),d=n.getBox(p,t,a.top),a.top=d.left+d.width,i.top.push(r.a.createElement(V,{key:y,left:d.left,width:d.width,label:s}))),c!=p.format(n.getFormat(e))&&(c=p.format(n.getFormat(e)),d=n.getBox(p,e,a.middle),a.middle=d.left+d.width,i.middle.push(r.a.createElement(V,{key:y,left:d.left,width:d.width,label:c}))),u!=p.format(n.getFormat(o))&&(u=p.format(n.getFormat(o)),d=n.getBox(p,o,a.bottom),a.bottom=d.left+d.width,"shorttime"==o||"fulltime"==o?i.bottom.push(n.renderTime(d.left,d.width,o,y)):i.bottom.push(r.a.createElement(V,{key:y,left:d.left,width:d.width,label:u})));return r.a.createElement("div",{className:"timeLine-main-header-container",style:{width:w,maxWidth:w}},r.a.createElement("div",{className:"header-top",style:C({},l.values.header.top.style)},i.top),r.a.createElement("div",{className:"header-middle",style:C({},l.values.header.middle.style)},i.middle),r.a.createElement("div",{className:"header-bottom",style:C({},l.values.header.bottom.style)},i.bottom))}),M(U(n),"renderHeader",function(){switch(n.props.mode){case k:return n.renderHeaderRows("week","dayweek","fulltime");case x:return n.renderHeaderRows("week","dayweek","shorttime");case O:return n.renderHeaderRows("month","dayweek","daymonth");case S:return n.renderHeaderRows("year","month","week")}}),M(U(n),"setBoundaries",function(){n.start=n.props.currentday-v,n.end=n.props.currentday+n.props.numVisibleDays+v}),M(U(n),"needToRender",function(){return n.props.currentday<n.start||n.props.currentday+n.props.numVisibleDays>n.end}),n.setBoundaries(),n}return N(e,o["PureComponent"]),R(e,[{key:"getFormat",value:function(t,e){switch(t){case"year":return"YYYY";case"month":return"top"==e?"MMMM YYYY":"MMMM";case"week":return"top"==e?"ww MMMM YYYY":"ww";case"dayweek":return"dd";case"daymonth":return"D"}}},{key:"getModeIncrement",value:function(t,e){switch(e){case"year":return P.daysInYear(t.year());case"month":return t.daysInMonth();case"week":return 7;default:return 1}}},{key:"getBox",value:function(t,e,n){var o=this.getModeIncrement(t,e)*this.props.dayWidth;if(!n){var r=this.getStartDate(t,e);r=r.startOf("day");var i=b()().startOf("day"),a=r.diff(i,"days");n=P.dayToPosition(a,this.props.nowposition,this.props.dayWidth)}return{left:n,width:o}}},{key:"render",value:function(){return this.refs.Header&&(this.refs.Header.scrollLeft=this.props.scrollLeft),r.a.createElement("div",{id:"timeline-header",ref:"Header",className:"timeLine-main-header-viewPort"},this.renderHeader())}}]),e}();function A(t){"@babel/helpers - typeof";return(A="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)}function H(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function Y(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?H(Object(n),!0).forEach(function(e){$(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function B(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function X(t){return(X=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function q(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function G(t,e){return(G=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function $(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var J=function(t){function e(t){var n,o,r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),o=this,r=X(e).call(this,t),$(q(n=!r||"object"!==A(r)&&"function"!=typeof r?q(o):r),"onCreateLinkMouseDown",function(t,e){0===t.button&&(t.stopPropagation(),n.props.onStartCreateLink(n.props.item,e))}),$(q(n),"onCreateLinkMouseUp",function(t,e){t.stopPropagation(),n.props.onFinishCreateLink(n.props.item,e)}),$(q(n),"onCreateLinkTouchStart",function(t,e){t.stopPropagation(),n.props.onStartCreateLink(n.props.item,e)}),$(q(n),"onCreateLinkTouchEnd",function(t,e){t.stopPropagation(),n.props.onFinishCreateLink(n.props.item,e)}),$(q(n),"doMouseDown",function(t,e){n.props.onUpdateTask&&0===t.button&&(t.stopPropagation(),n.dragStart(t.clientX,e))}),$(q(n),"doMouseMove",function(t){n.state.dragging&&(t.stopPropagation(),n.dragProcess(t.clientX))}),$(q(n),"doMouseUp",function(){n.dragEnd()}),$(q(n),"doTouchStart",function(t,e){n.props.onUpdateTask&&(t.stopPropagation(),n.dragStart(t.touches[0].clientX,e))}),$(q(n),"doTouchMove",function(t){n.state.dragging&&(t.stopPropagation(),n.dragProcess(t.changedTouches[0].clientX))}),$(q(n),"doTouchEnd",function(t){n.dragEnd()}),n.calculateStyle=n.calculateStyle.bind(q(n)),n.state={dragging:!1,left:n.props.left,width:n.props.width,mode:g},n}var n,i,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&G(t,e)}(e,o["Component"]),n=e,(i=[{key:"componentDidUpdate",value:function(t,e){this.state.dragging&&!e.dragging?(document.addEventListener("mousemove",this.doMouseMove),document.addEventListener("mouseup",this.doMouseUp),document.addEventListener("touchmove",this.doTouchMove),document.addEventListener("touchend",this.doTouchEnd)):!this.state.dragging&&e.dragging&&(document.removeEventListener("mousemove",this.doMouseMove),document.removeEventListener("mouseup",this.doMouseUp),document.removeEventListener("touchmove",this.doTouchMove),document.removeEventListener("touchend",this.doTouchEnd))}},{key:"dragStart",value:function(t,e){this.props.onChildDrag(!0),this.draggingPosition=t,this.setState({dragging:!0,mode:e,left:this.props.left,width:this.props.width})}},{key:"dragProcess",value:function(t){var e=this.draggingPosition-t,n=this.state.left,o=this.state.width;switch(this.state.mode){case 1:n=this.state.left-e;break;case 2:n=this.state.left-e,o=this.state.width+e;break;case 3:o=this.state.width-e}var r={item:this.props.item,position:{start:n-this.props.nowposition,end:n+o-this.props.nowposition}};this.props.onTaskChanging(r),this.setState({left:n,width:o}),this.draggingPosition=t}},{key:"dragEnd",value:function(){this.props.onChildDrag(!1);var t=P.pixelToDate(this.state.left,this.props.nowposition,this.props.dayWidth),e=P.pixelToDate(this.state.left+this.state.width,this.props.nowposition,this.props.dayWidth);this.props.onUpdateTask(this.props.item,{start:t,end:e}),this.setState({dragging:!1,mode:g})}},{key:"calculateStyle",value:function(){var t=this.props.isSelected?l.values.dataViewPort.task.selectedStyle:l.values.dataViewPort.task.style,e=this.props.color?this.props.color:t.backgroundColor;return this.state.dragging?Y({},t,{backgroundColor:e,left:this.state.left,width:this.state.width,height:this.props.height-5,top:2}):Y({},t,{backgroundColor:e,left:this.props.left,width:this.props.width,height:this.props.height-5,top:2})}},{key:"render",value:function(){var t=this,e=this.calculateStyle();return r.a.createElement("div",{onMouseDown:function(e){return t.doMouseDown(e,1)},onTouchStart:function(e){return t.doTouchStart(e,1)},onClick:function(e){t.props.onSelectItem(t.props.item)},style:e},r.a.createElement("div",{className:"timeLine-main-data-task-side",style:{top:0,left:-4,height:e.height},onMouseDown:function(e){return t.doMouseDown(e,2)},onTouchStart:function(e){return t.doTouchStart(e,2)}},r.a.createElement("div",{className:"timeLine-main-data-task-side-linker",onMouseUp:function(e){return t.onCreateLinkMouseUp(e,void 0)},onTouchEnd:function(e){return t.onCreateLinkTouchEnd(e,void 0)}})),r.a.createElement("div",{style:{overflow:"hidden"}},l.values.dataViewPort.task.showLabel?this.props.item.name:""),r.a.createElement("div",{className:"timeLine-main-data-task-side",style:{top:0,left:e.width-3,height:e.height},onMouseDown:function(e){return t.doMouseDown(e,3)},onTouchStart:function(e){return t.doTouchStart(e,3)}},r.a.createElement("div",{className:"timeLine-main-data-task-side-linker",onMouseDown:function(e){return t.onCreateLinkMouseDown(e,void 0)},onTouchStart:function(e){return t.onCreateLinkTouchStart(e,void 0)}})))}}])&&B(n.prototype,i),a&&B(n,a),e}(),K=n(5),Q=n.n(K);function Z(t){"@babel/helpers - typeof";return(Z="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)}function tt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function et(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ot(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function rt(t,e,n){return e&&ot(t.prototype,e),n&&ot(t,n),t}function it(t,e){return!e||"object"!==Z(e)&&"function"!=typeof e?at(t):e}function at(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function st(t){return(st=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ct(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&lt(t,e)}function lt(t,e){return(lt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var ut=function(t){function e(t){return nt(this,e),it(this,st(e).call(this,t))}return ct(e,o["Component"]),rt(e,[{key:"render",value:function(){return r.a.createElement("div",{className:"timeLine-main-data-row",style:function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?tt(Object(n),!0).forEach(function(e){et(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tt(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({},l.values.dataViewPort.rows.style,{top:this.props.top,height:this.props.itemheight})},this.props.children)}}]),e}(),pt=function(t){function e(t){var n;return nt(this,e),et(at(n=it(this,st(e).call(this,t))),"onChildDrag",function(t){n.childDragging=t}),et(at(n),"renderRows",function(){for(var t=[],e=n.props.startRow;e<n.props.endRow+1;e++){var o=n.props.data[e];if(!o)break;var i=P.dateToPixel(o.start,n.props.nowposition,n.props.dayWidth),a=P.dateToPixel(o.end,n.props.nowposition,n.props.dayWidth)-i;t.push(r.a.createElement(ut,{key:e,label:o.name,top:e*n.props.itemheight,left:20,itemheight:n.props.itemheight},r.a.createElement(J,{item:o,label:o.name,nowposition:n.props.nowposition,dayWidth:n.props.dayWidth,color:o.color,left:i,width:a,height:n.props.itemheight,onChildDrag:n.onChildDrag,isSelected:n.props.selectedItem==o,onSelectItem:n.props.onSelectItem,onStartCreateLink:n.props.onStartCreateLink,onFinishCreateLink:n.props.onFinishCreateLink,onTaskChanging:n.props.onTaskChanging,onUpdateTask:n.props.onUpdateTask}," ")))}return t}),et(at(n),"doMouseDown",function(t){0!==t.button||n.childDragging||n.props.onMouseDown(t)}),et(at(n),"doMouseMove",function(t){n.props.onMouseMove(t,n.refs.dataViewPort)}),et(at(n),"doTouchStart",function(t){n.childDragging||n.props.onTouchStart(t)}),et(at(n),"doTouchMove",function(t){n.props.onTouchMove(t,n.refs.dataViewPort)}),n.childDragging=!1,n}return ct(e,o["Component"]),rt(e,[{key:"getContainerHeight",value:function(t){return t>0?t*this.props.itemheight:10}},{key:"componentDidMount",value:function(){this.refs.dataViewPort.scrollLeft=0}},{key:"render",value:function(){this.refs.dataViewPort&&(this.refs.dataViewPort.scrollLeft=this.props.scrollLeft,this.refs.dataViewPort.scrollTop=this.props.scrollTop);var t=this.getContainerHeight(this.props.data.length);return r.a.createElement("div",{ref:"dataViewPort",id:"timeLinedataViewPort",className:"timeLine-main-data-viewPort",onMouseDown:this.doMouseDown,onMouseMove:this.doMouseMove,onMouseUp:this.props.onMouseUp,onMouseLeave:this.props.onMouseLeave,onTouchStart:this.doTouchStart,onTouchMove:this.doTouchMove,onTouchEnd:this.props.onTouchEnd,onTouchCancel:this.props.onTouchCancel},r.a.createElement("div",{className:"timeLine-main-data-container",style:{height:t,width:w,maxWidth:w}},this.renderRows()))}}]),e}(),dt=Q()({monitorWidth:!0,monitorHeight:!0})(pt);function ft(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var ht=new(function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.data={},this.link={}}var e,n,o;return e=t,(n=[{key:"registerData",value:function(t){if(t){this.data={};for(var e=0;e<t.length;e++)this.data[t[e].id]={item:t[e],index:e}}}},{key:"registerLinks",value:function(t){if(t){this.link={};for(var e=0,n=0,o=0;o<t.length;o++){e=t[o].start,n=t[o].end;var r={link:t[o],index:o};this.createAddTo(e,this.link,r,o),this.createAddTo(n,this.link,r,o)}}}},{key:"createAddTo",value:function(t,e,n,o){e[t]||(e[t]=[]),-1==e[t].indexOf(n)&&e[t].push(n)}},{key:"getTask",value:function(t){return this.data[t]}},{key:"getLinks",value:function(t){return this.link[t]}}])&&ft(e.prototype,n),o&&ft(e,o),t}());function yt(t){"@babel/helpers - typeof";return(yt="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)}function mt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function bt(t){return(bt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function gt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function vt(t,e){return(vt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function wt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var kt=20,xt=function(t){function e(t){var n,o,r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),o=this,r=bt(e).call(this,t),wt(gt(n=!r||"object"!==yt(r)&&"function"!=typeof r?gt(o):r),"calcNormCoordinates",function(){var t;return{cpt1:{x:t=n.props.start.x+(n.props.end.x-n.props.start.x)/2,y:n.props.start.y},cpt2:{x:t,y:n.props.end.y}}}),wt(gt(n),"calcSCoordinates",function(){var t={x:n.props.start.x+kt,y:n.props.start.y},e=(n.props.end.y-n.props.start.y)/2,o={x:t.x,y:t.y+e},r={x:n.props.end.x-kt,y:o.y};return{cpt1:t,cpt2:o,cpt3:r,cpt4:{x:r.x,y:r.y+e}}}),wt(gt(n),"getPath",function(){var t=null;return n.props.start.x>n.props.end.x?(t=n.calcSCoordinates(),"M".concat(n.props.start.x," ").concat(n.props.start.y," ").concat(t.cpt1.x," ").concat(t.cpt1.y," ").concat(t.cpt2.x," ").concat(t.cpt2.y," ").concat(t.cpt3.x," ").concat(t.cpt3.y," ").concat(t.cpt4.x," ").concat(t.cpt4.y," ").concat(n.props.end.x," ").concat(n.props.end.y)):(t=n.calcNormCoordinates(),"M".concat(n.props.start.x," ").concat(n.props.start.y," ").concat(t.cpt1.x," ").concat(t.cpt1.y," ").concat(t.cpt2.x," ").concat(t.cpt2.y," ").concat(n.props.end.x," ").concat(n.props.end.y))}),wt(gt(n),"onSelect",function(t){n.props.onSelectItem&&n.props.onSelectItem(n.props.item)}),n}var n,i,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&vt(t,e)}(e,o["Component"]),n=e,(i=[{key:"render",value:function(){var t=this.props.isSelected?l.values.links.selectedColor:l.values.links.color;return r.a.createElement("g",{className:"timeline-link"},r.a.createElement("path",{pointerEvents:"stroke",onMouseDown:this.onSelect,stroke:"white",d:this.getPath(),strokeLinejoin:"round",fill:"transparent",strokeWidth:"4",cursor:"pointer"}),r.a.createElement("path",{pointerEvents:"stroke",onMouseDown:this.onSelect,stroke:t,d:this.getPath(),strokeLinejoin:"round",fill:"transparent",strokeWidth:"1",cursor:"pointer",markerEnd:"url(#arrow)"}))}}])&&mt(n.prototype,i),a&&mt(n,a),e}();function Ot(t){"@babel/helpers - typeof";return(Ot="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)}function St(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function Tt(t){return(Tt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function jt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Pt(t,e){return(Pt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Et(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Lt=function(t){function e(t){var n,o,r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),o=this,r=Tt(e).call(this,t),Et(jt(n=!r||"object"!==Ot(r)&&"function"!=typeof r?jt(o):r),"doMouseMove",function(t){n.init||(n.lastX=t.clientX,n.lastY=t.clientY,n.init=!0);var e=n.state.x+(t.clientX-n.lastX),o=n.state.y+(t.clientY-n.lastY);n.lastX=t.clientX,n.lastY=t.clientY,n.setState({x:e,y:o})}),Et(jt(n),"doMouseUp",function(t){n.props.onFinishCreateLink()}),n.state={x:n.props.start.x,y:n.props.start.y},n.init=!1,n.lastX=-1,n.lastY=-1,n}var n,i,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Pt(t,e)}(e,o["Component"]),n=e,(i=[{key:"componentDidMount",value:function(){document.addEventListener("mousemove",this.doMouseMove),document.addEventListener("mouseup",this.doMouseUp)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousemove",this.doMouseMove),document.removeEventListener("mouseup",this.doMouseUp)}},{key:"render",value:function(){return r.a.createElement(xt,{key:-1,start:{x:this.props.start.x,y:this.props.start.y},end:{x:this.state.x,y:this.state.y}})}}])&&St(n.prototype,i),a&&St(n,a),e}();function Ct(t){"@babel/helpers - typeof";return(Ct="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)}function Mt(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function Dt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function _t(t){return(_t=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Rt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function It(t,e){return(It=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Ut(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var zt=function(t){function e(t){var n,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),o=this,i=_t(e).call(this,t),Ut(Rt(n=!i||"object"!==Ct(i)&&"function"!=typeof i?Rt(o):i),"getItemPosition",function(t,e){return{x:P.dateToPixel(e,0,n.props.dayWidth),y:t*n.props.itemheight+n.props.itemheight/2}}),Ut(Rt(n),"renderCreateLink",function(){if(n.props.interactiveMode){var t=ht.getTask(n.props.taskToCreate.task.id),e=n.getItemPosition(t.index,t.item.end);return r.a.createElement(Lt,{start:e,onFinishCreateLink:n.props.onFinishCreateLink})}}),Ut(Rt(n),"renderChangingTaskLinks",function(){if(n.props.changingTask!=n.state.changingTask){n.state.changingTask=n.props.changingTask;var t=ht.getLinks(n.state.changingTask.item.id);if(!t)return;for(var e=null,o=null,i=null,a={},s={},c=0;c<t.length;c++)e=t[c],(o=ht.getTask(e.link.start))&&(i=ht.getTask(e.link.end))&&(a=n.getItemPosition(o.index,o.item.end),n.state.changingTask.item.id==e.link.start&&(a.x=n.state.changingTask.position.end),s=n.getItemPosition(i.index,i.item.start),n.state.changingTask.item.id==e.link.end&&(s.x=n.state.changingTask.position.start),n.cache[e.index]=r.a.createElement(xt,{key:-c-1,item:e,start:{x:a.x,y:a.y},end:{x:s.x,y:s.y},isSelected:n.props.selectedItem==e,onSelectItem:n.props.onSelectItem}),n.cache=Mt(n.cache))}}),n.cache=[],n.state={links:[],data:[],selectedItem:null},n}var n,i,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&It(t,e)}(e,o["Component"]),n=e,(i=[{key:"renderLink",value:function(t,e,n,o){var i=this.getItemPosition(t.index,t.item.end),a=this.getItemPosition(e.index,e.item.start);return r.a.createElement(xt,{key:o,item:n,start:{x:i.x,y:i.y},end:{x:a.x,y:a.y},isSelected:this.props.selectedItem==n,onSelectItem:this.props.onSelectItem})}},{key:"renderLinks",value:function(){this.cache=[];var t,e={},n={};if(0!=this.state.data.length)for(var o=0;o<this.state.links.length;o++){var r=this.state.links[o];!r&&e[r.id]||((t=ht.getTask(r.start))&&(n=ht.getTask(r.end))?(this.cache.push(this.renderLink(t,n,r,o)),e[r.id]=""):this.cache.push(null))}}},{key:"refreshData",value:function(){this.props.links==this.state.links&&this.props.data==this.state.data&&this.props.dayWidth==this.state.dayWidth&&this.props.selectedItem==this.state.selectedItem||(this.state.selectedItem=this.props.selectedItem,this.state.dayWidth=this.props.dayWidth,this.state.links=this.props.links,this.state.data=this.props.data,this.state.links&&this.state.data&&this.renderLinks())}},{key:"render",value:function(){return this.refreshData(),this.renderChangingTaskLinks(),r.a.createElement("svg",{x:0,y:0,width:"100%",pointerEvents:"none",style:{position:"absolute",top:60,userSelect:"none",height:"100%"}},r.a.createElement("defs",null,r.a.createElement("marker",{id:"arrow",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"9",markerHeight:"9",orient:"auto-start-reverse"},r.a.createElement("path",{d:"M 0 0 L 10 5 L 0 10 z",strokeLinejoin:"round"}))),r.a.createElement("g",{transform:"matrix(1,0,0,1,".concat(-(this.props.scrollLeft-this.props.nowposition),",").concat(-this.props.scrollTop,")")},this.cache,this.renderCreateLink()))}}])&&Dt(n.prototype,i),a&&Dt(n,a),e}();function Nt(t){"@babel/helpers - typeof";return(Nt="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)}function Wt(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function Vt(t){return(Vt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ft(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function At(t,e){return(At=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Ht(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Yt=function(t){function e(t){var n,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),o=this,i=Vt(e).call(this,t),Ht(Ft(n=!i||"object"!==Nt(i)&&"function"!=typeof i?Ft(o):i),"onFocus",function(){n.setState({editing:!0})}),Ht(Ft(n),"onBlur",function(){n.finishEditing()}),Ht(Ft(n),"handleKey",function(t){13===(t.keyCode||t.which)&&n.finishEditing()}),Ht(Ft(n),"finishEditing",function(){n.isFocus=!1,n.setState({editing:!1}),n.props.onChange&&n.props.onChange(n.state.value)}),Ht(Ft(n),"handleChange",function(t){n.setState({value:t.target.value})}),Ht(Ft(n),"renderDiv",function(){return r.a.createElement("div",{tabIndex:n.props.index,onClick:n.onFocus,onFocus:n.onFocus,style:{width:"100%"}}," ",n.state.value)}),Ht(Ft(n),"renderEditor",function(){return r.a.createElement("input",{ref:"textInput",onBlur:n.onBlur,style:{width:"100%",outlineColor:"black",outlineStyle:"oinset"},type:"text",name:"name",value:n.state.value,onKeyUp:n.handleKey,onChange:n.handleChange})}),n.isFocus=!1,n.state={editing:!1,value:n.props.value},n}var n,i,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&At(t,e)}(e,o["Component"]),n=e,(i=[{key:"componentDidUpdate",value:function(t,e){this.refs.textInput&&!this.isFocus&&(this.refs.textInput.focus(),this.isFocus=!0)}},{key:"shouldComponentUpdate",value:function(t,e){return t.value!=this.props.value&&(this.state.value=t.value),!0}},{key:"render",value:function(){return this.state.editing?this.renderEditor():this.renderDiv()}}])&&Wt(n.prototype,i),a&&Wt(n,a),e}();function Bt(t){"@babel/helpers - typeof";return(Bt="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)}function Xt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function qt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Gt(t,e){if(!(t instanceof e))throw new TypeError(