awesome-timeline-react 0.5.0 → 0.6.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 +17 -0
- package/dist/_tsup-dts-rollup.d.ts +17 -0
- package/dist/index.css +8 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +50 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1997,6 +1997,7 @@ var CanvasBoard = forwardRef2(
|
|
|
1997
1997
|
rendererRef,
|
|
1998
1998
|
eventPromptRef,
|
|
1999
1999
|
rowsHeaderClassName,
|
|
2000
|
+
renderRowLabel,
|
|
2000
2001
|
setWindowTime,
|
|
2001
2002
|
setCellWidth,
|
|
2002
2003
|
setTick,
|
|
@@ -2016,6 +2017,7 @@ var CanvasBoard = forwardRef2(
|
|
|
2016
2017
|
const dynamicCanvasRef = useRef6(null);
|
|
2017
2018
|
const ghostRef = useRef6(null);
|
|
2018
2019
|
const headerWrapperRef = useRef6(null);
|
|
2020
|
+
const measureLayerRef = useRef6(null);
|
|
2019
2021
|
const totalHeightRef = useRef6(0);
|
|
2020
2022
|
const [scrollTop, setScrollTop] = useState3(0);
|
|
2021
2023
|
const [viewportHeight, setViewportHeight] = useState3(0);
|
|
@@ -2097,6 +2099,7 @@ var CanvasBoard = forwardRef2(
|
|
|
2097
2099
|
() => scene.version
|
|
2098
2100
|
);
|
|
2099
2101
|
useLayoutEffect(() => {
|
|
2102
|
+
if (renderRowLabel) return;
|
|
2100
2103
|
const wrapper = headerWrapperRef.current;
|
|
2101
2104
|
if (!wrapper) return;
|
|
2102
2105
|
const measurer = document.createElement("div");
|
|
@@ -2132,7 +2135,34 @@ var CanvasBoard = forwardRef2(
|
|
|
2132
2135
|
observer.disconnect();
|
|
2133
2136
|
wrapper.removeChild(measurer);
|
|
2134
2137
|
};
|
|
2135
|
-
}, [rows, scene, theme.rowPaddingY, rowsHeaderClassName]);
|
|
2138
|
+
}, [rows, scene, theme.rowPaddingY, rowsHeaderClassName, renderRowLabel]);
|
|
2139
|
+
useLayoutEffect(() => {
|
|
2140
|
+
if (!renderRowLabel) return;
|
|
2141
|
+
const layer = measureLayerRef.current;
|
|
2142
|
+
const wrapper = headerWrapperRef.current;
|
|
2143
|
+
if (!layer || !wrapper) return;
|
|
2144
|
+
const measure = () => {
|
|
2145
|
+
const real = wrapper.querySelector(".canvas-row-header");
|
|
2146
|
+
const w = (real == null ? void 0 : real.clientWidth) || wrapper.clientWidth || 100;
|
|
2147
|
+
layer.style.width = `${w}px`;
|
|
2148
|
+
const heights = /* @__PURE__ */ new Map();
|
|
2149
|
+
layer.querySelectorAll("[data-measure-row]").forEach((el) => {
|
|
2150
|
+
const id = el.dataset.measureRow;
|
|
2151
|
+
if (id) heights.set(id, Math.ceil(el.getBoundingClientRect().height) + 2 * theme.rowPaddingY);
|
|
2152
|
+
});
|
|
2153
|
+
if (heights.size) scene.setLabelMinHeights(heights);
|
|
2154
|
+
};
|
|
2155
|
+
measure();
|
|
2156
|
+
const ro = new ResizeObserver(measure);
|
|
2157
|
+
ro.observe(layer);
|
|
2158
|
+
layer.querySelectorAll("[data-measure-row]").forEach((el) => ro.observe(el));
|
|
2159
|
+
const wo = new ResizeObserver(measure);
|
|
2160
|
+
wo.observe(wrapper);
|
|
2161
|
+
return () => {
|
|
2162
|
+
ro.disconnect();
|
|
2163
|
+
wo.disconnect();
|
|
2164
|
+
};
|
|
2165
|
+
}, [rows, scene, theme.rowPaddingY, renderRowLabel]);
|
|
2136
2166
|
const {
|
|
2137
2167
|
handlePointerDown,
|
|
2138
2168
|
handlePointerMove,
|
|
@@ -2257,7 +2287,11 @@ var CanvasBoard = forwardRef2(
|
|
|
2257
2287
|
},
|
|
2258
2288
|
collapsed ? "\u25B8" : "\u25BE"
|
|
2259
2289
|
),
|
|
2260
|
-
|
|
2290
|
+
renderRowLabel ? (
|
|
2291
|
+
// custom header content (e.g. a control) fills the cell; it sizes to the row's height,
|
|
2292
|
+
// which stays driven by event lanes / the measured label (unchanged below).
|
|
2293
|
+
/* @__PURE__ */ React5.createElement("div", { className: "row-header-custom" }, renderRowLabel(row))
|
|
2294
|
+
) : /* @__PURE__ */ React5.createElement(
|
|
2261
2295
|
"span",
|
|
2262
2296
|
{
|
|
2263
2297
|
className: "row-header-label",
|
|
@@ -2276,7 +2310,18 @@ var CanvasBoard = forwardRef2(
|
|
|
2276
2310
|
className: headerClassNames,
|
|
2277
2311
|
style: { height: totalHeight }
|
|
2278
2312
|
},
|
|
2279
|
-
visibleHeaders
|
|
2313
|
+
visibleHeaders,
|
|
2314
|
+
renderRowLabel && // off-screen: renders every row's custom header so its natural height can be measured
|
|
2315
|
+
// (see the custom-header measurement effect). Never visible / hit-testable.
|
|
2316
|
+
/* @__PURE__ */ React5.createElement(
|
|
2317
|
+
"div",
|
|
2318
|
+
{
|
|
2319
|
+
ref: measureLayerRef,
|
|
2320
|
+
"aria-hidden": true,
|
|
2321
|
+
style: { position: "absolute", left: -99999, top: 0, visibility: "hidden", pointerEvents: "none" }
|
|
2322
|
+
},
|
|
2323
|
+
rows.map((row) => /* @__PURE__ */ React5.createElement("div", { key: row.id, "data-measure-row": row.id, className: "row-header-custom", style: { height: "auto" } }, renderRowLabel(row)))
|
|
2324
|
+
)
|
|
2280
2325
|
), /* @__PURE__ */ React5.createElement("div", { className: "canvas-content-column", ref: contentRef }, /* @__PURE__ */ React5.createElement("div", { className: "canvas-sticky" }, /* @__PURE__ */ React5.createElement("canvas", { ref: staticCanvasRef }), /* @__PURE__ */ React5.createElement(
|
|
2281
2326
|
"canvas",
|
|
2282
2327
|
{
|
|
@@ -2779,6 +2824,7 @@ var Timeline = forwardRef3(
|
|
|
2779
2824
|
theme,
|
|
2780
2825
|
drawEvent,
|
|
2781
2826
|
additionalClassNames,
|
|
2827
|
+
renderRowLabel,
|
|
2782
2828
|
showRTIndicator = true,
|
|
2783
2829
|
eventsResize = true,
|
|
2784
2830
|
stripeOverlap = false,
|
|
@@ -3015,6 +3061,7 @@ var Timeline = forwardRef3(
|
|
|
3015
3061
|
rendererRef,
|
|
3016
3062
|
eventPromptRef,
|
|
3017
3063
|
rowsHeaderClassName: additionalClassNames == null ? void 0 : additionalClassNames.rowsHeader,
|
|
3064
|
+
renderRowLabel,
|
|
3018
3065
|
setWindowTime,
|
|
3019
3066
|
setCellWidth,
|
|
3020
3067
|
setTick,
|