@syncfusion/ej2-gantt 22.1.36 → 22.1.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.
@@ -1474,8 +1474,16 @@ var DateProcessor = /** @__PURE__ @class */ (function () {
1474
1474
  viewData.forEach(function (data) {
1475
1475
  taskRange = [];
1476
1476
  var task = data.ganttProperties;
1477
- var tempStartDate = _this.getValidStartDate(task);
1478
- var tempEndDate = _this.getValidEndDate(task);
1477
+ var tempStartDate;
1478
+ var tempEndDate;
1479
+ if (isNullOrUndefined(task.startDate) && isNullOrUndefined(task.endDate)) {
1480
+ tempStartDate = null;
1481
+ tempEndDate = null;
1482
+ }
1483
+ else {
1484
+ tempStartDate = _this.getValidStartDate(task);
1485
+ tempEndDate = _this.getValidEndDate(task);
1486
+ }
1479
1487
  addDateToList(minStartDate);
1480
1488
  addDateToList(maxEndDate);
1481
1489
  addDateToList(tempStartDate);
@@ -1535,6 +1543,7 @@ var DateProcessor = /** @__PURE__ @class */ (function () {
1535
1543
  setValue('minStartDate', minStartDate, editArgs);
1536
1544
  setValue('maxEndDate', maxEndDate, editArgs);
1537
1545
  }
1546
+ this.parent['isProjectDateUpdated'] = true;
1538
1547
  };
1539
1548
  /**
1540
1549
  *
@@ -2108,7 +2117,7 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2108
2117
  endDate = this.getEndDate(startDate, duration, data.ganttProperties.durationUnit, data.ganttProperties, false);
2109
2118
  }
2110
2119
  else if (!taskSettings.duration && taskSettings.endDate) {
2111
- endDate = (!isNullOrUndefined(data.ganttProperties.endDate)) && endDate.getTime() >
2120
+ endDate = (!isNullOrUndefined(data.ganttProperties.endDate)) && endDate.getTime() <
2112
2121
  data.ganttProperties.endDate.getTime() && i !== segments.length - 1 ? endDate : data.ganttProperties.endDate;
2113
2122
  duration = this.getDuration(startDate, endDate, data.ganttProperties.durationUnit, data.ganttProperties.isAutoSchedule, data.ganttProperties.isMilestone);
2114
2123
  if (ganttSegments.length > 0 && endDate.getTime() < startDate.getTime()
@@ -2752,38 +2761,59 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2752
2761
  modifiedsDate = new Date(modifiedsDate.getTime() + ganttData.duration * 60 * 60 * 1000);
2753
2762
  }
2754
2763
  if (ganttData && ganttData.durationUnit == 'minute') {
2755
- modifiedsDate = new Date(modifiedsDate.getTime() + ganttData.duration * 60 * 60 * 60 * 1000);
2764
+ modifiedsDate = new Date(modifiedsDate.getTime() + ganttData.duration * 60 * 1000);
2756
2765
  }
2757
2766
  for (var i = 0; i < this.parent.dayWorkingTime.length; i++) {
2758
2767
  hour = hour + this.parent.dayWorkingTime[i].to - this.parent.dayWorkingTime[i].from;
2759
2768
  }
2760
2769
  var dateDiff = modifiedsDate.getTime() - sDate.getTime();
2761
- if (tierMode === 'Day') {
2762
- if ((Math.floor((dateDiff / (1000 * 60 * 60)) % 24) >= hour || dateDiff === 0)) {
2763
- isValid = true;
2770
+ if (ganttData && ganttData.durationUnit == 'minute' && ganttData.duration < (hour * 60)) {
2771
+ if (tierMode === 'Day') {
2772
+ if ((Math.floor((dateDiff / (1000 * 60 * 60)) % 24) >= hour || dateDiff === 0)) {
2773
+ isValid = true;
2774
+ }
2775
+ if (this.getSecondsInDecimal(sDate) === this.parent.defaultStartTime && isValid) {
2776
+ sDate.setHours(0, 0, 0, 0);
2777
+ }
2778
+ if (this.getSecondsInDecimal(eDate) === this.parent.defaultEndTime) {
2779
+ eDate.setHours(24);
2780
+ }
2781
+ if (this.getSecondsInDecimal(eDate) === this.parent.defaultStartTime) {
2782
+ eDate.setHours(0, 0, 0, 0);
2783
+ }
2764
2784
  }
2765
- if (this.getSecondsInDecimal(sDate) === this.parent.defaultStartTime && isValid) {
2766
- sDate.setHours(0, 0, 0, 0);
2785
+ else {
2786
+ isValid = true;
2767
2787
  }
2768
- if (this.getSecondsInDecimal(eDate) === this.parent.defaultEndTime) {
2769
- eDate.setHours(24);
2788
+ if ((sDate).getTime() === (eDate).getTime()) {
2789
+ return (this.parent.perDayWidth);
2770
2790
  }
2771
- if (this.getSecondsInDecimal(eDate) === this.parent.defaultStartTime) {
2772
- eDate.setHours(0, 0, 0, 0);
2791
+ else {
2792
+ if (isValid) {
2793
+ return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth);
2794
+ }
2795
+ else {
2796
+ return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * hour)) * this.parent.perDayWidth);
2797
+ }
2773
2798
  }
2774
2799
  }
2775
2800
  else {
2776
- isValid = true;
2777
- }
2778
- if ((sDate).getTime() === (eDate).getTime()) {
2779
- return (this.parent.perDayWidth);
2780
- }
2781
- else {
2782
- if (isValid) {
2783
- return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth);
2801
+ if (tierMode === 'Day') {
2802
+ if (this.getSecondsInDecimal(sDate) === this.parent.defaultStartTime) {
2803
+ sDate.setHours(0, 0, 0, 0);
2804
+ }
2805
+ if (this.getSecondsInDecimal(eDate) === this.parent.defaultEndTime) {
2806
+ eDate.setHours(24);
2807
+ }
2808
+ if (this.getSecondsInDecimal(eDate) === this.parent.defaultStartTime) {
2809
+ eDate.setHours(0, 0, 0, 0);
2810
+ }
2811
+ }
2812
+ if ((sDate).getTime() === (eDate).getTime()) {
2813
+ return (this.parent.perDayWidth);
2784
2814
  }
2785
2815
  else {
2786
- return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * hour)) * this.parent.perDayWidth);
2816
+ return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth);
2787
2817
  }
2788
2818
  }
2789
2819
  };
@@ -5166,7 +5196,6 @@ var GanttChart = /** @__PURE__ @class */ (function () {
5166
5196
  this.updateWidthAndHeight();
5167
5197
  this.reRenderConnectorLines();
5168
5198
  getValue('chartRow', args).setAttribute('aria-expanded', 'false');
5169
- this.parent.trigger('collapsed', args);
5170
5199
  };
5171
5200
  /**
5172
5201
  * To expand gantt rows
@@ -5221,7 +5250,6 @@ var GanttChart = /** @__PURE__ @class */ (function () {
5221
5250
  this.updateWidthAndHeight();
5222
5251
  this.reRenderConnectorLines();
5223
5252
  getValue('chartRow', args).setAttribute('aria-expanded', 'true');
5224
- this.parent.trigger('expanded', args);
5225
5253
  };
5226
5254
  GanttChart.prototype.renderMultiTaskbar = function (record) {
5227
5255
  if (this.parent.enableMultiTaskbar) {
@@ -5265,20 +5293,27 @@ var GanttChart = /** @__PURE__ @class */ (function () {
5265
5293
  removeClass([targetElement[t]], 'e-row-expand');
5266
5294
  }
5267
5295
  }
5268
- var childRecords = record.childRecords;
5269
- var chartRows = this.getChartRows();
5270
- var rows = [];
5271
- for (var i = 0; i < chartRows.length; i++) {
5272
- if (chartRows[i].classList.contains('gridrowtaskId'
5273
- + record.ganttProperties.rowUniqueID + 'level' + (record.level + 1))) {
5274
- rows.push(chartRows[i]);
5296
+ if (!this.parent.enableVirtualization) {
5297
+ var childRecords = record.childRecords;
5298
+ var chartRows = this.getChartRows();
5299
+ var rows = [];
5300
+ for (var i = 0; i < chartRows.length; i++) {
5301
+ if (chartRows[i].classList.contains("gridrowtaskId" +
5302
+ record.ganttProperties.rowUniqueID +
5303
+ "level" +
5304
+ (record.level + 1))) {
5305
+ rows.push(chartRows[i]);
5306
+ }
5275
5307
  }
5276
- }
5277
- for (var i = 0; i < rows.length; i++) {
5278
- rows[i].style.display = displayType;
5279
- if ((childRecords[i].childRecords && childRecords[i].childRecords.length)
5280
- && (action === 'collapse' || childRecords[i].expanded || this.isExpandAll)) {
5281
- this.expandCollapseChartRows(action, rows[i], childRecords[i], true);
5308
+ for (var i = 0; i < rows.length; i++) {
5309
+ rows[i].style.display = displayType;
5310
+ if (childRecords[i].childRecords &&
5311
+ childRecords[i].childRecords.length &&
5312
+ (action === "collapse" ||
5313
+ childRecords[i].expanded ||
5314
+ this.isExpandAll)) {
5315
+ this.expandCollapseChartRows(action, rows[i], childRecords[i], true);
5316
+ }
5282
5317
  }
5283
5318
  }
5284
5319
  };
@@ -5953,6 +5988,9 @@ var Timeline = /** @__PURE__ @class */ (function () {
5953
5988
  */
5954
5989
  Timeline.prototype.processZooming = function (isZoomIn) {
5955
5990
  this.isZoomToFit = false;
5991
+ if (!this.parent['isProjectDateUpdated']) {
5992
+ this.parent.dateValidationModule.calculateProjectDates();
5993
+ }
5956
5994
  if (!isNullOrUndefined(this.parent.zoomingProjectStartDate)) {
5957
5995
  this.parent.cloneProjectStartDate = this.parent.cloneProjectStartDate.getTime() < this.parent.zoomingProjectStartDate.getTime()
5958
5996
  ? this.parent.cloneProjectStartDate : this.parent.zoomingProjectStartDate;
@@ -6130,6 +6168,8 @@ var Timeline = /** @__PURE__ @class */ (function () {
6130
6168
  this.parent.showSpinner();
6131
6169
  }
6132
6170
  this.changeTimelineSettings(newTimeline);
6171
+ this.isZoomToFit = false;
6172
+ this.parent.isTimelineRoundOff = this.isZoomToFit ? false : isNullOrUndefined(this.parent.projectStartDate) ? true : false;
6133
6173
  };
6134
6174
  Timeline.prototype.bottomTierCellWidthCalc = function (mode, zoomLevel, date) {
6135
6175
  var convertedMilliSeconds;
@@ -7653,25 +7693,60 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7653
7693
  GanttTreeGrid.prototype.collapsing = function (args) {
7654
7694
  // Collapsing event
7655
7695
  var callBackPromise = new Deferred();
7696
+ var collapsingArgs;
7697
+ var record = getValue('data', args);
7698
+ var recordLength = record.length;
7656
7699
  if (!this.parent.ganttChartModule.isExpandCollapseFromChart) {
7657
- var collapsingArgs = this.createExpandCollapseArgs(args);
7658
- this.parent.ganttChartModule.collapseGanttRow(collapsingArgs);
7659
- setValue('cancel', getValue('cancel', collapsingArgs), args);
7700
+ if (!isNullOrUndefined(recordLength)) {
7701
+ for (var i = 0; i < recordLength; i++) {
7702
+ collapsingArgs = this.createExpandCollapseArgs(args, record[i]);
7703
+ this.parent.ganttChartModule.collapseGanttRow(collapsingArgs);
7704
+ }
7705
+ setValue('cancel', getValue('cancel', collapsingArgs), args);
7706
+ }
7707
+ else {
7708
+ collapsingArgs = this.createExpandCollapseArgs(args, null);
7709
+ this.parent.ganttChartModule.collapseGanttRow(collapsingArgs);
7710
+ setValue('cancel', getValue('cancel', collapsingArgs), args);
7711
+ }
7660
7712
  }
7661
7713
  };
7662
7714
  GanttTreeGrid.prototype.expanding = function (args) {
7663
7715
  // Expanding event
7664
7716
  var callBackPromise = new Deferred();
7717
+ var expandingArgs;
7718
+ var record = getValue('data', args);
7719
+ var recordLength = record.length;
7665
7720
  if (!this.parent.ganttChartModule.isExpandCollapseFromChart) {
7666
- var expandingArgs = this.createExpandCollapseArgs(args);
7667
- this.parent.ganttChartModule.expandGanttRow(expandingArgs);
7668
- setValue('cancel', getValue('cancel', expandingArgs), args);
7721
+ if (!isNullOrUndefined(recordLength)) {
7722
+ for (var i = 0; i < recordLength; i++) {
7723
+ expandingArgs = this.createExpandCollapseArgs(args, record[i]);
7724
+ this.parent.ganttChartModule.expandGanttRow(expandingArgs);
7725
+ }
7726
+ setValue('cancel', getValue('cancel', expandingArgs), args);
7727
+ }
7728
+ else {
7729
+ expandingArgs = this.createExpandCollapseArgs(args, null);
7730
+ this.parent.ganttChartModule.expandGanttRow(expandingArgs);
7731
+ setValue('cancel', getValue('cancel', expandingArgs), args);
7732
+ }
7669
7733
  }
7670
7734
  };
7671
7735
  GanttTreeGrid.prototype.collapsed = function (args) {
7672
7736
  if (!this.parent.ganttChartModule.isExpandCollapseFromChart && !this.parent.isExpandCollapseLevelMethod) {
7673
- var collapsedArgs = this.createExpandCollapseArgs(args);
7674
- this.parent.ganttChartModule.collapsedGanttRow(collapsedArgs);
7737
+ var collapsedArgs = void 0;
7738
+ var record = getValue('data', args);
7739
+ var recordLength = record.length;
7740
+ if (!isNullOrUndefined(recordLength)) {
7741
+ for (var i = 0; i < recordLength; i++) {
7742
+ collapsedArgs = this.createExpandCollapseArgs(args, record[i]);
7743
+ this.parent.ganttChartModule.collapsedGanttRow(collapsedArgs);
7744
+ }
7745
+ }
7746
+ else {
7747
+ collapsedArgs = this.createExpandCollapseArgs(args, null);
7748
+ this.parent.ganttChartModule.collapsedGanttRow(collapsedArgs);
7749
+ }
7675
7750
  if (this.parent.viewType === 'ResourceView' && !this.parent.allowTaskbarOverlap && collapsedArgs['gridRow']) {
7676
7751
  collapsedArgs['gridRow'].style.height = collapsedArgs['chartRow'].style.height;
7677
7752
  this.parent.contentHeight = this.parent.enableRtl ? this.parent['element'].getElementsByClassName('e-content')[2].children[0]['offsetHeight'] :
@@ -7685,19 +7760,29 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7685
7760
  else {
7686
7761
  this.parent.hideSpinner();
7687
7762
  }
7763
+ this.parent.trigger('collapsed', args);
7688
7764
  };
7689
7765
  GanttTreeGrid.prototype.expanded = function (args) {
7690
7766
  if (!this.parent.ganttChartModule.isExpandCollapseFromChart && !this.parent.isExpandCollapseLevelMethod) {
7691
- if (!args['data'].length) {
7692
- var expandedArgs = this.createExpandCollapseArgs(args);
7693
- this.parent.ganttChartModule.expandedGanttRow(expandedArgs);
7694
- if (this.parent.viewType === 'ResourceView' && !this.parent.allowTaskbarOverlap && args['row']) {
7695
- args['row'].style.height = this.parent.rowHeight + 'px';
7696
- this.parent.contentHeight = this.parent.enableRtl ? this.parent['element'].getElementsByClassName('e-content')[2].children[0]['offsetHeight'] :
7697
- this.parent['element'].getElementsByClassName('e-content')[0].children[0]['offsetHeight'];
7698
- document.getElementsByClassName('e-chart-rows-container')[0]['style'].height = this.parent.contentHeight + 'px';
7767
+ var expandedArgs = void 0;
7768
+ var record = getValue('data', args);
7769
+ var recordLength = record.length;
7770
+ if (!isNullOrUndefined(recordLength)) {
7771
+ for (var i = 0; i < recordLength; i++) {
7772
+ expandedArgs = this.createExpandCollapseArgs(args, record[i]);
7773
+ this.parent.ganttChartModule.expandedGanttRow(expandedArgs);
7699
7774
  }
7700
7775
  }
7776
+ else {
7777
+ expandedArgs = this.createExpandCollapseArgs(args, null);
7778
+ this.parent.ganttChartModule.expandedGanttRow(expandedArgs);
7779
+ }
7780
+ if (this.parent.viewType === 'ResourceView' && !this.parent.allowTaskbarOverlap && args['row']) {
7781
+ args['row'].style.height = this.parent.rowHeight + 'px';
7782
+ this.parent.contentHeight = this.parent.enableRtl ? this.parent['element'].getElementsByClassName('e-content')[2].children[0]['offsetHeight'] :
7783
+ this.parent['element'].getElementsByClassName('e-content')[0].children[0]['offsetHeight'];
7784
+ document.getElementsByClassName('e-chart-rows-container')[0]['style'].height = this.parent.contentHeight + 'px';
7785
+ }
7701
7786
  }
7702
7787
  if (!isNullOrUndefined(this.parent.loadingIndicator) && this.parent.loadingIndicator.indicatorType === "Shimmer") {
7703
7788
  this.parent.hideMaskRow();
@@ -7705,6 +7790,7 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7705
7790
  else {
7706
7791
  this.parent.hideSpinner();
7707
7792
  }
7793
+ this.parent.trigger('expanded', args);
7708
7794
  };
7709
7795
  GanttTreeGrid.prototype.actionBegin = function (args) {
7710
7796
  this.parent.notify('actionBegin', args);
@@ -7728,13 +7814,23 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7728
7814
  GanttTreeGrid.prototype.actionFailure = function (args) {
7729
7815
  this.parent.trigger('actionFailure', args);
7730
7816
  };
7731
- GanttTreeGrid.prototype.createExpandCollapseArgs = function (args) {
7732
- var record = getValue('data', args);
7733
- var gridRow = getValue('row', args);
7817
+ GanttTreeGrid.prototype.createExpandCollapseArgs = function (args, currentRecord) {
7734
7818
  var chartRow;
7735
- chartRow = this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(record)];
7736
- var eventArgs = { data: record, gridRow: gridRow, chartRow: chartRow, cancel: false };
7737
- return eventArgs;
7819
+ var record = getValue('data', args);
7820
+ var recordLength = record.length;
7821
+ if (!isNullOrUndefined(recordLength)) {
7822
+ var gridRow = getValue('row', args);
7823
+ chartRow = this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(currentRecord)];
7824
+ var eventArgs = { data: currentRecord, gridRow: gridRow, chartRow: chartRow, cancel: false };
7825
+ return eventArgs;
7826
+ }
7827
+ else {
7828
+ var record_1 = getValue('data', args);
7829
+ var gridRow = getValue('row', args);
7830
+ chartRow = this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(record_1)];
7831
+ var eventArgs = { data: record_1, gridRow: gridRow, chartRow: chartRow, cancel: false };
7832
+ return eventArgs;
7833
+ }
7738
7834
  };
7739
7835
  GanttTreeGrid.prototype.treeActionComplete = function (args) {
7740
7836
  var updatedArgs = extend({}, args);
@@ -11537,6 +11633,9 @@ var Dependency = /** @__PURE__ @class */ (function () {
11537
11633
  ganttRecord = predecessorsCollection[count];
11538
11634
  if ((!ganttRecord.hasChildRecords && !this.parent.allowParentDependency) || this.parent.allowParentDependency) {
11539
11635
  this.updatePredecessorHelper(ganttRecord, predecessorsCollection);
11636
+ if (!ganttRecord.ganttProperties.isAutoSchedule) {
11637
+ this.parent.connectorLineEditModule['calculateOffset'](ganttRecord);
11638
+ }
11540
11639
  }
11541
11640
  }
11542
11641
  };
@@ -11967,6 +12066,9 @@ var Dependency = /** @__PURE__ @class */ (function () {
11967
12066
  if (validationOn !== 'predecessor' && this.parent.isValidationEnabled) {
11968
12067
  this.validateChildGanttRecord(parentGanttRecord, record);
11969
12068
  }
12069
+ else if (!record.ganttProperties.isAutoSchedule && this.parent.UpdateOffsetOnTaskbarEdit) {
12070
+ this.parent.connectorLineEditModule['calculateOffset'](record);
12071
+ }
11970
12072
  if (parentGanttRecord.expanded === false || record.expanded === false) {
11971
12073
  if (record) {
11972
12074
  this.validatePredecessor(record, undefined, 'successor');
@@ -20308,6 +20410,7 @@ var TaskbarEdit = /** @__PURE__ @class */ (function (_super) {
20308
20410
  }
20309
20411
  }
20310
20412
  }
20413
+ this.parent['isProjectDateUpdated'] = false;
20311
20414
  };
20312
20415
  /**
20313
20416
  * To cancel the taskbar edt action.
@@ -30855,65 +30958,79 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
30855
30958
  }
30856
30959
  switch (this.item) {
30857
30960
  case 'TaskInformation':
30858
- if (isNaN(Number(this.rowData.ganttProperties.rowUniqueID))) {
30859
- this.parent.openEditDialog(this.rowData.ganttProperties.rowUniqueID);
30860
- }
30861
- else {
30862
- this.parent.openEditDialog(Number(this.rowData.ganttProperties.rowUniqueID));
30961
+ if (!isNullOrUndefined(this.rowData)) {
30962
+ if (isNaN(Number(this.rowData.ganttProperties.rowUniqueID))) {
30963
+ this.parent.openEditDialog(this.rowData.ganttProperties.rowUniqueID);
30964
+ }
30965
+ else {
30966
+ this.parent.openEditDialog(Number(this.rowData.ganttProperties.rowUniqueID));
30967
+ }
30863
30968
  }
30864
30969
  break;
30865
30970
  case 'Above':
30866
30971
  case 'Below':
30867
30972
  case 'Child':
30868
- position = this.item;
30869
- data = extend({}, {}, this.rowData.taskData, true);
30870
- taskfields = this.parent.taskFields;
30871
- if (data[taskfields.startDate]) {
30872
- this.parent.setRecordValue(taskfields.startDate, this.rowData.ganttProperties.startDate, data, true);
30873
- }
30874
- if (data[taskfields.endDate]) {
30875
- this.parent.setRecordValue(taskfields.endDate, this.rowData.ganttProperties.endDate, data, true);
30876
- }
30877
- if (!isNullOrUndefined(taskfields.dependency)) {
30878
- data[taskfields.dependency] = null;
30879
- }
30880
- if (!isNullOrUndefined(taskfields.child) && data[taskfields.child]) {
30881
- delete data[taskfields.child];
30882
- }
30883
- if (!isNullOrUndefined(taskfields.parentID) && data[taskfields.parentID]) {
30884
- data[taskfields.parentID] = null;
30973
+ if (!isNullOrUndefined(this.rowData)) {
30974
+ position = this.item;
30975
+ data = extend({}, {}, this.rowData.taskData, true);
30976
+ taskfields = this.parent.taskFields;
30977
+ if (data[taskfields.startDate]) {
30978
+ this.parent.setRecordValue(taskfields.startDate, this.rowData.ganttProperties.startDate, data, true);
30979
+ }
30980
+ if (data[taskfields.endDate]) {
30981
+ this.parent.setRecordValue(taskfields.endDate, this.rowData.ganttProperties.endDate, data, true);
30982
+ }
30983
+ if (!isNullOrUndefined(taskfields.dependency)) {
30984
+ data[taskfields.dependency] = null;
30985
+ }
30986
+ if (!isNullOrUndefined(taskfields.child) && data[taskfields.child]) {
30987
+ delete data[taskfields.child];
30988
+ }
30989
+ if (!isNullOrUndefined(taskfields.parentID) && data[taskfields.parentID]) {
30990
+ data[taskfields.parentID] = null;
30991
+ }
30992
+ if (this.rowData) {
30993
+ var rowIndex = this.parent.updatedRecords.indexOf(this.rowData);
30994
+ this.parent.addRecord(data, position, rowIndex);
30995
+ }
30885
30996
  }
30886
- if (this.rowData) {
30887
- var rowIndex = this.parent.updatedRecords.indexOf(this.rowData);
30888
- this.parent.addRecord(data, position, rowIndex);
30997
+ else if (this.parent.flatData.length === 0) {
30998
+ this.parent.addRecord();
30889
30999
  }
30890
31000
  break;
30891
31001
  case 'Milestone':
30892
31002
  case 'ToMilestone':
30893
- this.parent.convertToMilestone(this.rowData.ganttProperties.rowUniqueID);
31003
+ if (!isNullOrUndefined(this.rowData)) {
31004
+ this.parent.convertToMilestone(this.rowData.ganttProperties.rowUniqueID);
31005
+ }
31006
+ else if (this.parent.flatData.length === 0) {
31007
+ this.parent.addRecord();
31008
+ }
30894
31009
  break;
30895
31010
  case 'DeleteTask':
30896
31011
  this.parent.editModule.deleteRecord(this.rowData);
30897
31012
  break;
30898
31013
  case 'ToTask':
30899
- data = extend({}, {}, this.rowData.taskData, true);
30900
- taskfields = this.parent.taskFields;
30901
- if (!isNullOrUndefined(taskfields.duration)) {
30902
- var ganttProp = this.rowData.ganttProperties;
30903
- data[taskfields.duration] = '1 ' + ganttProp.durationUnit;
30904
- }
30905
- else {
30906
- data[taskfields.startDate] = new Date(this.rowData.taskData[taskfields.startDate]);
30907
- var endDate = new Date(this.rowData.taskData[taskfields.startDate]);
30908
- endDate.setDate(endDate.getDate() + 1);
30909
- data[taskfields.endDate] = endDate;
30910
- }
30911
- if (!isNullOrUndefined(data[taskfields.milestone])) {
30912
- if (data[taskfields.milestone] === true) {
30913
- data[taskfields.milestone] = false;
31014
+ if (!isNullOrUndefined(this.rowData)) {
31015
+ data = extend({}, {}, this.rowData.taskData, true);
31016
+ taskfields = this.parent.taskFields;
31017
+ if (!isNullOrUndefined(taskfields.duration)) {
31018
+ var ganttProp = this.rowData.ganttProperties;
31019
+ data[taskfields.duration] = '1 ' + ganttProp.durationUnit;
31020
+ }
31021
+ else {
31022
+ data[taskfields.startDate] = new Date(this.rowData.taskData[taskfields.startDate]);
31023
+ var endDate = new Date(this.rowData.taskData[taskfields.startDate]);
31024
+ endDate.setDate(endDate.getDate() + 1);
31025
+ data[taskfields.endDate] = endDate;
31026
+ }
31027
+ if (!isNullOrUndefined(data[taskfields.milestone])) {
31028
+ if (data[taskfields.milestone] === true) {
31029
+ data[taskfields.milestone] = false;
31030
+ }
30914
31031
  }
31032
+ this.parent.updateRecordByID(data);
30915
31033
  }
30916
- this.parent.updateRecordByID(data);
30917
31034
  break;
30918
31035
  case 'Cancel':
30919
31036
  this.parent.cancelEdit();
@@ -31069,7 +31186,7 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
31069
31186
  this.contextMenu.enableItems(['Add', 'Save', 'Convert', 'Delete Dependency', 'Delete Task', 'TaskMode', 'Indent', 'Outdent', 'SplitTask', 'MergeTask'], false);
31070
31187
  }
31071
31188
  if ((isNullOrUndefined(args.gridRow) && isNullOrUndefined(args.chartRow)) || this.contentMenuItems.length === 0) {
31072
- if (!isNullOrUndefined(args.parentItem) && !isNullOrUndefined(menuElement)) {
31189
+ if (!isNullOrUndefined(args.parentItem) && !isNullOrUndefined(menuElement) || !isNullOrUndefined(closest(target, '.e-content'))) {
31073
31190
  args.cancel = false;
31074
31191
  }
31075
31192
  else {
@@ -31109,7 +31226,7 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
31109
31226
  args.disableItems = this.disableItems;
31110
31227
  args.hideItems = this.hideItems;
31111
31228
  args.hideChildItems = [];
31112
- if (args.rowData.level === 0 && this.parent.viewType === 'ResourceView') {
31229
+ if (!isNullOrUndefined(args.rowData) && args.rowData.level === 0 && this.parent.viewType === 'ResourceView') {
31113
31230
  args.cancel = true;
31114
31231
  return;
31115
31232
  }
@@ -31151,6 +31268,9 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
31151
31268
  if (!this.parent.editSettings.allowEditing || !this.parent.editModule) {
31152
31269
  this.updateItemVisibility(item.text);
31153
31270
  }
31271
+ if (this.parent.flatData.length === 0) {
31272
+ this.hideItems.push(item.text);
31273
+ }
31154
31274
  break;
31155
31275
  case 'Add':
31156
31276
  if (!this.parent.editSettings.allowAdding || !this.parent.editModule) {
@@ -31162,14 +31282,14 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
31162
31282
  this.hideItems.push(item.text);
31163
31283
  break;
31164
31284
  case 'Convert':
31165
- if (this.rowData.hasChildRecords) {
31285
+ if (!isNullOrUndefined(this.rowData) && this.rowData.hasChildRecords) {
31166
31286
  this.hideItems.push(item.text);
31167
31287
  }
31168
31288
  else if (!this.parent.editSettings.allowEditing || !this.parent.editModule) {
31169
31289
  this.updateItemVisibility(item.text);
31170
31290
  }
31171
31291
  else {
31172
- if (!this.rowData.ganttProperties.isMilestone) {
31292
+ if (!isNullOrUndefined(this.rowData) && !this.rowData.ganttProperties.isMilestone) {
31173
31293
  subMenu.push(this.createItemModel(content, 'ToMilestone', this.getLocale('toMilestone')));
31174
31294
  }
31175
31295
  else {
@@ -31177,11 +31297,14 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
31177
31297
  }
31178
31298
  item.items = subMenu;
31179
31299
  }
31300
+ if (this.parent.flatData.length === 0) {
31301
+ this.hideItems.push(item.text);
31302
+ }
31180
31303
  break;
31181
31304
  case 'DeleteDependency':
31182
31305
  {
31183
31306
  var items = this.getPredecessorsItems();
31184
- if (this.rowData.hasChildRecords) {
31307
+ if (!isNullOrUndefined(this.rowData) && this.rowData.hasChildRecords) {
31185
31308
  this.hideItems.push(item.text);
31186
31309
  }
31187
31310
  else if (!this.parent.editSettings.allowDeleting || items.length === 0 || !this.parent.editModule) {
@@ -31196,6 +31319,9 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
31196
31319
  if (!this.parent.editSettings.allowDeleting || !this.parent.editModule) {
31197
31320
  this.updateItemVisibility(item.text);
31198
31321
  }
31322
+ if (this.parent.flatData.length === 0) {
31323
+ this.hideItems.push(item.text);
31324
+ }
31199
31325
  break;
31200
31326
  case 'TaskMode':
31201
31327
  if (this.parent.taskMode !== 'Custom') {