awesome-timeline-react 0.5.0 → 0.6.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/_tsup-dts-rollup.d.mts +49 -5
- package/dist/_tsup-dts-rollup.d.ts +49 -5
- package/dist/index.css +8 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +59 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React_2 } from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Layout animation configuration. `false` disables all animations;
|
|
@@ -13,14 +14,24 @@ export declare type AnimationConfig = boolean | {
|
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Assigns a vertical lane (stacking order) to each window-visible event of a
|
|
16
|
-
* single row
|
|
17
|
-
*
|
|
17
|
+
* single row: interval partitioning, so a row opens exactly as many lanes as
|
|
18
|
+
* its peak concurrency and NO event is ever laid over another.
|
|
19
|
+
*
|
|
20
|
+
* Each event takes the lowest lane whose last event has already ended; if every
|
|
21
|
+
* lane is still busy it opens a new one. Semantics:
|
|
18
22
|
*
|
|
19
23
|
* - Events outside [windowStart, windowEnd] are skipped and do not influence
|
|
20
24
|
* lane assignment at all.
|
|
21
|
-
* -
|
|
22
|
-
*
|
|
23
|
-
* -
|
|
25
|
+
* - Touching events (prev.endTime === next.startTime) do not overlap, so they
|
|
26
|
+
* share a lane.
|
|
27
|
+
* - Lowest-free-lane means the assignment is deterministic, and a row with N
|
|
28
|
+
* concurrent events ends up exactly N lanes tall.
|
|
29
|
+
*
|
|
30
|
+
* Replaces the algorithm inlined in the original use-produce-content.tsx, whose
|
|
31
|
+
* occupancy scan was bounded by the previously-placed event's lane and reset
|
|
32
|
+
* whenever a lane freed: after a lane freed mid-row, later events were placed
|
|
33
|
+
* in lanes that had never been checked, and were drawn on top of the events
|
|
34
|
+
* still running there (visible on capacity rows with 3+ concurrent events).
|
|
24
35
|
*
|
|
25
36
|
* `rowEvents` must already be filtered to one row and sorted with
|
|
26
37
|
* helpers/sort-events (startTime asc, endTime asc).
|
|
@@ -44,6 +55,7 @@ declare type CanvasBoardProps = {
|
|
|
44
55
|
rendererRef: React_2.MutableRefObject<TimelineRenderer | null>;
|
|
45
56
|
eventPromptRef: React_2.MutableRefObject<EventPromptActionsType | null>;
|
|
46
57
|
rowsHeaderClassName?: string;
|
|
58
|
+
renderRowLabel?: (row: RowType) => React_2.ReactNode;
|
|
47
59
|
setWindowTime: React_2.Dispatch<React_2.SetStateAction<number[]>>;
|
|
48
60
|
setCellWidth: React_2.Dispatch<React_2.SetStateAction<number>>;
|
|
49
61
|
setTick: React_2.Dispatch<React_2.SetStateAction<number | null>>;
|
|
@@ -929,6 +941,23 @@ declare type TimelineHandle = {
|
|
|
929
941
|
export { TimelineHandle }
|
|
930
942
|
export { TimelineHandle as TimelineHandle_alias_1 }
|
|
931
943
|
|
|
944
|
+
/**
|
|
945
|
+
* Lane stacking on a row whose events genuinely run in parallel (a shared pool / capacity row: one
|
|
946
|
+
* row, many concurrent bars). A row must open as many lanes as its peak concurrency so every bar is
|
|
947
|
+
* drawn in full — no bar may be laid over another.
|
|
948
|
+
*
|
|
949
|
+
* Both rows here are the same story with different data:
|
|
950
|
+
* - **Pool A** is the minimal case: four bars stack up, then lane 0's occupant ends and a new bar
|
|
951
|
+
* takes the freed lane, and the bars after it collide.
|
|
952
|
+
* - **Pool B** is the same failure in a realistic shape: a pool admitting a bar every 15 min, with
|
|
953
|
+
* runs of mixed length (one short "Hold"), so lane releases stop lining up with admissions.
|
|
954
|
+
*
|
|
955
|
+
* The panel above the board is computed by calling the SAME `assignLanes` the renderer uses, next to
|
|
956
|
+
* the peak concurrency the data actually needs — so it reports whether the layout is correct rather
|
|
957
|
+
* than asking you to eyeball it. `overlapping pairs` must be 0 and `lanes` must equal `needs`.
|
|
958
|
+
*/
|
|
959
|
+
export declare const TimelineLaneStacking: () => React_2.JSX.Element;
|
|
960
|
+
|
|
932
961
|
/**
|
|
933
962
|
* Long row labels: names that exceed the 100px header width wrap to multiple
|
|
934
963
|
* lines, stay centered, and grow the row height (and its canvas dividers) to
|
|
@@ -976,6 +1005,12 @@ declare type TimelineProps = {
|
|
|
976
1005
|
drawEvent?: DrawEventFn;
|
|
977
1006
|
/** only `rowsHeader` still applies — everything else is canvas-drawn (use `theme`) */
|
|
978
1007
|
additionalClassNames?: PartialRecord<keyof ModifableElements, string>;
|
|
1008
|
+
/** Custom content for a row's header cell (the left label column), replacing the default
|
|
1009
|
+
* `{row.name}` text. Rendered as real DOM inside the existing fixed-width header — the column width
|
|
1010
|
+
* is NOT changed (it feeds the canvas time-scale), so keep content within it; long text should wrap
|
|
1011
|
+
* or stack. The row's height stays driven by its event lanes / measured label, so custom content
|
|
1012
|
+
* should size to the height it's given (it varies per row). Absent → the default label. */
|
|
1013
|
+
renderRowLabel?: (row: RowType) => ReactNode;
|
|
979
1014
|
showRTIndicator?: boolean;
|
|
980
1015
|
eventsResize?: boolean;
|
|
981
1016
|
/** draw 45° diagonal stripes on the slice of an event bar that overlaps a
|
|
@@ -1027,6 +1062,15 @@ export declare class TimelineRenderer {
|
|
|
1027
1062
|
private drawFrame;
|
|
1028
1063
|
}
|
|
1029
1064
|
|
|
1065
|
+
/**
|
|
1066
|
+
* `renderRowLabel` slot: custom React in the row-header cell instead of the plain name. Here each
|
|
1067
|
+
* header shows a small circular value control ("dial") stacked over the row name — proving custom
|
|
1068
|
+
* content fits the fixed-width (100px) header, stacks when narrow, and vertically centers within each
|
|
1069
|
+
* row's DYNAMIC height (rows here have different numbers of stacked events, so heights vary). The
|
|
1070
|
+
* header width is NOT changed (it feeds the canvas time-scale); the dial sizes to the space it's given.
|
|
1071
|
+
*/
|
|
1072
|
+
export declare const TimelineRowHeaderSlot: () => React_2.JSX.Element;
|
|
1073
|
+
|
|
1030
1074
|
/**
|
|
1031
1075
|
* Selection: `selectable` turns on click selection. A plain click selects one
|
|
1032
1076
|
* event (it lifts with a shadow while every other event dims); Cmd/Ctrl+click
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React_2 } from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Layout animation configuration. `false` disables all animations;
|
|
@@ -13,14 +14,24 @@ export declare type AnimationConfig = boolean | {
|
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Assigns a vertical lane (stacking order) to each window-visible event of a
|
|
16
|
-
* single row
|
|
17
|
-
*
|
|
17
|
+
* single row: interval partitioning, so a row opens exactly as many lanes as
|
|
18
|
+
* its peak concurrency and NO event is ever laid over another.
|
|
19
|
+
*
|
|
20
|
+
* Each event takes the lowest lane whose last event has already ended; if every
|
|
21
|
+
* lane is still busy it opens a new one. Semantics:
|
|
18
22
|
*
|
|
19
23
|
* - Events outside [windowStart, windowEnd] are skipped and do not influence
|
|
20
24
|
* lane assignment at all.
|
|
21
|
-
* -
|
|
22
|
-
*
|
|
23
|
-
* -
|
|
25
|
+
* - Touching events (prev.endTime === next.startTime) do not overlap, so they
|
|
26
|
+
* share a lane.
|
|
27
|
+
* - Lowest-free-lane means the assignment is deterministic, and a row with N
|
|
28
|
+
* concurrent events ends up exactly N lanes tall.
|
|
29
|
+
*
|
|
30
|
+
* Replaces the algorithm inlined in the original use-produce-content.tsx, whose
|
|
31
|
+
* occupancy scan was bounded by the previously-placed event's lane and reset
|
|
32
|
+
* whenever a lane freed: after a lane freed mid-row, later events were placed
|
|
33
|
+
* in lanes that had never been checked, and were drawn on top of the events
|
|
34
|
+
* still running there (visible on capacity rows with 3+ concurrent events).
|
|
24
35
|
*
|
|
25
36
|
* `rowEvents` must already be filtered to one row and sorted with
|
|
26
37
|
* helpers/sort-events (startTime asc, endTime asc).
|
|
@@ -44,6 +55,7 @@ declare type CanvasBoardProps = {
|
|
|
44
55
|
rendererRef: React_2.MutableRefObject<TimelineRenderer | null>;
|
|
45
56
|
eventPromptRef: React_2.MutableRefObject<EventPromptActionsType | null>;
|
|
46
57
|
rowsHeaderClassName?: string;
|
|
58
|
+
renderRowLabel?: (row: RowType) => React_2.ReactNode;
|
|
47
59
|
setWindowTime: React_2.Dispatch<React_2.SetStateAction<number[]>>;
|
|
48
60
|
setCellWidth: React_2.Dispatch<React_2.SetStateAction<number>>;
|
|
49
61
|
setTick: React_2.Dispatch<React_2.SetStateAction<number | null>>;
|
|
@@ -929,6 +941,23 @@ declare type TimelineHandle = {
|
|
|
929
941
|
export { TimelineHandle }
|
|
930
942
|
export { TimelineHandle as TimelineHandle_alias_1 }
|
|
931
943
|
|
|
944
|
+
/**
|
|
945
|
+
* Lane stacking on a row whose events genuinely run in parallel (a shared pool / capacity row: one
|
|
946
|
+
* row, many concurrent bars). A row must open as many lanes as its peak concurrency so every bar is
|
|
947
|
+
* drawn in full — no bar may be laid over another.
|
|
948
|
+
*
|
|
949
|
+
* Both rows here are the same story with different data:
|
|
950
|
+
* - **Pool A** is the minimal case: four bars stack up, then lane 0's occupant ends and a new bar
|
|
951
|
+
* takes the freed lane, and the bars after it collide.
|
|
952
|
+
* - **Pool B** is the same failure in a realistic shape: a pool admitting a bar every 15 min, with
|
|
953
|
+
* runs of mixed length (one short "Hold"), so lane releases stop lining up with admissions.
|
|
954
|
+
*
|
|
955
|
+
* The panel above the board is computed by calling the SAME `assignLanes` the renderer uses, next to
|
|
956
|
+
* the peak concurrency the data actually needs — so it reports whether the layout is correct rather
|
|
957
|
+
* than asking you to eyeball it. `overlapping pairs` must be 0 and `lanes` must equal `needs`.
|
|
958
|
+
*/
|
|
959
|
+
export declare const TimelineLaneStacking: () => React_2.JSX.Element;
|
|
960
|
+
|
|
932
961
|
/**
|
|
933
962
|
* Long row labels: names that exceed the 100px header width wrap to multiple
|
|
934
963
|
* lines, stay centered, and grow the row height (and its canvas dividers) to
|
|
@@ -976,6 +1005,12 @@ declare type TimelineProps = {
|
|
|
976
1005
|
drawEvent?: DrawEventFn;
|
|
977
1006
|
/** only `rowsHeader` still applies — everything else is canvas-drawn (use `theme`) */
|
|
978
1007
|
additionalClassNames?: PartialRecord<keyof ModifableElements, string>;
|
|
1008
|
+
/** Custom content for a row's header cell (the left label column), replacing the default
|
|
1009
|
+
* `{row.name}` text. Rendered as real DOM inside the existing fixed-width header — the column width
|
|
1010
|
+
* is NOT changed (it feeds the canvas time-scale), so keep content within it; long text should wrap
|
|
1011
|
+
* or stack. The row's height stays driven by its event lanes / measured label, so custom content
|
|
1012
|
+
* should size to the height it's given (it varies per row). Absent → the default label. */
|
|
1013
|
+
renderRowLabel?: (row: RowType) => ReactNode;
|
|
979
1014
|
showRTIndicator?: boolean;
|
|
980
1015
|
eventsResize?: boolean;
|
|
981
1016
|
/** draw 45° diagonal stripes on the slice of an event bar that overlaps a
|
|
@@ -1027,6 +1062,15 @@ export declare class TimelineRenderer {
|
|
|
1027
1062
|
private drawFrame;
|
|
1028
1063
|
}
|
|
1029
1064
|
|
|
1065
|
+
/**
|
|
1066
|
+
* `renderRowLabel` slot: custom React in the row-header cell instead of the plain name. Here each
|
|
1067
|
+
* header shows a small circular value control ("dial") stacked over the row name — proving custom
|
|
1068
|
+
* content fits the fixed-width (100px) header, stacks when narrow, and vertically centers within each
|
|
1069
|
+
* row's DYNAMIC height (rows here have different numbers of stacked events, so heights vary). The
|
|
1070
|
+
* header width is NOT changed (it feeds the canvas time-scale); the dial sizes to the space it's given.
|
|
1071
|
+
*/
|
|
1072
|
+
export declare const TimelineRowHeaderSlot: () => React_2.JSX.Element;
|
|
1073
|
+
|
|
1030
1074
|
/**
|
|
1031
1075
|
* Selection: `selectable` turns on click selection. A plain click selects one
|
|
1032
1076
|
* event (it lifts with a shadow while every other event dims); Cmd/Ctrl+click
|
package/dist/index.css
CHANGED
|
@@ -42,6 +42,14 @@
|
|
|
42
42
|
overflow-wrap: break-word;
|
|
43
43
|
word-break: break-word;
|
|
44
44
|
}
|
|
45
|
+
.row-header-custom {
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
min-width: 0;
|
|
52
|
+
}
|
|
45
53
|
.event {
|
|
46
54
|
position: absolute;
|
|
47
55
|
height: 20px;
|
package/dist/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/style.css","../src/components/style.css"],"sourcesContent":[".rows-header-wrapper {\n width: 100px;\n height: fit-content;\n border-right: 1px solid yellow;\n background-color: rgb(39, 36, 36);\n color: white;\n box-sizing: border-box;\n box-shadow: 4px 0px 20px black;\n}\n\n.main-wrapper {\n position: relative;\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n}\n\n.body-wrapper {\n display: flex;\n flex-direction: row;\n border-left: 1px solid black;\n border-bottom: 1px solid black;\n border-right: 1px solid black;\n width: 100%;\n overflow: auto;\n box-sizing: border-box;\n}\n",".row-header {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100px;\n box-sizing: border-box;\n overflow: hidden;\n}\n\n/* The label wraps to as many lines as it needs; the row height is grown to\n fit it (see SceneStore.setLabelMinHeights) so wrapped labels stay vertically\n centered instead of overflowing into the next row. */\n.row-header-label {\n width: 100%;\n text-align: center;\n white-space: normal;\n overflow-wrap: break-word;\n word-break: break-word;\n}\n\n/* base look of an event pill — used by the drag ghost */\n.event {\n position: absolute;\n height: 20px;\n border: 1px solid black;\n z-index: 1;\n box-sizing: border-box;\n display: flex;\n justify-content: space-between;\n border-radius: 5px;\n box-shadow: inset 0px 0px 5px gray;\n}\n\n.event-prompt {\n position: absolute;\n display: none;\n z-index: 3;\n}\n\n.time-bar {\n display: flex;\n flex-direction: row;\n width: 100%;\n height: 50px;\n min-height: 50px;\n border: 1px solid yellow;\n background-color: rgb(39, 36, 36);\n color: white;\n box-sizing: border-box;\n}\n\n.empty-block {\n width: 100px;\n min-width: 100px;\n border-right: 1px solid yellow;\n box-sizing: border-box;\n}\n\n.rt-line {\n position: absolute;\n height: calc(100% - 24px);\n top: 24px;\n width: 2px;\n box-sizing: border-box;\n border-right: dotted 2px red;\n}\n\n.rt-arrow {\n position: absolute;\n top: 0px;\n width: 0;\n height: 0;\n border-left: 15px solid transparent;\n border-right: 15px solid transparent;\n\n border-top: 26px solid red;\n}\n\n.canvas-time-bar {\n height: 100%;\n /* replicates the legacy .hour-row drop shadow onto the content below */\n box-shadow: 0px 4px 20px black;\n}\n\n.canvas-rows-header {\n position: relative;\n flex-shrink: 0;\n}\n\n.canvas-row-header {\n position: absolute;\n width: 100%;\n box-sizing: border-box;\n /* transition is set inline from the `animations` prop */\n}\n\n.canvas-content-column {\n position: relative;\n flex: 1;\n min-width: 0;\n /* the body-wrapper is a flex row; without this the column is stretched to\n the viewport height, the scroll spacer overflows it, and the sticky\n canvas has no room to stick */\n align-self: flex-start;\n}\n\n.canvas-sticky {\n position: sticky;\n top: 0;\n height: 0;\n overflow: visible;\n z-index: 1;\n /* Isolate the sticky's internal layout. The viewport-sized canvases live\n inside it (absolutely positioned); without containment their height leaks\n into the content-sized body-wrapper's size, leaving it taller than its\n rows after a re-stack (a stale gap below the last row). `layout` keeps the\n canvases visible (unlike overflow:hidden) while stopping the leak. */\n contain: layout;\n}\n\n.canvas-sticky canvas {\n position: absolute;\n top: 0;\n left: 0;\n}\n\n.canvas-sticky canvas:last-of-type {\n cursor: grab;\n touch-action: none;\n}\n\n.canvas-drag-ghost {\n display: none;\n height: 20px;\n opacity: 50%;\n background-color: white;\n pointer-events: none;\n z-index: 2;\n}\n"],"mappings":";AAAA,CAAC;AACC,SAAO;AACP,UAAQ;AACR,gBAAc,IAAI,MAAM;AACxB,oBAAkB,IAAI,EAAE,EAAE,EAAE,EAAE;AAC9B,SAAO;AACP,cAAY;AACZ,cAAY,IAAI,IAAI,KAAK;AAC3B;AAEA,CAAC;AACC,YAAU;AAC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AC;AACC,YAAU;AACV,QAAM;AACN,aAAW;AAIX,cAAY;AACd;AAEA,CAAC;AACC,YAAU;AACV,OAAK;AACL,UAAQ;AACR,YAAU;AACV,WAAS;AAMT,WAAS;AACX;AAEA,CAdC,cAcc;AACb,YAAU;AACV,OAAK;AACL,QAAM;AACR;AAEA,CApBC,cAoBc,MAAM;AACnB,UAAQ;AACR,gBAAc;AAChB;AAEA,CAAC;AACC,WAAS;AACT,UAAQ;AACR,WAAS;AACT,oBAAkB;AAClB,kBAAgB;AAChB,WAAS;AACX;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/style.css","../src/components/style.css"],"sourcesContent":[".rows-header-wrapper {\n width: 100px;\n height: fit-content;\n border-right: 1px solid yellow;\n background-color: rgb(39, 36, 36);\n color: white;\n box-sizing: border-box;\n box-shadow: 4px 0px 20px black;\n}\n\n.main-wrapper {\n position: relative;\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n}\n\n.body-wrapper {\n display: flex;\n flex-direction: row;\n border-left: 1px solid black;\n border-bottom: 1px solid black;\n border-right: 1px solid black;\n width: 100%;\n overflow: auto;\n box-sizing: border-box;\n}\n",".row-header {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100px;\n box-sizing: border-box;\n overflow: hidden;\n}\n\n/* The label wraps to as many lines as it needs; the row height is grown to\n fit it (see SceneStore.setLabelMinHeights) so wrapped labels stay vertically\n centered instead of overflowing into the next row. */\n.row-header-label {\n width: 100%;\n text-align: center;\n white-space: normal;\n overflow-wrap: break-word;\n word-break: break-word;\n}\n\n/* Custom row-header content (the `renderRowLabel` slot). Fills the fixed-width cell and the row's\n (dynamic) height so the content can size itself to the space it's given. */\n.row-header-custom {\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 0;\n}\n\n/* base look of an event pill — used by the drag ghost */\n.event {\n position: absolute;\n height: 20px;\n border: 1px solid black;\n z-index: 1;\n box-sizing: border-box;\n display: flex;\n justify-content: space-between;\n border-radius: 5px;\n box-shadow: inset 0px 0px 5px gray;\n}\n\n.event-prompt {\n position: absolute;\n display: none;\n z-index: 3;\n}\n\n.time-bar {\n display: flex;\n flex-direction: row;\n width: 100%;\n height: 50px;\n min-height: 50px;\n border: 1px solid yellow;\n background-color: rgb(39, 36, 36);\n color: white;\n box-sizing: border-box;\n}\n\n.empty-block {\n width: 100px;\n min-width: 100px;\n border-right: 1px solid yellow;\n box-sizing: border-box;\n}\n\n.rt-line {\n position: absolute;\n height: calc(100% - 24px);\n top: 24px;\n width: 2px;\n box-sizing: border-box;\n border-right: dotted 2px red;\n}\n\n.rt-arrow {\n position: absolute;\n top: 0px;\n width: 0;\n height: 0;\n border-left: 15px solid transparent;\n border-right: 15px solid transparent;\n\n border-top: 26px solid red;\n}\n\n.canvas-time-bar {\n height: 100%;\n /* replicates the legacy .hour-row drop shadow onto the content below */\n box-shadow: 0px 4px 20px black;\n}\n\n.canvas-rows-header {\n position: relative;\n flex-shrink: 0;\n}\n\n.canvas-row-header {\n position: absolute;\n width: 100%;\n box-sizing: border-box;\n /* transition is set inline from the `animations` prop */\n}\n\n.canvas-content-column {\n position: relative;\n flex: 1;\n min-width: 0;\n /* the body-wrapper is a flex row; without this the column is stretched to\n the viewport height, the scroll spacer overflows it, and the sticky\n canvas has no room to stick */\n align-self: flex-start;\n}\n\n.canvas-sticky {\n position: sticky;\n top: 0;\n height: 0;\n overflow: visible;\n z-index: 1;\n /* Isolate the sticky's internal layout. The viewport-sized canvases live\n inside it (absolutely positioned); without containment their height leaks\n into the content-sized body-wrapper's size, leaving it taller than its\n rows after a re-stack (a stale gap below the last row). `layout` keeps the\n canvases visible (unlike overflow:hidden) while stopping the leak. */\n contain: layout;\n}\n\n.canvas-sticky canvas {\n position: absolute;\n top: 0;\n left: 0;\n}\n\n.canvas-sticky canvas:last-of-type {\n cursor: grab;\n touch-action: none;\n}\n\n.canvas-drag-ghost {\n display: none;\n height: 20px;\n opacity: 50%;\n background-color: white;\n pointer-events: none;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I;AAC3B;AAEA,CAAC;AACC,YAAU;AACV,OAAK;AACL,SAAO;AACP,UAAQ;AACR,eAAa,KAAK,MAAM;AACxB,gBAAc,KAAK,MAAM;AAEzB,cAAY,KAAK,MAAM;AACzB;AAEA,CAAC;AACC,UAAQ;AAER,cAAY,IAAI,IAAI,KAAK;AAC3B;AAEA,CAAC;AACC,YAAU;AACV,eAAa;AACf;AAEA,CAAC;AACC,YAAU;AACV,SAAO;AACP,cAAY;AAEd;AAEA,CAAC;AACC,YAAU;AACV,QAAM;AACN,aAAW;AAIX,cAAY;AACd;AAEA,CAAC;AACC,YAAU;AACV,OAAK;AACL,UAAQ;AACR,YAAU;AACV,WAAS;AAMT,WAAS;AACX;AAEA,CAdC,cAcc;AACb,YAAU;AACV,OAAK;AACL,QAAM;AACR;AAEA,CApBC,cAoBc,MAAM;AACnB,UAAQ;AACR,gBAAc;AAChB;AAEA,CAAC;AACC,WAAS;AACT,UAAQ;AACR,WAAS;AACT,oBAAkB;AAClB,kBAAgB;AAChB,WAAS;AACX;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -703,36 +703,20 @@ var laneTop = (lane, g = DEFAULT_GEOMETRY) => g.laneTopOffset + g.laneHeight * l
|
|
|
703
703
|
var rowMinHeight = (highestLane, g = DEFAULT_GEOMETRY) => g.rowBaseHeight + highestLane * g.laneHeight;
|
|
704
704
|
var staticEventHeight = (highestLane, g = DEFAULT_GEOMETRY) => g.staticEventBaseHeight + highestLane * g.laneHeight;
|
|
705
705
|
var assignLanes = (rowEvents, windowStart, windowEnd) => {
|
|
706
|
-
|
|
707
|
-
const prevEvent = [];
|
|
708
|
-
let highestEventOrder = 0;
|
|
706
|
+
const laneEnd = [];
|
|
709
707
|
const laneOf = /* @__PURE__ */ new Map();
|
|
710
708
|
for (const event of rowEvents) {
|
|
711
709
|
if (!intersectsWindow(event, windowStart, windowEnd)) continue;
|
|
712
|
-
let
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
if (eventOrder > highestEventOrder) {
|
|
719
|
-
highestEventOrder = eventOrder;
|
|
720
|
-
}
|
|
721
|
-
eventOrder = 0;
|
|
722
|
-
assignEventOrder = false;
|
|
723
|
-
break;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
if (assignEventOrder) {
|
|
727
|
-
eventOrder = tempEventOrder;
|
|
710
|
+
let lane = laneEnd.findIndex((end) => end <= event.startTime);
|
|
711
|
+
if (lane === -1) {
|
|
712
|
+
lane = laneEnd.length;
|
|
713
|
+
laneEnd.push(event.endTime);
|
|
714
|
+
} else if (event.endTime > laneEnd[lane]) {
|
|
715
|
+
laneEnd[lane] = event.endTime;
|
|
728
716
|
}
|
|
729
|
-
|
|
730
|
-
laneOf.set(event.id, tempEventOrder);
|
|
717
|
+
laneOf.set(event.id, lane);
|
|
731
718
|
}
|
|
732
|
-
|
|
733
|
-
highestEventOrder = eventOrder;
|
|
734
|
-
}
|
|
735
|
-
return { laneOf, highestLane: highestEventOrder };
|
|
719
|
+
return { laneOf, highestLane: Math.max(0, laneEnd.length - 1) };
|
|
736
720
|
};
|
|
737
721
|
|
|
738
722
|
// src/core/interactions.ts
|
|
@@ -2009,6 +1993,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2009
1993
|
rendererRef,
|
|
2010
1994
|
eventPromptRef,
|
|
2011
1995
|
rowsHeaderClassName,
|
|
1996
|
+
renderRowLabel,
|
|
2012
1997
|
setWindowTime,
|
|
2013
1998
|
setCellWidth,
|
|
2014
1999
|
setTick,
|
|
@@ -2028,6 +2013,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2028
2013
|
const dynamicCanvasRef = (0, import_react6.useRef)(null);
|
|
2029
2014
|
const ghostRef = (0, import_react6.useRef)(null);
|
|
2030
2015
|
const headerWrapperRef = (0, import_react6.useRef)(null);
|
|
2016
|
+
const measureLayerRef = (0, import_react6.useRef)(null);
|
|
2031
2017
|
const totalHeightRef = (0, import_react6.useRef)(0);
|
|
2032
2018
|
const [scrollTop, setScrollTop] = (0, import_react6.useState)(0);
|
|
2033
2019
|
const [viewportHeight, setViewportHeight] = (0, import_react6.useState)(0);
|
|
@@ -2109,6 +2095,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2109
2095
|
() => scene.version
|
|
2110
2096
|
);
|
|
2111
2097
|
(0, import_react6.useLayoutEffect)(() => {
|
|
2098
|
+
if (renderRowLabel) return;
|
|
2112
2099
|
const wrapper = headerWrapperRef.current;
|
|
2113
2100
|
if (!wrapper) return;
|
|
2114
2101
|
const measurer = document.createElement("div");
|
|
@@ -2144,7 +2131,34 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2144
2131
|
observer.disconnect();
|
|
2145
2132
|
wrapper.removeChild(measurer);
|
|
2146
2133
|
};
|
|
2147
|
-
}, [rows, scene, theme.rowPaddingY, rowsHeaderClassName]);
|
|
2134
|
+
}, [rows, scene, theme.rowPaddingY, rowsHeaderClassName, renderRowLabel]);
|
|
2135
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
2136
|
+
if (!renderRowLabel) return;
|
|
2137
|
+
const layer = measureLayerRef.current;
|
|
2138
|
+
const wrapper = headerWrapperRef.current;
|
|
2139
|
+
if (!layer || !wrapper) return;
|
|
2140
|
+
const measure = () => {
|
|
2141
|
+
const real = wrapper.querySelector(".canvas-row-header");
|
|
2142
|
+
const w = (real == null ? void 0 : real.clientWidth) || wrapper.clientWidth || 100;
|
|
2143
|
+
layer.style.width = `${w}px`;
|
|
2144
|
+
const heights = /* @__PURE__ */ new Map();
|
|
2145
|
+
layer.querySelectorAll("[data-measure-row]").forEach((el) => {
|
|
2146
|
+
const id = el.dataset.measureRow;
|
|
2147
|
+
if (id) heights.set(id, Math.ceil(el.getBoundingClientRect().height) + 2 * theme.rowPaddingY);
|
|
2148
|
+
});
|
|
2149
|
+
if (heights.size) scene.setLabelMinHeights(heights);
|
|
2150
|
+
};
|
|
2151
|
+
measure();
|
|
2152
|
+
const ro = new ResizeObserver(measure);
|
|
2153
|
+
ro.observe(layer);
|
|
2154
|
+
layer.querySelectorAll("[data-measure-row]").forEach((el) => ro.observe(el));
|
|
2155
|
+
const wo = new ResizeObserver(measure);
|
|
2156
|
+
wo.observe(wrapper);
|
|
2157
|
+
return () => {
|
|
2158
|
+
ro.disconnect();
|
|
2159
|
+
wo.disconnect();
|
|
2160
|
+
};
|
|
2161
|
+
}, [rows, scene, theme.rowPaddingY, renderRowLabel]);
|
|
2148
2162
|
const {
|
|
2149
2163
|
handlePointerDown,
|
|
2150
2164
|
handlePointerMove,
|
|
@@ -2269,7 +2283,11 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2269
2283
|
},
|
|
2270
2284
|
collapsed ? "\u25B8" : "\u25BE"
|
|
2271
2285
|
),
|
|
2272
|
-
|
|
2286
|
+
renderRowLabel ? (
|
|
2287
|
+
// custom header content (e.g. a control) fills the cell; it sizes to the row's height,
|
|
2288
|
+
// which stays driven by event lanes / the measured label (unchanged below).
|
|
2289
|
+
/* @__PURE__ */ import_react6.default.createElement("div", { className: "row-header-custom" }, renderRowLabel(row))
|
|
2290
|
+
) : /* @__PURE__ */ import_react6.default.createElement(
|
|
2273
2291
|
"span",
|
|
2274
2292
|
{
|
|
2275
2293
|
className: "row-header-label",
|
|
@@ -2288,7 +2306,18 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2288
2306
|
className: headerClassNames,
|
|
2289
2307
|
style: { height: totalHeight }
|
|
2290
2308
|
},
|
|
2291
|
-
visibleHeaders
|
|
2309
|
+
visibleHeaders,
|
|
2310
|
+
renderRowLabel && // off-screen: renders every row's custom header so its natural height can be measured
|
|
2311
|
+
// (see the custom-header measurement effect). Never visible / hit-testable.
|
|
2312
|
+
/* @__PURE__ */ import_react6.default.createElement(
|
|
2313
|
+
"div",
|
|
2314
|
+
{
|
|
2315
|
+
ref: measureLayerRef,
|
|
2316
|
+
"aria-hidden": true,
|
|
2317
|
+
style: { position: "absolute", left: -99999, top: 0, visibility: "hidden", pointerEvents: "none" }
|
|
2318
|
+
},
|
|
2319
|
+
rows.map((row) => /* @__PURE__ */ import_react6.default.createElement("div", { key: row.id, "data-measure-row": row.id, className: "row-header-custom", style: { height: "auto" } }, renderRowLabel(row)))
|
|
2320
|
+
)
|
|
2292
2321
|
), /* @__PURE__ */ import_react6.default.createElement("div", { className: "canvas-content-column", ref: contentRef }, /* @__PURE__ */ import_react6.default.createElement("div", { className: "canvas-sticky" }, /* @__PURE__ */ import_react6.default.createElement("canvas", { ref: staticCanvasRef }), /* @__PURE__ */ import_react6.default.createElement(
|
|
2293
2322
|
"canvas",
|
|
2294
2323
|
{
|
|
@@ -2791,6 +2820,7 @@ var Timeline = (0, import_react7.forwardRef)(
|
|
|
2791
2820
|
theme,
|
|
2792
2821
|
drawEvent,
|
|
2793
2822
|
additionalClassNames,
|
|
2823
|
+
renderRowLabel,
|
|
2794
2824
|
showRTIndicator = true,
|
|
2795
2825
|
eventsResize = true,
|
|
2796
2826
|
stripeOverlap = false,
|
|
@@ -3027,6 +3057,7 @@ var Timeline = (0, import_react7.forwardRef)(
|
|
|
3027
3057
|
rendererRef,
|
|
3028
3058
|
eventPromptRef,
|
|
3029
3059
|
rowsHeaderClassName: additionalClassNames == null ? void 0 : additionalClassNames.rowsHeader,
|
|
3060
|
+
renderRowLabel,
|
|
3030
3061
|
setWindowTime,
|
|
3031
3062
|
setCellWidth,
|
|
3032
3063
|
setTick,
|