gantt-task-react-v 1.0.0

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 (144) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +155 -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 +18 -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 +13 -0
  9. package/dist/components/context-menu/index.d.ts +13 -0
  10. package/dist/components/context-menu/menu-option.d.ts +10 -0
  11. package/dist/components/context-menu-options/copy.d.ts +3 -0
  12. package/dist/components/context-menu-options/cut.d.ts +2 -0
  13. package/dist/components/context-menu-options/delete.d.ts +2 -0
  14. package/dist/components/context-menu-options/edit.d.ts +2 -0
  15. package/dist/components/context-menu-options/index.d.ts +5 -0
  16. package/dist/components/context-menu-options/paste.d.ts +2 -0
  17. package/dist/components/gantt/default-check-is-holiday.d.ts +2 -0
  18. package/dist/components/gantt/default-get-copied-task-id.d.ts +2 -0
  19. package/dist/components/gantt/default-round-end-date.d.ts +2 -0
  20. package/dist/components/gantt/default-round-start-date.d.ts +2 -0
  21. package/dist/components/gantt/gantt.d.ts +4 -0
  22. package/dist/components/gantt/task-gantt-content.d.ts +45 -0
  23. package/dist/components/gantt/task-gantt.d.ts +21 -0
  24. package/dist/components/gantt/use-context-menu.d.ts +7 -0
  25. package/dist/components/gantt/use-create-relation.d.ts +18 -0
  26. package/dist/components/gantt/use-get-task-current-state.d.ts +15 -0
  27. package/dist/components/gantt/use-handle-action.d.ts +21 -0
  28. package/dist/components/gantt/use-holidays.d.ts +12 -0
  29. package/dist/components/gantt/use-horizontal-scrollbars.d.ts +9 -0
  30. package/dist/components/gantt/use-selection.d.ts +18 -0
  31. package/dist/components/gantt/use-tablelist-resize.d.ts +9 -0
  32. package/dist/components/gantt/use-task-drag.d.ts +28 -0
  33. package/dist/components/gantt/use-vertical-scrollbars.d.ts +11 -0
  34. package/dist/components/gantt-loader/index.d.ts +6 -0
  35. package/dist/components/gantt-locale/index.d.ts +8 -0
  36. package/dist/components/gantt-theme/default-theme.d.ts +2 -0
  37. package/dist/components/gantt-theme/gantt-theme-builder.d.ts +2 -0
  38. package/dist/components/gantt-theme/index.d.ts +9 -0
  39. package/dist/components/gantt-today/index.d.ts +12 -0
  40. package/dist/components/icons/add-icon.d.ts +2 -0
  41. package/dist/components/icons/copy-icon.d.ts +2 -0
  42. package/dist/components/icons/cut-icon.d.ts +2 -0
  43. package/dist/components/icons/delete-icon.d.ts +2 -0
  44. package/dist/components/icons/drag-indicator-icon.d.ts +2 -0
  45. package/dist/components/icons/edit-icon.d.ts +2 -0
  46. package/dist/components/icons/expand-less-icon.d.ts +2 -0
  47. package/dist/components/icons/expand-more-icon.d.ts +2 -0
  48. package/dist/components/icons/paste-icon.d.ts +2 -0
  49. package/dist/components/other/arrow.d.ts +22 -0
  50. package/dist/components/other/relation-line.d.ts +9 -0
  51. package/dist/components/other/tooltip.d.ts +18 -0
  52. package/dist/components/other/vertical-scroll.d.ts +11 -0
  53. package/dist/components/task-item/bar/bar-content-small.d.ts +6 -0
  54. package/dist/components/task-item/bar/bar-date-handle/index.d.ts +13 -0
  55. package/dist/components/task-item/bar/bar-default.d.ts +1 -0
  56. package/dist/components/task-item/bar/bar-display.d.ts +19 -0
  57. package/dist/components/task-item/bar/bar-progress-handle/index.d.ts +10 -0
  58. package/dist/components/task-item/bar/index.d.ts +3 -0
  59. package/dist/components/task-item/bar/types.d.ts +8 -0
  60. package/dist/components/task-item/bar-comparison/index.d.ts +13 -0
  61. package/dist/components/task-item/bar-relation/bar-relation-handle.d.ts +11 -0
  62. package/dist/components/task-item/bar-relation/index.d.ts +6 -0
  63. package/dist/components/task-item/milestone/index.d.ts +8 -0
  64. package/dist/components/task-item/project/project-display.d.ts +20 -0
  65. package/dist/components/task-item/task-item.d.ts +36 -0
  66. package/dist/components/task-item/task-label/index.d.ts +3 -0
  67. package/dist/components/task-item/task-label/task-center-label.d.ts +7 -0
  68. package/dist/components/task-item/task-label/task-outline-label.d.ts +3 -0
  69. package/dist/components/task-item/task-label/task-responsive-label.d.ts +7 -0
  70. package/dist/components/task-item/task-label/types.d.ts +11 -0
  71. package/dist/components/task-list/index.d.ts +42 -0
  72. package/dist/components/task-list/task-list-sortable-table/index.d.ts +3 -0
  73. package/dist/components/task-list/task-list-sortable-table/keyboardCoordinates.d.ts +3 -0
  74. package/dist/components/task-list/task-list-sortable-table/types.d.ts +6 -0
  75. package/dist/components/task-list/task-list-sortable-table/utilities.d.ts +8 -0
  76. package/dist/components/task-list/task-list-sortable-table-row/index.d.ts +3 -0
  77. package/dist/components/task-list/task-list-table/index.d.ts +3 -0
  78. package/dist/components/task-list/task-list-table-columns/add-column.d.ts +3 -0
  79. package/dist/components/task-list/task-list-table-columns/date-end-column.d.ts +3 -0
  80. package/dist/components/task-list/task-list-table-columns/date-start-column.d.ts +3 -0
  81. package/dist/components/task-list/task-list-table-columns/delete-column.d.ts +3 -0
  82. package/dist/components/task-list/task-list-table-columns/dependencies-column.d.ts +3 -0
  83. package/dist/components/task-list/task-list-table-columns/edit-column.d.ts +3 -0
  84. package/dist/components/task-list/task-list-table-columns/title-column.d.ts +3 -0
  85. package/dist/components/task-list/task-list-table-columns/use-task-list-columns-builder.d.ts +45 -0
  86. package/dist/components/task-list/task-list-table-headers/index.d.ts +3 -0
  87. package/dist/components/task-list/task-list-table-row/index.d.ts +3 -0
  88. package/dist/constants.d.ts +1 -0
  89. package/dist/gantt-task-react.es.js +19900 -0
  90. package/dist/gantt-task-react.umd.js +19917 -0
  91. package/dist/helpers/adjust-task-to-working-dates.d.ts +12 -0
  92. package/dist/helpers/bar-helper.d.ts +12 -0
  93. package/dist/helpers/check-has-children.d.ts +2 -0
  94. package/dist/helpers/check-is-descendant.d.ts +2 -0
  95. package/dist/helpers/collect-parents.d.ts +2 -0
  96. package/dist/helpers/collect-visible-tasks.d.ts +2 -0
  97. package/dist/helpers/compare-dates.d.ts +1 -0
  98. package/dist/helpers/copy-tasks.d.ts +2 -0
  99. package/dist/helpers/count-holidays.d.ts +2 -0
  100. package/dist/helpers/date-helper.d.ts +4 -0
  101. package/dist/helpers/generate-triangle-points.d.ts +1 -0
  102. package/dist/helpers/get-all-descendants.d.ts +2 -0
  103. package/dist/helpers/get-change-task-metadata.d.ts +13 -0
  104. package/dist/helpers/get-childs-and-roots.d.ts +2 -0
  105. package/dist/helpers/get-critical-path.d.ts +2 -0
  106. package/dist/helpers/get-date-by-offset.d.ts +2 -0
  107. package/dist/helpers/get-dates-diff.d.ts +2 -0
  108. package/dist/helpers/get-dependency-map.d.ts +2 -0
  109. package/dist/helpers/get-map-task-to-coordinates.d.ts +3 -0
  110. package/dist/helpers/get-map-task-to-global-index.d.ts +5 -0
  111. package/dist/helpers/get-map-task-to-nested-index.d.ts +2 -0
  112. package/dist/helpers/get-map-task-to-row-index.d.ts +6 -0
  113. package/dist/helpers/get-min-and-max-childs-map.d.ts +2 -0
  114. package/dist/helpers/get-next-working-date.d.ts +2 -0
  115. package/dist/helpers/get-previous-working-date.d.ts +2 -0
  116. package/dist/helpers/get-relation-circle-by-coordinates.d.ts +2 -0
  117. package/dist/helpers/get-task-coordinates.d.ts +4 -0
  118. package/dist/helpers/get-task-row-index.d.ts +2 -0
  119. package/dist/helpers/get-tasks-map.d.ts +5 -0
  120. package/dist/helpers/move-helper.d.ts +4 -0
  121. package/dist/helpers/obj-helper.d.ts +1 -0
  122. package/dist/helpers/round-task-dates.d.ts +2 -0
  123. package/dist/helpers/sort-tasks.d.ts +2 -0
  124. package/dist/helpers/use-optimized-list.d.ts +24 -0
  125. package/dist/helpers/use-task-tooltip.d.ts +12 -0
  126. package/dist/i18n.d.ts +2 -0
  127. package/dist/index.d.ts +14 -0
  128. package/dist/locales/en.d.ts +2 -0
  129. package/dist/locales/index.d.ts +1 -0
  130. package/dist/selected-tasks/get-parent-tasks.d.ts +2 -0
  131. package/dist/selected-tasks/get-selected-tasks.d.ts +2 -0
  132. package/dist/selected-tasks/get-tasks-with-descendants.d.ts +2 -0
  133. package/dist/style.css +686 -0
  134. package/dist/suggestions/change-start-and-end-descendants.d.ts +10 -0
  135. package/dist/test/date-helper.test.d.ts +1 -0
  136. package/dist/test/gant.test.d.ts +1 -0
  137. package/dist/types/common-types.d.ts +114 -0
  138. package/dist/types/gantt-task-actions.d.ts +9 -0
  139. package/dist/types/index.d.ts +6 -0
  140. package/dist/types/internal-types.d.ts +222 -0
  141. package/dist/types/public-types.d.ts +538 -0
  142. package/dist/types/theme-locale.d.ts +30 -0
  143. package/dist/types/theme-types.d.ts +84 -0
  144. package/package.json +113 -0
@@ -0,0 +1,538 @@
1
+ import type { ComponentType, ReactNode } from "react";
2
+ import { GanttPartialTheme } from "./theme-types";
3
+ import { GanttLocale } from "./theme-locale";
4
+ import { ChildByLevelMap, DateSetup, Distances, RelationMoveTarget, RootMapByLevel, Task, TaskBarMoveAction, RenderTask, ViewMode, TaskId } from "./common-types";
5
+ export type RenderTopHeader = (date: Date, viewMode: ViewMode, dateSetup: DateSetup) => ReactNode;
6
+ export type RenderCustomLabel = (task: RenderTask, x1: number, width: number, taskHeight: number, arrowIndent: number, taskYOffset: number, movingAction: TaskBarMoveAction | null, viewMode: ViewMode, rtl?: boolean) => ReactNode;
7
+ export type RenderBottomHeader = (date: Date, viewMode: ViewMode, dateSetup: DateSetup, index: number, isUnknownDates: boolean) => ReactNode;
8
+ export type OnArrowDoubleClick = (taskFrom: Task, taskFromIndex: number, taskTo: Task, taskToIndex: number) => void;
9
+ export type OnRelationChange = (
10
+ /**
11
+ * Task, from, index
12
+ */
13
+ from: [Task, RelationMoveTarget, number],
14
+ /**
15
+ * Task, to, index
16
+ */
17
+ to: [Task, RelationMoveTarget, number],
18
+ /**
19
+ * One of tasks is descendant of other task
20
+ */
21
+ isOneDescendant: boolean) => void;
22
+ export type OnDateChangeSuggestionType = [
23
+ /**
24
+ * Start date
25
+ */
26
+ Date,
27
+ /**
28
+ * End date
29
+ */
30
+ Date,
31
+ /**
32
+ * Suggested task
33
+ */
34
+ Task,
35
+ /**
36
+ * Index in array of tasks
37
+ */
38
+ number
39
+ ];
40
+ export type OnChangeTasksAction = {
41
+ type: "add_tasks";
42
+ payload: {
43
+ parent: RenderTask;
44
+ descendants: readonly RenderTask[];
45
+ };
46
+ } | {
47
+ type: "date_change";
48
+ payload: {
49
+ taskId: string;
50
+ taskIndex: number;
51
+ start: Date;
52
+ end: Date;
53
+ };
54
+ } | {
55
+ type: "delete_relation";
56
+ payload: {
57
+ taskFrom: Task;
58
+ taskFromIndex: number;
59
+ taskTo: Task;
60
+ taskToIndex: number;
61
+ };
62
+ } | {
63
+ type: "delete_task";
64
+ payload: {
65
+ tasks: readonly RenderTask[];
66
+ taskIndexes: readonly number[];
67
+ };
68
+ } | {
69
+ type: "edit_task";
70
+ } | {
71
+ type: "move_task_before";
72
+ payload: {
73
+ task: RenderTask;
74
+ taskForMove: RenderTask;
75
+ taskIndex: number;
76
+ taskForMoveIndex: number;
77
+ };
78
+ } | {
79
+ type: "move_task_after";
80
+ payload: {
81
+ task: RenderTask;
82
+ taskForMove: RenderTask;
83
+ taskIndex: number;
84
+ taskForMoveIndex: number;
85
+ };
86
+ } | {
87
+ type: "move_task_inside";
88
+ payload: {
89
+ parent: Task;
90
+ childs: readonly RenderTask[];
91
+ dependentTasks: readonly Task[];
92
+ parentIndex: number;
93
+ childIndexes: readonly number[];
94
+ };
95
+ } | {
96
+ type: "progress_change";
97
+ payload: {
98
+ task: Task;
99
+ };
100
+ } | {
101
+ type: "relation_change";
102
+ payload: {
103
+ /**
104
+ * Task, from, index
105
+ */
106
+ from: [Task, RelationMoveTarget, number];
107
+ /**
108
+ * Task, to, index
109
+ */
110
+ to: [Task, RelationMoveTarget, number];
111
+ /**
112
+ * One of tasks is descendant of other task
113
+ */
114
+ isOneDescendant: boolean;
115
+ };
116
+ } | {
117
+ type: "expandState_change";
118
+ payload: {
119
+ changedTask: Task;
120
+ };
121
+ };
122
+ export type RelationKind = "startToStart" | "startToEnd" | "endToStart" | "endToEnd";
123
+ export type OnCommitTasksResult = boolean | undefined | void;
124
+ export type OnCommitTasks = (nextTasks: readonly RenderTask[], action: OnChangeTasksAction) => Promise<OnCommitTasksResult> | OnCommitTasksResult;
125
+ export interface GanttTaskListProps {
126
+ enableTableListContextMenu?: number;
127
+ contextMenuOptions?: ContextMenuOptionType[];
128
+ /**
129
+ * Allow drag-n-drop of tasks in the table
130
+ */
131
+ allowReorderTask?: AllowReorderTask;
132
+ /**
133
+ * Can resize columns
134
+ */
135
+ canResizeColumns?: boolean;
136
+ /**
137
+ * Custom icons
138
+ */
139
+ icons?: Partial<GanttRenderIconsProps>;
140
+ /**
141
+ * Show numbers of tasks next to tasks
142
+ */
143
+ isShowTaskNumbers?: boolean;
144
+ /**
145
+ * Can reorder tasks
146
+ */
147
+ canReorderTasks?: boolean;
148
+ /**
149
+ * Can reorder tasks
150
+ */
151
+ onResizeColumn?: OnResizeColumn;
152
+ /**
153
+ * Render bottom table content
154
+ */
155
+ tableBottom?: TableRenderBottomProps;
156
+ }
157
+ export interface TableRenderBottomProps {
158
+ height?: number;
159
+ renderContent?: () => ReactNode;
160
+ }
161
+ export interface GanttTaskBarProps extends GanttTaskBarActions {
162
+ /**
163
+ * Render function of bottom part of header above chart
164
+ */
165
+ renderBottomHeader?: RenderBottomHeader;
166
+ /**
167
+ * Render function of top part of header above chart
168
+ */
169
+ renderTopHeader?: RenderTopHeader;
170
+ /**
171
+ * Render custom label
172
+ */
173
+ renderCustomLabel?: RenderCustomLabel;
174
+ /**
175
+ * Show critical path
176
+ */
177
+ isShowCriticalPath?: boolean;
178
+ isProgressChangeable?: (task: Task) => boolean;
179
+ isRelationChangeable?: (task: Task) => boolean;
180
+ isDateChangeable?: (task: Task) => boolean;
181
+ isDeleteDependencyOnDoubleClick?: boolean;
182
+ preStepsCount?: number;
183
+ TooltipContent?: ComponentType<{
184
+ task: Task;
185
+ }>;
186
+ /**
187
+ * Invokes on double-click on the relation arrow between tasks
188
+ */
189
+ onArrowDoubleClick?: OnArrowDoubleClick;
190
+ /**
191
+ * Invokes on bar double click.
192
+ */
193
+ onDoubleClick?: (task: Task) => void;
194
+ /**
195
+ * Invokes on bar click.
196
+ */
197
+ onClick?: (task: RenderTask) => void;
198
+ }
199
+ export interface GanttRenderIconsProps {
200
+ renderAddIcon: () => ReactNode;
201
+ renderDragIndicatorIcon: () => ReactNode;
202
+ renderClosedIcon: () => ReactNode;
203
+ renderDeleteIcon: () => ReactNode;
204
+ renderEditIcon: () => ReactNode;
205
+ renderOpenedIcon: () => ReactNode;
206
+ renderNoChildrenIcon: () => ReactNode;
207
+ }
208
+ export type InsertTaskPosition = "before" | "inside" | "after";
209
+ export type AllowReorderTask = (task: RenderTask, method: InsertTaskPosition) => boolean;
210
+ export type CheckIsHoliday = (date: Date, minTaskDate: Date, dateSetup: DateSetup) => boolean;
211
+ export interface GanttProps {
212
+ /**
213
+ * Language
214
+ */
215
+ language?: string;
216
+ /**
217
+ * Theme
218
+ */
219
+ theme?: GanttPartialTheme;
220
+ /**
221
+ * Locale
222
+ */
223
+ locale?: GanttLocale;
224
+ /**
225
+ * Check is current date holiday
226
+ * @param date the date
227
+ * @param minTaskDate lower date of all tasks
228
+ * @param dateSetup
229
+ * @returns
230
+ */
231
+ checkIsHoliday?: CheckIsHoliday;
232
+ /**
233
+ * Can be used to compare multiple graphs. This prop is the number of graps being compared
234
+ */
235
+ comparisonLevels?: number;
236
+ /**
237
+ * Get new id for task after using copy-paste
238
+ */
239
+ getCopiedTaskId?: GetCopiedTaskId;
240
+ /**
241
+ * Tasks
242
+ */
243
+ tasks: readonly RenderTask[];
244
+ /**
245
+ * Columns of the table
246
+ */
247
+ columns?: readonly Column[];
248
+ /**
249
+ * Round end date of task after move or resize
250
+ * @param date Date after move
251
+ * @param viewMode current date unit
252
+ * @returns next date
253
+ */
254
+ roundEndDate?: (date: Date, viewMode: ViewMode) => Date;
255
+ /**
256
+ * Round start date of task after move or resize
257
+ * @param date Date after move
258
+ * @param viewMode current date unit
259
+ * @returns next date
260
+ */
261
+ roundStartDate?: (date: Date, viewMode: ViewMode) => Date;
262
+ /**
263
+ * View mode
264
+ */
265
+ viewMode?: ViewMode;
266
+ /**
267
+ * View date
268
+ */
269
+ viewDate?: Date;
270
+ /**
271
+ * Task bar options
272
+ */
273
+ taskBar?: GanttTaskBarProps;
274
+ /**
275
+ * Task list options
276
+ */
277
+ taskList?: GanttTaskListProps;
278
+ /**
279
+ * Authorized relations between tasks
280
+ */
281
+ authorizedRelations?: RelationKind[];
282
+ /**
283
+ * Time step value for date changes.
284
+ */
285
+ timeStep?: number;
286
+ /**
287
+ * Invokes on every commit of the list of tasks
288
+ */
289
+ onCommitTasks?: OnCommitTasks;
290
+ /**
291
+ * Callback for getting data of the added task
292
+ */
293
+ onAddTaskAction?: (task: Task | null) => Promise<RenderTask | null>;
294
+ /**
295
+ * Callback for getting new data of the edited task
296
+ */
297
+ onEditTaskAction?: (task: RenderTask) => Promise<RenderTask | null>;
298
+ /**
299
+ * Callback for select task
300
+ */
301
+ onSelectTaskIds?: (taskIds: TaskId[]) => void;
302
+ /**
303
+ * Invokes on wheel event
304
+ * @param wheelEvent
305
+ */
306
+ onWheel?: (wheelEvent: WheelEvent) => void;
307
+ /**
308
+ * Recount descedents of a group task when moving
309
+ */
310
+ isMoveChildsWithParent?: boolean;
311
+ /**
312
+ * Recount parents of tasks in callback `onCommitTasks`
313
+ */
314
+ isUpdateDisabledParentsOnChange?: boolean;
315
+ /**
316
+ * Display offsets from start on timeline instead of dates
317
+ */
318
+ isUnknownDates?: boolean;
319
+ /**
320
+ * Move dates of tasks to working days during change
321
+ */
322
+ isAdjustToWorkingDates?: boolean;
323
+ }
324
+ export interface GanttTaskBarActions {
325
+ allowMoveTaskBar?: (action: TaskBarMoveAction, task: RenderTask) => boolean;
326
+ }
327
+ export type ColumnData = {
328
+ dateSetup: DateSetup;
329
+ depth: number;
330
+ dependencies: Task[];
331
+ distances: Distances;
332
+ handleAddTask: (task: Task) => void;
333
+ handleDeleteTasks: (task: RenderTask[]) => void;
334
+ handleEditTask: (task: RenderTask) => void;
335
+ hasChildren: boolean;
336
+ icons?: Partial<GanttRenderIconsProps>;
337
+ indexStr: string;
338
+ isClosed: boolean;
339
+ isShowTaskNumbers: boolean;
340
+ onExpanderClick: (task: Task) => void;
341
+ task: RenderTask;
342
+ };
343
+ export type ColumnProps = {
344
+ data: ColumnData;
345
+ };
346
+ export type Column = {
347
+ id: string;
348
+ component: ComponentType<ColumnProps>;
349
+ width: number;
350
+ title?: ReactNode;
351
+ canResize?: boolean;
352
+ };
353
+ export type OnResizeColumn = (nextColumns: readonly Column[], columnIndex: number, deltaWidth: number) => void;
354
+ export type ChangeAction = {
355
+ type: "add-childs";
356
+ parent: Task;
357
+ addedIdsMap: Map<number, Set<string>>;
358
+ addedChildsByLevelMap: ChildByLevelMap;
359
+ addedRootsByLevelMap: RootMapByLevel;
360
+ descendants: readonly RenderTask[];
361
+ } | {
362
+ type: "change";
363
+ task: RenderTask;
364
+ } | {
365
+ type: "change_start_and_end";
366
+ task: Task;
367
+ changedTask: Task;
368
+ originalTask: Task;
369
+ } | {
370
+ type: "delete";
371
+ tasks: readonly RenderTask[];
372
+ deletedIdsMap: Map<number, Set<string>>;
373
+ } | {
374
+ type: "move-before";
375
+ target: RenderTask;
376
+ taskForMove: RenderTask;
377
+ } | {
378
+ type: "move-after";
379
+ target: RenderTask;
380
+ taskForMove: RenderTask;
381
+ } | {
382
+ type: "move-inside";
383
+ parent: Task;
384
+ childs: readonly RenderTask[];
385
+ movedIdsMap: Map<number, Set<string>>;
386
+ };
387
+ export type ChangeMetadata = [
388
+ /**
389
+ * dependent tasks
390
+ */
391
+ Task[],
392
+ /**
393
+ * indexes in list of tasks
394
+ */
395
+ Array<{
396
+ task: RenderTask;
397
+ index: number;
398
+ }>,
399
+ /**
400
+ * array of parents of the task
401
+ */
402
+ Task[],
403
+ /**
404
+ * array of suggesgions for change parent
405
+ */
406
+ OnDateChangeSuggestionType[]
407
+ ];
408
+ export type ContextMenuType = {
409
+ task: RenderTask | null;
410
+ x: number;
411
+ y: number;
412
+ };
413
+ export type ActionMetaType = {
414
+ /**
415
+ * Check is task id exists at current level (1 by default)
416
+ */
417
+ checkTaskIdExists: CheckTaskIdExistsAtLevel;
418
+ /**
419
+ * Copy all selected tasks
420
+ */
421
+ copySelectedTasks: () => void;
422
+ /**
423
+ * Copy single task
424
+ * @param task the task
425
+ */
426
+ copyTask: (task: RenderTask) => void;
427
+ /**
428
+ * Cut all selected tasks
429
+ */
430
+ cutSelectedTasks: () => void;
431
+ /**
432
+ * Cut single task
433
+ * @param task the task
434
+ */
435
+ cutTask: (task: RenderTask) => void;
436
+ /**
437
+ * @returns List of parent tasks under copy action
438
+ */
439
+ getCopyParentTasks: () => readonly RenderTask[];
440
+ /**
441
+ * @returns List of tasks under copy action
442
+ */
443
+ getCopyTasks: () => readonly RenderTask[];
444
+ /**
445
+ * @returns List of tasks with all their descendants under copy action
446
+ */
447
+ getCopyTasksWithDescendants: () => readonly RenderTask[];
448
+ /**
449
+ * @returns List of parent tasks under cut action
450
+ */
451
+ getCutParentTasks: () => readonly RenderTask[];
452
+ /**
453
+ * @returns List of tasks under cut action
454
+ */
455
+ getCutTasks: () => readonly RenderTask[];
456
+ /**
457
+ * @returns List of parent tasks
458
+ */
459
+ getParentTasks: () => readonly RenderTask[];
460
+ /**
461
+ * @returns List of selected tasks
462
+ */
463
+ getSelectedTasks: () => readonly RenderTask[];
464
+ /**
465
+ * @returns List of tasks with all their descendants
466
+ */
467
+ getTasksWithDescendants: () => readonly RenderTask[];
468
+ /**
469
+ * Add childs to the container task
470
+ * @param parent the container task
471
+ * @param descendants list of added childs with their descendants
472
+ */
473
+ handleAddChilds: (parent: Task, descendants: readonly RenderTask[]) => void;
474
+ /**
475
+ * Delete tasks
476
+ * @param tasksForDelete list of tasks for delete
477
+ */
478
+ handleDeleteTasks: (tasksForDelete: readonly RenderTask[]) => void;
479
+ /**
480
+ * Edit task
481
+ */
482
+ handleEditTask: (task: RenderTask) => void;
483
+ /**
484
+ * Move tasks to the container task
485
+ * @param parent the container task
486
+ * @param childs list of moved tasks
487
+ */
488
+ handleMoveTasksInside: (parent: Task, childs: readonly RenderTask[]) => void;
489
+ /**
490
+ * Make copies of the list of tasks
491
+ */
492
+ makeCopies: (tasks: readonly RenderTask[]) => readonly RenderTask[];
493
+ /**
494
+ * Reset selection
495
+ */
496
+ resetSelectedTasks: () => void;
497
+ /**
498
+ * Task that triggered context menu
499
+ */
500
+ task: RenderTask;
501
+ };
502
+ export type CheckIsAvailableMetaType = {
503
+ /**
504
+ *
505
+ * @returns Check are there tasks under the copy action
506
+ */
507
+ checkHasCopyTasks: () => boolean;
508
+ /**
509
+ *
510
+ * @returns Check are there tasks under the cut action
511
+ */
512
+ checkHasCutTasks: () => boolean;
513
+ /**
514
+ * Context menu trigger task
515
+ */
516
+ task: RenderTask;
517
+ };
518
+ export type ContextMenuOptionType = {
519
+ /**
520
+ * Invokes on click on menu option
521
+ * @param meta Metadata for the action
522
+ */
523
+ action: (meta: ActionMetaType) => void;
524
+ /**
525
+ * Check is the current action available. Available by default
526
+ * @param meta Metadata for checking
527
+ */
528
+ checkIsAvailable?: (meta: CheckIsAvailableMetaType) => void;
529
+ label: ReactNode;
530
+ icon?: ReactNode;
531
+ };
532
+ export type CheckTaskIdExistsAtLevel = (newId: string, comparisonLevel?: number) => boolean;
533
+ export type GetCopiedTaskId = (task: RenderTask, checkExists: (newId: string) => boolean) => string;
534
+ export type AdjustTaskToWorkingDatesParams = {
535
+ action: TaskBarMoveAction;
536
+ changedTask: Task;
537
+ originalTask: Task;
538
+ };
@@ -0,0 +1,30 @@
1
+ import type { Locale as DateLocale } from "date-fns";
2
+ export interface GanttLocale {
3
+ /**
4
+ * Locale of date-fns
5
+ */
6
+ dateLocale?: DateLocale;
7
+ suffix: {
8
+ days: string;
9
+ };
10
+ tooltip: {
11
+ duration: string;
12
+ progress: string;
13
+ };
14
+ table: {
15
+ columns: {
16
+ name: string;
17
+ startDate: string;
18
+ endDate: string;
19
+ dependencies: string;
20
+ progress: string;
21
+ };
22
+ };
23
+ context: {
24
+ edit: string;
25
+ copy: string;
26
+ cut: string;
27
+ paste: string;
28
+ delete: string;
29
+ };
30
+ }
@@ -0,0 +1,84 @@
1
+ import { DateFormats, Distances } from "./common-types";
2
+ export interface GanttPartialTheme {
3
+ rtl?: boolean;
4
+ colors?: Partial<ColorStyles>;
5
+ shape?: Partial<ShapeStyles>;
6
+ typography?: Partial<TypographyStyles>;
7
+ distances?: Partial<Distances>;
8
+ dateFormats?: Partial<DateFormats>;
9
+ }
10
+ export interface GanttTheme {
11
+ rtl?: boolean;
12
+ colors: ColorStyles;
13
+ shape: ShapeStyles;
14
+ typography: TypographyStyles;
15
+ distances: Distances;
16
+ dateFormats: DateFormats;
17
+ }
18
+ export interface TypographyStyles {
19
+ fontFamily: string;
20
+ fontSize: string;
21
+ }
22
+ export interface ShapeStyles {
23
+ borderRadius: string;
24
+ }
25
+ export interface ColorStyles {
26
+ backgroundColor: string;
27
+ arrowColor: string;
28
+ arrowRelationColor: string;
29
+ dividerColor: string;
30
+ hoverFilter: string;
31
+ loadingPrimaryColor: string;
32
+ loadingSecondaryColor: string;
33
+ arrowCriticalColor: string;
34
+ barComparisonDefaultColor: string;
35
+ barComparisonPlanColor: string;
36
+ barComparisonWarningColor: string;
37
+ barComparisonCriticalColor: string;
38
+ barHandleColor: string;
39
+ barProgressColor: string;
40
+ barProgressCriticalColor: string;
41
+ barProgressSelectedColor: string;
42
+ barProgressSelectedCriticalColor: string;
43
+ barBackgroundColor: string;
44
+ barBackgroundCriticalColor: string;
45
+ barBackgroundSelectedColor: string;
46
+ barBackgroundSelectedCriticalColor: string;
47
+ groupProgressColor: string;
48
+ groupProgressCriticalColor: string;
49
+ groupProgressSelectedColor: string;
50
+ groupProgressSelectedCriticalColor: string;
51
+ groupBackgroundColor: string;
52
+ groupBackgroundCriticalColor: string;
53
+ groupBackgroundSelectedColor: string;
54
+ groupBackgroundSelectedCriticalColor: string;
55
+ projectProgressColor: string;
56
+ projectProgressCriticalColor: string;
57
+ projectProgressSelectedColor: string;
58
+ projectProgressSelectedCriticalColor: string;
59
+ projectBackgroundColor: string;
60
+ projectBackgroundCriticalColor: string;
61
+ projectBackgroundSelectedColor: string;
62
+ projectBackgroundSelectedCriticalColor: string;
63
+ milestoneBackgroundColor: string;
64
+ milestoneBackgroundCriticalColor: string;
65
+ milestoneBackgroundSelectedColor: string;
66
+ milestoneBackgroundSelectedCriticalColor: string;
67
+ calendarHolidayColor: string;
68
+ arrowHoverColor: string;
69
+ tableDragTaskBackgroundColor: string;
70
+ tableSelectedTaskBackgroundColor: string;
71
+ tableActionColor: string;
72
+ tableDragIndicatorColor: string;
73
+ tableHoverActionColor: string;
74
+ tableEvenBackgroundColor: string;
75
+ calendarTodayColor: string;
76
+ contextMenuBoxShadow: string;
77
+ contextMenuBgColor: string;
78
+ contextMenuTextColor: string;
79
+ tooltipBoxShadow: string;
80
+ scrollbarThumbColor: string;
81
+ calendarStrokeColor: string;
82
+ primaryTextColor: string;
83
+ secondaryTextColor: string;
84
+ }