@syncfusion/ej2-gantt 21.2.6 → 21.2.8

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.
@@ -387,7 +387,7 @@ class DateProcessor {
387
387
  else if (hour > this.parent.defaultStartTime && hour < this.parent.defaultEndTime) {
388
388
  for (let i = 0; i < this.parent.workingTimeRanges.length; i++) {
389
389
  const value = this.parent.workingTimeRanges[i];
390
- if (hour >= value.to && (this.parent.workingTimeRanges[i + 1] &&
390
+ if (hour > value.to && (this.parent.workingTimeRanges[i + 1] &&
391
391
  hour < this.parent.workingTimeRanges[i + 1].from)) {
392
392
  this.setTime(this.parent.workingTimeRanges[i + 1].from, cloneDate);
393
393
  break;
@@ -1885,7 +1885,7 @@ class TaskProcessor extends DateProcessor {
1885
1885
  (this.parent.taskMode === 'Manual') ? false :
1886
1886
  data[taskSettings.manual] === true ? false : true;
1887
1887
  this.parent.setRecordValue('ganttProperties', ganttProperties, ganttData);
1888
- if (!isNullOrUndefined(data[taskSettings.id])) {
1888
+ if (!isNullOrUndefined(data[taskSettings.id]) && (!((this.parent.viewType === "ResourceView" && level == 0))) || data[taskSettings.name] === "Unassigned Task") {
1889
1889
  id = data[taskSettings.id];
1890
1890
  name = data[taskSettings.name];
1891
1891
  this.addTaskData(ganttData, data, isLoad);
@@ -2302,7 +2302,7 @@ class TaskProcessor extends DateProcessor {
2302
2302
  startDate = this.getDateFromFormat(data[taskSettings.startDate], true);
2303
2303
  endDate = this.getDateFromFormat(data[taskSettings.endDate], true);
2304
2304
  }
2305
- const segments = taskSettings.segments ? (data[taskSettings.segments] ||
2305
+ const segments = taskSettings.segments && (!isNullOrUndefined(data[taskSettings.segments]) || !isNullOrUndefined(ganttData.taskData)) ? (data[taskSettings.segments] ||
2306
2306
  ganttData.taskData[taskSettings.segments]) : null;
2307
2307
  const isMileStone = taskSettings.milestone ? data[taskSettings.milestone] ? true : false : false;
2308
2308
  const durationMapping = data[taskSettings.durationUnit] ? data[taskSettings.durationUnit] : '';
@@ -3125,6 +3125,9 @@ class TaskProcessor extends DateProcessor {
3125
3125
  return resourceIdCollection;
3126
3126
  }
3127
3127
  resourceIdCollection = data[this.parent.taskFields.resourceInfo];
3128
+ if (resourceIdCollection != "" && typeof resourceIdCollection == "string") {
3129
+ resourceIdCollection = resourceIdCollection.split(',');
3130
+ }
3128
3131
  let resourceData;
3129
3132
  if (!isNullOrUndefined(this.parent.editModule) && !isNullOrUndefined(this.parent.editModule.dialogModule)
3130
3133
  && this.parent.editModule.dialogModule.isAddNewResource) {
@@ -3134,6 +3137,7 @@ class TaskProcessor extends DateProcessor {
3134
3137
  resourceData = this.parent.resources;
3135
3138
  }
3136
3139
  const resourceIDMapping = this.parent.resourceFields.id;
3140
+ const resourceNameMapping = this.parent.resourceFields.name;
3137
3141
  const resourceUnitMapping = this.parent.resourceFields.unit;
3138
3142
  const resourceGroup = this.parent.resourceFields.group;
3139
3143
  const resources = [];
@@ -3144,7 +3148,7 @@ class TaskProcessor extends DateProcessor {
3144
3148
  return true;
3145
3149
  }
3146
3150
  else {
3147
- return (resourceIdCollection[count] === resourceInfo[resourceIDMapping]);
3151
+ return (resourceIdCollection[count] === resourceInfo[resourceIDMapping]) || (resourceIdCollection[count] === resourceInfo[resourceNameMapping]);
3148
3152
  }
3149
3153
  });
3150
3154
  const ganttDataResource = extend({}, resource[0]);
@@ -4612,7 +4616,7 @@ class GanttChart {
4612
4616
  setVirtualHeight() {
4613
4617
  if (this.parent.virtualScrollModule && this.parent.enableVirtualization) {
4614
4618
  const wrapper = getValue('virtualTrack', this.parent.ganttChartModule.virtualRender);
4615
- wrapper.style.height = this.parent.treeGrid.element.getElementsByClassName('e-virtualtable')[0].style.height;
4619
+ wrapper.style.height = this.parent.treeGrid.element.getElementsByClassName('e-virtualtrack')[0].style.height;
4616
4620
  const wrapper1 = getValue('wrapper', this.parent.ganttChartModule.virtualRender);
4617
4621
  const treegridVirtualHeight = this.parent.treeGrid.element.getElementsByClassName('e-virtualtable')[0].style.transform;
4618
4622
  wrapper1.style.transform = treegridVirtualHeight;
@@ -8725,7 +8729,7 @@ class ChartRows extends DateProcessor {
8725
8729
  if (this.taskLabelTemplateFunction && !isNullOrUndefined(progressDiv) && progressDiv.length > 0) {
8726
8730
  const taskLabelTemplateNode = this.taskLabelTemplateFunction(extend({ index: i }, data), this.parent, 'TaskLabelTemplate', this.getTemplateID('TaskLabelTemplate'), false, undefined, progressDiv[0]);
8727
8731
  if (taskLabelTemplateNode && taskLabelTemplateNode.length > 0) {
8728
- tempDiv.appendChild(taskLabelTemplateNode[0]);
8732
+ append(taskLabelTemplateNode, tempDiv);
8729
8733
  labelString = tempDiv.innerHTML;
8730
8734
  }
8731
8735
  }
@@ -9280,7 +9284,7 @@ class ChartRows extends DateProcessor {
9280
9284
  if (leftLabelTemplateNode[0]['data'] === 'null') {
9281
9285
  leftLabelTemplateNode[0]['data'] = '';
9282
9286
  }
9283
- leftLabelNode[0].appendChild([].slice.call(leftLabelTemplateNode)[0]);
9287
+ append(leftLabelTemplateNode, leftLabelNode[0]);
9284
9288
  }
9285
9289
  if (this.parent.enableRtl) {
9286
9290
  leftLabelNode[0].style.paddingLeft = '25px';
@@ -9335,7 +9339,7 @@ class ChartRows extends DateProcessor {
9335
9339
  if (rightLabelTemplateNode[0]['data'] === 'null') {
9336
9340
  rightLabelTemplateNode[0]['data'] = '';
9337
9341
  }
9338
- rightLabelNode[0].appendChild([].slice.call(rightLabelTemplateNode)[0]);
9342
+ append(rightLabelTemplateNode, rightLabelNode[0]);
9339
9343
  }
9340
9344
  if (this.parent.enableRtl) {
9341
9345
  rightLabelNode[0].style.marginLeft = '0px';
@@ -9991,12 +9995,12 @@ class ChartRows extends DateProcessor {
9991
9995
  }
9992
9996
  }
9993
9997
  if ((this.templateData.ganttProperties.autoDuration !== 0) && !this.templateData.ganttProperties.isMilestone && parentTaskbarTemplateNode && parentTaskbarTemplateNode.length > 0) {
9994
- taskbarContainerNode[0].appendChild([].slice.call(parentTaskbarTemplateNode)[0]);
9998
+ append(parentTaskbarTemplateNode, taskbarContainerNode[0]);
9995
9999
  }
9996
10000
  else if ((this.templateData.ganttProperties.duration === 0 && this.templateData.ganttProperties.isMilestone && this.templateData.ganttProperties.isAutoSchedule)) {
9997
10001
  const milestoneTemplateNode = this.getMilestoneNode(i, taskbarContainerNode);
9998
10002
  if (milestoneTemplateNode && milestoneTemplateNode.length > 0) {
9999
- taskbarContainerNode[0].appendChild([].slice.call(milestoneTemplateNode)[0]);
10003
+ append(milestoneTemplateNode, taskbarContainerNode[0]);
10000
10004
  }
10001
10005
  }
10002
10006
  if (this.parent.renderBaseline && this.templateData.ganttProperties.baselineStartDate &&
@@ -10050,7 +10054,7 @@ class ChartRows extends DateProcessor {
10050
10054
  }
10051
10055
  }
10052
10056
  else {
10053
- taskbarContainerNode[0].appendChild([].slice.call(childTaskbarTemplateNode)[0]);
10057
+ append(childTaskbarTemplateNode, taskbarContainerNode[0]);
10054
10058
  }
10055
10059
  }
10056
10060
  if (childTaskbarProgressResizeNode) {
@@ -19671,7 +19675,8 @@ class TaskbarEdit extends DateProcessor {
19671
19675
  this.dependencyCancel = true;
19672
19676
  }
19673
19677
  if ((this.taskBarEditAction === 'ConnectorPointLeftDrag' ||
19674
- this.taskBarEditAction === 'ConnectorPointRightDrag') && this.drawPredecessor) {
19678
+ this.taskBarEditAction === 'ConnectorPointRightDrag') && this.drawPredecessor && (!this.connectorSecondRecord.hasChildRecords ||
19679
+ this.connectorSecondRecord.hasChildRecords && this.parent.allowParentDependency)) {
19675
19680
  this.parent.connectorLineEditModule.updatePredecessor(this.connectorSecondRecord, this.finalPredecessor);
19676
19681
  if (this.parent.UpdateOffsetOnTaskbarEdit) {
19677
19682
  this.parent.connectorLineEditModule['calculateOffset'](this.connectorSecondRecord);
@@ -20004,7 +20009,9 @@ class TaskbarEdit extends DateProcessor {
20004
20009
  }
20005
20010
  this.showHideTaskBarEditingElements(element, this.highlightedSecondElement, true);
20006
20011
  }
20007
- if (isNullOrUndefined(this.connectorSecondAction) && !isNullOrUndefined(this.connectorSecondElement)) {
20012
+ if (isNullOrUndefined(this.connectorSecondAction) && !isNullOrUndefined(this.connectorSecondElement) &&
20013
+ (!this.connectorSecondRecord.hasChildRecords || this.connectorSecondRecord.hasChildRecords &&
20014
+ this.parent.allowParentDependency)) {
20008
20015
  this.editTooltip.showHideTaskbarEditTooltip(false, this.segmentIndex);
20009
20016
  removeClass([this.connectorSecondElement.querySelector('.' + connectorPointLeft)], [connectorPointAllowBlock]);
20010
20017
  removeClass([this.connectorSecondElement.querySelector('.' + connectorPointRight)], [connectorPointAllowBlock]);
@@ -26312,6 +26319,7 @@ class Edit$2 {
26312
26319
  let args = {};
26313
26320
  args = this.constructTaskAddedEventArgs(cAddedRecord, this.parent.editedRecords, 'beforeAdd');
26314
26321
  this.parent.trigger('actionBegin', args, (args) => {
26322
+ this.parent.previousRecords = {};
26315
26323
  if (!isNullOrUndefined(this.parent.loadingIndicator) && this.parent.loadingIndicator.indicatorType === "Shimmer") {
26316
26324
  this.parent.showMaskRow();
26317
26325
  }
@@ -30306,7 +30314,7 @@ class ContextMenu$2 {
30306
30314
  this.parent.ganttChartModule.targetElement;
30307
30315
  // Closed edited cell before opening context menu
30308
30316
  // eslint-disable-next-line
30309
- if (!isNullOrUndefined(this.parent.editModule) && this.parent.editModule.cellEditModule && this.parent.editModule.cellEditModule.isCellEdit && target.parentElement.classList.contains('e-row')) {
30317
+ if (!isNullOrUndefined(this.parent.editModule) && this.parent.editModule.cellEditModule && this.parent.editModule.cellEditModule.isCellEdit && target.parentElement.classList.contains('e-row') || target.parentElement.classList.contains('e-treecolumn-container')) {
30310
30318
  this.parent.treeGrid.closeEdit();
30311
30319
  }
30312
30320
  if (!isNullOrUndefined(args.element) && args.element.id === this.parent.element.id + '_contextmenu') {
@@ -34983,11 +34991,22 @@ class PdfGanttPredecessor {
34983
34991
  this.parent = parent;
34984
34992
  this.pdfGantt = pdfGantt;
34985
34993
  }
34986
- findindex(num) {
34994
+ findindex(num, pdfExportProperties) {
34987
34995
  var dataindex;
34988
- this.parent.currentViewData.map((data, index) => { if (data.index == num) {
34989
- dataindex = index;
34990
- } });
34996
+ if (pdfExportProperties.exportType === 'CurrentViewData') {
34997
+ this.parent.currentViewData.map(function (data, index) {
34998
+ if (data.index == num) {
34999
+ dataindex = index;
35000
+ }
35001
+ });
35002
+ }
35003
+ else {
35004
+ this.parent.flatData.map(function (data, index) {
35005
+ if (data.index == num) {
35006
+ dataindex = index;
35007
+ }
35008
+ });
35009
+ }
34991
35010
  return dataindex;
34992
35011
  }
34993
35012
  /**
@@ -34997,11 +35016,11 @@ class PdfGanttPredecessor {
34997
35016
  * @returns {void}
34998
35017
  * @private
34999
35018
  */
35000
- drawPredecessor(pdfGantt) {
35019
+ drawPredecessor(pdfGantt, pdfExportProperties) {
35001
35020
  this.pdfGantt = pdfGantt;
35002
35021
  const pages = pdfGantt.result.page.section.getPages();
35003
- const parentTask = pdfGantt.taskbarCollection[this.findindex(this.parentIndex)];
35004
- const childTask = pdfGantt.taskbarCollection[this.findindex(this.childIndex)];
35022
+ const parentTask = pdfGantt.taskbarCollection[this.findindex(this.parentIndex, pdfExportProperties)];
35023
+ const childTask = pdfGantt.taskbarCollection[this.findindex(this.childIndex, pdfExportProperties)];
35005
35024
  let startPage = new PdfPage();
35006
35025
  let endPage = new PdfPage();
35007
35026
  let predecessorType = '';
@@ -35011,7 +35030,7 @@ class PdfGanttPredecessor {
35011
35030
  let childY = 0;
35012
35031
  switch (this.type) {
35013
35032
  case 'FS':
35014
- if (childTask.startPage > -1 && parentTask.endPage > -1) {
35033
+ if ((!isNullOrUndefined(childTask) && childTask.startPage > -1) && (!isNullOrUndefined(parentTask) && parentTask.endPage > -1)) {
35015
35034
  startPage = pages[parentTask.endPage];
35016
35035
  endPage = pages[childTask.startPage];
35017
35036
  parentPageData = pdfGantt.pdfPageDetail[parentTask.endPage - pdfGantt.chartPageIndex];
@@ -35038,7 +35057,7 @@ class PdfGanttPredecessor {
35038
35057
  }
35039
35058
  break;
35040
35059
  case 'SF':
35041
- if (childTask.endPage > -1 && parentTask.startPage > -1) {
35060
+ if ((!isNullOrUndefined(childTask) && childTask.endPage > -1) && (!isNullOrUndefined(parentTask) && parentTask.startPage > -1)) {
35042
35061
  startPage = pages[parentTask.startPage];
35043
35062
  endPage = pages[childTask.endPage];
35044
35063
  parentPageData = pdfGantt.pdfPageDetail[parentTask.endPage - pdfGantt.chartPageIndex];
@@ -35065,7 +35084,7 @@ class PdfGanttPredecessor {
35065
35084
  }
35066
35085
  break;
35067
35086
  case 'FF':
35068
- if (childTask.endPage > -1 && parentTask.endPage > -1) {
35087
+ if ((!isNullOrUndefined(childTask) && childTask.endPage > -1) && (!isNullOrUndefined(parentTask) && parentTask.endPage > -1)) {
35069
35088
  startPage = pages[parentTask.endPage];
35070
35089
  endPage = pages[childTask.endPage];
35071
35090
  parentPageData = pdfGantt.pdfPageDetail[parentTask.endPage - pdfGantt.chartPageIndex];
@@ -35092,7 +35111,7 @@ class PdfGanttPredecessor {
35092
35111
  }
35093
35112
  break;
35094
35113
  case 'SS':
35095
- if (childTask.startPage > -1 && parentTask.startPage > -1) {
35114
+ if ((!isNullOrUndefined(childTask) && childTask.startPage > -1) && (!isNullOrUndefined(parentTask) && parentTask.startPage > -1)) {
35096
35115
  startPage = pages[parentTask.startPage];
35097
35116
  endPage = pages[childTask.startPage];
35098
35117
  parentPageData = pdfGantt.pdfPageDetail[parentTask.startPage - pdfGantt.chartPageIndex];
@@ -35419,12 +35438,12 @@ class PdfGantt extends PdfTreeGrid {
35419
35438
  }
35420
35439
  return this.taskbars;
35421
35440
  }
35422
- drawChart(result) {
35441
+ drawChart(result, pdfExportProperties) {
35423
35442
  this.result = result;
35424
35443
  this.totalPages = this.result.page.section.count;
35425
35444
  this.perColumnPages = this.totalPages / this.layouter.columnRanges.length;
35426
35445
  this.calculateRange();
35427
- this.drawGantttChart();
35446
+ this.drawGantttChart(pdfExportProperties);
35428
35447
  this.drawPageBorder();
35429
35448
  }
35430
35449
  //Calcualte the header range for each pdf page based on schedule start and end date.
@@ -35573,7 +35592,7 @@ class PdfGantt extends PdfTreeGrid {
35573
35592
  }
35574
35593
  }
35575
35594
  //Draw the gantt chart side
35576
- drawGantttChart() {
35595
+ drawGantttChart(pdfExportProperties) {
35577
35596
  let taskbarPoint = this.startPoint;
35578
35597
  const pagePoint = new PointF();
35579
35598
  let pageStartX = 0;
@@ -35647,7 +35666,7 @@ class PdfGantt extends PdfTreeGrid {
35647
35666
  // Draw predecessor line.
35648
35667
  for (let i = 0; i < this.predecessorCollection.length; i++) {
35649
35668
  const predecessor = this.predecessorCollection[i];
35650
- predecessor.drawPredecessor(this);
35669
+ predecessor.drawPredecessor(this, pdfExportProperties);
35651
35670
  }
35652
35671
  }
35653
35672
  }
@@ -35760,7 +35779,7 @@ class PdfExport {
35760
35779
  const format = new PdfTreeGridLayoutFormat();
35761
35780
  format.break = PdfLayoutBreakType.FitElement;
35762
35781
  const layouter = this.gantt.drawGrid(pdfPage, 0, 0, format);
35763
- this.gantt.drawChart(layouter);
35782
+ this.gantt.drawChart(layouter, pdfExportProperties);
35764
35783
  if (!isMultipleExport) {
35765
35784
  if (!this.isBlob) {
35766
35785
  // save the PDF