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