@syncfusion/ej2-gantt 23.2.4 → 23.2.7

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.
@@ -270,7 +270,7 @@ class DateProcessor {
270
270
  if (!this.parent.includeWeekend) {
271
271
  const tempDate = new Date(cloneStartDate.getTime());
272
272
  cloneStartDate = this.getNextWorkingDay(cloneStartDate);
273
- if (tempDate.getTime() !== cloneStartDate.getTime()) {
273
+ if (tempDate.getTime() !== cloneStartDate.getTime() && !validateAsMilestone) {
274
274
  this.setTime(startTime, cloneStartDate);
275
275
  }
276
276
  }
@@ -4789,7 +4789,7 @@ class GanttChart {
4789
4789
  if (this.parent.editSettings.allowTaskbarEditing && this.parent.element.querySelector('.e-left-resize-gripper')) {
4790
4790
  isTaskbarEdited = true;
4791
4791
  }
4792
- if (!isTaskbarEdited) {
4792
+ if (!isTaskbarEdited || e.button == 2) {
4793
4793
  if (this.parent.editSettings.allowEditing && this.parent.treeGrid.element.getElementsByClassName('e-editedbatchcell').length > 0) {
4794
4794
  this.parent.treeGrid.endEdit();
4795
4795
  }
@@ -6052,6 +6052,10 @@ class Timeline {
6052
6052
  if (!this.parent.isFromOnPropertyChange) {
6053
6053
  this.parent.updateProjectDates(this.parent.cloneProjectStartDate, this.parent.cloneProjectEndDate, this.parent.isTimelineRoundOff);
6054
6054
  }
6055
+ const timelineContainer = this.parent.element.getElementsByClassName('e-timeline-header-container')[0]['offsetHeight'];
6056
+ this.parent.element.getElementsByClassName('e-gridcontent')[0]['style'].height = 'calc(100% - ' + timelineContainer + 'px)';
6057
+ // eslint-disable-next-line
6058
+ this.parent.element.getElementsByClassName('e-chart-scroll-container e-content')[0]['style'].height = 'calc(100% - ' + timelineContainer + 'px)';
6055
6059
  }
6056
6060
  /**
6057
6061
  * Function used to refresh Gantt rows.
@@ -6263,6 +6267,7 @@ class Timeline {
6263
6267
  }
6264
6268
  this.changeTimelineSettings(newTimeline);
6265
6269
  this.parent.isTimelineRoundOff = isNullOrUndefined(this.parent.projectStartDate) ? true : false;
6270
+ this.isZoomToFit = false;
6266
6271
  }
6267
6272
  bottomTierCellWidthCalc(mode, zoomLevel, date) {
6268
6273
  let convertedMilliSeconds;
@@ -7410,10 +7415,9 @@ class Timeline {
7410
7415
  const validEndLeft = this.parent.dataOperation.getTaskLeft(validEndDate, false);
7411
7416
  let isChanged;
7412
7417
  let taskbarModule = this.parent.editModule.taskbarEditModule;
7413
- if (!isNullOrUndefined(maxStartLeft) && ((minStartDate < this.timelineStartDate) ||
7414
- (!isNullOrUndefined(taskbarModule)) && (!isNullOrUndefined(taskbarModule.taskBarEditAction)
7415
- && taskbarModule.taskBarEditAction !== 'ProgressResizing' &&
7416
- taskbarModule.taskBarEditAction !== 'RightResizing')) && (maxStartLeft < this.bottomTierCellWidth || maxStartLeft <= validStartLeft)) {
7418
+ if (!isNullOrUndefined(maxStartLeft) && ((!isNullOrUndefined(taskbarModule)) && (!isNullOrUndefined(taskbarModule.taskBarEditAction)
7419
+ && taskbarModule.taskBarEditAction !== 'ProgressResizing' &&
7420
+ taskbarModule.taskBarEditAction !== 'RightResizing' && taskbarModule.taskBarEditAction !== 'LeftResizing')) && (maxStartLeft < this.bottomTierCellWidth || maxStartLeft <= validStartLeft)) {
7417
7421
  isChanged = 'prevTimeSpan';
7418
7422
  minStartDate = minStartDate > this.timelineStartDate ? this.timelineStartDate : minStartDate;
7419
7423
  }
@@ -7675,7 +7679,9 @@ class GanttTreeGrid {
7675
7679
  this.parent.treeGrid.loadChildOnDemand = this.parent.loadChildOnDemand;
7676
7680
  this.parent.treeGrid['isFromGantt'] = true;
7677
7681
  this.parent.treeGrid.parentIdMapping = this.parent.taskFields.parentID;
7678
- this.parent.treeGrid.idMapping = this.parent.taskFields.id;
7682
+ if (this.parent.taskFields.parentID) {
7683
+ this.parent.treeGrid.idMapping = this.parent.taskFields.id;
7684
+ }
7679
7685
  this.parent.treeGrid.showColumnMenu = this.parent.showColumnMenu;
7680
7686
  this.parent.treeGrid.enableCollapseAll = this.parent.collapseAllParentTasks;
7681
7687
  this.parent.treeGrid.columnMenuItems = this.parent.columnMenuItems;
@@ -7716,7 +7722,7 @@ class GanttTreeGrid {
7716
7722
  toolbarHeight = this.parent.toolbarModule.element.offsetHeight;
7717
7723
  }
7718
7724
  this.parent.treeGrid.height =
7719
- this.parent.element.getElementsByClassName('e-chart-scroll-container e-content')[0]['offsetHeight'] - 19;
7725
+ this.parent.element.getElementsByClassName('e-chart-scroll-container e-content')[0]['offsetHeight'] - (this.parent.flatData.length == 0 ? 0 : 19);
7720
7726
  }
7721
7727
  getContentDiv() {
7722
7728
  return this.treeGridElement.querySelector('.e-content');
@@ -8223,7 +8229,7 @@ class GanttTreeGrid {
8223
8229
  else {
8224
8230
  column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('duration');
8225
8231
  }
8226
- column.valueAccessor = column.valueAccessor ? column.valueAccessor : !isNullOrUndefined(column.edit) ? null :
8232
+ column.valueAccessor = column.valueAccessor ? column.valueAccessor : !isNullOrUndefined(column.edit) && !isNullOrUndefined(column.edit.read) ? null :
8227
8233
  this.durationValueAccessor.bind(this);
8228
8234
  column.editType = column.editType ? column.editType : 'stringedit';
8229
8235
  column.type = column.type ? column.type : 'string';
@@ -8370,7 +8376,7 @@ class GanttTreeGrid {
8370
8376
  */
8371
8377
  composeIDColumn(column) {
8372
8378
  const isProjectView = this.parent.viewType === 'ProjectView';
8373
- const lengthDataSource = this.parent.dataSource['length'];
8379
+ const lengthDataSource = this.parent.dataSource ? this.parent.dataSource['length'] : 0;
8374
8380
  let taskIDName;
8375
8381
  column.isPrimaryKey = isProjectView ? true : false;
8376
8382
  if (this.parent.isLocaleChanged) {
@@ -20153,7 +20159,7 @@ class TaskbarEdit extends DateProcessor {
20153
20159
  pStartDate.setTime(pStartDate.getTime() + (left * milliSecondsPerPixel));
20154
20160
  /* To render the milestone in proper date while editing */
20155
20161
  if (isMilestone && !isNullOrUndefined(property.predecessorsName) && property.predecessorsName !== '') {
20156
- pStartDate.setDate(pStartDate.getDate() - 1);
20162
+ // pStartDate.setDate(pStartDate.getDate()-1);
20157
20163
  this.parent.dateValidationModule.setTime(this.parent.defaultEndTime, pStartDate);
20158
20164
  pStartDate = this.parent.dateValidationModule.checkStartDate(pStartDate, property, true);
20159
20165
  }
@@ -20163,9 +20169,9 @@ class TaskbarEdit extends DateProcessor {
20163
20169
  if (this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString())) && !this.parent.isInDst(pStartDate)) {
20164
20170
  pStartDate.setTime(pStartDate.getTime() + (60 * 60 * 1000));
20165
20171
  }
20166
- else if (!this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString())) && this.parent.isInDst(pStartDate)) {
20167
- pStartDate.setTime(pStartDate.getTime() - (60 * 60 * 1000));
20168
- }
20172
+ // else if (!this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString())) && this.parent.isInDst(pStartDate)) {
20173
+ // pStartDate.setTime(pStartDate.getTime() - (60 * 60 * 1000));
20174
+ // }
20169
20175
  }
20170
20176
  return pStartDate;
20171
20177
  }
@@ -26768,34 +26774,42 @@ class Edit$2 {
26768
26774
  const predecessorCollection = parentRecordTaskData.predecessor;
26769
26775
  let childRecord;
26770
26776
  let predecessorIndex;
26777
+ let validPredecessor;
26771
26778
  const updatedPredecessor = [];
26772
26779
  for (let count = 0; count < len; count++) {
26773
- if (predecessorCollection[count].to === parentRecordTaskData.rowUniqueID.toString()) {
26774
- childRecord = this.parent.getRecordByID(predecessorCollection[count].from);
26775
- predecessorIndex = getIndex(predecessorCollection[count], 'from', childRecord.ganttProperties.predecessor, 'to');
26776
- // eslint-disable-next-line
26777
- let predecessorCollections = (extend([], childRecord.ganttProperties.predecessor, [], true));
26778
- predecessorCollections.splice(predecessorIndex, 1);
26779
- this.parent.setRecordValue('predecessor', predecessorCollections, childRecord.ganttProperties, true);
26780
- }
26781
- else if (predecessorCollection[count].from === parentRecordTaskData.rowUniqueID.toString()) {
26782
- childRecord = this.parent.getRecordByID(predecessorCollection[count].to);
26783
- const prdcList = (childRecord.ganttProperties.predecessorsName.toString()).split(',');
26784
- const str = predecessorCollection[count].from + predecessorCollection[count].type;
26785
- const ind = prdcList.indexOf(str);
26786
- prdcList.splice(ind, 1);
26787
- this.parent.setRecordValue('predecessorsName', prdcList.join(','), childRecord.ganttProperties, true);
26788
- this.parent.setRecordValue(this.parent.taskFields.dependency, prdcList.join(','), childRecord);
26789
- predecessorIndex = getIndex(predecessorCollection[count], 'from', childRecord.ganttProperties.predecessor, 'to');
26790
- // eslint-disable-next-line
26791
- const temppredecessorCollection = (extend([], childRecord.ganttProperties.predecessor, [], true));
26792
- temppredecessorCollection.splice(predecessorIndex, 1);
26793
- this.parent.setRecordValue('predecessor', temppredecessorCollection, childRecord.ganttProperties, true);
26794
- this.parent.predecessorModule.validatePredecessorDates(childRecord);
26780
+ const fromRecord = this.parent.getRecordByID(predecessorCollection[count].from);
26781
+ const toRecord = this.parent.getRecordByID(predecessorCollection[count].to);
26782
+ validPredecessor = this.parent.connectorLineEditModule.validateParentPredecessor(fromRecord, toRecord);
26783
+ if (!validPredecessor) {
26784
+ if (predecessorCollection[count].to === parentRecordTaskData.rowUniqueID.toString()) {
26785
+ childRecord = this.parent.getRecordByID(predecessorCollection[count].from);
26786
+ predecessorIndex = getIndex(predecessorCollection[count], 'from', childRecord.ganttProperties.predecessor, 'to');
26787
+ // eslint-disable-next-line
26788
+ let predecessorCollections = (extend([], childRecord.ganttProperties.predecessor, [], true));
26789
+ predecessorCollections.splice(predecessorIndex, 1);
26790
+ this.parent.setRecordValue('predecessor', predecessorCollections, childRecord.ganttProperties, true);
26791
+ }
26792
+ else if (predecessorCollection[count].from === parentRecordTaskData.rowUniqueID.toString()) {
26793
+ childRecord = this.parent.getRecordByID(predecessorCollection[count].to);
26794
+ const prdcList = (childRecord.ganttProperties.predecessorsName.toString()).split(',');
26795
+ const str = predecessorCollection[count].from + predecessorCollection[count].type;
26796
+ const ind = prdcList.indexOf(str);
26797
+ prdcList.splice(ind, 1);
26798
+ this.parent.setRecordValue('predecessorsName', prdcList.join(','), childRecord.ganttProperties, true);
26799
+ this.parent.setRecordValue(this.parent.taskFields.dependency, prdcList.join(','), childRecord);
26800
+ predecessorIndex = getIndex(predecessorCollection[count], 'from', childRecord.ganttProperties.predecessor, 'to');
26801
+ // eslint-disable-next-line
26802
+ const temppredecessorCollection = (extend([], childRecord.ganttProperties.predecessor, [], true));
26803
+ temppredecessorCollection.splice(predecessorIndex, 1);
26804
+ this.parent.setRecordValue('predecessor', temppredecessorCollection, childRecord.ganttProperties, true);
26805
+ this.parent.predecessorModule.validatePredecessorDates(childRecord);
26806
+ }
26795
26807
  }
26796
26808
  }
26797
- this.parent.setRecordValue('predecessor', updatedPredecessor, parentRecord.ganttProperties, true);
26798
- this.parent.setRecordValue('predecessorsName', '', parentRecord.ganttProperties, true);
26809
+ if (!validPredecessor) {
26810
+ this.parent.setRecordValue('predecessor', updatedPredecessor, parentRecord.ganttProperties, true);
26811
+ this.parent.setRecordValue('predecessorsName', '', parentRecord.ganttProperties, true);
26812
+ }
26799
26813
  }
26800
26814
  /**
26801
26815
  * @param {IPredecessor[]} predecessorCollection .
@@ -27756,11 +27770,19 @@ class Edit$2 {
27756
27770
  }
27757
27771
  if (this.dropPosition === 'middleSegment') {
27758
27772
  if (droppedRec.ganttProperties.predecessor) {
27759
- this.parent.editModule.removePredecessorOnDelete(droppedRec);
27760
- droppedRec.ganttProperties.predecessor = null;
27761
- droppedRec.ganttProperties.predecessorsName = null;
27762
- droppedRec[this.parent.taskFields.dependency] = null;
27763
- droppedRec.taskData[this.parent.taskFields.dependency] = null;
27773
+ const len = droppedRec.ganttProperties.predecessor.length;
27774
+ for (let count = 0; count < len; count++) {
27775
+ const fromRecord = this.parent.getRecordByID(droppedRec.ganttProperties.predecessor[count].from);
27776
+ const toRecord = this.parent.getRecordByID(droppedRec.ganttProperties.predecessor[count].to);
27777
+ const validPredecessor = this.parent.connectorLineEditModule.validateParentPredecessor(fromRecord, toRecord);
27778
+ if (droppedRec.ganttProperties.predecessor && !validPredecessor) {
27779
+ this.parent.editModule.removePredecessorOnDelete(droppedRec);
27780
+ droppedRec.ganttProperties.predecessor = null;
27781
+ droppedRec.ganttProperties.predecessorsName = null;
27782
+ droppedRec[this.parent.taskFields.dependency] = null;
27783
+ droppedRec.taskData[this.parent.taskFields.dependency] = null;
27784
+ }
27785
+ }
27764
27786
  }
27765
27787
  if (droppedRec.ganttProperties.isMilestone) {
27766
27788
  this.parent.setRecordValue('isMilestone', false, droppedRec.ganttProperties, true);
@@ -32231,11 +32253,19 @@ class RowDD$1 {
32231
32253
  }
32232
32254
  if (this.dropPosition === 'middleSegment') {
32233
32255
  if (droppedRecord.ganttProperties.predecessor) {
32234
- this.parent.editModule.removePredecessorOnDelete(droppedRecord);
32235
- droppedRecord.ganttProperties.predecessor = null;
32236
- droppedRecord.ganttProperties.predecessorsName = null;
32237
- droppedRecord[this.parent.taskFields.dependency] = null;
32238
- droppedRecord.taskData[this.parent.taskFields.dependency] = null;
32256
+ const len = droppedRecord.ganttProperties.predecessor.length;
32257
+ for (let count = 0; count < len; count++) {
32258
+ const fromRecord = this.parent.getRecordByID(droppedRecord.ganttProperties.predecessor[count].from);
32259
+ const toRecord = this.parent.getRecordByID(droppedRecord.ganttProperties.predecessor[count].to);
32260
+ const validPredecessor = this.parent.connectorLineEditModule.validateParentPredecessor(fromRecord, toRecord);
32261
+ if (droppedRecord.ganttProperties.predecessor && !validPredecessor) {
32262
+ this.parent.editModule.removePredecessorOnDelete(droppedRecord);
32263
+ droppedRecord.ganttProperties.predecessor = null;
32264
+ droppedRecord.ganttProperties.predecessorsName = null;
32265
+ droppedRecord[this.parent.taskFields.dependency] = null;
32266
+ droppedRecord.taskData[this.parent.taskFields.dependency] = null;
32267
+ }
32268
+ }
32239
32269
  }
32240
32270
  if (droppedRecord.ganttProperties.isMilestone) {
32241
32271
  this.parent.setRecordValue('isMilestone', false, droppedRecord.ganttProperties, true);