@hpcc-js/timeline 3.2.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,310 +1,324 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
1
3
  import { ITooltip } from "@hpcc-js/api";
2
4
  import { Axis } from "@hpcc-js/chart";
3
- import { EntityPin, EntityRect, SVGWidget, SVGZoomWidget, Utility, d3Event, extent, local, max, min, scaleBand, scaleLinear, select, timeFormat, timeParse, zoom, zoomIdentity } from "@hpcc-js/common";
5
+ import { Utility, SVGWidget, local, scaleBand, extent, timeParse, timeFormat, zoomIdentity, d3Event, zoom, select, EntityPin, EntityRect, SVGZoomWidget, scaleLinear, min, max } from "@hpcc-js/common";
4
6
  import { HTMLTooltip } from "@hpcc-js/html";
5
7
  import { LabelledRect, render } from "@hpcc-js/react";
6
8
  import { Border2 } from "@hpcc-js/layout";
7
-
8
- //#region src/__package__.ts
9
9
  const PKG_NAME = "@hpcc-js/timeline";
10
- const PKG_VERSION = "3.2.0";
11
- const BUILD_VERSION = "3.15.0";
12
-
13
- //#endregion
14
- //#region src/MiniGantt.ts
15
- var MiniGantt = class extends SVGWidget {
16
- tlAxis;
17
- brAxis;
18
- verticalBands;
19
- _zoom;
20
- gUpperContent;
21
- gUpperAxis;
22
- gMiddleContent;
23
- gLowerAxis;
24
- gLowerContent;
25
- localRect = local();
26
- localEntityPin = local();
27
- tooltipFormatter;
28
- _dateCache;
29
- rootExtent;
30
- _title_idx = 0;
31
- _startDate_idx = 1;
32
- _endDate_idx = 2;
33
- _icon_idx = -1;
34
- _color_idx = -1;
35
- _yoffset_idx = -1;
36
- constructor() {
37
- super();
38
- ITooltip.call(this);
39
- Utility.SimpleSelectionMixin.call(this);
40
- this._drawStartPos = "origin";
41
- this.tooltipHTML((d) => `<center>${d[this._title_idx]}</center><br>${this.tooltipFormatter(this.brAxis.parse(d[this._startDate_idx]))} -> ${this.tooltipFormatter(this.brAxis.parse(d[this._endDate_idx]))}`);
42
- this.tlAxis = new Axis().type("time");
43
- this.brAxis = new Axis().type("time");
44
- this.verticalBands = scaleBand().paddingOuter(.2).paddingInner(.2);
45
- }
46
- isHorizontal() {
47
- return this.orientation() === "horizontal";
48
- }
49
- fullExtent() {
50
- return extent([...this.data().map((d) => d[this._startDate_idx]), ...this.data().filter((d) => !!d[this._endDate_idx]).map((d) => d[this._endDate_idx])]);
51
- }
52
- extent() {
53
- const extent$1 = this.rootExtent ? [this.rootExtent[1], this.rootExtent[2]] : this.fullExtent();
54
- if (extent$1[0] !== void 0 && extent$1[1] !== void 0) {
55
- if (extent$1[0] === extent$1[1] || this.centerOnMostRecent()) {
56
- const parser = timeParse(this.timePattern());
57
- const formatter = timeFormat(this.timePattern());
58
- const date1 = parser(extent$1[0]);
59
- const date2 = parser(extent$1[1]);
60
- if (extent$1[0] === extent$1[1]) {
61
- extent$1[0] = formatter(new Date(date1.setFullYear(date1.getFullYear() - 1)));
62
- extent$1[1] = formatter(new Date(date1.setFullYear(date1.getFullYear() + 2)));
63
- } else {
64
- const time1 = date1.getTime();
65
- const timeDiff = date2.getTime() - time1;
66
- extent$1[0] = formatter(date1);
67
- extent$1[1] = formatter(new Date(time1 + timeDiff * 2));
68
- }
69
- }
70
- }
71
- return extent$1;
72
- }
73
- dataStartPos(d) {
74
- if (typeof this._dateCache[d[this._startDate_idx]] !== "undefined") return this._dateCache[d[this._startDate_idx]];
75
- const pos = this.brAxis.scalePos(d[this._startDate_idx]);
76
- this._dateCache[d[this._startDate_idx]] = pos;
77
- return pos;
78
- }
79
- dataEndPos(d) {
80
- if (typeof this._dateCache[d[this._endDate_idx]] !== "undefined") return this._dateCache[d[this._endDate_idx]];
81
- const pos = this.brAxis.scalePos(d[this._endDate_idx]);
82
- this._dateCache[d[this._endDate_idx]] = pos;
83
- return pos;
84
- }
85
- dataWidth(d) {
86
- return this.dataEndPos(d) - this.dataStartPos(d);
87
- }
88
- transform;
89
- resetZoom() {
90
- this._zoom.transform(this.element(), zoomIdentity.translate(0, this.isHorizontal() ? 0 : this.height()));
91
- }
92
- zoomed() {
93
- this.transform = d3Event().transform;
94
- this.render();
95
- }
96
- background;
97
- enter(domNode, element) {
98
- super.enter(domNode, element);
99
- this._zoom = zoom().scaleExtent([0, this.maxZoom()]).on("zoom", () => {
100
- this.zoomed();
101
- });
102
- this.background = element.append("rect").attr("fill", "white").attr("opacity", 0).on("dblclick", () => {
103
- d3Event().stopPropagation();
104
- delete this.rootExtent;
105
- this.resetZoom();
106
- });
107
- this.gUpperContent = element.append("g").attr("class", "gUpperContent");
108
- this.gUpperAxis = element.append("g").attr("class", "gUpperAxis");
109
- this.gMiddleContent = element.append("g").attr("class", "gMiddleContent");
110
- this.gLowerAxis = element.append("g").attr("class", "gLowerAxis");
111
- this.gLowerContent = element.append("g").attr("class", "gLowerContent");
112
- 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);
113
- 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);
114
- element.call(this._zoom);
115
- this._selection.widgetElement(this.gMiddleContent);
116
- }
117
- _prevIsHorizontal;
118
- update(domNode, element) {
119
- super.update(domNode, element);
120
- this._dateCache = {};
121
- this._title_idx = this.titleColumn() !== null ? this.columns().indexOf(this.titleColumn()) : this._title_idx;
122
- this._startDate_idx = this.startDateColumn() !== null ? this.columns().indexOf(this.startDateColumn()) : this._startDate_idx;
123
- this._endDate_idx = this.endDateColumn() !== null ? this.columns().indexOf(this.endDateColumn()) : this._endDate_idx;
124
- this._icon_idx = this.iconColumn() !== null ? this.columns().indexOf(this.iconColumn()) : this._icon_idx;
125
- this._color_idx = this.colorColumn() !== null ? this.columns().indexOf(this.colorColumn()) : this._color_idx;
126
- this._yoffset_idx = this.yOffsetColumn() !== null ? this.columns().indexOf(this.yOffsetColumn()) : this._yoffset_idx;
127
- if (this._prevIsHorizontal !== this.isHorizontal()) {
128
- this._prevIsHorizontal = this.isHorizontal();
129
- this.resetZoom();
130
- return;
131
- }
132
- this.tooltipFormatter = timeFormat(this.tooltipTimeFormat());
133
- const width = this.width();
134
- const height = this.height();
135
- this.background.attr("x", 0).attr("y", 0).attr("width", width).attr("height", height);
136
- const extent$1 = this.extent();
137
- this.tlAxis.x(width / 2).orientation(this.isHorizontal() ? "top" : "left").reverse(!this.isHorizontal()).timePattern(this.timePattern()).width(width - 1).low(extent$1[0]).high(extent$1[1]).updateScale();
138
- this.brAxis.x(width / 2).y(height / 2).orientation(this.isHorizontal() ? "bottom" : "right").reverse(!this.isHorizontal()).timePattern(this.timePattern()).width(width - 1).height(height).low(extent$1[0]).high(extent$1[1]).updateScale();
139
- if (this.transform) {
140
- let low;
141
- let hi;
142
- if (this.isHorizontal()) {
143
- low = this.tlAxis.parseInvert(this.tlAxis.invert(this.transform.invertX(0)));
144
- hi = this.tlAxis.parseInvert(this.tlAxis.invert(this.transform.invertX(width - 1)));
145
- } else {
146
- low = this.tlAxis.parseInvert(this.tlAxis.invert(-this.transform.invertY(0)));
147
- hi = this.tlAxis.parseInvert(this.tlAxis.invert(-this.transform.invertY(height - 1)));
148
- }
149
- this.tlAxis.low(low).high(hi).updateScale();
150
- this.brAxis.low(low).high(hi).updateScale();
151
- }
152
- const data = this.data().sort(this.isHorizontal() ? (l, r) => {
153
- const retVal = this.brAxis.scalePos(l[1]) - this.brAxis.scalePos(r[1]);
154
- if (retVal === 0) return ("" + l[0]).localeCompare("" + r[0]);
155
- return retVal;
156
- } : (l, r) => {
157
- return this.brAxis.scalePos(r[1]) - this.brAxis.scalePos(l[1]);
158
- });
159
- const events = data.filter((d) => !d[this._endDate_idx]);
160
- const ranges = data.filter((d) => !!d[this._endDate_idx]);
161
- this.tlAxis.render();
162
- this.brAxis.render();
163
- const brAxisBBox = this.brAxis.getBBox();
164
- let upperContentHeight = this.updateEntityPins(events);
165
- const lowerAxisHeight = brAxisBBox.height;
166
- let lowerHeight = height - upperContentHeight;
167
- const minYOffset = this._yoffset_idx !== -1 ? Math.min.apply(void 0, this.data().filter((row) => !isNaN(row[this._yoffset_idx])).map((row) => row[this._yoffset_idx])) : 0;
168
- if (events.length > 0 && ranges.length === 0) {
169
- this.tlAxis.visible(false);
170
- let y_offset = upperContentHeight / 4;
171
- if (y_offset > height / 2 - lowerAxisHeight) y_offset = height / 2 - lowerAxisHeight;
172
- const upperContentYOffset = height / 2 + y_offset;
173
- const lowerAxisYOffset = (height / 2 - lowerAxisHeight - y_offset) * -1;
174
- const halfMinYOffset = minYOffset !== 0 ? minYOffset / 2 : 0;
175
- this.gUpperContent.attr("transform", `translate(0, ${upperContentYOffset - halfMinYOffset})`);
176
- this.gLowerAxis.attr("transform", `translate(0, ${lowerAxisYOffset - halfMinYOffset})`);
177
- } else if (events.length === 0 && ranges.length > 0) {
178
- this.tlAxis.visible(true);
179
- this.gUpperContent.attr("transform", `translate(0, ${upperContentHeight})`);
180
- this.gUpperAxis.attr("transform", `translate(0, ${upperContentHeight})`);
181
- } else {
182
- upperContentHeight -= minYOffset;
183
- lowerHeight += minYOffset;
184
- this.tlAxis.visible(true);
185
- this.gUpperContent.attr("transform", `translate(0, ${upperContentHeight})`);
186
- this.gUpperAxis.attr("transform", `translate(0, ${upperContentHeight})`);
187
- this.gMiddleContent.attr("transform", `translate(0, ${upperContentHeight})`);
188
- }
189
- this.tlAxis.render();
190
- const tlAxisBBox = this.tlAxis.getBBox();
191
- const bucketData = [];
192
- const bucketIndex = {};
193
- for (const range of ranges) {
194
- for (let i = 0; i < bucketData.length; ++i) {
195
- const bucket = bucketData[i];
196
- if (bucket.endPos + this.overlapTolerence() <= this.dataStartPos(range)) {
197
- bucketIndex[range] = i;
198
- bucket.endPos = this.dataEndPos(range);
199
- break;
200
- }
201
- }
202
- if (bucketIndex[range] === void 0) {
203
- bucketIndex[range] = bucketData.length;
204
- bucketData.push({ endPos: this.dataEndPos(range) });
205
- }
206
- }
207
- const vbLower = this.isHorizontal() ? 0 + tlAxisBBox.height : 0 + tlAxisBBox.width;
208
- const vbHigher = this.isHorizontal() ? lowerHeight - brAxisBBox.height : width - brAxisBBox.width;
209
- this.verticalBands.range([vbLower, vbHigher]).domain(bucketData.map((_d, i) => i));
210
- if (ranges.length > 0) this.updateEventRanges(events, ranges, bucketIndex, lowerHeight, tlAxisBBox, brAxisBBox, width);
211
- }
212
- updateEntityPins(events) {
213
- let event_height = 0;
214
- const context = this;
215
- const entityPins = this.gUpperContent.selectAll(".entity_pin").data(events, (d) => d[0] + ":" + d[1]);
216
- const eventFontColor_idx = this.eventFontColorColumn() ? this.columns().indexOf(this.eventFontColorColumn()) : -1;
217
- const eventBorderColor_idx = this.eventBorderColorColumn() ? this.columns().indexOf(this.eventBorderColorColumn()) : -1;
218
- const eventBackgroundColor_idx = this.eventBackgroundColorColumn() ? this.columns().indexOf(this.eventBackgroundColorColumn()) : -1;
219
- const title_counts = {};
220
- for (const d of events) {
221
- const type = typeof d[context._title_idx] !== "undefined" ? d[context._title_idx] : d[0];
222
- title_counts[type] = title_counts[type] ? title_counts[type] + 1 : 1;
223
- }
224
- const title_types = Object.keys(title_counts);
225
- const title_group_offset = context.eventGroupOffset();
226
- const entityPinsEnter = entityPins.enter().append("g").attr("class", "entity_pin");
227
- entityPinsEnter.append("line").attr("class", "entity_line");
228
- entityPinsEnter.on("mouseover", function(d) {
229
- select(this).raise();
230
- }).each(function(d, i) {
231
- const entityPin = new EntityPin().target(this).icon("").iconOnlyShowOnHover(context.hideIconWhenCollapsed()).titleOnlyShowOnHover(context.hideTitleWhenCollapsed()).descriptionOnlyShowOnHover(context.hideDescriptionWhenCollapsed()).annotationOnlyShowOnHover(context.hideAnnotationsWhenCollapsed()).iconDiameter(18).iconPaddingPercent(1).titleFontSize(14).descriptionColor("#333").descriptionFontSize(15).iconColor(eventFontColor_idx === -1 ? "#333" : d[eventFontColor_idx]).titleColor(eventFontColor_idx === -1 ? "#333" : d[eventFontColor_idx]).descriptionColor(eventFontColor_idx === -1 ? "#333" : d[eventFontColor_idx]).backgroundShape("pin").backgroundColorFill(eventFontColor_idx === -1 ? "#f8f8f8" : d[eventBackgroundColor_idx]).backgroundColorStroke(eventFontColor_idx === -1 ? "#ccc" : d[eventBorderColor_idx]).cornerRadius(5).arrowHeight(10).arrowWidth(16);
232
- context.localEntityPin.set(this, entityPin);
233
- }).merge(entityPins).each(function(d, i) {
234
- const entityPin = context.localEntityPin.get(this);
235
- const _title = typeof d[context._title_idx] !== "undefined" ? d[context._title_idx] : entityPin.title();
236
- const x_offset = context.dataStartPos(d) - 0;
237
- let y_offset = title_types.indexOf(_title) % context.eventGroupMod() * title_group_offset - 5;
238
- if (typeof d[context._yoffset_idx] !== "undefined") y_offset += d[context._yoffset_idx] ? d[context._yoffset_idx] : 0;
239
- if (d[context._title_idx] !== entityPin.title() && d[context._startDate_idx] !== entityPin.description()) {
240
- const parsed_start_time = context.brAxis.parse(d[context._startDate_idx]);
241
- const formatted_start_time = context.tooltipFormatter(parsed_start_time);
242
- entityPin.x(x_offset).y(y_offset).iconOnlyShowOnHover(context.hideIconWhenCollapsed()).titleOnlyShowOnHover(context.hideTitleWhenCollapsed()).descriptionOnlyShowOnHover(context.hideDescriptionWhenCollapsed()).annotationOnlyShowOnHover(context.hideAnnotationsWhenCollapsed()).icon(typeof d[context._icon_idx] !== "undefined" ? d[context._icon_idx] : entityPin.icon()).title(_title).description(formatted_start_time).animationFrameRender();
243
- } else entityPin.move({
244
- x: x_offset,
245
- y: y_offset
246
- });
247
- const calc_height = entityPin.calcHeight();
248
- if (event_height < calc_height) event_height = calc_height;
249
- select(this).selectAll(".entity_line").attr("x1", x_offset).attr("x2", x_offset).attr("y1", 0).attr("y2", y_offset).style("stroke", eventFontColor_idx === -1 ? "#ccc" : d[eventBorderColor_idx]).style("stroke-width", 1);
250
- });
251
- entityPins.exit().each(function(d, i) {
252
- context.localEntityPin.get(this).target(null);
253
- }).remove();
254
- const event_offset = Math.abs(Math.min(events.length, context.eventGroupMod()) * context.eventGroupOffset());
255
- return event_height + event_offset;
256
- }
257
- updateEventRanges(events, ranges, bucketIndex, eventRangeHeight, tlAxisBBox, brAxisBBox, width) {
258
- const context = this;
259
- const lines = this.gMiddleContent.selectAll(".line").data(events, (d) => {
260
- return d[context._title_idx];
261
- });
262
- lines.enter().append("line").attr("class", "line").merge(lines).attr(this.isHorizontal() ? "x1" : "y1", (d) => this.dataStartPos(d) - 0).attr(this.isHorizontal() ? "x2" : "y2", (d) => this.dataStartPos(d) - 0).attr(this.isHorizontal() ? "y1" : "x1", this.isHorizontal() ? tlAxisBBox.height : tlAxisBBox.width).attr(this.isHorizontal() ? "y2" : "x2", this.isHorizontal() ? eventRangeHeight - brAxisBBox.height : width - brAxisBBox.width);
263
- lines.exit().remove();
264
- const buckets = this.gMiddleContent.selectAll(".buckets").data(ranges, (d) => d[context._title_idx]);
265
- buckets.enter().append("g").attr("class", "buckets").call(this._selection.enter.bind(this._selection)).each(function(d) {
266
- const entityRect = new EntityRect().target(this).iconDiameter(28).iconPaddingPercent(0).titleFontSize(28).titleColor(context.rangeFontColor()).descriptionColor(context.rangeFontColor()).iconColor(context.rangeFontColor()).backgroundShape("rect").backgroundColorFill(d[context._color_idx]);
267
- context.localRect.set(this, entityRect);
268
- context.enterEntityRect(entityRect, d);
269
- }).on("click", function(d) {
270
- context.click(context.rowToObj(d), "range", context._selection.selected(this));
271
- }, false).on("dblclick", function(d) {
272
- context.rootExtent = d;
273
- context.resetZoom();
274
- context.dblclick(context.rowToObj(d), "range", context._selection.selected(this));
275
- }, true).on("mouseout.tooltip", this.tooltip.hide).on("mousemove.tooltip", this.tooltip.show).merge(buckets).attr("transform", (d) => context.isHorizontal() ? `translate(${this.dataStartPos(d)}, ${this.verticalBands(bucketIndex[d])}) ` : `translate(${this.verticalBands(bucketIndex[d])}, ${this.dataStartPos(d)}) `).each(function(d) {
276
- const textBox = context.localRect.get(this);
277
- const x = context.dataWidth(d) / 2;
278
- const y = context.verticalBands.bandwidth() / 2;
279
- const rectWidth = Math.max(context.dataWidth(d), 2);
280
- const rectHeight = Math.max(context.verticalBands.bandwidth(), 2);
281
- const fontHeightRatio = .618;
282
- const paddingSize = (1 - fontHeightRatio) / 2 * rectHeight;
283
- const fontSize = rectHeight * fontHeightRatio;
284
- const iconSize = fontSize;
285
- textBox.pos(context.isHorizontal() ? {
286
- x,
287
- y
288
- } : {
289
- x: y,
290
- y: x
291
- }).fixedHeight(context.isHorizontal() ? rectHeight : rectWidth).fixedWidth(context.isHorizontal() ? rectWidth : rectHeight).icon(typeof d[context._icon_idx] !== "undefined" ? d[context._icon_idx] : "").title(typeof d[context._title_idx] !== "undefined" ? d[context._title_idx] : "").padding(paddingSize).iconDiameter(iconSize).titleFontSize(fontSize);
292
- if (iconSize * 1.5 > rectWidth) textBox.icon(null);
293
- context.updateEntityRect(textBox, d[context._icon_idx]);
294
- textBox.render();
295
- });
296
- buckets.exit().remove();
297
- }
298
- exit(domNode, element) {
299
- this.brAxis.target(null);
300
- this.tlAxis.target(null);
301
- super.exit(domNode, element);
302
- }
303
- click(row, col, sel) {}
304
- dblclick(row, col, sel) {}
305
- enterEntityRect(textbox, d) {}
306
- updateEntityRect(textbox, d) {}
10
+ const PKG_VERSION = "3.2.1";
11
+ const BUILD_VERSION = "3.15.1";
12
+ const _MiniGantt = class _MiniGantt extends SVGWidget {
13
+ tlAxis;
14
+ brAxis;
15
+ verticalBands;
16
+ _zoom;
17
+ gUpperContent;
18
+ gUpperAxis;
19
+ gMiddleContent;
20
+ gLowerAxis;
21
+ gLowerContent;
22
+ localRect = local();
23
+ localEntityPin = local();
24
+ tooltipFormatter;
25
+ _dateCache;
26
+ rootExtent;
27
+ _title_idx = 0;
28
+ _startDate_idx = 1;
29
+ _endDate_idx = 2;
30
+ _icon_idx = -1;
31
+ _color_idx = -1;
32
+ _yoffset_idx = -1;
33
+ constructor() {
34
+ super();
35
+ ITooltip.call(this);
36
+ Utility.SimpleSelectionMixin.call(this);
37
+ this._drawStartPos = "origin";
38
+ this.tooltipHTML((d) => `<center>${d[this._title_idx]}</center><br>${this.tooltipFormatter(this.brAxis.parse(d[this._startDate_idx]))} -> ${this.tooltipFormatter(this.brAxis.parse(d[this._endDate_idx]))}`);
39
+ this.tlAxis = new Axis().type("time");
40
+ this.brAxis = new Axis().type("time");
41
+ this.verticalBands = scaleBand().paddingOuter(0.2).paddingInner(0.2);
42
+ }
43
+ isHorizontal() {
44
+ return this.orientation() === "horizontal";
45
+ }
46
+ fullExtent() {
47
+ const data = [...this.data().map((d) => d[this._startDate_idx]), ...this.data().filter((d) => !!d[this._endDate_idx]).map((d) => d[this._endDate_idx])];
48
+ return extent(data);
49
+ }
50
+ extent() {
51
+ const extent2 = this.rootExtent ? [this.rootExtent[1], this.rootExtent[2]] : this.fullExtent();
52
+ if (extent2[0] !== void 0 && extent2[1] !== void 0) {
53
+ if (extent2[0] === extent2[1] || this.centerOnMostRecent()) {
54
+ const parser = timeParse(this.timePattern());
55
+ const formatter = timeFormat(this.timePattern());
56
+ const date1 = parser(extent2[0]);
57
+ const date2 = parser(extent2[1]);
58
+ if (extent2[0] === extent2[1]) {
59
+ extent2[0] = formatter(new Date(date1.setFullYear(date1.getFullYear() - 1)));
60
+ extent2[1] = formatter(new Date(date1.setFullYear(date1.getFullYear() + 2)));
61
+ } else {
62
+ const time1 = date1.getTime();
63
+ const timeDiff = date2.getTime() - time1;
64
+ extent2[0] = formatter(date1);
65
+ extent2[1] = formatter(new Date(time1 + timeDiff * 2));
66
+ }
67
+ }
68
+ }
69
+ return extent2;
70
+ }
71
+ dataStartPos(d) {
72
+ if (typeof this._dateCache[d[this._startDate_idx]] !== "undefined") {
73
+ return this._dateCache[d[this._startDate_idx]];
74
+ }
75
+ const pos = this.brAxis.scalePos(d[this._startDate_idx]);
76
+ this._dateCache[d[this._startDate_idx]] = pos;
77
+ return pos;
78
+ }
79
+ dataEndPos(d) {
80
+ if (typeof this._dateCache[d[this._endDate_idx]] !== "undefined") {
81
+ return this._dateCache[d[this._endDate_idx]];
82
+ }
83
+ const pos = this.brAxis.scalePos(d[this._endDate_idx]);
84
+ this._dateCache[d[this._endDate_idx]] = pos;
85
+ return pos;
86
+ }
87
+ dataWidth(d) {
88
+ return this.dataEndPos(d) - this.dataStartPos(d);
89
+ }
90
+ transform;
91
+ resetZoom() {
92
+ this._zoom.transform(this.element(), zoomIdentity.translate(0, this.isHorizontal() ? 0 : this.height()));
93
+ }
94
+ zoomed() {
95
+ this.transform = d3Event().transform;
96
+ this.render();
97
+ }
98
+ background;
99
+ enter(domNode, element) {
100
+ super.enter(domNode, element);
101
+ this._zoom = zoom().scaleExtent([0, this.maxZoom()]).on("zoom", () => {
102
+ this.zoomed();
103
+ });
104
+ this.background = element.append("rect").attr("fill", "white").attr("opacity", 0).on("dblclick", () => {
105
+ d3Event().stopPropagation();
106
+ delete this.rootExtent;
107
+ this.resetZoom();
108
+ });
109
+ this.gUpperContent = element.append("g").attr("class", "gUpperContent");
110
+ this.gUpperAxis = element.append("g").attr("class", "gUpperAxis");
111
+ this.gMiddleContent = element.append("g").attr("class", "gMiddleContent");
112
+ this.gLowerAxis = element.append("g").attr("class", "gLowerAxis");
113
+ this.gLowerContent = element.append("g").attr("class", "gLowerContent");
114
+ this.tlAxis.target(this.gUpperAxis.node()).tickFormat(this.tickFormat()).guideTarget(this.gUpperAxis.append("g").node()).shrinkToFit("none").overlapMode(this.tickFormat_exists() ? "stagger" : "none").extend(0.1);
115
+ this.brAxis.target(this.gLowerAxis.node()).tickFormat(this.tickFormat()).guideTarget(this.gLowerAxis.append("g").node()).shrinkToFit("none").overlapMode(this.tickFormat_exists() ? "stagger" : "none").extend(0.1);
116
+ element.call(this._zoom);
117
+ this._selection.widgetElement(this.gMiddleContent);
118
+ }
119
+ _prevIsHorizontal;
120
+ update(domNode, element) {
121
+ super.update(domNode, element);
122
+ this._dateCache = {};
123
+ this._title_idx = this.titleColumn() !== null ? this.columns().indexOf(this.titleColumn()) : this._title_idx;
124
+ this._startDate_idx = this.startDateColumn() !== null ? this.columns().indexOf(this.startDateColumn()) : this._startDate_idx;
125
+ this._endDate_idx = this.endDateColumn() !== null ? this.columns().indexOf(this.endDateColumn()) : this._endDate_idx;
126
+ this._icon_idx = this.iconColumn() !== null ? this.columns().indexOf(this.iconColumn()) : this._icon_idx;
127
+ this._color_idx = this.colorColumn() !== null ? this.columns().indexOf(this.colorColumn()) : this._color_idx;
128
+ this._yoffset_idx = this.yOffsetColumn() !== null ? this.columns().indexOf(this.yOffsetColumn()) : this._yoffset_idx;
129
+ if (this._prevIsHorizontal !== this.isHorizontal()) {
130
+ this._prevIsHorizontal = this.isHorizontal();
131
+ this.resetZoom();
132
+ return;
133
+ }
134
+ this.tooltipFormatter = timeFormat(this.tooltipTimeFormat());
135
+ const width = this.width();
136
+ const height = this.height();
137
+ this.background.attr("x", 0).attr("y", 0).attr("width", width).attr("height", height);
138
+ const extent2 = this.extent();
139
+ this.tlAxis.x(width / 2).orientation(this.isHorizontal() ? "top" : "left").reverse(!this.isHorizontal()).timePattern(this.timePattern()).width(width - 1).low(extent2[0]).high(extent2[1]).updateScale();
140
+ this.brAxis.x(width / 2).y(height / 2).orientation(this.isHorizontal() ? "bottom" : "right").reverse(!this.isHorizontal()).timePattern(this.timePattern()).width(width - 1).height(height).low(extent2[0]).high(extent2[1]).updateScale();
141
+ if (this.transform) {
142
+ let low;
143
+ let hi;
144
+ if (this.isHorizontal()) {
145
+ low = this.tlAxis.parseInvert(this.tlAxis.invert(this.transform.invertX(0)));
146
+ hi = this.tlAxis.parseInvert(this.tlAxis.invert(this.transform.invertX(width - 1)));
147
+ } else {
148
+ low = this.tlAxis.parseInvert(this.tlAxis.invert(-this.transform.invertY(0)));
149
+ hi = this.tlAxis.parseInvert(this.tlAxis.invert(-this.transform.invertY(height - 1)));
150
+ }
151
+ this.tlAxis.low(low).high(hi).updateScale();
152
+ this.brAxis.low(low).high(hi).updateScale();
153
+ }
154
+ const data = this.data().sort(this.isHorizontal() ? (l, r) => {
155
+ const retVal = this.brAxis.scalePos(l[1]) - this.brAxis.scalePos(r[1]);
156
+ if (retVal === 0) {
157
+ return ("" + l[0]).localeCompare("" + r[0]);
158
+ }
159
+ return retVal;
160
+ } : (l, r) => {
161
+ return this.brAxis.scalePos(r[1]) - this.brAxis.scalePos(l[1]);
162
+ });
163
+ const events = data.filter((d) => !d[this._endDate_idx]);
164
+ const ranges = data.filter((d) => !!d[this._endDate_idx]);
165
+ this.tlAxis.render();
166
+ this.brAxis.render();
167
+ const brAxisBBox = this.brAxis.getBBox();
168
+ let upperContentHeight = this.updateEntityPins(events);
169
+ const lowerAxisHeight = brAxisBBox.height;
170
+ let lowerHeight = height - upperContentHeight;
171
+ const minYOffset = this._yoffset_idx !== -1 ? Math.min.apply(void 0, this.data().filter((row) => !isNaN(row[this._yoffset_idx])).map((row) => row[this._yoffset_idx])) : 0;
172
+ if (events.length > 0 && ranges.length === 0) {
173
+ this.tlAxis.visible(false);
174
+ let y_offset = upperContentHeight / 4;
175
+ if (y_offset > height / 2 - lowerAxisHeight) {
176
+ y_offset = height / 2 - lowerAxisHeight;
177
+ }
178
+ const upperContentYOffset = height / 2 + y_offset;
179
+ const lowerAxisYOffset = (height / 2 - lowerAxisHeight - y_offset) * -1;
180
+ const halfMinYOffset = minYOffset !== 0 ? minYOffset / 2 : 0;
181
+ this.gUpperContent.attr("transform", `translate(0, ${upperContentYOffset - halfMinYOffset})`);
182
+ this.gLowerAxis.attr("transform", `translate(0, ${lowerAxisYOffset - halfMinYOffset})`);
183
+ } else if (events.length === 0 && ranges.length > 0) {
184
+ this.tlAxis.visible(true);
185
+ this.gUpperContent.attr("transform", `translate(0, ${upperContentHeight})`);
186
+ this.gUpperAxis.attr("transform", `translate(0, ${upperContentHeight})`);
187
+ } else {
188
+ upperContentHeight -= minYOffset;
189
+ lowerHeight += minYOffset;
190
+ this.tlAxis.visible(true);
191
+ this.gUpperContent.attr("transform", `translate(0, ${upperContentHeight})`);
192
+ this.gUpperAxis.attr("transform", `translate(0, ${upperContentHeight})`);
193
+ this.gMiddleContent.attr("transform", `translate(0, ${upperContentHeight})`);
194
+ }
195
+ this.tlAxis.render();
196
+ const tlAxisBBox = this.tlAxis.getBBox();
197
+ const bucketData = [];
198
+ const bucketIndex = {};
199
+ for (const range of ranges) {
200
+ for (let i = 0; i < bucketData.length; ++i) {
201
+ const bucket = bucketData[i];
202
+ if (bucket.endPos + this.overlapTolerence() <= this.dataStartPos(range)) {
203
+ bucketIndex[range] = i;
204
+ bucket.endPos = this.dataEndPos(range);
205
+ break;
206
+ }
207
+ }
208
+ if (bucketIndex[range] === void 0) {
209
+ bucketIndex[range] = bucketData.length;
210
+ bucketData.push({
211
+ endPos: this.dataEndPos(range)
212
+ });
213
+ }
214
+ }
215
+ const vbLower = this.isHorizontal() ? 0 + tlAxisBBox.height : 0 + tlAxisBBox.width;
216
+ const vbHigher = this.isHorizontal() ? lowerHeight - brAxisBBox.height : width - brAxisBBox.width;
217
+ this.verticalBands.range([vbLower, vbHigher]).domain(bucketData.map((_d, i) => i));
218
+ if (ranges.length > 0) {
219
+ this.updateEventRanges(events, ranges, bucketIndex, lowerHeight, tlAxisBBox, brAxisBBox, width);
220
+ }
221
+ }
222
+ updateEntityPins(events) {
223
+ let event_height = 0;
224
+ const context = this;
225
+ const entityPins = this.gUpperContent.selectAll(".entity_pin").data(events, (d) => d[0] + ":" + d[1]);
226
+ const eventFontColor_idx = this.eventFontColorColumn() ? this.columns().indexOf(this.eventFontColorColumn()) : -1;
227
+ const eventBorderColor_idx = this.eventBorderColorColumn() ? this.columns().indexOf(this.eventBorderColorColumn()) : -1;
228
+ const eventBackgroundColor_idx = this.eventBackgroundColorColumn() ? this.columns().indexOf(this.eventBackgroundColorColumn()) : -1;
229
+ const title_counts = {};
230
+ for (const d of events) {
231
+ const type = typeof d[context._title_idx] !== "undefined" ? d[context._title_idx] : d[0];
232
+ title_counts[type] = title_counts[type] ? title_counts[type] + 1 : 1;
233
+ }
234
+ const title_types = Object.keys(title_counts);
235
+ const title_group_offset = context.eventGroupOffset();
236
+ const entityPinsEnter = entityPins.enter().append("g").attr("class", "entity_pin");
237
+ entityPinsEnter.append("line").attr("class", "entity_line");
238
+ entityPinsEnter.on("mouseover", function(d) {
239
+ select(this).raise();
240
+ }).each(function(d, i) {
241
+ const entityPin = new EntityPin().target(this).icon("").iconOnlyShowOnHover(context.hideIconWhenCollapsed()).titleOnlyShowOnHover(context.hideTitleWhenCollapsed()).descriptionOnlyShowOnHover(context.hideDescriptionWhenCollapsed()).annotationOnlyShowOnHover(context.hideAnnotationsWhenCollapsed()).iconDiameter(18).iconPaddingPercent(1).titleFontSize(14).descriptionColor("#333").descriptionFontSize(15).iconColor(eventFontColor_idx === -1 ? "#333" : d[eventFontColor_idx]).titleColor(eventFontColor_idx === -1 ? "#333" : d[eventFontColor_idx]).descriptionColor(eventFontColor_idx === -1 ? "#333" : d[eventFontColor_idx]).backgroundShape("pin").backgroundColorFill(eventFontColor_idx === -1 ? "#f8f8f8" : d[eventBackgroundColor_idx]).backgroundColorStroke(eventFontColor_idx === -1 ? "#ccc" : d[eventBorderColor_idx]).cornerRadius(5).arrowHeight(10).arrowWidth(16);
242
+ context.localEntityPin.set(this, entityPin);
243
+ }).merge(entityPins).each(function(d, i) {
244
+ const entityPin = context.localEntityPin.get(this);
245
+ const _title = typeof d[context._title_idx] !== "undefined" ? d[context._title_idx] : entityPin.title();
246
+ const x_offset = context.dataStartPos(d) - 0;
247
+ let y_offset = title_types.indexOf(_title) % context.eventGroupMod() * title_group_offset - 5;
248
+ if (typeof d[context._yoffset_idx] !== "undefined") y_offset += d[context._yoffset_idx] ? d[context._yoffset_idx] : 0;
249
+ if (d[context._title_idx] !== entityPin.title() && d[context._startDate_idx] !== entityPin.description()) {
250
+ const parsed_start_time = context.brAxis.parse(d[context._startDate_idx]);
251
+ const formatted_start_time = context.tooltipFormatter(parsed_start_time);
252
+ entityPin.x(x_offset).y(y_offset).iconOnlyShowOnHover(context.hideIconWhenCollapsed()).titleOnlyShowOnHover(context.hideTitleWhenCollapsed()).descriptionOnlyShowOnHover(context.hideDescriptionWhenCollapsed()).annotationOnlyShowOnHover(context.hideAnnotationsWhenCollapsed()).icon(typeof d[context._icon_idx] !== "undefined" ? d[context._icon_idx] : entityPin.icon()).title(_title).description(formatted_start_time).animationFrameRender();
253
+ } else {
254
+ entityPin.move({ x: x_offset, y: y_offset });
255
+ }
256
+ const calc_height = entityPin.calcHeight();
257
+ if (event_height < calc_height) event_height = calc_height;
258
+ select(this).selectAll(".entity_line").attr("x1", x_offset).attr("x2", x_offset).attr("y1", 0).attr("y2", y_offset).style("stroke", eventFontColor_idx === -1 ? "#ccc" : d[eventBorderColor_idx]).style("stroke-width", 1);
259
+ });
260
+ entityPins.exit().each(function(d, i) {
261
+ const entityPin = context.localEntityPin.get(this);
262
+ entityPin.target(null);
263
+ }).remove();
264
+ const event_offset = Math.abs(Math.min(events.length, context.eventGroupMod()) * context.eventGroupOffset());
265
+ return event_height + event_offset;
266
+ }
267
+ updateEventRanges(events, ranges, bucketIndex, eventRangeHeight, tlAxisBBox, brAxisBBox, width) {
268
+ const context = this;
269
+ const lines = this.gMiddleContent.selectAll(".line").data(events, (d) => {
270
+ return d[context._title_idx];
271
+ });
272
+ lines.enter().append("line").attr("class", "line").merge(lines).attr(this.isHorizontal() ? "x1" : "y1", (d) => this.dataStartPos(d) - 0).attr(this.isHorizontal() ? "x2" : "y2", (d) => this.dataStartPos(d) - 0).attr(this.isHorizontal() ? "y1" : "x1", this.isHorizontal() ? tlAxisBBox.height : tlAxisBBox.width).attr(this.isHorizontal() ? "y2" : "x2", this.isHorizontal() ? eventRangeHeight - brAxisBBox.height : width - brAxisBBox.width);
273
+ lines.exit().remove();
274
+ const buckets = this.gMiddleContent.selectAll(".buckets").data(ranges, (d) => d[context._title_idx]);
275
+ buckets.enter().append("g").attr("class", "buckets").call(this._selection.enter.bind(this._selection)).each(function(d) {
276
+ const entityRect = new EntityRect().target(this).iconDiameter(28).iconPaddingPercent(0).titleFontSize(28).titleColor(context.rangeFontColor()).descriptionColor(context.rangeFontColor()).iconColor(context.rangeFontColor()).backgroundShape("rect").backgroundColorFill(d[context._color_idx]);
277
+ context.localRect.set(this, entityRect);
278
+ context.enterEntityRect(entityRect, d);
279
+ }).on("click", function(d) {
280
+ context.click(context.rowToObj(d), "range", context._selection.selected(this));
281
+ }, false).on("dblclick", function(d) {
282
+ context.rootExtent = d;
283
+ context.resetZoom();
284
+ context.dblclick(context.rowToObj(d), "range", context._selection.selected(this));
285
+ }, true).on("mouseout.tooltip", this.tooltip.hide).on("mousemove.tooltip", this.tooltip.show).merge(buckets).attr("transform", (d) => context.isHorizontal() ? `translate(${this.dataStartPos(d)}, ${this.verticalBands(bucketIndex[d])}) ` : `translate(${this.verticalBands(bucketIndex[d])}, ${this.dataStartPos(d)}) `).each(function(d) {
286
+ const textBox = context.localRect.get(this);
287
+ const x = context.dataWidth(d) / 2;
288
+ const y = context.verticalBands.bandwidth() / 2;
289
+ const rectWidth = Math.max(context.dataWidth(d), 2);
290
+ const rectHeight = Math.max(context.verticalBands.bandwidth(), 2);
291
+ const fontHeightRatio = 0.618;
292
+ const paddingRatio = (1 - fontHeightRatio) / 2;
293
+ const paddingSize = paddingRatio * rectHeight;
294
+ const fontSize = rectHeight * fontHeightRatio;
295
+ const iconSize = fontSize;
296
+ textBox.pos(context.isHorizontal() ? { x, y } : { x: y, y: x }).fixedHeight(context.isHorizontal() ? rectHeight : rectWidth).fixedWidth(context.isHorizontal() ? rectWidth : rectHeight).icon(typeof d[context._icon_idx] !== "undefined" ? d[context._icon_idx] : "").title(typeof d[context._title_idx] !== "undefined" ? d[context._title_idx] : "").padding(paddingSize).iconDiameter(iconSize).titleFontSize(fontSize);
297
+ if (iconSize * 1.5 > rectWidth) {
298
+ textBox.icon(null);
299
+ }
300
+ context.updateEntityRect(textBox, d[context._icon_idx]);
301
+ textBox.render();
302
+ });
303
+ buckets.exit().remove();
304
+ }
305
+ exit(domNode, element) {
306
+ this.brAxis.target(null);
307
+ this.tlAxis.target(null);
308
+ super.exit(domNode, element);
309
+ }
310
+ // Events ---
311
+ click(row, col, sel) {
312
+ }
313
+ dblclick(row, col, sel) {
314
+ }
315
+ enterEntityRect(textbox, d) {
316
+ }
317
+ updateEntityRect(textbox, d) {
318
+ }
307
319
  };
320
+ __name(_MiniGantt, "MiniGantt");
321
+ let MiniGantt = _MiniGantt;
308
322
  MiniGantt.prototype._class += " timeline_MiniGantt";
309
323
  MiniGantt.prototype.implements(ITooltip.prototype);
310
324
  MiniGantt.prototype.mixin(Utility.SimpleSelectionMixin);
@@ -331,414 +345,497 @@ MiniGantt.prototype.publish("hideTitleWhenCollapsed", false, "boolean", "hideTit
331
345
  MiniGantt.prototype.publish("hideDescriptionWhenCollapsed", false, "boolean", "hideDescriptionWhenCollapsed");
332
346
  MiniGantt.prototype.publish("hideAnnotationsWhenCollapsed", true, "boolean", "hideAnnotationsWhenCollapsed");
333
347
  MiniGantt.prototype.publish("centerOnMostRecent", false, "boolean", "If true, the timeline will be centered on the most recent data point");
334
-
335
- //#endregion
336
- //#region src/ReactGantt.ts
337
- var ReactGantt = class extends SVGZoomWidget {
338
- _selection = new Utility.Selection(this);
339
- _buckets;
340
- _interpolateX;
341
- _interpolateY;
342
- _bucketsBySeries;
343
- _dataBySeries;
344
- _origIdxMap;
345
- _seriesBackgrounds;
346
- _maxFontSize;
347
- _tooltip;
348
- _minStart;
349
- _maxEnd;
350
- _title_idx = 0;
351
- _startDate_idx = 1;
352
- _endDate_idx = 2;
353
- _icon_idx = -1;
354
- _color_idx = -1;
355
- _series_idx = -1;
356
- _bucket_idx = -1;
357
- _yoffset_idx = -1;
358
- _maxX;
359
- _maxY;
360
- _rangeOptions = {
361
- rangePadding: 2,
362
- fontFamily: "Verdana",
363
- fontSize: 12,
364
- fill: "white",
365
- stroke: "black",
366
- textFill: "black",
367
- cornerRadius: 3,
368
- strokeWidth: 0
369
- };
370
- constructor(drawStartPosition = "origin") {
371
- super();
372
- this._drawStartPos = drawStartPosition;
373
- this.showToolbar_default(false);
374
- this._tooltip = new HTMLTooltip();
375
- this._tooltip.tooltipHTML((d) => {
376
- return `<div style="text-align:center;">${d[0]}<br/><br/>${d[1]} -&gt; ${d[2]}</div>`;
377
- });
378
- this._tooltip.followCursor(true);
379
- }
380
- selection(_) {
381
- if (!arguments.length) return this._selection.get();
382
- this._selection.set(_);
383
- return this;
384
- }
385
- _rangeRenderer = LabelledRect;
386
- rangeRenderer(_) {
387
- if (!arguments.length) return this._rangeRenderer;
388
- this._rangeRenderer = _;
389
- return this._rangeRenderer;
390
- }
391
- enter(domNode, element) {
392
- super.enter(domNode, element);
393
- const context = this;
394
- element.on("click", function(d) {
395
- context._selection.clear();
396
- });
397
- this._tooltip.target(domNode);
398
- }
399
- update(domNode, element) {
400
- super.update(domNode, element);
401
- this.zoomExtent([.05, this.maxZoom()]);
402
- this._title_idx = this.titleColumn() !== null ? this.columns().indexOf(this.titleColumn()) : this._title_idx;
403
- this._startDate_idx = this.startDateColumn() !== null ? this.columns().indexOf(this.startDateColumn()) : this._startDate_idx;
404
- this._endDate_idx = this.endDateColumn() !== null ? this.columns().indexOf(this.endDateColumn()) : this._endDate_idx;
405
- this._icon_idx = this.iconColumn() !== null ? this.columns().indexOf(this.iconColumn()) : this._icon_idx;
406
- this._color_idx = this.colorColumn() !== null ? this.columns().indexOf(this.colorColumn()) : this._color_idx;
407
- this._series_idx = this.seriesColumn() !== null ? this.columns().indexOf(this.seriesColumn()) : this._series_idx;
408
- this._bucket_idx = this.bucketColumn() !== null ? this.columns().indexOf(this.bucketColumn()) : -1;
409
- const context = this;
410
- const w = this.width();
411
- const x0 = 0;
412
- const x1 = w;
413
- this._interpolateX = scaleLinear().domain([this._minStart, this._maxEnd]).range([x0, x1]);
414
- this.data().sort((a, b) => a[1] - b[1]);
415
- if (this._series_idx > -1) {
416
- this._origIdxMap = {};
417
- this._dataBySeries = {};
418
- this._bucketsBySeries = {};
419
- this.data().forEach((dataRow, origIdx) => {
420
- const seriesKey = dataRow[this._series_idx];
421
- if (!this._dataBySeries[seriesKey]) {
422
- this._origIdxMap[seriesKey] = {};
423
- this._dataBySeries[seriesKey] = [];
424
- }
425
- this._dataBySeries[seriesKey].push({
426
- dataRow,
427
- origIdx
428
- });
429
- });
430
- const gutter = this.gutter();
431
- let bucketOffset = 0;
432
- const seriesKeys = Object.keys(this._dataBySeries);
433
- seriesKeys.forEach((seriesKey) => {
434
- this._dataBySeries[seriesKey].sort((a, b) => a.dataRow[1] - b.dataRow[1]);
435
- this._bucketsBySeries[seriesKey] = this.calcBuckets(this._dataBySeries[seriesKey].map((n) => n.dataRow), 1, 2);
436
- this._bucketsBySeries[seriesKey].bucketHeight = this.bucketHeight();
437
- this._bucketsBySeries[seriesKey].bucketOffset = bucketOffset;
438
- bucketOffset += (this._bucketsBySeries[seriesKey].bucketHeight + this.strokeWidth() + this.gutter()) * (this._bucketsBySeries[seriesKey].maxBucket + 1);
439
- this._dataBySeries[seriesKey].forEach((n, i) => {
440
- this._origIdxMap[seriesKey][n.origIdx] = i;
441
- });
442
- });
443
- this._seriesBackgrounds = this._renderElement.selectAll(".series-background").data(seriesKeys.map((key) => {
444
- return this._bucketsBySeries[key];
445
- }));
446
- this._seriesBackgrounds.join((enter) => enter.append("rect").attr("class", "series-background"), (update) => update, (exit) => exit.each(function(d) {
447
- delete d.element;
448
- }).remove()).attr("opacity", (d) => d.props && d.props.hidden ? 0 : 1).each(function(d, i) {
449
- select(this).attr("x", 0).attr("y", d.bucketOffset - gutter / 2).attr("width", w).attr("height", (d.bucketHeight + gutter) * (d.maxBucket + 1) + gutter).attr("fill", i % 2 ? context.oddSeriesBackground() : context.evenSeriesBackground());
450
- });
451
- } else if (this._bucket_idx !== -1) this._buckets = this.calcBuckets(this.data(), this._startDate_idx, this._endDate_idx, this._bucket_idx);
452
- else this._buckets = this.calcBuckets(this.data(), this._startDate_idx, this._endDate_idx);
453
- const interpedStart = this._interpolateX(this._minStart);
454
- this.zoomTo([interpedStart, 0], 1);
455
- const bucketHeight = this.bucketHeight();
456
- this.setRangeOptions();
457
- this._maxFontScale = bucketHeight - this.rangePadding() * 2;
458
- this.measureDataText();
459
- const itemSelection = this._renderElement.selectAll(".item").data(this.data());
460
- const borderOffset1 = this.strokeWidth();
461
- const borderOffset2 = borderOffset1 * 2;
462
- itemSelection.join((enter) => enter.append("g").attr("class", "item").on("click.selectionBag", function(d, i) {
463
- const _id = d.id === void 0 ? i : d.id;
464
- if (context._selection.isSelected({
465
- _id,
466
- element: d.element
467
- })) context._selection.clear();
468
- else context._selection.click({
469
- _id,
470
- element: () => d.element
471
- }, d3Event);
472
- context.selectionChanged();
473
- d3Event().stopPropagation();
474
- }).on("click", function(d) {
475
- const selected = d.element.classed("selected");
476
- if (d[context.columns().length]) d.__lparam = d[context.columns().length];
477
- context.click(d, "", selected);
478
- }).on("dblclick", function(d) {
479
- const selected = d.element.classed("selected");
480
- if (d[context.columns().length]) d.__lparam = d[context.columns().length];
481
- context.click(d, "", selected);
482
- }).on("mousein", function(d) {
483
- context.highlightItem(select(this), d);
484
- const selected = d.element.classed("selected");
485
- context.mousein(d, "", selected);
486
- }).on("mouseover", function(d) {
487
- const d3evt = d3Event();
488
- context._tooltip._triggerElement = d.element;
489
- context._tooltip._cursorLoc = [d3evt.clientX, d3evt.clientY];
490
- context._tooltip.data(d).visible(true).fitContent(true).render();
491
- context.highlightItem(select(this), d);
492
- const selected = d.element.classed("selected");
493
- context.mouseover(d, "", selected);
494
- }).on("mouseout", function(d) {
495
- context._tooltip.visible(false).render();
496
- context.highlightItem(null, null);
497
- const selected = d.element.classed("selected");
498
- context.mouseout(d, "", selected);
499
- }).each(function(d, i) {
500
- d.that = this;
501
- d.element = select(this);
502
- d.x = context._interpolateX(d[1]);
503
- const endX = context._interpolateX(d[2]);
504
- if (context._series_idx > -1) {
505
- const seriesKey = d[context._series_idx];
506
- const bucket = context._bucketsBySeries[seriesKey].bucketMap[context._origIdxMap[seriesKey][i]];
507
- d.y = context._bucketsBySeries[seriesKey].interpolateY(bucket) + context._bucketsBySeries[seriesKey].bucketOffset;
508
- } else {
509
- const _i = context._bucket_idx === -1 ? i : d[context._bucket_idx];
510
- d.y = context._buckets.interpolateY(context._buckets.bucketMap[_i]);
511
- }
512
- d.props = {
513
- ...d[3],
514
- text: d[0]
515
- };
516
- d.props.width = endX - d.x;
517
- d.props.height = bucketHeight;
518
- d.x += borderOffset1;
519
- d.y += borderOffset1;
520
- d.props.width -= borderOffset2;
521
- d.props.height -= borderOffset2;
522
- d.element.attr("transform", `translate(${d.x + d.props.width / 2} ${d.y + d.props.height / 2})`);
523
- }), (update) => update, (exit) => exit.each(function(d) {
524
- delete d.element;
525
- }).remove()).attr("opacity", (d) => d.props && d.props.hidden ? 0 : 1).each(function(d, i) {
526
- d.that = this;
527
- if (context._series_idx > -1) {
528
- const seriesKey = d[context._series_idx];
529
- d.x = context.renderRangeElement(d, i, false, context._rangeOptions, seriesKey);
530
- } else d.x = context.renderRangeElement(d, i, false, context._rangeOptions);
531
- }).on("dblclick.zoom", (d) => {
532
- const x1$1 = this._interpolateX(d[1]);
533
- const xScale = w / (this._interpolateX(d[2]) - x1$1);
534
- this.zoomTo([-x1$1 * xScale, 0], xScale);
535
- });
536
- element.on("dblclick.zoom", null);
537
- }
538
- exit(domNode, element) {
539
- this._tooltip.target(null);
540
- super.exit(domNode, element);
541
- }
542
- renderRangeElement(d, i, transformEach = false, options = {}, seriesKey) {
543
- const borderOffset1 = options.strokeWidth;
544
- const borderOffset2 = borderOffset1 * 2;
545
- const padding = options.rangePadding;
546
- let endX;
547
- const x = isNaN(this._transform.x) ? 0 : this._transform.x;
548
- const k = isNaN(this._transform.k) ? 1 : this._transform.k;
549
- let b;
550
- const bucketHeight = this.bucketHeight();
551
- d.that.setAttribute("data-series", seriesKey);
552
- if (this._color_idx > -1) d.that.setAttribute("data-color", d[this._color_idx]);
553
- if (seriesKey !== void 0) {
554
- b = this._bucketsBySeries[seriesKey].bucketMap[this._origIdxMap[seriesKey][i]];
555
- d.that.setAttribute("data-b", b);
556
- d.that.setAttribute("data-bucketOffset", this._bucketsBySeries[seriesKey].bucketOffset);
557
- d.y = this._bucketsBySeries[seriesKey].interpolateY(b) + this._bucketsBySeries[seriesKey].bucketOffset;
558
- d.that.setAttribute("data-dy", d.y);
559
- } else {
560
- b = this._buckets.bucketMap[i];
561
- d.y = this._buckets.interpolateY(b);
562
- }
563
- if (this._color_idx > -1) options.fill = d[this._color_idx];
564
- if (!transformEach) {
565
- d.x = this._interpolateX(d[1]);
566
- endX = this._interpolateX(d[2]);
567
- d.props = {
568
- ...d[3],
569
- text: d[0]
570
- };
571
- d.props.width = (endX - d.x) / k;
572
- } else {
573
- d.x = this._interpolateX(d[1]) * k;
574
- endX = this._interpolateX(d[2]) * k;
575
- d.props = {
576
- ...d[3],
577
- text: d[0]
578
- };
579
- d.props.width = (endX - d.x) / k;
580
- d.x += x;
581
- d.props.width *= k;
582
- }
583
- d.props.height = bucketHeight;
584
- if (seriesKey === void 0 && this._buckets.bucketScale < 1) d.props.height = this._buckets.bucketScale * bucketHeight;
585
- if (d.element === void 0 && d.that) d.element = select(d.that);
586
- d.element.attr("transform", `translate(${d.x + d.props.width / 2} ${d.y + d.props.height / 2})`);
587
- d.x += borderOffset1;
588
- d.y += borderOffset1;
589
- d.props.width -= borderOffset2;
590
- d.props.height -= borderOffset2;
591
- d.props.width = d.props.width < 1 ? 1 : d.props.width;
592
- d.props.height = d.props.height < 1 ? 1 : d.props.height;
593
- let text = this.truncateText(d.props.text, d.props.width - padding, this._maxFontScale);
594
- if (text !== d.props.text) text = this.truncateText(d.props.text, d.props.width - padding);
595
- else d.props.fontSize = this._maxFontScale * options.fontSize;
596
- if (seriesKey === void 0 && this._buckets.bucketScale < 1) d.props.fontSize = Math.min(this._maxFontScale, this._buckets.bucketScale) * options.fontSize;
597
- if (!this._maxY || this._maxY < d.y + d.props.height) this._maxY = d.y + d.props.height;
598
- if (!this._maxX || this._maxX < d.x + d.props.width) this._maxX = d.x + d.props.width;
599
- render(this._rangeRenderer, {
600
- ...options,
601
- ...d.props,
602
- text
603
- }, d.that);
604
- }
605
- setRangeOptions() {
606
- this._rangeOptions = {
607
- rangePadding: this.rangePadding(),
608
- fontFamily: this.fontFamily(),
609
- fontSize: this.fontSize(),
610
- strokeWidth: this.strokeWidth(),
611
- fill: this.fill(),
612
- stroke: this.stroke(),
613
- textFill: this.rangeFontColor(),
614
- cornerRadius: this.cornerRadius()
615
- };
616
- }
617
- _transform = {
618
- k: 1,
619
- x: 0,
620
- y: 0
621
- };
622
- zoomed(transform) {
623
- this._transform = transform;
624
- switch (this.renderMode()) {
625
- case "scale-all":
626
- this._zoomScale = transform.k;
627
- this._zoomTranslate = [transform.x, 0];
628
- this._zoomG.attr("transform", `translate(${transform.x} 0)scale(${transform.k} 1)`);
629
- break;
630
- default:
631
- const options = this._rangeOptions;
632
- this.data().forEach((d, i) => {
633
- if (this._color_idx > -1) options.fill = d[this._color_idx];
634
- if (this._series_idx > -1) {
635
- const seriesKey = d[this._series_idx];
636
- this.renderRangeElement(d, i, true, options, seriesKey);
637
- } else this.renderRangeElement(d, i, true, options);
638
- });
639
- }
640
- this.zoomedHook(transform);
641
- }
642
- zoomedHook(transform) {}
643
- calcBuckets(data, startKey, endKey, bucketKey) {
644
- const bucketMap = {};
645
- const bucketKeyMap = {};
646
- const tol = this.overlapTolerence();
647
- const buckets = [{ end: -Infinity }];
648
- let maxBucket = 0;
649
- if (bucketKey !== void 0) {
650
- data.forEach((d, i) => {
651
- bucketMap[i] = d[bucketKey];
652
- bucketKeyMap[d[bucketKey]] = true;
653
- });
654
- maxBucket = Object.keys(bucketKeyMap).length;
655
- } else data.forEach((d, i) => {
656
- for (let i2 = 0; i2 < buckets.length; ++i2) if (i === 0 || buckets[i2][endKey] + tol <= d[startKey]) {
657
- bucketMap[i] = i2;
658
- if (maxBucket < i2) maxBucket = i2;
659
- buckets[i2][endKey] = d[endKey];
660
- break;
661
- }
662
- if (bucketMap[i] === void 0) {
663
- bucketMap[i] = buckets.length;
664
- const b = {};
665
- b[endKey] = d[endKey];
666
- buckets.push(b);
667
- }
668
- if (maxBucket < bucketMap[i]) maxBucket = bucketMap[i];
669
- });
670
- const height = (maxBucket + 1) * (this.bucketHeight() + this.gutter());
671
- return {
672
- bucketMap,
673
- maxBucket,
674
- bucketScale: this.height() / height,
675
- interpolateY: scaleLinear().domain([0, maxBucket + 1]).range([0, Math.min(this.height(), height)])
676
- };
677
- }
678
- data(_) {
679
- const retVal = super.data.apply(this, arguments);
680
- if (arguments.length > 0) {
681
- this._minStart = Math.min(...this.data().map((n) => n[1])) ?? 0;
682
- this._maxEnd = Math.max(...this.data().map((n) => n[2])) ?? 1;
683
- this.measureDataText(true);
684
- }
685
- return retVal;
686
- }
687
- _textWidths;
688
- _maxFontScale;
689
- _characterWidths;
690
- _prevFontFamily;
691
- _prevFontSize;
692
- measureDataText(forceMeasure = false) {
693
- const textWidths = {};
694
- const characterWidths = {};
695
- const fontFamily = this.fontFamily();
696
- const fontSize = this.fontSize();
697
- const bucketHeight = this.bucketHeight();
698
- if (bucketHeight) this._maxFontScale = (bucketHeight - this.rangePadding() * 2) / fontSize;
699
- if (forceMeasure || this._prevFontFamily !== fontFamily || this._prevFontSize !== fontSize) {
700
- characterWidths["."] = Utility.textSize(".", fontFamily, fontSize).width;
701
- this.data().forEach((d) => {
702
- if (!textWidths[d[0]]) textWidths[d[0]] = Utility.textSize(d[0], fontFamily, fontSize).width;
703
- d[0].split("").forEach((char) => {
704
- if (!characterWidths[char]) characterWidths[char] = Utility.textSize(char, fontFamily, fontSize).width;
705
- });
706
- });
707
- this._textWidths = textWidths;
708
- this._characterWidths = characterWidths;
709
- }
710
- this._prevFontFamily = fontFamily;
711
- this._prevFontSize = fontSize;
712
- }
713
- truncateText(text, width, scale = 1) {
714
- if (this._textWidths[text] * scale < width) return text;
715
- let ret = "";
716
- let sum = 0;
717
- const _width = width - this._characterWidths["."] * 3;
718
- for (const char of text) {
719
- sum += this._characterWidths[char];
720
- if (sum < _width) ret += char;
721
- else break;
722
- }
723
- return _width < 0 ? "" : ret + "...";
724
- }
725
- resize(_size) {
726
- let retVal;
727
- if (this.fitWidthToContent() || this.fitHeightToContent()) retVal = super.resize.call(this, {
728
- width: _size.width,
729
- height: this._maxY
730
- });
731
- else retVal = super.resize.apply(this, arguments);
732
- return retVal;
733
- }
734
- selectionChanged() {}
735
- highlightItem(_element, d) {}
736
- click(row, _col, sel) {}
737
- dblclick(row, _col, sel) {}
738
- mousein(row, _col, sel) {}
739
- mouseover(row, _col, sel) {}
740
- mouseout(row, _col, sel) {}
348
+ const _ReactGantt = class _ReactGantt extends SVGZoomWidget {
349
+ _selection = new Utility.Selection(this);
350
+ _buckets;
351
+ _interpolateX;
352
+ _interpolateY;
353
+ _bucketsBySeries;
354
+ _dataBySeries;
355
+ _origIdxMap;
356
+ _seriesBackgrounds;
357
+ _maxFontSize;
358
+ _tooltip;
359
+ _minStart;
360
+ _maxEnd;
361
+ _title_idx = 0;
362
+ _startDate_idx = 1;
363
+ _endDate_idx = 2;
364
+ _icon_idx = -1;
365
+ _color_idx = -1;
366
+ _series_idx = -1;
367
+ _bucket_idx = -1;
368
+ _yoffset_idx = -1;
369
+ _maxX;
370
+ _maxY;
371
+ _rangeOptions = {
372
+ rangePadding: 2,
373
+ fontFamily: "Verdana",
374
+ fontSize: 12,
375
+ fill: "white",
376
+ stroke: "black",
377
+ textFill: "black",
378
+ cornerRadius: 3,
379
+ strokeWidth: 0
380
+ };
381
+ constructor(drawStartPosition = "origin") {
382
+ super();
383
+ this._drawStartPos = drawStartPosition;
384
+ this.showToolbar_default(false);
385
+ this._tooltip = new HTMLTooltip();
386
+ this._tooltip.tooltipHTML((d) => {
387
+ return `<div style="text-align:center;">${d[0]}<br/><br/>${d[1]} -&gt; ${d[2]}</div>`;
388
+ });
389
+ this._tooltip.followCursor(true);
390
+ }
391
+ selection(_) {
392
+ if (!arguments.length) return this._selection.get();
393
+ this._selection.set(_);
394
+ return this;
395
+ }
396
+ _rangeRenderer = LabelledRect;
397
+ rangeRenderer(_) {
398
+ if (!arguments.length) return this._rangeRenderer;
399
+ this._rangeRenderer = _;
400
+ return this._rangeRenderer;
401
+ }
402
+ enter(domNode, element) {
403
+ super.enter(domNode, element);
404
+ const context = this;
405
+ element.on("click", function(d) {
406
+ context._selection.clear();
407
+ });
408
+ this._tooltip.target(domNode);
409
+ }
410
+ update(domNode, element) {
411
+ super.update(domNode, element);
412
+ this.zoomExtent([0.05, this.maxZoom()]);
413
+ this._title_idx = this.titleColumn() !== null ? this.columns().indexOf(this.titleColumn()) : this._title_idx;
414
+ this._startDate_idx = this.startDateColumn() !== null ? this.columns().indexOf(this.startDateColumn()) : this._startDate_idx;
415
+ this._endDate_idx = this.endDateColumn() !== null ? this.columns().indexOf(this.endDateColumn()) : this._endDate_idx;
416
+ this._icon_idx = this.iconColumn() !== null ? this.columns().indexOf(this.iconColumn()) : this._icon_idx;
417
+ this._color_idx = this.colorColumn() !== null ? this.columns().indexOf(this.colorColumn()) : this._color_idx;
418
+ this._series_idx = this.seriesColumn() !== null ? this.columns().indexOf(this.seriesColumn()) : this._series_idx;
419
+ this._bucket_idx = this.bucketColumn() !== null ? this.columns().indexOf(this.bucketColumn()) : -1;
420
+ const context = this;
421
+ const w = this.width();
422
+ const x0 = 0;
423
+ const x1 = w;
424
+ this._interpolateX = scaleLinear().domain([this._minStart, this._maxEnd]).range([x0, x1]);
425
+ this.data().sort((a, b) => a[1] - b[1]);
426
+ if (this._series_idx > -1) {
427
+ this._origIdxMap = {};
428
+ this._dataBySeries = {};
429
+ this._bucketsBySeries = {};
430
+ this.data().forEach((dataRow, origIdx) => {
431
+ const seriesKey = dataRow[this._series_idx];
432
+ if (!this._dataBySeries[seriesKey]) {
433
+ this._origIdxMap[seriesKey] = {};
434
+ this._dataBySeries[seriesKey] = [];
435
+ }
436
+ this._dataBySeries[seriesKey].push({
437
+ dataRow,
438
+ origIdx
439
+ });
440
+ });
441
+ const gutter = this.gutter();
442
+ let bucketOffset = 0;
443
+ const seriesKeys = Object.keys(this._dataBySeries);
444
+ seriesKeys.forEach((seriesKey) => {
445
+ this._dataBySeries[seriesKey].sort((a, b) => a.dataRow[1] - b.dataRow[1]);
446
+ this._bucketsBySeries[seriesKey] = this.calcBuckets(this._dataBySeries[seriesKey].map((n) => n.dataRow), 1, 2);
447
+ this._bucketsBySeries[seriesKey].bucketHeight = this.bucketHeight();
448
+ this._bucketsBySeries[seriesKey].bucketOffset = bucketOffset;
449
+ bucketOffset += (this._bucketsBySeries[seriesKey].bucketHeight + this.strokeWidth() + this.gutter()) * (this._bucketsBySeries[seriesKey].maxBucket + 1);
450
+ this._dataBySeries[seriesKey].forEach((n, i) => {
451
+ this._origIdxMap[seriesKey][n.origIdx] = i;
452
+ });
453
+ });
454
+ this._seriesBackgrounds = this._renderElement.selectAll(".series-background").data(seriesKeys.map((key) => {
455
+ return this._bucketsBySeries[key];
456
+ }));
457
+ this._seriesBackgrounds.join(
458
+ (enter) => enter.append("rect").attr("class", "series-background"),
459
+ (update) => update,
460
+ (exit) => exit.each(function(d) {
461
+ delete d.element;
462
+ }).remove()
463
+ ).attr("opacity", (d) => d.props && d.props.hidden ? 0 : 1).each(function(d, i) {
464
+ select(this).attr("x", 0).attr("y", d.bucketOffset - gutter / 2).attr("width", w).attr("height", (d.bucketHeight + gutter) * (d.maxBucket + 1) + gutter).attr("fill", i % 2 ? context.oddSeriesBackground() : context.evenSeriesBackground());
465
+ });
466
+ } else {
467
+ if (this._bucket_idx !== -1) {
468
+ this._buckets = this.calcBuckets(this.data(), this._startDate_idx, this._endDate_idx, this._bucket_idx);
469
+ } else {
470
+ this._buckets = this.calcBuckets(this.data(), this._startDate_idx, this._endDate_idx);
471
+ }
472
+ }
473
+ const interpedStart = this._interpolateX(this._minStart);
474
+ this.zoomTo(
475
+ [interpedStart, 0],
476
+ 1
477
+ );
478
+ const bucketHeight = this.bucketHeight();
479
+ this.setRangeOptions();
480
+ this._maxFontScale = bucketHeight - this.rangePadding() * 2;
481
+ this.measureDataText();
482
+ const itemSelection = this._renderElement.selectAll(".item").data(this.data());
483
+ const borderOffset1 = this.strokeWidth();
484
+ const borderOffset2 = borderOffset1 * 2;
485
+ itemSelection.join(
486
+ (enter) => enter.append("g").attr("class", "item").on("click.selectionBag", function(d, i) {
487
+ const _id = d.id === void 0 ? i : d.id;
488
+ if (context._selection.isSelected({ _id, element: d.element })) {
489
+ context._selection.clear();
490
+ } else {
491
+ context._selection.click(
492
+ {
493
+ _id,
494
+ element: /* @__PURE__ */ __name(() => d.element, "element")
495
+ },
496
+ d3Event
497
+ );
498
+ }
499
+ context.selectionChanged();
500
+ d3Event().stopPropagation();
501
+ }).on("click", function(d) {
502
+ const selected = d.element.classed("selected");
503
+ if (d[context.columns().length]) {
504
+ d.__lparam = d[context.columns().length];
505
+ }
506
+ context.click(d, "", selected);
507
+ }).on("dblclick", function(d) {
508
+ const selected = d.element.classed("selected");
509
+ if (d[context.columns().length]) {
510
+ d.__lparam = d[context.columns().length];
511
+ }
512
+ context.click(d, "", selected);
513
+ }).on("mousein", function(d) {
514
+ context.highlightItem(select(this), d);
515
+ const selected = d.element.classed("selected");
516
+ context.mousein(d, "", selected);
517
+ }).on("mouseover", function(d) {
518
+ const d3evt = d3Event();
519
+ context._tooltip._triggerElement = d.element;
520
+ context._tooltip._cursorLoc = [
521
+ d3evt.clientX,
522
+ d3evt.clientY
523
+ ];
524
+ context._tooltip.data(d).visible(true).fitContent(true).render();
525
+ context.highlightItem(select(this), d);
526
+ const selected = d.element.classed("selected");
527
+ context.mouseover(d, "", selected);
528
+ }).on("mouseout", function(d) {
529
+ context._tooltip.visible(false).render();
530
+ context.highlightItem(null, null);
531
+ const selected = d.element.classed("selected");
532
+ context.mouseout(d, "", selected);
533
+ }).each(function(d, i) {
534
+ d.that = this;
535
+ d.element = select(this);
536
+ d.x = context._interpolateX(d[1]);
537
+ const endX = context._interpolateX(d[2]);
538
+ if (context._series_idx > -1) {
539
+ const seriesKey = d[context._series_idx];
540
+ const bucket = context._bucketsBySeries[seriesKey].bucketMap[context._origIdxMap[seriesKey][i]];
541
+ d.y = context._bucketsBySeries[seriesKey].interpolateY(bucket) + context._bucketsBySeries[seriesKey].bucketOffset;
542
+ } else {
543
+ const _i = context._bucket_idx === -1 ? i : d[context._bucket_idx];
544
+ d.y = context._buckets.interpolateY(context._buckets.bucketMap[_i]);
545
+ }
546
+ d.props = {
547
+ ...d[3],
548
+ text: d[0]
549
+ };
550
+ d.props.width = endX - d.x;
551
+ d.props.height = bucketHeight;
552
+ d.x += borderOffset1;
553
+ d.y += borderOffset1;
554
+ d.props.width -= borderOffset2;
555
+ d.props.height -= borderOffset2;
556
+ d.element.attr("transform", `translate(${d.x + d.props.width / 2} ${d.y + d.props.height / 2})`);
557
+ }),
558
+ (update) => update,
559
+ (exit) => exit.each(function(d) {
560
+ delete d.element;
561
+ }).remove()
562
+ ).attr("opacity", (d) => d.props && d.props.hidden ? 0 : 1).each(function(d, i) {
563
+ d.that = this;
564
+ if (context._series_idx > -1) {
565
+ const seriesKey = d[context._series_idx];
566
+ d.x = context.renderRangeElement(d, i, false, context._rangeOptions, seriesKey);
567
+ } else {
568
+ d.x = context.renderRangeElement(d, i, false, context._rangeOptions);
569
+ }
570
+ }).on("dblclick.zoom", (d) => {
571
+ const x12 = this._interpolateX(d[1]);
572
+ const x2 = this._interpolateX(d[2]);
573
+ const xRange = x2 - x12;
574
+ const xScale = w / xRange;
575
+ this.zoomTo(
576
+ [
577
+ -x12 * xScale,
578
+ 0
579
+ ],
580
+ xScale
581
+ );
582
+ });
583
+ element.on("dblclick.zoom", null);
584
+ }
585
+ exit(domNode, element) {
586
+ this._tooltip.target(null);
587
+ super.exit(domNode, element);
588
+ }
589
+ renderRangeElement(d, i, transformEach = false, options = {}, seriesKey) {
590
+ const borderOffset1 = options.strokeWidth;
591
+ const borderOffset2 = borderOffset1 * 2;
592
+ const padding = options.rangePadding;
593
+ let endX;
594
+ const x = isNaN(this._transform.x) ? 0 : this._transform.x;
595
+ const k = isNaN(this._transform.k) ? 1 : this._transform.k;
596
+ let b;
597
+ const bucketHeight = this.bucketHeight();
598
+ d.that.setAttribute("data-series", seriesKey);
599
+ if (this._color_idx > -1) {
600
+ d.that.setAttribute("data-color", d[this._color_idx]);
601
+ }
602
+ if (seriesKey !== void 0) {
603
+ b = this._bucketsBySeries[seriesKey].bucketMap[this._origIdxMap[seriesKey][i]];
604
+ d.that.setAttribute("data-b", b);
605
+ d.that.setAttribute("data-bucketOffset", this._bucketsBySeries[seriesKey].bucketOffset);
606
+ d.y = this._bucketsBySeries[seriesKey].interpolateY(b) + this._bucketsBySeries[seriesKey].bucketOffset;
607
+ d.that.setAttribute("data-dy", d.y);
608
+ } else {
609
+ b = this._buckets.bucketMap[i];
610
+ d.y = this._buckets.interpolateY(b);
611
+ }
612
+ if (this._color_idx > -1) {
613
+ options.fill = d[this._color_idx];
614
+ }
615
+ if (!transformEach) {
616
+ d.x = this._interpolateX(d[1]);
617
+ endX = this._interpolateX(d[2]);
618
+ d.props = {
619
+ ...d[3],
620
+ text: d[0]
621
+ };
622
+ d.props.width = (endX - d.x) / k;
623
+ } else {
624
+ d.x = this._interpolateX(d[1]) * k;
625
+ endX = this._interpolateX(d[2]) * k;
626
+ d.props = {
627
+ ...d[3],
628
+ text: d[0]
629
+ };
630
+ d.props.width = (endX - d.x) / k;
631
+ d.x += x;
632
+ d.props.width *= k;
633
+ }
634
+ d.props.height = bucketHeight;
635
+ if (seriesKey === void 0 && this._buckets.bucketScale < 1) {
636
+ d.props.height = this._buckets.bucketScale * bucketHeight;
637
+ }
638
+ if (d.element === void 0 && d.that) {
639
+ d.element = select(d.that);
640
+ }
641
+ d.element.attr("transform", `translate(${d.x + d.props.width / 2} ${d.y + d.props.height / 2})`);
642
+ d.x += borderOffset1;
643
+ d.y += borderOffset1;
644
+ d.props.width -= borderOffset2;
645
+ d.props.height -= borderOffset2;
646
+ d.props.width = d.props.width < 1 ? 1 : d.props.width;
647
+ d.props.height = d.props.height < 1 ? 1 : d.props.height;
648
+ let text = this.truncateText(d.props.text, d.props.width - padding, this._maxFontScale);
649
+ if (text !== d.props.text) {
650
+ text = this.truncateText(d.props.text, d.props.width - padding);
651
+ } else {
652
+ d.props.fontSize = this._maxFontScale * options.fontSize;
653
+ }
654
+ if (seriesKey === void 0 && this._buckets.bucketScale < 1) {
655
+ d.props.fontSize = Math.min(this._maxFontScale, this._buckets.bucketScale) * options.fontSize;
656
+ }
657
+ if (!this._maxY || this._maxY < d.y + d.props.height) {
658
+ this._maxY = d.y + d.props.height;
659
+ }
660
+ if (!this._maxX || this._maxX < d.x + d.props.width) {
661
+ this._maxX = d.x + d.props.width;
662
+ }
663
+ render(
664
+ this._rangeRenderer,
665
+ {
666
+ ...options,
667
+ ...d.props,
668
+ text
669
+ },
670
+ d.that
671
+ );
672
+ }
673
+ setRangeOptions() {
674
+ this._rangeOptions = {
675
+ rangePadding: this.rangePadding(),
676
+ fontFamily: this.fontFamily(),
677
+ fontSize: this.fontSize(),
678
+ strokeWidth: this.strokeWidth(),
679
+ fill: this.fill(),
680
+ stroke: this.stroke(),
681
+ textFill: this.rangeFontColor(),
682
+ cornerRadius: this.cornerRadius()
683
+ };
684
+ }
685
+ _transform = { k: 1, x: 0, y: 0 };
686
+ zoomed(transform) {
687
+ this._transform = transform;
688
+ switch (this.renderMode()) {
689
+ case "scale-all":
690
+ this._zoomScale = transform.k;
691
+ this._zoomTranslate = [transform.x, 0];
692
+ this._zoomG.attr("transform", `translate(${transform.x} ${0})scale(${transform.k} 1)`);
693
+ break;
694
+ default:
695
+ const options = this._rangeOptions;
696
+ this.data().forEach((d, i) => {
697
+ if (this._color_idx > -1) {
698
+ options.fill = d[this._color_idx];
699
+ }
700
+ if (this._series_idx > -1) {
701
+ const seriesKey = d[this._series_idx];
702
+ this.renderRangeElement(d, i, true, options, seriesKey);
703
+ } else {
704
+ this.renderRangeElement(d, i, true, options);
705
+ }
706
+ });
707
+ }
708
+ this.zoomedHook(transform);
709
+ }
710
+ zoomedHook(transform) {
711
+ }
712
+ calcBuckets(data, startKey, endKey, bucketKey) {
713
+ const bucketMap = {};
714
+ const bucketKeyMap = {};
715
+ const tol = this.overlapTolerence();
716
+ const buckets = [{ end: -Infinity }];
717
+ let maxBucket = 0;
718
+ if (bucketKey !== void 0) {
719
+ data.forEach((d, i) => {
720
+ bucketMap[i] = d[bucketKey];
721
+ bucketKeyMap[d[bucketKey]] = true;
722
+ });
723
+ maxBucket = Object.keys(bucketKeyMap).length;
724
+ } else {
725
+ data.forEach((d, i) => {
726
+ for (let i2 = 0; i2 < buckets.length; ++i2) {
727
+ if (i === 0 || buckets[i2][endKey] + tol <= d[startKey]) {
728
+ bucketMap[i] = i2;
729
+ if (maxBucket < i2) maxBucket = i2;
730
+ buckets[i2][endKey] = d[endKey];
731
+ break;
732
+ }
733
+ }
734
+ if (bucketMap[i] === void 0) {
735
+ bucketMap[i] = buckets.length;
736
+ const b = {};
737
+ b[endKey] = d[endKey];
738
+ buckets.push(b);
739
+ }
740
+ if (maxBucket < bucketMap[i]) maxBucket = bucketMap[i];
741
+ });
742
+ }
743
+ const height = (maxBucket + 1) * (this.bucketHeight() + this.gutter());
744
+ return {
745
+ bucketMap,
746
+ maxBucket,
747
+ bucketScale: this.height() / height,
748
+ interpolateY: scaleLinear().domain([0, maxBucket + 1]).range([0, Math.min(this.height(), height)])
749
+ };
750
+ }
751
+ data(_) {
752
+ const retVal = super.data.apply(this, arguments);
753
+ if (arguments.length > 0) {
754
+ this._minStart = Math.min(...this.data().map((n) => n[1])) ?? 0;
755
+ this._maxEnd = Math.max(...this.data().map((n) => n[2])) ?? 1;
756
+ this.measureDataText(true);
757
+ }
758
+ return retVal;
759
+ }
760
+ _textWidths;
761
+ _maxFontScale;
762
+ _characterWidths;
763
+ _prevFontFamily;
764
+ _prevFontSize;
765
+ measureDataText(forceMeasure = false) {
766
+ const textWidths = {};
767
+ const characterWidths = {};
768
+ const fontFamily = this.fontFamily();
769
+ const fontSize = this.fontSize();
770
+ const bucketHeight = this.bucketHeight();
771
+ if (bucketHeight) {
772
+ this._maxFontScale = (bucketHeight - this.rangePadding() * 2) / fontSize;
773
+ }
774
+ if (forceMeasure || this._prevFontFamily !== fontFamily || this._prevFontSize !== fontSize) {
775
+ characterWidths["."] = Utility.textSize(".", fontFamily, fontSize).width;
776
+ this.data().forEach((d) => {
777
+ if (!textWidths[d[0]]) {
778
+ textWidths[d[0]] = Utility.textSize(d[0], fontFamily, fontSize).width;
779
+ }
780
+ d[0].split("").forEach((char) => {
781
+ if (!characterWidths[char]) {
782
+ characterWidths[char] = Utility.textSize(char, fontFamily, fontSize).width;
783
+ }
784
+ });
785
+ });
786
+ this._textWidths = textWidths;
787
+ this._characterWidths = characterWidths;
788
+ }
789
+ this._prevFontFamily = fontFamily;
790
+ this._prevFontSize = fontSize;
791
+ }
792
+ truncateText(text, width, scale = 1) {
793
+ const textFits = this._textWidths[text] * scale < width;
794
+ if (textFits) {
795
+ return text;
796
+ }
797
+ let ret = "";
798
+ let sum = 0;
799
+ const _width = width - this._characterWidths["."] * 3;
800
+ for (const char of text) {
801
+ sum += this._characterWidths[char];
802
+ if (sum < _width) {
803
+ ret += char;
804
+ } else {
805
+ break;
806
+ }
807
+ }
808
+ return _width < 0 ? "" : ret + "...";
809
+ }
810
+ resize(_size) {
811
+ let retVal;
812
+ if (this.fitWidthToContent() || this.fitHeightToContent()) {
813
+ retVal = super.resize.call(this, {
814
+ width: _size.width,
815
+ height: this._maxY
816
+ });
817
+ } else {
818
+ retVal = super.resize.apply(this, arguments);
819
+ }
820
+ return retVal;
821
+ }
822
+ selectionChanged() {
823
+ }
824
+ highlightItem(_element, d) {
825
+ }
826
+ click(row, _col, sel) {
827
+ }
828
+ dblclick(row, _col, sel) {
829
+ }
830
+ mousein(row, _col, sel) {
831
+ }
832
+ mouseover(row, _col, sel) {
833
+ }
834
+ mouseout(row, _col, sel) {
835
+ }
741
836
  };
837
+ __name(_ReactGantt, "ReactGantt");
838
+ let ReactGantt = _ReactGantt;
742
839
  ReactGantt.prototype._class += " timeline_ReactGantt";
743
840
  ReactGantt.prototype.publish("fitWidthToContent", false, "boolean", "If true, resize will simply reapply the bounding box width");
744
841
  ReactGantt.prototype.publish("fitHeightToContent", false, "boolean", "If true, resize will simply reapply the bounding box height");
@@ -765,134 +862,131 @@ ReactGantt.prototype.publish("gutter", 2, "number", "Space between range buckets
765
862
  ReactGantt.prototype.publish("maxZoom", 16, "number", "Maximum zoom");
766
863
  ReactGantt.prototype.publish("evenSeriesBackground", "#FFFFFF", "html-color", "Background color of even series rows");
767
864
  ReactGantt.prototype.publish("oddSeriesBackground", "#DDDDDD", "html-color", "Background color of odd series rows");
768
-
769
- //#endregion
770
- //#region src/ReactAxisGantt.ts
771
- var ReactAxisGantt = class extends SVGWidget {
772
- _topAxis = new Axis("center").orientation("top").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");
773
- _gantt = new ReactGantt("center").stroke("#000000");
774
- _bottomAxis = new Axis("center").orientation("bottom").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");
775
- _topAxisElement;
776
- _contentElement;
777
- _bottomAxisElement;
778
- _topRect;
779
- _contentRect;
780
- _bottomRect;
781
- rangeRenderer;
782
- constructor() {
783
- super();
784
- this._drawStartPos = "origin";
785
- this.rangeRenderer = function() {
786
- const ret = this._gantt.rangeRenderer.apply(this._gantt, arguments);
787
- if (!arguments.length) return ret;
788
- return this;
789
- };
790
- }
791
- selection(_) {
792
- if (!arguments.length) return this._gantt.selection();
793
- this._gantt.selection(_);
794
- return this;
795
- }
796
- resizeWrappers() {
797
- const w = this.width();
798
- const h = this.height();
799
- const axisHeight = this.axisHeight();
800
- const contentHeight = h - axisHeight * 2;
801
- const borderOffset1 = this.strokeWidth();
802
- this._topRect.attr("height", axisHeight).attr("width", w).attr("fill", "transparent");
803
- this._topAxisElement.attr("transform", "translate(0 0)");
804
- this._topAxis.resize({
805
- height: axisHeight,
806
- width: w
807
- });
808
- this._contentRect.attr("height", contentHeight).attr("width", w).attr("fill", "transparent");
809
- this._contentElement.attr("transform", `translate(0 ${axisHeight + borderOffset1})`);
810
- this._gantt.resize({
811
- height: contentHeight,
812
- width: w
813
- });
814
- this._bottomRect.attr("height", axisHeight).attr("width", w).attr("fill", "transparent");
815
- this._bottomAxisElement.attr("transform", `translate(0 ${axisHeight + contentHeight + borderOffset1})`);
816
- this._bottomAxis.resize({
817
- height: axisHeight,
818
- width: w
819
- });
820
- }
821
- enter(domNode, element) {
822
- super.enter(domNode, element);
823
- this._gantt.click = (row, col, sel) => {
824
- this.click(row, col, sel);
825
- };
826
- this._gantt.dblclick = (row, col, sel) => {
827
- this.dblclick(row, col, sel);
828
- };
829
- this._topAxisElement = element.append("g").attr("class", "top-axis-wrapper");
830
- this._topRect = this._topAxisElement.append("rect").attr("class", "top-axis-rect");
831
- this._contentElement = element.append("g").attr("class", "content-wrapper");
832
- this._contentRect = this._contentElement.append("rect").attr("class", "content-rect");
833
- this._bottomAxisElement = element.append("g").attr("class", "bottom-axis-wrapper");
834
- this._bottomRect = this._bottomAxisElement.append("rect").attr("class", "top-axis-rect");
835
- this._topAxis.target(this._topAxisElement.node());
836
- this._gantt.target(this._contentElement.node()).bucketHeight(30);
837
- this._bottomAxis.target(this._bottomAxisElement.node());
838
- this.resizeWrappers();
839
- this._gantt.zoomedHook = (transform) => {
840
- this.onzoom(transform);
841
- };
842
- }
843
- onzoom(transform) {
844
- const w = this.width();
845
- const low = this._gantt._minStart;
846
- const range = this._gantt._maxEnd - low;
847
- const wpp = range / w;
848
- const nextLow = Math.floor(low - wpp * (transform.x / transform.k));
849
- const nextHigh = Math.ceil(range / transform.k + nextLow);
850
- this._topAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(nextLow).high(nextHigh).render();
851
- this._bottomAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(nextLow).high(nextHigh).render();
852
- }
853
- update(domNode, element) {
854
- super.update(domNode, element);
855
- this._topAxis.tickFormat(this.tickFormat()).render();
856
- this._bottomAxis.tickFormat(this.tickFormat()).render();
857
- this._gantt.render();
858
- }
859
- exit(domNode, element) {
860
- this._bottomAxis.target(null);
861
- this._gantt.target(null);
862
- this._topAxis.target(null);
863
- super.exit(domNode, element);
864
- }
865
- columns(_) {
866
- const retVal = super.columns.apply(this, arguments);
867
- if (arguments.length > 0) this._gantt.columns(_);
868
- return retVal;
869
- }
870
- data(_) {
871
- const retVal = super.data.apply(this, arguments);
872
- if (arguments.length > 0) {
873
- const ganttData = this.data().map((n) => {
874
- const ret = [...n];
875
- ret[1] = isNaN(n[1]) ? new Date(n[1]).getTime() : Number(n[1]);
876
- ret[2] = isNaN(n[2]) ? new Date(n[2]).getTime() : Number(n[2]);
877
- return ret;
878
- });
879
- this._gantt._minStart = Math.min(...ganttData.map((n) => n[1])) ?? 0;
880
- this._gantt._maxEnd = Math.max(...ganttData.map((n) => n[2])) ?? 1;
881
- this._gantt.data(ganttData);
882
- }
883
- return retVal;
884
- }
885
- resize(_size) {
886
- const retVal = super.resize.apply(this, arguments);
887
- if (this._topAxisElement) this.resizeWrappers();
888
- return retVal;
889
- }
890
- click(row, col, sel) {}
891
- dblclick(row, col, sel) {}
892
- tooltip() {
893
- return this._gantt._tooltip;
894
- }
865
+ const _ReactAxisGantt = class _ReactAxisGantt extends SVGWidget {
866
+ _topAxis = new Axis("center").orientation("top").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");
867
+ _gantt = new ReactGantt("center").stroke("#000000");
868
+ _bottomAxis = new Axis("center").orientation("bottom").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");
869
+ _topAxisElement;
870
+ _contentElement;
871
+ _bottomAxisElement;
872
+ _topRect;
873
+ _contentRect;
874
+ _bottomRect;
875
+ rangeRenderer;
876
+ constructor() {
877
+ super();
878
+ this._drawStartPos = "origin";
879
+ this.rangeRenderer = function() {
880
+ const ret = this._gantt.rangeRenderer.apply(this._gantt, arguments);
881
+ if (!arguments.length) return ret;
882
+ return this;
883
+ };
884
+ }
885
+ selection(_) {
886
+ if (!arguments.length) return this._gantt.selection();
887
+ this._gantt.selection(_);
888
+ return this;
889
+ }
890
+ resizeWrappers() {
891
+ const w = this.width();
892
+ const h = this.height();
893
+ const axisHeight = this.axisHeight();
894
+ const contentHeight = h - axisHeight * 2;
895
+ const borderOffset1 = this.strokeWidth();
896
+ this._topRect.attr("height", axisHeight).attr("width", w).attr("fill", "transparent");
897
+ this._topAxisElement.attr("transform", "translate(0 0)");
898
+ this._topAxis.resize({ height: axisHeight, width: w });
899
+ this._contentRect.attr("height", contentHeight).attr("width", w).attr("fill", "transparent");
900
+ this._contentElement.attr("transform", `translate(0 ${axisHeight + borderOffset1})`);
901
+ this._gantt.resize({ height: contentHeight, width: w });
902
+ this._bottomRect.attr("height", axisHeight).attr("width", w).attr("fill", "transparent");
903
+ this._bottomAxisElement.attr("transform", `translate(0 ${axisHeight + contentHeight + borderOffset1})`);
904
+ this._bottomAxis.resize({ height: axisHeight, width: w });
905
+ }
906
+ enter(domNode, element) {
907
+ super.enter(domNode, element);
908
+ this._gantt.click = (row, col, sel) => {
909
+ this.click(row, col, sel);
910
+ };
911
+ this._gantt.dblclick = (row, col, sel) => {
912
+ this.dblclick(row, col, sel);
913
+ };
914
+ this._topAxisElement = element.append("g").attr("class", "top-axis-wrapper");
915
+ this._topRect = this._topAxisElement.append("rect").attr("class", "top-axis-rect");
916
+ this._contentElement = element.append("g").attr("class", "content-wrapper");
917
+ this._contentRect = this._contentElement.append("rect").attr("class", "content-rect");
918
+ this._bottomAxisElement = element.append("g").attr("class", "bottom-axis-wrapper");
919
+ this._bottomRect = this._bottomAxisElement.append("rect").attr("class", "top-axis-rect");
920
+ this._topAxis.target(this._topAxisElement.node());
921
+ this._gantt.target(this._contentElement.node()).bucketHeight(30);
922
+ this._bottomAxis.target(this._bottomAxisElement.node());
923
+ this.resizeWrappers();
924
+ this._gantt.zoomedHook = (transform) => {
925
+ this.onzoom(transform);
926
+ };
927
+ }
928
+ onzoom(transform) {
929
+ const w = this.width();
930
+ const low = this._gantt._minStart;
931
+ const high = this._gantt._maxEnd;
932
+ const range = high - low;
933
+ const wpp = range / w;
934
+ const nextLow = Math.floor(low - wpp * (transform.x / transform.k));
935
+ const nextHigh = Math.ceil(range / transform.k + nextLow);
936
+ this._topAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(nextLow).high(nextHigh).render();
937
+ this._bottomAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(nextLow).high(nextHigh).render();
938
+ }
939
+ update(domNode, element) {
940
+ super.update(domNode, element);
941
+ this._topAxis.tickFormat(this.tickFormat()).render();
942
+ this._bottomAxis.tickFormat(this.tickFormat()).render();
943
+ this._gantt.render();
944
+ }
945
+ exit(domNode, element) {
946
+ this._bottomAxis.target(null);
947
+ this._gantt.target(null);
948
+ this._topAxis.target(null);
949
+ super.exit(domNode, element);
950
+ }
951
+ columns(_) {
952
+ const retVal = super.columns.apply(this, arguments);
953
+ if (arguments.length > 0) {
954
+ this._gantt.columns(_);
955
+ }
956
+ return retVal;
957
+ }
958
+ data(_) {
959
+ const retVal = super.data.apply(this, arguments);
960
+ if (arguments.length > 0) {
961
+ const ganttData = this.data().map((n) => {
962
+ const ret = [...n];
963
+ ret[1] = isNaN(n[1]) ? new Date(n[1]).getTime() : Number(n[1]);
964
+ ret[2] = isNaN(n[2]) ? new Date(n[2]).getTime() : Number(n[2]);
965
+ return ret;
966
+ });
967
+ this._gantt._minStart = Math.min(...ganttData.map((n) => n[1])) ?? 0;
968
+ this._gantt._maxEnd = Math.max(...ganttData.map((n) => n[2])) ?? 1;
969
+ this._gantt.data(ganttData);
970
+ }
971
+ return retVal;
972
+ }
973
+ resize(_size) {
974
+ const retVal = super.resize.apply(this, arguments);
975
+ if (this._topAxisElement) {
976
+ this.resizeWrappers();
977
+ }
978
+ return retVal;
979
+ }
980
+ click(row, col, sel) {
981
+ }
982
+ dblclick(row, col, sel) {
983
+ }
984
+ tooltip() {
985
+ return this._gantt._tooltip;
986
+ }
895
987
  };
988
+ __name(_ReactAxisGantt, "ReactAxisGantt");
989
+ let ReactAxisGantt = _ReactAxisGantt;
896
990
  ReactAxisGantt.prototype._class += " timeline_ReactAxisGantt";
897
991
  ReactAxisGantt.prototype.publish("tickFormat", null, "string", "Format rule applied to axis tick labels", void 0, { optional: true });
898
992
  ReactAxisGantt.prototype.publish("axisHeight", 22, "number", "Height of axes (pixels)");
@@ -916,119 +1010,125 @@ ReactAxisGantt.prototype.publishProxy("colorColumn", "_gantt");
916
1010
  ReactAxisGantt.prototype.publishProxy("bucketColumn", "_gantt");
917
1011
  ReactAxisGantt.prototype.publishProxy("maxZoom", "_gantt");
918
1012
  ReactAxisGantt.prototype.publishProxy("bucketHeight", "_gantt");
919
-
920
- //#endregion
921
- //#region src/ReactAxisGanttSeries.ts
922
- var ReactAxisGanttSeries = class extends Border2 {
923
- _topAxis = new Axis("origin").orientation("top").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");
924
- _gantt = new ReactGantt("origin").stroke("#000000").fitHeightToContent(true);
925
- _bottomAxis = new Axis("origin").orientation("bottom").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");
926
- _topAxisElement;
927
- _contentElement;
928
- _bottomAxisElement;
929
- _topRect;
930
- _contentRect;
931
- _bottomRect;
932
- constructor() {
933
- super();
934
- this.centerOverflowX_default("hidden");
935
- this.centerOverflowY_default("auto");
936
- }
937
- selection(_) {
938
- if (!arguments.length) return this._gantt.selection();
939
- this._gantt.selection(_);
940
- return this;
941
- }
942
- rangeRenderer(_) {
943
- const ret = this._gantt.rangeRenderer.apply(this._gantt, arguments);
944
- if (!arguments.length) return ret;
945
- return this;
946
- }
947
- resizeWrappers() {
948
- const w = this.width();
949
- const h = this.height();
950
- const axisHeight = this.axisHeight();
951
- const contentHeight = h - axisHeight * 2;
952
- this.bottomHeight(axisHeight);
953
- this._topWA.resize({
954
- width: w,
955
- height: axisHeight
956
- });
957
- this._centerWA.resize({
958
- width: w,
959
- height: contentHeight
960
- });
961
- this._bottomWA.resize({
962
- width: w,
963
- height: axisHeight
964
- });
965
- this.top().render();
966
- this.bottom().render();
967
- this.center().render();
968
- }
969
- enter(domNode, element) {
970
- super.enter(domNode, element);
971
- this._gantt.click = (row, col, sel) => {
972
- this.click(row, col, sel);
973
- };
974
- this._gantt.dblclick = (row, col, sel) => {
975
- this.dblclick(row, col, sel);
976
- };
977
- this.top(this._topAxis);
978
- this.center(this._gantt);
979
- this.bottom(this._bottomAxis);
980
- this.resizeWrappers();
981
- this._gantt.zoomedHook = (transform) => {
982
- this.onzoom(transform);
983
- };
984
- }
985
- onzoom(transform) {
986
- const w = this.width();
987
- const low = this._gantt._minStart;
988
- const range = this._gantt._maxEnd - low;
989
- const wpp = range / w;
990
- const nextLow = Math.floor(low - wpp * (transform.x / transform.k));
991
- const nextHigh = Math.ceil(range / transform.k + nextLow);
992
- this._topAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(nextLow).high(nextHigh).lazyRender();
993
- this._bottomAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(nextLow).high(nextHigh).lazyRender();
994
- }
995
- update(domNode, element) {
996
- super.update(domNode, element);
997
- this._topAxis.tickFormat(this.tickFormat()).render();
998
- this._bottomAxis.tickFormat(this.tickFormat()).render();
999
- this._gantt.render();
1000
- }
1001
- columns(_) {
1002
- const retVal = super.columns.apply(this, arguments);
1003
- if (arguments.length > 0) this._gantt.columns(_);
1004
- return retVal;
1005
- }
1006
- data(_) {
1007
- const retVal = super.data.apply(this, arguments);
1008
- if (arguments.length > 0) {
1009
- const ganttData = this.data().map((n) => {
1010
- const ret = [...n];
1011
- ret[1] = isNaN(n[1]) ? new Date(n[1]).getTime() : Number(n[1]);
1012
- ret[2] = isNaN(n[2]) ? new Date(n[2]).getTime() : Number(n[2]);
1013
- return ret;
1014
- });
1015
- this._gantt._minStart = min(ganttData, (n) => n[1]);
1016
- this._gantt._maxEnd = max(ganttData, (n) => n[2]);
1017
- this._gantt.data(ganttData);
1018
- }
1019
- return retVal;
1020
- }
1021
- resize(_size) {
1022
- const retVal = super.resize.apply(this, arguments);
1023
- if (this._topAxisElement) this.resizeWrappers();
1024
- return retVal;
1025
- }
1026
- click(row, col, sel) {}
1027
- dblclick(row, col, sel) {}
1028
- tooltip() {
1029
- return this._gantt._tooltip;
1030
- }
1013
+ const _ReactAxisGanttSeries = class _ReactAxisGanttSeries extends Border2 {
1014
+ _topAxis = new Axis("origin").orientation("top").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");
1015
+ _gantt = new ReactGantt("origin").stroke("#000000").fitHeightToContent(true);
1016
+ _bottomAxis = new Axis("origin").orientation("bottom").type("linear").shrinkToFit("none").overlapMode("hide").extend(0).tickFormat("d");
1017
+ _topAxisElement;
1018
+ _contentElement;
1019
+ _bottomAxisElement;
1020
+ _topRect;
1021
+ _contentRect;
1022
+ _bottomRect;
1023
+ constructor() {
1024
+ super();
1025
+ this.centerOverflowX_default("hidden");
1026
+ this.centerOverflowY_default("auto");
1027
+ }
1028
+ selection(_) {
1029
+ if (!arguments.length) return this._gantt.selection();
1030
+ this._gantt.selection(_);
1031
+ return this;
1032
+ }
1033
+ rangeRenderer(_) {
1034
+ const ret = this._gantt.rangeRenderer.apply(this._gantt, arguments);
1035
+ if (!arguments.length) return ret;
1036
+ return this;
1037
+ }
1038
+ resizeWrappers() {
1039
+ const w = this.width();
1040
+ const h = this.height();
1041
+ const axisHeight = this.axisHeight();
1042
+ const contentHeight = h - axisHeight * 2;
1043
+ this.bottomHeight(axisHeight);
1044
+ this._topWA.resize({
1045
+ width: w,
1046
+ height: axisHeight
1047
+ });
1048
+ this._centerWA.resize({
1049
+ width: w,
1050
+ height: contentHeight
1051
+ });
1052
+ this._bottomWA.resize({
1053
+ width: w,
1054
+ height: axisHeight
1055
+ });
1056
+ this.top().render();
1057
+ this.bottom().render();
1058
+ this.center().render();
1059
+ }
1060
+ enter(domNode, element) {
1061
+ super.enter(domNode, element);
1062
+ this._gantt.click = (row, col, sel) => {
1063
+ this.click(row, col, sel);
1064
+ };
1065
+ this._gantt.dblclick = (row, col, sel) => {
1066
+ this.dblclick(row, col, sel);
1067
+ };
1068
+ this.top(this._topAxis);
1069
+ this.center(this._gantt);
1070
+ this.bottom(this._bottomAxis);
1071
+ this.resizeWrappers();
1072
+ this._gantt.zoomedHook = (transform) => {
1073
+ this.onzoom(transform);
1074
+ };
1075
+ }
1076
+ onzoom(transform) {
1077
+ const w = this.width();
1078
+ const low = this._gantt._minStart;
1079
+ const high = this._gantt._maxEnd;
1080
+ const range = high - low;
1081
+ const wpp = range / w;
1082
+ const nextLow = Math.floor(low - wpp * (transform.x / transform.k));
1083
+ const nextHigh = Math.ceil(range / transform.k + nextLow);
1084
+ this._topAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(nextLow).high(nextHigh).lazyRender();
1085
+ this._bottomAxis.fontFamily(this.axisFontFamily()).fontSize(this.axisFontSize()).tickLength(this.axisTickLength()).low(nextLow).high(nextHigh).lazyRender();
1086
+ }
1087
+ update(domNode, element) {
1088
+ super.update(domNode, element);
1089
+ this._topAxis.tickFormat(this.tickFormat()).render();
1090
+ this._bottomAxis.tickFormat(this.tickFormat()).render();
1091
+ this._gantt.render();
1092
+ }
1093
+ columns(_) {
1094
+ const retVal = super.columns.apply(this, arguments);
1095
+ if (arguments.length > 0) {
1096
+ this._gantt.columns(_);
1097
+ }
1098
+ return retVal;
1099
+ }
1100
+ data(_) {
1101
+ const retVal = super.data.apply(this, arguments);
1102
+ if (arguments.length > 0) {
1103
+ const ganttData = this.data().map((n) => {
1104
+ const ret = [...n];
1105
+ ret[1] = isNaN(n[1]) ? new Date(n[1]).getTime() : Number(n[1]);
1106
+ ret[2] = isNaN(n[2]) ? new Date(n[2]).getTime() : Number(n[2]);
1107
+ return ret;
1108
+ });
1109
+ this._gantt._minStart = min(ganttData, (n) => n[1]);
1110
+ this._gantt._maxEnd = max(ganttData, (n) => n[2]);
1111
+ this._gantt.data(ganttData);
1112
+ }
1113
+ return retVal;
1114
+ }
1115
+ resize(_size) {
1116
+ const retVal = super.resize.apply(this, arguments);
1117
+ if (this._topAxisElement) {
1118
+ this.resizeWrappers();
1119
+ }
1120
+ return retVal;
1121
+ }
1122
+ click(row, col, sel) {
1123
+ }
1124
+ dblclick(row, col, sel) {
1125
+ }
1126
+ tooltip() {
1127
+ return this._gantt._tooltip;
1128
+ }
1031
1129
  };
1130
+ __name(_ReactAxisGanttSeries, "ReactAxisGanttSeries");
1131
+ let ReactAxisGanttSeries = _ReactAxisGanttSeries;
1032
1132
  ReactAxisGanttSeries.prototype._class += " timeline_ReactAxisGanttSeries";
1033
1133
  ReactAxisGanttSeries.prototype.publish("tickFormat", null, "string", "Format rule applied to axis tick labels", void 0, { optional: true });
1034
1134
  ReactAxisGanttSeries.prototype.publish("axisHeight", 22, "number", "Height of axes (pixels)");
@@ -1055,155 +1155,169 @@ ReactAxisGanttSeries.prototype.publishProxy("maxZoom", "_gantt");
1055
1155
  ReactAxisGanttSeries.prototype.publishProxy("evenSeriesBackground", "_gantt");
1056
1156
  ReactAxisGanttSeries.prototype.publishProxy("oddSeriesBackground", "_gantt");
1057
1157
  ReactAxisGanttSeries.prototype.publishProxy("bucketHeight", "_gantt");
1058
-
1059
- //#endregion
1060
- //#region src/ReactTimeline.ts
1061
- var ReactTimeline = class extends ReactAxisGantt {
1062
- _axisLabelFormatter;
1063
- constructor() {
1064
- super();
1065
- this._drawStartPos = "origin";
1066
- this._topAxis.type("time");
1067
- this._bottomAxis.type("time");
1068
- this.tooltipHTML((d) => {
1069
- const parser = timeParse("%Q");
1070
- const startTime = parser(d[1]);
1071
- const endTime = parser(d[2]);
1072
- const formatter = timeFormat(this.tooltipTimeFormat());
1073
- return `<div style="text-align:center;">${d[0]}<br/><br/>${formatter(startTime)} -&gt; ${formatter(endTime)}</div>`;
1074
- });
1075
- }
1076
- update(domNode, element) {
1077
- super.update(domNode, element);
1078
- if (this.timePattern_exists()) {
1079
- let minTimestamp = Infinity;
1080
- let maxTimestamp = -Infinity;
1081
- let lowDateStr = "";
1082
- let highDateStr = "";
1083
- this.data().map((n) => {
1084
- const start = new Date(n[1]).getTime();
1085
- const end = new Date(n[2]).getTime();
1086
- if (minTimestamp > start) {
1087
- minTimestamp = start;
1088
- lowDateStr = "" + n[1];
1089
- }
1090
- if (maxTimestamp < end) {
1091
- maxTimestamp = end;
1092
- highDateStr = "" + n[2];
1093
- }
1094
- });
1095
- const axisTickFormat = this._axisLabelFormatter ? this._axisLabelFormatter : this.tickFormat_exists && this.tickFormat_exists() ? this.tickFormat() : void 0;
1096
- this._topAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(lowDateStr).high(highDateStr);
1097
- this._bottomAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(lowDateStr).high(highDateStr);
1098
- if (axisTickFormat) {
1099
- this._topAxis.tickFormat(axisTickFormat);
1100
- this._bottomAxis.tickFormat(axisTickFormat);
1101
- } else {
1102
- this._topAxis.tickFormat_reset();
1103
- this._bottomAxis.tickFormat_reset();
1104
- }
1105
- this._gantt._minStart = minTimestamp;
1106
- this._gantt._maxEnd = maxTimestamp;
1107
- }
1108
- }
1109
- tooltipHTML(callback) {
1110
- this._tooltipHTML = callback;
1111
- this.tooltip().tooltipHTML(this._tooltipHTML);
1112
- return this;
1113
- }
1114
- parseAxisValue(v) {
1115
- const parsedTime = timeParse("%Q")(v);
1116
- return timeFormat(this.timePattern())(parsedTime);
1117
- }
1118
- onzoom(transform) {
1119
- const w = this.width();
1120
- const low = this._gantt._minStart;
1121
- const range = this._gantt._maxEnd - low;
1122
- const wpp = range / w;
1123
- const nextLow = Math.floor(low - wpp * (transform.x / transform.k));
1124
- const nextHigh = Math.ceil(range / transform.k + nextLow);
1125
- this._topAxis.low(this.parseAxisValue(nextLow)).high(this.parseAxisValue(nextHigh)).render();
1126
- this._bottomAxis.low(this.parseAxisValue(nextLow)).high(this.parseAxisValue(nextHigh)).render();
1127
- }
1158
+ const _ReactTimeline = class _ReactTimeline extends ReactAxisGantt {
1159
+ _axisLabelFormatter;
1160
+ //TODO: add a type to this? d3 time formatting function type?
1161
+ constructor() {
1162
+ super();
1163
+ this._drawStartPos = "origin";
1164
+ this._topAxis.type("time");
1165
+ this._bottomAxis.type("time");
1166
+ this.tooltipHTML((d) => {
1167
+ const parser = timeParse("%Q");
1168
+ const startTime = parser(d[1]);
1169
+ const endTime = parser(d[2]);
1170
+ const formatter = timeFormat(this.tooltipTimeFormat());
1171
+ return `<div style="text-align:center;">${d[0]}<br/><br/>${formatter(startTime)} -&gt; ${formatter(endTime)}</div>`;
1172
+ });
1173
+ }
1174
+ update(domNode, element) {
1175
+ super.update(domNode, element);
1176
+ if (this.timePattern_exists()) {
1177
+ let minTimestamp = Infinity;
1178
+ let maxTimestamp = -Infinity;
1179
+ let lowDateStr = "";
1180
+ let highDateStr = "";
1181
+ this.data().map((n) => {
1182
+ const start = new Date(n[1]).getTime();
1183
+ const end = new Date(n[2]).getTime();
1184
+ if (minTimestamp > start) {
1185
+ minTimestamp = start;
1186
+ lowDateStr = "" + n[1];
1187
+ }
1188
+ if (maxTimestamp < end) {
1189
+ maxTimestamp = end;
1190
+ highDateStr = "" + n[2];
1191
+ }
1192
+ });
1193
+ const axisTickFormat = this._axisLabelFormatter ? this._axisLabelFormatter : this.tickFormat_exists && this.tickFormat_exists() ? this.tickFormat() : void 0;
1194
+ this._topAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(lowDateStr).high(highDateStr);
1195
+ this._bottomAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(lowDateStr).high(highDateStr);
1196
+ if (axisTickFormat) {
1197
+ this._topAxis.tickFormat(axisTickFormat);
1198
+ this._bottomAxis.tickFormat(axisTickFormat);
1199
+ } else {
1200
+ this._topAxis.tickFormat_reset();
1201
+ this._bottomAxis.tickFormat_reset();
1202
+ }
1203
+ this._gantt._minStart = minTimestamp;
1204
+ this._gantt._maxEnd = maxTimestamp;
1205
+ }
1206
+ }
1207
+ tooltipHTML(callback) {
1208
+ this._tooltipHTML = callback;
1209
+ this.tooltip().tooltipHTML(this._tooltipHTML);
1210
+ return this;
1211
+ }
1212
+ parseAxisValue(v) {
1213
+ const parseTime2 = timeParse("%Q");
1214
+ const parsedTime = parseTime2(v);
1215
+ const formatTime = timeFormat(this.timePattern());
1216
+ return formatTime(parsedTime);
1217
+ }
1218
+ onzoom(transform) {
1219
+ const w = this.width();
1220
+ const low = this._gantt._minStart;
1221
+ const high = this._gantt._maxEnd;
1222
+ const range = high - low;
1223
+ const wpp = range / w;
1224
+ const nextLow = Math.floor(low - wpp * (transform.x / transform.k));
1225
+ const nextHigh = Math.ceil(range / transform.k + nextLow);
1226
+ this._topAxis.low(this.parseAxisValue(nextLow)).high(this.parseAxisValue(nextHigh)).render();
1227
+ this._bottomAxis.low(this.parseAxisValue(nextLow)).high(this.parseAxisValue(nextHigh)).render();
1228
+ }
1128
1229
  };
1230
+ __name(_ReactTimeline, "ReactTimeline");
1231
+ let ReactTimeline = _ReactTimeline;
1129
1232
  ReactTimeline.prototype._class += " timeline_ReactTimeline";
1130
1233
  ReactTimeline.prototype.publish("timePattern", "%Y-%m-%d", "string", "Time pattern used for parsing datetime strings on each data row", null, { optional: true });
1131
1234
  ReactTimeline.prototype.publish("tooltipTimeFormat", "%Y-%m-%d", "string", "Time format used in the default html tooltip");
1132
-
1133
- //#endregion
1134
- //#region src/ReactTimelineSeries.ts
1135
- var parseTime = timeParse("%Q");
1136
- var ReactTimelineSeries = class extends ReactAxisGanttSeries {
1137
- _axisLabelFormatter;
1138
- constructor() {
1139
- super();
1140
- this._topAxis.type("time");
1141
- this._bottomAxis.type("time");
1142
- this.tooltipHTML((d) => {
1143
- const startTime = parseTime(d[1]);
1144
- const endTime = parseTime(d[2]);
1145
- const formatter = timeFormat(this.tooltipTimeFormat());
1146
- return `<div style="text-align:center;">${d[0]}<br/><br/>${formatter(startTime)} -&gt; ${formatter(endTime)}</div>`;
1147
- });
1148
- }
1149
- update(domNode, element) {
1150
- super.update(domNode, element);
1151
- if (this.timePattern_exists()) {
1152
- let minTimestamp = Infinity;
1153
- let maxTimestamp = -Infinity;
1154
- let lowDateStr = "";
1155
- let highDateStr = "";
1156
- this.data().forEach((n) => {
1157
- const start = new Date(n[1]).getTime();
1158
- const end = new Date(n[2]).getTime();
1159
- if (minTimestamp > start) {
1160
- minTimestamp = start;
1161
- lowDateStr = "" + n[1];
1162
- }
1163
- if (maxTimestamp < end) {
1164
- maxTimestamp = end;
1165
- highDateStr = "" + n[2];
1166
- }
1167
- });
1168
- const axisTickFormat = this._axisLabelFormatter ? this._axisLabelFormatter : this.tickFormat_exists && this.tickFormat_exists() ? this.tickFormat() : void 0;
1169
- this._topAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(lowDateStr).high(highDateStr);
1170
- this._bottomAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(lowDateStr).high(highDateStr);
1171
- if (axisTickFormat) {
1172
- this._topAxis.tickFormat(axisTickFormat);
1173
- this._bottomAxis.tickFormat(axisTickFormat);
1174
- } else {
1175
- this._topAxis.tickFormat_reset();
1176
- this._bottomAxis.tickFormat_reset();
1177
- }
1178
- this._gantt._minStart = minTimestamp;
1179
- this._gantt._maxEnd = maxTimestamp;
1180
- }
1181
- }
1182
- tooltipHTML(callback) {
1183
- this._tooltipHTML = callback;
1184
- this.tooltip().tooltipHTML(this._tooltipHTML);
1185
- return this;
1186
- }
1187
- parseAxisValue(v) {
1188
- const parsedTime = parseTime(v);
1189
- return timeFormat(this.timePattern())(parsedTime);
1190
- }
1191
- onzoom(transform) {
1192
- const w = this.width();
1193
- const low = this._gantt._minStart;
1194
- const range = this._gantt._maxEnd - low;
1195
- const wpp = range / w;
1196
- const nextLow = Math.floor(low - wpp * (transform.x / transform.k));
1197
- const nextHigh = Math.ceil(range / transform.k + nextLow);
1198
- this._topAxis.low(this.parseAxisValue(nextLow)).high(this.parseAxisValue(nextHigh)).render();
1199
- this._bottomAxis.low(this.parseAxisValue(nextLow)).high(this.parseAxisValue(nextHigh)).render();
1200
- }
1201
- _tooltipHTML;
1235
+ const parseTime = timeParse("%Q");
1236
+ const _ReactTimelineSeries = class _ReactTimelineSeries extends ReactAxisGanttSeries {
1237
+ _axisLabelFormatter;
1238
+ //TODO: add a type to this? d3 time formatting function type?
1239
+ constructor() {
1240
+ super();
1241
+ this._topAxis.type("time");
1242
+ this._bottomAxis.type("time");
1243
+ this.tooltipHTML((d) => {
1244
+ const startTime = parseTime(d[1]);
1245
+ const endTime = parseTime(d[2]);
1246
+ const formatter = timeFormat(this.tooltipTimeFormat());
1247
+ return `<div style="text-align:center;">${d[0]}<br/><br/>${formatter(startTime)} -&gt; ${formatter(endTime)}</div>`;
1248
+ });
1249
+ }
1250
+ update(domNode, element) {
1251
+ super.update(domNode, element);
1252
+ if (this.timePattern_exists()) {
1253
+ let minTimestamp = Infinity;
1254
+ let maxTimestamp = -Infinity;
1255
+ let lowDateStr = "";
1256
+ let highDateStr = "";
1257
+ this.data().forEach((n) => {
1258
+ const start = new Date(n[1]).getTime();
1259
+ const end = new Date(n[2]).getTime();
1260
+ if (minTimestamp > start) {
1261
+ minTimestamp = start;
1262
+ lowDateStr = "" + n[1];
1263
+ }
1264
+ if (maxTimestamp < end) {
1265
+ maxTimestamp = end;
1266
+ highDateStr = "" + n[2];
1267
+ }
1268
+ });
1269
+ const axisTickFormat = this._axisLabelFormatter ? this._axisLabelFormatter : this.tickFormat_exists && this.tickFormat_exists() ? this.tickFormat() : void 0;
1270
+ this._topAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(lowDateStr).high(highDateStr);
1271
+ this._bottomAxis.type("time").timePattern(this.timePattern()).overlapMode("none").low(lowDateStr).high(highDateStr);
1272
+ if (axisTickFormat) {
1273
+ this._topAxis.tickFormat(axisTickFormat);
1274
+ this._bottomAxis.tickFormat(axisTickFormat);
1275
+ } else {
1276
+ this._topAxis.tickFormat_reset();
1277
+ this._bottomAxis.tickFormat_reset();
1278
+ }
1279
+ this._gantt._minStart = minTimestamp;
1280
+ this._gantt._maxEnd = maxTimestamp;
1281
+ }
1282
+ }
1283
+ tooltipHTML(callback) {
1284
+ this._tooltipHTML = callback;
1285
+ this.tooltip().tooltipHTML(this._tooltipHTML);
1286
+ return this;
1287
+ }
1288
+ parseAxisValue(v) {
1289
+ const parsedTime = parseTime(v);
1290
+ const formatTime = timeFormat(this.timePattern());
1291
+ return formatTime(parsedTime);
1292
+ }
1293
+ onzoom(transform) {
1294
+ const w = this.width();
1295
+ const low = this._gantt._minStart;
1296
+ const high = this._gantt._maxEnd;
1297
+ const range = high - low;
1298
+ const wpp = range / w;
1299
+ const nextLow = Math.floor(low - wpp * (transform.x / transform.k));
1300
+ const nextHigh = Math.ceil(range / transform.k + nextLow);
1301
+ this._topAxis.low(this.parseAxisValue(nextLow)).high(this.parseAxisValue(nextHigh)).render();
1302
+ this._bottomAxis.low(this.parseAxisValue(nextLow)).high(this.parseAxisValue(nextHigh)).render();
1303
+ }
1304
+ _tooltipHTML;
1202
1305
  };
1306
+ __name(_ReactTimelineSeries, "ReactTimelineSeries");
1307
+ let ReactTimelineSeries = _ReactTimelineSeries;
1203
1308
  ReactTimelineSeries.prototype._class += " timeline_ReactTimelineSeries";
1204
1309
  ReactTimelineSeries.prototype.publish("timePattern", "%Y-%m-%d", "string", "Time pattern used for parsing datetime strings on each data row", null, { optional: true });
1205
1310
  ReactTimelineSeries.prototype.publish("tooltipTimeFormat", "%Y-%m-%d", "string", "Time format used in the default html tooltip");
1206
-
1207
- //#endregion
1208
- export { BUILD_VERSION, MiniGantt, PKG_NAME, PKG_VERSION, ReactAxisGantt, ReactAxisGanttSeries, ReactGantt, ReactTimeline, ReactTimelineSeries };
1209
- //# sourceMappingURL=index.js.map!function(){try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode(".timeline_MiniGantt .line{fill:none;stroke:#d3d3d3;opacity:.7}.timeline_MiniGantt .common_TextBox .rect{fill:#87cefa;stroke:#00f;opacity:.5}.timeline_MiniGantt .buckets .entity_shape rect{stroke:#333}.timeline_MiniGantt .buckets.selected .common_EntityRect .common_Shape>rect{stroke:red}.timeline_MiniGantt .common_TextBox .rect text{fill:#000;stroke:none}.timeline_MiniGantt .over{stroke:#0000;opacity:.8}.timeline_MiniGantt rect{shape-rendering:crispEdges}\n/*$vite$:1*/")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
1311
+ export {
1312
+ BUILD_VERSION,
1313
+ MiniGantt,
1314
+ PKG_NAME,
1315
+ PKG_VERSION,
1316
+ ReactAxisGantt,
1317
+ ReactAxisGanttSeries,
1318
+ ReactGantt,
1319
+ ReactTimeline,
1320
+ ReactTimelineSeries
1321
+ };
1322
+ //# sourceMappingURL=index.js.map
1323
+ !function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode(".timeline_MiniGantt .line{fill:none;stroke:#d3d3d3;opacity:.7}.timeline_MiniGantt .common_TextBox .rect{fill:#87cefa;stroke:#00f;opacity:.5}.timeline_MiniGantt .buckets .entity_shape rect{stroke:#333}.timeline_MiniGantt .buckets.selected .common_EntityRect .common_Shape>rect{stroke:red}.timeline_MiniGantt .common_TextBox .rect text{fill:#000;stroke:none}.timeline_MiniGantt .over{stroke:transparent;opacity:.8}.timeline_MiniGantt rect{shape-rendering:crispEdges}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();