@syncfusion/ej2-gantt 20.1.50 → 20.1.55

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.
@@ -5030,7 +5030,7 @@ class GanttChart {
5030
5030
  this.parent.treeGrid.grid.notify('key-pressed', e);
5031
5031
  }
5032
5032
  }
5033
- if (!this.parent.editModule.cellEditModule.isCellEdit) {
5033
+ if (!isInEditedState) {
5034
5034
  if (nextElement) {
5035
5035
  if ($target.classList.contains('e-rowcell')) {
5036
5036
  this.manageFocus($target, 'remove', false);
@@ -6092,7 +6092,7 @@ class Timeline {
6092
6092
  // PDf export collection
6093
6093
  const timelineCell = {};
6094
6094
  timelineCell.startDate = new Date(startDate.getTime());
6095
- if (mode === 'Month' && tier === 'bottomTier' && ((this.parent.currentZoomingLevel.level === 5) || (this.parent.currentZoomingLevel.level === 6)) && scheduleDateCollection.length === 0) {
6095
+ if (mode === 'Month' && tier === 'bottomTier' && (count != 1) && scheduleDateCollection.length === 0) {
6096
6096
  isFirstCell = true;
6097
6097
  }
6098
6098
  parentTr = this.getHeaterTemplateString(new Date(startDate.toString()), mode, tier, false, count, timelineCell, isFirstCell);
@@ -6106,6 +6106,10 @@ class Timeline {
6106
6106
  }
6107
6107
  isFirstCell = false;
6108
6108
  startDate.setTime(newTime);
6109
+ if (startDate.getHours() === 5 && count === 2 && tier === 'bottomTier' &&
6110
+ this.parent.timelineSettings.bottomTier.unit === 'Hour') {
6111
+ startDate.setTime(startDate.getTime() - (1000 * 60 * 60));
6112
+ }
6109
6113
  if (startDate >= endDate) {
6110
6114
  /* eslint-disable-next-line */
6111
6115
  parentTr = this.getHeaterTemplateString(scheduleDateCollection[scheduleDateCollection.length - 1], mode, tier, true, count, timelineCell);
@@ -6226,12 +6230,12 @@ class Timeline {
6226
6230
  checkDate(firstDay, lastDay, increment, count) {
6227
6231
  var date = new Date(firstDay.getTime());
6228
6232
  date.setTime(date.getTime() + increment);
6229
- if (((date.getTime() - lastDay.getTime()) / (1000 * 60 * 60)) != count && (firstDay.getTimezoneOffset() !== date.getTimezoneOffset())) {
6233
+ if (count !== 1 && ((date.getTime() - lastDay.getTime()) / (1000 * 60 * 60)) != count && (firstDay.getTimezoneOffset() !== date.getTimezoneOffset())) {
6230
6234
  var diffCount = count - (date.getTime() - lastDay.getTime()) / (1000 * 60 * 60);
6231
6235
  if (!this.parent.isInDst(date)) {
6232
6236
  increment += (1000 * 60 * 60 * diffCount);
6233
6237
  }
6234
- else if (this.parent.isInDst(date)) {
6238
+ else if (this.parent.isInDst(date) && count !== 2) {
6235
6239
  increment -= (1000 * 60 * 60 * diffCount);
6236
6240
  }
6237
6241
  }
@@ -6984,7 +6988,7 @@ class GanttTreeGrid {
6984
6988
  return eventArgs;
6985
6989
  }
6986
6990
  treeActionComplete(args) {
6987
- const updatedArgs = extend({}, args, true);
6991
+ const updatedArgs = extend({}, args);
6988
6992
  if (getValue('requestType', args) === 'sorting') {
6989
6993
  this.parent.notify('updateModel', {});
6990
6994
  deleteObject(updatedArgs, 'isFrozen');
@@ -8051,8 +8055,8 @@ class ChartRows extends DateProcessor {
8051
8055
  labelString = this.getTaskLabel(this.parent.labelSettings.taskLabel);
8052
8056
  labelString = labelString === 'isCustomTemplate' ? this.parent.labelSettings.taskLabel : labelString;
8053
8057
  }
8054
- if (labelString !== 'null') {
8055
- if (this.getTaskLabel(this.parent.labelSettings.taskLabel) === 'isCustomTemplate') {
8058
+ if (labelString.indexOf('null') === -1) {
8059
+ if (this.getTaskLabel(this.parent.labelSettings.taskLabel) === 'isCustomTemplate' && !this.isTemplate(this.parent.labelSettings.taskLabel)) {
8056
8060
  labelString = '';
8057
8061
  }
8058
8062
  if (isNaN(parseInt(labelString))) {
@@ -8093,14 +8097,16 @@ class ChartRows extends DateProcessor {
8093
8097
  data.ganttProperties.segments.length === 0))) {
8094
8098
  if (template !== '' && !isNullOrUndefined(progressDiv) && progressDiv.length > 0) {
8095
8099
  let templateElement = this.createDivElement(template)[0];
8096
- templateElement.appendChild(tempDiv);
8097
- progressDiv[0].appendChild(templateElement);
8098
8100
  let childLabel = this.parent.labelSettings.taskLabel;
8101
+ if (childLabel && childLabel['elementRef'])
8102
+ templateElement.appendChild(tempDiv);
8103
+ progressDiv[0].appendChild(templateElement);
8099
8104
  if (progressDiv[0].querySelectorAll('.e-task-label')[0].textContent !== '' &&
8100
- !this.isTemplate(childLabel))
8105
+ !this.isTemplate(childLabel) &&
8106
+ progressDiv[0].querySelectorAll('.e-task-label')[0].children[0])
8101
8107
  progressDiv[0].querySelectorAll('.e-task-label')[0].children[0].remove();
8102
8108
  if (progressDiv[0].querySelectorAll('.e-task-label')[0].textContent == '' &&
8103
- childLabel && !childLabel['elementRef'])
8109
+ childLabel && !childLabel['elementRef'] && tempDiv.innerHTML != '')
8104
8110
  progressDiv[0].querySelectorAll('.e-task-label')[0].textContent = childLabel;
8105
8111
  }
8106
8112
  if (!isNullOrUndefined(taskbarInnerDiv) && taskbarInnerDiv.length > 0) {
@@ -8687,8 +8693,8 @@ class ChartRows extends DateProcessor {
8687
8693
  labelString = this.getTaskLabel(this.parent.labelSettings.taskLabel);
8688
8694
  labelString = labelString === 'isCustomTemplate' ? this.parent.labelSettings.taskLabel : labelString;
8689
8695
  }
8690
- if (labelString !== 'null') {
8691
- if (this.getTaskLabel(this.parent.labelSettings.taskLabel) === 'isCustomTemplate') {
8696
+ if (labelString.indexOf('null') === -1) {
8697
+ if (this.getTaskLabel(this.parent.labelSettings.taskLabel) === 'isCustomTemplate' && !this.isTemplate(this.parent.labelSettings.taskLabel)) {
8692
8698
  labelString = '';
8693
8699
  }
8694
8700
  if (isNaN(parseInt(labelString))) {
@@ -8708,14 +8714,16 @@ class ChartRows extends DateProcessor {
8708
8714
  this.taskBarHeight + 'px;">' + labelString + '</span>';
8709
8715
  }
8710
8716
  let labelElement = this.createDivElement(labelDiv)[0];
8711
- labelElement.appendChild(div);
8712
- progressBarInnerDiv[0].appendChild(labelElement);
8713
8717
  let parentLabel = this.parent.labelSettings.taskLabel;
8718
+ if (parentLabel && parentLabel['elementRef'])
8719
+ labelElement.appendChild(div);
8720
+ progressBarInnerDiv[0].appendChild(labelElement);
8714
8721
  if (progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].textContent !== '' &&
8715
- !this.isTemplate(parentLabel))
8722
+ !this.isTemplate(parentLabel) &&
8723
+ progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].children[0])
8716
8724
  progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].children[0].remove();
8717
8725
  if (progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].textContent == '' &&
8718
- parentLabel && !parentLabel['elementRef'])
8726
+ parentLabel && !parentLabel['elementRef'] && div.innerHTML != '')
8719
8727
  progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].textContent = parentLabel;
8720
8728
  }
8721
8729
  const milestoneTemplate = '<div class="' + parentMilestone + '" style="position:absolute;">' +
@@ -12562,6 +12570,9 @@ let Gantt = class Gantt extends Component {
12562
12570
  }
12563
12571
  else {
12564
12572
  this.treeGrid.dataSource = this.flatData;
12573
+ if (!isNullOrUndefined(document.getElementsByClassName('e-listview')[0])) {
12574
+ this.treeGrid.dataBind();
12575
+ }
12565
12576
  }
12566
12577
  }
12567
12578
  else {
@@ -21304,6 +21315,9 @@ class Edit$2 {
21304
21315
  if (!isNullOrUndefined(this.parent.editModule) && ganttData) {
21305
21316
  this.parent.isOnEdit = true;
21306
21317
  this.validateUpdateValues(data, ganttData, true);
21318
+ if (data[this.parent.taskFields.resourceInfo]) {
21319
+ this.updateResourceRelatedFields(ganttData, 'resource');
21320
+ }
21307
21321
  const keys = Object.keys(data);
21308
21322
  if (keys.indexOf(tasks.startDate) !== -1 || keys.indexOf(tasks.endDate) !== -1 ||
21309
21323
  keys.indexOf(tasks.duration) !== -1) {
@@ -24755,7 +24769,7 @@ class Filter$1 {
24755
24769
  }
24756
24770
  updateFilterMenuPosition(element, args) {
24757
24771
  addClass([element], 'e-gantt');
24758
- document.body.appendChild(element);
24772
+ document.querySelector('#' + this.parent.controlId).appendChild(element);
24759
24773
  let targetElement;
24760
24774
  if (this.parent.showColumnMenu) {
24761
24775
  targetElement = document.querySelector('#treeGrid' + this.parent.controlId + '_gridcontrol_colmenu_Filter');
@@ -25873,6 +25887,7 @@ class Toolbar$3 {
25873
25887
 
25874
25888
  class NonWorkingDay {
25875
25889
  constructor(gantt) {
25890
+ this.weekendWidthUpdated = false;
25876
25891
  this.parent = gantt;
25877
25892
  this.nonworkingContainer = null;
25878
25893
  this.holidayContainer = null;
@@ -26012,6 +26027,14 @@ class NonWorkingDay {
26012
26027
  width = this.parent.dataOperation.getTaskWidth(start, tempEnd);
26013
26028
  isFirstCell = false;
26014
26029
  }
26030
+ let sDate = new Date(startDate);
26031
+ sDate.setDate(sDate.getDate() + 1);
26032
+ if (sDate.getTimezoneOffset() != this.parent.timelineModule.timelineStartDate.getTimezoneOffset() && !this.weekendWidthUpdated) {
26033
+ if (this.parent.timelineModule.bottomTier == 'Hour' && this.parent.timelineSettings.bottomTier.count === 1) {
26034
+ width = width - this.parent.timelineSettings.timelineUnitSize;
26035
+ this.weekendWidthUpdated = true;
26036
+ }
26037
+ }
26015
26038
  const weekendDiv = createElement('div', {
26016
26039
  className: weekend, styles: `left:${left}px;width:${width}px;height:100%;`
26017
26040
  });
@@ -30158,6 +30181,9 @@ class ExportHelper {
30158
30181
  if (data[this.parent.labelSettings.rightLabel]) {
30159
30182
  taskbar.rightTaskLabel.value = data[this.parent.labelSettings.rightLabel].toString();
30160
30183
  }
30184
+ if (data[this.parent.labelSettings.taskLabel]) {
30185
+ taskbar.taskLabel = data[this.parent.labelSettings.taskLabel].toString();
30186
+ }
30161
30187
  const reduceLeft = ganttProp.isMilestone ? Math.floor(this.parent.chartRowsModule.taskBarHeight / 2) + 33 : 33; // 33 indicates default timeline cell width
30162
30188
  taskbar.rightTaskLabel.left = ganttProp.left + ganttProp.width + reduceLeft; // right label left value
30163
30189
  taskbar.fontFamily = this.ganttStyle.fontFamily;
@@ -30506,6 +30532,12 @@ class PdfGanttTaskbarCollection {
30506
30532
  const progressFormat = new PdfStringFormat();
30507
30533
  progressFormat.lineAlignment = PdfVerticalAlignment.Middle;
30508
30534
  progressFormat.alignment = PdfTextAlignment.Right;
30535
+ let isLabelString = false;
30536
+ let updatedWidth;
30537
+ if (/^[a-zA-Z]/.test(this.taskLabel)) {
30538
+ isLabelString = true;
30539
+ progressFormat.alignment = PdfTextAlignment.Left;
30540
+ }
30509
30541
  let pageIndex = -1;
30510
30542
  if (!taskbar.isMilestone) {
30511
30543
  const taskbarPen = new PdfPen(taskbar.taskBorderColor);
@@ -30527,10 +30559,14 @@ class PdfGanttTaskbarCollection {
30527
30559
  }
30528
30560
  else {
30529
30561
  taskGraphics.drawRectangle(taskbarPen, taskBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth) + 0.5, startPoint.y + adjustHeight, pixelToPoint(taskbar.width), pixelToPoint(taskbar.height));
30530
- if (this.progress > 0 && this.progressWidth > 0 && this.isScheduledTask) {
30562
+ if (this.isScheduledTask) {
30531
30563
  taskGraphics.drawRectangle(progressPen, progressBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth) + 0.5, startPoint.y + adjustHeight, pixelToPoint(taskbar.progressWidth), pixelToPoint(taskbar.height));
30532
- if (!isNullOrUndefined(this.parent.taskFields.progress) && !isNullOrUndefined(this.parent.labelSettings.taskLabel)) {
30533
- taskGraphics.drawString(this.progress.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth), startPoint.y + adjustHeight, pixelToPoint(this.progressWidth), pixelToPoint(this.height), progressFormat);
30564
+ if (!isNullOrUndefined(this.parent.labelSettings.taskLabel) && !isNullOrUndefined(this.taskLabel)) {
30565
+ updatedWidth = this.progressWidth;
30566
+ if (isLabelString) {
30567
+ updatedWidth = this.width;
30568
+ }
30569
+ taskGraphics.drawString(this.taskLabel.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth), startPoint.y + adjustHeight, pixelToPoint(updatedWidth), pixelToPoint(this.height), progressFormat);
30534
30570
  }
30535
30571
  }
30536
30572
  }
@@ -30545,14 +30581,16 @@ class PdfGanttTaskbarCollection {
30545
30581
  this.isStartPoint = true;
30546
30582
  }
30547
30583
  let renderWidth = 0;
30548
- this.width = this.width - (detail.totalWidth - (this.left - cumulativeWidth));
30584
+ if (!isLabelString) {
30585
+ this.width = this.width - (detail.totalWidth - (this.left - cumulativeWidth));
30586
+ }
30549
30587
  renderWidth = (detail.totalWidth - (this.left - cumulativeWidth));
30550
30588
  if (!this.isScheduledTask && this.unscheduledTaskBy !== 'duration') {
30551
30589
  this.drawUnscheduledTask(taskGraphics, startPoint, cumulativeWidth, adjustHeight);
30552
30590
  }
30553
30591
  else {
30554
30592
  taskGraphics.drawRectangle(taskbarPen, taskBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth) + 0.5, startPoint.y + adjustHeight, pixelToPoint(renderWidth), pixelToPoint(taskbar.height));
30555
- if (this.progress > 0 && this.progressWidth > 0 && this.isScheduledTask) {
30593
+ if (this.isScheduledTask) {
30556
30594
  let progressBoundsWidth = 0;
30557
30595
  if (this.progressWidth <= renderWidth) {
30558
30596
  progressBoundsWidth = this.progressWidth;
@@ -30562,8 +30600,12 @@ class PdfGanttTaskbarCollection {
30562
30600
  }
30563
30601
  taskGraphics.drawRectangle(progressPen, progressBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth) + 0.5, startPoint.y + adjustHeight, pixelToPoint(progressBoundsWidth), pixelToPoint(taskbar.height));
30564
30602
  this.progressWidth -= progressBoundsWidth;
30565
- if (this.progressWidth === 0 && this.progress !== 0 && this.parent.labelSettings.taskLabel) {
30566
- taskGraphics.drawString(this.progress.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth), (startPoint.y + adjustHeight), pixelToPoint(progressBoundsWidth), pixelToPoint(this.height), progressFormat);
30603
+ if (this.parent.labelSettings.taskLabel && !isNullOrUndefined(this.taskLabel)) {
30604
+ updatedWidth = progressBoundsWidth;
30605
+ if (isLabelString) {
30606
+ updatedWidth = this.width;
30607
+ }
30608
+ taskGraphics.drawString(this.taskLabel.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth), (startPoint.y + adjustHeight), pixelToPoint(updatedWidth), pixelToPoint(this.height), progressFormat);
30567
30609
  }
30568
30610
  }
30569
30611
  }
@@ -30580,8 +30622,12 @@ class PdfGanttTaskbarCollection {
30580
30622
  taskGraphics.drawRectangle(taskbarPen, taskBrush, startPoint.x + pixelToPoint(taskbar.left + 0.5), startPoint.y + adjustHeight, pixelToPoint(taskbar.width), pixelToPoint(taskbar.height));
30581
30623
  if (this.isScheduledTask) {
30582
30624
  taskGraphics.drawRectangle(progressPen, progressBrush, startPoint.x + pixelToPoint(taskbar.left + 0.5), startPoint.y + adjustHeight, pixelToPoint(taskbar.progressWidth), pixelToPoint(taskbar.height));
30583
- if (this.progressWidth === 0 && this.progress !== 0) {
30584
- taskGraphics.drawString(this.progress.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left), (startPoint.y + adjustHeight), pixelToPoint(this.progressWidth), pixelToPoint(this.height), progressFormat);
30625
+ if (!isNullOrUndefined(this.taskLabel)) {
30626
+ updatedWidth = this.progressWidth;
30627
+ if (isLabelString) {
30628
+ updatedWidth = this.width;
30629
+ }
30630
+ taskGraphics.drawString(this.taskLabel.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left), (startPoint.y + adjustHeight), pixelToPoint(updatedWidth), pixelToPoint(this.height), progressFormat);
30585
30631
  }
30586
30632
  }
30587
30633
  this.isCompleted = true;
@@ -30595,7 +30641,7 @@ class PdfGanttTaskbarCollection {
30595
30641
  this.isStartPoint = true;
30596
30642
  }
30597
30643
  taskGraphics.drawRectangle(taskbarPen, taskBrush, startPoint.x + pixelToPoint(taskbar.left) + 0.5, startPoint.y + adjustHeight, pixelToPoint(detail.totalWidth), pixelToPoint(taskbar.height));
30598
- if (this.progress > 0 && this.progressWidth > 0 && this.isScheduledTask) {
30644
+ if (this.isScheduledTask) {
30599
30645
  let progressBoundsWidth = 0;
30600
30646
  if (this.progressWidth <= detail.totalWidth) {
30601
30647
  progressBoundsWidth = this.progressWidth;
@@ -30605,8 +30651,12 @@ class PdfGanttTaskbarCollection {
30605
30651
  }
30606
30652
  taskGraphics.drawRectangle(progressPen, progressBrush, startPoint.x + pixelToPoint(taskbar.left) + 0.5, startPoint.y + adjustHeight, pixelToPoint(progressBoundsWidth), pixelToPoint(taskbar.height));
30607
30653
  this.progressWidth -= progressBoundsWidth;
30608
- if (this.progressWidth === 0 && this.progress !== 0) {
30609
- taskGraphics.drawString(this.progress.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left), (startPoint.y + adjustHeight), pixelToPoint(progressBoundsWidth), pixelToPoint(this.height), progressFormat);
30654
+ if (!isNullOrUndefined(this.taskLabel)) {
30655
+ updatedWidth = progressBoundsWidth;
30656
+ if (isLabelString) {
30657
+ updatedWidth = this.width;
30658
+ }
30659
+ taskGraphics.drawString(this.taskLabel.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left), (startPoint.y + adjustHeight), pixelToPoint(updatedWidth), pixelToPoint(this.height), progressFormat);
30610
30660
  }
30611
30661
  }
30612
30662
  this.isCompleted = false;