awesome-timeline-react 0.8.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/dist/_tsup-dts-rollup.d.mts +12 -1
- package/dist/_tsup-dts-rollup.d.ts +12 -1
- package/dist/index.js +46 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -537,8 +537,9 @@ var CanvasTimeBar = ({
|
|
|
537
537
|
theme,
|
|
538
538
|
timeBar
|
|
539
539
|
}) => {
|
|
540
|
-
var _a, _b;
|
|
540
|
+
var _a, _b, _c;
|
|
541
541
|
const canvasRef = useRef4(null);
|
|
542
|
+
const header = theme != null ? theme : DEFAULT_THEME;
|
|
542
543
|
const topRow = (_a = timeBar == null ? void 0 : timeBar.topRow) != null ? _a : { unit: "day" };
|
|
543
544
|
const bottomRow = (_b = timeBar == null ? void 0 : timeBar.bottomRow) != null ? _b : { unit: "hour" };
|
|
544
545
|
useEffect3(() => {
|
|
@@ -567,24 +568,33 @@ var CanvasTimeBar = ({
|
|
|
567
568
|
}))
|
|
568
569
|
});
|
|
569
570
|
}, [windowTime, tick, contentWidth, theme, timeBar]);
|
|
570
|
-
return /* @__PURE__ */ React3.createElement(
|
|
571
|
-
"canvas",
|
|
572
|
-
{
|
|
573
|
-
ref: canvasRef,
|
|
574
|
-
className: "canvas-time-bar",
|
|
575
|
-
style: { minWidth: contentWidth ? contentWidth : 0 }
|
|
576
|
-
}
|
|
577
|
-
), scrollWidth ? /* @__PURE__ */ React3.createElement(
|
|
571
|
+
return /* @__PURE__ */ React3.createElement(
|
|
578
572
|
"div",
|
|
579
573
|
{
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
574
|
+
className: "time-bar",
|
|
575
|
+
style: { background: header.headerBackground, color: header.headerTextColor, borderColor: header.headerBorderColor }
|
|
576
|
+
},
|
|
577
|
+
/* @__PURE__ */ React3.createElement("div", { className: "empty-block", style: { borderRightColor: header.headerBorderColor } }),
|
|
578
|
+
/* @__PURE__ */ React3.createElement(
|
|
579
|
+
"canvas",
|
|
580
|
+
{
|
|
581
|
+
ref: canvasRef,
|
|
582
|
+
className: "canvas-time-bar",
|
|
583
|
+
style: { minWidth: contentWidth ? contentWidth : 0 }
|
|
585
584
|
}
|
|
586
|
-
|
|
587
|
-
|
|
585
|
+
),
|
|
586
|
+
scrollWidth ? /* @__PURE__ */ React3.createElement(
|
|
587
|
+
"div",
|
|
588
|
+
{
|
|
589
|
+
style: {
|
|
590
|
+
width: scrollWidth,
|
|
591
|
+
height: "100%",
|
|
592
|
+
boxSizing: "border-box",
|
|
593
|
+
borderLeft: `1px solid ${(_c = header.headerBorderColor) != null ? _c : "yellow"}`
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
) : null
|
|
597
|
+
);
|
|
588
598
|
};
|
|
589
599
|
var canvas_time_bar_default = CanvasTimeBar;
|
|
590
600
|
|
|
@@ -1990,6 +2000,7 @@ var CanvasBoard = forwardRef2(
|
|
|
1990
2000
|
applySelection,
|
|
1991
2001
|
getSelection
|
|
1992
2002
|
}, contentRef) => {
|
|
2003
|
+
var _a;
|
|
1993
2004
|
const staticCanvasRef = useRef6(null);
|
|
1994
2005
|
const dynamicCanvasRef = useRef6(null);
|
|
1995
2006
|
const ghostRef = useRef6(null);
|
|
@@ -2012,8 +2023,8 @@ var CanvasBoard = forwardRef2(
|
|
|
2012
2023
|
};
|
|
2013
2024
|
}, [scene, rendererRef]);
|
|
2014
2025
|
useEffect5(() => {
|
|
2015
|
-
var
|
|
2016
|
-
(
|
|
2026
|
+
var _a2, _b;
|
|
2027
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.animator.setDurations(
|
|
2017
2028
|
animations.layoutMs,
|
|
2018
2029
|
animations.fadeMs
|
|
2019
2030
|
);
|
|
@@ -2038,14 +2049,14 @@ var CanvasBoard = forwardRef2(
|
|
|
2038
2049
|
rendererRef
|
|
2039
2050
|
]);
|
|
2040
2051
|
const measureViewport = useCallback2(() => {
|
|
2041
|
-
var
|
|
2052
|
+
var _a2;
|
|
2042
2053
|
const column = contentRef && "current" in contentRef ? contentRef.current : null;
|
|
2043
2054
|
const body = bodyRef.current;
|
|
2044
2055
|
if (!column || !body) return;
|
|
2045
2056
|
const cap = totalHeightRef.current > 0 ? totalHeightRef.current : Infinity;
|
|
2046
2057
|
const height = Math.min(body.clientHeight, cap, window.innerHeight);
|
|
2047
2058
|
setViewportHeight(height);
|
|
2048
|
-
(
|
|
2059
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.setView({
|
|
2049
2060
|
width: column.getBoundingClientRect().width,
|
|
2050
2061
|
height
|
|
2051
2062
|
});
|
|
@@ -2064,8 +2075,8 @@ var CanvasBoard = forwardRef2(
|
|
|
2064
2075
|
const body = bodyRef.current;
|
|
2065
2076
|
if (!body) return;
|
|
2066
2077
|
const handleScroll = () => {
|
|
2067
|
-
var
|
|
2068
|
-
(
|
|
2078
|
+
var _a2;
|
|
2079
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.setView({ scrollTop: body.scrollTop });
|
|
2069
2080
|
setScrollTop(body.scrollTop);
|
|
2070
2081
|
};
|
|
2071
2082
|
body.addEventListener("scroll", handleScroll, { passive: true });
|
|
@@ -2090,14 +2101,14 @@ var CanvasBoard = forwardRef2(
|
|
|
2090
2101
|
wrapper.appendChild(measurer);
|
|
2091
2102
|
let lastWidth = -1;
|
|
2092
2103
|
const measure = () => {
|
|
2093
|
-
var
|
|
2104
|
+
var _a2;
|
|
2094
2105
|
const width = wrapper.clientWidth;
|
|
2095
2106
|
if (width === 0 || width === lastWidth) return;
|
|
2096
2107
|
lastWidth = width;
|
|
2097
2108
|
measurer.style.width = `${width}px`;
|
|
2098
2109
|
const heights = /* @__PURE__ */ new Map();
|
|
2099
2110
|
for (const row of rows) {
|
|
2100
|
-
measurer.textContent = (
|
|
2111
|
+
measurer.textContent = (_a2 = row.name) != null ? _a2 : "";
|
|
2101
2112
|
heights.set(
|
|
2102
2113
|
row.id,
|
|
2103
2114
|
Math.ceil(measurer.offsetHeight) + 2 * theme.rowPaddingY
|
|
@@ -2168,8 +2179,8 @@ var CanvasBoard = forwardRef2(
|
|
|
2168
2179
|
getSelection
|
|
2169
2180
|
});
|
|
2170
2181
|
useEffect5(() => {
|
|
2171
|
-
var
|
|
2172
|
-
(
|
|
2182
|
+
var _a2;
|
|
2183
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.setView({
|
|
2173
2184
|
selectedEventIds: new Set(getSelection())
|
|
2174
2185
|
});
|
|
2175
2186
|
}, [getSelection, rendererRef]);
|
|
@@ -2208,7 +2219,7 @@ var CanvasBoard = forwardRef2(
|
|
|
2208
2219
|
style: {
|
|
2209
2220
|
top,
|
|
2210
2221
|
height,
|
|
2211
|
-
borderBottom: i === rows.length - 1 ? "none" :
|
|
2222
|
+
borderBottom: i === rows.length - 1 ? "none" : `1px solid ${(_a = theme.headerBorderColor) != null ? _a : "yellow"}`,
|
|
2212
2223
|
// Row heights/positions apply instantly (no layout tween) so the
|
|
2213
2224
|
// header snaps in lockstep with its canvas row — see draw-events.
|
|
2214
2225
|
// Grouped rows left-align so the caret + tree spine line up; plain
|
|
@@ -2282,7 +2293,13 @@ var CanvasBoard = forwardRef2(
|
|
|
2282
2293
|
{
|
|
2283
2294
|
ref: headerWrapperRef,
|
|
2284
2295
|
className: headerClassNames,
|
|
2285
|
-
style: {
|
|
2296
|
+
style: {
|
|
2297
|
+
height: totalHeight,
|
|
2298
|
+
background: theme.headerBackground,
|
|
2299
|
+
color: theme.headerTextColor,
|
|
2300
|
+
borderRightColor: theme.headerBorderColor,
|
|
2301
|
+
boxShadow: theme.headerShadow
|
|
2302
|
+
}
|
|
2286
2303
|
},
|
|
2287
2304
|
visibleHeaders,
|
|
2288
2305
|
renderRowLabel && // off-screen: renders every row's custom header so its natural height can be measured
|
|
@@ -3041,7 +3058,7 @@ var Timeline = forwardRef3(
|
|
|
3041
3058
|
theme: resolvedTheme,
|
|
3042
3059
|
timeBar
|
|
3043
3060
|
}
|
|
3044
|
-
), /* @__PURE__ */ React6.createElement("div", { className: "body-wrapper", ref: bodyRef }, /* @__PURE__ */ React6.createElement(
|
|
3061
|
+
), /* @__PURE__ */ React6.createElement("div", { className: "body-wrapper", ref: bodyRef, style: { borderColor: resolvedTheme.borderColor } }, /* @__PURE__ */ React6.createElement(
|
|
3045
3062
|
canvas_board_default,
|
|
3046
3063
|
{
|
|
3047
3064
|
scene,
|