@hpcc-js/timeline 3.4.6 → 3.4.8
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 +1 -1
- package/dist/index.umd.cjs +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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.6",S="3.22.1",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]} -> ${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)} -> ${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)} -> ${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
|
+
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]} -> ${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)} -> ${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)} -> ${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};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
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)}}();
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/api"),require("@hpcc-js/chart"),require("@hpcc-js/common"),require("@hpcc-js/html"),require("@hpcc-js/react"),require("@hpcc-js/layout")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/api","@hpcc-js/chart","@hpcc-js/common","@hpcc-js/html","@hpcc-js/react","@hpcc-js/layout"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@hpcc-js/timeline"]={},t["@hpcc-js/api"],t["@hpcc-js/chart"],t["@hpcc-js/common"],t["@hpcc-js/html"],t["@hpcc-js/react"],t["@hpcc-js/layout"])}(this,function(t,e,i,o,s,n,r){"use strict";var a=Object.defineProperty,l=(t,e)=>a(t,"name",{value:e,configurable:!0});const h=class _MiniGantt extends o.SVGWidget{tlAxis;brAxis;verticalBands;_zoom;gUpperContent;gUpperAxis;gMiddleContent;gLowerAxis;gLowerContent;localRect=o.local();localEntityPin=o.local();tooltipFormatter;_dateCache;rootExtent;_title_idx=0;_startDate_idx=1;_endDate_idx=2;_icon_idx=-1;_color_idx=-1;_yoffset_idx=-1;constructor(){super(),e.ITooltip.call(this),o.Utility.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 i.Axis).type("time"),this.brAxis=(new i.Axis).type("time"),this.verticalBands=o.scaleBand().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 o.extent(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=o.timeParse(this.timePattern()),i=o.timeFormat(this.timePattern()),s=e(t[0]),n=e(t[1]);if(t[0]===t[1])t[0]=i(new Date(s.setFullYear(s.getFullYear()-1))),t[1]=i(new Date(s.setFullYear(s.getFullYear()+2)));else{const e=s.getTime(),o=n.getTime()-e;t[0]=i(s),t[1]=i(new Date(e+2*o))}}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(),o.zoomIdentity.translate(0,this.isHorizontal()?0:this.height()))}zoomed(){this.transform=o.d3Event().transform,this.render()}background;enter(t,e){super.enter(t,e),this._zoom=o.zoom().scaleExtent([0,this.maxZoom()]).on("zoom",()=>{this.zoomed()}),this.background=e.append("rect").attr("fill","white").attr("opacity",0).on("dblclick",()=>{o.d3Event().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=o.timeFormat(this.tooltipTimeFormat());const i=this.width(),s=this.height();this.background.attr("x",0).attr("y",0).attr("width",i).attr("height",s);const n=this.extent();if(this.tlAxis.x(i/2).orientation(this.isHorizontal()?"top":"left").reverse(!this.isHorizontal()).timePattern(this.timePattern()).width(i-1).low(n[0]).high(n[1]).updateScale(),this.brAxis.x(i/2).y(s/2).orientation(this.isHorizontal()?"bottom":"right").reverse(!this.isHorizontal()).timePattern(this.timePattern()).width(i-1).height(s).low(n[0]).high(n[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(s-1)))),this.tlAxis.low(t).high(e).updateScale(),this.brAxis.low(t).high(e).updateScale()}const r=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])),a=r.filter(t=>!t[this._endDate_idx]),l=r.filter(t=>!!t[this._endDate_idx]);this.tlAxis.render(),this.brAxis.render();const h=this.brAxis.getBBox();let p=this.updateEntityPins(a);const c=h.height;let d=s-p;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(a.length>0&&0===l.length){this.tlAxis.visible(!1);let t=p/4;t>s/2-c&&(t=s/2-c);const e=s/2+t,i=-1*(s/2-c-t),o=0!==m?m/2:0;this.gUpperContent.attr("transform",`translate(0, ${e-o})`),this.gLowerAxis.attr("transform",`translate(0, ${i-o})`)}else 0===a.length&&l.length>0?(this.tlAxis.visible(!0),this.gUpperContent.attr("transform",`translate(0, ${p})`),this.gUpperAxis.attr("transform",`translate(0, ${p})`)):(p-=m,d+=m,this.tlAxis.visible(!0),this.gUpperContent.attr("transform",`translate(0, ${p})`),this.gUpperAxis.attr("transform",`translate(0, ${p})`),this.gMiddleContent.attr("transform",`translate(0, ${p})`));this.tlAxis.render();const u=this.tlAxis.getBBox(),_=[],x={};for(const o of l){for(let t=0;t<_.length;++t){const e=_[t];if(e.endPos+this.overlapTolerence()<=this.dataStartPos(o)){x[o]=t,e.endPos=this.dataEndPos(o);break}}void 0===x[o]&&(x[o]=_.length,_.push({endPos:this.dataEndPos(o)}))}const g=this.isHorizontal()?0+u.height:0+u.width,b=this.isHorizontal()?d-h.height:i-h.width;this.verticalBands.range([g,b]).domain(_.map((t,e)=>e)),l.length>0&&this.updateEventRanges(a,l,x,d,u,h,i)}updateEntityPins(t){let e=0;const i=this,s=this.gUpperContent.selectAll(".entity_pin").data(t,t=>t[0]+":"+t[1]),n=this.eventFontColorColumn()?this.columns().indexOf(this.eventFontColorColumn()):-1,r=this.eventBorderColorColumn()?this.columns().indexOf(this.eventBorderColorColumn()):-1,a=this.eventBackgroundColorColumn()?this.columns().indexOf(this.eventBackgroundColorColumn()):-1,l={};for(const o of t){const t=void 0!==o[i._title_idx]?o[i._title_idx]:o[0];l[t]=l[t]?l[t]+1:1}const h=Object.keys(l),p=i.eventGroupOffset(),c=s.enter().append("g").attr("class","entity_pin");c.append("line").attr("class","entity_line"),c.on("mouseover",function(t){o.select(this).raise()}).each(function(t,e){const s=(new o.EntityPin).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===n?"#333":t[n]).titleColor(-1===n?"#333":t[n]).descriptionColor(-1===n?"#333":t[n]).backgroundShape("pin").backgroundColorFill(-1===n?"#f8f8f8":t[a]).backgroundColorStroke(-1===n?"#ccc":t[r]).cornerRadius(5).arrowHeight(10).arrowWidth(16);i.localEntityPin.set(this,s)}).merge(s).each(function(t,s){const a=i.localEntityPin.get(this),l=void 0!==t[i._title_idx]?t[i._title_idx]:a.title(),c=i.dataStartPos(t)-0;let d=h.indexOf(l)%i.eventGroupMod()*p-5;if(void 0!==t[i._yoffset_idx]&&(d+=t[i._yoffset_idx]?t[i._yoffset_idx]:0),t[i._title_idx]!==a.title()&&t[i._startDate_idx]!==a.description()){const e=i.brAxis.parse(t[i._startDate_idx]),o=i.tooltipFormatter(e);a.x(c).y(d).iconOnlyShowOnHover(i.hideIconWhenCollapsed()).titleOnlyShowOnHover(i.hideTitleWhenCollapsed()).descriptionOnlyShowOnHover(i.hideDescriptionWhenCollapsed()).annotationOnlyShowOnHover(i.hideAnnotationsWhenCollapsed()).icon(void 0!==t[i._icon_idx]?t[i._icon_idx]:a.icon()).title(l).description(o).animationFrameRender()}else a.move({x:c,y:d});const m=a.calcHeight();e<m&&(e=m),o.select(this).selectAll(".entity_line").attr("x1",c).attr("x2",c).attr("y1",0).attr("y2",d).style("stroke",-1===n?"#ccc":t[r]).style("stroke-width",1)}),s.exit().each(function(t,e){i.localEntityPin.get(this).target(null)}).remove();const d=Math.abs(Math.min(t.length,i.eventGroupMod())*i.eventGroupOffset());return e+d}updateEventRanges(t,e,i,s,n,r,a){const l=this,h=this.gMiddleContent.selectAll(".line").data(t,t=>t[l._title_idx]);h.enter().append("line").attr("class","line").merge(h).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()?n.height:n.width).attr(this.isHorizontal()?"y2":"x2",this.isHorizontal()?s-r.height:a-r.width),h.exit().remove();const p=this.gMiddleContent.selectAll(".buckets").data(e,t=>t[l._title_idx]);p.enter().append("g").attr("class","buckets").call(this._selection.enter.bind(this._selection)).each(function(t){const e=(new o.EntityRect).target(this).iconDiameter(28).iconPaddingPercent(0).titleFontSize(28).titleColor(l.rangeFontColor()).descriptionColor(l.rangeFontColor()).iconColor(l.rangeFontColor()).backgroundShape("rect").backgroundColorFill(t[l._color_idx]);l.localRect.set(this,e),l.enterEntityRect(e,t)}).on("click",function(t){l.click(l.rowToObj(t),"range",l._selection.selected(this))},!1).on("dblclick",function(t){l.rootExtent=t,l.resetZoom(),l.dblclick(l.rowToObj(t),"range",l._selection.selected(this))},!0).on("mouseout.tooltip",this.tooltip.hide).on("mousemove.tooltip",this.tooltip.show).merge(p).attr("transform",t=>l.isHorizontal()?`translate(${this.dataStartPos(t)}, ${this.verticalBands(i[t])}) `:`translate(${this.verticalBands(i[t])}, ${this.dataStartPos(t)}) `).each(function(t){const e=l.localRect.get(this),i=l.dataWidth(t)/2,o=l.verticalBands.bandwidth()/2,s=Math.max(l.dataWidth(t),2),n=Math.max(l.verticalBands.bandwidth(),2),r=.191*n,a=.618*n,h=a;e.pos(l.isHorizontal()?{x:i,y:o}:{x:o,y:i}).fixedHeight(l.isHorizontal()?n:s).fixedWidth(l.isHorizontal()?s:n).icon(void 0!==t[l._icon_idx]?t[l._icon_idx]:"").title(void 0!==t[l._title_idx]?t[l._title_idx]:"").padding(r).iconDiameter(h).titleFontSize(a),1.5*h>s&&e.icon(null),l.updateEntityRect(e,t[l._icon_idx]),e.render()}),p.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){}};l(h,"MiniGantt");let p=h;p.prototype._class+=" timeline_MiniGantt",p.prototype.implements(e.ITooltip.prototype),p.prototype.mixin(o.Utility.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 c=class _ReactGantt extends o.SVGZoomWidget{_selection=new o.Utility.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 s.HTMLTooltip,this._tooltip.tooltipHTML(t=>`<div style="text-align:center;">${t[0]}<br/><br/>${t[1]} -> ${t[2]}</div>`),this._tooltip.followCursor(!0)}selection(t){return arguments.length?(this._selection.set(t),this):this._selection.get()}_rangeRenderer=n.LabelledRect;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,e){super.update(t,e),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 i=this,s=this.width(),n=s;if(this._interpolateX=o.scaleLinear().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 n=Object.keys(this._dataBySeries);n.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(n.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,n){o.select(this).attr("x",0).attr("y",e.bucketOffset-t/2).attr("width",s).attr("height",(e.bucketHeight+t)*(e.maxBucket+1)+t).attr("fill",n%2?i.oddSeriesBackground():i.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()),h=this.strokeWidth(),p=2*h;if(a.join(t=>t.append("g").attr("class","item").on("click.selectionBag",function(t,e){const s=void 0===t.id?e:t.id;i._selection.isSelected({_id:s,element:t.element})?i._selection.clear():i._selection.click({_id:s,element:l(()=>t.element,"element")},o.d3Event),i.selectionChanged(),o.d3Event().stopPropagation()}).on("click",function(t){const e=t.element.classed("selected");t[i.columns().length]&&(t.__lparam=t[i.columns().length]),i.click(t,"",e)}).on("dblclick",function(t){const e=t.element.classed("selected");t[i.columns().length]&&(t.__lparam=t[i.columns().length]),i.click(t,"",e)}).on("mousein",function(t){i.highlightItem(o.select(this),t);const e=t.element.classed("selected");i.mousein(t,"",e)}).on("mouseover",function(t){const e=o.d3Event();i._tooltip._triggerElement=t.element,i._tooltip._cursorLoc=[e.clientX,e.clientY],i._tooltip.data(t).visible(!0).fitContent(!0).render(),i.highlightItem(o.select(this),t);const s=t.element.classed("selected");i.mouseover(t,"",s)}).on("mouseout",function(t){i._tooltip.visible(!1).render(),i.highlightItem(null,null);const e=t.element.classed("selected");i.mouseout(t,"",e)}).each(function(t,e){t.that=this,t.element=o.select(this),t.x=i._interpolateX(t[1]);const s=i._interpolateX(t[2]);if(i._series_idx>-1){const o=t[i._series_idx],s=i._bucketsBySeries[o].bucketMap[i._origIdxMap[o][e]];t.y=i._bucketsBySeries[o].interpolateY(s)+i._bucketsBySeries[o].bucketOffset}else{const o=-1===i._bucket_idx?e:t[i._bucket_idx];t.y=i._buckets.interpolateY(i._buckets.bucketMap[o])}t.props={...t[3],text:t[0]},t.props.width=s-t.x,t.props.height=r,t.x+=h,t.y+=h,t.props.width-=p,t.props.height-=p,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,i._series_idx>-1){const o=t[i._series_idx];t.x=i.renderRangeElement(t,e,!1,i._rangeOptions,o)}else t.x=i.renderRangeElement(t,e,!1,i._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)}),e.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,s={},r){const a=s.strokeWidth,l=2*a,h=s.rangePadding;let p;const c=isNaN(this._transform.x)?0:this._transform.x,d=isNaN(this._transform.k)?1:this._transform.k;let m;const u=this.bucketHeight();t.that.setAttribute("data-series",r),this._color_idx>-1&&t.that.setAttribute("data-color",t[this._color_idx]),void 0!==r?(m=this._bucketsBySeries[r].bucketMap[this._origIdxMap[r][e]],t.that.setAttribute("data-b",m),t.that.setAttribute("data-bucketOffset",this._bucketsBySeries[r].bucketOffset),t.y=this._bucketsBySeries[r].interpolateY(m)+this._bucketsBySeries[r].bucketOffset,t.that.setAttribute("data-dy",t.y)):(m=this._buckets.bucketMap[e],t.y=this._buckets.interpolateY(m)),this._color_idx>-1&&(s.fill=t[this._color_idx]),i?(t.x=this._interpolateX(t[1])*d,p=this._interpolateX(t[2])*d,t.props={...t[3],text:t[0]},t.props.width=(p-t.x)/d,t.x+=c,t.props.width*=d):(t.x=this._interpolateX(t[1]),p=this._interpolateX(t[2]),t.props={...t[3],text:t[0]},t.props.width=(p-t.x)/d),t.props.height=u,void 0===r&&this._buckets.bucketScale<1&&(t.props.height=this._buckets.bucketScale*u),void 0===t.element&&t.that&&(t.element=o.select(t.that)),t.element.attr("transform",`translate(${t.x+t.props.width/2} ${t.y+t.props.height/2})`),t.x+=a,t.y+=a,t.props.width-=l,t.props.height-=l,t.props.width=t.props.width<1?1:t.props.width,t.props.height=t.props.height<1?1:t.props.height;let _=this.truncateText(t.props.text,t.props.width-h,this._maxFontScale);_!==t.props.text?_=this.truncateText(t.props.text,t.props.width-h):t.props.fontSize=this._maxFontScale*s.fontSize,void 0===r&&this._buckets.bucketScale<1&&(t.props.fontSize=Math.min(this._maxFontScale,this._buckets.bucketScale)*s.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),n.render(this._rangeRenderer,{...s,...t.props,text:_},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,s){const n={},r={},a=this.overlapTolerence(),l=[{end:-1/0}];let h=0;void 0!==s?(t.forEach((t,e)=>{n[e]=t[s],r[t[s]]=!0}),h=Object.keys(r).length):t.forEach((t,o)=>{for(let s=0;s<l.length;++s)if(0===o||l[s][i]+a<=t[e]){n[o]=s,h<s&&(h=s),l[s][i]=t[i];break}if(void 0===n[o]){n[o]=l.length;const e={};e[i]=t[i],l.push(e)}h<n[o]&&(h=n[o])});const p=(h+1)*(this.bucketHeight()+this.gutter());return{bucketMap:n,maxBucket:h,bucketScale:this.height()/p,interpolateY:o.scaleLinear().domain([0,h+1]).range([0,Math.min(this.height(),p)])}}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={},s=this.fontFamily(),n=this.fontSize(),r=this.bucketHeight();r&&(this._maxFontScale=(r-2*this.rangePadding())/n),(t||this._prevFontFamily!==s||this._prevFontSize!==n)&&(i["."]=o.Utility.textSize(".",s,n).width,this.data().forEach(t=>{e[t[0]]||(e[t[0]]=o.Utility.textSize(t[0],s,n).width),t[0].split("").forEach(t=>{i[t]||(i[t]=o.Utility.textSize(t,s,n).width)})}),this._textWidths=e,this._characterWidths=i),this._prevFontFamily=s,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){}};l(c,"ReactGantt");let d=c;d.prototype._class+=" timeline_ReactGantt",d.prototype.publish("fitWidthToContent",!1,"boolean","If true, resize will simply reapply the bounding box width"),d.prototype.publish("fitHeightToContent",!1,"boolean","If true, resize will simply reapply the bounding box height"),d.prototype.publish("preserveZoom",!1,"boolean","If true, maintain zoom level when data is updated"),d.prototype.publish("titleColumn",null,"string","Column name to for the title"),d.prototype.publish("startDateColumn",null,"string","Column name to for the start date"),d.prototype.publish("endDateColumn",null,"string","Column name to for the end date"),d.prototype.publish("iconColumn",null,"string","Column name to for the icon"),d.prototype.publish("colorColumn",null,"string","Column name to for the color"),d.prototype.publish("seriesColumn",null,"string","Column name to for the series identifier"),d.prototype.publish("bucketColumn",null,"string","Column name to for the bucket identifier"),d.prototype.publish("renderMode","default","set","Render modes vary in features and performance",["default","scale-all"]),d.prototype.publish("rangePadding",3,"number","Padding within each range rectangle (pixels)"),d.prototype.publish("fill","#1f77b4","string","Background color of range rectangle"),d.prototype.publish("stroke",null,"string","Color of range rectangle border"),d.prototype.publish("strokeWidth",null,"number","Width of range rectangle border (pixels)"),d.prototype.publish("cornerRadius",3,"number","Space between range buckets (pixels)"),d.prototype.publish("fontFamily",null,"string","Font family within range rectangle",null,{optional:!0}),d.prototype.publish("fontSize",10,"number","Size of font within range rectangle (pixels)"),d.prototype.publish("rangeFontColor","#ecf0f1","html-color","rangeFontColor"),d.prototype.publish("overlapTolerence",2,"number","overlapTolerence"),d.prototype.publish("smallestRangeWidth",10,"number","Width of the shortest range (pixels)"),d.prototype.publish("bucketHeight",100,"number","Max height of range element (pixels)"),d.prototype.publish("gutter",2,"number","Space between range buckets (pixels)"),d.prototype.publish("maxZoom",16,"number","Maximum zoom"),d.prototype.publish("evenSeriesBackground","#FFFFFF","html-color","Background color of even series rows"),d.prototype.publish("oddSeriesBackground","#DDDDDD","html-color","Background color of odd series rows");const m=class _ReactAxisGantt extends o.SVGWidget{_topAxis=new i.Axis("center").orientation("top").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");_gantt=new d("center").stroke("#000000");_bottomAxis=new i.Axis("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}};l(m,"ReactAxisGantt");let u=m;u.prototype._class+=" timeline_ReactAxisGantt",u.prototype.publish("tickFormat",null,"string","Format rule applied to axis tick labels",void 0,{optional:!0}),u.prototype.publish("axisHeight",22,"number","Height of axes (pixels)"),u.prototype.publish("overlapTolerence",2,"number","overlapTolerence"),u.prototype.publish("smallestRangeWidth",10,"number","Width of the shortest range (pixels)"),u.prototype.publish("axisFontSize",null,"number","Font size of axis tick labels"),u.prototype.publish("axisFontFamily",null,"string","Font family of axis tick labels"),u.prototype.publish("axisTickLength",null,"number","Length of axis ticks"),u.prototype.publishProxy("gutter","_gantt"),u.prototype.publishProxy("renderMode","_gantt"),u.prototype.publishProxy("strokeWidth","_gantt"),u.prototype.publishProxy("fontSize","_gantt"),u.prototype.publishProxy("fontFamily","_gantt"),u.prototype.publishProxy("stroke","_gantt"),u.prototype.publishProxy("cornerRadius","_gantt"),u.prototype.publishProxy("titleColumn","_gantt"),u.prototype.publishProxy("startDateColumn","_gantt"),u.prototype.publishProxy("endDateColumn","_gantt"),u.prototype.publishProxy("iconColumn","_gantt"),u.prototype.publishProxy("colorColumn","_gantt"),u.prototype.publishProxy("bucketColumn","_gantt"),u.prototype.publishProxy("maxZoom","_gantt"),u.prototype.publishProxy("bucketHeight","_gantt");const _=class _ReactAxisGanttSeries extends r.Border2{_topAxis=new i.Axis("origin").orientation("top").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");_gantt=new d("origin").stroke("#000000").fitHeightToContent(!0);_bottomAxis=new i.Axis("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=o.min(t,t=>t[1]),this._gantt._maxEnd=o.max(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}};l(_,"ReactAxisGanttSeries");let x=_;x.prototype._class+=" timeline_ReactAxisGanttSeries",x.prototype.publish("tickFormat",null,"string","Format rule applied to axis tick labels",void 0,{optional:!0}),x.prototype.publish("axisHeight",22,"number","Height of axes (pixels)"),x.prototype.publish("overlapTolerence",2,"number","overlapTolerence"),x.prototype.publish("smallestRangeWidth",10,"number","Width of the shortest range (pixels)"),x.prototype.publish("axisFontSize",null,"number","Font size of axis tick labels"),x.prototype.publish("axisFontFamily",null,"string","Font family of axis tick labels"),x.prototype.publish("axisTickLength",null,"number","Length of axis ticks"),x.prototype.publishProxy("gutter","_gantt"),x.prototype.publishProxy("renderMode","_gantt"),x.prototype.publishProxy("strokeWidth","_gantt"),x.prototype.publishProxy("fontSize","_gantt"),x.prototype.publishProxy("fontFamily","_gantt"),x.prototype.publishProxy("stroke","_gantt"),x.prototype.publishProxy("cornerRadius","_gantt"),x.prototype.publishProxy("titleColumn","_gantt"),x.prototype.publishProxy("startDateColumn","_gantt"),x.prototype.publishProxy("endDateColumn","_gantt"),x.prototype.publishProxy("iconColumn","_gantt"),x.prototype.publishProxy("colorColumn","_gantt"),x.prototype.publishProxy("seriesColumn","_gantt"),x.prototype.publishProxy("bucketColumn","_gantt"),x.prototype.publishProxy("maxZoom","_gantt"),x.prototype.publishProxy("preserveZoom","_gantt"),x.prototype.publishProxy("evenSeriesBackground","_gantt"),x.prototype.publishProxy("oddSeriesBackground","_gantt"),x.prototype.publishProxy("bucketHeight","_gantt");const g=class _ReactTimeline extends u{_axisLabelFormatter;constructor(){super(),this._drawStartPos="origin",this._topAxis.type("time"),this._bottomAxis.type("time"),this.tooltipHTML(t=>{const e=o.timeParse("%Q"),i=e(t[1]),s=e(t[2]),n=o.timeFormat(this.tooltipTimeFormat());return`<div style="text-align:center;">${t[0]}<br/><br/>${n(i)} -> ${n(s)}</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=o.timeParse("%Q")(t);return o.timeFormat(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()}};l(g,"ReactTimeline");let b=g;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 y=o.timeParse("%Q"),f=class _ReactTimelineSeries extends x{_axisLabelFormatter;constructor(){super(),this._topAxis.type("time"),this._bottomAxis.type("time"),this.tooltipHTML(t=>{const e=y(t[1]),i=y(t[2]),s=o.timeFormat(this.tooltipTimeFormat());return`<div style="text-align:center;">${t[0]}<br/><br/>${s(e)} -> ${s(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=y(t);return o.timeFormat(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};l(f,"ReactTimelineSeries");let k=f;k.prototype._class+=" timeline_ReactTimelineSeries",k.prototype.publish("timePattern","%Y-%m-%d","string","Time pattern used for parsing datetime strings on each data row",null,{optional:!0}),k.prototype.publish("tooltipTimeFormat","%Y-%m-%d","string","Time format used in the default html tooltip"),t.BUILD_VERSION="3.22.1",t.MiniGantt=p,t.PKG_NAME="@hpcc-js/timeline",t.PKG_VERSION="3.4.6",t.ReactAxisGantt=u,t.ReactAxisGanttSeries=x,t.ReactGantt=d,t.ReactTimeline=b,t.ReactTimelineSeries=k,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/api"),require("@hpcc-js/chart"),require("@hpcc-js/common"),require("@hpcc-js/html"),require("@hpcc-js/react"),require("@hpcc-js/layout")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/api","@hpcc-js/chart","@hpcc-js/common","@hpcc-js/html","@hpcc-js/react","@hpcc-js/layout"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@hpcc-js/timeline"]={},t["@hpcc-js/api"],t["@hpcc-js/chart"],t["@hpcc-js/common"],t["@hpcc-js/html"],t["@hpcc-js/react"],t["@hpcc-js/layout"])}(this,function(t,e,i,o,s,n,r){"use strict";var a=Object.defineProperty,l=(t,e)=>a(t,"name",{value:e,configurable:!0});const h=class _MiniGantt extends o.SVGWidget{tlAxis;brAxis;verticalBands;_zoom;gUpperContent;gUpperAxis;gMiddleContent;gLowerAxis;gLowerContent;localRect=o.local();localEntityPin=o.local();tooltipFormatter;_dateCache;rootExtent;_title_idx=0;_startDate_idx=1;_endDate_idx=2;_icon_idx=-1;_color_idx=-1;_yoffset_idx=-1;constructor(){super(),e.ITooltip.call(this),o.Utility.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 i.Axis).type("time"),this.brAxis=(new i.Axis).type("time"),this.verticalBands=o.scaleBand().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 o.extent(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=o.timeParse(this.timePattern()),i=o.timeFormat(this.timePattern()),s=e(t[0]),n=e(t[1]);if(t[0]===t[1])t[0]=i(new Date(s.setFullYear(s.getFullYear()-1))),t[1]=i(new Date(s.setFullYear(s.getFullYear()+2)));else{const e=s.getTime(),o=n.getTime()-e;t[0]=i(s),t[1]=i(new Date(e+2*o))}}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(),o.zoomIdentity.translate(0,this.isHorizontal()?0:this.height()))}zoomed(){this.transform=o.d3Event().transform,this.render()}background;enter(t,e){super.enter(t,e),this._zoom=o.zoom().scaleExtent([0,this.maxZoom()]).on("zoom",()=>{this.zoomed()}),this.background=e.append("rect").attr("fill","white").attr("opacity",0).on("dblclick",()=>{o.d3Event().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=o.timeFormat(this.tooltipTimeFormat());const i=this.width(),s=this.height();this.background.attr("x",0).attr("y",0).attr("width",i).attr("height",s);const n=this.extent();if(this.tlAxis.x(i/2).orientation(this.isHorizontal()?"top":"left").reverse(!this.isHorizontal()).timePattern(this.timePattern()).width(i-1).low(n[0]).high(n[1]).updateScale(),this.brAxis.x(i/2).y(s/2).orientation(this.isHorizontal()?"bottom":"right").reverse(!this.isHorizontal()).timePattern(this.timePattern()).width(i-1).height(s).low(n[0]).high(n[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(s-1)))),this.tlAxis.low(t).high(e).updateScale(),this.brAxis.low(t).high(e).updateScale()}const r=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])),a=r.filter(t=>!t[this._endDate_idx]),l=r.filter(t=>!!t[this._endDate_idx]);this.tlAxis.render(),this.brAxis.render();const h=this.brAxis.getBBox();let p=this.updateEntityPins(a);const c=h.height;let d=s-p;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(a.length>0&&0===l.length){this.tlAxis.visible(!1);let t=p/4;t>s/2-c&&(t=s/2-c);const e=s/2+t,i=-1*(s/2-c-t),o=0!==m?m/2:0;this.gUpperContent.attr("transform",`translate(0, ${e-o})`),this.gLowerAxis.attr("transform",`translate(0, ${i-o})`)}else 0===a.length&&l.length>0?(this.tlAxis.visible(!0),this.gUpperContent.attr("transform",`translate(0, ${p})`),this.gUpperAxis.attr("transform",`translate(0, ${p})`)):(p-=m,d+=m,this.tlAxis.visible(!0),this.gUpperContent.attr("transform",`translate(0, ${p})`),this.gUpperAxis.attr("transform",`translate(0, ${p})`),this.gMiddleContent.attr("transform",`translate(0, ${p})`));this.tlAxis.render();const u=this.tlAxis.getBBox(),_=[],x={};for(const o of l){for(let t=0;t<_.length;++t){const e=_[t];if(e.endPos+this.overlapTolerence()<=this.dataStartPos(o)){x[o]=t,e.endPos=this.dataEndPos(o);break}}void 0===x[o]&&(x[o]=_.length,_.push({endPos:this.dataEndPos(o)}))}const g=this.isHorizontal()?0+u.height:0+u.width,b=this.isHorizontal()?d-h.height:i-h.width;this.verticalBands.range([g,b]).domain(_.map((t,e)=>e)),l.length>0&&this.updateEventRanges(a,l,x,d,u,h,i)}updateEntityPins(t){let e=0;const i=this,s=this.gUpperContent.selectAll(".entity_pin").data(t,t=>t[0]+":"+t[1]),n=this.eventFontColorColumn()?this.columns().indexOf(this.eventFontColorColumn()):-1,r=this.eventBorderColorColumn()?this.columns().indexOf(this.eventBorderColorColumn()):-1,a=this.eventBackgroundColorColumn()?this.columns().indexOf(this.eventBackgroundColorColumn()):-1,l={};for(const o of t){const t=void 0!==o[i._title_idx]?o[i._title_idx]:o[0];l[t]=l[t]?l[t]+1:1}const h=Object.keys(l),p=i.eventGroupOffset(),c=s.enter().append("g").attr("class","entity_pin");c.append("line").attr("class","entity_line"),c.on("mouseover",function(t){o.select(this).raise()}).each(function(t,e){const s=(new o.EntityPin).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===n?"#333":t[n]).titleColor(-1===n?"#333":t[n]).descriptionColor(-1===n?"#333":t[n]).backgroundShape("pin").backgroundColorFill(-1===n?"#f8f8f8":t[a]).backgroundColorStroke(-1===n?"#ccc":t[r]).cornerRadius(5).arrowHeight(10).arrowWidth(16);i.localEntityPin.set(this,s)}).merge(s).each(function(t,s){const a=i.localEntityPin.get(this),l=void 0!==t[i._title_idx]?t[i._title_idx]:a.title(),c=i.dataStartPos(t)-0;let d=h.indexOf(l)%i.eventGroupMod()*p-5;if(void 0!==t[i._yoffset_idx]&&(d+=t[i._yoffset_idx]?t[i._yoffset_idx]:0),t[i._title_idx]!==a.title()&&t[i._startDate_idx]!==a.description()){const e=i.brAxis.parse(t[i._startDate_idx]),o=i.tooltipFormatter(e);a.x(c).y(d).iconOnlyShowOnHover(i.hideIconWhenCollapsed()).titleOnlyShowOnHover(i.hideTitleWhenCollapsed()).descriptionOnlyShowOnHover(i.hideDescriptionWhenCollapsed()).annotationOnlyShowOnHover(i.hideAnnotationsWhenCollapsed()).icon(void 0!==t[i._icon_idx]?t[i._icon_idx]:a.icon()).title(l).description(o).animationFrameRender()}else a.move({x:c,y:d});const m=a.calcHeight();e<m&&(e=m),o.select(this).selectAll(".entity_line").attr("x1",c).attr("x2",c).attr("y1",0).attr("y2",d).style("stroke",-1===n?"#ccc":t[r]).style("stroke-width",1)}),s.exit().each(function(t,e){i.localEntityPin.get(this).target(null)}).remove();const d=Math.abs(Math.min(t.length,i.eventGroupMod())*i.eventGroupOffset());return e+d}updateEventRanges(t,e,i,s,n,r,a){const l=this,h=this.gMiddleContent.selectAll(".line").data(t,t=>t[l._title_idx]);h.enter().append("line").attr("class","line").merge(h).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()?n.height:n.width).attr(this.isHorizontal()?"y2":"x2",this.isHorizontal()?s-r.height:a-r.width),h.exit().remove();const p=this.gMiddleContent.selectAll(".buckets").data(e,t=>t[l._title_idx]);p.enter().append("g").attr("class","buckets").call(this._selection.enter.bind(this._selection)).each(function(t){const e=(new o.EntityRect).target(this).iconDiameter(28).iconPaddingPercent(0).titleFontSize(28).titleColor(l.rangeFontColor()).descriptionColor(l.rangeFontColor()).iconColor(l.rangeFontColor()).backgroundShape("rect").backgroundColorFill(t[l._color_idx]);l.localRect.set(this,e),l.enterEntityRect(e,t)}).on("click",function(t){l.click(l.rowToObj(t),"range",l._selection.selected(this))},!1).on("dblclick",function(t){l.rootExtent=t,l.resetZoom(),l.dblclick(l.rowToObj(t),"range",l._selection.selected(this))},!0).on("mouseout.tooltip",this.tooltip.hide).on("mousemove.tooltip",this.tooltip.show).merge(p).attr("transform",t=>l.isHorizontal()?`translate(${this.dataStartPos(t)}, ${this.verticalBands(i[t])}) `:`translate(${this.verticalBands(i[t])}, ${this.dataStartPos(t)}) `).each(function(t){const e=l.localRect.get(this),i=l.dataWidth(t)/2,o=l.verticalBands.bandwidth()/2,s=Math.max(l.dataWidth(t),2),n=Math.max(l.verticalBands.bandwidth(),2),r=.191*n,a=.618*n,h=a;e.pos(l.isHorizontal()?{x:i,y:o}:{x:o,y:i}).fixedHeight(l.isHorizontal()?n:s).fixedWidth(l.isHorizontal()?s:n).icon(void 0!==t[l._icon_idx]?t[l._icon_idx]:"").title(void 0!==t[l._title_idx]?t[l._title_idx]:"").padding(r).iconDiameter(h).titleFontSize(a),1.5*h>s&&e.icon(null),l.updateEntityRect(e,t[l._icon_idx]),e.render()}),p.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){}};l(h,"MiniGantt");let p=h;p.prototype._class+=" timeline_MiniGantt",p.prototype.implements(e.ITooltip.prototype),p.prototype.mixin(o.Utility.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 c=class _ReactGantt extends o.SVGZoomWidget{_selection=new o.Utility.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 s.HTMLTooltip,this._tooltip.tooltipHTML(t=>`<div style="text-align:center;">${t[0]}<br/><br/>${t[1]} -> ${t[2]}</div>`),this._tooltip.followCursor(!0)}selection(t){return arguments.length?(this._selection.set(t),this):this._selection.get()}_rangeRenderer=n.LabelledRect;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,e){super.update(t,e),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 i=this,s=this.width(),n=s;if(this._interpolateX=o.scaleLinear().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 n=Object.keys(this._dataBySeries);n.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(n.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,n){o.select(this).attr("x",0).attr("y",e.bucketOffset-t/2).attr("width",s).attr("height",(e.bucketHeight+t)*(e.maxBucket+1)+t).attr("fill",n%2?i.oddSeriesBackground():i.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()),h=this.strokeWidth(),p=2*h;if(a.join(t=>t.append("g").attr("class","item").on("click.selectionBag",function(t,e){const s=void 0===t.id?e:t.id;i._selection.isSelected({_id:s,element:t.element})?i._selection.clear():i._selection.click({_id:s,element:l(()=>t.element,"element")},o.d3Event),i.selectionChanged(),o.d3Event().stopPropagation()}).on("click",function(t){const e=t.element.classed("selected");t[i.columns().length]&&(t.__lparam=t[i.columns().length]),i.click(t,"",e)}).on("dblclick",function(t){const e=t.element.classed("selected");t[i.columns().length]&&(t.__lparam=t[i.columns().length]),i.click(t,"",e)}).on("mousein",function(t){i.highlightItem(o.select(this),t);const e=t.element.classed("selected");i.mousein(t,"",e)}).on("mouseover",function(t){const e=o.d3Event();i._tooltip._triggerElement=t.element,i._tooltip._cursorLoc=[e.clientX,e.clientY],i._tooltip.data(t).visible(!0).fitContent(!0).render(),i.highlightItem(o.select(this),t);const s=t.element.classed("selected");i.mouseover(t,"",s)}).on("mouseout",function(t){i._tooltip.visible(!1).render(),i.highlightItem(null,null);const e=t.element.classed("selected");i.mouseout(t,"",e)}).each(function(t,e){t.that=this,t.element=o.select(this),t.x=i._interpolateX(t[1]);const s=i._interpolateX(t[2]);if(i._series_idx>-1){const o=t[i._series_idx],s=i._bucketsBySeries[o].bucketMap[i._origIdxMap[o][e]];t.y=i._bucketsBySeries[o].interpolateY(s)+i._bucketsBySeries[o].bucketOffset}else{const o=-1===i._bucket_idx?e:t[i._bucket_idx];t.y=i._buckets.interpolateY(i._buckets.bucketMap[o])}t.props={...t[3],text:t[0]},t.props.width=s-t.x,t.props.height=r,t.x+=h,t.y+=h,t.props.width-=p,t.props.height-=p,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,i._series_idx>-1){const o=t[i._series_idx];t.x=i.renderRangeElement(t,e,!1,i._rangeOptions,o)}else t.x=i.renderRangeElement(t,e,!1,i._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)}),e.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,s={},r){const a=s.strokeWidth,l=2*a,h=s.rangePadding;let p;const c=isNaN(this._transform.x)?0:this._transform.x,d=isNaN(this._transform.k)?1:this._transform.k;let m;const u=this.bucketHeight();t.that.setAttribute("data-series",r),this._color_idx>-1&&t.that.setAttribute("data-color",t[this._color_idx]),void 0!==r?(m=this._bucketsBySeries[r].bucketMap[this._origIdxMap[r][e]],t.that.setAttribute("data-b",m),t.that.setAttribute("data-bucketOffset",this._bucketsBySeries[r].bucketOffset),t.y=this._bucketsBySeries[r].interpolateY(m)+this._bucketsBySeries[r].bucketOffset,t.that.setAttribute("data-dy",t.y)):(m=this._buckets.bucketMap[e],t.y=this._buckets.interpolateY(m)),this._color_idx>-1&&(s.fill=t[this._color_idx]),i?(t.x=this._interpolateX(t[1])*d,p=this._interpolateX(t[2])*d,t.props={...t[3],text:t[0]},t.props.width=(p-t.x)/d,t.x+=c,t.props.width*=d):(t.x=this._interpolateX(t[1]),p=this._interpolateX(t[2]),t.props={...t[3],text:t[0]},t.props.width=(p-t.x)/d),t.props.height=u,void 0===r&&this._buckets.bucketScale<1&&(t.props.height=this._buckets.bucketScale*u),void 0===t.element&&t.that&&(t.element=o.select(t.that)),t.element.attr("transform",`translate(${t.x+t.props.width/2} ${t.y+t.props.height/2})`),t.x+=a,t.y+=a,t.props.width-=l,t.props.height-=l,t.props.width=t.props.width<1?1:t.props.width,t.props.height=t.props.height<1?1:t.props.height;let _=this.truncateText(t.props.text,t.props.width-h,this._maxFontScale);_!==t.props.text?_=this.truncateText(t.props.text,t.props.width-h):t.props.fontSize=this._maxFontScale*s.fontSize,void 0===r&&this._buckets.bucketScale<1&&(t.props.fontSize=Math.min(this._maxFontScale,this._buckets.bucketScale)*s.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),n.render(this._rangeRenderer,{...s,...t.props,text:_},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,s){const n={},r={},a=this.overlapTolerence(),l=[{end:-1/0}];let h=0;void 0!==s?(t.forEach((t,e)=>{n[e]=t[s],r[t[s]]=!0}),h=Object.keys(r).length):t.forEach((t,o)=>{for(let s=0;s<l.length;++s)if(0===o||l[s][i]+a<=t[e]){n[o]=s,h<s&&(h=s),l[s][i]=t[i];break}if(void 0===n[o]){n[o]=l.length;const e={};e[i]=t[i],l.push(e)}h<n[o]&&(h=n[o])});const p=(h+1)*(this.bucketHeight()+this.gutter());return{bucketMap:n,maxBucket:h,bucketScale:this.height()/p,interpolateY:o.scaleLinear().domain([0,h+1]).range([0,Math.min(this.height(),p)])}}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={},s=this.fontFamily(),n=this.fontSize(),r=this.bucketHeight();r&&(this._maxFontScale=(r-2*this.rangePadding())/n),(t||this._prevFontFamily!==s||this._prevFontSize!==n)&&(i["."]=o.Utility.textSize(".",s,n).width,this.data().forEach(t=>{e[t[0]]||(e[t[0]]=o.Utility.textSize(t[0],s,n).width),t[0].split("").forEach(t=>{i[t]||(i[t]=o.Utility.textSize(t,s,n).width)})}),this._textWidths=e,this._characterWidths=i),this._prevFontFamily=s,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){}};l(c,"ReactGantt");let d=c;d.prototype._class+=" timeline_ReactGantt",d.prototype.publish("fitWidthToContent",!1,"boolean","If true, resize will simply reapply the bounding box width"),d.prototype.publish("fitHeightToContent",!1,"boolean","If true, resize will simply reapply the bounding box height"),d.prototype.publish("preserveZoom",!1,"boolean","If true, maintain zoom level when data is updated"),d.prototype.publish("titleColumn",null,"string","Column name to for the title"),d.prototype.publish("startDateColumn",null,"string","Column name to for the start date"),d.prototype.publish("endDateColumn",null,"string","Column name to for the end date"),d.prototype.publish("iconColumn",null,"string","Column name to for the icon"),d.prototype.publish("colorColumn",null,"string","Column name to for the color"),d.prototype.publish("seriesColumn",null,"string","Column name to for the series identifier"),d.prototype.publish("bucketColumn",null,"string","Column name to for the bucket identifier"),d.prototype.publish("renderMode","default","set","Render modes vary in features and performance",["default","scale-all"]),d.prototype.publish("rangePadding",3,"number","Padding within each range rectangle (pixels)"),d.prototype.publish("fill","#1f77b4","string","Background color of range rectangle"),d.prototype.publish("stroke",null,"string","Color of range rectangle border"),d.prototype.publish("strokeWidth",null,"number","Width of range rectangle border (pixels)"),d.prototype.publish("cornerRadius",3,"number","Space between range buckets (pixels)"),d.prototype.publish("fontFamily",null,"string","Font family within range rectangle",null,{optional:!0}),d.prototype.publish("fontSize",10,"number","Size of font within range rectangle (pixels)"),d.prototype.publish("rangeFontColor","#ecf0f1","html-color","rangeFontColor"),d.prototype.publish("overlapTolerence",2,"number","overlapTolerence"),d.prototype.publish("smallestRangeWidth",10,"number","Width of the shortest range (pixels)"),d.prototype.publish("bucketHeight",100,"number","Max height of range element (pixels)"),d.prototype.publish("gutter",2,"number","Space between range buckets (pixels)"),d.prototype.publish("maxZoom",16,"number","Maximum zoom"),d.prototype.publish("evenSeriesBackground","#FFFFFF","html-color","Background color of even series rows"),d.prototype.publish("oddSeriesBackground","#DDDDDD","html-color","Background color of odd series rows");const m=class _ReactAxisGantt extends o.SVGWidget{_topAxis=new i.Axis("center").orientation("top").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");_gantt=new d("center").stroke("#000000");_bottomAxis=new i.Axis("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}};l(m,"ReactAxisGantt");let u=m;u.prototype._class+=" timeline_ReactAxisGantt",u.prototype.publish("tickFormat",null,"string","Format rule applied to axis tick labels",void 0,{optional:!0}),u.prototype.publish("axisHeight",22,"number","Height of axes (pixels)"),u.prototype.publish("overlapTolerence",2,"number","overlapTolerence"),u.prototype.publish("smallestRangeWidth",10,"number","Width of the shortest range (pixels)"),u.prototype.publish("axisFontSize",null,"number","Font size of axis tick labels"),u.prototype.publish("axisFontFamily",null,"string","Font family of axis tick labels"),u.prototype.publish("axisTickLength",null,"number","Length of axis ticks"),u.prototype.publishProxy("gutter","_gantt"),u.prototype.publishProxy("renderMode","_gantt"),u.prototype.publishProxy("strokeWidth","_gantt"),u.prototype.publishProxy("fontSize","_gantt"),u.prototype.publishProxy("fontFamily","_gantt"),u.prototype.publishProxy("stroke","_gantt"),u.prototype.publishProxy("cornerRadius","_gantt"),u.prototype.publishProxy("titleColumn","_gantt"),u.prototype.publishProxy("startDateColumn","_gantt"),u.prototype.publishProxy("endDateColumn","_gantt"),u.prototype.publishProxy("iconColumn","_gantt"),u.prototype.publishProxy("colorColumn","_gantt"),u.prototype.publishProxy("bucketColumn","_gantt"),u.prototype.publishProxy("maxZoom","_gantt"),u.prototype.publishProxy("bucketHeight","_gantt");const _=class _ReactAxisGanttSeries extends r.Border2{_topAxis=new i.Axis("origin").orientation("top").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");_gantt=new d("origin").stroke("#000000").fitHeightToContent(!0);_bottomAxis=new i.Axis("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=o.min(t,t=>t[1]),this._gantt._maxEnd=o.max(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}};l(_,"ReactAxisGanttSeries");let x=_;x.prototype._class+=" timeline_ReactAxisGanttSeries",x.prototype.publish("tickFormat",null,"string","Format rule applied to axis tick labels",void 0,{optional:!0}),x.prototype.publish("axisHeight",22,"number","Height of axes (pixels)"),x.prototype.publish("overlapTolerence",2,"number","overlapTolerence"),x.prototype.publish("smallestRangeWidth",10,"number","Width of the shortest range (pixels)"),x.prototype.publish("axisFontSize",null,"number","Font size of axis tick labels"),x.prototype.publish("axisFontFamily",null,"string","Font family of axis tick labels"),x.prototype.publish("axisTickLength",null,"number","Length of axis ticks"),x.prototype.publishProxy("gutter","_gantt"),x.prototype.publishProxy("renderMode","_gantt"),x.prototype.publishProxy("strokeWidth","_gantt"),x.prototype.publishProxy("fontSize","_gantt"),x.prototype.publishProxy("fontFamily","_gantt"),x.prototype.publishProxy("stroke","_gantt"),x.prototype.publishProxy("cornerRadius","_gantt"),x.prototype.publishProxy("titleColumn","_gantt"),x.prototype.publishProxy("startDateColumn","_gantt"),x.prototype.publishProxy("endDateColumn","_gantt"),x.prototype.publishProxy("iconColumn","_gantt"),x.prototype.publishProxy("colorColumn","_gantt"),x.prototype.publishProxy("seriesColumn","_gantt"),x.prototype.publishProxy("bucketColumn","_gantt"),x.prototype.publishProxy("maxZoom","_gantt"),x.prototype.publishProxy("preserveZoom","_gantt"),x.prototype.publishProxy("evenSeriesBackground","_gantt"),x.prototype.publishProxy("oddSeriesBackground","_gantt"),x.prototype.publishProxy("bucketHeight","_gantt");const g=class _ReactTimeline extends u{_axisLabelFormatter;constructor(){super(),this._drawStartPos="origin",this._topAxis.type("time"),this._bottomAxis.type("time"),this.tooltipHTML(t=>{const e=o.timeParse("%Q"),i=e(t[1]),s=e(t[2]),n=o.timeFormat(this.tooltipTimeFormat());return`<div style="text-align:center;">${t[0]}<br/><br/>${n(i)} -> ${n(s)}</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=o.timeParse("%Q")(t);return o.timeFormat(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()}};l(g,"ReactTimeline");let b=g;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 y=o.timeParse("%Q"),f=class _ReactTimelineSeries extends x{_axisLabelFormatter;constructor(){super(),this._topAxis.type("time"),this._bottomAxis.type("time"),this.tooltipHTML(t=>{const e=y(t[1]),i=y(t[2]),s=o.timeFormat(this.tooltipTimeFormat());return`<div style="text-align:center;">${t[0]}<br/><br/>${s(e)} -> ${s(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=y(t);return o.timeFormat(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};l(f,"ReactTimelineSeries");let k=f;k.prototype._class+=" timeline_ReactTimelineSeries",k.prototype.publish("timePattern","%Y-%m-%d","string","Time pattern used for parsing datetime strings on each data row",null,{optional:!0}),k.prototype.publish("tooltipTimeFormat","%Y-%m-%d","string","Time format used in the default html tooltip"),t.BUILD_VERSION="3.24.0",t.MiniGantt=p,t.PKG_NAME="@hpcc-js/timeline",t.PKG_VERSION="3.4.8",t.ReactAxisGantt=u,t.ReactAxisGanttSeries=x,t.ReactGantt=d,t.ReactTimeline=b,t.ReactTimelineSeries=k,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=index.umd.cjs.map
|
|
3
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)}}();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/timeline",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.8",
|
|
4
4
|
"description": "hpcc-js - Viz Timeline",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.cjs",
|
|
@@ -39,15 +39,15 @@
|
|
|
39
39
|
"update-major": "npx --yes npm-check-updates -u"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@hpcc-js/api": "^3.4.
|
|
43
|
-
"@hpcc-js/chart": "^3.7.
|
|
44
|
-
"@hpcc-js/common": "^3.7.
|
|
45
|
-
"@hpcc-js/html": "^3.3.
|
|
46
|
-
"@hpcc-js/layout": "^3.5.
|
|
47
|
-
"@hpcc-js/react": "^3.4.
|
|
42
|
+
"@hpcc-js/api": "^3.4.19",
|
|
43
|
+
"@hpcc-js/chart": "^3.7.8",
|
|
44
|
+
"@hpcc-js/common": "^3.7.9",
|
|
45
|
+
"@hpcc-js/html": "^3.3.19",
|
|
46
|
+
"@hpcc-js/layout": "^3.5.14",
|
|
47
|
+
"@hpcc-js/react": "^3.4.19"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@hpcc-js/esbuild-plugins": "^1.8.
|
|
50
|
+
"@hpcc-js/esbuild-plugins": "^1.8.10",
|
|
51
51
|
"d3-array": "^1",
|
|
52
52
|
"d3-scale": "^1",
|
|
53
53
|
"d3-selection": "^1",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"url": "https://github.com/hpcc-systems/Visualization/issues"
|
|
66
66
|
},
|
|
67
67
|
"homepage": "https://github.com/hpcc-systems/Visualization",
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "83d7d72530df75074464a3b746abfa800c62b555"
|
|
69
69
|
}
|