@syncfusion/ej2-gantt 19.4.41 → 19.4.48

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 (63) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/ej2-gantt.umd.min.js +2 -2
  3. package/dist/ej2-gantt.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-gantt.es2015.js +87 -20
  5. package/dist/es6/ej2-gantt.es2015.js.map +1 -1
  6. package/dist/es6/ej2-gantt.es5.js +87 -20
  7. package/dist/es6/ej2-gantt.es5.js.map +1 -1
  8. package/dist/global/ej2-gantt.min.js +2 -2
  9. package/dist/global/ej2-gantt.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +18 -18
  12. package/src/gantt/actions/chart-scroll.js +1 -0
  13. package/src/gantt/actions/edit.d.ts +2 -1
  14. package/src/gantt/actions/edit.js +28 -1
  15. package/src/gantt/actions/filter.js +1 -1
  16. package/src/gantt/actions/keyboard.js +4 -0
  17. package/src/gantt/actions/rowdragdrop.js +1 -1
  18. package/src/gantt/actions/taskbar-edit.js +3 -1
  19. package/src/gantt/base/date-processor.js +8 -1
  20. package/src/gantt/base/gantt-chart.js +6 -2
  21. package/src/gantt/base/gantt.js +18 -5
  22. package/src/gantt/base/task-processor.js +15 -8
  23. package/src/gantt/renderer/edit-tooltip.js +1 -0
  24. package/src/gantt/renderer/tooltip.js +1 -0
  25. package/styles/bootstrap-dark.css +9 -1
  26. package/styles/bootstrap.css +9 -1
  27. package/styles/bootstrap4.css +9 -1
  28. package/styles/bootstrap5-dark.css +9 -1
  29. package/styles/bootstrap5.css +9 -1
  30. package/styles/fabric-dark.css +9 -1
  31. package/styles/fabric.css +9 -1
  32. package/styles/gantt/_bootstrap-dark-definition.scss +0 -1
  33. package/styles/gantt/_bootstrap-definition.scss +0 -1
  34. package/styles/gantt/_bootstrap4-definition.scss +0 -1
  35. package/styles/gantt/_bootstrap5-definition.scss +0 -1
  36. package/styles/gantt/_fabric-dark-definition.scss +0 -1
  37. package/styles/gantt/_fabric-definition.scss +0 -1
  38. package/styles/gantt/_fluent-definition.scss +0 -1
  39. package/styles/gantt/_highcontrast-definition.scss +0 -1
  40. package/styles/gantt/_highcontrast-light-definition.scss +0 -1
  41. package/styles/gantt/_layout.scss +8 -1
  42. package/styles/gantt/_material-dark-definition.scss +0 -1
  43. package/styles/gantt/_material-definition.scss +0 -1
  44. package/styles/gantt/_tailwind-definition.scss +0 -1
  45. package/styles/gantt/bootstrap-dark.css +9 -1
  46. package/styles/gantt/bootstrap.css +9 -1
  47. package/styles/gantt/bootstrap4.css +9 -1
  48. package/styles/gantt/bootstrap5-dark.css +9 -1
  49. package/styles/gantt/bootstrap5.css +9 -1
  50. package/styles/gantt/fabric-dark.css +9 -1
  51. package/styles/gantt/fabric.css +9 -1
  52. package/styles/gantt/highcontrast-light.css +9 -1
  53. package/styles/gantt/highcontrast.css +9 -1
  54. package/styles/gantt/material-dark.css +9 -1
  55. package/styles/gantt/material.css +9 -1
  56. package/styles/gantt/tailwind-dark.css +9 -1
  57. package/styles/gantt/tailwind.css +9 -1
  58. package/styles/highcontrast-light.css +9 -1
  59. package/styles/highcontrast.css +9 -1
  60. package/styles/material-dark.css +9 -1
  61. package/styles/material.css +9 -1
  62. package/styles/tailwind-dark.css +9 -1
  63. 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.
@@ -11477,6 +11496,7 @@ class Tooltip$1 {
11477
11496
  tooltipPositionY = tooltipPositionY + 10;
11478
11497
  }
11479
11498
  args.element.style.top = tooltipPositionY + 'px';
11499
+ args.element.style.visibility = 'visible';
11480
11500
  }
11481
11501
  /**
11482
11502
  * Method to get mouse pointor position
@@ -11725,6 +11745,10 @@ class FocusModule {
11725
11745
  onKeyPress(e) {
11726
11746
  const ganttObj = this.parent;
11727
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
+ }
11728
11752
  const targetElement = this.parent.focusModule.getActiveElement();
11729
11753
  if (e.action === 'home' || e.action === 'end' || e.action === 'downArrow' || e.action === 'upArrow' || e.action === 'delete' ||
11730
11754
  e.action === 'rightArrow' || e.action === 'leftArrow' || e.action === 'focusTask' || e.action === 'focusSearch' ||
@@ -12243,8 +12267,14 @@ let Gantt = class Gantt extends Component {
12243
12267
  calculateDimensions() {
12244
12268
  let settingsHeight;
12245
12269
  if (typeof (this.height) !== 'number' && this.height.indexOf('%') !== -1 && (this.element.parentElement &&
12246
- !this.element.parentElement.style.height)) {
12247
- 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
+ }
12248
12278
  ganttHeight = (ganttHeight * window.innerHeight) / 100;
12249
12279
  if (this.height === '100%') {
12250
12280
  ganttHeight = ganttHeight - 16;
@@ -12399,9 +12429,16 @@ let Gantt = class Gantt extends Component {
12399
12429
  let settingsHeight;
12400
12430
  if (this.height.indexOf('%') !== -1) {
12401
12431
  let ganttHeight = Number(this.height.split("%")[0]);
12402
- if (this.element.parentElement && this.element.parentElement.style.height) {
12403
- let containerHeight = Number(this.element.parentElement.style.height.split("px")[0]);
12404
- 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
+ }
12405
12442
  }
12406
12443
  else {
12407
12444
  ganttHeight = Number(this.height.split("%")[0]);
@@ -15767,6 +15804,7 @@ class EditTooltip {
15767
15804
  tooltipPositionX += leftEnd - (tooltipPositionX + args.element.offsetWidth);
15768
15805
  }
15769
15806
  args.element.style.left = tooltipPositionX + 'px';
15807
+ args.element.style.visibility = 'visible';
15770
15808
  }
15771
15809
  /**
15772
15810
  * To show/hide taskbar edit tooltip.
@@ -16386,7 +16424,9 @@ class TaskbarEdit extends DateProcessor {
16386
16424
  if (this.isMouseDragged && this.taskBarEditAction) {
16387
16425
  const args = {
16388
16426
  cancel: false,
16389
- requestType: 'taskbarediting'
16427
+ requestType: 'taskbarediting',
16428
+ taskBarEditAction: this.taskBarEditAction,
16429
+ data: this.taskBarEditRecord
16390
16430
  };
16391
16431
  if (this.segmentIndex !== -1) {
16392
16432
  args.requestType = 'mergeSegment';
@@ -21548,7 +21588,7 @@ class Edit$2 {
21548
21588
  */
21549
21589
  updateParentChildRecord(data) {
21550
21590
  const ganttRecord = data;
21551
- 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']) {
21552
21592
  this.updateChildItems(ganttRecord);
21553
21593
  }
21554
21594
  }
@@ -23467,6 +23507,10 @@ class Edit$2 {
23467
23507
  }
23468
23508
  this.parent.timelineModule.updateTimeLineOnEditing([tempArray], args.action);
23469
23509
  }
23510
+ let flag = getValue('doubleClickTarget', this.parent.treeGrid.editModule);
23511
+ if (flag !== null) {
23512
+ setValue('doubleClickTarget', null, this.parent.treeGrid.editModule);
23513
+ }
23470
23514
  this.addSuccess(args);
23471
23515
  args = this.constructTaskAddedEventArgs(cAddedRecord, args.modifiedRecords, 'add');
23472
23516
  this.parent.trigger('actionComplete', args);
@@ -23868,6 +23912,25 @@ class Edit$2 {
23868
23912
  const delRow = this.parent.getTaskByUniqueID(this.draggedRecord.uniqueID);
23869
23913
  this.removeRecords(delRow);
23870
23914
  }
23915
+ updateIndentedChildRecords(indentedRecord) {
23916
+ let createParentItem = {
23917
+ uniqueID: indentedRecord.uniqueID,
23918
+ expanded: indentedRecord.expanded,
23919
+ level: indentedRecord.level,
23920
+ index: indentedRecord.index,
23921
+ taskId: indentedRecord.ganttProperties.rowUniqueID
23922
+ };
23923
+ for (let i = 0; i < indentedRecord.childRecords.length; i++) {
23924
+ this.parent.setRecordValue('parentItem', createParentItem, indentedRecord.childRecords[i]);
23925
+ this.parent.setRecordValue('parentUniqueID', indentedRecord.uniqueID, indentedRecord.childRecords[i]);
23926
+ }
23927
+ if (indentedRecord.hasChildRecords) {
23928
+ indentedRecord = indentedRecord.childRecords;
23929
+ for (let j = 0; j < indentedRecord['length']; j++) {
23930
+ this.updateIndentedChildRecords(indentedRecord[j]);
23931
+ }
23932
+ }
23933
+ }
23871
23934
  dropMiddle(recordIndex1) {
23872
23935
  const obj = this.parent;
23873
23936
  const childRec = this.parent.editModule.getChildCount(this.droppedRecord, 0);
@@ -23883,6 +23946,10 @@ class Edit$2 {
23883
23946
  this.recordLevel();
23884
23947
  if (this.draggedRecord.hasChildRecords) {
23885
23948
  this.updateChildRecord(this.draggedRecord, childRecordsLength, this.droppedRecord.expanded);
23949
+ if (this.parent.enableImmutableMode) {
23950
+ let indentedRecord = this.draggedRecord;
23951
+ this.updateIndentedChildRecords(indentedRecord);
23952
+ }
23886
23953
  }
23887
23954
  if (isNullOrUndefined(this.draggedRecord.parentItem &&
23888
23955
  this.updateParentRecords.indexOf(this.draggedRecord.parentItem) !== -1)) {
@@ -24363,7 +24430,7 @@ class Filter$1 {
24363
24430
  const ganttElement = closest(element, '#' + this.parent.element.id)
24364
24431
  || element.querySelector('#' + this.parent.element.id);
24365
24432
  if ((!(this.filterMenuElement.contains(element)) && !isNullOrUndefined(ganttElement)) || element.nodeName === 'HTML'
24366
- || element.nodeName === 'DIV') {
24433
+ || ((element.nodeName === 'DIV') && (!element.classList.contains('e-day')))) {
24367
24434
  remove(this.filterMenuElement);
24368
24435
  this.parent.treeGrid.grid.notify('filter-menu-close', { isOpen: false });
24369
24436
  this.filterMenuElement = null;
@@ -27107,7 +27174,7 @@ class RowDD$1 {
27107
27174
  if (this.dropPosition === 'topSegment' || this.dropPosition === 'bottomSegment') {
27108
27175
  const rowPosition = this.dropPosition === 'topSegment' ? 'Above' : 'Below';
27109
27176
  this.parent.editModule.addRowSelectedItem = droppedRecord;
27110
- this.parent.editModule.updateRealDataSource(draggedRecord, rowPosition);
27177
+ this.parent.editModule.updateRealDataSource([draggedRecord], rowPosition);
27111
27178
  delete this.parent.editModule.addRowSelectedItem;
27112
27179
  }
27113
27180
  }