@syncfusion/ej2-gantt 22.2.11 → 22.2.12

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.
@@ -1529,8 +1529,8 @@ class DateProcessor {
1529
1529
  }
1530
1530
  if (!editArgs) {
1531
1531
  this.prevProjectStartDate = this.parent.cloneProjectStartDate;
1532
- this.parent.cloneProjectStartDate = minStartDate ? minStartDate : new Date(projectStartDate.getTime());
1533
- this.parent.cloneProjectEndDate = maxEndDate ? maxEndDate : new Date(projectEndDate.getTime());
1532
+ this.parent.cloneProjectStartDate = minStartDate ? (!this.parent.timelineModule.isZoomToFit) ? (!isNullOrUndefined(projectStartDate)) ? new Date(projectStartDate.getTime()) : minStartDate : minStartDate : new Date(projectStartDate.getTime());
1533
+ this.parent.cloneProjectEndDate = maxEndDate ? (!this.parent.timelineModule.isZoomToFit) ? (!isNullOrUndefined(projectEndDate)) ? new Date(projectEndDate.getTime()) : maxEndDate : maxEndDate : new Date(projectEndDate.getTime());
1534
1534
  }
1535
1535
  else {
1536
1536
  setValue('minStartDate', minStartDate, editArgs);
@@ -3054,17 +3054,15 @@ class TaskProcessor extends DateProcessor {
3054
3054
  else {
3055
3055
  hierarchicalData = this.parent.dataSource;
3056
3056
  }
3057
- this.parent.flatData.map((data) => {
3058
- hierarchicalData.map((record) => {
3059
- if (data.ganttProperties.taskId === record[this.parent.taskFields.id]) {
3060
- if (!isNullOrUndefined(this.parent.taskFields.startDate)) {
3061
- task[this.parent.taskFields.endDate] = record[this.parent.taskFields.endDate];
3062
- }
3063
- if (!isNullOrUndefined(this.parent.taskFields.endDate)) {
3064
- task[this.parent.taskFields.endDate] = record[this.parent.taskFields.endDate];
3065
- }
3057
+ hierarchicalData.map((record) => {
3058
+ if (task.ganttProperties.taskId === record[this.parent.taskFields.id]) {
3059
+ if (!isNullOrUndefined(this.parent.taskFields.startDate)) {
3060
+ task[this.parent.taskFields.startDate] = record[this.parent.taskFields.startDate];
3066
3061
  }
3067
- });
3062
+ if (!isNullOrUndefined(this.parent.taskFields.endDate)) {
3063
+ task[this.parent.taskFields.endDate] = record[this.parent.taskFields.endDate];
3064
+ }
3065
+ }
3068
3066
  });
3069
3067
  }
3070
3068
  getWorkInHour(work, workUnit) {
@@ -3106,7 +3104,9 @@ class TaskProcessor extends DateProcessor {
3106
3104
  this.setRecordDate(ganttData, ganttProperties.endDate, dataMapping.endDate);
3107
3105
  }
3108
3106
  if (dataMapping.duration) {
3109
- this.setRecordDuration(ganttData, dataMapping.duration);
3107
+ if (!isNullOrUndefined(dataMapping.milestone) && !ganttData.taskData[dataMapping.milestone]) {
3108
+ this.setRecordDuration(ganttData, dataMapping.duration);
3109
+ }
3110
3110
  }
3111
3111
  if (dataMapping.durationUnit) {
3112
3112
  data[dataMapping.durationUnit] = ganttProperties.durationUnit;
@@ -7315,13 +7315,16 @@ class Timeline {
7315
7315
  this.parent.updateProjectDates(args.projectStartDate, args.ProjectEndDate, args.isTimelineRoundOff, isFrom);
7316
7316
  if (type === 'prevTimeSpan' && isFrom === 'publicMethod') {
7317
7317
  this.parent.ganttChartModule.updateScrollLeft(0);
7318
+ this.parent.timelineModule.isZoomToFit = false;
7318
7319
  }
7319
7320
  else if (type === 'nextTimeSpan' && isFrom === 'publicMethod') {
7320
7321
  this.parent.ganttChartModule.updateScrollLeft(this.parent.timelineModule.totalTimelineWidth);
7322
+ this.parent.timelineModule.isZoomToFit = false;
7321
7323
  }
7322
7324
  else if (type === 'nextTimeSpan' && isFrom === 'TaskbarEditing') {
7323
7325
  let currentScrollLeft = document.getElementsByClassName('e-chart-scroll-container e-content')[0].scrollLeft;
7324
7326
  this.parent.element.querySelector('.e-timeline-header-container').scrollLeft = currentScrollLeft;
7327
+ this.parent.timelineModule.isZoomToFit = false;
7325
7328
  }
7326
7329
  this.parent.timelineModule.timeSpanActionEvent('actionComplete', type, isFrom);
7327
7330
  }
@@ -13068,34 +13071,38 @@ class Tooltip$1 {
13068
13071
  */
13069
13072
  updateTooltipPosition(args) {
13070
13073
  args.element.style.visibility = 'visible';
13071
- // if (isNullOrUndefined(this.tooltipMouseEvent) || args.target.classList.contains('e-notes-info')) {
13072
- // return;
13073
- // }
13074
- // const postion: { x: number, y: number } = this.getPointorPosition(this.tooltipMouseEvent);
13075
- // const containerPosition: { top: number, left: number, width?: number, height?: number } =
13076
- // this.parent.getOffsetRect(this.parent.chartPane);
13077
- // const topEnd: number = containerPosition.top + this.parent.chartPane.offsetHeight;
13078
- // const leftEnd: number = containerPosition.left + this.parent.chartPane.offsetWidth;
13079
- // let tooltipPositionX: number = postion.x;
13080
- // let tooltipPositionY: number = postion.y;
13081
- // if (leftEnd < (tooltipPositionX + args.element.offsetWidth + 10)) {
13082
- // while (leftEnd < (tooltipPositionX + args.element.offsetWidth + 10)) {
13083
- // tooltipPositionX = leftEnd - args.element.offsetWidth - 10;
13084
- // args.element.style.left = tooltipPositionX + 'px';
13085
- // }
13086
- // } else {
13087
- // tooltipPositionX = tooltipPositionX + 10;
13088
- // args.element.style.left = tooltipPositionX + 'px';
13089
- // }
13090
- // if (window.innerHeight < args.element.offsetHeight + tooltipPositionY) {
13091
- // tooltipPositionY = tooltipPositionY - args.element.offsetHeight - 10;
13092
- // }
13093
- // if ((topEnd < (tooltipPositionY + args.element.offsetHeight + 20))) {
13094
- // tooltipPositionY = tooltipPositionY - args.element.offsetHeight - 10;
13095
- // } else {
13096
- // tooltipPositionY = tooltipPositionY + 10;
13097
- // }
13098
- // args.element.style.top = tooltipPositionY + 'px';
13074
+ const parentWithZoomStyle = this.parent.element.closest('[style*="zoom"]');
13075
+ if (isNullOrUndefined(parentWithZoomStyle)) {
13076
+ if (isNullOrUndefined(this.tooltipMouseEvent) || args.target.classList.contains('e-notes-info')) {
13077
+ return;
13078
+ }
13079
+ const postion = this.getPointorPosition(this.tooltipMouseEvent);
13080
+ const containerPosition = this.parent.getOffsetRect(this.parent.chartPane);
13081
+ const topEnd = containerPosition.top + this.parent.chartPane.offsetHeight;
13082
+ const leftEnd = containerPosition.left + this.parent.chartPane.offsetWidth;
13083
+ let tooltipPositionX = postion.x;
13084
+ let tooltipPositionY = postion.y;
13085
+ if (leftEnd < (tooltipPositionX + args.element.offsetWidth + 10)) {
13086
+ while (leftEnd < (tooltipPositionX + args.element.offsetWidth + 10)) {
13087
+ tooltipPositionX = leftEnd - args.element.offsetWidth - 10;
13088
+ args.element.style.left = tooltipPositionX + 'px';
13089
+ }
13090
+ }
13091
+ else {
13092
+ tooltipPositionX = tooltipPositionX + 10;
13093
+ args.element.style.left = tooltipPositionX + 'px';
13094
+ }
13095
+ if (window.innerHeight < args.element.offsetHeight + tooltipPositionY) {
13096
+ tooltipPositionY = tooltipPositionY - args.element.offsetHeight - 10;
13097
+ }
13098
+ if ((topEnd < (tooltipPositionY + args.element.offsetHeight + 20))) {
13099
+ tooltipPositionY = tooltipPositionY - args.element.offsetHeight - 10;
13100
+ }
13101
+ else {
13102
+ tooltipPositionY = tooltipPositionY + 10;
13103
+ }
13104
+ args.element.style.top = tooltipPositionY + 'px';
13105
+ }
13099
13106
  }
13100
13107
  /**
13101
13108
  * Method to get mouse pointor position
@@ -14463,7 +14470,9 @@ let Gantt = class Gantt extends Component {
14463
14470
  this.wireEvents();
14464
14471
  this.notify('initPredessorDialog', {});
14465
14472
  }
14466
- this.splitterModule.updateSplitterPosition();
14473
+ if (!this.isFromOnPropertyChange) {
14474
+ this.splitterModule.updateSplitterPosition();
14475
+ }
14467
14476
  // if (this.gridLines === 'Vertical' || this.gridLines === 'Both') {
14468
14477
  // this.renderChartVerticalLines();
14469
14478
  // }
@@ -14475,6 +14484,8 @@ let Gantt = class Gantt extends Component {
14475
14484
  removeClass(ganttChartElement.querySelectorAll('.e-critical-milestone'), criticalMilestone);
14476
14485
  removeClass(this.element.querySelectorAll('.e-connector-line'), criticalConnectorLineSVG);
14477
14486
  removeClass(this.element.querySelectorAll('.e-connector-line-arrow'), criticalConnectorArrowSVG);
14487
+ const innerDivs = document.querySelector('.e-gantt-child-taskbar-inner-div');
14488
+ innerDivs.style.outlineColor = "";
14478
14489
  }
14479
14490
  wireEvents() {
14480
14491
  if (this.allowKeyboard) {
@@ -15184,6 +15195,7 @@ let Gantt = class Gantt extends Component {
15184
15195
  break;
15185
15196
  case 'projectStartDate':
15186
15197
  case 'projectEndDate':
15198
+ this.timelineModule.isZoomToFit = false;
15187
15199
  this.dataOperation.calculateProjectDates();
15188
15200
  this.updateProjectDates(this.cloneProjectStartDate, this.cloneProjectEndDate, this.isTimelineRoundOff);
15189
15201
  break;
@@ -16308,8 +16320,11 @@ let Gantt = class Gantt extends Component {
16308
16320
  }
16309
16321
  else {
16310
16322
  this.editModule.addRecord(data, rowPosition, rowIndex);
16323
+ if (rowPosition === 'Bottom') {
16324
+ this.selectedRowIndex = rowIndex;
16325
+ }
16311
16326
  if (rowPosition === 'Above' || rowPosition === 'Below' || rowPosition === 'Child') {
16312
- this.currentSelection = data;
16327
+ this.currentSelection = !isNullOrUndefined(data) ? data : this.currentSelection;
16313
16328
  }
16314
16329
  }
16315
16330
  }
@@ -18108,13 +18123,16 @@ class EditTooltip {
18108
18123
  * @returns {void} .
18109
18124
  */
18110
18125
  updateTooltipPosition(args) {
18111
- // const containerPosition: { top: number, left: number } = this.parent.getOffsetRect(this.parent.chartPane);
18112
- // const leftEnd: number = containerPosition.left + this.parent.chartPane.offsetWidth;
18113
- // let tooltipPositionX: number = args.element.offsetLeft;
18114
- // if (leftEnd < (tooltipPositionX + args.element.offsetWidth)) {
18115
- // tooltipPositionX += leftEnd - (tooltipPositionX + args.element.offsetWidth);
18116
- // }
18117
- // args.element.style.left = tooltipPositionX + 'px';
18126
+ const parentWithZoomStyle = this.parent.element.closest('[style*="zoom"]');
18127
+ if (isNullOrUndefined(parentWithZoomStyle)) {
18128
+ const containerPosition = this.parent.getOffsetRect(this.parent.chartPane);
18129
+ const leftEnd = containerPosition.left + this.parent.chartPane.offsetWidth;
18130
+ let tooltipPositionX = args.element.offsetLeft;
18131
+ if (leftEnd < (tooltipPositionX + args.element.offsetWidth)) {
18132
+ tooltipPositionX += leftEnd - (tooltipPositionX + args.element.offsetWidth);
18133
+ }
18134
+ args.element.style.left = tooltipPositionX + 'px';
18135
+ }
18118
18136
  args.element.style.visibility = 'visible';
18119
18137
  }
18120
18138
  /**
@@ -24183,6 +24201,11 @@ class Edit$2 {
24183
24201
  const ganttPropByMapping = getSwapKey(ganttObj.columnMapping);
24184
24202
  const scheduleFieldNames = [];
24185
24203
  let isScheduleValueUpdated = false;
24204
+ if (!isNullOrUndefined(ganttData[tasks.milestone])) {
24205
+ if (ganttData[tasks.milestone] === true) {
24206
+ ganttData[tasks.milestone] = false;
24207
+ }
24208
+ }
24186
24209
  for (const key of Object.keys(data)) {
24187
24210
  if ([tasks.startDate, tasks.endDate, tasks.duration].indexOf(key) !== -1) {
24188
24211
  if (isNullOrUndefined(data[`${key}`]) && !ganttObj.allowUnscheduledTasks) {
@@ -24244,6 +24267,22 @@ class Edit$2 {
24244
24267
  else if (key === tasks.cssClass) {
24245
24268
  ganttPropKey = 'cssClass';
24246
24269
  }
24270
+ else if (key === tasks.milestone) {
24271
+ ganttPropKey = 'isMilestone';
24272
+ if (!isNullOrUndefined(tasks.duration)) {
24273
+ const ganttProp = ganttData.ganttProperties;
24274
+ let durationValue = data[tasks.duration];
24275
+ if (value) {
24276
+ durationValue = 0;
24277
+ }
24278
+ else {
24279
+ durationValue = durationValue <= 0 ? 1 : durationValue;
24280
+ }
24281
+ ganttObj.setRecordValue(tasks.duration, durationValue, ganttData, true);
24282
+ ganttObj.setRecordValue('duration', durationValue, ganttProp, true);
24283
+ ganttObj.setRecordValue('taskData.' + tasks.duration, durationValue, ganttData);
24284
+ }
24285
+ }
24247
24286
  else if ((key === tasks.segments) && (!isNullOrUndefined(ganttData.ganttProperties.segments))) {
24248
24287
  ganttPropKey = 'segments';
24249
24288
  /* eslint-disable-next-line */
@@ -26631,6 +26670,57 @@ class Edit$2 {
26631
26670
  }
26632
26671
  }
26633
26672
  }
26673
+ /**
26674
+ * Method to update the values to client side from server side.
26675
+ *
26676
+ * @param {Object} e - Defines the new modified data from the server.
26677
+ * @param {ITaskAddedEventArgs} args - Defines the client side data.
26678
+ * @returns {void} .
26679
+ */
26680
+ updateClientDataFromServer(e, args) {
26681
+ const serverReturnedValue = e.addedRecords[0];
26682
+ const _aLength = Object.keys(serverReturnedValue).length;
26683
+ for (let j = 0, _a = Object.keys(serverReturnedValue); j < _aLength; j++) {
26684
+ let key = _a[parseInt(j.toString(), 10)];
26685
+ args.data[`${key}`] = serverReturnedValue[`${key}`];
26686
+ }
26687
+ if (this.parent.taskFields.id !== null) {
26688
+ args.data.ganttProperties['taskId'] = serverReturnedValue[this.parent.taskFields.id];
26689
+ }
26690
+ if (this.parent.taskFields.name !== null) {
26691
+ args.data.ganttProperties['taskName'] = serverReturnedValue[this.parent.taskFields.name];
26692
+ }
26693
+ if (this.parent.taskFields.startDate !== null) {
26694
+ args.data.ganttProperties['startDate'] = serverReturnedValue[this.parent.taskFields.startDate];
26695
+ }
26696
+ if (this.parent.taskFields.endDate !== null) {
26697
+ args.data.ganttProperties['endDate'] = serverReturnedValue[this.parent.taskFields.endDate];
26698
+ }
26699
+ if (this.parent.taskFields.duration !== null) {
26700
+ args.data.ganttProperties['duration'] = parseInt(serverReturnedValue[this.parent.taskFields.duration]);
26701
+ }
26702
+ if (this.parent.taskFields.durationUnit !== null) {
26703
+ args.data.ganttProperties['durationUnit'] = serverReturnedValue[this.parent.taskFields.durationUnit];
26704
+ }
26705
+ if (this.parent.taskFields.progress !== null) {
26706
+ args.data.ganttProperties['progress'] = serverReturnedValue[this.parent.taskFields.progress];
26707
+ }
26708
+ if (this.parent.taskFields.dependency !== null) {
26709
+ args.data.ganttProperties['dependency'] = serverReturnedValue[this.parent.taskFields.dependency];
26710
+ }
26711
+ if (this.parent.taskFields.parentID !== null) {
26712
+ args.data.ganttProperties['parentID'] = serverReturnedValue[this.parent.taskFields.parentID];
26713
+ }
26714
+ if (this.parent.taskFields.baselineEndDate !== null) {
26715
+ args.data.ganttProperties['baselineEndDate'] = serverReturnedValue[this.parent.taskFields.baselineEndDate];
26716
+ }
26717
+ if (this.parent.taskFields.baselineStartDate !== null) {
26718
+ args.data.ganttProperties['baselineStartDate'] = serverReturnedValue[this.parent.taskFields.baselineStartDate];
26719
+ }
26720
+ if (this.parent.taskFields.resourceInfo !== null) {
26721
+ args.data.ganttProperties['resources'] = serverReturnedValue[this.parent.taskFields.resourceInfo];
26722
+ }
26723
+ }
26634
26724
  /**
26635
26725
  * Method to add new record.
26636
26726
  *
@@ -26691,7 +26781,8 @@ class Edit$2 {
26691
26781
  /* tslint:disable-next-line */
26692
26782
  const query = this.parent.query instanceof Query ? this.parent.query : new Query();
26693
26783
  const adaptor = data.adaptor;
26694
- if (!(adaptor instanceof WebApiAdaptor && adaptor instanceof ODataAdaptor && adaptor instanceof ODataV4Adaptor) || data.dataSource.batchUrl) {
26784
+ const moduleName = adaptor.getModuleName();
26785
+ if (!(moduleName == "WebApiAdaptor" || moduleName == "ODataAdaptor" || moduleName == "ODataV4Adaptor") || data.dataSource.batchUrl) {
26695
26786
  /* tslint:disable-next-line */
26696
26787
  const crud = data.saveChanges(updatedData, this.parent.taskFields.id, null, query);
26697
26788
  crud.then((e) => {
@@ -26701,6 +26792,7 @@ class Edit$2 {
26701
26792
  this.parent.setRecordValue('taskData', e.addedRecords[0], args.data);
26702
26793
  this.parent.setRecordValue(this.parent.taskFields.id, e.addedRecords[0][this.parent.taskFields.id], args.data);
26703
26794
  this.parent.setRecordValue('rowUniqueID', e.addedRecords[0][this.parent.taskFields.id].toString(), args.data.ganttProperties, true);
26795
+ this.updateClientDataFromServer(e, args);
26704
26796
  const idsIndex = this.parent.ids.indexOf(prevID);
26705
26797
  if (idsIndex !== -1) {
26706
26798
  this.parent.ids[idsIndex] = e.addedRecords[0][this.parent.taskFields.id].toString();
@@ -27993,6 +28085,9 @@ class Filter$1 {
27993
28085
  break;
27994
28086
  }
27995
28087
  if (!isNullOrUndefined(this.parent.element.parentNode)) {
28088
+ if (parentNode.parentNode instanceof HTMLDocument) {
28089
+ break;
28090
+ }
27996
28091
  parentNode = parentNode.parentNode;
27997
28092
  marginLeft = parentNode.style.marginLeft;
27998
28093
  }
@@ -30387,6 +30482,8 @@ class CriticalPath {
30387
30482
  }
30388
30483
  if (element.getElementsByClassName('e-gantt-child-taskbar-inner-div').length > 0) {
30389
30484
  addClass(element.querySelectorAll('.e-gantt-child-taskbar-inner-div'), criticalChildTaskBarInnerDiv);
30485
+ const innerDivs = document.querySelector('.e-gantt-child-taskbar-inner-div');
30486
+ innerDivs.style.outlineColor = "";
30390
30487
  }
30391
30488
  if (element.getElementsByClassName('e-gantt-child-progressbar-inner-div').length > 0) {
30392
30489
  addClass(element.querySelectorAll('.e-gantt-child-progressbar-inner-div'), taskClass);
@@ -30606,7 +30703,7 @@ class ContextMenu$2 {
30606
30703
  taskfields = this.parent.taskFields;
30607
30704
  if (!isNullOrUndefined(taskfields.duration)) {
30608
30705
  const ganttProp = this.rowData.ganttProperties;
30609
- data[taskfields.duration] = '1 ' + ganttProp.durationUnit;
30706
+ data[taskfields.duration] = data[taskfields.duration] <= 0 ? 1 : data[taskfields.duration];
30610
30707
  }
30611
30708
  else {
30612
30709
  data[taskfields.startDate] = new Date(this.rowData.taskData[taskfields.startDate]);
@@ -30619,6 +30716,9 @@ class ContextMenu$2 {
30619
30716
  data[taskfields.milestone] = false;
30620
30717
  }
30621
30718
  }
30719
+ if (data[taskfields.startDate]) {
30720
+ this.parent.setRecordValue(taskfields.startDate, this.rowData.ganttProperties.startDate, data, true);
30721
+ }
30622
30722
  this.parent.updateRecordByID(data);
30623
30723
  }
30624
30724
  break;
@@ -33051,7 +33151,10 @@ class PdfTreeGridLayouter extends ElementLayouter {
33051
33151
  row.cells.getCell(i + j).isCellMergeContinue = true;
33052
33152
  }
33053
33153
  }
33054
- const size = new SizeF(column.width, height);
33154
+ let size = new SizeF(column.width, height);
33155
+ if (cell.columnSpan > 1) {
33156
+ size = new SizeF(cell.width, height);
33157
+ }
33055
33158
  if (!this.checkIfDefaultFormat(column.format) && this.checkIfDefaultFormat(cell.style.format)) {
33056
33159
  cell.style.format = column.format;
33057
33160
  }
@@ -33473,12 +33576,15 @@ class PdfTreeGrid extends PdfLayoutElement {
33473
33576
  colSpan = cell.columnSpan;
33474
33577
  currentCellIndex = j;
33475
33578
  cell.isCellMergeStart = true;
33579
+ let totalColumnWidth = this.columns.columns[currentCellIndex].width;
33476
33580
  //set Column merges.
33477
33581
  while (colSpan > 1) {
33478
33582
  currentCellIndex++;
33479
33583
  row.cells.getCell(currentCellIndex).isCellMergeContinue = true;
33480
33584
  colSpan--;
33585
+ totalColumnWidth += this.columns.columns[currentCellIndex].width;
33481
33586
  }
33587
+ cell.width = totalColumnWidth;
33482
33588
  }
33483
33589
  else if (cell.columnSpan === 1 && cell.rowSpan > 1) {
33484
33590
  rowSpan = cell.rowSpan;
@@ -34713,7 +34819,8 @@ class ExportHelper {
34713
34819
  row.height = pixelToPoint(this.parent.rowHeight);
34714
34820
  this.copyStyles(this.ganttStyle.columnHeader, row.cells.getCell(0), row.isParentRow);
34715
34821
  const count = this.columns.length;
34716
- this.mergeCells(0, 0, count);
34822
+ row.cells.getCell(0).value = this.parent.localeObj.getConstant('emptyRecord');
34823
+ this.mergeCells(1, 0, count);
34717
34824
  }
34718
34825
  mergeCells(rowIndex, colIndex, lastColIndex) {
34719
34826
  this.gantt.rows.getRow(rowIndex).cells.getCell(colIndex).columnSpan = lastColIndex;