@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.
@@ -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);
@@ -4816,6 +4816,9 @@ class GanttChart {
4816
4816
  * @private
4817
4817
  */
4818
4818
  expandedGanttRow(args) {
4819
+ if (isNullOrUndefined(args['gridRow'])) {
4820
+ return;
4821
+ }
4819
4822
  const record = getValue('data', args);
4820
4823
  if (this.isExpandCollapseFromChart) {
4821
4824
  this.expandCollapseChartRows('expand', getValue('chartRow', args), record, null);
@@ -5548,8 +5551,8 @@ class Timeline {
5548
5551
  }
5549
5552
  }
5550
5553
  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);
5554
+ this.roundOffDateToZoom(this.parent.cloneProjectStartDate, true, perDayWidth, newTimeline.bottomTier.unit, zoomingLevel);
5555
+ this.roundOffDateToZoom(this.parent.cloneProjectEndDate, false, perDayWidth, newTimeline.bottomTier.unit, zoomingLevel);
5553
5556
  const numberOfCells = this.calculateNumberOfTimelineCells(newTimeline);
5554
5557
  const scrollHeight = this.parent.ganttChartModule.scrollElement.offsetHeight - 17; //17 is horizontal scrollbar width
5555
5558
  const contentHeight = this.parent.ganttChartModule.chartBodyContent.offsetHeight;
@@ -5565,24 +5568,40 @@ class Timeline {
5565
5568
  this.parent.trigger('actionBegin', args);
5566
5569
  this.changeTimelineSettings(newTimeline);
5567
5570
  }
5568
- roundOffDateToZoom(date, isStartDate, perDayWidth, tierMode) {
5569
- const width = tierMode === 'Month' || tierMode === 'Year' ? 60 : 20;
5570
- const roundOffTime = (width / perDayWidth) * (24 * 60 * 60 * 1000);
5571
+ bottomTierCellWidthCalc(mode, zoomLevel, date) {
5572
+ let convertedMilliSeconds;
5573
+ switch (mode) {
5574
+ case 'Minutes':
5575
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 1000);
5576
+ break;
5577
+ case 'Hour':
5578
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 60 * 1000);
5579
+ break;
5580
+ case 'Week':
5581
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (7 * 24 * 60 * 60 * 1000);
5582
+ break;
5583
+ case 'Day':
5584
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (24 * 60 * 60 * 1000);
5585
+ break;
5586
+ case 'Month':
5587
+ const daysInMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
5588
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 60 * 24 * daysInMonth * 1000);
5589
+ break;
5590
+ case 'Year':
5591
+ const daysInYear = (date.getFullYear() % 400 === 0 || (date.getFullYear() % 100 !== 0 && date.getFullYear() % 4 === 0)) ? 366 : 365;
5592
+ convertedMilliSeconds = zoomLevel.bottomTier.count * (60 * 60 * 24 * daysInYear * 1000);
5593
+ break;
5594
+ }
5595
+ return convertedMilliSeconds;
5596
+ }
5597
+ roundOffDateToZoom(date, isStartDate, perDayWidth, tierMode, zoomingLevel) {
5598
+ const roundOffTime = this.bottomTierCellWidthCalc(tierMode, zoomingLevel, date);
5571
5599
  if (isStartDate) {
5572
5600
  date.setTime(date.getTime() - roundOffTime);
5573
5601
  }
5574
5602
  else {
5575
5603
  date.setTime(date.getTime() + roundOffTime);
5576
5604
  }
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
5605
  }
5587
5606
  calculateNumberOfTimelineCells(newTimeline) {
5588
5607
  const numberOfDays = Math.abs((this.parent.cloneProjectEndDate.getTime() -
@@ -6707,7 +6726,10 @@ class Timeline {
6707
6726
  if (type === 'prevTimeSpan' && isFrom === 'publicMethod') {
6708
6727
  this.parent.ganttChartModule.updateScrollLeft(0);
6709
6728
  }
6710
- else if ((type === 'nextTimeSpan' && isFrom === 'publicMethod') || (type === 'nextTimeSpan' && isFrom === 'TaskbarEditing')) {
6729
+ else if (type === 'nextTimeSpan' && isFrom === 'publicMethod') {
6730
+ this.parent.ganttChartModule.updateScrollLeft(this.parent.timelineModule.totalTimelineWidth);
6731
+ }
6732
+ else if (type === 'nextTimeSpan' && isFrom === 'TaskbarEditing') {
6711
6733
  let currentScrollLeft = document.getElementsByClassName('e-chart-scroll-container e-content')[0].scrollLeft;
6712
6734
  this.parent.element.querySelector('.e-timeline-header-container').scrollLeft = currentScrollLeft;
6713
6735
  }