@syncfusion/ej2-gantt 19.4.40 → 19.4.47

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +1 -1
  3. package/dist/ej2-gantt.umd.min.js +2 -2
  4. package/dist/ej2-gantt.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-gantt.es2015.js +86 -40
  6. package/dist/es6/ej2-gantt.es2015.js.map +1 -1
  7. package/dist/es6/ej2-gantt.es5.js +86 -40
  8. package/dist/es6/ej2-gantt.es5.js.map +1 -1
  9. package/dist/global/ej2-gantt.min.js +2 -2
  10. package/dist/global/ej2-gantt.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +17 -17
  13. package/src/gantt/actions/chart-scroll.js +1 -0
  14. package/src/gantt/actions/dialog-edit.js +1 -1
  15. package/src/gantt/actions/edit.d.ts +1 -1
  16. package/src/gantt/actions/edit.js +5 -1
  17. package/src/gantt/actions/filter.js +1 -1
  18. package/src/gantt/actions/keyboard.js +4 -0
  19. package/src/gantt/actions/rowdragdrop.js +1 -1
  20. package/src/gantt/actions/taskbar-edit.js +4 -1
  21. package/src/gantt/base/date-processor.js +8 -1
  22. package/src/gantt/base/gantt-chart.js +6 -2
  23. package/src/gantt/base/gantt.js +20 -9
  24. package/src/gantt/base/task-processor.js +15 -8
  25. package/src/gantt/renderer/chart-rows.js +2 -0
  26. package/src/gantt/renderer/edit-tooltip.js +1 -0
  27. package/src/gantt/renderer/timeline.d.ts +1 -0
  28. package/src/gantt/renderer/timeline.js +16 -15
  29. package/src/gantt/renderer/tooltip.js +1 -0
  30. package/styles/bootstrap-dark.css +9 -1
  31. package/styles/bootstrap.css +9 -1
  32. package/styles/bootstrap4.css +9 -1
  33. package/styles/bootstrap5-dark.css +9 -2
  34. package/styles/bootstrap5.css +9 -2
  35. package/styles/fabric-dark.css +9 -1
  36. package/styles/fabric.css +9 -1
  37. package/styles/gantt/_bootstrap-dark-definition.scss +0 -1
  38. package/styles/gantt/_bootstrap-definition.scss +0 -1
  39. package/styles/gantt/_bootstrap4-definition.scss +0 -1
  40. package/styles/gantt/_bootstrap5-definition.scss +0 -1
  41. package/styles/gantt/_fabric-dark-definition.scss +0 -1
  42. package/styles/gantt/_fabric-definition.scss +0 -1
  43. package/styles/gantt/_fluent-definition.scss +0 -1
  44. package/styles/gantt/_highcontrast-definition.scss +0 -1
  45. package/styles/gantt/_highcontrast-light-definition.scss +0 -1
  46. package/styles/gantt/_layout.scss +8 -1
  47. package/styles/gantt/_material-dark-definition.scss +0 -1
  48. package/styles/gantt/_material-definition.scss +0 -1
  49. package/styles/gantt/_tailwind-definition.scss +0 -1
  50. package/styles/gantt/bootstrap-dark.css +9 -1
  51. package/styles/gantt/bootstrap.css +9 -1
  52. package/styles/gantt/bootstrap4.css +9 -1
  53. package/styles/gantt/bootstrap5-dark.css +9 -2
  54. package/styles/gantt/bootstrap5.css +9 -2
  55. package/styles/gantt/fabric-dark.css +9 -1
  56. package/styles/gantt/fabric.css +9 -1
  57. package/styles/gantt/highcontrast-light.css +9 -1
  58. package/styles/gantt/highcontrast.css +9 -1
  59. package/styles/gantt/material-dark.css +9 -1
  60. package/styles/gantt/material.css +9 -1
  61. package/styles/gantt/tailwind-dark.css +9 -1
  62. package/styles/gantt/tailwind.css +9 -1
  63. package/styles/highcontrast-light.css +9 -1
  64. package/styles/highcontrast.css +9 -1
  65. package/styles/material-dark.css +9 -1
  66. package/styles/material.css +9 -1
  67. package/styles/tailwind-dark.css +9 -1
  68. package/styles/tailwind.css +9 -1
@@ -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);
@@ -3989,6 +4003,7 @@ class ChartScroll {
3989
4003
  */
3990
4004
  setScrollTop(scrollTop) {
3991
4005
  this.element.scrollTop = scrollTop;
4006
+ this.parent.treeGrid.element.querySelector('.e-content').scrollTop = scrollTop;
3992
4007
  }
3993
4008
  /**
3994
4009
  * To set scroll left for chart scroll container
@@ -4381,6 +4396,12 @@ class GanttChart {
4381
4396
  * @private
4382
4397
  */
4383
4398
  mouseUp(e) {
4399
+ if (this.parent.allowRowDragAndDrop) {
4400
+ const ganttDragElemet = this.parent.element.querySelector('.e-ganttdrag');
4401
+ if (ganttDragElemet) {
4402
+ ganttDragElemet.remove();
4403
+ }
4404
+ }
4384
4405
  if (!this.isGanttElement) {
4385
4406
  this.parent.notify('chartMouseUp', e);
4386
4407
  }
@@ -4827,8 +4848,6 @@ class GanttChart {
4827
4848
  this.parent.treeGrid.collapseAll();
4828
4849
  }
4829
4850
  this.isExpandAll = false;
4830
- const focussedElement = this.parent.element.querySelector('.e-treegrid');
4831
- focussedElement.focus();
4832
4851
  }
4833
4852
  /**
4834
4853
  * Public method to expand particular level of rows.
@@ -6041,9 +6060,6 @@ class Timeline {
6041
6060
  parentTr = this.getHeaterTemplateString(new Date(startDate.toString()), mode, tier, false, count, timelineCell);
6042
6061
  scheduleDateCollection.push(new Date(startDate.toString()));
6043
6062
  increment = this.getIncrement(startDate, count, mode);
6044
- if (this.parent.isInDst(startDate)) {
6045
- increment = increment + (1000 * 60 * 60);
6046
- }
6047
6063
  newTime = startDate.getTime() + increment;
6048
6064
  startDate.setTime(newTime);
6049
6065
  if (startDate >= endDate) {
@@ -6107,24 +6123,17 @@ class Timeline {
6107
6123
  dayIntervel - 1 : dayIntervel : dayIntervel;
6108
6124
  lastDay.setDate(lastDay.getDate() + (dayIntervel + (7 * count)));
6109
6125
  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
6126
  break;
6115
6127
  }
6116
6128
  case 'Day':
6117
6129
  lastDay.setHours(24, 0, 0, 0);
6118
6130
  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
6131
  break;
6124
6132
  case 'Hour':
6125
6133
  lastDay.setMinutes(60);
6126
6134
  lastDay.setSeconds(0);
6127
6135
  increment = (lastDay.getTime() - firstDay.getTime()) + (1000 * 60 * 60 * (count - 1));
6136
+ increment = this.checkDate(firstDay, lastDay, increment, count);
6128
6137
  break;
6129
6138
  case 'Minutes':
6130
6139
  lastDay.setSeconds(60);
@@ -6133,6 +6142,21 @@ class Timeline {
6133
6142
  }
6134
6143
  return increment;
6135
6144
  }
6145
+ checkDate(firstDay, lastDay, increment, count) {
6146
+ var date = new Date(firstDay.getTime());
6147
+ date.setTime(date.getTime() + increment);
6148
+ if (((date.getTime() - lastDay.getTime()) / (1000 * 60 * 60)) != count && (firstDay.getTimezoneOffset() !== date.getTimezoneOffset())) {
6149
+ var diffCount = count - (date.getTime() - lastDay.getTime()) / (1000 * 60 * 60);
6150
+ if (!this.parent.isInDst(date)) {
6151
+ increment += (1000 * 60 * 60 * diffCount);
6152
+ }
6153
+ else if (this.parent.isInDst(date)) {
6154
+ increment -= (1000 * 60 * 60 * diffCount);
6155
+ }
6156
+ }
6157
+ return increment;
6158
+ }
6159
+ ;
6136
6160
  /**
6137
6161
  * Method to find header cell was weekend or not
6138
6162
  *
@@ -6215,10 +6239,6 @@ class Timeline {
6215
6239
  */
6216
6240
  calculateWidthBetweenTwoDate(mode, scheduleWeeks, endDate) {
6217
6241
  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
6242
  const balanceDay = (timeDifference / (1000 * 60 * 60 * 24));
6223
6243
  return balanceDay * this.parent.perDayWidth;
6224
6244
  }
@@ -8960,6 +8980,7 @@ class ChartRows extends DateProcessor {
8960
8980
  }
8961
8981
  }
8962
8982
  }
8983
+ this.parent.renderTemplates();
8963
8984
  this.triggerQueryTaskbarInfo();
8964
8985
  this.parent.modifiedRecords = [];
8965
8986
  if (collapsedResourceRecord.length) {
@@ -9323,6 +9344,7 @@ class ChartRows extends DateProcessor {
9323
9344
  else {
9324
9345
  tr.replaceChild(this.getGanttChartRow(index, data).childNodes[0], tr.childNodes[0]);
9325
9346
  }
9347
+ this.parent.renderTemplates();
9326
9348
  if (this.parent.viewType === 'ResourceView' && data.hasChildRecords && this.parent.showOverAllocation) {
9327
9349
  if (isValidateRange) {
9328
9350
  this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData);
@@ -11474,6 +11496,7 @@ class Tooltip$1 {
11474
11496
  tooltipPositionY = tooltipPositionY + 10;
11475
11497
  }
11476
11498
  args.element.style.top = tooltipPositionY + 'px';
11499
+ args.element.style.visibility = 'visible';
11477
11500
  }
11478
11501
  /**
11479
11502
  * Method to get mouse pointor position
@@ -11722,6 +11745,10 @@ class FocusModule {
11722
11745
  onKeyPress(e) {
11723
11746
  const ganttObj = this.parent;
11724
11747
  const expandedRecords = ganttObj.getExpandedRecords(ganttObj.currentViewData);
11748
+ if (isNullOrUndefined(this.parent.focusModule.getActiveElement()) && (e.action === 'expandAll' || e.action === 'collapseAll')) {
11749
+ const focussedElement = this.parent.element.querySelector('.e-treegrid');
11750
+ focussedElement.focus();
11751
+ }
11725
11752
  const targetElement = this.parent.focusModule.getActiveElement();
11726
11753
  if (e.action === 'home' || e.action === 'end' || e.action === 'downArrow' || e.action === 'upArrow' || e.action === 'delete' ||
11727
11754
  e.action === 'rightArrow' || e.action === 'leftArrow' || e.action === 'focusTask' || e.action === 'focusSearch' ||
@@ -12240,8 +12267,14 @@ let Gantt = class Gantt extends Component {
12240
12267
  calculateDimensions() {
12241
12268
  let settingsHeight;
12242
12269
  if (typeof (this.height) !== 'number' && this.height.indexOf('%') !== -1 && (this.element.parentElement &&
12243
- !this.element.parentElement.style.height)) {
12244
- let ganttHeight = Number(this.height.split("%")[0]);
12270
+ !this.element.parentElement.style.height || this.element.parentElement.style.height.indexOf('%') !== -1)) {
12271
+ let ganttHeight;
12272
+ if (this.element.parentElement.style.height.indexOf('%') == -1) {
12273
+ ganttHeight = Number(this.height.split("%")[0]);
12274
+ }
12275
+ else {
12276
+ ganttHeight = Number(this.element.parentElement.style.height.split("%")[0]);
12277
+ }
12245
12278
  ganttHeight = (ganttHeight * window.innerHeight) / 100;
12246
12279
  if (this.height === '100%') {
12247
12280
  ganttHeight = ganttHeight - 16;
@@ -12396,9 +12429,16 @@ let Gantt = class Gantt extends Component {
12396
12429
  let settingsHeight;
12397
12430
  if (this.height.indexOf('%') !== -1) {
12398
12431
  let ganttHeight = Number(this.height.split("%")[0]);
12399
- if (this.element.parentElement && this.element.parentElement.style.height) {
12400
- let containerHeight = Number(this.element.parentElement.style.height.split("px")[0]);
12401
- ganttHeight = (ganttHeight * containerHeight) / 100;
12432
+ if (this.element.parentElement && (this.element.parentElement.style.height)) {
12433
+ let containerHeight;
12434
+ if (this.element.parentElement.style.height.indexOf('%') == -1) {
12435
+ containerHeight = Number(this.element.parentElement.style.height.split("px")[0]);
12436
+ ganttHeight = (ganttHeight * containerHeight) / 100;
12437
+ }
12438
+ else {
12439
+ containerHeight = Number(this.element.parentElement.style.height.split("%")[0]);
12440
+ ganttHeight = (window.innerHeight * containerHeight) / 100;
12441
+ }
12402
12442
  }
12403
12443
  else {
12404
12444
  ganttHeight = Number(this.height.split("%")[0]);
@@ -12912,10 +12952,8 @@ let Gantt = class Gantt extends Component {
12912
12952
  this.treeGrid.grid.searchSettings = getActualProperties(this.searchSettings);
12913
12953
  this.treeGrid.grid.dataBind();
12914
12954
  }
12915
- else {
12916
- this.treeGrid.searchSettings = getActualProperties(this.searchSettings);
12917
- this.treeGrid.dataBind();
12918
- }
12955
+ this.treeGrid.searchSettings = getActualProperties(this.searchSettings);
12956
+ this.treeGrid.dataBind();
12919
12957
  if (this.toolbarModule) {
12920
12958
  this.toolbarModule.updateSearchTextBox();
12921
12959
  }
@@ -15766,6 +15804,7 @@ class EditTooltip {
15766
15804
  tooltipPositionX += leftEnd - (tooltipPositionX + args.element.offsetWidth);
15767
15805
  }
15768
15806
  args.element.style.left = tooltipPositionX + 'px';
15807
+ args.element.style.visibility = 'visible';
15769
15808
  }
15770
15809
  /**
15771
15810
  * To show/hide taskbar edit tooltip.
@@ -16385,7 +16424,9 @@ class TaskbarEdit extends DateProcessor {
16385
16424
  if (this.isMouseDragged && this.taskBarEditAction) {
16386
16425
  const args = {
16387
16426
  cancel: false,
16388
- requestType: 'taskbarediting'
16427
+ requestType: 'taskbarediting',
16428
+ taskBarEditAction: this.taskBarEditAction,
16429
+ data: this.taskBarEditRecord
16389
16430
  };
16390
16431
  if (this.segmentIndex !== -1) {
16391
16432
  args.requestType = 'mergeSegment';
@@ -17372,6 +17413,7 @@ class TaskbarEdit extends DateProcessor {
17372
17413
  this.isMouseDragged = false;
17373
17414
  }
17374
17415
  else {
17416
+ this.parent.isOnEdit = false;
17375
17417
  this.cancelTaskbarEditActionInMouseLeave();
17376
17418
  }
17377
17419
  }
@@ -18028,7 +18070,7 @@ class DialogEdit {
18028
18070
  tempData.ganttProperties.durationUnit = this.parent.durationUnit.toLocaleLowerCase();
18029
18071
  }
18030
18072
  else if (columns[i].field === taskSettings.name) {
18031
- tempData[field] = 'New Task ' + id;
18073
+ tempData[field] = this.localeObj.getConstant('addDialogTitle') + ' ' + id;
18032
18074
  tempData.ganttProperties.taskName = tempData[field];
18033
18075
  }
18034
18076
  else if (columns[i].field === taskSettings.progress) {
@@ -21546,7 +21588,7 @@ class Edit$2 {
21546
21588
  */
21547
21589
  updateParentChildRecord(data) {
21548
21590
  const ganttRecord = data;
21549
- if (ganttRecord.hasChildRecords && this.taskbarMoved && this.parent.taskMode === 'Auto') {
21591
+ if (ganttRecord.hasChildRecords && this.taskbarMoved && this.parent.taskMode === 'Auto' && this.parent.previousRecords[data.uniqueID].resources === ganttRecord.ganttProperties['resourceNames']) {
21550
21592
  this.updateChildItems(ganttRecord);
21551
21593
  }
21552
21594
  }
@@ -23465,6 +23507,10 @@ class Edit$2 {
23465
23507
  }
23466
23508
  this.parent.timelineModule.updateTimeLineOnEditing([tempArray], args.action);
23467
23509
  }
23510
+ let flag = getValue('doubleClickTarget', this.parent.treeGrid.editModule);
23511
+ if (flag !== null) {
23512
+ setValue('doubleClickTarget', null, this.parent.treeGrid.editModule);
23513
+ }
23468
23514
  this.addSuccess(args);
23469
23515
  args = this.constructTaskAddedEventArgs(cAddedRecord, args.modifiedRecords, 'add');
23470
23516
  this.parent.trigger('actionComplete', args);
@@ -24361,7 +24407,7 @@ class Filter$1 {
24361
24407
  const ganttElement = closest(element, '#' + this.parent.element.id)
24362
24408
  || element.querySelector('#' + this.parent.element.id);
24363
24409
  if ((!(this.filterMenuElement.contains(element)) && !isNullOrUndefined(ganttElement)) || element.nodeName === 'HTML'
24364
- || element.nodeName === 'DIV') {
24410
+ || ((element.nodeName === 'DIV') && (!element.classList.contains('e-day')))) {
24365
24411
  remove(this.filterMenuElement);
24366
24412
  this.parent.treeGrid.grid.notify('filter-menu-close', { isOpen: false });
24367
24413
  this.filterMenuElement = null;
@@ -27105,7 +27151,7 @@ class RowDD$1 {
27105
27151
  if (this.dropPosition === 'topSegment' || this.dropPosition === 'bottomSegment') {
27106
27152
  const rowPosition = this.dropPosition === 'topSegment' ? 'Above' : 'Below';
27107
27153
  this.parent.editModule.addRowSelectedItem = droppedRecord;
27108
- this.parent.editModule.updateRealDataSource(draggedRecord, rowPosition);
27154
+ this.parent.editModule.updateRealDataSource([draggedRecord], rowPosition);
27109
27155
  delete this.parent.editModule.addRowSelectedItem;
27110
27156
  }
27111
27157
  }