@syncfusion/ej2-gantt 19.4.38 → 19.4.43

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.
@@ -482,7 +482,14 @@ class DateProcessor {
482
482
  tDuration = this.parent.editModule.taskbarEditModule.sumOfDuration(ganttProperties.segments);
483
483
  }
484
484
  else {
485
- tDuration = this.getDuration(ganttProperties.startDate, ganttProperties.endDate, ganttProperties.durationUnit, ganttProperties.isAutoSchedule, ganttProperties.isMilestone);
485
+ // eslint-disable-next-line
486
+ if (!isNullOrUndefined(ganttProperties.startDate) && !isNullOrUndefined(ganttProperties.endDate) &&
487
+ (ganttProperties.startDate).getTime() === (ganttProperties.endDate).getTime() && !isNullOrUndefined(ganttData.taskData[this.parent.taskFields.milestone])) {
488
+ tDuration = 1;
489
+ }
490
+ else {
491
+ tDuration = this.getDuration(ganttProperties.startDate, ganttProperties.endDate, ganttProperties.durationUnit, ganttProperties.isAutoSchedule, ganttProperties.isMilestone);
492
+ }
486
493
  }
487
494
  this.parent.setRecordValue('duration', tDuration, ganttProperties, true);
488
495
  const col = this.parent.columnByField[this.parent.columnMapping.duration];
@@ -2589,7 +2596,12 @@ class TaskProcessor extends DateProcessor {
2589
2596
  eDate.setHours(0, 0, 0, 0);
2590
2597
  }
2591
2598
  }
2592
- return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth);
2599
+ if ((sDate).getTime() === (eDate).getTime()) {
2600
+ return (this.parent.perDayWidth);
2601
+ }
2602
+ else {
2603
+ return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth);
2604
+ }
2593
2605
  }
2594
2606
  /**
2595
2607
  * Get task left value
@@ -2678,14 +2690,16 @@ class TaskProcessor extends DateProcessor {
2678
2690
  // eslint-disable-next-line
2679
2691
  const resourcesId = [];
2680
2692
  let resourcesName = [];
2681
- for (let i = 0; i < resourceData.length; i++) {
2682
- resourcesId.push(resourceData[i][resourceSettings.id]);
2683
- let resName = resourceData[i][resourceSettings.name];
2684
- const resourceUnit = resourceData[i][resourceSettings.unit];
2685
- if (resourceUnit !== 100) {
2686
- resName += '[' + resourceUnit + '%' + ']';
2693
+ if (!isNullOrUndefined(resourceData)) {
2694
+ for (let i = 0; i < resourceData.length; i++) {
2695
+ resourcesId.push(resourceData[i][resourceSettings.id]);
2696
+ let resName = resourceData[i][resourceSettings.name];
2697
+ const resourceUnit = resourceData[i][resourceSettings.unit];
2698
+ if (resourceUnit !== 100) {
2699
+ resName += '[' + resourceUnit + '%' + ']';
2700
+ }
2701
+ resourcesName.push(resName);
2687
2702
  }
2688
- resourcesName.push(resName);
2689
2703
  }
2690
2704
  this.parent.setRecordValue('resourceNames', resourcesName.join(','), ganttProp, true);
2691
2705
  this.updateTaskDataResource(ganttData);
@@ -4827,8 +4841,6 @@ class GanttChart {
4827
4841
  this.parent.treeGrid.collapseAll();
4828
4842
  }
4829
4843
  this.isExpandAll = false;
4830
- const focussedElement = this.parent.element.querySelector('.e-treegrid');
4831
- focussedElement.focus();
4832
4844
  }
4833
4845
  /**
4834
4846
  * Public method to expand particular level of rows.
@@ -6041,9 +6053,6 @@ class Timeline {
6041
6053
  parentTr = this.getHeaterTemplateString(new Date(startDate.toString()), mode, tier, false, count, timelineCell);
6042
6054
  scheduleDateCollection.push(new Date(startDate.toString()));
6043
6055
  increment = this.getIncrement(startDate, count, mode);
6044
- if (this.parent.isInDst(startDate)) {
6045
- increment = increment + (1000 * 60 * 60);
6046
- }
6047
6056
  newTime = startDate.getTime() + increment;
6048
6057
  startDate.setTime(newTime);
6049
6058
  if (startDate >= endDate) {
@@ -6107,24 +6116,17 @@ class Timeline {
6107
6116
  dayIntervel - 1 : dayIntervel : dayIntervel;
6108
6117
  lastDay.setDate(lastDay.getDate() + (dayIntervel + (7 * count)));
6109
6118
  increment = lastDay.getTime() - firstDay.getTime();
6110
- if ((this.parent.isInDst(lastDay) && !this.parent.isInDst(firstDay)) ||
6111
- (!this.parent.isInDst(lastDay) && this.parent.isInDst(firstDay))) {
6112
- increment = increment - (1000 * 60 * 60);
6113
- }
6114
6119
  break;
6115
6120
  }
6116
6121
  case 'Day':
6117
6122
  lastDay.setHours(24, 0, 0, 0);
6118
6123
  increment = (lastDay.getTime() - firstDay.getTime()) + (1000 * 60 * 60 * 24 * (count - 1));
6119
- if ((this.parent.isInDst(lastDay) && !this.parent.isInDst(firstDay)) ||
6120
- (!this.parent.isInDst(lastDay) && this.parent.isInDst(firstDay))) {
6121
- increment -= (1000 * 60 * 60);
6122
- }
6123
6124
  break;
6124
6125
  case 'Hour':
6125
6126
  lastDay.setMinutes(60);
6126
6127
  lastDay.setSeconds(0);
6127
6128
  increment = (lastDay.getTime() - firstDay.getTime()) + (1000 * 60 * 60 * (count - 1));
6129
+ increment = this.checkDate(firstDay, lastDay, increment, count);
6128
6130
  break;
6129
6131
  case 'Minutes':
6130
6132
  lastDay.setSeconds(60);
@@ -6133,6 +6135,21 @@ class Timeline {
6133
6135
  }
6134
6136
  return increment;
6135
6137
  }
6138
+ checkDate(firstDay, lastDay, increment, count) {
6139
+ var date = new Date(firstDay.getTime());
6140
+ date.setTime(date.getTime() + increment);
6141
+ if (((date.getTime() - lastDay.getTime()) / (1000 * 60 * 60)) != count && (firstDay.getTimezoneOffset() !== date.getTimezoneOffset())) {
6142
+ var diffCount = count - (date.getTime() - lastDay.getTime()) / (1000 * 60 * 60);
6143
+ if (!this.parent.isInDst(date)) {
6144
+ increment += (1000 * 60 * 60 * diffCount);
6145
+ }
6146
+ else if (this.parent.isInDst(date)) {
6147
+ increment -= (1000 * 60 * 60 * diffCount);
6148
+ }
6149
+ }
6150
+ return increment;
6151
+ }
6152
+ ;
6136
6153
  /**
6137
6154
  * Method to find header cell was weekend or not
6138
6155
  *
@@ -6215,10 +6232,6 @@ class Timeline {
6215
6232
  */
6216
6233
  calculateWidthBetweenTwoDate(mode, scheduleWeeks, endDate) {
6217
6234
  let timeDifference = (endDate.getTime() - scheduleWeeks.getTime());
6218
- if ((this.parent.isInDst(scheduleWeeks) && !this.parent.isInDst(endDate)) ||
6219
- (!this.parent.isInDst(scheduleWeeks) && this.parent.isInDst(endDate))) {
6220
- timeDifference = timeDifference - (1000 * 60 * 60);
6221
- }
6222
6235
  const balanceDay = (timeDifference / (1000 * 60 * 60 * 24));
6223
6236
  return balanceDay * this.parent.perDayWidth;
6224
6237
  }
@@ -6905,6 +6918,9 @@ class GanttTreeGrid {
6905
6918
  if (getValue('requestType', args) === 'refresh' && isNullOrUndefined(getValue('type', args)) && this.parent.addDeleteRecord) {
6906
6919
  if (this.parent.selectedRowIndex != -1) {
6907
6920
  this.parent.selectRow(this.parent.selectedRowIndex);
6921
+ if (this.parent.selectedRowIndex > this.parent.currentViewData.length - 1) {
6922
+ this.parent.selectedRowIndex = -1;
6923
+ }
6908
6924
  }
6909
6925
  else {
6910
6926
  this.parent.selectRow(0);
@@ -8957,6 +8973,7 @@ class ChartRows extends DateProcessor {
8957
8973
  }
8958
8974
  }
8959
8975
  }
8976
+ this.parent.renderTemplates();
8960
8977
  this.triggerQueryTaskbarInfo();
8961
8978
  this.parent.modifiedRecords = [];
8962
8979
  if (collapsedResourceRecord.length) {
@@ -9320,6 +9337,7 @@ class ChartRows extends DateProcessor {
9320
9337
  else {
9321
9338
  tr.replaceChild(this.getGanttChartRow(index, data).childNodes[0], tr.childNodes[0]);
9322
9339
  }
9340
+ this.parent.renderTemplates();
9323
9341
  if (this.parent.viewType === 'ResourceView' && data.hasChildRecords && this.parent.showOverAllocation) {
9324
9342
  if (isValidateRange) {
9325
9343
  this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData);
@@ -11719,6 +11737,10 @@ class FocusModule {
11719
11737
  onKeyPress(e) {
11720
11738
  const ganttObj = this.parent;
11721
11739
  const expandedRecords = ganttObj.getExpandedRecords(ganttObj.currentViewData);
11740
+ if (isNullOrUndefined(this.parent.focusModule.getActiveElement()) && (e.action === 'expandAll' || e.action === 'collapseAll')) {
11741
+ const focussedElement = this.parent.element.querySelector('.e-treegrid');
11742
+ focussedElement.focus();
11743
+ }
11722
11744
  const targetElement = this.parent.focusModule.getActiveElement();
11723
11745
  if (e.action === 'home' || e.action === 'end' || e.action === 'downArrow' || e.action === 'upArrow' || e.action === 'delete' ||
11724
11746
  e.action === 'rightArrow' || e.action === 'leftArrow' || e.action === 'focusTask' || e.action === 'focusSearch' ||
@@ -11831,9 +11853,9 @@ class FocusModule {
11831
11853
  {
11832
11854
  if (isNullOrUndefined(document.getElementById(this.parent.element.id + '_dialog'))) {
11833
11855
  e.preventDefault();
11834
- const focussedElement = ganttObj.element.querySelector('.e-gantt-chart');
11835
- focussedElement.focus();
11836
11856
  ganttObj.addRecord();
11857
+ const focussedElement = ganttObj.element;
11858
+ focussedElement.focus();
11837
11859
  }
11838
11860
  break;
11839
11861
  }
@@ -12237,7 +12259,7 @@ let Gantt = class Gantt extends Component {
12237
12259
  calculateDimensions() {
12238
12260
  let settingsHeight;
12239
12261
  if (typeof (this.height) !== 'number' && this.height.indexOf('%') !== -1 && (this.element.parentElement &&
12240
- !this.element.parentElement.style.height)) {
12262
+ !this.element.parentElement.style.height || this.element.parentElement.style.height.indexOf('%') !== -1)) {
12241
12263
  let ganttHeight = Number(this.height.split("%")[0]);
12242
12264
  ganttHeight = (ganttHeight * window.innerHeight) / 100;
12243
12265
  if (this.height === '100%') {
@@ -12393,7 +12415,8 @@ let Gantt = class Gantt extends Component {
12393
12415
  let settingsHeight;
12394
12416
  if (this.height.indexOf('%') !== -1) {
12395
12417
  let ganttHeight = Number(this.height.split("%")[0]);
12396
- if (this.element.parentElement && this.element.parentElement.style.height) {
12418
+ if (this.element.parentElement && (this.element.parentElement.style.height
12419
+ || this.element.parentElement.style.height.indexOf('%') !== -1)) {
12397
12420
  let containerHeight = Number(this.element.parentElement.style.height.split("px")[0]);
12398
12421
  ganttHeight = (ganttHeight * containerHeight) / 100;
12399
12422
  }
@@ -12909,10 +12932,8 @@ let Gantt = class Gantt extends Component {
12909
12932
  this.treeGrid.grid.searchSettings = getActualProperties(this.searchSettings);
12910
12933
  this.treeGrid.grid.dataBind();
12911
12934
  }
12912
- else {
12913
- this.treeGrid.searchSettings = getActualProperties(this.searchSettings);
12914
- this.treeGrid.dataBind();
12915
- }
12935
+ this.treeGrid.searchSettings = getActualProperties(this.searchSettings);
12936
+ this.treeGrid.dataBind();
12916
12937
  if (this.toolbarModule) {
12917
12938
  this.toolbarModule.updateSearchTextBox();
12918
12939
  }
@@ -17369,6 +17390,7 @@ class TaskbarEdit extends DateProcessor {
17369
17390
  this.isMouseDragged = false;
17370
17391
  }
17371
17392
  else {
17393
+ this.parent.isOnEdit = false;
17372
17394
  this.cancelTaskbarEditActionInMouseLeave();
17373
17395
  }
17374
17396
  }
@@ -18025,7 +18047,7 @@ class DialogEdit {
18025
18047
  tempData.ganttProperties.durationUnit = this.parent.durationUnit.toLocaleLowerCase();
18026
18048
  }
18027
18049
  else if (columns[i].field === taskSettings.name) {
18028
- tempData[field] = 'New Task ' + id;
18050
+ tempData[field] = this.localeObj.getConstant('addDialogTitle') + ' ' + id;
18029
18051
  tempData.ganttProperties.taskName = tempData[field];
18030
18052
  }
18031
18053
  else if (columns[i].field === taskSettings.progress) {
@@ -18935,7 +18957,7 @@ class DialogEdit {
18935
18957
  inputValue = dialog.querySelector('#' + ganttId + 'SegmentsTabContainer' + columnName)
18936
18958
  .ej2_instances[0];
18937
18959
  }
18938
- if (inputValue.value !== tempValue.toString()) {
18960
+ if (inputValue.value.toString() !== tempValue.toString()) {
18939
18961
  inputValue.value = tempValue;
18940
18962
  inputValue.dataBind();
18941
18963
  }
@@ -21521,7 +21543,7 @@ class Edit$2 {
21521
21543
  this.updateParentItemOnEditing();
21522
21544
  }
21523
21545
  /** Update parent up-to zeroth level */
21524
- if (ganttRecord.parentItem || this.parent.taskMode !== 'Auto') {
21546
+ if (ganttRecord.parentItem) {
21525
21547
  this.parent.dataOperation.updateParentItems(ganttRecord, true);
21526
21548
  }
21527
21549
  this.initiateSaveAction(args);