@syncfusion/ej2-gantt 19.4.48 → 19.4.50

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/ej2-gantt.umd.min.js +2 -2
  3. package/dist/ej2-gantt.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-gantt.es2015.js +125 -18
  5. package/dist/es6/ej2-gantt.es2015.js.map +1 -1
  6. package/dist/es6/ej2-gantt.es5.js +125 -18
  7. package/dist/es6/ej2-gantt.es5.js.map +1 -1
  8. package/dist/global/ej2-gantt.min.js +2 -2
  9. package/dist/global/ej2-gantt.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +14 -14
  12. package/src/gantt/actions/cell-edit.d.ts +1 -0
  13. package/src/gantt/actions/cell-edit.js +2 -0
  14. package/src/gantt/actions/dialog-edit.js +18 -2
  15. package/src/gantt/actions/edit.d.ts +1 -0
  16. package/src/gantt/actions/edit.js +74 -10
  17. package/src/gantt/actions/keyboard.js +1 -1
  18. package/src/gantt/renderer/timeline.d.ts +1 -0
  19. package/src/gantt/renderer/timeline.js +30 -5
  20. package/styles/bootstrap-dark.css +3 -3
  21. package/styles/bootstrap.css +3 -3
  22. package/styles/bootstrap4.css +3 -3
  23. package/styles/bootstrap5-dark.css +1 -1
  24. package/styles/bootstrap5.css +1 -1
  25. package/styles/gantt/_bootstrap-dark-definition.scss +3 -3
  26. package/styles/gantt/_bootstrap-definition.scss +3 -3
  27. package/styles/gantt/_bootstrap4-definition.scss +3 -3
  28. package/styles/gantt/_bootstrap5-definition.scss +1 -1
  29. package/styles/gantt/_fluent-definition.scss +1 -1
  30. package/styles/gantt/_tailwind-definition.scss +3 -3
  31. package/styles/gantt/bootstrap-dark.css +3 -3
  32. package/styles/gantt/bootstrap.css +3 -3
  33. package/styles/gantt/bootstrap4.css +3 -3
  34. package/styles/gantt/bootstrap5-dark.css +1 -1
  35. package/styles/gantt/bootstrap5.css +1 -1
  36. package/styles/gantt/tailwind-dark.css +3 -3
  37. package/styles/gantt/tailwind.css +3 -3
  38. package/styles/tailwind-dark.css +3 -3
  39. package/styles/tailwind.css +3 -3
@@ -6107,6 +6107,7 @@ var Timeline = /** @__PURE__ @class */ (function () {
6107
6107
  * @private
6108
6108
  */
6109
6109
  Timeline.prototype.createTimelineTemplate = function (tier) {
6110
+ var isFirstCell = false;
6110
6111
  var parent = this.parent;
6111
6112
  var parentTh = '';
6112
6113
  var parentTr = '';
@@ -6123,10 +6124,19 @@ var Timeline = /** @__PURE__ @class */ (function () {
6123
6124
  // PDf export collection
6124
6125
  var timelineCell = {};
6125
6126
  timelineCell.startDate = new Date(startDate.getTime());
6126
- parentTr = this.getHeaterTemplateString(new Date(startDate.toString()), mode, tier, false, count, timelineCell);
6127
+ if (mode === 'Month' && tier === 'bottomTier' && ((this.parent.currentZoomingLevel.level === 5) || (this.parent.currentZoomingLevel.level === 6)) && scheduleDateCollection.length === 0) {
6128
+ isFirstCell = true;
6129
+ }
6130
+ parentTr = this.getHeaterTemplateString(new Date(startDate.toString()), mode, tier, false, count, timelineCell, isFirstCell);
6127
6131
  scheduleDateCollection.push(new Date(startDate.toString()));
6128
- increment = this.getIncrement(startDate, count, mode);
6129
- newTime = startDate.getTime() + increment;
6132
+ if (isFirstCell) {
6133
+ newTime = this.calculateQuarterEndDate(startDate).getTime();
6134
+ }
6135
+ else {
6136
+ increment = this.getIncrement(startDate, count, mode);
6137
+ newTime = startDate.getTime() + increment;
6138
+ }
6139
+ isFirstCell = false;
6130
6140
  startDate.setTime(newTime);
6131
6141
  if (startDate >= endDate) {
6132
6142
  /* eslint-disable-next-line */
@@ -6236,6 +6246,21 @@ var Timeline = /** @__PURE__ @class */ (function () {
6236
6246
  mode === 'Hour' || mode === 'Minutes') &&
6237
6247
  this.parent.nonWorkingDayIndex.indexOf(day.getDay()) !== -1;
6238
6248
  };
6249
+ Timeline.prototype.calculateQuarterEndDate = function (date) {
6250
+ var month = date.getMonth();
6251
+ if (month >= 0 && month <= 2) {
6252
+ return new Date(date.getFullYear(), 3, 1);
6253
+ }
6254
+ else if (month >= 3 && month <= 5) {
6255
+ return new Date(date.getFullYear(), 6, 1);
6256
+ }
6257
+ else if (month >= 6 && month <= 8) {
6258
+ return new Date(date.getFullYear(), 9, 1);
6259
+ }
6260
+ else {
6261
+ return new Date(date.getFullYear() + 1, 0, 1);
6262
+ }
6263
+ };
6239
6264
  /**
6240
6265
  * To construct template string.
6241
6266
  *
@@ -6249,7 +6274,7 @@ var Timeline = /** @__PURE__ @class */ (function () {
6249
6274
  * @private
6250
6275
  */
6251
6276
  /* eslint-disable-next-line */
6252
- Timeline.prototype.getHeaterTemplateString = function (scheduleWeeks, mode, tier, isLast, count, timelineCell) {
6277
+ Timeline.prototype.getHeaterTemplateString = function (scheduleWeeks, mode, tier, isLast, count, timelineCell, isFirstCell) {
6253
6278
  var parentTr = '';
6254
6279
  var td = '';
6255
6280
  var format = tier === 'topTier' ?
@@ -6264,7 +6289,7 @@ var Timeline = /** @__PURE__ @class */ (function () {
6264
6289
  this.customFormat(scheduleWeeks, format, tier, mode, formatter);
6265
6290
  thWidth = (this.getIncrement(scheduleWeeks, count, mode) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth;
6266
6291
  var cellWidth = thWidth;
6267
- thWidth = isLast ? this.calculateWidthBetweenTwoDate(mode, scheduleWeeks, this.timelineRoundOffEndDate)
6292
+ thWidth = isLast || isFirstCell ? isLast ? this.calculateWidthBetweenTwoDate(mode, scheduleWeeks, this.timelineRoundOffEndDate) : this.calculateWidthBetweenTwoDate(mode, scheduleWeeks, this.calculateQuarterEndDate(scheduleWeeks))
6268
6293
  : thWidth;
6269
6294
  var isWeekendCell = this.isWeekendHeaderCell(mode, tier, scheduleWeeks);
6270
6295
  var textClassName = tier === 'topTier' ? ' e-gantt-top-cell-text' : '';
@@ -12259,7 +12284,7 @@ var FocusModule = /** @__PURE__ @class */ (function () {
12259
12284
  {
12260
12285
  if (isNullOrUndefined(document.getElementById(this.parent.element.id + '_dialog'))) {
12261
12286
  e.preventDefault();
12262
- ganttObj.addRecord();
12287
+ ganttObj.addRecord(undefined, this.parent.editSettings.newRowPosition);
12263
12288
  var focussedElement = ganttObj.element;
12264
12289
  focussedElement.focus();
12265
12290
  }
@@ -15623,6 +15648,7 @@ var CellEdit = /** @__PURE__ @class */ (function () {
15623
15648
  * @private
15624
15649
  */
15625
15650
  this.isCellEdit = false;
15651
+ this.isResourceCellEdited = false;
15626
15652
  this.parent = ganttObj;
15627
15653
  this.bindTreeGridProperties();
15628
15654
  }
@@ -16052,6 +16078,7 @@ var CellEdit = /** @__PURE__ @class */ (function () {
16052
16078
  var resourceSettings = this.parent.resourceFields;
16053
16079
  var editedResourceId = editedObj[this.parent.taskFields.resourceInfo];
16054
16080
  if (editedResourceId) {
16081
+ this.isResourceCellEdited = true;
16055
16082
  var tempResourceInfo = this.parent.dataOperation.setResourceInfo(editedObj);
16056
16083
  var editedResouceLength = tempResourceInfo.length;
16057
16084
  var previousResource = previousData.ganttProperties.resourceInfo;
@@ -19366,7 +19393,15 @@ var DialogEdit = /** @__PURE__ @class */ (function () {
19366
19393
  field: fields[i], headerText: this_1.localeObj.getConstant(fields[i]), editType: 'stringedit', width: '200px',
19367
19394
  edit: {
19368
19395
  write: function (args) {
19369
- var datePickerModel = _this.beforeOpenArgs[generalTabString][_this.parent.taskFields[fields[i]]];
19396
+ var datePickerModel;
19397
+ if (!isNullOrUndefined(_this.beforeOpenArgs[generalTabString])) {
19398
+ datePickerModel = _this.beforeOpenArgs[generalTabString][_this.parent.taskFields[fields[i]]];
19399
+ }
19400
+ else {
19401
+ var columnFields = _this.getGeneralColumnFields();
19402
+ var columnModel = _this.getFieldsModel(columnFields);
19403
+ datePickerModel = columnModel[_this.parent.taskFields[fields[i]]];
19404
+ }
19370
19405
  var value = args.rowData[args.column.field];
19371
19406
  setValue('value', value, datePickerModel);
19372
19407
  var datePicker = new _this.inputs[_this.parent.columnByField[_this.parent.taskFields[fields[i]]].editType](datePickerModel);
@@ -19389,7 +19424,15 @@ var DialogEdit = /** @__PURE__ @class */ (function () {
19389
19424
  field: fields[i], headerText: this_1.localeObj.getConstant(fields[i]), editType: 'stringedit', width: '100px',
19390
19425
  edit: {
19391
19426
  write: function (args) {
19392
- var inputTextModel = _this.beforeOpenArgs[generalTabString][_this.parent.taskFields[fields[i]]];
19427
+ var inputTextModel;
19428
+ if (!isNullOrUndefined(_this.beforeOpenArgs[generalTabString])) {
19429
+ inputTextModel = _this.beforeOpenArgs[generalTabString][_this.parent.taskFields[fields[i]]];
19430
+ }
19431
+ else {
19432
+ var columnFields = _this.getGeneralColumnFields();
19433
+ var columnModel = _this.getFieldsModel(columnFields);
19434
+ inputTextModel = columnModel[_this.parent.taskFields[fields[i]]];
19435
+ }
19393
19436
  inputTextModel.floatLabelType = 'Never';
19394
19437
  var value = args.rowData[args.column.field];
19395
19438
  if (!isNullOrUndefined(value)) {
@@ -22092,9 +22135,12 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
22092
22135
  */
22093
22136
  Edit$$1.prototype.updateParentChildRecord = function (data) {
22094
22137
  var ganttRecord = data;
22095
- if (ganttRecord.hasChildRecords && this.taskbarMoved && this.parent.taskMode === 'Auto' && this.parent.previousRecords[data.uniqueID].resources === ganttRecord.ganttProperties['resourceNames']) {
22138
+ if (ganttRecord.hasChildRecords && this.taskbarMoved && this.parent.taskMode === 'Auto' && (!isNullOrUndefined(this.parent.editModule.cellEditModule) && !this.parent.editModule.cellEditModule.isResourceCellEdited)) {
22096
22139
  this.updateChildItems(ganttRecord);
22097
22140
  }
22141
+ if (!isNullOrUndefined(this.parent.editModule.cellEditModule)) {
22142
+ this.parent.editModule.cellEditModule.isResourceCellEdited = false;
22143
+ }
22098
22144
  };
22099
22145
  /**
22100
22146
  * To update records while changing schedule mode.
@@ -23546,7 +23592,7 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
23546
23592
  /*Record Updates*/
23547
23593
  recordIndex = flatRecords.indexOf(this.addRowSelectedItem);
23548
23594
  updatedCollectionIndex = currentViewData.indexOf(this.addRowSelectedItem);
23549
- this.recordCollectionUpdate(childIndex, recordIndex, updatedCollectionIndex, record, parentItem);
23595
+ this.recordCollectionUpdate(childIndex, recordIndex, updatedCollectionIndex, record, parentItem, rowPosition);
23550
23596
  break;
23551
23597
  case 'Below':
23552
23598
  currentItemIndex = flatRecords.indexOf(this.addRowSelectedItem);
@@ -23560,7 +23606,7 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
23560
23606
  recordIndex = currentItemIndex + 1;
23561
23607
  updatedCollectionIndex = currentViewData.indexOf(this.addRowSelectedItem) + 1;
23562
23608
  }
23563
- this.recordCollectionUpdate(childIndex + 1, recordIndex, updatedCollectionIndex, record, parentItem);
23609
+ this.recordCollectionUpdate(childIndex + 1, recordIndex, updatedCollectionIndex, record, parentItem, rowPosition);
23564
23610
  break;
23565
23611
  case 'Child':
23566
23612
  currentItemIndex = flatRecords.indexOf(this.addRowSelectedItem);
@@ -23588,7 +23634,7 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
23588
23634
  this.addRowSelectedItem.ganttProperties.segments = null;
23589
23635
  }
23590
23636
  }
23591
- this.recordCollectionUpdate(childIndex + 1, recordIndex, updatedCollectionIndex, record, parentItem);
23637
+ this.recordCollectionUpdate(childIndex + 1, recordIndex, updatedCollectionIndex, record, parentItem, rowPosition);
23592
23638
  break;
23593
23639
  }
23594
23640
  this.newlyAddedRecordBackup = record;
@@ -23602,7 +23648,7 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
23602
23648
  * @returns {void} .
23603
23649
  * @private
23604
23650
  */
23605
- Edit$$1.prototype.recordCollectionUpdate = function (childIndex, recordIndex, updatedCollectionIndex, record, parentItem) {
23651
+ Edit$$1.prototype.recordCollectionUpdate = function (childIndex, recordIndex, updatedCollectionIndex, record, parentItem, rowPosition) {
23606
23652
  var flatRecords = this.parent.flatData;
23607
23653
  var currentViewData = this.parent.currentViewData;
23608
23654
  var ids = this.parent.ids;
@@ -23624,7 +23670,15 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
23624
23670
  !isNullOrUndefined(this.parent.dataSource)) {
23625
23671
  var child = this.parent.taskFields.child;
23626
23672
  if (parentItem.taskData[child] && parentItem.taskData[child].length > 0) {
23627
- parentItem.taskData[child].push(record.taskData);
23673
+ if (rowPosition === 'Above') {
23674
+ parentItem.taskData[child].splice(childIndex, 0, record.taskData);
23675
+ }
23676
+ else if (rowPosition === 'Below') {
23677
+ parentItem.taskData[child].splice(childIndex + 1, 0, record.taskData);
23678
+ }
23679
+ else {
23680
+ parentItem.taskData[child].push(record.taskData);
23681
+ }
23628
23682
  }
23629
23683
  else {
23630
23684
  parentItem.taskData[child] = [];
@@ -23709,13 +23763,13 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
23709
23763
  }
23710
23764
  for (var i = 0; i < addedRecord.length; i++) {
23711
23765
  if (isNullOrUndefined(rowPosition) || isNullOrUndefined(this.addRowSelectedItem)) {
23712
- rowPosition = 'Top';
23766
+ rowPosition = rowPosition === 'Bottom' ? 'Bottom' : 'Top';
23713
23767
  }
23714
23768
  if (rowPosition === 'Top') {
23715
23769
  dataSource.splice(0, 0, addedRecord[i].taskData);
23716
23770
  }
23717
23771
  else if (rowPosition === 'Bottom') {
23718
- dataSource.push(addedRecord[i]);
23772
+ dataSource.push(addedRecord[i].taskData);
23719
23773
  }
23720
23774
  else {
23721
23775
  if (!isNullOrUndefined(taskFields.id) && !isNullOrUndefined(taskFields.parentID)) {
@@ -23868,7 +23922,7 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
23868
23922
  else {
23869
23923
  if (_this.parent.viewType === 'ProjectView') {
23870
23924
  if ((rowPosition === 'Top' || rowPosition === 'Bottom') ||
23871
- ((rowPosition === 'Above' || rowPosition === 'Below') && !args.data.parentItem)) {
23925
+ ((rowPosition === 'Above' || rowPosition === 'Below' || rowPosition === 'Child') && !args.data.parentItem)) {
23872
23926
  if (args.data instanceof Array) {
23873
23927
  _this.updateRealDataSource(args.data, rowPosition);
23874
23928
  }
@@ -23911,6 +23965,59 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
23911
23965
  * @returns {void} .
23912
23966
  * @private
23913
23967
  */
23968
+ Edit$$1.prototype.createNewRecord = function () {
23969
+ var tempRecord = {};
23970
+ var ganttColumns = this.parent.ganttColumns;
23971
+ var taskSettingsFields = this.parent.taskFields;
23972
+ var taskId = this.parent.editModule.getNewTaskId();
23973
+ for (var i = 0; i < ganttColumns.length; i++) {
23974
+ var fieldName = ganttColumns[i].field;
23975
+ if (fieldName === taskSettingsFields.id) {
23976
+ tempRecord[fieldName] = taskId;
23977
+ }
23978
+ else if (ganttColumns[i].field === taskSettingsFields.startDate) {
23979
+ if (isNullOrUndefined(tempRecord[taskSettingsFields.endDate])) {
23980
+ tempRecord[fieldName] = this.parent.editModule.dialogModule.getMinimumStartDate();
23981
+ }
23982
+ else {
23983
+ tempRecord[fieldName] = new Date(tempRecord[taskSettingsFields.endDate]);
23984
+ }
23985
+ if (this.parent.timezone) {
23986
+ tempRecord[fieldName] = this.parent.dateValidationModule.remove(tempRecord[fieldName], this.parent.timezone);
23987
+ }
23988
+ }
23989
+ else if (ganttColumns[i].field === taskSettingsFields.endDate) {
23990
+ if (isNullOrUndefined(tempRecord[taskSettingsFields.startDate])) {
23991
+ tempRecord[fieldName] = this.parent.editModule.dialogModule.getMinimumStartDate();
23992
+ }
23993
+ else {
23994
+ tempRecord[fieldName] = new Date(tempRecord[taskSettingsFields.startDate]);
23995
+ }
23996
+ if (this.parent.timezone) {
23997
+ tempRecord[fieldName] = this.parent.dateValidationModule.remove(tempRecord[fieldName], this.parent.timezone);
23998
+ }
23999
+ }
24000
+ else if (ganttColumns[i].field === taskSettingsFields.duration) {
24001
+ tempRecord[fieldName] = 1;
24002
+ }
24003
+ else if (ganttColumns[i].field === taskSettingsFields.name) {
24004
+ tempRecord[fieldName] = this.parent.editModule.dialogModule['localeObj'].getConstant('addDialogTitle') + ' ' + taskId;
24005
+ }
24006
+ else if (ganttColumns[i].field === taskSettingsFields.progress) {
24007
+ tempRecord[fieldName] = 0;
24008
+ }
24009
+ else if (ganttColumns[i].field === taskSettingsFields.work) {
24010
+ tempRecord[fieldName] = 0;
24011
+ }
24012
+ else if (ganttColumns[i].field === 'taskType') {
24013
+ tempRecord[fieldName] = this.parent.taskType;
24014
+ }
24015
+ else {
24016
+ tempRecord[this.parent.ganttColumns[i].field] = '';
24017
+ }
24018
+ }
24019
+ return tempRecord;
24020
+ };
23914
24021
  Edit$$1.prototype.validateTaskPosition = function (data, rowPosition, rowIndex, cAddedRecord) {
23915
24022
  var selectedRowIndex = isNullOrUndefined(rowIndex) || isNaN(parseInt(rowIndex.toString(), 10)) ?
23916
24023
  this.parent.selectionModule ?
@@ -23922,7 +24029,7 @@ var Edit$2 = /** @__PURE__ @class */ (function () {
23922
24029
  this.parent.selectionModule.getSelectedRowCellIndexes()[0].rowIndex : null : null : rowIndex;
23923
24030
  this.addRowSelectedItem = isNullOrUndefined(selectedRowIndex) ? null : this.parent.updatedRecords[selectedRowIndex];
23924
24031
  rowPosition = isNullOrUndefined(rowPosition) ? this.parent.editSettings.newRowPosition : rowPosition;
23925
- data = isNullOrUndefined(data) ? this.parent.editModule.dialogModule.composeAddRecord() : data;
24032
+ data = isNullOrUndefined(data) ? this.createNewRecord() : data;
23926
24033
  if (((isNullOrUndefined(selectedRowIndex) || selectedRowIndex < 0 ||
23927
24034
  isNullOrUndefined(this.addRowSelectedItem)) && (rowPosition === 'Above'
23928
24035
  || rowPosition === 'Below'