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