@syncfusion/ej2-gantt 21.2.6 → 21.2.9

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.
@@ -11,7 +11,7 @@ var __extends = (this && this.__extends) || (function () {
11
11
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
12
  };
13
13
  })();
14
- import { createElement, isNullOrUndefined, extend, compile, getValue, setValue, SanitizeHtmlHelper } from '@syncfusion/ej2-base';
14
+ import { createElement, isNullOrUndefined, extend, compile, getValue, setValue, SanitizeHtmlHelper, append } from '@syncfusion/ej2-base';
15
15
  import { formatUnit, addClass } from '@syncfusion/ej2-base';
16
16
  import { isScheduledTask } from '../base/utils';
17
17
  import { DataManager, Query } from '@syncfusion/ej2-data';
@@ -173,7 +173,7 @@ var ChartRows = /** @class */ (function (_super) {
173
173
  if (this.taskLabelTemplateFunction && !isNullOrUndefined(progressDiv) && progressDiv.length > 0) {
174
174
  var taskLabelTemplateNode = this.taskLabelTemplateFunction(extend({ index: i }, data), this.parent, 'TaskLabelTemplate', this.getTemplateID('TaskLabelTemplate'), false, undefined, progressDiv[0]);
175
175
  if (taskLabelTemplateNode && taskLabelTemplateNode.length > 0) {
176
- tempDiv.appendChild(taskLabelTemplateNode[0]);
176
+ append(taskLabelTemplateNode, tempDiv);
177
177
  labelString = tempDiv.innerHTML;
178
178
  }
179
179
  }
@@ -243,7 +243,7 @@ var ChartRows = /** @class */ (function (_super) {
243
243
  !this.isTemplate(childLabel) &&
244
244
  progressDiv[0].querySelectorAll('.e-task-label')[0].children[0])
245
245
  progressDiv[0].querySelectorAll('.e-task-label')[0].children[0].remove();
246
- if (progressDiv[0].querySelectorAll('.e-task-label')[0].textContent == '' &&
246
+ if (progressDiv[0].querySelectorAll('.e-task-label')[0].textContent === '' &&
247
247
  childLabel && !childLabel['elementRef'] && tempDiv.innerHTML !== '')
248
248
  progressDiv[0].querySelectorAll('.e-task-label')[0].textContent = childLabel;
249
249
  }
@@ -728,7 +728,7 @@ var ChartRows = /** @class */ (function (_super) {
728
728
  if (leftLabelTemplateNode[0]['data'] === 'null') {
729
729
  leftLabelTemplateNode[0]['data'] = '';
730
730
  }
731
- leftLabelNode[0].appendChild([].slice.call(leftLabelTemplateNode)[0]);
731
+ append(leftLabelTemplateNode, leftLabelNode[0]);
732
732
  }
733
733
  if (this.parent.enableRtl) {
734
734
  leftLabelNode[0].style.paddingLeft = '25px';
@@ -783,7 +783,7 @@ var ChartRows = /** @class */ (function (_super) {
783
783
  if (rightLabelTemplateNode[0]['data'] === 'null') {
784
784
  rightLabelTemplateNode[0]['data'] = '';
785
785
  }
786
- rightLabelNode[0].appendChild([].slice.call(rightLabelTemplateNode)[0]);
786
+ append(rightLabelTemplateNode, rightLabelNode[0]);
787
787
  }
788
788
  if (this.parent.enableRtl) {
789
789
  rightLabelNode[0].style.marginLeft = '0px';
@@ -914,7 +914,7 @@ var ChartRows = /** @class */ (function (_super) {
914
914
  !this.isTemplate(parentLabel) &&
915
915
  progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].children[0])
916
916
  progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].children[0].remove();
917
- if (progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].textContent == '' &&
917
+ if (progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].textContent === '' &&
918
918
  parentLabel && !parentLabel['elementRef'] && div.innerHTML !== '')
919
919
  progressBarInnerDiv[0].querySelectorAll('.e-task-label')[0].textContent = parentLabel;
920
920
  }
@@ -944,11 +944,19 @@ var ChartRows = /** @class */ (function (_super) {
944
944
  * @returns {NodeList} .
945
945
  * @private
946
946
  */
947
- ChartRows.prototype.getTableTrNode = function () {
947
+ ChartRows.prototype.getTableTrNode = function (i) {
948
948
  var table = createElement('table');
949
949
  var className = (this.parent.gridLines === 'Horizontal' || this.parent.gridLines === 'Both') ?
950
950
  'e-chart-row-border' : '';
951
- table.innerHTML = '<tr class="' + this.getRowClassName(this.templateData) + ' ' + cls.chartRow + '"' +
951
+ var rows = this.parent.treeGrid.grid.contentModule.getRows()[i];
952
+ var activecls;
953
+ if (rows && rows.isSelected) {
954
+ activecls = 'e-active';
955
+ }
956
+ else {
957
+ activecls = '';
958
+ }
959
+ table.innerHTML = '<tr class="' + this.getRowClassName(this.templateData) + ' ' + cls.chartRow + ' ' + (activecls) + '"' +
952
960
  'style="display:' + this.getExpandDisplayProp(this.templateData) + ';height:' +
953
961
  this.parent.rowHeight + 'px;">' +
954
962
  '<td class="' + cls.chartRowCell + ' ' + className
@@ -1386,7 +1394,7 @@ var ChartRows = /** @class */ (function (_super) {
1386
1394
  this.parent.renderTemplates();
1387
1395
  this.triggerQueryTaskbarInfo();
1388
1396
  this.parent.modifiedRecords = [];
1389
- if (this.parent.viewType == 'ResourceView' && this.parent.showOverAllocation) {
1397
+ if (this.parent.viewType === 'ResourceView' && this.parent.showOverAllocation) {
1390
1398
  this.updateOverlapped();
1391
1399
  }
1392
1400
  if (collapsedResourceRecord.length) {
@@ -1410,7 +1418,7 @@ var ChartRows = /** @class */ (function (_super) {
1410
1418
  ChartRows.prototype.getGanttChartRow = function (i, tempTemplateData) {
1411
1419
  this.templateData = tempTemplateData;
1412
1420
  var taskBaselineTemplateNode = null;
1413
- var parentTrNode = this.getTableTrNode();
1421
+ var parentTrNode = this.getTableTrNode(i);
1414
1422
  var leftLabelNode = this.getLeftLabelNode(i);
1415
1423
  var taskbarContainerNode = this.taskbarContainer();
1416
1424
  taskbarContainerNode[0].setAttribute('aria-label', this.generateAriaLabel(this.templateData));
@@ -1440,12 +1448,12 @@ var ChartRows = /** @class */ (function (_super) {
1440
1448
  }
1441
1449
  }
1442
1450
  if ((this.templateData.ganttProperties.autoDuration !== 0) && !this.templateData.ganttProperties.isMilestone && parentTaskbarTemplateNode && parentTaskbarTemplateNode.length > 0) {
1443
- taskbarContainerNode[0].appendChild([].slice.call(parentTaskbarTemplateNode)[0]);
1451
+ append(parentTaskbarTemplateNode, taskbarContainerNode[0]);
1444
1452
  }
1445
1453
  else if ((this.templateData.ganttProperties.duration === 0 && this.templateData.ganttProperties.isMilestone && this.templateData.ganttProperties.isAutoSchedule)) {
1446
1454
  var milestoneTemplateNode = this.getMilestoneNode(i, taskbarContainerNode);
1447
1455
  if (milestoneTemplateNode && milestoneTemplateNode.length > 0) {
1448
- taskbarContainerNode[0].appendChild([].slice.call(milestoneTemplateNode)[0]);
1456
+ append(milestoneTemplateNode, taskbarContainerNode[0]);
1449
1457
  }
1450
1458
  }
1451
1459
  if (this.parent.renderBaseline && this.templateData.ganttProperties.baselineStartDate &&
@@ -1499,7 +1507,7 @@ var ChartRows = /** @class */ (function (_super) {
1499
1507
  }
1500
1508
  }
1501
1509
  else {
1502
- taskbarContainerNode[0].appendChild([].slice.call(childTaskbarTemplateNode)[0]);
1510
+ append(childTaskbarTemplateNode, taskbarContainerNode[0]);
1503
1511
  }
1504
1512
  }
1505
1513
  if (childTaskbarProgressResizeNode) {
@@ -1962,6 +1970,19 @@ var ChartRows = /** @class */ (function (_super) {
1962
1970
  }
1963
1971
  }
1964
1972
  };
1973
+ ChartRows.prototype.updateResourceTaskbarElement = function (tRow, parentTr) {
1974
+ var cloneElement = tRow.querySelector('.e-taskbar-main-container');
1975
+ addClass([cloneElement], 'collpse-parent-border');
1976
+ var id = tRow.querySelector('.' + cls.taskBarMainContainer).getAttribute('rowUniqueId');
1977
+ var ganttData = this.parent.getRecordByID(id);
1978
+ var zIndex = "";
1979
+ if (ganttData && !isNullOrUndefined(ganttData.ganttProperties.eOverlapIndex)) {
1980
+ zIndex = (ganttData.ganttProperties.eOverlapIndex).toString();
1981
+ }
1982
+ var cloneChildElement = cloneElement.cloneNode(true);
1983
+ cloneChildElement.style.zIndex = zIndex;
1984
+ parentTr[0].childNodes[0].childNodes[0].childNodes[0].appendChild(cloneChildElement);
1985
+ };
1965
1986
  ChartRows.prototype.getResourceParent = function (record) {
1966
1987
  var chartRows = this.parent.ganttChartModule.getChartRows();
1967
1988
  //Below code is for rendering taskbartemplate in resource view with multi taskbar
@@ -1985,20 +2006,19 @@ var ChartRows = /** @class */ (function (_super) {
1985
2006
  parentTrNode[0].childNodes[0].childNodes[0].appendChild(collapseParent);
1986
2007
  var tasks = this.parent.dataOperation.setSortedChildTasks(record);
1987
2008
  this.parent.dataOperation.updateOverlappingIndex(tasks);
1988
- for (var i = 0; i < chartRows.length; i++) {
1989
- if (chartRows[i].classList.contains('gridrowtaskId'
1990
- + record.ganttProperties.rowUniqueID + 'level' + (record.level + 1))) {
1991
- var cloneElement = chartRows[i].querySelector('.e-taskbar-main-container');
1992
- addClass([cloneElement], 'collpse-parent-border');
1993
- var id = chartRows[i].querySelector('.' + cls.taskBarMainContainer).getAttribute('rowUniqueId');
1994
- var ganttData = this.parent.getRecordByID(id);
1995
- var zIndex = "";
1996
- if (ganttData && !isNullOrUndefined(ganttData.ganttProperties.eOverlapIndex)) {
1997
- zIndex = (ganttData.ganttProperties.eOverlapIndex).toString();
2009
+ var tRow;
2010
+ if (this.parent.enableVirtualization) {
2011
+ for (var i = 0; i < record.childRecords.length; i++) {
2012
+ tRow = this.getGanttChartRow(record.childRecords[i].index, this.parent.flatData[record.childRecords[i].index]);
2013
+ this.updateResourceTaskbarElement(tRow, parentTrNode);
2014
+ }
2015
+ }
2016
+ else {
2017
+ for (var i = 0; i < chartRows.length; i++) {
2018
+ if (chartRows[i].classList.contains('gridrowtaskId'
2019
+ + record.ganttProperties.rowUniqueID + 'level' + (record.level + 1))) {
2020
+ this.updateResourceTaskbarElement(chartRows[i], parentTrNode);
1998
2021
  }
1999
- var cloneChildElement = cloneElement.cloneNode(true);
2000
- cloneChildElement.style.zIndex = zIndex;
2001
- parentTrNode[0].childNodes[0].childNodes[0].childNodes[0].appendChild(cloneChildElement);
2002
2022
  }
2003
2023
  }
2004
2024
  parentTrNode[0].childNodes[0].childNodes[0].appendChild([].slice.call(leftLabelNode)[0]);
@@ -1410,9 +1410,11 @@ var Timeline = /** @class */ (function () {
1410
1410
  var validStartLeft = this.parent.dataOperation.getTaskLeft(validStartDate, false);
1411
1411
  var validEndLeft = this.parent.dataOperation.getTaskLeft(validEndDate, false);
1412
1412
  var isChanged = void 0;
1413
+ var taskbarModule = this.parent.editModule.taskbarEditModule;
1413
1414
  if (!isNullOrUndefined(maxStartLeft) && ((minStartDate < this.timelineStartDate) ||
1414
- (!isNullOrUndefined(this.parent.editModule.taskbarEditModule)) &&
1415
- (!isNullOrUndefined(this.parent.editModule.taskbarEditModule.taskBarEditAction))) && (maxStartLeft < this.bottomTierCellWidth || maxStartLeft <= validStartLeft)) {
1415
+ (!isNullOrUndefined(taskbarModule)) && (!isNullOrUndefined(taskbarModule.taskBarEditAction)
1416
+ && taskbarModule.taskBarEditAction !== 'ProgressResizing' &&
1417
+ taskbarModule.taskBarEditAction !== 'RightResizing')) && (maxStartLeft < this.bottomTierCellWidth || maxStartLeft <= validStartLeft)) {
1416
1418
  isChanged = 'prevTimeSpan';
1417
1419
  minStartDate = minStartDate > this.timelineStartDate ? this.timelineStartDate : minStartDate;
1418
1420
  }