@hpcc-js/timeline 3.4.8 → 3.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,3 +1,701 @@
1
- var t=Object.defineProperty,e=(e,i)=>t(e,"name",{value:i,configurable:!0});import{ITooltip as i}from"@hpcc-js/api";import{Axis as o}from"@hpcc-js/chart";import{Utility as s,SVGWidget as n,local as r,scaleBand as a,extent as l,timeParse as h,timeFormat as p,zoomIdentity as c,d3Event as d,zoom as m,select as u,EntityPin as _,EntityRect as x,SVGZoomWidget as g,scaleLinear as b,min as y,max as f}from"@hpcc-js/common";import{HTMLTooltip as k}from"@hpcc-js/html";import{LabelledRect as C,render as F}from"@hpcc-js/react";import{Border2 as v}from"@hpcc-js/layout";const w="@hpcc-js/timeline",A="3.4.8",S="3.24.0",z=class _MiniGantt extends n{tlAxis;brAxis;verticalBands;_zoom;gUpperContent;gUpperAxis;gMiddleContent;gLowerAxis;gLowerContent;localRect=r();localEntityPin=r();tooltipFormatter;_dateCache;rootExtent;_title_idx=0;_startDate_idx=1;_endDate_idx=2;_icon_idx=-1;_color_idx=-1;_yoffset_idx=-1;constructor(){super(),i.call(this),s.SimpleSelectionMixin.call(this),this._drawStartPos="origin",this.tooltipHTML(t=>`<center>${t[this._title_idx]}</center><br>${this.tooltipFormatter(this.brAxis.parse(t[this._startDate_idx]))} -> ${this.tooltipFormatter(this.brAxis.parse(t[this._endDate_idx]))}`),this.tlAxis=(new o).type("time"),this.brAxis=(new o).type("time"),this.verticalBands=a().paddingOuter(.2).paddingInner(.2)}isHorizontal(){return"horizontal"===this.orientation()}fullExtent(){const t=[...this.data().map(t=>t[this._startDate_idx]),...this.data().filter(t=>!!t[this._endDate_idx]).map(t=>t[this._endDate_idx])];return l(t)}extent(){const t=this.rootExtent?[this.rootExtent[1],this.rootExtent[2]]:this.fullExtent();if(void 0!==t[0]&&void 0!==t[1]&&(t[0]===t[1]||this.centerOnMostRecent())){const e=h(this.timePattern()),i=p(this.timePattern()),o=e(t[0]),s=e(t[1]);if(t[0]===t[1])t[0]=i(new Date(o.setFullYear(o.getFullYear()-1))),t[1]=i(new Date(o.setFullYear(o.getFullYear()+2)));else{const e=o.getTime(),n=s.getTime()-e;t[0]=i(o),t[1]=i(new Date(e+2*n))}}return t}dataStartPos(t){if(void 0!==this._dateCache[t[this._startDate_idx]])return this._dateCache[t[this._startDate_idx]];const e=this.brAxis.scalePos(t[this._startDate_idx]);return this._dateCache[t[this._startDate_idx]]=e,e}dataEndPos(t){if(void 0!==this._dateCache[t[this._endDate_idx]])return this._dateCache[t[this._endDate_idx]];const e=this.brAxis.scalePos(t[this._endDate_idx]);return this._dateCache[t[this._endDate_idx]]=e,e}dataWidth(t){return this.dataEndPos(t)-this.dataStartPos(t)}transform;resetZoom(){this._zoom.transform(this.element(),c.translate(0,this.isHorizontal()?0:this.height()))}zoomed(){this.transform=d().transform,this.render()}background;enter(t,e){super.enter(t,e),this._zoom=m().scaleExtent([0,this.maxZoom()]).on("zoom",()=>{this.zoomed()}),this.background=e.append("rect").attr("fill","white").attr("opacity",0).on("dblclick",()=>{d().stopPropagation(),delete this.rootExtent,this.resetZoom()}),this.gUpperContent=e.append("g").attr("class","gUpperContent"),this.gUpperAxis=e.append("g").attr("class","gUpperAxis"),this.gMiddleContent=e.append("g").attr("class","gMiddleContent"),this.gLowerAxis=e.append("g").attr("class","gLowerAxis"),this.gLowerContent=e.append("g").attr("class","gLowerContent"),this.tlAxis.target(this.gUpperAxis.node()).tickFormat(this.tickFormat()).guideTarget(this.gUpperAxis.append("g").node()).shrinkToFit("none").overlapMode(this.tickFormat_exists()?"stagger":"none").extend(.1),this.brAxis.target(this.gLowerAxis.node()).tickFormat(this.tickFormat()).guideTarget(this.gLowerAxis.append("g").node()).shrinkToFit("none").overlapMode(this.tickFormat_exists()?"stagger":"none").extend(.1),e.call(this._zoom),this._selection.widgetElement(this.gMiddleContent)}_prevIsHorizontal;update(t,e){if(super.update(t,e),this._dateCache={},this._title_idx=null!==this.titleColumn()?this.columns().indexOf(this.titleColumn()):this._title_idx,this._startDate_idx=null!==this.startDateColumn()?this.columns().indexOf(this.startDateColumn()):this._startDate_idx,this._endDate_idx=null!==this.endDateColumn()?this.columns().indexOf(this.endDateColumn()):this._endDate_idx,this._icon_idx=null!==this.iconColumn()?this.columns().indexOf(this.iconColumn()):this._icon_idx,this._color_idx=null!==this.colorColumn()?this.columns().indexOf(this.colorColumn()):this._color_idx,this._yoffset_idx=null!==this.yOffsetColumn()?this.columns().indexOf(this.yOffsetColumn()):this._yoffset_idx,this._prevIsHorizontal!==this.isHorizontal())return this._prevIsHorizontal=this.isHorizontal(),void this.resetZoom();this.tooltipFormatter=p(this.tooltipTimeFormat());const i=this.width(),o=this.height();this.background.attr("x",0).attr("y",0).attr("width",i).attr("height",o);const s=this.extent();if(this.tlAxis.x(i/2).orientation(this.isHorizontal()?"top":"left").reverse(!this.isHorizontal()).timePattern(this.timePattern()).width(i-1).low(s[0]).high(s[1]).updateScale(),this.brAxis.x(i/2).y(o/2).orientation(this.isHorizontal()?"bottom":"right").reverse(!this.isHorizontal()).timePattern(this.timePattern()).width(i-1).height(o).low(s[0]).high(s[1]).updateScale(),this.transform){let t,e;this.isHorizontal()?(t=this.tlAxis.parseInvert(this.tlAxis.invert(this.transform.invertX(0))),e=this.tlAxis.parseInvert(this.tlAxis.invert(this.transform.invertX(i-1)))):(t=this.tlAxis.parseInvert(this.tlAxis.invert(-this.transform.invertY(0))),e=this.tlAxis.parseInvert(this.tlAxis.invert(-this.transform.invertY(o-1)))),this.tlAxis.low(t).high(e).updateScale(),this.brAxis.low(t).high(e).updateScale()}const n=this.data().sort(this.isHorizontal()?(t,e)=>{const i=this.brAxis.scalePos(t[1])-this.brAxis.scalePos(e[1]);return 0===i?(""+t[0]).localeCompare(""+e[0]):i}:(t,e)=>this.brAxis.scalePos(e[1])-this.brAxis.scalePos(t[1])),r=n.filter(t=>!t[this._endDate_idx]),a=n.filter(t=>!!t[this._endDate_idx]);this.tlAxis.render(),this.brAxis.render();const l=this.brAxis.getBBox();let h=this.updateEntityPins(r);const c=l.height;let d=o-h;const m=-1!==this._yoffset_idx?Math.min.apply(void 0,this.data().filter(t=>!isNaN(t[this._yoffset_idx])).map(t=>t[this._yoffset_idx])):0;if(r.length>0&&0===a.length){this.tlAxis.visible(!1);let t=h/4;t>o/2-c&&(t=o/2-c);const e=o/2+t,i=-1*(o/2-c-t),s=0!==m?m/2:0;this.gUpperContent.attr("transform",`translate(0, ${e-s})`),this.gLowerAxis.attr("transform",`translate(0, ${i-s})`)}else 0===r.length&&a.length>0?(this.tlAxis.visible(!0),this.gUpperContent.attr("transform",`translate(0, ${h})`),this.gUpperAxis.attr("transform",`translate(0, ${h})`)):(h-=m,d+=m,this.tlAxis.visible(!0),this.gUpperContent.attr("transform",`translate(0, ${h})`),this.gUpperAxis.attr("transform",`translate(0, ${h})`),this.gMiddleContent.attr("transform",`translate(0, ${h})`));this.tlAxis.render();const u=this.tlAxis.getBBox(),_=[],x={};for(const p of a){for(let t=0;t<_.length;++t){const e=_[t];if(e.endPos+this.overlapTolerence()<=this.dataStartPos(p)){x[p]=t,e.endPos=this.dataEndPos(p);break}}void 0===x[p]&&(x[p]=_.length,_.push({endPos:this.dataEndPos(p)}))}const g=this.isHorizontal()?0+u.height:0+u.width,b=this.isHorizontal()?d-l.height:i-l.width;this.verticalBands.range([g,b]).domain(_.map((t,e)=>e)),a.length>0&&this.updateEventRanges(r,a,x,d,u,l,i)}updateEntityPins(t){let e=0;const i=this,o=this.gUpperContent.selectAll(".entity_pin").data(t,t=>t[0]+":"+t[1]),s=this.eventFontColorColumn()?this.columns().indexOf(this.eventFontColorColumn()):-1,n=this.eventBorderColorColumn()?this.columns().indexOf(this.eventBorderColorColumn()):-1,r=this.eventBackgroundColorColumn()?this.columns().indexOf(this.eventBackgroundColorColumn()):-1,a={};for(const d of t){const t=void 0!==d[i._title_idx]?d[i._title_idx]:d[0];a[t]=a[t]?a[t]+1:1}const l=Object.keys(a),h=i.eventGroupOffset(),p=o.enter().append("g").attr("class","entity_pin");p.append("line").attr("class","entity_line"),p.on("mouseover",function(t){u(this).raise()}).each(function(t,e){const o=(new _).target(this).icon("").iconOnlyShowOnHover(i.hideIconWhenCollapsed()).titleOnlyShowOnHover(i.hideTitleWhenCollapsed()).descriptionOnlyShowOnHover(i.hideDescriptionWhenCollapsed()).annotationOnlyShowOnHover(i.hideAnnotationsWhenCollapsed()).iconDiameter(18).iconPaddingPercent(1).titleFontSize(14).descriptionColor("#333").descriptionFontSize(15).iconColor(-1===s?"#333":t[s]).titleColor(-1===s?"#333":t[s]).descriptionColor(-1===s?"#333":t[s]).backgroundShape("pin").backgroundColorFill(-1===s?"#f8f8f8":t[r]).backgroundColorStroke(-1===s?"#ccc":t[n]).cornerRadius(5).arrowHeight(10).arrowWidth(16);i.localEntityPin.set(this,o)}).merge(o).each(function(t,o){const r=i.localEntityPin.get(this),a=void 0!==t[i._title_idx]?t[i._title_idx]:r.title(),p=i.dataStartPos(t)-0;let c=l.indexOf(a)%i.eventGroupMod()*h-5;if(void 0!==t[i._yoffset_idx]&&(c+=t[i._yoffset_idx]?t[i._yoffset_idx]:0),t[i._title_idx]!==r.title()&&t[i._startDate_idx]!==r.description()){const e=i.brAxis.parse(t[i._startDate_idx]),o=i.tooltipFormatter(e);r.x(p).y(c).iconOnlyShowOnHover(i.hideIconWhenCollapsed()).titleOnlyShowOnHover(i.hideTitleWhenCollapsed()).descriptionOnlyShowOnHover(i.hideDescriptionWhenCollapsed()).annotationOnlyShowOnHover(i.hideAnnotationsWhenCollapsed()).icon(void 0!==t[i._icon_idx]?t[i._icon_idx]:r.icon()).title(a).description(o).animationFrameRender()}else r.move({x:p,y:c});const d=r.calcHeight();e<d&&(e=d),u(this).selectAll(".entity_line").attr("x1",p).attr("x2",p).attr("y1",0).attr("y2",c).style("stroke",-1===s?"#ccc":t[n]).style("stroke-width",1)}),o.exit().each(function(t,e){i.localEntityPin.get(this).target(null)}).remove();const c=Math.abs(Math.min(t.length,i.eventGroupMod())*i.eventGroupOffset());return e+c}updateEventRanges(t,e,i,o,s,n,r){const a=this,l=this.gMiddleContent.selectAll(".line").data(t,t=>t[a._title_idx]);l.enter().append("line").attr("class","line").merge(l).attr(this.isHorizontal()?"x1":"y1",t=>this.dataStartPos(t)-0).attr(this.isHorizontal()?"x2":"y2",t=>this.dataStartPos(t)-0).attr(this.isHorizontal()?"y1":"x1",this.isHorizontal()?s.height:s.width).attr(this.isHorizontal()?"y2":"x2",this.isHorizontal()?o-n.height:r-n.width),l.exit().remove();const h=this.gMiddleContent.selectAll(".buckets").data(e,t=>t[a._title_idx]);h.enter().append("g").attr("class","buckets").call(this._selection.enter.bind(this._selection)).each(function(t){const e=(new x).target(this).iconDiameter(28).iconPaddingPercent(0).titleFontSize(28).titleColor(a.rangeFontColor()).descriptionColor(a.rangeFontColor()).iconColor(a.rangeFontColor()).backgroundShape("rect").backgroundColorFill(t[a._color_idx]);a.localRect.set(this,e),a.enterEntityRect(e,t)}).on("click",function(t){a.click(a.rowToObj(t),"range",a._selection.selected(this))},!1).on("dblclick",function(t){a.rootExtent=t,a.resetZoom(),a.dblclick(a.rowToObj(t),"range",a._selection.selected(this))},!0).on("mouseout.tooltip",this.tooltip.hide).on("mousemove.tooltip",this.tooltip.show).merge(h).attr("transform",t=>a.isHorizontal()?`translate(${this.dataStartPos(t)}, ${this.verticalBands(i[t])}) `:`translate(${this.verticalBands(i[t])}, ${this.dataStartPos(t)}) `).each(function(t){const e=a.localRect.get(this),i=a.dataWidth(t)/2,o=a.verticalBands.bandwidth()/2,s=Math.max(a.dataWidth(t),2),n=Math.max(a.verticalBands.bandwidth(),2),r=.191*n,l=.618*n,h=l;e.pos(a.isHorizontal()?{x:i,y:o}:{x:o,y:i}).fixedHeight(a.isHorizontal()?n:s).fixedWidth(a.isHorizontal()?s:n).icon(void 0!==t[a._icon_idx]?t[a._icon_idx]:"").title(void 0!==t[a._title_idx]?t[a._title_idx]:"").padding(r).iconDiameter(h).titleFontSize(l),1.5*h>s&&e.icon(null),a.updateEntityRect(e,t[a._icon_idx]),e.render()}),h.exit().remove()}exit(t,e){this.brAxis.target(null),this.tlAxis.target(null),super.exit(t,e)}click(t,e,i){}dblclick(t,e,i){}enterEntityRect(t,e){}updateEntityRect(t,e){}};e(z,"MiniGantt");let P=z;P.prototype._class+=" timeline_MiniGantt",P.prototype.implements(i.prototype),P.prototype.mixin(s.SimpleSelectionMixin),P.prototype.publish("timePattern","%Y-%m-%d","string","timePattern"),P.prototype.publish("tickFormat",null,"string","tickFormat",void 0,{optional:!0}),P.prototype.publish("tooltipTimeFormat","%Y-%m-%d","string","tooltipTimeFormat"),P.prototype.publish("overlapTolerence",2,"number","overlapTolerence"),P.prototype.publish("orientation","horizontal","set","orientation",["horizontal","vertical"]),P.prototype.publish("rangeFontColor","#ecf0f1","html-color","rangeFontColor"),P.prototype.publish("titleColumn",null,"string","titleColumn"),P.prototype.publish("startDateColumn",null,"string","startDateColumn"),P.prototype.publish("endDateColumn",null,"string","endDateColumn"),P.prototype.publish("iconColumn",null,"string","iconColumn"),P.prototype.publish("colorColumn",null,"string","colorColumn"),P.prototype.publish("yOffsetColumn",null,"string","yOffsetColumn"),P.prototype.publish("maxZoom",16,"number","maxZoom"),P.prototype.publish("eventGroupOffset",-50,"number","eventGroupOffset"),P.prototype.publish("eventGroupMod",5,"number","eventGroupMod"),P.prototype.publish("eventFontColorColumn",null,"string","eventFontColorColumn"),P.prototype.publish("eventBorderColorColumn",null,"string","eventBorderColorColumn"),P.prototype.publish("eventBackgroundColorColumn",null,"string","eventBackgroundColorColumn"),P.prototype.publish("hideIconWhenCollapsed",!1,"boolean","hideIconWhenCollapsed"),P.prototype.publish("hideTitleWhenCollapsed",!1,"boolean","hideTitleWhenCollapsed"),P.prototype.publish("hideDescriptionWhenCollapsed",!1,"boolean","hideDescriptionWhenCollapsed"),P.prototype.publish("hideAnnotationsWhenCollapsed",!0,"boolean","hideAnnotationsWhenCollapsed"),P.prototype.publish("centerOnMostRecent",!1,"boolean","If true, the timeline will be centered on the most recent data point");const M=class _ReactGantt extends g{_selection=new s.Selection(this);_buckets;_interpolateX;_interpolateY;_bucketsBySeries;_dataBySeries;_origIdxMap;_seriesBackgrounds;_maxFontSize;_tooltip;_minStart;_maxEnd;_prevZoomState=null;_title_idx=0;_startDate_idx=1;_endDate_idx=2;_icon_idx=-1;_color_idx=-1;_series_idx=-1;_bucket_idx=-1;_yoffset_idx=-1;_maxX;_maxY;_rangeOptions={rangePadding:2,fontFamily:"Verdana",fontSize:12,fill:"white",stroke:"black",textFill:"black",cornerRadius:3,strokeWidth:0};constructor(t="origin"){super(),this._drawStartPos=t,this.showToolbar_default(!1),this._tooltip=new k,this._tooltip.tooltipHTML(t=>`<div style="text-align:center;">${t[0]}<br/><br/>${t[1]} -&gt; ${t[2]}</div>`),this._tooltip.followCursor(!0)}selection(t){return arguments.length?(this._selection.set(t),this):this._selection.get()}_rangeRenderer=C;rangeRenderer(t){return arguments.length?(this._rangeRenderer=t,this._rangeRenderer):this._rangeRenderer}enter(t,e){super.enter(t,e);const i=this;e.on("click",function(t){i._selection.clear()}),this._tooltip.target(t)}update(t,i){super.update(t,i),this.zoomExtent([.05,this.maxZoom()]),this._title_idx=null!==this.titleColumn()?this.columns().indexOf(this.titleColumn()):this._title_idx,this._startDate_idx=null!==this.startDateColumn()?this.columns().indexOf(this.startDateColumn()):this._startDate_idx,this._endDate_idx=null!==this.endDateColumn()?this.columns().indexOf(this.endDateColumn()):this._endDate_idx,this._icon_idx=null!==this.iconColumn()?this.columns().indexOf(this.iconColumn()):this._icon_idx,this._color_idx=null!==this.colorColumn()?this.columns().indexOf(this.colorColumn()):this._color_idx,this._series_idx=null!==this.seriesColumn()?this.columns().indexOf(this.seriesColumn()):this._series_idx,this._bucket_idx=null!==this.bucketColumn()?this.columns().indexOf(this.bucketColumn()):-1;const o=this,s=this.width(),n=s;if(this._interpolateX=b().domain([this._minStart,this._maxEnd]).range([0,n]),this.data().sort((t,e)=>t[1]-e[1]),this._series_idx>-1){this._origIdxMap={},this._dataBySeries={},this._bucketsBySeries={},this.data().forEach((t,e)=>{const i=t[this._series_idx];this._dataBySeries[i]||(this._origIdxMap[i]={},this._dataBySeries[i]=[]),this._dataBySeries[i].push({dataRow:t,origIdx:e})});const t=this.gutter();let e=0;const i=Object.keys(this._dataBySeries);i.forEach(t=>{this._dataBySeries[t].sort((t,e)=>t.dataRow[1]-e.dataRow[1]),this._bucketsBySeries[t]=this.calcBuckets(this._dataBySeries[t].map(t=>t.dataRow),1,2),this._bucketsBySeries[t].bucketHeight=this.bucketHeight(),this._bucketsBySeries[t].bucketOffset=e,e+=(this._bucketsBySeries[t].bucketHeight+this.strokeWidth()+this.gutter())*(this._bucketsBySeries[t].maxBucket+1),this._dataBySeries[t].forEach((e,i)=>{this._origIdxMap[t][e.origIdx]=i})}),this._seriesBackgrounds=this._renderElement.selectAll(".series-background").data(i.map(t=>this._bucketsBySeries[t])),this._seriesBackgrounds.join(t=>t.append("rect").attr("class","series-background"),t=>t,t=>t.each(function(t){delete t.element}).remove()).attr("opacity",t=>t.props&&t.props.hidden?0:1).each(function(e,i){u(this).attr("x",0).attr("y",e.bucketOffset-t/2).attr("width",s).attr("height",(e.bucketHeight+t)*(e.maxBucket+1)+t).attr("fill",i%2?o.oddSeriesBackground():o.evenSeriesBackground())})}else-1!==this._bucket_idx?this._buckets=this.calcBuckets(this.data(),this._startDate_idx,this._endDate_idx,this._bucket_idx):this._buckets=this.calcBuckets(this.data(),this._startDate_idx,this._endDate_idx);if(!this.preserveZoom()||!this._prevZoomState){const t=this._interpolateX(this._minStart);this.zoomTo([t,0],1)}const r=this.bucketHeight();this.setRangeOptions(),this._maxFontScale=r-2*this.rangePadding(),this.measureDataText();const a=this._renderElement.selectAll(".item").data(this.data()),l=this.strokeWidth(),h=2*l;if(a.join(t=>t.append("g").attr("class","item").on("click.selectionBag",function(t,i){const s=void 0===t.id?i:t.id;o._selection.isSelected({_id:s,element:t.element})?o._selection.clear():o._selection.click({_id:s,element:/* @__PURE__ */e(()=>t.element,"element")},d),o.selectionChanged(),d().stopPropagation()}).on("click",function(t){const e=t.element.classed("selected");t[o.columns().length]&&(t.__lparam=t[o.columns().length]),o.click(t,"",e)}).on("dblclick",function(t){const e=t.element.classed("selected");t[o.columns().length]&&(t.__lparam=t[o.columns().length]),o.click(t,"",e)}).on("mousein",function(t){o.highlightItem(u(this),t);const e=t.element.classed("selected");o.mousein(t,"",e)}).on("mouseover",function(t){const e=d();o._tooltip._triggerElement=t.element,o._tooltip._cursorLoc=[e.clientX,e.clientY],o._tooltip.data(t).visible(!0).fitContent(!0).render(),o.highlightItem(u(this),t);const i=t.element.classed("selected");o.mouseover(t,"",i)}).on("mouseout",function(t){o._tooltip.visible(!1).render(),o.highlightItem(null,null);const e=t.element.classed("selected");o.mouseout(t,"",e)}).each(function(t,e){t.that=this,t.element=u(this),t.x=o._interpolateX(t[1]);const i=o._interpolateX(t[2]);if(o._series_idx>-1){const i=t[o._series_idx],s=o._bucketsBySeries[i].bucketMap[o._origIdxMap[i][e]];t.y=o._bucketsBySeries[i].interpolateY(s)+o._bucketsBySeries[i].bucketOffset}else{const i=-1===o._bucket_idx?e:t[o._bucket_idx];t.y=o._buckets.interpolateY(o._buckets.bucketMap[i])}t.props={...t[3],text:t[0]},t.props.width=i-t.x,t.props.height=r,t.x+=l,t.y+=l,t.props.width-=h,t.props.height-=h,t.element.attr("transform",`translate(${t.x+t.props.width/2} ${t.y+t.props.height/2})`)}),t=>t,t=>t.each(function(t){delete t.element}).remove()).attr("opacity",t=>t.props&&t.props.hidden?0:1).each(function(t,e){if(t.that=this,o._series_idx>-1){const i=t[o._series_idx];t.x=o.renderRangeElement(t,e,!1,o._rangeOptions,i)}else t.x=o.renderRangeElement(t,e,!1,o._rangeOptions)}).on("dblclick.zoom",t=>{const e=this._interpolateX(t[1]),i=this._interpolateX(t[2]),o=s/(i-e);this.zoomTo([-e*o,0],o)}),i.on("dblclick.zoom",null),this.preserveZoom()&&this._prevZoomState&&this._interpolateX){const t=this.width();if(t>0){const e=this._minStart,i=this._maxEnd,o=Math.max(e,Math.min(i,this._prevZoomState.visibleStart));let s=Math.max(e,Math.min(i,this._prevZoomState.visibleEnd));if(s<=o){const t=1e-6*(i-e)||1e-6;s=Math.min(i,o+t)}const n=this._interpolateX(o),r=this._interpolateX(s),a=r-n;if(isFinite(a)&&Math.abs(a)>1e-9){const o=t/a,s=.05,l=this.maxZoom(),h=Math.max(s,Math.min(l,o));if(h>0&&isFinite(h)){const o=(n+r)/2,s=t/(2*h),a=this._interpolateX(e),l=this._interpolateX(i);let p=o;p-s<a&&(p=a+s),p+s>l&&(p=l-s);const c=t/2-h*p;isFinite(c)&&this.zoomTo([c,0],h)}}}}}exit(t,e){this._tooltip.target(null),super.exit(t,e)}renderRangeElement(t,e,i=!1,o={},s){const n=o.strokeWidth,r=2*n,a=o.rangePadding;let l;const h=isNaN(this._transform.x)?0:this._transform.x,p=isNaN(this._transform.k)?1:this._transform.k;let c;const d=this.bucketHeight();t.that.setAttribute("data-series",s),this._color_idx>-1&&t.that.setAttribute("data-color",t[this._color_idx]),void 0!==s?(c=this._bucketsBySeries[s].bucketMap[this._origIdxMap[s][e]],t.that.setAttribute("data-b",c),t.that.setAttribute("data-bucketOffset",this._bucketsBySeries[s].bucketOffset),t.y=this._bucketsBySeries[s].interpolateY(c)+this._bucketsBySeries[s].bucketOffset,t.that.setAttribute("data-dy",t.y)):(c=this._buckets.bucketMap[e],t.y=this._buckets.interpolateY(c)),this._color_idx>-1&&(o.fill=t[this._color_idx]),i?(t.x=this._interpolateX(t[1])*p,l=this._interpolateX(t[2])*p,t.props={...t[3],text:t[0]},t.props.width=(l-t.x)/p,t.x+=h,t.props.width*=p):(t.x=this._interpolateX(t[1]),l=this._interpolateX(t[2]),t.props={...t[3],text:t[0]},t.props.width=(l-t.x)/p),t.props.height=d,void 0===s&&this._buckets.bucketScale<1&&(t.props.height=this._buckets.bucketScale*d),void 0===t.element&&t.that&&(t.element=u(t.that)),t.element.attr("transform",`translate(${t.x+t.props.width/2} ${t.y+t.props.height/2})`),t.x+=n,t.y+=n,t.props.width-=r,t.props.height-=r,t.props.width=t.props.width<1?1:t.props.width,t.props.height=t.props.height<1?1:t.props.height;let m=this.truncateText(t.props.text,t.props.width-a,this._maxFontScale);m!==t.props.text?m=this.truncateText(t.props.text,t.props.width-a):t.props.fontSize=this._maxFontScale*o.fontSize,void 0===s&&this._buckets.bucketScale<1&&(t.props.fontSize=Math.min(this._maxFontScale,this._buckets.bucketScale)*o.fontSize),(!this._maxY||this._maxY<t.y+t.props.height)&&(this._maxY=t.y+t.props.height),(!this._maxX||this._maxX<t.x+t.props.width)&&(this._maxX=t.x+t.props.width),F(this._rangeRenderer,{...o,...t.props,text:m},t.that)}setRangeOptions(){this._rangeOptions={rangePadding:this.rangePadding(),fontFamily:this.fontFamily(),fontSize:this.fontSize(),strokeWidth:this.strokeWidth(),fill:this.fill(),stroke:this.stroke(),textFill:this.rangeFontColor(),cornerRadius:this.cornerRadius()}}_transform={k:1,x:0,y:0};zoomed(t){if(this._transform=t,this._interpolateX&&"function"==typeof this._interpolateX.invert){const e=this.width();if(e>0&&isFinite(t.k)&&0!==t.k){const i=(0-t.x)/t.k,o=(e-t.x)/t.k;let s=this._interpolateX.invert(i),n=this._interpolateX.invert(o);if(isFinite(s)&&isFinite(n)){if(s>n){const t=s;s=n,n=t}this._prevZoomState={visibleStart:s,visibleEnd:n}}}}if("scale-all"===this.renderMode())this._zoomScale=t.k,this._zoomTranslate=[t.x,0],this._zoomG.attr("transform",`translate(${t.x} 0)scale(${t.k} 1)`);else{const t=this._rangeOptions;this.data().forEach((e,i)=>{if(this._color_idx>-1&&(t.fill=e[this._color_idx]),this._series_idx>-1){const o=e[this._series_idx];this.renderRangeElement(e,i,!0,t,o)}else this.renderRangeElement(e,i,!0,t)})}this.zoomedHook(t)}zoomedHook(t){}calcBuckets(t,e,i,o){const s={},n={},r=this.overlapTolerence(),a=[{end:-1/0}];let l=0;void 0!==o?(t.forEach((t,e)=>{s[e]=t[o],n[t[o]]=!0}),l=Object.keys(n).length):t.forEach((t,o)=>{for(let n=0;n<a.length;++n)if(0===o||a[n][i]+r<=t[e]){s[o]=n,l<n&&(l=n),a[n][i]=t[i];break}if(void 0===s[o]){s[o]=a.length;const e={};e[i]=t[i],a.push(e)}l<s[o]&&(l=s[o])});const h=(l+1)*(this.bucketHeight()+this.gutter());return{bucketMap:s,maxBucket:l,bucketScale:this.height()/h,interpolateY:b().domain([0,l+1]).range([0,Math.min(this.height(),h)])}}data(t){const e=super.data.apply(this,arguments);return arguments.length>0&&(this._minStart=Math.min(...this.data().map(t=>t[1]))??0,this._maxEnd=Math.max(...this.data().map(t=>t[2]))??1,this.measureDataText(!0)),e}_textWidths;_maxFontScale;_characterWidths;_prevFontFamily;_prevFontSize;measureDataText(t=!1){const e={},i={},o=this.fontFamily(),n=this.fontSize(),r=this.bucketHeight();r&&(this._maxFontScale=(r-2*this.rangePadding())/n),(t||this._prevFontFamily!==o||this._prevFontSize!==n)&&(i["."]=s.textSize(".",o,n).width,this.data().forEach(t=>{e[t[0]]||(e[t[0]]=s.textSize(t[0],o,n).width),t[0].split("").forEach(t=>{i[t]||(i[t]=s.textSize(t,o,n).width)})}),this._textWidths=e,this._characterWidths=i),this._prevFontFamily=o,this._prevFontSize=n}truncateText(t,e,i=1){if(this._textWidths[t]*i<e)return t;let o="",s=0;const n=e-3*this._characterWidths["."];for(const r of t){if(s+=this._characterWidths[r],!(s<n))break;o+=r}return n<0?"":o+"..."}resize(t){let e;return e=this.fitWidthToContent()||this.fitHeightToContent()?super.resize.call(this,{width:t.width,height:Math.max(this._maxY??0,t?.height??0)}):super.resize.apply(this,arguments),e}selectionChanged(){}highlightItem(t,e){}click(t,e,i){}dblclick(t,e,i){}mousein(t,e,i){}mouseover(t,e,i){}mouseout(t,e,i){}};e(M,"ReactGantt");let T=M;T.prototype._class+=" timeline_ReactGantt",T.prototype.publish("fitWidthToContent",!1,"boolean","If true, resize will simply reapply the bounding box width"),T.prototype.publish("fitHeightToContent",!1,"boolean","If true, resize will simply reapply the bounding box height"),T.prototype.publish("preserveZoom",!1,"boolean","If true, maintain zoom level when data is updated"),T.prototype.publish("titleColumn",null,"string","Column name to for the title"),T.prototype.publish("startDateColumn",null,"string","Column name to for the start date"),T.prototype.publish("endDateColumn",null,"string","Column name to for the end date"),T.prototype.publish("iconColumn",null,"string","Column name to for the icon"),T.prototype.publish("colorColumn",null,"string","Column name to for the color"),T.prototype.publish("seriesColumn",null,"string","Column name to for the series identifier"),T.prototype.publish("bucketColumn",null,"string","Column name to for the bucket identifier"),T.prototype.publish("renderMode","default","set","Render modes vary in features and performance",["default","scale-all"]),T.prototype.publish("rangePadding",3,"number","Padding within each range rectangle (pixels)"),T.prototype.publish("fill","#1f77b4","string","Background color of range rectangle"),T.prototype.publish("stroke",null,"string","Color of range rectangle border"),T.prototype.publish("strokeWidth",null,"number","Width of range rectangle border (pixels)"),T.prototype.publish("cornerRadius",3,"number","Space between range buckets (pixels)"),T.prototype.publish("fontFamily",null,"string","Font family within range rectangle",null,{optional:!0}),T.prototype.publish("fontSize",10,"number","Size of font within range rectangle (pixels)"),T.prototype.publish("rangeFontColor","#ecf0f1","html-color","rangeFontColor"),T.prototype.publish("overlapTolerence",2,"number","overlapTolerence"),T.prototype.publish("smallestRangeWidth",10,"number","Width of the shortest range (pixels)"),T.prototype.publish("bucketHeight",100,"number","Max height of range element (pixels)"),T.prototype.publish("gutter",2,"number","Space between range buckets (pixels)"),T.prototype.publish("maxZoom",16,"number","Maximum zoom"),T.prototype.publish("evenSeriesBackground","#FFFFFF","html-color","Background color of even series rows"),T.prototype.publish("oddSeriesBackground","#DDDDDD","html-color","Background color of odd series rows");const D=class _ReactAxisGantt extends n{_topAxis=new o("center").orientation("top").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");_gantt=new T("center").stroke("#000000");_bottomAxis=new o("center").orientation("bottom").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");_topAxisElement;_contentElement;_bottomAxisElement;_topRect;_contentRect;_bottomRect;rangeRenderer;constructor(){super(),this._drawStartPos="origin",this.rangeRenderer=function(){const t=this._gantt.rangeRenderer.apply(this._gantt,arguments);return arguments.length?this:t}}selection(t){return arguments.length?(this._gantt.selection(t),this):this._gantt.selection()}resizeWrappers(){const t=this.width(),e=this.height(),i=this.axisHeight(),o=e-2*i,s=this.strokeWidth();this._topRect.attr("height",i).attr("width",t).attr("fill","transparent"),this._topAxisElement.attr("transform","translate(0 0)"),this._topAxis.resize({height:i,width:t}),this._contentRect.attr("height",o).attr("width",t).attr("fill","transparent"),this._contentElement.attr("transform",`translate(0 ${i+s})`),this._gantt.resize({height:o,width:t}),this._bottomRect.attr("height",i).attr("width",t).attr("fill","transparent"),this._bottomAxisElement.attr("transform",`translate(0 ${i+o+s})`),this._bottomAxis.resize({height:i,width:t})}enter(t,e){super.enter(t,e),this._gantt.click=(t,e,i)=>{this.click(t,e,i)},this._gantt.dblclick=(t,e,i)=>{this.dblclick(t,e,i)},this._topAxisElement=e.append("g").attr("class","top-axis-wrapper"),this._topRect=this._topAxisElement.append("rect").attr("class","top-axis-rect"),this._contentElement=e.append("g").attr("class","content-wrapper"),this._contentRect=this._contentElement.append("rect").attr("class","content-rect"),this._bottomAxisElement=e.append("g").attr("class","bottom-axis-wrapper"),this._bottomRect=this._bottomAxisElement.append("rect").attr("class","top-axis-rect"),this._topAxis.target(this._topAxisElement.node()),this._gantt.target(this._contentElement.node()).bucketHeight(30),this._bottomAxis.target(this._bottomAxisElement.node()),this.resizeWrappers(),this._gantt.zoomedHook=t=>{this.onzoom(t)}}onzoom(t){const e=this.width(),i=this._gantt._minStart,o=this._gantt._maxEnd-i,s=o/e,n=Math.floor(i-s*(t.x/t.k)),r=Math.ceil(o/t.k+n);this._topAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(n).high(r).render(),this._bottomAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(n).high(r).render()}update(t,e){super.update(t,e),this._topAxis.tickFormat(this.tickFormat()).render(),this._bottomAxis.tickFormat(this.tickFormat()).render(),this._gantt.render()}exit(t,e){this._bottomAxis.target(null),this._gantt.target(null),this._topAxis.target(null),super.exit(t,e)}columns(t){const e=super.columns.apply(this,arguments);return arguments.length>0&&this._gantt.columns(t),e}data(t){const e=super.data.apply(this,arguments);if(arguments.length>0){const t=this.data().map(t=>{const e=[...t];return e[1]=isNaN(t[1])?new Date(t[1]).getTime():Number(t[1]),e[2]=isNaN(t[2])?new Date(t[2]).getTime():Number(t[2]),e});this._gantt._minStart=Math.min(...t.map(t=>t[1]))??0,this._gantt._maxEnd=Math.max(...t.map(t=>t[2]))??1,this._gantt.data(t)}return e}resize(t){const e=super.resize.apply(this,arguments);return this._topAxisElement&&this.resizeWrappers(),e}click(t,e,i){}dblclick(t,e,i){}tooltip(){return this._gantt._tooltip}};e(D,"ReactAxisGantt");let E=D;E.prototype._class+=" timeline_ReactAxisGantt",E.prototype.publish("tickFormat",null,"string","Format rule applied to axis tick labels",void 0,{optional:!0}),E.prototype.publish("axisHeight",22,"number","Height of axes (pixels)"),E.prototype.publish("overlapTolerence",2,"number","overlapTolerence"),E.prototype.publish("smallestRangeWidth",10,"number","Width of the shortest range (pixels)"),E.prototype.publish("axisFontSize",null,"number","Font size of axis tick labels"),E.prototype.publish("axisFontFamily",null,"string","Font family of axis tick labels"),E.prototype.publish("axisTickLength",null,"number","Length of axis ticks"),E.prototype.publishProxy("gutter","_gantt"),E.prototype.publishProxy("renderMode","_gantt"),E.prototype.publishProxy("strokeWidth","_gantt"),E.prototype.publishProxy("fontSize","_gantt"),E.prototype.publishProxy("fontFamily","_gantt"),E.prototype.publishProxy("stroke","_gantt"),E.prototype.publishProxy("cornerRadius","_gantt"),E.prototype.publishProxy("titleColumn","_gantt"),E.prototype.publishProxy("startDateColumn","_gantt"),E.prototype.publishProxy("endDateColumn","_gantt"),E.prototype.publishProxy("iconColumn","_gantt"),E.prototype.publishProxy("colorColumn","_gantt"),E.prototype.publishProxy("bucketColumn","_gantt"),E.prototype.publishProxy("maxZoom","_gantt"),E.prototype.publishProxy("bucketHeight","_gantt");const H=class _ReactAxisGanttSeries extends v{_topAxis=new o("origin").orientation("top").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");_gantt=new T("origin").stroke("#000000").fitHeightToContent(!0);_bottomAxis=new o("origin").orientation("bottom").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");_topAxisElement;_contentElement;_bottomAxisElement;_topRect;_contentRect;_bottomRect;constructor(){super(),this.centerOverflowX_default("hidden"),this.centerOverflowY_default("auto")}selection(t){return arguments.length?(this._gantt.selection(t),this):this._gantt.selection()}rangeRenderer(t){const e=this._gantt.rangeRenderer.apply(this._gantt,arguments);return arguments.length?this:e}resizeWrappers(){const t=this.width(),e=this.height(),i=this.axisHeight(),o=e-2*i;this.bottomHeight(i),this._topWA.resize({width:t,height:i}),this._centerWA.resize({width:t,height:o}),this._bottomWA.resize({width:t,height:i}),this.top().render(),this.bottom().render(),this.center().render()}enter(t,e){super.enter(t,e),this._gantt.click=(t,e,i)=>{this.click(t,e,i)},this._gantt.dblclick=(t,e,i)=>{this.dblclick(t,e,i)},this.top(this._topAxis),this.center(this._gantt),this.bottom(this._bottomAxis),this.resizeWrappers(),this._gantt.zoomedHook=t=>{this.onzoom(t)}}onzoom(t){const e=this.width(),i=this._gantt._minStart,o=this._gantt._maxEnd-i,s=o/e,n=Math.floor(i-s*(t.x/t.k)),r=Math.ceil(o/t.k+n);this._topAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(n).high(r).lazyRender(),this._bottomAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(n).high(r).lazyRender()}update(t,e){super.update(t,e),this._topAxis.tickFormat(this.tickFormat()).render(),this._bottomAxis.tickFormat(this.tickFormat()).render(),this._gantt.render()}columns(t){const e=super.columns.apply(this,arguments);return arguments.length>0&&this._gantt.columns(t),e}data(t){const e=super.data.apply(this,arguments);if(arguments.length>0){const t=this.data().map(t=>{const e=[...t];return e[1]=isNaN(t[1])?new Date(t[1]).getTime():Number(t[1]),e[2]=isNaN(t[2])?new Date(t[2]).getTime():Number(t[2]),e});this._gantt._minStart=y(t,t=>t[1]),this._gantt._maxEnd=f(t,t=>t[2]),this._gantt.data(t)}return e}resize(t){const e=super.resize.apply(this,arguments);return this._topAxisElement&&this.resizeWrappers(),e}click(t,e,i){}dblclick(t,e,i){}tooltip(){return this._gantt._tooltip}};e(H,"ReactAxisGanttSeries");let R=H;R.prototype._class+=" timeline_ReactAxisGanttSeries",R.prototype.publish("tickFormat",null,"string","Format rule applied to axis tick labels",void 0,{optional:!0}),R.prototype.publish("axisHeight",22,"number","Height of axes (pixels)"),R.prototype.publish("overlapTolerence",2,"number","overlapTolerence"),R.prototype.publish("smallestRangeWidth",10,"number","Width of the shortest range (pixels)"),R.prototype.publish("axisFontSize",null,"number","Font size of axis tick labels"),R.prototype.publish("axisFontFamily",null,"string","Font family of axis tick labels"),R.prototype.publish("axisTickLength",null,"number","Length of axis ticks"),R.prototype.publishProxy("gutter","_gantt"),R.prototype.publishProxy("renderMode","_gantt"),R.prototype.publishProxy("strokeWidth","_gantt"),R.prototype.publishProxy("fontSize","_gantt"),R.prototype.publishProxy("fontFamily","_gantt"),R.prototype.publishProxy("stroke","_gantt"),R.prototype.publishProxy("cornerRadius","_gantt"),R.prototype.publishProxy("titleColumn","_gantt"),R.prototype.publishProxy("startDateColumn","_gantt"),R.prototype.publishProxy("endDateColumn","_gantt"),R.prototype.publishProxy("iconColumn","_gantt"),R.prototype.publishProxy("colorColumn","_gantt"),R.prototype.publishProxy("seriesColumn","_gantt"),R.prototype.publishProxy("bucketColumn","_gantt"),R.prototype.publishProxy("maxZoom","_gantt"),R.prototype.publishProxy("preserveZoom","_gantt"),R.prototype.publishProxy("evenSeriesBackground","_gantt"),R.prototype.publishProxy("oddSeriesBackground","_gantt"),R.prototype.publishProxy("bucketHeight","_gantt");const O=class _ReactTimeline extends E{_axisLabelFormatter;constructor(){super(),this._drawStartPos="origin",this._topAxis.type("time"),this._bottomAxis.type("time"),this.tooltipHTML(t=>{const e=h("%Q"),i=e(t[1]),o=e(t[2]),s=p(this.tooltipTimeFormat());return`<div style="text-align:center;">${t[0]}<br/><br/>${s(i)} -&gt; ${s(o)}</div>`})}update(t,e){if(super.update(t,e),this.timePattern_exists()){let t=1/0,e=-1/0,i="",o="";this.data().map(s=>{const n=new Date(s[1]).getTime(),r=new Date(s[2]).getTime();t>n&&(t=n,i=""+s[1]),e<r&&(e=r,o=""+s[2])});const s=this._axisLabelFormatter?this._axisLabelFormatter:this.tickFormat_exists&&this.tickFormat_exists()?this.tickFormat():void 0;this._topAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(i).high(o),this._bottomAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(i).high(o),s?(this._topAxis.tickFormat(s),this._bottomAxis.tickFormat(s)):(this._topAxis.tickFormat_reset(),this._bottomAxis.tickFormat_reset()),this._gantt._minStart=t,this._gantt._maxEnd=e}}tooltipHTML(t){return this._tooltipHTML=t,this.tooltip().tooltipHTML(this._tooltipHTML),this}parseAxisValue(t){const e=h("%Q")(t);return p(this.timePattern())(e)}onzoom(t){const e=this.width(),i=this._gantt._minStart,o=this._gantt._maxEnd-i,s=o/e,n=Math.floor(i-s*(t.x/t.k)),r=Math.ceil(o/t.k+n);this._topAxis.low(this.parseAxisValue(n)).high(this.parseAxisValue(r)).render(),this._bottomAxis.low(this.parseAxisValue(n)).high(this.parseAxisValue(r)).render()}};e(O,"ReactTimeline");let B=O;B.prototype._class+=" timeline_ReactTimeline",B.prototype.publish("timePattern","%Y-%m-%d","string","Time pattern used for parsing datetime strings on each data row",null,{optional:!0}),B.prototype.publish("tooltipTimeFormat","%Y-%m-%d","string","Time format used in the default html tooltip");const W=h("%Q"),L=class _ReactTimelineSeries extends R{_axisLabelFormatter;constructor(){super(),this._topAxis.type("time"),this._bottomAxis.type("time"),this.tooltipHTML(t=>{const e=W(t[1]),i=W(t[2]),o=p(this.tooltipTimeFormat());return`<div style="text-align:center;">${t[0]}<br/><br/>${o(e)} -&gt; ${o(i)}</div>`})}update(t,e){if(super.update(t,e),this.timePattern_exists()){let t=1/0,e=-1/0,i="",o="";this.data().forEach(s=>{const n=new Date(s[1]).getTime(),r=new Date(s[2]).getTime();t>n&&(t=n,i=""+s[1]),e<r&&(e=r,o=""+s[2])});const s=this._axisLabelFormatter?this._axisLabelFormatter:this.tickFormat_exists&&this.tickFormat_exists()?this.tickFormat():void 0;this._topAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(i).high(o),this._bottomAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(i).high(o),s?(this._topAxis.tickFormat(s),this._bottomAxis.tickFormat(s)):(this._topAxis.tickFormat_reset(),this._bottomAxis.tickFormat_reset()),this._gantt._minStart=t,this._gantt._maxEnd=e}}tickFormatFunc(t){return arguments.length?(this._axisLabelFormatter=t,this._topAxis.tickFormatFunc(t),this._bottomAxis.tickFormatFunc(t),this):this._axisLabelFormatter}tooltipHTML(t){return this._tooltipHTML=t,this.tooltip().tooltipHTML(this._tooltipHTML),this}parseAxisValue(t){const e=W(t);return p(this.timePattern())(e)}onzoom(t){const e=this.width(),i=this._gantt._minStart,o=this._gantt._maxEnd-i,s=o/e,n=Math.floor(i-s*(t.x/t.k)),r=Math.ceil(o/t.k+n);this._topAxis.low(this.parseAxisValue(n)).high(this.parseAxisValue(r)).render(),this._bottomAxis.low(this.parseAxisValue(n)).high(this.parseAxisValue(r)).render()}_tooltipHTML};e(L,"ReactTimelineSeries");let $=L;$.prototype._class+=" timeline_ReactTimelineSeries",$.prototype.publish("timePattern","%Y-%m-%d","string","Time pattern used for parsing datetime strings on each data row",null,{optional:!0}),$.prototype.publish("tooltipTimeFormat","%Y-%m-%d","string","Time format used in the default html tooltip");export{S as BUILD_VERSION,P as MiniGantt,w as PKG_NAME,A as PKG_VERSION,E as ReactAxisGantt,R as ReactAxisGanttSeries,T as ReactGantt,B as ReactTimeline,$ as ReactTimelineSeries};
1
+ import { ITooltip as e } from "@hpcc-js/api";
2
+ import { Axis as t } from "@hpcc-js/chart";
3
+ import { EntityPin as n, EntityRect as r, SVGWidget as i, SVGZoomWidget as a, Utility as o, d3Event as s, extent as c, local as l, max as u, min as d, scaleBand as f, scaleLinear as p, select as m, timeFormat as h, timeParse as g, zoom as _, zoomIdentity as v } from "@hpcc-js/common";
4
+ import { HTMLTooltip as y } from "@hpcc-js/html";
5
+ import { LabelledRect as b, render as x } from "@hpcc-js/react";
6
+ import { Border2 as S } from "@hpcc-js/layout";
7
+ //#region \0rolldown/runtime.js
8
+ var C = "@hpcc-js/timeline", w = "3.4.9", T = "3.25.1", MiniGantt = class extends i {
9
+ tlAxis;
10
+ brAxis;
11
+ verticalBands;
12
+ _zoom;
13
+ gUpperContent;
14
+ gUpperAxis;
15
+ gMiddleContent;
16
+ gLowerAxis;
17
+ gLowerContent;
18
+ localRect = l();
19
+ localEntityPin = l();
20
+ tooltipFormatter;
21
+ _dateCache;
22
+ rootExtent;
23
+ _title_idx = 0;
24
+ _startDate_idx = 1;
25
+ _endDate_idx = 2;
26
+ _icon_idx = -1;
27
+ _color_idx = -1;
28
+ _yoffset_idx = -1;
29
+ constructor() {
30
+ super(), e.call(this), o.SimpleSelectionMixin.call(this), this._drawStartPos = "origin", this.tooltipHTML((e) => `<center>${e[this._title_idx]}</center><br>${this.tooltipFormatter(this.brAxis.parse(e[this._startDate_idx]))} -> ${this.tooltipFormatter(this.brAxis.parse(e[this._endDate_idx]))}`), this.tlAxis = new t().type("time"), this.brAxis = new t().type("time"), this.verticalBands = f().paddingOuter(.2).paddingInner(.2);
31
+ }
32
+ isHorizontal() {
33
+ return this.orientation() === "horizontal";
34
+ }
35
+ fullExtent() {
36
+ return c([...this.data().map((e) => e[this._startDate_idx]), ...this.data().filter((e) => !!e[this._endDate_idx]).map((e) => e[this._endDate_idx])]);
37
+ }
38
+ extent() {
39
+ let e = this.rootExtent ? [this.rootExtent[1], this.rootExtent[2]] : this.fullExtent();
40
+ if (e[0] !== void 0 && e[1] !== void 0 && (e[0] === e[1] || this.centerOnMostRecent())) {
41
+ let t = g(this.timePattern()), n = h(this.timePattern()), r = t(e[0]), i = t(e[1]);
42
+ if (e[0] === e[1]) e[0] = n(new Date(r.setFullYear(r.getFullYear() - 1))), e[1] = n(new Date(r.setFullYear(r.getFullYear() + 2)));
43
+ else {
44
+ let t = r.getTime(), a = i.getTime() - t;
45
+ e[0] = n(r), e[1] = n(new Date(t + a * 2));
46
+ }
47
+ }
48
+ return e;
49
+ }
50
+ dataStartPos(e) {
51
+ if (this._dateCache[e[this._startDate_idx]] !== void 0) return this._dateCache[e[this._startDate_idx]];
52
+ let t = this.brAxis.scalePos(e[this._startDate_idx]);
53
+ return this._dateCache[e[this._startDate_idx]] = t, t;
54
+ }
55
+ dataEndPos(e) {
56
+ if (this._dateCache[e[this._endDate_idx]] !== void 0) return this._dateCache[e[this._endDate_idx]];
57
+ let t = this.brAxis.scalePos(e[this._endDate_idx]);
58
+ return this._dateCache[e[this._endDate_idx]] = t, t;
59
+ }
60
+ dataWidth(e) {
61
+ return this.dataEndPos(e) - this.dataStartPos(e);
62
+ }
63
+ transform;
64
+ resetZoom() {
65
+ this._zoom.transform(this.element(), v.translate(0, this.isHorizontal() ? 0 : this.height()));
66
+ }
67
+ zoomed() {
68
+ this.transform = s().transform, this.render();
69
+ }
70
+ background;
71
+ enter(e, t) {
72
+ super.enter(e, t), this._zoom = _().scaleExtent([0, this.maxZoom()]).on("zoom", () => {
73
+ this.zoomed();
74
+ }), this.background = t.append("rect").attr("fill", "white").attr("opacity", 0).on("dblclick", () => {
75
+ s().stopPropagation(), delete this.rootExtent, this.resetZoom();
76
+ }), this.gUpperContent = t.append("g").attr("class", "gUpperContent"), this.gUpperAxis = t.append("g").attr("class", "gUpperAxis"), this.gMiddleContent = t.append("g").attr("class", "gMiddleContent"), this.gLowerAxis = t.append("g").attr("class", "gLowerAxis"), this.gLowerContent = t.append("g").attr("class", "gLowerContent"), this.tlAxis.target(this.gUpperAxis.node()).tickFormat(this.tickFormat()).guideTarget(this.gUpperAxis.append("g").node()).shrinkToFit("none").overlapMode(this.tickFormat_exists() ? "stagger" : "none").extend(.1), this.brAxis.target(this.gLowerAxis.node()).tickFormat(this.tickFormat()).guideTarget(this.gLowerAxis.append("g").node()).shrinkToFit("none").overlapMode(this.tickFormat_exists() ? "stagger" : "none").extend(.1), t.call(this._zoom), this._selection.widgetElement(this.gMiddleContent);
77
+ }
78
+ _prevIsHorizontal;
79
+ update(e, t) {
80
+ if (super.update(e, t), this._dateCache = {}, this._title_idx = this.titleColumn() === null ? this._title_idx : this.columns().indexOf(this.titleColumn()), this._startDate_idx = this.startDateColumn() === null ? this._startDate_idx : this.columns().indexOf(this.startDateColumn()), this._endDate_idx = this.endDateColumn() === null ? this._endDate_idx : this.columns().indexOf(this.endDateColumn()), this._icon_idx = this.iconColumn() === null ? this._icon_idx : this.columns().indexOf(this.iconColumn()), this._color_idx = this.colorColumn() === null ? this._color_idx : this.columns().indexOf(this.colorColumn()), this._yoffset_idx = this.yOffsetColumn() === null ? this._yoffset_idx : this.columns().indexOf(this.yOffsetColumn()), this._prevIsHorizontal !== this.isHorizontal()) {
81
+ this._prevIsHorizontal = this.isHorizontal(), this.resetZoom();
82
+ return;
83
+ }
84
+ this.tooltipFormatter = h(this.tooltipTimeFormat());
85
+ let n = this.width(), r = this.height();
86
+ this.background.attr("x", 0).attr("y", 0).attr("width", n).attr("height", r);
87
+ let i = this.extent();
88
+ if (this.tlAxis.x(n / 2).orientation(this.isHorizontal() ? "top" : "left").reverse(!this.isHorizontal()).timePattern(this.timePattern()).width(n - 1).low(i[0]).high(i[1]).updateScale(), this.brAxis.x(n / 2).y(r / 2).orientation(this.isHorizontal() ? "bottom" : "right").reverse(!this.isHorizontal()).timePattern(this.timePattern()).width(n - 1).height(r).low(i[0]).high(i[1]).updateScale(), this.transform) {
89
+ let e, t;
90
+ this.isHorizontal() ? (e = this.tlAxis.parseInvert(this.tlAxis.invert(this.transform.invertX(0))), t = this.tlAxis.parseInvert(this.tlAxis.invert(this.transform.invertX(n - 1)))) : (e = this.tlAxis.parseInvert(this.tlAxis.invert(-this.transform.invertY(0))), t = this.tlAxis.parseInvert(this.tlAxis.invert(-this.transform.invertY(r - 1)))), this.tlAxis.low(e).high(t).updateScale(), this.brAxis.low(e).high(t).updateScale();
91
+ }
92
+ let a = this.data().sort(this.isHorizontal() ? (e, t) => {
93
+ let n = this.brAxis.scalePos(e[1]) - this.brAxis.scalePos(t[1]);
94
+ return n === 0 ? ("" + e[0]).localeCompare("" + t[0]) : n;
95
+ } : (e, t) => this.brAxis.scalePos(t[1]) - this.brAxis.scalePos(e[1])), o = a.filter((e) => !e[this._endDate_idx]), s = a.filter((e) => !!e[this._endDate_idx]);
96
+ this.tlAxis.render(), this.brAxis.render();
97
+ let c = this.brAxis.getBBox(), l = this.updateEntityPins(o), u = c.height, d = r - l, f = this._yoffset_idx === -1 ? 0 : Math.min.apply(void 0, this.data().filter((e) => !isNaN(e[this._yoffset_idx])).map((e) => e[this._yoffset_idx]));
98
+ if (o.length > 0 && s.length === 0) {
99
+ this.tlAxis.visible(!1);
100
+ let e = l / 4;
101
+ e > r / 2 - u && (e = r / 2 - u);
102
+ let t = r / 2 + e, n = (r / 2 - u - e) * -1, i = f === 0 ? 0 : f / 2;
103
+ this.gUpperContent.attr("transform", `translate(0, ${t - i})`), this.gLowerAxis.attr("transform", `translate(0, ${n - i})`);
104
+ } else o.length === 0 && s.length > 0 ? (this.tlAxis.visible(!0), this.gUpperContent.attr("transform", `translate(0, ${l})`), this.gUpperAxis.attr("transform", `translate(0, ${l})`)) : (l -= f, d += f, this.tlAxis.visible(!0), this.gUpperContent.attr("transform", `translate(0, ${l})`), this.gUpperAxis.attr("transform", `translate(0, ${l})`), this.gMiddleContent.attr("transform", `translate(0, ${l})`));
105
+ this.tlAxis.render();
106
+ let p = this.tlAxis.getBBox(), m = [], g = {};
107
+ for (let e of s) {
108
+ for (let t = 0; t < m.length; ++t) {
109
+ let n = m[t];
110
+ if (n.endPos + this.overlapTolerence() <= this.dataStartPos(e)) {
111
+ g[e] = t, n.endPos = this.dataEndPos(e);
112
+ break;
113
+ }
114
+ }
115
+ g[e] === void 0 && (g[e] = m.length, m.push({ endPos: this.dataEndPos(e) }));
116
+ }
117
+ let _ = this.isHorizontal() ? 0 + p.height : 0 + p.width, v = this.isHorizontal() ? d - c.height : n - c.width;
118
+ this.verticalBands.range([_, v]).domain(m.map((e, t) => t)), s.length > 0 && this.updateEventRanges(o, s, g, d, p, c, n);
119
+ }
120
+ updateEntityPins(e) {
121
+ let t = 0, r = this, i = this.gUpperContent.selectAll(".entity_pin").data(e, (e) => e[0] + ":" + e[1]), a = this.eventFontColorColumn() ? this.columns().indexOf(this.eventFontColorColumn()) : -1, o = this.eventBorderColorColumn() ? this.columns().indexOf(this.eventBorderColorColumn()) : -1, s = this.eventBackgroundColorColumn() ? this.columns().indexOf(this.eventBackgroundColorColumn()) : -1, c = {};
122
+ for (let t of e) {
123
+ let e = t[r._title_idx] === void 0 ? t[0] : t[r._title_idx];
124
+ c[e] = c[e] ? c[e] + 1 : 1;
125
+ }
126
+ let l = Object.keys(c), u = r.eventGroupOffset(), d = i.enter().append("g").attr("class", "entity_pin");
127
+ d.append("line").attr("class", "entity_line"), d.on("mouseover", function(e) {
128
+ m(this).raise();
129
+ }).each(function(e, t) {
130
+ let i = new n().target(this).icon("").iconOnlyShowOnHover(r.hideIconWhenCollapsed()).titleOnlyShowOnHover(r.hideTitleWhenCollapsed()).descriptionOnlyShowOnHover(r.hideDescriptionWhenCollapsed()).annotationOnlyShowOnHover(r.hideAnnotationsWhenCollapsed()).iconDiameter(18).iconPaddingPercent(1).titleFontSize(14).descriptionColor("#333").descriptionFontSize(15).iconColor(a === -1 ? "#333" : e[a]).titleColor(a === -1 ? "#333" : e[a]).descriptionColor(a === -1 ? "#333" : e[a]).backgroundShape("pin").backgroundColorFill(a === -1 ? "#f8f8f8" : e[s]).backgroundColorStroke(a === -1 ? "#ccc" : e[o]).cornerRadius(5).arrowHeight(10).arrowWidth(16);
131
+ r.localEntityPin.set(this, i);
132
+ }).merge(i).each(function(e, n) {
133
+ let i = r.localEntityPin.get(this), s = e[r._title_idx] === void 0 ? i.title() : e[r._title_idx], c = r.dataStartPos(e) - 0, d = l.indexOf(s) % r.eventGroupMod() * u - 5;
134
+ if (e[r._yoffset_idx] !== void 0 && (d += e[r._yoffset_idx] ? e[r._yoffset_idx] : 0), e[r._title_idx] !== i.title() && e[r._startDate_idx] !== i.description()) {
135
+ let t = r.brAxis.parse(e[r._startDate_idx]), n = r.tooltipFormatter(t);
136
+ i.x(c).y(d).iconOnlyShowOnHover(r.hideIconWhenCollapsed()).titleOnlyShowOnHover(r.hideTitleWhenCollapsed()).descriptionOnlyShowOnHover(r.hideDescriptionWhenCollapsed()).annotationOnlyShowOnHover(r.hideAnnotationsWhenCollapsed()).icon(e[r._icon_idx] === void 0 ? i.icon() : e[r._icon_idx]).title(s).description(n).animationFrameRender();
137
+ } else i.move({
138
+ x: c,
139
+ y: d
140
+ });
141
+ let f = i.calcHeight();
142
+ t < f && (t = f), m(this).selectAll(".entity_line").attr("x1", c).attr("x2", c).attr("y1", 0).attr("y2", d).style("stroke", a === -1 ? "#ccc" : e[o]).style("stroke-width", 1);
143
+ }), i.exit().each(function(e, t) {
144
+ r.localEntityPin.get(this).target(null);
145
+ }).remove();
146
+ let f = Math.abs(Math.min(e.length, r.eventGroupMod()) * r.eventGroupOffset());
147
+ return t + f;
148
+ }
149
+ updateEventRanges(e, t, n, i, a, o, s) {
150
+ let c = this, l = this.gMiddleContent.selectAll(".line").data(e, (e) => e[c._title_idx]);
151
+ l.enter().append("line").attr("class", "line").merge(l).attr(this.isHorizontal() ? "x1" : "y1", (e) => this.dataStartPos(e) - 0).attr(this.isHorizontal() ? "x2" : "y2", (e) => this.dataStartPos(e) - 0).attr(this.isHorizontal() ? "y1" : "x1", this.isHorizontal() ? a.height : a.width).attr(this.isHorizontal() ? "y2" : "x2", this.isHorizontal() ? i - o.height : s - o.width), l.exit().remove();
152
+ let u = this.gMiddleContent.selectAll(".buckets").data(t, (e) => e[c._title_idx]);
153
+ u.enter().append("g").attr("class", "buckets").call(this._selection.enter.bind(this._selection)).each(function(e) {
154
+ let t = new r().target(this).iconDiameter(28).iconPaddingPercent(0).titleFontSize(28).titleColor(c.rangeFontColor()).descriptionColor(c.rangeFontColor()).iconColor(c.rangeFontColor()).backgroundShape("rect").backgroundColorFill(e[c._color_idx]);
155
+ c.localRect.set(this, t), c.enterEntityRect(t, e);
156
+ }).on("click", function(e) {
157
+ c.click(c.rowToObj(e), "range", c._selection.selected(this));
158
+ }, !1).on("dblclick", function(e) {
159
+ c.rootExtent = e, c.resetZoom(), c.dblclick(c.rowToObj(e), "range", c._selection.selected(this));
160
+ }, !0).on("mouseout.tooltip", this.tooltip.hide).on("mousemove.tooltip", this.tooltip.show).merge(u).attr("transform", (e) => c.isHorizontal() ? `translate(${this.dataStartPos(e)}, ${this.verticalBands(n[e])}) ` : `translate(${this.verticalBands(n[e])}, ${this.dataStartPos(e)}) `).each(function(e) {
161
+ let t = c.localRect.get(this), n = c.dataWidth(e) / 2, r = c.verticalBands.bandwidth() / 2, i = Math.max(c.dataWidth(e), 2), a = Math.max(c.verticalBands.bandwidth(), 2), o = .618, s = (1 - o) / 2 * a, l = a * o, u = l;
162
+ t.pos(c.isHorizontal() ? {
163
+ x: n,
164
+ y: r
165
+ } : {
166
+ x: r,
167
+ y: n
168
+ }).fixedHeight(c.isHorizontal() ? a : i).fixedWidth(c.isHorizontal() ? i : a).icon(e[c._icon_idx] === void 0 ? "" : e[c._icon_idx]).title(e[c._title_idx] === void 0 ? "" : e[c._title_idx]).padding(s).iconDiameter(u).titleFontSize(l), u * 1.5 > i && t.icon(null), c.updateEntityRect(t, e[c._icon_idx]), t.render();
169
+ }), u.exit().remove();
170
+ }
171
+ exit(e, t) {
172
+ this.brAxis.target(null), this.tlAxis.target(null), super.exit(e, t);
173
+ }
174
+ click(e, t, n) {}
175
+ dblclick(e, t, n) {}
176
+ enterEntityRect(e, t) {}
177
+ updateEntityRect(e, t) {}
178
+ };
179
+ MiniGantt.prototype._class += " timeline_MiniGantt", MiniGantt.prototype.implements(e.prototype), MiniGantt.prototype.mixin(o.SimpleSelectionMixin), MiniGantt.prototype.publish("timePattern", "%Y-%m-%d", "string", "timePattern"), MiniGantt.prototype.publish("tickFormat", null, "string", "tickFormat", void 0, { optional: !0 }), MiniGantt.prototype.publish("tooltipTimeFormat", "%Y-%m-%d", "string", "tooltipTimeFormat"), MiniGantt.prototype.publish("overlapTolerence", 2, "number", "overlapTolerence"), MiniGantt.prototype.publish("orientation", "horizontal", "set", "orientation", ["horizontal", "vertical"]), MiniGantt.prototype.publish("rangeFontColor", "#ecf0f1", "html-color", "rangeFontColor"), MiniGantt.prototype.publish("titleColumn", null, "string", "titleColumn"), MiniGantt.prototype.publish("startDateColumn", null, "string", "startDateColumn"), MiniGantt.prototype.publish("endDateColumn", null, "string", "endDateColumn"), MiniGantt.prototype.publish("iconColumn", null, "string", "iconColumn"), MiniGantt.prototype.publish("colorColumn", null, "string", "colorColumn"), MiniGantt.prototype.publish("yOffsetColumn", null, "string", "yOffsetColumn"), MiniGantt.prototype.publish("maxZoom", 16, "number", "maxZoom"), MiniGantt.prototype.publish("eventGroupOffset", -50, "number", "eventGroupOffset"), MiniGantt.prototype.publish("eventGroupMod", 5, "number", "eventGroupMod"), MiniGantt.prototype.publish("eventFontColorColumn", null, "string", "eventFontColorColumn"), MiniGantt.prototype.publish("eventBorderColorColumn", null, "string", "eventBorderColorColumn"), MiniGantt.prototype.publish("eventBackgroundColorColumn", null, "string", "eventBackgroundColorColumn"), MiniGantt.prototype.publish("hideIconWhenCollapsed", !1, "boolean", "hideIconWhenCollapsed"), MiniGantt.prototype.publish("hideTitleWhenCollapsed", !1, "boolean", "hideTitleWhenCollapsed"), MiniGantt.prototype.publish("hideDescriptionWhenCollapsed", !1, "boolean", "hideDescriptionWhenCollapsed"), MiniGantt.prototype.publish("hideAnnotationsWhenCollapsed", !0, "boolean", "hideAnnotationsWhenCollapsed"), MiniGantt.prototype.publish("centerOnMostRecent", !1, "boolean", "If true, the timeline will be centered on the most recent data point");
180
+ //#endregion
181
+ //#region src/ReactGantt.ts
182
+ var ReactGantt = class extends a {
183
+ _selection = new o.Selection(this);
184
+ _buckets;
185
+ _interpolateX;
186
+ _interpolateY;
187
+ _bucketsBySeries;
188
+ _dataBySeries;
189
+ _origIdxMap;
190
+ _seriesBackgrounds;
191
+ _maxFontSize;
192
+ _tooltip;
193
+ _minStart;
194
+ _maxEnd;
195
+ _prevZoomState = null;
196
+ _title_idx = 0;
197
+ _startDate_idx = 1;
198
+ _endDate_idx = 2;
199
+ _icon_idx = -1;
200
+ _color_idx = -1;
201
+ _series_idx = -1;
202
+ _bucket_idx = -1;
203
+ _yoffset_idx = -1;
204
+ _maxX;
205
+ _maxY;
206
+ _rangeOptions = {
207
+ rangePadding: 2,
208
+ fontFamily: "Verdana",
209
+ fontSize: 12,
210
+ fill: "white",
211
+ stroke: "black",
212
+ textFill: "black",
213
+ cornerRadius: 3,
214
+ strokeWidth: 0
215
+ };
216
+ constructor(e = "origin") {
217
+ super(), this._drawStartPos = e, this.showToolbar_default(!1), this._tooltip = new y(), this._tooltip.tooltipHTML((e) => `<div style="text-align:center;">${e[0]}<br/><br/>${e[1]} -&gt; ${e[2]}</div>`), this._tooltip.followCursor(!0);
218
+ }
219
+ selection(e) {
220
+ return arguments.length ? (this._selection.set(e), this) : this._selection.get();
221
+ }
222
+ _rangeRenderer = b;
223
+ rangeRenderer(e) {
224
+ return arguments.length && (this._rangeRenderer = e), this._rangeRenderer;
225
+ }
226
+ enter(e, t) {
227
+ super.enter(e, t);
228
+ let n = this;
229
+ t.on("click", function(e) {
230
+ n._selection.clear();
231
+ }), this._tooltip.target(e);
232
+ }
233
+ update(e, t) {
234
+ super.update(e, t), this.zoomExtent([.05, this.maxZoom()]), this._title_idx = this.titleColumn() === null ? this._title_idx : this.columns().indexOf(this.titleColumn()), this._startDate_idx = this.startDateColumn() === null ? this._startDate_idx : this.columns().indexOf(this.startDateColumn()), this._endDate_idx = this.endDateColumn() === null ? this._endDate_idx : this.columns().indexOf(this.endDateColumn()), this._icon_idx = this.iconColumn() === null ? this._icon_idx : this.columns().indexOf(this.iconColumn()), this._color_idx = this.colorColumn() === null ? this._color_idx : this.columns().indexOf(this.colorColumn()), this._series_idx = this.seriesColumn() === null ? this._series_idx : this.columns().indexOf(this.seriesColumn()), this._bucket_idx = this.bucketColumn() === null ? -1 : this.columns().indexOf(this.bucketColumn());
235
+ let n = this, r = this.width(), i = r;
236
+ if (this._interpolateX = p().domain([this._minStart, this._maxEnd]).range([0, i]), this.data().sort((e, t) => e[1] - t[1]), this._series_idx > -1) {
237
+ this._origIdxMap = {}, this._dataBySeries = {}, this._bucketsBySeries = {}, this.data().forEach((e, t) => {
238
+ let n = e[this._series_idx];
239
+ this._dataBySeries[n] || (this._origIdxMap[n] = {}, this._dataBySeries[n] = []), this._dataBySeries[n].push({
240
+ dataRow: e,
241
+ origIdx: t
242
+ });
243
+ });
244
+ let e = this.gutter(), t = 0, i = Object.keys(this._dataBySeries);
245
+ i.forEach((e) => {
246
+ this._dataBySeries[e].sort((e, t) => e.dataRow[1] - t.dataRow[1]), this._bucketsBySeries[e] = this.calcBuckets(this._dataBySeries[e].map((e) => e.dataRow), 1, 2), this._bucketsBySeries[e].bucketHeight = this.bucketHeight(), this._bucketsBySeries[e].bucketOffset = t, t += (this._bucketsBySeries[e].bucketHeight + this.strokeWidth() + this.gutter()) * (this._bucketsBySeries[e].maxBucket + 1), this._dataBySeries[e].forEach((t, n) => {
247
+ this._origIdxMap[e][t.origIdx] = n;
248
+ });
249
+ }), this._seriesBackgrounds = this._renderElement.selectAll(".series-background").data(i.map((e) => this._bucketsBySeries[e])), this._seriesBackgrounds.join((e) => e.append("rect").attr("class", "series-background"), (e) => e, (e) => e.each(function(e) {
250
+ delete e.element;
251
+ }).remove()).attr("opacity", (e) => e.props && e.props.hidden ? 0 : 1).each(function(t, i) {
252
+ m(this).attr("x", 0).attr("y", t.bucketOffset - e / 2).attr("width", r).attr("height", (t.bucketHeight + e) * (t.maxBucket + 1) + e).attr("fill", i % 2 ? n.oddSeriesBackground() : n.evenSeriesBackground());
253
+ });
254
+ } else this._bucket_idx === -1 ? this._buckets = this.calcBuckets(this.data(), this._startDate_idx, this._endDate_idx) : this._buckets = this.calcBuckets(this.data(), this._startDate_idx, this._endDate_idx, this._bucket_idx);
255
+ if (!this.preserveZoom() || !this._prevZoomState) {
256
+ let e = this._interpolateX(this._minStart);
257
+ this.zoomTo([e, 0], 1);
258
+ }
259
+ let a = this.bucketHeight();
260
+ this.setRangeOptions(), this._maxFontScale = a - this.rangePadding() * 2, this.measureDataText();
261
+ let o = this._renderElement.selectAll(".item").data(this.data()), c = this.strokeWidth(), l = c * 2;
262
+ if (o.join((e) => e.append("g").attr("class", "item").on("click.selectionBag", function(e, t) {
263
+ let r = e.id === void 0 ? t : e.id;
264
+ n._selection.isSelected({
265
+ _id: r,
266
+ element: e.element
267
+ }) ? n._selection.clear() : n._selection.click({
268
+ _id: r,
269
+ element: () => e.element
270
+ }, s), n.selectionChanged(), s().stopPropagation();
271
+ }).on("click", function(e) {
272
+ let t = e.element.classed("selected");
273
+ e[n.columns().length] && (e.__lparam = e[n.columns().length]), n.click(e, "", t);
274
+ }).on("dblclick", function(e) {
275
+ let t = e.element.classed("selected");
276
+ e[n.columns().length] && (e.__lparam = e[n.columns().length]), n.click(e, "", t);
277
+ }).on("mousein", function(e) {
278
+ n.highlightItem(m(this), e);
279
+ let t = e.element.classed("selected");
280
+ n.mousein(e, "", t);
281
+ }).on("mouseover", function(e) {
282
+ let t = s();
283
+ n._tooltip._triggerElement = e.element, n._tooltip._cursorLoc = [t.clientX, t.clientY], n._tooltip.data(e).visible(!0).fitContent(!0).render(), n.highlightItem(m(this), e);
284
+ let r = e.element.classed("selected");
285
+ n.mouseover(e, "", r);
286
+ }).on("mouseout", function(e) {
287
+ n._tooltip.visible(!1).render(), n.highlightItem(null, null);
288
+ let t = e.element.classed("selected");
289
+ n.mouseout(e, "", t);
290
+ }).each(function(e, t) {
291
+ e.that = this, e.element = m(this), e.x = n._interpolateX(e[1]);
292
+ let r = n._interpolateX(e[2]);
293
+ if (n._series_idx > -1) {
294
+ let r = e[n._series_idx], i = n._bucketsBySeries[r].bucketMap[n._origIdxMap[r][t]];
295
+ e.y = n._bucketsBySeries[r].interpolateY(i) + n._bucketsBySeries[r].bucketOffset;
296
+ } else {
297
+ let r = n._bucket_idx === -1 ? t : e[n._bucket_idx];
298
+ e.y = n._buckets.interpolateY(n._buckets.bucketMap[r]);
299
+ }
300
+ e.props = {
301
+ ...e[3],
302
+ text: e[0]
303
+ }, e.props.width = r - e.x, e.props.height = a, e.x += c, e.y += c, e.props.width -= l, e.props.height -= l, e.element.attr("transform", `translate(${e.x + e.props.width / 2} ${e.y + e.props.height / 2})`);
304
+ }), (e) => e, (e) => e.each(function(e) {
305
+ delete e.element;
306
+ }).remove()).attr("opacity", (e) => e.props && e.props.hidden ? 0 : 1).each(function(e, t) {
307
+ if (e.that = this, n._series_idx > -1) {
308
+ let r = e[n._series_idx];
309
+ e.x = n.renderRangeElement(e, t, !1, n._rangeOptions, r);
310
+ } else e.x = n.renderRangeElement(e, t, !1, n._rangeOptions);
311
+ }).on("dblclick.zoom", (e) => {
312
+ let t = this._interpolateX(e[1]), n = r / (this._interpolateX(e[2]) - t);
313
+ this.zoomTo([-t * n, 0], n);
314
+ }), t.on("dblclick.zoom", null), this.preserveZoom() && this._prevZoomState && this._interpolateX) {
315
+ let e = this.width();
316
+ if (e > 0) {
317
+ let t = this._minStart, n = this._maxEnd, r = Math.max(t, Math.min(n, this._prevZoomState.visibleStart)), i = Math.max(t, Math.min(n, this._prevZoomState.visibleEnd));
318
+ if (i <= r) {
319
+ let e = (n - t) * 1e-6 || 1e-6;
320
+ i = Math.min(n, r + e);
321
+ }
322
+ let a = this._interpolateX(r), o = this._interpolateX(i), s = o - a;
323
+ if (isFinite(s) && Math.abs(s) > 1e-9) {
324
+ let r = e / s, i = this.maxZoom(), c = Math.max(.05, Math.min(i, r));
325
+ if (c > 0 && isFinite(c)) {
326
+ let r = (a + o) / 2, i = e / (2 * c), s = this._interpolateX(t), l = this._interpolateX(n), u = r;
327
+ u - i < s && (u = s + i), u + i > l && (u = l - i);
328
+ let d = e / 2 - c * u;
329
+ isFinite(d) && this.zoomTo([d, 0], c);
330
+ }
331
+ }
332
+ }
333
+ }
334
+ }
335
+ exit(e, t) {
336
+ this._tooltip.target(null), super.exit(e, t);
337
+ }
338
+ renderRangeElement(e, t, n = !1, r = {}, i) {
339
+ let a = r.strokeWidth, o = a * 2, s = r.rangePadding, c, l = isNaN(this._transform.x) ? 0 : this._transform.x, u = isNaN(this._transform.k) ? 1 : this._transform.k, d, f = this.bucketHeight();
340
+ e.that.setAttribute("data-series", i), this._color_idx > -1 && e.that.setAttribute("data-color", e[this._color_idx]), i === void 0 ? (d = this._buckets.bucketMap[t], e.y = this._buckets.interpolateY(d)) : (d = this._bucketsBySeries[i].bucketMap[this._origIdxMap[i][t]], e.that.setAttribute("data-b", d), e.that.setAttribute("data-bucketOffset", this._bucketsBySeries[i].bucketOffset), e.y = this._bucketsBySeries[i].interpolateY(d) + this._bucketsBySeries[i].bucketOffset, e.that.setAttribute("data-dy", e.y)), this._color_idx > -1 && (r.fill = e[this._color_idx]), n ? (e.x = this._interpolateX(e[1]) * u, c = this._interpolateX(e[2]) * u, e.props = {
341
+ ...e[3],
342
+ text: e[0]
343
+ }, e.props.width = (c - e.x) / u, e.x += l, e.props.width *= u) : (e.x = this._interpolateX(e[1]), c = this._interpolateX(e[2]), e.props = {
344
+ ...e[3],
345
+ text: e[0]
346
+ }, e.props.width = (c - e.x) / u), e.props.height = f, i === void 0 && this._buckets.bucketScale < 1 && (e.props.height = this._buckets.bucketScale * f), e.element === void 0 && e.that && (e.element = m(e.that)), e.element.attr("transform", `translate(${e.x + e.props.width / 2} ${e.y + e.props.height / 2})`), e.x += a, e.y += a, e.props.width -= o, e.props.height -= o, e.props.width = e.props.width < 1 ? 1 : e.props.width, e.props.height = e.props.height < 1 ? 1 : e.props.height;
347
+ let p = this.truncateText(e.props.text, e.props.width - s, this._maxFontScale);
348
+ p === e.props.text ? e.props.fontSize = this._maxFontScale * r.fontSize : p = this.truncateText(e.props.text, e.props.width - s), i === void 0 && this._buckets.bucketScale < 1 && (e.props.fontSize = Math.min(this._maxFontScale, this._buckets.bucketScale) * r.fontSize), (!this._maxY || this._maxY < e.y + e.props.height) && (this._maxY = e.y + e.props.height), (!this._maxX || this._maxX < e.x + e.props.width) && (this._maxX = e.x + e.props.width), x(this._rangeRenderer, {
349
+ ...r,
350
+ ...e.props,
351
+ text: p
352
+ }, e.that);
353
+ }
354
+ setRangeOptions() {
355
+ this._rangeOptions = {
356
+ rangePadding: this.rangePadding(),
357
+ fontFamily: this.fontFamily(),
358
+ fontSize: this.fontSize(),
359
+ strokeWidth: this.strokeWidth(),
360
+ fill: this.fill(),
361
+ stroke: this.stroke(),
362
+ textFill: this.rangeFontColor(),
363
+ cornerRadius: this.cornerRadius()
364
+ };
365
+ }
366
+ _transform = {
367
+ k: 1,
368
+ x: 0,
369
+ y: 0
370
+ };
371
+ zoomed(e) {
372
+ if (this._transform = e, this._interpolateX && typeof this._interpolateX.invert == "function") {
373
+ let t = this.width();
374
+ if (t > 0 && isFinite(e.k) && e.k !== 0) {
375
+ let n = (0 - e.x) / e.k, r = (t - e.x) / e.k, i = this._interpolateX.invert(n), a = this._interpolateX.invert(r);
376
+ if (isFinite(i) && isFinite(a)) {
377
+ if (i > a) {
378
+ let e = i;
379
+ i = a, a = e;
380
+ }
381
+ this._prevZoomState = {
382
+ visibleStart: i,
383
+ visibleEnd: a
384
+ };
385
+ }
386
+ }
387
+ }
388
+ switch (this.renderMode()) {
389
+ case "scale-all":
390
+ this._zoomScale = e.k, this._zoomTranslate = [e.x, 0], this._zoomG.attr("transform", `translate(${e.x} 0)scale(${e.k} 1)`);
391
+ break;
392
+ default:
393
+ let t = this._rangeOptions;
394
+ this.data().forEach((e, n) => {
395
+ if (this._color_idx > -1 && (t.fill = e[this._color_idx]), this._series_idx > -1) {
396
+ let r = e[this._series_idx];
397
+ this.renderRangeElement(e, n, !0, t, r);
398
+ } else this.renderRangeElement(e, n, !0, t);
399
+ });
400
+ }
401
+ this.zoomedHook(e);
402
+ }
403
+ zoomedHook(e) {}
404
+ calcBuckets(e, t, n, r) {
405
+ let i = {}, a = {}, o = this.overlapTolerence(), s = [{ end: -Infinity }], c = 0;
406
+ r === void 0 ? e.forEach((e, r) => {
407
+ for (let a = 0; a < s.length; ++a) if (r === 0 || s[a][n] + o <= e[t]) {
408
+ i[r] = a, c < a && (c = a), s[a][n] = e[n];
409
+ break;
410
+ }
411
+ if (i[r] === void 0) {
412
+ i[r] = s.length;
413
+ let t = {};
414
+ t[n] = e[n], s.push(t);
415
+ }
416
+ c < i[r] && (c = i[r]);
417
+ }) : (e.forEach((e, t) => {
418
+ i[t] = e[r], a[e[r]] = !0;
419
+ }), c = Object.keys(a).length);
420
+ let l = (c + 1) * (this.bucketHeight() + this.gutter());
421
+ return {
422
+ bucketMap: i,
423
+ maxBucket: c,
424
+ bucketScale: this.height() / l,
425
+ interpolateY: p().domain([0, c + 1]).range([0, Math.min(this.height(), l)])
426
+ };
427
+ }
428
+ data(e) {
429
+ let t = super.data.apply(this, arguments);
430
+ return arguments.length > 0 && (this._minStart = Math.min(...this.data().map((e) => e[1])) ?? 0, this._maxEnd = Math.max(...this.data().map((e) => e[2])) ?? 1, this.measureDataText(!0)), t;
431
+ }
432
+ _textWidths;
433
+ _maxFontScale;
434
+ _characterWidths;
435
+ _prevFontFamily;
436
+ _prevFontSize;
437
+ measureDataText(e = !1) {
438
+ let t = {}, n = {}, r = this.fontFamily(), i = this.fontSize(), a = this.bucketHeight();
439
+ a && (this._maxFontScale = (a - this.rangePadding() * 2) / i), (e || this._prevFontFamily !== r || this._prevFontSize !== i) && (n["."] = o.textSize(".", r, i).width, this.data().forEach((e) => {
440
+ t[e[0]] || (t[e[0]] = o.textSize(e[0], r, i).width), e[0].split("").forEach((e) => {
441
+ n[e] || (n[e] = o.textSize(e, r, i).width);
442
+ });
443
+ }), this._textWidths = t, this._characterWidths = n), this._prevFontFamily = r, this._prevFontSize = i;
444
+ }
445
+ truncateText(e, t, n = 1) {
446
+ if (this._textWidths[e] * n < t) return e;
447
+ let r = "", i = 0, a = t - this._characterWidths["."] * 3;
448
+ for (let t of e) if (i += this._characterWidths[t], i < a) r += t;
449
+ else break;
450
+ return a < 0 ? "" : r + "...";
451
+ }
452
+ resize(e) {
453
+ let t;
454
+ return t = this.fitWidthToContent() || this.fitHeightToContent() ? super.resize.call(this, {
455
+ width: e.width,
456
+ height: Math.max(this._maxY ?? 0, e?.height ?? 0)
457
+ }) : super.resize.apply(this, arguments), t;
458
+ }
459
+ selectionChanged() {}
460
+ highlightItem(e, t) {}
461
+ click(e, t, n) {}
462
+ dblclick(e, t, n) {}
463
+ mousein(e, t, n) {}
464
+ mouseover(e, t, n) {}
465
+ mouseout(e, t, n) {}
466
+ };
467
+ ReactGantt.prototype._class += " timeline_ReactGantt", ReactGantt.prototype.publish("fitWidthToContent", !1, "boolean", "If true, resize will simply reapply the bounding box width"), ReactGantt.prototype.publish("fitHeightToContent", !1, "boolean", "If true, resize will simply reapply the bounding box height"), ReactGantt.prototype.publish("preserveZoom", !1, "boolean", "If true, maintain zoom level when data is updated"), ReactGantt.prototype.publish("titleColumn", null, "string", "Column name to for the title"), ReactGantt.prototype.publish("startDateColumn", null, "string", "Column name to for the start date"), ReactGantt.prototype.publish("endDateColumn", null, "string", "Column name to for the end date"), ReactGantt.prototype.publish("iconColumn", null, "string", "Column name to for the icon"), ReactGantt.prototype.publish("colorColumn", null, "string", "Column name to for the color"), ReactGantt.prototype.publish("seriesColumn", null, "string", "Column name to for the series identifier"), ReactGantt.prototype.publish("bucketColumn", null, "string", "Column name to for the bucket identifier"), ReactGantt.prototype.publish("renderMode", "default", "set", "Render modes vary in features and performance", ["default", "scale-all"]), ReactGantt.prototype.publish("rangePadding", 3, "number", "Padding within each range rectangle (pixels)"), ReactGantt.prototype.publish("fill", "#1f77b4", "string", "Background color of range rectangle"), ReactGantt.prototype.publish("stroke", null, "string", "Color of range rectangle border"), ReactGantt.prototype.publish("strokeWidth", null, "number", "Width of range rectangle border (pixels)"), ReactGantt.prototype.publish("cornerRadius", 3, "number", "Space between range buckets (pixels)"), ReactGantt.prototype.publish("fontFamily", null, "string", "Font family within range rectangle", null, { optional: !0 }), ReactGantt.prototype.publish("fontSize", 10, "number", "Size of font within range rectangle (pixels)"), ReactGantt.prototype.publish("rangeFontColor", "#ecf0f1", "html-color", "rangeFontColor"), ReactGantt.prototype.publish("overlapTolerence", 2, "number", "overlapTolerence"), ReactGantt.prototype.publish("smallestRangeWidth", 10, "number", "Width of the shortest range (pixels)"), ReactGantt.prototype.publish("bucketHeight", 100, "number", "Max height of range element (pixels)"), ReactGantt.prototype.publish("gutter", 2, "number", "Space between range buckets (pixels)"), ReactGantt.prototype.publish("maxZoom", 16, "number", "Maximum zoom"), ReactGantt.prototype.publish("evenSeriesBackground", "#FFFFFF", "html-color", "Background color of even series rows"), ReactGantt.prototype.publish("oddSeriesBackground", "#DDDDDD", "html-color", "Background color of odd series rows");
468
+ //#endregion
469
+ //#region src/ReactAxisGantt.ts
470
+ var ReactAxisGantt = class extends i {
471
+ _topAxis = new t("center").orientation("top").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");
472
+ _gantt = new ReactGantt("center").stroke("#000000");
473
+ _bottomAxis = new t("center").orientation("bottom").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");
474
+ _topAxisElement;
475
+ _contentElement;
476
+ _bottomAxisElement;
477
+ _topRect;
478
+ _contentRect;
479
+ _bottomRect;
480
+ rangeRenderer;
481
+ constructor() {
482
+ super(), this._drawStartPos = "origin", this.rangeRenderer = function() {
483
+ let e = this._gantt.rangeRenderer.apply(this._gantt, arguments);
484
+ return arguments.length ? this : e;
485
+ };
486
+ }
487
+ selection(e) {
488
+ return arguments.length ? (this._gantt.selection(e), this) : this._gantt.selection();
489
+ }
490
+ resizeWrappers() {
491
+ let e = this.width(), t = this.height(), n = this.axisHeight(), r = t - n * 2, i = this.strokeWidth();
492
+ this._topRect.attr("height", n).attr("width", e).attr("fill", "transparent"), this._topAxisElement.attr("transform", "translate(0 0)"), this._topAxis.resize({
493
+ height: n,
494
+ width: e
495
+ }), this._contentRect.attr("height", r).attr("width", e).attr("fill", "transparent"), this._contentElement.attr("transform", `translate(0 ${n + i})`), this._gantt.resize({
496
+ height: r,
497
+ width: e
498
+ }), this._bottomRect.attr("height", n).attr("width", e).attr("fill", "transparent"), this._bottomAxisElement.attr("transform", `translate(0 ${n + r + i})`), this._bottomAxis.resize({
499
+ height: n,
500
+ width: e
501
+ });
502
+ }
503
+ enter(e, t) {
504
+ super.enter(e, t), this._gantt.click = (e, t, n) => {
505
+ this.click(e, t, n);
506
+ }, this._gantt.dblclick = (e, t, n) => {
507
+ this.dblclick(e, t, n);
508
+ }, this._topAxisElement = t.append("g").attr("class", "top-axis-wrapper"), this._topRect = this._topAxisElement.append("rect").attr("class", "top-axis-rect"), this._contentElement = t.append("g").attr("class", "content-wrapper"), this._contentRect = this._contentElement.append("rect").attr("class", "content-rect"), this._bottomAxisElement = t.append("g").attr("class", "bottom-axis-wrapper"), this._bottomRect = this._bottomAxisElement.append("rect").attr("class", "top-axis-rect"), this._topAxis.target(this._topAxisElement.node()), this._gantt.target(this._contentElement.node()).bucketHeight(30), this._bottomAxis.target(this._bottomAxisElement.node()), this.resizeWrappers(), this._gantt.zoomedHook = (e) => {
509
+ this.onzoom(e);
510
+ };
511
+ }
512
+ onzoom(e) {
513
+ let t = this.width(), n = this._gantt._minStart, r = this._gantt._maxEnd - n, i = r / t, a = Math.floor(n - i * (e.x / e.k)), o = Math.ceil(r / e.k + a);
514
+ this._topAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(a).high(o).render(), this._bottomAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(a).high(o).render();
515
+ }
516
+ update(e, t) {
517
+ super.update(e, t), this._topAxis.tickFormat(this.tickFormat()).render(), this._bottomAxis.tickFormat(this.tickFormat()).render(), this._gantt.render();
518
+ }
519
+ exit(e, t) {
520
+ this._bottomAxis.target(null), this._gantt.target(null), this._topAxis.target(null), super.exit(e, t);
521
+ }
522
+ columns(e) {
523
+ let t = super.columns.apply(this, arguments);
524
+ return arguments.length > 0 && this._gantt.columns(e), t;
525
+ }
526
+ data(e) {
527
+ let t = super.data.apply(this, arguments);
528
+ if (arguments.length > 0) {
529
+ let e = this.data().map((e) => {
530
+ let t = [...e];
531
+ return t[1] = isNaN(e[1]) ? new Date(e[1]).getTime() : Number(e[1]), t[2] = isNaN(e[2]) ? new Date(e[2]).getTime() : Number(e[2]), t;
532
+ });
533
+ this._gantt._minStart = Math.min(...e.map((e) => e[1])) ?? 0, this._gantt._maxEnd = Math.max(...e.map((e) => e[2])) ?? 1, this._gantt.data(e);
534
+ }
535
+ return t;
536
+ }
537
+ resize(e) {
538
+ let t = super.resize.apply(this, arguments);
539
+ return this._topAxisElement && this.resizeWrappers(), t;
540
+ }
541
+ click(e, t, n) {}
542
+ dblclick(e, t, n) {}
543
+ tooltip() {
544
+ return this._gantt._tooltip;
545
+ }
546
+ };
547
+ ReactAxisGantt.prototype._class += " timeline_ReactAxisGantt", ReactAxisGantt.prototype.publish("tickFormat", null, "string", "Format rule applied to axis tick labels", void 0, { optional: !0 }), ReactAxisGantt.prototype.publish("axisHeight", 22, "number", "Height of axes (pixels)"), ReactAxisGantt.prototype.publish("overlapTolerence", 2, "number", "overlapTolerence"), ReactAxisGantt.prototype.publish("smallestRangeWidth", 10, "number", "Width of the shortest range (pixels)"), ReactAxisGantt.prototype.publish("axisFontSize", null, "number", "Font size of axis tick labels"), ReactAxisGantt.prototype.publish("axisFontFamily", null, "string", "Font family of axis tick labels"), ReactAxisGantt.prototype.publish("axisTickLength", null, "number", "Length of axis ticks"), ReactAxisGantt.prototype.publishProxy("gutter", "_gantt"), ReactAxisGantt.prototype.publishProxy("renderMode", "_gantt"), ReactAxisGantt.prototype.publishProxy("strokeWidth", "_gantt"), ReactAxisGantt.prototype.publishProxy("fontSize", "_gantt"), ReactAxisGantt.prototype.publishProxy("fontFamily", "_gantt"), ReactAxisGantt.prototype.publishProxy("stroke", "_gantt"), ReactAxisGantt.prototype.publishProxy("cornerRadius", "_gantt"), ReactAxisGantt.prototype.publishProxy("titleColumn", "_gantt"), ReactAxisGantt.prototype.publishProxy("startDateColumn", "_gantt"), ReactAxisGantt.prototype.publishProxy("endDateColumn", "_gantt"), ReactAxisGantt.prototype.publishProxy("iconColumn", "_gantt"), ReactAxisGantt.prototype.publishProxy("colorColumn", "_gantt"), ReactAxisGantt.prototype.publishProxy("bucketColumn", "_gantt"), ReactAxisGantt.prototype.publishProxy("maxZoom", "_gantt"), ReactAxisGantt.prototype.publishProxy("bucketHeight", "_gantt");
548
+ //#endregion
549
+ //#region src/ReactAxisGanttSeries.ts
550
+ var ReactAxisGanttSeries = class extends S {
551
+ _topAxis = new t("origin").orientation("top").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");
552
+ _gantt = new ReactGantt("origin").stroke("#000000").fitHeightToContent(!0);
553
+ _bottomAxis = new t("origin").orientation("bottom").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");
554
+ _topAxisElement;
555
+ _contentElement;
556
+ _bottomAxisElement;
557
+ _topRect;
558
+ _contentRect;
559
+ _bottomRect;
560
+ constructor() {
561
+ super(), this.centerOverflowX_default("hidden"), this.centerOverflowY_default("auto");
562
+ }
563
+ selection(e) {
564
+ return arguments.length ? (this._gantt.selection(e), this) : this._gantt.selection();
565
+ }
566
+ rangeRenderer(e) {
567
+ let t = this._gantt.rangeRenderer.apply(this._gantt, arguments);
568
+ return arguments.length ? this : t;
569
+ }
570
+ resizeWrappers() {
571
+ let e = this.width(), t = this.height(), n = this.axisHeight(), r = t - n * 2;
572
+ this.bottomHeight(n), this._topWA.resize({
573
+ width: e,
574
+ height: n
575
+ }), this._centerWA.resize({
576
+ width: e,
577
+ height: r
578
+ }), this._bottomWA.resize({
579
+ width: e,
580
+ height: n
581
+ }), this.top().render(), this.bottom().render(), this.center().render();
582
+ }
583
+ enter(e, t) {
584
+ super.enter(e, t), this._gantt.click = (e, t, n) => {
585
+ this.click(e, t, n);
586
+ }, this._gantt.dblclick = (e, t, n) => {
587
+ this.dblclick(e, t, n);
588
+ }, this.top(this._topAxis), this.center(this._gantt), this.bottom(this._bottomAxis), this.resizeWrappers(), this._gantt.zoomedHook = (e) => {
589
+ this.onzoom(e);
590
+ };
591
+ }
592
+ onzoom(e) {
593
+ let t = this.width(), n = this._gantt._minStart, r = this._gantt._maxEnd - n, i = r / t, a = Math.floor(n - i * (e.x / e.k)), o = Math.ceil(r / e.k + a);
594
+ this._topAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(a).high(o).lazyRender(), this._bottomAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(a).high(o).lazyRender();
595
+ }
596
+ update(e, t) {
597
+ super.update(e, t), this._topAxis.tickFormat(this.tickFormat()).render(), this._bottomAxis.tickFormat(this.tickFormat()).render(), this._gantt.render();
598
+ }
599
+ columns(e) {
600
+ let t = super.columns.apply(this, arguments);
601
+ return arguments.length > 0 && this._gantt.columns(e), t;
602
+ }
603
+ data(e) {
604
+ let t = super.data.apply(this, arguments);
605
+ if (arguments.length > 0) {
606
+ let e = this.data().map((e) => {
607
+ let t = [...e];
608
+ return t[1] = isNaN(e[1]) ? new Date(e[1]).getTime() : Number(e[1]), t[2] = isNaN(e[2]) ? new Date(e[2]).getTime() : Number(e[2]), t;
609
+ });
610
+ this._gantt._minStart = d(e, (e) => e[1]), this._gantt._maxEnd = u(e, (e) => e[2]), this._gantt.data(e);
611
+ }
612
+ return t;
613
+ }
614
+ resize(e) {
615
+ let t = super.resize.apply(this, arguments);
616
+ return this._topAxisElement && this.resizeWrappers(), t;
617
+ }
618
+ click(e, t, n) {}
619
+ dblclick(e, t, n) {}
620
+ tooltip() {
621
+ return this._gantt._tooltip;
622
+ }
623
+ };
624
+ ReactAxisGanttSeries.prototype._class += " timeline_ReactAxisGanttSeries", ReactAxisGanttSeries.prototype.publish("tickFormat", null, "string", "Format rule applied to axis tick labels", void 0, { optional: !0 }), ReactAxisGanttSeries.prototype.publish("axisHeight", 22, "number", "Height of axes (pixels)"), ReactAxisGanttSeries.prototype.publish("overlapTolerence", 2, "number", "overlapTolerence"), ReactAxisGanttSeries.prototype.publish("smallestRangeWidth", 10, "number", "Width of the shortest range (pixels)"), ReactAxisGanttSeries.prototype.publish("axisFontSize", null, "number", "Font size of axis tick labels"), ReactAxisGanttSeries.prototype.publish("axisFontFamily", null, "string", "Font family of axis tick labels"), ReactAxisGanttSeries.prototype.publish("axisTickLength", null, "number", "Length of axis ticks"), ReactAxisGanttSeries.prototype.publishProxy("gutter", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("renderMode", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("strokeWidth", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("fontSize", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("fontFamily", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("stroke", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("cornerRadius", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("titleColumn", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("startDateColumn", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("endDateColumn", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("iconColumn", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("colorColumn", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("seriesColumn", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("bucketColumn", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("maxZoom", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("preserveZoom", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("evenSeriesBackground", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("oddSeriesBackground", "_gantt"), ReactAxisGanttSeries.prototype.publishProxy("bucketHeight", "_gantt");
625
+ //#endregion
626
+ //#region src/ReactTimeline.ts
627
+ var ReactTimeline = class extends ReactAxisGantt {
628
+ _axisLabelFormatter;
629
+ constructor() {
630
+ super(), this._drawStartPos = "origin", this._topAxis.type("time"), this._bottomAxis.type("time"), this.tooltipHTML((e) => {
631
+ let t = g("%Q"), n = t(e[1]), r = t(e[2]), i = h(this.tooltipTimeFormat());
632
+ return `<div style="text-align:center;">${e[0]}<br/><br/>${i(n)} -&gt; ${i(r)}</div>`;
633
+ });
634
+ }
635
+ update(e, t) {
636
+ if (super.update(e, t), this.timePattern_exists()) {
637
+ let e = Infinity, t = -Infinity, n = "", r = "";
638
+ this.data().map((i) => {
639
+ let a = new Date(i[1]).getTime(), o = new Date(i[2]).getTime();
640
+ e > a && (e = a, n = "" + i[1]), t < o && (t = o, r = "" + i[2]);
641
+ });
642
+ let i = this._axisLabelFormatter ? this._axisLabelFormatter : this.tickFormat_exists && this.tickFormat_exists() ? this.tickFormat() : void 0;
643
+ this._topAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(n).high(r), this._bottomAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(n).high(r), i ? (this._topAxis.tickFormat(i), this._bottomAxis.tickFormat(i)) : (this._topAxis.tickFormat_reset(), this._bottomAxis.tickFormat_reset()), this._gantt._minStart = e, this._gantt._maxEnd = t;
644
+ }
645
+ }
646
+ tooltipHTML(e) {
647
+ return this._tooltipHTML = e, this.tooltip().tooltipHTML(this._tooltipHTML), this;
648
+ }
649
+ parseAxisValue(e) {
650
+ let t = g("%Q")(e);
651
+ return h(this.timePattern())(t);
652
+ }
653
+ onzoom(e) {
654
+ let t = this.width(), n = this._gantt._minStart, r = this._gantt._maxEnd - n, i = r / t, a = Math.floor(n - i * (e.x / e.k)), o = Math.ceil(r / e.k + a);
655
+ this._topAxis.low(this.parseAxisValue(a)).high(this.parseAxisValue(o)).render(), this._bottomAxis.low(this.parseAxisValue(a)).high(this.parseAxisValue(o)).render();
656
+ }
657
+ };
658
+ ReactTimeline.prototype._class += " timeline_ReactTimeline", ReactTimeline.prototype.publish("timePattern", "%Y-%m-%d", "string", "Time pattern used for parsing datetime strings on each data row", null, { optional: !0 }), ReactTimeline.prototype.publish("tooltipTimeFormat", "%Y-%m-%d", "string", "Time format used in the default html tooltip");
659
+ //#endregion
660
+ //#region src/ReactTimelineSeries.ts
661
+ var E = g("%Q"), ReactTimelineSeries = class extends ReactAxisGanttSeries {
662
+ _axisLabelFormatter;
663
+ constructor() {
664
+ super(), this._topAxis.type("time"), this._bottomAxis.type("time"), this.tooltipHTML((e) => {
665
+ let t = E(e[1]), n = E(e[2]), r = h(this.tooltipTimeFormat());
666
+ return `<div style="text-align:center;">${e[0]}<br/><br/>${r(t)} -&gt; ${r(n)}</div>`;
667
+ });
668
+ }
669
+ update(e, t) {
670
+ if (super.update(e, t), this.timePattern_exists()) {
671
+ let e = Infinity, t = -Infinity, n = "", r = "";
672
+ this.data().forEach((i) => {
673
+ let a = new Date(i[1]).getTime(), o = new Date(i[2]).getTime();
674
+ e > a && (e = a, n = "" + i[1]), t < o && (t = o, r = "" + i[2]);
675
+ });
676
+ let i = this._axisLabelFormatter ? this._axisLabelFormatter : this.tickFormat_exists && this.tickFormat_exists() ? this.tickFormat() : void 0;
677
+ this._topAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(n).high(r), this._bottomAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(n).high(r), i ? (this._topAxis.tickFormat(i), this._bottomAxis.tickFormat(i)) : (this._topAxis.tickFormat_reset(), this._bottomAxis.tickFormat_reset()), this._gantt._minStart = e, this._gantt._maxEnd = t;
678
+ }
679
+ }
680
+ tickFormatFunc(e) {
681
+ return arguments.length ? (this._axisLabelFormatter = e, this._topAxis.tickFormatFunc(e), this._bottomAxis.tickFormatFunc(e), this) : this._axisLabelFormatter;
682
+ }
683
+ tooltipHTML(e) {
684
+ return this._tooltipHTML = e, this.tooltip().tooltipHTML(this._tooltipHTML), this;
685
+ }
686
+ parseAxisValue(e) {
687
+ let t = E(e);
688
+ return h(this.timePattern())(t);
689
+ }
690
+ onzoom(e) {
691
+ let t = this.width(), n = this._gantt._minStart, r = this._gantt._maxEnd - n, i = r / t, a = Math.floor(n - i * (e.x / e.k)), o = Math.ceil(r / e.k + a);
692
+ this._topAxis.low(this.parseAxisValue(a)).high(this.parseAxisValue(o)).render(), this._bottomAxis.low(this.parseAxisValue(a)).high(this.parseAxisValue(o)).render();
693
+ }
694
+ _tooltipHTML;
695
+ };
696
+ ReactTimelineSeries.prototype._class += " timeline_ReactTimelineSeries", ReactTimelineSeries.prototype.publish("timePattern", "%Y-%m-%d", "string", "Time pattern used for parsing datetime strings on each data row", null, { optional: !0 }), ReactTimelineSeries.prototype.publish("tooltipTimeFormat", "%Y-%m-%d", "string", "Time format used in the default html tooltip");
697
+ //#endregion
698
+ export { T as BUILD_VERSION, MiniGantt, C as PKG_NAME, w as PKG_VERSION, ReactAxisGantt, ReactAxisGanttSeries, ReactGantt, ReactTimeline, ReactTimelineSeries };
699
+
2
700
  //# sourceMappingURL=index.js.map
3
- !function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode(".timeline_MiniGantt .line{fill:none;stroke:#d3d3d3;opacity:.7}.timeline_MiniGantt .common_TextBox .rect{fill:#87cefa;stroke:#00f;opacity:.5}.timeline_MiniGantt .buckets .entity_shape rect{stroke:#333}.timeline_MiniGantt .buckets.selected .common_EntityRect .common_Shape>rect{stroke:red}.timeline_MiniGantt .common_TextBox .rect text{fill:#000;stroke:none}.timeline_MiniGantt .over{stroke:transparent;opacity:.8}.timeline_MiniGantt rect{shape-rendering:crispEdges}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
701
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.timeline_MiniGantt .line{fill:none;stroke:#d3d3d3;opacity:.7}.timeline_MiniGantt .common_TextBox .rect{fill:#87cefa;stroke:#00f;opacity:.5}.timeline_MiniGantt .buckets .entity_shape rect{stroke:#333}.timeline_MiniGantt .buckets.selected .common_EntityRect .common_Shape>rect{stroke:red}.timeline_MiniGantt .common_TextBox .rect text{fill:#000;stroke:none}.timeline_MiniGantt .over{stroke:#0000;opacity:.8}.timeline_MiniGantt rect{shape-rendering:crispedges}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();