@syncfusion/ej2-gantt 19.4.38 → 19.4.43

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.
@@ -483,7 +483,14 @@ var DateProcessor = /** @__PURE__ @class */ (function () {
483
483
  tDuration = this.parent.editModule.taskbarEditModule.sumOfDuration(ganttProperties.segments);
484
484
  }
485
485
  else {
486
- tDuration = this.getDuration(ganttProperties.startDate, ganttProperties.endDate, ganttProperties.durationUnit, ganttProperties.isAutoSchedule, ganttProperties.isMilestone);
486
+ // eslint-disable-next-line
487
+ if (!isNullOrUndefined(ganttProperties.startDate) && !isNullOrUndefined(ganttProperties.endDate) &&
488
+ (ganttProperties.startDate).getTime() === (ganttProperties.endDate).getTime() && !isNullOrUndefined(ganttData.taskData[this.parent.taskFields.milestone])) {
489
+ tDuration = 1;
490
+ }
491
+ else {
492
+ tDuration = this.getDuration(ganttProperties.startDate, ganttProperties.endDate, ganttProperties.durationUnit, ganttProperties.isAutoSchedule, ganttProperties.isMilestone);
493
+ }
487
494
  }
488
495
  this.parent.setRecordValue('duration', tDuration, ganttProperties, true);
489
496
  var col = this.parent.columnByField[this.parent.columnMapping.duration];
@@ -2628,7 +2635,12 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2628
2635
  eDate.setHours(0, 0, 0, 0);
2629
2636
  }
2630
2637
  }
2631
- return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth);
2638
+ if ((sDate).getTime() === (eDate).getTime()) {
2639
+ return (this.parent.perDayWidth);
2640
+ }
2641
+ else {
2642
+ return ((this.getTimeDifference(sDate, eDate) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth);
2643
+ }
2632
2644
  };
2633
2645
  /**
2634
2646
  * Get task left value
@@ -2717,14 +2729,16 @@ var TaskProcessor = /** @__PURE__ @class */ (function (_super) {
2717
2729
  // eslint-disable-next-line
2718
2730
  var resourcesId = [];
2719
2731
  var resourcesName = [];
2720
- for (var i = 0; i < resourceData.length; i++) {
2721
- resourcesId.push(resourceData[i][resourceSettings.id]);
2722
- var resName = resourceData[i][resourceSettings.name];
2723
- var resourceUnit = resourceData[i][resourceSettings.unit];
2724
- if (resourceUnit !== 100) {
2725
- resName += '[' + resourceUnit + '%' + ']';
2732
+ if (!isNullOrUndefined(resourceData)) {
2733
+ for (var i = 0; i < resourceData.length; i++) {
2734
+ resourcesId.push(resourceData[i][resourceSettings.id]);
2735
+ var resName = resourceData[i][resourceSettings.name];
2736
+ var resourceUnit = resourceData[i][resourceSettings.unit];
2737
+ if (resourceUnit !== 100) {
2738
+ resName += '[' + resourceUnit + '%' + ']';
2739
+ }
2740
+ resourcesName.push(resName);
2726
2741
  }
2727
- resourcesName.push(resName);
2728
2742
  }
2729
2743
  this.parent.setRecordValue('resourceNames', resourcesName.join(','), ganttProp, true);
2730
2744
  this.updateTaskDataResource(ganttData);
@@ -4873,8 +4887,6 @@ var GanttChart = /** @__PURE__ @class */ (function () {
4873
4887
  this.parent.treeGrid.collapseAll();
4874
4888
  }
4875
4889
  this.isExpandAll = false;
4876
- var focussedElement = this.parent.element.querySelector('.e-treegrid');
4877
- focussedElement.focus();
4878
4890
  };
4879
4891
  /**
4880
4892
  * Public method to expand particular level of rows.
@@ -6107,9 +6119,6 @@ var Timeline = /** @__PURE__ @class */ (function () {
6107
6119
  parentTr = this.getHeaterTemplateString(new Date(startDate.toString()), mode, tier, false, count, timelineCell);
6108
6120
  scheduleDateCollection.push(new Date(startDate.toString()));
6109
6121
  increment = this.getIncrement(startDate, count, mode);
6110
- if (this.parent.isInDst(startDate)) {
6111
- increment = increment + (1000 * 60 * 60);
6112
- }
6113
6122
  newTime = startDate.getTime() + increment;
6114
6123
  startDate.setTime(newTime);
6115
6124
  if (startDate >= endDate) {
@@ -6173,24 +6182,17 @@ var Timeline = /** @__PURE__ @class */ (function () {
6173
6182
  dayIntervel - 1 : dayIntervel : dayIntervel;
6174
6183
  lastDay.setDate(lastDay.getDate() + (dayIntervel + (7 * count)));
6175
6184
  increment = lastDay.getTime() - firstDay.getTime();
6176
- if ((this.parent.isInDst(lastDay) && !this.parent.isInDst(firstDay)) ||
6177
- (!this.parent.isInDst(lastDay) && this.parent.isInDst(firstDay))) {
6178
- increment = increment - (1000 * 60 * 60);
6179
- }
6180
6185
  break;
6181
6186
  }
6182
6187
  case 'Day':
6183
6188
  lastDay.setHours(24, 0, 0, 0);
6184
6189
  increment = (lastDay.getTime() - firstDay.getTime()) + (1000 * 60 * 60 * 24 * (count - 1));
6185
- if ((this.parent.isInDst(lastDay) && !this.parent.isInDst(firstDay)) ||
6186
- (!this.parent.isInDst(lastDay) && this.parent.isInDst(firstDay))) {
6187
- increment -= (1000 * 60 * 60);
6188
- }
6189
6190
  break;
6190
6191
  case 'Hour':
6191
6192
  lastDay.setMinutes(60);
6192
6193
  lastDay.setSeconds(0);
6193
6194
  increment = (lastDay.getTime() - firstDay.getTime()) + (1000 * 60 * 60 * (count - 1));
6195
+ increment = this.checkDate(firstDay, lastDay, increment, count);
6194
6196
  break;
6195
6197
  case 'Minutes':
6196
6198
  lastDay.setSeconds(60);
@@ -6199,6 +6201,21 @@ var Timeline = /** @__PURE__ @class */ (function () {
6199
6201
  }
6200
6202
  return increment;
6201
6203
  };
6204
+ Timeline.prototype.checkDate = function (firstDay, lastDay, increment, count) {
6205
+ var date = new Date(firstDay.getTime());
6206
+ date.setTime(date.getTime() + increment);
6207
+ if (((date.getTime() - lastDay.getTime()) / (1000 * 60 * 60)) != count && (firstDay.getTimezoneOffset() !== date.getTimezoneOffset())) {
6208
+ var diffCount = count - (date.getTime() - lastDay.getTime()) / (1000 * 60 * 60);
6209
+ if (!this.parent.isInDst(date)) {
6210
+ increment += (1000 * 60 * 60 * diffCount);
6211
+ }
6212
+ else if (this.parent.isInDst(date)) {
6213
+ increment -= (1000 * 60 * 60 * diffCount);
6214
+ }
6215
+ }
6216
+ return increment;
6217
+ };
6218
+
6202
6219
  /**
6203
6220
  * Method to find header cell was weekend or not
6204
6221
  *
@@ -6281,10 +6298,6 @@ var Timeline = /** @__PURE__ @class */ (function () {
6281
6298
  */
6282
6299
  Timeline.prototype.calculateWidthBetweenTwoDate = function (mode, scheduleWeeks, endDate) {
6283
6300
  var timeDifference = (endDate.getTime() - scheduleWeeks.getTime());
6284
- if ((this.parent.isInDst(scheduleWeeks) && !this.parent.isInDst(endDate)) ||
6285
- (!this.parent.isInDst(scheduleWeeks) && this.parent.isInDst(endDate))) {
6286
- timeDifference = timeDifference - (1000 * 60 * 60);
6287
- }
6288
6301
  var balanceDay = (timeDifference / (1000 * 60 * 60 * 24));
6289
6302
  return balanceDay * this.parent.perDayWidth;
6290
6303
  };
@@ -6974,6 +6987,9 @@ var GanttTreeGrid = /** @__PURE__ @class */ (function () {
6974
6987
  if (getValue('requestType', args) === 'refresh' && isNullOrUndefined(getValue('type', args)) && this.parent.addDeleteRecord) {
6975
6988
  if (this.parent.selectedRowIndex != -1) {
6976
6989
  this.parent.selectRow(this.parent.selectedRowIndex);
6990
+ if (this.parent.selectedRowIndex > this.parent.currentViewData.length - 1) {
6991
+ this.parent.selectedRowIndex = -1;
6992
+ }
6977
6993
  }
6978
6994
  else {
6979
6995
  this.parent.selectRow(0);
@@ -9345,6 +9361,7 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
9345
9361
  }
9346
9362
  }
9347
9363
  }
9364
+ this.parent.renderTemplates();
9348
9365
  this.triggerQueryTaskbarInfo();
9349
9366
  this.parent.modifiedRecords = [];
9350
9367
  if (collapsedResourceRecord.length) {
@@ -9709,6 +9726,7 @@ var ChartRows = /** @__PURE__ @class */ (function (_super) {
9709
9726
  else {
9710
9727
  tr.replaceChild(this.getGanttChartRow(index, data).childNodes[0], tr.childNodes[0]);
9711
9728
  }
9729
+ this.parent.renderTemplates();
9712
9730
  if (this.parent.viewType === 'ResourceView' && data.hasChildRecords && this.parent.showOverAllocation) {
9713
9731
  if (isValidateRange) {
9714
9732
  this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData);
@@ -12117,6 +12135,10 @@ var FocusModule = /** @__PURE__ @class */ (function () {
12117
12135
  FocusModule.prototype.onKeyPress = function (e) {
12118
12136
  var ganttObj = this.parent;
12119
12137
  var expandedRecords = ganttObj.getExpandedRecords(ganttObj.currentViewData);
12138
+ if (isNullOrUndefined(this.parent.focusModule.getActiveElement()) && (e.action === 'expandAll' || e.action === 'collapseAll')) {
12139
+ var focussedElement = this.parent.element.querySelector('.e-treegrid');
12140
+ focussedElement.focus();
12141
+ }
12120
12142
  var targetElement = this.parent.focusModule.getActiveElement();
12121
12143
  if (e.action === 'home' || e.action === 'end' || e.action === 'downArrow' || e.action === 'upArrow' || e.action === 'delete' ||
12122
12144
  e.action === 'rightArrow' || e.action === 'leftArrow' || e.action === 'focusTask' || e.action === 'focusSearch' ||
@@ -12229,9 +12251,9 @@ var FocusModule = /** @__PURE__ @class */ (function () {
12229
12251
  {
12230
12252
  if (isNullOrUndefined(document.getElementById(this.parent.element.id + '_dialog'))) {
12231
12253
  e.preventDefault();
12232
- var focussedElement = ganttObj.element.querySelector('.e-gantt-chart');
12233
- focussedElement.focus();
12234
12254
  ganttObj.addRecord();
12255
+ var focussedElement = ganttObj.element;
12256
+ focussedElement.focus();
12235
12257
  }
12236
12258
  break;
12237
12259
  }
@@ -12651,7 +12673,7 @@ var Gantt = /** @__PURE__ @class */ (function (_super) {
12651
12673
  Gantt.prototype.calculateDimensions = function () {
12652
12674
  var settingsHeight;
12653
12675
  if (typeof (this.height) !== 'number' && this.height.indexOf('%') !== -1 && (this.element.parentElement &&
12654
- !this.element.parentElement.style.height)) {
12676
+ !this.element.parentElement.style.height || this.element.parentElement.style.height.indexOf('%') !== -1)) {
12655
12677
  var ganttHeight = Number(this.height.split("%")[0]);
12656
12678
  ganttHeight = (ganttHeight * window.innerHeight) / 100;
12657
12679
  if (this.height === '100%') {
@@ -12807,7 +12829,8 @@ var Gantt = /** @__PURE__ @class */ (function (_super) {
12807
12829
  var settingsHeight = void 0;
12808
12830
  if (this.height.indexOf('%') !== -1) {
12809
12831
  var ganttHeight = Number(this.height.split("%")[0]);
12810
- if (this.element.parentElement && this.element.parentElement.style.height) {
12832
+ if (this.element.parentElement && (this.element.parentElement.style.height
12833
+ || this.element.parentElement.style.height.indexOf('%') !== -1)) {
12811
12834
  var containerHeight = Number(this.element.parentElement.style.height.split("px")[0]);
12812
12835
  ganttHeight = (ganttHeight * containerHeight) / 100;
12813
12836
  }
@@ -13325,10 +13348,8 @@ var Gantt = /** @__PURE__ @class */ (function (_super) {
13325
13348
  this.treeGrid.grid.searchSettings = getActualProperties(this.searchSettings);
13326
13349
  this.treeGrid.grid.dataBind();
13327
13350
  }
13328
- else {
13329
- this.treeGrid.searchSettings = getActualProperties(this.searchSettings);
13330
- this.treeGrid.dataBind();
13331
- }
13351
+ this.treeGrid.searchSettings = getActualProperties(this.searchSettings);
13352
+ this.treeGrid.dataBind();
13332
13353
  if (this.toolbarModule) {
13333
13354
  this.toolbarModule.updateSearchTextBox();
13334
13355
  }
@@ -17823,6 +17844,7 @@ var TaskbarEdit = /** @__PURE__ @class */ (function (_super) {
17823
17844
  this.isMouseDragged = false;
17824
17845
  }
17825
17846
  else {
17847
+ this.parent.isOnEdit = false;
17826
17848
  this.cancelTaskbarEditActionInMouseLeave();
17827
17849
  }
17828
17850
  }
@@ -18481,7 +18503,7 @@ var DialogEdit = /** @__PURE__ @class */ (function () {
18481
18503
  tempData.ganttProperties.durationUnit = this.parent.durationUnit.toLocaleLowerCase();
18482
18504
  }
18483
18505
  else if (columns[i].field === taskSettings.name) {
18484
- tempData[field] = 'New Task ' + id;
18506
+ tempData[field] = this.localeObj.getConstant('addDialogTitle') + ' ' + id;
18485
18507
  tempData.ganttProperties.taskName = tempData[field];
18486
18508
  }
18487
18509
  else if (columns[i].field === taskSettings.progress) {
@@ -19399,7 +19421,7 @@ var DialogEdit = /** @__PURE__ @class */ (function () {
19399
19421
  inputValue = dialog.querySelector('#' + ganttId + 'SegmentsTabContainer' + columnName)
19400
19422
  .ej2_instances[0];
19401
19423
  }
19402
- if (inputValue.value !== tempValue.toString()) {
19424
+ if (inputValue.value.toString() !== tempValue.toString()) {
19403
19425
  inputValue.value = tempValue;
19404
19426
  inputValue.dataBind();
19405
19427
  }
@@ -22025,7 +22047,7 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
22025
22047
  this.updateParentItemOnEditing();
22026
22048
  }
22027
22049
  /** Update parent up-to zeroth level */
22028
- if (ganttRecord.parentItem || this.parent.taskMode !== 'Auto') {
22050
+ if (ganttRecord.parentItem) {
22029
22051
  this.parent.dataOperation.updateParentItems(ganttRecord, true);
22030
22052
  }
22031
22053
  this.initiateSaveAction(args);