awesome-timeline-react 0.6.1 → 0.7.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/dist/_tsup-dts-rollup.d.mts +18 -0
- package/dist/_tsup-dts-rollup.d.ts +18 -0
- package/dist/index.js +24 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1031,6 +1031,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
1031
1031
|
if (rowY + rowHeight < 0) continue;
|
|
1032
1032
|
if (rowY > view.height) break;
|
|
1033
1033
|
const lanes = scene.getLanes(rowId, windowStart, windowEnd);
|
|
1034
|
+
const inset = scene.getLaneInset(rowId, windowStart, windowEnd);
|
|
1034
1035
|
const rowStatics = cullToWindow(
|
|
1035
1036
|
scene.getRowStaticEvents(rowId),
|
|
1036
1037
|
windowStart,
|
|
@@ -1043,7 +1044,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
1043
1044
|
roundedRect(
|
|
1044
1045
|
ctx,
|
|
1045
1046
|
x,
|
|
1046
|
-
rowY + geometry.laneTopOffset,
|
|
1047
|
+
rowY + inset + geometry.laneTopOffset,
|
|
1047
1048
|
width,
|
|
1048
1049
|
staticEventHeight(lanes.highestLane, geometry),
|
|
1049
1050
|
geometry.barRadius
|
|
@@ -1059,7 +1060,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
1059
1060
|
let width = timeToWidth(event.startTime, event.endTime, tick);
|
|
1060
1061
|
const y = rowY + animator.eventTop(
|
|
1061
1062
|
event.id,
|
|
1062
|
-
laneTop(lanes.laneOf.get(event.id), geometry)
|
|
1063
|
+
inset + laneTop(lanes.laneOf.get(event.id), geometry)
|
|
1063
1064
|
);
|
|
1064
1065
|
const resize = view.resizePreview;
|
|
1065
1066
|
const resizing = resize !== null && resize.eventId === event.id;
|
|
@@ -1219,7 +1220,7 @@ var hitTest = (scene, view, x, y) => {
|
|
|
1219
1220
|
}
|
|
1220
1221
|
if (rowId === null) return null;
|
|
1221
1222
|
const lanes = scene.getLanes(rowId, windowStart, windowEnd);
|
|
1222
|
-
const
|
|
1223
|
+
const lanesY = rowTop - scrollTop + scene.getLaneInset(rowId, windowStart, windowEnd);
|
|
1223
1224
|
const events = cullToWindow(
|
|
1224
1225
|
scene.getRowEvents(rowId),
|
|
1225
1226
|
windowStart,
|
|
@@ -1229,7 +1230,7 @@ var hitTest = (scene, view, x, y) => {
|
|
|
1229
1230
|
const event = events[i];
|
|
1230
1231
|
const rect = {
|
|
1231
1232
|
x: timeToX(event.startTime, windowStart, tick),
|
|
1232
|
-
y:
|
|
1233
|
+
y: lanesY + laneTop(lanes.laneOf.get(event.id), geometry),
|
|
1233
1234
|
width: timeToWidth(event.startTime, event.endTime, tick),
|
|
1234
1235
|
height: geometry.barHeight
|
|
1235
1236
|
};
|
|
@@ -1246,7 +1247,7 @@ var hitTest = (scene, view, x, y) => {
|
|
|
1246
1247
|
const event = statics[i];
|
|
1247
1248
|
const rect = {
|
|
1248
1249
|
x: timeToX(event.startTime, windowStart, tick),
|
|
1249
|
-
y:
|
|
1250
|
+
y: lanesY + geometry.laneTopOffset,
|
|
1250
1251
|
width: timeToWidth(event.startTime, event.endTime, tick),
|
|
1251
1252
|
height: staticEventHeight(lanes.highestLane, geometry)
|
|
1252
1253
|
};
|
|
@@ -2633,6 +2634,17 @@ var SceneStore = class {
|
|
|
2633
2634
|
const labelHeight = (_a = this.labelMinHeights.get(rowId)) != null ? _a : 0;
|
|
2634
2635
|
return Math.max(laneHeight, labelHeight);
|
|
2635
2636
|
}
|
|
2637
|
+
/** Extra top offset for a row's lanes: when a tall label grows the row past what its lanes need,
|
|
2638
|
+
* the lanes sit centred in it rather than hugging the top with the surplus all below. */
|
|
2639
|
+
getLaneInset(rowId, windowStart, windowEnd) {
|
|
2640
|
+
var _a;
|
|
2641
|
+
const laneHeight = rowMinHeight(
|
|
2642
|
+
this.getLanes(rowId, windowStart, windowEnd).highestLane,
|
|
2643
|
+
this.geometry
|
|
2644
|
+
);
|
|
2645
|
+
const labelHeight = (_a = this.labelMinHeights.get(rowId)) != null ? _a : 0;
|
|
2646
|
+
return labelHeight > laneHeight ? Math.floor((labelHeight - laneHeight) / 2) : 0;
|
|
2647
|
+
}
|
|
2636
2648
|
/**
|
|
2637
2649
|
* y offset of each row's top edge (content coordinates, before scroll) plus
|
|
2638
2650
|
* the total content height — drives both drawing and the scroll spacer.
|
|
@@ -2802,6 +2814,7 @@ var Timeline = forwardRef3(
|
|
|
2802
2814
|
selectable = false,
|
|
2803
2815
|
defaultSelectedEventIds,
|
|
2804
2816
|
onSelectionChange,
|
|
2817
|
+
onWindowChange,
|
|
2805
2818
|
defaultCollapsedRowIds,
|
|
2806
2819
|
startDate,
|
|
2807
2820
|
endDate,
|
|
@@ -2906,6 +2919,12 @@ var Timeline = forwardRef3(
|
|
|
2906
2919
|
}, [scene, defaultCollapsedRowIds]);
|
|
2907
2920
|
const windowTimeRef = useRef7(windowTime);
|
|
2908
2921
|
windowTimeRef.current = windowTime;
|
|
2922
|
+
const onWindowChangeRef = useRef7(onWindowChange);
|
|
2923
|
+
onWindowChangeRef.current = onWindowChange;
|
|
2924
|
+
useEffect6(() => {
|
|
2925
|
+
var _a;
|
|
2926
|
+
(_a = onWindowChangeRef.current) == null ? void 0 : _a.call(onWindowChangeRef, { startTime: windowTime[0], endTime: windowTime[1] });
|
|
2927
|
+
}, [windowTime[0], windowTime[1]]);
|
|
2909
2928
|
useImperativeHandle2(
|
|
2910
2929
|
handleRef,
|
|
2911
2930
|
() => ({
|