@syncfusion/ej2-gantt 24.1.43 → 24.1.45

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.
@@ -3802,14 +3802,11 @@ class TaskProcessor extends DateProcessor {
3802
3802
  */
3803
3803
  updateWidthLeft(data) {
3804
3804
  const ganttRecord = data.ganttProperties;
3805
+ let totalSegmentsProgressWidth = 0;
3805
3806
  // task endDate may be changed in segment calculation so this must be calculated first.
3806
3807
  // task width calculating was based on endDate
3807
3808
  if (!isNullOrUndefined(ganttRecord.segments) && ganttRecord.segments.length > 0) {
3808
3809
  const segments = ganttRecord.segments;
3809
- let fixedWidth = true;
3810
- const totalTaskWidth = this.splitTasksDuration(segments) * ((this.parent.timelineModule.bottomTier === "Hour" || this.parent.timelineModule.bottomTier === "Minutes") ? this.parent.timelineSettings.timelineUnitSize : this.parent.perDayWidth);
3811
-
3812
- let totalProgressWidth = this.parent.dataOperation.getProgressWidth(totalTaskWidth, ganttRecord.progress);
3813
3810
  for (let i = 0; i < segments.length; i++) {
3814
3811
  const segment = segments[i];
3815
3812
  if (i === 0 && !isNullOrUndefined(ganttRecord.startDate) &&
@@ -3820,22 +3817,27 @@ class TaskProcessor extends DateProcessor {
3820
3817
  this.parent.chartRowsModule.incrementSegments(segments, 0, data);
3821
3818
  }
3822
3819
  segment.width = this.getSplitTaskWidth(segment.startDate, segment.duration, data);
3820
+ totalSegmentsProgressWidth = totalSegmentsProgressWidth + segment.width;
3823
3821
  segment.showProgress = false;
3824
3822
  segment.progressWidth = -1;
3825
3823
  if (i !== 0) {
3826
3824
  const pStartDate = new Date(ganttRecord.startDate.getTime());
3827
3825
  segment.left = this.getSplitTaskLeft(segment.startDate, pStartDate);
3828
3826
  }
3829
- if (totalProgressWidth > 0 && totalProgressWidth > segment.width) {
3830
- totalProgressWidth = totalProgressWidth - segment.width;
3831
- segment.progressWidth = segment.width;
3832
- segment.showProgress = false;
3833
- }
3834
- else if (fixedWidth) {
3835
- segment.progressWidth = totalProgressWidth;
3836
- segment.showProgress = true;
3837
- totalProgressWidth = totalProgressWidth - segment.width;
3838
- fixedWidth = false;
3827
+ }
3828
+ let setProgress = this.parent.dataOperation.getProgressWidth(totalSegmentsProgressWidth, ganttRecord.progress);
3829
+ let isValid = true;
3830
+ for (let i = 0; i < segments.length; i++) {
3831
+ if (isValid) {
3832
+ if (setProgress <= segments[i].width) {
3833
+ segments[i].progressWidth = setProgress;
3834
+ segments[i].showProgress = true;
3835
+ isValid = false;
3836
+ }
3837
+ else {
3838
+ segments[i].progressWidth = segments[i].width;
3839
+ setProgress = setProgress - segments[i].progressWidth;
3840
+ }
3839
3841
  }
3840
3842
  }
3841
3843
  this.parent.setRecordValue('segments', ganttRecord.segments, ganttRecord, true);
@@ -3843,7 +3845,12 @@ class TaskProcessor extends DateProcessor {
3843
3845
  }
3844
3846
  this.parent.setRecordValue('width', this.parent.dataOperation.calculateWidth(data), ganttRecord, true);
3845
3847
  this.parent.setRecordValue('left', this.parent.dataOperation.calculateLeft(ganttRecord), ganttRecord, true);
3846
- this.parent.setRecordValue('progressWidth', this.parent.dataOperation.getProgressWidth((ganttRecord.isAutoSchedule || !data.hasChildRecords ? ganttRecord.width : ganttRecord.autoWidth), ganttRecord.progress), ganttRecord, true);
3848
+ if (!isNullOrUndefined(ganttRecord.segments) && ganttRecord.segments.length > 0) {
3849
+ this.parent.setRecordValue('progressWidth', this.parent.dataOperation.getProgressWidth(totalSegmentsProgressWidth, ganttRecord.progress), ganttRecord, true);
3850
+ }
3851
+ else {
3852
+ this.parent.setRecordValue('progressWidth', this.parent.dataOperation.getProgressWidth((ganttRecord.isAutoSchedule || !data.hasChildRecords ? ganttRecord.width : ganttRecord.autoWidth), ganttRecord.progress), ganttRecord, true);
3853
+ }
3847
3854
  }
3848
3855
  /**
3849
3856
  * method to update left, width, progress width in record
@@ -14382,7 +14389,10 @@ class FocusModule {
14382
14389
  const selectingRowIndex = expandedRecords.indexOf(selectedItem);
14383
14390
  const currentSelectingRecord = e.action === 'downArrow' ? expandedRecords[selectingRowIndex + 1] :
14384
14391
  expandedRecords[selectingRowIndex - 1];
14385
- ganttObj.selectionModule.selectRow(ganttObj.currentViewData.indexOf(currentSelectingRecord), false, true);
14392
+ const activeElement = this.parent['args'];
14393
+ if (document.activeElement != activeElement) {
14394
+ ganttObj.selectionModule.selectRow(ganttObj.currentViewData.indexOf(currentSelectingRecord), false, true);
14395
+ }
14386
14396
  }
14387
14397
  else if (ganttObj.selectionSettings.mode === 'Cell' && ganttObj.selectionModule.getSelectedRowCellIndexes().length > 0) {
14388
14398
  const selectCellIndex = ganttObj.selectionModule.getSelectedRowCellIndexes();
@@ -15244,6 +15254,12 @@ let Gantt = class Gantt extends Component {
15244
15254
  }
15245
15255
  }
15246
15256
  keyActionHandler(e) {
15257
+ if (this.enableContextMenu && this.contextMenuModule && (e.action === 'downArrow' || e.action === 'upArrow') && document.getElementById(this.element.id + '_contextmenu') && this['args']) {
15258
+ const firstMenuItem = this['args'];
15259
+ if (!isNullOrUndefined(firstMenuItem)) {
15260
+ (firstMenuItem).focus();
15261
+ }
15262
+ }
15247
15263
  if (e.target && (e.action === 'downArrow' || e.action === 'upArrow') && e.target === this.element.querySelector('.e-rowcell')) {
15248
15264
  this.treeGrid.grid.notify('key-pressed', e);
15249
15265
  }
@@ -23894,6 +23910,9 @@ class DialogEdit {
23894
23910
  const ganttObj = this.parent;
23895
23911
  const resourceSettings = ganttObj.resourceFields;
23896
23912
  const ganttData = this.beforeOpenArgs.rowData;
23913
+ if (((this.beforeOpenArgs.requestType === 'beforeOpenEditDialog' && !isNullOrUndefined(this.editedRecord[this.parent.taskFields.resourceInfo])) || (this.beforeOpenArgs.requestType === 'beforeOpenAddDialog' && !isNullOrUndefined(this.editedRecord[this.parent.taskFields.resourceInfo]))) && (typeof (this.editedRecord[this.parent.taskFields.resourceInfo]) === "object")) {
23914
+ this.parent.setRecordValue('resourceInfo', this.parent.dataOperation.setResourceInfo(this.editedRecord), ganttData.ganttProperties, true);
23915
+ }
23897
23916
  const rowResource = ganttData.ganttProperties.resourceInfo;
23898
23917
  const inputModel = this.beforeOpenArgs[itemName];
23899
23918
  const resourceTreeGridId = ganttObj.element.id + '' + itemName + 'TabContainer';
@@ -23932,6 +23951,11 @@ class DialogEdit {
23932
23951
  this.ganttResources.push(resourceInfo[i]);
23933
23952
  }
23934
23953
  }
23954
+ else if (!this.isEdit && !isNullOrUndefined(resourceInfo)) {
23955
+ for (let i = 0; i < resourceInfo.length; i++) {
23956
+ this.ganttResources.push(resourceInfo[i]);
23957
+ }
23958
+ }
23935
23959
  inputModel.rowSelected = (args) => {
23936
23960
  this.updateResourceCollection(args, resourceTreeGridId);
23937
23961
  };
@@ -24340,7 +24364,14 @@ class DialogEdit {
24340
24364
  }
24341
24365
  }
24342
24366
  else {
24343
- tasksData[fieldName] = controlObj.value;
24367
+ if (fieldName === "Duration") {
24368
+ let numericValue = parseFloat(String(controlObj.value));
24369
+
24370
+ tasksData[fieldName] = numericValue;
24371
+ }
24372
+ else {
24373
+ tasksData[fieldName] = controlObj.value;
24374
+ }
24344
24375
  if (this.parent.enableHtmlSanitizer && typeof (controlObj.value) === 'string') {
24345
24376
  controlObj.value = SanitizeHtmlHelper.sanitize(controlObj.value);
24346
24377
  tasksData[fieldName] = controlObj.value;
@@ -26993,9 +27024,11 @@ class Edit$2 {
26993
27024
  const taskID = updateRecord.ganttProperties.taskId;
26994
27025
  const resourceID = prevResource[index][this.parent.resourceFields.id];
26995
27026
  const record = flatRecords[this.parent.getTaskIds().indexOf('R' + resourceID)];
26996
- for (let j = 0; j < record.childRecords.length; j++) {
26997
- if (record.childRecords[j].ganttProperties.taskId === taskID) {
26998
- this.removeChildRecord(record.childRecords[j]);
27027
+ if (!isNullOrUndefined(record)) {
27028
+ for (let j = 0; j < record.childRecords.length; j++) {
27029
+ if (record.childRecords[j].ganttProperties.taskId === taskID) {
27030
+ this.removeChildRecord(record.childRecords[j]);
27031
+ }
26999
27032
  }
27000
27033
  }
27001
27034
  }
@@ -28523,6 +28556,8 @@ class Edit$2 {
28523
28556
  if (args.data[tempTaskID] != args.data['ganttProperties']['taskId']) {
28524
28557
  args.data['ganttProperties']['taskId'] = args.data[tempTaskID];
28525
28558
  args.newTaskData[tempTaskID] = args.data[tempTaskID];
28559
+ args.data['ganttProperties']['rowUniqueID'] = args.data[tempTaskID].toString();
28560
+ this.parent.ids.push(args.data[tempTaskID].toString());
28526
28561
  }
28527
28562
  }
28528
28563
  if (!args.cancel) {
@@ -28532,7 +28567,6 @@ class Edit$2 {
28532
28567
  addedRecords: [args.newTaskData],
28533
28568
  changedRecords: args.modifiedTaskData
28534
28569
  };
28535
- const prevID = args.data.ganttProperties.taskId.toString();
28536
28570
  /* tslint:disable-next-line */
28537
28571
  const query = this.parent.query instanceof Query ? this.parent.query : new Query();
28538
28572
  const adaptor = data.adaptor;
@@ -28540,6 +28574,13 @@ class Edit$2 {
28540
28574
  /* tslint:disable-next-line */
28541
28575
  const crud = data.saveChanges(updatedData, this.parent.taskFields.id, null, query);
28542
28576
  crud.then((e) => {
28577
+ if (e.addedRecords[0][this.parent.taskFields.id].toString() != args.data['ganttProperties']['taskId']) {
28578
+ args.data['ganttProperties']['taskId'] = e.addedRecords[0][this.parent.taskFields.id].toString();
28579
+ args.newTaskData[tempTaskID] = e.addedRecords[0][this.parent.taskFields.id].toString();
28580
+ args.data['ganttProperties']['rowUniqueID'] = e.addedRecords[0][this.parent.taskFields.id].toString();
28581
+ this.parent.ids.push(e.addedRecords[0][this.parent.taskFields.id].toString());
28582
+ }
28583
+ const prevID = args.data.ganttProperties.taskId.toString();
28543
28584
  if (this.parent.taskFields.id && !isNullOrUndefined(e.addedRecords[0][this.parent.taskFields.id]) &&
28544
28585
  e.addedRecords[0][this.parent.taskFields.id].toString() == prevID) {
28545
28586
  this.parent.setRecordValue('taskId', e.addedRecords[0][this.parent.taskFields.id], args.data.ganttProperties, true);
@@ -32964,7 +33005,7 @@ class ContextMenu$2 {
32964
33005
  }
32965
33006
  contextMenuOpen(args) {
32966
33007
  this.isOpen = true;
32967
- const firstMenuItem = args.element.querySelectorAll('li:not(.e-menu-hide):not(.e-disabled)')[0];
33008
+ const firstMenuItem = this.parent['args'] = args.element.querySelectorAll('li:not(.e-menu-hide):not(.e-disabled)')[0];
32968
33009
  if (!isNullOrUndefined(firstMenuItem)) {
32969
33010
  addClass([firstMenuItem], 'e-focused');
32970
33011
  }
@@ -37440,13 +37481,22 @@ class PdfGanttTaskbarCollection {
37440
37481
  progressFormat.alignment = PdfTextAlignment.Left;
37441
37482
  }
37442
37483
  let pageIndex = -1;
37484
+ let renderBaselineWidth = 0;
37485
+ if (this.baselineWidth > detail.totalWidth) {
37486
+ renderBaselineWidth = detail.totalWidth;
37487
+ this.baselineWidth = this.baselineWidth - detail.totalWidth;
37488
+ }
37489
+ else {
37490
+ renderBaselineWidth = this.baselineWidth;
37491
+ }
37492
+ const baselinePen = new PdfPen(taskbar.baselineBorderColor);
37493
+ const baselineBrush = new PdfSolidBrush(taskbar.baselineColor);
37494
+ let renderedBaseline = false;
37443
37495
  if (!taskbar.isMilestone) {
37444
37496
  const taskbarPen = new PdfPen(taskbar.taskBorderColor);
37445
37497
  const taskBrush = new PdfSolidBrush(taskbar.taskColor);
37446
- const baselinePen = new PdfPen(taskbar.baselineBorderColor);
37447
37498
  const manualParentBorderPen = new PdfPen(taskbar.manualParentBorder);
37448
37499
  const manualChildBorderPen = new PdfPen(taskbar.manualChildBorder);
37449
- const baselineBrush = new PdfSolidBrush(taskbar.baselineColor);
37450
37500
  const manualTaskbarPen = new PdfPen(taskbar.manuallineColor);
37451
37501
  const manualParentPen = new PdfPen(taskbar.manualParentProgress);
37452
37502
  const manualline = new PdfPen(taskbar.manuallineColor);
@@ -37517,11 +37567,12 @@ class PdfGanttTaskbarCollection {
37517
37567
  else {
37518
37568
  if (this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
37519
37569
  if (this.isAutoFit()) {
37520
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (this.baselineWidth), pixelToPoint(this.baselineHeight));
37570
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
37521
37571
  }
37522
37572
  else {
37523
- 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));
37573
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
37524
37574
  }
37575
+ renderedBaseline = true;
37525
37576
  }
37526
37577
  if (taskbar.isSpliterTask) {
37527
37578
  splitline.dashStyle = PdfDashStyle.Dot;
@@ -37734,11 +37785,12 @@ class PdfGanttTaskbarCollection {
37734
37785
  else {
37735
37786
  if (this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
37736
37787
  if (this.isAutoFit()) {
37737
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (this.baselineWidth), pixelToPoint(this.baselineHeight));
37788
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
37738
37789
  }
37739
37790
  else {
37740
- 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));
37791
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
37741
37792
  }
37793
+ renderedBaseline = true;
37742
37794
  }
37743
37795
  if (taskbar.isSpliterTask) {
37744
37796
  let pervwidth = 0;
@@ -37895,11 +37947,12 @@ class PdfGanttTaskbarCollection {
37895
37947
  }
37896
37948
  if (this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
37897
37949
  if (this.isAutoFit()) {
37898
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (this.baselineWidth), pixelToPoint(this.baselineHeight));
37950
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
37899
37951
  }
37900
37952
  else {
37901
- 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));
37953
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
37902
37954
  }
37955
+ renderedBaseline = true;
37903
37956
  }
37904
37957
  if (!this.isScheduledTask && this.unscheduledTaskBy === 'duration') {
37905
37958
  let brush1;
@@ -38051,11 +38104,12 @@ class PdfGanttTaskbarCollection {
38051
38104
  }
38052
38105
  if (this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
38053
38106
  if (this.isAutoFit()) {
38054
- taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (this.baselineWidth), pixelToPoint(this.baselineHeight));
38107
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
38055
38108
  }
38056
38109
  else {
38057
- 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));
38110
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
38058
38111
  }
38112
+ renderedBaseline = true;
38059
38113
  }
38060
38114
  if (!this.isScheduledTask && this.unscheduledTaskBy === 'duration') {
38061
38115
  let brush1;
@@ -38276,6 +38330,15 @@ class PdfGanttTaskbarCollection {
38276
38330
  this.drawMilestone(page, startPoint, detail, cumulativeWidth);
38277
38331
  }
38278
38332
  }
38333
+ if (this.baselineEndDate >= detail.startDate && !renderedBaseline && detail.startIndex != 1 && this.parent.renderBaseline && taskbar.baselineStartDate && taskbar.baselineEndDate) {
38334
+ const adjustHeight = pixelToPoint((this.parent.rowHeight - this.height) / 4.5);
38335
+ if (this.isAutoFit()) {
38336
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + (taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), (renderBaselineWidth), pixelToPoint(this.baselineHeight));
38337
+ }
38338
+ else {
38339
+ taskGraphics.drawRectangle(baselinePen, baselineBrush, startPoint.x + pixelToPoint(taskbar.baselineLeft - cumulativeWidth) + 0.5, startPoint.y + adjustHeight + pixelToPoint(taskbar.height + 3), pixelToPoint(renderBaselineWidth), pixelToPoint(this.baselineHeight));
38340
+ }
38341
+ }
38279
38342
  this.drawRightLabel(page, startPoint, detail, cumulativeWidth);
38280
38343
  return isNextPage;
38281
38344
  }