gantt-task-react-powern 0.6.36 → 0.6.38

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/index.js CHANGED
@@ -22,10 +22,6 @@ function _extends() {
22
22
  return _extends.apply(this, arguments);
23
23
  }
24
24
 
25
- function _objectDestructuringEmpty(obj) {
26
- if (obj == null) throw new TypeError("Cannot destructure undefined");
27
- }
28
-
29
25
  function _unsupportedIterableToArray(o, minLen) {
30
26
  if (!o) return;
31
27
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -600,7 +596,7 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
600
596
 
601
597
  var percentComplete = t.percentComplete != null ? t.percentComplete : (_t$progress = t.progress) != null ? _t$progress : 0;
602
598
  var plannedDuration = t.plannedDuration != null ? t.plannedDuration : null;
603
- var remainingDuration = plannedDuration != null ? Math.round(plannedDuration - plannedDuration * (percentComplete / 100)) : null;
599
+ var remainingDuration = plannedDuration != null ? Math.max(Math.round(plannedDuration - plannedDuration * (percentComplete / 100)), 0) : null;
604
600
 
605
601
  var actualDuration = function () {
606
602
  if (!t.actualStart || t.actualStart.getTime() === 0) return null;
@@ -822,7 +818,7 @@ var VerticalScroll = function VerticalScroll(_ref) {
822
818
  };
823
819
 
824
820
  function getTaskListColumns(scheduleType, hasCheckbox) {
825
- var columns = [];
821
+ const columns = [];
826
822
  if (hasCheckbox) columns.push({
827
823
  id: "select",
828
824
  factor: 0.3
@@ -875,13 +871,12 @@ function getTaskListColumns(scheduleType, hasCheckbox) {
875
871
 
876
872
  return columns;
877
873
  }
878
- var MIN_COLUMN_WIDTH = 40;
874
+ const MIN_COLUMN_WIDTH = 40;
879
875
  function buildDefaultColumnWidths(scheduleType, hasCheckbox, rowWidth) {
880
- var base = parseInt(rowWidth) || 0;
881
- var widths = {};
876
+ const base = parseInt(rowWidth) || 0;
877
+ const widths = {};
882
878
 
883
- for (var _iterator = _createForOfIteratorHelperLoose(getTaskListColumns(scheduleType, hasCheckbox)), _step; !(_step = _iterator()).done;) {
884
- var col = _step.value;
879
+ for (const col of getTaskListColumns(scheduleType, hasCheckbox)) {
885
880
  widths[col.id] = base * col.factor;
886
881
  }
887
882
 
@@ -984,6 +979,14 @@ var TaskList = function TaskList(_ref) {
984
979
  React.useEffect(function () {
985
980
  onContentWidthChange === null || onContentWidthChange === void 0 ? void 0 : onContentWidthChange(contentWidth);
986
981
  }, [contentWidth, onContentWidthChange]);
982
+ var taskIdsKey = React.useMemo(function () {
983
+ return tasks.map(function (t) {
984
+ return t.id;
985
+ }).join("|");
986
+ }, [tasks]);
987
+ var selectedTaskIds = React.useMemo(function () {
988
+ return new Set(selectedTasks);
989
+ }, [selectedTasks]);
987
990
 
988
991
  var _useState3 = React.useState([]),
989
992
  pendingTaskSelect = _useState3[0],
@@ -1032,10 +1035,10 @@ var TaskList = function TaskList(_ref) {
1032
1035
  } else {
1033
1036
  var _descendants = getDescendants(taskId, tasks);
1034
1037
 
1035
- newSelected["delete"](taskId);
1038
+ newSelected.delete(taskId);
1036
1039
 
1037
1040
  _descendants.forEach(function (d) {
1038
- return newSelected["delete"](d);
1041
+ return newSelected.delete(d);
1039
1042
  });
1040
1043
  }
1041
1044
  });
@@ -1068,7 +1071,7 @@ var TaskList = function TaskList(_ref) {
1068
1071
  if (JSON.stringify(newSelectedArray) !== JSON.stringify(selectedTasks)) {
1069
1072
  setSelectedTasks(newSelectedArray);
1070
1073
  }
1071
- }, [tasks.length]);
1074
+ }, [taskIdsKey]);
1072
1075
 
1073
1076
  var getDescendants = function getDescendants(taskId, allTasks) {
1074
1077
  var task = allTasks.find(function (t) {
@@ -1113,15 +1116,10 @@ var TaskList = function TaskList(_ref) {
1113
1116
 
1114
1117
  var handleSelectAll = function handleSelectAll(selected) {
1115
1118
  if (selected) {
1116
- var topLevelTasks = tasks.filter(function (task) {
1117
- return !getParentWbs(task.id);
1118
- });
1119
- setPendingTaskSelect(topLevelTasks.map(function (task) {
1120
- return {
1121
- taskId: task.id,
1122
- selected: true
1123
- };
1119
+ setSelectedTasks(tasks.map(function (task) {
1120
+ return task.id;
1124
1121
  }));
1122
+ setPendingTaskSelect([]);
1125
1123
  } else {
1126
1124
  setSelectedTasks([]);
1127
1125
  setPendingTaskSelect([]);
@@ -1134,7 +1132,9 @@ var TaskList = function TaskList(_ref) {
1134
1132
  fontSize: fontSize,
1135
1133
  rowWidth: rowWidth,
1136
1134
  scheduleType: scheduleType,
1137
- allSelected: tasks.length > 0 && selectedTasks.length === tasks.length,
1135
+ allSelected: tasks.length > 0 && tasks.every(function (t) {
1136
+ return selectedTaskIds.has(t.id);
1137
+ }),
1138
1138
  onSelectAll: onMultiSelect ? handleSelectAll : undefined,
1139
1139
  columnWidths: columnWidths,
1140
1140
  onColumnResize: handleColumnResize
@@ -1195,15 +1195,15 @@ var TaskList = function TaskList(_ref) {
1195
1195
  };
1196
1196
 
1197
1197
  function parseTimeToMinutes(t) {
1198
- var parts = t.split(":").map(Number);
1198
+ const parts = t.split(":").map(Number);
1199
1199
  return parts[0] * 60 + parts[1] + (parts[2] ? parts[2] / 60 : 0);
1200
1200
  }
1201
1201
 
1202
1202
  function toDateString(date) {
1203
- var y = date.getFullYear();
1204
- var m = String(date.getMonth() + 1).padStart(2, "0");
1205
- var d = String(date.getDate()).padStart(2, "0");
1206
- return y + "-" + m + "-" + d;
1203
+ const y = date.getFullYear();
1204
+ const m = String(date.getMonth() + 1).padStart(2, "0");
1205
+ const d = String(date.getDate()).padStart(2, "0");
1206
+ return `${y}-${m}-${d}`;
1207
1207
  }
1208
1208
 
1209
1209
  function isHoliday(date, cal) {
@@ -1222,9 +1222,8 @@ function isOffDay(date, cal) {
1222
1222
  }
1223
1223
  function getShiftsForDay(date, cal) {
1224
1224
  if (isOffDay(date, cal) || !cal.shifts) return [];
1225
- return cal.shifts.map(function (_ref) {
1226
- var s = _ref[0],
1227
- e = _ref[1];
1225
+ return cal.shifts.map(_ref => {
1226
+ let [s, e] = _ref;
1228
1227
  return {
1229
1228
  start: parseTimeToMinutes(s),
1230
1229
  end: parseTimeToMinutes(e)
@@ -1233,21 +1232,20 @@ function getShiftsForDay(date, cal) {
1233
1232
  }
1234
1233
  function getWorkingIntervals(start, end, cal) {
1235
1234
  if (start >= end) return [];
1236
- var intervals = [];
1237
- var cursor = new Date(start);
1235
+ const intervals = [];
1236
+ const cursor = new Date(start);
1238
1237
  cursor.setHours(0, 0, 0, 0);
1239
1238
 
1240
1239
  while (cursor <= end) {
1241
- var shifts = getShiftsForDay(cursor, cal);
1240
+ const shifts = getShiftsForDay(cursor, cal);
1242
1241
 
1243
- for (var _iterator = _createForOfIteratorHelperLoose(shifts), _step; !(_step = _iterator()).done;) {
1244
- var shift = _step.value;
1245
- var shiftStart = new Date(cursor);
1242
+ for (const shift of shifts) {
1243
+ const shiftStart = new Date(cursor);
1246
1244
  shiftStart.setHours(Math.floor(shift.start / 60), Math.floor(shift.start % 60), Math.round(shift.start % 1 * 60), 0);
1247
- var shiftEnd = new Date(cursor);
1245
+ const shiftEnd = new Date(cursor);
1248
1246
  shiftEnd.setHours(Math.floor(shift.end / 60), Math.floor(shift.end % 60), Math.round(shift.end % 1 * 60), 0);
1249
- var intervalStart = shiftStart < start ? start : shiftStart;
1250
- var intervalEnd = shiftEnd > end ? end : shiftEnd;
1247
+ const intervalStart = shiftStart < start ? start : shiftStart;
1248
+ const intervalEnd = shiftEnd > end ? end : shiftEnd;
1251
1249
 
1252
1250
  if (intervalStart < intervalEnd) {
1253
1251
  intervals.push({
@@ -1263,21 +1261,19 @@ function getWorkingIntervals(start, end, cal) {
1263
1261
  return intervals;
1264
1262
  }
1265
1263
  function snapToWorkingTime(date, cal, direction) {
1266
- var MAX_DAYS = 60;
1267
- var result = new Date(date);
1264
+ const MAX_DAYS = 60;
1265
+ const result = new Date(date);
1268
1266
 
1269
- for (var attempt = 0; attempt < MAX_DAYS * 24 * 60; attempt++) {
1270
- var dayStart = new Date(result);
1267
+ for (let attempt = 0; attempt < MAX_DAYS * 24 * 60; attempt++) {
1268
+ const dayStart = new Date(result);
1271
1269
  dayStart.setHours(0, 0, 0, 0);
1272
- var shifts = getShiftsForDay(dayStart, cal);
1270
+ const shifts = getShiftsForDay(dayStart, cal);
1273
1271
 
1274
1272
  if (shifts.length > 0) {
1275
1273
  if (direction === "forward") {
1276
- var currentMins = result.getHours() * 60 + result.getMinutes() + result.getSeconds() / 60;
1277
-
1278
- for (var _iterator2 = _createForOfIteratorHelperLoose(shifts), _step2; !(_step2 = _iterator2()).done;) {
1279
- var shift = _step2.value;
1274
+ const currentMins = result.getHours() * 60 + result.getMinutes() + result.getSeconds() / 60;
1280
1275
 
1276
+ for (const shift of shifts) {
1281
1277
  if (currentMins <= shift.end) {
1282
1278
  if (currentMins < shift.start) {
1283
1279
  result.setHours(Math.floor(shift.start / 60), Math.round(shift.start % 60), 0, 0);
@@ -1290,11 +1286,11 @@ function snapToWorkingTime(date, cal, direction) {
1290
1286
  result.setDate(result.getDate() + 1);
1291
1287
  result.setHours(0, 0, 0, 0);
1292
1288
  } else {
1293
- var _currentMins = result.getHours() * 60 + result.getMinutes() + result.getSeconds() / 60;
1289
+ const currentMins = result.getHours() * 60 + result.getMinutes() + result.getSeconds() / 60;
1294
1290
 
1295
- for (var i = shifts.length - 1; i >= 0; i--) {
1296
- if (_currentMins >= shifts[i].start) {
1297
- if (_currentMins > shifts[i].end) {
1291
+ for (let i = shifts.length - 1; i >= 0; i--) {
1292
+ if (currentMins >= shifts[i].start) {
1293
+ if (currentMins > shifts[i].end) {
1298
1294
  result.setHours(Math.floor(shifts[i].end / 60), Math.round(shifts[i].end % 60), 0, 0);
1299
1295
  }
1300
1296
 
@@ -1319,72 +1315,69 @@ function snapToWorkingTime(date, cal, direction) {
1319
1315
  return date;
1320
1316
  }
1321
1317
  function getQuarterNumber(date, quarterStart) {
1322
- var month = date.getMonth();
1323
- var offset = (month - quarterStart + 12) % 12;
1318
+ const month = date.getMonth();
1319
+ const offset = (month - quarterStart + 12) % 12;
1324
1320
  return Math.floor(offset / 3) + 1;
1325
1321
  }
1326
1322
 
1327
1323
  var styles$5 = {"gridRow":"_2dZTy","gridRowLookAhead":"_2RRca","gridRowLine":"_3rUKi","gridTick":"_RuwuK","gridTickWeekStart":"_1q0EV","gridTickDashed":"_Zh9jh","darkerGridRow":"_2M-tt"};
1328
1324
 
1329
- var GridBody = function GridBody(_ref) {
1330
- var _projectCalendar$week;
1331
-
1332
- var tasks = _ref.tasks,
1333
- scheduleType = _ref.scheduleType,
1334
- dates = _ref.dates,
1335
- rowHeight = _ref.rowHeight,
1336
- svgWidth = _ref.svgWidth,
1337
- columnWidth = _ref.columnWidth,
1338
- todayColor = _ref.todayColor,
1339
- weekendColor = _ref.weekendColor,
1340
- rtl = _ref.rtl,
1341
- _ref$virtualItems = _ref.virtualItems,
1342
- virtualItems = _ref$virtualItems === void 0 ? [] : _ref$virtualItems,
1343
- visibleStartY = _ref.visibleStartY,
1344
- visibleEndY = _ref.visibleEndY,
1345
- projectCalendar = _ref.projectCalendar,
1346
- viewMode = _ref.viewMode;
1347
- var visibleHeight = visibleEndY - visibleStartY;
1348
- var now = new Date();
1349
- var items = virtualItems.length > 0 ? virtualItems : tasks.map(function (_, i) {
1350
- return {
1351
- index: i,
1352
- start: i * rowHeight,
1353
- end: (i + 1) * rowHeight,
1354
- size: rowHeight,
1355
- key: i
1356
- };
1357
- });
1325
+ const GridBody = _ref => {
1326
+ let {
1327
+ tasks,
1328
+ scheduleType,
1329
+ dates,
1330
+ rowHeight,
1331
+ svgWidth,
1332
+ columnWidth,
1333
+ todayColor,
1334
+ weekendColor,
1335
+ rtl,
1336
+ virtualItems = [],
1337
+ visibleStartY,
1338
+ visibleEndY,
1339
+ projectCalendar,
1340
+ viewMode
1341
+ } = _ref;
1342
+ const visibleHeight = visibleEndY - visibleStartY;
1343
+ const now = new Date();
1344
+ const items = virtualItems.length > 0 ? virtualItems : tasks.map((_, i) => ({
1345
+ index: i,
1346
+ start: i * rowHeight,
1347
+ end: (i + 1) * rowHeight,
1348
+ size: rowHeight,
1349
+ key: i
1350
+ }));
1358
1351
 
1359
- var isDayOff = function isDayOff(date) {
1352
+ const isDayOff = date => {
1360
1353
  if (projectCalendar) return isOffDay(date, projectCalendar);
1361
- var d = date.getDay();
1354
+ const d = date.getDay();
1362
1355
  return d === 0 || d === 6;
1363
1356
  };
1364
1357
 
1365
- var isTodayColumn = function isTodayColumn(i) {
1366
- var date = dates[i];
1367
- var next = dates[i + 1];
1358
+ const isTodayColumn = i => {
1359
+ const date = dates[i];
1360
+ const next = dates[i + 1];
1368
1361
  if (next && date <= now && next > now) return true;
1369
1362
 
1370
1363
  if (!next && date <= now) {
1371
- var prev = dates[i - 1];
1372
- var step = prev ? date.getTime() - prev.getTime() : 86400000;
1373
- var end = addToDate(date, step, "millisecond");
1364
+ const prev = dates[i - 1];
1365
+ const step = prev ? date.getTime() - prev.getTime() : 86400000;
1366
+ const end = addToDate(date, step, "millisecond");
1374
1367
  return end > now;
1375
1368
  }
1376
1369
 
1377
1370
  return false;
1378
1371
  };
1379
1372
 
1380
- var todayRects = [];
1381
- var offDayRects = [];
1382
- var weekStartDay = (_projectCalendar$week = projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.week_start) != null ? _projectCalendar$week : 1;
1373
+ const todayRects = [];
1374
+ const offDayRects = [];
1375
+ const weekStartDay = (projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.week_start) ?? 1;
1383
1376
 
1384
- for (var i = 0, x = 0; i < dates.length; i++, x += columnWidth) {
1377
+ for (let i = 0, x = 0; i < dates.length; i++, x += columnWidth) {
1385
1378
  if (isTodayColumn(i)) {
1386
1379
  todayRects.push(React__default.createElement("rect", {
1387
- key: "today-" + i,
1380
+ key: `today-${i}`,
1388
1381
  x: rtl ? x + columnWidth : x,
1389
1382
  y: visibleStartY,
1390
1383
  width: columnWidth,
@@ -1394,26 +1387,24 @@ var GridBody = function GridBody(_ref) {
1394
1387
  }
1395
1388
 
1396
1389
  if (viewMode !== exports.ViewMode.Month && viewMode !== exports.ViewMode.Quarter) {
1397
- var _dates;
1398
-
1399
- var pEnd = (_dates = dates[i + 1]) != null ? _dates : addToDate(dates[i], 1, "day");
1400
- var periodMs = pEnd.getTime() - dates[i].getTime();
1390
+ const pEnd = dates[i + 1] ?? addToDate(dates[i], 1, "day");
1391
+ const periodMs = pEnd.getTime() - dates[i].getTime();
1401
1392
 
1402
1393
  if (periodMs > 0) {
1403
- var cursor = new Date(dates[i]);
1394
+ const cursor = new Date(dates[i]);
1404
1395
  cursor.setHours(0, 0, 0, 0);
1405
1396
 
1406
1397
  while (cursor.getTime() < pEnd.getTime()) {
1407
1398
  if (isDayOff(cursor)) {
1408
- var ds = cursor.getTime() - dates[i].getTime();
1409
- var de = ds + 86400000;
1410
- var startFrac = Math.max(0, ds) / periodMs;
1411
- var endFrac = Math.min(periodMs, de) / periodMs;
1412
- var rw = (endFrac - startFrac) * columnWidth;
1399
+ const ds = cursor.getTime() - dates[i].getTime();
1400
+ const de = ds + 86400000;
1401
+ const startFrac = Math.max(0, ds) / periodMs;
1402
+ const endFrac = Math.min(periodMs, de) / periodMs;
1403
+ const rw = (endFrac - startFrac) * columnWidth;
1413
1404
 
1414
1405
  if (rw > 0.5) {
1415
1406
  offDayRects.push(React__default.createElement("rect", {
1416
- key: "offday-" + i + "-" + cursor.getTime(),
1407
+ key: `offday-${i}-${cursor.getTime()}`,
1417
1408
  x: x + startFrac * columnWidth,
1418
1409
  y: visibleStartY,
1419
1410
  width: rw,
@@ -1429,10 +1420,10 @@ var GridBody = function GridBody(_ref) {
1429
1420
  }
1430
1421
  }
1431
1422
 
1432
- var isDayView = viewMode === exports.ViewMode.Day;
1433
- var isWeekView = viewMode === exports.ViewMode.Week;
1434
- var tickLines = dates.map(function (date, i) {
1435
- var tickClass = styles$5.gridTick;
1423
+ const isDayView = viewMode === exports.ViewMode.Day;
1424
+ const isWeekView = viewMode === exports.ViewMode.Week;
1425
+ const tickLines = dates.map((date, i) => {
1426
+ let tickClass = styles$5.gridTick;
1436
1427
 
1437
1428
  if (isDayView) {
1438
1429
  tickClass = date.getDay() === weekStartDay ? styles$5.gridTickWeekStart : styles$5.gridTickDashed;
@@ -1441,7 +1432,7 @@ var GridBody = function GridBody(_ref) {
1441
1432
  }
1442
1433
 
1443
1434
  return React__default.createElement("line", {
1444
- key: "tick-" + i,
1435
+ key: `tick-${i}`,
1445
1436
  x1: i * columnWidth,
1446
1437
  y1: visibleStartY,
1447
1438
  x2: i * columnWidth,
@@ -1449,9 +1440,9 @@ var GridBody = function GridBody(_ref) {
1449
1440
  className: tickClass
1450
1441
  });
1451
1442
  });
1452
- var rowBackgrounds = [];
1453
- var rowLines = [];
1454
- var rowOverlays = [];
1443
+ const rowBackgrounds = [];
1444
+ const rowLines = [];
1445
+ const rowOverlays = [];
1455
1446
  rowLines.push(React__default.createElement("line", {
1456
1447
  key: "top-line",
1457
1448
  x1: 0,
@@ -1460,17 +1451,16 @@ var GridBody = function GridBody(_ref) {
1460
1451
  y2: visibleStartY,
1461
1452
  className: styles$5.gridRowLine
1462
1453
  }));
1463
- var showPerRowOffDays = viewMode !== exports.ViewMode.Month && viewMode !== exports.ViewMode.Quarter;
1454
+ const showPerRowOffDays = viewMode !== exports.ViewMode.Month && viewMode !== exports.ViewMode.Quarter;
1464
1455
 
1465
- for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {
1466
- var vi = _step.value;
1467
- var task = tasks[vi.index];
1456
+ for (const vi of items) {
1457
+ const task = tasks[vi.index];
1468
1458
  if (!task) break;
1469
- var y = vi.start;
1470
- var isMilestone = task.type === "milestone";
1471
- var rowClass = isMilestone ? styles$5.darkerGridRow : scheduleType === "lookAhead" ? styles$5.gridRowLookAhead : styles$5.gridRow;
1459
+ const y = vi.start;
1460
+ const isMilestone = task.type === "milestone";
1461
+ const rowClass = isMilestone ? styles$5.darkerGridRow : scheduleType === "lookAhead" ? styles$5.gridRowLookAhead : styles$5.gridRow;
1472
1462
  rowBackgrounds.push(React__default.createElement("rect", {
1473
- key: "bg-" + vi.key,
1463
+ key: `bg-${vi.key}`,
1474
1464
  x: 0,
1475
1465
  y: y,
1476
1466
  width: svgWidth,
@@ -1478,7 +1468,7 @@ var GridBody = function GridBody(_ref) {
1478
1468
  className: rowClass
1479
1469
  }));
1480
1470
  rowLines.push(React__default.createElement("line", {
1481
- key: "line-" + vi.key,
1471
+ key: `line-${vi.key}`,
1482
1472
  x1: 0,
1483
1473
  y1: y + rowHeight,
1484
1474
  x2: svgWidth,
@@ -1487,57 +1477,47 @@ var GridBody = function GridBody(_ref) {
1487
1477
  }));
1488
1478
 
1489
1479
  if (showPerRowOffDays) {
1490
- var rowEven = vi.index % 2 === 1;
1491
- var rowFill = isMilestone ? "#e6e4e4" : scheduleType === "lookAhead" ? "#fff" : rowEven ? "#f5f5f5" : "#fff";
1480
+ const rowEven = vi.index % 2 === 1;
1481
+ const rowFill = isMilestone ? "#e6e4e4" : scheduleType === "lookAhead" ? "#fff" : rowEven ? "#f5f5f5" : "#fff";
1492
1482
  rowOverlays.push(React__default.createElement("rect", {
1493
- key: "row-clean-" + vi.key,
1483
+ key: `row-clean-${vi.key}`,
1494
1484
  x: 0,
1495
1485
  y: y,
1496
1486
  width: svgWidth,
1497
1487
  height: rowHeight,
1498
1488
  fill: rowFill
1499
1489
  }));
1500
- var cal = task.calendar;
1490
+ const cal = task.calendar;
1501
1491
 
1502
1492
  if (cal) {
1503
- for (var _i = 0, _x = 0; _i < dates.length; _i++, _x += columnWidth) {
1504
- var _dates2;
1505
-
1506
- var _pEnd = (_dates2 = dates[_i + 1]) != null ? _dates2 : addToDate(dates[_i], 1, "day");
1507
-
1508
- var _periodMs = _pEnd.getTime() - dates[_i].getTime();
1509
-
1510
- if (_periodMs <= 0) continue;
1511
-
1512
- var _cursor = new Date(dates[_i]);
1513
-
1514
- _cursor.setHours(0, 0, 0, 0);
1515
-
1516
- while (_cursor.getTime() < _pEnd.getTime()) {
1517
- if (isOffDay(_cursor, cal)) {
1518
- var _ds = _cursor.getTime() - dates[_i].getTime();
1519
-
1520
- var _de = _ds + 86400000;
1521
-
1522
- var _startFrac = Math.max(0, _ds) / _periodMs;
1523
-
1524
- var _endFrac = Math.min(_periodMs, _de) / _periodMs;
1525
-
1526
- var _rw = (_endFrac - _startFrac) * columnWidth;
1527
-
1528
- if (_rw > 0.5) {
1493
+ for (let i = 0, x = 0; i < dates.length; i++, x += columnWidth) {
1494
+ const pEnd = dates[i + 1] ?? addToDate(dates[i], 1, "day");
1495
+ const periodMs = pEnd.getTime() - dates[i].getTime();
1496
+ if (periodMs <= 0) continue;
1497
+ const cursor = new Date(dates[i]);
1498
+ cursor.setHours(0, 0, 0, 0);
1499
+
1500
+ while (cursor.getTime() < pEnd.getTime()) {
1501
+ if (isOffDay(cursor, cal)) {
1502
+ const ds = cursor.getTime() - dates[i].getTime();
1503
+ const de = ds + 86400000;
1504
+ const startFrac = Math.max(0, ds) / periodMs;
1505
+ const endFrac = Math.min(periodMs, de) / periodMs;
1506
+ const rw = (endFrac - startFrac) * columnWidth;
1507
+
1508
+ if (rw > 0.5) {
1529
1509
  rowOverlays.push(React__default.createElement("rect", {
1530
- key: "row-offday-" + vi.key + "-" + _cursor.getTime(),
1531
- x: rtl ? _x + columnWidth - (_startFrac * columnWidth + _rw) : _x + _startFrac * columnWidth,
1510
+ key: `row-offday-${vi.key}-${cursor.getTime()}`,
1511
+ x: rtl ? x + columnWidth - (startFrac * columnWidth + rw) : x + startFrac * columnWidth,
1532
1512
  y: y,
1533
- width: _rw,
1513
+ width: rw,
1534
1514
  height: rowHeight,
1535
1515
  fill: weekendColor
1536
1516
  }));
1537
1517
  }
1538
1518
  }
1539
1519
 
1540
- _cursor.setDate(_cursor.getDate() + 1);
1520
+ cursor.setDate(cursor.getDate() + 1);
1541
1521
  }
1542
1522
  }
1543
1523
  }
@@ -1561,7 +1541,7 @@ var GridBody = function GridBody(_ref) {
1561
1541
  }, todayRects));
1562
1542
  };
1563
1543
 
1564
- var Grid = function Grid(props) {
1544
+ const Grid = props => {
1565
1545
  return React__default.createElement("g", {
1566
1546
  className: "grid"
1567
1547
  }, React__default.createElement(GridBody, Object.assign({}, props)));
@@ -1569,16 +1549,17 @@ var Grid = function Grid(props) {
1569
1549
 
1570
1550
  var styles$6 = {"calendarBottomText":"_9w8d5","calendarTopTick":"_1rLuZ","calendarTickSolid":"_2X-yN","calendarTickDashed":"_2BaXZ","calendarOffDayHeader":"_24p-y","calendarTopText":"_2q1Kt","calendarHeader":"_35nLX","textAnchorStart":"_2Shd-","textAnchorMiddle":"_2XXW4","textAnchorEnd":"_3GdnC"};
1571
1551
 
1572
- var TopPartOfCalendar = function TopPartOfCalendar(_ref) {
1573
- var value = _ref.value,
1574
- x1Line = _ref.x1Line,
1575
- y1Line = _ref.y1Line,
1576
- y2Line = _ref.y2Line,
1577
- xText = _ref.xText,
1578
- yText = _ref.yText,
1579
- _ref$textAnchor = _ref.textAnchor,
1580
- textAnchor = _ref$textAnchor === void 0 ? "middle" : _ref$textAnchor;
1581
- var textAnchorClass = textAnchor === "start" ? styles$6.textAnchorStart : textAnchor === "middle" ? styles$6.textAnchorMiddle : styles$6.textAnchorEnd;
1552
+ const TopPartOfCalendar = _ref => {
1553
+ let {
1554
+ value,
1555
+ x1Line,
1556
+ y1Line,
1557
+ y2Line,
1558
+ xText,
1559
+ yText,
1560
+ textAnchor = "middle"
1561
+ } = _ref;
1562
+ const textAnchorClass = textAnchor === "start" ? styles$6.textAnchorStart : textAnchor === "middle" ? styles$6.textAnchorMiddle : styles$6.textAnchorEnd;
1582
1563
  return React__default.createElement("g", {
1583
1564
  className: "calendarTop"
1584
1565
  }, React__default.createElement("line", {
@@ -1592,41 +1573,41 @@ var TopPartOfCalendar = function TopPartOfCalendar(_ref) {
1592
1573
  key: value + "text",
1593
1574
  y: yText,
1594
1575
  x: xText,
1595
- className: styles$6.calendarTopText + " " + textAnchorClass
1576
+ className: `${styles$6.calendarTopText} ${textAnchorClass}`
1596
1577
  }, value));
1597
1578
  };
1598
1579
 
1599
- var Calendar = function Calendar(_ref) {
1600
- var dateSetup = _ref.dateSetup,
1601
- locale = _ref.locale,
1602
- viewMode = _ref.viewMode,
1603
- rtl = _ref.rtl,
1604
- headerHeight = _ref.headerHeight,
1605
- columnWidth = _ref.columnWidth,
1606
- fontFamily = _ref.fontFamily,
1607
- fontSize = _ref.fontSize,
1608
- projectCalendar = _ref.projectCalendar,
1609
- weekendColor = _ref.weekendColor;
1610
-
1611
- var isDayOff = function isDayOff(date) {
1580
+ const Calendar = _ref => {
1581
+ let {
1582
+ dateSetup,
1583
+ locale,
1584
+ viewMode,
1585
+ rtl,
1586
+ headerHeight,
1587
+ columnWidth,
1588
+ fontFamily,
1589
+ fontSize,
1590
+ projectCalendar,
1591
+ weekendColor
1592
+ } = _ref;
1593
+
1594
+ const isDayOff = date => {
1612
1595
  if (projectCalendar) return isOffDay(date, projectCalendar);
1613
1596
  return false;
1614
1597
  };
1615
1598
 
1616
- var shortMonth = function shortMonth(date) {
1617
- return date.toLocaleString(locale, {
1618
- month: "short"
1619
- });
1620
- };
1599
+ const shortMonth = date => date.toLocaleString(locale, {
1600
+ month: "short"
1601
+ });
1621
1602
 
1622
- var getCalendarValuesForYear = function getCalendarValuesForYear() {
1623
- var topValues = [];
1624
- var bottomValues = [];
1625
- var topDefaultHeight = headerHeight * 0.5;
1603
+ const getCalendarValuesForYear = () => {
1604
+ const topValues = [];
1605
+ const bottomValues = [];
1606
+ const topDefaultHeight = headerHeight * 0.5;
1626
1607
 
1627
- for (var i = 0; i < dateSetup.dates.length; i++) {
1628
- var date = dateSetup.dates[i];
1629
- var bottomValue = date.getFullYear();
1608
+ for (let i = 0; i < dateSetup.dates.length; i++) {
1609
+ const date = dateSetup.dates[i];
1610
+ const bottomValue = date.getFullYear();
1630
1611
  bottomValues.push(React__default.createElement("text", {
1631
1612
  key: date.getFullYear(),
1632
1613
  y: headerHeight * 0.8,
@@ -1635,8 +1616,8 @@ var Calendar = function Calendar(_ref) {
1635
1616
  }, bottomValue));
1636
1617
 
1637
1618
  if (i === 0 || date.getFullYear() !== dateSetup.dates[i - 1].getFullYear()) {
1638
- var topValue = date.getFullYear().toString();
1639
- var xText = void 0;
1619
+ const topValue = date.getFullYear().toString();
1620
+ let xText;
1640
1621
 
1641
1622
  if (rtl) {
1642
1623
  xText = (6 + i + date.getFullYear() + 1) * columnWidth;
@@ -1659,37 +1640,35 @@ var Calendar = function Calendar(_ref) {
1659
1640
  return [topValues, bottomValues];
1660
1641
  };
1661
1642
 
1662
- var getCalendarValuesForQuarter = function getCalendarValuesForQuarter() {
1663
- var _projectCalendar$quar;
1643
+ const getCalendarValuesForQuarter = () => {
1644
+ const topValues = [];
1645
+ const bottomValues = [];
1646
+ const offDayRects = [];
1647
+ const quarterStart = (projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.quarter_start) ?? 0;
1648
+ const rowH = headerHeight / 3;
1664
1649
 
1665
- var topValues = [];
1666
- var bottomValues = [];
1667
- var offDayRects = [];
1668
- var quarterStart = (_projectCalendar$quar = projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.quarter_start) != null ? _projectCalendar$quar : 0;
1669
- var rowH = headerHeight / 3;
1650
+ for (let i = 0; i < dateSetup.dates.length; i++) {
1651
+ const date = dateSetup.dates[i];
1652
+ const qNum = getQuarterNumber(date, quarterStart);
1670
1653
 
1671
- for (var i = 0; i < dateSetup.dates.length; i++) {
1672
- var date = dateSetup.dates[i];
1673
- var qNum = getQuarterNumber(date, quarterStart);
1674
-
1675
- for (var m = 0; m < 3; m++) {
1676
- var monthDate = addToDate(date, m, "month");
1654
+ for (let m = 0; m < 3; m++) {
1655
+ const monthDate = addToDate(date, m, "month");
1677
1656
  bottomValues.push(React__default.createElement("text", {
1678
- key: "qmonth-" + i + "-" + m,
1657
+ key: `qmonth-${i}-${m}`,
1679
1658
  y: headerHeight * 0.9,
1680
1659
  x: columnWidth * i + columnWidth * (m * 2 + 1) / 6,
1681
- className: styles$6.calendarTopText + " " + styles$6.textAnchorMiddle
1660
+ className: `${styles$6.calendarTopText} ${styles$6.textAnchorMiddle}`
1682
1661
  }, shortMonth(monthDate)));
1683
1662
  }
1684
1663
 
1685
1664
  bottomValues.push(React__default.createElement("text", {
1686
- key: "qlabel-" + i,
1665
+ key: `qlabel-${i}`,
1687
1666
  y: rowH * 1.6,
1688
1667
  x: columnWidth * i + columnWidth * 0.5,
1689
- className: styles$6.calendarTopText + " " + styles$6.textAnchorMiddle
1690
- }, "Qtr " + qNum));
1668
+ className: `${styles$6.calendarTopText} ${styles$6.textAnchorMiddle}`
1669
+ }, `Qtr ${qNum}`));
1691
1670
  bottomValues.push(React__default.createElement("line", {
1692
- key: "qsep-" + i,
1671
+ key: `qsep-${i}`,
1693
1672
  x1: columnWidth * i,
1694
1673
  y1: rowH,
1695
1674
  x2: columnWidth * i,
@@ -1717,14 +1696,14 @@ var Calendar = function Calendar(_ref) {
1717
1696
  }
1718
1697
 
1719
1698
  if (i === 0 || date.getFullYear() !== dateSetup.dates[i - 1].getFullYear()) {
1720
- var topValue = date.getFullYear().toString();
1721
- var span = 0;
1699
+ const topValue = date.getFullYear().toString();
1700
+ let span = 0;
1722
1701
 
1723
- for (var j = i; j < dateSetup.dates.length && dateSetup.dates[j].getFullYear() === date.getFullYear(); j++) {
1702
+ for (let j = i; j < dateSetup.dates.length && dateSetup.dates[j].getFullYear() === date.getFullYear(); j++) {
1724
1703
  span++;
1725
1704
  }
1726
1705
 
1727
- var xText = columnWidth * i + columnWidth * span / 2;
1706
+ const xText = columnWidth * i + columnWidth * span / 2;
1728
1707
  topValues.push(React__default.createElement(TopPartOfCalendar, {
1729
1708
  key: topValue + i,
1730
1709
  value: topValue,
@@ -1741,38 +1720,36 @@ var Calendar = function Calendar(_ref) {
1741
1720
  return [topValues, bottomValues, offDayRects];
1742
1721
  };
1743
1722
 
1744
- var getCalendarValuesForMonth = function getCalendarValuesForMonth() {
1745
- var _projectCalendar$quar2;
1746
-
1747
- var topValues = [];
1748
- var bottomValues = [];
1749
- var offDayRects = [];
1750
- var topDefaultHeight = headerHeight * 0.5;
1751
- var quarterStart = (_projectCalendar$quar2 = projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.quarter_start) != null ? _projectCalendar$quar2 : 0;
1723
+ const getCalendarValuesForMonth = () => {
1724
+ const topValues = [];
1725
+ const bottomValues = [];
1726
+ const offDayRects = [];
1727
+ const topDefaultHeight = headerHeight * 0.5;
1728
+ const quarterStart = (projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.quarter_start) ?? 0;
1752
1729
 
1753
- for (var i = 0; i < dateSetup.dates.length; i++) {
1754
- var date = dateSetup.dates[i];
1755
- var bottomValue = shortMonth(date);
1730
+ for (let i = 0; i < dateSetup.dates.length; i++) {
1731
+ const date = dateSetup.dates[i];
1732
+ const bottomValue = shortMonth(date);
1756
1733
  bottomValues.push(React__default.createElement("text", {
1757
1734
  key: bottomValue + date.getFullYear() + i,
1758
1735
  y: headerHeight * 0.8,
1759
1736
  x: columnWidth * i + columnWidth * 0.5,
1760
- className: styles$6.calendarTopText + " " + styles$6.textAnchorMiddle
1737
+ className: `${styles$6.calendarTopText} ${styles$6.textAnchorMiddle}`
1761
1738
  }, bottomValue));
1762
- var qNum = getQuarterNumber(date, quarterStart);
1763
- var prevDate = i > 0 ? dateSetup.dates[i - 1] : null;
1764
- var prevQNum = prevDate ? getQuarterNumber(prevDate, quarterStart) : -1;
1765
- var isNewQuarter = i === 0 || qNum !== prevQNum || date.getFullYear() !== (prevDate ? prevDate.getFullYear() : -1);
1739
+ const qNum = getQuarterNumber(date, quarterStart);
1740
+ const prevDate = i > 0 ? dateSetup.dates[i - 1] : null;
1741
+ const prevQNum = prevDate ? getQuarterNumber(prevDate, quarterStart) : -1;
1742
+ const isNewQuarter = i === 0 || qNum !== prevQNum || date.getFullYear() !== (prevDate ? prevDate.getFullYear() : -1);
1766
1743
 
1767
1744
  if (isNewQuarter) {
1768
- var topValue = "Qtr " + qNum + ", " + date.getFullYear();
1769
- var span = 0;
1745
+ const topValue = `Qtr ${qNum}, ${date.getFullYear()}`;
1746
+ let span = 0;
1770
1747
 
1771
- for (var j = i; j < dateSetup.dates.length && getQuarterNumber(dateSetup.dates[j], quarterStart) === qNum && dateSetup.dates[j].getFullYear() === date.getFullYear(); j++) {
1748
+ for (let j = i; j < dateSetup.dates.length && getQuarterNumber(dateSetup.dates[j], quarterStart) === qNum && dateSetup.dates[j].getFullYear() === date.getFullYear(); j++) {
1772
1749
  span++;
1773
1750
  }
1774
1751
 
1775
- var xText = rtl ? columnWidth * i + columnWidth * span * 0.5 + columnWidth : columnWidth * i + columnWidth * span / 2;
1752
+ const xText = rtl ? columnWidth * i + columnWidth * span * 0.5 + columnWidth : columnWidth * i + columnWidth * span / 2;
1776
1753
  topValues.push(React__default.createElement(TopPartOfCalendar, {
1777
1754
  key: topValue + i,
1778
1755
  value: topValue,
@@ -1786,7 +1763,7 @@ var Calendar = function Calendar(_ref) {
1786
1763
 
1787
1764
  if (i > 0) {
1788
1765
  bottomValues.push(React__default.createElement("line", {
1789
- key: "qbound-" + i,
1766
+ key: `qbound-${i}`,
1790
1767
  x1: columnWidth * i,
1791
1768
  y1: topDefaultHeight,
1792
1769
  x2: columnWidth * i,
@@ -1800,28 +1777,28 @@ var Calendar = function Calendar(_ref) {
1800
1777
  return [topValues, bottomValues, offDayRects];
1801
1778
  };
1802
1779
 
1803
- var getCalendarValuesForWeek = function getCalendarValuesForWeek() {
1804
- var topValues = [];
1805
- var bottomValues = [];
1806
- var offDayRects = [];
1807
- var weeksCount = 1;
1808
- var topDefaultHeight = headerHeight * 0.5;
1809
- var dates = dateSetup.dates;
1780
+ const getCalendarValuesForWeek = () => {
1781
+ const topValues = [];
1782
+ const bottomValues = [];
1783
+ const offDayRects = [];
1784
+ let weeksCount = 1;
1785
+ const topDefaultHeight = headerHeight * 0.5;
1786
+ const dates = dateSetup.dates;
1810
1787
 
1811
- for (var i = dates.length - 1; i >= 0; i--) {
1812
- var date = dates[i];
1813
- var topValue = "";
1788
+ for (let i = dates.length - 1; i >= 0; i--) {
1789
+ const date = dates[i];
1790
+ let topValue = "";
1814
1791
 
1815
1792
  if (i === 0 || date.getMonth() !== dates[i - 1].getMonth()) {
1816
- topValue = shortMonth(date) + " " + date.getFullYear();
1793
+ topValue = `${shortMonth(date)} ${date.getFullYear()}`;
1817
1794
  }
1818
1795
 
1819
- var bottomValue = date.getDate().toString();
1796
+ const bottomValue = date.getDate().toString();
1820
1797
  bottomValues.push(React__default.createElement("text", {
1821
1798
  key: date.getTime(),
1822
1799
  y: headerHeight * 0.8,
1823
1800
  x: columnWidth * (i + +rtl),
1824
- className: styles$6.calendarTopText + " " + styles$6.textAnchorStart
1801
+ className: `${styles$6.calendarTopText} ${styles$6.textAnchorStart}`
1825
1802
  }, bottomValue));
1826
1803
 
1827
1804
  if (topValue) {
@@ -1847,23 +1824,21 @@ var Calendar = function Calendar(_ref) {
1847
1824
  return [topValues, bottomValues, offDayRects];
1848
1825
  };
1849
1826
 
1850
- var getCalendarValuesForDay = function getCalendarValuesForDay() {
1851
- var _projectCalendar$week;
1827
+ const getCalendarValuesForDay = () => {
1828
+ const topValues = [];
1829
+ const bottomValues = [];
1830
+ const offDayRects = [];
1831
+ const tickLines = [];
1832
+ const topDefaultHeight = headerHeight * 0.5;
1833
+ const dates = dateSetup.dates;
1834
+ const weekStartDay = (projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.week_start) ?? 1;
1852
1835
 
1853
- var topValues = [];
1854
- var bottomValues = [];
1855
- var offDayRects = [];
1856
- var tickLines = [];
1857
- var topDefaultHeight = headerHeight * 0.5;
1858
- var dates = dateSetup.dates;
1859
- var weekStartDay = (_projectCalendar$week = projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.week_start) != null ? _projectCalendar$week : 1;
1860
-
1861
- for (var i = 0; i < dates.length; i++) {
1862
- var date = dates[i];
1836
+ for (let i = 0; i < dates.length; i++) {
1837
+ const date = dates[i];
1863
1838
 
1864
1839
  if (isDayOff(date)) {
1865
1840
  offDayRects.push(React__default.createElement("rect", {
1866
- key: "offday-header-" + i,
1841
+ key: `offday-header-${i}`,
1867
1842
  x: columnWidth * i,
1868
1843
  y: topDefaultHeight,
1869
1844
  width: columnWidth,
@@ -1872,25 +1847,25 @@ var Calendar = function Calendar(_ref) {
1872
1847
  }));
1873
1848
  }
1874
1849
 
1875
- var isWeekStart = date.getDay() === weekStartDay;
1850
+ const isWeekStart = date.getDay() === weekStartDay;
1876
1851
  tickLines.push(React__default.createElement("line", {
1877
- key: "tick-day-" + i,
1852
+ key: `tick-day-${i}`,
1878
1853
  x1: columnWidth * i,
1879
1854
  y1: topDefaultHeight,
1880
1855
  x2: columnWidth * i,
1881
1856
  y2: headerHeight,
1882
1857
  className: isWeekStart ? styles$6.calendarTickSolid : styles$6.calendarTickDashed
1883
1858
  }));
1884
- var bottomValue = columnWidth > 55 ? getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate() : getLocalDayOfWeek(date, locale, "narrow") + "," + date.getDate();
1859
+ const bottomValue = columnWidth > 55 ? `${getLocalDayOfWeek(date, locale, "short")}, ${date.getDate()}` : `${getLocalDayOfWeek(date, locale, "narrow")},${date.getDate()}`;
1885
1860
  bottomValues.push(React__default.createElement("text", {
1886
1861
  key: date.getTime(),
1887
1862
  y: headerHeight * 0.8,
1888
1863
  x: columnWidth * i + columnWidth * 0.5,
1889
- className: styles$6.calendarTopText + " " + styles$6.textAnchorMiddle
1864
+ className: `${styles$6.calendarTopText} ${styles$6.textAnchorMiddle}`
1890
1865
  }, bottomValue));
1891
1866
 
1892
1867
  if (i + 1 !== dates.length && date.getMonth() !== dates[i + 1].getMonth()) {
1893
- var topValue = shortMonth(date) + " " + date.getFullYear();
1868
+ const topValue = `${shortMonth(date)} ${date.getFullYear()}`;
1894
1869
  topValues.push(React__default.createElement(TopPartOfCalendar, {
1895
1870
  key: topValue + i,
1896
1871
  value: topValue,
@@ -1903,11 +1878,10 @@ var Calendar = function Calendar(_ref) {
1903
1878
  }
1904
1879
 
1905
1880
  if (i + 1 === dates.length) {
1906
- var _topValue = shortMonth(date) + " " + date.getFullYear();
1907
-
1881
+ const topValue = `${shortMonth(date)} ${date.getFullYear()}`;
1908
1882
  topValues.push(React__default.createElement(TopPartOfCalendar, {
1909
- key: _topValue + "last",
1910
- value: _topValue,
1883
+ key: topValue + "last",
1884
+ value: topValue,
1911
1885
  x1Line: columnWidth * (i + 1),
1912
1886
  y1Line: 0,
1913
1887
  y2Line: topDefaultHeight,
@@ -1920,28 +1894,28 @@ var Calendar = function Calendar(_ref) {
1920
1894
  return [topValues, bottomValues, offDayRects, tickLines];
1921
1895
  };
1922
1896
 
1923
- var getCalendarValuesForPartOfDay = function getCalendarValuesForPartOfDay() {
1924
- var topValues = [];
1925
- var bottomValues = [];
1926
- var ticks = viewMode === exports.ViewMode.HalfDay ? 2 : 4;
1927
- var topDefaultHeight = headerHeight * 0.5;
1928
- var dates = dateSetup.dates;
1897
+ const getCalendarValuesForPartOfDay = () => {
1898
+ const topValues = [];
1899
+ const bottomValues = [];
1900
+ const ticks = viewMode === exports.ViewMode.HalfDay ? 2 : 4;
1901
+ const topDefaultHeight = headerHeight * 0.5;
1902
+ const dates = dateSetup.dates;
1929
1903
 
1930
- for (var i = 0; i < dates.length; i++) {
1931
- var date = dates[i];
1932
- var bottomValue = getCachedDateTimeFormat(locale, {
1904
+ for (let i = 0; i < dates.length; i++) {
1905
+ const date = dates[i];
1906
+ const bottomValue = getCachedDateTimeFormat(locale, {
1933
1907
  hour: "numeric"
1934
1908
  }).format(date);
1935
1909
  bottomValues.push(React__default.createElement("text", {
1936
1910
  key: date.getTime(),
1937
1911
  y: headerHeight * 0.8,
1938
1912
  x: columnWidth * (i + +rtl),
1939
- className: styles$6.calendarTopText + " " + styles$6.textAnchorMiddle,
1913
+ className: `${styles$6.calendarTopText} ${styles$6.textAnchorMiddle}`,
1940
1914
  fontFamily: fontFamily
1941
1915
  }, bottomValue));
1942
1916
 
1943
1917
  if (i === 0 || date.getDate() !== dates[i - 1].getDate()) {
1944
- var topValue = getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate() + " " + shortMonth(date);
1918
+ const topValue = `${getLocalDayOfWeek(date, locale, "short")}, ${date.getDate()} ${shortMonth(date)}`;
1945
1919
  topValues.push(React__default.createElement(TopPartOfCalendar, {
1946
1920
  key: topValue + date.getFullYear(),
1947
1921
  value: topValue,
@@ -1957,15 +1931,15 @@ var Calendar = function Calendar(_ref) {
1957
1931
  return [topValues, bottomValues];
1958
1932
  };
1959
1933
 
1960
- var getCalendarValuesForHour = function getCalendarValuesForHour() {
1961
- var topValues = [];
1962
- var bottomValues = [];
1963
- var topDefaultHeight = headerHeight * 0.5;
1964
- var dates = dateSetup.dates;
1934
+ const getCalendarValuesForHour = () => {
1935
+ const topValues = [];
1936
+ const bottomValues = [];
1937
+ const topDefaultHeight = headerHeight * 0.5;
1938
+ const dates = dateSetup.dates;
1965
1939
 
1966
- for (var i = 0; i < dates.length; i++) {
1967
- var date = dates[i];
1968
- var bottomValue = getCachedDateTimeFormat(locale, {
1940
+ for (let i = 0; i < dates.length; i++) {
1941
+ const date = dates[i];
1942
+ const bottomValue = getCachedDateTimeFormat(locale, {
1969
1943
  hour: "numeric"
1970
1944
  }).format(date);
1971
1945
  bottomValues.push(React__default.createElement("text", {
@@ -1977,9 +1951,9 @@ var Calendar = function Calendar(_ref) {
1977
1951
  }, bottomValue));
1978
1952
 
1979
1953
  if (i !== 0 && date.getDate() !== dates[i - 1].getDate()) {
1980
- var displayDate = dates[i - 1];
1981
- var topValue = getLocalDayOfWeek(displayDate, locale, "long") + ", " + displayDate.getDate() + " " + shortMonth(displayDate);
1982
- var topPosition = (date.getHours() - 24) / 2;
1954
+ const displayDate = dates[i - 1];
1955
+ const topValue = `${getLocalDayOfWeek(displayDate, locale, "long")}, ${displayDate.getDate()} ${shortMonth(displayDate)}`;
1956
+ const topPosition = (date.getHours() - 24) / 2;
1983
1957
  topValues.push(React__default.createElement(TopPartOfCalendar, {
1984
1958
  key: topValue + displayDate.getFullYear(),
1985
1959
  value: topValue,
@@ -1995,22 +1969,19 @@ var Calendar = function Calendar(_ref) {
1995
1969
  return [topValues, bottomValues];
1996
1970
  };
1997
1971
 
1998
- var topValues = [];
1999
- var bottomValues = [];
2000
- var extraValues = [];
2001
- var tickLines = [];
1972
+ let topValues = [];
1973
+ let bottomValues = [];
1974
+ let extraValues = [];
1975
+ let tickLines = [];
2002
1976
 
2003
1977
  switch (dateSetup.viewMode) {
2004
1978
  case exports.ViewMode.Year:
2005
- var _getCalendarValuesFor = getCalendarValuesForYear();
2006
-
2007
- topValues = _getCalendarValuesFor[0];
2008
- bottomValues = _getCalendarValuesFor[1];
1979
+ [topValues, bottomValues] = getCalendarValuesForYear();
2009
1980
  break;
2010
1981
 
2011
1982
  case exports.ViewMode.Quarter:
2012
1983
  {
2013
- var r = getCalendarValuesForQuarter();
1984
+ const r = getCalendarValuesForQuarter();
2014
1985
  topValues = r[0];
2015
1986
  bottomValues = r[1];
2016
1987
  extraValues = r[2] || [];
@@ -2019,27 +1990,25 @@ var Calendar = function Calendar(_ref) {
2019
1990
 
2020
1991
  case exports.ViewMode.Month:
2021
1992
  {
2022
- var _r = getCalendarValuesForMonth();
2023
-
2024
- topValues = _r[0];
2025
- bottomValues = _r[1];
2026
- extraValues = _r[2] || [];
1993
+ const r = getCalendarValuesForMonth();
1994
+ topValues = r[0];
1995
+ bottomValues = r[1];
1996
+ extraValues = r[2] || [];
2027
1997
  break;
2028
1998
  }
2029
1999
 
2030
2000
  case exports.ViewMode.Week:
2031
2001
  {
2032
- var _r2 = getCalendarValuesForWeek();
2033
-
2034
- topValues = _r2[0];
2035
- bottomValues = _r2[1];
2036
- extraValues = _r2[2] || [];
2002
+ const r = getCalendarValuesForWeek();
2003
+ topValues = r[0];
2004
+ bottomValues = r[1];
2005
+ extraValues = r[2] || [];
2037
2006
  break;
2038
2007
  }
2039
2008
 
2040
2009
  case exports.ViewMode.Day:
2041
2010
  {
2042
- var result = getCalendarValuesForDay();
2011
+ const result = getCalendarValuesForDay();
2043
2012
  topValues = result[0];
2044
2013
  bottomValues = result[1];
2045
2014
  extraValues = result[2];
@@ -2049,17 +2018,11 @@ var Calendar = function Calendar(_ref) {
2049
2018
 
2050
2019
  case exports.ViewMode.QuarterDay:
2051
2020
  case exports.ViewMode.HalfDay:
2052
- var _getCalendarValuesFor2 = getCalendarValuesForPartOfDay();
2053
-
2054
- topValues = _getCalendarValuesFor2[0];
2055
- bottomValues = _getCalendarValuesFor2[1];
2021
+ [topValues, bottomValues] = getCalendarValuesForPartOfDay();
2056
2022
  break;
2057
2023
 
2058
2024
  case exports.ViewMode.Hour:
2059
- var _getCalendarValuesFor3 = getCalendarValuesForHour();
2060
-
2061
- topValues = _getCalendarValuesFor3[0];
2062
- bottomValues = _getCalendarValuesFor3[1];
2025
+ [topValues, bottomValues] = getCalendarValuesForHour();
2063
2026
  }
2064
2027
 
2065
2028
  return React__default.createElement("g", {
@@ -2095,19 +2058,17 @@ function _catch(body, recover) {
2095
2058
  return result;
2096
2059
  }
2097
2060
 
2098
- var Arrow = function Arrow(_ref) {
2099
- var taskFrom = _ref.taskFrom,
2100
- taskTo = _ref.taskTo,
2101
- rowHeight = _ref.rowHeight,
2102
- taskHeight = _ref.taskHeight,
2103
- arrowIndent = _ref.arrowIndent,
2104
- arrowColor = _ref.arrowColor,
2105
- dependencyType = _ref.dependencyType;
2106
-
2107
- var _drawPathAndTriangle = drawPathAndTriangle(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent, dependencyType),
2108
- path = _drawPathAndTriangle[0],
2109
- trianglePoints = _drawPathAndTriangle[1];
2110
-
2061
+ const Arrow = _ref => {
2062
+ let {
2063
+ taskFrom,
2064
+ taskTo,
2065
+ rowHeight,
2066
+ taskHeight,
2067
+ arrowIndent,
2068
+ arrowColor,
2069
+ dependencyType
2070
+ } = _ref;
2071
+ let [path, trianglePoints] = drawPathAndTriangle(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent, dependencyType);
2111
2072
  return React__default.createElement("g", {
2112
2073
  className: "arrow"
2113
2074
  }, React__default.createElement("path", {
@@ -2121,40 +2082,40 @@ var Arrow = function Arrow(_ref) {
2121
2082
  }));
2122
2083
  };
2123
2084
 
2124
- var drawPathAndTriangle = function drawPathAndTriangle(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent, dependencyType) {
2125
- var indexCompare = taskFrom.index > taskTo.index ? -1 : 1;
2126
- var taskToEndY = taskTo.y + taskHeight / 2;
2127
- var verticalOffset = indexCompare * (rowHeight / 2);
2085
+ const drawPathAndTriangle = (taskFrom, taskTo, rowHeight, taskHeight, arrowIndent, dependencyType) => {
2086
+ const indexCompare = taskFrom.index > taskTo.index ? -1 : 1;
2087
+ const taskToEndY = taskTo.y + taskHeight / 2;
2088
+ const verticalOffset = indexCompare * (rowHeight / 2);
2128
2089
 
2129
- var minX = function minX(t) {
2090
+ const minX = t => {
2130
2091
  if (t.plannedSegments && t.plannedSegments.length > 0) {
2131
- var p = t.plannedSegments[0].x1;
2092
+ const p = t.plannedSegments[0].x1;
2132
2093
  if (t.actualSegments && t.actualSegments.length > 0) return Math.min(p, t.actualSegments[0].x1);
2133
2094
  return p;
2134
2095
  }
2135
2096
 
2136
2097
  if (t.actualSegments && t.actualSegments.length > 0) return t.actualSegments[0].x1;
2137
- var candidates = [];
2098
+ const candidates = [];
2138
2099
  if (t.x2 > t.x1) candidates.push(t.x1);
2139
2100
  if (t.actualx2 > t.actualx1) candidates.push(t.actualx1);
2140
- return candidates.length > 0 ? Math.min.apply(Math, candidates) : 0;
2101
+ return candidates.length > 0 ? Math.min(...candidates) : 0;
2141
2102
  };
2142
2103
 
2143
- var maxX = function maxX(t) {
2104
+ const maxX = t => {
2144
2105
  if (t.plannedSegments && t.plannedSegments.length > 0) {
2145
- var p = t.plannedSegments[t.plannedSegments.length - 1].x2;
2106
+ const p = t.plannedSegments[t.plannedSegments.length - 1].x2;
2146
2107
  if (t.actualSegments && t.actualSegments.length > 0) return Math.max(p, t.actualSegments[t.actualSegments.length - 1].x2);
2147
2108
  return p;
2148
2109
  }
2149
2110
 
2150
2111
  if (t.actualSegments && t.actualSegments.length > 0) return t.actualSegments[t.actualSegments.length - 1].x2;
2151
- var candidates = [];
2112
+ const candidates = [];
2152
2113
  if (t.x2 > t.x1) candidates.push(t.x2);
2153
2114
  if (t.actualx2 > t.actualx1) candidates.push(t.actualx2);
2154
- return candidates.length > 0 ? Math.max.apply(Math, candidates) : 0;
2115
+ return candidates.length > 0 ? Math.max(...candidates) : 0;
2155
2116
  };
2156
2117
 
2157
- var fromPoint, toPoint;
2118
+ let fromPoint, toPoint;
2158
2119
 
2159
2120
  switch (dependencyType) {
2160
2121
  case "SS":
@@ -2178,35 +2139,51 @@ var drawPathAndTriangle = function drawPathAndTriangle(taskFrom, taskTo, rowHeig
2178
2139
  break;
2179
2140
  }
2180
2141
 
2181
- var arrowPoints = function arrowPoints(x, y, right) {
2142
+ const arrowPoints = function (x, y, right) {
2182
2143
  if (right === void 0) {
2183
2144
  right = true;
2184
2145
  }
2185
2146
 
2186
- return right ? x + "," + y + " " + (x - 5) + "," + (y - 5) + " " + (x - 5) + "," + (y + 5) : x + "," + y + " " + (x + 5) + "," + (y - 5) + " " + (x + 5) + "," + (y + 5);
2147
+ return right ? `${x},${y} ${x - 5},${y - 5} ${x - 5},${y + 5}` : `${x},${y} ${x + 5},${y - 5} ${x + 5},${y + 5}`;
2187
2148
  };
2188
2149
 
2189
- var path;
2190
- var trianglePoints;
2150
+ let path;
2151
+ let trianglePoints;
2191
2152
 
2192
2153
  switch (dependencyType) {
2193
2154
  case "SS":
2194
- path = "M " + fromPoint + " " + (taskFrom.y + taskHeight / 2) + "\n H " + (fromPoint + Math.min(toPoint - fromPoint, 0) - 2 * arrowIndent) + "\n V " + taskToEndY + "\n H " + (toPoint - 5);
2155
+ path = `M ${fromPoint} ${taskFrom.y + taskHeight / 2}
2156
+ H ${fromPoint + Math.min(toPoint - fromPoint, 0) - 2 * arrowIndent}
2157
+ V ${taskToEndY}
2158
+ H ${toPoint - 5}`;
2195
2159
  trianglePoints = arrowPoints(toPoint, taskToEndY, true);
2196
2160
  break;
2197
2161
 
2198
2162
  case "SF":
2199
- path = "M " + fromPoint + " " + (taskFrom.y + taskHeight / 2) + "\n H " + (fromPoint - 2 * arrowIndent) + "\n V " + (taskFrom.y + taskHeight / 2 + verticalOffset) + "\n " + (fromPoint - toPoint > 4 * arrowIndent ? "" : "H " + (toPoint + 2 * arrowIndent)) + "\n V " + taskToEndY + "\n H " + (toPoint + 5);
2163
+ path = `M ${fromPoint} ${taskFrom.y + taskHeight / 2}
2164
+ H ${fromPoint - 2 * arrowIndent}
2165
+ V ${taskFrom.y + taskHeight / 2 + verticalOffset}
2166
+ ${fromPoint - toPoint > 4 * arrowIndent ? "" : `H ${toPoint + 2 * arrowIndent}`}
2167
+ V ${taskToEndY}
2168
+ H ${toPoint + 5}`;
2200
2169
  trianglePoints = arrowPoints(toPoint, taskToEndY, false);
2201
2170
  break;
2202
2171
 
2203
2172
  case "FS":
2204
- path = "M " + fromPoint + " " + (taskFrom.y + taskHeight / 2) + "\n H " + (fromPoint + 2 * arrowIndent) + "\n V " + (taskFrom.y + taskHeight / 2 + verticalOffset) + "\n " + (toPoint - fromPoint > 4 * arrowIndent ? "" : "H " + (toPoint - 2 * arrowIndent)) + "\n V " + taskToEndY + "\n H " + (toPoint - 5);
2173
+ path = `M ${fromPoint} ${taskFrom.y + taskHeight / 2}
2174
+ H ${fromPoint + 2 * arrowIndent}
2175
+ V ${taskFrom.y + taskHeight / 2 + verticalOffset}
2176
+ ${toPoint - fromPoint > 4 * arrowIndent ? "" : `H ${toPoint - 2 * arrowIndent}`}
2177
+ V ${taskToEndY}
2178
+ H ${toPoint - 5}`;
2205
2179
  trianglePoints = arrowPoints(toPoint, taskToEndY, true);
2206
2180
  break;
2207
2181
 
2208
2182
  case "FF":
2209
- path = "M " + fromPoint + " " + (taskFrom.y + taskHeight / 2) + "\n H " + (fromPoint + Math.max(toPoint - fromPoint, 0) + 2 * arrowIndent) + "\n V " + taskToEndY + "\n H " + (toPoint + 5);
2183
+ path = `M ${fromPoint} ${taskFrom.y + taskHeight / 2}
2184
+ H ${fromPoint + Math.max(toPoint - fromPoint, 0) + 2 * arrowIndent}
2185
+ V ${taskToEndY}
2186
+ H ${toPoint + 5}`;
2210
2187
  trianglePoints = arrowPoints(toPoint, taskToEndY, false);
2211
2188
  break;
2212
2189
  }
@@ -2709,60 +2686,59 @@ var sortTasks = function sortTasks(taskA, taskB) {
2709
2686
  }
2710
2687
  };
2711
2688
 
2712
- var BarDisplay = function BarDisplay(_ref) {
2713
- var x = _ref.x,
2714
- y = _ref.y,
2715
- type = _ref.type,
2716
- width = _ref.width,
2717
- height = _ref.height,
2718
- isSelected = _ref.isSelected,
2719
- progressX = _ref.progressX,
2720
- progressWidth = _ref.progressWidth,
2721
- barCornerRadius = _ref.barCornerRadius,
2722
- styles = _ref.styles,
2723
- segments = _ref.segments,
2724
- onMouseDown = _ref.onMouseDown;
2725
-
2726
- var getProcessColor = function getProcessColor() {
2689
+ const BarDisplay = _ref => {
2690
+ let {
2691
+ x,
2692
+ y,
2693
+ type,
2694
+ width,
2695
+ height,
2696
+ isSelected,
2697
+ progressX,
2698
+ progressWidth,
2699
+ barCornerRadius,
2700
+ styles,
2701
+ segments,
2702
+ onMouseDown
2703
+ } = _ref;
2704
+
2705
+ const getProcessColor = () => {
2727
2706
  return isSelected ? styles.progressSelectedColor : styles.progressColor;
2728
2707
  };
2729
2708
 
2730
- var getBarColor = function getBarColor() {
2709
+ const getBarColor = () => {
2731
2710
  return isSelected ? styles.backgroundSelectedColor : styles.backgroundColor;
2732
2711
  };
2733
2712
 
2734
2713
  if (type === "planned") {
2735
2714
  if (segments && segments.length > 0) {
2736
- var totalWidth = width;
2715
+ const totalWidth = width;
2737
2716
  return React__default.createElement("g", {
2738
2717
  onMouseDown: onMouseDown
2739
- }, segments.map(function (seg, idx) {
2740
- return React__default.createElement("rect", {
2741
- key: "seg-" + idx,
2742
- x: seg.x1,
2743
- width: seg.x2 - seg.x1,
2744
- y: y,
2745
- height: height,
2746
- ry: barCornerRadius,
2747
- rx: barCornerRadius,
2748
- fill: getBarColor(),
2749
- strokeWidth: 2,
2750
- stroke: styles.criticalPathColor
2751
- });
2752
- }), progressWidth > 0 && function () {
2753
- var rects = [];
2754
- var remaining = progressWidth;
2755
-
2756
- for (var _iterator = _createForOfIteratorHelperLoose(segments), _step; !(_step = _iterator()).done;) {
2757
- var seg = _step.value;
2718
+ }, segments.map((seg, idx) => React__default.createElement("rect", {
2719
+ key: `seg-${idx}`,
2720
+ x: seg.x1,
2721
+ width: seg.x2 - seg.x1,
2722
+ y: y,
2723
+ height: height,
2724
+ ry: barCornerRadius,
2725
+ rx: barCornerRadius,
2726
+ fill: getBarColor(),
2727
+ strokeWidth: 2,
2728
+ stroke: styles.criticalPathColor
2729
+ })), progressWidth > 0 && (() => {
2730
+ const rects = [];
2731
+ let remaining = progressWidth;
2732
+
2733
+ for (const seg of segments) {
2758
2734
  if (remaining <= 0) break;
2759
- var segW = seg.x2 - seg.x1;
2760
- var ratio = totalWidth > 0 ? segW / totalWidth : 0;
2761
- var pw = Math.min(remaining, progressWidth * ratio);
2735
+ const segW = seg.x2 - seg.x1;
2736
+ const ratio = totalWidth > 0 ? segW / totalWidth : 0;
2737
+ const pw = Math.min(remaining, progressWidth * ratio);
2762
2738
 
2763
2739
  if (pw > 0) {
2764
2740
  rects.push(React__default.createElement("rect", {
2765
- key: "prog-" + seg.x1,
2741
+ key: `prog-${seg.x1}`,
2766
2742
  x: seg.x1,
2767
2743
  width: pw,
2768
2744
  y: y,
@@ -2776,7 +2752,7 @@ var BarDisplay = function BarDisplay(_ref) {
2776
2752
  }
2777
2753
 
2778
2754
  return rects;
2779
- }());
2755
+ })());
2780
2756
  }
2781
2757
 
2782
2758
  return React__default.createElement("g", {
@@ -2804,18 +2780,16 @@ var BarDisplay = function BarDisplay(_ref) {
2804
2780
  if (segments && segments.length > 0) {
2805
2781
  return React__default.createElement("g", {
2806
2782
  onMouseDown: onMouseDown
2807
- }, segments.map(function (seg, idx) {
2808
- return React__default.createElement("rect", {
2809
- key: "aseg-" + idx,
2810
- x: seg.x1,
2811
- width: seg.x2 - seg.x1,
2812
- y: y,
2813
- height: height,
2814
- ry: barCornerRadius,
2815
- rx: barCornerRadius,
2816
- fill: styles.taskProgressColor
2817
- });
2818
- }), React__default.createElement("rect", {
2783
+ }, segments.map((seg, idx) => React__default.createElement("rect", {
2784
+ key: `aseg-${idx}`,
2785
+ x: seg.x1,
2786
+ width: seg.x2 - seg.x1,
2787
+ y: y,
2788
+ height: height,
2789
+ ry: barCornerRadius,
2790
+ rx: barCornerRadius,
2791
+ fill: styles.taskProgressColor
2792
+ })), React__default.createElement("rect", {
2819
2793
  x: progressX,
2820
2794
  width: progressWidth,
2821
2795
  y: y,
@@ -2850,13 +2824,15 @@ var BarDisplay = function BarDisplay(_ref) {
2850
2824
 
2851
2825
  var styles$7 = {"barWrapper":"_KxSXS","barHandle":"_3w_5u","barBackground":"_31ERP"};
2852
2826
 
2853
- var BarDateHandle = function BarDateHandle(_ref) {
2854
- var x = _ref.x,
2855
- y = _ref.y,
2856
- width = _ref.width,
2857
- height = _ref.height,
2858
- barCornerRadius = _ref.barCornerRadius,
2859
- onMouseDown = _ref.onMouseDown;
2827
+ const BarDateHandle = _ref => {
2828
+ let {
2829
+ x,
2830
+ y,
2831
+ width,
2832
+ height,
2833
+ barCornerRadius,
2834
+ onMouseDown
2835
+ } = _ref;
2860
2836
  return React__default.createElement("rect", {
2861
2837
  x: x,
2862
2838
  y: y,
@@ -2869,28 +2845,28 @@ var BarDateHandle = function BarDateHandle(_ref) {
2869
2845
  });
2870
2846
  };
2871
2847
 
2872
- var BarProgressHandle = function BarProgressHandle(_ref) {
2873
- _objectDestructuringEmpty(_ref);
2874
-
2848
+ const BarProgressHandle = _ref => {
2875
2849
  return React__default.createElement("div", null);
2876
2850
  };
2877
2851
 
2878
- var Bar = function Bar(_ref) {
2879
- var task = _ref.task,
2880
- isProgressChangeable = _ref.isProgressChangeable,
2881
- isDateChangeable = _ref.isDateChangeable,
2882
- rtl = _ref.rtl,
2883
- type = _ref.type,
2884
- onEventStart = _ref.onEventStart,
2885
- isSelected = _ref.isSelected;
2886
- var progressPoint = getProgressPoint(+!rtl * task.progressWidth + task.progressX, task.y, task.height);
2887
- var handleHeight = task.height / 2 - 1;
2888
- var plannedSegs = task.plannedSegments;
2889
- var plannedLeftHandleX = plannedSegs !== null && plannedSegs !== void 0 && plannedSegs.length ? plannedSegs[0].x1 : task.x1;
2890
- var plannedRightHandleX = plannedSegs !== null && plannedSegs !== void 0 && plannedSegs.length ? plannedSegs[plannedSegs.length - 1].x2 : task.x2;
2891
- var actualSegs = task.actualSegments;
2892
- var actualLeftHandleX = actualSegs !== null && actualSegs !== void 0 && actualSegs.length ? actualSegs[0].x1 : task.actualx1;
2893
- var actualRightHandleX = actualSegs !== null && actualSegs !== void 0 && actualSegs.length ? actualSegs[actualSegs.length - 1].x2 : task.actualx2;
2852
+ const Bar = _ref => {
2853
+ let {
2854
+ task,
2855
+ isProgressChangeable,
2856
+ isDateChangeable,
2857
+ rtl,
2858
+ type,
2859
+ onEventStart,
2860
+ isSelected
2861
+ } = _ref;
2862
+ const progressPoint = getProgressPoint(+!rtl * task.progressWidth + task.progressX, task.y, task.height);
2863
+ const handleHeight = task.height / 2 - 1;
2864
+ const plannedSegs = task.plannedSegments;
2865
+ const plannedLeftHandleX = plannedSegs !== null && plannedSegs !== void 0 && plannedSegs.length ? plannedSegs[0].x1 : task.x1;
2866
+ const plannedRightHandleX = plannedSegs !== null && plannedSegs !== void 0 && plannedSegs.length ? plannedSegs[plannedSegs.length - 1].x2 : task.x2;
2867
+ const actualSegs = task.actualSegments;
2868
+ const actualLeftHandleX = actualSegs !== null && actualSegs !== void 0 && actualSegs.length ? actualSegs[0].x1 : task.actualx1;
2869
+ const actualRightHandleX = actualSegs !== null && actualSegs !== void 0 && actualSegs.length ? actualSegs[actualSegs.length - 1].x2 : task.actualx2;
2894
2870
 
2895
2871
  if (type == "planned") {
2896
2872
  if ((task === null || task === void 0 ? void 0 : task.x1) >= 0 && (task === null || task === void 0 ? void 0 : task.x2) >= 0 && task.x2 - task.x1 >= 0) return React__default.createElement("g", {
@@ -2916,7 +2892,7 @@ var Bar = function Bar(_ref) {
2916
2892
  styles: task.styles,
2917
2893
  isSelected: isSelected,
2918
2894
  segments: task.plannedSegments,
2919
- onMouseDown: function onMouseDown(e) {
2895
+ onMouseDown: e => {
2920
2896
  isDateChangeable && onEventStart("move", task, e, "planned");
2921
2897
  }
2922
2898
  }), React__default.createElement("g", {
@@ -2927,7 +2903,7 @@ var Bar = function Bar(_ref) {
2927
2903
  width: task.handleWidth,
2928
2904
  height: handleHeight,
2929
2905
  barCornerRadius: task.barCornerRadius,
2930
- onMouseDown: function onMouseDown(e) {
2906
+ onMouseDown: e => {
2931
2907
  onEventStart("start", task, e, "planned");
2932
2908
  }
2933
2909
  }), React__default.createElement(BarDateHandle, {
@@ -2936,12 +2912,12 @@ var Bar = function Bar(_ref) {
2936
2912
  width: task.handleWidth,
2937
2913
  height: handleHeight,
2938
2914
  barCornerRadius: task.barCornerRadius,
2939
- onMouseDown: function onMouseDown(e) {
2915
+ onMouseDown: e => {
2940
2916
  onEventStart("end", task, e, "planned");
2941
2917
  }
2942
2918
  })), isProgressChangeable && React__default.createElement(BarProgressHandle, {
2943
2919
  progressPoint: progressPoint,
2944
- onMouseDown: function onMouseDown(e) {
2920
+ onMouseDown: e => {
2945
2921
  onEventStart("progress", task, e, "planned");
2946
2922
  }
2947
2923
  })));else return React__default.createElement("g", {
@@ -2972,7 +2948,7 @@ var Bar = function Bar(_ref) {
2972
2948
  styles: task.styles,
2973
2949
  isSelected: isSelected,
2974
2950
  segments: task.actualSegments,
2975
- onMouseDown: function onMouseDown(e) {
2951
+ onMouseDown: e => {
2976
2952
  isDateChangeable && onEventStart("move", task, e, "actual");
2977
2953
  }
2978
2954
  }), React__default.createElement("g", {
@@ -2983,7 +2959,7 @@ var Bar = function Bar(_ref) {
2983
2959
  width: task.handleWidth,
2984
2960
  height: handleHeight,
2985
2961
  barCornerRadius: task.barCornerRadius,
2986
- onMouseDown: function onMouseDown(e) {
2962
+ onMouseDown: e => {
2987
2963
  onEventStart("start", task, e, "actual");
2988
2964
  }
2989
2965
  }), React__default.createElement(BarDateHandle, {
@@ -2992,12 +2968,12 @@ var Bar = function Bar(_ref) {
2992
2968
  width: task.handleWidth,
2993
2969
  height: handleHeight,
2994
2970
  barCornerRadius: task.barCornerRadius,
2995
- onMouseDown: function onMouseDown(e) {
2971
+ onMouseDown: e => {
2996
2972
  onEventStart("end", task, e, "actual");
2997
2973
  }
2998
2974
  })), isProgressChangeable && React__default.createElement(BarProgressHandle, {
2999
2975
  progressPoint: progressPoint,
3000
- onMouseDown: function onMouseDown(e) {
2976
+ onMouseDown: e => {
3001
2977
  onEventStart("progress", task, e, "actual");
3002
2978
  }
3003
2979
  })));
@@ -3009,14 +2985,16 @@ var Bar = function Bar(_ref) {
3009
2985
  }
3010
2986
  };
3011
2987
 
3012
- var BarSmall = function BarSmall(_ref) {
3013
- var task = _ref.task,
3014
- type = _ref.type,
3015
- isProgressChangeable = _ref.isProgressChangeable,
3016
- isDateChangeable = _ref.isDateChangeable,
3017
- onEventStart = _ref.onEventStart,
3018
- isSelected = _ref.isSelected;
3019
- var progressPoint = getProgressPoint(task.progressWidth + task.x1, task.y, task.height);
2988
+ const BarSmall = _ref => {
2989
+ let {
2990
+ task,
2991
+ type,
2992
+ isProgressChangeable,
2993
+ isDateChangeable,
2994
+ onEventStart,
2995
+ isSelected
2996
+ } = _ref;
2997
+ const progressPoint = getProgressPoint(task.progressWidth + task.x1, task.y, task.height);
3020
2998
  return React__default.createElement("g", {
3021
2999
  className: styles$7.barWrapper,
3022
3000
  tabIndex: 0
@@ -3033,14 +3011,14 @@ var BarSmall = function BarSmall(_ref) {
3033
3011
  barCornerRadius: task.barCornerRadius,
3034
3012
  styles: task.styles,
3035
3013
  isSelected: isSelected,
3036
- onMouseDown: function onMouseDown(e) {
3014
+ onMouseDown: e => {
3037
3015
  isDateChangeable && onEventStart("move", task, e);
3038
3016
  }
3039
3017
  }), React__default.createElement("g", {
3040
3018
  className: "handleGroup"
3041
3019
  }, isProgressChangeable && React__default.createElement(BarProgressHandle, {
3042
3020
  progressPoint: progressPoint,
3043
- onMouseDown: function onMouseDown(e) {
3021
+ onMouseDown: e => {
3044
3022
  onEventStart("progress", task, e);
3045
3023
  }
3046
3024
  })));
@@ -3048,14 +3026,17 @@ var BarSmall = function BarSmall(_ref) {
3048
3026
 
3049
3027
  var styles$8 = {"milestoneWrapper":"_RRr13","milestoneBackground":"_2P2B1"};
3050
3028
 
3051
- var Milestone = function Milestone(_ref) {
3052
- var task = _ref.task,
3053
- isDateChangeable = _ref.isDateChangeable,
3054
- onEventStart = _ref.onEventStart,
3055
- isSelected = _ref.isSelected;
3056
- var transform = "rotate(45 " + (task.x1 + task.height * 0.356) + " \n " + (task.y + task.height * 0.85) + ")";
3057
-
3058
- var getBarColor = function getBarColor() {
3029
+ const Milestone = _ref => {
3030
+ let {
3031
+ task,
3032
+ isDateChangeable,
3033
+ onEventStart,
3034
+ isSelected
3035
+ } = _ref;
3036
+ const transform = `rotate(45 ${task.x1 + task.height * 0.356}
3037
+ ${task.y + task.height * 0.85})`;
3038
+
3039
+ const getBarColor = () => {
3059
3040
  return isSelected ? task.styles.backgroundSelectedColor : task.styles.backgroundColor;
3060
3041
  };
3061
3042
 
@@ -3072,10 +3053,10 @@ var Milestone = function Milestone(_ref) {
3072
3053
  ry: task.barCornerRadius,
3073
3054
  transform: transform,
3074
3055
  className: styles$8.milestoneBackground,
3075
- onMouseDown: function onMouseDown(e) {
3056
+ onMouseDown: e => {
3076
3057
  isDateChangeable && onEventStart("move", task, e, "planned");
3077
3058
  },
3078
- onDoubleClick: function onDoubleClick(e) {
3059
+ onDoubleClick: e => {
3079
3060
  onEventStart("dblclick", task, e);
3080
3061
  }
3081
3062
  }));
@@ -3083,14 +3064,16 @@ var Milestone = function Milestone(_ref) {
3083
3064
 
3084
3065
  var styles$9 = {"projectWrapper":"_1KJ6x","projectBackground":"_2RbVy","projectTop":"_2pZMF"};
3085
3066
 
3086
- var Project = function Project(_ref) {
3087
- var task = _ref.task,
3088
- isSelected = _ref.isSelected;
3089
- var barColor = isSelected ? task.styles.backgroundSelectedColor : task.styles.backgroundColor;
3090
- var processColor = isSelected ? task.styles.progressSelectedColor : task.styles.progressColor;
3091
- var projectWith = task.x2 - task.x1;
3092
- var projectLeftTriangle = [task.x1, task.y + task.height / 2 - 1, task.x1, task.y + task.height, task.x1 + 15, task.y + task.height / 2 - 1].join(",");
3093
- var projectRightTriangle = [task.x2, task.y + task.height / 2 - 1, task.x2, task.y + task.height, task.x2 - 15, task.y + task.height / 2 - 1].join(",");
3067
+ const Project = _ref => {
3068
+ let {
3069
+ task,
3070
+ isSelected
3071
+ } = _ref;
3072
+ const barColor = isSelected ? task.styles.backgroundSelectedColor : task.styles.backgroundColor;
3073
+ const processColor = isSelected ? task.styles.progressSelectedColor : task.styles.progressColor;
3074
+ const projectWith = task.x2 - task.x1;
3075
+ const projectLeftTriangle = [task.x1, task.y + task.height / 2 - 1, task.x1, task.y + task.height, task.x1 + 15, task.y + task.height / 2 - 1].join(",");
3076
+ const projectRightTriangle = [task.x2, task.y + task.height / 2 - 1, task.x2, task.y + task.height, task.x2 - 15, task.y + task.height / 2 - 1].join(",");
3094
3077
  return React__default.createElement("g", {
3095
3078
  tabIndex: 0,
3096
3079
  className: styles$9.projectWrapper
@@ -3131,18 +3114,16 @@ var Project = function Project(_ref) {
3131
3114
  }));
3132
3115
  };
3133
3116
 
3134
- var TaskItem = function TaskItem(props) {
3135
- var _props = _extends({}, props),
3136
- task = _props.task,
3137
- isDelete = _props.isDelete,
3138
- isSelected = _props.isSelected,
3139
- onEventStart = _props.onEventStart;
3140
-
3141
- var _useState = React.useState([React__default.createElement("div", null)]),
3142
- taskItem = _useState[0],
3143
- setTaskItem = _useState[1];
3144
-
3145
- React.useEffect(function () {
3117
+ const TaskItem = props => {
3118
+ const {
3119
+ task,
3120
+ isDelete,
3121
+ isSelected,
3122
+ onEventStart
3123
+ } = { ...props
3124
+ };
3125
+ const [taskItem, setTaskItem] = React.useState([React__default.createElement("div", null)]);
3126
+ React.useEffect(() => {
3146
3127
  switch (task.typeInternal) {
3147
3128
  case "milestone":
3148
3129
  if (task.x1 >= 0 && task.actualx1 >= 0) setTaskItem([React__default.createElement(Milestone, Object.assign({}, props))]);else setTaskItem([]);
@@ -3158,27 +3139,27 @@ var TaskItem = function TaskItem(props) {
3158
3139
 
3159
3140
  default:
3160
3141
  {
3161
- var _taskItem = [];
3142
+ let taskItem = [];
3162
3143
 
3163
3144
  if ((task === null || task === void 0 ? void 0 : task.x1) >= 0 && (task === null || task === void 0 ? void 0 : task.x2) >= 0) {
3164
- _taskItem.push(React__default.createElement(Bar, Object.assign({}, props, {
3145
+ taskItem.push(React__default.createElement(Bar, Object.assign({}, props, {
3165
3146
  type: "planned"
3166
3147
  })));
3167
3148
  }
3168
3149
 
3169
3150
  if ((task === null || task === void 0 ? void 0 : task.actualx1) >= 0 && (task === null || task === void 0 ? void 0 : task.actualx2) >= 0) {
3170
- _taskItem.push(React__default.createElement(Bar, Object.assign({}, props, {
3151
+ taskItem.push(React__default.createElement(Bar, Object.assign({}, props, {
3171
3152
  type: "actual"
3172
3153
  })));
3173
3154
  }
3174
3155
 
3175
- setTaskItem(_taskItem);
3156
+ setTaskItem(taskItem);
3176
3157
  }
3177
3158
  break;
3178
3159
  }
3179
3160
  }, [task, isSelected]);
3180
3161
  return React__default.createElement("g", null, React__default.createElement("g", {
3181
- onKeyDown: function onKeyDown(e) {
3162
+ onKeyDown: e => {
3182
3163
  switch (e.key) {
3183
3164
  case "Delete":
3184
3165
  {
@@ -3189,20 +3170,20 @@ var TaskItem = function TaskItem(props) {
3189
3170
 
3190
3171
  e.stopPropagation();
3191
3172
  },
3192
- onMouseEnter: function onMouseEnter(e) {
3173
+ onMouseEnter: e => {
3193
3174
  onEventStart("mouseenter", task, e, "planned");
3194
3175
  },
3195
- onMouseLeave: function onMouseLeave(e) {
3176
+ onMouseLeave: e => {
3196
3177
  onEventStart("mouseleave", task, e, "planned");
3197
3178
  },
3198
- onDoubleClick: function onDoubleClick(e) {
3179
+ onDoubleClick: e => {
3199
3180
  onEventStart("dblclick", task, e, "planned");
3200
3181
  },
3201
- onClick: function onClick(e) {
3182
+ onClick: e => {
3202
3183
  onEventStart("click", task, e, "planned");
3203
3184
  }
3204
3185
  }, taskItem[0]), React__default.createElement("g", {
3205
- onKeyDown: function onKeyDown(e) {
3186
+ onKeyDown: e => {
3206
3187
  switch (e.key) {
3207
3188
  case "Delete":
3208
3189
  {
@@ -3213,177 +3194,152 @@ var TaskItem = function TaskItem(props) {
3213
3194
 
3214
3195
  e.stopPropagation();
3215
3196
  },
3216
- onMouseEnter: function onMouseEnter(e) {
3197
+ onMouseEnter: e => {
3217
3198
  onEventStart("mouseenter", task, e, "actual");
3218
3199
  },
3219
- onMouseLeave: function onMouseLeave(e) {
3200
+ onMouseLeave: e => {
3220
3201
  onEventStart("mouseleave", task, e, "actual");
3221
3202
  },
3222
- onDoubleClick: function onDoubleClick(e) {
3203
+ onDoubleClick: e => {
3223
3204
  onEventStart("dblclick", task, e, "actual");
3224
3205
  },
3225
- onClick: function onClick(e) {
3206
+ onClick: e => {
3226
3207
  onEventStart("click", task, e, "actual");
3227
3208
  }
3228
3209
  }, taskItem[1]));
3229
3210
  };
3230
3211
 
3231
- var TaskGanttContent = function TaskGanttContent(_ref) {
3212
+ const TaskGanttContent = _ref => {
3232
3213
  var _svg$current;
3233
3214
 
3234
- var tasks = _ref.tasks,
3235
- dates = _ref.dates,
3236
- ganttEvent = _ref.ganttEvent,
3237
- selectedTask = _ref.selectedTask,
3238
- rowHeight = _ref.rowHeight,
3239
- columnWidth = _ref.columnWidth,
3240
- timeStep = _ref.timeStep,
3241
- svg = _ref.svg,
3242
- taskHeight = _ref.taskHeight,
3243
- arrowIndent = _ref.arrowIndent,
3244
- fontFamily = _ref.fontFamily,
3245
- fontSize = _ref.fontSize,
3246
- rtl = _ref.rtl,
3247
- _ref$virtualItems = _ref.virtualItems,
3248
- virtualItems = _ref$virtualItems === void 0 ? [] : _ref$virtualItems,
3249
- setGanttEvent = _ref.setGanttEvent,
3250
- setFailedTask = _ref.setFailedTask,
3251
- setSelectedTask = _ref.setSelectedTask,
3252
- onBarTasksUpdate = _ref.onBarTasksUpdate,
3253
- onDateChange = _ref.onDateChange,
3254
- onProgressChange = _ref.onProgressChange,
3255
- onDoubleClick = _ref.onDoubleClick,
3256
- onClick = _ref.onClick,
3257
- onDelete = _ref.onDelete,
3258
- onCalendarError = _ref.onCalendarError,
3259
- projectCalendar = _ref.projectCalendar,
3260
- visibleStartY = _ref.visibleStartY,
3261
- visibleEndY = _ref.visibleEndY,
3262
- sliderTime = _ref.sliderTime;
3263
- var point = svg === null || svg === void 0 ? void 0 : (_svg$current = svg.current) === null || _svg$current === void 0 ? void 0 : _svg$current.createSVGPoint();
3264
-
3265
- var _useState = React.useState(0),
3266
- xStep = _useState[0],
3267
- setXStep = _useState[1];
3268
-
3269
- var _useState2 = React.useState(0),
3270
- initEventX1Delta = _useState2[0],
3271
- setInitEventX1Delta = _useState2[1];
3272
-
3273
- var _useState3 = React.useState(false),
3274
- isMoving = _useState3[0],
3275
- setIsMoving = _useState3[1];
3276
-
3277
- React.useEffect(function () {
3215
+ let {
3216
+ tasks,
3217
+ dates,
3218
+ ganttEvent,
3219
+ selectedTask,
3220
+ rowHeight,
3221
+ columnWidth,
3222
+ timeStep,
3223
+ svg,
3224
+ taskHeight,
3225
+ arrowIndent,
3226
+ fontFamily,
3227
+ fontSize,
3228
+ rtl,
3229
+ virtualItems = [],
3230
+ setGanttEvent,
3231
+ setFailedTask,
3232
+ setSelectedTask,
3233
+ onBarTasksUpdate,
3234
+ onDateChange,
3235
+ onProgressChange,
3236
+ onDoubleClick,
3237
+ onClick,
3238
+ onDelete,
3239
+ onCalendarError,
3240
+ projectCalendar,
3241
+ visibleStartY,
3242
+ visibleEndY,
3243
+ sliderTime
3244
+ } = _ref;
3245
+ const point = svg === null || svg === void 0 ? void 0 : (_svg$current = svg.current) === null || _svg$current === void 0 ? void 0 : _svg$current.createSVGPoint();
3246
+ const [xStep, setXStep] = React.useState(0);
3247
+ const [initEventX1Delta, setInitEventX1Delta] = React.useState(0);
3248
+ const [isMoving, setIsMoving] = React.useState(false);
3249
+ React.useEffect(() => {
3278
3250
  if (dates.length < 2) {
3279
3251
  setXStep(timeStep * columnWidth / 86400000);
3280
3252
  return;
3281
3253
  }
3282
3254
 
3283
- var dateDelta = dates[1].getTime() - dates[0].getTime() - dates[1].getTimezoneOffset() * 60 * 1000 + dates[0].getTimezoneOffset() * 60 * 1000;
3284
- var newXStep = timeStep * columnWidth / dateDelta;
3255
+ const dateDelta = dates[1].getTime() - dates[0].getTime() - dates[1].getTimezoneOffset() * 60 * 1000 + dates[0].getTimezoneOffset() * 60 * 1000;
3256
+ const newXStep = timeStep * columnWidth / dateDelta;
3285
3257
  setXStep(newXStep);
3286
3258
  }, [columnWidth, dates, timeStep]);
3287
- React.useEffect(function () {
3288
- var handleMouseMove = function handleMouseMove(event) {
3259
+ React.useEffect(() => {
3260
+ const handleMouseMove = function (event) {
3289
3261
  try {
3290
3262
  var _svg$current$getScree;
3291
3263
 
3292
3264
  if (!ganttEvent.changedTask || !point || !(svg !== null && svg !== void 0 && svg.current)) return Promise.resolve();
3293
3265
  event.preventDefault();
3294
3266
  point.x = event.clientX;
3295
- var cursor = point.matrixTransform(svg === null || svg === void 0 ? void 0 : (_svg$current$getScree = svg.current.getScreenCTM()) === null || _svg$current$getScree === void 0 ? void 0 : _svg$current$getScree.inverse());
3296
-
3297
- var _handleTaskBySVGMouse = handleTaskBySVGMouseEvent(cursor.x, ganttEvent.action, ganttEvent.changedTask, ganttEvent.type, xStep, timeStep, initEventX1Delta, rtl),
3298
- isChanged = _handleTaskBySVGMouse.isChanged,
3299
- changedTask = _handleTaskBySVGMouse.changedTask;
3267
+ const cursor = point.matrixTransform(svg === null || svg === void 0 ? void 0 : (_svg$current$getScree = svg.current.getScreenCTM()) === null || _svg$current$getScree === void 0 ? void 0 : _svg$current$getScree.inverse());
3268
+ const {
3269
+ isChanged,
3270
+ changedTask
3271
+ } = handleTaskBySVGMouseEvent(cursor.x, ganttEvent.action, ganttEvent.changedTask, ganttEvent.type, xStep, timeStep, initEventX1Delta, rtl);
3300
3272
 
3301
3273
  if (isChanged) {
3302
- var finalTask = _extends({}, changedTask);
3303
-
3304
- var dragType = ganttEvent.type;
3274
+ let finalTask = { ...changedTask
3275
+ };
3276
+ const dragType = ganttEvent.type;
3305
3277
 
3306
3278
  if (changedTask.calendar && (ganttEvent.action === "end" || ganttEvent.action === "start" || ganttEvent.action === "move")) {
3307
- var cal = finalTask.calendar;
3279
+ const cal = finalTask.calendar;
3308
3280
 
3309
3281
  if (dragType === "actual") {
3310
3282
  if (ganttEvent.action === "end") {
3311
- var snapped = snapToWorkingTime(finalTask.actualEnd, cal, "forward");
3283
+ const snapped = snapToWorkingTime(finalTask.actualEnd, cal, "forward");
3312
3284
  finalTask.actualEnd = snapped;
3313
3285
  finalTask.actualx2 = taskXCoordinate(snapped, dates, columnWidth);
3314
3286
  } else if (ganttEvent.action === "start") {
3315
- var _snapped = snapToWorkingTime(finalTask.actualStart, cal, "forward");
3316
-
3317
- finalTask.actualStart = _snapped;
3318
- finalTask.actualx1 = taskXCoordinate(_snapped, dates, columnWidth);
3287
+ const snapped = snapToWorkingTime(finalTask.actualStart, cal, "forward");
3288
+ finalTask.actualStart = snapped;
3289
+ finalTask.actualx1 = taskXCoordinate(snapped, dates, columnWidth);
3319
3290
  } else {
3320
- var _snapped2 = snapToWorkingTime(finalTask.actualStart, cal, "forward");
3321
-
3322
- var delta = _snapped2.getTime() - finalTask.actualStart.getTime();
3323
- finalTask.actualStart = _snapped2;
3291
+ const snapped = snapToWorkingTime(finalTask.actualStart, cal, "forward");
3292
+ const delta = snapped.getTime() - finalTask.actualStart.getTime();
3293
+ finalTask.actualStart = snapped;
3324
3294
  finalTask.actualEnd = new Date(finalTask.actualEnd.getTime() + delta);
3325
3295
  finalTask.actualx1 = taskXCoordinate(finalTask.actualStart, dates, columnWidth);
3326
3296
  finalTask.actualx2 = taskXCoordinate(finalTask.actualEnd, dates, columnWidth);
3327
3297
  }
3328
3298
 
3329
- var actEnd = addToDate(startOfDate(finalTask.actualEnd, "day"), 1, "day");
3330
- var actIntervals = getWorkingIntervals(finalTask.actualStart, actEnd, cal);
3331
- var actSegs = actIntervals.map(function (iv) {
3332
- return {
3333
- x1: taskXCoordinate(iv.start, dates, columnWidth),
3334
- x2: taskXCoordinate(iv.end, dates, columnWidth)
3335
- };
3336
- }).filter(function (s) {
3337
- return s.x2 > s.x1;
3338
- });
3299
+ const actEnd = addToDate(startOfDate(finalTask.actualEnd, "day"), 1, "day");
3300
+ const actIntervals = getWorkingIntervals(finalTask.actualStart, actEnd, cal);
3301
+ const actSegs = actIntervals.map(iv => ({
3302
+ x1: taskXCoordinate(iv.start, dates, columnWidth),
3303
+ x2: taskXCoordinate(iv.end, dates, columnWidth)
3304
+ })).filter(s => s.x2 > s.x1);
3339
3305
  finalTask.actualSegments = actSegs.length > 0 ? actSegs : undefined;
3340
- var actDays = Math.max(1, Math.round((finalTask.actualEnd.getTime() - finalTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3306
+ const actDays = Math.max(1, Math.round((finalTask.actualEnd.getTime() - finalTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3341
3307
  finalTask.actualDuration = actDays;
3342
3308
  } else {
3343
3309
  if (ganttEvent.action === "end") {
3344
- var _snapped3 = snapToWorkingTime(finalTask.end, cal, "forward");
3345
-
3346
- finalTask.end = _snapped3;
3347
- finalTask.x2 = taskXCoordinate(_snapped3, dates, columnWidth);
3310
+ const snapped = snapToWorkingTime(finalTask.end, cal, "forward");
3311
+ finalTask.end = snapped;
3312
+ finalTask.x2 = taskXCoordinate(snapped, dates, columnWidth);
3348
3313
  } else if (ganttEvent.action === "start") {
3349
- var _snapped4 = snapToWorkingTime(finalTask.start, cal, "forward");
3350
-
3351
- finalTask.start = _snapped4;
3352
- finalTask.x1 = taskXCoordinate(_snapped4, dates, columnWidth);
3314
+ const snapped = snapToWorkingTime(finalTask.start, cal, "forward");
3315
+ finalTask.start = snapped;
3316
+ finalTask.x1 = taskXCoordinate(snapped, dates, columnWidth);
3353
3317
  } else {
3354
- var _snapped5 = snapToWorkingTime(finalTask.start, cal, "forward");
3355
-
3356
- var _delta = _snapped5.getTime() - finalTask.start.getTime();
3357
-
3358
- finalTask.start = _snapped5;
3359
- finalTask.end = new Date(finalTask.end.getTime() + _delta);
3318
+ const snapped = snapToWorkingTime(finalTask.start, cal, "forward");
3319
+ const delta = snapped.getTime() - finalTask.start.getTime();
3320
+ finalTask.start = snapped;
3321
+ finalTask.end = new Date(finalTask.end.getTime() + delta);
3360
3322
  finalTask.x1 = taskXCoordinate(finalTask.start, dates, columnWidth);
3361
3323
  finalTask.x2 = taskXCoordinate(finalTask.end, dates, columnWidth);
3362
3324
  }
3363
3325
 
3364
- var planEnd = addToDate(startOfDate(finalTask.end, "day"), 1, "day");
3365
- var planIntervals = getWorkingIntervals(finalTask.start, planEnd, cal);
3366
- var planSegs = planIntervals.map(function (iv) {
3367
- return {
3368
- x1: taskXCoordinate(iv.start, dates, columnWidth),
3369
- x2: taskXCoordinate(iv.end, dates, columnWidth)
3370
- };
3371
- }).filter(function (s) {
3372
- return s.x2 > s.x1;
3373
- });
3326
+ const planEnd = addToDate(startOfDate(finalTask.end, "day"), 1, "day");
3327
+ const planIntervals = getWorkingIntervals(finalTask.start, planEnd, cal);
3328
+ const planSegs = planIntervals.map(iv => ({
3329
+ x1: taskXCoordinate(iv.start, dates, columnWidth),
3330
+ x2: taskXCoordinate(iv.end, dates, columnWidth)
3331
+ })).filter(s => s.x2 > s.x1);
3374
3332
  finalTask.plannedSegments = planSegs.length > 0 ? planSegs : undefined;
3375
- var planDays = Math.max(1, Math.round((finalTask.end.getTime() - finalTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3333
+ const planDays = Math.max(1, Math.round((finalTask.end.getTime() - finalTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3376
3334
  finalTask.plannedDuration = planDays;
3377
3335
  }
3378
3336
  } else {
3379
3337
  if (dragType === "actual") {
3380
- var _actDays = Math.max(1, Math.round((finalTask.actualEnd.getTime() - finalTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3381
-
3382
- finalTask.actualDuration = _actDays;
3338
+ const actDays = Math.max(1, Math.round((finalTask.actualEnd.getTime() - finalTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3339
+ finalTask.actualDuration = actDays;
3383
3340
  } else {
3384
- var _planDays = Math.max(1, Math.round((finalTask.end.getTime() - finalTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3385
-
3386
- finalTask.plannedDuration = _planDays;
3341
+ const planDays = Math.max(1, Math.round((finalTask.end.getTime() - finalTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3342
+ finalTask.plannedDuration = planDays;
3387
3343
  }
3388
3344
  }
3389
3345
 
@@ -3400,41 +3356,42 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3400
3356
  }
3401
3357
  };
3402
3358
 
3403
- var handleMouseUp = function handleMouseUp(event) {
3359
+ const handleMouseUp = function (event) {
3404
3360
  try {
3405
3361
  var _svg$current$getScree2;
3406
3362
 
3407
- var _temp6 = function _temp6() {
3363
+ function _temp5() {
3408
3364
  if (!operationSuccess) {
3409
3365
  setFailedTask(originalSelectedTask);
3410
3366
  }
3411
- };
3367
+ }
3412
3368
 
3413
- var action = ganttEvent.action,
3414
- originalSelectedTask = ganttEvent.originalSelectedTask,
3415
- changedTask = ganttEvent.changedTask,
3416
- type = ganttEvent.type;
3369
+ const {
3370
+ action,
3371
+ originalSelectedTask,
3372
+ changedTask,
3373
+ type
3374
+ } = ganttEvent;
3417
3375
  if (!changedTask || !point || !(svg !== null && svg !== void 0 && svg.current) || !originalSelectedTask) return Promise.resolve();
3418
3376
  event.preventDefault();
3419
3377
  point.x = event.clientX;
3420
- var cursor = point.matrixTransform(svg === null || svg === void 0 ? void 0 : (_svg$current$getScree2 = svg.current.getScreenCTM()) === null || _svg$current$getScree2 === void 0 ? void 0 : _svg$current$getScree2.inverse());
3421
-
3422
- var _handleTaskBySVGMouse2 = handleTaskBySVGMouseEvent(cursor.x, action, changedTask, type, xStep, timeStep, initEventX1Delta, rtl),
3423
- newChangedTask = _handleTaskBySVGMouse2.changedTask;
3424
-
3425
- var isNotLikeOriginal = originalSelectedTask.start !== newChangedTask.start || originalSelectedTask.end !== newChangedTask.end || originalSelectedTask.actualStart !== newChangedTask.actualStart || originalSelectedTask.actualEnd !== newChangedTask.actualEnd || originalSelectedTask.progress !== newChangedTask.progress;
3426
- var dropType = type;
3378
+ const cursor = point.matrixTransform(svg === null || svg === void 0 ? void 0 : (_svg$current$getScree2 = svg.current.getScreenCTM()) === null || _svg$current$getScree2 === void 0 ? void 0 : _svg$current$getScree2.inverse());
3379
+ const {
3380
+ changedTask: newChangedTask
3381
+ } = handleTaskBySVGMouseEvent(cursor.x, action, changedTask, type, xStep, timeStep, initEventX1Delta, rtl);
3382
+ const isNotLikeOriginal = originalSelectedTask.start !== newChangedTask.start || originalSelectedTask.end !== newChangedTask.end || originalSelectedTask.actualStart !== newChangedTask.actualStart || originalSelectedTask.actualEnd !== newChangedTask.actualEnd || originalSelectedTask.progress !== newChangedTask.progress;
3383
+ const dropType = type;
3427
3384
 
3428
3385
  if (newChangedTask.calendar && (action === "move" || action === "end" || action === "start")) {
3429
- var cal = newChangedTask.calendar;
3386
+ const cal = newChangedTask.calendar;
3430
3387
 
3431
3388
  if (dropType === "actual") {
3432
3389
  if (action === "end") {
3433
- var snappedEnd = snapToWorkingTime(newChangedTask.actualEnd, cal, "forward");
3390
+ const snappedEnd = snapToWorkingTime(newChangedTask.actualEnd, cal, "forward");
3434
3391
  newChangedTask.actualEnd = snappedEnd;
3435
3392
  newChangedTask.actualx2 = taskXCoordinate(snappedEnd, dates, columnWidth);
3436
3393
  } else if (action === "start") {
3437
- var snappedStart = snapToWorkingTime(newChangedTask.actualStart, cal, "forward");
3394
+ const snappedStart = snapToWorkingTime(newChangedTask.actualStart, cal, "forward");
3438
3395
 
3439
3396
  if (snappedStart >= newChangedTask.actualEnd) {
3440
3397
  setFailedTask(originalSelectedTask);
@@ -3451,38 +3408,32 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3451
3408
  newChangedTask.actualStart = snappedStart;
3452
3409
  newChangedTask.actualx1 = taskXCoordinate(snappedStart, dates, columnWidth);
3453
3410
  } else {
3454
- var _snappedStart = snapToWorkingTime(newChangedTask.actualStart, cal, "forward");
3455
-
3456
- var delta = _snappedStart.getTime() - newChangedTask.actualStart.getTime();
3457
- newChangedTask.actualStart = _snappedStart;
3411
+ const snappedStart = snapToWorkingTime(newChangedTask.actualStart, cal, "forward");
3412
+ const delta = snappedStart.getTime() - newChangedTask.actualStart.getTime();
3413
+ newChangedTask.actualStart = snappedStart;
3458
3414
  newChangedTask.actualEnd = new Date(newChangedTask.actualEnd.getTime() + delta);
3459
- newChangedTask.actualx1 = taskXCoordinate(_snappedStart, dates, columnWidth);
3415
+ newChangedTask.actualx1 = taskXCoordinate(snappedStart, dates, columnWidth);
3460
3416
  newChangedTask.actualx2 = taskXCoordinate(newChangedTask.actualEnd, dates, columnWidth);
3461
3417
  }
3462
3418
 
3463
- var actEnd = addToDate(startOfDate(newChangedTask.actualEnd, "day"), 1, "day");
3464
- var actIntervals = getWorkingIntervals(newChangedTask.actualStart, actEnd, cal);
3465
- var actSegs = actIntervals.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
- });
3419
+ const actEnd = addToDate(startOfDate(newChangedTask.actualEnd, "day"), 1, "day");
3420
+ const actIntervals = getWorkingIntervals(newChangedTask.actualStart, actEnd, cal);
3421
+ const actSegs = actIntervals.map(iv => ({
3422
+ x1: taskXCoordinate(iv.start, dates, columnWidth),
3423
+ x2: taskXCoordinate(iv.end, dates, columnWidth)
3424
+ })).filter(s => s.x2 > s.x1);
3473
3425
  newChangedTask.actualSegments = actSegs.length > 0 ? actSegs : undefined;
3474
- var actDays = Math.max(1, Math.round((newChangedTask.actualEnd.getTime() - newChangedTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3426
+ const actDays = Math.max(1, Math.round((newChangedTask.actualEnd.getTime() - newChangedTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3475
3427
  newChangedTask.actualDuration = actDays;
3476
3428
  } else {
3477
3429
  if (action === "end") {
3478
- var _snappedEnd = snapToWorkingTime(newChangedTask.end, cal, "forward");
3479
-
3480
- newChangedTask.end = _snappedEnd;
3481
- newChangedTask.x2 = taskXCoordinate(_snappedEnd, dates, columnWidth);
3430
+ const snappedEnd = snapToWorkingTime(newChangedTask.end, cal, "forward");
3431
+ newChangedTask.end = snappedEnd;
3432
+ newChangedTask.x2 = taskXCoordinate(snappedEnd, dates, columnWidth);
3482
3433
  } else if (action === "start") {
3483
- var _snappedStart2 = snapToWorkingTime(newChangedTask.start, cal, "forward");
3434
+ const snappedStart = snapToWorkingTime(newChangedTask.start, cal, "forward");
3484
3435
 
3485
- if (_snappedStart2 >= newChangedTask.end) {
3436
+ if (snappedStart >= newChangedTask.end) {
3486
3437
  setFailedTask(originalSelectedTask);
3487
3438
  onCalendarError === null || onCalendarError === void 0 ? void 0 : onCalendarError(newChangedTask, "No working time in selected range");
3488
3439
  setGanttEvent({
@@ -3494,42 +3445,34 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3494
3445
  return Promise.resolve();
3495
3446
  }
3496
3447
 
3497
- newChangedTask.start = _snappedStart2;
3498
- newChangedTask.x1 = taskXCoordinate(_snappedStart2, dates, columnWidth);
3448
+ newChangedTask.start = snappedStart;
3449
+ newChangedTask.x1 = taskXCoordinate(snappedStart, dates, columnWidth);
3499
3450
  } else {
3500
- var _snappedStart3 = snapToWorkingTime(newChangedTask.start, cal, "forward");
3501
-
3502
- var _delta2 = _snappedStart3.getTime() - newChangedTask.start.getTime();
3503
-
3504
- newChangedTask.start = _snappedStart3;
3505
- newChangedTask.end = new Date(newChangedTask.end.getTime() + _delta2);
3506
- newChangedTask.x1 = taskXCoordinate(_snappedStart3, dates, columnWidth);
3451
+ const snappedStart = snapToWorkingTime(newChangedTask.start, cal, "forward");
3452
+ const delta = snappedStart.getTime() - newChangedTask.start.getTime();
3453
+ newChangedTask.start = snappedStart;
3454
+ newChangedTask.end = new Date(newChangedTask.end.getTime() + delta);
3455
+ newChangedTask.x1 = taskXCoordinate(snappedStart, dates, columnWidth);
3507
3456
  newChangedTask.x2 = taskXCoordinate(newChangedTask.end, dates, columnWidth);
3508
3457
  }
3509
3458
 
3510
- var planEnd = addToDate(startOfDate(newChangedTask.end, "day"), 1, "day");
3511
- var planIntervals = getWorkingIntervals(newChangedTask.start, planEnd, cal);
3512
- var planSegs = planIntervals.map(function (iv) {
3513
- return {
3514
- x1: taskXCoordinate(iv.start, dates, columnWidth),
3515
- x2: taskXCoordinate(iv.end, dates, columnWidth)
3516
- };
3517
- }).filter(function (s) {
3518
- return s.x2 > s.x1;
3519
- });
3459
+ const planEnd = addToDate(startOfDate(newChangedTask.end, "day"), 1, "day");
3460
+ const planIntervals = getWorkingIntervals(newChangedTask.start, planEnd, cal);
3461
+ const planSegs = planIntervals.map(iv => ({
3462
+ x1: taskXCoordinate(iv.start, dates, columnWidth),
3463
+ x2: taskXCoordinate(iv.end, dates, columnWidth)
3464
+ })).filter(s => s.x2 > s.x1);
3520
3465
  newChangedTask.plannedSegments = planSegs.length > 0 ? planSegs : undefined;
3521
- var planDays = Math.max(1, Math.round((newChangedTask.end.getTime() - newChangedTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3466
+ const planDays = Math.max(1, Math.round((newChangedTask.end.getTime() - newChangedTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3522
3467
  newChangedTask.plannedDuration = planDays;
3523
3468
  }
3524
3469
  } else if (action === "move" || action === "end" || action === "start") {
3525
3470
  if (dropType === "actual") {
3526
- var _actDays2 = Math.max(1, Math.round((newChangedTask.actualEnd.getTime() - newChangedTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3527
-
3528
- newChangedTask.actualDuration = _actDays2;
3471
+ const actDays = Math.max(1, Math.round((newChangedTask.actualEnd.getTime() - newChangedTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3472
+ newChangedTask.actualDuration = actDays;
3529
3473
  } else {
3530
- var _planDays2 = Math.max(1, Math.round((newChangedTask.end.getTime() - newChangedTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3531
-
3532
- newChangedTask.plannedDuration = _planDays2;
3474
+ const planDays = Math.max(1, Math.round((newChangedTask.end.getTime() - newChangedTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3475
+ newChangedTask.plannedDuration = planDays;
3533
3476
  }
3534
3477
  }
3535
3478
 
@@ -3544,11 +3487,11 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3544
3487
  action: ""
3545
3488
  });
3546
3489
  setIsMoving(false);
3547
- var operationSuccess = true;
3490
+ let operationSuccess = true;
3548
3491
 
3549
- var _temp7 = function () {
3492
+ const _temp4 = function () {
3550
3493
  if ((action === "move" || action === "end" || action === "start") && onDateChange && isNotLikeOriginal) {
3551
- var _temp8 = _catch(function () {
3494
+ const _temp = _catch(function () {
3552
3495
  return Promise.resolve(onDateChange(newChangedTask, newChangedTask.barChildren)).then(function (result) {
3553
3496
  if (result !== undefined) {
3554
3497
  operationSuccess = result;
@@ -3558,11 +3501,11 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3558
3501
  operationSuccess = false;
3559
3502
  });
3560
3503
 
3561
- if (_temp8 && _temp8.then) return _temp8.then(function () {});
3504
+ if (_temp && _temp.then) return _temp.then(function () {});
3562
3505
  } else {
3563
- var _temp9 = function () {
3506
+ const _temp3 = function () {
3564
3507
  if (onProgressChange && isNotLikeOriginal) {
3565
- var _temp10 = _catch(function () {
3508
+ const _temp2 = _catch(function () {
3566
3509
  return Promise.resolve(onProgressChange(newChangedTask, newChangedTask.barChildren)).then(function (result) {
3567
3510
  if (result !== undefined) {
3568
3511
  operationSuccess = result;
@@ -3572,15 +3515,15 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3572
3515
  operationSuccess = false;
3573
3516
  });
3574
3517
 
3575
- if (_temp10 && _temp10.then) return _temp10.then(function () {});
3518
+ if (_temp2 && _temp2.then) return _temp2.then(function () {});
3576
3519
  }
3577
3520
  }();
3578
3521
 
3579
- if (_temp9 && _temp9.then) return _temp9.then(function () {});
3522
+ if (_temp3 && _temp3.then) return _temp3.then(function () {});
3580
3523
  }
3581
3524
  }();
3582
3525
 
3583
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp6) : _temp6(_temp7));
3526
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
3584
3527
  } catch (e) {
3585
3528
  return Promise.reject(e);
3586
3529
  }
@@ -3593,7 +3536,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3593
3536
  }
3594
3537
  }, [ganttEvent, xStep, initEventX1Delta, onProgressChange, timeStep, onDateChange, onCalendarError, projectCalendar, svg, isMoving, point, rtl, setFailedTask, setGanttEvent, onBarTasksUpdate, dates, columnWidth]);
3595
3538
 
3596
- var handleBarEventStart = function handleBarEventStart(action, task, event, type) {
3539
+ const handleBarEventStart = function (action, task, event, type) {
3597
3540
  try {
3598
3541
  return Promise.resolve(function () {
3599
3542
  if (!event) {
@@ -3602,15 +3545,15 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3602
3545
  }
3603
3546
  } else return function () {
3604
3547
  if (isKeyboardEvent(event)) {
3605
- var _temp14 = function () {
3548
+ const _temp8 = function () {
3606
3549
  if (action === "delete") {
3607
- var _temp15 = function () {
3550
+ const _temp7 = function () {
3608
3551
  if (onDelete) {
3609
- var _temp16 = _catch(function () {
3552
+ const _temp6 = _catch(function () {
3610
3553
  return Promise.resolve(onDelete(task)).then(function (result) {
3611
3554
  if (result !== undefined && result) {
3612
3555
  setGanttEvent({
3613
- action: action,
3556
+ action,
3614
3557
  changedTask: task
3615
3558
  });
3616
3559
  }
@@ -3619,19 +3562,19 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3619
3562
  console.error("Error on Delete. " + error);
3620
3563
  });
3621
3564
 
3622
- if (_temp16 && _temp16.then) return _temp16.then(function () {});
3565
+ if (_temp6 && _temp6.then) return _temp6.then(function () {});
3623
3566
  }
3624
3567
  }();
3625
3568
 
3626
- if (_temp15 && _temp15.then) return _temp15.then(function () {});
3569
+ if (_temp7 && _temp7.then) return _temp7.then(function () {});
3627
3570
  }
3628
3571
  }();
3629
3572
 
3630
- if (_temp14 && _temp14.then) return _temp14.then(function () {});
3573
+ if (_temp8 && _temp8.then) return _temp8.then(function () {});
3631
3574
  } else if (action === "mouseenter") {
3632
3575
  if (!ganttEvent.action) {
3633
3576
  setGanttEvent({
3634
- action: action,
3577
+ action,
3635
3578
  changedTask: task,
3636
3579
  originalSelectedTask: task,
3637
3580
  type: type
@@ -3652,17 +3595,17 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3652
3595
 
3653
3596
  if (!(svg !== null && svg !== void 0 && svg.current) || !point) return;
3654
3597
  point.x = event.clientX;
3655
- var cursor = point.matrixTransform((_svg$current$getScree3 = svg.current.getScreenCTM()) === null || _svg$current$getScree3 === void 0 ? void 0 : _svg$current$getScree3.inverse());
3598
+ const cursor = point.matrixTransform((_svg$current$getScree3 = svg.current.getScreenCTM()) === null || _svg$current$getScree3 === void 0 ? void 0 : _svg$current$getScree3.inverse());
3656
3599
  if (type == "planned") setInitEventX1Delta(cursor.x - task.x1);else if (type == "actual") setInitEventX1Delta(cursor.x - task.actualx1);
3657
3600
  setGanttEvent({
3658
- action: action,
3601
+ action,
3659
3602
  changedTask: task,
3660
3603
  originalSelectedTask: task,
3661
3604
  type: type
3662
3605
  });
3663
3606
  } else {
3664
3607
  setGanttEvent({
3665
- action: action,
3608
+ action,
3666
3609
  changedTask: task,
3667
3610
  originalSelectedTask: task,
3668
3611
  type: type
@@ -3675,36 +3618,34 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3675
3618
  }
3676
3619
  };
3677
3620
 
3678
- var getArrows = function getArrows(isCritical, criticalPathType) {
3679
- return tasks.flatMap(function (_task) {
3680
- var a = ganttEvent.action;
3681
- var isDraggingThis = (a === "move" || a === "start" || a === "end" || a === "progress") && !!ganttEvent.changedTask && ganttEvent.changedTask.id === _task.id;
3621
+ const getArrows = (isCritical, criticalPathType) => {
3622
+ return tasks.flatMap(_task => {
3623
+ const a = ganttEvent.action;
3624
+ const isDraggingThis = (a === "move" || a === "start" || a === "end" || a === "progress") && !!ganttEvent.changedTask && ganttEvent.changedTask.id === _task.id;
3682
3625
 
3683
- var _live = isDraggingThis ? _extends({}, ganttEvent.changedTask, {
3626
+ const _live = isDraggingThis ? { ...ganttEvent.changedTask,
3684
3627
  y: _task.y
3685
- }) : _task;
3628
+ } : _task;
3686
3629
 
3687
- var task = _live.start.getTime() > 0 && _live.end.getTime() > 0 ? _live : undefined;
3630
+ const task = _live.start.getTime() > 0 && _live.end.getTime() > 0 ? _live : undefined;
3688
3631
 
3689
3632
  if (!task) {
3690
3633
  return [];
3691
3634
  }
3692
3635
 
3693
- return task.barChildren.map(function (child) {
3694
- var taskTo = tasks[child.index];
3695
- var fromDrawable = task.x2 > task.x1 || task.actualx2 > task.actualx1;
3696
- var toDrawable = !!taskTo && (taskTo.x2 > taskTo.x1 || taskTo.actualx2 > taskTo.actualx1);
3636
+ return task.barChildren.map(child => {
3637
+ const taskTo = tasks[child.index];
3638
+ const fromDrawable = task.x2 > task.x1 || task.actualx2 > task.actualx1;
3639
+ const toDrawable = !!taskTo && (taskTo.x2 > taskTo.x1 || taskTo.actualx2 > taskTo.actualx1);
3697
3640
 
3698
3641
  if (fromDrawable && toDrawable) {
3699
3642
  var _task$criticalPathArr;
3700
3643
 
3701
- var criticalTask = (_task$criticalPathArr = task.criticalPathArrows) === null || _task$criticalPathArr === void 0 ? void 0 : _task$criticalPathArr.find(function (arrow) {
3702
- return arrow.taskId === taskTo.id && (!!arrow.criticalPathType ? arrow.criticalPathType === criticalPathType : !criticalPathType);
3703
- });
3704
- var yFrom = task.y + taskHeight / 2;
3705
- var yTo = taskTo.y + taskHeight / 2;
3706
- var minY = Math.min(yFrom, yTo);
3707
- var maxY = Math.max(yFrom, yTo);
3644
+ const criticalTask = (_task$criticalPathArr = task.criticalPathArrows) === null || _task$criticalPathArr === void 0 ? void 0 : _task$criticalPathArr.find(arrow => arrow.taskId === taskTo.id && (!!arrow.criticalPathType ? arrow.criticalPathType === criticalPathType : !criticalPathType));
3645
+ const yFrom = task.y + taskHeight / 2;
3646
+ const yTo = taskTo.y + taskHeight / 2;
3647
+ const minY = Math.min(yFrom, yTo);
3648
+ const maxY = Math.max(yFrom, yTo);
3708
3649
 
3709
3650
  if (maxY < visibleStartY || minY > visibleEndY) {
3710
3651
  return null;
@@ -3712,7 +3653,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3712
3653
 
3713
3654
  if (!!criticalTask === isCritical) {
3714
3655
  return React__default.createElement(Arrow, {
3715
- key: "Arrow from " + task.id + " to " + taskTo.id + (isCritical ? "-critical" : ""),
3656
+ key: `Arrow from ${task.id} to ${taskTo.id}${isCritical ? "-critical" : ""}`,
3716
3657
  taskFrom: task,
3717
3658
  taskTo: taskTo,
3718
3659
  rowHeight: rowHeight,
@@ -3729,8 +3670,8 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3729
3670
  });
3730
3671
  };
3731
3672
 
3732
- var lineX = sliderTime !== undefined ? taskXCoordinate(new Date(sliderTime), dates, columnWidth) : null;
3733
- var totalHeight = tasks.length * rowHeight;
3673
+ const lineX = sliderTime !== undefined ? taskXCoordinate(new Date(sliderTime), dates, columnWidth) : null;
3674
+ const totalHeight = tasks.length * rowHeight;
3734
3675
  return React__default.createElement("g", {
3735
3676
  className: "content"
3736
3677
  }, lineX !== null && lineX > 0 && React__default.createElement("line", {
@@ -3748,18 +3689,18 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3748
3689
  className: "bar",
3749
3690
  fontFamily: fontFamily,
3750
3691
  fontSize: fontSize
3751
- }, virtualItems.map(function (vi) {
3752
- var _task = tasks[vi.index];
3753
- var task = ganttEvent.changedTask && ganttEvent.changedTask.id === _task.id ? _extends({}, ganttEvent.changedTask, {
3692
+ }, virtualItems.map(vi => {
3693
+ const _task = tasks[vi.index];
3694
+ const task = ganttEvent.changedTask && ganttEvent.changedTask.id === _task.id ? { ...ganttEvent.changedTask,
3754
3695
  y: 0
3755
- }) : _extends({}, _task, {
3696
+ } : { ..._task,
3756
3697
  y: 0
3757
- });
3698
+ };
3758
3699
 
3759
3700
  if (!task && _task.typeInternal === "milestone") {
3760
3701
  return React__default.createElement("g", {
3761
3702
  key: _task.id,
3762
- transform: "translate(0, " + vi.start + ")"
3703
+ transform: `translate(0, ${vi.start})`
3763
3704
  }, React__default.createElement(Milestone, {
3764
3705
  task: task,
3765
3706
  arrowIndent: arrowIndent,
@@ -3776,7 +3717,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3776
3717
  if (!task) {
3777
3718
  return React__default.createElement("g", {
3778
3719
  key: _task.id,
3779
- transform: "translate(0, " + vi.start + ")",
3720
+ transform: `translate(0, ${vi.start})`,
3780
3721
  style: {
3781
3722
  height: taskHeight
3782
3723
  }
@@ -3785,7 +3726,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3785
3726
 
3786
3727
  return React__default.createElement("g", {
3787
3728
  key: task.id,
3788
- transform: "translate(0, " + vi.start + ")"
3729
+ transform: `translate(0, ${vi.start})`
3789
3730
  }, React__default.createElement(TaskItem, {
3790
3731
  task: task,
3791
3732
  arrowIndent: arrowIndent,