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
|
@@ -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;
|
|
@@ -44,6 +45,7 @@ declare type CanvasBoardProps = {
|
|
|
44
45
|
rendererRef: React_2.MutableRefObject<TimelineRenderer | null>;
|
|
45
46
|
eventPromptRef: React_2.MutableRefObject<EventPromptActionsType | null>;
|
|
46
47
|
rowsHeaderClassName?: string;
|
|
48
|
+
renderRowLabel?: (row: RowType) => React_2.ReactNode;
|
|
47
49
|
setWindowTime: React_2.Dispatch<React_2.SetStateAction<number[]>>;
|
|
48
50
|
setCellWidth: React_2.Dispatch<React_2.SetStateAction<number>>;
|
|
49
51
|
setTick: React_2.Dispatch<React_2.SetStateAction<number | null>>;
|
|
@@ -976,6 +978,12 @@ declare type TimelineProps = {
|
|
|
976
978
|
drawEvent?: DrawEventFn;
|
|
977
979
|
/** only `rowsHeader` still applies — everything else is canvas-drawn (use `theme`) */
|
|
978
980
|
additionalClassNames?: PartialRecord<keyof ModifableElements, string>;
|
|
981
|
+
/** Custom content for a row's header cell (the left label column), replacing the default
|
|
982
|
+
* `{row.name}` text. Rendered as real DOM inside the existing fixed-width header — the column width
|
|
983
|
+
* is NOT changed (it feeds the canvas time-scale), so keep content within it; long text should wrap
|
|
984
|
+
* or stack. The row's height stays driven by its event lanes / measured label, so custom content
|
|
985
|
+
* should size to the height it's given (it varies per row). Absent → the default label. */
|
|
986
|
+
renderRowLabel?: (row: RowType) => ReactNode;
|
|
979
987
|
showRTIndicator?: boolean;
|
|
980
988
|
eventsResize?: boolean;
|
|
981
989
|
/** draw 45° diagonal stripes on the slice of an event bar that overlaps a
|
|
@@ -1027,6 +1035,15 @@ export declare class TimelineRenderer {
|
|
|
1027
1035
|
private drawFrame;
|
|
1028
1036
|
}
|
|
1029
1037
|
|
|
1038
|
+
/**
|
|
1039
|
+
* `renderRowLabel` slot: custom React in the row-header cell instead of the plain name. Here each
|
|
1040
|
+
* header shows a small circular value control ("dial") stacked over the row name — proving custom
|
|
1041
|
+
* content fits the fixed-width (100px) header, stacks when narrow, and vertically centers within each
|
|
1042
|
+
* row's DYNAMIC height (rows here have different numbers of stacked events, so heights vary). The
|
|
1043
|
+
* header width is NOT changed (it feeds the canvas time-scale); the dial sizes to the space it's given.
|
|
1044
|
+
*/
|
|
1045
|
+
export declare const TimelineRowHeaderSlot: () => React_2.JSX.Element;
|
|
1046
|
+
|
|
1030
1047
|
/**
|
|
1031
1048
|
* Selection: `selectable` turns on click selection. A plain click selects one
|
|
1032
1049
|
* 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;
|
|
@@ -44,6 +45,7 @@ declare type CanvasBoardProps = {
|
|
|
44
45
|
rendererRef: React_2.MutableRefObject<TimelineRenderer | null>;
|
|
45
46
|
eventPromptRef: React_2.MutableRefObject<EventPromptActionsType | null>;
|
|
46
47
|
rowsHeaderClassName?: string;
|
|
48
|
+
renderRowLabel?: (row: RowType) => React_2.ReactNode;
|
|
47
49
|
setWindowTime: React_2.Dispatch<React_2.SetStateAction<number[]>>;
|
|
48
50
|
setCellWidth: React_2.Dispatch<React_2.SetStateAction<number>>;
|
|
49
51
|
setTick: React_2.Dispatch<React_2.SetStateAction<number | null>>;
|
|
@@ -976,6 +978,12 @@ declare type TimelineProps = {
|
|
|
976
978
|
drawEvent?: DrawEventFn;
|
|
977
979
|
/** only `rowsHeader` still applies — everything else is canvas-drawn (use `theme`) */
|
|
978
980
|
additionalClassNames?: PartialRecord<keyof ModifableElements, string>;
|
|
981
|
+
/** Custom content for a row's header cell (the left label column), replacing the default
|
|
982
|
+
* `{row.name}` text. Rendered as real DOM inside the existing fixed-width header — the column width
|
|
983
|
+
* is NOT changed (it feeds the canvas time-scale), so keep content within it; long text should wrap
|
|
984
|
+
* or stack. The row's height stays driven by its event lanes / measured label, so custom content
|
|
985
|
+
* should size to the height it's given (it varies per row). Absent → the default label. */
|
|
986
|
+
renderRowLabel?: (row: RowType) => ReactNode;
|
|
979
987
|
showRTIndicator?: boolean;
|
|
980
988
|
eventsResize?: boolean;
|
|
981
989
|
/** draw 45° diagonal stripes on the slice of an event bar that overlaps a
|
|
@@ -1027,6 +1035,15 @@ export declare class TimelineRenderer {
|
|
|
1027
1035
|
private drawFrame;
|
|
1028
1036
|
}
|
|
1029
1037
|
|
|
1038
|
+
/**
|
|
1039
|
+
* `renderRowLabel` slot: custom React in the row-header cell instead of the plain name. Here each
|
|
1040
|
+
* header shows a small circular value control ("dial") stacked over the row name — proving custom
|
|
1041
|
+
* content fits the fixed-width (100px) header, stacks when narrow, and vertically centers within each
|
|
1042
|
+
* row's DYNAMIC height (rows here have different numbers of stacked events, so heights vary). The
|
|
1043
|
+
* header width is NOT changed (it feeds the canvas time-scale); the dial sizes to the space it's given.
|
|
1044
|
+
*/
|
|
1045
|
+
export declare const TimelineRowHeaderSlot: () => React_2.JSX.Element;
|
|
1046
|
+
|
|
1030
1047
|
/**
|
|
1031
1048
|
* Selection: `selectable` turns on click selection. A plain click selects one
|
|
1032
1049
|
* 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;AACV,WAAS;AACT,kBAAgB;AAChB,UAAQ;AACR,SAAO;AACT;AAEA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,eAAa,IAAI,MAAM;AACvB,iBAAe,IAAI,MAAM;AACzB,gBAAc,IAAI,MAAM;AACxB,SAAO;AACP,YAAU;AACV,cAAY;AACd;;;AC3BA,CAAC;AACC,WAAS;AACT,mBAAiB;AACjB,eAAa;AACb,SAAO;AACP,cAAY;AACZ,YAAU;AACZ;AAKA,CAAC;AACC,SAAO;AACP,cAAY;AACZ,eAAa;AACb,iBAAe;AACf,cAAY;AACd;AAGA,CAAC;AACC,YAAU;AACV,UAAQ;AACR,UAAQ,IAAI,MAAM;AAClB,WAAS;AACT,cAAY;AACZ,WAAS;AACT,mBAAiB;AACjB,iBAAe;AACf,cAAY,MAAM,IAAI,IAAI,IAAI;AAChC;AAEA,CAAC;AACC,YAAU;AACV,WAAS;AACT,WAAS;AACX;AAEA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,SAAO;AACP,UAAQ;AACR,cAAY;AACZ,UAAQ,IAAI,MAAM;AAClB,oBAAkB,IAAI,EAAE,EAAE,EAAE,EAAE;AAC9B,SAAO;AACP,cAAY;AACd;AAEA,CAAC;AACC,SAAO;AACP,aAAW;AACX,gBAAc,IAAI,MAAM;AACxB,cAAY;AACd;AAEA,CAAC;AACC,YAAU;AACV,UAAQ,KAAK,KAAK,EAAE;AACpB,OAAK;AACL,SAAO;AACP,cAAY;AACZ,gBAAc,OAAO,IAAI;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":[]}
|
|
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;\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;AACV,WAAS;AACT,kBAAgB;AAChB,UAAQ;AACR,SAAO;AACT;AAEA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,eAAa,IAAI,MAAM;AACvB,iBAAe,IAAI,MAAM;AACzB,gBAAc,IAAI,MAAM;AACxB,SAAO;AACP,YAAU;AACV,cAAY;AACd;;;AC3BA,CAAC;AACC,WAAS;AACT,mBAAiB;AACjB,eAAa;AACb,SAAO;AACP,cAAY;AACZ,YAAU;AACZ;AAKA,CAAC;AACC,SAAO;AACP,cAAY;AACZ,eAAa;AACb,iBAAe;AACf,cAAY;AACd;AAIA,CAAC;AACC,SAAO;AACP,UAAQ;AACR,WAAS;AACT,eAAa;AACb,mBAAiB;AACjB,aAAW;AACb;AAGA,CAAC;AACC,YAAU;AACV,UAAQ;AACR,UAAQ,IAAI,MAAM;AAClB,WAAS;AACT,cAAY;AACZ,WAAS;AACT,mBAAiB;AACjB,iBAAe;AACf,cAAY,MAAM,IAAI,IAAI,IAAI;AAChC;AAEA,CAAC;AACC,YAAU;AACV,WAAS;AACT,WAAS;AACX;AAEA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,SAAO;AACP,UAAQ;AACR,cAAY;AACZ,UAAQ,IAAI,MAAM;AAClB,oBAAkB,IAAI,EAAE,EAAE,EAAE,EAAE;AAC9B,SAAO;AACP,cAAY;AACd;AAEA,CAAC;AACC,SAAO;AACP,aAAW;AACX,gBAAc,IAAI,MAAM;AACxB,cAAY;AACd;AAEA,CAAC;AACC,YAAU;AACV,UAAQ,KAAK,KAAK,EAAE;AACpB,OAAK;AACL,SAAO;AACP,cAAY;AACZ,gBAAc,OAAO,IAAI;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
|
@@ -2009,6 +2009,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2009
2009
|
rendererRef,
|
|
2010
2010
|
eventPromptRef,
|
|
2011
2011
|
rowsHeaderClassName,
|
|
2012
|
+
renderRowLabel,
|
|
2012
2013
|
setWindowTime,
|
|
2013
2014
|
setCellWidth,
|
|
2014
2015
|
setTick,
|
|
@@ -2028,6 +2029,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2028
2029
|
const dynamicCanvasRef = (0, import_react6.useRef)(null);
|
|
2029
2030
|
const ghostRef = (0, import_react6.useRef)(null);
|
|
2030
2031
|
const headerWrapperRef = (0, import_react6.useRef)(null);
|
|
2032
|
+
const measureLayerRef = (0, import_react6.useRef)(null);
|
|
2031
2033
|
const totalHeightRef = (0, import_react6.useRef)(0);
|
|
2032
2034
|
const [scrollTop, setScrollTop] = (0, import_react6.useState)(0);
|
|
2033
2035
|
const [viewportHeight, setViewportHeight] = (0, import_react6.useState)(0);
|
|
@@ -2109,6 +2111,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2109
2111
|
() => scene.version
|
|
2110
2112
|
);
|
|
2111
2113
|
(0, import_react6.useLayoutEffect)(() => {
|
|
2114
|
+
if (renderRowLabel) return;
|
|
2112
2115
|
const wrapper = headerWrapperRef.current;
|
|
2113
2116
|
if (!wrapper) return;
|
|
2114
2117
|
const measurer = document.createElement("div");
|
|
@@ -2144,7 +2147,34 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2144
2147
|
observer.disconnect();
|
|
2145
2148
|
wrapper.removeChild(measurer);
|
|
2146
2149
|
};
|
|
2147
|
-
}, [rows, scene, theme.rowPaddingY, rowsHeaderClassName]);
|
|
2150
|
+
}, [rows, scene, theme.rowPaddingY, rowsHeaderClassName, renderRowLabel]);
|
|
2151
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
2152
|
+
if (!renderRowLabel) return;
|
|
2153
|
+
const layer = measureLayerRef.current;
|
|
2154
|
+
const wrapper = headerWrapperRef.current;
|
|
2155
|
+
if (!layer || !wrapper) return;
|
|
2156
|
+
const measure = () => {
|
|
2157
|
+
const real = wrapper.querySelector(".canvas-row-header");
|
|
2158
|
+
const w = (real == null ? void 0 : real.clientWidth) || wrapper.clientWidth || 100;
|
|
2159
|
+
layer.style.width = `${w}px`;
|
|
2160
|
+
const heights = /* @__PURE__ */ new Map();
|
|
2161
|
+
layer.querySelectorAll("[data-measure-row]").forEach((el) => {
|
|
2162
|
+
const id = el.dataset.measureRow;
|
|
2163
|
+
if (id) heights.set(id, Math.ceil(el.getBoundingClientRect().height) + 2 * theme.rowPaddingY);
|
|
2164
|
+
});
|
|
2165
|
+
if (heights.size) scene.setLabelMinHeights(heights);
|
|
2166
|
+
};
|
|
2167
|
+
measure();
|
|
2168
|
+
const ro = new ResizeObserver(measure);
|
|
2169
|
+
ro.observe(layer);
|
|
2170
|
+
layer.querySelectorAll("[data-measure-row]").forEach((el) => ro.observe(el));
|
|
2171
|
+
const wo = new ResizeObserver(measure);
|
|
2172
|
+
wo.observe(wrapper);
|
|
2173
|
+
return () => {
|
|
2174
|
+
ro.disconnect();
|
|
2175
|
+
wo.disconnect();
|
|
2176
|
+
};
|
|
2177
|
+
}, [rows, scene, theme.rowPaddingY, renderRowLabel]);
|
|
2148
2178
|
const {
|
|
2149
2179
|
handlePointerDown,
|
|
2150
2180
|
handlePointerMove,
|
|
@@ -2269,7 +2299,11 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2269
2299
|
},
|
|
2270
2300
|
collapsed ? "\u25B8" : "\u25BE"
|
|
2271
2301
|
),
|
|
2272
|
-
|
|
2302
|
+
renderRowLabel ? (
|
|
2303
|
+
// custom header content (e.g. a control) fills the cell; it sizes to the row's height,
|
|
2304
|
+
// which stays driven by event lanes / the measured label (unchanged below).
|
|
2305
|
+
/* @__PURE__ */ import_react6.default.createElement("div", { className: "row-header-custom" }, renderRowLabel(row))
|
|
2306
|
+
) : /* @__PURE__ */ import_react6.default.createElement(
|
|
2273
2307
|
"span",
|
|
2274
2308
|
{
|
|
2275
2309
|
className: "row-header-label",
|
|
@@ -2288,7 +2322,18 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2288
2322
|
className: headerClassNames,
|
|
2289
2323
|
style: { height: totalHeight }
|
|
2290
2324
|
},
|
|
2291
|
-
visibleHeaders
|
|
2325
|
+
visibleHeaders,
|
|
2326
|
+
renderRowLabel && // off-screen: renders every row's custom header so its natural height can be measured
|
|
2327
|
+
// (see the custom-header measurement effect). Never visible / hit-testable.
|
|
2328
|
+
/* @__PURE__ */ import_react6.default.createElement(
|
|
2329
|
+
"div",
|
|
2330
|
+
{
|
|
2331
|
+
ref: measureLayerRef,
|
|
2332
|
+
"aria-hidden": true,
|
|
2333
|
+
style: { position: "absolute", left: -99999, top: 0, visibility: "hidden", pointerEvents: "none" }
|
|
2334
|
+
},
|
|
2335
|
+
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)))
|
|
2336
|
+
)
|
|
2292
2337
|
), /* @__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
2338
|
"canvas",
|
|
2294
2339
|
{
|
|
@@ -2791,6 +2836,7 @@ var Timeline = (0, import_react7.forwardRef)(
|
|
|
2791
2836
|
theme,
|
|
2792
2837
|
drawEvent,
|
|
2793
2838
|
additionalClassNames,
|
|
2839
|
+
renderRowLabel,
|
|
2794
2840
|
showRTIndicator = true,
|
|
2795
2841
|
eventsResize = true,
|
|
2796
2842
|
stripeOverlap = false,
|
|
@@ -3027,6 +3073,7 @@ var Timeline = (0, import_react7.forwardRef)(
|
|
|
3027
3073
|
rendererRef,
|
|
3028
3074
|
eventPromptRef,
|
|
3029
3075
|
rowsHeaderClassName: additionalClassNames == null ? void 0 : additionalClassNames.rowsHeader,
|
|
3076
|
+
renderRowLabel,
|
|
3030
3077
|
setWindowTime,
|
|
3031
3078
|
setCellWidth,
|
|
3032
3079
|
setTick,
|