gantt-task-react-powern 0.6.42 → 0.6.43
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/dist/helpers/calendar-helper.d.ts +2 -0
- package/dist/index.js +201 -259
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +201 -259
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -380,6 +380,187 @@ var TaskListHeaderDefault = function TaskListHeaderDefault(_ref) {
|
|
|
380
380
|
|
|
381
381
|
var styles$1 = {"taskListWrapper":"_3ZbQT","taskListTableRow":"_34SS0","taskListLookAheadRow":"_GzvG4","taskListMilestoneRow":"_3Ykml","taskListCell":"_3lLk3","taskListNameWrapper":"_nI1Xw","taskListExpander":"_2QjE6","taskListExpanderPlaceholder":"_1fnLB","taskListEmptyExpander":"_2TfEi","taskListText":"_2ZvXU"};
|
|
382
382
|
|
|
383
|
+
function parseTimeToMinutes(t) {
|
|
384
|
+
var parts = t.split(":").map(Number);
|
|
385
|
+
return parts[0] * 60 + parts[1] + (parts[2] ? parts[2] / 60 : 0);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function toDateString(date) {
|
|
389
|
+
var y = date.getFullYear();
|
|
390
|
+
var m = String(date.getMonth() + 1).padStart(2, "0");
|
|
391
|
+
var d = String(date.getDate()).padStart(2, "0");
|
|
392
|
+
return y + "-" + m + "-" + d;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function isHoliday(date, cal) {
|
|
396
|
+
if (cal.holidays && cal.holidays.length > 0) {
|
|
397
|
+
return cal.holidays.includes(toDateString(date));
|
|
398
|
+
} else {
|
|
399
|
+
return false;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
function isOffDay(date, cal) {
|
|
403
|
+
if (cal.off_days && cal.off_days.length > 0) {
|
|
404
|
+
return cal.off_days.includes(date.getUTCDay()) || isHoliday(date, cal);
|
|
405
|
+
} else {
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function getOffDays(calendar, start, end) {
|
|
410
|
+
var daysOff = [];
|
|
411
|
+
if (!calendar) return daysOff;
|
|
412
|
+
var currentDate = new Date(start);
|
|
413
|
+
|
|
414
|
+
while (currentDate <= end) {
|
|
415
|
+
if (isOffDay(currentDate, calendar)) {
|
|
416
|
+
daysOff.push(currentDate.getTime());
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
currentDate.setDate(currentDate.getDate() + 1);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
return daysOff;
|
|
423
|
+
}
|
|
424
|
+
var parsedShiftsCache = new WeakMap();
|
|
425
|
+
var offDayCache = new WeakMap();
|
|
426
|
+
|
|
427
|
+
function parsedShifts(cal) {
|
|
428
|
+
var shifts = parsedShiftsCache.get(cal);
|
|
429
|
+
|
|
430
|
+
if (!shifts) {
|
|
431
|
+
var _cal$shifts;
|
|
432
|
+
|
|
433
|
+
shifts = ((_cal$shifts = cal.shifts) != null ? _cal$shifts : []).map(function (_ref) {
|
|
434
|
+
var s = _ref[0],
|
|
435
|
+
e = _ref[1];
|
|
436
|
+
return {
|
|
437
|
+
start: parseTimeToMinutes(s),
|
|
438
|
+
end: parseTimeToMinutes(e)
|
|
439
|
+
};
|
|
440
|
+
});
|
|
441
|
+
parsedShiftsCache.set(cal, shifts);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
return shifts;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function isOffDayCached(date, cal) {
|
|
448
|
+
var perCal = offDayCache.get(cal);
|
|
449
|
+
|
|
450
|
+
if (!perCal) {
|
|
451
|
+
perCal = new Map();
|
|
452
|
+
offDayCache.set(cal, perCal);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
var key = date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate();
|
|
456
|
+
var off = perCal.get(key);
|
|
457
|
+
|
|
458
|
+
if (off === undefined) {
|
|
459
|
+
off = isOffDay(date, cal);
|
|
460
|
+
perCal.set(key, off);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
return off;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
var NO_SHIFTS = [];
|
|
467
|
+
function getShiftsForDay(date, cal) {
|
|
468
|
+
if (!cal.shifts || isOffDayCached(date, cal)) return NO_SHIFTS;
|
|
469
|
+
return parsedShifts(cal);
|
|
470
|
+
}
|
|
471
|
+
function getWorkingIntervals(start, end, cal) {
|
|
472
|
+
if (start >= end) return [];
|
|
473
|
+
var intervals = [];
|
|
474
|
+
var cursor = new Date(start);
|
|
475
|
+
cursor.setHours(0, 0, 0, 0);
|
|
476
|
+
|
|
477
|
+
while (cursor <= end) {
|
|
478
|
+
var shifts = getShiftsForDay(cursor, cal);
|
|
479
|
+
|
|
480
|
+
for (var _iterator = _createForOfIteratorHelperLoose(shifts), _step; !(_step = _iterator()).done;) {
|
|
481
|
+
var shift = _step.value;
|
|
482
|
+
var shiftStart = new Date(cursor);
|
|
483
|
+
shiftStart.setHours(Math.floor(shift.start / 60), Math.floor(shift.start % 60), Math.round(shift.start % 1 * 60), 0);
|
|
484
|
+
var shiftEnd = new Date(cursor);
|
|
485
|
+
shiftEnd.setHours(Math.floor(shift.end / 60), Math.floor(shift.end % 60), Math.round(shift.end % 1 * 60), 0);
|
|
486
|
+
var intervalStart = shiftStart < start ? start : shiftStart;
|
|
487
|
+
var intervalEnd = shiftEnd > end ? end : shiftEnd;
|
|
488
|
+
|
|
489
|
+
if (intervalStart < intervalEnd) {
|
|
490
|
+
intervals.push({
|
|
491
|
+
start: intervalStart,
|
|
492
|
+
end: intervalEnd
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
cursor.setDate(cursor.getDate() + 1);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
return intervals;
|
|
501
|
+
}
|
|
502
|
+
function snapToWorkingTime(date, cal, direction) {
|
|
503
|
+
var MAX_DAYS = 60;
|
|
504
|
+
var result = new Date(date);
|
|
505
|
+
|
|
506
|
+
for (var attempt = 0; attempt < MAX_DAYS * 24 * 60; attempt++) {
|
|
507
|
+
var dayStart = new Date(result);
|
|
508
|
+
dayStart.setHours(0, 0, 0, 0);
|
|
509
|
+
var shifts = getShiftsForDay(dayStart, cal);
|
|
510
|
+
|
|
511
|
+
if (shifts.length > 0) {
|
|
512
|
+
if (direction === "forward") {
|
|
513
|
+
var currentMins = result.getHours() * 60 + result.getMinutes() + result.getSeconds() / 60;
|
|
514
|
+
|
|
515
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(shifts), _step2; !(_step2 = _iterator2()).done;) {
|
|
516
|
+
var shift = _step2.value;
|
|
517
|
+
|
|
518
|
+
if (currentMins <= shift.end) {
|
|
519
|
+
if (currentMins < shift.start) {
|
|
520
|
+
result.setHours(Math.floor(shift.start / 60), Math.round(shift.start % 60), 0, 0);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
return result;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
result.setDate(result.getDate() + 1);
|
|
528
|
+
result.setHours(0, 0, 0, 0);
|
|
529
|
+
} else {
|
|
530
|
+
var _currentMins = result.getHours() * 60 + result.getMinutes() + result.getSeconds() / 60;
|
|
531
|
+
|
|
532
|
+
for (var i = shifts.length - 1; i >= 0; i--) {
|
|
533
|
+
if (_currentMins >= shifts[i].start) {
|
|
534
|
+
if (_currentMins > shifts[i].end) {
|
|
535
|
+
result.setHours(Math.floor(shifts[i].end / 60), Math.round(shifts[i].end % 60), 0, 0);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
return result;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
result.setDate(result.getDate() - 1);
|
|
543
|
+
result.setHours(23, 59, 59, 0);
|
|
544
|
+
}
|
|
545
|
+
} else {
|
|
546
|
+
if (direction === "forward") {
|
|
547
|
+
result.setDate(result.getDate() + 1);
|
|
548
|
+
result.setHours(0, 0, 0, 0);
|
|
549
|
+
} else {
|
|
550
|
+
result.setDate(result.getDate() - 1);
|
|
551
|
+
result.setHours(23, 59, 59, 0);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
return date;
|
|
557
|
+
}
|
|
558
|
+
function getQuarterNumber(date, quarterStart) {
|
|
559
|
+
var month = date.getMonth();
|
|
560
|
+
var offset = (month - quarterStart + 12) % 12;
|
|
561
|
+
return Math.floor(offset / 3) + 1;
|
|
562
|
+
}
|
|
563
|
+
|
|
383
564
|
var localeDateStringCache = {};
|
|
384
565
|
|
|
385
566
|
var toLocaleDateStringFactory = function toLocaleDateStringFactory(locale) {
|
|
@@ -604,7 +785,8 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
604
785
|
var actualDuration = function () {
|
|
605
786
|
if (!t.actualStart || t.actualStart.getTime() === 0) return null;
|
|
606
787
|
var endRef = t.actualEnd && t.actualEnd.getTime() > 0 ? t.actualEnd : new Date();
|
|
607
|
-
|
|
788
|
+
var offTimeDays = t.calendar ? getOffDays(t.calendar, t.actualStart, t.actualEnd) : [];
|
|
789
|
+
return Math.ceil((endRef.getTime() - t.actualStart.getTime()) / (1000 * 60 * 60 * 24)) - offTimeDays.length;
|
|
608
790
|
}();
|
|
609
791
|
|
|
610
792
|
return React.createElement(React.Fragment, null, React.createElement("div", {
|
|
@@ -749,43 +931,6 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
749
931
|
type: type
|
|
750
932
|
}));
|
|
751
933
|
};
|
|
752
|
-
|
|
753
|
-
function getOffTime(task, taskStart, taskEnd, _message) {
|
|
754
|
-
var start = taskStart.getTime();
|
|
755
|
-
var end = taskEnd.getTime();
|
|
756
|
-
var startWeek = Math.floor((start / 86400000 + 4) / 7);
|
|
757
|
-
var endWeek = Math.floor((end / 86400000 + 4) / 7);
|
|
758
|
-
var offTime = 0;
|
|
759
|
-
|
|
760
|
-
if (task.calendar) {
|
|
761
|
-
if (task.calendar.off_days && task.calendar.off_days.length) {
|
|
762
|
-
for (var d = 0; d < task.calendar.off_days.length || 0; d++) {
|
|
763
|
-
for (var w = startWeek; w <= endWeek; w++) {
|
|
764
|
-
var dayOfTheWeek = task.calendar.off_days[d];
|
|
765
|
-
var offDay = 86400000 * (7 * w - 4 + dayOfTheWeek);
|
|
766
|
-
|
|
767
|
-
if (offDay >= start && offDay <= end) {
|
|
768
|
-
offTime += 86400000;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
if (task.calendar.holidays && task.calendar.holidays.length) {
|
|
775
|
-
for (var h = 0; h < task.calendar.holidays.length || 0; h++) {
|
|
776
|
-
var holiday = task.calendar.holidays[h];
|
|
777
|
-
var holiday_timestamp = new Date(holiday).getTime();
|
|
778
|
-
|
|
779
|
-
if (holiday_timestamp >= start && holiday_timestamp <= end) {
|
|
780
|
-
offTime += 86400000;
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
return offTime;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
934
|
var StandardTooltipContent = function StandardTooltipContent(_ref2) {
|
|
790
935
|
var _task$plannedDuration, _task$actualDuration;
|
|
791
936
|
|
|
@@ -797,8 +942,10 @@ var StandardTooltipContent = function StandardTooltipContent(_ref2) {
|
|
|
797
942
|
fontSize: fontSize,
|
|
798
943
|
fontFamily: fontFamily
|
|
799
944
|
};
|
|
800
|
-
var
|
|
801
|
-
var
|
|
945
|
+
var actualOffTimeDays = task.calendar ? getOffDays(task.calendar, task.actualStart, task.actualEnd) : [];
|
|
946
|
+
var plannedOffTimeDays = task.calendar ? getOffDays(task.calendar, task.start, task.end) : [];
|
|
947
|
+
var computedPlannedDuration = task.start && task.end && task.end.getTime() - task.start.getTime() > 0 ? Math.max(1, Math.round((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24)) - plannedOffTimeDays.length) : (_task$plannedDuration = task.plannedDuration) != null ? _task$plannedDuration : 0;
|
|
948
|
+
var computedActualDuration = task.actualStart && task.actualEnd && task.actualEnd.getTime() - task.actualStart.getTime() > 0 ? Math.max(1, Math.round((task.actualEnd.getTime() - task.actualStart.getTime()) / (1000 * 60 * 60 * 24)) - actualOffTimeDays.length) : (_task$actualDuration = task.actualDuration) != null ? _task$actualDuration : 0;
|
|
802
949
|
if (type == "planned") return React.createElement("div", {
|
|
803
950
|
className: styles$2.tooltipDefaultContainer,
|
|
804
951
|
style: style
|
|
@@ -1257,172 +1404,6 @@ var TaskList = function TaskList(_ref) {
|
|
|
1257
1404
|
}, React.createElement(TaskListTable, Object.assign({}, tableProps))))));
|
|
1258
1405
|
};
|
|
1259
1406
|
|
|
1260
|
-
function parseTimeToMinutes(t) {
|
|
1261
|
-
var parts = t.split(":").map(Number);
|
|
1262
|
-
return parts[0] * 60 + parts[1] + (parts[2] ? parts[2] / 60 : 0);
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
function toDateString(date) {
|
|
1266
|
-
var y = date.getFullYear();
|
|
1267
|
-
var m = String(date.getMonth() + 1).padStart(2, "0");
|
|
1268
|
-
var d = String(date.getDate()).padStart(2, "0");
|
|
1269
|
-
return y + "-" + m + "-" + d;
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
function isHoliday(date, cal) {
|
|
1273
|
-
if (cal.holidays && cal.holidays.length > 0) {
|
|
1274
|
-
return cal.holidays.includes(toDateString(date));
|
|
1275
|
-
} else {
|
|
1276
|
-
return false;
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
function isOffDay(date, cal) {
|
|
1280
|
-
if (cal.off_days && cal.off_days.length > 0) {
|
|
1281
|
-
return cal.off_days.includes(date.getDay()) || isHoliday(date, cal);
|
|
1282
|
-
} else {
|
|
1283
|
-
return false;
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
var parsedShiftsCache = new WeakMap();
|
|
1287
|
-
var offDayCache = new WeakMap();
|
|
1288
|
-
|
|
1289
|
-
function parsedShifts(cal) {
|
|
1290
|
-
var shifts = parsedShiftsCache.get(cal);
|
|
1291
|
-
|
|
1292
|
-
if (!shifts) {
|
|
1293
|
-
var _cal$shifts;
|
|
1294
|
-
|
|
1295
|
-
shifts = ((_cal$shifts = cal.shifts) != null ? _cal$shifts : []).map(function (_ref) {
|
|
1296
|
-
var s = _ref[0],
|
|
1297
|
-
e = _ref[1];
|
|
1298
|
-
return {
|
|
1299
|
-
start: parseTimeToMinutes(s),
|
|
1300
|
-
end: parseTimeToMinutes(e)
|
|
1301
|
-
};
|
|
1302
|
-
});
|
|
1303
|
-
parsedShiftsCache.set(cal, shifts);
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
return shifts;
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
function isOffDayCached(date, cal) {
|
|
1310
|
-
var perCal = offDayCache.get(cal);
|
|
1311
|
-
|
|
1312
|
-
if (!perCal) {
|
|
1313
|
-
perCal = new Map();
|
|
1314
|
-
offDayCache.set(cal, perCal);
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
var key = date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate();
|
|
1318
|
-
var off = perCal.get(key);
|
|
1319
|
-
|
|
1320
|
-
if (off === undefined) {
|
|
1321
|
-
off = isOffDay(date, cal);
|
|
1322
|
-
perCal.set(key, off);
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
return off;
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
var NO_SHIFTS = [];
|
|
1329
|
-
function getShiftsForDay(date, cal) {
|
|
1330
|
-
if (!cal.shifts || isOffDayCached(date, cal)) return NO_SHIFTS;
|
|
1331
|
-
return parsedShifts(cal);
|
|
1332
|
-
}
|
|
1333
|
-
function getWorkingIntervals(start, end, cal) {
|
|
1334
|
-
if (start >= end) return [];
|
|
1335
|
-
var intervals = [];
|
|
1336
|
-
var cursor = new Date(start);
|
|
1337
|
-
cursor.setHours(0, 0, 0, 0);
|
|
1338
|
-
|
|
1339
|
-
while (cursor <= end) {
|
|
1340
|
-
var shifts = getShiftsForDay(cursor, cal);
|
|
1341
|
-
|
|
1342
|
-
for (var _iterator = _createForOfIteratorHelperLoose(shifts), _step; !(_step = _iterator()).done;) {
|
|
1343
|
-
var shift = _step.value;
|
|
1344
|
-
var shiftStart = new Date(cursor);
|
|
1345
|
-
shiftStart.setHours(Math.floor(shift.start / 60), Math.floor(shift.start % 60), Math.round(shift.start % 1 * 60), 0);
|
|
1346
|
-
var shiftEnd = new Date(cursor);
|
|
1347
|
-
shiftEnd.setHours(Math.floor(shift.end / 60), Math.floor(shift.end % 60), Math.round(shift.end % 1 * 60), 0);
|
|
1348
|
-
var intervalStart = shiftStart < start ? start : shiftStart;
|
|
1349
|
-
var intervalEnd = shiftEnd > end ? end : shiftEnd;
|
|
1350
|
-
|
|
1351
|
-
if (intervalStart < intervalEnd) {
|
|
1352
|
-
intervals.push({
|
|
1353
|
-
start: intervalStart,
|
|
1354
|
-
end: intervalEnd
|
|
1355
|
-
});
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
cursor.setDate(cursor.getDate() + 1);
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
return intervals;
|
|
1363
|
-
}
|
|
1364
|
-
function snapToWorkingTime(date, cal, direction) {
|
|
1365
|
-
var MAX_DAYS = 60;
|
|
1366
|
-
var result = new Date(date);
|
|
1367
|
-
|
|
1368
|
-
for (var attempt = 0; attempt < MAX_DAYS * 24 * 60; attempt++) {
|
|
1369
|
-
var dayStart = new Date(result);
|
|
1370
|
-
dayStart.setHours(0, 0, 0, 0);
|
|
1371
|
-
var shifts = getShiftsForDay(dayStart, cal);
|
|
1372
|
-
|
|
1373
|
-
if (shifts.length > 0) {
|
|
1374
|
-
if (direction === "forward") {
|
|
1375
|
-
var currentMins = result.getHours() * 60 + result.getMinutes() + result.getSeconds() / 60;
|
|
1376
|
-
|
|
1377
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose(shifts), _step2; !(_step2 = _iterator2()).done;) {
|
|
1378
|
-
var shift = _step2.value;
|
|
1379
|
-
|
|
1380
|
-
if (currentMins <= shift.end) {
|
|
1381
|
-
if (currentMins < shift.start) {
|
|
1382
|
-
result.setHours(Math.floor(shift.start / 60), Math.round(shift.start % 60), 0, 0);
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
return result;
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
result.setDate(result.getDate() + 1);
|
|
1390
|
-
result.setHours(0, 0, 0, 0);
|
|
1391
|
-
} else {
|
|
1392
|
-
var _currentMins = result.getHours() * 60 + result.getMinutes() + result.getSeconds() / 60;
|
|
1393
|
-
|
|
1394
|
-
for (var i = shifts.length - 1; i >= 0; i--) {
|
|
1395
|
-
if (_currentMins >= shifts[i].start) {
|
|
1396
|
-
if (_currentMins > shifts[i].end) {
|
|
1397
|
-
result.setHours(Math.floor(shifts[i].end / 60), Math.round(shifts[i].end % 60), 0, 0);
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
return result;
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
result.setDate(result.getDate() - 1);
|
|
1405
|
-
result.setHours(23, 59, 59, 0);
|
|
1406
|
-
}
|
|
1407
|
-
} else {
|
|
1408
|
-
if (direction === "forward") {
|
|
1409
|
-
result.setDate(result.getDate() + 1);
|
|
1410
|
-
result.setHours(0, 0, 0, 0);
|
|
1411
|
-
} else {
|
|
1412
|
-
result.setDate(result.getDate() - 1);
|
|
1413
|
-
result.setHours(23, 59, 59, 0);
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
return date;
|
|
1419
|
-
}
|
|
1420
|
-
function getQuarterNumber(date, quarterStart) {
|
|
1421
|
-
var month = date.getMonth();
|
|
1422
|
-
var offset = (month - quarterStart + 12) % 12;
|
|
1423
|
-
return Math.floor(offset / 3) + 1;
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1426
1407
|
var styles$5 = {"gridRow":"_2dZTy","gridRowLookAhead":"_2RRca","gridRowLine":"_3rUKi","gridTick":"_RuwuK","gridTickWeekStart":"_1q0EV","gridTickDashed":"_Zh9jh","darkerGridRow":"_2M-tt"};
|
|
1427
1408
|
|
|
1428
1409
|
var GridBody = function GridBody(_ref) {
|
|
@@ -3459,7 +3440,8 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3459
3440
|
return s.x2 > s.x1;
|
|
3460
3441
|
});
|
|
3461
3442
|
finalTask.actualSegments = actSegs.length > 0 ? actSegs : undefined;
|
|
3462
|
-
var
|
|
3443
|
+
var offTimeDays = finalTask.calendar ? getOffDays(finalTask.calendar, finalTask.actualStart, finalTask.actualEnd) : [];
|
|
3444
|
+
var actDays = Math.max(1, Math.round((finalTask.actualEnd.getTime() - finalTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)) - offTimeDays.length);
|
|
3463
3445
|
finalTask.actualDuration = actDays;
|
|
3464
3446
|
} else {
|
|
3465
3447
|
if (ganttEvent.action === "end") {
|
|
@@ -3494,13 +3476,10 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3494
3476
|
return s.x2 > s.x1;
|
|
3495
3477
|
});
|
|
3496
3478
|
finalTask.plannedSegments = planSegs.length > 0 ? planSegs : undefined;
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
}
|
|
3502
|
-
});
|
|
3503
|
-
var planDays = Math.max(1, Math.round((finalTask.end.getTime() - finalTask.start.getTime()) / (1000 * 60 * 60 * 24)) - totalDaysOff);
|
|
3479
|
+
|
|
3480
|
+
var _offTimeDays = finalTask.calendar ? getOffDays(finalTask.calendar, finalTask.start, finalTask.end) : [];
|
|
3481
|
+
|
|
3482
|
+
var planDays = Math.max(1, Math.round((finalTask.end.getTime() - finalTask.start.getTime()) / (1000 * 60 * 60 * 24)) - _offTimeDays.length);
|
|
3504
3483
|
finalTask.plannedDuration = planDays;
|
|
3505
3484
|
}
|
|
3506
3485
|
} else {
|
|
@@ -3599,7 +3578,8 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3599
3578
|
return s.x2 > s.x1;
|
|
3600
3579
|
});
|
|
3601
3580
|
newChangedTask.actualSegments = actSegs.length > 0 ? actSegs : undefined;
|
|
3602
|
-
var
|
|
3581
|
+
var offTimeDays = newChangedTask.calendar ? getOffDays(newChangedTask.calendar, newChangedTask.actualStart, newChangedTask.actualEnd) : [];
|
|
3582
|
+
var actDays = Math.max(1, Math.round((newChangedTask.actualEnd.getTime() - newChangedTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)) - offTimeDays.length);
|
|
3603
3583
|
newChangedTask.actualDuration = actDays;
|
|
3604
3584
|
} else {
|
|
3605
3585
|
if (action === "end") {
|
|
@@ -3646,13 +3626,10 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3646
3626
|
return s.x2 > s.x1;
|
|
3647
3627
|
});
|
|
3648
3628
|
newChangedTask.plannedSegments = planSegs.length > 0 ? planSegs : undefined;
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
}
|
|
3654
|
-
});
|
|
3655
|
-
var planDays = Math.max(1, Math.round((newChangedTask.end.getTime() - newChangedTask.start.getTime()) / (1000 * 60 * 60 * 24)) - totalDaysOff);
|
|
3629
|
+
|
|
3630
|
+
var _offTimeDays2 = newChangedTask.calendar ? getOffDays(newChangedTask.calendar, newChangedTask.start, newChangedTask.end) : [];
|
|
3631
|
+
|
|
3632
|
+
var planDays = Math.max(1, Math.round((newChangedTask.end.getTime() - newChangedTask.start.getTime()) / (1000 * 60 * 60 * 24)) - _offTimeDays2.length);
|
|
3656
3633
|
newChangedTask.plannedDuration = planDays;
|
|
3657
3634
|
}
|
|
3658
3635
|
} else if (action === "move" || action === "end" || action === "start") {
|
|
@@ -5078,54 +5055,19 @@ function getCriticalPaths(leafTasks) {
|
|
|
5078
5055
|
|
|
5079
5056
|
return [[], []];
|
|
5080
5057
|
}
|
|
5081
|
-
|
|
5082
|
-
function getOffTime$1(tIndex, taskMap, start, end) {
|
|
5083
|
-
var startWeek = Math.floor((start / 86400000 + 4) / 7);
|
|
5084
|
-
var endWeek = Math.floor((end / 86400000 + 4) / 7);
|
|
5085
|
-
var offTime = [];
|
|
5086
|
-
|
|
5087
|
-
if (taskMap[tIndex].task.calendar) {
|
|
5088
|
-
if (taskMap[tIndex].task.calendar.off_days && taskMap[tIndex].task.calendar.off_days.length) {
|
|
5089
|
-
for (var d = 0; d < taskMap[tIndex].task.calendar.off_days.length || 0; d++) {
|
|
5090
|
-
for (var w = startWeek; w <= endWeek; w++) {
|
|
5091
|
-
var dayOfTheWeek = taskMap[tIndex].task.calendar.off_days[d];
|
|
5092
|
-
var offDay = 86400000 * (7 * w - 4 + dayOfTheWeek);
|
|
5093
|
-
|
|
5094
|
-
if (offDay >= start && offDay <= end) {
|
|
5095
|
-
offTime.push(offDay);
|
|
5096
|
-
}
|
|
5097
|
-
}
|
|
5098
|
-
}
|
|
5099
|
-
}
|
|
5100
|
-
|
|
5101
|
-
if (taskMap[tIndex].task.calendar.holidays && taskMap[tIndex].task.calendar.holidays.length) {
|
|
5102
|
-
for (var h = 0; h < taskMap[tIndex].task.calendar.holidays.length || 0; h++) {
|
|
5103
|
-
var holiday = taskMap[tIndex].task.calendar.holidays[h];
|
|
5104
|
-
var holiday_timestamp = new Date(holiday).getTime();
|
|
5105
|
-
|
|
5106
|
-
if (holiday_timestamp >= start && holiday_timestamp <= end) {
|
|
5107
|
-
offTime.push(holiday_timestamp);
|
|
5108
|
-
}
|
|
5109
|
-
}
|
|
5110
|
-
}
|
|
5111
|
-
}
|
|
5112
|
-
|
|
5113
|
-
return offTime;
|
|
5114
|
-
}
|
|
5115
|
-
|
|
5116
5058
|
function computeCriticalPath(taskID, taskMap) {
|
|
5117
5059
|
var task = taskMap[taskID].task;
|
|
5118
5060
|
var dependents = taskMap[taskID].dependents;
|
|
5119
5061
|
taskMap[taskID].start = task.start.getTime();
|
|
5120
5062
|
taskMap[taskID].end = task.end.getTime();
|
|
5121
5063
|
taskMap[taskID].paths = [];
|
|
5122
|
-
var parent_off_time =
|
|
5064
|
+
var parent_off_time = getOffDays(taskMap[taskID].calendar, taskMap[taskID].start, taskMap[taskID].end);
|
|
5123
5065
|
|
|
5124
5066
|
for (var j = 0; j < dependents.length; j++) {
|
|
5125
5067
|
var depStart = taskMap[dependents[j]].task.start.getTime();
|
|
5126
5068
|
var depEnd = taskMap[dependents[j]].task.end.getTime();
|
|
5127
5069
|
var depDuration = depEnd - depStart;
|
|
5128
|
-
var child_off_time =
|
|
5070
|
+
var child_off_time = getOffDays(dependents[j].calendar, taskMap[dependents[j]].task.start, taskMap[dependents[j]].task.end);
|
|
5129
5071
|
var overlap = Math.max(taskMap[taskID].end - depStart, 0);
|
|
5130
5072
|
|
|
5131
5073
|
for (var t = 0; t < parent_off_time.length; t++) {
|