@ssfm/gantt-task-react 0.6.17

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 (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +197 -0
  3. package/dist/change-metadata/get-dependent-tasks.d.ts +3 -0
  4. package/dist/change-metadata/get-task-indexes.d.ts +9 -0
  5. package/dist/components/calendar/calendar.d.ts +19 -0
  6. package/dist/components/calendar/default-render-bottom-header.d.ts +3 -0
  7. package/dist/components/calendar/default-render-top-header.d.ts +2 -0
  8. package/dist/components/calendar/top-part-of-calendar.d.ts +14 -0
  9. package/dist/components/context-menu/index.d.ts +14 -0
  10. package/dist/components/context-menu/menu-option.d.ts +10 -0
  11. package/dist/components/gantt/default-check-is-holiday.d.ts +2 -0
  12. package/dist/components/gantt/default-get-copied-task-id.d.ts +2 -0
  13. package/dist/components/gantt/default-round-date.d.ts +2 -0
  14. package/dist/components/gantt/default-round-end-date.d.ts +2 -0
  15. package/dist/components/gantt/default-round-start-date.d.ts +2 -0
  16. package/dist/components/gantt/gantt.d.ts +3 -0
  17. package/dist/components/gantt/task-gantt-content.d.ts +49 -0
  18. package/dist/components/gantt/task-gantt.d.ts +22 -0
  19. package/dist/components/gantt/use-context-menu.d.ts +7 -0
  20. package/dist/components/gantt/use-create-relation.d.ts +16 -0
  21. package/dist/components/gantt/use-get-task-current-state.d.ts +14 -0
  22. package/dist/components/gantt/use-handle-action.d.ts +20 -0
  23. package/dist/components/gantt/use-holidays.d.ts +14 -0
  24. package/dist/components/gantt/use-horizontal-scrollbars.d.ts +2 -0
  25. package/dist/components/gantt/use-selection.d.ts +18 -0
  26. package/dist/components/gantt/use-tablelist-resize.d.ts +2 -0
  27. package/dist/components/gantt/use-task-drag.d.ts +25 -0
  28. package/dist/components/gantt/use-vertical-scrollbars.d.ts +2 -0
  29. package/dist/components/grid/grid-body.d.ts +19 -0
  30. package/dist/components/grid/grid.d.ts +4 -0
  31. package/dist/components/other/arrow.d.ts +27 -0
  32. package/dist/components/other/bar-fix-width.d.ts +13 -0
  33. package/dist/components/other/fix-dependency-position.d.ts +14 -0
  34. package/dist/components/other/relation-line.d.ts +9 -0
  35. package/dist/components/other/tooltip.d.ts +24 -0
  36. package/dist/components/task-item/bar/bar-date-handle.d.ts +12 -0
  37. package/dist/components/task-item/bar/bar-display.d.ts +19 -0
  38. package/dist/components/task-item/bar/bar-progress-handle.d.ts +8 -0
  39. package/dist/components/task-item/bar/bar-relation-handle.d.ts +11 -0
  40. package/dist/components/task-item/bar/bar-small.d.ts +6 -0
  41. package/dist/components/task-item/bar/bar.d.ts +6 -0
  42. package/dist/components/task-item/milestone/milestone.d.ts +6 -0
  43. package/dist/components/task-item/project/project-display.d.ts +21 -0
  44. package/dist/components/task-item/task-item.d.ts +41 -0
  45. package/dist/components/task-item/task-warning.d.ts +14 -0
  46. package/dist/components/task-list/TaskListHeaderActions.d.ts +9 -0
  47. package/dist/components/task-list/columns/add-column.d.ts +3 -0
  48. package/dist/components/task-list/columns/date-end-column.d.ts +3 -0
  49. package/dist/components/task-list/columns/date-start-column.d.ts +3 -0
  50. package/dist/components/task-list/columns/delete-column.d.ts +3 -0
  51. package/dist/components/task-list/columns/dependencies-column.d.ts +3 -0
  52. package/dist/components/task-list/columns/edit-column.d.ts +3 -0
  53. package/dist/components/task-list/columns/title-column.d.ts +3 -0
  54. package/dist/components/task-list/task-list-header.d.ts +4 -0
  55. package/dist/components/task-list/task-list-table-row.d.ts +40 -0
  56. package/dist/components/task-list/task-list-table.d.ts +3 -0
  57. package/dist/components/task-list/task-list.d.ts +80 -0
  58. package/dist/constants.d.ts +2 -0
  59. package/dist/context-menu-options/copy.d.ts +2 -0
  60. package/dist/context-menu-options/cut.d.ts +2 -0
  61. package/dist/context-menu-options/delete.d.ts +2 -0
  62. package/dist/context-menu-options/index.d.ts +4 -0
  63. package/dist/context-menu-options/paste.d.ts +2 -0
  64. package/dist/gantt-task-react.es.js +12936 -0
  65. package/dist/gantt-task-react.umd.js +12949 -0
  66. package/dist/helpers/adjust-task-to-working-dates.d.ts +12 -0
  67. package/dist/helpers/bar-helper.d.ts +11 -0
  68. package/dist/helpers/check-has-children.d.ts +2 -0
  69. package/dist/helpers/check-is-descendant.d.ts +2 -0
  70. package/dist/helpers/check-task-has-dependency-warning.d.ts +2 -0
  71. package/dist/helpers/collect-parents.d.ts +2 -0
  72. package/dist/helpers/collect-visible-tasks.d.ts +2 -0
  73. package/dist/helpers/compare-dates.d.ts +1 -0
  74. package/dist/helpers/copy-tasks.d.ts +2 -0
  75. package/dist/helpers/count-holidays.d.ts +2 -0
  76. package/dist/helpers/date-helper.d.ts +4 -0
  77. package/dist/helpers/generate-triangle-points.d.ts +1 -0
  78. package/dist/helpers/get-all-descendants.d.ts +2 -0
  79. package/dist/helpers/get-change-task-metadata.d.ts +13 -0
  80. package/dist/helpers/get-child-out-of-parent-warnings.d.ts +2 -0
  81. package/dist/helpers/get-childs-and-roots.d.ts +5 -0
  82. package/dist/helpers/get-critical-path.d.ts +2 -0
  83. package/dist/helpers/get-date-by-offset.d.ts +2 -0
  84. package/dist/helpers/get-dates-diff.d.ts +2 -0
  85. package/dist/helpers/get-dependency-map-and-warnings.d.ts +2 -0
  86. package/dist/helpers/get-initial-closed-tasks.d.ts +2 -0
  87. package/dist/helpers/get-map-task-to-coordinates.d.ts +6 -0
  88. package/dist/helpers/get-map-task-to-global-index.d.ts +5 -0
  89. package/dist/helpers/get-map-task-to-nested-index.d.ts +2 -0
  90. package/dist/helpers/get-map-task-to-row-index.d.ts +10 -0
  91. package/dist/helpers/get-previous-next-working-date.d.ts +3 -0
  92. package/dist/helpers/get-relation-circle-by-coordinates.d.ts +2 -0
  93. package/dist/helpers/get-task-coordinates.d.ts +4 -0
  94. package/dist/helpers/get-task-row-index.d.ts +2 -0
  95. package/dist/helpers/get-task-to-has-dependency-warning-map.d.ts +2 -0
  96. package/dist/helpers/get-tasks-map.d.ts +5 -0
  97. package/dist/helpers/round-task-dates.d.ts +7 -0
  98. package/dist/helpers/sort-tasks.d.ts +2 -0
  99. package/dist/helpers/use-optimized-list.d.ts +24 -0
  100. package/dist/helpers/use-task-tooltip.d.ts +12 -0
  101. package/dist/index.d.ts +13 -0
  102. package/dist/selected-tasks/get-parent-tasks.d.ts +2 -0
  103. package/dist/selected-tasks/get-selected-tasks.d.ts +2 -0
  104. package/dist/selected-tasks/get-tasks-with-descendants.d.ts +2 -0
  105. package/dist/style.css +563 -0
  106. package/dist/suggestions/change-start-and-end-descendants.d.ts +10 -0
  107. package/dist/test/date-helper.test.d.ts +1 -0
  108. package/dist/test/gant.test.d.ts +1 -0
  109. package/dist/types/gantt-task-actions.d.ts +9 -0
  110. package/dist/types/public-types.d.ts +845 -0
  111. package/package.json +133 -0
@@ -0,0 +1,845 @@
1
+ import type { ComponentType, MouseEvent, ReactNode } from "react";
2
+ import type { Locale as DateLocale } from "date-fns";
3
+ import { OptimizedListParams } from "../helpers/use-optimized-list";
4
+ import { TaskListHeaderActionsProps } from "../components/task-list/TaskListHeaderActions";
5
+ export declare enum ViewMode {
6
+ Hour = "Hour",
7
+ QuarterDay = "Quarter Day",
8
+ HalfDay = "Half Day",
9
+ Day = "Day",
10
+ TwoDays = "Two Days",
11
+ /** ISO-8601 week */
12
+ Week = "Week",
13
+ Month = "Month",
14
+ QuarterYear = "QuarterYear",
15
+ Year = "Year"
16
+ }
17
+ export interface DateSetup {
18
+ dateFormats: DateFormats;
19
+ dateLocale: DateLocale;
20
+ isUnknownDates: boolean;
21
+ preStepsCount: number;
22
+ viewMode: ViewMode;
23
+ }
24
+ export type RenderTopHeader = (date: Date, viewMode: ViewMode, dateSetup: DateSetup) => ReactNode;
25
+ export type RenderBottomHeader = (date: Date, viewMode: ViewMode, dateSetup: DateSetup, index: number, isUnknownDates: boolean) => ReactNode;
26
+ export interface Dependency {
27
+ sourceId: string;
28
+ sourceTarget: DateExtremity;
29
+ ownTarget: DateExtremity;
30
+ }
31
+ export interface ExpandedDependency {
32
+ containerHeight: number;
33
+ containerY: number;
34
+ innerFromY: number;
35
+ innerToY: number;
36
+ marginBetweenTasks: number | null;
37
+ ownTarget: DateExtremity;
38
+ source: Task;
39
+ sourceTarget: DateExtremity;
40
+ }
41
+ export interface ExpandedDependent {
42
+ containerHeight: number;
43
+ containerY: number;
44
+ innerFromY: number;
45
+ innerToY: number;
46
+ marginBetweenTasks: number | null;
47
+ dependent: Task;
48
+ dependentTarget: DateExtremity;
49
+ ownTarget: DateExtremity;
50
+ }
51
+ export interface ColorStyles {
52
+ arrowColor: string;
53
+ arrowCriticalColor: string;
54
+ arrowWarningColor: string;
55
+ barLabelColor: string;
56
+ barLabelWhenOutsideColor: string;
57
+ barProgressColor: string;
58
+ barProgressCriticalColor: string;
59
+ barProgressSelectedColor: string;
60
+ barProgressSelectedCriticalColor: string;
61
+ barBackgroundColor: string;
62
+ barBackgroundCriticalColor: string;
63
+ barBackgroundSelectedColor: string;
64
+ barBackgroundSelectedCriticalColor: string;
65
+ groupProgressColor: string;
66
+ groupProgressCriticalColor: string;
67
+ groupProgressSelectedColor: string;
68
+ groupProgressSelectedCriticalColor: string;
69
+ groupBackgroundColor: string;
70
+ groupBackgroundCriticalColor: string;
71
+ groupBackgroundSelectedColor: string;
72
+ groupBackgroundSelectedCriticalColor: string;
73
+ projectProgressColor: string;
74
+ projectProgressCriticalColor: string;
75
+ projectProgressSelectedColor: string;
76
+ projectProgressSelectedCriticalColor: string;
77
+ projectBackgroundColor: string;
78
+ projectBackgroundCriticalColor: string;
79
+ projectBackgroundSelectedColor: string;
80
+ projectBackgroundSelectedCriticalColor: string;
81
+ milestoneBackgroundColor: string;
82
+ milestoneBackgroundCriticalColor: string;
83
+ milestoneBackgroundSelectedColor: string;
84
+ milestoneBackgroundSelectedCriticalColor: string;
85
+ evenTaskBackgroundColor: string;
86
+ oddTaskBackgroundColor: string;
87
+ holidayBackgroundColor: string;
88
+ taskDragColor: string;
89
+ selectedTaskBackgroundColor: string;
90
+ todayColor: string;
91
+ contextMenuBoxShadow: string;
92
+ contextMenuBgColor: string;
93
+ contextMenuTextColor: string;
94
+ }
95
+ /**
96
+ * date-fns formats
97
+ */
98
+ export interface DateFormats {
99
+ dateColumnFormat: string;
100
+ dayBottomHeaderFormat: string;
101
+ dayTopHeaderFormat: string;
102
+ hourBottomHeaderFormat: string;
103
+ monthBottomHeaderFormat: string;
104
+ monthTopHeaderFormat: string;
105
+ }
106
+ export interface Distances {
107
+ actionColumnWidth: number;
108
+ arrowIndent: number;
109
+ barCornerRadius: number;
110
+ /**
111
+ * How many of row width can be taken by task.
112
+ * From 0 to 100
113
+ */
114
+ barFill: number;
115
+ columnWidth: number;
116
+ contextMenuIconWidth: number;
117
+ contextMenuOptionHeight: number;
118
+ contextMenuSidePadding: number;
119
+ dateCellWidth: number;
120
+ dependenciesCellWidth: number;
121
+ dependencyFixHeight: number;
122
+ dependencyFixIndent: number;
123
+ dependencyFixWidth: number;
124
+ expandIconWidth: number;
125
+ handleWidth: number;
126
+ headerHeight: number;
127
+ minimumRowDisplayed: number;
128
+ nestedTaskNameOffset: number;
129
+ relationCircleOffset: number;
130
+ relationCircleRadius: number;
131
+ rowHeight: number;
132
+ tableWidth?: number;
133
+ taskWarningOffset: number;
134
+ titleCellWidth: number;
135
+ }
136
+ export type TaskType = "task" | "milestone" | "project";
137
+ export interface Task {
138
+ id: string;
139
+ type: TaskType;
140
+ name: string;
141
+ start: Date;
142
+ end: Date;
143
+ /**
144
+ * From 0 to 100
145
+ */
146
+ progress: number;
147
+ assignees?: string[];
148
+ styles?: Partial<ColorStyles>;
149
+ isDisabled?: boolean;
150
+ isRelationDisabled?: boolean;
151
+ /**
152
+ * Project or task
153
+ */
154
+ parent?: string;
155
+ dependencies?: Dependency[];
156
+ hideChildren?: boolean;
157
+ displayOrder?: number;
158
+ comparisonLevel?: number;
159
+ }
160
+ export interface EmptyTask {
161
+ id: string;
162
+ type: "empty";
163
+ name: string;
164
+ parent?: string;
165
+ comparisonLevel?: number;
166
+ displayOrder?: number;
167
+ isDisabled?: boolean;
168
+ styles?: Partial<ColorStyles>;
169
+ }
170
+ export type TaskOrEmpty = Task | EmptyTask;
171
+ export type OnArrowDoubleClick = (taskFrom: Task, taskFromIndex: number, taskTo: Task, taskToIndex: number) => void;
172
+ export type OnRelationChange = (
173
+ /**
174
+ * Task, target, index
175
+ */
176
+ from: [Task, DateExtremity, number],
177
+ /**
178
+ * Task, target, index
179
+ */
180
+ to: [Task, DateExtremity, number],
181
+ /**
182
+ * One of tasks is descendant of other task
183
+ */
184
+ isOneDescendant: boolean) => void;
185
+ export type OnDateChangeSuggestionType = [
186
+ /**
187
+ * Start date
188
+ */
189
+ Date,
190
+ /**
191
+ * End date
192
+ */
193
+ Date,
194
+ /**
195
+ * Suggested task
196
+ */
197
+ Task,
198
+ /**
199
+ * Index in array of tasks
200
+ */
201
+ number
202
+ ];
203
+ export type OnDateChange = (task: TaskOrEmpty, dependentTasks: readonly Task[], index: number, parents: readonly Task[], suggestions: readonly OnDateChangeSuggestionType[]) => void;
204
+ export type OnProgressChange = (task: Task, children: readonly Task[], index: number) => void;
205
+ export type OnEditTask = (task: TaskOrEmpty, index: number, getMetadata: GetMetadata) => void;
206
+ export type OnMoveTaskBeforeAfter = (task: TaskOrEmpty, taskForMove: TaskOrEmpty, dependentTasks: readonly Task[], taskIndex: number, taskForMoveIndex: number, parents: readonly Task[], suggestions: readonly OnDateChangeSuggestionType[]) => void;
207
+ export type OnMoveTaskInside = (parent: Task, childs: readonly TaskOrEmpty[], dependentTasks: readonly Task[], parentIndex: number, childIndexes: readonly number[], parents: readonly Task[], suggestions: readonly OnDateChangeSuggestionType[]) => void;
208
+ export type OnAddTask = (parentTask: Task, getMetadata: GetMetadata) => void;
209
+ export type FixPosition = (task: Task, date: Date,
210
+ /**
211
+ * index in the array of tasks
212
+ */
213
+ index: number) => void;
214
+ export type OnChangeTasksAction = {
215
+ type: "add_tasks";
216
+ } | {
217
+ type: "date_change";
218
+ } | {
219
+ type: "delete_relation";
220
+ payload: {
221
+ taskFrom: Task;
222
+ taskFromIndex: number;
223
+ taskTo: Task;
224
+ taskToIndex: number;
225
+ };
226
+ } | {
227
+ type: "delete_task";
228
+ payload: {
229
+ tasks: readonly TaskOrEmpty[];
230
+ taskIndexes: readonly number[];
231
+ };
232
+ } | {
233
+ type: "edit_task";
234
+ } | {
235
+ type: "fix_dependency_position";
236
+ } | {
237
+ type: "fix_end_position";
238
+ } | {
239
+ type: "fix_start_position";
240
+ } | {
241
+ type: "move_task_before";
242
+ } | {
243
+ type: "move_task_after";
244
+ } | {
245
+ type: "move_task_inside";
246
+ } | {
247
+ type: "progress_change";
248
+ } | {
249
+ type: "relation_change";
250
+ } | {
251
+ type: "expandState_change";
252
+ payload: {
253
+ changedTask: Task;
254
+ };
255
+ };
256
+ export type RelationKind = "startToStart" | "startToEnd" | "endToStart" | "endToEnd";
257
+ export type OnChangeTasks = (nextTasks: readonly TaskOrEmpty[], action: OnChangeTasksAction) => void;
258
+ export interface EventOption {
259
+ /**
260
+ * Time step value for date changes.
261
+ */
262
+ timeStep?: number;
263
+ /**
264
+ * Invokes on bar double click.
265
+ */
266
+ onDoubleClick?: (task: Task) => void;
267
+ /**
268
+ * Invokes on bar click.
269
+ */
270
+ onClick?: (task: TaskOrEmpty) => void;
271
+ /**
272
+ * Recount descedents of a group task when moving
273
+ */
274
+ isMoveChildsWithParent?: boolean;
275
+ /**
276
+ * Recount parents of tasks in callback `onChangeTasks`
277
+ */
278
+ isUpdateDisabledParentsOnChange?: boolean;
279
+ /**
280
+ * Invokes when the task expand status changed(task.hideChildren)
281
+ */
282
+ onChangeExpandState?: (changedTask: Task) => void;
283
+ /**
284
+ * Invokes on every change of the list of tasks
285
+ */
286
+ onChangeTasks?: OnChangeTasks;
287
+ /**
288
+ * Invokes on end and start time change. Chart undoes operation if method return false or error.
289
+ */
290
+ onDateChange?: OnDateChange;
291
+ authorizedRelations?: RelationKind[];
292
+ /**
293
+ * Invokes on click on fix element next to relation arrow
294
+ */
295
+ onFixDependencyPosition?: OnDateChange;
296
+ /**
297
+ * Invokes new relation between tasks
298
+ */
299
+ onRelationChange?: OnRelationChange;
300
+ /**
301
+ * Invokes on progress change
302
+ */
303
+ onProgressChange?: OnProgressChange;
304
+ /**
305
+ * Callback for getting data of the added task
306
+ */
307
+ onAddTask?: (task: Task) => Promise<TaskOrEmpty | null>;
308
+ /**
309
+ * Invokes on edit button click
310
+ */
311
+ onAddTaskClick?: OnAddTask;
312
+ /**
313
+ * Invokes on delete selected task
314
+ */
315
+ onDelete?: (tasks: readonly TaskOrEmpty[], dependentTasks: readonly Task[], indexes: Array<{
316
+ task: TaskOrEmpty;
317
+ index: number;
318
+ }>, parents: readonly Task[], suggestions: readonly OnDateChangeSuggestionType[]) => void;
319
+ /**
320
+ * Callback for getting new data of the edited task
321
+ */
322
+ onEditTask?: (task: TaskOrEmpty) => Promise<TaskOrEmpty | null>;
323
+ /**
324
+ * Invokes on edit button click
325
+ */
326
+ onEditTaskClick?: OnEditTask;
327
+ /**
328
+ * Invokes on move task after other task
329
+ */
330
+ onMoveTaskBefore?: OnMoveTaskBeforeAfter;
331
+ /**
332
+ * Invokes on move task after other task
333
+ */
334
+ onMoveTaskAfter?: OnMoveTaskBeforeAfter;
335
+ /**
336
+ * Invokes on move task inside other task
337
+ */
338
+ onMoveTaskInside?: OnMoveTaskInside;
339
+ /**
340
+ * Invokes on double click on the relation arrow between tasks
341
+ */
342
+ onArrowDoubleClick?: OnArrowDoubleClick;
343
+ /**
344
+ * Invokes on click on fix element on the start of task
345
+ */
346
+ fixStartPosition?: FixPosition;
347
+ /**
348
+ * Invokes on click on fix element on the end of task
349
+ */
350
+ fixEndPosition?: FixPosition;
351
+ onWheel?: (wheelEvent: WheelEvent) => void;
352
+ }
353
+ export interface DisplayOption {
354
+ viewMode?: ViewMode;
355
+ isDeleteDependencyOnDoubleClick?: boolean;
356
+ /**
357
+ * Display offsets from start on timeline instead of dates
358
+ */
359
+ isUnknownDates?: boolean;
360
+ /**
361
+ * Locale of date-fns
362
+ */
363
+ dateLocale?: DateLocale;
364
+ viewDate?: Date;
365
+ preStepsCount?: number;
366
+ rtl?: boolean;
367
+ /**
368
+ * Show an warning icon next to task
369
+ * if some childs aren't within the time interval of the task
370
+ * and show elements to fix these warnings
371
+ */
372
+ isShowChildOutOfParentWarnings?: boolean;
373
+ /**
374
+ * Show an warning icon next to task
375
+ * if some dependencies are conflicting
376
+ * and show elements to fix these warnings
377
+ */
378
+ isShowDependencyWarnings?: boolean;
379
+ /**
380
+ * Show critical path
381
+ */
382
+ isShowCriticalPath?: boolean;
383
+ /**
384
+ * Show numbers of tasks next to tasks
385
+ */
386
+ isShowTaskNumbers?: boolean;
387
+ }
388
+ export interface Icons {
389
+ renderAddIcon: (task: TaskOrEmpty) => ReactNode;
390
+ renderClosedIcon: (task: TaskOrEmpty) => ReactNode;
391
+ renderDeleteIcon: (task: TaskOrEmpty) => ReactNode;
392
+ renderEditIcon: (task: TaskOrEmpty) => ReactNode;
393
+ renderOpenedIcon: (task: TaskOrEmpty) => ReactNode;
394
+ renderNoChildrenIcon: (task: TaskOrEmpty) => ReactNode;
395
+ }
396
+ export type BarMoveAction = "progress" | "end" | "start" | "move";
397
+ export interface StylingOption {
398
+ /**
399
+ * Allow drag-n-drop of tasks in the table
400
+ */
401
+ canMoveTasks?: boolean;
402
+ canResizeColumns?: boolean;
403
+ colors?: Partial<ColorStyles>;
404
+ dateFormats?: Partial<DateFormats>;
405
+ distances?: Partial<Distances>;
406
+ icons?: Partial<Icons>;
407
+ columns?: readonly Column[];
408
+ onResizeColumn?: OnResizeColumn;
409
+ fontFamily?: string;
410
+ fontSize?: string;
411
+ TooltipContent?: ComponentType<{
412
+ task: Task;
413
+ fontSize: string;
414
+ fontFamily: string;
415
+ }>;
416
+ TaskListHeader?: ComponentType<TaskListHeaderProps>;
417
+ TaskListTable?: ComponentType<TaskListTableProps>;
418
+ /**
419
+ * Render function of bottom part of header above chart
420
+ */
421
+ renderBottomHeader?: RenderBottomHeader;
422
+ /**
423
+ * Render function of top part of header above chart
424
+ */
425
+ renderTopHeader?: RenderTopHeader;
426
+ /**
427
+ * Check is current date is a holiday
428
+ * @param date the date
429
+ * @param minTaskDate lower date of all tasks
430
+ * @param dateSetup
431
+ * @param dateExtremity start or end date
432
+ */
433
+ checkIsHoliday?: (date: Date, minTaskDate: Date, dateSetup: DateSetup, dateExtremity: DateExtremity) => boolean;
434
+ /**
435
+ * Round the date of task after move or resize
436
+ * @param date Date after move
437
+ * @param viewMode current date unit
438
+ * @param dateExtremity start or end date
439
+ * @param action current user action
440
+ * @returns rounded date
441
+ */
442
+ roundDate?: (date: Date, viewMode: ViewMode, dateExtremity: DateExtremity, action: BarMoveAction) => Date;
443
+ dateMoveStep?: GanttDateRounding;
444
+ ContextualPalette?: React.FC<TaskContextualPaletteProps>;
445
+ TaskDependencyContextualPalette?: React.FC<TaskDependencyContextualPaletteProps>;
446
+ }
447
+ export interface GanttDateRounding {
448
+ value: number;
449
+ timeUnit: GanttDateRoundingTimeUnit;
450
+ }
451
+ export declare enum GanttDateRoundingTimeUnit {
452
+ MINUTE = 0,
453
+ HOUR = 1,
454
+ DAY = 2
455
+ }
456
+ export interface TaskContextualPaletteProps {
457
+ selectedTask: Task;
458
+ onClosePalette: () => void;
459
+ }
460
+ export interface TaskDependencyContextualPaletteProps {
461
+ taskFrom: Task;
462
+ extremityFrom: DateExtremity;
463
+ taskTo: Task;
464
+ extremityTo: DateExtremity;
465
+ onClosePalette: () => void;
466
+ }
467
+ export type DateExtremity = "startOfTask" | "endOfTask";
468
+ export interface GanttProps extends EventOption, DisplayOption, StylingOption {
469
+ /**
470
+ * Can be used to compare multiple graphs. This prop is the number of graps being compared
471
+ */
472
+ comparisonLevels?: number;
473
+ contextMenuOptions?: ContextMenuOptionType[];
474
+ enableTableListContextMenu?: number;
475
+ /**
476
+ * Get new id for task after using copy-paste
477
+ */
478
+ getCopiedTaskId?: GetCopiedTaskId;
479
+ /**
480
+ * Move dates of tasks to working days during change
481
+ */
482
+ isAdjustToWorkingDates?: boolean;
483
+ tasks: readonly TaskOrEmpty[];
484
+ }
485
+ export interface TaskListTableProps {
486
+ canMoveTasks: boolean;
487
+ childTasksMap: ChildByLevelMap;
488
+ colors: ColorStyles;
489
+ columns: readonly Column[];
490
+ cutIdsMirror: Readonly<Record<string, true>>;
491
+ dateSetup: DateSetup;
492
+ dependencyMap: DependencyMap;
493
+ distances: Distances;
494
+ fontFamily: string;
495
+ fontSize: string;
496
+ fullRowHeight: number;
497
+ ganttFullHeight: number;
498
+ getTaskCurrentState: (task: Task) => Task;
499
+ handleAddTask: (task: Task) => void;
500
+ handleDeleteTasks: (task: TaskOrEmpty[]) => void;
501
+ handleEditTask: (task: TaskOrEmpty) => void;
502
+ handleMoveTaskBefore: (target: TaskOrEmpty, taskForMove: TaskOrEmpty) => void;
503
+ handleMoveTaskAfter: (target: TaskOrEmpty, taskForMove: TaskOrEmpty) => void;
504
+ handleMoveTasksInside: (parent: Task, childs: readonly TaskOrEmpty[]) => void;
505
+ handleOpenContextMenu: (task: TaskOrEmpty, clientX: number, clientY: number) => void;
506
+ icons?: Partial<Icons>;
507
+ isShowTaskNumbers: boolean;
508
+ mapTaskToNestedIndex: MapTaskToNestedIndex;
509
+ onClick: (task: TaskOrEmpty) => void;
510
+ onExpanderClick: (task: Task) => void;
511
+ renderedIndexes: OptimizedListParams | null;
512
+ scrollToTask: (task: Task) => void;
513
+ selectTaskOnMouseDown: (taskId: string, event: MouseEvent) => void;
514
+ selectedIdsMirror: Readonly<Record<string, true>>;
515
+ taskListWidth: number;
516
+ tasks: readonly TaskOrEmpty[];
517
+ }
518
+ export interface TaskListHeaderProps extends TaskListHeaderActionsProps {
519
+ headerHeight: number;
520
+ columns: readonly Column[];
521
+ fontFamily: string;
522
+ fontSize: string;
523
+ canResizeColumns: boolean;
524
+ onColumnResizeStart: (columnIndex: number, clientX: number) => void;
525
+ colors: ColorStyles;
526
+ }
527
+ export type TaskToGlobalIndexMap = Map<number, Map<string, number>>;
528
+ export type TaskToRowIndexMap = Map<number, Map<string, number>>;
529
+ export type RowIndexToTaskMap = Map<number, Map<number, TaskOrEmpty>>;
530
+ export type GlobalRowIndexToTaskMap = Map<number, TaskOrEmpty>;
531
+ export type ChildByLevelMap = Map<number, Map<string, TaskOrEmpty[]>>;
532
+ export type RootMapByLevel = Map<number, TaskOrEmpty[]>;
533
+ export type TaskMapByLevel = Map<number, Map<string, TaskOrEmpty>>;
534
+ export type MapTaskToNestedIndex = Map<number, Map<string, [number, string]>>;
535
+ export interface TaskOutOfParentWarning {
536
+ isOutside: boolean;
537
+ date: Date;
538
+ }
539
+ export interface TaskOutOfParentWarnings {
540
+ start?: TaskOutOfParentWarning;
541
+ end?: TaskOutOfParentWarning;
542
+ }
543
+ /**
544
+ * comparison level -> task id -> {
545
+ * start: {
546
+ * isOutsie: false,
547
+ * date: Date,
548
+ * },
549
+ *
550
+ * end: {
551
+ * isOutsie: false,
552
+ * date: Date,
553
+ * },
554
+ * }
555
+ */
556
+ export type ChildOutOfParentWarnings = Map<number, Map<string, TaskOutOfParentWarnings>>;
557
+ export type DependencyMap = Map<number, Map<string, ExpandedDependency[]>>;
558
+ export type DependentMap = Map<number, Map<string, ExpandedDependent[]>>;
559
+ export type DependencyMargins = Map<number, Map<string, Map<string, number>>>;
560
+ export type TaskToHasDependencyWarningMap = Map<number, Set<string>>;
561
+ export type CriticalPath = {
562
+ tasks: Set<string>;
563
+ dependencies: Map<string, Set<string>>;
564
+ };
565
+ export type CriticalPaths = Map<number, CriticalPath>;
566
+ export type TaskCoordinates = {
567
+ /**
568
+ * Width of inner svg wrapper
569
+ */
570
+ containerWidth: number;
571
+ /**
572
+ * Left border of inner svg wrapper relative to the root svg
573
+ */
574
+ containerX: number;
575
+ /**
576
+ * Left border relative to the wrapper svg
577
+ */
578
+ innerX1: number;
579
+ /**
580
+ * Right border relative to the wrapper svg
581
+ */
582
+ innerX2: number;
583
+ /**
584
+ * Top border of inner svg wrapper relative to the root svg
585
+ */
586
+ levelY: number;
587
+ /**
588
+ * Width of the progress bar
589
+ */
590
+ progressWidth: number;
591
+ /**
592
+ * Left border of the progress bar relative to the root svg
593
+ */
594
+ progressX: number;
595
+ /**
596
+ * Width of the task
597
+ */
598
+ width: number;
599
+ /**
600
+ * Left border of the task relative to the root svg
601
+ */
602
+ x1: number;
603
+ /**
604
+ * Right border of the task relative to the root svg
605
+ */
606
+ x2: number;
607
+ /**
608
+ * Top border of the task relative to the root svg
609
+ */
610
+ y: number;
611
+ };
612
+ /**
613
+ * comparison level -> task id -> {
614
+ * x1: number;
615
+ * x2: number;
616
+ * y: number;
617
+ * }
618
+ */
619
+ export type MapTaskToCoordinates = Map<number, Map<string, TaskCoordinates>>;
620
+ export type ChangeInProgress = {
621
+ action: BarMoveAction;
622
+ additionalLeftSpace: number;
623
+ additionalRightSpace: number;
624
+ changedTask: Task;
625
+ coordinates: TaskCoordinates;
626
+ coordinatesDiff: number;
627
+ initialCoordinates: TaskCoordinates;
628
+ lastClientX: number;
629
+ startX: number;
630
+ originalTask: Task;
631
+ taskRootNode: Element;
632
+ tsDiff: number;
633
+ };
634
+ export type GetMetadata = (task: TaskOrEmpty) => ChangeMetadata;
635
+ export type ColumnData = {
636
+ canMoveTasks: boolean;
637
+ dateSetup: DateSetup;
638
+ depth: number;
639
+ dependencies: Task[];
640
+ distances: Distances;
641
+ handleAddTask: (task: Task) => void;
642
+ handleDeleteTasks: (task: TaskOrEmpty[]) => void;
643
+ handleEditTask: (task: TaskOrEmpty) => void;
644
+ hasChildren: boolean;
645
+ icons?: Partial<Icons>;
646
+ indexStr: string;
647
+ isClosed: boolean;
648
+ isShowTaskNumbers: boolean;
649
+ onExpanderClick: (task: Task) => void;
650
+ task: TaskOrEmpty;
651
+ colors: Partial<ColorStyles>;
652
+ };
653
+ export type ColumnProps = {
654
+ data: ColumnData;
655
+ };
656
+ export type Column = {
657
+ id: string;
658
+ Cell: ComponentType<ColumnProps>;
659
+ width: number;
660
+ title?: ReactNode;
661
+ canResize?: boolean;
662
+ };
663
+ export type OnResizeColumn = (nextColumns: readonly Column[], columnIndex: number, deltaWidth: number) => void;
664
+ export type ChangeAction = {
665
+ type: "add-childs";
666
+ parent: Task;
667
+ addedIdsMap: Map<number, Set<string>>;
668
+ addedChildsByLevelMap: ChildByLevelMap;
669
+ addedRootsByLevelMap: RootMapByLevel;
670
+ descendants: readonly TaskOrEmpty[];
671
+ } | {
672
+ type: "change";
673
+ task: TaskOrEmpty;
674
+ } | {
675
+ type: "change_start_and_end";
676
+ task: Task;
677
+ changedTask: Task;
678
+ originalTask: Task;
679
+ } | {
680
+ type: "delete";
681
+ tasks: readonly TaskOrEmpty[];
682
+ deletedIdsMap: Map<number, Set<string>>;
683
+ } | {
684
+ type: "move-before";
685
+ target: TaskOrEmpty;
686
+ taskForMove: TaskOrEmpty;
687
+ } | {
688
+ type: "move-after";
689
+ target: TaskOrEmpty;
690
+ taskForMove: TaskOrEmpty;
691
+ } | {
692
+ type: "move-inside";
693
+ parent: Task;
694
+ childs: readonly TaskOrEmpty[];
695
+ movedIdsMap: Map<number, Set<string>>;
696
+ };
697
+ export type ChangeMetadata = [
698
+ /**
699
+ * dependent tasks
700
+ */
701
+ Task[],
702
+ /**
703
+ * indexes in list of tasks
704
+ */
705
+ Array<{
706
+ task: TaskOrEmpty;
707
+ index: number;
708
+ }>,
709
+ /**
710
+ * array of parents of the task
711
+ */
712
+ Task[],
713
+ /**
714
+ * array of suggesgions for change parent
715
+ */
716
+ OnDateChangeSuggestionType[]
717
+ ];
718
+ export type ContextMenuType = {
719
+ task: TaskOrEmpty | null;
720
+ x: number;
721
+ y: number;
722
+ };
723
+ export type ActionMetaType = {
724
+ /**
725
+ * Check is task id exists at current level (1 by default)
726
+ */
727
+ checkTaskIdExists: CheckTaskIdExistsAtLevel;
728
+ /**
729
+ * Copy all selected tasks
730
+ */
731
+ copySelectedTasks: () => void;
732
+ /**
733
+ * Copy single task
734
+ * @param task the task
735
+ */
736
+ copyTask: (task: TaskOrEmpty) => void;
737
+ /**
738
+ * Cut all selected tasks
739
+ */
740
+ cutSelectedTasks: () => void;
741
+ /**
742
+ * Cut single task
743
+ * @param task the task
744
+ */
745
+ cutTask: (task: TaskOrEmpty) => void;
746
+ /**
747
+ * @returns List of parent tasks under copy action
748
+ */
749
+ getCopyParentTasks: () => readonly TaskOrEmpty[];
750
+ /**
751
+ * @returns List of tasks under copy action
752
+ */
753
+ getCopyTasks: () => readonly TaskOrEmpty[];
754
+ /**
755
+ * @returns List of tasks with all their descendants under copy action
756
+ */
757
+ getCopyTasksWithDescendants: () => readonly TaskOrEmpty[];
758
+ /**
759
+ * @returns List of parent tasks under cut action
760
+ */
761
+ getCutParentTasks: () => readonly TaskOrEmpty[];
762
+ /**
763
+ * @returns List of tasks under cut action
764
+ */
765
+ getCutTasks: () => readonly TaskOrEmpty[];
766
+ /**
767
+ * @returns List of parent tasks
768
+ */
769
+ getParentTasks: () => readonly TaskOrEmpty[];
770
+ /**
771
+ * @returns List of selected tasks
772
+ */
773
+ getSelectedTasks: () => readonly TaskOrEmpty[];
774
+ /**
775
+ * @returns List of tasks with all their descendants
776
+ */
777
+ getTasksWithDescendants: () => readonly TaskOrEmpty[];
778
+ /**
779
+ * Add childs to the container task
780
+ * @param parent the container task
781
+ * @param descendants list of added childs with their descendants
782
+ */
783
+ handleAddChilds: (parent: Task, descendants: readonly TaskOrEmpty[]) => void;
784
+ /**
785
+ * Delete tasks
786
+ * @param tasksForDelete list of tasks for delete
787
+ */
788
+ handleDeleteTasks: (tasksForDelete: readonly TaskOrEmpty[]) => void;
789
+ /**
790
+ * Move tasks to the container task
791
+ * @param parent the container task
792
+ * @param childs list of moved tasks
793
+ */
794
+ handleMoveTasksInside: (parent: Task, childs: readonly TaskOrEmpty[]) => void;
795
+ /**
796
+ * Make copies of the list of tasks
797
+ */
798
+ makeCopies: (tasks: readonly TaskOrEmpty[]) => readonly TaskOrEmpty[];
799
+ /**
800
+ * Reset selection
801
+ */
802
+ resetSelectedTasks: () => void;
803
+ /**
804
+ * Task that triggered context menu
805
+ */
806
+ task: TaskOrEmpty;
807
+ };
808
+ export type CheckIsAvailableMetaType = {
809
+ /**
810
+ *
811
+ * @returns Check are there tasks under the copy action
812
+ */
813
+ checkHasCopyTasks: () => boolean;
814
+ /**
815
+ *
816
+ * @returns Check are there tasks under the cut action
817
+ */
818
+ checkHasCutTasks: () => boolean;
819
+ /**
820
+ * Context menu trigger task
821
+ */
822
+ task: TaskOrEmpty;
823
+ };
824
+ export type ContextMenuOptionType = {
825
+ /**
826
+ * Invokes on click on menu option
827
+ * @param meta Metadata for the action
828
+ */
829
+ action: (meta: ActionMetaType) => void;
830
+ /**
831
+ * Check is the current action available. Available by default
832
+ * @param meta Metadata for checking
833
+ */
834
+ checkIsAvailable?: (meta: CheckIsAvailableMetaType) => void;
835
+ label: ReactNode;
836
+ icon?: ReactNode;
837
+ };
838
+ export type CheckTaskIdExistsAtLevel = (newId: string, comparisonLevel?: number) => boolean;
839
+ export type GetCopiedTaskId = (task: TaskOrEmpty, checkExists: (newId: string) => boolean) => string;
840
+ export type AdjustTaskToWorkingDatesParams = {
841
+ action: BarMoveAction;
842
+ changedTask: Task;
843
+ originalTask: Task;
844
+ roundDate: (date: Date, action: BarMoveAction, dateExtremity: DateExtremity) => Date;
845
+ };