UNPKG

3.89 kBTypeScriptView Raw
1/// <reference types="react" />
2export declare enum ViewMode {
3 Hour = "Hour",
4 QuarterDay = "Quarter Day",
5 HalfDay = "Half Day",
6 Day = "Day",
7 /** ISO-8601 week */
8 Week = "Week",
9 Month = "Month",
10 Year = "Year"
11}
12export declare type TaskType = "task" | "milestone" | "project";
13export interface Task {
14 id: string;
15 type: TaskType;
16 name: string;
17 start: Date;
18 end: Date;
19 /**
20 * From 0 to 100
21 */
22 progress: number;
23 styles?: {
24 backgroundColor?: string;
25 backgroundSelectedColor?: string;
26 progressColor?: string;
27 progressSelectedColor?: string;
28 };
29 isDisabled?: boolean;
30 project?: string;
31 dependencies?: string[];
32 hideChildren?: boolean;
33 displayOrder?: number;
34}
35export interface EventOption {
36 /**
37 * Time step value for date changes.
38 */
39 timeStep?: number;
40 /**
41 * Invokes on bar select on unselect.
42 */
43 onSelect?: (task: Task, isSelected: boolean) => void;
44 /**
45 * Invokes on bar double click.
46 */
47 onDoubleClick?: (task: Task) => void;
48 /**
49 * Invokes on bar click.
50 */
51 onClick?: (task: Task) => void;
52 /**
53 * Invokes on end and start time change. Chart undoes operation if method return false or error.
54 */
55 onDateChange?: (task: Task, children: Task[]) => void | boolean | Promise<void> | Promise<boolean>;
56 /**
57 * Invokes on progress change. Chart undoes operation if method return false or error.
58 */
59 onProgressChange?: (task: Task, children: Task[]) => void | boolean | Promise<void> | Promise<boolean>;
60 /**
61 * Invokes on delete selected task. Chart undoes operation if method return false or error.
62 */
63 onDelete?: (task: Task) => void | boolean | Promise<void> | Promise<boolean>;
64 /**
65 * Invokes on expander on task list
66 */
67 onExpanderClick?: (task: Task) => void;
68}
69export interface DisplayOption {
70 viewMode?: ViewMode;
71 viewDate?: Date;
72 preStepsCount?: number;
73 /**
74 * Specifies the month name language. Able formats: ISO 639-2, Java Locale
75 */
76 locale?: string;
77 rtl?: boolean;
78}
79export interface StylingOption {
80 headerHeight?: number;
81 columnWidth?: number;
82 listCellWidth?: string;
83 rowHeight?: number;
84 ganttHeight?: number;
85 barCornerRadius?: number;
86 handleWidth?: number;
87 fontFamily?: string;
88 fontSize?: string;
89 /**
90 * How many of row width can be taken by task.
91 * From 0 to 100
92 */
93 barFill?: number;
94 barProgressColor?: string;
95 barProgressSelectedColor?: string;
96 barBackgroundColor?: string;
97 barBackgroundSelectedColor?: string;
98 projectProgressColor?: string;
99 projectProgressSelectedColor?: string;
100 projectBackgroundColor?: string;
101 projectBackgroundSelectedColor?: string;
102 milestoneBackgroundColor?: string;
103 milestoneBackgroundSelectedColor?: string;
104 arrowColor?: string;
105 arrowIndent?: number;
106 todayColor?: string;
107 TooltipContent?: React.FC<{
108 task: Task;
109 fontSize: string;
110 fontFamily: string;
111 }>;
112 TaskListHeader?: React.FC<{
113 headerHeight: number;
114 rowWidth: string;
115 fontFamily: string;
116 fontSize: string;
117 }>;
118 TaskListTable?: React.FC<{
119 rowHeight: number;
120 rowWidth: string;
121 fontFamily: string;
122 fontSize: string;
123 locale: string;
124 tasks: Task[];
125 selectedTaskId: string;
126 /**
127 * Sets selected task by id
128 */
129 setSelectedTask: (taskId: string) => void;
130 onExpanderClick: (task: Task) => void;
131 }>;
132}
133export interface GanttProps extends EventOption, DisplayOption, StylingOption {
134 tasks: Task[];
135}