awesome-timeline-react 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/_tsup-dts-rollup.d.mts +55 -31
- package/dist/_tsup-dts-rollup.d.ts +55 -31
- package/dist/index.css +6 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +89 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -81
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -557,8 +557,9 @@ var CanvasTimeBar = ({
|
|
|
557
557
|
theme,
|
|
558
558
|
timeBar
|
|
559
559
|
}) => {
|
|
560
|
-
var _a, _b;
|
|
560
|
+
var _a, _b, _c;
|
|
561
561
|
const canvasRef = (0, import_react4.useRef)(null);
|
|
562
|
+
const header = theme != null ? theme : DEFAULT_THEME;
|
|
562
563
|
const topRow = (_a = timeBar == null ? void 0 : timeBar.topRow) != null ? _a : { unit: "day" };
|
|
563
564
|
const bottomRow = (_b = timeBar == null ? void 0 : timeBar.bottomRow) != null ? _b : { unit: "hour" };
|
|
564
565
|
(0, import_react4.useEffect)(() => {
|
|
@@ -587,24 +588,33 @@ var CanvasTimeBar = ({
|
|
|
587
588
|
}))
|
|
588
589
|
});
|
|
589
590
|
}, [windowTime, tick, contentWidth, theme, timeBar]);
|
|
590
|
-
return /* @__PURE__ */ import_react4.default.createElement(
|
|
591
|
-
"canvas",
|
|
592
|
-
{
|
|
593
|
-
ref: canvasRef,
|
|
594
|
-
className: "canvas-time-bar",
|
|
595
|
-
style: { minWidth: contentWidth ? contentWidth : 0 }
|
|
596
|
-
}
|
|
597
|
-
), scrollWidth ? /* @__PURE__ */ import_react4.default.createElement(
|
|
591
|
+
return /* @__PURE__ */ import_react4.default.createElement(
|
|
598
592
|
"div",
|
|
599
593
|
{
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
594
|
+
className: "time-bar",
|
|
595
|
+
style: { background: header.headerBackground, color: header.headerTextColor, borderColor: header.headerBorderColor }
|
|
596
|
+
},
|
|
597
|
+
/* @__PURE__ */ import_react4.default.createElement("div", { className: "empty-block", style: { borderRightColor: header.headerBorderColor } }),
|
|
598
|
+
/* @__PURE__ */ import_react4.default.createElement(
|
|
599
|
+
"canvas",
|
|
600
|
+
{
|
|
601
|
+
ref: canvasRef,
|
|
602
|
+
className: "canvas-time-bar",
|
|
603
|
+
style: { minWidth: contentWidth ? contentWidth : 0 }
|
|
605
604
|
}
|
|
606
|
-
|
|
607
|
-
|
|
605
|
+
),
|
|
606
|
+
scrollWidth ? /* @__PURE__ */ import_react4.default.createElement(
|
|
607
|
+
"div",
|
|
608
|
+
{
|
|
609
|
+
style: {
|
|
610
|
+
width: scrollWidth,
|
|
611
|
+
height: "100%",
|
|
612
|
+
boxSizing: "border-box",
|
|
613
|
+
borderLeft: `1px solid ${(_c = header.headerBorderColor) != null ? _c : "yellow"}`
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
) : null
|
|
617
|
+
);
|
|
608
618
|
};
|
|
609
619
|
var canvas_time_bar_default = CanvasTimeBar;
|
|
610
620
|
|
|
@@ -674,7 +684,6 @@ var cullToWindow = (events, windowStart, windowEnd) => {
|
|
|
674
684
|
// src/core/coords.ts
|
|
675
685
|
var timeToX = (time, windowStart, tick) => (time - windowStart) / tick;
|
|
676
686
|
var timeToWidth = (startTime, endTime, tick) => (endTime - startTime) / tick;
|
|
677
|
-
var intersectsWindow = (event, windowStart, windowEnd) => event.endTime >= windowStart && event.startTime <= windowEnd;
|
|
678
687
|
|
|
679
688
|
// src/core/geometry.ts
|
|
680
689
|
var DEFAULT_GEOMETRY = {
|
|
@@ -702,11 +711,10 @@ var geometryFromTheme = (theme) => {
|
|
|
702
711
|
var laneTop = (lane, g = DEFAULT_GEOMETRY) => g.laneTopOffset + g.laneHeight * lane;
|
|
703
712
|
var rowMinHeight = (highestLane, g = DEFAULT_GEOMETRY) => g.rowBaseHeight + highestLane * g.laneHeight;
|
|
704
713
|
var staticEventHeight = (highestLane, g = DEFAULT_GEOMETRY) => g.staticEventBaseHeight + highestLane * g.laneHeight;
|
|
705
|
-
var assignLanes = (rowEvents
|
|
714
|
+
var assignLanes = (rowEvents) => {
|
|
706
715
|
const laneEnd = [];
|
|
707
716
|
const laneOf = /* @__PURE__ */ new Map();
|
|
708
717
|
for (const event of rowEvents) {
|
|
709
|
-
if (!intersectsWindow(event, windowStart, windowEnd)) continue;
|
|
710
718
|
let lane = laneEnd.findIndex((end) => end <= event.startTime);
|
|
711
719
|
if (lane === -1) {
|
|
712
720
|
lane = laneEnd.length;
|
|
@@ -800,7 +808,6 @@ var roundedRect = (ctx, x, y, width, height, radius) => {
|
|
|
800
808
|
};
|
|
801
809
|
var drawGroupShading = (ctx, view, scene) => {
|
|
802
810
|
var _a;
|
|
803
|
-
const [windowStart, windowEnd] = view.windowTime;
|
|
804
811
|
const visible = scene.getVisibleRowIds();
|
|
805
812
|
const regions = [];
|
|
806
813
|
let y = 0;
|
|
@@ -812,7 +819,7 @@ var drawGroupShading = (ctx, view, scene) => {
|
|
|
812
819
|
runParent = null;
|
|
813
820
|
};
|
|
814
821
|
for (const rowId of visible) {
|
|
815
|
-
const height = scene.getRowHeight(rowId
|
|
822
|
+
const height = scene.getRowHeight(rowId);
|
|
816
823
|
const parentId = (_a = scene.getRow(rowId)) == null ? void 0 : _a.parentId;
|
|
817
824
|
if (parentId !== void 0) {
|
|
818
825
|
if (runParent === parentId) {
|
|
@@ -859,14 +866,13 @@ var drawGroupShading = (ctx, view, scene) => {
|
|
|
859
866
|
ctx.restore();
|
|
860
867
|
};
|
|
861
868
|
var drawRowDividers = (ctx, view, scene) => {
|
|
862
|
-
const [windowStart, windowEnd] = view.windowTime;
|
|
863
869
|
const rowIds = scene.getVisibleRowIds();
|
|
864
870
|
ctx.strokeStyle = view.theme.gridColor;
|
|
865
871
|
ctx.lineWidth = 1;
|
|
866
872
|
ctx.beginPath();
|
|
867
873
|
let y = 0;
|
|
868
874
|
for (let i = 0; i < rowIds.length; i++) {
|
|
869
|
-
y += scene.getRowHeight(rowIds[i]
|
|
875
|
+
y += scene.getRowHeight(rowIds[i]);
|
|
870
876
|
if (i === rowIds.length - 1) break;
|
|
871
877
|
const screenY = y - view.scrollTop;
|
|
872
878
|
if (screenY < 0) continue;
|
|
@@ -979,7 +985,7 @@ var paintOverlapStripes = (ctx, event, rect, rowStatics, windowStart, tick, colo
|
|
|
979
985
|
}
|
|
980
986
|
};
|
|
981
987
|
var drawEvents = (ctx, view, scene, font, animator) => {
|
|
982
|
-
var _a;
|
|
988
|
+
var _a, _b, _c, _d;
|
|
983
989
|
if (view.tick === null) return;
|
|
984
990
|
const [windowStart, windowEnd] = view.windowTime;
|
|
985
991
|
const tick = view.tick;
|
|
@@ -991,7 +997,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
991
997
|
const hasSelection = selectedIds.size > 0;
|
|
992
998
|
const deferred = [];
|
|
993
999
|
const paintEvent = (event, rect, state, opts, rowStatics) => {
|
|
994
|
-
var _a2,
|
|
1000
|
+
var _a2, _b2, _c2, _d2, _e;
|
|
995
1001
|
ctx.save();
|
|
996
1002
|
ctx.globalAlpha = 1;
|
|
997
1003
|
if (opts.elevate) {
|
|
@@ -1002,7 +1008,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
1002
1008
|
}
|
|
1003
1009
|
if (state.dragging) ctx.globalAlpha = 0.5;
|
|
1004
1010
|
else if (opts.dim) ctx.globalAlpha *= view.theme.dimmedOpacity;
|
|
1005
|
-
const custom = (
|
|
1011
|
+
const custom = (_b2 = (_a2 = event.props) == null ? void 0 : _a2.drawEvent) != null ? _b2 : view.drawEvent;
|
|
1006
1012
|
const drawn = custom !== void 0 && custom(ctx, event, rect, state, view.theme) !== false;
|
|
1007
1013
|
if (!drawn) {
|
|
1008
1014
|
defaultDrawEvent(ctx, event, rect, view, font, geometry.barRadius);
|
|
@@ -1029,7 +1035,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
1029
1035
|
ctx,
|
|
1030
1036
|
rect,
|
|
1031
1037
|
alpha,
|
|
1032
|
-
(_e = (
|
|
1038
|
+
(_e = (_d2 = (_c2 = event.props) == null ? void 0 : _c2.style) == null ? void 0 : _d2.stroke) != null ? _e : view.theme.eventStroke
|
|
1033
1039
|
);
|
|
1034
1040
|
}
|
|
1035
1041
|
}
|
|
@@ -1037,13 +1043,13 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
1037
1043
|
};
|
|
1038
1044
|
let rowTop = 0;
|
|
1039
1045
|
for (const rowId of scene.getVisibleRowIds()) {
|
|
1040
|
-
const rowHeight = scene.getRowHeight(rowId
|
|
1046
|
+
const rowHeight = scene.getRowHeight(rowId);
|
|
1041
1047
|
const rowY = rowTop - view.scrollTop;
|
|
1042
1048
|
rowTop += rowHeight;
|
|
1043
1049
|
if (rowY + rowHeight < 0) continue;
|
|
1044
1050
|
if (rowY > view.height) break;
|
|
1045
|
-
const lanes = scene.getLanes(rowId
|
|
1046
|
-
const inset = scene.getLaneInset(rowId
|
|
1051
|
+
const lanes = scene.getLanes(rowId);
|
|
1052
|
+
const inset = scene.getLaneInset(rowId);
|
|
1047
1053
|
const rowStatics = cullToWindow(
|
|
1048
1054
|
scene.getRowStaticEvents(rowId),
|
|
1049
1055
|
windowStart,
|
|
@@ -1052,7 +1058,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
1052
1058
|
for (const event of rowStatics) {
|
|
1053
1059
|
const x = timeToX(event.startTime, windowStart, tick);
|
|
1054
1060
|
const width = timeToWidth(event.startTime, event.endTime, tick);
|
|
1055
|
-
ctx.fillStyle = view.theme.staticEventFill;
|
|
1061
|
+
ctx.fillStyle = (_d = (_c = (_b = event.props) == null ? void 0 : _b.style) == null ? void 0 : _c.fill) != null ? _d : view.theme.staticEventFill;
|
|
1056
1062
|
roundedRect(
|
|
1057
1063
|
ctx,
|
|
1058
1064
|
x,
|
|
@@ -1223,7 +1229,7 @@ var hitTest = (scene, view, x, y) => {
|
|
|
1223
1229
|
let rowTop = 0;
|
|
1224
1230
|
let rowId = null;
|
|
1225
1231
|
for (const id of scene.getVisibleRowIds()) {
|
|
1226
|
-
const height = scene.getRowHeight(id
|
|
1232
|
+
const height = scene.getRowHeight(id);
|
|
1227
1233
|
if (yContent >= rowTop && yContent < rowTop + height) {
|
|
1228
1234
|
rowId = id;
|
|
1229
1235
|
break;
|
|
@@ -1231,8 +1237,8 @@ var hitTest = (scene, view, x, y) => {
|
|
|
1231
1237
|
rowTop += height;
|
|
1232
1238
|
}
|
|
1233
1239
|
if (rowId === null) return null;
|
|
1234
|
-
const lanes = scene.getLanes(rowId
|
|
1235
|
-
const lanesY = rowTop - scrollTop + scene.getLaneInset(rowId
|
|
1240
|
+
const lanes = scene.getLanes(rowId);
|
|
1241
|
+
const lanesY = rowTop - scrollTop + scene.getLaneInset(rowId);
|
|
1236
1242
|
const events = cullToWindow(
|
|
1237
1243
|
scene.getRowEvents(rowId),
|
|
1238
1244
|
windowStart,
|
|
@@ -1652,11 +1658,7 @@ var useCanvasInteractions = ({
|
|
|
1652
1658
|
const yContent = clientY - canvas.getBoundingClientRect().top + view.scrollTop;
|
|
1653
1659
|
let rowTop = 0;
|
|
1654
1660
|
for (const id of scene.getVisibleRowIds()) {
|
|
1655
|
-
const height = scene.getRowHeight(
|
|
1656
|
-
id,
|
|
1657
|
-
view.windowTime[0],
|
|
1658
|
-
view.windowTime[1]
|
|
1659
|
-
);
|
|
1661
|
+
const height = scene.getRowHeight(id);
|
|
1660
1662
|
if (yContent >= rowTop && yContent < rowTop + height) return id;
|
|
1661
1663
|
rowTop += height;
|
|
1662
1664
|
}
|
|
@@ -2010,6 +2012,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2010
2012
|
applySelection,
|
|
2011
2013
|
getSelection
|
|
2012
2014
|
}, contentRef) => {
|
|
2015
|
+
var _a;
|
|
2013
2016
|
const staticCanvasRef = (0, import_react6.useRef)(null);
|
|
2014
2017
|
const dynamicCanvasRef = (0, import_react6.useRef)(null);
|
|
2015
2018
|
const ghostRef = (0, import_react6.useRef)(null);
|
|
@@ -2032,8 +2035,8 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2032
2035
|
};
|
|
2033
2036
|
}, [scene, rendererRef]);
|
|
2034
2037
|
(0, import_react6.useEffect)(() => {
|
|
2035
|
-
var
|
|
2036
|
-
(
|
|
2038
|
+
var _a2, _b;
|
|
2039
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.animator.setDurations(
|
|
2037
2040
|
animations.layoutMs,
|
|
2038
2041
|
animations.fadeMs
|
|
2039
2042
|
);
|
|
@@ -2058,14 +2061,14 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2058
2061
|
rendererRef
|
|
2059
2062
|
]);
|
|
2060
2063
|
const measureViewport = (0, import_react6.useCallback)(() => {
|
|
2061
|
-
var
|
|
2064
|
+
var _a2;
|
|
2062
2065
|
const column = contentRef && "current" in contentRef ? contentRef.current : null;
|
|
2063
2066
|
const body = bodyRef.current;
|
|
2064
2067
|
if (!column || !body) return;
|
|
2065
2068
|
const cap = totalHeightRef.current > 0 ? totalHeightRef.current : Infinity;
|
|
2066
2069
|
const height = Math.min(body.clientHeight, cap, window.innerHeight);
|
|
2067
2070
|
setViewportHeight(height);
|
|
2068
|
-
(
|
|
2071
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.setView({
|
|
2069
2072
|
width: column.getBoundingClientRect().width,
|
|
2070
2073
|
height
|
|
2071
2074
|
});
|
|
@@ -2084,8 +2087,8 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2084
2087
|
const body = bodyRef.current;
|
|
2085
2088
|
if (!body) return;
|
|
2086
2089
|
const handleScroll = () => {
|
|
2087
|
-
var
|
|
2088
|
-
(
|
|
2090
|
+
var _a2;
|
|
2091
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.setView({ scrollTop: body.scrollTop });
|
|
2089
2092
|
setScrollTop(body.scrollTop);
|
|
2090
2093
|
};
|
|
2091
2094
|
body.addEventListener("scroll", handleScroll, { passive: true });
|
|
@@ -2110,14 +2113,14 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2110
2113
|
wrapper.appendChild(measurer);
|
|
2111
2114
|
let lastWidth = -1;
|
|
2112
2115
|
const measure = () => {
|
|
2113
|
-
var
|
|
2116
|
+
var _a2;
|
|
2114
2117
|
const width = wrapper.clientWidth;
|
|
2115
2118
|
if (width === 0 || width === lastWidth) return;
|
|
2116
2119
|
lastWidth = width;
|
|
2117
2120
|
measurer.style.width = `${width}px`;
|
|
2118
2121
|
const heights = /* @__PURE__ */ new Map();
|
|
2119
2122
|
for (const row of rows) {
|
|
2120
|
-
measurer.textContent = (
|
|
2123
|
+
measurer.textContent = (_a2 = row.name) != null ? _a2 : "";
|
|
2121
2124
|
heights.set(
|
|
2122
2125
|
row.id,
|
|
2123
2126
|
Math.ceil(measurer.offsetHeight) + 2 * theme.rowPaddingY
|
|
@@ -2188,15 +2191,12 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2188
2191
|
getSelection
|
|
2189
2192
|
});
|
|
2190
2193
|
(0, import_react6.useEffect)(() => {
|
|
2191
|
-
var
|
|
2192
|
-
(
|
|
2194
|
+
var _a2;
|
|
2195
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.setView({
|
|
2193
2196
|
selectedEventIds: new Set(getSelection())
|
|
2194
2197
|
});
|
|
2195
2198
|
}, [getSelection, rendererRef]);
|
|
2196
|
-
const { offsetOf, totalHeight } = scene.getRowOffsets(
|
|
2197
|
-
windowTime[0],
|
|
2198
|
-
windowTime[1]
|
|
2199
|
-
);
|
|
2199
|
+
const { offsetOf, totalHeight } = scene.getRowOffsets();
|
|
2200
2200
|
totalHeightRef.current = totalHeight;
|
|
2201
2201
|
(0, import_react6.useLayoutEffect)(() => {
|
|
2202
2202
|
measureViewport();
|
|
@@ -2213,7 +2213,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2213
2213
|
if (scene.isRowHidden(row.id)) continue;
|
|
2214
2214
|
const top = offsetOf.get(row.id);
|
|
2215
2215
|
if (top === void 0) continue;
|
|
2216
|
-
const height = scene.getRowHeight(row.id
|
|
2216
|
+
const height = scene.getRowHeight(row.id);
|
|
2217
2217
|
if (top + height < scrollTop) continue;
|
|
2218
2218
|
if (top > scrollTop + viewportHeight) break;
|
|
2219
2219
|
const isParent = scene.isRowParent(row.id);
|
|
@@ -2231,7 +2231,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2231
2231
|
style: {
|
|
2232
2232
|
top,
|
|
2233
2233
|
height,
|
|
2234
|
-
borderBottom: i === rows.length - 1 ? "none" :
|
|
2234
|
+
borderBottom: i === rows.length - 1 ? "none" : `1px solid ${(_a = theme.headerBorderColor) != null ? _a : "yellow"}`,
|
|
2235
2235
|
// Row heights/positions apply instantly (no layout tween) so the
|
|
2236
2236
|
// header snaps in lockstep with its canvas row — see draw-events.
|
|
2237
2237
|
// Grouped rows left-align so the caret + tree spine line up; plain
|
|
@@ -2305,7 +2305,13 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2305
2305
|
{
|
|
2306
2306
|
ref: headerWrapperRef,
|
|
2307
2307
|
className: headerClassNames,
|
|
2308
|
-
style: {
|
|
2308
|
+
style: {
|
|
2309
|
+
height: totalHeight,
|
|
2310
|
+
background: theme.headerBackground,
|
|
2311
|
+
color: theme.headerTextColor,
|
|
2312
|
+
borderRightColor: theme.headerBorderColor,
|
|
2313
|
+
boxShadow: theme.headerShadow
|
|
2314
|
+
}
|
|
2309
2315
|
},
|
|
2310
2316
|
visibleHeaders,
|
|
2311
2317
|
renderRowLabel && // off-screen: renders every row's custom header so its natural height can be measured
|
|
@@ -2420,9 +2426,7 @@ var SceneStore = class {
|
|
|
2420
2426
|
events: [],
|
|
2421
2427
|
staticEvents: [],
|
|
2422
2428
|
lanesDirty: true,
|
|
2423
|
-
lanes: null
|
|
2424
|
-
laneWindowStart: NaN,
|
|
2425
|
-
laneWindowEnd: NaN
|
|
2429
|
+
lanes: null
|
|
2426
2430
|
}
|
|
2427
2431
|
);
|
|
2428
2432
|
}
|
|
@@ -2604,14 +2608,15 @@ var SceneStore = class {
|
|
|
2604
2608
|
var _a, _b;
|
|
2605
2609
|
return (_b = (_a = this.rowIndexes.get(rowId)) == null ? void 0 : _a.staticEvents) != null ? _b : [];
|
|
2606
2610
|
}
|
|
2607
|
-
|
|
2611
|
+
/** Lanes over ALL the row's events, not just those in view: a lane assignment that followed the
|
|
2612
|
+
* window re-packed the row on every pan frame, so bars jumped between lanes as others scrolled in
|
|
2613
|
+
* and out. The row is as tall as its peak overlap anywhere. */
|
|
2614
|
+
getLanes(rowId) {
|
|
2608
2615
|
this.flushParentSpans(rowId);
|
|
2609
2616
|
const index = this.rowIndexes.get(rowId);
|
|
2610
2617
|
if (!index) return { laneOf: /* @__PURE__ */ new Map(), highestLane: 0 };
|
|
2611
|
-
if (index.lanesDirty || index.lanes === null
|
|
2612
|
-
index.lanes = assignLanes(index.events
|
|
2613
|
-
index.laneWindowStart = windowStart;
|
|
2614
|
-
index.laneWindowEnd = windowEnd;
|
|
2618
|
+
if (index.lanesDirty || index.lanes === null) {
|
|
2619
|
+
index.lanes = assignLanes(index.events);
|
|
2615
2620
|
index.lanesDirty = false;
|
|
2616
2621
|
}
|
|
2617
2622
|
return index.lanes;
|
|
@@ -2637,23 +2642,17 @@ var SceneStore = class {
|
|
|
2637
2642
|
this.labelMinHeights = heights;
|
|
2638
2643
|
this.bump();
|
|
2639
2644
|
}
|
|
2640
|
-
getRowHeight(rowId
|
|
2645
|
+
getRowHeight(rowId) {
|
|
2641
2646
|
var _a;
|
|
2642
|
-
const laneHeight = rowMinHeight(
|
|
2643
|
-
this.getLanes(rowId, windowStart, windowEnd).highestLane,
|
|
2644
|
-
this.geometry
|
|
2645
|
-
);
|
|
2647
|
+
const laneHeight = rowMinHeight(this.getLanes(rowId).highestLane, this.geometry);
|
|
2646
2648
|
const labelHeight = (_a = this.labelMinHeights.get(rowId)) != null ? _a : 0;
|
|
2647
2649
|
return Math.max(laneHeight, labelHeight);
|
|
2648
2650
|
}
|
|
2649
2651
|
/** Extra top offset for a row's lanes: when a tall label grows the row past what its lanes need,
|
|
2650
2652
|
* the lanes sit centred in it rather than hugging the top with the surplus all below. */
|
|
2651
|
-
getLaneInset(rowId
|
|
2653
|
+
getLaneInset(rowId) {
|
|
2652
2654
|
var _a;
|
|
2653
|
-
const laneHeight = rowMinHeight(
|
|
2654
|
-
this.getLanes(rowId, windowStart, windowEnd).highestLane,
|
|
2655
|
-
this.geometry
|
|
2656
|
-
);
|
|
2655
|
+
const laneHeight = rowMinHeight(this.getLanes(rowId).highestLane, this.geometry);
|
|
2657
2656
|
const labelHeight = (_a = this.labelMinHeights.get(rowId)) != null ? _a : 0;
|
|
2658
2657
|
return labelHeight > laneHeight ? Math.floor((labelHeight - laneHeight) / 2) : 0;
|
|
2659
2658
|
}
|
|
@@ -2661,12 +2660,12 @@ var SceneStore = class {
|
|
|
2661
2660
|
* y offset of each row's top edge (content coordinates, before scroll) plus
|
|
2662
2661
|
* the total content height — drives both drawing and the scroll spacer.
|
|
2663
2662
|
*/
|
|
2664
|
-
getRowOffsets(
|
|
2663
|
+
getRowOffsets() {
|
|
2665
2664
|
const offsetOf = /* @__PURE__ */ new Map();
|
|
2666
2665
|
let y = 0;
|
|
2667
2666
|
for (const rowId of this.getVisibleRowIds()) {
|
|
2668
2667
|
offsetOf.set(rowId, y);
|
|
2669
|
-
y += this.getRowHeight(rowId
|
|
2668
|
+
y += this.getRowHeight(rowId);
|
|
2670
2669
|
}
|
|
2671
2670
|
return { offsetOf, totalHeight: y };
|
|
2672
2671
|
}
|
|
@@ -2841,6 +2840,7 @@ var Timeline = (0, import_react7.forwardRef)(
|
|
|
2841
2840
|
showEventPrompt = true,
|
|
2842
2841
|
panZoom,
|
|
2843
2842
|
timeBar,
|
|
2843
|
+
showTimeBar = true,
|
|
2844
2844
|
animations = true
|
|
2845
2845
|
}, handleRef) => {
|
|
2846
2846
|
const [windowTime, setWindowTime] = (0, import_react7.useState)([
|
|
@@ -2944,8 +2944,7 @@ var Timeline = (0, import_react7.forwardRef)(
|
|
|
2944
2944
|
updateEvents: (patches) => scene.applyPatches(patches),
|
|
2945
2945
|
getEvent: (id) => scene.getEvent(id),
|
|
2946
2946
|
scrollToRow: (rowId) => {
|
|
2947
|
-
const
|
|
2948
|
-
const offset2 = scene.getRowOffsets(windowStart, windowEnd).offsetOf.get(rowId);
|
|
2947
|
+
const offset2 = scene.getRowOffsets().offsetOf.get(rowId);
|
|
2949
2948
|
if (offset2 !== void 0 && bodyRef.current) {
|
|
2950
2949
|
bodyRef.current.scrollTop = offset2;
|
|
2951
2950
|
}
|
|
@@ -2953,7 +2952,16 @@ var Timeline = (0, import_react7.forwardRef)(
|
|
|
2953
2952
|
scrollToTime: (time) => {
|
|
2954
2953
|
setWindowTime((prev) => [time, time + (prev[1] - prev[0])]);
|
|
2955
2954
|
},
|
|
2956
|
-
|
|
2955
|
+
// the scale follows the window, or a zoom applied from outside draws and pans at the old one
|
|
2956
|
+
setWindow: (startTime, endTime) => {
|
|
2957
|
+
var _a;
|
|
2958
|
+
setWindowTime([startTime, endTime]);
|
|
2959
|
+
const width = (_a = contentRef.current) == null ? void 0 : _a.getBoundingClientRect().width;
|
|
2960
|
+
if (width && endTime > startTime) {
|
|
2961
|
+
setTick((endTime - startTime) / width);
|
|
2962
|
+
setCellWidth(width / ((endTime - startTime) / 3600));
|
|
2963
|
+
}
|
|
2964
|
+
},
|
|
2957
2965
|
getVisibleRange: () => ({
|
|
2958
2966
|
startTime: windowTimeRef.current[0],
|
|
2959
2967
|
endTime: windowTimeRef.current[1]
|
|
@@ -3052,7 +3060,7 @@ var Timeline = (0, import_react7.forwardRef)(
|
|
|
3052
3060
|
),
|
|
3053
3061
|
[eventPromptTemplate]
|
|
3054
3062
|
);
|
|
3055
|
-
return /* @__PURE__ */ import_react7.default.createElement("div", { className: "main-wrapper", ref: mainRef }, showRTIndicator && /* @__PURE__ */ import_react7.default.createElement(rt_indicator_default, { tick, windowTime }), /* @__PURE__ */ import_react7.default.createElement(
|
|
3063
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", { className: "main-wrapper", ref: mainRef }, showRTIndicator && /* @__PURE__ */ import_react7.default.createElement(rt_indicator_default, { tick, windowTime }), showTimeBar && /* @__PURE__ */ import_react7.default.createElement(
|
|
3056
3064
|
canvas_time_bar_default,
|
|
3057
3065
|
{
|
|
3058
3066
|
windowTime,
|
|
@@ -3062,7 +3070,7 @@ var Timeline = (0, import_react7.forwardRef)(
|
|
|
3062
3070
|
theme: resolvedTheme,
|
|
3063
3071
|
timeBar
|
|
3064
3072
|
}
|
|
3065
|
-
), /* @__PURE__ */ import_react7.default.createElement("div", { className: "body-wrapper", ref: bodyRef }, /* @__PURE__ */ import_react7.default.createElement(
|
|
3073
|
+
), /* @__PURE__ */ import_react7.default.createElement("div", { className: "body-wrapper", ref: bodyRef, style: { borderColor: resolvedTheme.borderColor } }, /* @__PURE__ */ import_react7.default.createElement(
|
|
3066
3074
|
canvas_board_default,
|
|
3067
3075
|
{
|
|
3068
3076
|
scene,
|