awesome-timeline-react 0.4.3 → 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 +40 -0
- package/dist/_tsup-dts-rollup.d.ts +40 -0
- package/dist/index.css +8 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +118 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +118 -9
- 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>>;
|
|
@@ -52,6 +54,7 @@ declare type CanvasBoardProps = {
|
|
|
52
54
|
onEventClick?: (props: OnEventClickProps) => void;
|
|
53
55
|
onEventHover?: (props: OnEventHoverProps) => void;
|
|
54
56
|
eventsResize: boolean;
|
|
57
|
+
stripeOverlap: boolean;
|
|
55
58
|
panZoom?: PanZoomConfig;
|
|
56
59
|
animations: {
|
|
57
60
|
layoutMs: number;
|
|
@@ -629,6 +632,7 @@ export declare type RendererView = {
|
|
|
629
632
|
theme: ResolvedTheme;
|
|
630
633
|
drawEvent?: DrawEventFn;
|
|
631
634
|
eventsResize: boolean;
|
|
635
|
+
stripeOverlap: boolean;
|
|
632
636
|
hoveredEventId: string | null;
|
|
633
637
|
draggedEventId: string | null;
|
|
634
638
|
resizePreview: ResizePreview | null;
|
|
@@ -788,6 +792,10 @@ declare type Theme = {
|
|
|
788
792
|
eventStroke?: string;
|
|
789
793
|
eventTextColor?: string;
|
|
790
794
|
staticEventFill?: string;
|
|
795
|
+
/** color of the 45° stripes drawn over the slice of an event bar that overlaps
|
|
796
|
+
* a static event, when the `stripeOverlap` prop is on (default a translucent
|
|
797
|
+
* slate so it reads over any bar fill). */
|
|
798
|
+
overlapStripeColor?: string;
|
|
791
799
|
gridColor?: string;
|
|
792
800
|
timeBarBorder?: string;
|
|
793
801
|
timeBarTextColor?: string;
|
|
@@ -970,8 +978,20 @@ declare type TimelineProps = {
|
|
|
970
978
|
drawEvent?: DrawEventFn;
|
|
971
979
|
/** only `rowsHeader` still applies — everything else is canvas-drawn (use `theme`) */
|
|
972
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;
|
|
973
987
|
showRTIndicator?: boolean;
|
|
974
988
|
eventsResize?: boolean;
|
|
989
|
+
/** draw 45° diagonal stripes on the slice of an event bar that overlaps a
|
|
990
|
+
* static event (e.g. an off-shift/downtime band) on the same row. This gives
|
|
991
|
+
* a visible cause for a bar that looks "too wide" because it spans
|
|
992
|
+
* non-working time. Stripe color is `theme.overlapStripeColor`. Default
|
|
993
|
+
* false (no striping). */
|
|
994
|
+
stripeOverlap?: boolean;
|
|
975
995
|
showEventPrompt?: boolean;
|
|
976
996
|
eventPromptTemplate?: (event: EventType) => JSX.Element;
|
|
977
997
|
panZoom?: PanZoomConfig;
|
|
@@ -1015,6 +1035,15 @@ export declare class TimelineRenderer {
|
|
|
1015
1035
|
private drawFrame;
|
|
1016
1036
|
}
|
|
1017
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
|
+
|
|
1018
1047
|
/**
|
|
1019
1048
|
* Selection: `selectable` turns on click selection. A plain click selects one
|
|
1020
1049
|
* event (it lifts with a shadow while every other event dims); Cmd/Ctrl+click
|
|
@@ -1040,6 +1069,17 @@ export declare const TimelineShiftBar: () => React_2.JSX.Element;
|
|
|
1040
1069
|
*/
|
|
1041
1070
|
export declare const TimelineStreaming10k: () => React_2.JSX.Element;
|
|
1042
1071
|
|
|
1072
|
+
/**
|
|
1073
|
+
* `stripeOverlap`: where an event bar overlaps a static event (an off-shift /
|
|
1074
|
+
* downtime band) on the same row, its overlapping slice is hatched with 45°
|
|
1075
|
+
* stripes so an over-wide bar has a visible cause (spec §6.4 — "why is my 2h op
|
|
1076
|
+
* 14h wide?"). Toggle it to compare. Row 1's op straddles the band (striped over
|
|
1077
|
+
* the gap only); row 2's op starts at the band's end (no overlap → no stripes),
|
|
1078
|
+
* modelling a "continuous / no-straddle" op that shifted whole. Stripe color is
|
|
1079
|
+
* `theme.overlapStripeColor`.
|
|
1080
|
+
*/
|
|
1081
|
+
export declare const TimelineStripedOverlap: () => React_2.JSX.Element;
|
|
1082
|
+
|
|
1043
1083
|
/**
|
|
1044
1084
|
* Themeable bar geometry: chunky 32px bars with a 6px lane gap, wide row
|
|
1045
1085
|
* padding, and a larger corner radius. Verifies stacking, hit-testing
|
|
@@ -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>>;
|
|
@@ -52,6 +54,7 @@ declare type CanvasBoardProps = {
|
|
|
52
54
|
onEventClick?: (props: OnEventClickProps) => void;
|
|
53
55
|
onEventHover?: (props: OnEventHoverProps) => void;
|
|
54
56
|
eventsResize: boolean;
|
|
57
|
+
stripeOverlap: boolean;
|
|
55
58
|
panZoom?: PanZoomConfig;
|
|
56
59
|
animations: {
|
|
57
60
|
layoutMs: number;
|
|
@@ -629,6 +632,7 @@ export declare type RendererView = {
|
|
|
629
632
|
theme: ResolvedTheme;
|
|
630
633
|
drawEvent?: DrawEventFn;
|
|
631
634
|
eventsResize: boolean;
|
|
635
|
+
stripeOverlap: boolean;
|
|
632
636
|
hoveredEventId: string | null;
|
|
633
637
|
draggedEventId: string | null;
|
|
634
638
|
resizePreview: ResizePreview | null;
|
|
@@ -788,6 +792,10 @@ declare type Theme = {
|
|
|
788
792
|
eventStroke?: string;
|
|
789
793
|
eventTextColor?: string;
|
|
790
794
|
staticEventFill?: string;
|
|
795
|
+
/** color of the 45° stripes drawn over the slice of an event bar that overlaps
|
|
796
|
+
* a static event, when the `stripeOverlap` prop is on (default a translucent
|
|
797
|
+
* slate so it reads over any bar fill). */
|
|
798
|
+
overlapStripeColor?: string;
|
|
791
799
|
gridColor?: string;
|
|
792
800
|
timeBarBorder?: string;
|
|
793
801
|
timeBarTextColor?: string;
|
|
@@ -970,8 +978,20 @@ declare type TimelineProps = {
|
|
|
970
978
|
drawEvent?: DrawEventFn;
|
|
971
979
|
/** only `rowsHeader` still applies — everything else is canvas-drawn (use `theme`) */
|
|
972
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;
|
|
973
987
|
showRTIndicator?: boolean;
|
|
974
988
|
eventsResize?: boolean;
|
|
989
|
+
/** draw 45° diagonal stripes on the slice of an event bar that overlaps a
|
|
990
|
+
* static event (e.g. an off-shift/downtime band) on the same row. This gives
|
|
991
|
+
* a visible cause for a bar that looks "too wide" because it spans
|
|
992
|
+
* non-working time. Stripe color is `theme.overlapStripeColor`. Default
|
|
993
|
+
* false (no striping). */
|
|
994
|
+
stripeOverlap?: boolean;
|
|
975
995
|
showEventPrompt?: boolean;
|
|
976
996
|
eventPromptTemplate?: (event: EventType) => JSX.Element;
|
|
977
997
|
panZoom?: PanZoomConfig;
|
|
@@ -1015,6 +1035,15 @@ export declare class TimelineRenderer {
|
|
|
1015
1035
|
private drawFrame;
|
|
1016
1036
|
}
|
|
1017
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
|
+
|
|
1018
1047
|
/**
|
|
1019
1048
|
* Selection: `selectable` turns on click selection. A plain click selects one
|
|
1020
1049
|
* event (it lifts with a shadow while every other event dims); Cmd/Ctrl+click
|
|
@@ -1040,6 +1069,17 @@ export declare const TimelineShiftBar: () => React_2.JSX.Element;
|
|
|
1040
1069
|
*/
|
|
1041
1070
|
export declare const TimelineStreaming10k: () => React_2.JSX.Element;
|
|
1042
1071
|
|
|
1072
|
+
/**
|
|
1073
|
+
* `stripeOverlap`: where an event bar overlaps a static event (an off-shift /
|
|
1074
|
+
* downtime band) on the same row, its overlapping slice is hatched with 45°
|
|
1075
|
+
* stripes so an over-wide bar has a visible cause (spec §6.4 — "why is my 2h op
|
|
1076
|
+
* 14h wide?"). Toggle it to compare. Row 1's op straddles the band (striped over
|
|
1077
|
+
* the gap only); row 2's op starts at the band's end (no overlap → no stripes),
|
|
1078
|
+
* modelling a "continuous / no-straddle" op that shifted whole. Stripe color is
|
|
1079
|
+
* `theme.overlapStripeColor`.
|
|
1080
|
+
*/
|
|
1081
|
+
export declare const TimelineStripedOverlap: () => React_2.JSX.Element;
|
|
1082
|
+
|
|
1043
1083
|
/**
|
|
1044
1084
|
* Themeable bar geometry: chunky 32px bars with a 6px lane gap, wide row
|
|
1045
1085
|
* padding, and a larger corner radius. Verifies stacking, hit-testing
|
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;AA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;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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C,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
|
@@ -454,6 +454,7 @@ var DEFAULT_THEME = {
|
|
|
454
454
|
eventStroke: "#000000",
|
|
455
455
|
eventTextColor: "#000000",
|
|
456
456
|
staticEventFill: "#e0e0e0",
|
|
457
|
+
overlapStripeColor: "rgba(15,23,42,0.6)",
|
|
457
458
|
gridColor: "#e4dcdc",
|
|
458
459
|
timeBarBorder: "yellow",
|
|
459
460
|
timeBarTextColor: "white",
|
|
@@ -956,6 +957,43 @@ var defaultDrawEvent = (ctx, event, rect, view, font, barRadius) => {
|
|
|
956
957
|
ctx.restore();
|
|
957
958
|
}
|
|
958
959
|
};
|
|
960
|
+
var STRIPE_STEP = 6;
|
|
961
|
+
var STRIPE_WIDTH = 2;
|
|
962
|
+
var STRIPE_WASH_ALPHA = 0.18;
|
|
963
|
+
var paintOverlapStripes = (ctx, event, rect, rowStatics, windowStart, tick, color) => {
|
|
964
|
+
const barRight = rect.x + rect.width;
|
|
965
|
+
for (const band of rowStatics) {
|
|
966
|
+
const overlapStart = Math.max(event.startTime, band.startTime);
|
|
967
|
+
const overlapEnd = Math.min(event.endTime, band.endTime);
|
|
968
|
+
if (overlapEnd <= overlapStart) continue;
|
|
969
|
+
const x0 = Math.max(timeToX(overlapStart, windowStart, tick), rect.x);
|
|
970
|
+
const x1 = Math.min(
|
|
971
|
+
timeToX(overlapStart, windowStart, tick) + timeToWidth(overlapStart, overlapEnd, tick),
|
|
972
|
+
barRight
|
|
973
|
+
);
|
|
974
|
+
const width = x1 - x0;
|
|
975
|
+
if (width <= 0) continue;
|
|
976
|
+
const { y, height } = rect;
|
|
977
|
+
ctx.save();
|
|
978
|
+
ctx.beginPath();
|
|
979
|
+
ctx.rect(x0, y, width, height);
|
|
980
|
+
ctx.clip();
|
|
981
|
+
const baseAlpha = ctx.globalAlpha;
|
|
982
|
+
ctx.globalAlpha = baseAlpha * STRIPE_WASH_ALPHA;
|
|
983
|
+
ctx.fillStyle = color;
|
|
984
|
+
ctx.fillRect(x0, y, width, height);
|
|
985
|
+
ctx.globalAlpha = baseAlpha;
|
|
986
|
+
ctx.strokeStyle = color;
|
|
987
|
+
ctx.lineWidth = STRIPE_WIDTH;
|
|
988
|
+
for (let sx = x0 - height; sx < x1; sx += STRIPE_STEP) {
|
|
989
|
+
ctx.beginPath();
|
|
990
|
+
ctx.moveTo(sx, y + height);
|
|
991
|
+
ctx.lineTo(sx + height, y);
|
|
992
|
+
ctx.stroke();
|
|
993
|
+
}
|
|
994
|
+
ctx.restore();
|
|
995
|
+
}
|
|
996
|
+
};
|
|
959
997
|
var drawEvents = (ctx, view, scene, font, animator) => {
|
|
960
998
|
var _a;
|
|
961
999
|
if (view.tick === null) return;
|
|
@@ -968,7 +1006,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
968
1006
|
const selectedIds = view.selectedEventIds;
|
|
969
1007
|
const hasSelection = selectedIds.size > 0;
|
|
970
1008
|
const deferred = [];
|
|
971
|
-
const paintEvent = (event, rect, state, opts) => {
|
|
1009
|
+
const paintEvent = (event, rect, state, opts, rowStatics) => {
|
|
972
1010
|
var _a2, _b, _c, _d, _e;
|
|
973
1011
|
ctx.save();
|
|
974
1012
|
ctx.globalAlpha = 1;
|
|
@@ -985,6 +1023,17 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
985
1023
|
if (!drawn) {
|
|
986
1024
|
defaultDrawEvent(ctx, event, rect, view, font, geometry.barRadius);
|
|
987
1025
|
}
|
|
1026
|
+
if (view.stripeOverlap && rowStatics.length > 0) {
|
|
1027
|
+
paintOverlapStripes(
|
|
1028
|
+
ctx,
|
|
1029
|
+
event,
|
|
1030
|
+
rect,
|
|
1031
|
+
rowStatics,
|
|
1032
|
+
windowStart,
|
|
1033
|
+
tick,
|
|
1034
|
+
view.theme.overlapStripeColor
|
|
1035
|
+
);
|
|
1036
|
+
}
|
|
988
1037
|
if (canResizeEvent(event, view.eventsResize)) {
|
|
989
1038
|
const alpha = animator.handleAlpha(
|
|
990
1039
|
event.id,
|
|
@@ -1010,11 +1059,12 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
1010
1059
|
if (rowY + rowHeight < 0) continue;
|
|
1011
1060
|
if (rowY > view.height) break;
|
|
1012
1061
|
const lanes = scene.getLanes(rowId, windowStart, windowEnd);
|
|
1013
|
-
|
|
1062
|
+
const rowStatics = cullToWindow(
|
|
1014
1063
|
scene.getRowStaticEvents(rowId),
|
|
1015
1064
|
windowStart,
|
|
1016
1065
|
windowEnd
|
|
1017
|
-
)
|
|
1066
|
+
);
|
|
1067
|
+
for (const event of rowStatics) {
|
|
1018
1068
|
const x = timeToX(event.startTime, windowStart, tick);
|
|
1019
1069
|
const width = timeToWidth(event.startTime, event.endTime, tick);
|
|
1020
1070
|
ctx.fillStyle = view.theme.staticEventFill;
|
|
@@ -1059,10 +1109,16 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
1059
1109
|
};
|
|
1060
1110
|
if (selected) {
|
|
1061
1111
|
deferred.push(
|
|
1062
|
-
() => paintEvent(event, rect, state, { dim: false, elevate: true })
|
|
1112
|
+
() => paintEvent(event, rect, state, { dim: false, elevate: true }, rowStatics)
|
|
1063
1113
|
);
|
|
1064
1114
|
} else {
|
|
1065
|
-
paintEvent(
|
|
1115
|
+
paintEvent(
|
|
1116
|
+
event,
|
|
1117
|
+
rect,
|
|
1118
|
+
state,
|
|
1119
|
+
{ dim: hasSelection, elevate: false },
|
|
1120
|
+
rowStatics
|
|
1121
|
+
);
|
|
1066
1122
|
}
|
|
1067
1123
|
}
|
|
1068
1124
|
}
|
|
@@ -1085,6 +1141,7 @@ var TimelineRenderer = class {
|
|
|
1085
1141
|
theme: DEFAULT_THEME,
|
|
1086
1142
|
drawEvent: void 0,
|
|
1087
1143
|
eventsResize: true,
|
|
1144
|
+
stripeOverlap: false,
|
|
1088
1145
|
hoveredEventId: null,
|
|
1089
1146
|
draggedEventId: null,
|
|
1090
1147
|
resizePreview: null,
|
|
@@ -1952,6 +2009,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
1952
2009
|
rendererRef,
|
|
1953
2010
|
eventPromptRef,
|
|
1954
2011
|
rowsHeaderClassName,
|
|
2012
|
+
renderRowLabel,
|
|
1955
2013
|
setWindowTime,
|
|
1956
2014
|
setCellWidth,
|
|
1957
2015
|
setTick,
|
|
@@ -1960,6 +2018,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
1960
2018
|
onEventClick,
|
|
1961
2019
|
onEventHover,
|
|
1962
2020
|
eventsResize,
|
|
2021
|
+
stripeOverlap,
|
|
1963
2022
|
panZoom,
|
|
1964
2023
|
animations,
|
|
1965
2024
|
selectable,
|
|
@@ -1970,6 +2029,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
1970
2029
|
const dynamicCanvasRef = (0, import_react6.useRef)(null);
|
|
1971
2030
|
const ghostRef = (0, import_react6.useRef)(null);
|
|
1972
2031
|
const headerWrapperRef = (0, import_react6.useRef)(null);
|
|
2032
|
+
const measureLayerRef = (0, import_react6.useRef)(null);
|
|
1973
2033
|
const totalHeightRef = (0, import_react6.useRef)(0);
|
|
1974
2034
|
const [scrollTop, setScrollTop] = (0, import_react6.useState)(0);
|
|
1975
2035
|
const [viewportHeight, setViewportHeight] = (0, import_react6.useState)(0);
|
|
@@ -1998,7 +2058,8 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
1998
2058
|
cellWidth,
|
|
1999
2059
|
theme,
|
|
2000
2060
|
drawEvent,
|
|
2001
|
-
eventsResize
|
|
2061
|
+
eventsResize,
|
|
2062
|
+
stripeOverlap
|
|
2002
2063
|
});
|
|
2003
2064
|
}, [
|
|
2004
2065
|
windowTime,
|
|
@@ -2007,6 +2068,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2007
2068
|
theme,
|
|
2008
2069
|
drawEvent,
|
|
2009
2070
|
eventsResize,
|
|
2071
|
+
stripeOverlap,
|
|
2010
2072
|
animations,
|
|
2011
2073
|
rendererRef
|
|
2012
2074
|
]);
|
|
@@ -2049,6 +2111,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2049
2111
|
() => scene.version
|
|
2050
2112
|
);
|
|
2051
2113
|
(0, import_react6.useLayoutEffect)(() => {
|
|
2114
|
+
if (renderRowLabel) return;
|
|
2052
2115
|
const wrapper = headerWrapperRef.current;
|
|
2053
2116
|
if (!wrapper) return;
|
|
2054
2117
|
const measurer = document.createElement("div");
|
|
@@ -2084,7 +2147,34 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2084
2147
|
observer.disconnect();
|
|
2085
2148
|
wrapper.removeChild(measurer);
|
|
2086
2149
|
};
|
|
2087
|
-
}, [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]);
|
|
2088
2178
|
const {
|
|
2089
2179
|
handlePointerDown,
|
|
2090
2180
|
handlePointerMove,
|
|
@@ -2209,7 +2299,11 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2209
2299
|
},
|
|
2210
2300
|
collapsed ? "\u25B8" : "\u25BE"
|
|
2211
2301
|
),
|
|
2212
|
-
|
|
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(
|
|
2213
2307
|
"span",
|
|
2214
2308
|
{
|
|
2215
2309
|
className: "row-header-label",
|
|
@@ -2228,7 +2322,18 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2228
2322
|
className: headerClassNames,
|
|
2229
2323
|
style: { height: totalHeight }
|
|
2230
2324
|
},
|
|
2231
|
-
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
|
+
)
|
|
2232
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(
|
|
2233
2338
|
"canvas",
|
|
2234
2339
|
{
|
|
@@ -2731,8 +2836,10 @@ var Timeline = (0, import_react7.forwardRef)(
|
|
|
2731
2836
|
theme,
|
|
2732
2837
|
drawEvent,
|
|
2733
2838
|
additionalClassNames,
|
|
2839
|
+
renderRowLabel,
|
|
2734
2840
|
showRTIndicator = true,
|
|
2735
2841
|
eventsResize = true,
|
|
2842
|
+
stripeOverlap = false,
|
|
2736
2843
|
eventPromptTemplate,
|
|
2737
2844
|
showEventPrompt = true,
|
|
2738
2845
|
panZoom,
|
|
@@ -2966,6 +3073,7 @@ var Timeline = (0, import_react7.forwardRef)(
|
|
|
2966
3073
|
rendererRef,
|
|
2967
3074
|
eventPromptRef,
|
|
2968
3075
|
rowsHeaderClassName: additionalClassNames == null ? void 0 : additionalClassNames.rowsHeader,
|
|
3076
|
+
renderRowLabel,
|
|
2969
3077
|
setWindowTime,
|
|
2970
3078
|
setCellWidth,
|
|
2971
3079
|
setTick,
|
|
@@ -2974,6 +3082,7 @@ var Timeline = (0, import_react7.forwardRef)(
|
|
|
2974
3082
|
onEventClick,
|
|
2975
3083
|
onEventHover,
|
|
2976
3084
|
eventsResize,
|
|
3085
|
+
stripeOverlap,
|
|
2977
3086
|
panZoom,
|
|
2978
3087
|
animations: resolvedAnimations,
|
|
2979
3088
|
selectable,
|