@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.
@@ -238,7 +238,7 @@ class DateProcessor {
238
238
  this.setTime(this.parent.defaultStartTime, cloneStartDate);
239
239
  }
240
240
  else if (hour < this.parent.defaultStartTime && validateAsMilestone) {
241
- this.setTime(this.parent.defaultEndTime, cloneStartDate);
241
+ this.setTime(this.parent.defaultStartTime, cloneStartDate);
242
242
  }
243
243
  else if ((hour === this.parent.defaultEndTime && (!ganttProp || !validateAsMilestone)) || hour > this.parent.defaultEndTime) {
244
244
  cloneStartDate.setDate(cloneStartDate.getDate() + 1);
@@ -400,7 +400,7 @@ class DateProcessor {
400
400
  if (hour > this.parent.defaultEndTime) {
401
401
  this.setTime(this.parent.defaultEndTime, cloneDate);
402
402
  }
403
- else if (hour <= this.parent.defaultStartTime && !ganttProp.isMilestone) {
403
+ else if (hour <= this.parent.defaultStartTime && !isNullOrUndefined(ganttProp) && !ganttProp.isMilestone) {
404
404
  cloneDate.setDate(cloneDate.getDate() - 1);
405
405
  this.setTime(this.parent.defaultEndTime, cloneDate);
406
406
  }
@@ -1466,7 +1466,13 @@ class DateProcessor {
1466
1466
  }
1467
1467
  sortDates(taskRange);
1468
1468
  if (!minStartDate || !maxEndDate) {
1469
- minStartDate = isNullOrUndefined(minStartDate) ? this.getDateFromFormat(new Date()) : minStartDate;
1469
+ if (!minStartDate) {
1470
+ minStartDate = isNullOrUndefined(minStartDate) ? this.getDateFromFormat(new Date()) : minStartDate;
1471
+ minStartDate.setHours(0, 0, 0, 0);
1472
+ }
1473
+ else {
1474
+ minStartDate = isNullOrUndefined(minStartDate) ? this.getDateFromFormat(new Date()) : minStartDate;
1475
+ }
1470
1476
  maxEndDate = this.getDateFromFormat(new Date(minStartDate.getTime()));
1471
1477
  maxEndDate.setDate(maxEndDate.getDate() + 20);
1472
1478
  }
@@ -4816,6 +4822,9 @@ class GanttChart {
4816
4822
  * @private
4817
4823
  */
4818
4824
  expandedGanttRow(args) {
4825
+ if (isNullOrUndefined(args['gridRow']) && this.parent.enableVirtualization) {
4826
+ return;
4827
+ }
4819
4828
  const record = getValue('data', args);
4820
4829
  if (this.isExpandCollapseFromChart) {
4821
4830
  this.expandCollapseChartRows('expand', getValue('chartRow', args), record, null);
@@ -5023,6 +5032,23 @@ class GanttChart {
5023
5032
  $target.closest('.e-chart-row') ? $target.closest('.e-chart-row').rowIndex : -1;
5024
5033
  const isTab = (e.action === 'tab') ? true : false;
5025
5034
  const nextElement = this.getNextElement($target, isTab, isInEditedState);
5035
+ this.tempNextElement = nextElement;
5036
+ if (!isNullOrUndefined(nextElement['cellIndex'])) {
5037
+ if (this.parent.allowRowDragAndDrop) {
5038
+ this.childrenIndex = nextElement['cellIndex'];
5039
+ this.nextElementIndex = nextElement['cellIndex'] - 1;
5040
+ }
5041
+ else {
5042
+ this.childrenIndex = nextElement['cellIndex'];
5043
+ this.nextElementIndex = nextElement['cellIndex'];
5044
+ }
5045
+ if (!this.parent.ganttColumns[this.nextElementIndex]['allowEditing'] && this.parent.ganttColumns[this.nextElementIndex]['field'] !== this.parent.taskFields.id) {
5046
+ this.isEditableElement = true;
5047
+ }
5048
+ else {
5049
+ this.isEditableElement = false;
5050
+ }
5051
+ }
5026
5052
  if (nextElement === 'noNextRow') {
5027
5053
  this.manageFocus($target, 'remove', true);
5028
5054
  return;
@@ -5070,7 +5096,8 @@ class GanttChart {
5070
5096
  this.parent.treeGrid.grid.notify('key-pressed', e);
5071
5097
  }
5072
5098
  }
5073
- if (!isNullOrUndefined(isInEditedState) && !this.parent.editModule.cellEditModule.isCellEdit) {
5099
+ if (!(this.parent.editModule && this.parent.editModule.cellEditModule
5100
+ && !isNullOrUndefined(this.parent.editModule.cellEditModule.editedColumn))) {
5074
5101
  if (nextElement) {
5075
5102
  if ($target.classList.contains('e-rowcell')) {
5076
5103
  this.manageFocus($target, 'remove', false);
@@ -5548,8 +5575,8 @@ class Timeline {
5548
5575
  }
5549
5576
  }
5550
5577
  const newTimeline = extend({}, {}, zoomingLevel, true);
5551
- this.roundOffDateToZoom(this.parent.cloneProjectStartDate, true, perDayWidth, newTimeline.bottomTier.unit);
5552
- this.roundOffDateToZoom(this.parent.cloneProjectEndDate, false, perDayWidth, newTimeline.bottomTier.unit);
5578
+ this.roundOffDateToZoom(this.parent.cloneProjectStartDate, true, perDayWidth, newTimeline.bottomTier.unit, zoomingLevel);
5579
+ this.roundOffDateToZoom(this.parent.cloneProjectEndDate, false, perDayWidth, newTimeline.bottomTier.unit, zoomingLevel);
5553
5580
  const numberOfCells = this.calculateNumberOfTimelineCells(newTimeline);
5554
5581
  const scrollHeight = this.parent.ganttChartModule.scrollElement.offsetHeight - 17; //17 is horizontal scrollbar width
5555
5582
  const contentHeight = this.parent.ganttChartModule.chartBodyContent.offsetHeight;
@@ -5565,24 +5592,40 @@ class Timeline {
5565
5592
  this.parent.trigger('actionBegin', args);
5566
5593
  this.changeTimelineSettings(newTimeline);
5567
5594
  }
5568
- roundOffDateToZoom(date, isStartDate, perDayWidth, tierMode) {
5569
- const width = tierMode === 'Month' || tierMode === 'Year' ? 60 : 20;
5570
- const roundOffTime = (width / perDayWidth) * (24 * 60 * 60 * 1000);
5595
+ bottomTierCellWidthCalc(mode, zoomLevel, date) {
5596
+ let convertedMilliSeconds;
5597
+ switch (mode) {
5598
+ case 'Minutes':
5599
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 1000);
5600
+ break;
5601
+ case 'Hour':
5602
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 60 * 1000);
5603
+ break;
5604
+ case 'Week':
5605
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (7 * 24 * 60 * 60 * 1000);
5606
+ break;
5607
+ case 'Day':
5608
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (24 * 60 * 60 * 1000);
5609
+ break;
5610
+ case 'Month':
5611
+ const daysInMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
5612
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 60 * 24 * daysInMonth * 1000);
5613
+ break;
5614
+ case 'Year':
5615
+ const daysInYear = (date.getFullYear() % 400 === 0 || (date.getFullYear() % 100 !== 0 && date.getFullYear() % 4 === 0)) ? 366 : 365;
5616
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 60 * 24 * daysInYear * 1000);
5617
+ break;
5618
+ }
5619
+ return convertedMilliSeconds;
5620
+ }
5621
+ roundOffDateToZoom(date, isStartDate, perDayWidth, tierMode, zoomingLevel) {
5622
+ const roundOffTime = this.bottomTierCellWidthCalc(tierMode, zoomingLevel, date);
5571
5623
  if (isStartDate) {
5572
5624
  date.setTime(date.getTime() - roundOffTime);
5573
5625
  }
5574
5626
  else {
5575
5627
  date.setTime(date.getTime() + roundOffTime);
5576
5628
  }
5577
- if (tierMode === 'Hour') {
5578
- date.setMinutes(isStartDate ? -120 : 120);
5579
- }
5580
- else if (tierMode === 'Minutes') {
5581
- date.setSeconds(isStartDate ? -120 : 120);
5582
- }
5583
- else {
5584
- date.setHours(isStartDate ? -48 : 48, 0, 0, 0);
5585
- }
5586
5629
  }
5587
5630
  calculateNumberOfTimelineCells(newTimeline) {
5588
5631
  const numberOfDays = Math.abs((this.parent.cloneProjectEndDate.getTime() -
@@ -6707,7 +6750,10 @@ class Timeline {
6707
6750
  if (type === 'prevTimeSpan' && isFrom === 'publicMethod') {
6708
6751
  this.parent.ganttChartModule.updateScrollLeft(0);
6709
6752
  }
6710
- else if ((type === 'nextTimeSpan' && isFrom === 'publicMethod') || (type === 'nextTimeSpan' && isFrom === 'TaskbarEditing')) {
6753
+ else if (type === 'nextTimeSpan' && isFrom === 'publicMethod') {
6754
+ this.parent.ganttChartModule.updateScrollLeft(this.parent.timelineModule.totalTimelineWidth);
6755
+ }
6756
+ else if (type === 'nextTimeSpan' && isFrom === 'TaskbarEditing') {
6711
6757
  let currentScrollLeft = document.getElementsByClassName('e-chart-scroll-container e-content')[0].scrollLeft;
6712
6758
  this.parent.element.querySelector('.e-timeline-header-container').scrollLeft = currentScrollLeft;
6713
6759
  }
@@ -6887,6 +6933,7 @@ class GanttTreeGrid {
6887
6933
  }
6888
6934
  composeProperties() {
6889
6935
  this.parent.treeGrid.showColumnMenu = this.parent.showColumnMenu;
6936
+ this.parent.treeGrid.enableCollapseAll = this.parent.collapseAllParentTasks;
6890
6937
  this.parent.treeGrid.columnMenuItems = this.parent.columnMenuItems;
6891
6938
  this.parent.treeGrid.childMapping = isNullOrUndefined(this.parent.taskFields.child) ? '' : this.parent.taskFields.child;
6892
6939
  this.parent.treeGrid.treeColumnIndex = this.parent.treeColumnIndex;
@@ -9617,6 +9664,12 @@ class ChartRows extends DateProcessor {
9617
9664
  }
9618
9665
  const dataId = this.parent.viewType === 'ProjectView' ? data.ganttProperties.taskId : data.ganttProperties.rowUniqueID;
9619
9666
  this.parent.treeGrid.grid.setRowData(dataId, data);
9667
+ let nextEditableElement = this.parent.ganttChartModule.tempNextElement;
9668
+ if (this.parent.ganttChartModule.isEditableElement && nextEditableElement) {
9669
+ this.parent.treeGrid.grid.focusModule.focus();
9670
+ addClass([this.parent.treeGrid.getRows()[tr['ariaRowIndex']].children[this.parent.ganttChartModule.childrenIndex]], 'e-focused');
9671
+ this.parent.ganttChartModule.tempNextElement = null;
9672
+ }
9620
9673
  const row = this.parent.treeGrid.grid.getRowObjectFromUID(this.parent.treeGrid.grid.getDataRows()[index].getAttribute('data-uid'));
9621
9674
  row.data = data;
9622
9675
  }
@@ -11807,7 +11860,7 @@ class Tooltip$1 {
11807
11860
  if (ganttData) {
11808
11861
  data = ganttData.ganttProperties;
11809
11862
  taskName = !isNullOrUndefined(data.taskName) ? '<tr class = "e-gantt-tooltip-rowcell"><td colspan="3">' +
11810
- data.taskName + '</td></tr>' : '';
11863
+ (this.parent.disableHtmlEncode ? data.taskName.replace(/</g, "&lt;").replace(/>/g, "&gt;") : data.taskName) + '</td></tr>' : '';
11811
11864
  }
11812
11865
  switch (elementType) {
11813
11866
  case 'milestone':
@@ -21259,7 +21312,7 @@ class Edit$2 {
21259
21312
  if (column.field === this.parent.taskFields.id) {
21260
21313
  this.updateIDColumnEditParams(column);
21261
21314
  }
21262
- else if (column.field === this.parent.taskFields.progress) {
21315
+ else if (column.field === this.parent.taskFields.progress && isNullOrUndefined(column.edit)) {
21263
21316
  this.updateProgessColumnEditParams(column);
21264
21317
  }
21265
21318
  else if (column.field === this.parent.taskFields.resourceInfo) {
@@ -23222,6 +23275,7 @@ class Edit$2 {
23222
23275
  eventArgs.modifiedRecords = args.updatedRecordCollection;
23223
23276
  eventArgs.modifiedTaskData = getTaskData(args.updatedRecordCollection, null, null, this.parent);
23224
23277
  setValue('action', args.action, eventArgs);
23278
+ this.parent.isOnDelete = false;
23225
23279
  this.parent.trigger('actionComplete', eventArgs);
23226
23280
  this.deletedTaskDetails = [];
23227
23281
  this.parent.initiateEditAction(false);
@@ -27535,7 +27589,7 @@ class ContextMenu$2 {
27535
27589
  let rowIndex = -1;
27536
27590
  if (args.gridRow) {
27537
27591
  // eslint-disable-next-line
27538
- rowIndex = parseInt(args.gridRow.getAttribute('aria-rowindex'), 0);
27592
+ rowIndex = parseInt(args.gridRow.getAttribute('data-rowindex'), 0);
27539
27593
  }
27540
27594
  else if (args.chartRow) {
27541
27595
  // eslint-disable-next-line
@@ -28164,7 +28218,7 @@ class RowDD$1 {
28164
28218
  ganttDragelem.remove();
28165
28219
  }
28166
28220
  const gridRow = closest(args.target, '.e-row');
28167
- const dropIndex = gridRow ? parseInt(gridRow.getAttribute('aria-rowindex'), 10) : args.dropIndex;
28221
+ const dropIndex = gridRow ? parseInt(gridRow.getAttribute('data-rowindex'), 10) : args.dropIndex;
28168
28222
  args.dropIndex = dropIndex;
28169
28223
  args.dropRecord = this.parent.updatedRecords[args.dropIndex];
28170
28224
  this.parent.trigger('rowDrop', args);
@@ -28473,6 +28527,7 @@ class RowDD$1 {
28473
28527
  const proxy = this.parent;
28474
28528
  let tempDataSource;
28475
28529
  let idx;
28530
+ const ganttFields = this.parent.taskFields;
28476
28531
  if (this.parent.dataSource instanceof DataManager) {
28477
28532
  tempDataSource = getValue('dataOperation.dataArray', this.parent);
28478
28533
  }
@@ -28481,7 +28536,12 @@ class RowDD$1 {
28481
28536
  }
28482
28537
  if (tempDataSource.length > 0 && (!isNullOrUndefined(droppedRecord) && !droppedRecord.parentItem)) {
28483
28538
  for (let i = 0; i < Object.keys(tempDataSource).length; i++) {
28484
- if (tempDataSource[i][this.parent.taskFields.child] === droppedRecord.taskData[this.parent.taskFields.child]) {
28539
+ if (!isNullOrUndefined(droppedRecord.taskData[ganttFields.child]) &&
28540
+ tempDataSource[i][ganttFields.child] === droppedRecord.taskData[ganttFields.child]) {
28541
+ idx = i;
28542
+ }
28543
+ else if (isNullOrUndefined(droppedRecord.taskData[ganttFields.child]) &&
28544
+ droppedRecord.taskData[ganttFields.id] === tempDataSource[i][ganttFields.id]) {
28485
28545
  idx = i;
28486
28546
  }
28487
28547
  }