@hpcc-js/timeline 3.5.1 → 3.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { HTMLTooltip as y } from "@hpcc-js/html";
5
5
  import { LabelledRect as b, render as x } from "@hpcc-js/react";
6
6
  import { Border2 as S } from "@hpcc-js/layout";
7
7
  //#region \0rolldown/runtime.js
8
- var C = "@hpcc-js/timeline", w = "3.5.1", T = "3.26.1", MiniGantt = class extends i {
8
+ var C = "@hpcc-js/timeline", w = "3.5.2", T = "3.27.0", MiniGantt = class extends i {
9
9
  tlAxis;
10
10
  brAxis;
11
11
  verticalBands;
@@ -1,3 +1,3 @@
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.5.1`,l=`3.26.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]} -&gt; ${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)} -&gt; ${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)} -&gt; ${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});
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.5.2`,l=`3.27.0`,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]} -&gt; ${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)} -&gt; ${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)} -&gt; ${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)}})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hpcc-js/timeline",
3
- "version": "3.5.1",
3
+ "version": "3.5.2",
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.5.1",
43
- "@hpcc-js/chart": "^3.8.1",
44
- "@hpcc-js/common": "^3.8.1",
45
- "@hpcc-js/html": "^3.4.1",
46
- "@hpcc-js/layout": "^3.6.1",
47
- "@hpcc-js/react": "^3.5.1"
42
+ "@hpcc-js/api": "^3.5.2",
43
+ "@hpcc-js/chart": "^3.8.2",
44
+ "@hpcc-js/common": "^3.8.2",
45
+ "@hpcc-js/html": "^3.4.2",
46
+ "@hpcc-js/layout": "^3.6.2",
47
+ "@hpcc-js/react": "^3.5.2"
48
48
  },
49
49
  "devDependencies": {
50
- "@hpcc-js/esbuild-plugins": "^1.9.1",
50
+ "@hpcc-js/esbuild-plugins": "^1.9.2",
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": "0cfcae9b4ccbd0b3c9f21381f4581bf121392585"
68
+ "gitHead": "9d31241482c78decca86e3bf624244ce5b40f3d6"
69
69
  }