react-gantt-timeline
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("moment"),require("react-sizeme")):"function"==typeof define&&define.amd?define("react-gantt-timeline",["React","moment","ReactDOM"],t):"object"==typeof exports?exports["react-gantt-timeline"]=t(require("react"),require("moment"),require("react-sizeme")):e["react-gantt-timeline"]=t(e.React,e.moment,e.ReactDOM)}(window,function(e,t,n){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(t,n){t.exports=e},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();var r={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"}},i=new(function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.load=function(e){t.data={},e?t.populate(e,r,t.data):t.data=r},this.data=r}return o(e,[{key:"populate",value:function(e,t,n){if(this.isObject(t))for(var o in t)e[o]?(n[o]=e[o],this.populate(e[o],t[o],n[o])):n[o]=t[o]}},{key:"isObject",value:function(e){return"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e}},{key:"values",get:function(){return this.data}}]),e}());t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();var r=new(function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.dayToPosition=function(e,t,n){return e*n+t},this.daysInYear=function(e){return t.isLeapYear(e)?366:365}}return o(e,[{key:"dateToPixel",value:function(e,t,n){var o=this.getToday(),r=new Date(e),i=60*(r.getTimezoneOffset()-o.getTimezoneOffset())*1e3;return(r.getTime()-o.getTime()-i)/36e5*(n/24)+t}},{key:"pixelToDate",value:function(e,t,n){var o=24/n,r=e-t,i=this.getToday(),a=i.getTime()+r*o*36e5,s=new Date(a),l=60*(s.getTimezoneOffset()-i.getTimezoneOffset())*1e3;return s.setTime(s.getTime()+l),s}},{key:"getToday",value:function(){var e=new Date;return e.setHours(0,0,0,0),e}},{key:"monthDiff",value:function(e,t){return Math.abs(t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear()))}},{key:"daysInMonth",value:function(e,t){return new Date(t,e,0).getDate()}},{key:"isLeapYear",value:function(e){return e%400==0||e%100!=0&&e%4==0}}]),e}());t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.MODE_NONE=0,t.MODE_MOVE=1,t.MOVE_RESIZE_LEFT=2,t.MOVE_RESIZE_RIGHT=3,t.BUFFER_DAYS=30,t.DATA_CONTAINER_WIDTH=5e3,t.VIEW_MODE_DAY="day",t.VIEW_MODE_WEEK="week",t.VIEW_MODE_MONTH="month",t.VIEW_MODE_YEAR="year",t.DAY_YEAR_MODE=4,t.DAY_MONTH_MODE=24,t.DAY_WEEK_MODE=480,t.HOUR_DAY_WEEK=20,t.DAY_DAY_MODE=1440,t.HOUR_DAY_DAY=60},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=function(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var r=(a=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),i=o.sources.map(function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"});return[n].concat(i).concat([r]).join("\n")}var a;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},r=0;r<this.length;r++){var i=this[r][0];"number"==typeof i&&(o[i]=!0)}for(r=0;r<e.length;r++){var a=e[r];"number"==typeof a[0]&&o[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},function(e,t,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(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var n=function(e){return document.querySelector(e)}.call(this,e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}}(),l=null,u=0,c=[],d=n(17);function p(e,t){for(var n=0;n<e.length;n++){var o=e[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(v(o.parts[a],t))}else{var s=[];for(a=0;a<o.parts.length;a++)s.push(v(o.parts[a],t));i[o.id]={id:o.id,refs:1,parts:s}}}}function f(e,t){for(var n=[],o={},r=0;r<e.length;r++){var i=e[r],a=t.base?i[0]+t.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(e,t){var n=s(e.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=c[c.length-1];if("top"===e.insertAt)o?o.nextSibling?n.insertBefore(t,o.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),c.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.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(e.insertInto+" "+e.insertAt.before);n.insertBefore(t,r)}}function m(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=c.indexOf(e);t>=0&&c.splice(t,1)}function y(e){var t=document.createElement("style");return void 0===e.attrs.type&&(e.attrs.type="text/css"),g(t,e.attrs),h(e,t),t}function g(e,t){Object.keys(t).forEach(function(n){e.setAttribute(n,t[n])})}function v(e,t){var n,o,r,i;if(t.transform&&e.css){if(!(i=t.transform(e.css)))return function(){};e.css=i}if(t.singleton){var a=u++;n=l||(l=y(t)),o=k.bind(null,n,a,!1),r=k.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",g(t,e.attrs),h(e,t),t}(t),o=function(e,t,n){var o=n.css,r=n.sourceMap,i=void 0===t.convertToAbsoluteUrls&&r;(t.convertToAbsoluteUrls||i)&&(o=d(o));r&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([o],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,t),r=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=y(t),o=function(e,t){var n=t.css,o=t.media;o&&e.setAttribute("media",o);if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,n),r=function(){m(n)});return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else r()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=f(e,t);return p(n,t),function(e){for(var o=[],r=0;r<n.length;r++){var a=n[r];(s=i[a.id]).refs--,o.push(s)}e&&p(f(e,t),t);for(r=0;r<o.length;r++){var s;if(0===(s=o[r]).refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete i[s.id]}}}};var b,w=(b=[],function(e,t){return b[e]=t,b.filter(Boolean).join("\n")});function k(e,t,n,o){var r=n?"":o.css;if(e.styleSheet)e.styleSheet.cssText=w(t,r);else{var i=document.createTextNode(r),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(i,a[t]):e.appendChild(i)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();var r=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data={},this.link={}}return o(e,[{key:"registerData",value:function(e){if(e){this.data={};for(var t=0;t<e.length;t++)this.data[e[t].id]={item:e[t],index:t}}}},{key:"registerLinks",value:function(e){if(e){this.link={};for(var t=0,n=0,o=0;o<e.length;o++){t=e[o].start,n=e[o].end;var r={link:e[o],index:o};this.createAddTo(t,this.link,r,o),this.createAddTo(n,this.link,r,o)}}}},{key:"createAddTo",value:function(e,t,n,o){t[e]||(t[e]=[]),-1==t[e].indexOf(n)&&t[e].push(n)}},{key:"getTask",value:function(e){return this.data[e]}},{key:"getLinks",value:function(e){return this.link[e]}}]),e}());t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(0),i=s(r),a=s(n(1));function s(e){return e&&e.__esModule?e:{default:e}}var l=20,u=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.calcNormCoordinates=function(){var e;return{cpt1:{x:e=n.props.start.x+(n.props.end.x-n.props.start.x)/2,y:n.props.start.y},cpt2:{x:e,y:n.props.end.y}}},n.calcSCoordinates=function(){var e={x:n.props.start.x+l,y:n.props.start.y},t=(n.props.end.y-n.props.start.y)/2,o={x:e.x,y:e.y+t},r={x:n.props.end.x-l,y:o.y};return{cpt1:e,cpt2:o,cpt3:r,cpt4:{x:r.x,y:r.y+t}}},n.getPath=function(){var e=null;return n.props.start.x>n.props.end.x?(e=n.calcSCoordinates(),"M"+n.props.start.x+" "+n.props.start.y+" "+e.cpt1.x+" "+e.cpt1.y+" "+e.cpt2.x+" "+e.cpt2.y+" "+e.cpt3.x+" "+e.cpt3.y+" "+e.cpt4.x+" "+e.cpt4.y+" "+n.props.end.x+" "+n.props.end.y):(e=n.calcNormCoordinates(),"M"+n.props.start.x+" "+n.props.start.y+" "+e.cpt1.x+" "+e.cpt1.y+" "+e.cpt2.x+" "+e.cpt2.y+" "+n.props.end.x+" "+n.props.end.y)},n.onSelect=function(e){n.props.onSelectItem&&n.props.onSelectItem(n.props.item)},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.Component),o(t,[{key:"render",value:function(){var e=this.props.isSelected?a.default.values.links.selectedColor:a.default.values.links.color;return i.default.createElement("g",{className:"timeline-link"},i.default.createElement("path",{pointerEvents:"stroke",onMouseDown:this.onSelect,stroke:"white",d:this.getPath(),strokeLinejoin:"round",fill:"transparent",strokeWidth:"4",cursor:"pointer"}),i.default.createElement("path",{pointerEvents:"stroke",onMouseDown:this.onSelect,stroke:e,d:this.getPath(),strokeLinejoin:"round",fill:"transparent",strokeWidth:"1",cursor:"pointer",markerEnd:"url(#arrow)"}))}}]),t}();t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(0),a=g(i),s=g(n(9)),l=g(n(12)),u=g(n(13)),c=g(n(18)),d=g(n(21)),p=g(n(23)),f=g(n(6)),h=n(3),m=g(n(25)),y=g(n(1));g(n(2));function g(e){return e&&e.__esModule?e:{default:e}}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n(26);var b=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));n.onSize=function(e){n.calculateVerticalScrollVariables(e),n.initialise||(n.dc.initialise(n.state.scrollLeft+n.state.nowposition,n.state.scrollLeft+n.state.nowposition+e.width,n.state.nowposition,n.state.dayWidth),n.initialise=!0),n.setStartEnd();var t=Math.ceil(e.height/n.props.itemheight),o=n.calcNumVisibleDays(e),r=n.calculateStartEndRows(t,n.props.data,n.state.scrollTop);n.setState({numVisibleRows:t,numVisibleDays:o,startRow:r.start,endRow:r.end,size:e})},n.verticalChange=function(e){if(e!=n.state.scrollTop){var t=n.calculateStartEndRows(n.state.numVisibleRows,n.props.data,e);t.start!==n.state.start&&n.setState(n.state={scrollTop:e,startRow:t.start,endRow:t.end})}},n.calculateStartEndRows=function(e,t,o){var r=Math.trunc(o/n.props.itemheight);return{start:r,end:r+e>=t.length?t.length:r+e}},n.setStartEnd=function(){n.dc.setStartEnd(n.state.scrollLeft,n.state.scrollLeft+n.state.size.width,n.state.nowposition,n.state.dayWidth)},n.horizontalChange=function(e){var t=n.state.nowposition,o=-1,r=n.state.headerData,i=n.state.startRow,a=n.state.endRow;e>n.pxToScroll?(t=n.state.nowposition-n.pxToScroll,o=0):e<=0?(t=n.state.nowposition+n.pxToScroll,o=n.pxToScroll):o=e;var s=Math.trunc((e-n.state.nowposition)/n.state.dayWidth);a=(i=Math.trunc(n.state.scrollTop/n.props.itemheight))+n.state.numVisibleRows>=n.props.data.length?n.props.data.length-1:i+n.state.numVisibleRows,n.setStartEnd(),n.setState(n.state={currentday:s,nowposition:t,headerData:r,scrollLeft:o,startRow:i,endRow:a})},n.calculateVerticalScrollVariables=function(e){n.pxToScroll=(1-e.width/h.DATA_CONTAINER_WIDTH)*h.DATA_CONTAINER_WIDTH-1},n.onHorizonChange=function(e,t){n.props.onHorizonChange&&n.props.onHorizonChange(e,t)},n.doMouseDown=function(e){n.dragging=!0,n.draggingPosition=e.clientX},n.doMouseMove=function(e){if(n.dragging){var t=n.draggingPosition-e.clientX;0!==t&&(n.draggingPosition=e.clientX,n.horizontalChange(n.state.scrollLeft+t))}},n.doMouseUp=function(e){n.dragging=!1},n.doMouseLeave=function(e){n.dragging=!1},n.doTouchStart=function(e){n.dragging=!0,n.draggingPosition=e.touches[0].clientX},n.doTouchEnd=function(e){n.dragging=!1},n.doTouchMove=function(e){if(n.dragging){var t=n.draggingPosition-e.touches[0].clientX;0!==t&&(n.draggingPosition=e.touches[0].clientX,n.horizontalChange(n.state.scrollLeft+t))}},n.doTouchCancel=function(e){n.dragging=!1},n.doMouseLeave=function(e){n.dragging=!1},n.onTaskListSizing=function(e){n.setState(function(t){var n=o({},t);return n.sideStyle={width:n.sideStyle.width-e},n})},n.onSelectItem=function(e){n.props.onSelectItem&&e!=n.props.selectedItem&&n.props.onSelectItem(e)},n.onStartCreateLink=function(e,t){n.setState({interactiveMode:!0,taskToCreate:{task:e,position:t}})},n.onFinishCreateLink=function(e,t){n.props.onCreateLink&&e&&n.props.onCreateLink({start:n.state.taskToCreate,end:{task:e,position:t}}),n.setState({interactiveMode:!1,taskToCreate:null})},n.onTaskChanging=function(e){n.setState({changingTask:e})},n.calcNumVisibleDays=function(e){return Math.ceil(e.width/n.state.dayWidth)+h.BUFFER_DAYS},n.checkNeeeData=function(){if(n.props.data!=n.state.data){n.state.data=n.props.data;var e=n.calculateStartEndRows(n.state.numVisibleRows,n.props.data,n.state.scrollTop);n.state.startRow=e.start,n.state.endRow=e.end,f.default.registerData(n.state.data)}n.props.links!=n.state.links&&(n.state.links=n.props.links,f.default.registerLinks(n.props.links))},n.dragging=!1,n.draggingPosition=0,n.dc=new m.default,n.dc.onHorizonChange=n.onHorizonChange,n.initialise=!1,n.pxToScroll=1900;var r=n.getDayWidth(n.props.mode);return y.default.load(n.props.config),n.state={currentday:0,nowposition:0,startRow:0,endRow:10,sideStyle:{width:200},scrollLeft:0,scrollTop:0,numVisibleRows:40,numVisibleDays:60,dayWidth:r,interactiveMode:!1,taskToCreate:null,links:[],mode:n.props.mode?n.props.mode:h.VIEW_MODE_MONTH,size:{width:1,height:1},changingTask:null},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.Component),r(t,[{key:"getDayWidth",value:function(e){switch(e){case h.VIEW_MODE_DAY:return h.DAY_DAY_MODE;case h.VIEW_MODE_WEEK:return h.DAY_WEEK_MODE;case h.VIEW_MODE_MONTH:return h.DAY_MONTH_MODE;case h.VIEW_MODE_YEAR:return h.DAY_YEAR_MODE;default:return h.DAY_MONTH_MODE}}},{key:"checkMode",value:function(){if(this.props.mode!=this.state.mode&&this.props.mode){this.state.mode=this.props.mode;var e=this.getDayWidth(this.state.mode);this.state.dayWidth=e,this.state.numVisibleDays=this.calcNumVisibleDays(this.state.size);var t=Math.ceil(-this.state.currentday*this.state.dayWidth/this.pxToScroll);this.state.nowposition=t*this.pxToScroll;var n=(this.state.currentday*this.state.dayWidth+this.state.nowposition)%this.pxToScroll;this.state.scrollLeft=n}}},{key:"render",value:function(){var e;return this.checkMode(),this.checkNeeeData(),a.default.createElement("div",{className:"timeLine"},a.default.createElement("div",{className:"timeLine-side-main",style:this.state.sideStyle},a.default.createElement(p.default,{ref:"taskViewPort",itemheight:this.props.itemheight,startRow:this.state.startRow,endRow:this.state.endRow,data:this.props.data,selectedItem:this.props.selectedItem,onSelectItem:this.onSelectItem,onUpdateTask:this.props.onUpdateTask,onScroll:this.verticalChange}),a.default.createElement(l.default,{onTaskListSizing:this.onTaskListSizing})),a.default.createElement("div",{className:"timeLine-main"},a.default.createElement(u.default,{headerData:this.state.headerData,numVisibleDays:this.state.numVisibleDays,currentday:this.state.currentday,nowposition:this.state.nowposition,dayWidth:this.state.dayWidth,mode:this.state.mode,scrollLeft:this.state.scrollLeft}),a.default.createElement(c.default,{ref:"dataViewPort",scrollLeft:this.state.scrollLeft,scrollTop:this.state.scrollTop,itemheight:this.props.itemheight,nowposition:this.state.nowposition,startRow:this.state.startRow,endRow:this.state.endRow,data:this.props.data,selectedItem:this.props.selectedItem,dayWidth:this.state.dayWidth,onScroll:this.scrollData,onMouseDown:this.doMouseDown,onMouseMove:this.doMouseMove,onMouseUp:this.doMouseUp,onMouseLeave:this.doMouseLeave,onTouchStart:this.doTouchStart,onTouchMove:this.doTouchMove,onTouchEnd:this.doTouchEnd,onTouchCancel:this.doTouchCancel,onSelectItem:this.onSelectItem,onUpdateTask:this.props.onUpdateTask,onTaskChanging:this.onTaskChanging,onStartCreateLink:this.onStartCreateLink,onFinishCreateLink:this.onFinishCreateLink,boundaries:{lower:this.state.scrollLeft,upper:this.state.scrollLeft+this.state.size.width},onSize:this.onSize}),a.default.createElement(d.default,(v(e={scrollLeft:this.state.scrollLeft,scrollTop:this.state.scrollTop,startRow:this.state.startRow,endRow:this.state.endRow,data:this.props.data,nowposition:this.state.nowposition,dayWidth:this.state.dayWidth,interactiveMode:this.state.interactiveMode,taskToCreate:this.state.taskToCreate,onFinishCreateLink:this.onFinishCreateLink,changingTask:this.state.changingTask,selectedItem:this.props.selectedItem,onSelectItem:this.onSelectItem,itemheight:this.props.itemheight},"onSelectItem",this.onSelectItem),v(e,"links",this.props.links),e))))}}]),t}();b.propTypes={itemheight:s.default.number.isRequired,dayWidth:s.default.number.isRequired},b.defaultProps={itemheight:20,dayWidth:24},t.default=b},function(e,t,n){e.exports=n(10)()},function(e,t,n){"use strict";var o=n(11);function r(){}e.exports=function(){function e(e,t,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 t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(0),i=s(r),a=s(n(1));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.doMouseMove=n.doMouseMove.bind(n),n.doMouseDown=n.doMouseDown.bind(n),n.doMouseUp=n.doMouseUp.bind(n),n.state={dragging:!1},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.Component),o(t,[{key:"doMouseDown",value:function(e){0===e.button&&(this.draggingPosition=e.clientX,this.setState({dragging:!0}))}},{key:"componentDidUpdate",value:function(e,t){this.state.dragging&&!t.dragging?(document.addEventListener("mousemove",this.doMouseMove),document.addEventListener("mouseup",this.doMouseUp)):!this.state.dragging&&t.dragging&&(document.removeEventListener("mousemove",this.doMouseMove),document.removeEventListener("mouseup",this.doMouseUp))}},{key:"doMouseMove",value:function(e){if(this.state.dragging){e.stopPropagation();var t=this.draggingPosition-e.clientX;this.draggingPosition=e.clientX,this.props.onTaskListSizing(t)}}},{key:"doMouseUp",value:function(e){this.setState({dragging:!1})}},{key:"render",value:function(){return i.default.createElement("div",{className:"verticalResizer",style:a.default.values.taskList.verticalSeparator.style,onMouseDown:this.doMouseDown},i.default.createElement("div",{className:"squareGrip",style:a.default.values.taskList.verticalSeparator.grip.style}),i.default.createElement("div",{className:"squareGrip",style:a.default.values.taskList.verticalSeparator.grip.style}),i.default.createElement("div",{className:"squareGrip",style:a.default.values.taskList.verticalSeparator.grip.style}),i.default.createElement("div",{className:"squareGrip",style:a.default.values.taskList.verticalSeparator.grip.style}))}}]),t}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HeaderItem=void 0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(0),a=d(i),s=d(n(14)),l=n(3),u=d(n(1)),c=d(n(2));function d(e){return e&&e.__esModule?e:{default:e}}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}n(15);var m=t.HeaderItem=function(e){function t(e){return p(this,t),f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return h(t,i.PureComponent),r(t,[{key:"render",value:function(){return a.default.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}},a.default.createElement("div",null,this.props.label))}}]),t}(),y=function(e){function t(e){p(this,t);var n=f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.getStartDate=function(e,t){var n=null;switch(t){case"year":return n=e.year(),(0,s.default)([n,0,1]);case"month":n=e.year();var o=e.month();return(0,s.default)([n,o,1]);case"week":return e.subtract(e.day(),"days");default:return e}},n.renderTime=function(e,t,n,o){for(var r=[],i=t/24,s=0,l=0;l<24;l++)r.push(a.default.createElement(m,{key:l,left:s,width:i,label:"shorttime"==n?l:l+":00"})),s+=i;return a.default.createElement("div",{key:o,style:{position:"absolute",height:20,left:e,width:t}}," ",r)},n.renderHeaderRows=function(e,t,r){for(var i={top:[],middle:[],bottom:[]},c={},d="",p="",f="",h=null,y=null,g=n.props.currentday,v=n.props.currentday+n.props.numVisibleDays,b=g-l.BUFFER_DAYS;b<v+l.BUFFER_DAYS;b++)d!=(h=(0,s.default)().add(b,"days")).format(n.getFormat(e,"top"))&&(d=h.format(n.getFormat(e,"top")),y=n.getBox(h,e,c.top),c.top=y.left+y.width,i.top.push(a.default.createElement(m,{key:b,left:y.left,width:y.width,label:d}))),p!=h.format(n.getFormat(t))&&(p=h.format(n.getFormat(t)),y=n.getBox(h,t,c.middle),c.middle=y.left+y.width,i.middle.push(a.default.createElement(m,{key:b,left:y.left,width:y.width,label:p}))),f!=h.format(n.getFormat(r))&&(f=h.format(n.getFormat(r)),y=n.getBox(h,r,c.bottom),c.bottom=y.left+y.width,"shorttime"==r||"fulltime"==r?i.bottom.push(n.renderTime(y.left,y.width,r,b)):i.bottom.push(a.default.createElement(m,{key:b,left:y.left,width:y.width,label:f})));return a.default.createElement("div",{className:"timeLine-main-header-container",style:{width:l.DATA_CONTAINER_WIDTH,maxWidth:l.DATA_CONTAINER_WIDTH}},a.default.createElement("div",{className:"header-top",style:o({},u.default.values.header.top.style)},i.top),a.default.createElement("div",{className:"header-middle",style:o({},u.default.values.header.middle.style)},i.middle),a.default.createElement("div",{className:"header-bottom",style:o({},u.default.values.header.bottom.style)},i.bottom))},n.renderHeader=function(){switch(n.props.mode){case l.VIEW_MODE_DAY:return n.renderHeaderRows("week","dayweek","fulltime");case l.VIEW_MODE_WEEK:return n.renderHeaderRows("week","dayweek","shorttime");case l.VIEW_MODE_MONTH:return n.renderHeaderRows("month","dayweek","daymonth");case l.VIEW_MODE_YEAR:return n.renderHeaderRows("year","month","week")}},n.setBoundaries=function(){n.start=n.props.currentday-l.BUFFER_DAYS,n.end=n.props.currentday+n.props.numVisibleDays+l.BUFFER_DAYS},n.needToRender=function(){return n.props.currentday<n.start||n.props.currentday+n.props.numVisibleDays>n.end},n.setBoundaries(),n}return h(t,i.PureComponent),r(t,[{key:"getFormat",value:function(e,t){switch(e){case"year":return"YYYY";case"month":return"top"==t?"MMMM YYYY":"MMMM";case"week":return"top"==t?"ww MMMM YYYY":"ww";case"dayweek":return"dd";case"daymonth":return"D"}}},{key:"getModeIncrement",value:function(e,t){switch(t){case"year":return c.default.daysInYear(e.year());case"month":return e.daysInMonth();case"week":return 7;default:return 1}}},{key:"getBox",value:function(e,t,n){var o=this.getModeIncrement(e,t)*this.props.dayWidth;if(!n){var r=this.getStartDate(e,t);r=r.startOf("day");var i=(0,s.default)().startOf("day"),a=r.diff(i,"days");n=c.default.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),a.default.createElement("div",{id:"timeline-header",ref:"Header",className:"timeLine-main-header-viewPort"},this.renderHeader())}}]),t}();t.default=y},function(e,n){e.exports=t},function(e,t,n){var o=n(16);"string"==typeof o&&(o=[[e.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(5)(o,r);o.locals&&(e.exports=o.locals)},function(e,t,n){(e.exports=n(4)(!1)).push([e.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}\n.header-bottom{\n height: 20px;\n font-size:10px;\n border-bottom: solid 0.5px silver;\n}\n",""])},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,o=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(e,t){var r,i=t.trim().replace(/^"(.*)"$/,function(e,t){return t}).replace(/^'(.*)'$/,function(e,t){return t});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?e:(r=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:o+i.replace(/^\.\//,""),"url("+JSON.stringify(r)+")")})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataViewPort=t.DataRow=void 0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(0),a=p(i),s=n(3),l=p(n(19)),u=p(n(2)),c=p(n(20)),d=p(n(1));function p(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var y=t.DataRow=function(e){function t(e){return f(this,t),h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return m(t,i.Component),r(t,[{key:"render",value:function(){return a.default.createElement("div",{className:"timeLine-main-data-row",style:o({},d.default.values.dataViewPort.rows.style,{top:this.props.top,height:this.props.itemheight})},this.props.children)}}]),t}(),g=t.DataViewPort=function(e){function t(e){f(this,t);var n=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.onChildDrag=function(e){n.childDragging=e},n.renderRows=function(){for(var e=[],t=n.props.startRow;t<n.props.endRow+1;t++){var o=n.props.data[t];if(!o)break;var r=u.default.dateToPixel(o.start,n.props.nowposition,n.props.dayWidth),i=u.default.dateToPixel(o.end,n.props.nowposition,n.props.dayWidth)-r;e.push(a.default.createElement(y,{key:t,label:o.name,top:t*n.props.itemheight,left:20,itemheight:n.props.itemheight},a.default.createElement(l.default,{item:o,label:o.name,nowposition:n.props.nowposition,dayWidth:n.props.dayWidth,color:o.color,left:r,width:i,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 e},n.doMouseDown=function(e){0!==e.button||n.childDragging||n.props.onMouseDown(e)},n.doMouseMove=function(e){n.props.onMouseMove(e,n.refs.dataViewPort)},n.doTouchStart=function(e){n.childDragging||n.props.onTouchStart(e)},n.doTouchMove=function(e){n.props.onTouchMove(e,n.refs.dataViewPort)},n.childDragging=!1,n}return m(t,i.Component),r(t,[{key:"getContainerHeight",value:function(e){return e>0?e*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 e=this.getContainerHeight(this.props.data.length);return a.default.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},a.default.createElement("div",{className:"timeLine-main-data-container",style:{height:e,width:s.DATA_CONTAINER_WIDTH,maxWidth:s.DATA_CONTAINER_WIDTH}},this.renderRows()))}}]),t}();t.default=(0,c.default)({monitorWidth:!0,monitorHeight:!0})(g)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(0),a=c(i),s=c(n(2)),l=n(3),u=c(n(1));function c(e){return e&&e.__esModule?e:{default:e}}var d=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.onCreateLinkMouseDown=function(e,t){0===e.button&&(e.stopPropagation(),n.props.onStartCreateLink(n.props.item,t))},n.onCreateLinkMouseUp=function(e,t){e.stopPropagation(),n.props.onFinishCreateLink(n.props.item,t)},n.onCreateLinkTouchStart=function(e,t){e.stopPropagation(),n.props.onStartCreateLink(n.props.item,t)},n.onCreateLinkTouchEnd=function(e,t){e.stopPropagation(),n.props.onFinishCreateLink(n.props.item,t)},n.doMouseDown=function(e,t){n.props.onUpdateTask&&0===e.button&&(e.stopPropagation(),n.dragStart(e.clientX,t))},n.doMouseMove=function(e){n.state.dragging&&(e.stopPropagation(),n.dragProcess(e.clientX))},n.doMouseUp=function(){n.dragEnd()},n.doTouchStart=function(e,t){n.props.onUpdateTask&&(e.stopPropagation(),n.dragStart(e.touches[0].clientX,t))},n.doTouchMove=function(e){n.state.dragging&&(e.stopPropagation(),n.dragProcess(e.changedTouches[0].clientX))},n.doTouchEnd=function(e){n.dragEnd()},n.calculateStyle=n.calculateStyle.bind(n),n.state={dragging:!1,left:n.props.left,width:n.props.width,mode:l.MODE_NONE},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.Component),r(t,[{key:"componentDidUpdate",value:function(e,t){this.state.dragging&&!t.dragging?(document.addEventListener("mousemove",this.doMouseMove),document.addEventListener("mouseup",this.doMouseUp),document.addEventListener("touchmove",this.doTouchMove),document.addEventListener("touchend",this.doTouchEnd)):!this.state.dragging&&t.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(e,t){this.props.onChildDrag(!0),this.draggingPosition=e,this.setState({dragging:!0,mode:t,left:this.props.left,width:this.props.width})}},{key:"dragProcess",value:function(e){var t=this.draggingPosition-e,n=this.state.left,o=this.state.width;switch(this.state.mode){case l.MODE_MOVE:n=this.state.left-t;break;case l.MOVE_RESIZE_LEFT:n=this.state.left-t,o=this.state.width+t;break;case l.MOVE_RESIZE_RIGHT:o=this.state.width-t}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=e}},{key:"dragEnd",value:function(){this.props.onChildDrag(!1);var e=s.default.pixelToDate(this.state.left,this.props.nowposition,this.props.dayWidth),t=s.default.pixelToDate(this.state.left+this.state.width,this.props.nowposition,this.props.dayWidth);this.props.onUpdateTask(this.props.item,{start:e,end:t}),this.setState({dragging:!1,mode:l.MODE_NONE})}},{key:"calculateStyle",value:function(){var e=this.props.isSelected?u.default.values.dataViewPort.task.selectedStyle:u.default.values.dataViewPort.task.style,t=this.props.color?this.props.color:e.backgroundColor;return this.state.dragging?o({},e,{backgroundColor:t,left:this.state.left,width:this.state.width,height:this.props.height-5,top:2}):o({},e,{backgroundColor:t,left:this.props.left,width:this.props.width,height:this.props.height-5,top:2})}},{key:"render",value:function(){var e=this,t=this.calculateStyle();return a.default.createElement("div",{onMouseDown:function(t){return e.doMouseDown(t,l.MODE_MOVE)},onTouchStart:function(t){return e.doTouchStart(t,l.MODE_MOVE)},onClick:function(t){e.props.onSelectItem(e.props.item)},style:t},a.default.createElement("div",{className:"timeLine-main-data-task-side",style:{top:0,left:-4,height:t.height},onMouseDown:function(t){return e.doMouseDown(t,l.MOVE_RESIZE_LEFT)},onTouchStart:function(t){return e.doTouchStart(t,l.MOVE_RESIZE_LEFT)}},a.default.createElement("div",{className:"timeLine-main-data-task-side-linker",onMouseUp:function(t){return e.onCreateLinkMouseUp(t,l.LINK_POS_LEFT)},onTouchEnd:function(t){return e.onCreateLinkTouchEnd(t,l.LINK_POS_LEFT)}})),a.default.createElement("div",{style:{overflow:"hidden"}},u.default.values.dataViewPort.task.showLabel?this.props.item.name:""),a.default.createElement("div",{className:"timeLine-main-data-task-side",style:{top:0,left:t.width-3,height:t.height},onMouseDown:function(t){return e.doMouseDown(t,l.MOVE_RESIZE_RIGHT)},onTouchStart:function(t){return e.doTouchStart(t,l.MOVE_RESIZE_RIGHT)}},a.default.createElement("div",{className:"timeLine-main-data-task-side-linker",onMouseDown:function(t){return e.onCreateLinkMouseDown(t,l.LINK_POS_RIGHT)},onTouchStart:function(t){return e.onCreateLinkTouchStart(t,l.LINK_POS_RIGHT)}})))}}]),t}();t.default=d},function(e,t){e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(0),i=c(r),a=c(n(6)),s=c(n(7)),l=c(n(22)),u=c(n(2));function c(e){return e&&e.__esModule?e:{default:e}}function d(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var p=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.getItemPosition=function(e,t){return{x:u.default.dateToPixel(t,0,n.props.dayWidth),y:e*n.props.itemheight+n.props.itemheight/2}},n.renderCreateLink=function(){if(n.props.interactiveMode){var e=a.default.getTask(n.props.taskToCreate.task.id),t=n.getItemPosition(e.index,e.item.end);return i.default.createElement(l.default,{start:t,onFinishCreateLink:n.props.onFinishCreateLink})}},n.renderChangingTaskLinks=function(){if(n.props.changingTask!=n.state.changingTask){n.state.changingTask=n.props.changingTask;var e=a.default.getLinks(n.state.changingTask.item.id);if(!e)return;for(var t=null,o=null,r=null,l={},u={},c=0;c<e.length;c++)t=e[c],(o=a.default.getTask(t.link.start))&&(r=a.default.getTask(t.link.end))&&(l=n.getItemPosition(o.index,o.item.end),n.state.changingTask.item.id==t.link.start&&(l.x=n.state.changingTask.position.end),u=n.getItemPosition(r.index,r.item.start),n.state.changingTask.item.id==t.link.end&&(u.x=n.state.changingTask.position.start),n.cache[t.index]=i.default.createElement(s.default,{key:-c-1,item:t,start:{x:l.x,y:l.y},end:{x:u.x,y:u.y},isSelected:n.props.selectedItem==t,onSelectItem:n.props.onSelectItem}),n.cache=[].concat(d(n.cache)))}},n.cache=[],n.state={links:[],data:[],selectedItem:null},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.Component),o(t,[{key:"renderLink",value:function(e,t,n,o){var r=this.getItemPosition(e.index,e.item.end),a=this.getItemPosition(t.index,t.item.start);return i.default.createElement(s.default,{key:o,item:n,start:{x:r.x,y:r.y},end:{x:a.x,y:a.y},isSelected:this.props.selectedItem==n,onSelectItem:this.props.onSelectItem})}},{key:"renderLinks",value:function(){this.cache=[];var e={},t=void 0,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=a.default.getTask(r.start))&&(n=a.default.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(),i.default.createElement("svg",{x:0,y:0,width:"100%",pointerEvents:"none",style:{position:"absolute",top:60,userSelect:"none",height:"100%"}},i.default.createElement("defs",null,i.default.createElement("marker",{id:"arrow",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"9",markerHeight:"9",orient:"auto-start-reverse"},i.default.createElement("path",{d:"M 0 0 L 10 5 L 0 10 z",strokeLinejoin:"round"}))),i.default.createElement("g",{transform:"matrix(1,0,0,1,"+-(this.props.scrollLeft-this.props.nowposition)+","+-this.props.scrollTop+")"},this.cache,this.renderCreateLink()))}}]),t}();t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(0),i=s(r),a=s(n(7));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.doMouseMove=function(e){n.init||(n.lastX=e.clientX,n.lastY=e.clientY,n.init=!0);var t=n.state.x+(e.clientX-n.lastX),o=n.state.y+(e.clientY-n.lastY);n.lastX=e.clientX,n.lastY=e.clientY,n.setState({x:t,y:o})},n.doMouseUp=function(e){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}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.Component),o(t,[{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 i.default.createElement(a.default,{key:-1,start:{x:this.props.start.x,y:this.props.start.y},end:{x:this.state.x,y:this.state.y}})}}]),t}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TaskRow=t.VerticalLine=void 0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(0),a=u(i),s=u(n(1)),l=u(n(24));function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.VerticalLine=function(e){function t(e){return c(this,t),d(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return p(t,i.Component),r(t,[{key:"render",value:function(){return a.default.createElement("div",{className:"timeLine-main-data-verticalLine",style:{left:this.props.left}})}}]),t}();var f=t.TaskRow=function(e){function t(e){c(this,t);var n=d(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.onChange=function(e){n.props.onUpdateTask&&n.props.onUpdateTask(n.props.item,{name:e})},n}return p(t,i.Component),r(t,[{key:"render",value:function(){var e=this;return a.default.createElement("div",{className:"timeLine-side-task-row",style:o({},s.default.values.taskList.task.style,{top:this.props.top,height:this.props.itemheight}),onClick:function(t){return e.props.onSelectItem(e.props.item)}},a.default.createElement(l.default,{value:this.props.label,index:this.props.index,onChange:this.onChange}))}}]),t}(),h=function(e){function t(e){c(this,t);var n=d(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.doScroll=function(){n.props.onScroll(n.refs.taskViewPort.scrollTop)},n}return p(t,i.Component),r(t,[{key:"getContainerStyle",value:function(e){return{height:e>0?e*this.props.itemheight:10}}},{key:"renderTaskRow",value:function(e){for(var t=[],n=this.props.startRow;n<this.props.endRow+1;n++){var o=e[n];if(!o)break;t.push(a.default.createElement(f,{key:n,index:n,item:o,label:o.name,top:n*this.props.itemheight,itemheight:this.props.itemheight,isSelected:this.props.selectedItem==o,onUpdateTask:this.props.onUpdateTask,onSelectItem:this.props.onSelectItem}))}return t}},{key:"render",value:function(){var e=this.props.data?this.props.data:[];return this.containerStyle=this.getContainerStyle(e.length),a.default.createElement("div",{className:"timeLine-side"},a.default.createElement("div",{className:"timeLine-side-title",style:s.default.values.taskList.title.style},a.default.createElement("div",null,s.default.values.taskList.title.label)),a.default.createElement("div",{ref:"taskViewPort",className:"timeLine-side-task-viewPort",onScroll:this.doScroll},a.default.createElement("div",{className:"timeLine-side-task-container",style:this.containerStyle},this.renderTaskRow(e))))}}]),t}();t.default=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(0),a=(o=i)&&o.__esModule?o:{default:o};var s=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.onFocus=function(){n.setState({editing:!0})},n.onBlur=function(){n.finishEditing()},n.handleKey=function(e){13===(e.keyCode||e.which)&&n.finishEditing()},n.finishEditing=function(){n.isFocus=!1,n.setState({editing:!1}),n.props.onChange&&n.props.onChange(n.state.value)},n.handleChange=function(e){n.setState({value:e.target.value})},n.renderDiv=function(){return a.default.createElement("div",{tabIndex:n.props.index,onClick:n.onFocus,onFocus:n.onFocus,style:{width:"100%"}}," ",n.state.value)},n.renderEditor=function(){return a.default.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}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.Component),r(t,[{key:"componentDidUpdate",value:function(e,t){this.refs.textInput&&!this.isFocus&&(this.refs.textInput.focus(),this.isFocus=!0)}},{key:"shouldComponentUpdate",value:function(e,t){return e.value!=this.props.value&&(this.state.value=e.value),!0}},{key:"render",value:function(){return this.state.editing?this.renderEditor():this.renderDiv()}}]),t}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=n(2),i=(o=r)&&o.__esModule?o:{default:o};t.default=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.initialise=function(e,n,o,r){t.nowposition=o,t.daywidth=r,t.setLimits(e,n,o,r),t.loadDataHorizon()},this.setStartEnd=function(e,n,o,r){t.nowposition=o,t.daywidth=r,t.needData(e,n)&&(t.setLimits(e,n),t.loadDataHorizon())},this.needData=function(e,n){return e<t.lower_data_limit||n>t.upper_data_limit},this.setLimits=function(e,n){t.lower_limit=e-1e3,t.lower_data_limit=e-750,t.upper_limit=n+1e3,t.upper_data_limit=n+750},this.loadDataHorizon=function(){var e=i.default.pixelToDate(t.lower_limit,t.nowposition,t.daywidth),n=i.default.pixelToDate(t.upper_limit,t.nowposition,t.daywidth);t.onHorizonChange(e,n)},this.lower_limit=0,this.upper_limit=0,this._dataToRender=[]}},function(e,t,n){var o=n(27);"string"==typeof o&&(o=[[e.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(5)(o,r);o.locals&&(e.exports=o.locals)},function(e,t,n){(e.exports=n(4)(!1)).push([e.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\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\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 \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\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}\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\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\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}\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\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}\n\n",""])}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("moment"),require("react-sizeme")):"function"==typeof define&&define.amd?define("react-gantt-timeline",["React","moment","ReactDOM"],t):"object"==typeof exports?exports["react-gantt-timeline"]=t(require("react"),require("moment"),require("react-sizeme")):e["react-gantt-timeline"]=t(e.React,e.moment,e.ReactDOM)}(window,function(e,t,n){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(t,n){t.exports=e},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();var r={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"}},i=new(function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.load=function(e){t.data={},e?t.populate(e,r,t.data):t.data=r},this.data=r}return o(e,[{key:"populate",value:function(e,t,n){if(this.isObject(t))for(var o in t)e[o]?(n[o]=e[o],this.populate(e[o],t[o],n[o])):n[o]=t[o]}},{key:"isObject",value:function(e){return"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e}},{key:"values",get:function(){return this.data}}]),e}());t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();var r=new(function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.dayToPosition=function(e,t,n){return e*n+t},this.daysInYear=function(e){return t.isLeapYear(e)?366:365}}return o(e,[{key:"dateToPixel",value:function(e,t,n){var o=this.getToday(),r=new Date(e),i=60*(r.getTimezoneOffset()-o.getTimezoneOffset())*1e3;return(r.getTime()-o.getTime()-i)/36e5*(n/24)+t}},{key:"pixelToDate",value:function(e,t,n){var o=24/n,r=e-t,i=this.getToday(),a=i.getTime()+r*o*36e5,s=new Date(a),l=60*(s.getTimezoneOffset()-i.getTimezoneOffset())*1e3;return s.setTime(s.getTime()+l),s}},{key:"getToday",value:function(){var e=new Date;return e.setHours(0,0,0,0),e}},{key:"monthDiff",value:function(e,t){return Math.abs(t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear()))}},{key:"daysInMonth",value:function(e,t){return new Date(t,e,0).getDate()}},{key:"isLeapYear",value:function(e){return e%400==0||e%100!=0&&e%4==0}}]),e}());t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.MODE_NONE=0,t.MODE_MOVE=1,t.MOVE_RESIZE_LEFT=2,t.MOVE_RESIZE_RIGHT=3,t.BUFFER_DAYS=30,t.DATA_CONTAINER_WIDTH=5e3,t.VIEW_MODE_DAY="day",t.VIEW_MODE_WEEK="week",t.VIEW_MODE_MONTH="month",t.VIEW_MODE_YEAR="year",t.DAY_YEAR_MODE=4,t.DAY_MONTH_MODE=24,t.DAY_WEEK_MODE=480,t.HOUR_DAY_WEEK=20,t.DAY_DAY_MODE=1440,t.HOUR_DAY_DAY=60},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=function(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var r=(a=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),i=o.sources.map(function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"});return[n].concat(i).concat([r]).join("\n")}var a;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},r=0;r<this.length;r++){var i=this[r][0];"number"==typeof i&&(o[i]=!0)}for(r=0;r<e.length;r++){var a=e[r];"number"==typeof a[0]&&o[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},function(e,t,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(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var n=function(e){return document.querySelector(e)}.call(this,e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}}(),l=null,u=0,c=[],d=n(17);function p(e,t){for(var n=0;n<e.length;n++){var o=e[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(v(o.parts[a],t))}else{var s=[];for(a=0;a<o.parts.length;a++)s.push(v(o.parts[a],t));i[o.id]={id:o.id,refs:1,parts:s}}}}function f(e,t){for(var n=[],o={},r=0;r<e.length;r++){var i=e[r],a=t.base?i[0]+t.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(e,t){var n=s(e.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=c[c.length-1];if("top"===e.insertAt)o?o.nextSibling?n.insertBefore(t,o.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),c.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.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(e.insertInto+" "+e.insertAt.before);n.insertBefore(t,r)}}function m(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=c.indexOf(e);t>=0&&c.splice(t,1)}function y(e){var t=document.createElement("style");return void 0===e.attrs.type&&(e.attrs.type="text/css"),g(t,e.attrs),h(e,t),t}function g(e,t){Object.keys(t).forEach(function(n){e.setAttribute(n,t[n])})}function v(e,t){var n,o,r,i;if(t.transform&&e.css){if(!(i=t.transform(e.css)))return function(){};e.css=i}if(t.singleton){var a=u++;n=l||(l=y(t)),o=k.bind(null,n,a,!1),r=k.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",g(t,e.attrs),h(e,t),t}(t),o=function(e,t,n){var o=n.css,r=n.sourceMap,i=void 0===t.convertToAbsoluteUrls&&r;(t.convertToAbsoluteUrls||i)&&(o=d(o));r&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([o],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,t),r=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=y(t),o=function(e,t){var n=t.css,o=t.media;o&&e.setAttribute("media",o);if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,n),r=function(){m(n)});return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else r()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=f(e,t);return p(n,t),function(e){for(var o=[],r=0;r<n.length;r++){var a=n[r];(s=i[a.id]).refs--,o.push(s)}e&&p(f(e,t),t);for(r=0;r<o.length;r++){var s;if(0===(s=o[r]).refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete i[s.id]}}}};var b,w=(b=[],function(e,t){return b[e]=t,b.filter(Boolean).join("\n")});function k(e,t,n,o){var r=n?"":o.css;if(e.styleSheet)e.styleSheet.cssText=w(t,r);else{var i=document.createTextNode(r),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(i,a[t]):e.appendChild(i)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();var r=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data={},this.link={}}return o(e,[{key:"registerData",value:function(e){if(e){this.data={};for(var t=0;t<e.length;t++)this.data[e[t].id]={item:e[t],index:t}}}},{key:"registerLinks",value:function(e){if(e){this.link={};for(var t=0,n=0,o=0;o<e.length;o++){t=e[o].start,n=e[o].end;var r={link:e[o],index:o};this.createAddTo(t,this.link,r,o),this.createAddTo(n,this.link,r,o)}}}},{key:"createAddTo",value:function(e,t,n,o){t[e]||(t[e]=[]),-1==t[e].indexOf(n)&&t[e].push(n)}},{key:"getTask",value:function(e){return this.data[e]}},{key:"getLinks",value:function(e){return this.link[e]}}]),e}());t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(0),i=s(r),a=s(n(1));function s(e){return e&&e.__esModule?e:{default:e}}var l=20,u=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.calcNormCoordinates=function(){var e;return{cpt1:{x:e=n.props.start.x+(n.props.end.x-n.props.start.x)/2,y:n.props.start.y},cpt2:{x:e,y:n.props.end.y}}},n.calcSCoordinates=function(){var e={x:n.props.start.x+l,y:n.props.start.y},t=(n.props.end.y-n.props.start.y)/2,o={x:e.x,y:e.y+t},r={x:n.props.end.x-l,y:o.y};return{cpt1:e,cpt2:o,cpt3:r,cpt4:{x:r.x,y:r.y+t}}},n.getPath=function(){var e=null;return n.props.start.x>n.props.end.x?(e=n.calcSCoordinates(),"M"+n.props.start.x+" "+n.props.start.y+" "+e.cpt1.x+" "+e.cpt1.y+" "+e.cpt2.x+" "+e.cpt2.y+" "+e.cpt3.x+" "+e.cpt3.y+" "+e.cpt4.x+" "+e.cpt4.y+" "+n.props.end.x+" "+n.props.end.y):(e=n.calcNormCoordinates(),"M"+n.props.start.x+" "+n.props.start.y+" "+e.cpt1.x+" "+e.cpt1.y+" "+e.cpt2.x+" "+e.cpt2.y+" "+n.props.end.x+" "+n.props.end.y)},n.onSelect=function(e){n.props.onSelectItem&&n.props.onSelectItem(n.props.item)},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.Component),o(t,[{key:"render",value:function(){var e=this.props.isSelected?a.default.values.links.selectedColor:a.default.values.links.color;return i.default.createElement("g",{className:"timeline-link"},i.default.createElement("path",{pointerEvents:"stroke",onMouseDown:this.onSelect,stroke:"white",d:this.getPath(),strokeLinejoin:"round",fill:"transparent",strokeWidth:"4",cursor:"pointer"}),i.default.createElement("path",{pointerEvents:"stroke",onMouseDown:this.onSelect,stroke:e,d:this.getPath(),strokeLinejoin:"round",fill:"transparent",strokeWidth:"1",cursor:"pointer",markerEnd:"url(#arrow)"}))}}]),t}();t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(0),a=g(i),s=g(n(9)),l=g(n(12)),u=g(n(13)),c=g(n(18)),d=g(n(21)),p=g(n(23)),f=g(n(6)),h=n(3),m=g(n(25)),y=g(n(1));g(n(2));function g(e){return e&&e.__esModule?e:{default:e}}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n(26);var b=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));n.onSize=function(e){n.calculateVerticalScrollVariables(e),n.initialise||(n.dc.initialise(n.state.scrollLeft+n.state.nowposition,n.state.scrollLeft+n.state.nowposition+e.width,n.state.nowposition,n.state.dayWidth),n.initialise=!0),n.setStartEnd();var t=Math.ceil(e.height/n.props.itemheight),o=n.calcNumVisibleDays(e),r=n.calculateStartEndRows(t,n.props.data,n.state.scrollTop);n.setState({numVisibleRows:t,numVisibleDays:o,startRow:r.start,endRow:r.end,size:e})},n.verticalChange=function(e){if(e!=n.state.scrollTop){var t=n.calculateStartEndRows(n.state.numVisibleRows,n.props.data,e);t.start!==n.state.start&&n.setState(n.state={scrollTop:e,startRow:t.start,endRow:t.end})}},n.calculateStartEndRows=function(e,t,o){var r=Math.trunc(o/n.props.itemheight);return{start:r,end:r+e>=t.length?t.length:r+e}},n.setStartEnd=function(){n.dc.setStartEnd(n.state.scrollLeft,n.state.scrollLeft+n.state.size.width,n.state.nowposition,n.state.dayWidth)},n.horizontalChange=function(e){var t=n.state.nowposition,o=-1,r=n.state.headerData,i=n.state.startRow,a=n.state.endRow;e>n.pxToScroll?(t=n.state.nowposition-n.pxToScroll,o=0):e<=0?(t=n.state.nowposition+n.pxToScroll,o=n.pxToScroll):o=e;var s=Math.trunc((e-n.state.nowposition)/n.state.dayWidth);a=(i=Math.trunc(n.state.scrollTop/n.props.itemheight))+n.state.numVisibleRows>=n.props.data.length?n.props.data.length-1:i+n.state.numVisibleRows,n.setStartEnd(),n.setState(n.state={currentday:s,nowposition:t,headerData:r,scrollLeft:o,startRow:i,endRow:a})},n.calculateVerticalScrollVariables=function(e){n.pxToScroll=(1-e.width/h.DATA_CONTAINER_WIDTH)*h.DATA_CONTAINER_WIDTH-1},n.onHorizonChange=function(e,t){n.props.onHorizonChange&&n.props.onHorizonChange(e,t)},n.doMouseDown=function(e){n.dragging=!0,n.draggingPosition=e.clientX},n.doMouseMove=function(e){if(n.dragging){var t=n.draggingPosition-e.clientX;0!==t&&(n.draggingPosition=e.clientX,n.horizontalChange(n.state.scrollLeft+t))}},n.doMouseUp=function(e){n.dragging=!1},n.doMouseLeave=function(e){n.dragging=!1},n.doTouchStart=function(e){n.dragging=!0,n.draggingPosition=e.touches[0].clientX},n.doTouchEnd=function(e){n.dragging=!1},n.doTouchMove=function(e){if(n.dragging){var t=n.draggingPosition-e.touches[0].clientX;0!==t&&(n.draggingPosition=e.touches[0].clientX,n.horizontalChange(n.state.scrollLeft+t))}},n.doTouchCancel=function(e){n.dragging=!1},n.doMouseLeave=function(e){n.dragging=!1},n.onTaskListSizing=function(e){n.setState(function(t){var n=o({},t);return n.sideStyle={width:n.sideStyle.width-e},n})},n.onSelectItem=function(e){n.props.onSelectItem&&e!=n.props.selectedItem&&n.props.onSelectItem(e)},n.onStartCreateLink=function(e,t){n.setState({interactiveMode:!0,taskToCreate:{task:e,position:t}})},n.onFinishCreateLink=function(e,t){n.props.onCreateLink&&e&&n.props.onCreateLink({start:n.state.taskToCreate,end:{task:e,position:t}}),n.setState({interactiveMode:!1,taskToCreate:null})},n.onTaskChanging=function(e){n.setState({changingTask:e})},n.calcNumVisibleDays=function(e){return Math.ceil(e.width/n.state.dayWidth)+h.BUFFER_DAYS},n.checkNeeeData=function(){if(n.props.data!=n.state.data){n.state.data=n.props.data;var e=n.calculateStartEndRows(n.state.numVisibleRows,n.props.data,n.state.scrollTop);n.state.startRow=e.start,n.state.endRow=e.end,f.default.registerData(n.state.data)}n.props.links!=n.state.links&&(n.state.links=n.props.links,f.default.registerLinks(n.props.links))},n.dragging=!1,n.draggingPosition=0,n.dc=new m.default,n.dc.onHorizonChange=n.onHorizonChange,n.initialise=!1,n.pxToScroll=1900;var r=n.getDayWidth(n.props.mode);return y.default.load(n.props.config),n.state={currentday:0,nowposition:0,startRow:0,endRow:10,sideStyle:{width:200},scrollLeft:0,scrollTop:0,numVisibleRows:40,numVisibleDays:60,dayWidth:r,interactiveMode:!1,taskToCreate:null,links:[],mode:n.props.mode?n.props.mode:h.VIEW_MODE_MONTH,size:{width:1,height:1},changingTask:null},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.Component),r(t,[{key:"getDayWidth",value:function(e){switch(e){case h.VIEW_MODE_DAY:return h.DAY_DAY_MODE;case h.VIEW_MODE_WEEK:return h.DAY_WEEK_MODE;case h.VIEW_MODE_MONTH:return h.DAY_MONTH_MODE;case h.VIEW_MODE_YEAR:return h.DAY_YEAR_MODE;default:return h.DAY_MONTH_MODE}}},{key:"checkMode",value:function(){if(this.props.mode!=this.state.mode&&this.props.mode){this.state.mode=this.props.mode;var e=this.getDayWidth(this.state.mode);this.state.dayWidth=e,this.state.numVisibleDays=this.calcNumVisibleDays(this.state.size);var t=Math.ceil(-this.state.currentday*this.state.dayWidth/this.pxToScroll);this.state.nowposition=t*this.pxToScroll;var n=(this.state.currentday*this.state.dayWidth+this.state.nowposition)%this.pxToScroll;this.state.scrollLeft=n}}},{key:"render",value:function(){var e;return this.checkMode(),this.checkNeeeData(),a.default.createElement("div",{className:"timeLine"},a.default.createElement("div",{className:"timeLine-side-main",style:this.state.sideStyle},a.default.createElement(p.default,{ref:"taskViewPort",itemheight:this.props.itemheight,startRow:this.state.startRow,endRow:this.state.endRow,data:this.props.data,selectedItem:this.props.selectedItem,onSelectItem:this.onSelectItem,onUpdateTask:this.props.onUpdateTask,onScroll:this.verticalChange,nonEditable:this.props.nonEditableName}),a.default.createElement(l.default,{onTaskListSizing:this.onTaskListSizing})),a.default.createElement("div",{className:"timeLine-main"},a.default.createElement(u.default,{headerData:this.state.headerData,numVisibleDays:this.state.numVisibleDays,currentday:this.state.currentday,nowposition:this.state.nowposition,dayWidth:this.state.dayWidth,mode:this.state.mode,scrollLeft:this.state.scrollLeft}),a.default.createElement(c.default,{ref:"dataViewPort",scrollLeft:this.state.scrollLeft,scrollTop:this.state.scrollTop,itemheight:this.props.itemheight,nowposition:this.state.nowposition,startRow:this.state.startRow,endRow:this.state.endRow,data:this.props.data,selectedItem:this.props.selectedItem,dayWidth:this.state.dayWidth,onScroll:this.scrollData,onMouseDown:this.doMouseDown,onMouseMove:this.doMouseMove,onMouseUp:this.doMouseUp,onMouseLeave:this.doMouseLeave,onTouchStart:this.doTouchStart,onTouchMove:this.doTouchMove,onTouchEnd:this.doTouchEnd,onTouchCancel:this.doTouchCancel,onSelectItem:this.onSelectItem,onUpdateTask:this.props.onUpdateTask,onTaskChanging:this.onTaskChanging,onStartCreateLink:this.onStartCreateLink,onFinishCreateLink:this.onFinishCreateLink,boundaries:{lower:this.state.scrollLeft,upper:this.state.scrollLeft+this.state.size.width},onSize:this.onSize}),a.default.createElement(d.default,(v(e={scrollLeft:this.state.scrollLeft,scrollTop:this.state.scrollTop,startRow:this.state.startRow,endRow:this.state.endRow,data:this.props.data,nowposition:this.state.nowposition,dayWidth:this.state.dayWidth,interactiveMode:this.state.interactiveMode,taskToCreate:this.state.taskToCreate,onFinishCreateLink:this.onFinishCreateLink,changingTask:this.state.changingTask,selectedItem:this.props.selectedItem,onSelectItem:this.onSelectItem,itemheight:this.props.itemheight},"onSelectItem",this.onSelectItem),v(e,"links",this.props.links),e))))}}]),t}();b.propTypes={itemheight:s.default.number.isRequired,dayWidth:s.default.number.isRequired,nonEditableName:s.default.bool},b.defaultProps={itemheight:20,dayWidth:24,nonEditableName:!1},t.default=b},function(e,t,n){e.exports=n(10)()},function(e,t,n){"use strict";var o=n(11);function r(){}e.exports=function(){function e(e,t,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 t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(0),i=s(r),a=s(n(1));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.doMouseMove=n.doMouseMove.bind(n),n.doMouseDown=n.doMouseDown.bind(n),n.doMouseUp=n.doMouseUp.bind(n),n.state={dragging:!1},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.Component),o(t,[{key:"doMouseDown",value:function(e){0===e.button&&(this.draggingPosition=e.clientX,this.setState({dragging:!0}))}},{key:"componentDidUpdate",value:function(e,t){this.state.dragging&&!t.dragging?(document.addEventListener("mousemove",this.doMouseMove),document.addEventListener("mouseup",this.doMouseUp)):!this.state.dragging&&t.dragging&&(document.removeEventListener("mousemove",this.doMouseMove),document.removeEventListener("mouseup",this.doMouseUp))}},{key:"doMouseMove",value:function(e){if(this.state.dragging){e.stopPropagation();var t=this.draggingPosition-e.clientX;this.draggingPosition=e.clientX,this.props.onTaskListSizing(t)}}},{key:"doMouseUp",value:function(e){this.setState({dragging:!1})}},{key:"render",value:function(){return i.default.createElement("div",{className:"verticalResizer",style:a.default.values.taskList.verticalSeparator.style,onMouseDown:this.doMouseDown},i.default.createElement("div",{className:"squareGrip",style:a.default.values.taskList.verticalSeparator.grip.style}),i.default.createElement("div",{className:"squareGrip",style:a.default.values.taskList.verticalSeparator.grip.style}),i.default.createElement("div",{className:"squareGrip",style:a.default.values.taskList.verticalSeparator.grip.style}),i.default.createElement("div",{className:"squareGrip",style:a.default.values.taskList.verticalSeparator.grip.style}))}}]),t}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HeaderItem=void 0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(0),a=d(i),s=d(n(14)),l=n(3),u=d(n(1)),c=d(n(2));function d(e){return e&&e.__esModule?e:{default:e}}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}n(15);var m=t.HeaderItem=function(e){function t(e){return p(this,t),f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return h(t,i.PureComponent),r(t,[{key:"render",value:function(){return a.default.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}},a.default.createElement("div",null,this.props.label))}}]),t}(),y=function(e){function t(e){p(this,t);var n=f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.getStartDate=function(e,t){var n=null;switch(t){case"year":return n=e.year(),(0,s.default)([n,0,1]);case"month":n=e.year();var o=e.month();return(0,s.default)([n,o,1]);case"week":return e.subtract(e.day(),"days");default:return e}},n.renderTime=function(e,t,n,o){for(var r=[],i=t/24,s=0,l=0;l<24;l++)r.push(a.default.createElement(m,{key:l,left:s,width:i,label:"shorttime"==n?l:l+":00"})),s+=i;return a.default.createElement("div",{key:o,style:{position:"absolute",height:20,left:e,width:t}}," ",r)},n.renderHeaderRows=function(e,t,r){for(var i={top:[],middle:[],bottom:[]},c={},d="",p="",f="",h=null,y=null,g=n.props.currentday,v=n.props.currentday+n.props.numVisibleDays,b=g-l.BUFFER_DAYS;b<v+l.BUFFER_DAYS;b++)d!=(h=(0,s.default)().add(b,"days")).format(n.getFormat(e,"top"))&&(d=h.format(n.getFormat(e,"top")),y=n.getBox(h,e,c.top),c.top=y.left+y.width,i.top.push(a.default.createElement(m,{key:b,left:y.left,width:y.width,label:d}))),p!=h.format(n.getFormat(t))&&(p=h.format(n.getFormat(t)),y=n.getBox(h,t,c.middle),c.middle=y.left+y.width,i.middle.push(a.default.createElement(m,{key:b,left:y.left,width:y.width,label:p}))),f!=h.format(n.getFormat(r))&&(f=h.format(n.getFormat(r)),y=n.getBox(h,r,c.bottom),c.bottom=y.left+y.width,"shorttime"==r||"fulltime"==r?i.bottom.push(n.renderTime(y.left,y.width,r,b)):i.bottom.push(a.default.createElement(m,{key:b,left:y.left,width:y.width,label:f})));return a.default.createElement("div",{className:"timeLine-main-header-container",style:{width:l.DATA_CONTAINER_WIDTH,maxWidth:l.DATA_CONTAINER_WIDTH}},a.default.createElement("div",{className:"header-top",style:o({},u.default.values.header.top.style)},i.top),a.default.createElement("div",{className:"header-middle",style:o({},u.default.values.header.middle.style)},i.middle),a.default.createElement("div",{className:"header-bottom",style:o({},u.default.values.header.bottom.style)},i.bottom))},n.renderHeader=function(){switch(n.props.mode){case l.VIEW_MODE_DAY:return n.renderHeaderRows("week","dayweek","fulltime");case l.VIEW_MODE_WEEK:return n.renderHeaderRows("week","dayweek","shorttime");case l.VIEW_MODE_MONTH:return n.renderHeaderRows("month","dayweek","daymonth");case l.VIEW_MODE_YEAR:return n.renderHeaderRows("year","month","week")}},n.setBoundaries=function(){n.start=n.props.currentday-l.BUFFER_DAYS,n.end=n.props.currentday+n.props.numVisibleDays+l.BUFFER_DAYS},n.needToRender=function(){return n.props.currentday<n.start||n.props.currentday+n.props.numVisibleDays>n.end},n.setBoundaries(),n}return h(t,i.PureComponent),r(t,[{key:"getFormat",value:function(e,t){switch(e){case"year":return"YYYY";case"month":return"top"==t?"MMMM YYYY":"MMMM";case"week":return"top"==t?"ww MMMM YYYY":"ww";case"dayweek":return"dd";case"daymonth":return"D"}}},{key:"getModeIncrement",value:function(e,t){switch(t){case"year":return c.default.daysInYear(e.year());case"month":return e.daysInMonth();case"week":return 7;default:return 1}}},{key:"getBox",value:function(e,t,n){var o=this.getModeIncrement(e,t)*this.props.dayWidth;if(!n){var r=this.getStartDate(e,t);r=r.startOf("day");var i=(0,s.default)().startOf("day"),a=r.diff(i,"days");n=c.default.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),a.default.createElement("div",{id:"timeline-header",ref:"Header",className:"timeLine-main-header-viewPort"},this.renderHeader())}}]),t}();t.default=y},function(e,n){e.exports=t},function(e,t,n){var o=n(16);"string"==typeof o&&(o=[[e.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(5)(o,r);o.locals&&(e.exports=o.locals)},function(e,t,n){(e.exports=n(4)(!1)).push([e.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}\n.header-bottom{\n height: 20px;\n font-size:10px;\n border-bottom: solid 0.5px silver;\n}\n",""])},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,o=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(e,t){var r,i=t.trim().replace(/^"(.*)"$/,function(e,t){return t}).replace(/^'(.*)'$/,function(e,t){return t});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?e:(r=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:o+i.replace(/^\.\//,""),"url("+JSON.stringify(r)+")")})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataViewPort=t.DataRow=void 0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(0),a=p(i),s=n(3),l=p(n(19)),u=p(n(2)),c=p(n(20)),d=p(n(1));function p(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var y=t.DataRow=function(e){function t(e){return f(this,t),h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return m(t,i.Component),r(t,[{key:"render",value:function(){return a.default.createElement("div",{className:"timeLine-main-data-row",style:o({},d.default.values.dataViewPort.rows.style,{top:this.props.top,height:this.props.itemheight})},this.props.children)}}]),t}(),g=t.DataViewPort=function(e){function t(e){f(this,t);var n=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.onChildDrag=function(e){n.childDragging=e},n.renderRows=function(){for(var e=[],t=n.props.startRow;t<n.props.endRow+1;t++){var o=n.props.data[t];if(!o)break;var r=u.default.dateToPixel(o.start,n.props.nowposition,n.props.dayWidth),i=u.default.dateToPixel(o.end,n.props.nowposition,n.props.dayWidth)-r;e.push(a.default.createElement(y,{key:t,label:o.name,top:t*n.props.itemheight,left:20,itemheight:n.props.itemheight},a.default.createElement(l.default,{item:o,label:o.name,nowposition:n.props.nowposition,dayWidth:n.props.dayWidth,color:o.color,left:r,width:i,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 e},n.doMouseDown=function(e){0!==e.button||n.childDragging||n.props.onMouseDown(e)},n.doMouseMove=function(e){n.props.onMouseMove(e,n.refs.dataViewPort)},n.doTouchStart=function(e){n.childDragging||n.props.onTouchStart(e)},n.doTouchMove=function(e){n.props.onTouchMove(e,n.refs.dataViewPort)},n.childDragging=!1,n}return m(t,i.Component),r(t,[{key:"getContainerHeight",value:function(e){return e>0?e*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 e=this.getContainerHeight(this.props.data.length);return a.default.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},a.default.createElement("div",{className:"timeLine-main-data-container",style:{height:e,width:s.DATA_CONTAINER_WIDTH,maxWidth:s.DATA_CONTAINER_WIDTH}},this.renderRows()))}}]),t}();t.default=(0,c.default)({monitorWidth:!0,monitorHeight:!0})(g)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(0),a=c(i),s=c(n(2)),l=n(3),u=c(n(1));function c(e){return e&&e.__esModule?e:{default:e}}var d=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.onCreateLinkMouseDown=function(e,t){0===e.button&&(e.stopPropagation(),n.props.onStartCreateLink(n.props.item,t))},n.onCreateLinkMouseUp=function(e,t){e.stopPropagation(),n.props.onFinishCreateLink(n.props.item,t)},n.onCreateLinkTouchStart=function(e,t){e.stopPropagation(),n.props.onStartCreateLink(n.props.item,t)},n.onCreateLinkTouchEnd=function(e,t){e.stopPropagation(),n.props.onFinishCreateLink(n.props.item,t)},n.doMouseDown=function(e,t){n.props.onUpdateTask&&0===e.button&&(e.stopPropagation(),n.dragStart(e.clientX,t))},n.doMouseMove=function(e){n.state.dragging&&(e.stopPropagation(),n.dragProcess(e.clientX))},n.doMouseUp=function(){n.dragEnd()},n.doTouchStart=function(e,t){n.props.onUpdateTask&&(e.stopPropagation(),n.dragStart(e.touches[0].clientX,t))},n.doTouchMove=function(e){n.state.dragging&&(e.stopPropagation(),n.dragProcess(e.changedTouches[0].clientX))},n.doTouchEnd=function(e){n.dragEnd()},n.calculateStyle=n.calculateStyle.bind(n),n.state={dragging:!1,left:n.props.left,width:n.props.width,mode:l.MODE_NONE},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.Component),r(t,[{key:"componentDidUpdate",value:function(e,t){this.state.dragging&&!t.dragging?(document.addEventListener("mousemove",this.doMouseMove),document.addEventListener("mouseup",this.doMouseUp),document.addEventListener("touchmove",this.doTouchMove),document.addEventListener("touchend",this.doTouchEnd)):!this.state.dragging&&t.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(e,t){this.props.onChildDrag(!0),this.draggingPosition=e,this.setState({dragging:!0,mode:t,left:this.props.left,width:this.props.width})}},{key:"dragProcess",value:function(e){var t=this.draggingPosition-e,n=this.state.left,o=this.state.width;switch(this.state.mode){case l.MODE_MOVE:n=this.state.left-t;break;case l.MOVE_RESIZE_LEFT:n=this.state.left-t,o=this.state.width+t;break;case l.MOVE_RESIZE_RIGHT:o=this.state.width-t}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=e}},{key:"dragEnd",value:function(){this.props.onChildDrag(!1);var e=s.default.pixelToDate(this.state.left,this.props.nowposition,this.props.dayWidth),t=s.default.pixelToDate(this.state.left+this.state.width,this.props.nowposition,this.props.dayWidth);this.props.onUpdateTask(this.props.item,{start:e,end:t}),this.setState({dragging:!1,mode:l.MODE_NONE})}},{key:"calculateStyle",value:function(){var e=this.props.isSelected?u.default.values.dataViewPort.task.selectedStyle:u.default.values.dataViewPort.task.style,t=this.props.color?this.props.color:e.backgroundColor;return this.state.dragging?o({},e,{backgroundColor:t,left:this.state.left,width:this.state.width,height:this.props.height-5,top:2}):o({},e,{backgroundColor:t,left:this.props.left,width:this.props.width,height:this.props.height-5,top:2})}},{key:"render",value:function(){var e=this,t=this.calculateStyle();return a.default.createElement("div",{onMouseDown:function(t){return e.doMouseDown(t,l.MODE_MOVE)},onTouchStart:function(t){return e.doTouchStart(t,l.MODE_MOVE)},onClick:function(t){e.props.onSelectItem(e.props.item)},style:t},a.default.createElement("div",{className:"timeLine-main-data-task-side",style:{top:0,left:-4,height:t.height},onMouseDown:function(t){return e.doMouseDown(t,l.MOVE_RESIZE_LEFT)},onTouchStart:function(t){return e.doTouchStart(t,l.MOVE_RESIZE_LEFT)}},a.default.createElement("div",{className:"timeLine-main-data-task-side-linker",onMouseUp:function(t){return e.onCreateLinkMouseUp(t,l.LINK_POS_LEFT)},onTouchEnd:function(t){return e.onCreateLinkTouchEnd(t,l.LINK_POS_LEFT)}})),a.default.createElement("div",{style:{overflow:"hidden"}},u.default.values.dataViewPort.task.showLabel?this.props.item.name:""),a.default.createElement("div",{className:"timeLine-main-data-task-side",style:{top:0,left:t.width-3,height:t.height},onMouseDown:function(t){return e.doMouseDown(t,l.MOVE_RESIZE_RIGHT)},onTouchStart:function(t){return e.doTouchStart(t,l.MOVE_RESIZE_RIGHT)}},a.default.createElement("div",{className:"timeLine-main-data-task-side-linker",onMouseDown:function(t){return e.onCreateLinkMouseDown(t,l.LINK_POS_RIGHT)},onTouchStart:function(t){return e.onCreateLinkTouchStart(t,l.LINK_POS_RIGHT)}})))}}]),t}();t.default=d},function(e,t){e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(0),i=c(r),a=c(n(6)),s=c(n(7)),l=c(n(22)),u=c(n(2));function c(e){return e&&e.__esModule?e:{default:e}}function d(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var p=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.getItemPosition=function(e,t){return{x:u.default.dateToPixel(t,0,n.props.dayWidth),y:e*n.props.itemheight+n.props.itemheight/2}},n.renderCreateLink=function(){if(n.props.interactiveMode){var e=a.default.getTask(n.props.taskToCreate.task.id),t=n.getItemPosition(e.index,e.item.end);return i.default.createElement(l.default,{start:t,onFinishCreateLink:n.props.onFinishCreateLink})}},n.renderChangingTaskLinks=function(){if(n.props.changingTask!=n.state.changingTask){n.state.changingTask=n.props.changingTask;var e=a.default.getLinks(n.state.changingTask.item.id);if(!e)return;for(var t=null,o=null,r=null,l={},u={},c=0;c<e.length;c++)t=e[c],(o=a.default.getTask(t.link.start))&&(r=a.default.getTask(t.link.end))&&(l=n.getItemPosition(o.index,o.item.end),n.state.changingTask.item.id==t.link.start&&(l.x=n.state.changingTask.position.end),u=n.getItemPosition(r.index,r.item.start),n.state.changingTask.item.id==t.link.end&&(u.x=n.state.changingTask.position.start),n.cache[t.index]=i.default.createElement(s.default,{key:-c-1,item:t,start:{x:l.x,y:l.y},end:{x:u.x,y:u.y},isSelected:n.props.selectedItem==t,onSelectItem:n.props.onSelectItem}),n.cache=[].concat(d(n.cache)))}},n.cache=[],n.state={links:[],data:[],selectedItem:null},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.Component),o(t,[{key:"renderLink",value:function(e,t,n,o){var r=this.getItemPosition(e.index,e.item.end),a=this.getItemPosition(t.index,t.item.start);return i.default.createElement(s.default,{key:o,item:n,start:{x:r.x,y:r.y},end:{x:a.x,y:a.y},isSelected:this.props.selectedItem==n,onSelectItem:this.props.onSelectItem})}},{key:"renderLinks",value:function(){this.cache=[];var e={},t=void 0,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=a.default.getTask(r.start))&&(n=a.default.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(),i.default.createElement("svg",{x:0,y:0,width:"100%",pointerEvents:"none",style:{position:"absolute",top:60,userSelect:"none",height:"100%"}},i.default.createElement("defs",null,i.default.createElement("marker",{id:"arrow",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"9",markerHeight:"9",orient:"auto-start-reverse"},i.default.createElement("path",{d:"M 0 0 L 10 5 L 0 10 z",strokeLinejoin:"round"}))),i.default.createElement("g",{transform:"matrix(1,0,0,1,"+-(this.props.scrollLeft-this.props.nowposition)+","+-this.props.scrollTop+")"},this.cache,this.renderCreateLink()))}}]),t}();t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(0),i=s(r),a=s(n(7));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.doMouseMove=function(e){n.init||(n.lastX=e.clientX,n.lastY=e.clientY,n.init=!0);var t=n.state.x+(e.clientX-n.lastX),o=n.state.y+(e.clientY-n.lastY);n.lastX=e.clientX,n.lastY=e.clientY,n.setState({x:t,y:o})},n.doMouseUp=function(e){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}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r.Component),o(t,[{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 i.default.createElement(a.default,{key:-1,start:{x:this.props.start.x,y:this.props.start.y},end:{x:this.state.x,y:this.state.y}})}}]),t}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TaskRow=t.VerticalLine=void 0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(0),a=u(i),s=u(n(1)),l=u(n(24));function u(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.VerticalLine=function(e){function t(e){return c(this,t),d(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return p(t,i.Component),r(t,[{key:"render",value:function(){return a.default.createElement("div",{className:"timeLine-main-data-verticalLine",style:{left:this.props.left}})}}]),t}();var f=t.TaskRow=function(e){function t(e){c(this,t);var n=d(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.onChange=function(e){n.props.onUpdateTask&&n.props.onUpdateTask(n.props.item,{name:e})},n}return p(t,i.Component),r(t,[{key:"render",value:function(){var e=this;return a.default.createElement("div",{className:"timeLine-side-task-row",style:o({},s.default.values.taskList.task.style,{top:this.props.top,height:this.props.itemheight}),onClick:function(t){return e.props.onSelectItem(e.props.item)}},this.props.nonEditable?a.default.createElement("div",{tabIndex:this.props.index,style:{width:"100%"}},this.props.label):a.default.createElement(l.default,{value:this.props.label,index:this.props.index,onChange:this.onChange}))}}]),t}(),h=function(e){function t(e){c(this,t);var n=d(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.doScroll=function(){n.props.onScroll(n.refs.taskViewPort.scrollTop)},n}return p(t,i.Component),r(t,[{key:"getContainerStyle",value:function(e){return{height:e>0?e*this.props.itemheight:10}}},{key:"renderTaskRow",value:function(e){for(var t=[],n=this.props.startRow;n<this.props.endRow+1;n++){var o=e[n];if(!o)break;t.push(a.default.createElement(f,{key:n,index:n,item:o,label:o.name,top:n*this.props.itemheight,itemheight:this.props.itemheight,isSelected:this.props.selectedItem==o,onUpdateTask:this.props.onUpdateTask,onSelectItem:this.props.onSelectItem,nonEditable:this.props.nonEditable}))}return t}},{key:"render",value:function(){var e=this.props.data?this.props.data:[];return this.containerStyle=this.getContainerStyle(e.length),a.default.createElement("div",{className:"timeLine-side"},a.default.createElement("div",{className:"timeLine-side-title",style:s.default.values.taskList.title.style},a.default.createElement("div",null,s.default.values.taskList.title.label)),a.default.createElement("div",{ref:"taskViewPort",className:"timeLine-side-task-viewPort",onScroll:this.doScroll},a.default.createElement("div",{className:"timeLine-side-task-container",style:this.containerStyle},this.renderTaskRow(e))))}}]),t}();t.default=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(0),a=(o=i)&&o.__esModule?o:{default:o};var s=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.onFocus=function(){n.setState({editing:!0})},n.onBlur=function(){n.finishEditing()},n.handleKey=function(e){13===(e.keyCode||e.which)&&n.finishEditing()},n.finishEditing=function(){n.isFocus=!1,n.setState({editing:!1}),n.props.onChange&&n.props.onChange(n.state.value)},n.handleChange=function(e){n.setState({value:e.target.value})},n.renderDiv=function(){return a.default.createElement("div",{tabIndex:n.props.index,onClick:n.onFocus,onFocus:n.onFocus,style:{width:"100%"}}," ",n.state.value)},n.renderEditor=function(){return a.default.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}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.Component),r(t,[{key:"componentDidUpdate",value:function(e,t){this.refs.textInput&&!this.isFocus&&(this.refs.textInput.focus(),this.isFocus=!0)}},{key:"shouldComponentUpdate",value:function(e,t){return e.value!=this.props.value&&(this.state.value=e.value),!0}},{key:"render",value:function(){return this.state.editing?this.renderEditor():this.renderDiv()}}]),t}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=n(2),i=(o=r)&&o.__esModule?o:{default:o};t.default=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.initialise=function(e,n,o,r){t.nowposition=o,t.daywidth=r,t.setLimits(e,n,o,r),t.loadDataHorizon()},this.setStartEnd=function(e,n,o,r){t.nowposition=o,t.daywidth=r,t.needData(e,n)&&(t.setLimits(e,n),t.loadDataHorizon())},this.needData=function(e,n){return e<t.lower_data_limit||n>t.upper_data_limit},this.setLimits=function(e,n){t.lower_limit=e-1e3,t.lower_data_limit=e-750,t.upper_limit=n+1e3,t.upper_data_limit=n+750},this.loadDataHorizon=function(){var e=i.default.pixelToDate(t.lower_limit,t.nowposition,t.daywidth),n=i.default.pixelToDate(t.upper_limit,t.nowposition,t.daywidth);t.onHorizonChange(e,n)},this.lower_limit=0,this.upper_limit=0,this._dataToRender=[]}},function(e,t,n){var o=n(27);"string"==typeof o&&(o=[[e.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(5)(o,r);o.locals&&(e.exports=o.locals)},function(e,t,n){(e.exports=n(4)(!1)).push([e.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",""])}])}); |
{ | ||
"name": "react-gantt-timeline", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "", | ||
@@ -44,2 +44,3 @@ "main": "dist/index.js", | ||
"json-loader": "^0.5.7", | ||
"merge": ">=1.2.1", | ||
"react": "^16.3.2", | ||
@@ -53,3 +54,3 @@ "react-dom": "^16.3.2", | ||
"webpack-cli": "^3.1.1", | ||
"webpack-dev-server": "^3.1.4" | ||
"webpack-dev-server": "^3.1.11" | ||
}, | ||
@@ -71,4 +72,6 @@ "author": "Guillermo Quiros", | ||
"dependencies": { | ||
"moment": "^2.24.0", | ||
"opencollective": "^1.0.3", | ||
"opencollective-postinstall": "^2.0.1" | ||
"opencollective-postinstall": "^2.0.1", | ||
"react-sizeme": "^2.5.2" | ||
}, | ||
@@ -75,0 +78,0 @@ "collective": { |
@@ -10,6 +10,5 @@ | ||
[![Backers on Open Collective](https://opencollective.com/react-timeline-gantt/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/react-timeline-gantt/sponsors/badge.svg)](#sponsors) | ||
[![downloads](https://img.shields.io/npm/dt/react-gantt-timeline.svg?maxAge=2592000)](https://www.npmjs.com/package/react-gantt-timeline) | ||
A react timeline gantt component. | ||
@@ -37,2 +36,5 @@ | ||
To play with a live [demo](https://guiqui.github.io/react-timeline-gantt/index.html) . | ||
## Golden Sponsor | ||
[![alt text](https://guiqui.github.io/react-timeline-gantt/K8Stu.png)](https://www.uxxu.io) | ||
@@ -43,4 +45,5 @@ | ||
- Add "year" mode option. | ||
## Coming up in version 0.4.0 | ||
## Release Notes version 0.4.0 | ||
- Touch Event Support for scrolling and task movement | ||
## Coming up in version 0.4.1 | ||
- Subtask implementation | ||
@@ -52,3 +55,3 @@ - Add start and end date columns to the task list | ||
## Installation | ||
```javascript | ||
```bash | ||
npm install react-gantt-timeline | ||
@@ -55,0 +58,0 @@ ``` |
@@ -1,73 +0,83 @@ | ||
import React,{Component} from 'react' | ||
export default class ContentEditable extends Component{ | ||
constructor(props){ | ||
super(props) | ||
this.isFocus=false; | ||
this.state={ | ||
editing:false, | ||
value:this.props.value, | ||
} | ||
} | ||
import React, { Component } from "react"; | ||
export default class ContentEditable extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.isFocus = false; | ||
this.state = { | ||
editing: false, | ||
value: this.props.value | ||
}; | ||
} | ||
componentDidUpdate(prevProps, prevState) { | ||
if (this.refs.textInput && !this.isFocus){ | ||
this.refs.textInput.focus(); | ||
this.isFocus=true; | ||
} | ||
componentDidUpdate(prevProps, prevState) { | ||
if (this.refs.textInput && !this.isFocus) { | ||
this.refs.textInput.focus(); | ||
this.isFocus = true; | ||
} | ||
} | ||
onFocus=()=>{ | ||
this.setState({editing:true}) | ||
} | ||
onFocus = () => { | ||
this.setState({ editing: true }); | ||
}; | ||
onBlur=()=>{ | ||
this.finishEditing() | ||
} | ||
onBlur = () => { | ||
this.finishEditing(); | ||
}; | ||
handleKey=(e)=>{ | ||
const keyCode = e.keyCode || e.which; | ||
if (keyCode === 13) { | ||
this.finishEditing() | ||
} | ||
handleKey = e => { | ||
const keyCode = e.keyCode || e.which; | ||
if (keyCode === 13) { | ||
this.finishEditing(); | ||
} | ||
}; | ||
finishEditing=()=>{ | ||
this.isFocus=false; | ||
this.setState({editing:false}) | ||
if(this.props.onChange) | ||
this.props.onChange(this.state.value) | ||
} | ||
finishEditing = () => { | ||
this.isFocus = false; | ||
this.setState({ editing: false }); | ||
if (this.props.onChange) this.props.onChange(this.state.value); | ||
}; | ||
handleChange=(e)=> { | ||
this.setState({value: e.target.value}); | ||
} | ||
handleChange = e => { | ||
this.setState({ value: e.target.value }); | ||
}; | ||
renderDiv=()=>{ | ||
return <div tabIndex={this.props.index} | ||
onClick={this.onFocus} | ||
onFocus={this.onFocus} | ||
style={{width:'100%'}}> {this.state.value}</div> | ||
} | ||
shouldComponentUpdate(nextProps, nextState){ | ||
if (nextProps.value!=this.props.value){ | ||
this.state.value=nextProps.value; | ||
} | ||
return true; | ||
} | ||
renderDiv = () => { | ||
return ( | ||
<div | ||
tabIndex={this.props.index} | ||
onClick={this.onFocus} | ||
onFocus={this.onFocus} | ||
style={{ width: "100%" }} | ||
> | ||
{" "} | ||
{this.state.value} | ||
</div> | ||
); | ||
}; | ||
renderEditor=()=>{ | ||
return <input ref='textInput' onBlur={this.onBlur} | ||
style={{width:'100%',outlineColor:'black',outlineStyle: 'oinset'}} | ||
type="text" | ||
name="name" | ||
value={this.state.value} | ||
onKeyUp={this.handleKey} | ||
onChange={this.handleChange}/> | ||
shouldComponentUpdate(nextProps, nextState) { | ||
if (nextProps.value != this.props.value) { | ||
this.state.value = nextProps.value; | ||
} | ||
return true; | ||
} | ||
render(){ | ||
return this.state.editing?this.renderEditor():this.renderDiv(); | ||
renderEditor = () => { | ||
return ( | ||
<input | ||
ref="textInput" | ||
onBlur={this.onBlur} | ||
style={{ width: "100%", outlineColor: "black", outlineStyle: "oinset" }} | ||
type="text" | ||
name="name" | ||
value={this.state.value} | ||
onKeyUp={this.handleKey} | ||
onChange={this.handleChange} | ||
/> | ||
); | ||
}; | ||
} | ||
render() { | ||
return this.state.editing ? this.renderEditor() : this.renderDiv(); | ||
} | ||
} |
@@ -1,91 +0,121 @@ | ||
import React,{Component} from 'react' | ||
import Config from 'libs/helpers/config/Config' | ||
import ContentEditable from 'libs/components/common/ContentEditable' | ||
import React, { Component } from "react"; | ||
import Config from "libs/helpers/config/Config"; | ||
import ContentEditable from "libs/components/common/ContentEditable"; | ||
export class VerticalLine extends Component{ | ||
constructor(props){ | ||
super(props); | ||
} | ||
render(){ | ||
return (<div className="timeLine-main-data-verticalLine" style={{left:this.props.left}}> | ||
</div> ) | ||
} | ||
export class VerticalLine extends Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
render() { | ||
return ( | ||
<div | ||
className="timeLine-main-data-verticalLine" | ||
style={{ left: this.props.left }} | ||
/> | ||
); | ||
} | ||
} | ||
export class TaskRow extends Component{ | ||
constructor(props){ | ||
super(props); | ||
} | ||
onChange=(value)=>{ | ||
if (this.props.onUpdateTask){ | ||
this.props.onUpdateTask(this.props.item,{name:value}) | ||
} | ||
export class TaskRow extends Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
onChange = value => { | ||
if (this.props.onUpdateTask) { | ||
this.props.onUpdateTask(this.props.item, { name: value }); | ||
} | ||
}; | ||
render(){ | ||
return ( | ||
<div className="timeLine-side-task-row" | ||
style={{...Config.values.taskList.task.style,top:this.props.top,height:this.props.itemheight}} | ||
onClick={(e)=>this.props.onSelectItem(this.props.item)}> | ||
<ContentEditable value={this.props.label} | ||
index={this.props.index} | ||
onChange={this.onChange}/> | ||
</div>) | ||
} | ||
render() { | ||
return ( | ||
<div | ||
className="timeLine-side-task-row" | ||
style={{ | ||
...Config.values.taskList.task.style, | ||
top: this.props.top, | ||
height: this.props.itemheight | ||
}} | ||
onClick={e => this.props.onSelectItem(this.props.item)} | ||
> | ||
{this.props.nonEditable ? ( | ||
<div tabIndex={this.props.index} style={{ width: "100%" }}> | ||
{this.props.label} | ||
</div> | ||
) : ( | ||
<ContentEditable | ||
value={this.props.label} | ||
index={this.props.index} | ||
onChange={this.onChange} | ||
/> | ||
)} | ||
</div> | ||
); | ||
} | ||
} | ||
export default class TaskList extends Component{ | ||
constructor(props){ | ||
super(props) | ||
export default class TaskList extends Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
getContainerStyle(rows) { | ||
let new_height = rows > 0 ? rows * this.props.itemheight : 10; | ||
return { height: new_height }; | ||
} | ||
renderTaskRow(data) { | ||
let result = []; | ||
for (let i = this.props.startRow; i < this.props.endRow + 1; i++) { | ||
let item = data[i]; | ||
if (!item) break; | ||
result.push( | ||
<TaskRow | ||
key={i} | ||
index={i} | ||
item={item} | ||
label={item.name} | ||
top={i * this.props.itemheight} | ||
itemheight={this.props.itemheight} | ||
isSelected={this.props.selectedItem == item} | ||
onUpdateTask={this.props.onUpdateTask} | ||
onSelectItem={this.props.onSelectItem} | ||
nonEditable={this.props.nonEditable} | ||
/> | ||
); | ||
} | ||
getContainerStyle(rows){ | ||
let new_height=rows>0?rows * this.props.itemheight:10; | ||
return {height:new_height} | ||
} | ||
renderTaskRow(data){ | ||
let result=[]; | ||
for (let i=this.props.startRow;i<this.props.endRow+1;i++){ | ||
let item=data[i]; | ||
if(!item) break | ||
result.push(<TaskRow key={i} | ||
index={i} | ||
item={item} | ||
label={item.name} | ||
top={i*this.props.itemheight} | ||
itemheight={this.props.itemheight} | ||
isSelected={this.props.selectedItem==item} | ||
onUpdateTask={this.props.onUpdateTask} | ||
onSelectItem={this.props.onSelectItem}></TaskRow>); | ||
} | ||
return result; | ||
} | ||
doScroll=()=>{ | ||
this.props.onScroll(this.refs.taskViewPort.scrollTop) | ||
} | ||
render(){ | ||
let data =this.props.data?this.props.data:[]; | ||
this.containerStyle=this.getContainerStyle(data.length) | ||
return( | ||
<div className="timeLine-side"> | ||
<div className="timeLine-side-title" style={Config.values.taskList.title.style}> | ||
<div> | ||
{Config.values.taskList.title.label} | ||
</div> | ||
</div> | ||
<div ref="taskViewPort" className="timeLine-side-task-viewPort" onScroll={this.doScroll} > | ||
<div className="timeLine-side-task-container" style={this.containerStyle}> | ||
{ this.renderTaskRow(data) } | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
return result; | ||
} | ||
} | ||
} | ||
doScroll = () => { | ||
this.props.onScroll(this.refs.taskViewPort.scrollTop); | ||
}; | ||
render() { | ||
let data = this.props.data ? this.props.data : []; | ||
this.containerStyle = this.getContainerStyle(data.length); | ||
return ( | ||
<div className="timeLine-side"> | ||
<div | ||
className="timeLine-side-title" | ||
style={Config.values.taskList.title.style} | ||
> | ||
<div>{Config.values.taskList.title.label}</div> | ||
</div> | ||
<div | ||
ref="taskViewPort" | ||
className="timeLine-side-task-viewPort" | ||
onScroll={this.doScroll} | ||
> | ||
<div | ||
className="timeLine-side-task-container" | ||
style={this.containerStyle} | ||
> | ||
{this.renderTaskRow(data)} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
@@ -1,426 +0,453 @@ | ||
import React,{Component} from 'react' | ||
import PropTypes from 'prop-types' | ||
import VerticalSpliter from 'libs/components/taskList/VerticalSpliter' | ||
import Header from 'libs/components/header/Headers' | ||
import DataViewPort from 'libs/components/viewport/DataViewPort' | ||
import LinkViewPort from 'libs/components/links/LinkViewPort' | ||
import TaskList from 'libs/components/taskList/TaskList' | ||
import Registry from 'libs/helpers/registry/Registry' | ||
import {BUFFER_DAYS,DATA_CONTAINER_WIDTH} from 'libs/Const' | ||
import {VIEW_MODE_DAY,VIEW_MODE_WEEK,VIEW_MODE_MONTH,VIEW_MODE_YEAR}from 'libs/Const' | ||
import {DAY_MONTH_MODE,DAY_WEEK_MODE,DAY_DAY_MODE,DAY_YEAR_MODE} from 'libs/Const' | ||
import DataController from 'libs/controller/DataController' | ||
import Config from 'libs/helpers/config/Config' | ||
import DateHelper from 'libs/helpers/DateHelper' | ||
import './TimeLine.css' | ||
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
import VerticalSpliter from "libs/components/taskList/VerticalSpliter"; | ||
import Header from "libs/components/header/Headers"; | ||
import DataViewPort from "libs/components/viewport/DataViewPort"; | ||
import LinkViewPort from "libs/components/links/LinkViewPort"; | ||
import TaskList from "libs/components/taskList/TaskList"; | ||
import Registry from "libs/helpers/registry/Registry"; | ||
import { BUFFER_DAYS, DATA_CONTAINER_WIDTH } from "libs/Const"; | ||
import { | ||
VIEW_MODE_DAY, | ||
VIEW_MODE_WEEK, | ||
VIEW_MODE_MONTH, | ||
VIEW_MODE_YEAR | ||
} from "libs/Const"; | ||
import { | ||
DAY_MONTH_MODE, | ||
DAY_WEEK_MODE, | ||
DAY_DAY_MODE, | ||
DAY_YEAR_MODE | ||
} from "libs/Const"; | ||
import DataController from "libs/controller/DataController"; | ||
import Config from "libs/helpers/config/Config"; | ||
import DateHelper from "libs/helpers/DateHelper"; | ||
import "./TimeLine.css"; | ||
class TimeLine extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.dragging = false; | ||
this.draggingPosition = 0; | ||
this.dc = new DataController(); | ||
this.dc.onHorizonChange = this.onHorizonChange; | ||
this.initialise = false; | ||
//This variable define the number of pixels the viewport can scroll till arrive to the end of the context | ||
this.pxToScroll = 1900; | ||
let dayWidth = this.getDayWidth(this.props.mode); | ||
Config.load(this.props.config); | ||
//Initialising state | ||
this.state = { | ||
currentday: 0, //Day that is in the 0px horizontal | ||
//nowposition is the reference position, this variable support the infinit scrolling by accumulatning scroll times and redefining the 0 position | ||
// if we accumulat 2 scroll to the left nowposition will be 2* DATA_CONTAINER_WIDTH | ||
nowposition: 0, | ||
startRow: 0, // | ||
endRow: 10, | ||
sideStyle: { width: 200 }, | ||
scrollLeft: 0, | ||
scrollTop: 0, | ||
numVisibleRows: 40, | ||
numVisibleDays: 60, | ||
dayWidth: dayWidth, | ||
interactiveMode: false, | ||
taskToCreate: null, | ||
links: [], | ||
mode: this.props.mode ? this.props.mode : VIEW_MODE_MONTH, | ||
size: { width: 1, height: 1 }, | ||
changingTask: null | ||
}; | ||
} | ||
//////////////////// | ||
// ON MODE // | ||
//////////////////// | ||
class TimeLine extends Component{ | ||
constructor(props){ | ||
super(props); | ||
this.dragging=false; | ||
this.draggingPosition=0; | ||
this.dc=new DataController(); | ||
this.dc.onHorizonChange=this.onHorizonChange; | ||
this.initialise=false; | ||
//This variable define the number of pixels the viewport can scroll till arrive to the end of the context | ||
this.pxToScroll=1900; | ||
let dayWidth=this.getDayWidth(this.props.mode); | ||
Config.load(this.props.config) | ||
//Initialising state | ||
this.state={ | ||
currentday:0,//Day that is in the 0px horizontal | ||
//nowposition is the reference position, this variable support the infinit scrolling by accumulatning scroll times and redefining the 0 position | ||
// if we accumulat 2 scroll to the left nowposition will be 2* DATA_CONTAINER_WIDTH | ||
nowposition:0, | ||
startRow:0,// | ||
endRow:10, | ||
sideStyle:{width:200}, | ||
scrollLeft:0, | ||
scrollTop:0, | ||
numVisibleRows:40, | ||
numVisibleDays:60, | ||
dayWidth:dayWidth, | ||
interactiveMode:false, | ||
taskToCreate:null, | ||
links:[], | ||
mode:this.props.mode?this.props.mode:VIEW_MODE_MONTH, | ||
size:{width:1,height:1}, | ||
changingTask:null | ||
} | ||
getDayWidth(mode) { | ||
switch (mode) { | ||
case VIEW_MODE_DAY: | ||
return DAY_DAY_MODE; | ||
case VIEW_MODE_WEEK: | ||
return DAY_WEEK_MODE; | ||
case VIEW_MODE_MONTH: | ||
return DAY_MONTH_MODE; | ||
case VIEW_MODE_YEAR: | ||
return DAY_YEAR_MODE; | ||
default: | ||
return DAY_MONTH_MODE; | ||
} | ||
} | ||
//////////////////// | ||
// ON MODE // | ||
//////////////////// | ||
//////////////////// | ||
// ON SIZE // | ||
//////////////////// | ||
getDayWidth(mode){ | ||
switch(mode){ | ||
case VIEW_MODE_DAY: | ||
return DAY_DAY_MODE; | ||
case VIEW_MODE_WEEK: | ||
return DAY_WEEK_MODE; | ||
case VIEW_MODE_MONTH: | ||
return DAY_MONTH_MODE; | ||
case VIEW_MODE_YEAR: | ||
return DAY_YEAR_MODE; | ||
default: | ||
return DAY_MONTH_MODE; | ||
} | ||
onSize = size => { | ||
//If size has changed | ||
this.calculateVerticalScrollVariables(size); | ||
if (!this.initialise) { | ||
this.dc.initialise( | ||
this.state.scrollLeft + this.state.nowposition, | ||
this.state.scrollLeft + this.state.nowposition + size.width, | ||
this.state.nowposition, | ||
this.state.dayWidth | ||
); | ||
this.initialise = true; | ||
} | ||
this.setStartEnd(); | ||
let newNumVisibleRows = Math.ceil(size.height / this.props.itemheight); | ||
let newNumVisibleDays = this.calcNumVisibleDays(size); | ||
let rowInfo = this.calculateStartEndRows( | ||
newNumVisibleRows, | ||
this.props.data, | ||
this.state.scrollTop | ||
); | ||
this.setState({ | ||
numVisibleRows: newNumVisibleRows, | ||
numVisibleDays: newNumVisibleDays, | ||
startRow: rowInfo.start, | ||
endRow: rowInfo.end, | ||
size: size | ||
}); | ||
}; | ||
///////////////////////// | ||
// VIEWPORT CHANGES // | ||
///////////////////////// | ||
//////////////////// | ||
// ON SIZE // | ||
//////////////////// | ||
onSize = size => { | ||
//If size has changed | ||
this.calculateVerticalScrollVariables(size); | ||
if (!this.initialise){ | ||
this.dc.initialise(this.state.scrollLeft+this.state.nowposition, | ||
this.state.scrollLeft+this.state.nowposition+size.width, | ||
this.state.nowposition,this.state.dayWidth | ||
) | ||
this.initialise=true; | ||
} | ||
this.setStartEnd(); | ||
let newNumVisibleRows=Math.ceil(size.height / this.props.itemheight); | ||
let newNumVisibleDays=this.calcNumVisibleDays(size) | ||
let rowInfo=this.calculateStartEndRows(newNumVisibleRows,this.props.data,this.state.scrollTop); | ||
this.setState({ | ||
numVisibleRows:newNumVisibleRows, | ||
numVisibleDays:newNumVisibleDays, | ||
startRow:rowInfo.start, | ||
endRow:rowInfo.end, | ||
size:size | ||
verticalChange = scrollTop => { | ||
if (scrollTop == this.state.scrollTop) return; | ||
//Check if we have scrolling rows | ||
let rowInfo = this.calculateStartEndRows( | ||
this.state.numVisibleRows, | ||
this.props.data, | ||
scrollTop | ||
); | ||
if (rowInfo.start !== this.state.start) { | ||
this.setState( | ||
(this.state = { | ||
scrollTop: scrollTop, | ||
startRow: rowInfo.start, | ||
endRow: rowInfo.end | ||
}) | ||
); | ||
} | ||
///////////////////////// | ||
// VIEWPORT CHANGES // | ||
///////////////////////// | ||
}; | ||
verticalChange=(scrollTop)=>{ | ||
if (scrollTop==this.state.scrollTop) | ||
return; | ||
//Check if we have scrolling rows | ||
let rowInfo=this.calculateStartEndRows(this.state.numVisibleRows,this.props.data,scrollTop); | ||
if (rowInfo.start!==this.state.start){ | ||
this.setState( | ||
this.state={ | ||
scrollTop:scrollTop, | ||
startRow:rowInfo.start, | ||
endRow:rowInfo.end, | ||
}) | ||
} | ||
} | ||
calculateStartEndRows = (numVisibleRows, data, scrollTop) => { | ||
let new_start = Math.trunc(scrollTop / this.props.itemheight); | ||
let new_end = | ||
new_start + numVisibleRows >= data.length | ||
? data.length | ||
: new_start + numVisibleRows; | ||
return { start: new_start, end: new_end }; | ||
}; | ||
calculateStartEndRows=(numVisibleRows,data,scrollTop)=>{ | ||
let new_start=Math.trunc(scrollTop/this.props.itemheight) | ||
let new_end =new_start+numVisibleRows>=data.length?data.length:new_start+numVisibleRows; | ||
return {start:new_start,end:new_end} | ||
} | ||
setStartEnd = () => { | ||
this.dc.setStartEnd( | ||
this.state.scrollLeft, | ||
this.state.scrollLeft + this.state.size.width, | ||
this.state.nowposition, | ||
this.state.dayWidth | ||
); | ||
}; | ||
setStartEnd=()=>{ | ||
this.dc.setStartEnd(this.state.scrollLeft, | ||
this.state.scrollLeft+this.state.size.width, | ||
this.state.nowposition, | ||
this.state.dayWidth) | ||
horizontalChange = newScrollLeft => { | ||
let new_nowposition = this.state.nowposition; | ||
let new_left = -1; | ||
let headerData = this.state.headerData; | ||
let new_startRow = this.state.startRow; | ||
let new_endRow = this.state.endRow; | ||
//Calculating if we need to roll up the scroll | ||
if (newScrollLeft > this.pxToScroll) { | ||
//ContenLegnth-viewportLengt | ||
new_nowposition = this.state.nowposition - this.pxToScroll; | ||
new_left = 0; | ||
} else { | ||
if (newScrollLeft <= 0) { | ||
//ContenLegnth-viewportLengt | ||
new_nowposition = this.state.nowposition + this.pxToScroll; | ||
new_left = this.pxToScroll; | ||
} else { | ||
new_left = newScrollLeft; | ||
} | ||
} | ||
//Get the day of the left position | ||
let currentIndx = Math.trunc( | ||
(newScrollLeft - this.state.nowposition) / this.state.dayWidth | ||
); | ||
horizontalChange=(newScrollLeft)=>{ | ||
let new_nowposition=this.state.nowposition; | ||
let new_left=-1; | ||
let headerData=this.state.headerData; | ||
let new_startRow=this.state.startRow; | ||
let new_endRow=this.state.endRow; | ||
//Calculating if we need to roll up the scroll | ||
if (newScrollLeft>this.pxToScroll){//ContenLegnth-viewportLengt | ||
new_nowposition=this.state.nowposition-this.pxToScroll | ||
new_left=0; | ||
} else{ | ||
if (newScrollLeft<=0){//ContenLegnth-viewportLengt | ||
new_nowposition=this.state.nowposition+this.pxToScroll | ||
new_left=this.pxToScroll; | ||
}else{ | ||
new_left=newScrollLeft; | ||
} | ||
} | ||
//Calculate rows to render | ||
new_startRow = Math.trunc(this.state.scrollTop / this.props.itemheight); | ||
new_endRow = | ||
new_startRow + this.state.numVisibleRows >= this.props.data.length | ||
? this.props.data.length - 1 | ||
: new_startRow + this.state.numVisibleRows; | ||
//If we need updates then change the state and the scroll position | ||
//Got you | ||
this.setStartEnd(); | ||
this.setState( | ||
(this.state = { | ||
currentday: currentIndx, | ||
nowposition: new_nowposition, | ||
headerData: headerData, | ||
scrollLeft: new_left, | ||
startRow: new_startRow, | ||
endRow: new_endRow | ||
}) | ||
); | ||
}; | ||
//Get the day of the left position | ||
let currentIndx=Math.trunc((newScrollLeft-this.state.nowposition) /this.state.dayWidth) | ||
//Calculate rows to render | ||
new_startRow=Math.trunc(this.state.scrollTop/this.props.itemheight) | ||
new_endRow =new_startRow+this.state.numVisibleRows>=this.props.data.length?this.props.data.length-1:new_startRow+this.state.numVisibleRows; | ||
//If we need updates then change the state and the scroll position | ||
//Got you | ||
this.setStartEnd(); | ||
this.setState( | ||
this.state={ | ||
currentday:currentIndx, | ||
nowposition:new_nowposition, | ||
headerData:headerData, | ||
scrollLeft: new_left, | ||
startRow:new_startRow, | ||
endRow:new_endRow, | ||
}) | ||
} | ||
calculateVerticalScrollVariables = size => { | ||
//The pixel to scroll verically is equal to the pecentage of what the viewport represent in the context multiply by the context width | ||
this.pxToScroll = | ||
(1 - size.width / DATA_CONTAINER_WIDTH) * DATA_CONTAINER_WIDTH - 1; | ||
}; | ||
onHorizonChange = (lowerLimit, upLimit) => { | ||
if (this.props.onHorizonChange) | ||
this.props.onHorizonChange(lowerLimit, upLimit); | ||
}; | ||
///////////////////// | ||
// MOUSE EVENTS // | ||
///////////////////// | ||
calculateVerticalScrollVariables=(size)=>{ | ||
//The pixel to scroll verically is equal to the pecentage of what the viewport represent in the context multiply by the context width | ||
this.pxToScroll=(1-(size.width/DATA_CONTAINER_WIDTH)) * DATA_CONTAINER_WIDTH -1; | ||
} | ||
doMouseDown = e => { | ||
this.dragging = true; | ||
this.draggingPosition = e.clientX; | ||
}; | ||
doMouseMove = e => { | ||
if (this.dragging) { | ||
let delta = this.draggingPosition - e.clientX; | ||
onHorizonChange=(lowerLimit,upLimit)=>{ | ||
if (this.props.onHorizonChange) | ||
this.props.onHorizonChange(lowerLimit,upLimit) | ||
if (delta !== 0) { | ||
this.draggingPosition = e.clientX; | ||
this.horizontalChange(this.state.scrollLeft + delta); | ||
} | ||
} | ||
///////////////////// | ||
// MOUSE EVENTS // | ||
///////////////////// | ||
}; | ||
doMouseUp = e => { | ||
this.dragging = false; | ||
}; | ||
doMouseLeave = e => { | ||
// if (!e.relatedTarget.nodeName) | ||
// this.dragging=false; | ||
this.dragging = false; | ||
}; | ||
doMouseDown=(e)=>{ | ||
this.dragging=true; | ||
this.draggingPosition=e.clientX; | ||
} | ||
doMouseMove=(e)=>{ | ||
if(this.dragging){ | ||
let delta=this.draggingPosition-e.clientX; | ||
if (delta!==0){ | ||
this.draggingPosition=e.clientX; | ||
this.horizontalChange(this.state.scrollLeft+delta); | ||
} | ||
} | ||
} | ||
doMouseUp=(e)=>{ | ||
this.dragging=false; | ||
} | ||
doMouseLeave=(e)=>{ | ||
// if (!e.relatedTarget.nodeName) | ||
// this.dragging=false; | ||
this.dragging=false; | ||
} | ||
doTouchStart=(e)=>{ | ||
this.dragging=true; | ||
this.draggingPosition=e.touches[0].clientX; | ||
} | ||
doTouchEnd=(e)=>{ | ||
this.dragging=false; | ||
} | ||
doTouchMove=(e)=>{ | ||
if(this.dragging){ | ||
let delta=this.draggingPosition-e.touches[0].clientX; | ||
if (delta!==0){ | ||
this.draggingPosition=e.touches[0].clientX; | ||
this.horizontalChange(this.state.scrollLeft+delta); | ||
} | ||
} | ||
} | ||
doTouchCancel=(e)=>{ | ||
this.dragging=false; | ||
} | ||
doTouchStart = e => { | ||
this.dragging = true; | ||
this.draggingPosition = e.touches[0].clientX; | ||
}; | ||
doTouchEnd = e => { | ||
this.dragging = false; | ||
}; | ||
doTouchMove = e => { | ||
if (this.dragging) { | ||
let delta = this.draggingPosition - e.touches[0].clientX; | ||
doMouseLeave=(e)=>{ | ||
// if (!e.relatedTarget.nodeName) | ||
// this.dragging=false; | ||
this.dragging=false; | ||
if (delta !== 0) { | ||
this.draggingPosition = e.touches[0].clientX; | ||
this.horizontalChange(this.state.scrollLeft + delta); | ||
} | ||
} | ||
}; | ||
doTouchCancel = e => { | ||
this.dragging = false; | ||
}; | ||
//Child communicating states | ||
onTaskListSizing=(delta)=>{ | ||
this.setState((prevState) => { | ||
let result={...prevState}; | ||
result.sideStyle={width:result.sideStyle.width-delta}; | ||
return result; | ||
}) | ||
} | ||
doMouseLeave = e => { | ||
// if (!e.relatedTarget.nodeName) | ||
// this.dragging=false; | ||
this.dragging = false; | ||
}; | ||
///////////////////// | ||
// ITEMS EVENTS // | ||
///////////////////// | ||
onSelectItem=(item)=>{ | ||
if (this.props.onSelectItem && item!=this.props.selectedItem) | ||
this.props.onSelectItem(item) | ||
} | ||
//Child communicating states | ||
onTaskListSizing = delta => { | ||
this.setState(prevState => { | ||
let result = { ...prevState }; | ||
result.sideStyle = { width: result.sideStyle.width - delta }; | ||
return result; | ||
}); | ||
}; | ||
onStartCreateLink=(task,position)=>{ | ||
console.log(`Start Link ${task}`) | ||
this.setState({ | ||
interactiveMode:true, | ||
taskToCreate:{task:task,position:position} | ||
}) | ||
} | ||
///////////////////// | ||
// ITEMS EVENTS // | ||
///////////////////// | ||
onFinishCreateLink=(task,position)=>{ | ||
console.log(`End Link ${task}`) | ||
if (this.props.onCreateLink && task){ | ||
this.props.onCreateLink({start:this.state.taskToCreate,end:{task:task,position:position}}) | ||
} | ||
this.setState({ | ||
interactiveMode:false, | ||
taskToCreate:null | ||
}) | ||
onSelectItem = item => { | ||
if (this.props.onSelectItem && item != this.props.selectedItem) | ||
this.props.onSelectItem(item); | ||
}; | ||
onStartCreateLink = (task, position) => { | ||
console.log(`Start Link ${task}`); | ||
this.setState({ | ||
interactiveMode: true, | ||
taskToCreate: { task: task, position: position } | ||
}); | ||
}; | ||
onFinishCreateLink = (task, position) => { | ||
console.log(`End Link ${task}`); | ||
if (this.props.onCreateLink && task) { | ||
this.props.onCreateLink({ | ||
start: this.state.taskToCreate, | ||
end: { task: task, position: position } | ||
}); | ||
} | ||
this.setState({ | ||
interactiveMode: false, | ||
taskToCreate: null | ||
}); | ||
}; | ||
onTaskChanging=(changingTask)=>{ | ||
this.setState({ | ||
changingTask:changingTask | ||
}) | ||
onTaskChanging = changingTask => { | ||
this.setState({ | ||
changingTask: changingTask | ||
}); | ||
}; | ||
calcNumVisibleDays = size => { | ||
return Math.ceil(size.width / this.state.dayWidth) + BUFFER_DAYS; | ||
}; | ||
checkMode() { | ||
if (this.props.mode != this.state.mode && this.props.mode) { | ||
this.state.mode = this.props.mode; | ||
let newDayWidth = this.getDayWidth(this.state.mode); | ||
this.state.dayWidth = newDayWidth; | ||
this.state.numVisibleDays = this.calcNumVisibleDays(this.state.size); | ||
//to recalculate the now position we have to see how mwny scroll has happen | ||
//to do so we calculate the diff of days between current day and now | ||
//And we calculate how many times we have scroll | ||
let scrollTime = Math.ceil( | ||
(-this.state.currentday * this.state.dayWidth) / this.pxToScroll | ||
); | ||
//We readjust now postion to the new number of scrolls | ||
this.state.nowposition = scrollTime * this.pxToScroll; | ||
let scrollLeft = | ||
(this.state.currentday * this.state.dayWidth + this.state.nowposition) % | ||
this.pxToScroll; | ||
// we recalculate the new scroll Left value | ||
this.state.scrollLeft = scrollLeft; | ||
} | ||
calcNumVisibleDays=(size)=>{ | ||
return Math.ceil(size.width / this.state.dayWidth)+BUFFER_DAYS | ||
} | ||
checkNeeeData = () => { | ||
if (this.props.data != this.state.data) { | ||
this.state.data = this.props.data; | ||
let rowInfo = this.calculateStartEndRows( | ||
this.state.numVisibleRows, | ||
this.props.data, | ||
this.state.scrollTop | ||
); | ||
this.state.startRow = rowInfo.start; | ||
this.state.endRow = rowInfo.end; | ||
Registry.registerData(this.state.data); | ||
} | ||
checkMode(){ | ||
if(this.props.mode!=this.state.mode && this.props.mode){ | ||
this.state.mode=this.props.mode | ||
let newDayWidth=this.getDayWidth(this.state.mode); | ||
this.state.dayWidth=newDayWidth; | ||
this.state.numVisibleDays=this.calcNumVisibleDays(this.state.size) | ||
//to recalculate the now position we have to see how mwny scroll has happen | ||
//to do so we calculate the diff of days between current day and now | ||
//And we calculate how many times we have scroll | ||
let scrollTime=Math.ceil(-this.state.currentday*this.state.dayWidth/this.pxToScroll) | ||
//We readjust now postion to the new number of scrolls | ||
this.state.nowposition=scrollTime*this.pxToScroll; | ||
let scrollLeft=(this.state.currentday*this.state.dayWidth+this.state.nowposition)%this.pxToScroll | ||
// we recalculate the new scroll Left value | ||
this.state.scrollLeft=scrollLeft; | ||
} | ||
if (this.props.links != this.state.links) { | ||
this.state.links = this.props.links; | ||
Registry.registerLinks(this.props.links); | ||
} | ||
checkNeeeData=()=>{ | ||
if (this.props.data!=this.state.data){ | ||
this.state.data=this.props.data; | ||
let rowInfo=this.calculateStartEndRows(this.state.numVisibleRows,this.props.data,this.state.scrollTop); | ||
this.state.startRow=rowInfo.start; | ||
this.state.endRow=rowInfo.end; | ||
Registry.registerData(this.state.data) | ||
} | ||
if (this.props.links!=this.state.links){ | ||
this.state.links=this.props.links; | ||
Registry.registerLinks(this.props.links) | ||
} | ||
} | ||
render(){ | ||
this.checkMode(); | ||
this.checkNeeeData(); | ||
return ( | ||
<div className="timeLine"> | ||
<div className="timeLine-side-main" style={this.state.sideStyle}> | ||
<TaskList | ||
ref='taskViewPort' | ||
itemheight={this.props.itemheight} | ||
startRow={this.state.startRow} | ||
endRow={this.state.endRow} | ||
data={this.props.data} | ||
selectedItem={this.props.selectedItem} | ||
onSelectItem={this.onSelectItem} | ||
onUpdateTask={this.props.onUpdateTask} | ||
onScroll={this.verticalChange}/> | ||
<VerticalSpliter onTaskListSizing={this.onTaskListSizing}/> | ||
</div> | ||
<div className="timeLine-main"> | ||
<Header headerData={this.state.headerData} | ||
numVisibleDays={this.state.numVisibleDays} | ||
currentday={this.state.currentday} | ||
nowposition={this.state.nowposition} | ||
dayWidth={this.state.dayWidth} | ||
mode={this.state.mode} | ||
scrollLeft={this.state.scrollLeft}/> | ||
<DataViewPort | ||
ref='dataViewPort' | ||
scrollLeft={this.state.scrollLeft} | ||
scrollTop={this.state.scrollTop} | ||
itemheight={this.props.itemheight} | ||
nowposition={this.state.nowposition} | ||
startRow={this.state.startRow} | ||
endRow={this.state.endRow} | ||
data={this.props.data} | ||
selectedItem={this.props.selectedItem} | ||
dayWidth={this.state.dayWidth} | ||
onScroll={this.scrollData} | ||
onMouseDown={this.doMouseDown} | ||
onMouseMove={this.doMouseMove} | ||
onMouseUp={this.doMouseUp} | ||
onMouseLeave ={this.doMouseLeave} | ||
onTouchStart={this.doTouchStart} | ||
onTouchMove={this.doTouchMove} | ||
onTouchEnd={this.doTouchEnd} | ||
onTouchCancel={this.doTouchCancel} | ||
onSelectItem={this.onSelectItem} | ||
onUpdateTask={this.props.onUpdateTask} | ||
onTaskChanging={this.onTaskChanging} | ||
onStartCreateLink={this.onStartCreateLink} | ||
onFinishCreateLink={this.onFinishCreateLink} | ||
boundaries={{lower:this.state.scrollLeft,upper:this.state.scrollLeft+this.state.size.width}} | ||
onSize={this.onSize}/> | ||
<LinkViewPort | ||
scrollLeft={this.state.scrollLeft} | ||
scrollTop={this.state.scrollTop} | ||
startRow={this.state.startRow} | ||
endRow={this.state.endRow} | ||
data={this.props.data} | ||
nowposition={this.state.nowposition} | ||
dayWidth={this.state.dayWidth} | ||
interactiveMode={this.state.interactiveMode} | ||
taskToCreate={this.state.taskToCreate} | ||
onFinishCreateLink={this.onFinishCreateLink} | ||
changingTask={this.state.changingTask} | ||
selectedItem={this.props.selectedItem} | ||
onSelectItem={this.onSelectItem} | ||
itemheight={this.props.itemheight} | ||
onSelectItem={this.onSelectItem} | ||
links={this.props.links}/> | ||
</div> | ||
</div>) | ||
} | ||
}; | ||
render() { | ||
this.checkMode(); | ||
this.checkNeeeData(); | ||
return ( | ||
<div className="timeLine"> | ||
<div className="timeLine-side-main" style={this.state.sideStyle}> | ||
<TaskList | ||
ref="taskViewPort" | ||
itemheight={this.props.itemheight} | ||
startRow={this.state.startRow} | ||
endRow={this.state.endRow} | ||
data={this.props.data} | ||
selectedItem={this.props.selectedItem} | ||
onSelectItem={this.onSelectItem} | ||
onUpdateTask={this.props.onUpdateTask} | ||
onScroll={this.verticalChange} | ||
nonEditable={this.props.nonEditableName} | ||
/> | ||
<VerticalSpliter onTaskListSizing={this.onTaskListSizing} /> | ||
</div> | ||
<div className="timeLine-main"> | ||
<Header | ||
headerData={this.state.headerData} | ||
numVisibleDays={this.state.numVisibleDays} | ||
currentday={this.state.currentday} | ||
nowposition={this.state.nowposition} | ||
dayWidth={this.state.dayWidth} | ||
mode={this.state.mode} | ||
scrollLeft={this.state.scrollLeft} | ||
/> | ||
<DataViewPort | ||
ref="dataViewPort" | ||
scrollLeft={this.state.scrollLeft} | ||
scrollTop={this.state.scrollTop} | ||
itemheight={this.props.itemheight} | ||
nowposition={this.state.nowposition} | ||
startRow={this.state.startRow} | ||
endRow={this.state.endRow} | ||
data={this.props.data} | ||
selectedItem={this.props.selectedItem} | ||
dayWidth={this.state.dayWidth} | ||
onScroll={this.scrollData} | ||
onMouseDown={this.doMouseDown} | ||
onMouseMove={this.doMouseMove} | ||
onMouseUp={this.doMouseUp} | ||
onMouseLeave={this.doMouseLeave} | ||
onTouchStart={this.doTouchStart} | ||
onTouchMove={this.doTouchMove} | ||
onTouchEnd={this.doTouchEnd} | ||
onTouchCancel={this.doTouchCancel} | ||
onSelectItem={this.onSelectItem} | ||
onUpdateTask={this.props.onUpdateTask} | ||
onTaskChanging={this.onTaskChanging} | ||
onStartCreateLink={this.onStartCreateLink} | ||
onFinishCreateLink={this.onFinishCreateLink} | ||
boundaries={{ | ||
lower: this.state.scrollLeft, | ||
upper: this.state.scrollLeft + this.state.size.width | ||
}} | ||
onSize={this.onSize} | ||
/> | ||
<LinkViewPort | ||
scrollLeft={this.state.scrollLeft} | ||
scrollTop={this.state.scrollTop} | ||
startRow={this.state.startRow} | ||
endRow={this.state.endRow} | ||
data={this.props.data} | ||
nowposition={this.state.nowposition} | ||
dayWidth={this.state.dayWidth} | ||
interactiveMode={this.state.interactiveMode} | ||
taskToCreate={this.state.taskToCreate} | ||
onFinishCreateLink={this.onFinishCreateLink} | ||
changingTask={this.state.changingTask} | ||
selectedItem={this.props.selectedItem} | ||
onSelectItem={this.onSelectItem} | ||
itemheight={this.props.itemheight} | ||
onSelectItem={this.onSelectItem} | ||
links={this.props.links} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
TimeLine.propTypes = { | ||
itemheight: PropTypes.number.isRequired, | ||
dayWidth:PropTypes.number.isRequired | ||
}; | ||
itemheight: PropTypes.number.isRequired, | ||
dayWidth: PropTypes.number.isRequired, | ||
nonEditableName: PropTypes.bool | ||
}; | ||
TimeLine.defaultProps = { | ||
itemheight:20, | ||
dayWidth:24 | ||
}; | ||
itemheight: 20, | ||
dayWidth: 24, | ||
nonEditableName: false | ||
}; | ||
export default TimeLine | ||
export default TimeLine; |
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
2788
247
188453
9
30
37
+ Addedmoment@^2.24.0
+ Addedreact-sizeme@^2.5.2