@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.
@@ -5076,7 +5076,7 @@ var GanttChart = /** @__PURE__ @class */ (function () {
5076
5076
  this.parent.treeGrid.grid.notify('key-pressed', e);
5077
5077
  }
5078
5078
  }
5079
- if (!this.parent.editModule.cellEditModule.isCellEdit) {
5079
+ if (!isInEditedState) {
5080
5080
  if (nextElement) {
5081
5081
  if ($target.classList.contains('e-rowcell')) {
5082
5082
  this.manageFocus($target, 'remove', false);
@@ -6158,7 +6158,7 @@ var Timeline = /** @__PURE__ @class */ (function () {
6158
6158
  // PDf export collection
6159
6159
  var timelineCell = {};
6160
6160
  timelineCell.startDate = new Date(startDate.getTime());
6161
- if (mode === 'Month' && tier === 'bottomTier' && ((this.parent.currentZoomingLevel.level === 5) || (this.parent.currentZoomingLevel.level === 6)) && scheduleDateCollection.length === 0) {
6161
+ if (mode === 'Month' && tier === 'bottomTier' && (count != 1) && scheduleDateCollection.length === 0) {
6162
6162
  isFirstCell = true;
6163
6163
  }
6164
6164
  parentTr = this.getHeaterTemplateString(new Date(startDate.toString()), mode, tier, false, count, timelineCell, isFirstCell);
@@ -6172,6 +6172,10 @@ var Timeline = /** @__PURE__ @class */ (function () {
6172
6172
  }
6173
6173
  isFirstCell = false;
6174
6174
  startDate.setTime(newTime);
6175
+ if (startDate.getHours() === 5 && count === 2 && tier === 'bottomTier' &&
6176
+ this.parent.timelineSettings.bottomTier.unit === 'Hour') {
6177
+ startDate.setTime(startDate.getTime() - (1000 * 60 * 60));
6178
+ }
6175
6179
  if (startDate >= endDate) {
6176
6180
  /* eslint-disable-next-line */
6177
6181
  parentTr = this.getHeaterTemplateString(scheduleDateCollection[scheduleDateCollection.length - 1], mode, tier, true, count, timelineCell);
@@ -6292,12 +6296,12 @@ var Timeline = /** @__PURE__ @class */ (function () {
6292
6296
  Timeline.prototype.checkDate = function (firstDay, lastDay, increment, count) {
6293
6297
  var date = new Date(firstDay.getTime());
6294
6298
  date.setTime(date.getTime() + increment);
6295
- if (((date.getTime() - lastDay.getTime()) / (1000 * 60 * 60)) != count && (firstDay.getTimezoneOffset() !== date.getTimezoneOffset())) {
6299
+ if (count !== 1 && ((date.getTime() - lastDay.getTime()) / (1000 * 60 * 60)) != count && (firstDay.getTimezoneOffset() !== date.getTimezoneOffset())) {
6296
6300
  var diffCount = count - (date.getTime() - lastDay.getTime()) / (1000 * 60 * 60);
6297
6301
  if (!this.parent.isInDst(date)) {
6298
6302
  increment += (1000 * 60 * 60 * diffCount);
6299
6303
  }
6300
- else if (this.parent.isInDst(date)) {
6304
+ else if (this.parent.isInDst(date) && count !== 2) {
6301
6305
  increment -= (1000 * 60 * 60 * diffCount);
6302
6306
  }
6303
6307
  }
@@ -7053,7 +7057,7 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7053
7057
  return eventArgs;
7054
7058
  };
7055
7059
  GanttTreeGrid.prototype.treeActionComplete = function (args) {
7056
- var updatedArgs = extend({}, args, true);
7060
+ var updatedArgs = extend({}, args);
7057
7061
  if (getValue('requestType', args) === 'sorting') {
7058
7062
  this.parent.notify('updateModel', {});
7059
7063
  deleteObject(updatedArgs, 'isFrozen');
@@ -8439,8 +8443,8 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
8439
8443
  labelString = this.getTaskLabel(this.parent.labelSettings.taskLabel);
8440
8444
  labelString = labelString === 'isCustomTemplate' ? this.parent.labelSettings.taskLabel : labelString;
8441
8445
  }
8442
- if (labelString !== 'null') {
8443
- if (this.getTaskLabel(this.parent.labelSettings.taskLabel) === 'isCustomTemplate') {
8446
+ if (labelString.indexOf('null') === -1) {
8447
+ if (this.getTaskLabel(this.parent.labelSettings.taskLabel) === 'isCustomTemplate' && !this.isTemplate(this.parent.labelSettings.taskLabel)) {
8444
8448
  labelString = '';
8445
8449
  }
8446
8450
  if (isNaN(parseInt(labelString))) {
@@ -8481,14 +8485,16 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
8481
8485
  data.ganttProperties.segments.length === 0))) {
8482
8486
  if (template !== '' && !isNullOrUndefined(progressDiv) && progressDiv.length > 0) {
8483
8487
  var templateElement = this.createDivElement(template)[0];
8484
- templateElement.appendChild(tempDiv);
8485
- progressDiv[0].appendChild(templateElement);
8486
8488
  var childLabel = this.parent.labelSettings.taskLabel;
8489
+ if (childLabel && childLabel['elementRef'])
8490
+ templateElement.appendChild(tempDiv);
8491
+ progressDiv[0].appendChild(templateElement);
8487
8492
  if (progressDiv[0].querySelectorAll('.e-task-label')[0].textContent !== '' &&
8488
- !this.isTemplate(childLabel))
8493
+ !this.isTemplate(childLabel) &&
8494
+ progressDiv[0].querySelectorAll('.e-task-label')[0].children[0])
8489
8495
  progressDiv[0].querySelectorAll('.e-task-label')[0].children[0].remove();
8490
8496
  if (progressDiv[0].querySelectorAll('.e-task-label')[0].textContent == '' &&
8491
- childLabel && !childLabel['elementRef'])
8497
+ childLabel && !childLabel['elementRef'] && tempDiv.innerHTML != '')
8492
8498
  progressDiv[0].querySelectorAll('.e-task-label')[0].textContent = childLabel;
8493
8499
  }
8494
8500
  if (!isNullOrUndefined(taskbarInnerDiv) && taskbarInnerDiv.length > 0) {
@@ -9075,8 +9081,8 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
9075
9081
  labelString = this.getTaskLabel(this.parent.labelSettings.taskLabel);
9076
9082
  labelString = labelString === 'isCustomTemplate' ? this.parent.labelSettings.taskLabel : labelString;
9077
9083
  }
9078
- if (labelString !== 'null') {
9079
- if (this.getTaskLabel(this.parent.labelSettings.taskLabel) === 'isCustomTemplate') {
9084
+ if (labelString.indexOf('null') === -1) {
9085
+ if (this.getTaskLabel(this.parent.labelSettings.taskLabel) === 'isCustomTemplate' && !this.isTemplate(this.parent.labelSettings.taskLabel)) {
9080
9086
  labelString = '';
9081
9087
  }
9082
9088
  if (isNaN(parseInt(labelString))) {
@@ -9096,14 +9102,16 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
9096
9102
  this.taskBarHeight + 'px;">' + labelString + '</span>';
9097
9103
  }
9098
9104
  var labelElement = this.createDivElement(labelDiv)[0];
9099
- labelElement.appendChild(div);
9100
- progressBarInnerDiv[0].appendChild(labelElement);
9101
9105
  var parentLabel = this.parent.labelSettings.taskLabel;
9106
+ if (parentLabel && parentLabel['elementRef'])
9107
+ labelElement.appendChild(div);
9108
+ progressBarInnerDiv[0].appendChild(labelElement);
9102
9109
  if (progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].textContent !== '' &&
9103
- !this.isTemplate(parentLabel))
9110
+ !this.isTemplate(parentLabel) &&
9111
+ progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].children[0])
9104
9112
  progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].children[0].remove();
9105
9113
  if (progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].textContent == '' &&
9106
- parentLabel && !parentLabel['elementRef'])
9114
+ parentLabel && !parentLabel['elementRef'] && div.innerHTML != '')
9107
9115
  progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].textContent = parentLabel;
9108
9116
  }
9109
9117
  var milestoneTemplate = '<div class="' + parentMilestone + '" style="position:absolute;">' +
@@ -12976,6 +12984,9 @@ var Gantt = /** @__PURE__ @class */ (function (_super) {
12976
12984
  }
12977
12985
  else {
12978
12986
  this.treeGrid.dataSource = this.flatData;
12987
+ if (!isNullOrUndefined(document.getElementsByClassName('e-listview')[0])) {
12988
+ this.treeGrid.dataBind();
12989
+ }
12979
12990
  }
12980
12991
  }
12981
12992
  else {
@@ -21808,6 +21819,9 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
21808
21819
  if (!isNullOrUndefined(this.parent.editModule) && ganttData) {
21809
21820
  this.parent.isOnEdit = true;
21810
21821
  this.validateUpdateValues(data, ganttData, true);
21822
+ if (data[this.parent.taskFields.resourceInfo]) {
21823
+ this.updateResourceRelatedFields(ganttData, 'resource');
21824
+ }
21811
21825
  var keys = Object.keys(data);
21812
21826
  if (keys.indexOf(tasks.startDate) !== -1 || keys.indexOf(tasks.endDate) !== -1 ||
21813
21827
  keys.indexOf(tasks.duration) !== -1) {
@@ -25276,7 +25290,7 @@ var Filter$1 = /** @__PURE__ @class */ (function () {
25276
25290
  };
25277
25291
  Filter$$1.prototype.updateFilterMenuPosition = function (element, args) {
25278
25292
  addClass([element], 'e-gantt');
25279
- document.body.appendChild(element);
25293
+ document.querySelector('#' + this.parent.controlId).appendChild(element);
25280
25294
  var targetElement;
25281
25295
  if (this.parent.showColumnMenu) {
25282
25296
  targetElement = document.querySelector('#treeGrid' + this.parent.controlId + '_gridcontrol_colmenu_Filter');
@@ -26408,6 +26422,7 @@ var Toolbar$3 = /** @__PURE__ @class */ (function () {
26408
26422
 
26409
26423
  var NonWorkingDay = /** @__PURE__ @class */ (function () {
26410
26424
  function NonWorkingDay(gantt) {
26425
+ this.weekendWidthUpdated = false;
26411
26426
  this.parent = gantt;
26412
26427
  this.nonworkingContainer = null;
26413
26428
  this.holidayContainer = null;
@@ -26547,6 +26562,14 @@ var NonWorkingDay = /** @__PURE__ @class */ (function () {
26547
26562
  width = this.parent.dataOperation.getTaskWidth(start, tempEnd);
26548
26563
  isFirstCell = false;
26549
26564
  }
26565
+ var sDate = new Date(startDate);
26566
+ sDate.setDate(sDate.getDate() + 1);
26567
+ if (sDate.getTimezoneOffset() != this.parent.timelineModule.timelineStartDate.getTimezoneOffset() && !this.weekendWidthUpdated) {
26568
+ if (this.parent.timelineModule.bottomTier == 'Hour' && this.parent.timelineSettings.bottomTier.count === 1) {
26569
+ width = width - this.parent.timelineSettings.timelineUnitSize;
26570
+ this.weekendWidthUpdated = true;
26571
+ }
26572
+ }
26550
26573
  var weekendDiv = createElement('div', {
26551
26574
  className: weekend, styles: "left:" + left + "px;width:" + width + "px;height:100%;"
26552
26575
  });
@@ -30938,6 +30961,9 @@ var ExportHelper = /** @__PURE__ @class */ (function () {
30938
30961
  if (data[_this.parent.labelSettings.rightLabel]) {
30939
30962
  taskbar.rightTaskLabel.value = data[_this.parent.labelSettings.rightLabel].toString();
30940
30963
  }
30964
+ if (data[_this.parent.labelSettings.taskLabel]) {
30965
+ taskbar.taskLabel = data[_this.parent.labelSettings.taskLabel].toString();
30966
+ }
30941
30967
  var reduceLeft = ganttProp.isMilestone ? Math.floor(_this.parent.chartRowsModule.taskBarHeight / 2) + 33 : 33; // 33 indicates default timeline cell width
30942
30968
  taskbar.rightTaskLabel.left = ganttProp.left + ganttProp.width + reduceLeft; // right label left value
30943
30969
  taskbar.fontFamily = _this.ganttStyle.fontFamily;
@@ -31299,6 +31325,12 @@ var PdfGanttTaskbarCollection = /** @__PURE__ @class */ (function () {
31299
31325
  var progressFormat = new PdfStringFormat();
31300
31326
  progressFormat.lineAlignment = PdfVerticalAlignment.Middle;
31301
31327
  progressFormat.alignment = PdfTextAlignment.Right;
31328
+ var isLabelString = false;
31329
+ var updatedWidth;
31330
+ if (/^[a-zA-Z]/.test(this.taskLabel)) {
31331
+ isLabelString = true;
31332
+ progressFormat.alignment = PdfTextAlignment.Left;
31333
+ }
31302
31334
  var pageIndex = -1;
31303
31335
  if (!taskbar.isMilestone) {
31304
31336
  var taskbarPen = new PdfPen(taskbar.taskBorderColor);
@@ -31320,10 +31352,14 @@ var PdfGanttTaskbarCollection = /** @__PURE__ @class */ (function () {
31320
31352
  }
31321
31353
  else {
31322
31354
  taskGraphics.drawRectangle(taskbarPen, taskBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth) + 0.5, startPoint.y + adjustHeight, pixelToPoint(taskbar.width), pixelToPoint(taskbar.height));
31323
- if (this.progress > 0 && this.progressWidth > 0 && this.isScheduledTask) {
31355
+ if (this.isScheduledTask) {
31324
31356
  taskGraphics.drawRectangle(progressPen, progressBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth) + 0.5, startPoint.y + adjustHeight, pixelToPoint(taskbar.progressWidth), pixelToPoint(taskbar.height));
31325
- if (!isNullOrUndefined(this.parent.taskFields.progress) && !isNullOrUndefined(this.parent.labelSettings.taskLabel)) {
31326
- taskGraphics.drawString(this.progress.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth), startPoint.y + adjustHeight, pixelToPoint(this.progressWidth), pixelToPoint(this.height), progressFormat);
31357
+ if (!isNullOrUndefined(this.parent.labelSettings.taskLabel) && !isNullOrUndefined(this.taskLabel)) {
31358
+ updatedWidth = this.progressWidth;
31359
+ if (isLabelString) {
31360
+ updatedWidth = this.width;
31361
+ }
31362
+ taskGraphics.drawString(this.taskLabel.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth), startPoint.y + adjustHeight, pixelToPoint(updatedWidth), pixelToPoint(this.height), progressFormat);
31327
31363
  }
31328
31364
  }
31329
31365
  }
@@ -31338,14 +31374,16 @@ var PdfGanttTaskbarCollection = /** @__PURE__ @class */ (function () {
31338
31374
  this.isStartPoint = true;
31339
31375
  }
31340
31376
  var renderWidth = 0;
31341
- this.width = this.width - (detail.totalWidth - (this.left - cumulativeWidth));
31377
+ if (!isLabelString) {
31378
+ this.width = this.width - (detail.totalWidth - (this.left - cumulativeWidth));
31379
+ }
31342
31380
  renderWidth = (detail.totalWidth - (this.left - cumulativeWidth));
31343
31381
  if (!this.isScheduledTask && this.unscheduledTaskBy !== 'duration') {
31344
31382
  this.drawUnscheduledTask(taskGraphics, startPoint, cumulativeWidth, adjustHeight);
31345
31383
  }
31346
31384
  else {
31347
31385
  taskGraphics.drawRectangle(taskbarPen, taskBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth) + 0.5, startPoint.y + adjustHeight, pixelToPoint(renderWidth), pixelToPoint(taskbar.height));
31348
- if (this.progress > 0 && this.progressWidth > 0 && this.isScheduledTask) {
31386
+ if (this.isScheduledTask) {
31349
31387
  var progressBoundsWidth = 0;
31350
31388
  if (this.progressWidth <= renderWidth) {
31351
31389
  progressBoundsWidth = this.progressWidth;
@@ -31355,8 +31393,12 @@ var PdfGanttTaskbarCollection = /** @__PURE__ @class */ (function () {
31355
31393
  }
31356
31394
  taskGraphics.drawRectangle(progressPen, progressBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth) + 0.5, startPoint.y + adjustHeight, pixelToPoint(progressBoundsWidth), pixelToPoint(taskbar.height));
31357
31395
  this.progressWidth -= progressBoundsWidth;
31358
- if (this.progressWidth === 0 && this.progress !== 0 && this.parent.labelSettings.taskLabel) {
31359
- taskGraphics.drawString(this.progress.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth), (startPoint.y + adjustHeight), pixelToPoint(progressBoundsWidth), pixelToPoint(this.height), progressFormat);
31396
+ if (this.parent.labelSettings.taskLabel && !isNullOrUndefined(this.taskLabel)) {
31397
+ updatedWidth = progressBoundsWidth;
31398
+ if (isLabelString) {
31399
+ updatedWidth = this.width;
31400
+ }
31401
+ taskGraphics.drawString(this.taskLabel.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth), (startPoint.y + adjustHeight), pixelToPoint(updatedWidth), pixelToPoint(this.height), progressFormat);
31360
31402
  }
31361
31403
  }
31362
31404
  }
@@ -31373,8 +31415,12 @@ var PdfGanttTaskbarCollection = /** @__PURE__ @class */ (function () {
31373
31415
  taskGraphics.drawRectangle(taskbarPen, taskBrush, startPoint.x + pixelToPoint(taskbar.left + 0.5), startPoint.y + adjustHeight, pixelToPoint(taskbar.width), pixelToPoint(taskbar.height));
31374
31416
  if (this.isScheduledTask) {
31375
31417
  taskGraphics.drawRectangle(progressPen, progressBrush, startPoint.x + pixelToPoint(taskbar.left + 0.5), startPoint.y + adjustHeight, pixelToPoint(taskbar.progressWidth), pixelToPoint(taskbar.height));
31376
- if (this.progressWidth === 0 && this.progress !== 0) {
31377
- taskGraphics.drawString(this.progress.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left), (startPoint.y + adjustHeight), pixelToPoint(this.progressWidth), pixelToPoint(this.height), progressFormat);
31418
+ if (!isNullOrUndefined(this.taskLabel)) {
31419
+ updatedWidth = this.progressWidth;
31420
+ if (isLabelString) {
31421
+ updatedWidth = this.width;
31422
+ }
31423
+ taskGraphics.drawString(this.taskLabel.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left), (startPoint.y + adjustHeight), pixelToPoint(updatedWidth), pixelToPoint(this.height), progressFormat);
31378
31424
  }
31379
31425
  }
31380
31426
  this.isCompleted = true;
@@ -31388,7 +31434,7 @@ var PdfGanttTaskbarCollection = /** @__PURE__ @class */ (function () {
31388
31434
  this.isStartPoint = true;
31389
31435
  }
31390
31436
  taskGraphics.drawRectangle(taskbarPen, taskBrush, startPoint.x + pixelToPoint(taskbar.left) + 0.5, startPoint.y + adjustHeight, pixelToPoint(detail.totalWidth), pixelToPoint(taskbar.height));
31391
- if (this.progress > 0 && this.progressWidth > 0 && this.isScheduledTask) {
31437
+ if (this.isScheduledTask) {
31392
31438
  var progressBoundsWidth = 0;
31393
31439
  if (this.progressWidth <= detail.totalWidth) {
31394
31440
  progressBoundsWidth = this.progressWidth;
@@ -31398,8 +31444,12 @@ var PdfGanttTaskbarCollection = /** @__PURE__ @class */ (function () {
31398
31444
  }
31399
31445
  taskGraphics.drawRectangle(progressPen, progressBrush, startPoint.x + pixelToPoint(taskbar.left) + 0.5, startPoint.y + adjustHeight, pixelToPoint(progressBoundsWidth), pixelToPoint(taskbar.height));
31400
31446
  this.progressWidth -= progressBoundsWidth;
31401
- if (this.progressWidth === 0 && this.progress !== 0) {
31402
- taskGraphics.drawString(this.progress.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left), (startPoint.y + adjustHeight), pixelToPoint(progressBoundsWidth), pixelToPoint(this.height), progressFormat);
31447
+ if (!isNullOrUndefined(this.taskLabel)) {
31448
+ updatedWidth = progressBoundsWidth;
31449
+ if (isLabelString) {
31450
+ updatedWidth = this.width;
31451
+ }
31452
+ taskGraphics.drawString(this.taskLabel.toString(), font, fontColor, fontBrush, startPoint.x + pixelToPoint(this.left), (startPoint.y + adjustHeight), pixelToPoint(updatedWidth), pixelToPoint(this.height), progressFormat);
31403
31453
  }
31404
31454
  }
31405
31455
  this.isCompleted = false;