react-timelane 0.0.0 → 0.0.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/components/TimelineAside.d.ts +13 -0
- package/dist/components/TimelineBackground.d.ts +5 -0
- package/dist/components/TimelineBody.d.ts +13 -0
- package/dist/components/TimelineHeader/DaysHeader.d.ts +15 -0
- package/dist/components/TimelineHeader/MonthsHeader.d.ts +15 -0
- package/dist/components/TimelineHeader/TimelineHeader.d.ts +24 -0
- package/dist/components/TimelineHeader/WeeksHeader.d.ts +15 -0
- package/dist/components/TimelineHeader/index.d.ts +5 -0
- package/dist/components/TimelineHeader/renderingUtils.d.ts +4 -0
- package/dist/components/TimelineSelectionLayer.d.ts +6 -0
- package/dist/components/TimelineSettingsContext.d.ts +7 -0
- package/dist/components/TimelineSettingsProvider.d.ts +7 -0
- package/dist/components/TimelineWrapper.d.ts +17 -0
- package/dist/components/core/CoreItem/CoreItemComponent.d.ts +14 -0
- package/dist/components/core/CoreItem/DragResizeComponent.d.ts +20 -0
- package/dist/components/core/CoreSwimlane/AvailableSpaceIndicator.d.ts +21 -0
- package/dist/components/core/CoreSwimlane/CoreSwimlane.d.ts +16 -0
- package/dist/components/core/CoreSwimlane/DropPreview.d.ts +9 -0
- package/dist/components/core/CoreSwimlane/DropTarget.d.ts +11 -0
- package/dist/components/core/CoreSwimlane/OverlapIndicator.d.ts +6 -0
- package/dist/components/core/CoreSwimlane/utils.d.ts +13 -0
- package/dist/components/core/utils.d.ts +15 -0
- package/dist/components/layout/TimelineLayout.d.ts +23 -0
- package/dist/hooks/useScroll.d.ts +10 -0
- package/dist/hooks/useTimelineContext.d.ts +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/react-timelane.css +1 -0
- package/dist/react-timelane.js +4744 -0
- package/dist/types/AvailableSpace.d.ts +6 -0
- package/dist/types/CoreItem.d.ts +12 -0
- package/dist/types/DateBounds.d.ts +4 -0
- package/dist/types/Dimensions.d.ts +4 -0
- package/dist/types/GrabInfo.d.ts +5 -0
- package/dist/types/Grid.d.ts +6 -0
- package/dist/types/OffsetBounds.d.ts +4 -0
- package/dist/types/Pixels.d.ts +4 -0
- package/{src/types/Position.ts → dist/types/Position.d.ts} +2 -2
- package/dist/types/Rectangle.d.ts +6 -0
- package/dist/types/SwimlaneT.d.ts +5 -0
- package/dist/types/TimeRange.d.ts +4 -0
- package/dist/types/TimelineSettings.d.ts +11 -0
- package/dist/types/index.d.ts +15 -0
- package/package.json +1 -1
- package/vite.config.ts +1 -1
- package/.github/workflows/static.yml +0 -55
- package/docs/README.md +0 -54
- package/docs/eslint.config.js +0 -28
- package/docs/index.html +0 -12
- package/docs/package-lock.json +0 -5101
- package/docs/package.json +0 -35
- package/docs/src/App.css +0 -5
- package/docs/src/App.tsx +0 -59
- package/docs/src/assets/react.svg +0 -1
- package/docs/src/components/AllocationComponent.tsx +0 -82
- package/docs/src/components/Timeline.tsx +0 -183
- package/docs/src/constants.ts +0 -42
- package/docs/src/hooks/useLocalStorage.ts +0 -21
- package/docs/src/main.tsx +0 -9
- package/docs/src/models/Allocation.ts +0 -11
- package/docs/src/models/AllocationId.ts +0 -1
- package/docs/src/models/Resource.ts +0 -8
- package/docs/src/models/ResourceId.ts +0 -1
- package/docs/src/vite-env.d.ts +0 -1
- package/docs/tsconfig.json +0 -27
- package/docs/vite.config.ts +0 -8
- package/src/components/Timeline.scss +0 -297
- package/src/components/TimelineAside.tsx +0 -81
- package/src/components/TimelineBackground.tsx +0 -53
- package/src/components/TimelineBody.tsx +0 -54
- package/src/components/TimelineHeader/DaysHeader.tsx +0 -44
- package/src/components/TimelineHeader/MonthsHeader.tsx +0 -62
- package/src/components/TimelineHeader/TimelineHeader.tsx +0 -64
- package/src/components/TimelineHeader/WeeksHeader.tsx +0 -63
- package/src/components/TimelineHeader/index.ts +0 -9
- package/src/components/TimelineHeader/renderingUtils.tsx +0 -57
- package/src/components/TimelineSelectionLayer.tsx +0 -179
- package/src/components/TimelineSettingsContext.tsx +0 -27
- package/src/components/TimelineSettingsProvider.tsx +0 -24
- package/src/components/TimelineWrapper.tsx +0 -51
- package/src/components/core/CoreItem/CoreItemComponent.tsx +0 -69
- package/src/components/core/CoreItem/DragResizeComponent.tsx +0 -180
- package/src/components/core/CoreSwimlane/AvailableSpaceIndicator.tsx +0 -156
- package/src/components/core/CoreSwimlane/CoreSwimlane.tsx +0 -245
- package/src/components/core/CoreSwimlane/DropPreview.tsx +0 -30
- package/src/components/core/CoreSwimlane/DropTarget.tsx +0 -83
- package/src/components/core/CoreSwimlane/OverlapIndicator.tsx +0 -22
- package/src/components/core/CoreSwimlane/utils.ts +0 -375
- package/src/components/core/utils.ts +0 -154
- package/src/components/layout/TimelineLayout.tsx +0 -93
- package/src/components/layout/layout.scss +0 -107
- package/src/global.d.ts +0 -9
- package/src/hooks/useScroll.tsx +0 -71
- package/src/hooks/useTimelineContext.tsx +0 -6
- package/src/index.ts +0 -15
- package/src/types/AvailableSpace.ts +0 -6
- package/src/types/CoreItem.ts +0 -23
- package/src/types/DateBounds.ts +0 -4
- package/src/types/Dimensions.ts +0 -4
- package/src/types/GrabInfo.ts +0 -6
- package/src/types/Grid.ts +0 -6
- package/src/types/OffsetBounds.ts +0 -4
- package/src/types/Pixels.ts +0 -4
- package/src/types/Rectangle.ts +0 -6
- package/src/types/SwimlaneT.ts +0 -6
- package/src/types/TimeRange.ts +0 -4
- package/src/types/TimelineSettings.ts +0 -11
- package/src/types/index.ts +0 -15
- package/tsconfig.json +0 -32
- /package/{src/types/ItemId.ts → dist/types/ItemId.d.ts} +0 -0
- /package/{src/types/SwimlaneId.ts → dist/types/SwimlaneId.d.ts} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MouseEvent, ReactElement } from 'react';
|
|
2
|
+
import { SwimlaneT } from '../types';
|
|
3
|
+
interface TimelineAsideProps {
|
|
4
|
+
swimlanes: SwimlaneT[];
|
|
5
|
+
focusedSwimlane?: SwimlaneT | null;
|
|
6
|
+
setFocusedSwimlane?: (lane: SwimlaneT | null) => void;
|
|
7
|
+
onSwimlaneHeaderClick?: (lane: SwimlaneT, e: MouseEvent) => void;
|
|
8
|
+
onSwimlaneHeaderDoubleClick?: (lane: SwimlaneT, e: MouseEvent) => void;
|
|
9
|
+
onSwimlaneHeaderContextMenu?: (lane: SwimlaneT, e: MouseEvent) => void;
|
|
10
|
+
renderSwimlaneHeader?: (lane: SwimlaneT) => ReactElement;
|
|
11
|
+
}
|
|
12
|
+
export default function TimelineAside({ swimlanes, focusedSwimlane, setFocusedSwimlane, onSwimlaneHeaderClick, onSwimlaneHeaderDoubleClick, onSwimlaneHeaderContextMenu, renderSwimlaneHeader, }: TimelineAsideProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MouseEvent, ReactElement } from 'react';
|
|
2
|
+
import { AvailableSpace, CoreItem, SwimlaneT } from '../types';
|
|
3
|
+
interface TimelineBodyProps<T> {
|
|
4
|
+
lanes: SwimlaneT[];
|
|
5
|
+
items: CoreItem<T>[];
|
|
6
|
+
renderItem?: (item: CoreItem<T>, isDragged: boolean) => ReactElement;
|
|
7
|
+
onItemUpdate?: (item: CoreItem<T>) => void;
|
|
8
|
+
onLaneClick?: (lane: SwimlaneT, when: Date, availableSpace: AvailableSpace | null, e: MouseEvent) => void;
|
|
9
|
+
onLaneDoubleClick?: (lane: SwimlaneT, when: Date, availableSpace: AvailableSpace | null, e: MouseEvent) => void;
|
|
10
|
+
onLaneContextMenu?: (lane: SwimlaneT, when: Date, e: MouseEvent) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function TimelineBody<T>({ lanes, items, renderItem, onItemUpdate, onLaneClick, onLaneDoubleClick, onLaneContextMenu, }: TimelineBodyProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MouseEvent, ReactElement } from 'react';
|
|
2
|
+
import { Pixels, TimeRange } from '../../types';
|
|
3
|
+
interface DaysHeaderProps {
|
|
4
|
+
range: TimeRange;
|
|
5
|
+
pixels: Pixels;
|
|
6
|
+
focusedDay?: Date | null;
|
|
7
|
+
setFocusedDay?: (day: Date | null) => void;
|
|
8
|
+
render?: (day: Date) => ReactElement;
|
|
9
|
+
onDayClick?: (_: {
|
|
10
|
+
day: Date;
|
|
11
|
+
e: MouseEvent;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function DaysHeader({ range, pixels, focusedDay, setFocusedDay, render, onDayClick, }: DaysHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MouseEvent, ReactElement } from 'react';
|
|
2
|
+
import { Pixels, TimeRange } from '../../types';
|
|
3
|
+
interface MonthsHeaderProps {
|
|
4
|
+
range: TimeRange;
|
|
5
|
+
pixels: Pixels;
|
|
6
|
+
setFocusedDay?: (day: Date | null) => void;
|
|
7
|
+
render?: (firstDay: Date, lastDay: Date) => ReactElement;
|
|
8
|
+
onMonthClick?: (params: {
|
|
9
|
+
firstDay: Date;
|
|
10
|
+
lastDay: Date;
|
|
11
|
+
e: MouseEvent;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function MonthsHeader({ range, pixels, setFocusedDay, render, onMonthClick, }: MonthsHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MouseEvent, ReactElement } from 'react';
|
|
2
|
+
interface TimelineHeaderProps {
|
|
3
|
+
focusedDay?: Date | null;
|
|
4
|
+
setFocusedDay?: (day: Date | null) => void;
|
|
5
|
+
renderMonthHeader?: (firstDay: Date, lastDay: Date) => ReactElement;
|
|
6
|
+
renderWeekHeader?: (firstDay: Date, lastDay: Date) => ReactElement;
|
|
7
|
+
renderDayHeader?: (day: Date) => ReactElement;
|
|
8
|
+
onMonthClick?: (_: {
|
|
9
|
+
firstDay: Date;
|
|
10
|
+
lastDay: Date;
|
|
11
|
+
e: MouseEvent;
|
|
12
|
+
}) => void;
|
|
13
|
+
onWeekClick?: (_: {
|
|
14
|
+
firstDay: Date;
|
|
15
|
+
lastDay: Date;
|
|
16
|
+
e: MouseEvent;
|
|
17
|
+
}) => void;
|
|
18
|
+
onDayClick?: (_: {
|
|
19
|
+
day: Date;
|
|
20
|
+
e: MouseEvent;
|
|
21
|
+
}) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function TimelineHeader({ focusedDay, setFocusedDay, renderMonthHeader, renderWeekHeader, renderDayHeader, onMonthClick, onDayClick, onWeekClick, }: TimelineHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MouseEvent, ReactElement } from 'react';
|
|
2
|
+
import { Pixels, TimeRange } from '../../types';
|
|
3
|
+
interface WeeksHeaderProps {
|
|
4
|
+
range: TimeRange;
|
|
5
|
+
pixels: Pixels;
|
|
6
|
+
setFocusedDay?: (day: Date | null) => void;
|
|
7
|
+
render?: (firstDay: Date, lastDay: Date) => ReactElement;
|
|
8
|
+
onWeekClick?: (params: {
|
|
9
|
+
firstDay: Date;
|
|
10
|
+
lastDay: Date;
|
|
11
|
+
e: MouseEvent;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function WeeksHeader({ range, pixels, setFocusedDay, render, onWeekClick, }: WeeksHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { DaysHeader } from './DaysHeader';
|
|
2
|
+
export { WeeksHeader } from './WeeksHeader';
|
|
3
|
+
export { MonthsHeader } from './MonthsHeader';
|
|
4
|
+
export { TimelineHeader } from './TimelineHeader';
|
|
5
|
+
export { renderDayHeader, renderMonthHeader, renderWeekHeader, } from './renderingUtils';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
export declare function renderMonthHeader(firstDay: Date, lastDay: Date): ReactElement;
|
|
3
|
+
export declare function renderWeekHeader(firstDay: Date, lastDay: Date): ReactElement;
|
|
4
|
+
export declare function renderDayHeader(day: Date): ReactElement;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
interface TimelineSelectionLayerProps {
|
|
3
|
+
onSelect: (selection: number[]) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare function TimelineSelectionLayer({ children, onSelect, }: PropsWithChildren<TimelineSelectionLayerProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { TimelineSettings } from '../types/TimelineSettings';
|
|
3
|
+
export interface TimelineContextOuter {
|
|
4
|
+
settings: TimelineSettings;
|
|
5
|
+
setSettings: Dispatch<SetStateAction<TimelineSettings>>;
|
|
6
|
+
}
|
|
7
|
+
export declare const TimelineSettingsContext: import('react').Context<TimelineContextOuter>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { TimelineSettings } from '../types/TimelineSettings';
|
|
3
|
+
interface TimelineSettingsProviderProps {
|
|
4
|
+
settings: TimelineSettings;
|
|
5
|
+
}
|
|
6
|
+
export declare const TimelineSettingsProvider: ({ settings: _settings, children, }: PropsWithChildren<TimelineSettingsProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { SwimlaneT } from '../types';
|
|
3
|
+
interface TimelineWrapperProps {
|
|
4
|
+
focusedDay?: Date | null;
|
|
5
|
+
focusedSwimlane?: SwimlaneT | null;
|
|
6
|
+
start?: Date;
|
|
7
|
+
end?: Date;
|
|
8
|
+
pixelsPerDay?: number;
|
|
9
|
+
pixelsPerResource?: number;
|
|
10
|
+
showMonths?: boolean;
|
|
11
|
+
showWeeks?: boolean;
|
|
12
|
+
showDays?: boolean;
|
|
13
|
+
allowOverlaps?: boolean;
|
|
14
|
+
focusedDate?: Date | null;
|
|
15
|
+
}
|
|
16
|
+
export default function TimelineWrapper({ children, start, end, pixelsPerDay, pixelsPerResource, showMonths, showWeeks, showDays, allowOverlaps, focusedDate, }: PropsWithChildren<TimelineWrapperProps>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { CoreItem, Position, SwimlaneT, TimelineSettings } from '../../../types';
|
|
3
|
+
interface CoreItemComponentProps<T> {
|
|
4
|
+
item: CoreItem<T>;
|
|
5
|
+
swimlane: SwimlaneT;
|
|
6
|
+
settings: TimelineSettings;
|
|
7
|
+
onDragStart: (grabPosition: Position, relativeGrabPosition: Position) => void;
|
|
8
|
+
onDrop: () => void;
|
|
9
|
+
onDrag: () => void;
|
|
10
|
+
onUpdate: (updatedItem: CoreItem<T>) => void;
|
|
11
|
+
onResizeStart: () => void;
|
|
12
|
+
}
|
|
13
|
+
export default function CoreItemComponent<T>({ swimlane, item, settings, children, onDragStart, onDrag, onDrop, onUpdate, onResizeStart, }: PropsWithChildren<CoreItemComponentProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { Position, Rectangle, Dimensions, CoreItem } from '../../../types';
|
|
3
|
+
interface DragResizeComponentProps<T> {
|
|
4
|
+
item: CoreItem<T>;
|
|
5
|
+
rectangle: Rectangle;
|
|
6
|
+
boundingRectangle: Dimensions;
|
|
7
|
+
onDragStart: (grabPosition: Position, relativeGrabPosition: Position) => void;
|
|
8
|
+
onDrag: () => void;
|
|
9
|
+
onDrop: () => void;
|
|
10
|
+
onUpdate: (rectangle: Rectangle) => void;
|
|
11
|
+
onResizeStart: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* takes care of pixel-level drag-and-drop and resizing.
|
|
15
|
+
* will emit every event through event handlers.
|
|
16
|
+
* @param param0 t
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
export default function DragResizeComponent<T>({ item, rectangle, boundingRectangle, children, onDrag, onDragStart, onDrop, onUpdate, onResizeStart, }: PropsWithChildren<DragResizeComponentProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { CoreItem, Pixels, SwimlaneT, TimeRange } from '../../../types';
|
|
3
|
+
interface AvailableSpaceIndicatorProps<T> {
|
|
4
|
+
pixels: Pixels;
|
|
5
|
+
range: TimeRange;
|
|
6
|
+
swimlane: SwimlaneT;
|
|
7
|
+
debug: boolean;
|
|
8
|
+
items: CoreItem<T>[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A component that displays the available space at the mouse cursor position.
|
|
12
|
+
* The available space is a rectangle that does not overlap with it's surrounding items.
|
|
13
|
+
* It is determined by some heuristics.
|
|
14
|
+
*
|
|
15
|
+
* Only used for debugging purposes.
|
|
16
|
+
*
|
|
17
|
+
* @param param0
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export default function AvailableSpaceIndicator<T>({ pixels, range, swimlane, items, debug, children, }: PropsWithChildren<AvailableSpaceIndicatorProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MouseEvent, ReactElement } from 'react';
|
|
2
|
+
import { AvailableSpace, CoreItem, SwimlaneT } from '../../../types';
|
|
3
|
+
interface CoreSwimlaneProps<T> {
|
|
4
|
+
swimlane: SwimlaneT;
|
|
5
|
+
items: CoreItem<T>[];
|
|
6
|
+
focused?: boolean;
|
|
7
|
+
onItemUpdate?: (item: CoreItem<T>) => void;
|
|
8
|
+
onMouseUp?: (e: MouseEvent) => void;
|
|
9
|
+
onClick?: (when: Date, availableSpace: AvailableSpace | null, e: MouseEvent) => void;
|
|
10
|
+
onDoubleClick?: (when: Date, availableSpace: AvailableSpace | null, e: MouseEvent) => void;
|
|
11
|
+
onContextMenu?: (when: Date, e: MouseEvent) => void;
|
|
12
|
+
renderItem?: (item: CoreItem<T>, isDragged: boolean) => ReactElement;
|
|
13
|
+
onResizeStart?: (data: T) => void;
|
|
14
|
+
}
|
|
15
|
+
export default function CoreSwimlane<T>({ swimlane, items, focused, onItemUpdate, onMouseUp, onClick, onDoubleClick, onContextMenu, renderItem, onResizeStart, }: CoreSwimlaneProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
interface DropPreviewProps {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export default function DropPreview({ x, y, width, height, children, }: PropsWithChildren<DropPreviewProps>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { GrabInfo, Position } from '../../../types';
|
|
3
|
+
interface DropTargetProps {
|
|
4
|
+
onDragStart?: (mousePos: Position, grabInfo: GrabInfo, data: any) => void;
|
|
5
|
+
onDrag?: (mousePos: Position, grabInfo: GrabInfo, data: any) => void;
|
|
6
|
+
onDrop?: (mousePos: Position, grabInfo: GrabInfo, data: any) => void;
|
|
7
|
+
onDragEnter?: (mousePos: Position, grabInfo: GrabInfo, data: any) => void;
|
|
8
|
+
onDragLeave?: (grabInfo: GrabInfo, data: any) => void;
|
|
9
|
+
}
|
|
10
|
+
export default function DropTarget({ children, onDragStart, onDrag, onDrop, onDragEnter, onDragLeave, }: PropsWithChildren<DropTargetProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AvailableSpace, CoreItem, Dimensions, GrabInfo, Grid, Pixels, Position, Rectangle, SwimlaneT, TimeRange } from '../../../types';
|
|
2
|
+
export declare function getDropPreviewRectangle<S, T>(swimlane: SwimlaneT, items: CoreItem<T>[], item: CoreItem<S>, mousePosition: Position | null, grabInfo: GrabInfo, pixels: Pixels, grid: Grid, range: TimeRange, allowOverlaps: boolean): Rectangle | null;
|
|
3
|
+
/**
|
|
4
|
+
* Returns true if two rectangles (l1, r1) and (l2, r2) overlap
|
|
5
|
+
* @param el1
|
|
6
|
+
* @param el2
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function doOverlap(el1: Rectangle, el2: Rectangle): boolean;
|
|
10
|
+
export declare function getOverlap(rect1: Rectangle, rect2: Rectangle): Rectangle | null;
|
|
11
|
+
export declare function itemsDoOverlap<T>(a: CoreItem<T>, b: CoreItem<T>): boolean;
|
|
12
|
+
export declare function isWithinTargetDimensions(item: Rectangle, targetDimensions: Dimensions): boolean;
|
|
13
|
+
export declare function getAvailableSpace<T>(clickedDate: Date, clickedOffset: number, swimlane: SwimlaneT, items: CoreItem<T>[], range: TimeRange): AvailableSpace | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DragLocationHistory, ElementDragPayload } from '@atlaskit/pragmatic-drag-and-drop/dist/types/internal-types';
|
|
2
|
+
import { CoreItem, Dimensions, Pixels, Position, Rectangle, SwimlaneT, TimeRange } from '../../types';
|
|
3
|
+
export declare function getDropTargetDimensions(swimlane: SwimlaneT, pixels: Pixels, range: TimeRange): Dimensions;
|
|
4
|
+
export declare function getDropTargetHeight(swimlane: SwimlaneT, pixels: Pixels): number;
|
|
5
|
+
export declare function getDropTargetWidth(swimlane: SwimlaneT, pixels: Pixels, range: TimeRange): number;
|
|
6
|
+
export declare function getItemRectangle<T>(item: CoreItem<T>, swimlane: SwimlaneT, range: TimeRange, pixels: Pixels): Rectangle;
|
|
7
|
+
export declare function getItemDimensions<T>(item: CoreItem<T>, swimlane: SwimlaneT, pixels: Pixels): Dimensions;
|
|
8
|
+
export declare function dateToPixel(date: Date, start: Date, pixels: Pixels): number;
|
|
9
|
+
export declare function offsetToPixel(offset: number, capacity: number, pixels: Pixels): number;
|
|
10
|
+
export declare function getItemPosition<T>(item: CoreItem<T>, swimlane: SwimlaneT, start: Date, pixels: Pixels): Position;
|
|
11
|
+
export declare function getGrabPosition(source: ElementDragPayload, location: DragLocationHistory): {
|
|
12
|
+
absolute: Position;
|
|
13
|
+
relative: Position;
|
|
14
|
+
};
|
|
15
|
+
export declare function getUpdatedItem<T>(oldItem: CoreItem<T>, swimlane: SwimlaneT, dropPreviewRect: Rectangle, pixels: Pixels, range: TimeRange): CoreItem<T>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
declare function TimelineLayout({ children }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare namespace TimelineLayout {
|
|
4
|
+
var Header: typeof TimelineLayoutHeader;
|
|
5
|
+
var Body: typeof TimelineLayoutBody;
|
|
6
|
+
var Background: typeof TimelineLayoutBackground;
|
|
7
|
+
var Footer: typeof TimelineLayoutFooter;
|
|
8
|
+
var Aside: typeof TimelineLayoutAside;
|
|
9
|
+
var Corner: typeof TimelineLayoutCorner;
|
|
10
|
+
}
|
|
11
|
+
declare function TimelineLayoutHeader({ children }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function TimelineLayoutBackground({ children }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function TimelineLayoutBody({ children }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function TimelineLayoutFooter({ children }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
interface TimelineLayoutAsideProps {
|
|
16
|
+
side?: "left" | "right";
|
|
17
|
+
}
|
|
18
|
+
declare function TimelineLayoutAside({ side, children, }: PropsWithChildren<TimelineLayoutAsideProps>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
interface TimelineLayoutCornerProps {
|
|
20
|
+
corner?: "top left" | "top right" | "bottom left" | "bottom right";
|
|
21
|
+
}
|
|
22
|
+
declare function TimelineLayoutCorner({ corner, children, }: PropsWithChildren<TimelineLayoutCornerProps>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export default TimelineLayout;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ItemId, SwimlaneId } from '../types';
|
|
2
|
+
export declare const useScroll: () => {
|
|
3
|
+
scrollTo: (destination: {
|
|
4
|
+
horz?: Date;
|
|
5
|
+
vert?: SwimlaneId;
|
|
6
|
+
} | ItemId) => void;
|
|
7
|
+
scrollToDate: (date: Date) => void;
|
|
8
|
+
scrollToItem: (itemId: ItemId) => void;
|
|
9
|
+
scrollToLane: (laneId: SwimlaneId) => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useTimelineContext: () => import('../components/TimelineSettingsContext').TimelineContextOuter;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as TimelineLayout } from './components/layout/TimelineLayout';
|
|
2
|
+
export { default as TimelineAside } from './components/TimelineAside';
|
|
3
|
+
export { default as TimelineBackground } from './components/TimelineBackground';
|
|
4
|
+
export * from './components/TimelineHeader';
|
|
5
|
+
export { default as TimelineWrapper } from './components/TimelineWrapper';
|
|
6
|
+
export { default as CoreSwimlane } from './components/core/CoreSwimlane/CoreSwimlane';
|
|
7
|
+
export { TimelineBody } from './components/TimelineBody';
|
|
8
|
+
export { TimelineSelectionLayer } from './components/TimelineSelectionLayer';
|
|
9
|
+
export * from './types';
|
|
10
|
+
export * from './components/core/utils';
|
|
11
|
+
export * from './components/core/CoreSwimlane/utils';
|
|
12
|
+
export { useScroll } from './hooks/useScroll';
|
|
13
|
+
export { useTimelineContext } from './hooks/useTimelineContext';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.timeline-layout{position:relative;width:100%;height:100%;overflow:auto}.timeline-layout .timeline-layout-inner{position:relative;width:fit-content;height:fit-content;display:grid;grid-template-areas:"corner-tl header corner-tr" "aside-l body aside-r" "corner-bl footer corner-br"}.timeline-layout .timeline-layout-inner .timeline-layout-header,.timeline-layout .timeline-layout-inner .timeline-layout-footer,.timeline-layout .timeline-layout-inner .timeline-layout-aside,.timeline-layout .timeline-layout-inner .timeline-layout-corner{background:#fff}.timeline-layout .timeline-layout-inner .timeline-layout-header{grid-area:header;position:sticky;position:-webkit-sticky;top:0;z-index:101;overflow:hidden}.timeline-layout .timeline-layout-inner .timeline-layout-body{grid-area:body;z-index:100}.timeline-layout .timeline-layout-inner .timeline-layout-background{grid-area:body;z-index:-1}.timeline-layout .timeline-layout-inner .timeline-layout-footer{grid-area:footer;position:sticky;position:-webkit-sticky;bottom:0;z-index:101;border-top:1px solid lightgray}.timeline-layout .timeline-layout-inner .timeline-layout-aside{grid-area:aside-l;position:sticky;position:-webkit-sticky;left:0;z-index:101}.timeline-layout .timeline-layout-inner .timeline-layout-aside.timeline-layout-aside-right{grid-area:aside-r;right:0;left:initial;border-left:1px solid lightgray}.timeline-layout .timeline-layout-inner .timeline-layout-corner{position:sticky;position:-webkit-sticky;z-index:102}.timeline-layout .timeline-layout-inner .timeline-layout-corner.timeline-layout-corner-top-left{grid-area:corner-tl;top:0;left:0;border-bottom:1px solid lightgray;border-right:1px solid lightgray}.timeline-layout .timeline-layout-inner .timeline-layout-corner.timeline-layout-corner-top-right{grid-area:corner-tr;top:0;right:0;border-bottom:1px solid lightgray;border-left:1px solid lightgray}.timeline-layout .timeline-layout-inner .timeline-layout-corner.timeline-layout-corner-bottom-left{grid-area:corner-bl;bottom:0;left:0;border-top:1px solid lightgray;border-right:1px solid lightgray}.timeline-layout .timeline-layout-inner .timeline-layout-corner.timeline-layout-corner-bottom-right{grid-area:corner-br;bottom:0;right:0;border-top:1px solid lightgray;border-left:1px solid lightgray}*{box-sizing:border-box}.timeline{--timeline-aside-width: 150px;--timeline-border-color-light: #f0f0f0;--timeline-border-color-normal: lightgray;--timeline-border-color-dark: gray;--timeline-highlight-color: #f8f8f8;--timeline-focused-color: rgba(0, 0, 255, .1);--timeline-hover-color: rgba(0, 0, 0, .05);overflow:auto;position:relative;width:100%;height:100%;border-left:1px solid var(--timeline-border-color-normal)}.timeline .timeline-header{top:0;z-index:101;background:#fff}.timeline .timeline-header .timeline-header-months{display:flex;flex-flow:row nowrap}.timeline .timeline-header .timeline-header-months .timeline-header-month-label{border-right:1px solid var(--timeline-border-color-normal);border-bottom:1px solid var(--timeline-border-color-normal);overflow:hidden;font-size:1em;height:30px;line-height:30px;text-align:center;cursor:pointer}.timeline .timeline-header .timeline-header-months .timeline-header-month-label:hover{background:var(--timeline-hover-color)}.timeline .timeline-header .timeline-header-weeks{display:flex;flex-flow:row nowrap}.timeline .timeline-header .timeline-header-weeks .timeline-header-week-label{border-right:1px solid var(--timeline-border-color-normal);border-bottom:1px solid var(--timeline-border-color-normal);overflow:hidden;font-size:1em;height:30px;line-height:30px;text-align:center;cursor:pointer}.timeline .timeline-header .timeline-header-weeks .timeline-header-week-label:hover{background:var(--timeline-hover-color)}.timeline .timeline-header .timeline-header-days{display:flex;flex-flow:row nowrap}.timeline .timeline-header .timeline-header-days .timeline-header-day-label{border-right:1px solid var(--timeline-border-color-normal);border-bottom:1px solid var(--timeline-border-color-normal);overflow:hidden;font-size:.8em;height:20px;line-height:20px;text-align:center;cursor:pointer}.timeline .timeline-header .timeline-header-days .timeline-header-day-label:hover{background:var(--timeline-hover-color)}.timeline .timeline-header .timeline-header-days .timeline-header-day-label.timeline-header-day-label-focused{background:var(--timeline-focused-color)}.timeline .timeline-header-corner{z-index:102;background:#fff;border-right:1px solid var(--timeline-border-color-normal);border-bottom:1px solid var(--timeline-border-color-normal)}.timeline .timeline-body{z-index:99;position:relative;width:fit-content}.timeline .timeline-body .timeline-swimlane{border-color:var(--timeline-border-color-normal)!important;border-top:1px solid gray;border-bottom:1px solid gray;margin-top:-1px;overflow:hidden}.timeline .timeline-body .timeline-swimlane .timeline-drop-target{position:relative;width:100%;height:100%}.timeline .timeline-body .timeline-swimlane .timeline-drop-target .timeline-item{position:absolute;cursor:pointer;border-radius:3px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.timeline .timeline-body .timeline-swimlane .timeline-drop-target .timeline-item.timeline-item-marked .timeline-allocation{border:2px dashed rgba(0,0,0,.5)}.timeline .timeline-body .timeline-swimlane .timeline-drop-target .timeline-item .timeline-item-drag-handle{height:100%}.timeline .timeline-body .timeline-swimlane .timeline-drop-target .timeline-item .timeline-item-resize-handle{background:#bed7dc;border-radius:5px;top:4px!important;bottom:4px!important;height:auto!important;width:6px!important;z-index:2;background:transparent!important;transition:.2s}.timeline .timeline-body .timeline-swimlane .timeline-drop-target .timeline-item .timeline-item-resize-handle:hover{background:#0000001a!important}.timeline .timeline-body .timeline-swimlane .timeline-drop-target .timeline-item .timeline-item-resize-handle.timeline-item-resize-handle-left{left:0!important;margin-left:1px}.timeline .timeline-body .timeline-swimlane .timeline-drop-target .timeline-item .timeline-item-resize-handle.timeline-item-resize-handle-right{right:0!important}.timeline .timeline-body .timeline-swimlane .timeline-drop-target .timeline-item .timeline-allocation{background:#92a8d1;border-radius:2px;border:2px solid transparent;height:calc(100% - 1px);overflow:hidden;cursor:pointer;padding:0 4px;margin-left:1px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;container-type:size;container-name:timeline-allocation}.timeline .timeline-body .timeline-swimlane .timeline-drop-target .timeline-item .timeline-allocation .timeline-allocation-title{font-weight:700;transform-origin:top left;line-height:30px;white-space:nowrap}@container timeline-allocation (max-height: 30px){.timeline .timeline-body .timeline-swimlane .timeline-drop-target .timeline-item .timeline-allocation .timeline-allocation-title{margin:0}}.timeline .timeline-body .timeline-swimlane .timeline-drop-target .timeline-item .timeline-allocation.timeline-allocation-selected{border:2px dashed rgba(0,0,0,.5)}.timeline .timeline-body .timeline-swimlane .timeline-drop-target .timeline-item.dragging{opacity:0}.timeline .timeline-body .timeline-swimlane .timeline-drop-target .timeline-drop-preview{background:#00f;position:absolute;border-radius:2px;color:#fff}.timeline .timeline-body .timeline-swimlane.timeline-row-focused{background:var(--timeline-focused-color)}.timeline .timeline-aside{border-right:1px solid var(--timeline-border-color-normal);width:var(--timeline-aside-width);background:#fff}.timeline .timeline-aside .timeline-aside-swimlane-header{border:1px solid var(--timeline-border-color-normal);border-right:none;border-left:none;margin-top:-1px;padding:10px;overflow:hidden;position:relative;cursor:pointer}.timeline .timeline-aside .timeline-aside-swimlane-header.timeline-aside-swimlane-header-focused{background:var(--timeline-focused-color)}.timeline .timeline-aside .timeline-aside-swimlane-header:hover .timeline-aside-resource-menu{opacity:1}.timeline .timeline-aside .timeline-aside-swimlane-header .timeline-aside-resource-menu{position:absolute;top:5px;right:5px;opacity:0;transition:.15s}.timeline .timeline-aside .timeline-aside-swimlane-header .timeline-aside-resource-menu.timeline-aside-resource-menu-open{opacity:1}.timeline .timeline-background{position:relative;width:100%;height:100%}.timeline .timeline-background .timeline-background-inner{display:flex;flex-flow:row nowrap;height:100%}.timeline .timeline-background .timeline-background-inner .timeline-background-day-label{border-right:1px solid var(--timeline-border-color-light);overflow:hidden;font-size:.8em;height:100%;z-index:-100}.timeline .timeline-background .timeline-background-inner .timeline-background-day-label.timeline-background-day-label-sunday{border-right:1px solid var(--timeline-border-color-normal)}.timeline .timeline-background .timeline-background-inner .timeline-background-day-label.timeline-background-day-label-focused{background:var(--timeline-focused-color)}.timeline .timeline-background .timeline-background-inner .timeline-background-focused-day-position{position:absolute;height:100%;background:var(--timeline-focused-color);z-index:-101}.timeline-header-tooltip,.timeline-header-day-tooltip{font-size:2em}
|