@syncfusion/ej2-gantt 20.4.51 → 20.4.52
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/CHANGELOG.md +13 -0
- package/dist/ej2-gantt.min.js +2 -2
- package/dist/ej2-gantt.umd.min.js +2 -2
- package/dist/ej2-gantt.umd.min.js.map +1 -1
- package/dist/es6/ej2-gantt.es2015.js +143 -22
- package/dist/es6/ej2-gantt.es2015.js.map +1 -1
- package/dist/es6/ej2-gantt.es5.js +141 -20
- package/dist/es6/ej2-gantt.es5.js.map +1 -1
- package/dist/global/ej2-gantt.min.js +2 -2
- package/dist/global/ej2-gantt.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +12 -12
- package/src/gantt/actions/dependency.js +1 -1
- package/src/gantt/actions/edit.js +18 -5
- package/src/gantt/actions/taskbar-edit.d.ts +1 -1
- package/src/gantt/actions/taskbar-edit.js +18 -2
- package/src/gantt/base/date-processor.d.ts +1 -1
- package/src/gantt/base/date-processor.js +23 -2
- package/src/gantt/base/gantt.js +2 -0
- package/src/gantt/base/task-processor.d.ts +2 -0
- package/src/gantt/base/task-processor.js +37 -0
- package/src/gantt/renderer/timeline.js +42 -10
|
@@ -631,9 +631,9 @@ class DateProcessor {
|
|
|
631
631
|
* @returns {Date} .
|
|
632
632
|
* @private
|
|
633
633
|
*/
|
|
634
|
-
getStartDate(endDate, duration, durationUnit, ganttProp) {
|
|
634
|
+
getStartDate(endDate, duration, durationUnit, ganttProp, fromValidation) {
|
|
635
635
|
let tempEnd = new Date(endDate.getTime());
|
|
636
|
-
|
|
636
|
+
let startDate = new Date(endDate.getTime());
|
|
637
637
|
let secondDuration = this.getDurationAsSeconds(duration, durationUnit);
|
|
638
638
|
let nonWork = 0;
|
|
639
639
|
let workHours = 0;
|
|
@@ -647,6 +647,12 @@ class DateProcessor {
|
|
|
647
647
|
}
|
|
648
648
|
tempEnd = new Date(startDate.getTime());
|
|
649
649
|
}
|
|
650
|
+
/* To render the milestone in proper date while loading */
|
|
651
|
+
if (fromValidation && ganttProp.isMilestone) {
|
|
652
|
+
startDate.setDate(startDate.getDate() - 1);
|
|
653
|
+
this.parent.dateValidationModule.setTime(this.parent.defaultEndTime, startDate);
|
|
654
|
+
startDate = this.parent.dateValidationModule.checkStartDate(startDate, ganttProp, true);
|
|
655
|
+
}
|
|
650
656
|
return startDate;
|
|
651
657
|
}
|
|
652
658
|
/**
|
|
@@ -708,7 +714,21 @@ class DateProcessor {
|
|
|
708
714
|
this.setTime(this.parent.defaultStartTime, sDate);
|
|
709
715
|
}
|
|
710
716
|
else if (!isNullOrUndefined(duration)) {
|
|
711
|
-
|
|
717
|
+
this.parent.flatData.map((record) => {
|
|
718
|
+
if (record.ganttProperties.taskId == ganttProp.taskId) {
|
|
719
|
+
if ((!isNullOrUndefined(record.parentItem)) && (record.parentItem.taskId)) {
|
|
720
|
+
this.parent.flatData.map((data) => {
|
|
721
|
+
if (data.ganttProperties.taskId === record.parentItem.taskId) {
|
|
722
|
+
if (!isNullOrUndefined(data.ganttProperties.startDate))
|
|
723
|
+
sDate = data.ganttProperties.startDate;
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
else {
|
|
728
|
+
sDate = this.getProjectStartDate(ganttProp);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
});
|
|
712
732
|
}
|
|
713
733
|
}
|
|
714
734
|
else {
|
|
@@ -2900,6 +2920,39 @@ class TaskProcessor extends DateProcessor {
|
|
|
2900
2920
|
task.taskData[this.parent.taskFields.durationUnit] = task.ganttProperties.durationUnit;
|
|
2901
2921
|
}
|
|
2902
2922
|
}
|
|
2923
|
+
setDataSource(data) {
|
|
2924
|
+
let createData = [];
|
|
2925
|
+
let length = data.length;
|
|
2926
|
+
for (var i = 0; i < length; i++) {
|
|
2927
|
+
let record = data[i];
|
|
2928
|
+
createData.push(record);
|
|
2929
|
+
if (!(isNullOrUndefined(data[i][this.parent.taskFields.child]))) {
|
|
2930
|
+
this.setDataSource(data[i][this.parent.taskFields.child]);
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2933
|
+
return createData;
|
|
2934
|
+
}
|
|
2935
|
+
setStartDate(task) {
|
|
2936
|
+
let hierarchicalData = [];
|
|
2937
|
+
if (!isNullOrUndefined(this.parent.taskFields.parentID) && !isNullOrUndefined(this.parent.taskFields.id)) {
|
|
2938
|
+
hierarchicalData = this.setDataSource(this.parent.dataSource);
|
|
2939
|
+
}
|
|
2940
|
+
else {
|
|
2941
|
+
hierarchicalData = this.parent.dataSource;
|
|
2942
|
+
}
|
|
2943
|
+
this.parent.flatData.map((data) => {
|
|
2944
|
+
hierarchicalData.map((record) => {
|
|
2945
|
+
if (data.ganttProperties.taskId === record[this.parent.taskFields.id]) {
|
|
2946
|
+
if (!isNullOrUndefined(this.parent.taskFields.startDate)) {
|
|
2947
|
+
task[this.parent.taskFields.endDate] = record[this.parent.taskFields.endDate];
|
|
2948
|
+
}
|
|
2949
|
+
if (!isNullOrUndefined(this.parent.taskFields.endDate)) {
|
|
2950
|
+
task[this.parent.taskFields.endDate] = record[this.parent.taskFields.endDate];
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
});
|
|
2954
|
+
});
|
|
2955
|
+
}
|
|
2903
2956
|
getWorkInHour(work, workUnit) {
|
|
2904
2957
|
if (workUnit === 'day') {
|
|
2905
2958
|
return work * (this.parent.secondsPerDay / 3600);
|
|
@@ -3191,6 +3244,9 @@ class TaskProcessor extends DateProcessor {
|
|
|
3191
3244
|
if (!isNullOrUndefined(this.parent.taskFields.duration)) {
|
|
3192
3245
|
this.setRecordDuration(ganttData, this.parent.taskFields.duration);
|
|
3193
3246
|
}
|
|
3247
|
+
if (this.parent.isLoad) {
|
|
3248
|
+
this.setStartDate(ganttData);
|
|
3249
|
+
}
|
|
3194
3250
|
this.calculateScheduledValues(ganttData, data, false);
|
|
3195
3251
|
}
|
|
3196
3252
|
this.updateGanttData();
|
|
@@ -5649,6 +5705,9 @@ class Timeline {
|
|
|
5649
5705
|
* @private
|
|
5650
5706
|
*/
|
|
5651
5707
|
changeTimelineSettings(newTimeline) {
|
|
5708
|
+
if (!this.isZoomIn) {
|
|
5709
|
+
this.isSingleTier = newTimeline.topTier.unit === 'None' || newTimeline.bottomTier.unit === 'None' ? true : false;
|
|
5710
|
+
}
|
|
5652
5711
|
const skipProperty = this.isSingleTier ?
|
|
5653
5712
|
this.customTimelineSettings.topTier.unit === 'None' ?
|
|
5654
5713
|
'topTier' : 'bottomTier' : null;
|
|
@@ -5660,7 +5719,9 @@ class Timeline {
|
|
|
5660
5719
|
else {
|
|
5661
5720
|
const value = property === 'topTier' ? 'bottomTier' : 'topTier';
|
|
5662
5721
|
const assignValue = 'bottomTier';
|
|
5663
|
-
|
|
5722
|
+
if (newTimeline[assignValue].unit != "None") {
|
|
5723
|
+
this.customTimelineSettings[value] = Object.assign({}, newTimeline[assignValue]);
|
|
5724
|
+
}
|
|
5664
5725
|
}
|
|
5665
5726
|
});
|
|
5666
5727
|
this.parent.isTimelineRoundOff = this.isZoomToFit ? false : isNullOrUndefined(this.parent.projectStartDate) ? true : false;
|
|
@@ -5894,7 +5955,9 @@ class Timeline {
|
|
|
5894
5955
|
this.customTimelineSettings.bottomTier.count : this.customTimelineSettings.topTier.count;
|
|
5895
5956
|
const unit = this.customTimelineSettings.bottomTier.unit !== 'None' ?
|
|
5896
5957
|
this.customTimelineSettings.bottomTier.unit : this.customTimelineSettings.topTier.unit;
|
|
5897
|
-
const
|
|
5958
|
+
const tier = this.customTimelineSettings.bottomTier.unit !== 'None' ?
|
|
5959
|
+
"bottomTier" : "topTier";
|
|
5960
|
+
const zoomLevel = this.getCurrentZoomingLevel(unit, count, tier);
|
|
5898
5961
|
if (this.parent.toolbarModule) {
|
|
5899
5962
|
if (zoomLevel === this.parent.zoomingLevels[this.parent.zoomingLevels.length - 1].level) {
|
|
5900
5963
|
this.parent.toolbarModule.enableItems([this.parent.controlId + '_zoomin'], false);
|
|
@@ -5912,7 +5975,7 @@ class Timeline {
|
|
|
5912
5975
|
* @returns {number} .
|
|
5913
5976
|
* @private
|
|
5914
5977
|
*/
|
|
5915
|
-
getCurrentZoomingLevel(unit, count) {
|
|
5978
|
+
getCurrentZoomingLevel(unit, count, tier) {
|
|
5916
5979
|
let level;
|
|
5917
5980
|
let currentZoomCollection;
|
|
5918
5981
|
let checkSameCountLevels;
|
|
@@ -5922,15 +5985,32 @@ class Timeline {
|
|
|
5922
5985
|
this.parent.zoomingLevels = this.parent.getZoomingLevels();
|
|
5923
5986
|
}
|
|
5924
5987
|
let sameUnitLevels = this.parent.zoomingLevels.filter((tempLevel) => {
|
|
5925
|
-
|
|
5988
|
+
if (tier === "bottomTier") {
|
|
5989
|
+
return tempLevel.bottomTier.unit === unit;
|
|
5990
|
+
}
|
|
5991
|
+
else {
|
|
5992
|
+
return tempLevel.topTier.unit === unit;
|
|
5993
|
+
}
|
|
5926
5994
|
});
|
|
5927
5995
|
if (sameUnitLevels.length === 0) {
|
|
5928
5996
|
const closestUnit = this.getClosestUnit(unit, '', false);
|
|
5929
5997
|
sameUnitLevels = this.parent.zoomingLevels.filter((tempLevel) => {
|
|
5930
|
-
|
|
5998
|
+
if (tier === "bottomTier") {
|
|
5999
|
+
return tempLevel.bottomTier.unit === closestUnit;
|
|
6000
|
+
}
|
|
6001
|
+
else {
|
|
6002
|
+
return tempLevel.topTier.unit === closestUnit;
|
|
6003
|
+
}
|
|
5931
6004
|
});
|
|
5932
6005
|
}
|
|
5933
|
-
const sortedUnitLevels = sameUnitLevels.sort((a, b) =>
|
|
6006
|
+
const sortedUnitLevels = sameUnitLevels.sort((a, b) => {
|
|
6007
|
+
if (tier === "bottomTier") {
|
|
6008
|
+
return (a.bottomTier.count < b.bottomTier.count) ? 1 : -1;
|
|
6009
|
+
}
|
|
6010
|
+
else {
|
|
6011
|
+
return (a.topTier.count < b.topTier.count) ? 1 : -1;
|
|
6012
|
+
}
|
|
6013
|
+
});
|
|
5934
6014
|
for (let i = 0; i < sortedUnitLevels.length; i++) {
|
|
5935
6015
|
firstValue = sortedUnitLevels[i];
|
|
5936
6016
|
if (i === sortedUnitLevels.length - 1) {
|
|
@@ -5940,10 +6020,15 @@ class Timeline {
|
|
|
5940
6020
|
else {
|
|
5941
6021
|
secondValue = sortedUnitLevels[i + 1];
|
|
5942
6022
|
}
|
|
5943
|
-
if (count >= firstValue.
|
|
6023
|
+
if (count >= firstValue[tier].count) {
|
|
5944
6024
|
currentZoomCollection = sortedUnitLevels[i];
|
|
5945
6025
|
checkSameCountLevels = sortedUnitLevels.filter((tempLevel) => {
|
|
5946
|
-
|
|
6026
|
+
if (tier === "bottomTier") {
|
|
6027
|
+
return tempLevel.bottomTier.count === currentZoomCollection.bottomTier.count;
|
|
6028
|
+
}
|
|
6029
|
+
else {
|
|
6030
|
+
return tempLevel.topTier.count === currentZoomCollection.topTier.count;
|
|
6031
|
+
}
|
|
5947
6032
|
});
|
|
5948
6033
|
if (checkSameCountLevels.length > 1) {
|
|
5949
6034
|
level = this.checkCollectionsWidth(checkSameCountLevels);
|
|
@@ -5953,10 +6038,15 @@ class Timeline {
|
|
|
5953
6038
|
}
|
|
5954
6039
|
break;
|
|
5955
6040
|
}
|
|
5956
|
-
else if (count < firstValue.
|
|
6041
|
+
else if (count < firstValue[tier].count && count > secondValue[tier].count) {
|
|
5957
6042
|
currentZoomCollection = sortedUnitLevels[i + 1];
|
|
5958
6043
|
checkSameCountLevels = sortedUnitLevels.filter((tempLevel) => {
|
|
5959
|
-
|
|
6044
|
+
if (tier === "bottomTier") {
|
|
6045
|
+
return tempLevel.bottomTier.count === currentZoomCollection.bottomTier.count;
|
|
6046
|
+
}
|
|
6047
|
+
else {
|
|
6048
|
+
return tempLevel.topTier.count === currentZoomCollection.topTier.count;
|
|
6049
|
+
}
|
|
5960
6050
|
});
|
|
5961
6051
|
if (checkSameCountLevels.length > 1) {
|
|
5962
6052
|
level = this.checkCollectionsWidth(checkSameCountLevels);
|
|
@@ -10770,7 +10860,7 @@ class Dependency {
|
|
|
10770
10860
|
const offsetValue = predecessor.offset;
|
|
10771
10861
|
const durationUnit = predecessor.offsetUnit;
|
|
10772
10862
|
if (offsetValue < 0) {
|
|
10773
|
-
resultDate = this.dateValidateModule.getStartDate(this.dateValidateModule.checkEndDate(date, record), (offsetValue * -1), durationUnit, record);
|
|
10863
|
+
resultDate = this.dateValidateModule.getStartDate(this.dateValidateModule.checkEndDate(date, record), (offsetValue * -1), durationUnit, record, true);
|
|
10774
10864
|
}
|
|
10775
10865
|
else {
|
|
10776
10866
|
resultDate = this.dateValidateModule.getEndDate(date, offsetValue, durationUnit, record, false);
|
|
@@ -14270,6 +14360,7 @@ let Gantt = class Gantt extends Component {
|
|
|
14270
14360
|
case 'dayWorkingTime':
|
|
14271
14361
|
case 'allowUnscheduledTasks':
|
|
14272
14362
|
case 'holidays':
|
|
14363
|
+
this.isLoad = true;
|
|
14273
14364
|
if (prop === 'holidays') {
|
|
14274
14365
|
this.totalHolidayDates = this.dataOperation.getHolidayDates();
|
|
14275
14366
|
this.notify('ui-update', { module: 'day-markers', properties: newProp });
|
|
@@ -14278,6 +14369,7 @@ let Gantt = class Gantt extends Component {
|
|
|
14278
14369
|
this.treeGrid.refreshColumns();
|
|
14279
14370
|
this.chartRowsModule.initiateTemplates();
|
|
14280
14371
|
this.chartRowsModule.refreshGanttRows();
|
|
14372
|
+
this.isLoad = false;
|
|
14281
14373
|
break;
|
|
14282
14374
|
case 'addDialogFields':
|
|
14283
14375
|
case 'editDialogFields':
|
|
@@ -17946,6 +18038,16 @@ class TaskbarEdit extends DateProcessor {
|
|
|
17946
18038
|
merge(this.taskBarEditRecord.ganttProperties, arg.previousData);
|
|
17947
18039
|
}
|
|
17948
18040
|
});
|
|
18041
|
+
this.parent.flatData.map((data) => {
|
|
18042
|
+
if ((!isNullOrUndefined(this.taskBarEditRecord.parentItem)) && data.ganttProperties.taskId === this.taskBarEditRecord.parentItem.taskId) {
|
|
18043
|
+
data.childRecords.map((s) => {
|
|
18044
|
+
if (isNullOrUndefined(s.ganttProperties.startDate) || isNullOrUndefined(s.ganttProperties.endDate) ||
|
|
18045
|
+
isNullOrUndefined(s.ganttProperties.duration)) {
|
|
18046
|
+
this.parent.dataOperation.updateGanttData();
|
|
18047
|
+
}
|
|
18048
|
+
});
|
|
18049
|
+
}
|
|
18050
|
+
});
|
|
17949
18051
|
}
|
|
17950
18052
|
}
|
|
17951
18053
|
/**
|
|
@@ -18498,7 +18600,7 @@ class TaskbarEdit extends DateProcessor {
|
|
|
18498
18600
|
}
|
|
18499
18601
|
updateChildDrag(item) {
|
|
18500
18602
|
const left = this.getRoundOffStartLeft(item, this.roundOffDuration);
|
|
18501
|
-
const projectStartDate = this.getDateByLeft(left);
|
|
18603
|
+
const projectStartDate = this.getDateByLeft(left, item.isMilestone, item);
|
|
18502
18604
|
let endDate;
|
|
18503
18605
|
if (this.segmentIndex === 0) {
|
|
18504
18606
|
this.parent.setRecordValue('startDate', this.parent.dateValidationModule.checkStartDate(projectStartDate, item, null), item, true);
|
|
@@ -18721,10 +18823,16 @@ class TaskbarEdit extends DateProcessor {
|
|
|
18721
18823
|
* @returns {Date} .
|
|
18722
18824
|
* @private
|
|
18723
18825
|
*/
|
|
18724
|
-
getDateByLeft(left) {
|
|
18725
|
-
|
|
18826
|
+
getDateByLeft(left, isMilestone, property) {
|
|
18827
|
+
let pStartDate = new Date(this.parent.timelineModule.timelineStartDate.toString());
|
|
18726
18828
|
const milliSecondsPerPixel = (24 * 60 * 60 * 1000) / this.parent.perDayWidth;
|
|
18727
18829
|
pStartDate.setTime(pStartDate.getTime() + (left * milliSecondsPerPixel));
|
|
18830
|
+
/* To render the milestone in proper date while editing */
|
|
18831
|
+
if (isMilestone) {
|
|
18832
|
+
pStartDate.setDate(pStartDate.getDate() - 1);
|
|
18833
|
+
this.parent.dateValidationModule.setTime(this.parent.defaultEndTime, pStartDate);
|
|
18834
|
+
pStartDate = this.parent.dateValidationModule.checkStartDate(pStartDate, property, true);
|
|
18835
|
+
}
|
|
18728
18836
|
const tierMode = this.parent.timelineModule.bottomTier !== 'None' ? this.parent.timelineModule.topTier :
|
|
18729
18837
|
this.parent.timelineModule.bottomTier;
|
|
18730
18838
|
if (tierMode !== 'Hour' && tierMode !== 'Minutes') {
|
|
@@ -23658,7 +23766,7 @@ class Edit$2 {
|
|
|
23658
23766
|
durationDiff = this.parent.dateValidationModule.getDuration(validStartDate, validEndDate, 'minute', true, false);
|
|
23659
23767
|
}
|
|
23660
23768
|
for (let i = 0; i < childRecords.length; i++) {
|
|
23661
|
-
if (childRecords[i].ganttProperties.isAutoSchedule) {
|
|
23769
|
+
if ((!(this.parent.isUnscheduledTask(childRecords[i].ganttProperties))) && (childRecords[i].ganttProperties.isAutoSchedule)) {
|
|
23662
23770
|
if (durationDiff > 0) {
|
|
23663
23771
|
const startDate = isScheduledTask(childRecords[i].ganttProperties) ?
|
|
23664
23772
|
childRecords[i].ganttProperties.startDate : childRecords[i].ganttProperties.startDate ?
|
|
@@ -23686,6 +23794,7 @@ class Edit$2 {
|
|
|
23686
23794
|
}
|
|
23687
23795
|
if (childRecords.length) {
|
|
23688
23796
|
this.parent.dataOperation.updateParentItems(ganttRecord, true);
|
|
23797
|
+
this.parent.dataOperation.updateGanttData();
|
|
23689
23798
|
}
|
|
23690
23799
|
}
|
|
23691
23800
|
/**
|
|
@@ -23764,9 +23873,21 @@ class Edit$2 {
|
|
|
23764
23873
|
});
|
|
23765
23874
|
}
|
|
23766
23875
|
dmSuccess(e, args) {
|
|
23767
|
-
let eLength
|
|
23876
|
+
let eLength;
|
|
23877
|
+
let rec;
|
|
23878
|
+
if (e.changedRecords) {
|
|
23879
|
+
eLength = e.changedRecords['length'];
|
|
23880
|
+
}
|
|
23881
|
+
else {
|
|
23882
|
+
eLength = e['length'];
|
|
23883
|
+
}
|
|
23768
23884
|
for (let i = 0; i < eLength; i++) {
|
|
23769
|
-
|
|
23885
|
+
if (e.changedRecords) {
|
|
23886
|
+
rec = e.changedRecords[i];
|
|
23887
|
+
}
|
|
23888
|
+
else {
|
|
23889
|
+
rec = e[i];
|
|
23890
|
+
}
|
|
23770
23891
|
let _aLength = Object.keys(rec).length;
|
|
23771
23892
|
for (let j = 0, _a = Object.keys(rec); j < _aLength; j++) {
|
|
23772
23893
|
let key = _a[j];
|
|
@@ -25416,9 +25537,9 @@ class Edit$2 {
|
|
|
25416
25537
|
const crud = data.saveChanges(updatedData, this.parent.taskFields.id, null, query);
|
|
25417
25538
|
crud.then((e) => {
|
|
25418
25539
|
if (this.parent.taskFields.id && !isNullOrUndefined(e.addedRecords[0][this.parent.taskFields.id]) &&
|
|
25419
|
-
e.addedRecords[0][this.parent.taskFields.id].toString()
|
|
25540
|
+
e.addedRecords[0][this.parent.taskFields.id].toString() == prevID) {
|
|
25420
25541
|
this.parent.setRecordValue('taskId', e.addedRecords[0][this.parent.taskFields.id], args.data.ganttProperties, true);
|
|
25421
|
-
this.parent.setRecordValue('taskData
|
|
25542
|
+
this.parent.setRecordValue('taskData', e.addedRecords[0], args.data);
|
|
25422
25543
|
this.parent.setRecordValue(this.parent.taskFields.id, e.addedRecords[0][this.parent.taskFields.id], args.data);
|
|
25423
25544
|
this.parent.setRecordValue('rowUniqueID', e.addedRecords[0][this.parent.taskFields.id].toString(), args.data.ganttProperties, true);
|
|
25424
25545
|
const idsIndex = this.parent.ids.indexOf(prevID);
|