awesome-timeline-react 0.3.0 → 0.4.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/README.md +131 -1
- package/dist/_tsup-dts-rollup.d.mts +230 -10
- package/dist/_tsup-dts-rollup.d.ts +230 -10
- package/dist/index.css +9 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +705 -93
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +707 -93
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -27,7 +27,9 @@ export declare type AnimationConfig = boolean | {
|
|
|
27
27
|
*/
|
|
28
28
|
export declare const assignLanes: (rowEvents: EventType[], windowStart: number, windowEnd: number) => LaneResult;
|
|
29
29
|
|
|
30
|
-
/** Eligibility: same expression as the legacy Event component's render guard.
|
|
30
|
+
/** Eligibility: same expression as the legacy Event component's render guard.
|
|
31
|
+
* A group-parent (summary) event is never resizable — its span is derived from
|
|
32
|
+
* its children. */
|
|
31
33
|
export declare const canResizeEvent: (event: EventType, eventsResize: boolean) => boolean;
|
|
32
34
|
|
|
33
35
|
declare type CanvasBoardProps = {
|
|
@@ -55,6 +57,9 @@ declare type CanvasBoardProps = {
|
|
|
55
57
|
layoutMs: number;
|
|
56
58
|
fadeMs: number;
|
|
57
59
|
};
|
|
60
|
+
selectable: boolean;
|
|
61
|
+
applySelection: (eventIds: string[]) => void;
|
|
62
|
+
getSelection: () => string[];
|
|
58
63
|
};
|
|
59
64
|
|
|
60
65
|
/**
|
|
@@ -162,7 +167,7 @@ export declare const default_alias_7: (eventA: EventType, eventB: EventType) =>
|
|
|
162
167
|
* change grid granularity (middle-click mode or ctrl+wheel). Event mutations
|
|
163
168
|
* are applied straight to the SceneStore — no React state on the hot path.
|
|
164
169
|
*/
|
|
165
|
-
export declare const default_alias_8: ({ scene, rendererRef, dynamicCanvasRef, bodyRef, ghostRef, eventPromptRef, setWindowTime, setCellWidth, setTick, onDrop, onResize, onEventClick, onEventHover, eventsResize, panZoom, }: UseCanvasInteractionsArgs) => {
|
|
170
|
+
export declare const default_alias_8: ({ scene, rendererRef, dynamicCanvasRef, bodyRef, ghostRef, eventPromptRef, setWindowTime, setCellWidth, setTick, onDrop, onResize, onEventClick, onEventHover, eventsResize, panZoom, selectable, applySelection, getSelection, }: UseCanvasInteractionsArgs) => {
|
|
166
171
|
handlePointerDown: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
|
|
167
172
|
handlePointerMove: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
|
|
168
173
|
handlePointerUp: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
|
|
@@ -219,8 +224,16 @@ export declare const drawGridLines: (ctx: CanvasRenderingContext2D, { width, hei
|
|
|
219
224
|
color?: string;
|
|
220
225
|
}) => void;
|
|
221
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Recessed-group depth cue. For each expanded group, the contiguous block of
|
|
229
|
+
* its visible child rows is filled with a faint tint and given an inset shadow
|
|
230
|
+
* along its top (and left) edge, so the child rows read as sitting *beneath*
|
|
231
|
+
* their parent row. Drawn on the static layer beneath the grid lines/dividers.
|
|
232
|
+
*/
|
|
233
|
+
export declare const drawGroupShading: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore) => void;
|
|
234
|
+
|
|
222
235
|
/** Horizontal row dividers — replaces .row-content border-bottom. */
|
|
223
|
-
export declare const drawRowDividers: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore
|
|
236
|
+
export declare const drawRowDividers: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore) => void;
|
|
224
237
|
|
|
225
238
|
/**
|
|
226
239
|
* Two-row time bar (top row over bottom row) — canvas replacement for the
|
|
@@ -238,6 +251,20 @@ export declare const drawTimeBar: (ctx: CanvasRenderingContext2D, { width, heigh
|
|
|
238
251
|
bottomBlocks: TimeBlock[];
|
|
239
252
|
}) => void;
|
|
240
253
|
|
|
254
|
+
/**
|
|
255
|
+
* Written by the library into `props.metadata.droppableError` when an event's
|
|
256
|
+
* current `rowId` is absent from its `droppableRowIds`. Read it off events your
|
|
257
|
+
* app holds (or via the handle's `getEvent`) to flag the misconfiguration.
|
|
258
|
+
*/
|
|
259
|
+
declare type DroppableError = {
|
|
260
|
+
/** the event's current rowId, which is not among its droppableRowIds */
|
|
261
|
+
rowId: string;
|
|
262
|
+
/** the rows the event declared it may live on */
|
|
263
|
+
droppableRowIds: string[];
|
|
264
|
+
};
|
|
265
|
+
export { DroppableError }
|
|
266
|
+
export { DroppableError as DroppableError_alias_1 }
|
|
267
|
+
|
|
241
268
|
/** Imperative event mutation, applied without React re-renders. */
|
|
242
269
|
declare type EventPatch = {
|
|
243
270
|
op: "upsert";
|
|
@@ -274,7 +301,39 @@ declare type EventPropsType = {
|
|
|
274
301
|
style?: EventStyle;
|
|
275
302
|
/** per-event custom renderer; overrides the Timeline-level drawEvent */
|
|
276
303
|
drawEvent?: DrawEventFn;
|
|
277
|
-
/**
|
|
304
|
+
/** connects this event to others sharing the same tag. Cmd/Ctrl+click on any
|
|
305
|
+
* member selects the whole connected group (requires `selectable`). */
|
|
306
|
+
groupId?: string;
|
|
307
|
+
/** opt this event out of selection while the Timeline is `selectable`
|
|
308
|
+
* (default: selectable). A non-selectable event can't be clicked into the
|
|
309
|
+
* selection, is excluded from a group selection, and is ignored by
|
|
310
|
+
* `setSelection`. */
|
|
311
|
+
isSelectable?: boolean;
|
|
312
|
+
/** mark this event as a group summary bar. Its `startTime`/`endTime` are
|
|
313
|
+
* derived by the scene from its children (earliest start → latest end) and
|
|
314
|
+
* ignored on input — supplied values are kept only as a fallback while the
|
|
315
|
+
* parent has no resolved children yet. A parent event is never resizable and
|
|
316
|
+
* (in v1) never draggable; it stays clickable/selectable. Selecting it also
|
|
317
|
+
* selects all of its children. Must live on a row that is some row's
|
|
318
|
+
* `parentId`. */
|
|
319
|
+
isGroupParent?: boolean;
|
|
320
|
+
/** child → parent-event link. The referenced parent event is expected to live
|
|
321
|
+
* on this row's `parentId` row. An unresolved link is harmless — the event
|
|
322
|
+
* draws as a plain event (a dev warning is logged). */
|
|
323
|
+
parentEventId?: string;
|
|
324
|
+
/** rows this event may be dragged/dropped onto. `undefined` = any row (the
|
|
325
|
+
* default). When set, a drag only commits if the target row is in the list —
|
|
326
|
+
* otherwise the event snaps back (no `onDrop`). An empty array therefore pins
|
|
327
|
+
* the event (every drop snaps back).
|
|
328
|
+
*
|
|
329
|
+
* If the event's own `rowId` is not in this list, the library records a
|
|
330
|
+
* `{ droppableError: DroppableError }` on `props.metadata` (merging, not
|
|
331
|
+
* clobbering, any object you already put there) so the host app can surface
|
|
332
|
+
* the misconfiguration. The error is cleared automatically once the event is
|
|
333
|
+
* on an allowed row. */
|
|
334
|
+
droppableRowIds?: string[];
|
|
335
|
+
/** arbitrary data for eventPromptTemplate. The library may merge a
|
|
336
|
+
* `droppableError` key here — see `droppableRowIds`. */
|
|
278
337
|
metadata?: unknown;
|
|
279
338
|
};
|
|
280
339
|
export { EventPropsType }
|
|
@@ -411,6 +470,12 @@ export declare type HitTestView = {
|
|
|
411
470
|
|
|
412
471
|
export declare const intersectsWindow: (event: EventType, windowStart: number, windowEnd: number) => boolean;
|
|
413
472
|
|
|
473
|
+
/**
|
|
474
|
+
* Whether an event may be dropped onto a row, given its `droppableRowIds`.
|
|
475
|
+
* `undefined` = unrestricted (any row); otherwise the target must be listed.
|
|
476
|
+
*/
|
|
477
|
+
export declare const isRowDroppable: (droppableRowIds: string[] | undefined, targetRowId: string) => boolean;
|
|
478
|
+
|
|
414
479
|
export declare type LaneResult = {
|
|
415
480
|
laneOf: Map<string, number>;
|
|
416
481
|
highestLane: number;
|
|
@@ -426,10 +491,11 @@ export declare type LayerDirty = {
|
|
|
426
491
|
};
|
|
427
492
|
|
|
428
493
|
/**
|
|
429
|
-
* Replaces the CSS transitions the DOM renderer got for free:
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
494
|
+
* Replaces the CSS transitions the DOM renderer got for free: event tops
|
|
495
|
+
* tween when stacking changes, and resize handles fade in/out. (Row heights
|
|
496
|
+
* apply instantly so the canvas rows stay locked to the DOM headers, which
|
|
497
|
+
* also snap.) Values are queried per frame; while any tween is live the
|
|
498
|
+
* renderer keeps scheduling frames.
|
|
433
499
|
*
|
|
434
500
|
* Durations are configurable via the Timeline `animations` prop; a duration
|
|
435
501
|
* of 0 disables that animation (values jump straight to target).
|
|
@@ -441,7 +507,6 @@ export declare type LayerDirty = {
|
|
|
441
507
|
* perpetually, desyncing the layers.
|
|
442
508
|
*/
|
|
443
509
|
export declare class LayoutAnimator {
|
|
444
|
-
private rowHeights;
|
|
445
510
|
private eventTops;
|
|
446
511
|
private handleAlphas;
|
|
447
512
|
private now;
|
|
@@ -450,7 +515,6 @@ export declare class LayoutAnimator {
|
|
|
450
515
|
private fadeDuration;
|
|
451
516
|
setDurations(layoutMs: number, fadeMs: number): void;
|
|
452
517
|
beginFrame(now: number): void;
|
|
453
|
-
rowHeight(rowId: string, target: number): number;
|
|
454
518
|
eventTop(eventId: string, target: number): number;
|
|
455
519
|
/** 0..1 opacity of an event's resize handles; target 1 = hovered. */
|
|
456
520
|
handleAlpha(eventId: string, target: number): number;
|
|
@@ -568,6 +632,7 @@ export declare type RendererView = {
|
|
|
568
632
|
hoveredEventId: string | null;
|
|
569
633
|
draggedEventId: string | null;
|
|
570
634
|
resizePreview: ResizePreview | null;
|
|
635
|
+
selectedEventIds: ReadonlySet<string>;
|
|
571
636
|
};
|
|
572
637
|
|
|
573
638
|
export declare type ResizePreview = {
|
|
@@ -587,6 +652,10 @@ export declare const rowMinHeight: (highestLane: number, g?: Geometry) => number
|
|
|
587
652
|
declare type RowType = {
|
|
588
653
|
id: string;
|
|
589
654
|
name: string;
|
|
655
|
+
/** group this row under a parent row (one level of nesting only in v1). Child
|
|
656
|
+
* rows are hidden when their parent row is collapsed. List child rows
|
|
657
|
+
* immediately after their parent row for the clearest visual nesting. */
|
|
658
|
+
parentId?: string;
|
|
590
659
|
};
|
|
591
660
|
export { RowType }
|
|
592
661
|
export { RowType as RowType_alias_1 }
|
|
@@ -604,8 +673,17 @@ export declare class SceneStore {
|
|
|
604
673
|
private rowIndexes;
|
|
605
674
|
private rowOrder;
|
|
606
675
|
private eventRow;
|
|
676
|
+
private eventGroup;
|
|
677
|
+
private groupMembers;
|
|
678
|
+
private parentOf;
|
|
679
|
+
private childRowsOf;
|
|
680
|
+
private collapsedRows;
|
|
681
|
+
private childrenOf;
|
|
682
|
+
private parentEventOf;
|
|
683
|
+
private parentSpanDirty;
|
|
607
684
|
private listeners;
|
|
608
685
|
private geometry;
|
|
686
|
+
private labelMinHeights;
|
|
609
687
|
version: number;
|
|
610
688
|
setGeometry(geometry: Geometry): void;
|
|
611
689
|
getGeometry(): Geometry;
|
|
@@ -614,11 +692,48 @@ export declare class SceneStore {
|
|
|
614
692
|
setStaticEvents(events: EventType[]): void;
|
|
615
693
|
applyPatches(patches: EventPatch[]): void;
|
|
616
694
|
getEvent(id: string): EventType | undefined;
|
|
695
|
+
/**
|
|
696
|
+
* Event ids "connected" to the given event via a shared `props.groupId`.
|
|
697
|
+
* Returns every member of the group (including the event itself), or just
|
|
698
|
+
* `[eventId]` when the event has no group / no other members / is unknown.
|
|
699
|
+
*/
|
|
700
|
+
getConnectedEventIds(eventId: string): string[];
|
|
701
|
+
/**
|
|
702
|
+
* Whether an event may enter the selection. False only when the event is
|
|
703
|
+
* present and explicitly opted out (`props.isSelectable === false`); unknown
|
|
704
|
+
* ids are treated as selectable so a selection can be set before data loads
|
|
705
|
+
* and survives streaming.
|
|
706
|
+
*/
|
|
707
|
+
isEventSelectable(id: string): boolean;
|
|
617
708
|
getRowIds(): string[];
|
|
709
|
+
/**
|
|
710
|
+
* Row ids in display order, minus rows hidden inside a collapsed parent.
|
|
711
|
+
* Drives offsets, drawing and hit-testing. The header still walks
|
|
712
|
+
* `getRowIds()` so it can draw the carets and decide which rows to skip.
|
|
713
|
+
*/
|
|
714
|
+
getVisibleRowIds(): string[];
|
|
715
|
+
/** whether a row is a parent (owns at least one child row) */
|
|
716
|
+
isRowParent(rowId: string): boolean;
|
|
717
|
+
/** whether a row is hidden because its parent row is collapsed */
|
|
718
|
+
isRowHidden(rowId: string): boolean;
|
|
719
|
+
isRowCollapsed(rowId: string): boolean;
|
|
720
|
+
getCollapsedRowIds(): string[];
|
|
721
|
+
setCollapsed(rowId: string, collapsed: boolean): void;
|
|
722
|
+
toggleCollapsed(rowId: string): void;
|
|
723
|
+
/** child event ids of a parent (summary) event; empty if it has none */
|
|
724
|
+
getChildEventIds(parentEventId: string): string[];
|
|
618
725
|
getRow(rowId: string): RowType | undefined;
|
|
619
726
|
getRowEvents(rowId: string): EventType[];
|
|
620
727
|
getRowStaticEvents(rowId: string): EventType[];
|
|
621
728
|
getLanes(rowId: string, windowStart: number, windowEnd: number): LaneResult;
|
|
729
|
+
/**
|
|
730
|
+
* Report the per-row label heights measured against the live DOM header
|
|
731
|
+
* (key: rowId, value: the minimum row height the wrapped label needs,
|
|
732
|
+
* already including vertical padding). Replaces the previous map wholesale
|
|
733
|
+
* and only bumps when a value actually changed, so re-measuring identical
|
|
734
|
+
* labels is a no-op and can't feed back into an infinite render loop.
|
|
735
|
+
*/
|
|
736
|
+
setLabelMinHeights(heights: Map<string, number>): void;
|
|
622
737
|
getRowHeight(rowId: string, windowStart: number, windowEnd: number): number;
|
|
623
738
|
/**
|
|
624
739
|
* y offset of each row's top edge (content coordinates, before scroll) plus
|
|
@@ -631,6 +746,24 @@ export declare class SceneStore {
|
|
|
631
746
|
subscribe(listener: () => void): () => void;
|
|
632
747
|
private insert;
|
|
633
748
|
private remove;
|
|
749
|
+
private addToGroup;
|
|
750
|
+
private removeFromGroup;
|
|
751
|
+
/**
|
|
752
|
+
* Enforce the authoring contract for `props.droppableRowIds`: if the event's
|
|
753
|
+
* current row is not among its allowed rows, record a `droppableError` on
|
|
754
|
+
* `props.metadata` (merged non-destructively); otherwise clear any stale one.
|
|
755
|
+
* Cheap no-op for events without `droppableRowIds` and no prior error.
|
|
756
|
+
*/
|
|
757
|
+
private validateDroppable;
|
|
758
|
+
private addToParentIndex;
|
|
759
|
+
private removeFromParentIndex;
|
|
760
|
+
/**
|
|
761
|
+
* Recompute the derived span of any dirty parent event living on `rowId`
|
|
762
|
+
* (earliest child start → latest child end), write it back into the parent
|
|
763
|
+
* event, and re-sort the row so the sorted-array invariant holds. Cheap no-op
|
|
764
|
+
* when nothing is dirty (the common no-groups case never touches this).
|
|
765
|
+
*/
|
|
766
|
+
private flushParentSpans;
|
|
634
767
|
private bump;
|
|
635
768
|
}
|
|
636
769
|
|
|
@@ -658,6 +791,17 @@ declare type Theme = {
|
|
|
658
791
|
gridColor?: string;
|
|
659
792
|
timeBarBorder?: string;
|
|
660
793
|
timeBarTextColor?: string;
|
|
794
|
+
/** opacity applied to NON-selected events while a selection is active, so the
|
|
795
|
+
* selection stands out (default 0.35). 1 disables dimming. */
|
|
796
|
+
dimmedOpacity?: number;
|
|
797
|
+
/** shadow color for the "lifted" look of selected events (default
|
|
798
|
+
* "rgba(0,0,0,0.35)") */
|
|
799
|
+
selectionShadowColor?: string;
|
|
800
|
+
/** shadow blur in px for selected events (default 8) */
|
|
801
|
+
selectionShadowBlur?: number;
|
|
802
|
+
/** px the selected event bar is lifted (drawn offset upward) to read as
|
|
803
|
+
* elevated above the others (default 2) */
|
|
804
|
+
selectionElevation?: number;
|
|
661
805
|
/** canvas text font; defaults to the canvas element's computed font */
|
|
662
806
|
font?: string;
|
|
663
807
|
/** event bar height in px (default 20) */
|
|
@@ -668,6 +812,15 @@ declare type Theme = {
|
|
|
668
812
|
rowPaddingY?: number;
|
|
669
813
|
/** event bar corner radius in px (default 5) */
|
|
670
814
|
barRadius?: number;
|
|
815
|
+
/** faint fill laid over the child-row block of an expanded group so it reads
|
|
816
|
+
* as recessed beneath its parent row (default "rgba(0,0,0,0.05)"). Also used
|
|
817
|
+
* to tint child row headers. */
|
|
818
|
+
groupChildBackground?: string;
|
|
819
|
+
/** color of the inset shadow drawn at the top (and left) of an expanded
|
|
820
|
+
* group's child block — the "sitting beneath the parent" depth cue (default
|
|
821
|
+
* "rgba(0,0,0,0.22)"). Also tints the header tree connector lines if no
|
|
822
|
+
* gridColor contrast is desired. */
|
|
823
|
+
groupShadowColor?: string;
|
|
671
824
|
};
|
|
672
825
|
export { Theme }
|
|
673
826
|
export { Theme as Theme_alias_1 }
|
|
@@ -709,6 +862,25 @@ export { Timeline as Timeline_alias_1 }
|
|
|
709
862
|
|
|
710
863
|
export declare const TimelineCanvas: () => React_2.JSX.Element;
|
|
711
864
|
|
|
865
|
+
/**
|
|
866
|
+
* Per-event drop-target restriction (`props.droppableRowIds`). The blue event
|
|
867
|
+
* can only be dropped onto Welder/CNC (drag it elsewhere → not-allowed cursor,
|
|
868
|
+
* snaps back). The green event is unrestricted. The red event is *misconfigured*
|
|
869
|
+
* — it sits on Paint but its droppableRowIds doesn't include Paint, so the
|
|
870
|
+
* library records `metadata.droppableError`; click "Inspect" to see it.
|
|
871
|
+
*/
|
|
872
|
+
export declare const TimelineDroppableRows: () => React_2.JSX.Element;
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* Grouped (collapsible) rows. A parent row owns child rows (`parentId`); a
|
|
876
|
+
* group-parent event (`isGroupParent`) on the parent row summarizes the child
|
|
877
|
+
* events that point at it (`parentEventId`). The parent's span is derived
|
|
878
|
+
* (earliest child start → latest child end) — it is never resizable or
|
|
879
|
+
* draggable. Selecting a parent also selects its children. Collapsing a parent
|
|
880
|
+
* row hides its child rows while the summary bar stays.
|
|
881
|
+
*/
|
|
882
|
+
export declare const TimelineGrouped: () => React_2.JSX.Element;
|
|
883
|
+
|
|
712
884
|
/**
|
|
713
885
|
* Imperative handle for streaming/live updates: `const ref =
|
|
714
886
|
* useRef<TimelineHandle>(null); <Timeline ref={ref} ...>`.
|
|
@@ -734,12 +906,32 @@ declare type TimelineHandle = {
|
|
|
734
906
|
startTime: number;
|
|
735
907
|
endTime: number;
|
|
736
908
|
};
|
|
909
|
+
/** replace the current selection with these event ids. No `groupId`-tag
|
|
910
|
+
* expansion (that's Cmd/Ctrl+click only), but a group-parent id still pulls
|
|
911
|
+
* in its child events (parent → children). Requires `selectable`; fires
|
|
912
|
+
* `onSelectionChange`. */
|
|
913
|
+
setSelection(eventIds: string[]): void;
|
|
914
|
+
/** the currently selected event ids */
|
|
915
|
+
getSelection(): string[];
|
|
916
|
+
/** toggle a parent row's collapsed state (hides/shows its child rows) */
|
|
917
|
+
toggleRow(rowId: string): void;
|
|
918
|
+
/** explicitly collapse or expand a parent row */
|
|
919
|
+
setCollapsed(rowId: string, collapsed: boolean): void;
|
|
737
920
|
/** force a full redraw of both canvas layers */
|
|
738
921
|
redraw(): void;
|
|
739
922
|
};
|
|
740
923
|
export { TimelineHandle }
|
|
741
924
|
export { TimelineHandle as TimelineHandle_alias_1 }
|
|
742
925
|
|
|
926
|
+
/**
|
|
927
|
+
* Long row labels: names that exceed the 100px header width wrap to multiple
|
|
928
|
+
* lines, stay centered, and grow the row height (and its canvas dividers) to
|
|
929
|
+
* fit instead of overflowing into the neighbouring row. Mixes short, multi-word,
|
|
930
|
+
* and a single unbroken token (forced to break-word) so the per-row height
|
|
931
|
+
* adapts to whichever label is tallest.
|
|
932
|
+
*/
|
|
933
|
+
export declare const TimelineLongRowLabels: () => React_2.JSX.Element;
|
|
934
|
+
|
|
743
935
|
/**
|
|
744
936
|
* A small, sub-day window (~6h). With a window narrower than a day the time
|
|
745
937
|
* bar must still track the hour labels to the actual time as you pan — pan the
|
|
@@ -760,6 +952,20 @@ declare type TimelineProps = {
|
|
|
760
952
|
onResize?: (props: OnResizeProps) => void;
|
|
761
953
|
onEventClick?: (props: OnEventClickProps) => void;
|
|
762
954
|
onEventHover?: (props: OnEventHoverProps) => void;
|
|
955
|
+
/** enable click selection: click selects one event (elevated + others dimmed),
|
|
956
|
+
* Cmd/Ctrl+click selects its whole connected group (`props.groupId`),
|
|
957
|
+
* background click / Escape clears. Default false (no selection). */
|
|
958
|
+
selectable?: boolean;
|
|
959
|
+
/** initial selection for the uncontrolled selection state */
|
|
960
|
+
defaultSelectedEventIds?: string[];
|
|
961
|
+
/** fires whenever the selection changes (click, group-click, clear, or the
|
|
962
|
+
* imperative handle) */
|
|
963
|
+
onSelectionChange?: (eventIds: string[]) => void;
|
|
964
|
+
/** rows collapsed initially (uncontrolled). After mount, collapse state lives
|
|
965
|
+
* in the scene and survives every data update — streaming patches,
|
|
966
|
+
* `setEvents`, and `events`-prop resets never change it; only a user caret
|
|
967
|
+
* click or the imperative handle (`toggleRow`/`setCollapsed`) does. */
|
|
968
|
+
defaultCollapsedRowIds?: string[];
|
|
763
969
|
theme?: Theme;
|
|
764
970
|
drawEvent?: DrawEventFn;
|
|
765
971
|
/** only `rowsHeader` still applies — everything else is canvas-drawn (use `theme`) */
|
|
@@ -809,6 +1015,16 @@ export declare class TimelineRenderer {
|
|
|
809
1015
|
private drawFrame;
|
|
810
1016
|
}
|
|
811
1017
|
|
|
1018
|
+
/**
|
|
1019
|
+
* Selection: `selectable` turns on click selection. A plain click selects one
|
|
1020
|
+
* event (it lifts with a shadow while every other event dims); Cmd/Ctrl+click
|
|
1021
|
+
* selects the whole connected group (`props.groupId`). Background click or
|
|
1022
|
+
* Escape clears. The buttons drive the same state through the imperative
|
|
1023
|
+
* handle (`setSelection`/`getSelection`). Dragging/resizing still operate on a
|
|
1024
|
+
* single event regardless of how many are selected.
|
|
1025
|
+
*/
|
|
1026
|
+
export declare const TimelineSelectable: () => React_2.JSX.Element;
|
|
1027
|
+
|
|
812
1028
|
/**
|
|
813
1029
|
* Configurable time-bar rows: a day row over 8-hour "shift" blocks instead of
|
|
814
1030
|
* hours. The bottom row uses `{ stepSeconds: 8 * 3600 }` with a custom
|
|
@@ -857,6 +1073,10 @@ declare type UseCanvasInteractionsArgs = {
|
|
|
857
1073
|
onEventHover?: (props: OnEventHoverProps) => void;
|
|
858
1074
|
eventsResize: boolean;
|
|
859
1075
|
panZoom?: PanZoomConfig;
|
|
1076
|
+
selectable: boolean;
|
|
1077
|
+
/** replace the selection with exactly these ids (single write path) */
|
|
1078
|
+
applySelection: (eventIds: string[]) => void;
|
|
1079
|
+
getSelection: () => string[];
|
|
860
1080
|
};
|
|
861
1081
|
|
|
862
1082
|
/** Notifies when devicePixelRatio changes (browser zoom, monitor switch). */
|
package/dist/index.css
CHANGED
|
@@ -33,6 +33,14 @@
|
|
|
33
33
|
align-items: center;
|
|
34
34
|
width: 100px;
|
|
35
35
|
box-sizing: border-box;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
}
|
|
38
|
+
.row-header-label {
|
|
39
|
+
width: 100%;
|
|
40
|
+
text-align: center;
|
|
41
|
+
white-space: normal;
|
|
42
|
+
overflow-wrap: break-word;
|
|
43
|
+
word-break: break-word;
|
|
36
44
|
}
|
|
37
45
|
.event {
|
|
38
46
|
position: absolute;
|
|
@@ -109,6 +117,7 @@
|
|
|
109
117
|
height: 0;
|
|
110
118
|
overflow: visible;
|
|
111
119
|
z-index: 1;
|
|
120
|
+
contain: layout;
|
|
112
121
|
}
|
|
113
122
|
.canvas-sticky canvas {
|
|
114
123
|
position: absolute;
|
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}\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}\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"],"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AAK;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;AACX;AAEA,
|
|
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,SAA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AAY;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.d.mts
CHANGED
|
@@ -11,6 +11,7 @@ export { OnDropProps } from './_tsup-dts-rollup.mjs';
|
|
|
11
11
|
export { OnResizeProps } from './_tsup-dts-rollup.mjs';
|
|
12
12
|
export { OnEventClickProps } from './_tsup-dts-rollup.mjs';
|
|
13
13
|
export { OnEventHoverProps } from './_tsup-dts-rollup.mjs';
|
|
14
|
+
export { DroppableError } from './_tsup-dts-rollup.mjs';
|
|
14
15
|
export { PanZoomConfig } from './_tsup-dts-rollup.mjs';
|
|
15
16
|
export { EventPatch } from './_tsup-dts-rollup.mjs';
|
|
16
17
|
export { TimelineHandle } from './_tsup-dts-rollup.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { OnDropProps } from './_tsup-dts-rollup.js';
|
|
|
11
11
|
export { OnResizeProps } from './_tsup-dts-rollup.js';
|
|
12
12
|
export { OnEventClickProps } from './_tsup-dts-rollup.js';
|
|
13
13
|
export { OnEventHoverProps } from './_tsup-dts-rollup.js';
|
|
14
|
+
export { DroppableError } from './_tsup-dts-rollup.js';
|
|
14
15
|
export { PanZoomConfig } from './_tsup-dts-rollup.js';
|
|
15
16
|
export { EventPatch } from './_tsup-dts-rollup.js';
|
|
16
17
|
export { TimelineHandle } from './_tsup-dts-rollup.js';
|