@syncfusion/ej2-gantt 20.2.36 → 20.2.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.
@@ -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);
@@ -4862,6 +4862,9 @@ var GanttChart = /** @__PURE__ @class */ (function () {
4862
4862
  * @private
4863
4863
  */
4864
4864
  GanttChart.prototype.expandedGanttRow = function (args) {
4865
+ if (isNullOrUndefined(args['gridRow'])) {
4866
+ return;
4867
+ }
4865
4868
  var record = getValue('data', args);
4866
4869
  if (this.isExpandCollapseFromChart) {
4867
4870
  this.expandCollapseChartRows('expand', getValue('chartRow', args), record, null);
@@ -5609,8 +5612,8 @@ var Timeline = /** @__PURE__ @class */ (function () {
5609
5612
  }
5610
5613
  }
5611
5614
  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);
5615
+ this.roundOffDateToZoom(this.parent.cloneProjectStartDate, true, perDayWidth, newTimeline.bottomTier.unit, zoomingLevel);
5616
+ this.roundOffDateToZoom(this.parent.cloneProjectEndDate, false, perDayWidth, newTimeline.bottomTier.unit, zoomingLevel);
5614
5617
  var numberOfCells = this.calculateNumberOfTimelineCells(newTimeline);
5615
5618
  var scrollHeight = this.parent.ganttChartModule.scrollElement.offsetHeight - 17; //17 is horizontal scrollbar width
5616
5619
  var contentHeight = this.parent.ganttChartModule.chartBodyContent.offsetHeight;
@@ -5626,24 +5629,40 @@ var Timeline = /** @__PURE__ @class */ (function () {
5626
5629
  this.parent.trigger('actionBegin', args);
5627
5630
  this.changeTimelineSettings(newTimeline);
5628
5631
  };
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);
5632
+ Timeline.prototype.bottomTierCellWidthCalc = function (mode, zoomLevel, date) {
5633
+ var convertedMilliSeconds;
5634
+ switch (mode) {
5635
+ case 'Minutes':
5636
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 1000);
5637
+ break;
5638
+ case 'Hour':
5639
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 60 * 1000);
5640
+ break;
5641
+ case 'Week':
5642
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (7 * 24 * 60 * 60 * 1000);
5643
+ break;
5644
+ case 'Day':
5645
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (24 * 60 * 60 * 1000);
5646
+ break;
5647
+ case 'Month':
5648
+ var daysInMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
5649
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 60 * 24 * daysInMonth * 1000);
5650
+ break;
5651
+ case 'Year':
5652
+ var daysInYear = (date.getFullYear() % 400 === 0 || (date.getFullYear() % 100 !== 0 && date.getFullYear() % 4 === 0)) ? 366 : 365;
5653
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 60 * 24 * daysInYear * 1000);
5654
+ break;
5655
+ }
5656
+ return convertedMilliSeconds;
5657
+ };
5658
+ Timeline.prototype.roundOffDateToZoom = function (date, isStartDate, perDayWidth, tierMode, zoomingLevel) {
5659
+ var roundOffTime = this.bottomTierCellWidthCalc(tierMode, zoomingLevel, date);
5632
5660
  if (isStartDate) {
5633
5661
  date.setTime(date.getTime() - roundOffTime);
5634
5662
  }
5635
5663
  else {
5636
5664
  date.setTime(date.getTime() + roundOffTime);
5637
5665
  }
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
5666
  };
5648
5667
  Timeline.prototype.calculateNumberOfTimelineCells = function (newTimeline) {
5649
5668
  var numberOfDays = Math.abs((this.parent.cloneProjectEndDate.getTime() -
@@ -6773,7 +6792,10 @@ var Timeline = /** @__PURE__ @class */ (function () {
6773
6792
  if (type === 'prevTimeSpan' && isFrom === 'publicMethod') {
6774
6793
  this.parent.ganttChartModule.updateScrollLeft(0);
6775
6794
  }
6776
- else if ((type === 'nextTimeSpan' && isFrom === 'publicMethod') || (type === 'nextTimeSpan' && isFrom === 'TaskbarEditing')) {
6795
+ else if (type === 'nextTimeSpan' && isFrom === 'publicMethod') {
6796
+ this.parent.ganttChartModule.updateScrollLeft(this.parent.timelineModule.totalTimelineWidth);
6797
+ }
6798
+ else if (type === 'nextTimeSpan' && isFrom === 'TaskbarEditing') {
6777
6799
  var currentScrollLeft = document.getElementsByClassName('e-chart-scroll-container e-content')[0].scrollLeft;
6778
6800
  this.parent.element.querySelector('.e-timeline-header-container').scrollLeft = currentScrollLeft;
6779
6801
  }