@syncfusion/ej2-gantt 20.4.51 → 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.
@@ -59,7 +59,13 @@ var GanttTreeGrid = /** @class */ (function () {
59
59
  this.parent.treeGrid.allowKeyboard = this.parent.allowKeyboard;
60
60
  this.parent.treeGrid.enableImmutableMode = this.parent.enableImmutableMode;
61
61
  this.treeGridColumns = [];
62
+ if (!this.parent.isLocaleChanged && this.parent.isLoad) {
63
+ this.parent.previousGanttColumns = extend([], [], this.parent.columns, true);
64
+ }
62
65
  this.validateGanttColumns();
66
+ if (this.parent.isLocaleChanged) {
67
+ this.parent.isLocaleChanged = false;
68
+ }
63
69
  this.addEventListener();
64
70
  }
65
71
  GanttTreeGrid.prototype.addEventListener = function () {
@@ -481,6 +487,9 @@ var GanttTreeGrid = /** @class */ (function () {
481
487
  */
482
488
  GanttTreeGrid.prototype.createTreeGridColumn = function (column, isDefined) {
483
489
  var taskSettings = this.parent.taskFields;
490
+ var previousColumn = this.parent.previousGanttColumns.filter(function (prevcolumn) {
491
+ return column.field == prevcolumn.field;
492
+ })[0];
484
493
  column.disableHtmlEncode = !isNullOrUndefined(column.disableHtmlEncode) ? column.disableHtmlEncode : this.parent.disableHtmlEncode;
485
494
  if (taskSettings.id !== column.field) {
486
495
  column.clipMode = column.clipMode ? column.clipMode : 'EllipsisWithTooltip';
@@ -491,14 +500,24 @@ var GanttTreeGrid = /** @class */ (function () {
491
500
  }
492
501
  else if (taskSettings.name === column.field) {
493
502
  /** Name column */
494
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('name');
503
+ if (this.parent.isLocaleChanged && previousColumn) {
504
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('name');
505
+ }
506
+ else {
507
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('name');
508
+ }
495
509
  column.width = column.width ? column.width : 150;
496
510
  column.editType = column.editType ? column.editType : 'stringedit';
497
511
  column.type = column.type ? column.type : 'string';
498
512
  }
499
513
  else if (taskSettings.startDate === column.field) {
500
514
  /** Name column */
501
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('startDate');
515
+ if (this.parent.isLocaleChanged && previousColumn) {
516
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('startDate');
517
+ }
518
+ else {
519
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('startDate');
520
+ }
502
521
  column.editType = column.editType ? column.editType :
503
522
  this.parent.getDateFormat().toLowerCase().indexOf('hh') !== -1 ? 'datetimepickeredit' : 'datepickeredit';
504
523
  column.format = column.format ? column.format : { type: 'date', format: this.parent.getDateFormat() };
@@ -506,7 +525,12 @@ var GanttTreeGrid = /** @class */ (function () {
506
525
  column.edit = { params: { renderDayCell: this.parent.renderWorkingDayCell.bind(this.parent) } };
507
526
  }
508
527
  else if (taskSettings.endDate === column.field) {
509
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('endDate');
528
+ if (this.parent.isLocaleChanged && previousColumn) {
529
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('endDate');
530
+ }
531
+ else {
532
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('endDate');
533
+ }
510
534
  column.format = column.format ? column.format : { type: 'date', format: this.parent.getDateFormat() };
511
535
  column.editType = column.editType ? column.editType :
512
536
  this.parent.getDateFormat().toLowerCase().indexOf('hh') !== -1 ? 'datetimepickeredit' : 'datepickeredit';
@@ -515,7 +539,12 @@ var GanttTreeGrid = /** @class */ (function () {
515
539
  }
516
540
  else if (taskSettings.duration === column.field) {
517
541
  column.width = column.width ? column.width : 150;
518
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('duration');
542
+ if (this.parent.isLocaleChanged && previousColumn) {
543
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('duration');
544
+ }
545
+ else {
546
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('duration');
547
+ }
519
548
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : !isNullOrUndefined(column.edit) ? null :
520
549
  this.durationValueAccessor.bind(this);
521
550
  column.editType = column.editType ? column.editType : 'stringedit';
@@ -525,7 +554,12 @@ var GanttTreeGrid = /** @class */ (function () {
525
554
  this.composeProgressColumn(column);
526
555
  }
527
556
  else if (taskSettings.dependency === column.field) {
528
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('dependency');
557
+ if (this.parent.isLocaleChanged && previousColumn) {
558
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('dependency');
559
+ }
560
+ else {
561
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('dependency');
562
+ }
529
563
  column.width = column.width ? column.width : 150;
530
564
  column.editType = column.editType ? column.editType : 'stringedit';
531
565
  column.type = 'string';
@@ -535,7 +569,12 @@ var GanttTreeGrid = /** @class */ (function () {
535
569
  this.composeResourceColumn(column);
536
570
  }
537
571
  else if (taskSettings.notes === column.field) {
538
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('notes');
572
+ if (this.parent.isLocaleChanged && previousColumn) {
573
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('notes');
574
+ }
575
+ else {
576
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('notes');
577
+ }
539
578
  column.width = column.width ? column.width : 150;
540
579
  column.editType = column.editType ? column.editType : 'stringedit';
541
580
  if (!this.parent.showInlineNotes) {
@@ -550,26 +589,46 @@ var GanttTreeGrid = /** @class */ (function () {
550
589
  var colName = (taskSettings.baselineEndDate === column.field) ? 'baselineEndDate' :
551
590
  'baselineStartDate';
552
591
  column.width = column.width ? column.width : 150;
553
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant(colName);
592
+ if (this.parent.isLocaleChanged && previousColumn) {
593
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant(colName);
594
+ }
595
+ else {
596
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant(colName);
597
+ }
554
598
  column.format = column.format ? column.format : { type: 'date', format: this.parent.getDateFormat() };
555
599
  column.editType = column.editType ? column.editType :
556
600
  this.parent.getDateFormat().toLowerCase().indexOf('hh') !== -1 ? 'datetimepickeredit' : 'datepickeredit';
557
601
  }
558
602
  else if (taskSettings.work === column.field) {
559
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('work');
603
+ if (this.parent.isLocaleChanged && previousColumn) {
604
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('work');
605
+ }
606
+ else {
607
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('work');
608
+ }
560
609
  column.width = column.width ? column.width : 150;
561
610
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.workValueAccessor.bind(this);
562
611
  column.editType = column.editType ? column.editType : 'numericedit';
563
612
  }
564
613
  else if (taskSettings.type === column.field) {
565
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('taskType');
614
+ if (this.parent.isLocaleChanged && previousColumn) {
615
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('taskType');
616
+ }
617
+ else {
618
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('taskType');
619
+ }
566
620
  column.width = column.width ? column.width : 150;
567
621
  //column.type = 'string';
568
622
  column.editType = 'dropdownedit';
569
623
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.taskTypeValueAccessor.bind(this);
570
624
  }
571
625
  else if (taskSettings.manual === column.field && this.parent.taskMode === 'Custom') {
572
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('taskMode');
626
+ if (this.parent.isLocaleChanged && previousColumn) {
627
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('taskMode');
628
+ }
629
+ else {
630
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('taskMode');
631
+ }
573
632
  column.width = column.width ? column.width : 120;
574
633
  column.editType = column.editType ? column.editType : 'dropdownedit';
575
634
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.modeValueAccessor.bind(this);
@@ -593,7 +652,15 @@ var GanttTreeGrid = /** @class */ (function () {
593
652
  * @returns {void} .
594
653
  */
595
654
  GanttTreeGrid.prototype.composeResourceColumn = function (column) {
596
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('resourceName');
655
+ var previousColumn = this.parent.previousGanttColumns.filter(function (prevcolumn) {
656
+ return column.field == prevcolumn.field;
657
+ })[0];
658
+ if (this.parent.isLocaleChanged && previousColumn) {
659
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('resourceName');
660
+ }
661
+ else {
662
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('resourceName');
663
+ }
597
664
  column.width = column.width ? column.width : 150;
598
665
  column.type = 'string';
599
666
  column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.resourceValueAccessor.bind(this);
@@ -628,7 +695,17 @@ var GanttTreeGrid = /** @class */ (function () {
628
695
  var lengthDataSource = this.parent.dataSource['length'];
629
696
  var taskIDName;
630
697
  column.isPrimaryKey = isProjectView ? true : false;
631
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('id');
698
+ if (this.parent.isLocaleChanged) {
699
+ var previousColumn = this.parent.previousGanttColumns.filter(function (prevcolumn) {
700
+ return column.field == prevcolumn.field;
701
+ })[0];
702
+ if (previousColumn) {
703
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('id');
704
+ }
705
+ }
706
+ else {
707
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('id');
708
+ }
632
709
  column.width = column.width ? column.width : 100;
633
710
  for (var i = 0; i < lengthDataSource; i++) {
634
711
  if (!isNullOrUndefined(this.parent.dataSource[i][this.parent.taskFields.id])) {
@@ -665,7 +742,15 @@ var GanttTreeGrid = /** @class */ (function () {
665
742
  * @returns {void} .
666
743
  */
667
744
  GanttTreeGrid.prototype.composeProgressColumn = function (column) {
668
- column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('progress');
745
+ var previousColumn = this.parent.previousGanttColumns.filter(function (prevcolumn) {
746
+ return column.field == prevcolumn.field;
747
+ })[0];
748
+ if (this.parent.isLocaleChanged && previousColumn) {
749
+ column.headerText = previousColumn.headerText ? previousColumn.headerText : this.parent.localeObj.getConstant('progress');
750
+ }
751
+ else {
752
+ column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('progress');
753
+ }
669
754
  column.width = column.width ? column.width : 150;
670
755
  column.editType = column.editType ? column.editType : 'numericedit';
671
756
  };
@@ -1328,7 +1328,7 @@ var ChartRows = /** @class */ (function (_super) {
1328
1328
  for (var i = 0; i < this.parent.currentViewData.length; i++) {
1329
1329
  var tempTemplateData = this.parent.currentViewData[i];
1330
1330
  if (this.parent.viewType === 'ResourceView') {
1331
- if (this.parent.editModule && this.parent.editModule.isResourceTaskDeleted) {
1331
+ if (this.parent.editModule && this.parent.editModule.isResourceTaskDeleted || this.parent.isFromOnPropertyChange) {
1332
1332
  this.parent.initialChartRowElements = this.parent.ganttChartModule.getChartRows();
1333
1333
  this.parent.editModule.isResourceTaskDeleted = false;
1334
1334
  }
@@ -1840,7 +1840,10 @@ var ChartRows = /** @class */ (function (_super) {
1840
1840
  addClass([cloneElement], 'collpse-parent-border');
1841
1841
  var id = chartRows[i].querySelector('.' + cls.taskBarMainContainer).getAttribute('rowUniqueId');
1842
1842
  var ganttData = this.parent.getRecordByID(id);
1843
- var zIndex = (ganttData.ganttProperties.eOverlapIndex).toString();
1843
+ var zIndex = "";
1844
+ if (ganttData && ganttData.ganttProperties.eOverlapIndex) {
1845
+ zIndex = (ganttData.ganttProperties.eOverlapIndex).toString();
1846
+ }
1844
1847
  var cloneChildElement = cloneElement.cloneNode(true);
1845
1848
  cloneChildElement.style.zIndex = zIndex;
1846
1849
  parentTrNode[0].childNodes[0].childNodes[0].childNodes[0].appendChild(cloneChildElement);
@@ -156,6 +156,9 @@ var Timeline = /** @class */ (function () {
156
156
  */
157
157
  Timeline.prototype.changeTimelineSettings = function (newTimeline) {
158
158
  var _this = this;
159
+ if (!this.isZoomIn) {
160
+ this.isSingleTier = newTimeline.topTier.unit === 'None' || newTimeline.bottomTier.unit === 'None' ? true : false;
161
+ }
159
162
  var skipProperty = this.isSingleTier ?
160
163
  this.customTimelineSettings.topTier.unit === 'None' ?
161
164
  'topTier' : 'bottomTier' : null;
@@ -167,7 +170,9 @@ var Timeline = /** @class */ (function () {
167
170
  else {
168
171
  var value = property === 'topTier' ? 'bottomTier' : 'topTier';
169
172
  var assignValue = 'bottomTier';
170
- _this.customTimelineSettings[value] = __assign({}, newTimeline[assignValue]);
173
+ if (newTimeline[assignValue].unit != "None") {
174
+ _this.customTimelineSettings[value] = __assign({}, newTimeline[assignValue]);
175
+ }
171
176
  }
172
177
  });
173
178
  this.parent.isTimelineRoundOff = this.isZoomToFit ? false : isNullOrUndefined(this.parent.projectStartDate) ? true : false;
@@ -403,7 +408,9 @@ var Timeline = /** @class */ (function () {
403
408
  this.customTimelineSettings.bottomTier.count : this.customTimelineSettings.topTier.count;
404
409
  var unit = this.customTimelineSettings.bottomTier.unit !== 'None' ?
405
410
  this.customTimelineSettings.bottomTier.unit : this.customTimelineSettings.topTier.unit;
406
- var zoomLevel = this.getCurrentZoomingLevel(unit, count);
411
+ var tier = this.customTimelineSettings.bottomTier.unit !== 'None' ?
412
+ "bottomTier" : "topTier";
413
+ var zoomLevel = this.getCurrentZoomingLevel(unit, count, tier);
407
414
  if (this.parent.toolbarModule) {
408
415
  if (zoomLevel === this.parent.zoomingLevels[this.parent.zoomingLevels.length - 1].level) {
409
416
  this.parent.toolbarModule.enableItems([this.parent.controlId + '_zoomin'], false);
@@ -421,7 +428,7 @@ var Timeline = /** @class */ (function () {
421
428
  * @returns {number} .
422
429
  * @private
423
430
  */
424
- Timeline.prototype.getCurrentZoomingLevel = function (unit, count) {
431
+ Timeline.prototype.getCurrentZoomingLevel = function (unit, count, tier) {
425
432
  var level;
426
433
  var currentZoomCollection;
427
434
  var checkSameCountLevels;
@@ -431,16 +438,31 @@ var Timeline = /** @class */ (function () {
431
438
  this.parent.zoomingLevels = this.parent.getZoomingLevels();
432
439
  }
433
440
  var sameUnitLevels = this.parent.zoomingLevels.filter(function (tempLevel) {
434
- return tempLevel.bottomTier.unit === unit;
441
+ if (tier === "bottomTier") {
442
+ return tempLevel.bottomTier.unit === unit;
443
+ }
444
+ else {
445
+ return tempLevel.topTier.unit === unit;
446
+ }
435
447
  });
436
448
  if (sameUnitLevels.length === 0) {
437
449
  var closestUnit_1 = this.getClosestUnit(unit, '', false);
438
450
  sameUnitLevels = this.parent.zoomingLevels.filter(function (tempLevel) {
439
- return tempLevel.bottomTier.unit === closestUnit_1;
451
+ if (tier === "bottomTier") {
452
+ return tempLevel.bottomTier.unit === closestUnit_1;
453
+ }
454
+ else {
455
+ return tempLevel.topTier.unit === closestUnit_1;
456
+ }
440
457
  });
441
458
  }
442
459
  var sortedUnitLevels = sameUnitLevels.sort(function (a, b) {
443
- return (a.bottomTier.count < b.bottomTier.count) ? 1 : -1;
460
+ if (tier === "bottomTier") {
461
+ return (a.bottomTier.count < b.bottomTier.count) ? 1 : -1;
462
+ }
463
+ else {
464
+ return (a.topTier.count < b.topTier.count) ? 1 : -1;
465
+ }
444
466
  });
445
467
  for (var i = 0; i < sortedUnitLevels.length; i++) {
446
468
  firstValue = sortedUnitLevels[i];
@@ -451,10 +473,15 @@ var Timeline = /** @class */ (function () {
451
473
  else {
452
474
  secondValue = sortedUnitLevels[i + 1];
453
475
  }
454
- if (count >= firstValue.bottomTier.count) {
476
+ if (count >= firstValue[tier].count) {
455
477
  currentZoomCollection = sortedUnitLevels[i];
456
478
  checkSameCountLevels = sortedUnitLevels.filter(function (tempLevel) {
457
- return tempLevel.bottomTier.count === currentZoomCollection.bottomTier.count;
479
+ if (tier === "bottomTier") {
480
+ return tempLevel.bottomTier.count === currentZoomCollection.bottomTier.count;
481
+ }
482
+ else {
483
+ return tempLevel.topTier.count === currentZoomCollection.topTier.count;
484
+ }
458
485
  });
459
486
  if (checkSameCountLevels.length > 1) {
460
487
  level = this.checkCollectionsWidth(checkSameCountLevels);
@@ -464,10 +491,15 @@ var Timeline = /** @class */ (function () {
464
491
  }
465
492
  break;
466
493
  }
467
- else if (count < firstValue.bottomTier.count && count > secondValue.bottomTier.count) {
494
+ else if (count < firstValue[tier].count && count > secondValue[tier].count) {
468
495
  currentZoomCollection = sortedUnitLevels[i + 1];
469
496
  checkSameCountLevels = sortedUnitLevels.filter(function (tempLevel) {
470
- return tempLevel.bottomTier.count === currentZoomCollection.bottomTier.count;
497
+ if (tier === "bottomTier") {
498
+ return tempLevel.bottomTier.count === currentZoomCollection.bottomTier.count;
499
+ }
500
+ else {
501
+ return tempLevel.topTier.count === currentZoomCollection.topTier.count;
502
+ }
471
503
  });
472
504
  if (checkSameCountLevels.length > 1) {
473
505
  level = this.checkCollectionsWidth(checkSameCountLevels);
@@ -1 +0,0 @@
1
- []
Binary file
Binary file