@syncfusion/ej2-gantt 23.1.44 → 23.2.5

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 (40) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/ej2-gantt.min.js +2 -2
  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 +52 -30
  6. package/dist/es6/ej2-gantt.es2015.js.map +1 -1
  7. package/dist/es6/ej2-gantt.es5.js +90 -57
  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 +20 -20
  13. package/src/gantt/actions/edit.js +19 -0
  14. package/src/gantt/actions/toolbar.js +3 -0
  15. package/src/gantt/base/date-processor.js +1 -1
  16. package/src/gantt/base/gantt.js +1 -0
  17. package/src/gantt/base/tree-grid.js +5 -3
  18. package/src/gantt/export/export-helper.js +11 -11
  19. package/src/gantt/export/pdf-gantt.js +6 -3
  20. package/src/gantt/export/pdf-taskbar.js +3 -3
  21. package/src/gantt/export/pdf-timeline.js +12 -6
  22. package/src/gantt/renderer/timeline.js +3 -4
  23. package/styles/bootstrap-dark.css +5 -0
  24. package/styles/bootstrap5-dark.css +2 -1
  25. package/styles/bootstrap5.css +2 -1
  26. package/styles/fabric-dark.css +5 -0
  27. package/styles/fluent-dark.css +2 -1
  28. package/styles/fluent.css +2 -1
  29. package/styles/gantt/bootstrap-dark.css +5 -0
  30. package/styles/gantt/bootstrap5-dark.css +2 -1
  31. package/styles/gantt/bootstrap5.css +2 -1
  32. package/styles/gantt/fabric-dark.css +5 -0
  33. package/styles/gantt/fluent-dark.css +2 -1
  34. package/styles/gantt/fluent.css +2 -1
  35. package/styles/gantt/highcontrast.css +5 -0
  36. package/styles/gantt/tailwind-dark.css +2 -1
  37. package/styles/gantt/tailwind.css +2 -1
  38. package/styles/highcontrast.css +5 -0
  39. package/styles/tailwind-dark.css +2 -1
  40. package/styles/tailwind.css +2 -1
@@ -270,7 +270,7 @@ class DateProcessor {
270
270
  if (!this.parent.includeWeekend) {
271
271
  const tempDate = new Date(cloneStartDate.getTime());
272
272
  cloneStartDate = this.getNextWorkingDay(cloneStartDate);
273
- if (tempDate.getTime() !== cloneStartDate.getTime()) {
273
+ if (tempDate.getTime() !== cloneStartDate.getTime() && !validateAsMilestone) {
274
274
  this.setTime(startTime, cloneStartDate);
275
275
  }
276
276
  }
@@ -7410,10 +7410,9 @@ class Timeline {
7410
7410
  const validEndLeft = this.parent.dataOperation.getTaskLeft(validEndDate, false);
7411
7411
  let isChanged;
7412
7412
  let taskbarModule = this.parent.editModule.taskbarEditModule;
7413
- if (!isNullOrUndefined(maxStartLeft) && ((minStartDate < this.timelineStartDate) ||
7414
- (!isNullOrUndefined(taskbarModule)) && (!isNullOrUndefined(taskbarModule.taskBarEditAction)
7415
- && taskbarModule.taskBarEditAction !== 'ProgressResizing' &&
7416
- taskbarModule.taskBarEditAction !== 'RightResizing')) && (maxStartLeft < this.bottomTierCellWidth || maxStartLeft <= validStartLeft)) {
7413
+ if (!isNullOrUndefined(maxStartLeft) && ((!isNullOrUndefined(taskbarModule)) && (!isNullOrUndefined(taskbarModule.taskBarEditAction)
7414
+ && taskbarModule.taskBarEditAction !== 'ProgressResizing' &&
7415
+ taskbarModule.taskBarEditAction !== 'RightResizing' && taskbarModule.taskBarEditAction !== 'LeftResizing')) && (maxStartLeft < this.bottomTierCellWidth || maxStartLeft <= validStartLeft)) {
7417
7416
  isChanged = 'prevTimeSpan';
7418
7417
  minStartDate = minStartDate > this.timelineStartDate ? this.timelineStartDate : minStartDate;
7419
7418
  }
@@ -7675,7 +7674,9 @@ class GanttTreeGrid {
7675
7674
  this.parent.treeGrid.loadChildOnDemand = this.parent.loadChildOnDemand;
7676
7675
  this.parent.treeGrid['isFromGantt'] = true;
7677
7676
  this.parent.treeGrid.parentIdMapping = this.parent.taskFields.parentID;
7678
- this.parent.treeGrid.idMapping = this.parent.taskFields.id;
7677
+ if (this.parent.taskFields.parentID) {
7678
+ this.parent.treeGrid.idMapping = this.parent.taskFields.id;
7679
+ }
7679
7680
  this.parent.treeGrid.showColumnMenu = this.parent.showColumnMenu;
7680
7681
  this.parent.treeGrid.enableCollapseAll = this.parent.collapseAllParentTasks;
7681
7682
  this.parent.treeGrid.columnMenuItems = this.parent.columnMenuItems;
@@ -7716,7 +7717,7 @@ class GanttTreeGrid {
7716
7717
  toolbarHeight = this.parent.toolbarModule.element.offsetHeight;
7717
7718
  }
7718
7719
  this.parent.treeGrid.height =
7719
- this.parent.element.getElementsByClassName('e-chart-scroll-container e-content')[0]['offsetHeight'] - 19;
7720
+ this.parent.element.getElementsByClassName('e-chart-scroll-container e-content')[0]['offsetHeight'] - (this.parent.flatData.length == 0 ? 0 : 19);
7720
7721
  }
7721
7722
  getContentDiv() {
7722
7723
  return this.treeGridElement.querySelector('.e-content');
@@ -8370,7 +8371,7 @@ class GanttTreeGrid {
8370
8371
  */
8371
8372
  composeIDColumn(column) {
8372
8373
  const isProjectView = this.parent.viewType === 'ProjectView';
8373
- const lengthDataSource = this.parent.dataSource['length'];
8374
+ const lengthDataSource = this.parent.dataSource ? this.parent.dataSource['length'] : 0;
8374
8375
  let taskIDName;
8375
8376
  column.isPrimaryKey = isProjectView ? true : false;
8376
8377
  if (this.parent.isLocaleChanged) {
@@ -15502,6 +15503,7 @@ let Gantt = class Gantt extends Component {
15502
15503
  this.treeGridModule.treeGridColumns = [];
15503
15504
  this.treeGridModule.validateGanttColumns();
15504
15505
  this.treeGrid.columns = this.treeGridModule.treeGridColumns;
15506
+ this.treeGrid.grid.columns = this.treeGridModule.treeGridColumns;
15505
15507
  this.chartRowsModule.initiateTemplates();
15506
15508
  this.timelineModule.updateChartByNewTimeline();
15507
15509
  break;
@@ -25456,7 +25458,15 @@ class Edit$2 {
25456
25458
  if (args.action && args.action === 'DrawConnectorLine') {
25457
25459
  eventArgs.action = 'DrawConnectorLine';
25458
25460
  }
25461
+ const ganttObj = this.parent;
25462
+ const currentBaselineStart = Object.assign({}, eventArgs.data.ganttProperties.baselineStartDate);
25463
+ const currentBaselineEnd = Object.assign({}, eventArgs.data.ganttProperties.baselineEndDate);
25459
25464
  this.parent.trigger('actionBegin', eventArgs, (eventArg) => {
25465
+ if (currentBaselineStart != eventArg.data["ganttProperties"].baselineStartDate
25466
+ || currentBaselineEnd != eventArg.data["ganttProperties"].baselineEndDate) {
25467
+ ganttObj.setRecordValue('baselineLeft', ganttObj.dataOperation.calculateBaselineLeft(eventArg.data['ganttProperties']), eventArg.data['ganttProperties'], true);
25468
+ ganttObj.setRecordValue('baselineWidth', ganttObj.dataOperation.calculateBaselineWidth(eventArg.data['ganttProperties']), eventArg.data['ganttProperties'], true);
25469
+ }
25460
25470
  if (!isNullOrUndefined(this.parent.loadingIndicator) && this.parent.loadingIndicator.indicatorType === "Shimmer") {
25461
25471
  this.parent.showMaskRow();
25462
25472
  }
@@ -29350,6 +29360,9 @@ class Toolbar$3 {
29350
29360
  this.toolbar.isReact = this.parent.isReact;
29351
29361
  this.toolbar.on('render-react-toolbar-template', this.addReactToolbarPortals, this);
29352
29362
  this.toolbar.appendTo(this.element);
29363
+ if (this.parent.treeGrid.grid && this.parent.isReact) {
29364
+ this.parent.treeGrid.grid.portals = this.parent.portals;
29365
+ }
29353
29366
  const cancelItem = this.element.querySelector('#' + this.parent.element.id + '_cancel');
29354
29367
  const updateItem = this.element.querySelector('#' + this.parent.element.id + '_update');
29355
29368
  if (cancelItem) {
@@ -35165,10 +35178,10 @@ class ExportHelper {
35165
35178
  this.parent.predecessorModule.createConnectorLinesCollection();
35166
35179
  this.parent.updatedConnectorLineCollection.forEach((data) => {
35167
35180
  const predecessor = this.gantt.predecessor.add();
35168
- predecessor.parentLeft = pointToPixel(data.parentLeft);
35169
- predecessor.childLeft = pointToPixel(data.childLeft);
35170
- predecessor.parentWidth = pointToPixel(data.parentWidth);
35171
- predecessor.childWidth = pointToPixel(data.childWidth);
35181
+ predecessor.parentLeft = data.parentLeft;
35182
+ predecessor.childLeft = data.childLeft;
35183
+ predecessor.parentWidth = data.parentWidth;
35184
+ predecessor.childWidth = data.childWidth;
35172
35185
  predecessor.parentIndex = data.parentIndex;
35173
35186
  predecessor.childIndex = data.childIndex;
35174
35187
  predecessor.rowHeight = data.rowHeight;
@@ -35251,8 +35264,8 @@ class ExportHelper {
35251
35264
  flatData.forEach((data) => {
35252
35265
  const taskbar = this.gantt.taskbar.add();
35253
35266
  const ganttProp = data.ganttProperties;
35254
- taskbar.left = pointToPixel(ganttProp.left);
35255
- taskbar.width = pointToPixel(ganttProp.width);
35267
+ taskbar.left = ganttProp.left;
35268
+ taskbar.width = ganttProp.width;
35256
35269
  if (taskbar.left < 0) {
35257
35270
  taskbar.width = taskbar.width + taskbar.left;
35258
35271
  taskbar.left = 0;
@@ -35293,8 +35306,8 @@ class ExportHelper {
35293
35306
  taskbar.isMilestone = ganttProp.isMilestone;
35294
35307
  taskbar.baselineStartDate = ganttProp.baselineStartDate;
35295
35308
  taskbar.baselineEndDate = ganttProp.baselineEndDate;
35296
- taskbar.baselineLeft = pointToPixel(ganttProp.baselineLeft);
35297
- taskbar.baselineWidth = pointToPixel(ganttProp.baselineWidth);
35309
+ taskbar.baselineLeft = ganttProp.baselineLeft;
35310
+ taskbar.baselineWidth = ganttProp.baselineWidth;
35298
35311
  taskbar.milestoneColor = new PdfColor(this.ganttStyle.taskbar.milestoneColor);
35299
35312
  taskbar.isParentTask = data.hasChildRecords;
35300
35313
  if (ganttProp.isMilestone) {
@@ -35310,9 +35323,9 @@ class ExportHelper {
35310
35323
  taskbar.taskLabel = data[this.parent.labelSettings.taskLabel].toString();
35311
35324
  }
35312
35325
  const reduceLeft = ganttProp.isMilestone ? Math.floor(this.parent.chartRowsModule.taskBarHeight / 2) + 33 : 33; // 33 indicates default timeline cell width
35313
- taskbar.rightTaskLabel.left = pointToPixel(ganttProp.left) + pointToPixel(ganttProp.width) + reduceLeft; // right label left value
35326
+ taskbar.rightTaskLabel.left = ganttProp.left + ganttProp.width + reduceLeft; // right label left value
35314
35327
  taskbar.fontFamily = this.ganttStyle.fontFamily;
35315
- taskbar.progressWidth = pointToPixel(ganttProp.progressWidth);
35328
+ taskbar.progressWidth = ganttProp.progressWidth;
35316
35329
  taskbar.labelColor = new PdfColor(this.ganttStyle.label.fontColor);
35317
35330
  taskbar.progressFontColor = new PdfColor(this.ganttStyle.taskbar.progressFontColor);
35318
35331
  if (taskbar.isParentTask) {
@@ -35687,7 +35700,8 @@ class PdfGanttTaskbarCollection {
35687
35700
  //code for while current pdf page is exceed
35688
35701
  if (yPoint > pageSize.height) {
35689
35702
  page = this.GetNextPage(page);
35690
- page['contentWidth'] = pointToPixel(detail.endPoint - detail.startPoint);
35703
+ page['contentWidth'] = (this.parent.pdfExportModule && this.parent.pdfExportModule.helper.exportProps && this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings &&
35704
+ this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) ? pointToPixel(detail.endPoint - detail.startPoint) : detail.endPoint - detail.startPoint;
35691
35705
  taskGraphics = page.graphics;
35692
35706
  startPoint.y = 0;
35693
35707
  if (this.parent.pdfExportModule.gantt.enableHeader) {
@@ -35715,7 +35729,7 @@ class PdfGanttTaskbarCollection {
35715
35729
  progressFormat.alignment = PdfTextAlignment.Right;
35716
35730
  let isLabelString = false;
35717
35731
  let updatedWidth;
35718
- if (/^[a-zA-Z]/.test(this.taskLabel)) {
35732
+ if (!isNullOrUndefined(this.taskLabel) && (/^[a-zA-Z]/.test(this.taskLabel))) {
35719
35733
  isLabelString = true;
35720
35734
  progressFormat.alignment = PdfTextAlignment.Left;
35721
35735
  }
@@ -35781,7 +35795,6 @@ class PdfGanttTaskbarCollection {
35781
35795
  taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(this.baselineWidth), pixelToPoint(this.baselineHeight));
35782
35796
  }
35783
35797
  taskGraphics.drawRectangle(taskbarPen, taskBrush, startPoint.x + pixelToPoint(this.left - cumulativeWidth) + 0.5, startPoint.y + adjustHeight, pixelToPoint(renderWidth), pixelToPoint(taskbar.height));
35784
- taskbar.width = taskbar.width - renderWidth;
35785
35798
  if (this.isScheduledTask) {
35786
35799
  let progressBoundsWidth = 0;
35787
35800
  if (this.progressWidth <= renderWidth) {
@@ -36067,7 +36080,8 @@ class PdfTimeline {
36067
36080
  * @returns {void}
36068
36081
  */
36069
36082
  drawTimeline(page, startPoint, detail) {
36070
- let remainWidth = pointToPixel(Math.floor(detail.totalWidth));
36083
+ let remainWidth = (this.parent.pdfExportModule && this.parent.pdfExportModule.helper.exportProps && this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings &&
36084
+ this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) ? pointToPixel(Math.floor(detail.totalWidth)) : Math.floor(detail.totalWidth);
36071
36085
  let renderWidth = 0;
36072
36086
  this.topTierPoint.x = startPoint.x;
36073
36087
  this.topTierPoint.y = startPoint.y;
@@ -36095,7 +36109,8 @@ class PdfTimeline {
36095
36109
  //Primary header Event Arguments
36096
36110
  /* eslint-disable-next-line */
36097
36111
  this.triggerQueryTimelinecell(page, this.topTierPoint.x, this.topTierPoint.y, this.topTierHeight, renderWidth, pHeader.value, true);
36098
- this.topTierPoint.x += renderWidth;
36112
+ this.topTierPoint.x += (this.parent.pdfExportModule && this.parent.pdfExportModule.helper.exportProps && this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings &&
36113
+ this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) ? renderWidth : pixelToPoint(renderWidth);
36099
36114
  remainWidth -= renderWidth;
36100
36115
  if (isCompleted) {
36101
36116
  this.topTierIndex++;
@@ -36121,7 +36136,8 @@ class PdfTimeline {
36121
36136
  //Secondary header Event Arguments
36122
36137
  /* eslint-disable-next-line */
36123
36138
  this.triggerQueryTimelinecell(page, this.bottomTierPoint.x, this.bottomTierPoint.y, this.bottomTierHeight, width, secondHeader.value, false);
36124
- this.bottomTierPoint.x = this.bottomTierPoint.x + width;
36139
+ this.bottomTierPoint.x = (this.parent.pdfExportModule && this.parent.pdfExportModule.helper.exportProps && this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings &&
36140
+ this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) ? this.bottomTierPoint.x + width : this.bottomTierPoint.x + pixelToPoint(width);
36125
36141
  remainWidth -= width;
36126
36142
  secondHeader.completedWidth = width;
36127
36143
  if (isCompleted) {
@@ -36152,7 +36168,8 @@ class PdfTimeline {
36152
36168
  //Primary header Event Arguments
36153
36169
  /* eslint-disable-next-line */
36154
36170
  this.triggerQueryTimelinecell(page, this.topTierPoint.x, this.topTierPoint.y, this.topTierHeight, pHeader.completedWidth, pHeader.value, true);
36155
- this.topTierPoint.x += pHeader.completedWidth;
36171
+ this.topTierPoint.x += (this.parent.pdfExportModule && this.parent.pdfExportModule.helper.exportProps && this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings &&
36172
+ this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) ? pHeader.completedWidth : pixelToPoint(pHeader.completedWidth);
36156
36173
  }
36157
36174
  }
36158
36175
  }
@@ -36165,7 +36182,8 @@ class PdfTimeline {
36165
36182
  //Secondary header Event Arguments
36166
36183
  /* eslint-disable-next-line */
36167
36184
  this.triggerQueryTimelinecell(page, this.bottomTierPoint.x, this.bottomTierPoint.y, this.bottomTierHeight, secondHeader.width, secondHeader.value, false);
36168
- this.bottomTierPoint.x = this.bottomTierPoint.x + secondHeader.width;
36185
+ this.bottomTierPoint.x = (this.parent.pdfExportModule && this.parent.pdfExportModule.helper.exportProps && this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings &&
36186
+ this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) ? this.bottomTierPoint.x + secondHeader.width : this.bottomTierPoint.x + pixelToPoint(secondHeader.width);
36169
36187
  }
36170
36188
  }
36171
36189
  }
@@ -36212,7 +36230,8 @@ class PdfTimeline {
36212
36230
  const e = eventArgs.timelineCell;
36213
36231
  const rectPen = new PdfPen(eventArgs.timelineCell.borderColor);
36214
36232
  const rectBrush = new PdfSolidBrush(eventArgs.timelineCell.backgroundColor);
36215
- graphics.drawRectangle(rectPen, rectBrush, x, y, width, pixelToPoint(height));
36233
+ graphics.drawRectangle(rectPen, rectBrush, x, y, (this.parent.pdfExportModule && this.parent.pdfExportModule.helper.exportProps && this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings &&
36234
+ this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) ? width : pixelToPoint(width), pixelToPoint(height));
36216
36235
  if (!isTopTier && (this.parent.gridLines == "Both" || this.parent.gridLines == "Vertical")) {
36217
36236
  graphics.drawRectangle(rectPen, rectBrush, x, y + pixelToPoint(height), width, page.getClientSize().height);
36218
36237
  }
@@ -36731,10 +36750,12 @@ class PdfGantt extends PdfTreeGrid {
36731
36750
  }
36732
36751
  const detail = {};
36733
36752
  const range = [];
36734
- const convertedWidth = pixelToPoint(this.chartHeader.bottomTierCellWidth);
36753
+ const convertedWidth = (this.parent.pdfExportModule && this.parent.pdfExportModule.helper.exportProps && this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings &&
36754
+ this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) ? pixelToPoint(this.chartHeader.bottomTierCellWidth) : this.chartHeader.bottomTierCellWidth;
36735
36755
  let width = 0;
36736
36756
  if (this.chartHeader.bottomTierCellWidth !== 0) {
36737
- width = (Math.floor(pageWidth / convertedWidth) * convertedWidth);
36757
+ width = (this.parent.pdfExportModule && this.parent.pdfExportModule.helper.exportProps && this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings &&
36758
+ this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) ? (Math.floor(pageWidth / convertedWidth) * convertedWidth) : (Math.floor(pageWidth / convertedWidth) * convertedWidth) + 5;
36738
36759
  }
36739
36760
  range[0] = point;
36740
36761
  if (headerWidth - point <= width) {
@@ -36850,7 +36871,8 @@ class PdfGantt extends PdfTreeGrid {
36850
36871
  let pageData;
36851
36872
  this.headerDetails.forEach((detail, index) => {
36852
36873
  const page = this.result.page.section.getPages()[this.startPageIndex];
36853
- page['contentWidth'] = pointToPixel(this.headerDetails[index].endPoint - this.headerDetails[index].startPoint);
36874
+ page['contentWidth'] = (this.parent.pdfExportModule && this.parent.pdfExportModule.helper.exportProps && this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings &&
36875
+ this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth) ? pointToPixel(this.headerDetails[index].endPoint - this.headerDetails[index].startPoint) : this.headerDetails[index].endPoint - this.headerDetails[index].startPoint;
36854
36876
  this.chartHeader.drawTimeline(page, this.startPoint, detail);
36855
36877
  taskbarPoint.y = taskbarPoint.y + pixelToPoint(this.parent.timelineModule.isSingleTier ? 45 : 60); // headerHeight
36856
36878
  pageStartX = taskbarPoint.x;