@syncfusion/ej2-gantt 20.4.38 → 20.4.40

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.
@@ -2580,7 +2580,7 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2580
2580
  }
2581
2581
  else if (endDate) {
2582
2582
  sDate = new Date(endDate.getTime());
2583
- milestone = true;
2583
+ milestone = isNullOrUndefined(startDate) && this.parent.allowUnscheduledTasks ? false : true;
2584
2584
  }
2585
2585
  else {
2586
2586
  sDate = this.getValidStartDate(ganttProp);
@@ -2703,6 +2703,9 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2703
2703
  else if (isMilestone && this.getSecondsInDecimal(date) === this.parent.defaultEndTime) {
2704
2704
  date.setHours(24);
2705
2705
  }
2706
+ else if (this.getSecondsInDecimal(date) === this.parent.defaultEndTime && this.parent.allowUnscheduledTasks) {
2707
+ date.setHours(22);
2708
+ }
2706
2709
  }
2707
2710
  var timelineStartDate = this.parent.timelineModule.timelineStartDate;
2708
2711
  if (timelineStartDate) {
@@ -3682,7 +3685,12 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
3682
3685
  durationInDay = (childGanttRecord.ganttProperties.duration / (this.parent.secondsPerDay / 60));
3683
3686
  break;
3684
3687
  default:
3685
- durationInDay = childGanttRecord.ganttProperties.duration;
3688
+ if (childGanttRecord.ganttProperties.duration < 1) {
3689
+ durationInDay = (childGanttRecord.ganttProperties.duration / (this.parent.secondsPerDay / 3600));
3690
+ }
3691
+ else {
3692
+ durationInDay = childGanttRecord.ganttProperties.duration;
3693
+ }
3686
3694
  }
3687
3695
  if (childGanttRecord.hasChildRecords) {
3688
3696
  setValue('totalProgress', childGanttRecord.ganttProperties.totalProgress, progressValues);
@@ -3759,7 +3767,13 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
3759
3767
  if (!childData.ganttProperties.isMilestone && isScheduledTask(childData.ganttProperties)) {
3760
3768
  progressValues = this.getParentProgress(childData);
3761
3769
  totalProgress += getValue('totalProgress', progressValues);
3762
- totalDuration += getValue('totalDuration', progressValues);
3770
+ if (childData[this.parent.taskFields.duration] < 1) {
3771
+ totalDuration += getValue('totalDuration', progressValues);
3772
+ totalDuration = Number(totalDuration.toFixed(4));
3773
+ }
3774
+ else {
3775
+ totalDuration += getValue('totalDuration', progressValues);
3776
+ }
3763
3777
  }
3764
3778
  else {
3765
3779
  milestoneCount++;
@@ -5573,7 +5587,7 @@ var Timeline = /** @__PURE__ @class */ (function () {
5573
5587
  this.totalTimelineWidth = 0;
5574
5588
  this.customTimelineSettings = null;
5575
5589
  this.parent.isTimelineRoundOff = this.isZoomToFit ? false : isNullOrUndefined(this.parent.projectStartDate) ? true : false;
5576
- if (this.parent.enablePersistence) {
5590
+ if (this.parent.enablePersistence && this.parent.isLoad) {
5577
5591
  this.parent.timelineSettings = this.parent.currentZoomingLevel;
5578
5592
  }
5579
5593
  };
@@ -9907,6 +9921,7 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
9907
9921
  }
9908
9922
  this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData);
9909
9923
  }
9924
+ this.parent.ganttChartModule.updateLastRowBottomWidth();
9910
9925
  };
9911
9926
  /**
9912
9927
  * To render taskbars.
@@ -10015,9 +10030,9 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10015
10030
  }
10016
10031
  if (this.parent.renderBaseline && this.templateData.ganttProperties.baselineStartDate &&
10017
10032
  this.templateData.ganttProperties.baselineEndDate) {
10018
- taskBaselineTemplateNode = ((!isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate) && !isNullOrUndefined(this.templateData.ganttProperties.startDate) && (this.templateData.ganttProperties.baselineStartDate.getTime() === this.templateData.ganttProperties.startDate.getTime()))
10033
+ taskBaselineTemplateNode = ((this.templateData.ganttProperties.baselineStartDate.getTime() === this.templateData.ganttProperties.baselineEndDate.getTime()) || ((!isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate) && !isNullOrUndefined(this.templateData.ganttProperties.startDate) && (this.templateData.ganttProperties.baselineStartDate.getTime() === this.templateData.ganttProperties.startDate.getTime()))
10019
10034
  && (!isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate) && !isNullOrUndefined(this.templateData.ganttProperties.endDate) && (this.templateData.ganttProperties.baselineEndDate.toLocaleDateString() === this.templateData.ganttProperties.endDate.toLocaleDateString())) &&
10020
- this.templateData.ganttProperties.isMilestone)
10035
+ this.templateData.ganttProperties.isMilestone))
10021
10036
  ? this.getMilestoneBaselineNode() : this.getTaskBaselineNode();
10022
10037
  }
10023
10038
  }
@@ -10028,9 +10043,9 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10028
10043
  }
10029
10044
  if (this.parent.renderBaseline && this.templateData.ganttProperties.baselineStartDate &&
10030
10045
  this.templateData.ganttProperties.baselineEndDate) {
10031
- taskBaselineTemplateNode = ((!isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate) && !isNullOrUndefined(this.templateData.ganttProperties.startDate) && (this.templateData.ganttProperties.baselineStartDate.getTime() === this.templateData.ganttProperties.startDate.getTime()))
10046
+ taskBaselineTemplateNode = ((this.templateData.ganttProperties.baselineStartDate.getTime() === this.templateData.ganttProperties.baselineEndDate.getTime()) || ((!isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate) && !isNullOrUndefined(this.templateData.ganttProperties.startDate) && (this.templateData.ganttProperties.baselineStartDate.getTime() === this.templateData.ganttProperties.startDate.getTime()))
10032
10047
  && (!isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate) && !isNullOrUndefined(this.templateData.ganttProperties.endDate) && (this.templateData.ganttProperties.baselineEndDate.toLocaleDateString() === this.templateData.ganttProperties.endDate.toLocaleDateString())) &&
10033
- this.templateData.ganttProperties.isMilestone)
10048
+ this.templateData.ganttProperties.isMilestone))
10034
10049
  ? this.getMilestoneBaselineNode() : this.getTaskBaselineNode();
10035
10050
  }
10036
10051
  }
@@ -10076,9 +10091,9 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10076
10091
  }
10077
10092
  if (this.parent.renderBaseline && this.templateData.ganttProperties.baselineStartDate &&
10078
10093
  this.templateData.ganttProperties.baselineEndDate) {
10079
- taskBaselineTemplateNode = ((!isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate) && !isNullOrUndefined(this.templateData.ganttProperties.startDate) && (this.templateData.ganttProperties.baselineStartDate.getTime() === this.templateData.ganttProperties.startDate.getTime()))
10094
+ taskBaselineTemplateNode = ((this.templateData.ganttProperties.baselineStartDate.getTime() === this.templateData.ganttProperties.baselineEndDate.getTime()) || ((!isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate) && !isNullOrUndefined(this.templateData.ganttProperties.startDate) && (this.templateData.ganttProperties.baselineStartDate.getTime() === this.templateData.ganttProperties.startDate.getTime()))
10080
10095
  && (!isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate) && !isNullOrUndefined(this.templateData.ganttProperties.endDate) && (this.templateData.ganttProperties.baselineEndDate.toLocaleDateString() === this.templateData.ganttProperties.endDate.toLocaleDateString())) &&
10081
- this.templateData.ganttProperties.isMilestone)
10096
+ this.templateData.ganttProperties.isMilestone))
10082
10097
  ? this.getMilestoneBaselineNode() : this.getTaskBaselineNode();
10083
10098
  }
10084
10099
  }
@@ -10178,6 +10193,10 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10178
10193
  var taskbarElement = !isNullOrUndefined(data.ganttProperties.segments) && data.ganttProperties.segments.length > 0 ? trElement :
10179
10194
  trElement.querySelector('.' + taskBarMainContainer);
10180
10195
  var rowElement;
10196
+ var segmentRowElement;
10197
+ if (data.ganttProperties.segments && data.ganttProperties.segments.length > 0) {
10198
+ segmentRowElement = trElement.parentElement.parentElement.parentElement;
10199
+ }
10181
10200
  var triggerTaskbarElement;
10182
10201
  var args = {
10183
10202
  data: data,
@@ -10190,7 +10209,8 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10190
10209
  args.milestoneColor = taskbarElement.querySelector(classCollections[0]) ?
10191
10210
  getComputedStyle(taskbarElement.querySelector(classCollections[0])).borderBottomColor : null;
10192
10211
  args.baselineColor = trElement.querySelector(classCollections[1]) ?
10193
- getComputedStyle(trElement.querySelector(classCollections[1])).borderBottomColor : null;
10212
+ getComputedStyle(trElement.querySelector(classCollections[1])).borderBottomColor :
10213
+ (trElement.querySelector('.' + baselineBar) ? getComputedStyle(trElement.querySelector('.' + baselineBar)).backgroundColor : null);
10194
10214
  }
10195
10215
  else {
10196
10216
  var childTask = taskbarElement.querySelector(classCollections[0]);
@@ -10207,17 +10227,33 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10207
10227
  getComputedStyle(taskbarElement.querySelector(classCollections[1])).backgroundColor;
10208
10228
  // args.progressBarBorderColor = taskbarElement.querySelector(progressBarClass) ?
10209
10229
  // getComputedStyle(taskbarElement.querySelector(progressBarClass)).borderColor : null;
10210
- args.baselineColor = trElement.querySelector('.' + baselineBar) ?
10211
- getComputedStyle(trElement.querySelector('.' + baselineBar)).backgroundColor : null;
10230
+ if (segmentRowElement) {
10231
+ args.baselineColor = segmentRowElement.querySelector('.' + baselineBar) ?
10232
+ getComputedStyle(segmentRowElement.querySelector('.' + baselineBar)).backgroundColor : null;
10233
+ }
10234
+ else {
10235
+ args.baselineColor = trElement.querySelector('.' + baselineBar) ?
10236
+ getComputedStyle(trElement.querySelector('.' + baselineBar)).backgroundColor : null;
10237
+ }
10212
10238
  args.taskLabelColor = taskbarElement.querySelector('.' + taskLabel) ?
10213
10239
  getComputedStyle(taskbarElement.querySelector('.' + taskLabel)).color : null;
10214
10240
  }
10215
- args.rightLabelColor = trElement.querySelector('.' + rightLabelContainer) &&
10216
- (trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label) ?
10217
- getComputedStyle((trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label)).color : null;
10218
- args.leftLabelColor = trElement.querySelector('.' + leftLabelContainer) &&
10219
- (trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label) ?
10220
- getComputedStyle((trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label)).color : null;
10241
+ if (segmentRowElement) {
10242
+ args.rightLabelColor = segmentRowElement.querySelector('.' + rightLabelContainer) &&
10243
+ (segmentRowElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label) ?
10244
+ getComputedStyle((segmentRowElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label)).color : null;
10245
+ args.leftLabelColor = segmentRowElement.querySelector('.' + leftLabelContainer) &&
10246
+ (segmentRowElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label) ?
10247
+ getComputedStyle((segmentRowElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label)).color : null;
10248
+ }
10249
+ else {
10250
+ args.rightLabelColor = trElement.querySelector('.' + rightLabelContainer) &&
10251
+ (trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label) ?
10252
+ getComputedStyle((trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label)).color : null;
10253
+ args.leftLabelColor = trElement.querySelector('.' + leftLabelContainer) &&
10254
+ (trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label) ?
10255
+ getComputedStyle((trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label)).color : null;
10256
+ }
10221
10257
  this.parent.trigger('queryTaskbarInfo', args, function (taskbarArgs) {
10222
10258
  _this.updateQueryTaskbarInfoArgs(taskbarArgs, rowElement, triggerTaskbarElement);
10223
10259
  });
@@ -10235,6 +10271,10 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10235
10271
  var trElement = args.rowElement;
10236
10272
  var taskbarElement = args.taskbarElement;
10237
10273
  var classCollections = this.getClassName(args);
10274
+ var segmentRowElement;
10275
+ if (args.data.ganttProperties.segments && args.data.ganttProperties.segments.length > 0) {
10276
+ segmentRowElement = trElement.parentElement.parentElement.parentElement;
10277
+ }
10238
10278
  if (args.taskbarType === 'Milestone') {
10239
10279
  if (taskbarElement.querySelector(classCollections[0]) &&
10240
10280
  getComputedStyle(taskbarElement.querySelector(classCollections[0])).borderBottomColor !== args.milestoneColor) {
@@ -10246,6 +10286,10 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10246
10286
  trElement.querySelector(classCollections[1]).style.borderBottomColor = args.baselineColor;
10247
10287
  trElement.querySelector('.' + baselineMilestoneBottom).style.borderTopColor = args.baselineColor;
10248
10288
  }
10289
+ if (trElement.querySelector('.' + baselineBar) &&
10290
+ getComputedStyle(trElement.querySelector('.' + baselineBar)).borderTopColor !== args.baselineColor) {
10291
+ trElement.querySelector('.' + baselineBar).style.backgroundColor = args.baselineColor;
10292
+ }
10249
10293
  }
10250
10294
  else {
10251
10295
  if (taskbarElement.querySelector(classCollections[0]) &&
@@ -10280,20 +10324,42 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10280
10324
  getComputedStyle(taskbarElement.querySelector('.' + taskLabel)).color !== args.taskLabelColor) {
10281
10325
  taskbarElement.querySelector('.' + taskLabel).style.color = args.taskLabelColor;
10282
10326
  }
10283
- if (trElement.querySelector('.' + baselineBar) &&
10284
- getComputedStyle(trElement.querySelector('.' + baselineBar)).backgroundColor !== args.baselineColor) {
10285
- trElement.querySelector('.' + baselineBar).style.backgroundColor = args.baselineColor;
10327
+ if (segmentRowElement) {
10328
+ if (segmentRowElement.querySelector('.' + baselineBar) &&
10329
+ getComputedStyle(segmentRowElement.querySelector('.' + baselineBar)).backgroundColor !== args.baselineColor) {
10330
+ segmentRowElement.querySelector('.' + baselineBar).style.backgroundColor = args.baselineColor;
10331
+ }
10332
+ }
10333
+ else {
10334
+ if (trElement.querySelector('.' + baselineBar) &&
10335
+ getComputedStyle(trElement.querySelector('.' + baselineBar)).backgroundColor !== args.baselineColor) {
10336
+ trElement.querySelector('.' + baselineBar).style.backgroundColor = args.baselineColor;
10337
+ }
10286
10338
  }
10287
10339
  }
10288
- if (trElement.querySelector('.' + leftLabelContainer) &&
10289
- (trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label) &&
10290
- getComputedStyle((trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label)).color !== args.leftLabelColor) {
10291
- (trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label).style.color = args.leftLabelColor;
10340
+ if (segmentRowElement) {
10341
+ if (segmentRowElement.querySelector('.' + leftLabelContainer) &&
10342
+ (segmentRowElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label) &&
10343
+ getComputedStyle((segmentRowElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label)).color !== args.leftLabelColor) {
10344
+ (segmentRowElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label).style.color = args.leftLabelColor;
10345
+ }
10346
+ if (segmentRowElement.querySelector('.' + rightLabelContainer) &&
10347
+ (segmentRowElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label) &&
10348
+ getComputedStyle((segmentRowElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label)).color !== args.rightLabelColor) {
10349
+ (segmentRowElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label).style.color = args.rightLabelColor;
10350
+ }
10292
10351
  }
10293
- if (trElement.querySelector('.' + rightLabelContainer) &&
10294
- (trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label) &&
10295
- getComputedStyle((trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label)).color !== args.rightLabelColor) {
10296
- (trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label).style.color = args.rightLabelColor;
10352
+ else {
10353
+ if (trElement.querySelector('.' + leftLabelContainer) &&
10354
+ (trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label) &&
10355
+ getComputedStyle((trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label)).color !== args.leftLabelColor) {
10356
+ (trElement.querySelector('.' + leftLabelContainer)).querySelector('.' + label).style.color = args.leftLabelColor;
10357
+ }
10358
+ if (trElement.querySelector('.' + rightLabelContainer) &&
10359
+ (trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label) &&
10360
+ getComputedStyle((trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label)).color !== args.rightLabelColor) {
10361
+ (trElement.querySelector('.' + rightLabelContainer)).querySelector('.' + label).style.color = args.rightLabelColor;
10362
+ }
10297
10363
  }
10298
10364
  };
10299
10365
  ChartRows.prototype.getClassName = function (args) {
@@ -10904,9 +10970,9 @@ var Dependency = /** @__PURE__ @class */ (function () {
10904
10970
  var flatData = this.parent.flatData;
10905
10971
  var totLength = this.parent.flatData.length;
10906
10972
  for (var count = 0; count < totLength; count++) {
10907
- if (flatData[count].ganttProperties.predecessor) {
10973
+ if (flatData[count].ganttProperties.predecessorsName) {
10908
10974
  this.validatePredecessorDates(flatData[count]);
10909
- if (flatData[count].hasChildRecords && this.parent.editModule) {
10975
+ if (flatData[count].hasChildRecords && this.parent.editModule && !this.parent.allowUnscheduledTasks) {
10910
10976
  this.parent.editModule['updateChildItems'](flatData[count]);
10911
10977
  }
10912
10978
  }
@@ -10918,6 +10984,9 @@ var Dependency = /** @__PURE__ @class */ (function () {
10918
10984
  for (var i = parentPredecessorLength - 1; i >= 0; i--) {
10919
10985
  var item = this.parentPredecessors[i];
10920
10986
  this.validatePredecessorDates(item);
10987
+ if (item.ganttProperties.startDate) {
10988
+ this.parent.editModule['updateChildItems'](item);
10989
+ }
10921
10990
  }
10922
10991
  }
10923
10992
  };
@@ -15539,18 +15608,24 @@ var Gantt = /** @__PURE__ @class */ (function (_super) {
15539
15608
  */
15540
15609
  /* eslint-disable-next-line */
15541
15610
  Gantt.prototype.setRecordValue = function (field, value, record, isTaskData) {
15611
+ value = isUndefined(value) ? null : value;
15542
15612
  if (this.isOnEdit || this.isOnDelete) {
15543
15613
  this.makeCloneData(field, record, isTaskData);
15544
- var id = isTaskData ? record.rowUniqueID : record.ganttProperties.rowUniqueID;
15614
+ var ganttData = isTaskData ? record : record.ganttProperties;
15615
+ var id = ganttData.rowUniqueID;
15545
15616
  var task = this.getRecordByID(id);
15546
- if (task && this.editedRecords.indexOf(task) === -1) {
15617
+ var isValid = false;
15618
+ if (isNullOrUndefined(value) || (!isNullOrUndefined(value) && !isNullOrUndefined(ganttData[field]) && (value instanceof Date ? value.getTime() !==
15619
+ ganttData[field].getTime() : ganttData[field] !== value))) {
15620
+ isValid = true;
15621
+ }
15622
+ if (task && ((this.editedRecords.indexOf(task) === -1 && isValid) || this.editedRecords.length === 0)) {
15547
15623
  this.editedRecords.push(task);
15548
15624
  if (this.enableImmutableMode) {
15549
15625
  this.modifiedRecords.push(task);
15550
15626
  }
15551
15627
  }
15552
15628
  }
15553
- value = isUndefined(value) ? null : value;
15554
15629
  setValue(field, value, record);
15555
15630
  };
15556
15631
  Gantt.prototype.makeCloneData = function (field, record, isTaskData) {