@syncfusion/ej2-gantt 24.2.6 → 24.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.
@@ -1278,9 +1278,16 @@ class DateProcessor {
1278
1278
  convert(date, timezone) {
1279
1279
  const fromOffset = date.getTimezoneOffset();
1280
1280
  const toOffset = this.offset(date, timezone);
1281
- date = new Date(date.getTime() + (fromOffset - toOffset) * 60000);
1282
- const toLocalOffset = date.getTimezoneOffset();
1283
- return new Date(date.getTime() + (toLocalOffset - fromOffset) * 60000);
1281
+ if (fromOffset < 0) {
1282
+ date = new Date(date.getTime() - (fromOffset - toOffset) / 60000);
1283
+ const toLocalOffset = date.getTimezoneOffset();
1284
+ return new Date(date.getTime() - (toLocalOffset - fromOffset) / 60000);
1285
+ }
1286
+ else {
1287
+ date = new Date(date.getTime() + (fromOffset - toOffset) * 60000);
1288
+ const toLocalOffset = date.getTimezoneOffset();
1289
+ return new Date(date.getTime() + (toLocalOffset - fromOffset) * 60000);
1290
+ }
1284
1291
  }
1285
1292
  /**
1286
1293
  * @param {string | Date} date .
@@ -2218,12 +2225,14 @@ class TaskProcessor extends DateProcessor {
2218
2225
  work = parseFloat(work.toFixed(2));
2219
2226
  }
2220
2227
  }
2221
- if (ganttData.childRecords.length > 0 && this.parent.isOnEdit) {
2222
- let childCompletedWorks = 0;
2223
- for (let i = 0; i < ganttData.childRecords.length; i++) {
2224
- childCompletedWorks += ganttData.childRecords[i].ganttProperties.work;
2228
+ if (ganttData.childRecords) {
2229
+ if (ganttData.childRecords.length > 0 && this.parent.isOnEdit) {
2230
+ let childCompletedWorks = 0;
2231
+ for (let i = 0; i < ganttData.childRecords.length; i++) {
2232
+ childCompletedWorks += ganttData.childRecords[i].ganttProperties.work;
2233
+ }
2234
+ work += childCompletedWorks;
2225
2235
  }
2226
- work += childCompletedWorks;
2227
2236
  }
2228
2237
  this.parent.setRecordValue('work', work, ganttData.ganttProperties, true);
2229
2238
  if (!isNullOrUndefined(this.parent.taskFields.work)) {
@@ -2438,7 +2447,7 @@ class TaskProcessor extends DateProcessor {
2438
2447
  this.parent.setRecordValue('work', work, ganttProperties, true);
2439
2448
  switch (tType) {
2440
2449
  case 'FixedDuration':
2441
- this.updateUnitWithWork(ganttData);
2450
+ this.updateWorkWithDuration(ganttData);
2442
2451
  break;
2443
2452
  case 'FixedWork':
2444
2453
  this.updateUnitWithWork(ganttData);
@@ -2794,7 +2803,12 @@ class TaskProcessor extends DateProcessor {
2794
2803
  return ((this.getTimeDifference(sDate, eDate, true) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth);
2795
2804
  }
2796
2805
  else {
2797
- return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * hour)) * this.parent.perDayWidth);
2806
+ if (ganttData.durationUnit === "day" && ganttData.duration < 1 && isNullOrUndefined(this.parent.taskFields.duration)) {
2807
+ return (ganttData.duration * this.parent.perDayWidth);
2808
+ }
2809
+ else {
2810
+ return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * hour)) * this.parent.perDayWidth);
2811
+ }
2798
2812
  }
2799
2813
  }
2800
2814
  }
@@ -2805,6 +2819,7 @@ class TaskProcessor extends DateProcessor {
2805
2819
  }
2806
2820
  if (this.getSecondsInDecimal(eDate) === this.parent.defaultEndTime) {
2807
2821
  eDate.setHours(24);
2822
+ eDate.setHours(0, 0, 0, 0);
2808
2823
  }
2809
2824
  if (this.getSecondsInDecimal(eDate) === this.parent.defaultStartTime) {
2810
2825
  eDate.setHours(0, 0, 0, 0);
@@ -2847,14 +2862,18 @@ class TaskProcessor extends DateProcessor {
2847
2862
  this.parent.ganttChartModule.scrollObject['isSetScrollLeft'])) && !isFromTimelineVirtulization) {
2848
2863
  isValid = false;
2849
2864
  }
2850
- if (this.parent.enableTimelineVirtualization && isValid && !this.parent.timelineModule['performedTimeSpanAction']) {
2865
+ if (!this.parent.editModule && this.parent.enableTimelineVirtualization && isValid && !this.parent.timelineModule['performedTimeSpanAction']) {
2851
2866
  leftValueForStartDate = (this.parent.enableTimelineVirtualization && this.parent.ganttChartModule.scrollObject.element.scrollLeft != 0)
2852
2867
  ? this.parent.ganttChartModule.scrollObject.getTimelineLeft() : null;
2853
2868
  }
2854
- const timelineStartDate = (this.parent.enableTimelineVirtualization && !isNullOrUndefined(leftValueForStartDate))
2869
+ const timelineStartDate = (!this.parent.editModule && this.parent.enableTimelineVirtualization && !isNullOrUndefined(leftValueForStartDate))
2855
2870
  ? new Date((this.parent.timelineModule['dateByLeftValue'](leftValueForStartDate)).toString()) : new Date(this.parent.timelineModule.timelineStartDate);
2856
2871
  if (timelineStartDate) {
2857
- return (date.getTime() - timelineStartDate.getTime()) / (1000 * 60 * 60 * 24) * this.parent.perDayWidth;
2872
+ let leftValue = (date.getTime() - timelineStartDate.getTime()) / (1000 * 60 * 60 * 24) * this.parent.perDayWidth;
2873
+ if (this.parent.isInDst(timelineStartDate) && !this.parent.isInDst(startDate) && (this.parent.timelineModule.topTier == 'Hour' || this.parent.timelineModule.bottomTier == 'Hour')) {
2874
+ leftValue = leftValue - this.parent.timelineSettings.timelineUnitSize;
2875
+ }
2876
+ return leftValue;
2858
2877
  }
2859
2878
  else {
2860
2879
  return 0;
@@ -6314,10 +6333,8 @@ class Timeline {
6314
6333
  this.parent.dateValidationModule.calculateProjectDates();
6315
6334
  }
6316
6335
  if (!isNullOrUndefined(this.parent.zoomingProjectStartDate)) {
6317
- this.parent.cloneProjectStartDate = this.parent.cloneProjectStartDate.getTime() < this.parent.zoomingProjectStartDate.getTime()
6318
- ? this.parent.cloneProjectStartDate : this.parent.zoomingProjectStartDate;
6319
- this.parent.cloneProjectEndDate = this.parent.cloneProjectEndDate.getTime() > this.parent.zoomingProjectEndDate.getTime()
6320
- ? this.parent.cloneProjectEndDate : this.parent.zoomingProjectEndDate;
6336
+ this.parent.cloneProjectStartDate = this.parent.zoomingProjectStartDate;
6337
+ this.parent.cloneProjectEndDate = this.parent.zoomingProjectEndDate;
6321
6338
  }
6322
6339
  this.parent.zoomingProjectStartDate = null;
6323
6340
  this.parent.zoomingProjectEndDate = null;
@@ -8376,7 +8393,7 @@ class GanttTreeGrid {
8376
8393
  this.currentEditRow = {};
8377
8394
  }
8378
8395
  }
8379
- if (getValue('requestType', args) === 'filterafteropen') {
8396
+ if (getValue('requestType', args) === 'filterAfterOpen') {
8380
8397
  this.parent.notify('actionComplete', args);
8381
8398
  }
8382
8399
  if (getValue('requestType', args) === 'searching') {
@@ -11574,6 +11591,7 @@ class Dependency {
11574
11591
  this.parentIds = [];
11575
11592
  this.parentPredecessors = [];
11576
11593
  this.validatedParentIds = [];
11594
+ this.storeId = null;
11577
11595
  this.parent = gantt;
11578
11596
  this.dateValidateModule = this.parent.dateValidationModule;
11579
11597
  }
@@ -11611,7 +11629,7 @@ class Dependency {
11611
11629
  for (let c = 0; c < predecessorVal.length; c++) {
11612
11630
  const predecessorItem = predecessorVal[c];
11613
11631
  const preValue = {};
11614
- preValue.from = getValue('from', predecessorItem);
11632
+ preValue.from = getValue('from', predecessorItem) ? getValue('from', predecessorItem) : predecessorVal[c];
11615
11633
  preValue.to = getValue('to', predecessorItem) ? getValue('to', predecessorItem) : ganttProp.rowUniqueID;
11616
11634
  preValue.type = getValue('type', predecessorItem) ? getValue('type', predecessorItem) : 'FS';
11617
11635
  const offsetUnits = getValue('offset', predecessorItem);
@@ -11695,6 +11713,9 @@ class Dependency {
11695
11713
  let predecessorText;
11696
11714
  predecessor.split(',').forEach((el) => {
11697
11715
  let isGUId = false;
11716
+ let firstPart;
11717
+ let predecessorName;
11718
+ let isAlpha = false;
11698
11719
  var regex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
11699
11720
  let elSplit = el.split('-');
11700
11721
  let id;
@@ -11708,6 +11729,26 @@ class Dependency {
11708
11729
  isGUId = true;
11709
11730
  }
11710
11731
  }
11732
+ if (el.includes('-')) {
11733
+ if (el.includes('-') && el.includes('days')) {
11734
+ predecessorName = el.slice(-9).toString();
11735
+ }
11736
+ if (el.includes('-') && el.includes('day')) {
11737
+ predecessorName = el.slice(-8).toString();
11738
+ }
11739
+ else {
11740
+ predecessorName = el.slice(-2).toString();
11741
+ }
11742
+ if (el.includes('-') && /[A-Za-z]/.test(predecessorName)) {
11743
+ const indexFS = el.indexOf(predecessorName);
11744
+ if (indexFS !== -1) {
11745
+ firstPart = el.substring(0, indexFS);
11746
+ if (firstPart.includes('-')) {
11747
+ isAlpha = true;
11748
+ }
11749
+ }
11750
+ }
11751
+ }
11711
11752
  if (isGUId) {
11712
11753
  let split;
11713
11754
  split = elSplit[4].split('+');
@@ -11736,11 +11777,16 @@ class Dependency {
11736
11777
  }
11737
11778
  }
11738
11779
  else {
11739
- values = el.split('+');
11740
- offsetValue = '+';
11741
- if (el.indexOf('-') >= 0) {
11742
- values = el.split('-');
11743
- offsetValue = '-';
11780
+ if (isAlpha && firstPart.includes('-')) {
11781
+ values[0] = firstPart;
11782
+ }
11783
+ else {
11784
+ values = el.split('+');
11785
+ offsetValue = '+';
11786
+ if (el.indexOf('-') >= 0) {
11787
+ values = el.split('-');
11788
+ offsetValue = '-';
11789
+ }
11744
11790
  }
11745
11791
  }
11746
11792
  match = [];
@@ -11778,6 +11824,16 @@ class Dependency {
11778
11824
  predecessorText = 'FS';
11779
11825
  }
11780
11826
  }
11827
+ else if (el.includes('-') && /[A-Za-z]/.test(predecessorName) && firstPart.includes('-')) {
11828
+ const type = el.slice(-2).toString();
11829
+ type.toUpperCase();
11830
+ if (type === 'FS' || type === 'FF' || type === 'SF' || type === 'SS') {
11831
+ predecessorText = type;
11832
+ }
11833
+ else {
11834
+ predecessorText = 'FS';
11835
+ }
11836
+ }
11781
11837
  else {
11782
11838
  predecessorText = 'FS';
11783
11839
  }
@@ -12011,7 +12067,7 @@ class Dependency {
12011
12067
  }
12012
12068
  if (flatData[count].hasChildRecords && this.parent.editModule && !this.parent.allowUnscheduledTasks
12013
12069
  && this.parent.allowParentDependency) {
12014
- this.parent.editModule['updateChildItems'](flatData[count]);
12070
+ this.updateChildItems(flatData[count]);
12015
12071
  }
12016
12072
  }
12017
12073
  }
@@ -12023,7 +12079,7 @@ class Dependency {
12023
12079
  let item = this.parentPredecessors[i];
12024
12080
  this.validatePredecessorDates(item);
12025
12081
  if (item.ganttProperties.startDate) {
12026
- this.parent.editModule['updateChildItems'](item);
12082
+ this.updateChildItems(item);
12027
12083
  }
12028
12084
  }
12029
12085
  }
@@ -12400,7 +12456,15 @@ class Dependency {
12400
12456
  continue;
12401
12457
  }
12402
12458
  if (record) {
12403
- this.validatePredecessor(record, undefined, 'successor');
12459
+ if (this.parent.editModule.isFirstCall) {
12460
+ this.storeId = JSON.parse(JSON.stringify(this.parent.ids));
12461
+ this.parent.editModule.isFirstCall = false;
12462
+ }
12463
+ let index = (this.storeId && this.storeId.indexOf(record[this.parent.taskFields.id].toString()) !== -1) ? this.storeId.indexOf(record[this.parent.taskFields.id].toString()) : -1;
12464
+ if (index !== -1) {
12465
+ this.storeId = this.storeId.slice(0, index).concat(this.storeId.slice(index + 1));
12466
+ this.validatePredecessor(record, undefined, 'successor');
12467
+ }
12404
12468
  }
12405
12469
  }
12406
12470
  if (record && !record.hasChildRecords && record.parentItem && this.validatedParentIds.indexOf(record.parentItem.taskId) == -1) {
@@ -12415,13 +12479,13 @@ class Dependency {
12415
12479
  if (record && record.ganttProperties.taskId !== this.isValidatedParentTaskID && ganttProp) {
12416
12480
  if ((taskBarModule.taskBarEditAction !== 'ParentDrag' && taskBarModule.taskBarEditAction !== 'ChildDrag')) {
12417
12481
  if (!ganttProp.hasChildRecords && record.hasChildRecords) {
12418
- this.parent.editModule['updateChildItems'](record);
12482
+ this.updateChildItems(record);
12419
12483
  this.isValidatedParentTaskID = record.ganttProperties.taskId;
12420
12484
  }
12421
12485
  }
12422
12486
  else if ((!record.hasChildRecords && taskBarModule.taskBarEditAction == 'ChildDrag') ||
12423
12487
  (record.hasChildRecords && taskBarModule.taskBarEditAction == 'ParentDrag')) {
12424
- this.parent.editModule['updateChildItems'](record);
12488
+ this.updateChildItems(record);
12425
12489
  this.isValidatedParentTaskID = record.ganttProperties.taskId;
12426
12490
  }
12427
12491
  if (!ganttProp.hasChildRecords) {
@@ -12429,11 +12493,128 @@ class Dependency {
12429
12493
  }
12430
12494
  }
12431
12495
  else if (record && record.hasChildRecords && !ganttProp) {
12432
- this.parent.editModule['updateChildItems'](record);
12496
+ this.updateChildItems(record);
12497
+ }
12498
+ }
12499
+ }
12500
+ }
12501
+ /**
12502
+ *
12503
+ * @param {IGanttData} ganttRecord .
12504
+ * @returns {void} .
12505
+ */
12506
+ updateChildItems(ganttRecord) {
12507
+ const previousData = this.parent.previousRecords[ganttRecord.uniqueID];
12508
+ let previousStartDate;
12509
+ if (isNullOrUndefined(previousData) ||
12510
+ (isNullOrUndefined(previousData) && !isNullOrUndefined(previousData.ganttProperties))) {
12511
+ previousStartDate = new Date(ganttRecord.ganttProperties.startDate.getTime());
12512
+ }
12513
+ else {
12514
+ if (!isNullOrUndefined(previousData.ganttProperties.startDate)) {
12515
+ previousStartDate = new Date(previousData.ganttProperties.startDate.getTime());
12516
+ }
12517
+ }
12518
+ const currentStartDate = ganttRecord.ganttProperties.startDate;
12519
+ const childRecords = [];
12520
+ let validStartDate;
12521
+ let validEndDate;
12522
+ let calcEndDate;
12523
+ let isRightMove;
12524
+ let durationDiff;
12525
+ this.getUpdatableChildRecords(ganttRecord, childRecords);
12526
+ if (childRecords.length === 0) {
12527
+ return;
12528
+ }
12529
+ if (!isNullOrUndefined(previousStartDate) && !isNullOrUndefined(currentStartDate) && previousStartDate.getTime() > currentStartDate.getTime()) {
12530
+ validStartDate = this.parent.dateValidationModule.checkStartDate(currentStartDate);
12531
+ validEndDate = this.parent.dateValidationModule.checkEndDate(previousStartDate, ganttRecord.ganttProperties);
12532
+ isRightMove = false;
12533
+ }
12534
+ else {
12535
+ validStartDate = this.parent.dateValidationModule.checkStartDate(previousStartDate);
12536
+ validEndDate = this.parent.dateValidationModule.checkEndDate(currentStartDate, ganttRecord.ganttProperties);
12537
+ isRightMove = true;
12538
+ }
12539
+ //Get Duration
12540
+ if (!isNullOrUndefined(validStartDate) && !isNullOrUndefined(validEndDate) && validStartDate.getTime() >= validEndDate.getTime()) {
12541
+ durationDiff = 0;
12542
+ }
12543
+ else {
12544
+ durationDiff = this.parent.dateValidationModule.getDuration(validStartDate, validEndDate, 'minute', true, false);
12545
+ }
12546
+ for (let i = 0; i < childRecords.length; i++) {
12547
+ if (childRecords[i].ganttProperties.isAutoSchedule) {
12548
+ if (durationDiff > 0) {
12549
+ const startDate = isScheduledTask(childRecords[i].ganttProperties) ?
12550
+ childRecords[i].ganttProperties.startDate : childRecords[i].ganttProperties.startDate ?
12551
+ childRecords[i].ganttProperties.startDate : childRecords[i].ganttProperties.endDate ?
12552
+ childRecords[i].ganttProperties.endDate : new Date(previousStartDate.toString());
12553
+ if (isRightMove) {
12554
+ calcEndDate = this.parent.dateValidationModule.getEndDate(this.parent.dateValidationModule.checkStartDate(startDate, childRecords[i].ganttProperties, childRecords[i].ganttProperties.isMilestone), durationDiff, 'minute', childRecords[i].ganttProperties, false);
12555
+ }
12556
+ else {
12557
+ calcEndDate = this.parent.dateValidationModule.getStartDate(this.parent.dateValidationModule.checkEndDate(startDate, childRecords[i].ganttProperties), durationDiff, 'minute', childRecords[i].ganttProperties);
12558
+ }
12559
+ this.calculateDateByRoundOffDuration(childRecords[i], calcEndDate);
12560
+ if (this.parent.isOnEdit && this.validatedChildItems.indexOf(childRecords[i]) === -1) {
12561
+ this.validatedChildItems.push(childRecords[i]);
12562
+ }
12563
+ }
12564
+ else if (isNullOrUndefined(previousData)) {
12565
+ calcEndDate = previousStartDate;
12566
+ this.calculateDateByRoundOffDuration(childRecords[i], calcEndDate);
12567
+ if (this.parent.isOnEdit && this.validatedChildItems.indexOf(childRecords[i]) === -1) {
12568
+ this.validatedChildItems.push(childRecords[i]);
12569
+ }
12570
+ }
12571
+ }
12572
+ }
12573
+ if (childRecords.length) {
12574
+ this.parent.dataOperation.updateParentItems(ganttRecord, true);
12575
+ }
12576
+ }
12577
+ /**
12578
+ * To get updated child records.
12579
+ *
12580
+ * @param {IGanttData} parentRecord .
12581
+ * @param {IGanttData} childLists .
12582
+ * @returns {void} .
12583
+ */
12584
+ getUpdatableChildRecords(parentRecord, childLists) {
12585
+ const childRecords = parentRecord.childRecords;
12586
+ for (let i = 0; i < childRecords.length; i++) {
12587
+ if (childRecords[i].ganttProperties.isAutoSchedule) {
12588
+ childLists.push(childRecords[i]);
12589
+ if (childRecords[i].hasChildRecords) {
12590
+ this.getUpdatableChildRecords(childRecords[i], childLists);
12433
12591
  }
12434
12592
  }
12435
12593
  }
12436
12594
  }
12595
+ /**
12596
+ *
12597
+ * @param {IGanttData} data .
12598
+ * @param {Date} newStartDate .
12599
+ * @returns {void} .
12600
+ */
12601
+ calculateDateByRoundOffDuration(data, newStartDate) {
12602
+ const ganttRecord = data;
12603
+ const taskData = ganttRecord.ganttProperties;
12604
+ const projectStartDate = new Date(newStartDate.getTime());
12605
+ if (!isNullOrUndefined(taskData.endDate) && isNullOrUndefined(taskData.startDate)) {
12606
+ const endDate = this.parent.dateValidationModule.checkStartDate(projectStartDate, taskData, null);
12607
+ this.parent.setRecordValue('endDate', this.parent.dateValidationModule.checkEndDate(endDate, ganttRecord.ganttProperties), taskData, true);
12608
+ }
12609
+ else {
12610
+ this.parent.setRecordValue('startDate', this.parent.dateValidationModule.checkStartDate(projectStartDate, taskData, false), taskData, true);
12611
+ if (!isNullOrUndefined(taskData.duration)) {
12612
+ this.parent.dateValidationModule.calculateEndDate(ganttRecord);
12613
+ }
12614
+ }
12615
+ this.parent.dataOperation.updateWidthLeft(data);
12616
+ this.parent.dataOperation.updateTaskData(ganttRecord);
12617
+ }
12437
12618
  /**
12438
12619
  * Method to get validate able predecessor alone from record
12439
12620
  *
@@ -15961,7 +16142,7 @@ let Gantt = class Gantt extends Component {
15961
16142
  this.treeGridModule.treeGridColumns = [];
15962
16143
  this.treeGridModule.validateGanttColumns();
15963
16144
  this.treeGrid.columns = this.treeGridModule.treeGridColumns;
15964
- this.treeGrid.grid.columns = this.treeGridModule.treeGridColumns;
16145
+ this.treeGrid.refreshColumns();
15965
16146
  this.chartRowsModule.initiateTemplates();
15966
16147
  this.timelineModule.updateChartByNewTimeline();
15967
16148
  break;
@@ -17008,6 +17189,19 @@ let Gantt = class Gantt extends Component {
17008
17189
  const tempSplitterSettings = {};
17009
17190
  tempSplitterSettings[type] = value;
17010
17191
  const splitterPosition = this.splitterModule.calculateSplitterPosition(tempSplitterSettings);
17192
+ switch (type) {
17193
+ case 'view':
17194
+ this.splitterSettings.view = tempSplitterSettings[type];
17195
+ break;
17196
+ case 'columnIndex':
17197
+ this.splitterSettings.columnIndex = tempSplitterSettings[type];
17198
+ break;
17199
+ case 'position':
17200
+ this.splitterSettings.position = tempSplitterSettings[type];
17201
+ break;
17202
+ default:
17203
+ break;
17204
+ }
17011
17205
  const pane1 = this.splitterModule.splitterObject.element.querySelectorAll('.e-pane')[0];
17012
17206
  const pane2 = this.splitterModule.splitterObject.element.querySelectorAll('.e-pane')[1];
17013
17207
  this.splitterModule.splitterPreviousPositionGrid = pane1.scrollWidth + 1 + 'px';
@@ -19844,7 +20038,12 @@ class TaskbarEdit extends DateProcessor {
19844
20038
  event.preventDefault();
19845
20039
  if (!isNullOrUndefined(this.taskbarElement) && !isNullOrUndefined(this.editElement) && (this.taskBarEditAction !== "ConnectorPointRightDrag" && this.taskBarEditAction !== "ConnectorPointLeftDrag") && !(this.parent.viewType === 'ResourceView' && this.currentData.hasChildRecords)) {
19846
20040
  const currentElement = this.editElement.parentElement;
19847
- currentElement.style.setProperty("position", "absolute");
20041
+ if (this.parent.enableTimelineVirtualization && this.parent.timelineModule.wholeTimelineWidth > this.parent.element.offsetWidth * 3) {
20042
+ currentElement.style.setProperty("position", "relative");
20043
+ }
20044
+ else {
20045
+ currentElement.style.setProperty("position", "absolute");
20046
+ }
19848
20047
  if ((this.taskBarEditAction === 'ChildDrag' || this.taskBarEditAction === 'LeftResizing') && !isNullOrUndefined(this.currentIndex) && !isNullOrUndefined(this.currentIndex) ? Number(this.currentIndex) === 0 : false) {
19849
20048
  this.taskbarElement.childNodes[0].childNodes[0].style.setProperty("top", currentElement.parentElement.offsetTop + "px");
19850
20049
  if (this.parent.allowTaskbarDragAndDrop && this.taskBarEditAction !== 'LeftResizing' && this.taskBarEditAction !== 'RightResizing' && this.taskBarEditAction !== 'ProgressResizing') {
@@ -19863,8 +20062,14 @@ class TaskbarEdit extends DateProcessor {
19863
20062
  }
19864
20063
  }
19865
20064
  if (this.taskBarEditAction !== 'ProgressResizing') {
19866
- const rootElement = this.parent.ganttChartModule.chartBodyContainer.querySelectorAll(".e-chart-rows-container");
19867
- rootElement[0].appendChild(this.taskbarResizer);
20065
+ if (this.parent.enableTimelineVirtualization && this.parent.timelineModule.wholeTimelineWidth > this.parent.element.offsetWidth * 3) {
20066
+ var rootElement = this.parent.ganttChartModule.chartBodyContainer.querySelectorAll(".e-chart-scroll-container");
20067
+ rootElement[0].appendChild(this.taskbarResizer);
20068
+ }
20069
+ else {
20070
+ var rootElement = this.parent.ganttChartModule.chartBodyContainer.querySelectorAll(".e-chart-rows-container");
20071
+ rootElement[0].appendChild(this.taskbarResizer);
20072
+ }
19868
20073
  }
19869
20074
  }
19870
20075
  if (this.parent.allowTaskbarDragAndDrop && (this.taskBarEditAction === "ChildDrag" || this.taskBarEditAction === "ParentDrag" ||
@@ -20989,7 +21194,12 @@ class TaskbarEdit extends DateProcessor {
20989
21194
  currentElement.style.position = null;
20990
21195
  }
20991
21196
  else {
20992
- currentElement.style.setProperty("position", "absolute");
21197
+ if (this.parent.enableTimelineVirtualization && this.parent.timelineModule.wholeTimelineWidth > this.parent.element.offsetWidth * 3) {
21198
+ currentElement.style.setProperty("position", "relative");
21199
+ }
21200
+ else {
21201
+ currentElement.style.setProperty("position", "absolute");
21202
+ }
20993
21203
  }
20994
21204
  }
20995
21205
  const item = this.taskBarEditRecord.ganttProperties;
@@ -24394,7 +24604,7 @@ class DialogEdit {
24394
24604
  }
24395
24605
  }
24396
24606
  else {
24397
- if (fieldName === "Duration") {
24607
+ if (fieldName === this.parent.taskFields.duration) {
24398
24608
  let numericValue = parseFloat(String(controlObj.value));
24399
24609
 
24400
24610
  tasksData[fieldName] = numericValue;
@@ -24730,6 +24940,9 @@ class ConnectorLineEdit {
24730
24940
  let match = [];
24731
24941
  for (let j = 0; j < preArray.length; j++) {
24732
24942
  const strArray = [];
24943
+ let firstPart;
24944
+ let isAlpha = false;
24945
+ let predecessorName;
24733
24946
  let isGUId = false;
24734
24947
  var regex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
24735
24948
  let elSplit = preArray[j].split('-');
@@ -24744,6 +24957,26 @@ class ConnectorLineEdit {
24744
24957
  isGUId = true;
24745
24958
  }
24746
24959
  }
24960
+ if (preArray[j].includes('-')) {
24961
+ if (preArray[j].includes('-') && preArray[j].includes('days')) {
24962
+ predecessorName = preArray[j].slice(-9).toString();
24963
+ }
24964
+ if (preArray[j].includes('-') && preArray[j].includes('day')) {
24965
+ predecessorName = preArray[j].slice(-8).toString();
24966
+ }
24967
+ else {
24968
+ predecessorName = preArray[j].slice(-2).toString();
24969
+ }
24970
+ if (preArray[j].includes('-') && /[A-Za-z]/.test(predecessorName)) {
24971
+ var indexFS = preArray[j].indexOf(predecessorName);
24972
+ if (indexFS !== -1) {
24973
+ firstPart = preArray[j].substring(0, indexFS);
24974
+ if (firstPart.includes('-')) {
24975
+ isAlpha = true;
24976
+ }
24977
+ }
24978
+ }
24979
+ }
24747
24980
  if (isGUId) {
24748
24981
  let split;
24749
24982
  split = elSplit[4].split('+');
@@ -24770,10 +25003,15 @@ class ConnectorLineEdit {
24770
25003
  }
24771
25004
  }
24772
25005
  else {
24773
- values = preArray[j].split('+');
24774
- if (preArray[j].indexOf('-') >= 0) {
24775
- values = preArray[j].split('-');
24776
-
25006
+ if (isAlpha && firstPart.includes('-')) {
25007
+ values[0] = firstPart;
25008
+ }
25009
+ else {
25010
+ values = preArray[j].split('+');
25011
+ if (preArray[j].indexOf('-') >= 0) {
25012
+ values = preArray[j].split('-');
25013
+
25014
+ }
24777
25015
  }
24778
25016
  }
24779
25017
  if (!isNullOrUndefined(values[0])) {
@@ -25604,7 +25842,7 @@ class Edit$2 {
25604
25842
  */
25605
25843
  this.deletedTaskDetails = [];
25606
25844
  this.parent = parent;
25607
- this.validatedChildItems = [];
25845
+ this.parent.predecessorModule.validatedChildItems = [];
25608
25846
  if (this.parent.editSettings.allowEditing && this.parent.editSettings.mode === 'Auto') {
25609
25847
  this.cellEditModule = new CellEdit(this.parent);
25610
25848
  }
@@ -26439,8 +26677,8 @@ class Edit$2 {
26439
26677
  }
26440
26678
  if (this.parent.isConnectorLineUpdate && this.parent.autoCalculateDateScheduling) {
26441
26679
  /* validating predecessor for updated child items */
26442
- for (let i = 0; i < this.validatedChildItems.length; i++) {
26443
- const child = this.validatedChildItems[i];
26680
+ for (let i = 0; i < this.parent.predecessorModule.validatedChildItems.length; i++) {
26681
+ const child = this.parent.predecessorModule.validatedChildItems[i];
26444
26682
  if (child.ganttProperties.predecessor && child.ganttProperties.predecessor.length > 0) {
26445
26683
  this.parent.editedTaskBarItem = child;
26446
26684
  this.parent.predecessorModule.validatePredecessor(child, [], '');
@@ -26454,6 +26692,7 @@ class Edit$2 {
26454
26692
  this.parent.editedTaskBarItem = ganttRecord;
26455
26693
  }
26456
26694
  if (!this.isValidatedEditedRecord) {
26695
+ this.isFirstCall = true;
26457
26696
  this.parent.predecessorModule.validatePredecessor(ganttRecord, [], '');
26458
26697
  }
26459
26698
  this.isValidatedEditedRecord = false;
@@ -26461,7 +26700,7 @@ class Edit$2 {
26461
26700
  }
26462
26701
  if (this.parent.allowParentDependency && ganttRecord.hasChildRecords && this.parent.previousRecords[ganttRecord.uniqueID].ganttProperties.startDate &&
26463
26702
  (args.action === "DrawConnectorLine")) {
26464
- this.updateChildItems(ganttRecord);
26703
+ this.parent.predecessorModule['updateChildItems'](ganttRecord);
26465
26704
  }
26466
26705
  this.updateParentItemOnEditing();
26467
26706
  this.parent.dataOperation.updateParentItems(ganttRecord, true);
@@ -26474,6 +26713,7 @@ class Edit$2 {
26474
26713
  let parentData = this.parent.getRecordByID(ganttRecord.parentItem.taskId);
26475
26714
  if (!isNullOrUndefined(parentData)) {
26476
26715
  if (!parentData.ganttProperties.predecessorsName) {
26716
+ this.isFirstCall = true;
26477
26717
  this.parent.predecessorModule.validatePredecessor(parentData, [], '');
26478
26718
  this.updateParentItemOnEditing();
26479
26719
  this.parent.ganttChartModule.reRenderConnectorLines();
@@ -26504,7 +26744,7 @@ class Edit$2 {
26504
26744
  updateParentChildRecord(data) {
26505
26745
  const ganttRecord = data;
26506
26746
  if (ganttRecord.hasChildRecords && this.taskbarMoved && (ganttRecord[this.parent.taskFields.manual] === false || this.parent.taskMode === 'Auto') && (!isNullOrUndefined(this.parent.editModule.cellEditModule) && !this.parent.editModule.cellEditModule.isResourceCellEdited)) {
26507
- this.updateChildItems(ganttRecord);
26747
+ this.parent.predecessorModule['updateChildItems'](ganttRecord);
26508
26748
  }
26509
26749
  if (!isNullOrUndefined(this.parent.editModule.cellEditModule)) {
26510
26750
  this.parent.editModule.cellEditModule.isResourceCellEdited = false;
@@ -26549,29 +26789,6 @@ class Edit$2 {
26549
26789
  this.parent.dataOperation.updateWidthLeft(data);
26550
26790
  }
26551
26791
  }
26552
- /**
26553
- *
26554
- * @param {IGanttData} data .
26555
- * @param {Date} newStartDate .
26556
- * @returns {void} .
26557
- */
26558
- calculateDateByRoundOffDuration(data, newStartDate) {
26559
- const ganttRecord = data;
26560
- const taskData = ganttRecord.ganttProperties;
26561
- const projectStartDate = new Date(newStartDate.getTime());
26562
- if (!isNullOrUndefined(taskData.endDate) && isNullOrUndefined(taskData.startDate)) {
26563
- const endDate = this.parent.dateValidationModule.checkStartDate(projectStartDate, taskData, null);
26564
- this.parent.setRecordValue('endDate', this.parent.dateValidationModule.checkEndDate(endDate, ganttRecord.ganttProperties), taskData, true);
26565
- }
26566
- else {
26567
- this.parent.setRecordValue('startDate', this.parent.dateValidationModule.checkStartDate(projectStartDate, taskData, false), taskData, true);
26568
- if (!isNullOrUndefined(taskData.duration)) {
26569
- this.parent.dateValidationModule.calculateEndDate(ganttRecord);
26570
- }
26571
- }
26572
- this.parent.dataOperation.updateWidthLeft(data);
26573
- this.parent.dataOperation.updateTaskData(ganttRecord);
26574
- }
26575
26792
  /**
26576
26793
  * To update progress value of parent tasks
26577
26794
  *
@@ -26681,106 +26898,6 @@ class Edit$2 {
26681
26898
  updateScheduleDatesOnEditing(args) {
26682
26899
  //..
26683
26900
  }
26684
- /**
26685
- *
26686
- * @param {IGanttData} ganttRecord .
26687
- * @returns {void} .
26688
- */
26689
- updateChildItems(ganttRecord) {
26690
- const previousData = this.parent.previousRecords[ganttRecord.uniqueID];
26691
- let previousStartDate;
26692
- if (isNullOrUndefined(previousData) ||
26693
- (isNullOrUndefined(previousData) && !isNullOrUndefined(previousData.ganttProperties))) {
26694
- previousStartDate = new Date(ganttRecord.ganttProperties.startDate.getTime());
26695
- }
26696
- else {
26697
- if (!isNullOrUndefined(previousData.ganttProperties.startDate)) {
26698
- previousStartDate = new Date(previousData.ganttProperties.startDate.getTime());
26699
- }
26700
- }
26701
- const currentStartDate = ganttRecord.ganttProperties.startDate;
26702
- const childRecords = [];
26703
- let validStartDate;
26704
- let validEndDate;
26705
- let calcEndDate;
26706
- let isRightMove;
26707
- let durationDiff;
26708
- this.getUpdatableChildRecords(ganttRecord, childRecords);
26709
- if (childRecords.length === 0) {
26710
- return;
26711
- }
26712
- if (!isNullOrUndefined(previousStartDate) && !isNullOrUndefined(currentStartDate) && previousStartDate.getTime() > currentStartDate.getTime()) {
26713
- validStartDate = this.parent.dateValidationModule.checkStartDate(currentStartDate);
26714
- validEndDate = this.parent.dateValidationModule.checkEndDate(previousStartDate, ganttRecord.ganttProperties);
26715
- isRightMove = false;
26716
- }
26717
- else {
26718
- validStartDate = this.parent.dateValidationModule.checkStartDate(previousStartDate);
26719
- validEndDate = this.parent.dateValidationModule.checkEndDate(currentStartDate, ganttRecord.ganttProperties);
26720
- isRightMove = true;
26721
- }
26722
- //Get Duration
26723
- if (!isNullOrUndefined(validStartDate) && !isNullOrUndefined(validEndDate) && validStartDate.getTime() >= validEndDate.getTime()) {
26724
- durationDiff = 0;
26725
- }
26726
- else {
26727
- durationDiff = this.parent.dateValidationModule.getDuration(validStartDate, validEndDate, 'minute', true, false);
26728
- }
26729
- for (let i = 0; i < childRecords.length; i++) {
26730
- if (childRecords[i].ganttProperties.isAutoSchedule) {
26731
- if (durationDiff > 0) {
26732
- const startDate = isScheduledTask(childRecords[i].ganttProperties) ?
26733
- childRecords[i].ganttProperties.startDate : childRecords[i].ganttProperties.startDate ?
26734
- childRecords[i].ganttProperties.startDate : childRecords[i].ganttProperties.endDate ?
26735
- childRecords[i].ganttProperties.endDate : new Date(previousStartDate.toString());
26736
- if (isRightMove) {
26737
- calcEndDate = this.parent.dateValidationModule.getEndDate(this.parent.dateValidationModule.checkStartDate(startDate, childRecords[i].ganttProperties, childRecords[i].ganttProperties.isMilestone), durationDiff, 'minute', childRecords[i].ganttProperties, false);
26738
- }
26739
- else {
26740
- calcEndDate = this.parent.dateValidationModule.getStartDate(this.parent.dateValidationModule.checkEndDate(startDate, childRecords[i].ganttProperties), durationDiff, 'minute', childRecords[i].ganttProperties);
26741
- }
26742
- this.calculateDateByRoundOffDuration(childRecords[i], calcEndDate);
26743
- if (this.parent.isOnEdit && this.validatedChildItems.indexOf(childRecords[i]) === -1) {
26744
- this.validatedChildItems.push(childRecords[i]);
26745
- }
26746
- }
26747
- else if (isNullOrUndefined(previousData)) {
26748
- calcEndDate = previousStartDate;
26749
- const initialData = this.parent.initialLoadData[childRecords[i].index];
26750
- if (this.parent.isLoad) {
26751
- this.calculateDateByRoundOffDuration(initialData, calcEndDate);
26752
- }
26753
- else {
26754
- this.calculateDateByRoundOffDuration(childRecords[i], calcEndDate);
26755
- }
26756
- if (this.parent.isOnEdit && this.validatedChildItems.indexOf(childRecords[i]) === -1) {
26757
- this.validatedChildItems.push(childRecords[i]);
26758
- }
26759
- }
26760
- }
26761
- }
26762
- if (childRecords.length) {
26763
- this.parent.dataOperation.updateParentItems(ganttRecord, true);
26764
- }
26765
- }
26766
- /**
26767
- * To get updated child records.
26768
- *
26769
- * @param {IGanttData} parentRecord .
26770
- * @param {IGanttData} childLists .
26771
- * @returns {void} .
26772
- */
26773
- getUpdatableChildRecords(parentRecord, childLists) {
26774
- const childRecords = parentRecord.childRecords;
26775
- for (let i = 0; i < childRecords.length; i++) {
26776
- if (childRecords[i].ganttProperties.isAutoSchedule) {
26777
- childLists.push(childRecords[i]);
26778
- if (childRecords[i].hasChildRecords) {
26779
- this.getUpdatableChildRecords(childRecords[i], childLists);
26780
- }
26781
- }
26782
- }
26783
- }
26784
26901
  /**
26785
26902
  * @param {ITaskbarEditedEventArgs} args .
26786
26903
  * @returns {void} .
@@ -27292,7 +27409,7 @@ class Edit$2 {
27292
27409
  this.resetValidateArgs();
27293
27410
  this.parent.editedTaskBarItem = null;
27294
27411
  this.parent.isOnEdit = false;
27295
- this.validatedChildItems = [];
27412
+ this.parent.predecessorModule.validatedChildItems = [];
27296
27413
  this.parent.isConnectorLineUpdate = false;
27297
27414
  this.parent.editedTaskBarItem = null;
27298
27415
  this.taskbarMoved = false;
@@ -29181,6 +29298,7 @@ class Edit$2 {
29181
29298
  for (let k = 0; k < this.updateParentRecords.length; k++) {
29182
29299
  this.parent.dataOperation.updateParentItems(this.updateParentRecords[k]);
29183
29300
  }
29301
+ this.isFirstCall = true;
29184
29302
  this.parent.editedRecords.forEach(record => {
29185
29303
  this.parent.predecessorModule.validatePredecessor(record, [], '');
29186
29304
  });
@@ -30223,7 +30341,14 @@ class Selection$1 {
30223
30341
  if (this.parent.enableTimelineVirtualization) {
30224
30342
  this.parent['isRowSelected'] = true;
30225
30343
  }
30226
- this.parent.ganttChartModule.updateScrollLeft(getValue('data.ganttProperties.left', args));
30344
+ if (args.data && !isNullOrUndefined(args.data['length'])) {
30345
+ for (let i = 0; i < args.data['length']; i++) {
30346
+ this.parent.ganttChartModule.updateScrollLeft(args.data[i].ganttProperties.left);
30347
+ }
30348
+ }
30349
+ else {
30350
+ this.parent.ganttChartModule.updateScrollLeft(getValue('data.ganttProperties.left', args));
30351
+ }
30227
30352
  }
30228
30353
  args.target = this.actualTarget;
30229
30354
  if (!isNullOrUndefined(args.foreignKeyData) && Object.keys(args.foreignKeyData).length === 0) {