@syncfusion/ej2-gantt 23.2.5 → 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.
@@ -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;
@@ -8224,7 +8229,7 @@ class GanttTreeGrid {
8224
8229
  else {
8225
8230
  column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('duration');
8226
8231
  }
8227
- 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 :
8228
8233
  this.durationValueAccessor.bind(this);
8229
8234
  column.editType = column.editType ? column.editType : 'stringedit';
8230
8235
  column.type = column.type ? column.type : 'string';
@@ -20154,7 +20159,7 @@ class TaskbarEdit extends DateProcessor {
20154
20159
  pStartDate.setTime(pStartDate.getTime() + (left * milliSecondsPerPixel));
20155
20160
  /* To render the milestone in proper date while editing */
20156
20161
  if (isMilestone && !isNullOrUndefined(property.predecessorsName) && property.predecessorsName !== '') {
20157
- pStartDate.setDate(pStartDate.getDate() - 1);
20162
+ // pStartDate.setDate(pStartDate.getDate()-1);
20158
20163
  this.parent.dateValidationModule.setTime(this.parent.defaultEndTime, pStartDate);
20159
20164
  pStartDate = this.parent.dateValidationModule.checkStartDate(pStartDate, property, true);
20160
20165
  }
@@ -20164,9 +20169,9 @@ class TaskbarEdit extends DateProcessor {
20164
20169
  if (this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString())) && !this.parent.isInDst(pStartDate)) {
20165
20170
  pStartDate.setTime(pStartDate.getTime() + (60 * 60 * 1000));
20166
20171
  }
20167
- else if (!this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString())) && this.parent.isInDst(pStartDate)) {
20168
- pStartDate.setTime(pStartDate.getTime() - (60 * 60 * 1000));
20169
- }
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
+ // }
20170
20175
  }
20171
20176
  return pStartDate;
20172
20177
  }
@@ -26769,34 +26774,42 @@ class Edit$2 {
26769
26774
  const predecessorCollection = parentRecordTaskData.predecessor;
26770
26775
  let childRecord;
26771
26776
  let predecessorIndex;
26777
+ let validPredecessor;
26772
26778
  const updatedPredecessor = [];
26773
26779
  for (let count = 0; count < len; count++) {
26774
- if (predecessorCollection[count].to === parentRecordTaskData.rowUniqueID.toString()) {
26775
- childRecord = this.parent.getRecordByID(predecessorCollection[count].from);
26776
- predecessorIndex = getIndex(predecessorCollection[count], 'from', childRecord.ganttProperties.predecessor, 'to');
26777
- // eslint-disable-next-line
26778
- let predecessorCollections = (extend([], childRecord.ganttProperties.predecessor, [], true));
26779
- predecessorCollections.splice(predecessorIndex, 1);
26780
- this.parent.setRecordValue('predecessor', predecessorCollections, childRecord.ganttProperties, true);
26781
- }
26782
- else if (predecessorCollection[count].from === parentRecordTaskData.rowUniqueID.toString()) {
26783
- childRecord = this.parent.getRecordByID(predecessorCollection[count].to);
26784
- const prdcList = (childRecord.ganttProperties.predecessorsName.toString()).split(',');
26785
- const str = predecessorCollection[count].from + predecessorCollection[count].type;
26786
- const ind = prdcList.indexOf(str);
26787
- prdcList.splice(ind, 1);
26788
- this.parent.setRecordValue('predecessorsName', prdcList.join(','), childRecord.ganttProperties, true);
26789
- this.parent.setRecordValue(this.parent.taskFields.dependency, prdcList.join(','), childRecord);
26790
- predecessorIndex = getIndex(predecessorCollection[count], 'from', childRecord.ganttProperties.predecessor, 'to');
26791
- // eslint-disable-next-line
26792
- const temppredecessorCollection = (extend([], childRecord.ganttProperties.predecessor, [], true));
26793
- temppredecessorCollection.splice(predecessorIndex, 1);
26794
- this.parent.setRecordValue('predecessor', temppredecessorCollection, childRecord.ganttProperties, true);
26795
- 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
+ }
26796
26807
  }
26797
26808
  }
26798
- this.parent.setRecordValue('predecessor', updatedPredecessor, parentRecord.ganttProperties, true);
26799
- 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
+ }
26800
26813
  }
26801
26814
  /**
26802
26815
  * @param {IPredecessor[]} predecessorCollection .
@@ -27757,11 +27770,19 @@ class Edit$2 {
27757
27770
  }
27758
27771
  if (this.dropPosition === 'middleSegment') {
27759
27772
  if (droppedRec.ganttProperties.predecessor) {
27760
- this.parent.editModule.removePredecessorOnDelete(droppedRec);
27761
- droppedRec.ganttProperties.predecessor = null;
27762
- droppedRec.ganttProperties.predecessorsName = null;
27763
- droppedRec[this.parent.taskFields.dependency] = null;
27764
- 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
+ }
27765
27786
  }
27766
27787
  if (droppedRec.ganttProperties.isMilestone) {
27767
27788
  this.parent.setRecordValue('isMilestone', false, droppedRec.ganttProperties, true);
@@ -32232,11 +32253,19 @@ class RowDD$1 {
32232
32253
  }
32233
32254
  if (this.dropPosition === 'middleSegment') {
32234
32255
  if (droppedRecord.ganttProperties.predecessor) {
32235
- this.parent.editModule.removePredecessorOnDelete(droppedRecord);
32236
- droppedRecord.ganttProperties.predecessor = null;
32237
- droppedRecord.ganttProperties.predecessorsName = null;
32238
- droppedRecord[this.parent.taskFields.dependency] = null;
32239
- 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
+ }
32240
32269
  }
32241
32270
  if (droppedRecord.ganttProperties.isMilestone) {
32242
32271
  this.parent.setRecordValue('isMilestone', false, droppedRecord.ganttProperties, true);