gantt-task-react/src/types/public-types.ts

127 lines
3.0 KiB
TypeScript
Raw Normal View History

2020-07-22 20:50:43 +03:00
export enum ViewMode {
2020-08-05 08:14:22 +03:00
QuarterDay = "Quarter Day",
HalfDay = "Half Day",
Day = "Day",
2020-07-22 20:50:43 +03:00
/** ISO-8601 week */
2020-08-05 08:14:22 +03:00
Week = "Week",
Month = "Month",
2020-07-22 20:50:43 +03:00
}
2021-03-27 21:05:38 +02:00
export type TaskType = "task" | "milestone" | "project";
2020-07-22 20:50:43 +03:00
export interface Task {
id: string;
2021-03-01 21:55:27 +02:00
type: TaskType;
2020-07-22 20:50:43 +03:00
name: string;
start: Date;
end: Date;
/**
* From 0 to 100
*/
progress: number;
styles?: {
backgroundColor?: string;
backgroundSelectedColor?: string;
progressColor?: string;
progressSelectedColor?: string;
};
isDisabled?: boolean;
2021-03-27 21:05:38 +02:00
project?: string;
2020-07-22 20:50:43 +03:00
dependencies?: string[];
}
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.
*/
2020-08-11 01:16:53 +03:00
onDoubleClick?: (task: Task) => void;
/**
* Invokes on end and start time change. Chart undoes operation if method return false or error.
*/
onDateChange?: (
task: Task
) => void | boolean | Promise<void> | Promise<boolean>;
/**
* Invokes on progress change. Chart undoes operation if method return false or error.
*/
onProgressChange?: (
task: Task
) => void | boolean | Promise<void> | Promise<boolean>;
/**
* Invokes on delete selected task. Chart undoes operation if method return false or error.
*/
2021-03-27 21:05:38 +02:00
onDelete?: (task: Task) => void | boolean | Promise<void> | Promise<boolean>;
2020-07-22 20:50:43 +03:00
}
export interface DisplayOption {
viewMode?: ViewMode;
/**
2020-07-24 10:14:18 +03:00
* Specifies the month name language. Able formats: ISO 639-2, Java Locale
2020-07-22 20:50:43 +03:00
*/
locale?: string;
}
export interface StylingOption {
headerHeight?: number;
columnWidth?: number;
listCellWidth?: string;
2020-07-22 20:50:43 +03:00
rowHeight?: number;
ganttHeight?: number;
2020-07-22 20:50:43 +03:00
barCornerRadius?: number;
handleWidth?: number;
fontFamily?: string;
fontSize?: string;
/**
* How many of row width can be taken by task.
* From 0 to 100
*/
barFill?: number;
2020-07-30 00:01:51 +03:00
barProgressColor?: string;
barProgressSelectedColor?: string;
barBackgroundColor?: string;
barBackgroundSelectedColor?: string;
2021-03-28 16:12:28 +03:00
projectProgressColor?: string;
projectProgressSelectedColor?: string;
projectBackgroundColor?: string;
projectBackgroundSelectedColor?: string;
2021-03-01 21:55:27 +02:00
milestoneBackgroundColor?: string;
milestoneBackgroundSelectedColor?: string;
2020-07-22 20:50:43 +03:00
arrowColor?: string;
arrowIndent?: number;
2020-07-30 00:01:51 +03:00
todayColor?: string;
TooltipContent?: React.FC<{
task: Task;
fontSize: string;
fontFamily: string;
}>;
2020-08-23 22:44:51 +03:00
TaskListHeader?: React.FC<{
headerHeight: number;
rowWidth: string;
fontFamily: string;
fontSize: string;
}>;
2020-08-23 22:44:51 +03:00
TaskListTable?: React.FC<{
rowHeight: number;
rowWidth: string;
fontFamily: string;
fontSize: string;
locale: string;
tasks: Task[];
2020-09-15 23:23:09 +03:00
selectedTaskId: string;
2020-09-15 23:34:30 +03:00
/**
* Sets selected task by id
*/
2020-09-15 23:23:09 +03:00
setSelectedTask: (taskId: string) => void;
}>;
2020-07-22 20:50:43 +03:00
}
export interface GanttProps extends EventOption, DisplayOption, StylingOption {
tasks: Task[];
}