@syncfusion/ej2-gantt 20.4.52 → 20.4.53

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.
@@ -7148,7 +7148,13 @@ class GanttTreeGrid {
7148
7148
  this.parent.treeGrid.allowKeyboard = this.parent.allowKeyboard;
7149
7149
  this.parent.treeGrid.enableImmutableMode = this.parent.enableImmutableMode;
7150
7150
  this.treeGridColumns = [];
7151
+ if (!this.parent.isLocaleChanged && this.parent.isLoad) {
7152
+ this.parent.previousGanttColumns = extend([], [], this.parent.columns, true);
7153
+ }
7151
7154
  this.validateGanttColumns();
7155
+ if (this.parent.isLocaleChanged) {
7156
+ this.parent.isLocaleChanged = false;
7157
+ }
7152
7158
  this.addEventListener();
7153
7159
  }
7154
7160
  addEventListener() {
@@ -7566,6 +7572,9 @@ class GanttTreeGrid {
7566
7572
  */
7567
7573
  createTreeGridColumn(column, isDefined) {
7568
7574
  const taskSettings = this.parent.taskFields;
7575
+ let previousColumn = this.parent.previousGanttColumns.filter((prevcolumn) => {
7576
+ return column.field == prevcolumn.field;
7577
+ })[0];
7569
7578
  column.disableHtmlEncode = !isNullOrUndefined(column.disableHtmlEncode) ? column.disableHtmlEncode : this.parent.disableHtmlEncode;
7570
7579
  if (taskSettings.id !== column.field) {
7571
7580
  column.clipMode = column.clipMode ? column.clipMode : 'EllipsisWithTooltip';
@@ -7576,14 +7585,24 @@ class GanttTreeGrid {
7576
7585
  }
7577
7586
  else if (taskSettings.name === column.field) {
7578
7587
  /** Name column */
7579
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('name');
7588
+ if (this.parent.isLocaleChanged && previousColumn) {
7589
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('name');
7590
+ }
7591
+ else {
7592
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('name');
7593
+ }
7580
7594
  column.width = column.width ? column.width : 150;
7581
7595
  column.editType = column.editType ? column.editType : 'stringedit';
7582
7596
  column.type = column.type ? column.type : 'string';
7583
7597
  }
7584
7598
  else if (taskSettings.startDate === column.field) {
7585
7599
  /** Name column */
7586
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('startDate');
7600
+ if (this.parent.isLocaleChanged && previousColumn) {
7601
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('startDate');
7602
+ }
7603
+ else {
7604
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('startDate');
7605
+ }
7587
7606
  column.editType = column.editType ? column.editType :
7588
7607
  this.parent.getDateFormat().toLowerCase().indexOf('hh') !== -1 ? 'datetimepickeredit' : 'datepickeredit';
7589
7608
  column.format = column.format ? column.format : { type: 'date', format: this.parent.getDateFormat() };
@@ -7591,7 +7610,12 @@ class GanttTreeGrid {
7591
7610
  column.edit = { params: { renderDayCell: this.parent.renderWorkingDayCell.bind(this.parent) } };
7592
7611
  }
7593
7612
  else if (taskSettings.endDate === column.field) {
7594
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('endDate');
7613
+ if (this.parent.isLocaleChanged && previousColumn) {
7614
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('endDate');
7615
+ }
7616
+ else {
7617
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('endDate');
7618
+ }
7595
7619
  column.format = column.format ? column.format : { type: 'date', format: this.parent.getDateFormat() };
7596
7620
  column.editType = column.editType ? column.editType :
7597
7621
  this.parent.getDateFormat().toLowerCase().indexOf('hh') !== -1 ? 'datetimepickeredit' : 'datepickeredit';
@@ -7600,7 +7624,12 @@ class GanttTreeGrid {
7600
7624
  }
7601
7625
  else if (taskSettings.duration === column.field) {
7602
7626
  column.width = column.width ? column.width : 150;
7603
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('duration');
7627
+ if (this.parent.isLocaleChanged && previousColumn) {
7628
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('duration');
7629
+ }
7630
+ else {
7631
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('duration');
7632
+ }
7604
7633
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : !isNullOrUndefined(column.edit) ? null :
7605
7634
  this.durationValueAccessor.bind(this);
7606
7635
  column.editType = column.editType ? column.editType : 'stringedit';
@@ -7610,7 +7639,12 @@ class GanttTreeGrid {
7610
7639
  this.composeProgressColumn(column);
7611
7640
  }
7612
7641
  else if (taskSettings.dependency === column.field) {
7613
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('dependency');
7642
+ if (this.parent.isLocaleChanged && previousColumn) {
7643
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('dependency');
7644
+ }
7645
+ else {
7646
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('dependency');
7647
+ }
7614
7648
  column.width = column.width ? column.width : 150;
7615
7649
  column.editType = column.editType ? column.editType : 'stringedit';
7616
7650
  column.type = 'string';
@@ -7620,7 +7654,12 @@ class GanttTreeGrid {
7620
7654
  this.composeResourceColumn(column);
7621
7655
  }
7622
7656
  else if (taskSettings.notes === column.field) {
7623
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('notes');
7657
+ if (this.parent.isLocaleChanged && previousColumn) {
7658
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('notes');
7659
+ }
7660
+ else {
7661
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('notes');
7662
+ }
7624
7663
  column.width = column.width ? column.width : 150;
7625
7664
  column.editType = column.editType ? column.editType : 'stringedit';
7626
7665
  if (!this.parent.showInlineNotes) {
@@ -7635,26 +7674,46 @@ class GanttTreeGrid {
7635
7674
  const colName = (taskSettings.baselineEndDate === column.field) ? 'baselineEndDate' :
7636
7675
  'baselineStartDate';
7637
7676
  column.width = column.width ? column.width : 150;
7638
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant(colName);
7677
+ if (this.parent.isLocaleChanged && previousColumn) {
7678
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant(colName);
7679
+ }
7680
+ else {
7681
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant(colName);
7682
+ }
7639
7683
  column.format = column.format ? column.format : { type: 'date', format: this.parent.getDateFormat() };
7640
7684
  column.editType = column.editType ? column.editType :
7641
7685
  this.parent.getDateFormat().toLowerCase().indexOf('hh') !== -1 ? 'datetimepickeredit' : 'datepickeredit';
7642
7686
  }
7643
7687
  else if (taskSettings.work === column.field) {
7644
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('work');
7688
+ if (this.parent.isLocaleChanged && previousColumn) {
7689
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('work');
7690
+ }
7691
+ else {
7692
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('work');
7693
+ }
7645
7694
  column.width = column.width ? column.width : 150;
7646
7695
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.workValueAccessor.bind(this);
7647
7696
  column.editType = column.editType ? column.editType : 'numericedit';
7648
7697
  }
7649
7698
  else if (taskSettings.type === column.field) {
7650
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('taskType');
7699
+ if (this.parent.isLocaleChanged && previousColumn) {
7700
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('taskType');
7701
+ }
7702
+ else {
7703
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('taskType');
7704
+ }
7651
7705
  column.width = column.width ? column.width : 150;
7652
7706
  //column.type = 'string';
7653
7707
  column.editType = 'dropdownedit';
7654
7708
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.taskTypeValueAccessor.bind(this);
7655
7709
  }
7656
7710
  else if (taskSettings.manual === column.field && this.parent.taskMode === 'Custom') {
7657
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('taskMode');
7711
+ if (this.parent.isLocaleChanged && previousColumn) {
7712
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('taskMode');
7713
+ }
7714
+ else {
7715
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('taskMode');
7716
+ }
7658
7717
  column.width = column.width ? column.width : 120;
7659
7718
  column.editType = column.editType ? column.editType : 'dropdownedit';
7660
7719
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.modeValueAccessor.bind(this);
@@ -7678,7 +7737,15 @@ class GanttTreeGrid {
7678
7737
  * @returns {void} .
7679
7738
  */
7680
7739
  composeResourceColumn(column) {
7681
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('resourceName');
7740
+ let previousColumn = this.parent.previousGanttColumns.filter((prevcolumn) => {
7741
+ return column.field == prevcolumn.field;
7742
+ })[0];
7743
+ if (this.parent.isLocaleChanged && previousColumn) {
7744
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('resourceName');
7745
+ }
7746
+ else {
7747
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('resourceName');
7748
+ }
7682
7749
  column.width = column.width ? column.width : 150;
7683
7750
  column.type = 'string';
7684
7751
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.resourceValueAccessor.bind(this);
@@ -7713,7 +7780,17 @@ class GanttTreeGrid {
7713
7780
  const lengthDataSource = this.parent.dataSource['length'];
7714
7781
  let taskIDName;
7715
7782
  column.isPrimaryKey = isProjectView ? true : false;
7716
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('id');
7783
+ if (this.parent.isLocaleChanged) {
7784
+ let previousColumn = this.parent.previousGanttColumns.filter((prevcolumn) => {
7785
+ return column.field == prevcolumn.field;
7786
+ })[0];
7787
+ if (previousColumn) {
7788
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('id');
7789
+ }
7790
+ }
7791
+ else {
7792
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('id');
7793
+ }
7717
7794
  column.width = column.width ? column.width : 100;
7718
7795
  for (let i = 0; i < lengthDataSource; i++) {
7719
7796
  if (!isNullOrUndefined(this.parent.dataSource[i][this.parent.taskFields.id])) {
@@ -7750,7 +7827,15 @@ class GanttTreeGrid {
7750
7827
  * @returns {void} .
7751
7828
  */
7752
7829
  composeProgressColumn(column) {
7753
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('progress');
7830
+ let previousColumn = this.parent.previousGanttColumns.filter((prevcolumn) => {
7831
+ return column.field == prevcolumn.field;
7832
+ })[0];
7833
+ if (this.parent.isLocaleChanged && previousColumn) {
7834
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('progress');
7835
+ }
7836
+ else {
7837
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('progress');
7838
+ }
7754
7839
  column.width = column.width ? column.width : 150;
7755
7840
  column.editType = column.editType ? column.editType : 'numericedit';
7756
7841
  }
@@ -9651,7 +9736,7 @@ class ChartRows extends DateProcessor {
9651
9736
  for (let i = 0; i < this.parent.currentViewData.length; i++) {
9652
9737
  const tempTemplateData = this.parent.currentViewData[i];
9653
9738
  if (this.parent.viewType === 'ResourceView') {
9654
- if (this.parent.editModule && this.parent.editModule.isResourceTaskDeleted) {
9739
+ if (this.parent.editModule && this.parent.editModule.isResourceTaskDeleted || this.parent.isFromOnPropertyChange) {
9655
9740
  this.parent.initialChartRowElements = this.parent.ganttChartModule.getChartRows();
9656
9741
  this.parent.editModule.isResourceTaskDeleted = false;
9657
9742
  }
@@ -10162,7 +10247,10 @@ class ChartRows extends DateProcessor {
10162
10247
  addClass([cloneElement], 'collpse-parent-border');
10163
10248
  const id = chartRows[i].querySelector('.' + taskBarMainContainer).getAttribute('rowUniqueId');
10164
10249
  const ganttData = this.parent.getRecordByID(id);
10165
- const zIndex = (ganttData.ganttProperties.eOverlapIndex).toString();
10250
+ let zIndex = "";
10251
+ if (ganttData && ganttData.ganttProperties.eOverlapIndex) {
10252
+ zIndex = (ganttData.ganttProperties.eOverlapIndex).toString();
10253
+ }
10166
10254
  const cloneChildElement = cloneElement.cloneNode(true);
10167
10255
  cloneChildElement.style.zIndex = zIndex;
10168
10256
  parentTrNode[0].childNodes[0].childNodes[0].childNodes[0].appendChild(cloneChildElement);
@@ -13024,6 +13112,7 @@ let Gantt = class Gantt extends Component {
13024
13112
  super(options, element);
13025
13113
  this.showIndicator = true;
13026
13114
  this.singleTier = 0;
13115
+ this.isLocaleChanged = false;
13027
13116
  /** @hidden */
13028
13117
  this.isCancelled = false;
13029
13118
  /** @hidden */
@@ -14449,6 +14538,9 @@ let Gantt = class Gantt extends Component {
14449
14538
  case 'enableRtl':
14450
14539
  case 'readOnly':
14451
14540
  case 'viewType':
14541
+ if (prop === 'locale') {
14542
+ this.isLocaleChanged = true;
14543
+ }
14452
14544
  isRefresh = true;
14453
14545
  break;
14454
14546
  case 'validateManualTasksOnLinking':
@@ -22363,7 +22455,7 @@ class ConnectorLineEdit {
22363
22455
  this.parent.chartRowsModule.refreshRecords([args.data]);
22364
22456
  }
22365
22457
  else if (args.validateMode.removeLink) {
22366
- this.removePredecessors(ganttRecord, this.validationPredecessor);
22458
+ this.checkChildRecords(ganttRecord);
22367
22459
  this.parent.editModule.updateEditedTask(args.editEventArgs);
22368
22460
  }
22369
22461
  else if (args.validateMode.preserveLinkWithEditing) {
@@ -22371,6 +22463,29 @@ class ConnectorLineEdit {
22371
22463
  this.parent.editModule.updateEditedTask(args.editEventArgs);
22372
22464
  }
22373
22465
  }
22466
+ checkChildRecords(ganttRecord) {
22467
+ this.validationPredecessor = ganttRecord.ganttProperties.predecessor;
22468
+ if (!isNullOrUndefined(this.validationPredecessor)) {
22469
+ this.removePredecessors(ganttRecord, this.validationPredecessor);
22470
+ }
22471
+ if (ganttRecord.childRecords.length > 0) {
22472
+ for (let i = 0; i < ganttRecord.childRecords.length; i++) {
22473
+ let childRecord = ganttRecord.childRecords[i];
22474
+ this.validationPredecessor = childRecord.ganttProperties.predecessor;
22475
+ if (!isNullOrUndefined(this.validationPredecessor)) {
22476
+ this.removePredecessors(childRecord, this.validationPredecessor);
22477
+ }
22478
+ if (childRecord.childRecords.length > 0) {
22479
+ this.checkChildRecords(childRecord);
22480
+ }
22481
+ }
22482
+ }
22483
+ else if (!isNullOrUndefined(ganttRecord.parentItem)) {
22484
+ let parentRecord = this.parent.getRecordByID(ganttRecord.parentItem.taskId);
22485
+ this.validationPredecessor = parentRecord.ganttProperties.predecessor;
22486
+ this.removePredecessors(parentRecord, this.validationPredecessor);
22487
+ }
22488
+ }
22374
22489
  calculateOffset(record) {
22375
22490
  const prevPredecessor = extend([], record.ganttProperties.predecessor, [], true);
22376
22491
  const validPredecessor = this.parent.predecessorModule.getValidPredecessor(record);
@@ -22446,6 +22561,9 @@ class ConnectorLineEdit {
22446
22561
  */
22447
22562
  removePredecessors(ganttRecord, predecessor) {
22448
22563
  const prevPredecessor = extend([], [], ganttRecord.ganttProperties.predecessor, true);
22564
+ if (isNullOrUndefined(predecessor)) {
22565
+ return;
22566
+ }
22449
22567
  const preLength = predecessor.length;
22450
22568
  for (let i = 0; i < preLength; i++) {
22451
22569
  const parentGanttRecord = this.parent.connectorLineModule.getRecordByID(predecessor[i].from);
@@ -22541,14 +22659,20 @@ class ConnectorLineEdit {
22541
22659
  * @returns {boolean} .
22542
22660
  * @private
22543
22661
  */
22544
- validateTypes(ganttRecord) {
22662
+ validateTypes(ganttRecord, data) {
22545
22663
  const predecessor = this.parent.predecessorModule.getValidPredecessor(ganttRecord);
22546
22664
  let parentGanttRecord;
22665
+ let ganttTaskData;
22547
22666
  this.validationPredecessor = [];
22548
22667
  let violatedParent;
22549
22668
  let violateType;
22550
22669
  const startDate = this.parent.predecessorModule.getPredecessorDate(ganttRecord, predecessor);
22551
- const ganttTaskData = ganttRecord.ganttProperties;
22670
+ if (data) {
22671
+ ganttTaskData = data.ganttProperties;
22672
+ }
22673
+ else {
22674
+ ganttTaskData = ganttRecord.ganttProperties;
22675
+ }
22552
22676
  const endDate = this.parent.allowUnscheduledTasks && isNullOrUndefined(startDate) ?
22553
22677
  ganttTaskData.endDate :
22554
22678
  this.dateValidateModule.getEndDate(startDate, ganttTaskData.duration, ganttTaskData.durationUnit, ganttTaskData, false);
@@ -23429,7 +23553,30 @@ class Edit$2 {
23429
23553
  * @private
23430
23554
  */
23431
23555
  initiateUpdateAction(args) {
23432
- const isValidatePredecessor = this.isCheckPredecessor(args.data);
23556
+ let isValidatePredecessor = this.isCheckPredecessor(args.data);
23557
+ let parentData;
23558
+ let childRecordIndex;
23559
+ if (!isNullOrUndefined(args.data.parentItem) && !isValidatePredecessor) {
23560
+ parentData = this.parent.getRecordByID(args.data.parentItem.taskId);
23561
+ if (this.isTaskbarMoved(args.data) && this.parent.predecessorModule.getValidPredecessor(parentData).length > 0
23562
+ && this.parent.isInPredecessorValidation) {
23563
+ isValidatePredecessor = true;
23564
+ }
23565
+ else {
23566
+ isValidatePredecessor = false;
23567
+ }
23568
+ }
23569
+ else if (args.data.childRecords.length > 0 && !isValidatePredecessor) {
23570
+ isValidatePredecessor = this.isCheckPredecessor(args.data);
23571
+ if (!isValidatePredecessor && this.isTaskbarMoved(args.data)) {
23572
+ for (var i = 0; i < args.data.childRecords.length; i++) {
23573
+ if (this.parent.predecessorModule.getValidPredecessor(args.data.childRecords[i]).length > 0) {
23574
+ childRecordIndex = i;
23575
+ isValidatePredecessor = true;
23576
+ }
23577
+ }
23578
+ }
23579
+ }
23433
23580
  this.taskbarMoved = this.isTaskbarMoved(args.data);
23434
23581
  this.predecessorUpdated = this.isPredecessorUpdated(args.data);
23435
23582
  if (this.predecessorUpdated) {
@@ -23438,7 +23585,15 @@ class Edit$2 {
23438
23585
  }
23439
23586
  let validateObject = {};
23440
23587
  if (isValidatePredecessor) {
23441
- validateObject = this.parent.connectorLineEditModule.validateTypes(args.data);
23588
+ if (!isNullOrUndefined(parentData)) {
23589
+ validateObject = this.parent.connectorLineEditModule.validateTypes(parentData, args.data);
23590
+ }
23591
+ else if (!isNullOrUndefined(childRecordIndex)) {
23592
+ validateObject = this.parent.connectorLineEditModule.validateTypes(args.data.childRecords[childRecordIndex], args.data);
23593
+ }
23594
+ else {
23595
+ validateObject = this.parent.connectorLineEditModule.validateTypes(args.data);
23596
+ }
23442
23597
  this.parent.isConnectorLineUpdate = true;
23443
23598
  if (!isNullOrUndefined(getValue('violationType', validateObject))) {
23444
23599
  const newArgs = this.validateTaskEvent(args);