gantt-task-react-powern 0.6.44 → 0.6.45
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.
- package/README.md +3 -0
- package/dist/components/gantt/task-gantt-content.d.ts +6 -0
- package/dist/helpers/bar-helper.d.ts +10 -2
- package/dist/helpers/calendar-helper.d.ts +4 -1
- package/dist/helpers/date-helper.d.ts +5 -0
- package/dist/index.js +81 -87
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +81 -87
- package/dist/index.modern.js.map +1 -1
- package/dist/test/bar-segments.test.d.ts +1 -0
- package/dist/test/calendar-helper.test.d.ts +1 -0
- package/dist/test/hide-actual-before-slider.test.d.ts +1 -0
- package/dist/test/slider-bar-colors.test.d.ts +1 -0
- package/dist/types/public-types.d.ts +12 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,6 +72,8 @@ npm start
|
|
|
72
72
|
| endDate | Date | Project-level end date used for calendar/critical-path bounds. |
|
|
73
73
|
| projectCalendar | CalendarDefinition | Working calendar (shifts, off days, holidays) applied to scheduling. |
|
|
74
74
|
| sliderTime | number | Vertical slider time marker (ms) drawn on the chart. |
|
|
75
|
+
| hideActualBeforeSlider | boolean | Draws actual bars transparent until `sliderTime` reaches their actual start day. |
|
|
76
|
+
| plannedInProgressColor | string | Planned bar fill while `sliderTime` is inside the task's `inProgressWindow`. |
|
|
75
77
|
| [EventOption](#EventOption) | interface | Specifies gantt events. |
|
|
76
78
|
| [DisplayOption](#DisplayOption) | interface | Specifies view type and display timeline language. |
|
|
77
79
|
| [StylingOption](#StylingOption) | interface | Specifies chart and global tasks styles |
|
|
@@ -159,6 +161,7 @@ npm start
|
|
|
159
161
|
| optionalId | string | Optional secondary id (e.g. external system id). |
|
|
160
162
|
| dependencies | DependencyType[] | Parent dependencies. Each entry is `{ id: string; type: "SS" \| "SF" \| "FS" \| "FF" }`. |
|
|
161
163
|
| criticalPathArrows | object[] | Arrows on the critical path: `{ taskId: string; arrowColor: string; criticalPathType: string }`. |
|
|
164
|
+
| inProgressWindow | object | `{ start: Date; end?: Date }`: days the planned bar takes `plannedInProgressColor` (open-ended without `end`). |
|
|
162
165
|
| styles | object | Specifies the taskbar styling settings locally. Object is passed with the following attributes: |
|
|
163
166
|
| | | - **backgroundColor**: String. Specifies the taskbar background fill color locally. |
|
|
164
167
|
| | | - **backgroundSelectedColor**: String. Specifies the taskbar background fill color locally on select. |
|
|
@@ -28,5 +28,11 @@ export declare type TaskGanttContentProps = {
|
|
|
28
28
|
setSelectedTask: (taskId: string) => void;
|
|
29
29
|
onBarTasksUpdate?: (task: BarTask) => void;
|
|
30
30
|
sliderTime?: number;
|
|
31
|
+
/** Draw actual bars transparent until sliderTime reaches their actual start day. */
|
|
32
|
+
hideActualBeforeSlider?: boolean;
|
|
33
|
+
/** Planned bar fill while sliderTime is inside the task's `inProgressWindow`. */
|
|
34
|
+
plannedInProgressColor?: string;
|
|
35
|
+
/** Split calendar bars around off days; false in Month/Quarter views. */
|
|
36
|
+
segmentBars?: boolean;
|
|
31
37
|
} & EventOption;
|
|
32
38
|
export declare const TaskGanttContent: React.FC<TaskGanttContentProps>;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { Task } from "../types/public-types";
|
|
1
|
+
import { CalendarDefinition, Task } from "../types/public-types";
|
|
2
2
|
import { BarTask } from "../types/bar-task";
|
|
3
3
|
import { BarMoveAction } from "../types/gantt-task-actions";
|
|
4
|
-
export declare const convertToBarTasks: (tasks: Task[], dates: Date[], columnWidth: number, rowHeight: number, taskHeight: number, barCornerRadius: number, handleWidth: number, rtl: boolean, barProgressColor: string, barProgressSelectedColor: string, barBackgroundColor: string, barBackgroundSelectedColor: string, projectProgressColor: string, projectProgressSelectedColor: string, projectBackgroundColor: string, projectBackgroundSelectedColor: string, milestoneBackgroundColor: string, milestoneBackgroundSelectedColor: string) => BarTask[];
|
|
4
|
+
export declare const convertToBarTasks: (tasks: Task[], dates: Date[], columnWidth: number, rowHeight: number, taskHeight: number, barCornerRadius: number, handleWidth: number, rtl: boolean, barProgressColor: string, barProgressSelectedColor: string, barBackgroundColor: string, barBackgroundSelectedColor: string, projectProgressColor: string, projectProgressSelectedColor: string, projectBackgroundColor: string, projectBackgroundSelectedColor: string, milestoneBackgroundColor: string, milestoneBackgroundSelectedColor: string, segmentBars?: boolean) => BarTask[];
|
|
5
|
+
/**
|
|
6
|
+
* x-ranges of the working intervals from `start` through the end of `end`'s
|
|
7
|
+
* day, or undefined when none fall inside the chart.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getWorkingSegments: (start: Date, end: Date, calendar: CalendarDefinition, dates: Date[], columnWidth: number) => {
|
|
10
|
+
x1: number;
|
|
11
|
+
x2: number;
|
|
12
|
+
}[] | undefined;
|
|
5
13
|
export declare const taskXCoordinate: (xDate: Date, dates: Date[], columnWidth: number) => number;
|
|
6
14
|
export declare const progressWithByParams: (taskX1: number, taskX2: number, progress: number, rtl: boolean) => number[];
|
|
7
15
|
export declare const progressByProgressWidth: (progressWidth: number, barTask: BarTask) => number;
|
|
@@ -3,7 +3,10 @@ import { CalendarDefinition } from "../types/public-types";
|
|
|
3
3
|
export declare function parseTimeToMinutes(t: string): number;
|
|
4
4
|
/** True if the date falls on a calendar holiday. */
|
|
5
5
|
export declare function isHoliday(date: Date, cal: CalendarDefinition): boolean;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* True if the date's weekday is in off_days or is a holiday. Local weekday, to
|
|
8
|
+
* match the local-midnight dates and day loops used everywhere else.
|
|
9
|
+
*/
|
|
7
10
|
export declare function isOffDay(date: Date, cal: CalendarDefinition): boolean;
|
|
8
11
|
/** Gets the timestamps (Milliseconds - UTC) of all off-days for a calendar between a start and end date*/
|
|
9
12
|
export declare function getOffDays(calendar: CalendarDefinition, start: Date, end: Date): number[];
|
|
@@ -27,4 +27,9 @@ export declare const getLocaleMonth: (date: Date, locale: string) => string;
|
|
|
27
27
|
export declare const getLocalDayOfWeek: (date: Date, locale: string, format?: "long" | "short" | "narrow" | undefined) => string;
|
|
28
28
|
export declare const getWeekNumberISO8601: (date: Date) => string;
|
|
29
29
|
export declare const getDaysInMonth: (month: number, year: number) => number;
|
|
30
|
+
/**
|
|
31
|
+
* Day-resolution views shade calendar off days and split task bars around
|
|
32
|
+
* them; Month and Quarter columns are too coarse, so they do neither.
|
|
33
|
+
*/
|
|
34
|
+
export declare const viewShowsOffDays: (viewMode?: ViewMode | undefined) => boolean;
|
|
30
35
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -269,6 +269,9 @@ var getMonday = function getMonday(date) {
|
|
|
269
269
|
var diff = date.getDate() - day + (day === 0 ? -6 : 1);
|
|
270
270
|
return new Date(date.setDate(diff));
|
|
271
271
|
};
|
|
272
|
+
var viewShowsOffDays = function viewShowsOffDays(viewMode) {
|
|
273
|
+
return viewMode !== exports.ViewMode.Month && viewMode !== exports.ViewMode.Quarter;
|
|
274
|
+
};
|
|
272
275
|
|
|
273
276
|
var styles = {"ganttTable":"_3_ygE","ganttTable_Header":"_1nBOt","ganttTable_HeaderSeparator":"_2eZzQ","ganttTable_HeaderResizeHandle":"_ddPJg","ganttTable_HeaderItem":"_WuQ0f","ganttTable_HeaderItemText":"_2X3fk"};
|
|
274
277
|
|
|
@@ -402,7 +405,7 @@ function isHoliday(date, cal) {
|
|
|
402
405
|
}
|
|
403
406
|
function isOffDay(date, cal) {
|
|
404
407
|
if (cal.off_days && cal.off_days.length > 0) {
|
|
405
|
-
return cal.off_days.includes(date.
|
|
408
|
+
return cal.off_days.includes(date.getDay()) || isHoliday(date, cal);
|
|
406
409
|
} else {
|
|
407
410
|
return false;
|
|
408
411
|
}
|
|
@@ -1474,7 +1477,7 @@ var GridBody = function GridBody(_ref) {
|
|
|
1474
1477
|
}));
|
|
1475
1478
|
}
|
|
1476
1479
|
|
|
1477
|
-
if (viewMode
|
|
1480
|
+
if (viewShowsOffDays(viewMode)) {
|
|
1478
1481
|
var _dates;
|
|
1479
1482
|
|
|
1480
1483
|
var pEnd = (_dates = dates[i + 1]) != null ? _dates : addToDate(dates[i], 1, "day");
|
|
@@ -1541,7 +1544,7 @@ var GridBody = function GridBody(_ref) {
|
|
|
1541
1544
|
y2: visibleStartY,
|
|
1542
1545
|
className: styles$5.gridRowLine
|
|
1543
1546
|
}));
|
|
1544
|
-
var showPerRowOffDays = viewMode
|
|
1547
|
+
var showPerRowOffDays = viewShowsOffDays(viewMode);
|
|
1545
1548
|
|
|
1546
1549
|
for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {
|
|
1547
1550
|
var vi = _step.value;
|
|
@@ -2289,9 +2292,13 @@ var drawPathAndTriangle = function drawPathAndTriangle(taskFrom, taskTo, rowHeig
|
|
|
2289
2292
|
return [path, trianglePoints];
|
|
2290
2293
|
};
|
|
2291
2294
|
|
|
2292
|
-
var convertToBarTasks = function convertToBarTasks(tasks, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor) {
|
|
2295
|
+
var convertToBarTasks = function convertToBarTasks(tasks, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor, segmentBars) {
|
|
2296
|
+
if (segmentBars === void 0) {
|
|
2297
|
+
segmentBars = true;
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2293
2300
|
var barTasks = tasks.map(function (t, i) {
|
|
2294
|
-
return convertToBarTask(t, i, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor);
|
|
2301
|
+
return convertToBarTask(t, i, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor, segmentBars);
|
|
2295
2302
|
});
|
|
2296
2303
|
var indexById = new Map();
|
|
2297
2304
|
|
|
@@ -2319,7 +2326,7 @@ var convertToBarTasks = function convertToBarTasks(tasks, dates, columnWidth, ro
|
|
|
2319
2326
|
return barTasks;
|
|
2320
2327
|
};
|
|
2321
2328
|
|
|
2322
|
-
var convertToBarTask = function convertToBarTask(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor) {
|
|
2329
|
+
var convertToBarTask = function convertToBarTask(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor, segmentBars) {
|
|
2323
2330
|
var barTask;
|
|
2324
2331
|
|
|
2325
2332
|
switch (task.type) {
|
|
@@ -2328,18 +2335,18 @@ var convertToBarTask = function convertToBarTask(task, index, dates, columnWidth
|
|
|
2328
2335
|
break;
|
|
2329
2336
|
|
|
2330
2337
|
case "project":
|
|
2331
|
-
barTask = convertToBar(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor);
|
|
2338
|
+
barTask = convertToBar(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, segmentBars);
|
|
2332
2339
|
break;
|
|
2333
2340
|
|
|
2334
2341
|
default:
|
|
2335
|
-
barTask = convertToBar(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor);
|
|
2342
|
+
barTask = convertToBar(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, segmentBars);
|
|
2336
2343
|
break;
|
|
2337
2344
|
}
|
|
2338
2345
|
|
|
2339
2346
|
return barTask;
|
|
2340
2347
|
};
|
|
2341
2348
|
|
|
2342
|
-
var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor) {
|
|
2349
|
+
var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, segmentBars) {
|
|
2343
2350
|
var x1;
|
|
2344
2351
|
var x2;
|
|
2345
2352
|
var actualx1;
|
|
@@ -2372,35 +2379,12 @@ var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHei
|
|
|
2372
2379
|
var plannedSegments;
|
|
2373
2380
|
var actualSegments;
|
|
2374
2381
|
|
|
2375
|
-
if (task.calendar && task.start && task.end && task.start.getTime() > 0) {
|
|
2376
|
-
|
|
2377
|
-
var intervals = getWorkingIntervals(task.start, planEnd, task.calendar);
|
|
2378
|
-
var segs = intervals.map(function (iv) {
|
|
2379
|
-
return {
|
|
2380
|
-
x1: taskXCoordinate(iv.start, dates, columnWidth),
|
|
2381
|
-
x2: taskXCoordinate(iv.end, dates, columnWidth)
|
|
2382
|
-
};
|
|
2383
|
-
}).filter(function (s) {
|
|
2384
|
-
return s.x2 > s.x1;
|
|
2385
|
-
});
|
|
2386
|
-
if (segs.length > 0) plannedSegments = segs;
|
|
2382
|
+
if (segmentBars && task.calendar && task.start && task.end && task.start.getTime() > 0) {
|
|
2383
|
+
plannedSegments = getWorkingSegments(task.start, task.end, task.calendar, dates, columnWidth);
|
|
2387
2384
|
}
|
|
2388
2385
|
|
|
2389
|
-
if (task.calendar && task.actualStart && task.actualEnd && task.actualStart.getTime() > 0) {
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
var _intervals = getWorkingIntervals(task.actualStart, actEnd, task.calendar);
|
|
2393
|
-
|
|
2394
|
-
var _segs = _intervals.map(function (iv) {
|
|
2395
|
-
return {
|
|
2396
|
-
x1: taskXCoordinate(iv.start, dates, columnWidth),
|
|
2397
|
-
x2: taskXCoordinate(iv.end, dates, columnWidth)
|
|
2398
|
-
};
|
|
2399
|
-
}).filter(function (s) {
|
|
2400
|
-
return s.x2 > s.x1;
|
|
2401
|
-
});
|
|
2402
|
-
|
|
2403
|
-
if (_segs.length > 0) actualSegments = _segs;
|
|
2386
|
+
if (segmentBars && task.calendar && task.actualStart && task.actualEnd && task.actualStart.getTime() > 0) {
|
|
2387
|
+
actualSegments = getWorkingSegments(task.actualStart, task.actualEnd, task.calendar, dates, columnWidth);
|
|
2404
2388
|
}
|
|
2405
2389
|
|
|
2406
2390
|
var styles = _extends({
|
|
@@ -2433,6 +2417,18 @@ var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHei
|
|
|
2433
2417
|
});
|
|
2434
2418
|
};
|
|
2435
2419
|
|
|
2420
|
+
var getWorkingSegments = function getWorkingSegments(start, end, calendar, dates, columnWidth) {
|
|
2421
|
+
var segs = getWorkingIntervals(start, addToDate(startOfDate(end, "day"), 1, "day"), calendar).map(function (iv) {
|
|
2422
|
+
return {
|
|
2423
|
+
x1: taskXCoordinate(iv.start, dates, columnWidth),
|
|
2424
|
+
x2: taskXCoordinate(iv.end, dates, columnWidth)
|
|
2425
|
+
};
|
|
2426
|
+
}).filter(function (s) {
|
|
2427
|
+
return s.x2 > s.x1;
|
|
2428
|
+
});
|
|
2429
|
+
return segs.length > 0 ? segs : undefined;
|
|
2430
|
+
};
|
|
2431
|
+
|
|
2436
2432
|
var convertToMilestone = function convertToMilestone(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, milestoneBackgroundColor, milestoneBackgroundSelectedColor) {
|
|
2437
2433
|
var x = task.start && task.end ? taskXCoordinate(task.end, dates, columnWidth) : 0;
|
|
2438
2434
|
var y = taskYCoordinate(index, rowHeight, taskHeight);
|
|
@@ -3326,6 +3322,7 @@ var TaskItem = function TaskItem(props) {
|
|
|
3326
3322
|
}, taskItem[1]));
|
|
3327
3323
|
};
|
|
3328
3324
|
|
|
3325
|
+
var HIDDEN_ACTUAL_COLOR = "rgba(0, 0, 0, 0)";
|
|
3329
3326
|
var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
3330
3327
|
var _svg$current;
|
|
3331
3328
|
|
|
@@ -3357,7 +3354,12 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3357
3354
|
projectCalendar = _ref.projectCalendar,
|
|
3358
3355
|
visibleStartY = _ref.visibleStartY,
|
|
3359
3356
|
visibleEndY = _ref.visibleEndY,
|
|
3360
|
-
sliderTime = _ref.sliderTime
|
|
3357
|
+
sliderTime = _ref.sliderTime,
|
|
3358
|
+
_ref$hideActualBefore = _ref.hideActualBeforeSlider,
|
|
3359
|
+
hideActualBeforeSlider = _ref$hideActualBefore === void 0 ? false : _ref$hideActualBefore,
|
|
3360
|
+
plannedInProgressColor = _ref.plannedInProgressColor,
|
|
3361
|
+
_ref$segmentBars = _ref.segmentBars,
|
|
3362
|
+
segmentBars = _ref$segmentBars === void 0 ? true : _ref$segmentBars;
|
|
3361
3363
|
var point = svg === null || svg === void 0 ? void 0 : (_svg$current = svg.current) === null || _svg$current === void 0 ? void 0 : _svg$current.createSVGPoint();
|
|
3362
3364
|
|
|
3363
3365
|
var _useState = React.useState(0),
|
|
@@ -3424,17 +3426,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3424
3426
|
finalTask.actualx2 = taskXCoordinate(finalTask.actualEnd, dates, columnWidth);
|
|
3425
3427
|
}
|
|
3426
3428
|
|
|
3427
|
-
|
|
3428
|
-
var actIntervals = getWorkingIntervals(finalTask.actualStart, actEnd, cal);
|
|
3429
|
-
var actSegs = actIntervals.map(function (iv) {
|
|
3430
|
-
return {
|
|
3431
|
-
x1: taskXCoordinate(iv.start, dates, columnWidth),
|
|
3432
|
-
x2: taskXCoordinate(iv.end, dates, columnWidth)
|
|
3433
|
-
};
|
|
3434
|
-
}).filter(function (s) {
|
|
3435
|
-
return s.x2 > s.x1;
|
|
3436
|
-
});
|
|
3437
|
-
finalTask.actualSegments = actSegs.length > 0 ? actSegs : undefined;
|
|
3429
|
+
finalTask.actualSegments = segmentBars ? getWorkingSegments(finalTask.actualStart, finalTask.actualEnd, cal, dates, columnWidth) : undefined;
|
|
3438
3430
|
var offTimeDays = finalTask.calendar ? getOffDays(finalTask.calendar, finalTask.actualStart, finalTask.actualEnd) : [];
|
|
3439
3431
|
var actDays = Math.max(1, Math.round((finalTask.actualEnd.getTime() - finalTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)) - offTimeDays.length);
|
|
3440
3432
|
finalTask.actualDuration = actDays;
|
|
@@ -3460,17 +3452,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3460
3452
|
finalTask.x2 = taskXCoordinate(finalTask.end, dates, columnWidth);
|
|
3461
3453
|
}
|
|
3462
3454
|
|
|
3463
|
-
|
|
3464
|
-
var planIntervals = getWorkingIntervals(finalTask.start, planEnd, cal);
|
|
3465
|
-
var planSegs = planIntervals.map(function (iv) {
|
|
3466
|
-
return {
|
|
3467
|
-
x1: taskXCoordinate(iv.start, dates, columnWidth),
|
|
3468
|
-
x2: taskXCoordinate(iv.end, dates, columnWidth)
|
|
3469
|
-
};
|
|
3470
|
-
}).filter(function (s) {
|
|
3471
|
-
return s.x2 > s.x1;
|
|
3472
|
-
});
|
|
3473
|
-
finalTask.plannedSegments = planSegs.length > 0 ? planSegs : undefined;
|
|
3455
|
+
finalTask.plannedSegments = segmentBars ? getWorkingSegments(finalTask.start, finalTask.end, cal, dates, columnWidth) : undefined;
|
|
3474
3456
|
|
|
3475
3457
|
var _offTimeDays = finalTask.calendar ? getOffDays(finalTask.calendar, finalTask.start, finalTask.end) : [];
|
|
3476
3458
|
|
|
@@ -3562,17 +3544,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3562
3544
|
newChangedTask.actualx2 = taskXCoordinate(newChangedTask.actualEnd, dates, columnWidth);
|
|
3563
3545
|
}
|
|
3564
3546
|
|
|
3565
|
-
|
|
3566
|
-
var actIntervals = getWorkingIntervals(newChangedTask.actualStart, actEnd, cal);
|
|
3567
|
-
var actSegs = actIntervals.map(function (iv) {
|
|
3568
|
-
return {
|
|
3569
|
-
x1: taskXCoordinate(iv.start, dates, columnWidth),
|
|
3570
|
-
x2: taskXCoordinate(iv.end, dates, columnWidth)
|
|
3571
|
-
};
|
|
3572
|
-
}).filter(function (s) {
|
|
3573
|
-
return s.x2 > s.x1;
|
|
3574
|
-
});
|
|
3575
|
-
newChangedTask.actualSegments = actSegs.length > 0 ? actSegs : undefined;
|
|
3547
|
+
newChangedTask.actualSegments = segmentBars ? getWorkingSegments(newChangedTask.actualStart, newChangedTask.actualEnd, cal, dates, columnWidth) : undefined;
|
|
3576
3548
|
var offTimeDays = newChangedTask.calendar ? getOffDays(newChangedTask.calendar, newChangedTask.actualStart, newChangedTask.actualEnd) : [];
|
|
3577
3549
|
var actDays = Math.max(1, Math.round((newChangedTask.actualEnd.getTime() - newChangedTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)) - offTimeDays.length);
|
|
3578
3550
|
newChangedTask.actualDuration = actDays;
|
|
@@ -3610,17 +3582,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3610
3582
|
newChangedTask.x2 = taskXCoordinate(newChangedTask.end, dates, columnWidth);
|
|
3611
3583
|
}
|
|
3612
3584
|
|
|
3613
|
-
|
|
3614
|
-
var planIntervals = getWorkingIntervals(newChangedTask.start, planEnd, cal);
|
|
3615
|
-
var planSegs = planIntervals.map(function (iv) {
|
|
3616
|
-
return {
|
|
3617
|
-
x1: taskXCoordinate(iv.start, dates, columnWidth),
|
|
3618
|
-
x2: taskXCoordinate(iv.end, dates, columnWidth)
|
|
3619
|
-
};
|
|
3620
|
-
}).filter(function (s) {
|
|
3621
|
-
return s.x2 > s.x1;
|
|
3622
|
-
});
|
|
3623
|
-
newChangedTask.plannedSegments = planSegs.length > 0 ? planSegs : undefined;
|
|
3585
|
+
newChangedTask.plannedSegments = segmentBars ? getWorkingSegments(newChangedTask.start, newChangedTask.end, cal, dates, columnWidth) : undefined;
|
|
3624
3586
|
|
|
3625
3587
|
var _offTimeDays2 = newChangedTask.calendar ? getOffDays(newChangedTask.calendar, newChangedTask.start, newChangedTask.end) : [];
|
|
3626
3588
|
|
|
@@ -3697,7 +3659,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3697
3659
|
svg.current.addEventListener("mouseup", handleMouseUp);
|
|
3698
3660
|
setIsMoving(true);
|
|
3699
3661
|
}
|
|
3700
|
-
}, [ganttEvent, xStep, initEventX1Delta, onProgressChange, timeStep, onDateChange, onCalendarError, projectCalendar, svg, isMoving, point, rtl, setFailedTask, setGanttEvent, onBarTasksUpdate, dates, columnWidth]);
|
|
3662
|
+
}, [ganttEvent, xStep, initEventX1Delta, onProgressChange, timeStep, onDateChange, onCalendarError, projectCalendar, svg, isMoving, point, rtl, segmentBars, setFailedTask, setGanttEvent, onBarTasksUpdate, dates, columnWidth]);
|
|
3701
3663
|
|
|
3702
3664
|
var handleBarEventStart = function handleBarEventStart(action, task, event, type) {
|
|
3703
3665
|
try {
|
|
@@ -3852,6 +3814,17 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3852
3814
|
|
|
3853
3815
|
var lineX = sliderTime !== undefined ? taskXCoordinate(new Date(sliderTime), dates, columnWidth) : null;
|
|
3854
3816
|
var totalHeight = tasks.length * rowHeight;
|
|
3817
|
+
var sliderDate = sliderTime != null ? new Date(sliderTime) : null;
|
|
3818
|
+
|
|
3819
|
+
var isActualBeforeSlider = function isActualBeforeSlider(task) {
|
|
3820
|
+
return hideActualBeforeSlider && !!sliderDate && !!task.actualStart && startOfDate(task.actualStart, "day") > sliderDate;
|
|
3821
|
+
};
|
|
3822
|
+
|
|
3823
|
+
var isInProgressAtSlider = function isInProgressAtSlider(_ref2) {
|
|
3824
|
+
var w = _ref2.inProgressWindow;
|
|
3825
|
+
return !!plannedInProgressColor && !!sliderDate && !!w && startOfDate(w.start, "day") <= sliderDate && (!w.end || addToDate(startOfDate(w.end, "day"), 1, "day") > sliderDate);
|
|
3826
|
+
};
|
|
3827
|
+
|
|
3855
3828
|
return React__default.createElement("g", {
|
|
3856
3829
|
className: "content"
|
|
3857
3830
|
}, lineX !== null && lineX > 0 && React__default.createElement("line", {
|
|
@@ -3877,6 +3850,19 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3877
3850
|
y: 0
|
|
3878
3851
|
});
|
|
3879
3852
|
|
|
3853
|
+
if (isActualBeforeSlider(task)) {
|
|
3854
|
+
task.styles = _extends({}, task.styles, {
|
|
3855
|
+
taskProgressColor: HIDDEN_ACTUAL_COLOR
|
|
3856
|
+
});
|
|
3857
|
+
}
|
|
3858
|
+
|
|
3859
|
+
if (isInProgressAtSlider(task)) {
|
|
3860
|
+
task.styles = _extends({}, task.styles, {
|
|
3861
|
+
backgroundColor: plannedInProgressColor,
|
|
3862
|
+
backgroundSelectedColor: plannedInProgressColor
|
|
3863
|
+
});
|
|
3864
|
+
}
|
|
3865
|
+
|
|
3880
3866
|
if (!task && _task.typeInternal === "milestone") {
|
|
3881
3867
|
return React__default.createElement("g", {
|
|
3882
3868
|
key: _task.id,
|
|
@@ -4029,6 +4015,8 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
|
|
|
4029
4015
|
};
|
|
4030
4016
|
|
|
4031
4017
|
var GANTT_MIN_WIDTH_RATIO = 0.4;
|
|
4018
|
+
var PRIMARY_PATH_COLOR = "#AA00FF";
|
|
4019
|
+
var SECONDARY_PATH_COLOR = "#ff82e4";
|
|
4032
4020
|
var TABLE_GANTT_DIVIDER_WIDTH = 20;
|
|
4033
4021
|
var Gantt = function Gantt(_ref) {
|
|
4034
4022
|
var _ref3;
|
|
@@ -4123,7 +4111,10 @@ var Gantt = function Gantt(_ref) {
|
|
|
4123
4111
|
shouldNotShowLoadingOverlay = _ref$shouldNotShowLoa === void 0 ? true : _ref$shouldNotShowLoa,
|
|
4124
4112
|
projectCalendar = _ref.projectCalendar,
|
|
4125
4113
|
onCalendarError = _ref.onCalendarError,
|
|
4126
|
-
sliderTime = _ref.sliderTime
|
|
4114
|
+
sliderTime = _ref.sliderTime,
|
|
4115
|
+
_ref$hideActualBefore = _ref.hideActualBeforeSlider,
|
|
4116
|
+
hideActualBeforeSlider = _ref$hideActualBefore === void 0 ? false : _ref$hideActualBefore,
|
|
4117
|
+
plannedInProgressColor = _ref.plannedInProgressColor;
|
|
4127
4118
|
var wrapperRef = React.useRef(null);
|
|
4128
4119
|
var taskListRef = React.useRef(null);
|
|
4129
4120
|
var isDraggingTable = React.useRef(false);
|
|
@@ -4399,11 +4390,11 @@ var Gantt = function Gantt(_ref) {
|
|
|
4399
4390
|
uncolorAll(tasks);
|
|
4400
4391
|
|
|
4401
4392
|
if (scheduleType !== "lookAhead") {
|
|
4402
|
-
colorPath(secondaryPath,
|
|
4403
|
-
colorPath(primaryPath,
|
|
4393
|
+
colorPath(secondaryPath, SECONDARY_PATH_COLOR, tasks, "secondary");
|
|
4394
|
+
colorPath(primaryPath, PRIMARY_PATH_COLOR, tasks, "primary");
|
|
4404
4395
|
}
|
|
4405
4396
|
|
|
4406
|
-
setBarTasks(convertToBarTasks(filteredTasks, newDates, effectiveColumnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor));
|
|
4397
|
+
setBarTasks(convertToBarTasks(filteredTasks, newDates, effectiveColumnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor, viewShowsOffDays(viewMode)));
|
|
4407
4398
|
setIsProcessing(false);
|
|
4408
4399
|
}, delayToRender);
|
|
4409
4400
|
}, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor, rtl, shouldNotShowLoadingOverlay, effectiveColumnWidth, projectCalendar]);
|
|
@@ -4758,7 +4749,10 @@ var Gantt = function Gantt(_ref) {
|
|
|
4758
4749
|
projectCalendar: projectCalendar,
|
|
4759
4750
|
visibleStartY: visibleStartY,
|
|
4760
4751
|
visibleEndY: visibleEndY,
|
|
4761
|
-
sliderTime: sliderTime
|
|
4752
|
+
sliderTime: sliderTime,
|
|
4753
|
+
hideActualBeforeSlider: hideActualBeforeSlider,
|
|
4754
|
+
plannedInProgressColor: plannedInProgressColor,
|
|
4755
|
+
segmentBars: viewShowsOffDays(viewMode)
|
|
4762
4756
|
};
|
|
4763
4757
|
var tableTasks = React.useMemo(function () {
|
|
4764
4758
|
return ganttEvent.changedTask ? barTasks.map(function (t) {
|