@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.
@@ -271,7 +271,7 @@ var DateProcessor = /** @__PURE__ @class */ (function () {
271
271
  if (!this.parent.includeWeekend) {
272
272
  var tempDate = new Date(cloneStartDate.getTime());
273
273
  cloneStartDate = this.getNextWorkingDay(cloneStartDate);
274
- if (tempDate.getTime() !== cloneStartDate.getTime()) {
274
+ if (tempDate.getTime() !== cloneStartDate.getTime() && !validateAsMilestone) {
275
275
  this.setTime(startTime, cloneStartDate);
276
276
  }
277
277
  }
@@ -4839,7 +4839,7 @@ var GanttChart = /** @__PURE__ @class */ (function () {
4839
4839
  if (this.parent.editSettings.allowTaskbarEditing && this.parent.element.querySelector('.e-left-resize-gripper')) {
4840
4840
  isTaskbarEdited = true;
4841
4841
  }
4842
- if (!isTaskbarEdited) {
4842
+ if (!isTaskbarEdited || e.button == 2) {
4843
4843
  if (this.parent.editSettings.allowEditing && this.parent.treeGrid.element.getElementsByClassName('e-editedbatchcell').length > 0) {
4844
4844
  this.parent.treeGrid.endEdit();
4845
4845
  }
@@ -6118,6 +6118,10 @@ var Timeline = /** @__PURE__ @class */ (function () {
6118
6118
  if (!this.parent.isFromOnPropertyChange) {
6119
6119
  this.parent.updateProjectDates(this.parent.cloneProjectStartDate, this.parent.cloneProjectEndDate, this.parent.isTimelineRoundOff);
6120
6120
  }
6121
+ var timelineContainer = this.parent.element.getElementsByClassName('e-timeline-header-container')[0]['offsetHeight'];
6122
+ this.parent.element.getElementsByClassName('e-gridcontent')[0]['style'].height = 'calc(100% - ' + timelineContainer + 'px)';
6123
+ // eslint-disable-next-line
6124
+ this.parent.element.getElementsByClassName('e-chart-scroll-container e-content')[0]['style'].height = 'calc(100% - ' + timelineContainer + 'px)';
6121
6125
  };
6122
6126
  /**
6123
6127
  * Function used to refresh Gantt rows.
@@ -6332,6 +6336,7 @@ var Timeline = /** @__PURE__ @class */ (function () {
6332
6336
  }
6333
6337
  this.changeTimelineSettings(newTimeline);
6334
6338
  this.parent.isTimelineRoundOff = isNullOrUndefined(this.parent.projectStartDate) ? true : false;
6339
+ this.isZoomToFit = false;
6335
6340
  };
6336
6341
  Timeline.prototype.bottomTierCellWidthCalc = function (mode, zoomLevel, date) {
6337
6342
  var convertedMilliSeconds;
@@ -7482,10 +7487,9 @@ var Timeline = /** @__PURE__ @class */ (function () {
7482
7487
  var validEndLeft = this.parent.dataOperation.getTaskLeft(validEndDate, false);
7483
7488
  var isChanged = void 0;
7484
7489
  var taskbarModule = this.parent.editModule.taskbarEditModule;
7485
- if (!isNullOrUndefined(maxStartLeft) && ((minStartDate < this.timelineStartDate) ||
7486
- (!isNullOrUndefined(taskbarModule)) && (!isNullOrUndefined(taskbarModule.taskBarEditAction)
7487
- && taskbarModule.taskBarEditAction !== 'ProgressResizing' &&
7488
- taskbarModule.taskBarEditAction !== 'RightResizing')) && (maxStartLeft < this.bottomTierCellWidth || maxStartLeft <= validStartLeft)) {
7490
+ if (!isNullOrUndefined(maxStartLeft) && ((!isNullOrUndefined(taskbarModule)) && (!isNullOrUndefined(taskbarModule.taskBarEditAction)
7491
+ && taskbarModule.taskBarEditAction !== 'ProgressResizing' &&
7492
+ taskbarModule.taskBarEditAction !== 'RightResizing' && taskbarModule.taskBarEditAction !== 'LeftResizing')) && (maxStartLeft < this.bottomTierCellWidth || maxStartLeft <= validStartLeft)) {
7489
7493
  isChanged = 'prevTimeSpan';
7490
7494
  minStartDate = minStartDate > this.timelineStartDate ? this.timelineStartDate : minStartDate;
7491
7495
  }
@@ -7750,7 +7754,9 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7750
7754
  this.parent.treeGrid.loadChildOnDemand = this.parent.loadChildOnDemand;
7751
7755
  this.parent.treeGrid['isFromGantt'] = true;
7752
7756
  this.parent.treeGrid.parentIdMapping = this.parent.taskFields.parentID;
7753
- this.parent.treeGrid.idMapping = this.parent.taskFields.id;
7757
+ if (this.parent.taskFields.parentID) {
7758
+ this.parent.treeGrid.idMapping = this.parent.taskFields.id;
7759
+ }
7754
7760
  this.parent.treeGrid.showColumnMenu = this.parent.showColumnMenu;
7755
7761
  this.parent.treeGrid.enableCollapseAll = this.parent.collapseAllParentTasks;
7756
7762
  this.parent.treeGrid.columnMenuItems = this.parent.columnMenuItems;
@@ -7791,7 +7797,7 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7791
7797
  toolbarHeight = this.parent.toolbarModule.element.offsetHeight;
7792
7798
  }
7793
7799
  this.parent.treeGrid.height =
7794
- this.parent.element.getElementsByClassName('e-chart-scroll-container e-content')[0]['offsetHeight'] - 19;
7800
+ this.parent.element.getElementsByClassName('e-chart-scroll-container e-content')[0]['offsetHeight'] - (this.parent.flatData.length == 0 ? 0 : 19);
7795
7801
  };
7796
7802
  GanttTreeGrid.prototype.getContentDiv = function () {
7797
7803
  return this.treeGridElement.querySelector('.e-content');
@@ -8303,7 +8309,7 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
8303
8309
  else {
8304
8310
  column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('duration');
8305
8311
  }
8306
- column.valueAccessor = column.valueAccessor ? column.valueAccessor : !isNullOrUndefined(column.edit) ? null :
8312
+ column.valueAccessor = column.valueAccessor ? column.valueAccessor : !isNullOrUndefined(column.edit) && !isNullOrUndefined(column.edit.read) ? null :
8307
8313
  this.durationValueAccessor.bind(this);
8308
8314
  column.editType = column.editType ? column.editType : 'stringedit';
8309
8315
  column.type = column.type ? column.type : 'string';
@@ -8450,7 +8456,7 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
8450
8456
  */
8451
8457
  GanttTreeGrid.prototype.composeIDColumn = function (column) {
8452
8458
  var isProjectView = this.parent.viewType === 'ProjectView';
8453
- var lengthDataSource = this.parent.dataSource['length'];
8459
+ var lengthDataSource = this.parent.dataSource ? this.parent.dataSource['length'] : 0;
8454
8460
  var taskIDName;
8455
8461
  column.isPrimaryKey = isProjectView ? true : false;
8456
8462
  if (this.parent.isLocaleChanged) {
@@ -20637,7 +20643,7 @@ var TaskbarEdit = /** @__PURE__ @class */ (function (_super) {
20637
20643
  pStartDate.setTime(pStartDate.getTime() + (left * milliSecondsPerPixel));
20638
20644
  /* To render the milestone in proper date while editing */
20639
20645
  if (isMilestone && !isNullOrUndefined(property.predecessorsName) && property.predecessorsName !== '') {
20640
- pStartDate.setDate(pStartDate.getDate() - 1);
20646
+ // pStartDate.setDate(pStartDate.getDate()-1);
20641
20647
  this.parent.dateValidationModule.setTime(this.parent.defaultEndTime, pStartDate);
20642
20648
  pStartDate = this.parent.dateValidationModule.checkStartDate(pStartDate, property, true);
20643
20649
  }
@@ -20647,9 +20653,9 @@ var TaskbarEdit = /** @__PURE__ @class */ (function (_super) {
20647
20653
  if (this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString())) && !this.parent.isInDst(pStartDate)) {
20648
20654
  pStartDate.setTime(pStartDate.getTime() + (60 * 60 * 1000));
20649
20655
  }
20650
- else if (!this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString())) && this.parent.isInDst(pStartDate)) {
20651
- pStartDate.setTime(pStartDate.getTime() - (60 * 60 * 1000));
20652
- }
20656
+ // else if (!this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString())) && this.parent.isInDst(pStartDate)) {
20657
+ // pStartDate.setTime(pStartDate.getTime() - (60 * 60 * 1000));
20658
+ // }
20653
20659
  }
20654
20660
  return pStartDate;
20655
20661
  };
@@ -27323,34 +27329,42 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
27323
27329
  var predecessorCollection = parentRecordTaskData.predecessor;
27324
27330
  var childRecord;
27325
27331
  var predecessorIndex;
27332
+ var validPredecessor;
27326
27333
  var updatedPredecessor = [];
27327
27334
  for (var count = 0; count < len; count++) {
27328
- if (predecessorCollection[count].to === parentRecordTaskData.rowUniqueID.toString()) {
27329
- childRecord = this.parent.getRecordByID(predecessorCollection[count].from);
27330
- predecessorIndex = getIndex(predecessorCollection[count], 'from', childRecord.ganttProperties.predecessor, 'to');
27331
- // eslint-disable-next-line
27332
- var predecessorCollections = (extend([], childRecord.ganttProperties.predecessor, [], true));
27333
- predecessorCollections.splice(predecessorIndex, 1);
27334
- this.parent.setRecordValue('predecessor', predecessorCollections, childRecord.ganttProperties, true);
27335
- }
27336
- else if (predecessorCollection[count].from === parentRecordTaskData.rowUniqueID.toString()) {
27337
- childRecord = this.parent.getRecordByID(predecessorCollection[count].to);
27338
- var prdcList = (childRecord.ganttProperties.predecessorsName.toString()).split(',');
27339
- var str = predecessorCollection[count].from + predecessorCollection[count].type;
27340
- var ind = prdcList.indexOf(str);
27341
- prdcList.splice(ind, 1);
27342
- this.parent.setRecordValue('predecessorsName', prdcList.join(','), childRecord.ganttProperties, true);
27343
- this.parent.setRecordValue(this.parent.taskFields.dependency, prdcList.join(','), childRecord);
27344
- predecessorIndex = getIndex(predecessorCollection[count], 'from', childRecord.ganttProperties.predecessor, 'to');
27345
- // eslint-disable-next-line
27346
- var temppredecessorCollection = (extend([], childRecord.ganttProperties.predecessor, [], true));
27347
- temppredecessorCollection.splice(predecessorIndex, 1);
27348
- this.parent.setRecordValue('predecessor', temppredecessorCollection, childRecord.ganttProperties, true);
27349
- this.parent.predecessorModule.validatePredecessorDates(childRecord);
27335
+ var fromRecord = this.parent.getRecordByID(predecessorCollection[count].from);
27336
+ var toRecord = this.parent.getRecordByID(predecessorCollection[count].to);
27337
+ validPredecessor = this.parent.connectorLineEditModule.validateParentPredecessor(fromRecord, toRecord);
27338
+ if (!validPredecessor) {
27339
+ if (predecessorCollection[count].to === parentRecordTaskData.rowUniqueID.toString()) {
27340
+ childRecord = this.parent.getRecordByID(predecessorCollection[count].from);
27341
+ predecessorIndex = getIndex(predecessorCollection[count], 'from', childRecord.ganttProperties.predecessor, 'to');
27342
+ // eslint-disable-next-line
27343
+ var predecessorCollections = (extend([], childRecord.ganttProperties.predecessor, [], true));
27344
+ predecessorCollections.splice(predecessorIndex, 1);
27345
+ this.parent.setRecordValue('predecessor', predecessorCollections, childRecord.ganttProperties, true);
27346
+ }
27347
+ else if (predecessorCollection[count].from === parentRecordTaskData.rowUniqueID.toString()) {
27348
+ childRecord = this.parent.getRecordByID(predecessorCollection[count].to);
27349
+ var prdcList = (childRecord.ganttProperties.predecessorsName.toString()).split(',');
27350
+ var str = predecessorCollection[count].from + predecessorCollection[count].type;
27351
+ var ind = prdcList.indexOf(str);
27352
+ prdcList.splice(ind, 1);
27353
+ this.parent.setRecordValue('predecessorsName', prdcList.join(','), childRecord.ganttProperties, true);
27354
+ this.parent.setRecordValue(this.parent.taskFields.dependency, prdcList.join(','), childRecord);
27355
+ predecessorIndex = getIndex(predecessorCollection[count], 'from', childRecord.ganttProperties.predecessor, 'to');
27356
+ // eslint-disable-next-line
27357
+ var temppredecessorCollection = (extend([], childRecord.ganttProperties.predecessor, [], true));
27358
+ temppredecessorCollection.splice(predecessorIndex, 1);
27359
+ this.parent.setRecordValue('predecessor', temppredecessorCollection, childRecord.ganttProperties, true);
27360
+ this.parent.predecessorModule.validatePredecessorDates(childRecord);
27361
+ }
27350
27362
  }
27351
27363
  }
27352
- this.parent.setRecordValue('predecessor', updatedPredecessor, parentRecord.ganttProperties, true);
27353
- this.parent.setRecordValue('predecessorsName', '', parentRecord.ganttProperties, true);
27364
+ if (!validPredecessor) {
27365
+ this.parent.setRecordValue('predecessor', updatedPredecessor, parentRecord.ganttProperties, true);
27366
+ this.parent.setRecordValue('predecessorsName', '', parentRecord.ganttProperties, true);
27367
+ }
27354
27368
  };
27355
27369
  /**
27356
27370
  * @param {IPredecessor[]} predecessorCollection .
@@ -28317,11 +28331,19 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
28317
28331
  }
28318
28332
  if (this.dropPosition === 'middleSegment') {
28319
28333
  if (droppedRec.ganttProperties.predecessor) {
28320
- this.parent.editModule.removePredecessorOnDelete(droppedRec);
28321
- droppedRec.ganttProperties.predecessor = null;
28322
- droppedRec.ganttProperties.predecessorsName = null;
28323
- droppedRec[this.parent.taskFields.dependency] = null;
28324
- droppedRec.taskData[this.parent.taskFields.dependency] = null;
28334
+ var len = droppedRec.ganttProperties.predecessor.length;
28335
+ for (var count = 0; count < len; count++) {
28336
+ var fromRecord = this.parent.getRecordByID(droppedRec.ganttProperties.predecessor[count].from);
28337
+ var toRecord = this.parent.getRecordByID(droppedRec.ganttProperties.predecessor[count].to);
28338
+ var validPredecessor = this.parent.connectorLineEditModule.validateParentPredecessor(fromRecord, toRecord);
28339
+ if (droppedRec.ganttProperties.predecessor && !validPredecessor) {
28340
+ this.parent.editModule.removePredecessorOnDelete(droppedRec);
28341
+ droppedRec.ganttProperties.predecessor = null;
28342
+ droppedRec.ganttProperties.predecessorsName = null;
28343
+ droppedRec[this.parent.taskFields.dependency] = null;
28344
+ droppedRec.taskData[this.parent.taskFields.dependency] = null;
28345
+ }
28346
+ }
28325
28347
  }
28326
28348
  if (droppedRec.ganttProperties.isMilestone) {
28327
28349
  this.parent.setRecordValue('isMilestone', false, droppedRec.ganttProperties, true);
@@ -32861,11 +32883,19 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
32861
32883
  }
32862
32884
  if (this.dropPosition === 'middleSegment') {
32863
32885
  if (droppedRecord.ganttProperties.predecessor) {
32864
- this.parent.editModule.removePredecessorOnDelete(droppedRecord);
32865
- droppedRecord.ganttProperties.predecessor = null;
32866
- droppedRecord.ganttProperties.predecessorsName = null;
32867
- droppedRecord[this.parent.taskFields.dependency] = null;
32868
- droppedRecord.taskData[this.parent.taskFields.dependency] = null;
32886
+ var len = droppedRecord.ganttProperties.predecessor.length;
32887
+ for (var count_1 = 0; count_1 < len; count_1++) {
32888
+ var fromRecord = this.parent.getRecordByID(droppedRecord.ganttProperties.predecessor[count_1].from);
32889
+ var toRecord = this.parent.getRecordByID(droppedRecord.ganttProperties.predecessor[count_1].to);
32890
+ var validPredecessor = this.parent.connectorLineEditModule.validateParentPredecessor(fromRecord, toRecord);
32891
+ if (droppedRecord.ganttProperties.predecessor && !validPredecessor) {
32892
+ this.parent.editModule.removePredecessorOnDelete(droppedRecord);
32893
+ droppedRecord.ganttProperties.predecessor = null;
32894
+ droppedRecord.ganttProperties.predecessorsName = null;
32895
+ droppedRecord[this.parent.taskFields.dependency] = null;
32896
+ droppedRecord.taskData[this.parent.taskFields.dependency] = null;
32897
+ }
32898
+ }
32869
32899
  }
32870
32900
  if (droppedRecord.ganttProperties.isMilestone) {
32871
32901
  this.parent.setRecordValue('isMilestone', false, droppedRecord.ganttProperties, true);