@hpcc-js/timeline 2.52.1 → 2.53.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hpcc-js/timeline",
3
- "version": "2.52.1",
3
+ "version": "2.53.0",
4
4
  "description": "hpcc-js - Viz Timeline",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es6",
@@ -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": "ac825f8d94e3b16ecb4cf74fa92bba3ea7a84ae4"
68
+ "gitHead": "fa253060b25b42e0b8b6ae145d7c3a35bb3788e9"
69
69
  }
@@ -2,7 +2,7 @@ import { Axis } from "@hpcc-js/chart";
2
2
  import { SVGWidget } from "@hpcc-js/common";
3
3
  import { ReactGantt } from "./ReactGantt";
4
4
 
5
- export type IAxisGanttData = [ string, number | string, number | string, any? ] | any[];
5
+ export type IAxisGanttData = [string, number | string, number | string, any?] | any[];
6
6
 
7
7
  export class ReactAxisGantt extends SVGWidget {
8
8
 
@@ -25,7 +25,7 @@ export class ReactAxisGantt extends SVGWidget {
25
25
  .extend(0)
26
26
  .tickFormat("d")
27
27
  ;
28
-
28
+
29
29
  protected _topAxisElement;
30
30
  protected _contentElement;
31
31
  protected _bottomAxisElement;
@@ -35,23 +35,31 @@ export class ReactAxisGantt extends SVGWidget {
35
35
 
36
36
  protected rangeRenderer;
37
37
 
38
- constructor(){
38
+ constructor() {
39
39
  super();
40
40
  this._drawStartPos = "origin";
41
41
  this.rangeRenderer = function () {
42
42
  const ret = this._gantt.rangeRenderer.apply(this._gantt, arguments);
43
- if(!arguments.length)return ret;
43
+ if (!arguments.length) return ret;
44
44
  return this;
45
45
  };
46
46
  }
47
47
 
48
+ selection(_: any[]): this;
49
+ selection(): any[];
50
+ selection(_?: any[]): any[] | this {
51
+ if (!arguments.length) return this._gantt.selection();
52
+ this._gantt.selection(_);
53
+ return this;
54
+ }
55
+
48
56
  resizeWrappers() {
49
57
 
50
58
  const w = this.width();
51
59
  const h = this.height();
52
60
 
53
61
  const axisHeight = this.axisHeight(); //TODO: Dynamic scaling to allow for small resolutions?
54
-
62
+
55
63
  const contentHeight = (h - (axisHeight * 2));
56
64
  const borderOffset1 = this.strokeWidth();
57
65
  this._topRect
@@ -60,24 +68,24 @@ export class ReactAxisGantt extends SVGWidget {
60
68
  .attr("fill", "transparent")
61
69
  ;
62
70
  this._topAxisElement.attr("transform", "translate(0 0)");
63
- this._topAxis.resize({height:axisHeight, width:w});
71
+ this._topAxis.resize({ height: axisHeight, width: w });
64
72
  this._contentRect
65
73
  .attr("height", contentHeight)
66
74
  .attr("width", w)
67
75
  .attr("fill", "transparent")
68
76
  ;
69
77
  this._contentElement.attr("transform", `translate(0 ${axisHeight + borderOffset1})`);
70
- this._gantt.resize({height:contentHeight, width:w});
78
+ this._gantt.resize({ height: contentHeight, width: w });
71
79
  this._bottomRect
72
80
  .attr("height", axisHeight)
73
81
  .attr("width", w)
74
82
  .attr("fill", "transparent")
75
83
  ;
76
84
  this._bottomAxisElement.attr("transform", `translate(0 ${axisHeight + contentHeight + borderOffset1})`);
77
- this._bottomAxis.resize({height:axisHeight, width:w});
85
+ this._bottomAxis.resize({ height: axisHeight, width: w });
78
86
  }
79
87
 
80
- enter(domNode, element){
88
+ enter(domNode, element) {
81
89
  super.enter(domNode, element);
82
90
 
83
91
  this._gantt.click = (row, col, sel) => {
@@ -145,7 +153,7 @@ export class ReactAxisGantt extends SVGWidget {
145
153
  ;
146
154
  }
147
155
 
148
- update(domNode, element){
156
+ update(domNode, element) {
149
157
  super.update(domNode, element);
150
158
  this._topAxis.tickFormat(this.tickFormat()).render();
151
159
  this._bottomAxis.tickFormat(this.tickFormat()).render();
@@ -156,7 +164,7 @@ export class ReactAxisGantt extends SVGWidget {
156
164
  columns(_: string[]): this;
157
165
  columns(_?: string[]): this | string[] {
158
166
  const retVal = super.columns.apply(this, arguments);
159
- if(arguments.length > 0) {
167
+ if (arguments.length > 0) {
160
168
  this._gantt.columns(_);
161
169
  }
162
170
  return retVal;
@@ -166,15 +174,15 @@ export class ReactAxisGantt extends SVGWidget {
166
174
  data(_: IAxisGanttData[]): this;
167
175
  data(_?: IAxisGanttData[]): this | IAxisGanttData[] {
168
176
  const retVal = super.data.apply(this, arguments);
169
- if(arguments.length > 0) {
170
- const ganttData: any[] = this.data().map(n=>{
177
+ if (arguments.length > 0) {
178
+ const ganttData: any[] = this.data().map(n => {
171
179
  const ret = [...n];
172
180
  ret[1] = isNaN(n[1] as any) ? new Date(n[1]).getTime() : Number(n[1]);
173
181
  ret[2] = isNaN(n[2] as any) ? new Date(n[2]).getTime() : Number(n[2]);
174
182
  return ret;
175
183
  });
176
- this._gantt._minStart = Math.min(...ganttData.map(n=>n[1])) ?? 0;
177
- this._gantt._maxEnd = Math.max(...ganttData.map(n=>n[2])) ?? 1;
184
+ this._gantt._minStart = Math.min(...ganttData.map(n => n[1])) ?? 0;
185
+ this._gantt._maxEnd = Math.max(...ganttData.map(n => n[2])) ?? 1;
178
186
  this._gantt.data(ganttData);
179
187
  }
180
188
  return retVal;
@@ -183,7 +191,7 @@ export class ReactAxisGantt extends SVGWidget {
183
191
  resize(_size?: { width: number, height: number }) {
184
192
  const retVal = super.resize.apply(this, arguments);
185
193
 
186
- if(this._topAxisElement){
194
+ if (this._topAxisElement) {
187
195
  this.resizeWrappers();
188
196
  }
189
197
 
@@ -195,9 +203,9 @@ export class ReactAxisGantt extends SVGWidget {
195
203
  }
196
204
 
197
205
  dblclick(row, col, sel) {
198
-
206
+
199
207
  }
200
-
208
+
201
209
  tooltip() {
202
210
  return this._gantt._tooltip;
203
211
  }
@@ -41,6 +41,14 @@ export class ReactAxisGanttSeries extends Border2 {
41
41
  this.centerOverflowY_default("auto");
42
42
  }
43
43
 
44
+ selection(_: any[]): this;
45
+ selection(): any[];
46
+ selection(_?: any[]): any[] | this {
47
+ if (!arguments.length) return this._gantt.selection();
48
+ this._gantt.selection(_);
49
+ return this;
50
+ }
51
+
44
52
  rangeRenderer(): React.FunctionComponent;
45
53
  rangeRenderer(_: React.FunctionComponent): this;
46
54
  rangeRenderer(_?: React.FunctionComponent): this | React.FunctionComponent {
package/src/ReactGantt.ts CHANGED
@@ -3,7 +3,7 @@ import { HTMLTooltip } from "@hpcc-js/html";
3
3
  import { scaleLinear as d3ScaleLinear } from "d3-scale";
4
4
  import { React, render, LabelledRect } from "@hpcc-js/react";
5
5
 
6
- export type IGanttData = [ string, number, number, any? ];
6
+ export type IGanttData = [string, number, number, any?];
7
7
 
8
8
  export interface IRangeOptions {
9
9
  rangePadding: number;
@@ -23,7 +23,7 @@ export class ReactGantt extends SVGZoomWidget {
23
23
  protected _buckets;
24
24
  protected _interpolateX;
25
25
  protected _interpolateY;
26
-
26
+
27
27
  protected _bucketsBySeries;
28
28
  protected _dataBySeries;
29
29
  protected _origIdxMap;
@@ -58,7 +58,7 @@ export class ReactGantt extends SVGZoomWidget {
58
58
  cornerRadius: 3,
59
59
  strokeWidth: 0
60
60
  };
61
-
61
+
62
62
  constructor(drawStartPosition: "origin" | "center" = "origin") {
63
63
  super();
64
64
  this._drawStartPos = drawStartPosition;
@@ -75,6 +75,14 @@ export class ReactGantt extends SVGZoomWidget {
75
75
  ;
76
76
  }
77
77
 
78
+ selection(_: any[]): this;
79
+ selection(): any[];
80
+ selection(_?: any[]): any[] | this {
81
+ if (!arguments.length) return this._selection.get();
82
+ this._selection.set(_);
83
+ return this;
84
+ }
85
+
78
86
  private _rangeRenderer: React.FunctionComponent = LabelledRect;
79
87
  rangeRenderer(): React.FunctionComponent;
80
88
  rangeRenderer(_: React.FunctionComponent): this;
@@ -84,7 +92,7 @@ export class ReactGantt extends SVGZoomWidget {
84
92
  return this._rangeRenderer;
85
93
  }
86
94
 
87
- enter(domNode, element){
95
+ enter(domNode, element) {
88
96
  super.enter(domNode, element);
89
97
 
90
98
  const context = this;
@@ -95,7 +103,7 @@ export class ReactGantt extends SVGZoomWidget {
95
103
 
96
104
  this._tooltip.target(domNode);
97
105
  }
98
- update(domNode, element){
106
+ update(domNode, element) {
99
107
  super.update(domNode, element);
100
108
 
101
109
  this.zoomExtent([0.05, this.maxZoom()]);
@@ -118,16 +126,16 @@ export class ReactGantt extends SVGZoomWidget {
118
126
  .domain([this._minStart, this._maxEnd])
119
127
  .range([x0, x1])
120
128
  ;
121
-
122
- this.data().sort((a, b)=>a[1]-b[1]);
123
-
124
- if(this._series_idx > -1) {
129
+
130
+ this.data().sort((a, b) => a[1] - b[1]);
131
+
132
+ if (this._series_idx > -1) {
125
133
  this._origIdxMap = {};
126
134
  this._dataBySeries = {};
127
135
  this._bucketsBySeries = {};
128
- this.data().forEach((dataRow, origIdx)=>{
136
+ this.data().forEach((dataRow, origIdx) => {
129
137
  const seriesKey = dataRow[this._series_idx];
130
- if(!this._dataBySeries[seriesKey]) {
138
+ if (!this._dataBySeries[seriesKey]) {
131
139
  this._origIdxMap[seriesKey] = {};
132
140
  this._dataBySeries[seriesKey] = [];
133
141
  }
@@ -139,18 +147,18 @@ export class ReactGantt extends SVGZoomWidget {
139
147
  const gutter = this.gutter();
140
148
  let bucketOffset = 0;
141
149
  const seriesKeys = Object.keys(this._dataBySeries);
142
- seriesKeys.forEach(seriesKey=>{
143
- this._dataBySeries[seriesKey].sort((a, b)=>a.dataRow[1]-b.dataRow[1]);
144
- this._bucketsBySeries[seriesKey] = this.calcBuckets(this._dataBySeries[seriesKey].map(n=>n.dataRow), 1, 2);
150
+ seriesKeys.forEach(seriesKey => {
151
+ this._dataBySeries[seriesKey].sort((a, b) => a.dataRow[1] - b.dataRow[1]);
152
+ this._bucketsBySeries[seriesKey] = this.calcBuckets(this._dataBySeries[seriesKey].map(n => n.dataRow), 1, 2);
145
153
  this._bucketsBySeries[seriesKey].bucketHeight = this.bucketHeight();
146
154
  this._bucketsBySeries[seriesKey].bucketOffset = bucketOffset;
147
- bucketOffset += (this._bucketsBySeries[seriesKey].bucketHeight + this.strokeWidth() + this.gutter()) * (this._bucketsBySeries[seriesKey].maxBucket+1);
155
+ bucketOffset += (this._bucketsBySeries[seriesKey].bucketHeight + this.strokeWidth() + this.gutter()) * (this._bucketsBySeries[seriesKey].maxBucket + 1);
148
156
  this._dataBySeries[seriesKey].forEach((n, i) => {
149
157
  this._origIdxMap[seriesKey][n.origIdx] = i;
150
158
  });
151
159
  });
152
160
  this._seriesBackgrounds = this._renderElement.selectAll(".series-background")
153
- .data(seriesKeys.map(key=>{
161
+ .data(seriesKeys.map(key => {
154
162
  return this._bucketsBySeries[key];
155
163
  }))
156
164
  ;
@@ -169,21 +177,21 @@ export class ReactGantt extends SVGZoomWidget {
169
177
  .each(function (this: SVGGElement, d, i) {
170
178
  d3Select(this)
171
179
  .attr("x", 0)
172
- .attr("y", d.bucketOffset - (gutter/2))
180
+ .attr("y", d.bucketOffset - (gutter / 2))
173
181
  .attr("width", w)
174
182
  .attr("height", ((d.bucketHeight + gutter) * (d.maxBucket + 1)) + gutter)
175
- .attr("fill", i%2 ? context.oddSeriesBackground() : context.evenSeriesBackground())
183
+ .attr("fill", i % 2 ? context.oddSeriesBackground() : context.evenSeriesBackground())
176
184
  ;
177
185
  });
178
186
  } else {
179
- if(this._bucket_idx !== -1){
187
+ if (this._bucket_idx !== -1) {
180
188
  this._buckets = this.calcBuckets(this.data(), this._startDate_idx, this._endDate_idx, this._bucket_idx);
181
189
  } else {
182
190
  this._buckets = this.calcBuckets(this.data(), this._startDate_idx, this._endDate_idx);
183
191
  }
184
192
  }
185
193
  const interpedStart = this._interpolateX(this._minStart);
186
-
194
+
187
195
  this.zoomTo(
188
196
  [interpedStart, 0],
189
197
  1
@@ -207,14 +215,14 @@ export class ReactGantt extends SVGZoomWidget {
207
215
  .attr("class", "item")
208
216
  .on("click.selectionBag", function (d, i) {
209
217
  const _id = d.id === undefined ? i : d.id;
210
- if(context._selection.isSelected({_id, element: d.element})){
218
+ if (context._selection.isSelected({ _id, element: d.element })) {
211
219
  context._selection.clear();
212
220
  } else {
213
221
  context._selection.click(
214
222
  {
215
223
  _id,
216
224
  element: () => d.element
217
- },
225
+ },
218
226
  d3Event
219
227
  );
220
228
  }
@@ -223,14 +231,14 @@ export class ReactGantt extends SVGZoomWidget {
223
231
  })
224
232
  .on("click", function (this: SVGElement, d) {
225
233
  const selected = d.element.classed("selected");
226
- if(d[context.columns().length]){
234
+ if (d[context.columns().length]) {
227
235
  d.__lparam = d[context.columns().length];
228
236
  }
229
237
  context.click(d, "", selected);
230
238
  })
231
239
  .on("dblclick", function (this: SVGElement, d) {
232
240
  const selected = d.element.classed("selected");
233
- if(d[context.columns().length]){
241
+ if (d[context.columns().length]) {
234
242
  d.__lparam = d[context.columns().length];
235
243
  }
236
244
  context.click(d, "", selected);
@@ -271,7 +279,7 @@ export class ReactGantt extends SVGZoomWidget {
271
279
  d.element = d3Select(this);
272
280
  d.x = context._interpolateX(d[1]);
273
281
  const endX = context._interpolateX(d[2]);
274
- if(context._series_idx > -1) {
282
+ if (context._series_idx > -1) {
275
283
  const seriesKey = d[context._series_idx];
276
284
  const bucket = context._bucketsBySeries[seriesKey].bucketMap[context._origIdxMap[seriesKey][i]];
277
285
  d.y = context._bucketsBySeries[seriesKey].interpolateY(bucket) + context._bucketsBySeries[seriesKey].bucketOffset;
@@ -279,7 +287,7 @@ export class ReactGantt extends SVGZoomWidget {
279
287
  const _i = context._bucket_idx === -1 ? i : d[context._bucket_idx];
280
288
  d.y = context._buckets.interpolateY(context._buckets.bucketMap[_i]);
281
289
  }
282
- d.props={
290
+ d.props = {
283
291
  ...d[3],
284
292
  text: d[0]
285
293
  };
@@ -289,7 +297,7 @@ export class ReactGantt extends SVGZoomWidget {
289
297
  d.y += borderOffset1;
290
298
  d.props.width -= borderOffset2;
291
299
  d.props.height -= borderOffset2;
292
- d.element.attr("transform", `translate(${d.x+(d.props.width/2)} ${d.y+(d.props.height/2)})`);
300
+ d.element.attr("transform", `translate(${d.x + (d.props.width / 2)} ${d.y + (d.props.height / 2)})`);
293
301
  }),
294
302
  update => update,
295
303
  exit => exit
@@ -301,7 +309,7 @@ export class ReactGantt extends SVGZoomWidget {
301
309
  .attr("opacity", d => d.props && d.props.hidden ? 0 : 1)
302
310
  .each(function (this: SVGGElement, d, i) {
303
311
  d.that = this;
304
- if(context._series_idx > -1){
312
+ if (context._series_idx > -1) {
305
313
  const seriesKey = d[context._series_idx];
306
314
  d.x = context.renderRangeElement(d, i, false, context._rangeOptions, seriesKey);
307
315
  } else {
@@ -322,7 +330,7 @@ export class ReactGantt extends SVGZoomWidget {
322
330
  );
323
331
  })
324
332
  ;
325
- element.on("dblclick.zoom", null);
333
+ element.on("dblclick.zoom", null);
326
334
  }
327
335
  renderRangeElement(d, i, transformEach = false, options: any = {}, seriesKey?: string) {
328
336
  const borderOffset1 = options.strokeWidth;
@@ -335,11 +343,11 @@ export class ReactGantt extends SVGZoomWidget {
335
343
  const bucketHeight = this.bucketHeight();
336
344
  d.that.setAttribute("data-series", seriesKey);
337
345
 
338
- if(this._color_idx > -1){
346
+ if (this._color_idx > -1) {
339
347
  d.that.setAttribute("data-color", d[this._color_idx]);
340
348
  }
341
-
342
- if(seriesKey !== undefined) {
349
+
350
+ if (seriesKey !== undefined) {
343
351
  b = this._bucketsBySeries[seriesKey].bucketMap[this._origIdxMap[seriesKey][i]];
344
352
  d.that.setAttribute("data-b", b);
345
353
  d.that.setAttribute("data-bucketOffset", this._bucketsBySeries[seriesKey].bucketOffset);
@@ -349,13 +357,13 @@ export class ReactGantt extends SVGZoomWidget {
349
357
  b = this._buckets.bucketMap[i];
350
358
  d.y = this._buckets.interpolateY(b);
351
359
  }
352
- if(this._color_idx > -1) {
360
+ if (this._color_idx > -1) {
353
361
  options.fill = d[this._color_idx];
354
362
  }
355
363
  if (!transformEach) {
356
364
  d.x = this._interpolateX(d[1]);
357
365
  endX = this._interpolateX(d[2]);
358
- d.props={
366
+ d.props = {
359
367
  ...d[3],
360
368
  text: d[0]
361
369
  };
@@ -363,23 +371,23 @@ export class ReactGantt extends SVGZoomWidget {
363
371
  } else {
364
372
  d.x = this._interpolateX(d[1]) * k;
365
373
  endX = this._interpolateX(d[2]) * k;
366
- d.props={
374
+ d.props = {
367
375
  ...d[3],
368
376
  text: d[0]
369
377
  };
370
- d.props.width = (endX - d.x)/k;
378
+ d.props.width = (endX - d.x) / k;
371
379
  d.x += x;
372
380
  d.props.width *= k;
373
381
  }
374
382
  d.props.height = bucketHeight;
375
- if(seriesKey === undefined && this._buckets.bucketScale < 1) {
383
+ if (seriesKey === undefined && this._buckets.bucketScale < 1) {
376
384
  d.props.height = this._buckets.bucketScale * bucketHeight;
377
385
  }
378
- if(d.element === undefined && d.that){
386
+ if (d.element === undefined && d.that) {
379
387
  d.element = d3Select(d.that);
380
388
  }
381
- d.element.attr("transform", `translate(${d.x+(d.props.width/2)} ${d.y+(d.props.height/2)})`);
382
-
389
+ d.element.attr("transform", `translate(${d.x + (d.props.width / 2)} ${d.y + (d.props.height / 2)})`);
390
+
383
391
  d.x += borderOffset1;
384
392
  d.y += borderOffset1;
385
393
  d.props.width -= borderOffset2;
@@ -388,19 +396,19 @@ export class ReactGantt extends SVGZoomWidget {
388
396
  d.props.height = d.props.height < 1 ? 1 : d.props.height;
389
397
 
390
398
  let text = this.truncateText(d.props.text, d.props.width - padding, this._maxFontScale);
391
-
392
- if(text !== d.props.text){
399
+
400
+ if (text !== d.props.text) {
393
401
  text = this.truncateText(d.props.text, d.props.width - padding);
394
402
  } else {
395
403
  d.props.fontSize = this._maxFontScale * options.fontSize;
396
404
  }
397
- if(seriesKey === undefined && this._buckets.bucketScale < 1) {
405
+ if (seriesKey === undefined && this._buckets.bucketScale < 1) {
398
406
  d.props.fontSize = Math.min(this._maxFontScale, this._buckets.bucketScale) * options.fontSize;
399
407
  }
400
- if(!this._maxY || this._maxY < d.y + d.props.height) {
408
+ if (!this._maxY || this._maxY < d.y + d.props.height) {
401
409
  this._maxY = d.y + d.props.height;
402
410
  }
403
- if(!this._maxX || this._maxX < d.x + d.props.width) {
411
+ if (!this._maxX || this._maxX < d.x + d.props.width) {
404
412
  this._maxX = d.x + d.props.width;
405
413
  }
406
414
  render(
@@ -414,7 +422,7 @@ export class ReactGantt extends SVGZoomWidget {
414
422
  );
415
423
  }
416
424
 
417
- setRangeOptions(){
425
+ setRangeOptions() {
418
426
  this._rangeOptions = {
419
427
  rangePadding: this.rangePadding(),
420
428
  fontFamily: this.fontFamily(),
@@ -426,23 +434,23 @@ export class ReactGantt extends SVGZoomWidget {
426
434
  cornerRadius: this.cornerRadius(),
427
435
  };
428
436
  }
429
-
430
- public _transform = {k:1, x:0, y:0};
437
+
438
+ public _transform = { k: 1, x: 0, y: 0 };
431
439
  zoomed(transform) {
432
440
  this._transform = transform;
433
- switch(this.renderMode()){
434
- case "scale-all":
441
+ switch (this.renderMode()) {
442
+ case "scale-all":
435
443
  this._zoomScale = transform.k;
436
444
  this._zoomTranslate = [transform.x, 0];
437
445
  this._zoomG.attr("transform", `translate(${transform.x} ${0})scale(${transform.k} 1)`);
438
446
  break;
439
447
  default:
440
448
  const options = this._rangeOptions;
441
- this.data().forEach((d, i)=>{
442
- if(this._color_idx > -1){
449
+ this.data().forEach((d, i) => {
450
+ if (this._color_idx > -1) {
443
451
  options.fill = d[this._color_idx];
444
452
  }
445
- if(this._series_idx > -1){
453
+ if (this._series_idx > -1) {
446
454
  const seriesKey = d[this._series_idx];
447
455
  this.renderRangeElement(d, i, true, options, seriesKey);
448
456
  } else {
@@ -462,41 +470,41 @@ export class ReactGantt extends SVGZoomWidget {
462
470
  const bucketMap = {};
463
471
  const bucketKeyMap = {};
464
472
  const tol = this.overlapTolerence();
465
- const buckets = [{end:-Infinity}];
473
+ const buckets = [{ end: -Infinity }];
466
474
  let maxBucket = 0;
467
- if(bucketKey !== undefined) {
468
- data.forEach((d, i)=>{
475
+ if (bucketKey !== undefined) {
476
+ data.forEach((d, i) => {
469
477
  bucketMap[i] = d[bucketKey];
470
478
  bucketKeyMap[d[bucketKey]] = true;
471
479
  });
472
480
  maxBucket = Object.keys(bucketKeyMap).length;
473
481
  } else {
474
- data.forEach((d, i)=>{
482
+ data.forEach((d, i) => {
475
483
  for (let i2 = 0; i2 < buckets.length; ++i2) {
476
484
  if (i === 0 || buckets[i2][endKey] + tol <= d[startKey]) {
477
485
  bucketMap[i] = i2;
478
- if(maxBucket < i2)maxBucket = i2;
486
+ if (maxBucket < i2) maxBucket = i2;
479
487
  buckets[i2][endKey] = d[endKey];
480
488
  break;
481
489
  }
482
490
  }
483
- if(bucketMap[i] === undefined){
491
+ if (bucketMap[i] === undefined) {
484
492
  bucketMap[i] = buckets.length;
485
493
  const b = {};
486
494
  b[endKey] = d[endKey];
487
495
  buckets.push(b as any);
488
496
  }
489
-
490
- if(maxBucket < bucketMap[i])maxBucket = bucketMap[i];
497
+
498
+ if (maxBucket < bucketMap[i]) maxBucket = bucketMap[i];
491
499
  });
492
500
  }
493
- const height = (maxBucket+1) * (this.bucketHeight() + this.gutter());
501
+ const height = (maxBucket + 1) * (this.bucketHeight() + this.gutter());
494
502
  return {
495
503
  bucketMap,
496
504
  maxBucket,
497
505
  bucketScale: this.height() / height,
498
506
  interpolateY: d3ScaleLinear()
499
- .domain([0, maxBucket+1])
507
+ .domain([0, maxBucket + 1])
500
508
  .range([0, Math.min(this.height(), height)])
501
509
  };
502
510
  }
@@ -505,14 +513,14 @@ export class ReactGantt extends SVGZoomWidget {
505
513
  data(_: IGanttData[]): this;
506
514
  data(_?: IGanttData[]): this | IGanttData[] {
507
515
  const retVal = super.data.apply(this, arguments);
508
- if(arguments.length > 0) {
509
- this._minStart = Math.min(...this.data().map(n=>n[1])) ?? 0;
510
- this._maxEnd = Math.max(...this.data().map(n=>n[2])) ?? 1;
516
+ if (arguments.length > 0) {
517
+ this._minStart = Math.min(...this.data().map(n => n[1])) ?? 0;
518
+ this._maxEnd = Math.max(...this.data().map(n => n[2])) ?? 1;
511
519
  this.measureDataText(true);
512
520
  }
513
521
  return retVal;
514
522
  }
515
-
523
+
516
524
  protected _textWidths;
517
525
  protected _maxFontScale;
518
526
  protected _characterWidths;
@@ -525,18 +533,18 @@ export class ReactGantt extends SVGZoomWidget {
525
533
  const fontSize = this.fontSize();
526
534
  const bucketHeight = this.bucketHeight();
527
535
 
528
- if(bucketHeight){
536
+ if (bucketHeight) {
529
537
  this._maxFontScale = (bucketHeight - (this.rangePadding() * 2)) / fontSize;
530
538
  }
531
539
 
532
- if(forceMeasure || this._prevFontFamily !== fontFamily || this._prevFontSize !== fontSize) {
540
+ if (forceMeasure || this._prevFontFamily !== fontFamily || this._prevFontSize !== fontSize) {
533
541
  characterWidths["."] = Utility.textSize(".", fontFamily, fontSize).width;
534
- this.data().forEach(d=>{
535
- if(!textWidths[d[0]]){
542
+ this.data().forEach(d => {
543
+ if (!textWidths[d[0]]) {
536
544
  textWidths[d[0]] = Utility.textSize(d[0], fontFamily, fontSize).width;
537
545
  }
538
- d[0].split("").forEach(char=>{
539
- if(!characterWidths[char]){
546
+ d[0].split("").forEach(char => {
547
+ if (!characterWidths[char]) {
540
548
  characterWidths[char] = Utility.textSize(char, fontFamily, fontSize).width;
541
549
  }
542
550
  });
@@ -550,15 +558,15 @@ export class ReactGantt extends SVGZoomWidget {
550
558
 
551
559
  truncateText(text, width, scale = 1) {
552
560
  const textFits = this._textWidths[text] * scale < width;
553
- if(textFits){
561
+ if (textFits) {
554
562
  return text;
555
563
  }
556
564
  let ret = "";
557
565
  let sum = 0;
558
566
  const _width = width - (this._characterWidths["."] * 3);
559
- for(const char of text){
567
+ for (const char of text) {
560
568
  sum += this._characterWidths[char];
561
- if(sum < _width){
569
+ if (sum < _width) {
562
570
  ret += char;
563
571
  } else {
564
572
  break;
@@ -569,7 +577,7 @@ export class ReactGantt extends SVGZoomWidget {
569
577
 
570
578
  resize(_size?: { width: number, height: number }) {
571
579
  let retVal;
572
- if(this.fitWidthToContent() || this.fitHeightToContent()) {
580
+ if (this.fitWidthToContent() || this.fitHeightToContent()) {
573
581
  retVal = super.resize.call(this, {
574
582
  width: _size.width,
575
583
  height: this._maxY
@@ -581,19 +589,19 @@ export class ReactGantt extends SVGZoomWidget {
581
589
  }
582
590
 
583
591
  selectionChanged() {
584
-
592
+
585
593
  }
586
-
594
+
587
595
  highlightItem(_element, d) {
588
-
596
+
589
597
  }
590
598
 
591
599
  click(row, _col, sel) {
592
-
600
+
593
601
  }
594
602
 
595
603
  dblclick(row, _col, sel) {
596
-
604
+
597
605
  }
598
606
 
599
607
  mousein(row, _col, sel) {
@@ -676,7 +684,7 @@ ReactGantt.prototype.publish("fill", "#1f77b4", "string", "Background color of r
676
684
  ReactGantt.prototype.publish("stroke", null, "string", "Color of range rectangle border");
677
685
  ReactGantt.prototype.publish("strokeWidth", null, "number", "Width of range rectangle border (pixels)");
678
686
  ReactGantt.prototype.publish("cornerRadius", 3, "number", "Space between range buckets (pixels)");
679
- ReactGantt.prototype.publish("fontFamily", null, "string", "Font family within range rectangle", null, {optional:true});
687
+ ReactGantt.prototype.publish("fontFamily", null, "string", "Font family within range rectangle", null, { optional: true });
680
688
  ReactGantt.prototype.publish("fontSize", 10, "number", "Size of font within range rectangle (pixels)");
681
689
  ReactGantt.prototype.publish("rangeFontColor", "#ecf0f1", "html-color", "rangeFontColor");
682
690
  ReactGantt.prototype.publish("overlapTolerence", 2, "number", "overlapTolerence");
@@ -1,3 +1,3 @@
1
1
  export const PKG_NAME = "@hpcc-js/timeline";
2
- export const PKG_VERSION = "2.52.1";
3
- export const BUILD_VERSION = "2.106.1";
2
+ export const PKG_VERSION = "2.53.0";
3
+ export const BUILD_VERSION = "2.106.3";
@@ -14,6 +14,8 @@ export declare class ReactAxisGantt extends SVGWidget {
14
14
  protected _bottomRect: any;
15
15
  protected rangeRenderer: any;
16
16
  constructor();
17
+ selection(_: any[]): this;
18
+ selection(): any[];
17
19
  resizeWrappers(): void;
18
20
  enter(domNode: any, element: any): void;
19
21
  onzoom(transform: any): void;