@syncfusion/ej2-gantt 20.2.36 → 20.2.43

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.
@@ -239,7 +239,7 @@ var DateProcessor = /** @__PURE__ @class */ (function () {
239
239
  this.setTime(this.parent.defaultStartTime, cloneStartDate);
240
240
  }
241
241
  else if (hour < this.parent.defaultStartTime && validateAsMilestone) {
242
- this.setTime(this.parent.defaultEndTime, cloneStartDate);
242
+ this.setTime(this.parent.defaultStartTime, cloneStartDate);
243
243
  }
244
244
  else if ((hour === this.parent.defaultEndTime && (!ganttProp || !validateAsMilestone)) || hour > this.parent.defaultEndTime) {
245
245
  cloneStartDate.setDate(cloneStartDate.getDate() + 1);
@@ -401,7 +401,7 @@ var DateProcessor = /** @__PURE__ @class */ (function () {
401
401
  if (hour > this.parent.defaultEndTime) {
402
402
  this.setTime(this.parent.defaultEndTime, cloneDate);
403
403
  }
404
- else if (hour <= this.parent.defaultStartTime && !ganttProp.isMilestone) {
404
+ else if (hour <= this.parent.defaultStartTime && !isNullOrUndefined(ganttProp) && !ganttProp.isMilestone) {
405
405
  cloneDate.setDate(cloneDate.getDate() - 1);
406
406
  this.setTime(this.parent.defaultEndTime, cloneDate);
407
407
  }
@@ -1473,7 +1473,13 @@ var DateProcessor = /** @__PURE__ @class */ (function () {
1473
1473
  }
1474
1474
  sortDates(taskRange);
1475
1475
  if (!minStartDate || !maxEndDate) {
1476
- minStartDate = isNullOrUndefined(minStartDate) ? this.getDateFromFormat(new Date()) : minStartDate;
1476
+ if (!minStartDate) {
1477
+ minStartDate = isNullOrUndefined(minStartDate) ? this.getDateFromFormat(new Date()) : minStartDate;
1478
+ minStartDate.setHours(0, 0, 0, 0);
1479
+ }
1480
+ else {
1481
+ minStartDate = isNullOrUndefined(minStartDate) ? this.getDateFromFormat(new Date()) : minStartDate;
1482
+ }
1477
1483
  maxEndDate = this.getDateFromFormat(new Date(minStartDate.getTime()));
1478
1484
  maxEndDate.setDate(maxEndDate.getDate() + 20);
1479
1485
  }
@@ -4862,6 +4868,9 @@ var GanttChart = /** @__PURE__ @class */ (function () {
4862
4868
  * @private
4863
4869
  */
4864
4870
  GanttChart.prototype.expandedGanttRow = function (args) {
4871
+ if (isNullOrUndefined(args['gridRow']) && this.parent.enableVirtualization) {
4872
+ return;
4873
+ }
4865
4874
  var record = getValue('data', args);
4866
4875
  if (this.isExpandCollapseFromChart) {
4867
4876
  this.expandCollapseChartRows('expand', getValue('chartRow', args), record, null);
@@ -5069,6 +5078,23 @@ var GanttChart = /** @__PURE__ @class */ (function () {
5069
5078
  $target.closest('.e-chart-row') ? $target.closest('.e-chart-row').rowIndex : -1;
5070
5079
  var isTab = (e.action === 'tab') ? true : false;
5071
5080
  var nextElement = this.getNextElement($target, isTab, isInEditedState);
5081
+ this.tempNextElement = nextElement;
5082
+ if (!isNullOrUndefined(nextElement['cellIndex'])) {
5083
+ if (this.parent.allowRowDragAndDrop) {
5084
+ this.childrenIndex = nextElement['cellIndex'];
5085
+ this.nextElementIndex = nextElement['cellIndex'] - 1;
5086
+ }
5087
+ else {
5088
+ this.childrenIndex = nextElement['cellIndex'];
5089
+ this.nextElementIndex = nextElement['cellIndex'];
5090
+ }
5091
+ if (!this.parent.ganttColumns[this.nextElementIndex]['allowEditing'] && this.parent.ganttColumns[this.nextElementIndex]['field'] !== this.parent.taskFields.id) {
5092
+ this.isEditableElement = true;
5093
+ }
5094
+ else {
5095
+ this.isEditableElement = false;
5096
+ }
5097
+ }
5072
5098
  if (nextElement === 'noNextRow') {
5073
5099
  this.manageFocus($target, 'remove', true);
5074
5100
  return;
@@ -5116,7 +5142,8 @@ var GanttChart = /** @__PURE__ @class */ (function () {
5116
5142
  this.parent.treeGrid.grid.notify('key-pressed', e);
5117
5143
  }
5118
5144
  }
5119
- if (!isNullOrUndefined(isInEditedState) && !this.parent.editModule.cellEditModule.isCellEdit) {
5145
+ if (!(this.parent.editModule && this.parent.editModule.cellEditModule
5146
+ && !isNullOrUndefined(this.parent.editModule.cellEditModule.editedColumn))) {
5120
5147
  if (nextElement) {
5121
5148
  if ($target.classList.contains('e-rowcell')) {
5122
5149
  this.manageFocus($target, 'remove', false);
@@ -5609,8 +5636,8 @@ var Timeline = /** @__PURE__ @class */ (function () {
5609
5636
  }
5610
5637
  }
5611
5638
  var newTimeline = extend({}, {}, zoomingLevel, true);
5612
- this.roundOffDateToZoom(this.parent.cloneProjectStartDate, true, perDayWidth, newTimeline.bottomTier.unit);
5613
- this.roundOffDateToZoom(this.parent.cloneProjectEndDate, false, perDayWidth, newTimeline.bottomTier.unit);
5639
+ this.roundOffDateToZoom(this.parent.cloneProjectStartDate, true, perDayWidth, newTimeline.bottomTier.unit, zoomingLevel);
5640
+ this.roundOffDateToZoom(this.parent.cloneProjectEndDate, false, perDayWidth, newTimeline.bottomTier.unit, zoomingLevel);
5614
5641
  var numberOfCells = this.calculateNumberOfTimelineCells(newTimeline);
5615
5642
  var scrollHeight = this.parent.ganttChartModule.scrollElement.offsetHeight - 17; //17 is horizontal scrollbar width
5616
5643
  var contentHeight = this.parent.ganttChartModule.chartBodyContent.offsetHeight;
@@ -5626,24 +5653,40 @@ var Timeline = /** @__PURE__ @class */ (function () {
5626
5653
  this.parent.trigger('actionBegin', args);
5627
5654
  this.changeTimelineSettings(newTimeline);
5628
5655
  };
5629
- Timeline.prototype.roundOffDateToZoom = function (date, isStartDate, perDayWidth, tierMode) {
5630
- var width = tierMode === 'Month' || tierMode === 'Year' ? 60 : 20;
5631
- var roundOffTime = (width / perDayWidth) * (24 * 60 * 60 * 1000);
5656
+ Timeline.prototype.bottomTierCellWidthCalc = function (mode, zoomLevel, date) {
5657
+ var convertedMilliSeconds;
5658
+ switch (mode) {
5659
+ case 'Minutes':
5660
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 1000);
5661
+ break;
5662
+ case 'Hour':
5663
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 60 * 1000);
5664
+ break;
5665
+ case 'Week':
5666
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (7 * 24 * 60 * 60 * 1000);
5667
+ break;
5668
+ case 'Day':
5669
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (24 * 60 * 60 * 1000);
5670
+ break;
5671
+ case 'Month':
5672
+ var daysInMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
5673
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 60 * 24 * daysInMonth * 1000);
5674
+ break;
5675
+ case 'Year':
5676
+ var daysInYear = (date.getFullYear() % 400 === 0 || (date.getFullYear() % 100 !== 0 && date.getFullYear() % 4 === 0)) ? 366 : 365;
5677
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 60 * 24 * daysInYear * 1000);
5678
+ break;
5679
+ }
5680
+ return convertedMilliSeconds;
5681
+ };
5682
+ Timeline.prototype.roundOffDateToZoom = function (date, isStartDate, perDayWidth, tierMode, zoomingLevel) {
5683
+ var roundOffTime = this.bottomTierCellWidthCalc(tierMode, zoomingLevel, date);
5632
5684
  if (isStartDate) {
5633
5685
  date.setTime(date.getTime() - roundOffTime);
5634
5686
  }
5635
5687
  else {
5636
5688
  date.setTime(date.getTime() + roundOffTime);
5637
5689
  }
5638
- if (tierMode === 'Hour') {
5639
- date.setMinutes(isStartDate ? -120 : 120);
5640
- }
5641
- else if (tierMode === 'Minutes') {
5642
- date.setSeconds(isStartDate ? -120 : 120);
5643
- }
5644
- else {
5645
- date.setHours(isStartDate ? -48 : 48, 0, 0, 0);
5646
- }
5647
5690
  };
5648
5691
  Timeline.prototype.calculateNumberOfTimelineCells = function (newTimeline) {
5649
5692
  var numberOfDays = Math.abs((this.parent.cloneProjectEndDate.getTime() -
@@ -6773,7 +6816,10 @@ var Timeline = /** @__PURE__ @class */ (function () {
6773
6816
  if (type === 'prevTimeSpan' && isFrom === 'publicMethod') {
6774
6817
  this.parent.ganttChartModule.updateScrollLeft(0);
6775
6818
  }
6776
- else if ((type === 'nextTimeSpan' && isFrom === 'publicMethod') || (type === 'nextTimeSpan' && isFrom === 'TaskbarEditing')) {
6819
+ else if (type === 'nextTimeSpan' && isFrom === 'publicMethod') {
6820
+ this.parent.ganttChartModule.updateScrollLeft(this.parent.timelineModule.totalTimelineWidth);
6821
+ }
6822
+ else if (type === 'nextTimeSpan' && isFrom === 'TaskbarEditing') {
6777
6823
  var currentScrollLeft = document.getElementsByClassName('e-chart-scroll-container e-content')[0].scrollLeft;
6778
6824
  this.parent.element.querySelector('.e-timeline-header-container').scrollLeft = currentScrollLeft;
6779
6825
  }
@@ -6956,6 +7002,7 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
6956
7002
  };
6957
7003
  GanttTreeGrid.prototype.composeProperties = function () {
6958
7004
  this.parent.treeGrid.showColumnMenu = this.parent.showColumnMenu;
7005
+ this.parent.treeGrid.enableCollapseAll = this.parent.collapseAllParentTasks;
6959
7006
  this.parent.treeGrid.columnMenuItems = this.parent.columnMenuItems;
6960
7007
  this.parent.treeGrid.childMapping = isNullOrUndefined(this.parent.taskFields.child) ? '' : this.parent.taskFields.child;
6961
7008
  this.parent.treeGrid.treeColumnIndex = this.parent.treeColumnIndex;
@@ -10006,6 +10053,12 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10006
10053
  }
10007
10054
  var dataId = this.parent.viewType === 'ProjectView' ? data.ganttProperties.taskId : data.ganttProperties.rowUniqueID;
10008
10055
  this.parent.treeGrid.grid.setRowData(dataId, data);
10056
+ var nextEditableElement = this.parent.ganttChartModule.tempNextElement;
10057
+ if (this.parent.ganttChartModule.isEditableElement && nextEditableElement) {
10058
+ this.parent.treeGrid.grid.focusModule.focus();
10059
+ addClass([this.parent.treeGrid.getRows()[tr['ariaRowIndex']].children[this.parent.ganttChartModule.childrenIndex]], 'e-focused');
10060
+ this.parent.ganttChartModule.tempNextElement = null;
10061
+ }
10009
10062
  var row = this.parent.treeGrid.grid.getRowObjectFromUID(this.parent.treeGrid.grid.getDataRows()[index].getAttribute('data-uid'));
10010
10063
  row.data = data;
10011
10064
  }
@@ -12204,7 +12257,7 @@ var Tooltip$1 = /** @__PURE__ @class */ (function () {
12204
12257
  if (ganttData) {
12205
12258
  data = ganttData.ganttProperties;
12206
12259
  taskName = !isNullOrUndefined(data.taskName) ? '<tr class = "e-gantt-tooltip-rowcell"><td colspan="3">' +
12207
- data.taskName + '</td></tr>' : '';
12260
+ (this.parent.disableHtmlEncode ? data.taskName.replace(/</g, "&lt;").replace(/>/g, "&gt;") : data.taskName) + '</td></tr>' : '';
12208
12261
  }
12209
12262
  switch (elementType) {
12210
12263
  case 'milestone':
@@ -21762,7 +21815,7 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
21762
21815
  if (column.field === this.parent.taskFields.id) {
21763
21816
  this.updateIDColumnEditParams(column);
21764
21817
  }
21765
- else if (column.field === this.parent.taskFields.progress) {
21818
+ else if (column.field === this.parent.taskFields.progress && isNullOrUndefined(column.edit)) {
21766
21819
  this.updateProgessColumnEditParams(column);
21767
21820
  }
21768
21821
  else if (column.field === this.parent.taskFields.resourceInfo) {
@@ -23729,6 +23782,7 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
23729
23782
  eventArgs.modifiedRecords = args.updatedRecordCollection;
23730
23783
  eventArgs.modifiedTaskData = getTaskData(args.updatedRecordCollection, null, null, this.parent);
23731
23784
  setValue('action', args.action, eventArgs);
23785
+ this.parent.isOnDelete = false;
23732
23786
  this.parent.trigger('actionComplete', eventArgs);
23733
23787
  this.deletedTaskDetails = [];
23734
23788
  this.parent.initiateEditAction(false);
@@ -28079,7 +28133,7 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
28079
28133
  var rowIndex = -1;
28080
28134
  if (args.gridRow) {
28081
28135
  // eslint-disable-next-line
28082
- rowIndex = parseInt(args.gridRow.getAttribute('aria-rowindex'), 0);
28136
+ rowIndex = parseInt(args.gridRow.getAttribute('data-rowindex'), 0);
28083
28137
  }
28084
28138
  else if (args.chartRow) {
28085
28139
  // eslint-disable-next-line
@@ -28715,7 +28769,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
28715
28769
  ganttDragelem.remove();
28716
28770
  }
28717
28771
  var gridRow = closest(args.target, '.e-row');
28718
- var dropIndex = gridRow ? parseInt(gridRow.getAttribute('aria-rowindex'), 10) : args.dropIndex;
28772
+ var dropIndex = gridRow ? parseInt(gridRow.getAttribute('data-rowindex'), 10) : args.dropIndex;
28719
28773
  args.dropIndex = dropIndex;
28720
28774
  args.dropRecord = this.parent.updatedRecords[args.dropIndex];
28721
28775
  this.parent.trigger('rowDrop', args);
@@ -29043,6 +29097,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
29043
29097
  var proxy = this.parent;
29044
29098
  var tempDataSource;
29045
29099
  var idx;
29100
+ var ganttFields = this.parent.taskFields;
29046
29101
  if (this.parent.dataSource instanceof DataManager) {
29047
29102
  tempDataSource = getValue('dataOperation.dataArray', this.parent);
29048
29103
  }
@@ -29051,7 +29106,12 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
29051
29106
  }
29052
29107
  if (tempDataSource.length > 0 && (!isNullOrUndefined(droppedRecord) && !droppedRecord.parentItem)) {
29053
29108
  for (var i = 0; i < Object.keys(tempDataSource).length; i++) {
29054
- if (tempDataSource[i][this.parent.taskFields.child] === droppedRecord.taskData[this.parent.taskFields.child]) {
29109
+ if (!isNullOrUndefined(droppedRecord.taskData[ganttFields.child]) &&
29110
+ tempDataSource[i][ganttFields.child] === droppedRecord.taskData[ganttFields.child]) {
29111
+ idx = i;
29112
+ }
29113
+ else if (isNullOrUndefined(droppedRecord.taskData[ganttFields.child]) &&
29114
+ droppedRecord.taskData[ganttFields.id] === tempDataSource[i][ganttFields.id]) {
29055
29115
  idx = i;
29056
29116
  }
29057
29117
  }