@hpcc-js/timeline 3.4.8 → 3.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +700 -2
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +2 -2
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +9 -9
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.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"})});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(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")):typeof define==`function`&&define.amd?define([`exports`,`@hpcc-js/api`,`@hpcc-js/chart`,`@hpcc-js/common`,`@hpcc-js/html`,`@hpcc-js/react`,`@hpcc-js/layout`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`@hpcc-js/timeline`]={},e[`@hpcc-js/api`],e[`@hpcc-js/chart`],e[`@hpcc-js/common`],e[`@hpcc-js/html`],e[`@hpcc-js/react`],e[`@hpcc-js/layout`]))})(this,function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var s=`@hpcc-js/timeline`,c=`3.4.9`,l=`3.25.1`,MiniGantt=class extends r.SVGWidget{tlAxis;brAxis;verticalBands;_zoom;gUpperContent;gUpperAxis;gMiddleContent;gLowerAxis;gLowerContent;localRect=(0,r.local)();localEntityPin=(0,r.local)();tooltipFormatter;_dateCache;rootExtent;_title_idx=0;_startDate_idx=1;_endDate_idx=2;_icon_idx=-1;_color_idx=-1;_yoffset_idx=-1;constructor(){super(),t.ITooltip.call(this),r.Utility.SimpleSelectionMixin.call(this),this._drawStartPos=`origin`,this.tooltipHTML(e=>`<center>${e[this._title_idx]}</center><br>${this.tooltipFormatter(this.brAxis.parse(e[this._startDate_idx]))} -> ${this.tooltipFormatter(this.brAxis.parse(e[this._endDate_idx]))}`),this.tlAxis=new n.Axis().type(`time`),this.brAxis=new n.Axis().type(`time`),this.verticalBands=(0,r.scaleBand)().paddingOuter(.2).paddingInner(.2)}isHorizontal(){return this.orientation()===`horizontal`}fullExtent(){return(0,r.extent)([...this.data().map(e=>e[this._startDate_idx]),...this.data().filter(e=>!!e[this._endDate_idx]).map(e=>e[this._endDate_idx])])}extent(){let e=this.rootExtent?[this.rootExtent[1],this.rootExtent[2]]:this.fullExtent();if(e[0]!==void 0&&e[1]!==void 0&&(e[0]===e[1]||this.centerOnMostRecent())){let t=(0,r.timeParse)(this.timePattern()),n=(0,r.timeFormat)(this.timePattern()),i=t(e[0]),a=t(e[1]);if(e[0]===e[1])e[0]=n(new Date(i.setFullYear(i.getFullYear()-1))),e[1]=n(new Date(i.setFullYear(i.getFullYear()+2)));else{let t=i.getTime(),r=a.getTime()-t;e[0]=n(i),e[1]=n(new Date(t+r*2))}}return e}dataStartPos(e){if(this._dateCache[e[this._startDate_idx]]!==void 0)return this._dateCache[e[this._startDate_idx]];let t=this.brAxis.scalePos(e[this._startDate_idx]);return this._dateCache[e[this._startDate_idx]]=t,t}dataEndPos(e){if(this._dateCache[e[this._endDate_idx]]!==void 0)return this._dateCache[e[this._endDate_idx]];let t=this.brAxis.scalePos(e[this._endDate_idx]);return this._dateCache[e[this._endDate_idx]]=t,t}dataWidth(e){return this.dataEndPos(e)-this.dataStartPos(e)}transform;resetZoom(){this._zoom.transform(this.element(),r.zoomIdentity.translate(0,this.isHorizontal()?0:this.height()))}zoomed(){this.transform=(0,r.d3Event)().transform,this.render()}background;enter(e,t){super.enter(e,t),this._zoom=(0,r.zoom)().scaleExtent([0,this.maxZoom()]).on(`zoom`,()=>{this.zoomed()}),this.background=t.append(`rect`).attr(`fill`,`white`).attr(`opacity`,0).on(`dblclick`,()=>{(0,r.d3Event)().stopPropagation(),delete this.rootExtent,this.resetZoom()}),this.gUpperContent=t.append(`g`).attr(`class`,`gUpperContent`),this.gUpperAxis=t.append(`g`).attr(`class`,`gUpperAxis`),this.gMiddleContent=t.append(`g`).attr(`class`,`gMiddleContent`),this.gLowerAxis=t.append(`g`).attr(`class`,`gLowerAxis`),this.gLowerContent=t.append(`g`).attr(`class`,`gLowerContent`),this.tlAxis.target(this.gUpperAxis.node()).tickFormat(this.tickFormat()).guideTarget(this.gUpperAxis.append(`g`).node()).shrinkToFit(`none`).overlapMode(this.tickFormat_exists()?`stagger`:`none`).extend(.1),this.brAxis.target(this.gLowerAxis.node()).tickFormat(this.tickFormat()).guideTarget(this.gLowerAxis.append(`g`).node()).shrinkToFit(`none`).overlapMode(this.tickFormat_exists()?`stagger`:`none`).extend(.1),t.call(this._zoom),this._selection.widgetElement(this.gMiddleContent)}_prevIsHorizontal;update(e,t){if(super.update(e,t),this._dateCache={},this._title_idx=this.titleColumn()===null?this._title_idx:this.columns().indexOf(this.titleColumn()),this._startDate_idx=this.startDateColumn()===null?this._startDate_idx:this.columns().indexOf(this.startDateColumn()),this._endDate_idx=this.endDateColumn()===null?this._endDate_idx:this.columns().indexOf(this.endDateColumn()),this._icon_idx=this.iconColumn()===null?this._icon_idx:this.columns().indexOf(this.iconColumn()),this._color_idx=this.colorColumn()===null?this._color_idx:this.columns().indexOf(this.colorColumn()),this._yoffset_idx=this.yOffsetColumn()===null?this._yoffset_idx:this.columns().indexOf(this.yOffsetColumn()),this._prevIsHorizontal!==this.isHorizontal()){this._prevIsHorizontal=this.isHorizontal(),this.resetZoom();return}this.tooltipFormatter=(0,r.timeFormat)(this.tooltipTimeFormat());let n=this.width(),i=this.height();this.background.attr(`x`,0).attr(`y`,0).attr(`width`,n).attr(`height`,i);let a=this.extent();if(this.tlAxis.x(n/2).orientation(this.isHorizontal()?`top`:`left`).reverse(!this.isHorizontal()).timePattern(this.timePattern()).width(n-1).low(a[0]).high(a[1]).updateScale(),this.brAxis.x(n/2).y(i/2).orientation(this.isHorizontal()?`bottom`:`right`).reverse(!this.isHorizontal()).timePattern(this.timePattern()).width(n-1).height(i).low(a[0]).high(a[1]).updateScale(),this.transform){let e,t;this.isHorizontal()?(e=this.tlAxis.parseInvert(this.tlAxis.invert(this.transform.invertX(0))),t=this.tlAxis.parseInvert(this.tlAxis.invert(this.transform.invertX(n-1)))):(e=this.tlAxis.parseInvert(this.tlAxis.invert(-this.transform.invertY(0))),t=this.tlAxis.parseInvert(this.tlAxis.invert(-this.transform.invertY(i-1)))),this.tlAxis.low(e).high(t).updateScale(),this.brAxis.low(e).high(t).updateScale()}let o=this.data().sort(this.isHorizontal()?(e,t)=>{let n=this.brAxis.scalePos(e[1])-this.brAxis.scalePos(t[1]);return n===0?(``+e[0]).localeCompare(``+t[0]):n}:(e,t)=>this.brAxis.scalePos(t[1])-this.brAxis.scalePos(e[1])),s=o.filter(e=>!e[this._endDate_idx]),c=o.filter(e=>!!e[this._endDate_idx]);this.tlAxis.render(),this.brAxis.render();let l=this.brAxis.getBBox(),u=this.updateEntityPins(s),d=l.height,f=i-u,p=this._yoffset_idx===-1?0:Math.min.apply(void 0,this.data().filter(e=>!isNaN(e[this._yoffset_idx])).map(e=>e[this._yoffset_idx]));if(s.length>0&&c.length===0){this.tlAxis.visible(!1);let e=u/4;e>i/2-d&&(e=i/2-d);let t=i/2+e,n=(i/2-d-e)*-1,r=p===0?0:p/2;this.gUpperContent.attr(`transform`,`translate(0, ${t-r})`),this.gLowerAxis.attr(`transform`,`translate(0, ${n-r})`)}else s.length===0&&c.length>0?(this.tlAxis.visible(!0),this.gUpperContent.attr(`transform`,`translate(0, ${u})`),this.gUpperAxis.attr(`transform`,`translate(0, ${u})`)):(u-=p,f+=p,this.tlAxis.visible(!0),this.gUpperContent.attr(`transform`,`translate(0, ${u})`),this.gUpperAxis.attr(`transform`,`translate(0, ${u})`),this.gMiddleContent.attr(`transform`,`translate(0, ${u})`));this.tlAxis.render();let m=this.tlAxis.getBBox(),h=[],g={};for(let e of c){for(let t=0;t<h.length;++t){let n=h[t];if(n.endPos+this.overlapTolerence()<=this.dataStartPos(e)){g[e]=t,n.endPos=this.dataEndPos(e);break}}g[e]===void 0&&(g[e]=h.length,h.push({endPos:this.dataEndPos(e)}))}let _=this.isHorizontal()?0+m.height:0+m.width,v=this.isHorizontal()?f-l.height:n-l.width;this.verticalBands.range([_,v]).domain(h.map((e,t)=>t)),c.length>0&&this.updateEventRanges(s,c,g,f,m,l,n)}updateEntityPins(e){let t=0,n=this,i=this.gUpperContent.selectAll(`.entity_pin`).data(e,e=>e[0]+`:`+e[1]),a=this.eventFontColorColumn()?this.columns().indexOf(this.eventFontColorColumn()):-1,o=this.eventBorderColorColumn()?this.columns().indexOf(this.eventBorderColorColumn()):-1,s=this.eventBackgroundColorColumn()?this.columns().indexOf(this.eventBackgroundColorColumn()):-1,c={};for(let t of e){let e=t[n._title_idx]===void 0?t[0]:t[n._title_idx];c[e]=c[e]?c[e]+1:1}let l=Object.keys(c),u=n.eventGroupOffset(),d=i.enter().append(`g`).attr(`class`,`entity_pin`);d.append(`line`).attr(`class`,`entity_line`),d.on(`mouseover`,function(e){(0,r.select)(this).raise()}).each(function(e,t){let i=new r.EntityPin().target(this).icon(``).iconOnlyShowOnHover(n.hideIconWhenCollapsed()).titleOnlyShowOnHover(n.hideTitleWhenCollapsed()).descriptionOnlyShowOnHover(n.hideDescriptionWhenCollapsed()).annotationOnlyShowOnHover(n.hideAnnotationsWhenCollapsed()).iconDiameter(18).iconPaddingPercent(1).titleFontSize(14).descriptionColor(`#333`).descriptionFontSize(15).iconColor(a===-1?`#333`:e[a]).titleColor(a===-1?`#333`:e[a]).descriptionColor(a===-1?`#333`:e[a]).backgroundShape(`pin`).backgroundColorFill(a===-1?`#f8f8f8`:e[s]).backgroundColorStroke(a===-1?`#ccc`:e[o]).cornerRadius(5).arrowHeight(10).arrowWidth(16);n.localEntityPin.set(this,i)}).merge(i).each(function(e,i){let s=n.localEntityPin.get(this),c=e[n._title_idx]===void 0?s.title():e[n._title_idx],d=n.dataStartPos(e)-0,f=l.indexOf(c)%n.eventGroupMod()*u-5;if(e[n._yoffset_idx]!==void 0&&(f+=e[n._yoffset_idx]?e[n._yoffset_idx]:0),e[n._title_idx]!==s.title()&&e[n._startDate_idx]!==s.description()){let t=n.brAxis.parse(e[n._startDate_idx]),r=n.tooltipFormatter(t);s.x(d).y(f).iconOnlyShowOnHover(n.hideIconWhenCollapsed()).titleOnlyShowOnHover(n.hideTitleWhenCollapsed()).descriptionOnlyShowOnHover(n.hideDescriptionWhenCollapsed()).annotationOnlyShowOnHover(n.hideAnnotationsWhenCollapsed()).icon(e[n._icon_idx]===void 0?s.icon():e[n._icon_idx]).title(c).description(r).animationFrameRender()}else s.move({x:d,y:f});let p=s.calcHeight();t<p&&(t=p),(0,r.select)(this).selectAll(`.entity_line`).attr(`x1`,d).attr(`x2`,d).attr(`y1`,0).attr(`y2`,f).style(`stroke`,a===-1?`#ccc`:e[o]).style(`stroke-width`,1)}),i.exit().each(function(e,t){n.localEntityPin.get(this).target(null)}).remove();let f=Math.abs(Math.min(e.length,n.eventGroupMod())*n.eventGroupOffset());return t+f}updateEventRanges(e,t,n,i,a,o,s){let c=this,l=this.gMiddleContent.selectAll(`.line`).data(e,e=>e[c._title_idx]);l.enter().append(`line`).attr(`class`,`line`).merge(l).attr(this.isHorizontal()?`x1`:`y1`,e=>this.dataStartPos(e)-0).attr(this.isHorizontal()?`x2`:`y2`,e=>this.dataStartPos(e)-0).attr(this.isHorizontal()?`y1`:`x1`,this.isHorizontal()?a.height:a.width).attr(this.isHorizontal()?`y2`:`x2`,this.isHorizontal()?i-o.height:s-o.width),l.exit().remove();let u=this.gMiddleContent.selectAll(`.buckets`).data(t,e=>e[c._title_idx]);u.enter().append(`g`).attr(`class`,`buckets`).call(this._selection.enter.bind(this._selection)).each(function(e){let t=new r.EntityRect().target(this).iconDiameter(28).iconPaddingPercent(0).titleFontSize(28).titleColor(c.rangeFontColor()).descriptionColor(c.rangeFontColor()).iconColor(c.rangeFontColor()).backgroundShape(`rect`).backgroundColorFill(e[c._color_idx]);c.localRect.set(this,t),c.enterEntityRect(t,e)}).on(`click`,function(e){c.click(c.rowToObj(e),`range`,c._selection.selected(this))},!1).on(`dblclick`,function(e){c.rootExtent=e,c.resetZoom(),c.dblclick(c.rowToObj(e),`range`,c._selection.selected(this))},!0).on(`mouseout.tooltip`,this.tooltip.hide).on(`mousemove.tooltip`,this.tooltip.show).merge(u).attr(`transform`,e=>c.isHorizontal()?`translate(${this.dataStartPos(e)}, ${this.verticalBands(n[e])}) `:`translate(${this.verticalBands(n[e])}, ${this.dataStartPos(e)}) `).each(function(e){let t=c.localRect.get(this),n=c.dataWidth(e)/2,r=c.verticalBands.bandwidth()/2,i=Math.max(c.dataWidth(e),2),a=Math.max(c.verticalBands.bandwidth(),2),o=.618,s=(1-o)/2*a,l=a*o,u=l;t.pos(c.isHorizontal()?{x:n,y:r}:{x:r,y:n}).fixedHeight(c.isHorizontal()?a:i).fixedWidth(c.isHorizontal()?i:a).icon(e[c._icon_idx]===void 0?``:e[c._icon_idx]).title(e[c._title_idx]===void 0?``:e[c._title_idx]).padding(s).iconDiameter(u).titleFontSize(l),u*1.5>i&&t.icon(null),c.updateEntityRect(t,e[c._icon_idx]),t.render()}),u.exit().remove()}exit(e,t){this.brAxis.target(null),this.tlAxis.target(null),super.exit(e,t)}click(e,t,n){}dblclick(e,t,n){}enterEntityRect(e,t){}updateEntityRect(e,t){}};MiniGantt.prototype._class+=` timeline_MiniGantt`,MiniGantt.prototype.implements(t.ITooltip.prototype),MiniGantt.prototype.mixin(r.Utility.SimpleSelectionMixin),MiniGantt.prototype.publish(`timePattern`,`%Y-%m-%d`,`string`,`timePattern`),MiniGantt.prototype.publish(`tickFormat`,null,`string`,`tickFormat`,void 0,{optional:!0}),MiniGantt.prototype.publish(`tooltipTimeFormat`,`%Y-%m-%d`,`string`,`tooltipTimeFormat`),MiniGantt.prototype.publish(`overlapTolerence`,2,`number`,`overlapTolerence`),MiniGantt.prototype.publish(`orientation`,`horizontal`,`set`,`orientation`,[`horizontal`,`vertical`]),MiniGantt.prototype.publish(`rangeFontColor`,`#ecf0f1`,`html-color`,`rangeFontColor`),MiniGantt.prototype.publish(`titleColumn`,null,`string`,`titleColumn`),MiniGantt.prototype.publish(`startDateColumn`,null,`string`,`startDateColumn`),MiniGantt.prototype.publish(`endDateColumn`,null,`string`,`endDateColumn`),MiniGantt.prototype.publish(`iconColumn`,null,`string`,`iconColumn`),MiniGantt.prototype.publish(`colorColumn`,null,`string`,`colorColumn`),MiniGantt.prototype.publish(`yOffsetColumn`,null,`string`,`yOffsetColumn`),MiniGantt.prototype.publish(`maxZoom`,16,`number`,`maxZoom`),MiniGantt.prototype.publish(`eventGroupOffset`,-50,`number`,`eventGroupOffset`),MiniGantt.prototype.publish(`eventGroupMod`,5,`number`,`eventGroupMod`),MiniGantt.prototype.publish(`eventFontColorColumn`,null,`string`,`eventFontColorColumn`),MiniGantt.prototype.publish(`eventBorderColorColumn`,null,`string`,`eventBorderColorColumn`),MiniGantt.prototype.publish(`eventBackgroundColorColumn`,null,`string`,`eventBackgroundColorColumn`),MiniGantt.prototype.publish(`hideIconWhenCollapsed`,!1,`boolean`,`hideIconWhenCollapsed`),MiniGantt.prototype.publish(`hideTitleWhenCollapsed`,!1,`boolean`,`hideTitleWhenCollapsed`),MiniGantt.prototype.publish(`hideDescriptionWhenCollapsed`,!1,`boolean`,`hideDescriptionWhenCollapsed`),MiniGantt.prototype.publish(`hideAnnotationsWhenCollapsed`,!0,`boolean`,`hideAnnotationsWhenCollapsed`),MiniGantt.prototype.publish(`centerOnMostRecent`,!1,`boolean`,`If true, the timeline will be centered on the most recent data point`);var ReactGantt=class extends r.SVGZoomWidget{_selection=new r.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(e=`origin`){super(),this._drawStartPos=e,this.showToolbar_default(!1),this._tooltip=new i.HTMLTooltip,this._tooltip.tooltipHTML(e=>`<div style="text-align:center;">${e[0]}<br/><br/>${e[1]} -> ${e[2]}</div>`),this._tooltip.followCursor(!0)}selection(e){return arguments.length?(this._selection.set(e),this):this._selection.get()}_rangeRenderer=a.LabelledRect;rangeRenderer(e){return arguments.length&&(this._rangeRenderer=e),this._rangeRenderer}enter(e,t){super.enter(e,t);let n=this;t.on(`click`,function(e){n._selection.clear()}),this._tooltip.target(e)}update(e,t){super.update(e,t),this.zoomExtent([.05,this.maxZoom()]),this._title_idx=this.titleColumn()===null?this._title_idx:this.columns().indexOf(this.titleColumn()),this._startDate_idx=this.startDateColumn()===null?this._startDate_idx:this.columns().indexOf(this.startDateColumn()),this._endDate_idx=this.endDateColumn()===null?this._endDate_idx:this.columns().indexOf(this.endDateColumn()),this._icon_idx=this.iconColumn()===null?this._icon_idx:this.columns().indexOf(this.iconColumn()),this._color_idx=this.colorColumn()===null?this._color_idx:this.columns().indexOf(this.colorColumn()),this._series_idx=this.seriesColumn()===null?this._series_idx:this.columns().indexOf(this.seriesColumn()),this._bucket_idx=this.bucketColumn()===null?-1:this.columns().indexOf(this.bucketColumn());let n=this,i=this.width(),a=i;if(this._interpolateX=(0,r.scaleLinear)().domain([this._minStart,this._maxEnd]).range([0,a]),this.data().sort((e,t)=>e[1]-t[1]),this._series_idx>-1){this._origIdxMap={},this._dataBySeries={},this._bucketsBySeries={},this.data().forEach((e,t)=>{let n=e[this._series_idx];this._dataBySeries[n]||(this._origIdxMap[n]={},this._dataBySeries[n]=[]),this._dataBySeries[n].push({dataRow:e,origIdx:t})});let e=this.gutter(),t=0,a=Object.keys(this._dataBySeries);a.forEach(e=>{this._dataBySeries[e].sort((e,t)=>e.dataRow[1]-t.dataRow[1]),this._bucketsBySeries[e]=this.calcBuckets(this._dataBySeries[e].map(e=>e.dataRow),1,2),this._bucketsBySeries[e].bucketHeight=this.bucketHeight(),this._bucketsBySeries[e].bucketOffset=t,t+=(this._bucketsBySeries[e].bucketHeight+this.strokeWidth()+this.gutter())*(this._bucketsBySeries[e].maxBucket+1),this._dataBySeries[e].forEach((t,n)=>{this._origIdxMap[e][t.origIdx]=n})}),this._seriesBackgrounds=this._renderElement.selectAll(`.series-background`).data(a.map(e=>this._bucketsBySeries[e])),this._seriesBackgrounds.join(e=>e.append(`rect`).attr(`class`,`series-background`),e=>e,e=>e.each(function(e){delete e.element}).remove()).attr(`opacity`,e=>e.props&&e.props.hidden?0:1).each(function(t,a){(0,r.select)(this).attr(`x`,0).attr(`y`,t.bucketOffset-e/2).attr(`width`,i).attr(`height`,(t.bucketHeight+e)*(t.maxBucket+1)+e).attr(`fill`,a%2?n.oddSeriesBackground():n.evenSeriesBackground())})}else this._bucket_idx===-1?this._buckets=this.calcBuckets(this.data(),this._startDate_idx,this._endDate_idx):this._buckets=this.calcBuckets(this.data(),this._startDate_idx,this._endDate_idx,this._bucket_idx);if(!this.preserveZoom()||!this._prevZoomState){let e=this._interpolateX(this._minStart);this.zoomTo([e,0],1)}let o=this.bucketHeight();this.setRangeOptions(),this._maxFontScale=o-this.rangePadding()*2,this.measureDataText();let s=this._renderElement.selectAll(`.item`).data(this.data()),c=this.strokeWidth(),l=c*2;if(s.join(e=>e.append(`g`).attr(`class`,`item`).on(`click.selectionBag`,function(e,t){let i=e.id===void 0?t:e.id;n._selection.isSelected({_id:i,element:e.element})?n._selection.clear():n._selection.click({_id:i,element:()=>e.element},r.d3Event),n.selectionChanged(),(0,r.d3Event)().stopPropagation()}).on(`click`,function(e){let t=e.element.classed(`selected`);e[n.columns().length]&&(e.__lparam=e[n.columns().length]),n.click(e,``,t)}).on(`dblclick`,function(e){let t=e.element.classed(`selected`);e[n.columns().length]&&(e.__lparam=e[n.columns().length]),n.click(e,``,t)}).on(`mousein`,function(e){n.highlightItem((0,r.select)(this),e);let t=e.element.classed(`selected`);n.mousein(e,``,t)}).on(`mouseover`,function(e){let t=(0,r.d3Event)();n._tooltip._triggerElement=e.element,n._tooltip._cursorLoc=[t.clientX,t.clientY],n._tooltip.data(e).visible(!0).fitContent(!0).render(),n.highlightItem((0,r.select)(this),e);let i=e.element.classed(`selected`);n.mouseover(e,``,i)}).on(`mouseout`,function(e){n._tooltip.visible(!1).render(),n.highlightItem(null,null);let t=e.element.classed(`selected`);n.mouseout(e,``,t)}).each(function(e,t){e.that=this,e.element=(0,r.select)(this),e.x=n._interpolateX(e[1]);let i=n._interpolateX(e[2]);if(n._series_idx>-1){let r=e[n._series_idx],i=n._bucketsBySeries[r].bucketMap[n._origIdxMap[r][t]];e.y=n._bucketsBySeries[r].interpolateY(i)+n._bucketsBySeries[r].bucketOffset}else{let r=n._bucket_idx===-1?t:e[n._bucket_idx];e.y=n._buckets.interpolateY(n._buckets.bucketMap[r])}e.props={...e[3],text:e[0]},e.props.width=i-e.x,e.props.height=o,e.x+=c,e.y+=c,e.props.width-=l,e.props.height-=l,e.element.attr(`transform`,`translate(${e.x+e.props.width/2} ${e.y+e.props.height/2})`)}),e=>e,e=>e.each(function(e){delete e.element}).remove()).attr(`opacity`,e=>e.props&&e.props.hidden?0:1).each(function(e,t){if(e.that=this,n._series_idx>-1){let r=e[n._series_idx];e.x=n.renderRangeElement(e,t,!1,n._rangeOptions,r)}else e.x=n.renderRangeElement(e,t,!1,n._rangeOptions)}).on(`dblclick.zoom`,e=>{let t=this._interpolateX(e[1]),n=i/(this._interpolateX(e[2])-t);this.zoomTo([-t*n,0],n)}),t.on(`dblclick.zoom`,null),this.preserveZoom()&&this._prevZoomState&&this._interpolateX){let e=this.width();if(e>0){let t=this._minStart,n=this._maxEnd,r=Math.max(t,Math.min(n,this._prevZoomState.visibleStart)),i=Math.max(t,Math.min(n,this._prevZoomState.visibleEnd));if(i<=r){let e=(n-t)*1e-6||1e-6;i=Math.min(n,r+e)}let a=this._interpolateX(r),o=this._interpolateX(i),s=o-a;if(isFinite(s)&&Math.abs(s)>1e-9){let r=e/s,i=this.maxZoom(),c=Math.max(.05,Math.min(i,r));if(c>0&&isFinite(c)){let r=(a+o)/2,i=e/(2*c),s=this._interpolateX(t),l=this._interpolateX(n),u=r;u-i<s&&(u=s+i),u+i>l&&(u=l-i);let d=e/2-c*u;isFinite(d)&&this.zoomTo([d,0],c)}}}}}exit(e,t){this._tooltip.target(null),super.exit(e,t)}renderRangeElement(e,t,n=!1,i={},o){let s=i.strokeWidth,c=s*2,l=i.rangePadding,u,d=isNaN(this._transform.x)?0:this._transform.x,f=isNaN(this._transform.k)?1:this._transform.k,p,m=this.bucketHeight();e.that.setAttribute(`data-series`,o),this._color_idx>-1&&e.that.setAttribute(`data-color`,e[this._color_idx]),o===void 0?(p=this._buckets.bucketMap[t],e.y=this._buckets.interpolateY(p)):(p=this._bucketsBySeries[o].bucketMap[this._origIdxMap[o][t]],e.that.setAttribute(`data-b`,p),e.that.setAttribute(`data-bucketOffset`,this._bucketsBySeries[o].bucketOffset),e.y=this._bucketsBySeries[o].interpolateY(p)+this._bucketsBySeries[o].bucketOffset,e.that.setAttribute(`data-dy`,e.y)),this._color_idx>-1&&(i.fill=e[this._color_idx]),n?(e.x=this._interpolateX(e[1])*f,u=this._interpolateX(e[2])*f,e.props={...e[3],text:e[0]},e.props.width=(u-e.x)/f,e.x+=d,e.props.width*=f):(e.x=this._interpolateX(e[1]),u=this._interpolateX(e[2]),e.props={...e[3],text:e[0]},e.props.width=(u-e.x)/f),e.props.height=m,o===void 0&&this._buckets.bucketScale<1&&(e.props.height=this._buckets.bucketScale*m),e.element===void 0&&e.that&&(e.element=(0,r.select)(e.that)),e.element.attr(`transform`,`translate(${e.x+e.props.width/2} ${e.y+e.props.height/2})`),e.x+=s,e.y+=s,e.props.width-=c,e.props.height-=c,e.props.width=e.props.width<1?1:e.props.width,e.props.height=e.props.height<1?1:e.props.height;let h=this.truncateText(e.props.text,e.props.width-l,this._maxFontScale);h===e.props.text?e.props.fontSize=this._maxFontScale*i.fontSize:h=this.truncateText(e.props.text,e.props.width-l),o===void 0&&this._buckets.bucketScale<1&&(e.props.fontSize=Math.min(this._maxFontScale,this._buckets.bucketScale)*i.fontSize),(!this._maxY||this._maxY<e.y+e.props.height)&&(this._maxY=e.y+e.props.height),(!this._maxX||this._maxX<e.x+e.props.width)&&(this._maxX=e.x+e.props.width),(0,a.render)(this._rangeRenderer,{...i,...e.props,text:h},e.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(e){if(this._transform=e,this._interpolateX&&typeof this._interpolateX.invert==`function`){let t=this.width();if(t>0&&isFinite(e.k)&&e.k!==0){let n=(0-e.x)/e.k,r=(t-e.x)/e.k,i=this._interpolateX.invert(n),a=this._interpolateX.invert(r);if(isFinite(i)&&isFinite(a)){if(i>a){let e=i;i=a,a=e}this._prevZoomState={visibleStart:i,visibleEnd:a}}}}switch(this.renderMode()){case`scale-all`:this._zoomScale=e.k,this._zoomTranslate=[e.x,0],this._zoomG.attr(`transform`,`translate(${e.x} 0)scale(${e.k} 1)`);break;default:let t=this._rangeOptions;this.data().forEach((e,n)=>{if(this._color_idx>-1&&(t.fill=e[this._color_idx]),this._series_idx>-1){let r=e[this._series_idx];this.renderRangeElement(e,n,!0,t,r)}else this.renderRangeElement(e,n,!0,t)})}this.zoomedHook(e)}zoomedHook(e){}calcBuckets(e,t,n,i){let a={},o={},s=this.overlapTolerence(),c=[{end:-1/0}],l=0;i===void 0?e.forEach((e,r)=>{for(let i=0;i<c.length;++i)if(r===0||c[i][n]+s<=e[t]){a[r]=i,l<i&&(l=i),c[i][n]=e[n];break}if(a[r]===void 0){a[r]=c.length;let t={};t[n]=e[n],c.push(t)}l<a[r]&&(l=a[r])}):(e.forEach((e,t)=>{a[t]=e[i],o[e[i]]=!0}),l=Object.keys(o).length);let u=(l+1)*(this.bucketHeight()+this.gutter());return{bucketMap:a,maxBucket:l,bucketScale:this.height()/u,interpolateY:(0,r.scaleLinear)().domain([0,l+1]).range([0,Math.min(this.height(),u)])}}data(e){let t=super.data.apply(this,arguments);return arguments.length>0&&(this._minStart=Math.min(...this.data().map(e=>e[1]))??0,this._maxEnd=Math.max(...this.data().map(e=>e[2]))??1,this.measureDataText(!0)),t}_textWidths;_maxFontScale;_characterWidths;_prevFontFamily;_prevFontSize;measureDataText(e=!1){let t={},n={},i=this.fontFamily(),a=this.fontSize(),o=this.bucketHeight();o&&(this._maxFontScale=(o-this.rangePadding()*2)/a),(e||this._prevFontFamily!==i||this._prevFontSize!==a)&&(n[`.`]=r.Utility.textSize(`.`,i,a).width,this.data().forEach(e=>{t[e[0]]||(t[e[0]]=r.Utility.textSize(e[0],i,a).width),e[0].split(``).forEach(e=>{n[e]||(n[e]=r.Utility.textSize(e,i,a).width)})}),this._textWidths=t,this._characterWidths=n),this._prevFontFamily=i,this._prevFontSize=a}truncateText(e,t,n=1){if(this._textWidths[e]*n<t)return e;let r=``,i=0,a=t-this._characterWidths[`.`]*3;for(let t of e)if(i+=this._characterWidths[t],i<a)r+=t;else break;return a<0?``:r+`...`}resize(e){let t;return t=this.fitWidthToContent()||this.fitHeightToContent()?super.resize.call(this,{width:e.width,height:Math.max(this._maxY??0,e?.height??0)}):super.resize.apply(this,arguments),t}selectionChanged(){}highlightItem(e,t){}click(e,t,n){}dblclick(e,t,n){}mousein(e,t,n){}mouseover(e,t,n){}mouseout(e,t,n){}};ReactGantt.prototype._class+=` timeline_ReactGantt`,ReactGantt.prototype.publish(`fitWidthToContent`,!1,`boolean`,`If true, resize will simply reapply the bounding box width`),ReactGantt.prototype.publish(`fitHeightToContent`,!1,`boolean`,`If true, resize will simply reapply the bounding box height`),ReactGantt.prototype.publish(`preserveZoom`,!1,`boolean`,`If true, maintain zoom level when data is updated`),ReactGantt.prototype.publish(`titleColumn`,null,`string`,`Column name to for the title`),ReactGantt.prototype.publish(`startDateColumn`,null,`string`,`Column name to for the start date`),ReactGantt.prototype.publish(`endDateColumn`,null,`string`,`Column name to for the end date`),ReactGantt.prototype.publish(`iconColumn`,null,`string`,`Column name to for the icon`),ReactGantt.prototype.publish(`colorColumn`,null,`string`,`Column name to for the color`),ReactGantt.prototype.publish(`seriesColumn`,null,`string`,`Column name to for the series identifier`),ReactGantt.prototype.publish(`bucketColumn`,null,`string`,`Column name to for the bucket identifier`),ReactGantt.prototype.publish(`renderMode`,`default`,`set`,`Render modes vary in features and performance`,[`default`,`scale-all`]),ReactGantt.prototype.publish(`rangePadding`,3,`number`,`Padding within each range rectangle (pixels)`),ReactGantt.prototype.publish(`fill`,`#1f77b4`,`string`,`Background color of range rectangle`),ReactGantt.prototype.publish(`stroke`,null,`string`,`Color of range rectangle border`),ReactGantt.prototype.publish(`strokeWidth`,null,`number`,`Width of range rectangle border (pixels)`),ReactGantt.prototype.publish(`cornerRadius`,3,`number`,`Space between range buckets (pixels)`),ReactGantt.prototype.publish(`fontFamily`,null,`string`,`Font family within range rectangle`,null,{optional:!0}),ReactGantt.prototype.publish(`fontSize`,10,`number`,`Size of font within range rectangle (pixels)`),ReactGantt.prototype.publish(`rangeFontColor`,`#ecf0f1`,`html-color`,`rangeFontColor`),ReactGantt.prototype.publish(`overlapTolerence`,2,`number`,`overlapTolerence`),ReactGantt.prototype.publish(`smallestRangeWidth`,10,`number`,`Width of the shortest range (pixels)`),ReactGantt.prototype.publish(`bucketHeight`,100,`number`,`Max height of range element (pixels)`),ReactGantt.prototype.publish(`gutter`,2,`number`,`Space between range buckets (pixels)`),ReactGantt.prototype.publish(`maxZoom`,16,`number`,`Maximum zoom`),ReactGantt.prototype.publish(`evenSeriesBackground`,`#FFFFFF`,`html-color`,`Background color of even series rows`),ReactGantt.prototype.publish(`oddSeriesBackground`,`#DDDDDD`,`html-color`,`Background color of odd series rows`);var ReactAxisGantt=class extends r.SVGWidget{_topAxis=new n.Axis(`center`).orientation(`top`).type(`linear`).shrinkToFit(`none`).overlapMode(`hide`).extend(0).tickFormat(`d`);_gantt=new ReactGantt(`center`).stroke(`#000000`);_bottomAxis=new n.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(){let e=this._gantt.rangeRenderer.apply(this._gantt,arguments);return arguments.length?this:e}}selection(e){return arguments.length?(this._gantt.selection(e),this):this._gantt.selection()}resizeWrappers(){let e=this.width(),t=this.height(),n=this.axisHeight(),r=t-n*2,i=this.strokeWidth();this._topRect.attr(`height`,n).attr(`width`,e).attr(`fill`,`transparent`),this._topAxisElement.attr(`transform`,`translate(0 0)`),this._topAxis.resize({height:n,width:e}),this._contentRect.attr(`height`,r).attr(`width`,e).attr(`fill`,`transparent`),this._contentElement.attr(`transform`,`translate(0 ${n+i})`),this._gantt.resize({height:r,width:e}),this._bottomRect.attr(`height`,n).attr(`width`,e).attr(`fill`,`transparent`),this._bottomAxisElement.attr(`transform`,`translate(0 ${n+r+i})`),this._bottomAxis.resize({height:n,width:e})}enter(e,t){super.enter(e,t),this._gantt.click=(e,t,n)=>{this.click(e,t,n)},this._gantt.dblclick=(e,t,n)=>{this.dblclick(e,t,n)},this._topAxisElement=t.append(`g`).attr(`class`,`top-axis-wrapper`),this._topRect=this._topAxisElement.append(`rect`).attr(`class`,`top-axis-rect`),this._contentElement=t.append(`g`).attr(`class`,`content-wrapper`),this._contentRect=this._contentElement.append(`rect`).attr(`class`,`content-rect`),this._bottomAxisElement=t.append(`g`).attr(`class`,`bottom-axis-wrapper`),this._bottomRect=this._bottomAxisElement.append(`rect`).attr(`class`,`top-axis-rect`),this._topAxis.target(this._topAxisElement.node()),this._gantt.target(this._contentElement.node()).bucketHeight(30),this._bottomAxis.target(this._bottomAxisElement.node()),this.resizeWrappers(),this._gantt.zoomedHook=e=>{this.onzoom(e)}}onzoom(e){let t=this.width(),n=this._gantt._minStart,r=this._gantt._maxEnd-n,i=r/t,a=Math.floor(n-i*(e.x/e.k)),o=Math.ceil(r/e.k+a);this._topAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(a).high(o).render(),this._bottomAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(a).high(o).render()}update(e,t){super.update(e,t),this._topAxis.tickFormat(this.tickFormat()).render(),this._bottomAxis.tickFormat(this.tickFormat()).render(),this._gantt.render()}exit(e,t){this._bottomAxis.target(null),this._gantt.target(null),this._topAxis.target(null),super.exit(e,t)}columns(e){let t=super.columns.apply(this,arguments);return arguments.length>0&&this._gantt.columns(e),t}data(e){let t=super.data.apply(this,arguments);if(arguments.length>0){let e=this.data().map(e=>{let t=[...e];return t[1]=isNaN(e[1])?new Date(e[1]).getTime():Number(e[1]),t[2]=isNaN(e[2])?new Date(e[2]).getTime():Number(e[2]),t});this._gantt._minStart=Math.min(...e.map(e=>e[1]))??0,this._gantt._maxEnd=Math.max(...e.map(e=>e[2]))??1,this._gantt.data(e)}return t}resize(e){let t=super.resize.apply(this,arguments);return this._topAxisElement&&this.resizeWrappers(),t}click(e,t,n){}dblclick(e,t,n){}tooltip(){return this._gantt._tooltip}};ReactAxisGantt.prototype._class+=` timeline_ReactAxisGantt`,ReactAxisGantt.prototype.publish(`tickFormat`,null,`string`,`Format rule applied to axis tick labels`,void 0,{optional:!0}),ReactAxisGantt.prototype.publish(`axisHeight`,22,`number`,`Height of axes (pixels)`),ReactAxisGantt.prototype.publish(`overlapTolerence`,2,`number`,`overlapTolerence`),ReactAxisGantt.prototype.publish(`smallestRangeWidth`,10,`number`,`Width of the shortest range (pixels)`),ReactAxisGantt.prototype.publish(`axisFontSize`,null,`number`,`Font size of axis tick labels`),ReactAxisGantt.prototype.publish(`axisFontFamily`,null,`string`,`Font family of axis tick labels`),ReactAxisGantt.prototype.publish(`axisTickLength`,null,`number`,`Length of axis ticks`),ReactAxisGantt.prototype.publishProxy(`gutter`,`_gantt`),ReactAxisGantt.prototype.publishProxy(`renderMode`,`_gantt`),ReactAxisGantt.prototype.publishProxy(`strokeWidth`,`_gantt`),ReactAxisGantt.prototype.publishProxy(`fontSize`,`_gantt`),ReactAxisGantt.prototype.publishProxy(`fontFamily`,`_gantt`),ReactAxisGantt.prototype.publishProxy(`stroke`,`_gantt`),ReactAxisGantt.prototype.publishProxy(`cornerRadius`,`_gantt`),ReactAxisGantt.prototype.publishProxy(`titleColumn`,`_gantt`),ReactAxisGantt.prototype.publishProxy(`startDateColumn`,`_gantt`),ReactAxisGantt.prototype.publishProxy(`endDateColumn`,`_gantt`),ReactAxisGantt.prototype.publishProxy(`iconColumn`,`_gantt`),ReactAxisGantt.prototype.publishProxy(`colorColumn`,`_gantt`),ReactAxisGantt.prototype.publishProxy(`bucketColumn`,`_gantt`),ReactAxisGantt.prototype.publishProxy(`maxZoom`,`_gantt`),ReactAxisGantt.prototype.publishProxy(`bucketHeight`,`_gantt`);var ReactAxisGanttSeries=class extends o.Border2{_topAxis=new n.Axis(`origin`).orientation(`top`).type(`linear`).shrinkToFit(`none`).overlapMode(`hide`).extend(0).tickFormat(`d`);_gantt=new ReactGantt(`origin`).stroke(`#000000`).fitHeightToContent(!0);_bottomAxis=new n.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(e){return arguments.length?(this._gantt.selection(e),this):this._gantt.selection()}rangeRenderer(e){let t=this._gantt.rangeRenderer.apply(this._gantt,arguments);return arguments.length?this:t}resizeWrappers(){let e=this.width(),t=this.height(),n=this.axisHeight(),r=t-n*2;this.bottomHeight(n),this._topWA.resize({width:e,height:n}),this._centerWA.resize({width:e,height:r}),this._bottomWA.resize({width:e,height:n}),this.top().render(),this.bottom().render(),this.center().render()}enter(e,t){super.enter(e,t),this._gantt.click=(e,t,n)=>{this.click(e,t,n)},this._gantt.dblclick=(e,t,n)=>{this.dblclick(e,t,n)},this.top(this._topAxis),this.center(this._gantt),this.bottom(this._bottomAxis),this.resizeWrappers(),this._gantt.zoomedHook=e=>{this.onzoom(e)}}onzoom(e){let t=this.width(),n=this._gantt._minStart,r=this._gantt._maxEnd-n,i=r/t,a=Math.floor(n-i*(e.x/e.k)),o=Math.ceil(r/e.k+a);this._topAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(a).high(o).lazyRender(),this._bottomAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(a).high(o).lazyRender()}update(e,t){super.update(e,t),this._topAxis.tickFormat(this.tickFormat()).render(),this._bottomAxis.tickFormat(this.tickFormat()).render(),this._gantt.render()}columns(e){let t=super.columns.apply(this,arguments);return arguments.length>0&&this._gantt.columns(e),t}data(e){let t=super.data.apply(this,arguments);if(arguments.length>0){let e=this.data().map(e=>{let t=[...e];return t[1]=isNaN(e[1])?new Date(e[1]).getTime():Number(e[1]),t[2]=isNaN(e[2])?new Date(e[2]).getTime():Number(e[2]),t});this._gantt._minStart=(0,r.min)(e,e=>e[1]),this._gantt._maxEnd=(0,r.max)(e,e=>e[2]),this._gantt.data(e)}return t}resize(e){let t=super.resize.apply(this,arguments);return this._topAxisElement&&this.resizeWrappers(),t}click(e,t,n){}dblclick(e,t,n){}tooltip(){return this._gantt._tooltip}};ReactAxisGanttSeries.prototype._class+=` timeline_ReactAxisGanttSeries`,ReactAxisGanttSeries.prototype.publish(`tickFormat`,null,`string`,`Format rule applied to axis tick labels`,void 0,{optional:!0}),ReactAxisGanttSeries.prototype.publish(`axisHeight`,22,`number`,`Height of axes (pixels)`),ReactAxisGanttSeries.prototype.publish(`overlapTolerence`,2,`number`,`overlapTolerence`),ReactAxisGanttSeries.prototype.publish(`smallestRangeWidth`,10,`number`,`Width of the shortest range (pixels)`),ReactAxisGanttSeries.prototype.publish(`axisFontSize`,null,`number`,`Font size of axis tick labels`),ReactAxisGanttSeries.prototype.publish(`axisFontFamily`,null,`string`,`Font family of axis tick labels`),ReactAxisGanttSeries.prototype.publish(`axisTickLength`,null,`number`,`Length of axis ticks`),ReactAxisGanttSeries.prototype.publishProxy(`gutter`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`renderMode`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`strokeWidth`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`fontSize`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`fontFamily`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`stroke`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`cornerRadius`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`titleColumn`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`startDateColumn`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`endDateColumn`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`iconColumn`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`colorColumn`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`seriesColumn`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`bucketColumn`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`maxZoom`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`preserveZoom`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`evenSeriesBackground`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`oddSeriesBackground`,`_gantt`),ReactAxisGanttSeries.prototype.publishProxy(`bucketHeight`,`_gantt`);var ReactTimeline=class extends ReactAxisGantt{_axisLabelFormatter;constructor(){super(),this._drawStartPos=`origin`,this._topAxis.type(`time`),this._bottomAxis.type(`time`),this.tooltipHTML(e=>{let t=(0,r.timeParse)(`%Q`),n=t(e[1]),i=t(e[2]),a=(0,r.timeFormat)(this.tooltipTimeFormat());return`<div style="text-align:center;">${e[0]}<br/><br/>${a(n)} -> ${a(i)}</div>`})}update(e,t){if(super.update(e,t),this.timePattern_exists()){let e=1/0,t=-1/0,n=``,r=``;this.data().map(i=>{let a=new Date(i[1]).getTime(),o=new Date(i[2]).getTime();e>a&&(e=a,n=``+i[1]),t<o&&(t=o,r=``+i[2])});let i=this._axisLabelFormatter?this._axisLabelFormatter:this.tickFormat_exists&&this.tickFormat_exists()?this.tickFormat():void 0;this._topAxis.type(`time`).timePattern(this.timePattern()).overlapMode(`none`).low(n).high(r),this._bottomAxis.type(`time`).timePattern(this.timePattern()).overlapMode(`none`).low(n).high(r),i?(this._topAxis.tickFormat(i),this._bottomAxis.tickFormat(i)):(this._topAxis.tickFormat_reset(),this._bottomAxis.tickFormat_reset()),this._gantt._minStart=e,this._gantt._maxEnd=t}}tooltipHTML(e){return this._tooltipHTML=e,this.tooltip().tooltipHTML(this._tooltipHTML),this}parseAxisValue(e){let t=(0,r.timeParse)(`%Q`)(e);return(0,r.timeFormat)(this.timePattern())(t)}onzoom(e){let t=this.width(),n=this._gantt._minStart,r=this._gantt._maxEnd-n,i=r/t,a=Math.floor(n-i*(e.x/e.k)),o=Math.ceil(r/e.k+a);this._topAxis.low(this.parseAxisValue(a)).high(this.parseAxisValue(o)).render(),this._bottomAxis.low(this.parseAxisValue(a)).high(this.parseAxisValue(o)).render()}};ReactTimeline.prototype._class+=` timeline_ReactTimeline`,ReactTimeline.prototype.publish(`timePattern`,`%Y-%m-%d`,`string`,`Time pattern used for parsing datetime strings on each data row`,null,{optional:!0}),ReactTimeline.prototype.publish(`tooltipTimeFormat`,`%Y-%m-%d`,`string`,`Time format used in the default html tooltip`);var u=(0,r.timeParse)(`%Q`),ReactTimelineSeries=class extends ReactAxisGanttSeries{_axisLabelFormatter;constructor(){super(),this._topAxis.type(`time`),this._bottomAxis.type(`time`),this.tooltipHTML(e=>{let t=u(e[1]),n=u(e[2]),i=(0,r.timeFormat)(this.tooltipTimeFormat());return`<div style="text-align:center;">${e[0]}<br/><br/>${i(t)} -> ${i(n)}</div>`})}update(e,t){if(super.update(e,t),this.timePattern_exists()){let e=1/0,t=-1/0,n=``,r=``;this.data().forEach(i=>{let a=new Date(i[1]).getTime(),o=new Date(i[2]).getTime();e>a&&(e=a,n=``+i[1]),t<o&&(t=o,r=``+i[2])});let i=this._axisLabelFormatter?this._axisLabelFormatter:this.tickFormat_exists&&this.tickFormat_exists()?this.tickFormat():void 0;this._topAxis.type(`time`).timePattern(this.timePattern()).overlapMode(`none`).low(n).high(r),this._bottomAxis.type(`time`).timePattern(this.timePattern()).overlapMode(`none`).low(n).high(r),i?(this._topAxis.tickFormat(i),this._bottomAxis.tickFormat(i)):(this._topAxis.tickFormat_reset(),this._bottomAxis.tickFormat_reset()),this._gantt._minStart=e,this._gantt._maxEnd=t}}tickFormatFunc(e){return arguments.length?(this._axisLabelFormatter=e,this._topAxis.tickFormatFunc(e),this._bottomAxis.tickFormatFunc(e),this):this._axisLabelFormatter}tooltipHTML(e){return this._tooltipHTML=e,this.tooltip().tooltipHTML(this._tooltipHTML),this}parseAxisValue(e){let t=u(e);return(0,r.timeFormat)(this.timePattern())(t)}onzoom(e){let t=this.width(),n=this._gantt._minStart,r=this._gantt._maxEnd-n,i=r/t,a=Math.floor(n-i*(e.x/e.k)),o=Math.ceil(r/e.k+a);this._topAxis.low(this.parseAxisValue(a)).high(this.parseAxisValue(o)).render(),this._bottomAxis.low(this.parseAxisValue(a)).high(this.parseAxisValue(o)).render()}_tooltipHTML};ReactTimelineSeries.prototype._class+=` timeline_ReactTimelineSeries`,ReactTimelineSeries.prototype.publish(`timePattern`,`%Y-%m-%d`,`string`,`Time pattern used for parsing datetime strings on each data row`,null,{optional:!0}),ReactTimelineSeries.prototype.publish(`tooltipTimeFormat`,`%Y-%m-%d`,`string`,`Time format used in the default html tooltip`),e.BUILD_VERSION=l,e.MiniGantt=MiniGantt,e.PKG_NAME=s,e.PKG_VERSION=c,e.ReactAxisGantt=ReactAxisGantt,e.ReactAxisGanttSeries=ReactAxisGanttSeries,e.ReactGantt=ReactGantt,e.ReactTimeline=ReactTimeline,e.ReactTimelineSeries=ReactTimelineSeries});
|
|
2
2
|
//# sourceMappingURL=index.umd.cjs.map
|
|
3
|
-
|
|
3
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.timeline_MiniGantt .line{fill:none;stroke:#d3d3d3;opacity:.7}.timeline_MiniGantt .common_TextBox .rect{fill:#87cefa;stroke:#00f;opacity:.5}.timeline_MiniGantt .buckets .entity_shape rect{stroke:#333}.timeline_MiniGantt .buckets.selected .common_EntityRect .common_Shape>rect{stroke:red}.timeline_MiniGantt .common_TextBox .rect text{fill:#000;stroke:none}.timeline_MiniGantt .over{stroke:#0000;opacity:.8}.timeline_MiniGantt rect{shape-rendering:crispedges}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|