gantt-task-react-powern 0.6.38 → 0.6.39

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.
@@ -19,6 +19,10 @@ function _extends() {
19
19
  return _extends.apply(this, arguments);
20
20
  }
21
21
 
22
+ function _objectDestructuringEmpty(obj) {
23
+ if (obj == null) throw new TypeError("Cannot destructure undefined");
24
+ }
25
+
22
26
  function _unsupportedIterableToArray(o, minLen) {
23
27
  if (!o) return;
24
28
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -353,7 +357,7 @@ var TaskListHeaderDefault = function TaskListHeaderDefault(_ref) {
353
357
  }
354
358
  }), {
355
359
  resizable: false
356
- }), cell("id", 0.8, "ID"), cell("wbs", 0.8, "WBS Code / Activity ID"), cell("name", 1.8, "Task"), cell("plannedStart", 0.6, "Planned Start", {
360
+ }), cell("id", 0.8, "ID"), cell("wbs", 0.8, "WBS Code / Activity ID"), cell("name", 1.8, "IM TESTING"), cell("plannedStart", 0.6, "Planned Start", {
357
361
  title: "Planned Start"
358
362
  }), cell("plannedEnd", 0.6, "Planned End", {
359
363
  title: "Planned End"
@@ -745,6 +749,43 @@ var Tooltip = function Tooltip(_ref) {
745
749
  type: type
746
750
  }));
747
751
  };
752
+
753
+ function getOffTime(task, taskStart, taskEnd, _message) {
754
+ var start = taskStart.getTime();
755
+ var end = taskEnd.getTime();
756
+ var startWeek = Math.floor((start / 86400000 + 4) / 7);
757
+ var endWeek = Math.floor((end / 86400000 + 4) / 7);
758
+ var offTime = 0;
759
+
760
+ if (task.calendar) {
761
+ if (task.calendar.off_days && task.calendar.off_days.length) {
762
+ for (var d = 0; d < task.calendar.off_days.length || 0; d++) {
763
+ for (var w = startWeek; w <= endWeek; w++) {
764
+ var dayOfTheWeek = task.calendar.off_days[d];
765
+ var offDay = 86400000 * (7 * w - 4 + dayOfTheWeek);
766
+
767
+ if (offDay >= start && offDay <= end) {
768
+ offTime += 86400000;
769
+ }
770
+ }
771
+ }
772
+ }
773
+
774
+ if (task.calendar.holidays && task.calendar.holidays.length) {
775
+ for (var h = 0; h < task.calendar.holidays.length || 0; h++) {
776
+ var holiday = task.calendar.holidays[h];
777
+ var holiday_timestamp = new Date(holiday).getTime();
778
+
779
+ if (holiday_timestamp >= start && holiday_timestamp <= end) {
780
+ offTime += 86400000;
781
+ }
782
+ }
783
+ }
784
+ }
785
+
786
+ return offTime;
787
+ }
788
+
748
789
  var StandardTooltipContent = function StandardTooltipContent(_ref2) {
749
790
  var _task$plannedDuration, _task$actualDuration;
750
791
 
@@ -756,8 +797,8 @@ var StandardTooltipContent = function StandardTooltipContent(_ref2) {
756
797
  fontSize: fontSize,
757
798
  fontFamily: fontFamily
758
799
  };
759
- var computedPlannedDuration = task.start && task.end && task.end.getTime() - task.start.getTime() > 0 ? Math.max(1, Math.round((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24))) : (_task$plannedDuration = task.plannedDuration) != null ? _task$plannedDuration : 0;
760
- var computedActualDuration = task.actualStart && task.actualEnd && task.actualEnd.getTime() - task.actualStart.getTime() > 0 ? Math.max(1, Math.round((task.actualEnd.getTime() - task.actualStart.getTime()) / (1000 * 60 * 60 * 24))) : (_task$actualDuration = task.actualDuration) != null ? _task$actualDuration : 0;
800
+ var computedPlannedDuration = task.start && task.end && task.end.getTime() - task.start.getTime() > 0 ? Math.max(1, Math.round((task.end.getTime() - task.start.getTime() - getOffTime(task, task.start, task.end)) / (1000 * 60 * 60 * 24))) : (_task$plannedDuration = task.plannedDuration) != null ? _task$plannedDuration : 0;
801
+ var computedActualDuration = task.actualStart && task.actualEnd && task.actualEnd.getTime() - task.actualStart.getTime() > 0 ? Math.max(1, Math.round((task.actualEnd.getTime() - task.actualStart.getTime() - getOffTime(task, task.actualStart, task.actualEnd)) / (1000 * 60 * 60 * 24))) : (_task$actualDuration = task.actualDuration) != null ? _task$actualDuration : 0;
761
802
  if (type == "planned") return React.createElement("div", {
762
803
  className: styles$2.tooltipDefaultContainer,
763
804
  style: style
@@ -817,7 +858,7 @@ var VerticalScroll = function VerticalScroll(_ref) {
817
858
  };
818
859
 
819
860
  function getTaskListColumns(scheduleType, hasCheckbox) {
820
- const columns = [];
861
+ var columns = [];
821
862
  if (hasCheckbox) columns.push({
822
863
  id: "select",
823
864
  factor: 0.3
@@ -870,12 +911,13 @@ function getTaskListColumns(scheduleType, hasCheckbox) {
870
911
 
871
912
  return columns;
872
913
  }
873
- const MIN_COLUMN_WIDTH = 40;
914
+ var MIN_COLUMN_WIDTH = 40;
874
915
  function buildDefaultColumnWidths(scheduleType, hasCheckbox, rowWidth) {
875
- const base = parseInt(rowWidth) || 0;
876
- const widths = {};
916
+ var base = parseInt(rowWidth) || 0;
917
+ var widths = {};
877
918
 
878
- for (const col of getTaskListColumns(scheduleType, hasCheckbox)) {
919
+ for (var _iterator = _createForOfIteratorHelperLoose(getTaskListColumns(scheduleType, hasCheckbox)), _step; !(_step = _iterator()).done;) {
920
+ var col = _step.value;
879
921
  widths[col.id] = base * col.factor;
880
922
  }
881
923
 
@@ -978,21 +1020,44 @@ var TaskList = function TaskList(_ref) {
978
1020
  useEffect(function () {
979
1021
  onContentWidthChange === null || onContentWidthChange === void 0 ? void 0 : onContentWidthChange(contentWidth);
980
1022
  }, [contentWidth, onContentWidthChange]);
981
- var taskIdsKey = useMemo(function () {
982
- return tasks.map(function (t) {
983
- return t.id;
984
- }).join("|");
985
- }, [tasks]);
986
- var selectedTaskIds = useMemo(function () {
987
- return new Set(selectedTasks);
988
- }, [selectedTasks]);
989
1023
 
990
1024
  var _useState3 = useState([]),
991
1025
  pendingTaskSelect = _useState3[0],
992
1026
  setPendingTaskSelect = _useState3[1];
993
1027
 
994
1028
  var prevSelectedTasksRef = useRef([]);
995
- var expandedTasks = useRef([]);
1029
+ var expandedTasks = useRef(new Set());
1030
+ var taskIndex = useMemo(function () {
1031
+ var byId = new Map();
1032
+ var childrenOf = new Map();
1033
+ var roots = [];
1034
+ tasks.forEach(function (task) {
1035
+ return byId.set(task.id, task);
1036
+ });
1037
+ tasks.forEach(function (task) {
1038
+ var parent = getParentWbs(task.id);
1039
+
1040
+ if (parent === undefined) {
1041
+ roots.push(task.id);
1042
+ return;
1043
+ }
1044
+
1045
+ var siblings = childrenOf.get(parent);
1046
+ if (siblings) siblings.push(task.id);else childrenOf.set(parent, [task.id]);
1047
+ });
1048
+ return {
1049
+ byId: byId,
1050
+ childrenOf: childrenOf,
1051
+ roots: roots
1052
+ };
1053
+ }, [tasks]);
1054
+
1055
+ var sameIds = function sameIds(a, b) {
1056
+ return a.length === b.length && a.every(function (id, i) {
1057
+ return id === b[i];
1058
+ });
1059
+ };
1060
+
996
1061
  var virtualizer = useVirtualizer({
997
1062
  count: tasks.length,
998
1063
  getScrollElement: function getScrollElement() {
@@ -1009,13 +1074,15 @@ var TaskList = function TaskList(_ref) {
1009
1074
  }
1010
1075
  }, [scrollY]);
1011
1076
  useEffect(function () {
1012
- if (onMultiSelect && JSON.stringify(prevSelectedTasksRef.current) !== JSON.stringify(selectedTasks)) {
1013
- var selectedTaskObjects = tasks.filter(function (task) {
1014
- return selectedTasks.includes(task.id);
1015
- });
1016
- prevSelectedTasksRef.current = [].concat(selectedTasks);
1017
- onMultiSelect(selectedTaskObjects);
1077
+ if (!onMultiSelect || sameIds(prevSelectedTasksRef.current, selectedTasks)) {
1078
+ return;
1018
1079
  }
1080
+
1081
+ var selected = new Set(selectedTasks);
1082
+ prevSelectedTasksRef.current = selectedTasks;
1083
+ onMultiSelect(tasks.filter(function (task) {
1084
+ return selected.has(task.id);
1085
+ }));
1019
1086
  }, [selectedTasks, tasks, onMultiSelect]);
1020
1087
  useEffect(function () {
1021
1088
  if (pendingTaskSelect.length === 0) return;
@@ -1025,19 +1092,19 @@ var TaskList = function TaskList(_ref) {
1025
1092
  selected = _ref2.selected;
1026
1093
 
1027
1094
  if (selected) {
1028
- recursiveOpen(taskId, tasks);
1029
- var descendants = getDescendants(taskId, tasks);
1095
+ recursiveOpen(taskId);
1096
+ var descendants = getDescendants(taskId);
1030
1097
  newSelected.add(taskId);
1031
1098
  descendants.forEach(function (d) {
1032
1099
  return newSelected.add(d);
1033
1100
  });
1034
1101
  } else {
1035
- var _descendants = getDescendants(taskId, tasks);
1102
+ var _descendants = getDescendants(taskId);
1036
1103
 
1037
- newSelected.delete(taskId);
1104
+ newSelected["delete"](taskId);
1038
1105
 
1039
1106
  _descendants.forEach(function (d) {
1040
- return newSelected.delete(d);
1107
+ return newSelected["delete"](d);
1041
1108
  });
1042
1109
  }
1043
1110
  });
@@ -1045,63 +1112,60 @@ var TaskList = function TaskList(_ref) {
1045
1112
  setPendingTaskSelect([]);
1046
1113
  }, [pendingTaskSelect]);
1047
1114
  useEffect(function () {
1048
- expandedTasks.current = expandedTasks.current.filter(function (id) {
1049
- var t = tasks.find(function (task) {
1050
- return task.id === id;
1051
- });
1052
- return t && !t.hideChildren;
1115
+ expandedTasks.current.forEach(function (id) {
1116
+ var task = taskIndex.byId.get(id);
1117
+ if (!task || task.hideChildren) expandedTasks.current["delete"](id);
1053
1118
  });
1054
1119
  if (selectedTasks.length === 0) return;
1055
1120
  var newSelected = new Set();
1056
1121
  selectedTasks.forEach(function (taskId) {
1057
- if (tasks.find(function (t) {
1058
- return t.id === taskId;
1059
- })) {
1060
- recursiveOpen(taskId, tasks);
1061
- newSelected.add(taskId);
1062
- var descendants = getDescendants(taskId, tasks);
1063
- descendants.forEach(function (d) {
1064
- return newSelected.add(d);
1065
- });
1066
- }
1122
+ if (!taskIndex.byId.has(taskId)) return;
1123
+ recursiveOpen(taskId);
1124
+ newSelected.add(taskId);
1125
+ getDescendants(taskId).forEach(function (d) {
1126
+ return newSelected.add(d);
1127
+ });
1067
1128
  });
1068
1129
  var newSelectedArray = Array.from(newSelected);
1069
1130
 
1070
- if (JSON.stringify(newSelectedArray) !== JSON.stringify(selectedTasks)) {
1131
+ if (!sameIds(newSelectedArray, selectedTasks)) {
1071
1132
  setSelectedTasks(newSelectedArray);
1072
1133
  }
1073
- }, [taskIdsKey]);
1134
+ }, [tasks.length]);
1074
1135
 
1075
- var getDescendants = function getDescendants(taskId, allTasks) {
1076
- var task = allTasks.find(function (t) {
1077
- return t.id === taskId;
1078
- });
1079
- if (!task) return [];
1080
- var children = allTasks.filter(function (t) {
1081
- return getParentWbs(t.id) === taskId;
1082
- });
1083
- return children.flatMap(function (child) {
1084
- return [child.id].concat(getDescendants(child.id, allTasks));
1085
- });
1086
- };
1136
+ var getDescendants = function getDescendants(taskId) {
1137
+ var _taskIndex$childrenOf;
1087
1138
 
1088
- var recursiveOpen = function recursiveOpen(taskId, allTasks) {
1089
- var task = allTasks.find(function (t) {
1090
- return t.id === taskId;
1091
- });
1092
- if (!task) return;
1139
+ if (!taskIndex.byId.has(taskId)) return [];
1140
+ var out = [];
1141
+ var stack = [].concat((_taskIndex$childrenOf = taskIndex.childrenOf.get(taskId)) != null ? _taskIndex$childrenOf : []).reverse();
1093
1142
 
1094
- if (!expandedTasks.current.includes(taskId) && task.hideChildren) {
1095
- onExpanderClick(task);
1096
- expandedTasks.current = [].concat(expandedTasks.current, [taskId]);
1143
+ while (stack.length) {
1144
+ var id = stack.pop();
1145
+ out.push(id);
1146
+ var children = taskIndex.childrenOf.get(id);
1147
+ if (children) stack.push.apply(stack, [].concat(children).reverse());
1097
1148
  }
1098
1149
 
1099
- var children = allTasks.filter(function (t) {
1100
- return getParentWbs(t.id) === taskId;
1101
- });
1102
- children.forEach(function (c) {
1103
- return recursiveOpen(c.id, allTasks);
1104
- });
1150
+ return out;
1151
+ };
1152
+
1153
+ var recursiveOpen = function recursiveOpen(taskId) {
1154
+ var stack = [taskId];
1155
+
1156
+ while (stack.length) {
1157
+ var id = stack.pop();
1158
+ var task = taskIndex.byId.get(id);
1159
+ var children = taskIndex.childrenOf.get(id);
1160
+ if (!task || !children) continue;
1161
+
1162
+ if (task.hideChildren && !expandedTasks.current.has(id)) {
1163
+ onExpanderClick(task);
1164
+ expandedTasks.current.add(id);
1165
+ }
1166
+
1167
+ stack.push.apply(stack, children);
1168
+ }
1105
1169
  };
1106
1170
 
1107
1171
  var handleTaskSelect = function handleTaskSelect(taskId, selected) {
@@ -1115,10 +1179,12 @@ var TaskList = function TaskList(_ref) {
1115
1179
 
1116
1180
  var handleSelectAll = function handleSelectAll(selected) {
1117
1181
  if (selected) {
1118
- setSelectedTasks(tasks.map(function (task) {
1119
- return task.id;
1182
+ setPendingTaskSelect(taskIndex.roots.map(function (taskId) {
1183
+ return {
1184
+ taskId: taskId,
1185
+ selected: true
1186
+ };
1120
1187
  }));
1121
- setPendingTaskSelect([]);
1122
1188
  } else {
1123
1189
  setSelectedTasks([]);
1124
1190
  setPendingTaskSelect([]);
@@ -1131,9 +1197,7 @@ var TaskList = function TaskList(_ref) {
1131
1197
  fontSize: fontSize,
1132
1198
  rowWidth: rowWidth,
1133
1199
  scheduleType: scheduleType,
1134
- allSelected: tasks.length > 0 && tasks.every(function (t) {
1135
- return selectedTaskIds.has(t.id);
1136
- }),
1200
+ allSelected: tasks.length > 0 && selectedTasks.length === tasks.length,
1137
1201
  onSelectAll: onMultiSelect ? handleSelectAll : undefined,
1138
1202
  columnWidths: columnWidths,
1139
1203
  onColumnResize: handleColumnResize
@@ -1194,15 +1258,15 @@ var TaskList = function TaskList(_ref) {
1194
1258
  };
1195
1259
 
1196
1260
  function parseTimeToMinutes(t) {
1197
- const parts = t.split(":").map(Number);
1261
+ var parts = t.split(":").map(Number);
1198
1262
  return parts[0] * 60 + parts[1] + (parts[2] ? parts[2] / 60 : 0);
1199
1263
  }
1200
1264
 
1201
1265
  function toDateString(date) {
1202
- const y = date.getFullYear();
1203
- const m = String(date.getMonth() + 1).padStart(2, "0");
1204
- const d = String(date.getDate()).padStart(2, "0");
1205
- return `${y}-${m}-${d}`;
1266
+ var y = date.getFullYear();
1267
+ var m = String(date.getMonth() + 1).padStart(2, "0");
1268
+ var d = String(date.getDate()).padStart(2, "0");
1269
+ return y + "-" + m + "-" + d;
1206
1270
  }
1207
1271
 
1208
1272
  function isHoliday(date, cal) {
@@ -1219,32 +1283,70 @@ function isOffDay(date, cal) {
1219
1283
  return false;
1220
1284
  }
1221
1285
  }
1286
+ var parsedShiftsCache = new WeakMap();
1287
+ var offDayCache = new WeakMap();
1288
+
1289
+ function parsedShifts(cal) {
1290
+ var shifts = parsedShiftsCache.get(cal);
1291
+
1292
+ if (!shifts) {
1293
+ var _cal$shifts;
1294
+
1295
+ shifts = ((_cal$shifts = cal.shifts) != null ? _cal$shifts : []).map(function (_ref) {
1296
+ var s = _ref[0],
1297
+ e = _ref[1];
1298
+ return {
1299
+ start: parseTimeToMinutes(s),
1300
+ end: parseTimeToMinutes(e)
1301
+ };
1302
+ });
1303
+ parsedShiftsCache.set(cal, shifts);
1304
+ }
1305
+
1306
+ return shifts;
1307
+ }
1308
+
1309
+ function isOffDayCached(date, cal) {
1310
+ var perCal = offDayCache.get(cal);
1311
+
1312
+ if (!perCal) {
1313
+ perCal = new Map();
1314
+ offDayCache.set(cal, perCal);
1315
+ }
1316
+
1317
+ var key = date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate();
1318
+ var off = perCal.get(key);
1319
+
1320
+ if (off === undefined) {
1321
+ off = isOffDay(date, cal);
1322
+ perCal.set(key, off);
1323
+ }
1324
+
1325
+ return off;
1326
+ }
1327
+
1328
+ var NO_SHIFTS = [];
1222
1329
  function getShiftsForDay(date, cal) {
1223
- if (isOffDay(date, cal) || !cal.shifts) return [];
1224
- return cal.shifts.map(_ref => {
1225
- let [s, e] = _ref;
1226
- return {
1227
- start: parseTimeToMinutes(s),
1228
- end: parseTimeToMinutes(e)
1229
- };
1230
- });
1330
+ if (!cal.shifts || isOffDayCached(date, cal)) return NO_SHIFTS;
1331
+ return parsedShifts(cal);
1231
1332
  }
1232
1333
  function getWorkingIntervals(start, end, cal) {
1233
1334
  if (start >= end) return [];
1234
- const intervals = [];
1235
- const cursor = new Date(start);
1335
+ var intervals = [];
1336
+ var cursor = new Date(start);
1236
1337
  cursor.setHours(0, 0, 0, 0);
1237
1338
 
1238
1339
  while (cursor <= end) {
1239
- const shifts = getShiftsForDay(cursor, cal);
1340
+ var shifts = getShiftsForDay(cursor, cal);
1240
1341
 
1241
- for (const shift of shifts) {
1242
- const shiftStart = new Date(cursor);
1342
+ for (var _iterator = _createForOfIteratorHelperLoose(shifts), _step; !(_step = _iterator()).done;) {
1343
+ var shift = _step.value;
1344
+ var shiftStart = new Date(cursor);
1243
1345
  shiftStart.setHours(Math.floor(shift.start / 60), Math.floor(shift.start % 60), Math.round(shift.start % 1 * 60), 0);
1244
- const shiftEnd = new Date(cursor);
1346
+ var shiftEnd = new Date(cursor);
1245
1347
  shiftEnd.setHours(Math.floor(shift.end / 60), Math.floor(shift.end % 60), Math.round(shift.end % 1 * 60), 0);
1246
- const intervalStart = shiftStart < start ? start : shiftStart;
1247
- const intervalEnd = shiftEnd > end ? end : shiftEnd;
1348
+ var intervalStart = shiftStart < start ? start : shiftStart;
1349
+ var intervalEnd = shiftEnd > end ? end : shiftEnd;
1248
1350
 
1249
1351
  if (intervalStart < intervalEnd) {
1250
1352
  intervals.push({
@@ -1260,19 +1362,21 @@ function getWorkingIntervals(start, end, cal) {
1260
1362
  return intervals;
1261
1363
  }
1262
1364
  function snapToWorkingTime(date, cal, direction) {
1263
- const MAX_DAYS = 60;
1264
- const result = new Date(date);
1365
+ var MAX_DAYS = 60;
1366
+ var result = new Date(date);
1265
1367
 
1266
- for (let attempt = 0; attempt < MAX_DAYS * 24 * 60; attempt++) {
1267
- const dayStart = new Date(result);
1368
+ for (var attempt = 0; attempt < MAX_DAYS * 24 * 60; attempt++) {
1369
+ var dayStart = new Date(result);
1268
1370
  dayStart.setHours(0, 0, 0, 0);
1269
- const shifts = getShiftsForDay(dayStart, cal);
1371
+ var shifts = getShiftsForDay(dayStart, cal);
1270
1372
 
1271
1373
  if (shifts.length > 0) {
1272
1374
  if (direction === "forward") {
1273
- const currentMins = result.getHours() * 60 + result.getMinutes() + result.getSeconds() / 60;
1375
+ var currentMins = result.getHours() * 60 + result.getMinutes() + result.getSeconds() / 60;
1376
+
1377
+ for (var _iterator2 = _createForOfIteratorHelperLoose(shifts), _step2; !(_step2 = _iterator2()).done;) {
1378
+ var shift = _step2.value;
1274
1379
 
1275
- for (const shift of shifts) {
1276
1380
  if (currentMins <= shift.end) {
1277
1381
  if (currentMins < shift.start) {
1278
1382
  result.setHours(Math.floor(shift.start / 60), Math.round(shift.start % 60), 0, 0);
@@ -1285,11 +1389,11 @@ function snapToWorkingTime(date, cal, direction) {
1285
1389
  result.setDate(result.getDate() + 1);
1286
1390
  result.setHours(0, 0, 0, 0);
1287
1391
  } else {
1288
- const currentMins = result.getHours() * 60 + result.getMinutes() + result.getSeconds() / 60;
1392
+ var _currentMins = result.getHours() * 60 + result.getMinutes() + result.getSeconds() / 60;
1289
1393
 
1290
- for (let i = shifts.length - 1; i >= 0; i--) {
1291
- if (currentMins >= shifts[i].start) {
1292
- if (currentMins > shifts[i].end) {
1394
+ for (var i = shifts.length - 1; i >= 0; i--) {
1395
+ if (_currentMins >= shifts[i].start) {
1396
+ if (_currentMins > shifts[i].end) {
1293
1397
  result.setHours(Math.floor(shifts[i].end / 60), Math.round(shifts[i].end % 60), 0, 0);
1294
1398
  }
1295
1399
 
@@ -1314,69 +1418,72 @@ function snapToWorkingTime(date, cal, direction) {
1314
1418
  return date;
1315
1419
  }
1316
1420
  function getQuarterNumber(date, quarterStart) {
1317
- const month = date.getMonth();
1318
- const offset = (month - quarterStart + 12) % 12;
1421
+ var month = date.getMonth();
1422
+ var offset = (month - quarterStart + 12) % 12;
1319
1423
  return Math.floor(offset / 3) + 1;
1320
1424
  }
1321
1425
 
1322
1426
  var styles$5 = {"gridRow":"_2dZTy","gridRowLookAhead":"_2RRca","gridRowLine":"_3rUKi","gridTick":"_RuwuK","gridTickWeekStart":"_1q0EV","gridTickDashed":"_Zh9jh","darkerGridRow":"_2M-tt"};
1323
1427
 
1324
- const GridBody = _ref => {
1325
- let {
1326
- tasks,
1327
- scheduleType,
1328
- dates,
1329
- rowHeight,
1330
- svgWidth,
1331
- columnWidth,
1332
- todayColor,
1333
- weekendColor,
1334
- rtl,
1335
- virtualItems = [],
1336
- visibleStartY,
1337
- visibleEndY,
1338
- projectCalendar,
1339
- viewMode
1340
- } = _ref;
1341
- const visibleHeight = visibleEndY - visibleStartY;
1342
- const now = new Date();
1343
- const items = virtualItems.length > 0 ? virtualItems : tasks.map((_, i) => ({
1344
- index: i,
1345
- start: i * rowHeight,
1346
- end: (i + 1) * rowHeight,
1347
- size: rowHeight,
1348
- key: i
1349
- }));
1428
+ var GridBody = function GridBody(_ref) {
1429
+ var _projectCalendar$week;
1430
+
1431
+ var tasks = _ref.tasks,
1432
+ scheduleType = _ref.scheduleType,
1433
+ dates = _ref.dates,
1434
+ rowHeight = _ref.rowHeight,
1435
+ svgWidth = _ref.svgWidth,
1436
+ columnWidth = _ref.columnWidth,
1437
+ todayColor = _ref.todayColor,
1438
+ weekendColor = _ref.weekendColor,
1439
+ rtl = _ref.rtl,
1440
+ _ref$virtualItems = _ref.virtualItems,
1441
+ virtualItems = _ref$virtualItems === void 0 ? [] : _ref$virtualItems,
1442
+ visibleStartY = _ref.visibleStartY,
1443
+ visibleEndY = _ref.visibleEndY,
1444
+ projectCalendar = _ref.projectCalendar,
1445
+ viewMode = _ref.viewMode;
1446
+ var visibleHeight = visibleEndY - visibleStartY;
1447
+ var now = new Date();
1448
+ var items = virtualItems != null ? virtualItems : tasks.map(function (_, i) {
1449
+ return {
1450
+ index: i,
1451
+ start: i * rowHeight,
1452
+ end: (i + 1) * rowHeight,
1453
+ size: rowHeight,
1454
+ key: i
1455
+ };
1456
+ });
1350
1457
 
1351
- const isDayOff = date => {
1458
+ var isDayOff = function isDayOff(date) {
1352
1459
  if (projectCalendar) return isOffDay(date, projectCalendar);
1353
- const d = date.getDay();
1460
+ var d = date.getDay();
1354
1461
  return d === 0 || d === 6;
1355
1462
  };
1356
1463
 
1357
- const isTodayColumn = i => {
1358
- const date = dates[i];
1359
- const next = dates[i + 1];
1464
+ var isTodayColumn = function isTodayColumn(i) {
1465
+ var date = dates[i];
1466
+ var next = dates[i + 1];
1360
1467
  if (next && date <= now && next > now) return true;
1361
1468
 
1362
1469
  if (!next && date <= now) {
1363
- const prev = dates[i - 1];
1364
- const step = prev ? date.getTime() - prev.getTime() : 86400000;
1365
- const end = addToDate(date, step, "millisecond");
1470
+ var prev = dates[i - 1];
1471
+ var step = prev ? date.getTime() - prev.getTime() : 86400000;
1472
+ var end = addToDate(date, step, "millisecond");
1366
1473
  return end > now;
1367
1474
  }
1368
1475
 
1369
1476
  return false;
1370
1477
  };
1371
1478
 
1372
- const todayRects = [];
1373
- const offDayRects = [];
1374
- const weekStartDay = (projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.week_start) ?? 1;
1479
+ var todayRects = [];
1480
+ var offDayRects = [];
1481
+ var weekStartDay = (_projectCalendar$week = projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.week_start) != null ? _projectCalendar$week : 1;
1375
1482
 
1376
- for (let i = 0, x = 0; i < dates.length; i++, x += columnWidth) {
1483
+ for (var i = 0, x = 0; i < dates.length; i++, x += columnWidth) {
1377
1484
  if (isTodayColumn(i)) {
1378
1485
  todayRects.push(React.createElement("rect", {
1379
- key: `today-${i}`,
1486
+ key: "today-" + i,
1380
1487
  x: rtl ? x + columnWidth : x,
1381
1488
  y: visibleStartY,
1382
1489
  width: columnWidth,
@@ -1386,24 +1493,26 @@ const GridBody = _ref => {
1386
1493
  }
1387
1494
 
1388
1495
  if (viewMode !== ViewMode.Month && viewMode !== ViewMode.Quarter) {
1389
- const pEnd = dates[i + 1] ?? addToDate(dates[i], 1, "day");
1390
- const periodMs = pEnd.getTime() - dates[i].getTime();
1496
+ var _dates;
1497
+
1498
+ var pEnd = (_dates = dates[i + 1]) != null ? _dates : addToDate(dates[i], 1, "day");
1499
+ var periodMs = pEnd.getTime() - dates[i].getTime();
1391
1500
 
1392
1501
  if (periodMs > 0) {
1393
- const cursor = new Date(dates[i]);
1502
+ var cursor = new Date(dates[i]);
1394
1503
  cursor.setHours(0, 0, 0, 0);
1395
1504
 
1396
1505
  while (cursor.getTime() < pEnd.getTime()) {
1397
1506
  if (isDayOff(cursor)) {
1398
- const ds = cursor.getTime() - dates[i].getTime();
1399
- const de = ds + 86400000;
1400
- const startFrac = Math.max(0, ds) / periodMs;
1401
- const endFrac = Math.min(periodMs, de) / periodMs;
1402
- const rw = (endFrac - startFrac) * columnWidth;
1507
+ var ds = cursor.getTime() - dates[i].getTime();
1508
+ var de = ds + 86400000;
1509
+ var startFrac = Math.max(0, ds) / periodMs;
1510
+ var endFrac = Math.min(periodMs, de) / periodMs;
1511
+ var rw = (endFrac - startFrac) * columnWidth;
1403
1512
 
1404
1513
  if (rw > 0.5) {
1405
1514
  offDayRects.push(React.createElement("rect", {
1406
- key: `offday-${i}-${cursor.getTime()}`,
1515
+ key: "offday-" + i + "-" + cursor.getTime(),
1407
1516
  x: x + startFrac * columnWidth,
1408
1517
  y: visibleStartY,
1409
1518
  width: rw,
@@ -1419,10 +1528,10 @@ const GridBody = _ref => {
1419
1528
  }
1420
1529
  }
1421
1530
 
1422
- const isDayView = viewMode === ViewMode.Day;
1423
- const isWeekView = viewMode === ViewMode.Week;
1424
- const tickLines = dates.map((date, i) => {
1425
- let tickClass = styles$5.gridTick;
1531
+ var isDayView = viewMode === ViewMode.Day;
1532
+ var isWeekView = viewMode === ViewMode.Week;
1533
+ var tickLines = dates.map(function (date, i) {
1534
+ var tickClass = styles$5.gridTick;
1426
1535
 
1427
1536
  if (isDayView) {
1428
1537
  tickClass = date.getDay() === weekStartDay ? styles$5.gridTickWeekStart : styles$5.gridTickDashed;
@@ -1431,7 +1540,7 @@ const GridBody = _ref => {
1431
1540
  }
1432
1541
 
1433
1542
  return React.createElement("line", {
1434
- key: `tick-${i}`,
1543
+ key: "tick-" + i,
1435
1544
  x1: i * columnWidth,
1436
1545
  y1: visibleStartY,
1437
1546
  x2: i * columnWidth,
@@ -1439,9 +1548,9 @@ const GridBody = _ref => {
1439
1548
  className: tickClass
1440
1549
  });
1441
1550
  });
1442
- const rowBackgrounds = [];
1443
- const rowLines = [];
1444
- const rowOverlays = [];
1551
+ var rowBackgrounds = [];
1552
+ var rowLines = [];
1553
+ var rowOverlays = [];
1445
1554
  rowLines.push(React.createElement("line", {
1446
1555
  key: "top-line",
1447
1556
  x1: 0,
@@ -1450,16 +1559,17 @@ const GridBody = _ref => {
1450
1559
  y2: visibleStartY,
1451
1560
  className: styles$5.gridRowLine
1452
1561
  }));
1453
- const showPerRowOffDays = viewMode !== ViewMode.Month && viewMode !== ViewMode.Quarter;
1562
+ var showPerRowOffDays = viewMode !== ViewMode.Month && viewMode !== ViewMode.Quarter;
1454
1563
 
1455
- for (const vi of items) {
1456
- const task = tasks[vi.index];
1564
+ for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {
1565
+ var vi = _step.value;
1566
+ var task = tasks[vi.index];
1457
1567
  if (!task) break;
1458
- const y = vi.start;
1459
- const isMilestone = task.type === "milestone";
1460
- const rowClass = isMilestone ? styles$5.darkerGridRow : scheduleType === "lookAhead" ? styles$5.gridRowLookAhead : styles$5.gridRow;
1568
+ var y = vi.start;
1569
+ var isMilestone = task.type === "milestone";
1570
+ var rowClass = isMilestone ? styles$5.darkerGridRow : scheduleType === "lookAhead" ? styles$5.gridRowLookAhead : styles$5.gridRow;
1461
1571
  rowBackgrounds.push(React.createElement("rect", {
1462
- key: `bg-${vi.key}`,
1572
+ key: "bg-" + vi.key,
1463
1573
  x: 0,
1464
1574
  y: y,
1465
1575
  width: svgWidth,
@@ -1467,7 +1577,7 @@ const GridBody = _ref => {
1467
1577
  className: rowClass
1468
1578
  }));
1469
1579
  rowLines.push(React.createElement("line", {
1470
- key: `line-${vi.key}`,
1580
+ key: "line-" + vi.key,
1471
1581
  x1: 0,
1472
1582
  y1: y + rowHeight,
1473
1583
  x2: svgWidth,
@@ -1476,47 +1586,57 @@ const GridBody = _ref => {
1476
1586
  }));
1477
1587
 
1478
1588
  if (showPerRowOffDays) {
1479
- const rowEven = vi.index % 2 === 1;
1480
- const rowFill = isMilestone ? "#e6e4e4" : scheduleType === "lookAhead" ? "#fff" : rowEven ? "#f5f5f5" : "#fff";
1589
+ var rowEven = vi.index % 2 === 1;
1590
+ var rowFill = isMilestone ? "#e6e4e4" : scheduleType === "lookAhead" ? "#fff" : rowEven ? "#f5f5f5" : "#fff";
1481
1591
  rowOverlays.push(React.createElement("rect", {
1482
- key: `row-clean-${vi.key}`,
1592
+ key: "row-clean-" + vi.key,
1483
1593
  x: 0,
1484
1594
  y: y,
1485
1595
  width: svgWidth,
1486
1596
  height: rowHeight,
1487
1597
  fill: rowFill
1488
1598
  }));
1489
- const cal = task.calendar;
1599
+ var cal = task.calendar;
1490
1600
 
1491
1601
  if (cal) {
1492
- for (let i = 0, x = 0; i < dates.length; i++, x += columnWidth) {
1493
- const pEnd = dates[i + 1] ?? addToDate(dates[i], 1, "day");
1494
- const periodMs = pEnd.getTime() - dates[i].getTime();
1495
- if (periodMs <= 0) continue;
1496
- const cursor = new Date(dates[i]);
1497
- cursor.setHours(0, 0, 0, 0);
1498
-
1499
- while (cursor.getTime() < pEnd.getTime()) {
1500
- if (isOffDay(cursor, cal)) {
1501
- const ds = cursor.getTime() - dates[i].getTime();
1502
- const de = ds + 86400000;
1503
- const startFrac = Math.max(0, ds) / periodMs;
1504
- const endFrac = Math.min(periodMs, de) / periodMs;
1505
- const rw = (endFrac - startFrac) * columnWidth;
1506
-
1507
- if (rw > 0.5) {
1602
+ for (var _i = 0, _x = 0; _i < dates.length; _i++, _x += columnWidth) {
1603
+ var _dates2;
1604
+
1605
+ var _pEnd = (_dates2 = dates[_i + 1]) != null ? _dates2 : addToDate(dates[_i], 1, "day");
1606
+
1607
+ var _periodMs = _pEnd.getTime() - dates[_i].getTime();
1608
+
1609
+ if (_periodMs <= 0) continue;
1610
+
1611
+ var _cursor = new Date(dates[_i]);
1612
+
1613
+ _cursor.setHours(0, 0, 0, 0);
1614
+
1615
+ while (_cursor.getTime() < _pEnd.getTime()) {
1616
+ if (isOffDay(_cursor, cal)) {
1617
+ var _ds = _cursor.getTime() - dates[_i].getTime();
1618
+
1619
+ var _de = _ds + 86400000;
1620
+
1621
+ var _startFrac = Math.max(0, _ds) / _periodMs;
1622
+
1623
+ var _endFrac = Math.min(_periodMs, _de) / _periodMs;
1624
+
1625
+ var _rw = (_endFrac - _startFrac) * columnWidth;
1626
+
1627
+ if (_rw > 0.5) {
1508
1628
  rowOverlays.push(React.createElement("rect", {
1509
- key: `row-offday-${vi.key}-${cursor.getTime()}`,
1510
- x: rtl ? x + columnWidth - (startFrac * columnWidth + rw) : x + startFrac * columnWidth,
1629
+ key: "row-offday-" + vi.key + "-" + _cursor.getTime(),
1630
+ x: rtl ? _x + columnWidth - (_startFrac * columnWidth + _rw) : _x + _startFrac * columnWidth,
1511
1631
  y: y,
1512
- width: rw,
1632
+ width: _rw,
1513
1633
  height: rowHeight,
1514
1634
  fill: weekendColor
1515
1635
  }));
1516
1636
  }
1517
1637
  }
1518
1638
 
1519
- cursor.setDate(cursor.getDate() + 1);
1639
+ _cursor.setDate(_cursor.getDate() + 1);
1520
1640
  }
1521
1641
  }
1522
1642
  }
@@ -1540,7 +1660,7 @@ const GridBody = _ref => {
1540
1660
  }, todayRects));
1541
1661
  };
1542
1662
 
1543
- const Grid = props => {
1663
+ var Grid = function Grid(props) {
1544
1664
  return React.createElement("g", {
1545
1665
  className: "grid"
1546
1666
  }, React.createElement(GridBody, Object.assign({}, props)));
@@ -1548,17 +1668,16 @@ const Grid = props => {
1548
1668
 
1549
1669
  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"};
1550
1670
 
1551
- const TopPartOfCalendar = _ref => {
1552
- let {
1553
- value,
1554
- x1Line,
1555
- y1Line,
1556
- y2Line,
1557
- xText,
1558
- yText,
1559
- textAnchor = "middle"
1560
- } = _ref;
1561
- const textAnchorClass = textAnchor === "start" ? styles$6.textAnchorStart : textAnchor === "middle" ? styles$6.textAnchorMiddle : styles$6.textAnchorEnd;
1671
+ var TopPartOfCalendar = function TopPartOfCalendar(_ref) {
1672
+ var value = _ref.value,
1673
+ x1Line = _ref.x1Line,
1674
+ y1Line = _ref.y1Line,
1675
+ y2Line = _ref.y2Line,
1676
+ xText = _ref.xText,
1677
+ yText = _ref.yText,
1678
+ _ref$textAnchor = _ref.textAnchor,
1679
+ textAnchor = _ref$textAnchor === void 0 ? "middle" : _ref$textAnchor;
1680
+ var textAnchorClass = textAnchor === "start" ? styles$6.textAnchorStart : textAnchor === "middle" ? styles$6.textAnchorMiddle : styles$6.textAnchorEnd;
1562
1681
  return React.createElement("g", {
1563
1682
  className: "calendarTop"
1564
1683
  }, React.createElement("line", {
@@ -1572,41 +1691,41 @@ const TopPartOfCalendar = _ref => {
1572
1691
  key: value + "text",
1573
1692
  y: yText,
1574
1693
  x: xText,
1575
- className: `${styles$6.calendarTopText} ${textAnchorClass}`
1694
+ className: styles$6.calendarTopText + " " + textAnchorClass
1576
1695
  }, value));
1577
1696
  };
1578
1697
 
1579
- const Calendar = _ref => {
1580
- let {
1581
- dateSetup,
1582
- locale,
1583
- viewMode,
1584
- rtl,
1585
- headerHeight,
1586
- columnWidth,
1587
- fontFamily,
1588
- fontSize,
1589
- projectCalendar,
1590
- weekendColor
1591
- } = _ref;
1592
-
1593
- const isDayOff = date => {
1698
+ var Calendar = function Calendar(_ref) {
1699
+ var dateSetup = _ref.dateSetup,
1700
+ locale = _ref.locale,
1701
+ viewMode = _ref.viewMode,
1702
+ rtl = _ref.rtl,
1703
+ headerHeight = _ref.headerHeight,
1704
+ columnWidth = _ref.columnWidth,
1705
+ fontFamily = _ref.fontFamily,
1706
+ fontSize = _ref.fontSize,
1707
+ projectCalendar = _ref.projectCalendar,
1708
+ weekendColor = _ref.weekendColor;
1709
+
1710
+ var isDayOff = function isDayOff(date) {
1594
1711
  if (projectCalendar) return isOffDay(date, projectCalendar);
1595
1712
  return false;
1596
1713
  };
1597
1714
 
1598
- const shortMonth = date => date.toLocaleString(locale, {
1599
- month: "short"
1600
- });
1715
+ var shortMonth = function shortMonth(date) {
1716
+ return date.toLocaleString(locale, {
1717
+ month: "short"
1718
+ });
1719
+ };
1601
1720
 
1602
- const getCalendarValuesForYear = () => {
1603
- const topValues = [];
1604
- const bottomValues = [];
1605
- const topDefaultHeight = headerHeight * 0.5;
1721
+ var getCalendarValuesForYear = function getCalendarValuesForYear() {
1722
+ var topValues = [];
1723
+ var bottomValues = [];
1724
+ var topDefaultHeight = headerHeight * 0.5;
1606
1725
 
1607
- for (let i = 0; i < dateSetup.dates.length; i++) {
1608
- const date = dateSetup.dates[i];
1609
- const bottomValue = date.getFullYear();
1726
+ for (var i = 0; i < dateSetup.dates.length; i++) {
1727
+ var date = dateSetup.dates[i];
1728
+ var bottomValue = date.getFullYear();
1610
1729
  bottomValues.push(React.createElement("text", {
1611
1730
  key: date.getFullYear(),
1612
1731
  y: headerHeight * 0.8,
@@ -1615,8 +1734,8 @@ const Calendar = _ref => {
1615
1734
  }, bottomValue));
1616
1735
 
1617
1736
  if (i === 0 || date.getFullYear() !== dateSetup.dates[i - 1].getFullYear()) {
1618
- const topValue = date.getFullYear().toString();
1619
- let xText;
1737
+ var topValue = date.getFullYear().toString();
1738
+ var xText = void 0;
1620
1739
 
1621
1740
  if (rtl) {
1622
1741
  xText = (6 + i + date.getFullYear() + 1) * columnWidth;
@@ -1639,35 +1758,37 @@ const Calendar = _ref => {
1639
1758
  return [topValues, bottomValues];
1640
1759
  };
1641
1760
 
1642
- const getCalendarValuesForQuarter = () => {
1643
- const topValues = [];
1644
- const bottomValues = [];
1645
- const offDayRects = [];
1646
- const quarterStart = (projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.quarter_start) ?? 0;
1647
- const rowH = headerHeight / 3;
1761
+ var getCalendarValuesForQuarter = function getCalendarValuesForQuarter() {
1762
+ var _projectCalendar$quar;
1648
1763
 
1649
- for (let i = 0; i < dateSetup.dates.length; i++) {
1650
- const date = dateSetup.dates[i];
1651
- const qNum = getQuarterNumber(date, quarterStart);
1764
+ var topValues = [];
1765
+ var bottomValues = [];
1766
+ var offDayRects = [];
1767
+ var quarterStart = (_projectCalendar$quar = projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.quarter_start) != null ? _projectCalendar$quar : 0;
1768
+ var rowH = headerHeight / 3;
1652
1769
 
1653
- for (let m = 0; m < 3; m++) {
1654
- const monthDate = addToDate(date, m, "month");
1770
+ for (var i = 0; i < dateSetup.dates.length; i++) {
1771
+ var date = dateSetup.dates[i];
1772
+ var qNum = getQuarterNumber(date, quarterStart);
1773
+
1774
+ for (var m = 0; m < 3; m++) {
1775
+ var monthDate = addToDate(date, m, "month");
1655
1776
  bottomValues.push(React.createElement("text", {
1656
- key: `qmonth-${i}-${m}`,
1777
+ key: "qmonth-" + i + "-" + m,
1657
1778
  y: headerHeight * 0.9,
1658
1779
  x: columnWidth * i + columnWidth * (m * 2 + 1) / 6,
1659
- className: `${styles$6.calendarTopText} ${styles$6.textAnchorMiddle}`
1780
+ className: styles$6.calendarTopText + " " + styles$6.textAnchorMiddle
1660
1781
  }, shortMonth(monthDate)));
1661
1782
  }
1662
1783
 
1663
1784
  bottomValues.push(React.createElement("text", {
1664
- key: `qlabel-${i}`,
1785
+ key: "qlabel-" + i,
1665
1786
  y: rowH * 1.6,
1666
1787
  x: columnWidth * i + columnWidth * 0.5,
1667
- className: `${styles$6.calendarTopText} ${styles$6.textAnchorMiddle}`
1668
- }, `Qtr ${qNum}`));
1788
+ className: styles$6.calendarTopText + " " + styles$6.textAnchorMiddle
1789
+ }, "Qtr " + qNum));
1669
1790
  bottomValues.push(React.createElement("line", {
1670
- key: `qsep-${i}`,
1791
+ key: "qsep-" + i,
1671
1792
  x1: columnWidth * i,
1672
1793
  y1: rowH,
1673
1794
  x2: columnWidth * i,
@@ -1695,14 +1816,14 @@ const Calendar = _ref => {
1695
1816
  }
1696
1817
 
1697
1818
  if (i === 0 || date.getFullYear() !== dateSetup.dates[i - 1].getFullYear()) {
1698
- const topValue = date.getFullYear().toString();
1699
- let span = 0;
1819
+ var topValue = date.getFullYear().toString();
1820
+ var span = 0;
1700
1821
 
1701
- for (let j = i; j < dateSetup.dates.length && dateSetup.dates[j].getFullYear() === date.getFullYear(); j++) {
1822
+ for (var j = i; j < dateSetup.dates.length && dateSetup.dates[j].getFullYear() === date.getFullYear(); j++) {
1702
1823
  span++;
1703
1824
  }
1704
1825
 
1705
- const xText = columnWidth * i + columnWidth * span / 2;
1826
+ var xText = columnWidth * i + columnWidth * span / 2;
1706
1827
  topValues.push(React.createElement(TopPartOfCalendar, {
1707
1828
  key: topValue + i,
1708
1829
  value: topValue,
@@ -1719,36 +1840,38 @@ const Calendar = _ref => {
1719
1840
  return [topValues, bottomValues, offDayRects];
1720
1841
  };
1721
1842
 
1722
- const getCalendarValuesForMonth = () => {
1723
- const topValues = [];
1724
- const bottomValues = [];
1725
- const offDayRects = [];
1726
- const topDefaultHeight = headerHeight * 0.5;
1727
- const quarterStart = (projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.quarter_start) ?? 0;
1843
+ var getCalendarValuesForMonth = function getCalendarValuesForMonth() {
1844
+ var _projectCalendar$quar2;
1845
+
1846
+ var topValues = [];
1847
+ var bottomValues = [];
1848
+ var offDayRects = [];
1849
+ var topDefaultHeight = headerHeight * 0.5;
1850
+ var quarterStart = (_projectCalendar$quar2 = projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.quarter_start) != null ? _projectCalendar$quar2 : 0;
1728
1851
 
1729
- for (let i = 0; i < dateSetup.dates.length; i++) {
1730
- const date = dateSetup.dates[i];
1731
- const bottomValue = shortMonth(date);
1852
+ for (var i = 0; i < dateSetup.dates.length; i++) {
1853
+ var date = dateSetup.dates[i];
1854
+ var bottomValue = shortMonth(date);
1732
1855
  bottomValues.push(React.createElement("text", {
1733
1856
  key: bottomValue + date.getFullYear() + i,
1734
1857
  y: headerHeight * 0.8,
1735
1858
  x: columnWidth * i + columnWidth * 0.5,
1736
- className: `${styles$6.calendarTopText} ${styles$6.textAnchorMiddle}`
1859
+ className: styles$6.calendarTopText + " " + styles$6.textAnchorMiddle
1737
1860
  }, bottomValue));
1738
- const qNum = getQuarterNumber(date, quarterStart);
1739
- const prevDate = i > 0 ? dateSetup.dates[i - 1] : null;
1740
- const prevQNum = prevDate ? getQuarterNumber(prevDate, quarterStart) : -1;
1741
- const isNewQuarter = i === 0 || qNum !== prevQNum || date.getFullYear() !== (prevDate ? prevDate.getFullYear() : -1);
1861
+ var qNum = getQuarterNumber(date, quarterStart);
1862
+ var prevDate = i > 0 ? dateSetup.dates[i - 1] : null;
1863
+ var prevQNum = prevDate ? getQuarterNumber(prevDate, quarterStart) : -1;
1864
+ var isNewQuarter = i === 0 || qNum !== prevQNum || date.getFullYear() !== (prevDate ? prevDate.getFullYear() : -1);
1742
1865
 
1743
1866
  if (isNewQuarter) {
1744
- const topValue = `Qtr ${qNum}, ${date.getFullYear()}`;
1745
- let span = 0;
1867
+ var topValue = "Qtr " + qNum + ", " + date.getFullYear();
1868
+ var span = 0;
1746
1869
 
1747
- for (let j = i; j < dateSetup.dates.length && getQuarterNumber(dateSetup.dates[j], quarterStart) === qNum && dateSetup.dates[j].getFullYear() === date.getFullYear(); j++) {
1870
+ for (var j = i; j < dateSetup.dates.length && getQuarterNumber(dateSetup.dates[j], quarterStart) === qNum && dateSetup.dates[j].getFullYear() === date.getFullYear(); j++) {
1748
1871
  span++;
1749
1872
  }
1750
1873
 
1751
- const xText = rtl ? columnWidth * i + columnWidth * span * 0.5 + columnWidth : columnWidth * i + columnWidth * span / 2;
1874
+ var xText = rtl ? columnWidth * i + columnWidth * span * 0.5 + columnWidth : columnWidth * i + columnWidth * span / 2;
1752
1875
  topValues.push(React.createElement(TopPartOfCalendar, {
1753
1876
  key: topValue + i,
1754
1877
  value: topValue,
@@ -1762,7 +1885,7 @@ const Calendar = _ref => {
1762
1885
 
1763
1886
  if (i > 0) {
1764
1887
  bottomValues.push(React.createElement("line", {
1765
- key: `qbound-${i}`,
1888
+ key: "qbound-" + i,
1766
1889
  x1: columnWidth * i,
1767
1890
  y1: topDefaultHeight,
1768
1891
  x2: columnWidth * i,
@@ -1776,28 +1899,28 @@ const Calendar = _ref => {
1776
1899
  return [topValues, bottomValues, offDayRects];
1777
1900
  };
1778
1901
 
1779
- const getCalendarValuesForWeek = () => {
1780
- const topValues = [];
1781
- const bottomValues = [];
1782
- const offDayRects = [];
1783
- let weeksCount = 1;
1784
- const topDefaultHeight = headerHeight * 0.5;
1785
- const dates = dateSetup.dates;
1902
+ var getCalendarValuesForWeek = function getCalendarValuesForWeek() {
1903
+ var topValues = [];
1904
+ var bottomValues = [];
1905
+ var offDayRects = [];
1906
+ var weeksCount = 1;
1907
+ var topDefaultHeight = headerHeight * 0.5;
1908
+ var dates = dateSetup.dates;
1786
1909
 
1787
- for (let i = dates.length - 1; i >= 0; i--) {
1788
- const date = dates[i];
1789
- let topValue = "";
1910
+ for (var i = dates.length - 1; i >= 0; i--) {
1911
+ var date = dates[i];
1912
+ var topValue = "";
1790
1913
 
1791
1914
  if (i === 0 || date.getMonth() !== dates[i - 1].getMonth()) {
1792
- topValue = `${shortMonth(date)} ${date.getFullYear()}`;
1915
+ topValue = shortMonth(date) + " " + date.getFullYear();
1793
1916
  }
1794
1917
 
1795
- const bottomValue = date.getDate().toString();
1918
+ var bottomValue = date.getDate().toString();
1796
1919
  bottomValues.push(React.createElement("text", {
1797
1920
  key: date.getTime(),
1798
1921
  y: headerHeight * 0.8,
1799
1922
  x: columnWidth * (i + +rtl),
1800
- className: `${styles$6.calendarTopText} ${styles$6.textAnchorStart}`
1923
+ className: styles$6.calendarTopText + " " + styles$6.textAnchorStart
1801
1924
  }, bottomValue));
1802
1925
 
1803
1926
  if (topValue) {
@@ -1823,21 +1946,23 @@ const Calendar = _ref => {
1823
1946
  return [topValues, bottomValues, offDayRects];
1824
1947
  };
1825
1948
 
1826
- const getCalendarValuesForDay = () => {
1827
- const topValues = [];
1828
- const bottomValues = [];
1829
- const offDayRects = [];
1830
- const tickLines = [];
1831
- const topDefaultHeight = headerHeight * 0.5;
1832
- const dates = dateSetup.dates;
1833
- const weekStartDay = (projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.week_start) ?? 1;
1949
+ var getCalendarValuesForDay = function getCalendarValuesForDay() {
1950
+ var _projectCalendar$week;
1834
1951
 
1835
- for (let i = 0; i < dates.length; i++) {
1836
- const date = dates[i];
1952
+ var topValues = [];
1953
+ var bottomValues = [];
1954
+ var offDayRects = [];
1955
+ var tickLines = [];
1956
+ var topDefaultHeight = headerHeight * 0.5;
1957
+ var dates = dateSetup.dates;
1958
+ var weekStartDay = (_projectCalendar$week = projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.week_start) != null ? _projectCalendar$week : 1;
1959
+
1960
+ for (var i = 0; i < dates.length; i++) {
1961
+ var date = dates[i];
1837
1962
 
1838
1963
  if (isDayOff(date)) {
1839
1964
  offDayRects.push(React.createElement("rect", {
1840
- key: `offday-header-${i}`,
1965
+ key: "offday-header-" + i,
1841
1966
  x: columnWidth * i,
1842
1967
  y: topDefaultHeight,
1843
1968
  width: columnWidth,
@@ -1846,25 +1971,25 @@ const Calendar = _ref => {
1846
1971
  }));
1847
1972
  }
1848
1973
 
1849
- const isWeekStart = date.getDay() === weekStartDay;
1974
+ var isWeekStart = date.getDay() === weekStartDay;
1850
1975
  tickLines.push(React.createElement("line", {
1851
- key: `tick-day-${i}`,
1976
+ key: "tick-day-" + i,
1852
1977
  x1: columnWidth * i,
1853
1978
  y1: topDefaultHeight,
1854
1979
  x2: columnWidth * i,
1855
1980
  y2: headerHeight,
1856
1981
  className: isWeekStart ? styles$6.calendarTickSolid : styles$6.calendarTickDashed
1857
1982
  }));
1858
- const bottomValue = columnWidth > 55 ? `${getLocalDayOfWeek(date, locale, "short")}, ${date.getDate()}` : `${getLocalDayOfWeek(date, locale, "narrow")},${date.getDate()}`;
1983
+ var bottomValue = columnWidth > 55 ? getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate() : getLocalDayOfWeek(date, locale, "narrow") + "," + date.getDate();
1859
1984
  bottomValues.push(React.createElement("text", {
1860
1985
  key: date.getTime(),
1861
1986
  y: headerHeight * 0.8,
1862
1987
  x: columnWidth * i + columnWidth * 0.5,
1863
- className: `${styles$6.calendarTopText} ${styles$6.textAnchorMiddle}`
1988
+ className: styles$6.calendarTopText + " " + styles$6.textAnchorMiddle
1864
1989
  }, bottomValue));
1865
1990
 
1866
1991
  if (i + 1 !== dates.length && date.getMonth() !== dates[i + 1].getMonth()) {
1867
- const topValue = `${shortMonth(date)} ${date.getFullYear()}`;
1992
+ var topValue = shortMonth(date) + " " + date.getFullYear();
1868
1993
  topValues.push(React.createElement(TopPartOfCalendar, {
1869
1994
  key: topValue + i,
1870
1995
  value: topValue,
@@ -1877,10 +2002,11 @@ const Calendar = _ref => {
1877
2002
  }
1878
2003
 
1879
2004
  if (i + 1 === dates.length) {
1880
- const topValue = `${shortMonth(date)} ${date.getFullYear()}`;
2005
+ var _topValue = shortMonth(date) + " " + date.getFullYear();
2006
+
1881
2007
  topValues.push(React.createElement(TopPartOfCalendar, {
1882
- key: topValue + "last",
1883
- value: topValue,
2008
+ key: _topValue + "last",
2009
+ value: _topValue,
1884
2010
  x1Line: columnWidth * (i + 1),
1885
2011
  y1Line: 0,
1886
2012
  y2Line: topDefaultHeight,
@@ -1893,28 +2019,28 @@ const Calendar = _ref => {
1893
2019
  return [topValues, bottomValues, offDayRects, tickLines];
1894
2020
  };
1895
2021
 
1896
- const getCalendarValuesForPartOfDay = () => {
1897
- const topValues = [];
1898
- const bottomValues = [];
1899
- const ticks = viewMode === ViewMode.HalfDay ? 2 : 4;
1900
- const topDefaultHeight = headerHeight * 0.5;
1901
- const dates = dateSetup.dates;
2022
+ var getCalendarValuesForPartOfDay = function getCalendarValuesForPartOfDay() {
2023
+ var topValues = [];
2024
+ var bottomValues = [];
2025
+ var ticks = viewMode === ViewMode.HalfDay ? 2 : 4;
2026
+ var topDefaultHeight = headerHeight * 0.5;
2027
+ var dates = dateSetup.dates;
1902
2028
 
1903
- for (let i = 0; i < dates.length; i++) {
1904
- const date = dates[i];
1905
- const bottomValue = getCachedDateTimeFormat(locale, {
2029
+ for (var i = 0; i < dates.length; i++) {
2030
+ var date = dates[i];
2031
+ var bottomValue = getCachedDateTimeFormat(locale, {
1906
2032
  hour: "numeric"
1907
2033
  }).format(date);
1908
2034
  bottomValues.push(React.createElement("text", {
1909
2035
  key: date.getTime(),
1910
2036
  y: headerHeight * 0.8,
1911
2037
  x: columnWidth * (i + +rtl),
1912
- className: `${styles$6.calendarTopText} ${styles$6.textAnchorMiddle}`,
2038
+ className: styles$6.calendarTopText + " " + styles$6.textAnchorMiddle,
1913
2039
  fontFamily: fontFamily
1914
2040
  }, bottomValue));
1915
2041
 
1916
2042
  if (i === 0 || date.getDate() !== dates[i - 1].getDate()) {
1917
- const topValue = `${getLocalDayOfWeek(date, locale, "short")}, ${date.getDate()} ${shortMonth(date)}`;
2043
+ var topValue = getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate() + " " + shortMonth(date);
1918
2044
  topValues.push(React.createElement(TopPartOfCalendar, {
1919
2045
  key: topValue + date.getFullYear(),
1920
2046
  value: topValue,
@@ -1930,15 +2056,15 @@ const Calendar = _ref => {
1930
2056
  return [topValues, bottomValues];
1931
2057
  };
1932
2058
 
1933
- const getCalendarValuesForHour = () => {
1934
- const topValues = [];
1935
- const bottomValues = [];
1936
- const topDefaultHeight = headerHeight * 0.5;
1937
- const dates = dateSetup.dates;
2059
+ var getCalendarValuesForHour = function getCalendarValuesForHour() {
2060
+ var topValues = [];
2061
+ var bottomValues = [];
2062
+ var topDefaultHeight = headerHeight * 0.5;
2063
+ var dates = dateSetup.dates;
1938
2064
 
1939
- for (let i = 0; i < dates.length; i++) {
1940
- const date = dates[i];
1941
- const bottomValue = getCachedDateTimeFormat(locale, {
2065
+ for (var i = 0; i < dates.length; i++) {
2066
+ var date = dates[i];
2067
+ var bottomValue = getCachedDateTimeFormat(locale, {
1942
2068
  hour: "numeric"
1943
2069
  }).format(date);
1944
2070
  bottomValues.push(React.createElement("text", {
@@ -1950,9 +2076,9 @@ const Calendar = _ref => {
1950
2076
  }, bottomValue));
1951
2077
 
1952
2078
  if (i !== 0 && date.getDate() !== dates[i - 1].getDate()) {
1953
- const displayDate = dates[i - 1];
1954
- const topValue = `${getLocalDayOfWeek(displayDate, locale, "long")}, ${displayDate.getDate()} ${shortMonth(displayDate)}`;
1955
- const topPosition = (date.getHours() - 24) / 2;
2079
+ var displayDate = dates[i - 1];
2080
+ var topValue = getLocalDayOfWeek(displayDate, locale, "long") + ", " + displayDate.getDate() + " " + shortMonth(displayDate);
2081
+ var topPosition = (date.getHours() - 24) / 2;
1956
2082
  topValues.push(React.createElement(TopPartOfCalendar, {
1957
2083
  key: topValue + displayDate.getFullYear(),
1958
2084
  value: topValue,
@@ -1968,19 +2094,22 @@ const Calendar = _ref => {
1968
2094
  return [topValues, bottomValues];
1969
2095
  };
1970
2096
 
1971
- let topValues = [];
1972
- let bottomValues = [];
1973
- let extraValues = [];
1974
- let tickLines = [];
2097
+ var topValues = [];
2098
+ var bottomValues = [];
2099
+ var extraValues = [];
2100
+ var tickLines = [];
1975
2101
 
1976
2102
  switch (dateSetup.viewMode) {
1977
2103
  case ViewMode.Year:
1978
- [topValues, bottomValues] = getCalendarValuesForYear();
2104
+ var _getCalendarValuesFor = getCalendarValuesForYear();
2105
+
2106
+ topValues = _getCalendarValuesFor[0];
2107
+ bottomValues = _getCalendarValuesFor[1];
1979
2108
  break;
1980
2109
 
1981
2110
  case ViewMode.Quarter:
1982
2111
  {
1983
- const r = getCalendarValuesForQuarter();
2112
+ var r = getCalendarValuesForQuarter();
1984
2113
  topValues = r[0];
1985
2114
  bottomValues = r[1];
1986
2115
  extraValues = r[2] || [];
@@ -1989,25 +2118,27 @@ const Calendar = _ref => {
1989
2118
 
1990
2119
  case ViewMode.Month:
1991
2120
  {
1992
- const r = getCalendarValuesForMonth();
1993
- topValues = r[0];
1994
- bottomValues = r[1];
1995
- extraValues = r[2] || [];
2121
+ var _r = getCalendarValuesForMonth();
2122
+
2123
+ topValues = _r[0];
2124
+ bottomValues = _r[1];
2125
+ extraValues = _r[2] || [];
1996
2126
  break;
1997
2127
  }
1998
2128
 
1999
2129
  case ViewMode.Week:
2000
2130
  {
2001
- const r = getCalendarValuesForWeek();
2002
- topValues = r[0];
2003
- bottomValues = r[1];
2004
- extraValues = r[2] || [];
2131
+ var _r2 = getCalendarValuesForWeek();
2132
+
2133
+ topValues = _r2[0];
2134
+ bottomValues = _r2[1];
2135
+ extraValues = _r2[2] || [];
2005
2136
  break;
2006
2137
  }
2007
2138
 
2008
2139
  case ViewMode.Day:
2009
2140
  {
2010
- const result = getCalendarValuesForDay();
2141
+ var result = getCalendarValuesForDay();
2011
2142
  topValues = result[0];
2012
2143
  bottomValues = result[1];
2013
2144
  extraValues = result[2];
@@ -2017,11 +2148,17 @@ const Calendar = _ref => {
2017
2148
 
2018
2149
  case ViewMode.QuarterDay:
2019
2150
  case ViewMode.HalfDay:
2020
- [topValues, bottomValues] = getCalendarValuesForPartOfDay();
2151
+ var _getCalendarValuesFor2 = getCalendarValuesForPartOfDay();
2152
+
2153
+ topValues = _getCalendarValuesFor2[0];
2154
+ bottomValues = _getCalendarValuesFor2[1];
2021
2155
  break;
2022
2156
 
2023
2157
  case ViewMode.Hour:
2024
- [topValues, bottomValues] = getCalendarValuesForHour();
2158
+ var _getCalendarValuesFor3 = getCalendarValuesForHour();
2159
+
2160
+ topValues = _getCalendarValuesFor3[0];
2161
+ bottomValues = _getCalendarValuesFor3[1];
2025
2162
  }
2026
2163
 
2027
2164
  return React.createElement("g", {
@@ -2057,17 +2194,19 @@ function _catch(body, recover) {
2057
2194
  return result;
2058
2195
  }
2059
2196
 
2060
- const Arrow = _ref => {
2061
- let {
2062
- taskFrom,
2063
- taskTo,
2064
- rowHeight,
2065
- taskHeight,
2066
- arrowIndent,
2067
- arrowColor,
2068
- dependencyType
2069
- } = _ref;
2070
- let [path, trianglePoints] = drawPathAndTriangle(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent, dependencyType);
2197
+ var Arrow = function Arrow(_ref) {
2198
+ var taskFrom = _ref.taskFrom,
2199
+ taskTo = _ref.taskTo,
2200
+ rowHeight = _ref.rowHeight,
2201
+ taskHeight = _ref.taskHeight,
2202
+ arrowIndent = _ref.arrowIndent,
2203
+ arrowColor = _ref.arrowColor,
2204
+ dependencyType = _ref.dependencyType;
2205
+
2206
+ var _drawPathAndTriangle = drawPathAndTriangle(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent, dependencyType),
2207
+ path = _drawPathAndTriangle[0],
2208
+ trianglePoints = _drawPathAndTriangle[1];
2209
+
2071
2210
  return React.createElement("g", {
2072
2211
  className: "arrow"
2073
2212
  }, React.createElement("path", {
@@ -2081,40 +2220,40 @@ const Arrow = _ref => {
2081
2220
  }));
2082
2221
  };
2083
2222
 
2084
- const drawPathAndTriangle = (taskFrom, taskTo, rowHeight, taskHeight, arrowIndent, dependencyType) => {
2085
- const indexCompare = taskFrom.index > taskTo.index ? -1 : 1;
2086
- const taskToEndY = taskTo.y + taskHeight / 2;
2087
- const verticalOffset = indexCompare * (rowHeight / 2);
2223
+ var drawPathAndTriangle = function drawPathAndTriangle(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent, dependencyType) {
2224
+ var indexCompare = taskFrom.index > taskTo.index ? -1 : 1;
2225
+ var taskToEndY = taskTo.y + taskHeight / 2;
2226
+ var verticalOffset = indexCompare * (rowHeight / 2);
2088
2227
 
2089
- const minX = t => {
2228
+ var minX = function minX(t) {
2090
2229
  if (t.plannedSegments && t.plannedSegments.length > 0) {
2091
- const p = t.plannedSegments[0].x1;
2230
+ var p = t.plannedSegments[0].x1;
2092
2231
  if (t.actualSegments && t.actualSegments.length > 0) return Math.min(p, t.actualSegments[0].x1);
2093
2232
  return p;
2094
2233
  }
2095
2234
 
2096
2235
  if (t.actualSegments && t.actualSegments.length > 0) return t.actualSegments[0].x1;
2097
- const candidates = [];
2236
+ var candidates = [];
2098
2237
  if (t.x2 > t.x1) candidates.push(t.x1);
2099
2238
  if (t.actualx2 > t.actualx1) candidates.push(t.actualx1);
2100
- return candidates.length > 0 ? Math.min(...candidates) : 0;
2239
+ return candidates.length > 0 ? Math.min.apply(Math, candidates) : 0;
2101
2240
  };
2102
2241
 
2103
- const maxX = t => {
2242
+ var maxX = function maxX(t) {
2104
2243
  if (t.plannedSegments && t.plannedSegments.length > 0) {
2105
- const p = t.plannedSegments[t.plannedSegments.length - 1].x2;
2244
+ var p = t.plannedSegments[t.plannedSegments.length - 1].x2;
2106
2245
  if (t.actualSegments && t.actualSegments.length > 0) return Math.max(p, t.actualSegments[t.actualSegments.length - 1].x2);
2107
2246
  return p;
2108
2247
  }
2109
2248
 
2110
2249
  if (t.actualSegments && t.actualSegments.length > 0) return t.actualSegments[t.actualSegments.length - 1].x2;
2111
- const candidates = [];
2250
+ var candidates = [];
2112
2251
  if (t.x2 > t.x1) candidates.push(t.x2);
2113
2252
  if (t.actualx2 > t.actualx1) candidates.push(t.actualx2);
2114
- return candidates.length > 0 ? Math.max(...candidates) : 0;
2253
+ return candidates.length > 0 ? Math.max.apply(Math, candidates) : 0;
2115
2254
  };
2116
2255
 
2117
- let fromPoint, toPoint;
2256
+ var fromPoint, toPoint;
2118
2257
 
2119
2258
  switch (dependencyType) {
2120
2259
  case "SS":
@@ -2138,51 +2277,35 @@ const drawPathAndTriangle = (taskFrom, taskTo, rowHeight, taskHeight, arrowInden
2138
2277
  break;
2139
2278
  }
2140
2279
 
2141
- const arrowPoints = function (x, y, right) {
2280
+ var arrowPoints = function arrowPoints(x, y, right) {
2142
2281
  if (right === void 0) {
2143
2282
  right = true;
2144
2283
  }
2145
2284
 
2146
- return right ? `${x},${y} ${x - 5},${y - 5} ${x - 5},${y + 5}` : `${x},${y} ${x + 5},${y - 5} ${x + 5},${y + 5}`;
2285
+ return right ? x + "," + y + " " + (x - 5) + "," + (y - 5) + " " + (x - 5) + "," + (y + 5) : x + "," + y + " " + (x + 5) + "," + (y - 5) + " " + (x + 5) + "," + (y + 5);
2147
2286
  };
2148
2287
 
2149
- let path;
2150
- let trianglePoints;
2288
+ var path;
2289
+ var trianglePoints;
2151
2290
 
2152
2291
  switch (dependencyType) {
2153
2292
  case "SS":
2154
- path = `M ${fromPoint} ${taskFrom.y + taskHeight / 2}
2155
- H ${fromPoint + Math.min(toPoint - fromPoint, 0) - 2 * arrowIndent}
2156
- V ${taskToEndY}
2157
- H ${toPoint - 5}`;
2293
+ path = "M " + fromPoint + " " + (taskFrom.y + taskHeight / 2) + "\n H " + (fromPoint + Math.min(toPoint - fromPoint, 0) - 2 * arrowIndent) + "\n V " + taskToEndY + "\n H " + (toPoint - 5);
2158
2294
  trianglePoints = arrowPoints(toPoint, taskToEndY, true);
2159
2295
  break;
2160
2296
 
2161
2297
  case "SF":
2162
- path = `M ${fromPoint} ${taskFrom.y + taskHeight / 2}
2163
- H ${fromPoint - 2 * arrowIndent}
2164
- V ${taskFrom.y + taskHeight / 2 + verticalOffset}
2165
- ${fromPoint - toPoint > 4 * arrowIndent ? "" : `H ${toPoint + 2 * arrowIndent}`}
2166
- V ${taskToEndY}
2167
- H ${toPoint + 5}`;
2298
+ 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);
2168
2299
  trianglePoints = arrowPoints(toPoint, taskToEndY, false);
2169
2300
  break;
2170
2301
 
2171
2302
  case "FS":
2172
- path = `M ${fromPoint} ${taskFrom.y + taskHeight / 2}
2173
- H ${fromPoint + 2 * arrowIndent}
2174
- V ${taskFrom.y + taskHeight / 2 + verticalOffset}
2175
- ${toPoint - fromPoint > 4 * arrowIndent ? "" : `H ${toPoint - 2 * arrowIndent}`}
2176
- V ${taskToEndY}
2177
- H ${toPoint - 5}`;
2303
+ 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);
2178
2304
  trianglePoints = arrowPoints(toPoint, taskToEndY, true);
2179
2305
  break;
2180
2306
 
2181
2307
  case "FF":
2182
- path = `M ${fromPoint} ${taskFrom.y + taskHeight / 2}
2183
- H ${fromPoint + Math.max(toPoint - fromPoint, 0) + 2 * arrowIndent}
2184
- V ${taskToEndY}
2185
- H ${toPoint + 5}`;
2308
+ path = "M " + fromPoint + " " + (taskFrom.y + taskHeight / 2) + "\n H " + (fromPoint + Math.max(toPoint - fromPoint, 0) + 2 * arrowIndent) + "\n V " + taskToEndY + "\n H " + (toPoint + 5);
2186
2309
  trianglePoints = arrowPoints(toPoint, taskToEndY, false);
2187
2310
  break;
2188
2311
  }
@@ -2194,25 +2317,25 @@ var convertToBarTasks = function convertToBarTasks(tasks, dates, columnWidth, ro
2194
2317
  var barTasks = tasks.map(function (t, i) {
2195
2318
  return convertToBarTask(t, i, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor);
2196
2319
  });
2320
+ var indexById = new Map();
2321
+
2322
+ for (var i = 0; i < barTasks.length; i++) {
2323
+ indexById.set(barTasks[i].id, i);
2324
+ }
2325
+
2197
2326
  barTasks = barTasks.map(function (task) {
2198
2327
  var dependencies = task.dependencies || [];
2199
2328
 
2200
- var _loop = function _loop(j) {
2201
- var dependence = barTasks.findIndex(function (value) {
2202
- return value.id === dependencies[j].id;
2203
- });
2329
+ for (var j = 0; j < dependencies.length; j++) {
2330
+ var dependence = indexById.get(dependencies[j].id);
2204
2331
 
2205
- if (dependence !== -1 && task.start.getTime() > 0 && task.end.getTime() > 0) {
2332
+ if (dependence !== undefined && task.start.getTime() > 0 && task.end.getTime() > 0) {
2206
2333
  var barchild = _extends({}, task, {
2207
2334
  dependencyType: dependencies[j].type
2208
2335
  });
2209
2336
 
2210
2337
  barTasks[dependence].barChildren.push(barchild);
2211
2338
  }
2212
- };
2213
-
2214
- for (var j = 0; j < dependencies.length; j++) {
2215
- _loop(j);
2216
2339
  }
2217
2340
 
2218
2341
  return task;
@@ -2370,10 +2493,33 @@ var convertToMilestone = function convertToMilestone(task, index, dates, columnW
2370
2493
  });
2371
2494
  };
2372
2495
 
2496
+ var dateTimesCache = new WeakMap();
2497
+
2498
+ var getDateTimes = function getDateTimes(dates) {
2499
+ var times = dateTimesCache.get(dates);
2500
+
2501
+ if (!times) {
2502
+ times = dates.map(function (d) {
2503
+ return d.getTime();
2504
+ });
2505
+ dateTimesCache.set(dates, times);
2506
+ }
2507
+
2508
+ return times;
2509
+ };
2510
+
2373
2511
  var taskXCoordinate = function taskXCoordinate(xDate, dates, columnWidth) {
2374
- var index = dates.findIndex(function (d) {
2375
- return d.getTime() >= xDate.getTime();
2376
- }) - 1;
2512
+ var times = getDateTimes(dates);
2513
+ var target = xDate.getTime();
2514
+ var lo = 0;
2515
+ var hi = times.length - 1;
2516
+
2517
+ while (lo <= hi) {
2518
+ var mid = lo + hi >> 1;
2519
+ if (times[mid] >= target) hi = mid - 1;else lo = mid + 1;
2520
+ }
2521
+
2522
+ var index = (lo === times.length ? -1 : lo) - 1;
2377
2523
 
2378
2524
  if (index < 0) {
2379
2525
  if (dates[dates.length - 1].getTime() <= xDate.getTime()) {
@@ -2685,59 +2831,60 @@ var sortTasks = function sortTasks(taskA, taskB) {
2685
2831
  }
2686
2832
  };
2687
2833
 
2688
- const BarDisplay = _ref => {
2689
- let {
2690
- x,
2691
- y,
2692
- type,
2693
- width,
2694
- height,
2695
- isSelected,
2696
- progressX,
2697
- progressWidth,
2698
- barCornerRadius,
2699
- styles,
2700
- segments,
2701
- onMouseDown
2702
- } = _ref;
2703
-
2704
- const getProcessColor = () => {
2834
+ var BarDisplay = function BarDisplay(_ref) {
2835
+ var x = _ref.x,
2836
+ y = _ref.y,
2837
+ type = _ref.type,
2838
+ width = _ref.width,
2839
+ height = _ref.height,
2840
+ isSelected = _ref.isSelected,
2841
+ progressX = _ref.progressX,
2842
+ progressWidth = _ref.progressWidth,
2843
+ barCornerRadius = _ref.barCornerRadius,
2844
+ styles = _ref.styles,
2845
+ segments = _ref.segments,
2846
+ onMouseDown = _ref.onMouseDown;
2847
+
2848
+ var getProcessColor = function getProcessColor() {
2705
2849
  return isSelected ? styles.progressSelectedColor : styles.progressColor;
2706
2850
  };
2707
2851
 
2708
- const getBarColor = () => {
2852
+ var getBarColor = function getBarColor() {
2709
2853
  return isSelected ? styles.backgroundSelectedColor : styles.backgroundColor;
2710
2854
  };
2711
2855
 
2712
2856
  if (type === "planned") {
2713
2857
  if (segments && segments.length > 0) {
2714
- const totalWidth = width;
2858
+ var totalWidth = width;
2715
2859
  return React.createElement("g", {
2716
2860
  onMouseDown: onMouseDown
2717
- }, segments.map((seg, idx) => React.createElement("rect", {
2718
- key: `seg-${idx}`,
2719
- x: seg.x1,
2720
- width: seg.x2 - seg.x1,
2721
- y: y,
2722
- height: height,
2723
- ry: barCornerRadius,
2724
- rx: barCornerRadius,
2725
- fill: getBarColor(),
2726
- strokeWidth: 2,
2727
- stroke: styles.criticalPathColor
2728
- })), progressWidth > 0 && (() => {
2729
- const rects = [];
2730
- let remaining = progressWidth;
2731
-
2732
- for (const seg of segments) {
2861
+ }, segments.map(function (seg, idx) {
2862
+ return React.createElement("rect", {
2863
+ key: "seg-" + idx,
2864
+ x: seg.x1,
2865
+ width: seg.x2 - seg.x1,
2866
+ y: y,
2867
+ height: height,
2868
+ ry: barCornerRadius,
2869
+ rx: barCornerRadius,
2870
+ fill: getBarColor(),
2871
+ strokeWidth: 2,
2872
+ stroke: styles.criticalPathColor
2873
+ });
2874
+ }), progressWidth > 0 && function () {
2875
+ var rects = [];
2876
+ var remaining = progressWidth;
2877
+
2878
+ for (var _iterator = _createForOfIteratorHelperLoose(segments), _step; !(_step = _iterator()).done;) {
2879
+ var seg = _step.value;
2733
2880
  if (remaining <= 0) break;
2734
- const segW = seg.x2 - seg.x1;
2735
- const ratio = totalWidth > 0 ? segW / totalWidth : 0;
2736
- const pw = Math.min(remaining, progressWidth * ratio);
2881
+ var segW = seg.x2 - seg.x1;
2882
+ var ratio = totalWidth > 0 ? segW / totalWidth : 0;
2883
+ var pw = Math.min(remaining, progressWidth * ratio);
2737
2884
 
2738
2885
  if (pw > 0) {
2739
2886
  rects.push(React.createElement("rect", {
2740
- key: `prog-${seg.x1}`,
2887
+ key: "prog-" + seg.x1,
2741
2888
  x: seg.x1,
2742
2889
  width: pw,
2743
2890
  y: y,
@@ -2751,7 +2898,7 @@ const BarDisplay = _ref => {
2751
2898
  }
2752
2899
 
2753
2900
  return rects;
2754
- })());
2901
+ }());
2755
2902
  }
2756
2903
 
2757
2904
  return React.createElement("g", {
@@ -2779,16 +2926,18 @@ const BarDisplay = _ref => {
2779
2926
  if (segments && segments.length > 0) {
2780
2927
  return React.createElement("g", {
2781
2928
  onMouseDown: onMouseDown
2782
- }, segments.map((seg, idx) => React.createElement("rect", {
2783
- key: `aseg-${idx}`,
2784
- x: seg.x1,
2785
- width: seg.x2 - seg.x1,
2786
- y: y,
2787
- height: height,
2788
- ry: barCornerRadius,
2789
- rx: barCornerRadius,
2790
- fill: styles.taskProgressColor
2791
- })), React.createElement("rect", {
2929
+ }, segments.map(function (seg, idx) {
2930
+ return React.createElement("rect", {
2931
+ key: "aseg-" + idx,
2932
+ x: seg.x1,
2933
+ width: seg.x2 - seg.x1,
2934
+ y: y,
2935
+ height: height,
2936
+ ry: barCornerRadius,
2937
+ rx: barCornerRadius,
2938
+ fill: styles.taskProgressColor
2939
+ });
2940
+ }), React.createElement("rect", {
2792
2941
  x: progressX,
2793
2942
  width: progressWidth,
2794
2943
  y: y,
@@ -2823,15 +2972,13 @@ const BarDisplay = _ref => {
2823
2972
 
2824
2973
  var styles$7 = {"barWrapper":"_KxSXS","barHandle":"_3w_5u","barBackground":"_31ERP"};
2825
2974
 
2826
- const BarDateHandle = _ref => {
2827
- let {
2828
- x,
2829
- y,
2830
- width,
2831
- height,
2832
- barCornerRadius,
2833
- onMouseDown
2834
- } = _ref;
2975
+ var BarDateHandle = function BarDateHandle(_ref) {
2976
+ var x = _ref.x,
2977
+ y = _ref.y,
2978
+ width = _ref.width,
2979
+ height = _ref.height,
2980
+ barCornerRadius = _ref.barCornerRadius,
2981
+ onMouseDown = _ref.onMouseDown;
2835
2982
  return React.createElement("rect", {
2836
2983
  x: x,
2837
2984
  y: y,
@@ -2844,28 +2991,28 @@ const BarDateHandle = _ref => {
2844
2991
  });
2845
2992
  };
2846
2993
 
2847
- const BarProgressHandle = _ref => {
2994
+ var BarProgressHandle = function BarProgressHandle(_ref) {
2995
+ _objectDestructuringEmpty(_ref);
2996
+
2848
2997
  return React.createElement("div", null);
2849
2998
  };
2850
2999
 
2851
- const Bar = _ref => {
2852
- let {
2853
- task,
2854
- isProgressChangeable,
2855
- isDateChangeable,
2856
- rtl,
2857
- type,
2858
- onEventStart,
2859
- isSelected
2860
- } = _ref;
2861
- const progressPoint = getProgressPoint(+!rtl * task.progressWidth + task.progressX, task.y, task.height);
2862
- const handleHeight = task.height / 2 - 1;
2863
- const plannedSegs = task.plannedSegments;
2864
- const plannedLeftHandleX = plannedSegs !== null && plannedSegs !== void 0 && plannedSegs.length ? plannedSegs[0].x1 : task.x1;
2865
- const plannedRightHandleX = plannedSegs !== null && plannedSegs !== void 0 && plannedSegs.length ? plannedSegs[plannedSegs.length - 1].x2 : task.x2;
2866
- const actualSegs = task.actualSegments;
2867
- const actualLeftHandleX = actualSegs !== null && actualSegs !== void 0 && actualSegs.length ? actualSegs[0].x1 : task.actualx1;
2868
- const actualRightHandleX = actualSegs !== null && actualSegs !== void 0 && actualSegs.length ? actualSegs[actualSegs.length - 1].x2 : task.actualx2;
3000
+ var Bar = function Bar(_ref) {
3001
+ var task = _ref.task,
3002
+ isProgressChangeable = _ref.isProgressChangeable,
3003
+ isDateChangeable = _ref.isDateChangeable,
3004
+ rtl = _ref.rtl,
3005
+ type = _ref.type,
3006
+ onEventStart = _ref.onEventStart,
3007
+ isSelected = _ref.isSelected;
3008
+ var progressPoint = getProgressPoint(+!rtl * task.progressWidth + task.progressX, task.y, task.height);
3009
+ var handleHeight = task.height / 2 - 1;
3010
+ var plannedSegs = task.plannedSegments;
3011
+ var plannedLeftHandleX = plannedSegs !== null && plannedSegs !== void 0 && plannedSegs.length ? plannedSegs[0].x1 : task.x1;
3012
+ var plannedRightHandleX = plannedSegs !== null && plannedSegs !== void 0 && plannedSegs.length ? plannedSegs[plannedSegs.length - 1].x2 : task.x2;
3013
+ var actualSegs = task.actualSegments;
3014
+ var actualLeftHandleX = actualSegs !== null && actualSegs !== void 0 && actualSegs.length ? actualSegs[0].x1 : task.actualx1;
3015
+ var actualRightHandleX = actualSegs !== null && actualSegs !== void 0 && actualSegs.length ? actualSegs[actualSegs.length - 1].x2 : task.actualx2;
2869
3016
 
2870
3017
  if (type == "planned") {
2871
3018
  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.createElement("g", {
@@ -2891,7 +3038,7 @@ const Bar = _ref => {
2891
3038
  styles: task.styles,
2892
3039
  isSelected: isSelected,
2893
3040
  segments: task.plannedSegments,
2894
- onMouseDown: e => {
3041
+ onMouseDown: function onMouseDown(e) {
2895
3042
  isDateChangeable && onEventStart("move", task, e, "planned");
2896
3043
  }
2897
3044
  }), React.createElement("g", {
@@ -2902,7 +3049,7 @@ const Bar = _ref => {
2902
3049
  width: task.handleWidth,
2903
3050
  height: handleHeight,
2904
3051
  barCornerRadius: task.barCornerRadius,
2905
- onMouseDown: e => {
3052
+ onMouseDown: function onMouseDown(e) {
2906
3053
  onEventStart("start", task, e, "planned");
2907
3054
  }
2908
3055
  }), React.createElement(BarDateHandle, {
@@ -2911,12 +3058,12 @@ const Bar = _ref => {
2911
3058
  width: task.handleWidth,
2912
3059
  height: handleHeight,
2913
3060
  barCornerRadius: task.barCornerRadius,
2914
- onMouseDown: e => {
3061
+ onMouseDown: function onMouseDown(e) {
2915
3062
  onEventStart("end", task, e, "planned");
2916
3063
  }
2917
3064
  })), isProgressChangeable && React.createElement(BarProgressHandle, {
2918
3065
  progressPoint: progressPoint,
2919
- onMouseDown: e => {
3066
+ onMouseDown: function onMouseDown(e) {
2920
3067
  onEventStart("progress", task, e, "planned");
2921
3068
  }
2922
3069
  })));else return React.createElement("g", {
@@ -2947,7 +3094,7 @@ const Bar = _ref => {
2947
3094
  styles: task.styles,
2948
3095
  isSelected: isSelected,
2949
3096
  segments: task.actualSegments,
2950
- onMouseDown: e => {
3097
+ onMouseDown: function onMouseDown(e) {
2951
3098
  isDateChangeable && onEventStart("move", task, e, "actual");
2952
3099
  }
2953
3100
  }), React.createElement("g", {
@@ -2958,7 +3105,7 @@ const Bar = _ref => {
2958
3105
  width: task.handleWidth,
2959
3106
  height: handleHeight,
2960
3107
  barCornerRadius: task.barCornerRadius,
2961
- onMouseDown: e => {
3108
+ onMouseDown: function onMouseDown(e) {
2962
3109
  onEventStart("start", task, e, "actual");
2963
3110
  }
2964
3111
  }), React.createElement(BarDateHandle, {
@@ -2967,12 +3114,12 @@ const Bar = _ref => {
2967
3114
  width: task.handleWidth,
2968
3115
  height: handleHeight,
2969
3116
  barCornerRadius: task.barCornerRadius,
2970
- onMouseDown: e => {
3117
+ onMouseDown: function onMouseDown(e) {
2971
3118
  onEventStart("end", task, e, "actual");
2972
3119
  }
2973
3120
  })), isProgressChangeable && React.createElement(BarProgressHandle, {
2974
3121
  progressPoint: progressPoint,
2975
- onMouseDown: e => {
3122
+ onMouseDown: function onMouseDown(e) {
2976
3123
  onEventStart("progress", task, e, "actual");
2977
3124
  }
2978
3125
  })));
@@ -2984,16 +3131,14 @@ const Bar = _ref => {
2984
3131
  }
2985
3132
  };
2986
3133
 
2987
- const BarSmall = _ref => {
2988
- let {
2989
- task,
2990
- type,
2991
- isProgressChangeable,
2992
- isDateChangeable,
2993
- onEventStart,
2994
- isSelected
2995
- } = _ref;
2996
- const progressPoint = getProgressPoint(task.progressWidth + task.x1, task.y, task.height);
3134
+ var BarSmall = function BarSmall(_ref) {
3135
+ var task = _ref.task,
3136
+ type = _ref.type,
3137
+ isProgressChangeable = _ref.isProgressChangeable,
3138
+ isDateChangeable = _ref.isDateChangeable,
3139
+ onEventStart = _ref.onEventStart,
3140
+ isSelected = _ref.isSelected;
3141
+ var progressPoint = getProgressPoint(task.progressWidth + task.x1, task.y, task.height);
2997
3142
  return React.createElement("g", {
2998
3143
  className: styles$7.barWrapper,
2999
3144
  tabIndex: 0
@@ -3010,14 +3155,14 @@ const BarSmall = _ref => {
3010
3155
  barCornerRadius: task.barCornerRadius,
3011
3156
  styles: task.styles,
3012
3157
  isSelected: isSelected,
3013
- onMouseDown: e => {
3158
+ onMouseDown: function onMouseDown(e) {
3014
3159
  isDateChangeable && onEventStart("move", task, e);
3015
3160
  }
3016
3161
  }), React.createElement("g", {
3017
3162
  className: "handleGroup"
3018
3163
  }, isProgressChangeable && React.createElement(BarProgressHandle, {
3019
3164
  progressPoint: progressPoint,
3020
- onMouseDown: e => {
3165
+ onMouseDown: function onMouseDown(e) {
3021
3166
  onEventStart("progress", task, e);
3022
3167
  }
3023
3168
  })));
@@ -3025,17 +3170,14 @@ const BarSmall = _ref => {
3025
3170
 
3026
3171
  var styles$8 = {"milestoneWrapper":"_RRr13","milestoneBackground":"_2P2B1"};
3027
3172
 
3028
- const Milestone = _ref => {
3029
- let {
3030
- task,
3031
- isDateChangeable,
3032
- onEventStart,
3033
- isSelected
3034
- } = _ref;
3035
- const transform = `rotate(45 ${task.x1 + task.height * 0.356}
3036
- ${task.y + task.height * 0.85})`;
3037
-
3038
- const getBarColor = () => {
3173
+ var Milestone = function Milestone(_ref) {
3174
+ var task = _ref.task,
3175
+ isDateChangeable = _ref.isDateChangeable,
3176
+ onEventStart = _ref.onEventStart,
3177
+ isSelected = _ref.isSelected;
3178
+ var transform = "rotate(45 " + (task.x1 + task.height * 0.356) + " \n " + (task.y + task.height * 0.85) + ")";
3179
+
3180
+ var getBarColor = function getBarColor() {
3039
3181
  return isSelected ? task.styles.backgroundSelectedColor : task.styles.backgroundColor;
3040
3182
  };
3041
3183
 
@@ -3052,10 +3194,10 @@ const Milestone = _ref => {
3052
3194
  ry: task.barCornerRadius,
3053
3195
  transform: transform,
3054
3196
  className: styles$8.milestoneBackground,
3055
- onMouseDown: e => {
3197
+ onMouseDown: function onMouseDown(e) {
3056
3198
  isDateChangeable && onEventStart("move", task, e, "planned");
3057
3199
  },
3058
- onDoubleClick: e => {
3200
+ onDoubleClick: function onDoubleClick(e) {
3059
3201
  onEventStart("dblclick", task, e);
3060
3202
  }
3061
3203
  }));
@@ -3063,16 +3205,14 @@ const Milestone = _ref => {
3063
3205
 
3064
3206
  var styles$9 = {"projectWrapper":"_1KJ6x","projectBackground":"_2RbVy","projectTop":"_2pZMF"};
3065
3207
 
3066
- const Project = _ref => {
3067
- let {
3068
- task,
3069
- isSelected
3070
- } = _ref;
3071
- const barColor = isSelected ? task.styles.backgroundSelectedColor : task.styles.backgroundColor;
3072
- const processColor = isSelected ? task.styles.progressSelectedColor : task.styles.progressColor;
3073
- const projectWith = task.x2 - task.x1;
3074
- 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(",");
3075
- 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(",");
3208
+ var Project = function Project(_ref) {
3209
+ var task = _ref.task,
3210
+ isSelected = _ref.isSelected;
3211
+ var barColor = isSelected ? task.styles.backgroundSelectedColor : task.styles.backgroundColor;
3212
+ var processColor = isSelected ? task.styles.progressSelectedColor : task.styles.progressColor;
3213
+ var projectWith = task.x2 - task.x1;
3214
+ 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(",");
3215
+ 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(",");
3076
3216
  return React.createElement("g", {
3077
3217
  tabIndex: 0,
3078
3218
  className: styles$9.projectWrapper
@@ -3113,16 +3253,18 @@ const Project = _ref => {
3113
3253
  }));
3114
3254
  };
3115
3255
 
3116
- const TaskItem = props => {
3117
- const {
3118
- task,
3119
- isDelete,
3120
- isSelected,
3121
- onEventStart
3122
- } = { ...props
3123
- };
3124
- const [taskItem, setTaskItem] = useState([React.createElement("div", null)]);
3125
- useEffect(() => {
3256
+ var TaskItem = function TaskItem(props) {
3257
+ var _props = _extends({}, props),
3258
+ task = _props.task,
3259
+ isDelete = _props.isDelete,
3260
+ isSelected = _props.isSelected,
3261
+ onEventStart = _props.onEventStart;
3262
+
3263
+ var _useState = useState([React.createElement("div", null)]),
3264
+ taskItem = _useState[0],
3265
+ setTaskItem = _useState[1];
3266
+
3267
+ useEffect(function () {
3126
3268
  switch (task.typeInternal) {
3127
3269
  case "milestone":
3128
3270
  if (task.x1 >= 0 && task.actualx1 >= 0) setTaskItem([React.createElement(Milestone, Object.assign({}, props))]);else setTaskItem([]);
@@ -3138,27 +3280,27 @@ const TaskItem = props => {
3138
3280
 
3139
3281
  default:
3140
3282
  {
3141
- let taskItem = [];
3283
+ var _taskItem = [];
3142
3284
 
3143
3285
  if ((task === null || task === void 0 ? void 0 : task.x1) >= 0 && (task === null || task === void 0 ? void 0 : task.x2) >= 0) {
3144
- taskItem.push(React.createElement(Bar, Object.assign({}, props, {
3286
+ _taskItem.push(React.createElement(Bar, Object.assign({}, props, {
3145
3287
  type: "planned"
3146
3288
  })));
3147
3289
  }
3148
3290
 
3149
3291
  if ((task === null || task === void 0 ? void 0 : task.actualx1) >= 0 && (task === null || task === void 0 ? void 0 : task.actualx2) >= 0) {
3150
- taskItem.push(React.createElement(Bar, Object.assign({}, props, {
3292
+ _taskItem.push(React.createElement(Bar, Object.assign({}, props, {
3151
3293
  type: "actual"
3152
3294
  })));
3153
3295
  }
3154
3296
 
3155
- setTaskItem(taskItem);
3297
+ setTaskItem(_taskItem);
3156
3298
  }
3157
3299
  break;
3158
3300
  }
3159
3301
  }, [task, isSelected]);
3160
3302
  return React.createElement("g", null, React.createElement("g", {
3161
- onKeyDown: e => {
3303
+ onKeyDown: function onKeyDown(e) {
3162
3304
  switch (e.key) {
3163
3305
  case "Delete":
3164
3306
  {
@@ -3169,20 +3311,20 @@ const TaskItem = props => {
3169
3311
 
3170
3312
  e.stopPropagation();
3171
3313
  },
3172
- onMouseEnter: e => {
3314
+ onMouseEnter: function onMouseEnter(e) {
3173
3315
  onEventStart("mouseenter", task, e, "planned");
3174
3316
  },
3175
- onMouseLeave: e => {
3317
+ onMouseLeave: function onMouseLeave(e) {
3176
3318
  onEventStart("mouseleave", task, e, "planned");
3177
3319
  },
3178
- onDoubleClick: e => {
3320
+ onDoubleClick: function onDoubleClick(e) {
3179
3321
  onEventStart("dblclick", task, e, "planned");
3180
3322
  },
3181
- onClick: e => {
3323
+ onClick: function onClick(e) {
3182
3324
  onEventStart("click", task, e, "planned");
3183
3325
  }
3184
3326
  }, taskItem[0]), React.createElement("g", {
3185
- onKeyDown: e => {
3327
+ onKeyDown: function onKeyDown(e) {
3186
3328
  switch (e.key) {
3187
3329
  case "Delete":
3188
3330
  {
@@ -3193,152 +3335,177 @@ const TaskItem = props => {
3193
3335
 
3194
3336
  e.stopPropagation();
3195
3337
  },
3196
- onMouseEnter: e => {
3338
+ onMouseEnter: function onMouseEnter(e) {
3197
3339
  onEventStart("mouseenter", task, e, "actual");
3198
3340
  },
3199
- onMouseLeave: e => {
3341
+ onMouseLeave: function onMouseLeave(e) {
3200
3342
  onEventStart("mouseleave", task, e, "actual");
3201
3343
  },
3202
- onDoubleClick: e => {
3344
+ onDoubleClick: function onDoubleClick(e) {
3203
3345
  onEventStart("dblclick", task, e, "actual");
3204
3346
  },
3205
- onClick: e => {
3347
+ onClick: function onClick(e) {
3206
3348
  onEventStart("click", task, e, "actual");
3207
3349
  }
3208
3350
  }, taskItem[1]));
3209
3351
  };
3210
3352
 
3211
- const TaskGanttContent = _ref => {
3353
+ var TaskGanttContent = function TaskGanttContent(_ref) {
3212
3354
  var _svg$current;
3213
3355
 
3214
- let {
3215
- tasks,
3216
- dates,
3217
- ganttEvent,
3218
- selectedTask,
3219
- rowHeight,
3220
- columnWidth,
3221
- timeStep,
3222
- svg,
3223
- taskHeight,
3224
- arrowIndent,
3225
- fontFamily,
3226
- fontSize,
3227
- rtl,
3228
- virtualItems = [],
3229
- setGanttEvent,
3230
- setFailedTask,
3231
- setSelectedTask,
3232
- onBarTasksUpdate,
3233
- onDateChange,
3234
- onProgressChange,
3235
- onDoubleClick,
3236
- onClick,
3237
- onDelete,
3238
- onCalendarError,
3239
- projectCalendar,
3240
- visibleStartY,
3241
- visibleEndY,
3242
- sliderTime
3243
- } = _ref;
3244
- const point = svg === null || svg === void 0 ? void 0 : (_svg$current = svg.current) === null || _svg$current === void 0 ? void 0 : _svg$current.createSVGPoint();
3245
- const [xStep, setXStep] = useState(0);
3246
- const [initEventX1Delta, setInitEventX1Delta] = useState(0);
3247
- const [isMoving, setIsMoving] = useState(false);
3248
- useEffect(() => {
3356
+ var tasks = _ref.tasks,
3357
+ dates = _ref.dates,
3358
+ ganttEvent = _ref.ganttEvent,
3359
+ selectedTask = _ref.selectedTask,
3360
+ rowHeight = _ref.rowHeight,
3361
+ columnWidth = _ref.columnWidth,
3362
+ timeStep = _ref.timeStep,
3363
+ svg = _ref.svg,
3364
+ taskHeight = _ref.taskHeight,
3365
+ arrowIndent = _ref.arrowIndent,
3366
+ fontFamily = _ref.fontFamily,
3367
+ fontSize = _ref.fontSize,
3368
+ rtl = _ref.rtl,
3369
+ _ref$virtualItems = _ref.virtualItems,
3370
+ virtualItems = _ref$virtualItems === void 0 ? [] : _ref$virtualItems,
3371
+ setGanttEvent = _ref.setGanttEvent,
3372
+ setFailedTask = _ref.setFailedTask,
3373
+ setSelectedTask = _ref.setSelectedTask,
3374
+ onBarTasksUpdate = _ref.onBarTasksUpdate,
3375
+ onDateChange = _ref.onDateChange,
3376
+ onProgressChange = _ref.onProgressChange,
3377
+ onDoubleClick = _ref.onDoubleClick,
3378
+ onClick = _ref.onClick,
3379
+ onDelete = _ref.onDelete,
3380
+ onCalendarError = _ref.onCalendarError,
3381
+ projectCalendar = _ref.projectCalendar,
3382
+ visibleStartY = _ref.visibleStartY,
3383
+ visibleEndY = _ref.visibleEndY,
3384
+ sliderTime = _ref.sliderTime;
3385
+ var point = svg === null || svg === void 0 ? void 0 : (_svg$current = svg.current) === null || _svg$current === void 0 ? void 0 : _svg$current.createSVGPoint();
3386
+
3387
+ var _useState = useState(0),
3388
+ xStep = _useState[0],
3389
+ setXStep = _useState[1];
3390
+
3391
+ var _useState2 = useState(0),
3392
+ initEventX1Delta = _useState2[0],
3393
+ setInitEventX1Delta = _useState2[1];
3394
+
3395
+ var _useState3 = useState(false),
3396
+ isMoving = _useState3[0],
3397
+ setIsMoving = _useState3[1];
3398
+
3399
+ useEffect(function () {
3249
3400
  if (dates.length < 2) {
3250
3401
  setXStep(timeStep * columnWidth / 86400000);
3251
3402
  return;
3252
3403
  }
3253
3404
 
3254
- const dateDelta = dates[1].getTime() - dates[0].getTime() - dates[1].getTimezoneOffset() * 60 * 1000 + dates[0].getTimezoneOffset() * 60 * 1000;
3255
- const newXStep = timeStep * columnWidth / dateDelta;
3405
+ var dateDelta = dates[1].getTime() - dates[0].getTime() - dates[1].getTimezoneOffset() * 60 * 1000 + dates[0].getTimezoneOffset() * 60 * 1000;
3406
+ var newXStep = timeStep * columnWidth / dateDelta;
3256
3407
  setXStep(newXStep);
3257
3408
  }, [columnWidth, dates, timeStep]);
3258
- useEffect(() => {
3259
- const handleMouseMove = function (event) {
3409
+ useEffect(function () {
3410
+ var handleMouseMove = function handleMouseMove(event) {
3260
3411
  try {
3261
3412
  var _svg$current$getScree;
3262
3413
 
3263
3414
  if (!ganttEvent.changedTask || !point || !(svg !== null && svg !== void 0 && svg.current)) return Promise.resolve();
3264
3415
  event.preventDefault();
3265
3416
  point.x = event.clientX;
3266
- 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());
3267
- const {
3268
- isChanged,
3269
- changedTask
3270
- } = handleTaskBySVGMouseEvent(cursor.x, ganttEvent.action, ganttEvent.changedTask, ganttEvent.type, xStep, timeStep, initEventX1Delta, rtl);
3417
+ 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());
3418
+
3419
+ var _handleTaskBySVGMouse = handleTaskBySVGMouseEvent(cursor.x, ganttEvent.action, ganttEvent.changedTask, ganttEvent.type, xStep, timeStep, initEventX1Delta, rtl),
3420
+ isChanged = _handleTaskBySVGMouse.isChanged,
3421
+ changedTask = _handleTaskBySVGMouse.changedTask;
3271
3422
 
3272
3423
  if (isChanged) {
3273
- let finalTask = { ...changedTask
3274
- };
3275
- const dragType = ganttEvent.type;
3424
+ var finalTask = _extends({}, changedTask);
3425
+
3426
+ var dragType = ganttEvent.type;
3276
3427
 
3277
3428
  if (changedTask.calendar && (ganttEvent.action === "end" || ganttEvent.action === "start" || ganttEvent.action === "move")) {
3278
- const cal = finalTask.calendar;
3429
+ var cal = finalTask.calendar;
3279
3430
 
3280
3431
  if (dragType === "actual") {
3281
3432
  if (ganttEvent.action === "end") {
3282
- const snapped = snapToWorkingTime(finalTask.actualEnd, cal, "forward");
3433
+ var snapped = snapToWorkingTime(finalTask.actualEnd, cal, "forward");
3283
3434
  finalTask.actualEnd = snapped;
3284
3435
  finalTask.actualx2 = taskXCoordinate(snapped, dates, columnWidth);
3285
3436
  } else if (ganttEvent.action === "start") {
3286
- const snapped = snapToWorkingTime(finalTask.actualStart, cal, "forward");
3287
- finalTask.actualStart = snapped;
3288
- finalTask.actualx1 = taskXCoordinate(snapped, dates, columnWidth);
3437
+ var _snapped = snapToWorkingTime(finalTask.actualStart, cal, "forward");
3438
+
3439
+ finalTask.actualStart = _snapped;
3440
+ finalTask.actualx1 = taskXCoordinate(_snapped, dates, columnWidth);
3289
3441
  } else {
3290
- const snapped = snapToWorkingTime(finalTask.actualStart, cal, "forward");
3291
- const delta = snapped.getTime() - finalTask.actualStart.getTime();
3292
- finalTask.actualStart = snapped;
3442
+ var _snapped2 = snapToWorkingTime(finalTask.actualStart, cal, "forward");
3443
+
3444
+ var delta = _snapped2.getTime() - finalTask.actualStart.getTime();
3445
+ finalTask.actualStart = _snapped2;
3293
3446
  finalTask.actualEnd = new Date(finalTask.actualEnd.getTime() + delta);
3294
3447
  finalTask.actualx1 = taskXCoordinate(finalTask.actualStart, dates, columnWidth);
3295
3448
  finalTask.actualx2 = taskXCoordinate(finalTask.actualEnd, dates, columnWidth);
3296
3449
  }
3297
3450
 
3298
- const actEnd = addToDate(startOfDate(finalTask.actualEnd, "day"), 1, "day");
3299
- const actIntervals = getWorkingIntervals(finalTask.actualStart, actEnd, cal);
3300
- const actSegs = actIntervals.map(iv => ({
3301
- x1: taskXCoordinate(iv.start, dates, columnWidth),
3302
- x2: taskXCoordinate(iv.end, dates, columnWidth)
3303
- })).filter(s => s.x2 > s.x1);
3451
+ var actEnd = addToDate(startOfDate(finalTask.actualEnd, "day"), 1, "day");
3452
+ var actIntervals = getWorkingIntervals(finalTask.actualStart, actEnd, cal);
3453
+ var actSegs = actIntervals.map(function (iv) {
3454
+ return {
3455
+ x1: taskXCoordinate(iv.start, dates, columnWidth),
3456
+ x2: taskXCoordinate(iv.end, dates, columnWidth)
3457
+ };
3458
+ }).filter(function (s) {
3459
+ return s.x2 > s.x1;
3460
+ });
3304
3461
  finalTask.actualSegments = actSegs.length > 0 ? actSegs : undefined;
3305
- const actDays = Math.max(1, Math.round((finalTask.actualEnd.getTime() - finalTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3462
+ var actDays = Math.max(1, Math.round((finalTask.actualEnd.getTime() - finalTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3306
3463
  finalTask.actualDuration = actDays;
3307
3464
  } else {
3308
3465
  if (ganttEvent.action === "end") {
3309
- const snapped = snapToWorkingTime(finalTask.end, cal, "forward");
3310
- finalTask.end = snapped;
3311
- finalTask.x2 = taskXCoordinate(snapped, dates, columnWidth);
3466
+ var _snapped3 = snapToWorkingTime(finalTask.end, cal, "forward");
3467
+
3468
+ finalTask.end = _snapped3;
3469
+ finalTask.x2 = taskXCoordinate(_snapped3, dates, columnWidth);
3312
3470
  } else if (ganttEvent.action === "start") {
3313
- const snapped = snapToWorkingTime(finalTask.start, cal, "forward");
3314
- finalTask.start = snapped;
3315
- finalTask.x1 = taskXCoordinate(snapped, dates, columnWidth);
3471
+ var _snapped4 = snapToWorkingTime(finalTask.start, cal, "forward");
3472
+
3473
+ finalTask.start = _snapped4;
3474
+ finalTask.x1 = taskXCoordinate(_snapped4, dates, columnWidth);
3316
3475
  } else {
3317
- const snapped = snapToWorkingTime(finalTask.start, cal, "forward");
3318
- const delta = snapped.getTime() - finalTask.start.getTime();
3319
- finalTask.start = snapped;
3320
- finalTask.end = new Date(finalTask.end.getTime() + delta);
3476
+ var _snapped5 = snapToWorkingTime(finalTask.start, cal, "forward");
3477
+
3478
+ var _delta = _snapped5.getTime() - finalTask.start.getTime();
3479
+
3480
+ finalTask.start = _snapped5;
3481
+ finalTask.end = new Date(finalTask.end.getTime() + _delta);
3321
3482
  finalTask.x1 = taskXCoordinate(finalTask.start, dates, columnWidth);
3322
3483
  finalTask.x2 = taskXCoordinate(finalTask.end, dates, columnWidth);
3323
3484
  }
3324
3485
 
3325
- const planEnd = addToDate(startOfDate(finalTask.end, "day"), 1, "day");
3326
- const planIntervals = getWorkingIntervals(finalTask.start, planEnd, cal);
3327
- const planSegs = planIntervals.map(iv => ({
3328
- x1: taskXCoordinate(iv.start, dates, columnWidth),
3329
- x2: taskXCoordinate(iv.end, dates, columnWidth)
3330
- })).filter(s => s.x2 > s.x1);
3486
+ var planEnd = addToDate(startOfDate(finalTask.end, "day"), 1, "day");
3487
+ var planIntervals = getWorkingIntervals(finalTask.start, planEnd, cal);
3488
+ var planSegs = planIntervals.map(function (iv) {
3489
+ return {
3490
+ x1: taskXCoordinate(iv.start, dates, columnWidth),
3491
+ x2: taskXCoordinate(iv.end, dates, columnWidth)
3492
+ };
3493
+ }).filter(function (s) {
3494
+ return s.x2 > s.x1;
3495
+ });
3331
3496
  finalTask.plannedSegments = planSegs.length > 0 ? planSegs : undefined;
3332
- const planDays = Math.max(1, Math.round((finalTask.end.getTime() - finalTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3497
+ var planDays = Math.max(1, Math.round((finalTask.end.getTime() - finalTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3333
3498
  finalTask.plannedDuration = planDays;
3334
3499
  }
3335
3500
  } else {
3336
3501
  if (dragType === "actual") {
3337
- const actDays = Math.max(1, Math.round((finalTask.actualEnd.getTime() - finalTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3338
- finalTask.actualDuration = actDays;
3502
+ var _actDays = Math.max(1, Math.round((finalTask.actualEnd.getTime() - finalTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3503
+
3504
+ finalTask.actualDuration = _actDays;
3339
3505
  } else {
3340
- const planDays = Math.max(1, Math.round((finalTask.end.getTime() - finalTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3341
- finalTask.plannedDuration = planDays;
3506
+ var _planDays = Math.max(1, Math.round((finalTask.end.getTime() - finalTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3507
+
3508
+ finalTask.plannedDuration = _planDays;
3342
3509
  }
3343
3510
  }
3344
3511
 
@@ -3355,42 +3522,41 @@ const TaskGanttContent = _ref => {
3355
3522
  }
3356
3523
  };
3357
3524
 
3358
- const handleMouseUp = function (event) {
3525
+ var handleMouseUp = function handleMouseUp(event) {
3359
3526
  try {
3360
3527
  var _svg$current$getScree2;
3361
3528
 
3362
- function _temp5() {
3529
+ var _temp6 = function _temp6() {
3363
3530
  if (!operationSuccess) {
3364
3531
  setFailedTask(originalSelectedTask);
3365
3532
  }
3366
- }
3533
+ };
3367
3534
 
3368
- const {
3369
- action,
3370
- originalSelectedTask,
3371
- changedTask,
3372
- type
3373
- } = ganttEvent;
3535
+ var action = ganttEvent.action,
3536
+ originalSelectedTask = ganttEvent.originalSelectedTask,
3537
+ changedTask = ganttEvent.changedTask,
3538
+ type = ganttEvent.type;
3374
3539
  if (!changedTask || !point || !(svg !== null && svg !== void 0 && svg.current) || !originalSelectedTask) return Promise.resolve();
3375
3540
  event.preventDefault();
3376
3541
  point.x = event.clientX;
3377
- 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());
3378
- const {
3379
- changedTask: newChangedTask
3380
- } = handleTaskBySVGMouseEvent(cursor.x, action, changedTask, type, xStep, timeStep, initEventX1Delta, rtl);
3381
- const isNotLikeOriginal = originalSelectedTask.start !== newChangedTask.start || originalSelectedTask.end !== newChangedTask.end || originalSelectedTask.actualStart !== newChangedTask.actualStart || originalSelectedTask.actualEnd !== newChangedTask.actualEnd || originalSelectedTask.progress !== newChangedTask.progress;
3382
- const dropType = type;
3542
+ 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());
3543
+
3544
+ var _handleTaskBySVGMouse2 = handleTaskBySVGMouseEvent(cursor.x, action, changedTask, type, xStep, timeStep, initEventX1Delta, rtl),
3545
+ newChangedTask = _handleTaskBySVGMouse2.changedTask;
3546
+
3547
+ var isNotLikeOriginal = originalSelectedTask.start !== newChangedTask.start || originalSelectedTask.end !== newChangedTask.end || originalSelectedTask.actualStart !== newChangedTask.actualStart || originalSelectedTask.actualEnd !== newChangedTask.actualEnd || originalSelectedTask.progress !== newChangedTask.progress;
3548
+ var dropType = type;
3383
3549
 
3384
3550
  if (newChangedTask.calendar && (action === "move" || action === "end" || action === "start")) {
3385
- const cal = newChangedTask.calendar;
3551
+ var cal = newChangedTask.calendar;
3386
3552
 
3387
3553
  if (dropType === "actual") {
3388
3554
  if (action === "end") {
3389
- const snappedEnd = snapToWorkingTime(newChangedTask.actualEnd, cal, "forward");
3555
+ var snappedEnd = snapToWorkingTime(newChangedTask.actualEnd, cal, "forward");
3390
3556
  newChangedTask.actualEnd = snappedEnd;
3391
3557
  newChangedTask.actualx2 = taskXCoordinate(snappedEnd, dates, columnWidth);
3392
3558
  } else if (action === "start") {
3393
- const snappedStart = snapToWorkingTime(newChangedTask.actualStart, cal, "forward");
3559
+ var snappedStart = snapToWorkingTime(newChangedTask.actualStart, cal, "forward");
3394
3560
 
3395
3561
  if (snappedStart >= newChangedTask.actualEnd) {
3396
3562
  setFailedTask(originalSelectedTask);
@@ -3407,32 +3573,38 @@ const TaskGanttContent = _ref => {
3407
3573
  newChangedTask.actualStart = snappedStart;
3408
3574
  newChangedTask.actualx1 = taskXCoordinate(snappedStart, dates, columnWidth);
3409
3575
  } else {
3410
- const snappedStart = snapToWorkingTime(newChangedTask.actualStart, cal, "forward");
3411
- const delta = snappedStart.getTime() - newChangedTask.actualStart.getTime();
3412
- newChangedTask.actualStart = snappedStart;
3576
+ var _snappedStart = snapToWorkingTime(newChangedTask.actualStart, cal, "forward");
3577
+
3578
+ var delta = _snappedStart.getTime() - newChangedTask.actualStart.getTime();
3579
+ newChangedTask.actualStart = _snappedStart;
3413
3580
  newChangedTask.actualEnd = new Date(newChangedTask.actualEnd.getTime() + delta);
3414
- newChangedTask.actualx1 = taskXCoordinate(snappedStart, dates, columnWidth);
3581
+ newChangedTask.actualx1 = taskXCoordinate(_snappedStart, dates, columnWidth);
3415
3582
  newChangedTask.actualx2 = taskXCoordinate(newChangedTask.actualEnd, dates, columnWidth);
3416
3583
  }
3417
3584
 
3418
- const actEnd = addToDate(startOfDate(newChangedTask.actualEnd, "day"), 1, "day");
3419
- const actIntervals = getWorkingIntervals(newChangedTask.actualStart, actEnd, cal);
3420
- const actSegs = actIntervals.map(iv => ({
3421
- x1: taskXCoordinate(iv.start, dates, columnWidth),
3422
- x2: taskXCoordinate(iv.end, dates, columnWidth)
3423
- })).filter(s => s.x2 > s.x1);
3585
+ var actEnd = addToDate(startOfDate(newChangedTask.actualEnd, "day"), 1, "day");
3586
+ var actIntervals = getWorkingIntervals(newChangedTask.actualStart, actEnd, cal);
3587
+ var actSegs = actIntervals.map(function (iv) {
3588
+ return {
3589
+ x1: taskXCoordinate(iv.start, dates, columnWidth),
3590
+ x2: taskXCoordinate(iv.end, dates, columnWidth)
3591
+ };
3592
+ }).filter(function (s) {
3593
+ return s.x2 > s.x1;
3594
+ });
3424
3595
  newChangedTask.actualSegments = actSegs.length > 0 ? actSegs : undefined;
3425
- const actDays = Math.max(1, Math.round((newChangedTask.actualEnd.getTime() - newChangedTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3596
+ var actDays = Math.max(1, Math.round((newChangedTask.actualEnd.getTime() - newChangedTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3426
3597
  newChangedTask.actualDuration = actDays;
3427
3598
  } else {
3428
3599
  if (action === "end") {
3429
- const snappedEnd = snapToWorkingTime(newChangedTask.end, cal, "forward");
3430
- newChangedTask.end = snappedEnd;
3431
- newChangedTask.x2 = taskXCoordinate(snappedEnd, dates, columnWidth);
3600
+ var _snappedEnd = snapToWorkingTime(newChangedTask.end, cal, "forward");
3601
+
3602
+ newChangedTask.end = _snappedEnd;
3603
+ newChangedTask.x2 = taskXCoordinate(_snappedEnd, dates, columnWidth);
3432
3604
  } else if (action === "start") {
3433
- const snappedStart = snapToWorkingTime(newChangedTask.start, cal, "forward");
3605
+ var _snappedStart2 = snapToWorkingTime(newChangedTask.start, cal, "forward");
3434
3606
 
3435
- if (snappedStart >= newChangedTask.end) {
3607
+ if (_snappedStart2 >= newChangedTask.end) {
3436
3608
  setFailedTask(originalSelectedTask);
3437
3609
  onCalendarError === null || onCalendarError === void 0 ? void 0 : onCalendarError(newChangedTask, "No working time in selected range");
3438
3610
  setGanttEvent({
@@ -3444,34 +3616,42 @@ const TaskGanttContent = _ref => {
3444
3616
  return Promise.resolve();
3445
3617
  }
3446
3618
 
3447
- newChangedTask.start = snappedStart;
3448
- newChangedTask.x1 = taskXCoordinate(snappedStart, dates, columnWidth);
3619
+ newChangedTask.start = _snappedStart2;
3620
+ newChangedTask.x1 = taskXCoordinate(_snappedStart2, dates, columnWidth);
3449
3621
  } else {
3450
- const snappedStart = snapToWorkingTime(newChangedTask.start, cal, "forward");
3451
- const delta = snappedStart.getTime() - newChangedTask.start.getTime();
3452
- newChangedTask.start = snappedStart;
3453
- newChangedTask.end = new Date(newChangedTask.end.getTime() + delta);
3454
- newChangedTask.x1 = taskXCoordinate(snappedStart, dates, columnWidth);
3622
+ var _snappedStart3 = snapToWorkingTime(newChangedTask.start, cal, "forward");
3623
+
3624
+ var _delta2 = _snappedStart3.getTime() - newChangedTask.start.getTime();
3625
+
3626
+ newChangedTask.start = _snappedStart3;
3627
+ newChangedTask.end = new Date(newChangedTask.end.getTime() + _delta2);
3628
+ newChangedTask.x1 = taskXCoordinate(_snappedStart3, dates, columnWidth);
3455
3629
  newChangedTask.x2 = taskXCoordinate(newChangedTask.end, dates, columnWidth);
3456
3630
  }
3457
3631
 
3458
- const planEnd = addToDate(startOfDate(newChangedTask.end, "day"), 1, "day");
3459
- const planIntervals = getWorkingIntervals(newChangedTask.start, planEnd, cal);
3460
- const planSegs = planIntervals.map(iv => ({
3461
- x1: taskXCoordinate(iv.start, dates, columnWidth),
3462
- x2: taskXCoordinate(iv.end, dates, columnWidth)
3463
- })).filter(s => s.x2 > s.x1);
3632
+ var planEnd = addToDate(startOfDate(newChangedTask.end, "day"), 1, "day");
3633
+ var planIntervals = getWorkingIntervals(newChangedTask.start, planEnd, cal);
3634
+ var planSegs = planIntervals.map(function (iv) {
3635
+ return {
3636
+ x1: taskXCoordinate(iv.start, dates, columnWidth),
3637
+ x2: taskXCoordinate(iv.end, dates, columnWidth)
3638
+ };
3639
+ }).filter(function (s) {
3640
+ return s.x2 > s.x1;
3641
+ });
3464
3642
  newChangedTask.plannedSegments = planSegs.length > 0 ? planSegs : undefined;
3465
- const planDays = Math.max(1, Math.round((newChangedTask.end.getTime() - newChangedTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3643
+ var planDays = Math.max(1, Math.round((newChangedTask.end.getTime() - newChangedTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3466
3644
  newChangedTask.plannedDuration = planDays;
3467
3645
  }
3468
3646
  } else if (action === "move" || action === "end" || action === "start") {
3469
3647
  if (dropType === "actual") {
3470
- const actDays = Math.max(1, Math.round((newChangedTask.actualEnd.getTime() - newChangedTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3471
- newChangedTask.actualDuration = actDays;
3648
+ var _actDays2 = Math.max(1, Math.round((newChangedTask.actualEnd.getTime() - newChangedTask.actualStart.getTime()) / (1000 * 60 * 60 * 24)));
3649
+
3650
+ newChangedTask.actualDuration = _actDays2;
3472
3651
  } else {
3473
- const planDays = Math.max(1, Math.round((newChangedTask.end.getTime() - newChangedTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3474
- newChangedTask.plannedDuration = planDays;
3652
+ var _planDays2 = Math.max(1, Math.round((newChangedTask.end.getTime() - newChangedTask.start.getTime()) / (1000 * 60 * 60 * 24)));
3653
+
3654
+ newChangedTask.plannedDuration = _planDays2;
3475
3655
  }
3476
3656
  }
3477
3657
 
@@ -3486,11 +3666,11 @@ const TaskGanttContent = _ref => {
3486
3666
  action: ""
3487
3667
  });
3488
3668
  setIsMoving(false);
3489
- let operationSuccess = true;
3669
+ var operationSuccess = true;
3490
3670
 
3491
- const _temp4 = function () {
3671
+ var _temp7 = function () {
3492
3672
  if ((action === "move" || action === "end" || action === "start") && onDateChange && isNotLikeOriginal) {
3493
- const _temp = _catch(function () {
3673
+ var _temp8 = _catch(function () {
3494
3674
  return Promise.resolve(onDateChange(newChangedTask, newChangedTask.barChildren)).then(function (result) {
3495
3675
  if (result !== undefined) {
3496
3676
  operationSuccess = result;
@@ -3500,11 +3680,11 @@ const TaskGanttContent = _ref => {
3500
3680
  operationSuccess = false;
3501
3681
  });
3502
3682
 
3503
- if (_temp && _temp.then) return _temp.then(function () {});
3683
+ if (_temp8 && _temp8.then) return _temp8.then(function () {});
3504
3684
  } else {
3505
- const _temp3 = function () {
3685
+ var _temp9 = function () {
3506
3686
  if (onProgressChange && isNotLikeOriginal) {
3507
- const _temp2 = _catch(function () {
3687
+ var _temp10 = _catch(function () {
3508
3688
  return Promise.resolve(onProgressChange(newChangedTask, newChangedTask.barChildren)).then(function (result) {
3509
3689
  if (result !== undefined) {
3510
3690
  operationSuccess = result;
@@ -3514,15 +3694,15 @@ const TaskGanttContent = _ref => {
3514
3694
  operationSuccess = false;
3515
3695
  });
3516
3696
 
3517
- if (_temp2 && _temp2.then) return _temp2.then(function () {});
3697
+ if (_temp10 && _temp10.then) return _temp10.then(function () {});
3518
3698
  }
3519
3699
  }();
3520
3700
 
3521
- if (_temp3 && _temp3.then) return _temp3.then(function () {});
3701
+ if (_temp9 && _temp9.then) return _temp9.then(function () {});
3522
3702
  }
3523
3703
  }();
3524
3704
 
3525
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
3705
+ return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp6) : _temp6(_temp7));
3526
3706
  } catch (e) {
3527
3707
  return Promise.reject(e);
3528
3708
  }
@@ -3535,7 +3715,7 @@ const TaskGanttContent = _ref => {
3535
3715
  }
3536
3716
  }, [ganttEvent, xStep, initEventX1Delta, onProgressChange, timeStep, onDateChange, onCalendarError, projectCalendar, svg, isMoving, point, rtl, setFailedTask, setGanttEvent, onBarTasksUpdate, dates, columnWidth]);
3537
3717
 
3538
- const handleBarEventStart = function (action, task, event, type) {
3718
+ var handleBarEventStart = function handleBarEventStart(action, task, event, type) {
3539
3719
  try {
3540
3720
  return Promise.resolve(function () {
3541
3721
  if (!event) {
@@ -3544,15 +3724,15 @@ const TaskGanttContent = _ref => {
3544
3724
  }
3545
3725
  } else return function () {
3546
3726
  if (isKeyboardEvent(event)) {
3547
- const _temp8 = function () {
3727
+ var _temp14 = function () {
3548
3728
  if (action === "delete") {
3549
- const _temp7 = function () {
3729
+ var _temp15 = function () {
3550
3730
  if (onDelete) {
3551
- const _temp6 = _catch(function () {
3731
+ var _temp16 = _catch(function () {
3552
3732
  return Promise.resolve(onDelete(task)).then(function (result) {
3553
3733
  if (result !== undefined && result) {
3554
3734
  setGanttEvent({
3555
- action,
3735
+ action: action,
3556
3736
  changedTask: task
3557
3737
  });
3558
3738
  }
@@ -3561,19 +3741,19 @@ const TaskGanttContent = _ref => {
3561
3741
  console.error("Error on Delete. " + error);
3562
3742
  });
3563
3743
 
3564
- if (_temp6 && _temp6.then) return _temp6.then(function () {});
3744
+ if (_temp16 && _temp16.then) return _temp16.then(function () {});
3565
3745
  }
3566
3746
  }();
3567
3747
 
3568
- if (_temp7 && _temp7.then) return _temp7.then(function () {});
3748
+ if (_temp15 && _temp15.then) return _temp15.then(function () {});
3569
3749
  }
3570
3750
  }();
3571
3751
 
3572
- if (_temp8 && _temp8.then) return _temp8.then(function () {});
3752
+ if (_temp14 && _temp14.then) return _temp14.then(function () {});
3573
3753
  } else if (action === "mouseenter") {
3574
3754
  if (!ganttEvent.action) {
3575
3755
  setGanttEvent({
3576
- action,
3756
+ action: action,
3577
3757
  changedTask: task,
3578
3758
  originalSelectedTask: task,
3579
3759
  type: type
@@ -3594,17 +3774,17 @@ const TaskGanttContent = _ref => {
3594
3774
 
3595
3775
  if (!(svg !== null && svg !== void 0 && svg.current) || !point) return;
3596
3776
  point.x = event.clientX;
3597
- const cursor = point.matrixTransform((_svg$current$getScree3 = svg.current.getScreenCTM()) === null || _svg$current$getScree3 === void 0 ? void 0 : _svg$current$getScree3.inverse());
3777
+ var cursor = point.matrixTransform((_svg$current$getScree3 = svg.current.getScreenCTM()) === null || _svg$current$getScree3 === void 0 ? void 0 : _svg$current$getScree3.inverse());
3598
3778
  if (type == "planned") setInitEventX1Delta(cursor.x - task.x1);else if (type == "actual") setInitEventX1Delta(cursor.x - task.actualx1);
3599
3779
  setGanttEvent({
3600
- action,
3780
+ action: action,
3601
3781
  changedTask: task,
3602
3782
  originalSelectedTask: task,
3603
3783
  type: type
3604
3784
  });
3605
3785
  } else {
3606
3786
  setGanttEvent({
3607
- action,
3787
+ action: action,
3608
3788
  changedTask: task,
3609
3789
  originalSelectedTask: task,
3610
3790
  type: type
@@ -3617,60 +3797,77 @@ const TaskGanttContent = _ref => {
3617
3797
  }
3618
3798
  };
3619
3799
 
3620
- const getArrows = (isCritical, criticalPathType) => {
3621
- return tasks.flatMap(_task => {
3622
- const a = ganttEvent.action;
3623
- const isDraggingThis = (a === "move" || a === "start" || a === "end" || a === "progress") && !!ganttEvent.changedTask && ganttEvent.changedTask.id === _task.id;
3624
-
3625
- const _live = isDraggingThis ? { ...ganttEvent.changedTask,
3626
- y: _task.y
3627
- } : _task;
3628
-
3629
- const task = _live.start.getTime() > 0 && _live.end.getTime() > 0 ? _live : undefined;
3630
-
3631
- if (!task) {
3632
- return [];
3800
+ var arrowIndex = React.useMemo(function () {
3801
+ var entries = [];
3802
+
3803
+ for (var i = 0; i < tasks.length; i++) {
3804
+ var task = tasks[i];
3805
+ var yFrom = task.y + taskHeight / 2;
3806
+
3807
+ for (var _iterator = _createForOfIteratorHelperLoose(task.barChildren), _step; !(_step = _iterator()).done;) {
3808
+ var child = _step.value;
3809
+ var taskTo = tasks[child.index];
3810
+ if (!taskTo) continue;
3811
+ var yTo = taskTo.y + taskHeight / 2;
3812
+ entries.push({
3813
+ from: i,
3814
+ to: child.index,
3815
+ minY: Math.min(yFrom, yTo),
3816
+ maxY: Math.max(yFrom, yTo),
3817
+ dependencyType: child.dependencyType
3818
+ });
3633
3819
  }
3820
+ }
3634
3821
 
3635
- return task.barChildren.map(child => {
3636
- const taskTo = tasks[child.index];
3637
- const fromDrawable = task.x2 > task.x1 || task.actualx2 > task.actualx1;
3638
- const toDrawable = !!taskTo && (taskTo.x2 > taskTo.x1 || taskTo.actualx2 > taskTo.actualx1);
3822
+ return entries;
3823
+ }, [tasks, taskHeight]);
3639
3824
 
3640
- if (fromDrawable && toDrawable) {
3641
- var _task$criticalPathArr;
3825
+ var getArrows = function getArrows(isCritical, criticalPathType) {
3826
+ var out = [];
3827
+ var a = ganttEvent.action;
3828
+ var dragging = (a === "move" || a === "start" || a === "end" || a === "progress") && !!ganttEvent.changedTask;
3642
3829
 
3643
- 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));
3644
- const yFrom = task.y + taskHeight / 2;
3645
- const yTo = taskTo.y + taskHeight / 2;
3646
- const minY = Math.min(yFrom, yTo);
3647
- const maxY = Math.max(yFrom, yTo);
3830
+ var _loop = function _loop() {
3831
+ var _task$criticalPathArr;
3648
3832
 
3649
- if (maxY < visibleStartY || minY > visibleEndY) {
3650
- return null;
3651
- }
3833
+ var e = _step2.value;
3834
+ if (e.maxY < visibleStartY || e.minY > visibleEndY) return "continue";
3835
+ var _task = tasks[e.from];
3836
+ var task = dragging && ganttEvent.changedTask.id === _task.id ? _extends({}, ganttEvent.changedTask, {
3837
+ y: _task.y
3838
+ }) : _task;
3839
+ if (!(task.start.getTime() > 0 && task.end.getTime() > 0)) return "continue";
3840
+ var taskTo = tasks[e.to];
3841
+ var fromDrawable = task.x2 > task.x1 || task.actualx2 > task.actualx1;
3842
+ var toDrawable = taskTo.x2 > taskTo.x1 || taskTo.actualx2 > taskTo.actualx1;
3843
+ if (!fromDrawable || !toDrawable) return "continue";
3844
+ var criticalTask = (_task$criticalPathArr = task.criticalPathArrows) === null || _task$criticalPathArr === void 0 ? void 0 : _task$criticalPathArr.find(function (arrow) {
3845
+ return arrow.taskId === taskTo.id && (!!arrow.criticalPathType ? arrow.criticalPathType === criticalPathType : !criticalPathType);
3846
+ });
3847
+ if (!!criticalTask !== isCritical) return "continue";
3848
+ out.push(React.createElement(Arrow, {
3849
+ key: "Arrow from " + task.id + " to " + taskTo.id + (isCritical ? "-critical" : ""),
3850
+ taskFrom: task,
3851
+ taskTo: taskTo,
3852
+ rowHeight: rowHeight,
3853
+ dependencyType: e.dependencyType,
3854
+ taskHeight: taskHeight,
3855
+ arrowIndent: arrowIndent,
3856
+ arrowColor: (criticalTask === null || criticalTask === void 0 ? void 0 : criticalTask.arrowColor) || "#808080"
3857
+ }));
3858
+ };
3652
3859
 
3653
- if (!!criticalTask === isCritical) {
3654
- return React.createElement(Arrow, {
3655
- key: `Arrow from ${task.id} to ${taskTo.id}${isCritical ? "-critical" : ""}`,
3656
- taskFrom: task,
3657
- taskTo: taskTo,
3658
- rowHeight: rowHeight,
3659
- dependencyType: child.dependencyType,
3660
- taskHeight: taskHeight,
3661
- arrowIndent: arrowIndent,
3662
- arrowColor: (criticalTask === null || criticalTask === void 0 ? void 0 : criticalTask.arrowColor) || "#808080"
3663
- });
3664
- }
3665
- }
3860
+ for (var _iterator2 = _createForOfIteratorHelperLoose(arrowIndex), _step2; !(_step2 = _iterator2()).done;) {
3861
+ var _ret = _loop();
3666
3862
 
3667
- return null;
3668
- }).filter(Boolean);
3669
- });
3863
+ if (_ret === "continue") continue;
3864
+ }
3865
+
3866
+ return out;
3670
3867
  };
3671
3868
 
3672
- const lineX = sliderTime !== undefined ? taskXCoordinate(new Date(sliderTime), dates, columnWidth) : null;
3673
- const totalHeight = tasks.length * rowHeight;
3869
+ var lineX = sliderTime !== undefined ? taskXCoordinate(new Date(sliderTime), dates, columnWidth) : null;
3870
+ var totalHeight = tasks.length * rowHeight;
3674
3871
  return React.createElement("g", {
3675
3872
  className: "content"
3676
3873
  }, lineX !== null && lineX > 0 && React.createElement("line", {
@@ -3688,18 +3885,18 @@ const TaskGanttContent = _ref => {
3688
3885
  className: "bar",
3689
3886
  fontFamily: fontFamily,
3690
3887
  fontSize: fontSize
3691
- }, virtualItems.map(vi => {
3692
- const _task = tasks[vi.index];
3693
- const task = ganttEvent.changedTask && ganttEvent.changedTask.id === _task.id ? { ...ganttEvent.changedTask,
3888
+ }, virtualItems.map(function (vi) {
3889
+ var _task = tasks[vi.index];
3890
+ var task = ganttEvent.changedTask && ganttEvent.changedTask.id === _task.id ? _extends({}, ganttEvent.changedTask, {
3694
3891
  y: 0
3695
- } : { ..._task,
3892
+ }) : _extends({}, _task, {
3696
3893
  y: 0
3697
- };
3894
+ });
3698
3895
 
3699
3896
  if (!task && _task.typeInternal === "milestone") {
3700
3897
  return React.createElement("g", {
3701
3898
  key: _task.id,
3702
- transform: `translate(0, ${vi.start})`
3899
+ transform: "translate(0, " + vi.start + ")"
3703
3900
  }, React.createElement(Milestone, {
3704
3901
  task: task,
3705
3902
  arrowIndent: arrowIndent,
@@ -3716,7 +3913,7 @@ const TaskGanttContent = _ref => {
3716
3913
  if (!task) {
3717
3914
  return React.createElement("g", {
3718
3915
  key: _task.id,
3719
- transform: `translate(0, ${vi.start})`,
3916
+ transform: "translate(0, " + vi.start + ")",
3720
3917
  style: {
3721
3918
  height: taskHeight
3722
3919
  }
@@ -3725,7 +3922,7 @@ const TaskGanttContent = _ref => {
3725
3922
 
3726
3923
  return React.createElement("g", {
3727
3924
  key: task.id,
3728
- transform: `translate(0, ${vi.start})`
3925
+ transform: "translate(0, " + vi.start + ")"
3729
3926
  }, React.createElement(TaskItem, {
3730
3927
  task: task,
3731
3928
  arrowIndent: arrowIndent,
@@ -3850,7 +4047,7 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
3850
4047
  var GANTT_MIN_WIDTH_RATIO = 0.4;
3851
4048
  var TABLE_GANTT_DIVIDER_WIDTH = 20;
3852
4049
  var Gantt = function Gantt(_ref) {
3853
- var _ref2;
4050
+ var _ref3;
3854
4051
 
3855
4052
  var tasks = _ref.tasks,
3856
4053
  primaryPath = _ref.primaryPath,
@@ -3964,9 +4161,9 @@ var Gantt = function Gantt(_ref) {
3964
4161
  setTableContentWidth = _useState2[1];
3965
4162
 
3966
4163
  var _useState3 = useState(function () {
3967
- var _ganttDateRange = ganttDateRange(tasks, viewMode, preStepsCount),
3968
- startDateRange = _ganttDateRange[0],
3969
- endDateRange = _ganttDateRange[1];
4164
+ var _ref2 = tasks ? ganttDateRange(tasks, viewMode, preStepsCount) : [new Date(), new Date()],
4165
+ startDateRange = _ref2[0],
4166
+ endDateRange = _ref2[1];
3970
4167
 
3971
4168
  if (scheduleType === "lookAhead") {
3972
4169
  return {
@@ -4118,7 +4315,7 @@ var Gantt = function Gantt(_ref) {
4118
4315
  setComputedColumnWidth(next);
4119
4316
  }
4120
4317
  }, [viewMode, svgContainerWidth, columnWidthProp, computedColumnWidth]);
4121
- var columnWidth = (_ref2 = columnWidthProp != null ? columnWidthProp : computedColumnWidth) != null ? _ref2 : 60;
4318
+ var columnWidth = (_ref3 = columnWidthProp != null ? columnWidthProp : computedColumnWidth) != null ? _ref3 : 60;
4122
4319
  var effectiveColumnWidth = useMemo(function () {
4123
4320
  if (svgContainerWidth <= 0 || dateSetup.dates.length <= 0) return columnWidth;
4124
4321
 
@@ -4190,9 +4387,9 @@ var Gantt = function Gantt(_ref) {
4190
4387
  filteredTasks = removeHiddenTasks(tasks);
4191
4388
  filteredTasks = filteredTasks.sort(sortTasks);
4192
4389
 
4193
- var _ganttDateRange2 = ganttDateRange(filteredTasks, viewMode, preStepsCount, (_projectCalendar$quar = projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.quarter_start) != null ? _projectCalendar$quar : 0),
4194
- startDateRange = _ganttDateRange2[0],
4195
- endDateRange = _ganttDateRange2[1];
4390
+ var _ganttDateRange = ganttDateRange(filteredTasks, viewMode, preStepsCount, (_projectCalendar$quar = projectCalendar === null || projectCalendar === void 0 ? void 0 : projectCalendar.quarter_start) != null ? _projectCalendar$quar : 0),
4391
+ startDateRange = _ganttDateRange[0],
4392
+ endDateRange = _ganttDateRange[1];
4196
4393
 
4197
4394
  var newDates = seedDates(startDateRange, endDateRange, viewMode);
4198
4395
 
@@ -4222,7 +4419,8 @@ var Gantt = function Gantt(_ref) {
4222
4419
  colorPath(primaryPath, "#ff0000", tasks, "primary");
4223
4420
  }
4224
4421
 
4225
- setBarTasks(convertToBarTasks(filteredTasks, newDates, effectiveColumnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor));
4422
+ var nextBarTasks = convertToBarTasks(filteredTasks, newDates, effectiveColumnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor);
4423
+ setBarTasks(nextBarTasks);
4226
4424
  setIsProcessing(false);
4227
4425
  }, delayToRender);
4228
4426
  }, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor, rtl, shouldNotShowLoadingOverlay, effectiveColumnWidth, projectCalendar]);
@@ -4794,6 +4992,7 @@ function getCriticalPaths(leafTasks) {
4794
4992
  taskChainList.sort(function (a, b) {
4795
4993
  return b.duration - a.duration;
4796
4994
  });
4995
+ console.debug(taskChainList);
4797
4996
  var primaryLeaf = taskChainList[0].parent;
4798
4997
  var primaryPath = [];
4799
4998
 
@@ -4861,59 +5060,76 @@ function getCriticalPaths(leafTasks) {
4861
5060
  secondaryLeaf = _nextPath.task;
4862
5061
  }
4863
5062
 
4864
- console.debug("Primary", primaryPath);
4865
- console.debug("Secondary", secondaryPath);
5063
+ console.debug("Primary ", primaryPath);
5064
+ console.debug("Secondary ", secondaryPath);
4866
5065
  return [primaryPath, secondaryPath];
4867
5066
  }
4868
5067
 
4869
5068
  return [[], []];
4870
5069
  }
5070
+
5071
+ function getOffTime$1(tIndex, taskMap, start, end) {
5072
+ var startWeek = Math.floor((start / 86400000 + 4) / 7);
5073
+ var endWeek = Math.floor((end / 86400000 + 4) / 7);
5074
+ var offTime = [];
5075
+
5076
+ if (taskMap[tIndex].task.calendar) {
5077
+ if (taskMap[tIndex].task.calendar.off_days && taskMap[tIndex].task.calendar.off_days.length) {
5078
+ for (var d = 0; d < taskMap[tIndex].task.calendar.off_days.length || 0; d++) {
5079
+ for (var w = startWeek; w <= endWeek; w++) {
5080
+ var dayOfTheWeek = taskMap[tIndex].task.calendar.off_days[d];
5081
+ var offDay = 86400000 * (7 * w - 4 + dayOfTheWeek);
5082
+
5083
+ if (offDay >= start && offDay <= end) {
5084
+ offTime.push(offDay);
5085
+ }
5086
+ }
5087
+ }
5088
+ }
5089
+
5090
+ if (taskMap[tIndex].task.calendar.holidays && taskMap[tIndex].task.calendar.holidays.length) {
5091
+ for (var h = 0; h < taskMap[tIndex].task.calendar.holidays.length || 0; h++) {
5092
+ var holiday = taskMap[tIndex].task.calendar.holidays[h];
5093
+ var holiday_timestamp = new Date(holiday).getTime();
5094
+
5095
+ if (holiday_timestamp >= start && holiday_timestamp <= end) {
5096
+ offTime.push(holiday_timestamp);
5097
+ }
5098
+ }
5099
+ }
5100
+ }
5101
+
5102
+ return offTime;
5103
+ }
5104
+
4871
5105
  function computeCriticalPath(taskID, taskMap) {
4872
5106
  var task = taskMap[taskID].task;
4873
5107
  var dependents = taskMap[taskID].dependents;
4874
5108
  taskMap[taskID].start = task.start.getTime();
4875
5109
  taskMap[taskID].end = task.end.getTime();
4876
5110
  taskMap[taskID].paths = [];
5111
+ var parent_off_time = getOffTime$1(taskID, taskMap, taskMap[taskID].start, taskMap[taskID].end);
4877
5112
 
4878
5113
  for (var j = 0; j < dependents.length; j++) {
4879
5114
  var depStart = taskMap[dependents[j]].task.start.getTime();
4880
5115
  var depEnd = taskMap[dependents[j]].task.end.getTime();
4881
5116
  var depDuration = depEnd - depStart;
4882
- var startWeek = Math.floor((depStart / 86400000 + 4) / 7);
4883
- var endWeek = Math.floor((depEnd / 86400000 + 4) / 7);
4884
- var offTime = 0;
4885
-
4886
- if (taskMap[dependents[j]].task.calendar) {
4887
- if (taskMap[dependents[j]].task.calendar.off_days && taskMap[dependents[j]].task.calendar.off_days.length) {
4888
- for (var d = 0; d < taskMap[dependents[j]].task.calendar.off_days.length || 0; d++) {
4889
- for (var w = startWeek; w <= endWeek; w++) {
4890
- var dayOfTheWeek = taskMap[dependents[j]].task.calendar.off_days[d];
4891
- var offDay = 86400000 * (7 * w - 4 + dayOfTheWeek);
4892
-
4893
- if (offDay >= depStart && offDay <= depEnd && (offDay > taskMap[taskID].end || taskMap[taskID].task.calendar.off_days.includes(dayOfTheWeek))) {
4894
- offTime += 86400000;
4895
- }
4896
- }
4897
- }
4898
- }
4899
-
4900
- if (taskMap[dependents[j]].task.calendar.holidays && taskMap[dependents[j]].task.calendar.holidays.length) {
4901
- for (var h = 0; h < taskMap[dependents[j]].task.calendar.holidays.length || 0; h++) {
4902
- var holiday = taskMap[dependents[j]].task.calendar.holidays[h];
5117
+ var child_off_time = getOffTime$1(dependents[j], taskMap, depStart, depEnd);
5118
+ var overlap = Math.max(taskMap[taskID].end - depStart, 0);
4903
5119
 
4904
- if (holiday >= depStart && holiday <= depEnd) {
4905
- offTime += 86400000;
4906
- }
4907
- }
5120
+ for (var t = 0; t < parent_off_time.length; t++) {
5121
+ if (child_off_time.includes(parent_off_time[t])) {
5122
+ parent_off_time.splice(t, 1);
5123
+ t -= 1;
4908
5124
  }
4909
5125
  }
4910
5126
 
4911
- var overlap = Math.max(taskMap[taskID].end - depStart, 0);
5127
+ var offTime = parent_off_time.length + child_off_time.length;
4912
5128
  var paths = taskMap[dependents[j]].paths;
4913
5129
 
4914
5130
  if (paths && paths.length) {
4915
5131
  for (var k = 0; k < paths.length; k++) {
4916
- var totalDuration = taskMap[taskID].end - taskMap[taskID].start - overlap - offTime + paths[k].duration;
5132
+ var totalDuration = taskMap[taskID].end - taskMap[taskID].start - overlap - parent_off_time.length * 86400000 + paths[k].duration;
4917
5133
 
4918
5134
  if (taskMap[taskID].paths.length < 2) {
4919
5135
  taskMap[taskID].paths.push({
@@ -4935,7 +5151,7 @@ function computeCriticalPath(taskID, taskMap) {
4935
5151
  }
4936
5152
  }
4937
5153
  } else {
4938
- var immediateChildDuration = taskMap[taskID].end - taskMap[taskID].start + depDuration - overlap - offTime;
5154
+ var immediateChildDuration = taskMap[taskID].end - taskMap[taskID].start + depDuration - overlap - offTime * 86400000;
4939
5155
 
4940
5156
  if (taskMap[taskID].paths.length < 2) {
4941
5157
  taskMap[taskID].paths.push({
@@ -4965,22 +5181,28 @@ function uncolorAll(tasks) {
4965
5181
  });
4966
5182
  }
4967
5183
  function colorPath(path, color, tasks, criticalPathType) {
4968
- for (var i = 0; i < path.length; i++) {
4969
- var longestIDLength = 0;
4970
- var longestTask = void 0;
5184
+ var byId = new Map();
4971
5185
 
4972
- for (var j = 0; j < tasks.length; j++) {
4973
- if (path[i].id === tasks[j].id) {
4974
- longestTask = tasks[j];
4975
- break;
4976
- }
5186
+ for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
5187
+ var task = _step.value;
5188
+ byId.set(task.id, task);
5189
+ }
4977
5190
 
4978
- if (path[i].id.startsWith(tasks[j].id + ".") && tasks[j].id.length > longestIDLength) {
4979
- longestIDLength = tasks[j].id.length;
4980
- longestTask = tasks[j];
4981
- }
5191
+ var nearest = function nearest(id) {
5192
+ var exact = byId.get(id);
5193
+ if (exact) return exact;
5194
+
5195
+ for (var cut = id.lastIndexOf("."); cut > 0; cut = id.lastIndexOf(".", cut - 1)) {
5196
+ var ancestor = byId.get(id.slice(0, cut));
5197
+ if (ancestor) return ancestor;
4982
5198
  }
4983
5199
 
5200
+ return undefined;
5201
+ };
5202
+
5203
+ for (var i = 0; i < path.length; i++) {
5204
+ var longestTask = nearest(path[i].id);
5205
+
4984
5206
  if (longestTask) {
4985
5207
  var _longestTask$styles;
4986
5208
 
@@ -4992,14 +5214,7 @@ function colorPath(path, color, tasks, criticalPathType) {
4992
5214
  }
4993
5215
 
4994
5216
  var _loop = function _loop(_i9) {
4995
- var taskFromTasks = void 0;
4996
-
4997
- for (var _j2 = 0; _j2 < tasks.length; _j2++) {
4998
- if (path[_i9].id === tasks[_j2].id) {
4999
- taskFromTasks = tasks[_j2];
5000
- break;
5001
- }
5002
- }
5217
+ var taskFromTasks = byId.get(path[_i9].id);
5003
5218
 
5004
5219
  if (taskFromTasks) {
5005
5220
  var arrows = taskFromTasks.criticalPathArrows;