schedulant 1.0.0-alpha.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.
Files changed (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +46 -0
  3. package/dist/components/datagrid/body-cell.d.ts +10 -0
  4. package/dist/components/datagrid/datagrid-body.d.ts +4 -0
  5. package/dist/components/datagrid/datagrid-colgroup.d.ts +4 -0
  6. package/dist/components/datagrid/datagrid-head.d.ts +4 -0
  7. package/dist/components/datagrid/head-cell.d.ts +7 -0
  8. package/dist/components/schedulant.d.ts +2 -0
  9. package/dist/components/timeline/timeline-body-slot.d.ts +6 -0
  10. package/dist/components/timeline/timeline-body.d.ts +4 -0
  11. package/dist/components/timeline/timeline-checkpoint-harness.d.ts +9 -0
  12. package/dist/components/timeline/timeline-colgroup.d.ts +5 -0
  13. package/dist/components/timeline/timeline-drawing-board.d.ts +4 -0
  14. package/dist/components/timeline/timeline-event-harness.d.ts +11 -0
  15. package/dist/components/timeline/timeline-header-slot.d.ts +9 -0
  16. package/dist/components/timeline/timeline-header.d.ts +4 -0
  17. package/dist/components/timeline/timeline-lane.d.ts +7 -0
  18. package/dist/components/timeline/timeline-milestone-harness.d.ts +9 -0
  19. package/dist/context/schedulant-context.d.ts +8 -0
  20. package/dist/context/schedulant-provider.d.ts +4 -0
  21. package/dist/context/schedulant-reducer.d.ts +2 -0
  22. package/dist/context/schedulant-state.d.ts +21 -0
  23. package/dist/hooks/mounts/use-checkpoint-mount.d.ts +8 -0
  24. package/dist/hooks/mounts/use-event-mount.d.ts +8 -0
  25. package/dist/hooks/mounts/use-milestone-mount.d.ts +8 -0
  26. package/dist/hooks/mounts/use-resource-label-mount.d.ts +4 -0
  27. package/dist/hooks/mounts/use-resource-lane-mount.d.ts +4 -0
  28. package/dist/hooks/mounts/use-schedulant-mount.d.ts +3 -0
  29. package/dist/hooks/use-move-timeline-event.d.ts +15 -0
  30. package/dist/hooks/use-move-timeline-marker.d.ts +14 -0
  31. package/dist/hooks/use-resource-area-width.d.ts +2 -0
  32. package/dist/hooks/use-schedulant-context.d.ts +4 -0
  33. package/dist/hooks/use-schedulant-height.d.ts +1 -0
  34. package/dist/hooks/use-sync-scroll.d.ts +2 -0
  35. package/dist/hooks/use-timeline-width.d.ts +1 -0
  36. package/dist/icons/drag-icon.d.ts +5 -0
  37. package/dist/icons/droplet-icon.d.ts +5 -0
  38. package/dist/icons/flag-icon.d.ts +5 -0
  39. package/dist/icons/triangle-left-icon.d.ts +5 -0
  40. package/dist/icons/triangle-right-icon.d.ts +5 -0
  41. package/dist/schedulant.css +1 -0
  42. package/dist/schedulant.d.ts +8 -0
  43. package/dist/schedulant.js +19898 -0
  44. package/dist/types/base.d.ts +41 -0
  45. package/dist/types/checkpoint.d.ts +47 -0
  46. package/dist/types/day-timeline-view.d.ts +12 -0
  47. package/dist/types/event.d.ts +66 -0
  48. package/dist/types/index.d.ts +7 -0
  49. package/dist/types/milestone.d.ts +51 -0
  50. package/dist/types/misc.d.ts +8 -0
  51. package/dist/types/month-timeline-view.d.ts +12 -0
  52. package/dist/types/option.d.ts +10 -0
  53. package/dist/types/quarter-timeline-view.d.ts +12 -0
  54. package/dist/types/resource.d.ts +85 -0
  55. package/dist/types/schedulant-view.d.ts +20 -0
  56. package/dist/types/schedulant.d.ts +143 -0
  57. package/dist/types/timeline-view.d.ts +24 -0
  58. package/dist/types/timeline.d.ts +75 -0
  59. package/dist/types/week-timeline-view.d.ts +12 -0
  60. package/dist/types/year-timeline-view.d.ts +12 -0
  61. package/dist/utils/array.d.ts +1 -0
  62. package/dist/utils/dom.d.ts +3 -0
  63. package/dist/utils/if.d.ts +6 -0
  64. package/package.json +58 -0
@@ -0,0 +1,41 @@
1
+ import { default as React } from 'react';
2
+ import { MenuProps } from 'antd';
3
+ export type MenuItems = MenuProps["items"];
4
+ export type Dictionary = Record<string, unknown>;
5
+ export type Position = {
6
+ left: number;
7
+ right: number;
8
+ };
9
+ export type TimeStage = {
10
+ isPast: boolean;
11
+ isFuture: boolean;
12
+ isProcess: boolean;
13
+ };
14
+ export type MenuArg<ContentArg> = ContentArg & {
15
+ key: string;
16
+ keyPath: string[];
17
+ domEvent: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>;
18
+ };
19
+ export type MountArg<ContentArg> = ContentArg & {
20
+ el: HTMLElement;
21
+ };
22
+ export type MoveHandler<TheMountArg extends {
23
+ el: HTMLElement;
24
+ }> = (mountArg: TheMountArg) => void;
25
+ export type SelectHandler<TheMountArg extends {
26
+ el: HTMLElement;
27
+ }> = (mountArg: TheMountArg) => void;
28
+ export type ResizeHandler<TheMountArg extends {
29
+ el: HTMLElement;
30
+ }> = (mountArg: TheMountArg) => void;
31
+ export type DidMountHandler<TheMountArg extends {
32
+ el: HTMLElement;
33
+ }> = (mountArg: TheMountArg) => void;
34
+ export type WillUnmountHandler<TheMountArg extends {
35
+ el: HTMLElement;
36
+ }> = (mountArg: TheMountArg) => void;
37
+ export type ContextMenuClickHandler<TheMenuArg extends {
38
+ key: string;
39
+ keyPath: string[];
40
+ domEvent: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>;
41
+ }> = (menuArg: TheMenuArg) => void;
@@ -0,0 +1,47 @@
1
+ import { Dayjs } from 'dayjs';
2
+ import { ReactNode } from 'react';
3
+ import { Option } from './option.ts';
4
+ import { ResourceApi } from './resource.ts';
5
+ import { PublicSchedulantApi } from './schedulant.ts';
6
+ import { Dictionary, MenuArg, MenuItems, MountArg, TimeStage } from './base.ts';
7
+ export type CheckpointArg = {
8
+ checkpointApi: PublicCheckpointApi;
9
+ schedulantApi: PublicSchedulantApi;
10
+ };
11
+ export type CheckpointContextMenuItems = MenuItems;
12
+ export type CheckpointMountArg = MountArg<CheckpointArg & TimeStage>;
13
+ export type CheckpointContextMenuArg = MenuArg<CheckpointArg & TimeStage>;
14
+ export type CheckpointMoveMountArg = MountArg<CheckpointArg & {
15
+ date: Dayjs;
16
+ }>;
17
+ export type Checkpoint = {
18
+ id: string;
19
+ time: Dayjs;
20
+ title: string;
21
+ resourceId: string;
22
+ color?: string;
23
+ tooltip?: ReactNode;
24
+ extendedProps?: Dictionary;
25
+ };
26
+ export declare class CheckpointApi {
27
+ private checkpoint;
28
+ private resourceApi?;
29
+ constructor(checkpoint: Checkpoint);
30
+ setId(id: string): void;
31
+ getId(): string;
32
+ setTitle(title: string): void;
33
+ getTitle(): string;
34
+ setTime(time: Dayjs): void;
35
+ getTime(): Dayjs;
36
+ setResourceId(resourceId: string): void;
37
+ getResourceId(): string;
38
+ setResourceApi(resourceApi: ResourceApi): void;
39
+ getResourceApi(): ResourceApi;
40
+ setColor(color: string): void;
41
+ getColor(): Option<string>;
42
+ setTooltip(tooltip: ReactNode): void;
43
+ getTooltip(): ReactNode;
44
+ setExtendedProps(extendedProps: Dictionary): void;
45
+ getExtendProps(): Option<Dictionary>;
46
+ }
47
+ export type PublicCheckpointApi = Pick<CheckpointApi, "getId" | "getTitle" | "getTime" | "getResourceId" | "getResourceApi" | "getColor" | "getTooltip" | "getExtendProps">;
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ import { TimelineView } from './timeline-view.tsx';
3
+ import { Position } from './base';
4
+ import { Dayjs } from 'dayjs';
5
+ export declare class DayTimelineView extends TimelineView {
6
+ renderColgroup(): ReactNode;
7
+ renderBodySlots(): ReactNode;
8
+ renderHeaderSlots(): ReactNode;
9
+ calculateDate(timelineWidth: number, point: number): Dayjs;
10
+ calculateSlotWidth(timelineWidth: number): number;
11
+ calculatePosition(timelineWidth: number, start: Dayjs, end: Dayjs): Position;
12
+ }
@@ -0,0 +1,66 @@
1
+ import { Dayjs } from 'dayjs';
2
+ import { ReactNode } from 'react';
3
+ import { Option } from './option.ts';
4
+ import { ResourceApi } from './resource.ts';
5
+ import { PublicSchedulantApi } from './schedulant.ts';
6
+ import { Dictionary, MenuArg, MenuItems, MountArg, TimeStage } from './base.ts';
7
+ export type EventArg = {
8
+ eventApi: PublicEventApi;
9
+ schedulantApi: PublicSchedulantApi;
10
+ };
11
+ export type EventContextMenuItems = MenuItems;
12
+ export type EventMountArg = MountArg<EventArg & TimeStage>;
13
+ export type EventContextMenuArg = MenuArg<EventArg & TimeStage>;
14
+ export type EventResizeMountArg = MountArg<EventArg & {
15
+ date: Dayjs;
16
+ }>;
17
+ export type EventMoveMountArg = MountArg<EventArg & {
18
+ startDate: Dayjs;
19
+ endDate: Dayjs;
20
+ }>;
21
+ export type Event = {
22
+ id: string;
23
+ start: Dayjs;
24
+ title: string;
25
+ color: string;
26
+ resourceId: string;
27
+ end?: Dayjs;
28
+ url?: string;
29
+ tooltip?: ReactNode;
30
+ textColor?: string;
31
+ borderColor?: string;
32
+ backgroundColor?: string;
33
+ extendedProps?: Dictionary;
34
+ };
35
+ export declare class EventApi {
36
+ private event;
37
+ private resourceApi?;
38
+ constructor(event: Event);
39
+ setId(id: string): void;
40
+ getId(): string;
41
+ setTitle(title: string): void;
42
+ getTitle(): string;
43
+ setColor(color: string): void;
44
+ getColor(): string;
45
+ setStart(start: Dayjs): void;
46
+ getStart(): Dayjs;
47
+ setEnd(end: Dayjs): void;
48
+ getEnd(): Option<Dayjs>;
49
+ setResourceId(resourceId: string): void;
50
+ getResourceId(): string;
51
+ setResourceApi(resourceApi: ResourceApi): void;
52
+ getResourceApi(): ResourceApi;
53
+ setUrl(url: string): void;
54
+ getUrl(): Option<string>;
55
+ setTooltip(tooltip: React.ReactNode): void;
56
+ getTooltip(): React.ReactNode;
57
+ setTextColor(textColor: string): void;
58
+ getTextColor(): Option<string>;
59
+ setBorderColor(borderColor: string): void;
60
+ getBorderColor(): Option<string>;
61
+ setBackgroundColor(backgroundColor: string): void;
62
+ getBackgroundColor(): Option<string>;
63
+ setExtendedProps(extendedProps: Dictionary): void;
64
+ getExtendProps(): Option<Dictionary>;
65
+ }
66
+ export type PublicEventApi = Pick<EventApi, "getId" | "getTitle" | "getColor" | "getStart" | "getEnd" | "getResourceId" | "getResourceApi" | "getUrl" | "getTooltip" | "getTextColor" | "getBorderColor" | "getBackgroundColor" | "getExtendProps">;
@@ -0,0 +1,7 @@
1
+ export type { SchedulantProps, SchedulantMountArg, PublicSchedulantApi } from './schedulant.ts';
2
+ export type { Event, EventArg, EventMountArg, PublicEventApi, EventMoveMountArg, EventContextMenuArg, EventResizeMountArg, EventContextMenuItems } from './event.ts';
3
+ export type { Milestone, MilestoneArg, MilestoneStatus, MilestoneMountArg, PublicMilestoneApi, MilestoneMoveMountArg, MilestoneContextMenuArg, MilestoneContextMenuItems } from './milestone.ts';
4
+ export type { Checkpoint, CheckpointArg, CheckpointMountArg, PublicCheckpointApi, CheckpointMoveMountArg, CheckpointContextMenuArg, CheckpointContextMenuItems } from './checkpoint.ts';
5
+ export type { Resource, ResourceLaneArg, ResourceLabelArg, PublicResourceApi, ResourceAreaColumn, ResourceLaneMountArg, ResourceLabelMountArg, ResourceContextMenuItems, ResourceLaneContextMenuArg, ResourceLabelContextMenuArg } from './resource.ts';
6
+ export type { TimelineSlotArg, TimelineSlotLaneMountArg, TimelineSlotLabelMountArg } from './timeline.ts';
7
+ export type { SelectInfoArg } from './misc.ts';
@@ -0,0 +1,51 @@
1
+ import { Dayjs } from 'dayjs';
2
+ import { ReactNode } from 'react';
3
+ import { Option } from './option.ts';
4
+ import { ResourceApi } from './resource.ts';
5
+ import { PublicSchedulantApi } from './schedulant.ts';
6
+ import { Dictionary, MenuArg, MenuItems, MountArg, TimeStage } from './base.ts';
7
+ export type MilestoneArg = {
8
+ milestoneApi: PublicMilestoneApi;
9
+ schedulantApi: PublicSchedulantApi;
10
+ };
11
+ export type MilestoneContextMenuItems = MenuItems;
12
+ export type MilestoneStatus = "Success" | "Failure" | "Warning";
13
+ export type MilestoneMountArg = MountArg<MilestoneArg & TimeStage>;
14
+ export type MilestoneContextMenuArg = MenuArg<MilestoneArg & TimeStage>;
15
+ export type MilestoneMoveMountArg = MountArg<MilestoneArg & {
16
+ date: Dayjs;
17
+ }>;
18
+ export type Milestone = {
19
+ id: string;
20
+ time: Dayjs;
21
+ title: string;
22
+ status: MilestoneStatus;
23
+ resourceId: string;
24
+ color?: string;
25
+ tooltip?: ReactNode;
26
+ extendedProps?: Dictionary;
27
+ };
28
+ export declare class MilestoneApi {
29
+ private milestone;
30
+ private resourceApi?;
31
+ constructor(milestone: Milestone);
32
+ setId(id: string): void;
33
+ getId(): string;
34
+ setTitle(title: string): void;
35
+ getTitle(): string;
36
+ setTime(timestamp: Dayjs): void;
37
+ getTime(): Dayjs;
38
+ setStatus(status: MilestoneStatus): void;
39
+ getStatus(): MilestoneStatus;
40
+ setResourceApi(resourceApi: ResourceApi): void;
41
+ getResourceApi(): ResourceApi;
42
+ setResourceId(resourceId: string): void;
43
+ getResourceId(): string;
44
+ setColor(color: string): void;
45
+ getColor(): Option<string>;
46
+ setTooltip(tooltip: ReactNode): void;
47
+ getTooltip(): ReactNode;
48
+ setExtendedProps(extendedProps: Dictionary): void;
49
+ getExtendProps(): Option<Dictionary>;
50
+ }
51
+ export type PublicMilestoneApi = Pick<MilestoneApi, "getId" | "getTitle" | "getTime" | "getStatus" | "getResourceApi" | "getResourceId" | "getColor" | "getTooltip" | "getExtendProps">;
@@ -0,0 +1,8 @@
1
+ import { Dayjs } from 'dayjs';
2
+ import { MountArg } from './base.ts';
3
+ import { PublicResourceApi } from './resource.ts';
4
+ export type SelectInfoArg = MountArg<{
5
+ resourceApi: PublicResourceApi;
6
+ startDate: Dayjs;
7
+ endDate: Dayjs;
8
+ }>;
@@ -0,0 +1,12 @@
1
+ import { TimelineView } from './timeline-view.tsx';
2
+ import { Position } from './base.ts';
3
+ import { Dayjs } from 'dayjs';
4
+ import { ReactNode } from 'react';
5
+ export declare class MonthTimelineView extends TimelineView {
6
+ renderColgroup(): ReactNode;
7
+ renderBodySlots(): ReactNode;
8
+ renderHeaderSlots(): ReactNode;
9
+ calculateDate(timelineWidth: number, point: number): Dayjs;
10
+ calculateSlotWidth(timelineWidth: number): number;
11
+ calculatePosition(timelineWidth: number, start: Dayjs, end: Dayjs): Position;
12
+ }
@@ -0,0 +1,10 @@
1
+ export declare class Option<T> {
2
+ private readonly value;
3
+ private constructor();
4
+ static Some<T>(value: T): Option<T>;
5
+ static None<T>(): Option<T>;
6
+ static fromNullable<T>(value: T | null | undefined): Option<T>;
7
+ isDefined(): boolean;
8
+ get(): T;
9
+ getOrElse(defaultValue: T): T;
10
+ }
@@ -0,0 +1,12 @@
1
+ import { TimelineView } from './timeline-view.tsx';
2
+ import { ReactNode } from 'react';
3
+ import { Dayjs } from 'dayjs';
4
+ import { Position } from './base.ts';
5
+ export declare class QuarterTimelineView extends TimelineView {
6
+ renderColgroup(): ReactNode;
7
+ renderBodySlots(): ReactNode;
8
+ renderHeaderSlots(): ReactNode;
9
+ calculateDate(timelineWidth: number, point: number): Dayjs;
10
+ calculateSlotWidth(timelineWidth: number): number;
11
+ calculatePosition(timelineWidth: number, start: Dayjs, end: Dayjs): Position;
12
+ }
@@ -0,0 +1,85 @@
1
+ import { ReactNode } from 'react';
2
+ import { Option } from './option.ts';
3
+ import { EventApi } from './event.ts';
4
+ import { MilestoneApi } from './milestone';
5
+ import { CheckpointApi } from './checkpoint';
6
+ import { PublicSchedulantApi } from './schedulant.ts';
7
+ import { Dictionary, MenuArg, MenuItems, MountArg } from './base.ts';
8
+ export type ResourceLaneArg = {
9
+ label: ResourceAreaColumn;
10
+ resourceApi: PublicResourceApi;
11
+ schedulantApi: PublicSchedulantApi;
12
+ };
13
+ export interface ResourceLabelArg {
14
+ label: ResourceAreaColumn;
15
+ }
16
+ export type ResourceContextMenuItems = MenuItems;
17
+ export type ResourceAreaColumn = {
18
+ field: string;
19
+ headerContent: string;
20
+ };
21
+ export type ResourceLaneMountArg = MountArg<ResourceLaneArg>;
22
+ export type ResourceLabelMountArg = MountArg<ResourceLabelArg>;
23
+ export type ResourceLaneContextMenuArg = MenuArg<ResourceLaneArg>;
24
+ export type ResourceLabelContextMenuArg = MenuArg<ResourceLabelArg>;
25
+ export type Resource = {
26
+ id: string;
27
+ title: string;
28
+ tooltip?: ReactNode;
29
+ parentId?: string;
30
+ eventColor?: string;
31
+ eventTextColor?: string;
32
+ eventBorderColor?: string;
33
+ eventBackgroundColor?: string;
34
+ extendedProps?: Dictionary;
35
+ };
36
+ export declare class ResourceApi {
37
+ private depth;
38
+ private readonly resource;
39
+ private parent?;
40
+ private children;
41
+ private eventApis?;
42
+ private milestoneApis?;
43
+ private checkpointApis?;
44
+ constructor(resource: Resource);
45
+ setId(id: string): void;
46
+ getId(): string;
47
+ setTitle(title: string): void;
48
+ getTitle(): string;
49
+ setDepth(depth: number): void;
50
+ getDepth(): number;
51
+ setTooltip(tooltip: ReactNode): void;
52
+ getTooltip(): ReactNode;
53
+ setParent(parent?: ResourceApi): void;
54
+ getParent(): Option<ResourceApi>;
55
+ setParentId(parentId: string): void;
56
+ getParentId(): Option<string>;
57
+ setChildren(children: ResourceApi[]): void;
58
+ getChildren(): ResourceApi[];
59
+ setEventColor(color: string): void;
60
+ getEventColor(): Option<string>;
61
+ setEventTextColor(color: string): void;
62
+ getEventTextColor(): Option<string>;
63
+ setEventBorderColor(color: string): void;
64
+ getEventBorderColor(): Option<string>;
65
+ setEventBackgroundColor(color: string): void;
66
+ getEventBackgroundColor(): Option<string>;
67
+ getResource(): Resource;
68
+ setEventApis(eventApis: EventApi[]): void;
69
+ getEventApis(): EventApi[];
70
+ setMilestoneApis(milestoneApis: MilestoneApi[]): void;
71
+ getMilestoneApis(): MilestoneApi[];
72
+ setCheckpointApis(checkpointApis: CheckpointApi[]): void;
73
+ getCheckpointApis(): CheckpointApi[];
74
+ setExtendedProps(extendedProps: Dictionary): void;
75
+ getExtendProps(): Option<Dictionary>;
76
+ }
77
+ export declare class ResourceApiHelper {
78
+ static compare(prev: ResourceApi, next: ResourceApi): number;
79
+ static createTree(resources: Resource[], eventApis: EventApi[], milestoneApis: MilestoneApi[], checkpointApis: CheckpointApi[]): ResourceApi[];
80
+ static flatMapTree(resourceApis: ResourceApi[]): ResourceApi[];
81
+ }
82
+ export declare class ResourceUtils {
83
+ static createEmptyResources(count: number): Resource[];
84
+ }
85
+ export type PublicResourceApi = Pick<ResourceApi, "getId" | "getTitle" | "getDepth" | "getTooltip" | "getParent" | "getParentId" | "getChildren" | "getEventColor" | "getEventTextColor" | "getEventBorderColor" | "getEventBackgroundColor" | "getResource" | "getEventApis" | "getMilestoneApis" | "getCheckpointApis" | "getExtendProps">;
@@ -0,0 +1,20 @@
1
+ import { SchedulantApi, SchedulantProps } from './schedulant';
2
+ import { TimelineView } from './timeline-view.tsx';
3
+ import { MutableRefObject, ReactNode } from 'react';
4
+ export type SchedulantViewType = "Day" | "Week" | "Month" | "Quarter" | "Year";
5
+ export declare class SchedulantView {
6
+ private readonly schedulantApi;
7
+ private readonly timelineView;
8
+ private readonly schedulantElRef;
9
+ constructor(props: SchedulantProps, schedulantElRef: MutableRefObject<HTMLDivElement | null>);
10
+ renderTimelineTableColgroup(): ReactNode;
11
+ renderTimelineBodyTableSlots(): ReactNode;
12
+ renderTimelineHeaderTableSlots(): ReactNode;
13
+ renderTimelineDrawingBoardTable(collapseIds: Array<string>, timelineWidth: number): ReactNode;
14
+ renderResourceTableColgroup(): ReactNode;
15
+ renderResourceLabel(): ReactNode;
16
+ renderResourceLane(collapseIds: Array<string>): ReactNode;
17
+ getTimelineView(): TimelineView;
18
+ getScheduleApi(): SchedulantApi;
19
+ getScheduleElRef(): MutableRefObject<HTMLDivElement | null>;
20
+ }
@@ -0,0 +1,143 @@
1
+ import { Dayjs } from 'dayjs';
2
+ import { EventApi, Event, EventContextMenuArg, EventContextMenuItems, EventMountArg, EventMoveMountArg, EventResizeMountArg } from './event.ts';
3
+ import { Resource, ResourceApi, ResourceAreaColumn, ResourceContextMenuItems, ResourceLabelContextMenuArg, ResourceLabelMountArg, ResourceLaneContextMenuArg, ResourceLaneMountArg } from './resource.ts';
4
+ import { MilestoneApi, Milestone, MilestoneContextMenuArg, MilestoneContextMenuItems, MilestoneMountArg, MilestoneMoveMountArg } from './milestone.ts';
5
+ import { CheckpointApi, Checkpoint, CheckpointContextMenuArg, CheckpointContextMenuItems, CheckpointMountArg, CheckpointMoveMountArg } from './checkpoint.ts';
6
+ import { ContextMenuClickHandler, DidMountHandler, MountArg, MoveHandler, ResizeHandler, SelectHandler, WillUnmountHandler } from './base.ts';
7
+ import { Option } from './option.ts';
8
+ import { SelectInfoArg } from './misc';
9
+ import { SchedulantView, SchedulantViewType } from './schedulant-view.tsx';
10
+ import { TimelineApi, TimelineSlotLabelMountArg, TimelineSlotLaneMountArg } from './timeline';
11
+ import { MutableRefObject } from 'react';
12
+ export type SchedulantProps = {
13
+ end: Dayjs;
14
+ start: Dayjs;
15
+ editable: boolean;
16
+ selectable: boolean;
17
+ lineHeight: number;
18
+ slotMinWidth: number;
19
+ schedulantMaxHeight: number;
20
+ schedulantViewType: SchedulantViewType;
21
+ events: Event[];
22
+ resources: Resource[];
23
+ milestones?: Milestone[];
24
+ checkpoints?: Checkpoint[];
25
+ companyHolidays?: Dayjs[];
26
+ specialWorkdays?: Dayjs[];
27
+ nationalHolidays?: Dayjs[];
28
+ defaultEmptyLanes?: number;
29
+ resourceAreaWidth?: string;
30
+ resourceAreaColumns?: Array<ResourceAreaColumn>;
31
+ selectAllow?: SelectHandler<SelectInfoArg>;
32
+ enableEventContextMenu?: boolean;
33
+ eventContextMenuClick?: ContextMenuClickHandler<EventContextMenuArg>;
34
+ eventContextMenuItems?: EventContextMenuItems;
35
+ eventDidMount?: DidMountHandler<EventMountArg>;
36
+ eventWillUnmount?: WillUnmountHandler<EventMountArg>;
37
+ eventMove?: MoveHandler<EventMoveMountArg>;
38
+ eventResizeStart?: ResizeHandler<EventResizeMountArg>;
39
+ eventResizeEnd?: ResizeHandler<EventResizeMountArg>;
40
+ enableMilestoneContextMenu?: boolean;
41
+ milestoneContextMenuClick?: ContextMenuClickHandler<MilestoneContextMenuArg>;
42
+ milestoneContextMenuItems?: MilestoneContextMenuItems;
43
+ milestoneDidMount?: DidMountHandler<MilestoneMountArg>;
44
+ milestoneWillUnmount?: WillUnmountHandler<MilestoneMountArg>;
45
+ milestoneMove?: MoveHandler<MilestoneMoveMountArg>;
46
+ enableCheckpointContextMenu?: boolean;
47
+ checkpointContextMenuClick?: ContextMenuClickHandler<CheckpointContextMenuArg>;
48
+ checkpointContextMenuItems?: CheckpointContextMenuItems;
49
+ checkpointDidMount?: DidMountHandler<CheckpointMountArg>;
50
+ checkpointWillUnmount?: WillUnmountHandler<CheckpointMountArg>;
51
+ checkpointMove?: MoveHandler<CheckpointMoveMountArg>;
52
+ enableResourceLaneContextMenu?: boolean;
53
+ resourceLaneContextMenuClick?: ContextMenuClickHandler<ResourceLaneContextMenuArg>;
54
+ resourceLaneContextMenuItems?: ResourceContextMenuItems;
55
+ resourceLaneDidMount?: DidMountHandler<ResourceLaneMountArg>;
56
+ resourceLaneWillUnmount?: WillUnmountHandler<ResourceLaneMountArg>;
57
+ enableResourceLabelContextMenu?: boolean;
58
+ resourceLabelContextMenuClick?: ContextMenuClickHandler<ResourceLabelContextMenuArg>;
59
+ resourceLabelContextMenuItems?: ResourceContextMenuItems;
60
+ resourceLabelDidMount?: DidMountHandler<ResourceLabelMountArg>;
61
+ resourceLabelWillUnmount?: WillUnmountHandler<ResourceLabelMountArg>;
62
+ timelineSlotLabelDidMount?: DidMountHandler<TimelineSlotLabelMountArg>;
63
+ timelineSlotLabelWillUnmount?: WillUnmountHandler<TimelineSlotLabelMountArg>;
64
+ timelineSlotLaneDidMount?: DidMountHandler<TimelineSlotLaneMountArg>;
65
+ timelineSlotLaneWillUnmount?: WillUnmountHandler<TimelineSlotLaneMountArg>;
66
+ schedulantDidMount?: DidMountHandler<SchedulantMountArg>;
67
+ schedulantWillUnmount?: DidMountHandler<SchedulantMountArg>;
68
+ };
69
+ export declare class SchedulantApi implements PublicSchedulantApi {
70
+ private readonly schedulantProps;
71
+ private readonly schedulantView;
72
+ private readonly timelineApi;
73
+ private readonly eventApis;
74
+ private readonly resourceApis;
75
+ private readonly flatMapResourceApis;
76
+ private readonly milestoneApis;
77
+ private readonly checkpointApis;
78
+ private generateTimelineApi;
79
+ constructor(schedulantView: SchedulantView, props: SchedulantProps);
80
+ getProps(): SchedulantProps;
81
+ getStart(): Dayjs;
82
+ getEnd(): Dayjs;
83
+ getLineHeight(): number;
84
+ getSlotMinWidth(): number;
85
+ getSchedulantMaxHeight(): number;
86
+ getScheduleView(): SchedulantView;
87
+ getSchedulantViewType(): SchedulantViewType;
88
+ getResourceAreaColumns(): ResourceAreaColumn[];
89
+ getTimelineApi(): TimelineApi;
90
+ getEventApis(): EventApi[];
91
+ getEventApiById(eventId: string): Option<EventApi>;
92
+ getResourceApis(): ResourceApi[];
93
+ getResourceApiById(resourceId: string): Option<ResourceApi>;
94
+ getFlatMapResourceApis(): ResourceApi[];
95
+ isEditable(): boolean;
96
+ isSelectable(): boolean;
97
+ getMilestoneApis(): MilestoneApi[];
98
+ getMilestoneApiById(milestoneId: string): Option<MilestoneApi>;
99
+ getCheckpointApis(): CheckpointApi[];
100
+ getCheckpointApiById(checkpointId: string): Option<CheckpointApi>;
101
+ getSchedulantElRef(): MutableRefObject<HTMLDivElement | null>;
102
+ eventDidMount(arg: EventMountArg): void;
103
+ eventWillUnmount(arg: EventMountArg): void;
104
+ eventMove(arg: EventMoveMountArg): void;
105
+ eventResizeStart(arg: EventResizeMountArg): void;
106
+ eventResizeEnd(arg: EventResizeMountArg): void;
107
+ selectAllow(arg: SelectInfoArg): void;
108
+ isEnableEventContextMenu(): boolean;
109
+ getEventContextMenuItems(): import('antd/es/menu/interface').ItemType[] | undefined;
110
+ onEventContextMenuClick(arg: EventContextMenuArg): void;
111
+ resourceLaneDidMount(arg: ResourceLaneMountArg): void;
112
+ resourceLaneWillUnmount(arg: ResourceLaneMountArg): void;
113
+ isEnableResourceLaneContextMenu(): boolean;
114
+ getResourceLaneContextMenuItems(): import('antd/es/menu/interface').ItemType[] | undefined;
115
+ onResourceLaneContextMenuClick(arg: ResourceLaneContextMenuArg): void;
116
+ resourceLabelDidMount(arg: ResourceLabelMountArg): void;
117
+ resourceLabelWillUnmount(arg: ResourceLabelMountArg): void;
118
+ isEnableResourceLabelContextMenu(): boolean;
119
+ getResourceLabelContextMenuItems(): import('antd/es/menu/interface').ItemType[] | undefined;
120
+ onResourceLabelContextMenuClick(arg: ResourceLabelContextMenuArg): void;
121
+ milestoneDidMount(arg: MilestoneMountArg): void;
122
+ milestoneWillUnmount(arg: MilestoneMountArg): void;
123
+ isEnableMilestoneContextMenu(): boolean;
124
+ getMilestoneContextMenuItems(): import('antd/es/menu/interface').ItemType[] | undefined;
125
+ onMilestoneContextMenuClick(arg: MilestoneContextMenuArg): void;
126
+ milestoneMove(arg: MilestoneMoveMountArg): void;
127
+ checkpointDidMount(arg: CheckpointMountArg): void;
128
+ checkpointWillUnmount(arg: CheckpointMountArg): void;
129
+ isEnableCheckpointContextMenu(): boolean;
130
+ getCheckpointContextMenuItems(): import('antd/es/menu/interface').ItemType[] | undefined;
131
+ onCheckpointContextMenuClick(arg: CheckpointContextMenuArg): void;
132
+ checkpointMove(arg: CheckpointMoveMountArg): void;
133
+ timelineSlotLaneDidMount(arg: TimelineSlotLaneMountArg): void;
134
+ timelineSlotLaneWillUnmount(arg: TimelineSlotLaneMountArg): void;
135
+ timelineSlotLabelDidMount(arg: TimelineSlotLabelMountArg): void;
136
+ timelineSlotLabelWillUnmount(arg: TimelineSlotLabelMountArg): void;
137
+ schedulantDidMount(arg: SchedulantMountArg): void;
138
+ schedulantWillUnmount(arg: SchedulantMountArg): void;
139
+ }
140
+ export type PublicSchedulantApi = Pick<SchedulantApi, "getEnd" | "getStart" | "isEditable" | "isSelectable" | "getLineHeight" | "getSlotMinWidth" | "getSchedulantMaxHeight">;
141
+ export type SchedulantMountArg = MountArg<{
142
+ schedulantApi: PublicSchedulantApi;
143
+ }>;
@@ -0,0 +1,24 @@
1
+ import { SchedulantApi } from './schedulant.ts';
2
+ import { ResourceApi } from './resource.ts';
3
+ import { TimelineApi } from './timeline.ts';
4
+ import { ReactNode } from 'react';
5
+ import { Dayjs } from 'dayjs';
6
+ import { Position } from './base.ts';
7
+ export declare abstract class TimelineView {
8
+ private readonly schedulantApi;
9
+ constructor(schedulantApi: SchedulantApi);
10
+ getSchedulantApi(): SchedulantApi;
11
+ getTimelineApi(): TimelineApi;
12
+ renderLane(resourceApi: ResourceApi, timelineWidth: number): ReactNode;
13
+ renderEvents(resourceApi: ResourceApi, timelineWidth: number): ReactNode;
14
+ renderMilestones(resource: ResourceApi, timelineWidth: number): ReactNode;
15
+ renderCheckpoints(resource: ResourceApi, timelineWidth: number): ReactNode;
16
+ calculateLaneHeight(resourceApi: ResourceApi): number;
17
+ calculateEventHeight(): number;
18
+ abstract renderColgroup(): ReactNode;
19
+ abstract renderBodySlots(): ReactNode;
20
+ abstract renderHeaderSlots(): ReactNode;
21
+ abstract calculateDate(timelineWidth: number, point: number): Dayjs;
22
+ abstract calculateSlotWidth(timelineWidth: number): number;
23
+ abstract calculatePosition(timelineWidth: number, start: Dayjs, end: Dayjs): Position;
24
+ }
@@ -0,0 +1,75 @@
1
+ import { Dayjs } from 'dayjs';
2
+ import { MountArg, TimeStage } from './base.ts';
3
+ import { PublicSchedulantApi } from './schedulant.ts';
4
+ import { SchedulantViewType } from './schedulant-view.tsx';
5
+ export type TimelineSlotArg = {
6
+ schedulantApi: PublicSchedulantApi;
7
+ date: Dayjs;
8
+ level?: number;
9
+ timeText?: string;
10
+ slotType: SchedulantViewType;
11
+ };
12
+ export type TimelineSlotLaneMountArg = MountArg<TimelineSlotArg & TimeStage>;
13
+ export type TimelineSlotLabelMountArg = MountArg<TimelineSlotArg & TimeStage>;
14
+ export type TimelineData = {
15
+ days: Dayjs[];
16
+ weeks: Record<string, Dayjs[]>;
17
+ months: Record<string, Dayjs[]>;
18
+ quarters: Record<string, Dayjs[]>;
19
+ years: Record<string, Dayjs[]>;
20
+ };
21
+ export declare class TimelineApi {
22
+ private start;
23
+ private end;
24
+ private timelineData;
25
+ private specialWorkdays?;
26
+ private companyHolidays?;
27
+ private nationalHolidays?;
28
+ private generateTimelineData;
29
+ constructor(start: Dayjs, end: Dayjs);
30
+ setStart(start: Dayjs): void;
31
+ getStart(): Dayjs;
32
+ setEnd(end: Dayjs): void;
33
+ getEnd(): Dayjs;
34
+ getDays(): Dayjs[];
35
+ getWeeks(): Dayjs[];
36
+ getMonths(): Dayjs[];
37
+ getQuarters(): Dayjs[];
38
+ getYears(): Dayjs[];
39
+ setSpecialWorkdays(specialWorkdays: Dayjs[]): void;
40
+ getSpecialWorkdays(): Dayjs[];
41
+ setCompanyHolidays(companyHolidays: Dayjs[]): void;
42
+ getCompanyHolidays(): Dayjs[];
43
+ setNationalHolidays(nationalHolidays: Dayjs[]): void;
44
+ getNationalHolidays(): Dayjs[];
45
+ isWeekend(target: Dayjs): boolean;
46
+ isHoliday(target: Dayjs): boolean;
47
+ isSpecialWorkday(target: Dayjs): boolean;
48
+ isCompanyHoliday(target: Dayjs): boolean;
49
+ isNationalHoliday(target: Dayjs): boolean;
50
+ getDayPosition(target: Dayjs): number;
51
+ getWeekPosition(target: Dayjs): number;
52
+ getMonthPosition(target: Dayjs): number;
53
+ getQuarterPosition(target: Dayjs): number;
54
+ getYearPosition(target: Dayjs): number;
55
+ populateMonthsWithDays(): Array<{
56
+ month: Dayjs;
57
+ days: Dayjs[];
58
+ }>;
59
+ populateYearsWithDays(): Array<{
60
+ year: Dayjs;
61
+ days: Dayjs[];
62
+ }>;
63
+ populateYearsWithWeeks(): Array<{
64
+ year: Dayjs;
65
+ weeks: Dayjs[];
66
+ }>;
67
+ populateYearsWithMonths(): Array<{
68
+ year: Dayjs;
69
+ months: Dayjs[];
70
+ }>;
71
+ populateYearsWithQuarters(): Array<{
72
+ year: Dayjs;
73
+ quarters: Dayjs[];
74
+ }>;
75
+ }
@@ -0,0 +1,12 @@
1
+ import { TimelineView } from './timeline-view.tsx';
2
+ import { ReactNode } from 'react';
3
+ import { Dayjs } from 'dayjs';
4
+ import { Position } from './base.ts';
5
+ export declare class WeekTimelineView extends TimelineView {
6
+ renderColgroup(): ReactNode;
7
+ renderBodySlots(): ReactNode;
8
+ renderHeaderSlots(): ReactNode;
9
+ calculateDate(timelineWidth: number, point: number): Dayjs;
10
+ calculateSlotWidth(timelineWidth: number): number;
11
+ calculatePosition(timelineWidth: number, start: Dayjs, end: Dayjs): Position;
12
+ }
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ import { TimelineView } from './timeline-view';
3
+ import { Dayjs } from 'dayjs';
4
+ import { Position } from './base.ts';
5
+ export declare class YearTimelineView extends TimelineView {
6
+ renderColgroup(): ReactNode;
7
+ renderBodySlots(): ReactNode;
8
+ renderHeaderSlots(): ReactNode;
9
+ calculateDate(timelineWidth: number, point: number): Dayjs;
10
+ calculateSlotWidth(timelineWidth: number): number;
11
+ calculatePosition(timelineWidth: number, start: Dayjs, end: Dayjs): Position;
12
+ }
@@ -0,0 +1 @@
1
+ export declare const groupBy: <T>(arr: T[], func: (item: T) => string) => Record<string, T[]>;
@@ -0,0 +1,3 @@
1
+ export declare const extractNumber: (value: string) => number;
2
+ export declare const numberToPixels: (value: number) => string;
3
+ export declare const pixelsToNumber: (value: string) => number;