@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.
@@ -7217,7 +7217,13 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7217
7217
  this.parent.treeGrid.allowKeyboard = this.parent.allowKeyboard;
7218
7218
  this.parent.treeGrid.enableImmutableMode = this.parent.enableImmutableMode;
7219
7219
  this.treeGridColumns = [];
7220
+ if (!this.parent.isLocaleChanged && this.parent.isLoad) {
7221
+ this.parent.previousGanttColumns = extend([], [], this.parent.columns, true);
7222
+ }
7220
7223
  this.validateGanttColumns();
7224
+ if (this.parent.isLocaleChanged) {
7225
+ this.parent.isLocaleChanged = false;
7226
+ }
7221
7227
  this.addEventListener();
7222
7228
  }
7223
7229
  GanttTreeGrid.prototype.addEventListener = function () {
@@ -7639,6 +7645,9 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7639
7645
  */
7640
7646
  GanttTreeGrid.prototype.createTreeGridColumn = function (column, isDefined) {
7641
7647
  var taskSettings = this.parent.taskFields;
7648
+ var previousColumn = this.parent.previousGanttColumns.filter(function (prevcolumn) {
7649
+ return column.field == prevcolumn.field;
7650
+ })[0];
7642
7651
  column.disableHtmlEncode = !isNullOrUndefined(column.disableHtmlEncode) ? column.disableHtmlEncode : this.parent.disableHtmlEncode;
7643
7652
  if (taskSettings.id !== column.field) {
7644
7653
  column.clipMode = column.clipMode ? column.clipMode : 'EllipsisWithTooltip';
@@ -7649,14 +7658,24 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7649
7658
  }
7650
7659
  else if (taskSettings.name === column.field) {
7651
7660
  /** Name column */
7652
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('name');
7661
+ if (this.parent.isLocaleChanged && previousColumn) {
7662
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('name');
7663
+ }
7664
+ else {
7665
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('name');
7666
+ }
7653
7667
  column.width = column.width ? column.width : 150;
7654
7668
  column.editType = column.editType ? column.editType : 'stringedit';
7655
7669
  column.type = column.type ? column.type : 'string';
7656
7670
  }
7657
7671
  else if (taskSettings.startDate === column.field) {
7658
7672
  /** Name column */
7659
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('startDate');
7673
+ if (this.parent.isLocaleChanged && previousColumn) {
7674
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('startDate');
7675
+ }
7676
+ else {
7677
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('startDate');
7678
+ }
7660
7679
  column.editType = column.editType ? column.editType :
7661
7680
  this.parent.getDateFormat().toLowerCase().indexOf('hh') !== -1 ? 'datetimepickeredit' : 'datepickeredit';
7662
7681
  column.format = column.format ? column.format : { type: 'date', format: this.parent.getDateFormat() };
@@ -7664,7 +7683,12 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7664
7683
  column.edit = { params: { renderDayCell: this.parent.renderWorkingDayCell.bind(this.parent) } };
7665
7684
  }
7666
7685
  else if (taskSettings.endDate === column.field) {
7667
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('endDate');
7686
+ if (this.parent.isLocaleChanged && previousColumn) {
7687
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('endDate');
7688
+ }
7689
+ else {
7690
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('endDate');
7691
+ }
7668
7692
  column.format = column.format ? column.format : { type: 'date', format: this.parent.getDateFormat() };
7669
7693
  column.editType = column.editType ? column.editType :
7670
7694
  this.parent.getDateFormat().toLowerCase().indexOf('hh') !== -1 ? 'datetimepickeredit' : 'datepickeredit';
@@ -7673,7 +7697,12 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7673
7697
  }
7674
7698
  else if (taskSettings.duration === column.field) {
7675
7699
  column.width = column.width ? column.width : 150;
7676
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('duration');
7700
+ if (this.parent.isLocaleChanged && previousColumn) {
7701
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('duration');
7702
+ }
7703
+ else {
7704
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('duration');
7705
+ }
7677
7706
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : !isNullOrUndefined(column.edit) ? null :
7678
7707
  this.durationValueAccessor.bind(this);
7679
7708
  column.editType = column.editType ? column.editType : 'stringedit';
@@ -7683,7 +7712,12 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7683
7712
  this.composeProgressColumn(column);
7684
7713
  }
7685
7714
  else if (taskSettings.dependency === column.field) {
7686
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('dependency');
7715
+ if (this.parent.isLocaleChanged && previousColumn) {
7716
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('dependency');
7717
+ }
7718
+ else {
7719
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('dependency');
7720
+ }
7687
7721
  column.width = column.width ? column.width : 150;
7688
7722
  column.editType = column.editType ? column.editType : 'stringedit';
7689
7723
  column.type = 'string';
@@ -7693,7 +7727,12 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7693
7727
  this.composeResourceColumn(column);
7694
7728
  }
7695
7729
  else if (taskSettings.notes === column.field) {
7696
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('notes');
7730
+ if (this.parent.isLocaleChanged && previousColumn) {
7731
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('notes');
7732
+ }
7733
+ else {
7734
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('notes');
7735
+ }
7697
7736
  column.width = column.width ? column.width : 150;
7698
7737
  column.editType = column.editType ? column.editType : 'stringedit';
7699
7738
  if (!this.parent.showInlineNotes) {
@@ -7708,26 +7747,46 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7708
7747
  var colName = (taskSettings.baselineEndDate === column.field) ? 'baselineEndDate' :
7709
7748
  'baselineStartDate';
7710
7749
  column.width = column.width ? column.width : 150;
7711
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant(colName);
7750
+ if (this.parent.isLocaleChanged && previousColumn) {
7751
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant(colName);
7752
+ }
7753
+ else {
7754
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant(colName);
7755
+ }
7712
7756
  column.format = column.format ? column.format : { type: 'date', format: this.parent.getDateFormat() };
7713
7757
  column.editType = column.editType ? column.editType :
7714
7758
  this.parent.getDateFormat().toLowerCase().indexOf('hh') !== -1 ? 'datetimepickeredit' : 'datepickeredit';
7715
7759
  }
7716
7760
  else if (taskSettings.work === column.field) {
7717
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('work');
7761
+ if (this.parent.isLocaleChanged && previousColumn) {
7762
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('work');
7763
+ }
7764
+ else {
7765
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('work');
7766
+ }
7718
7767
  column.width = column.width ? column.width : 150;
7719
7768
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.workValueAccessor.bind(this);
7720
7769
  column.editType = column.editType ? column.editType : 'numericedit';
7721
7770
  }
7722
7771
  else if (taskSettings.type === column.field) {
7723
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('taskType');
7772
+ if (this.parent.isLocaleChanged && previousColumn) {
7773
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('taskType');
7774
+ }
7775
+ else {
7776
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('taskType');
7777
+ }
7724
7778
  column.width = column.width ? column.width : 150;
7725
7779
  //column.type = 'string';
7726
7780
  column.editType = 'dropdownedit';
7727
7781
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.taskTypeValueAccessor.bind(this);
7728
7782
  }
7729
7783
  else if (taskSettings.manual === column.field && this.parent.taskMode === 'Custom') {
7730
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('taskMode');
7784
+ if (this.parent.isLocaleChanged && previousColumn) {
7785
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('taskMode');
7786
+ }
7787
+ else {
7788
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('taskMode');
7789
+ }
7731
7790
  column.width = column.width ? column.width : 120;
7732
7791
  column.editType = column.editType ? column.editType : 'dropdownedit';
7733
7792
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.modeValueAccessor.bind(this);
@@ -7751,7 +7810,15 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7751
7810
  * @returns {void} .
7752
7811
  */
7753
7812
  GanttTreeGrid.prototype.composeResourceColumn = function (column) {
7754
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('resourceName');
7813
+ var previousColumn = this.parent.previousGanttColumns.filter(function (prevcolumn) {
7814
+ return column.field == prevcolumn.field;
7815
+ })[0];
7816
+ if (this.parent.isLocaleChanged && previousColumn) {
7817
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('resourceName');
7818
+ }
7819
+ else {
7820
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('resourceName');
7821
+ }
7755
7822
  column.width = column.width ? column.width : 150;
7756
7823
  column.type = 'string';
7757
7824
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.resourceValueAccessor.bind(this);
@@ -7786,7 +7853,17 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7786
7853
  var lengthDataSource = this.parent.dataSource['length'];
7787
7854
  var taskIDName;
7788
7855
  column.isPrimaryKey = isProjectView ? true : false;
7789
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('id');
7856
+ if (this.parent.isLocaleChanged) {
7857
+ var previousColumn = this.parent.previousGanttColumns.filter(function (prevcolumn) {
7858
+ return column.field == prevcolumn.field;
7859
+ })[0];
7860
+ if (previousColumn) {
7861
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('id');
7862
+ }
7863
+ }
7864
+ else {
7865
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('id');
7866
+ }
7790
7867
  column.width = column.width ? column.width : 100;
7791
7868
  for (var i = 0; i < lengthDataSource; i++) {
7792
7869
  if (!isNullOrUndefined(this.parent.dataSource[i][this.parent.taskFields.id])) {
@@ -7823,7 +7900,15 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
7823
7900
  * @returns {void} .
7824
7901
  */
7825
7902
  GanttTreeGrid.prototype.composeProgressColumn = function (column) {
7826
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('progress');
7903
+ var previousColumn = this.parent.previousGanttColumns.filter(function (prevcolumn) {
7904
+ return column.field == prevcolumn.field;
7905
+ })[0];
7906
+ if (this.parent.isLocaleChanged && previousColumn) {
7907
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('progress');
7908
+ }
7909
+ else {
7910
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('progress');
7911
+ }
7827
7912
  column.width = column.width ? column.width : 150;
7828
7913
  column.editType = column.editType ? column.editType : 'numericedit';
7829
7914
  };
@@ -10057,7 +10142,7 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10057
10142
  for (var i = 0; i < this.parent.currentViewData.length; i++) {
10058
10143
  var tempTemplateData = this.parent.currentViewData[i];
10059
10144
  if (this.parent.viewType === 'ResourceView') {
10060
- if (this.parent.editModule && this.parent.editModule.isResourceTaskDeleted) {
10145
+ if (this.parent.editModule && this.parent.editModule.isResourceTaskDeleted || this.parent.isFromOnPropertyChange) {
10061
10146
  this.parent.initialChartRowElements = this.parent.ganttChartModule.getChartRows();
10062
10147
  this.parent.editModule.isResourceTaskDeleted = false;
10063
10148
  }
@@ -10569,7 +10654,10 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
10569
10654
  addClass([cloneElement], 'collpse-parent-border');
10570
10655
  var id = chartRows[i].querySelector('.' + taskBarMainContainer).getAttribute('rowUniqueId');
10571
10656
  var ganttData = this.parent.getRecordByID(id);
10572
- var zIndex = (ganttData.ganttProperties.eOverlapIndex).toString();
10657
+ var zIndex = "";
10658
+ if (ganttData && ganttData.ganttProperties.eOverlapIndex) {
10659
+ zIndex = (ganttData.ganttProperties.eOverlapIndex).toString();
10660
+ }
10573
10661
  var cloneChildElement = cloneElement.cloneNode(true);
10574
10662
  cloneChildElement.style.zIndex = zIndex;
10575
10663
  parentTrNode[0].childNodes[0].childNodes[0].childNodes[0].appendChild(cloneChildElement);
@@ -13455,6 +13543,7 @@ var Gantt = /** @__PURE__ @class */ (function (_super) {
13455
13543
  var _this = _super.call(this, options, element) || this;
13456
13544
  _this.showIndicator = true;
13457
13545
  _this.singleTier = 0;
13546
+ _this.isLocaleChanged = false;
13458
13547
  /** @hidden */
13459
13548
  _this.isCancelled = false;
13460
13549
  /** @hidden */
@@ -14884,6 +14973,9 @@ var Gantt = /** @__PURE__ @class */ (function (_super) {
14884
14973
  case 'enableRtl':
14885
14974
  case 'readOnly':
14886
14975
  case 'viewType':
14976
+ if (prop === 'locale') {
14977
+ this.isLocaleChanged = true;
14978
+ }
14887
14979
  isRefresh = true;
14888
14980
  break;
14889
14981
  case 'validateManualTasksOnLinking':
@@ -22882,7 +22974,7 @@ var ConnectorLineEdit = /** @__PURE__ @class */ (function () {
22882
22974
  this.parent.chartRowsModule.refreshRecords([args.data]);
22883
22975
  }
22884
22976
  else if (args.validateMode.removeLink) {
22885
- this.removePredecessors(ganttRecord, this.validationPredecessor);
22977
+ this.checkChildRecords(ganttRecord);
22886
22978
  this.parent.editModule.updateEditedTask(args.editEventArgs);
22887
22979
  }
22888
22980
  else if (args.validateMode.preserveLinkWithEditing) {
@@ -22890,6 +22982,29 @@ var ConnectorLineEdit = /** @__PURE__ @class */ (function () {
22890
22982
  this.parent.editModule.updateEditedTask(args.editEventArgs);
22891
22983
  }
22892
22984
  };
22985
+ ConnectorLineEdit.prototype.checkChildRecords = function (ganttRecord) {
22986
+ this.validationPredecessor = ganttRecord.ganttProperties.predecessor;
22987
+ if (!isNullOrUndefined(this.validationPredecessor)) {
22988
+ this.removePredecessors(ganttRecord, this.validationPredecessor);
22989
+ }
22990
+ if (ganttRecord.childRecords.length > 0) {
22991
+ for (var i = 0; i < ganttRecord.childRecords.length; i++) {
22992
+ var childRecord = ganttRecord.childRecords[i];
22993
+ this.validationPredecessor = childRecord.ganttProperties.predecessor;
22994
+ if (!isNullOrUndefined(this.validationPredecessor)) {
22995
+ this.removePredecessors(childRecord, this.validationPredecessor);
22996
+ }
22997
+ if (childRecord.childRecords.length > 0) {
22998
+ this.checkChildRecords(childRecord);
22999
+ }
23000
+ }
23001
+ }
23002
+ else if (!isNullOrUndefined(ganttRecord.parentItem)) {
23003
+ var parentRecord = this.parent.getRecordByID(ganttRecord.parentItem.taskId);
23004
+ this.validationPredecessor = parentRecord.ganttProperties.predecessor;
23005
+ this.removePredecessors(parentRecord, this.validationPredecessor);
23006
+ }
23007
+ };
22893
23008
  ConnectorLineEdit.prototype.calculateOffset = function (record) {
22894
23009
  var prevPredecessor = extend([], record.ganttProperties.predecessor, [], true);
22895
23010
  var validPredecessor = this.parent.predecessorModule.getValidPredecessor(record);
@@ -22965,6 +23080,9 @@ var ConnectorLineEdit = /** @__PURE__ @class */ (function () {
22965
23080
  */
22966
23081
  ConnectorLineEdit.prototype.removePredecessors = function (ganttRecord, predecessor) {
22967
23082
  var prevPredecessor = extend([], [], ganttRecord.ganttProperties.predecessor, true);
23083
+ if (isNullOrUndefined(predecessor)) {
23084
+ return;
23085
+ }
22968
23086
  var preLength = predecessor.length;
22969
23087
  for (var i = 0; i < preLength; i++) {
22970
23088
  var parentGanttRecord = this.parent.connectorLineModule.getRecordByID(predecessor[i].from);
@@ -23060,14 +23178,20 @@ var ConnectorLineEdit = /** @__PURE__ @class */ (function () {
23060
23178
  * @returns {boolean} .
23061
23179
  * @private
23062
23180
  */
23063
- ConnectorLineEdit.prototype.validateTypes = function (ganttRecord) {
23181
+ ConnectorLineEdit.prototype.validateTypes = function (ganttRecord, data) {
23064
23182
  var predecessor = this.parent.predecessorModule.getValidPredecessor(ganttRecord);
23065
23183
  var parentGanttRecord;
23184
+ var ganttTaskData;
23066
23185
  this.validationPredecessor = [];
23067
23186
  var violatedParent;
23068
23187
  var violateType;
23069
23188
  var startDate = this.parent.predecessorModule.getPredecessorDate(ganttRecord, predecessor);
23070
- var ganttTaskData = ganttRecord.ganttProperties;
23189
+ if (data) {
23190
+ ganttTaskData = data.ganttProperties;
23191
+ }
23192
+ else {
23193
+ ganttTaskData = ganttRecord.ganttProperties;
23194
+ }
23071
23195
  var endDate = this.parent.allowUnscheduledTasks && isNullOrUndefined(startDate) ?
23072
23196
  ganttTaskData.endDate :
23073
23197
  this.dateValidateModule.getEndDate(startDate, ganttTaskData.duration, ganttTaskData.durationUnit, ganttTaskData, false);
@@ -23952,6 +24076,29 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
23952
24076
  */
23953
24077
  Edit$$1.prototype.initiateUpdateAction = function (args) {
23954
24078
  var isValidatePredecessor = this.isCheckPredecessor(args.data);
24079
+ var parentData;
24080
+ var childRecordIndex;
24081
+ if (!isNullOrUndefined(args.data.parentItem) && !isValidatePredecessor) {
24082
+ parentData = this.parent.getRecordByID(args.data.parentItem.taskId);
24083
+ if (this.isTaskbarMoved(args.data) && this.parent.predecessorModule.getValidPredecessor(parentData).length > 0
24084
+ && this.parent.isInPredecessorValidation) {
24085
+ isValidatePredecessor = true;
24086
+ }
24087
+ else {
24088
+ isValidatePredecessor = false;
24089
+ }
24090
+ }
24091
+ else if (args.data.childRecords.length > 0 && !isValidatePredecessor) {
24092
+ isValidatePredecessor = this.isCheckPredecessor(args.data);
24093
+ if (!isValidatePredecessor && this.isTaskbarMoved(args.data)) {
24094
+ for (var i = 0; i < args.data.childRecords.length; i++) {
24095
+ if (this.parent.predecessorModule.getValidPredecessor(args.data.childRecords[i]).length > 0) {
24096
+ childRecordIndex = i;
24097
+ isValidatePredecessor = true;
24098
+ }
24099
+ }
24100
+ }
24101
+ }
23955
24102
  this.taskbarMoved = this.isTaskbarMoved(args.data);
23956
24103
  this.predecessorUpdated = this.isPredecessorUpdated(args.data);
23957
24104
  if (this.predecessorUpdated) {
@@ -23960,7 +24107,15 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
23960
24107
  }
23961
24108
  var validateObject = {};
23962
24109
  if (isValidatePredecessor) {
23963
- validateObject = this.parent.connectorLineEditModule.validateTypes(args.data);
24110
+ if (!isNullOrUndefined(parentData)) {
24111
+ validateObject = this.parent.connectorLineEditModule.validateTypes(parentData, args.data);
24112
+ }
24113
+ else if (!isNullOrUndefined(childRecordIndex)) {
24114
+ validateObject = this.parent.connectorLineEditModule.validateTypes(args.data.childRecords[childRecordIndex], args.data);
24115
+ }
24116
+ else {
24117
+ validateObject = this.parent.connectorLineEditModule.validateTypes(args.data);
24118
+ }
23964
24119
  this.parent.isConnectorLineUpdate = true;
23965
24120
  if (!isNullOrUndefined(getValue('violationType', validateObject))) {
23966
24121
  var newArgs = this.validateTaskEvent(args);