@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
@@ -6041,6 +6041,7 @@ class Timeline {
6041
6041
  * @private
6042
6042
  */
6043
6043
  createTimelineTemplate(tier) {
6044
+ var isFirstCell = false;
6044
6045
  const parent = this.parent;
6045
6046
  let parentTh = '';
6046
6047
  let parentTr = '';
@@ -6057,10 +6058,19 @@ class Timeline {
6057
6058
  // PDf export collection
6058
6059
  const timelineCell = {};
6059
6060
  timelineCell.startDate = new Date(startDate.getTime());
6060
- parentTr = this.getHeaterTemplateString(new Date(startDate.toString()), mode, tier, false, count, timelineCell);
6061
+ if (mode === 'Month' && tier === 'bottomTier' && ((this.parent.currentZoomingLevel.level === 5) || (this.parent.currentZoomingLevel.level === 6)) && scheduleDateCollection.length === 0) {
6062
+ isFirstCell = true;
6063
+ }
6064
+ parentTr = this.getHeaterTemplateString(new Date(startDate.toString()), mode, tier, false, count, timelineCell, isFirstCell);
6061
6065
  scheduleDateCollection.push(new Date(startDate.toString()));
6062
- increment = this.getIncrement(startDate, count, mode);
6063
- newTime = startDate.getTime() + increment;
6066
+ if (isFirstCell) {
6067
+ newTime = this.calculateQuarterEndDate(startDate).getTime();
6068
+ }
6069
+ else {
6070
+ increment = this.getIncrement(startDate, count, mode);
6071
+ newTime = startDate.getTime() + increment;
6072
+ }
6073
+ isFirstCell = false;
6064
6074
  startDate.setTime(newTime);
6065
6075
  if (startDate >= endDate) {
6066
6076
  /* eslint-disable-next-line */
@@ -6170,6 +6180,21 @@ class Timeline {
6170
6180
  mode === 'Hour' || mode === 'Minutes') &&
6171
6181
  this.parent.nonWorkingDayIndex.indexOf(day.getDay()) !== -1;
6172
6182
  }
6183
+ calculateQuarterEndDate(date) {
6184
+ const month = date.getMonth();
6185
+ if (month >= 0 && month <= 2) {
6186
+ return new Date(date.getFullYear(), 3, 1);
6187
+ }
6188
+ else if (month >= 3 && month <= 5) {
6189
+ return new Date(date.getFullYear(), 6, 1);
6190
+ }
6191
+ else if (month >= 6 && month <= 8) {
6192
+ return new Date(date.getFullYear(), 9, 1);
6193
+ }
6194
+ else {
6195
+ return new Date(date.getFullYear() + 1, 0, 1);
6196
+ }
6197
+ }
6173
6198
  /**
6174
6199
  * To construct template string.
6175
6200
  *
@@ -6183,7 +6208,7 @@ class Timeline {
6183
6208
  * @private
6184
6209
  */
6185
6210
  /* eslint-disable-next-line */
6186
- getHeaterTemplateString(scheduleWeeks, mode, tier, isLast, count, timelineCell) {
6211
+ getHeaterTemplateString(scheduleWeeks, mode, tier, isLast, count, timelineCell, isFirstCell) {
6187
6212
  let parentTr = '';
6188
6213
  let td = '';
6189
6214
  const format = tier === 'topTier' ?
@@ -6198,7 +6223,7 @@ class Timeline {
6198
6223
  this.customFormat(scheduleWeeks, format, tier, mode, formatter);
6199
6224
  thWidth = (this.getIncrement(scheduleWeeks, count, mode) / (1000 * 60 * 60 * 24)) * this.parent.perDayWidth;
6200
6225
  const cellWidth = thWidth;
6201
- thWidth = isLast ? this.calculateWidthBetweenTwoDate(mode, scheduleWeeks, this.timelineRoundOffEndDate)
6226
+ thWidth = isLast || isFirstCell ? isLast ? this.calculateWidthBetweenTwoDate(mode, scheduleWeeks, this.timelineRoundOffEndDate) : this.calculateWidthBetweenTwoDate(mode, scheduleWeeks, this.calculateQuarterEndDate(scheduleWeeks))
6202
6227
  : thWidth;
6203
6228
  const isWeekendCell = this.isWeekendHeaderCell(mode, tier, scheduleWeeks);
6204
6229
  const textClassName = tier === 'topTier' ? ' e-gantt-top-cell-text' : '';
@@ -11861,7 +11886,7 @@ class FocusModule {
11861
11886
  {
11862
11887
  if (isNullOrUndefined(document.getElementById(this.parent.element.id + '_dialog'))) {
11863
11888
  e.preventDefault();
11864
- ganttObj.addRecord();
11889
+ ganttObj.addRecord(undefined, this.parent.editSettings.newRowPosition);
11865
11890
  const focussedElement = ganttObj.element;
11866
11891
  focussedElement.focus();
11867
11892
  }
@@ -15205,6 +15230,7 @@ class CellEdit {
15205
15230
  * @private
15206
15231
  */
15207
15232
  this.isCellEdit = false;
15233
+ this.isResourceCellEdited = false;
15208
15234
  this.parent = ganttObj;
15209
15235
  this.bindTreeGridProperties();
15210
15236
  }
@@ -15633,6 +15659,7 @@ class CellEdit {
15633
15659
  const resourceSettings = this.parent.resourceFields;
15634
15660
  const editedResourceId = editedObj[this.parent.taskFields.resourceInfo];
15635
15661
  if (editedResourceId) {
15662
+ this.isResourceCellEdited = true;
15636
15663
  const tempResourceInfo = this.parent.dataOperation.setResourceInfo(editedObj);
15637
15664
  const editedResouceLength = tempResourceInfo.length;
15638
15665
  const previousResource = previousData.ganttProperties.resourceInfo;
@@ -18906,7 +18933,15 @@ class DialogEdit {
18906
18933
  field: fields[i], headerText: this.localeObj.getConstant(fields[i]), editType: 'stringedit', width: '200px',
18907
18934
  edit: {
18908
18935
  write: (args) => {
18909
- const datePickerModel = this.beforeOpenArgs[generalTabString][this.parent.taskFields[fields[i]]];
18936
+ let datePickerModel;
18937
+ if (!isNullOrUndefined(this.beforeOpenArgs[generalTabString])) {
18938
+ datePickerModel = this.beforeOpenArgs[generalTabString][this.parent.taskFields[fields[i]]];
18939
+ }
18940
+ else {
18941
+ let columnFields = this.getGeneralColumnFields();
18942
+ let columnModel = this.getFieldsModel(columnFields);
18943
+ datePickerModel = columnModel[this.parent.taskFields[fields[i]]];
18944
+ }
18910
18945
  const value = args.rowData[args.column.field];
18911
18946
  setValue('value', value, datePickerModel);
18912
18947
  const datePicker = new this.inputs[this.parent.columnByField[this.parent.taskFields[fields[i]]].editType](datePickerModel);
@@ -18929,7 +18964,15 @@ class DialogEdit {
18929
18964
  field: fields[i], headerText: this.localeObj.getConstant(fields[i]), editType: 'stringedit', width: '100px',
18930
18965
  edit: {
18931
18966
  write: (args) => {
18932
- const inputTextModel = this.beforeOpenArgs[generalTabString][this.parent.taskFields[fields[i]]];
18967
+ let inputTextModel;
18968
+ if (!isNullOrUndefined(this.beforeOpenArgs[generalTabString])) {
18969
+ inputTextModel = this.beforeOpenArgs[generalTabString][this.parent.taskFields[fields[i]]];
18970
+ }
18971
+ else {
18972
+ let columnFields = this.getGeneralColumnFields();
18973
+ let columnModel = this.getFieldsModel(columnFields);
18974
+ inputTextModel = columnModel[this.parent.taskFields[fields[i]]];
18975
+ }
18933
18976
  inputTextModel.floatLabelType = 'Never';
18934
18977
  const value = args.rowData[args.column.field];
18935
18978
  if (!isNullOrUndefined(value)) {
@@ -21588,9 +21631,12 @@ class Edit$2 {
21588
21631
  */
21589
21632
  updateParentChildRecord(data) {
21590
21633
  const ganttRecord = data;
21591
- if (ganttRecord.hasChildRecords && this.taskbarMoved && this.parent.taskMode === 'Auto' && this.parent.previousRecords[data.uniqueID].resources === ganttRecord.ganttProperties['resourceNames']) {
21634
+ if (ganttRecord.hasChildRecords && this.taskbarMoved && this.parent.taskMode === 'Auto' && (!isNullOrUndefined(this.parent.editModule.cellEditModule) && !this.parent.editModule.cellEditModule.isResourceCellEdited)) {
21592
21635
  this.updateChildItems(ganttRecord);
21593
21636
  }
21637
+ if (!isNullOrUndefined(this.parent.editModule.cellEditModule)) {
21638
+ this.parent.editModule.cellEditModule.isResourceCellEdited = false;
21639
+ }
21594
21640
  }
21595
21641
  /**
21596
21642
  * To update records while changing schedule mode.
@@ -23040,7 +23086,7 @@ class Edit$2 {
23040
23086
  /*Record Updates*/
23041
23087
  recordIndex = flatRecords.indexOf(this.addRowSelectedItem);
23042
23088
  updatedCollectionIndex = currentViewData.indexOf(this.addRowSelectedItem);
23043
- this.recordCollectionUpdate(childIndex, recordIndex, updatedCollectionIndex, record, parentItem);
23089
+ this.recordCollectionUpdate(childIndex, recordIndex, updatedCollectionIndex, record, parentItem, rowPosition);
23044
23090
  break;
23045
23091
  case 'Below':
23046
23092
  currentItemIndex = flatRecords.indexOf(this.addRowSelectedItem);
@@ -23054,7 +23100,7 @@ class Edit$2 {
23054
23100
  recordIndex = currentItemIndex + 1;
23055
23101
  updatedCollectionIndex = currentViewData.indexOf(this.addRowSelectedItem) + 1;
23056
23102
  }
23057
- this.recordCollectionUpdate(childIndex + 1, recordIndex, updatedCollectionIndex, record, parentItem);
23103
+ this.recordCollectionUpdate(childIndex + 1, recordIndex, updatedCollectionIndex, record, parentItem, rowPosition);
23058
23104
  break;
23059
23105
  case 'Child':
23060
23106
  currentItemIndex = flatRecords.indexOf(this.addRowSelectedItem);
@@ -23082,7 +23128,7 @@ class Edit$2 {
23082
23128
  this.addRowSelectedItem.ganttProperties.segments = null;
23083
23129
  }
23084
23130
  }
23085
- this.recordCollectionUpdate(childIndex + 1, recordIndex, updatedCollectionIndex, record, parentItem);
23131
+ this.recordCollectionUpdate(childIndex + 1, recordIndex, updatedCollectionIndex, record, parentItem, rowPosition);
23086
23132
  break;
23087
23133
  }
23088
23134
  this.newlyAddedRecordBackup = record;
@@ -23096,7 +23142,7 @@ class Edit$2 {
23096
23142
  * @returns {void} .
23097
23143
  * @private
23098
23144
  */
23099
- recordCollectionUpdate(childIndex, recordIndex, updatedCollectionIndex, record, parentItem) {
23145
+ recordCollectionUpdate(childIndex, recordIndex, updatedCollectionIndex, record, parentItem, rowPosition) {
23100
23146
  const flatRecords = this.parent.flatData;
23101
23147
  const currentViewData = this.parent.currentViewData;
23102
23148
  const ids = this.parent.ids;
@@ -23118,7 +23164,15 @@ class Edit$2 {
23118
23164
  !isNullOrUndefined(this.parent.dataSource)) {
23119
23165
  const child = this.parent.taskFields.child;
23120
23166
  if (parentItem.taskData[child] && parentItem.taskData[child].length > 0) {
23121
- parentItem.taskData[child].push(record.taskData);
23167
+ if (rowPosition === 'Above') {
23168
+ parentItem.taskData[child].splice(childIndex, 0, record.taskData);
23169
+ }
23170
+ else if (rowPosition === 'Below') {
23171
+ parentItem.taskData[child].splice(childIndex + 1, 0, record.taskData);
23172
+ }
23173
+ else {
23174
+ parentItem.taskData[child].push(record.taskData);
23175
+ }
23122
23176
  }
23123
23177
  else {
23124
23178
  parentItem.taskData[child] = [];
@@ -23203,13 +23257,13 @@ class Edit$2 {
23203
23257
  }
23204
23258
  for (let i = 0; i < addedRecord.length; i++) {
23205
23259
  if (isNullOrUndefined(rowPosition) || isNullOrUndefined(this.addRowSelectedItem)) {
23206
- rowPosition = 'Top';
23260
+ rowPosition = rowPosition === 'Bottom' ? 'Bottom' : 'Top';
23207
23261
  }
23208
23262
  if (rowPosition === 'Top') {
23209
23263
  dataSource.splice(0, 0, addedRecord[i].taskData);
23210
23264
  }
23211
23265
  else if (rowPosition === 'Bottom') {
23212
- dataSource.push(addedRecord[i]);
23266
+ dataSource.push(addedRecord[i].taskData);
23213
23267
  }
23214
23268
  else {
23215
23269
  if (!isNullOrUndefined(taskFields.id) && !isNullOrUndefined(taskFields.parentID)) {
@@ -23361,7 +23415,7 @@ class Edit$2 {
23361
23415
  else {
23362
23416
  if (this.parent.viewType === 'ProjectView') {
23363
23417
  if ((rowPosition === 'Top' || rowPosition === 'Bottom') ||
23364
- ((rowPosition === 'Above' || rowPosition === 'Below') && !args.data.parentItem)) {
23418
+ ((rowPosition === 'Above' || rowPosition === 'Below' || rowPosition === 'Child') && !args.data.parentItem)) {
23365
23419
  if (args.data instanceof Array) {
23366
23420
  this.updateRealDataSource(args.data, rowPosition);
23367
23421
  }
@@ -23404,6 +23458,59 @@ class Edit$2 {
23404
23458
  * @returns {void} .
23405
23459
  * @private
23406
23460
  */
23461
+ createNewRecord() {
23462
+ const tempRecord = {};
23463
+ const ganttColumns = this.parent.ganttColumns;
23464
+ const taskSettingsFields = this.parent.taskFields;
23465
+ const taskId = this.parent.editModule.getNewTaskId();
23466
+ for (let i = 0; i < ganttColumns.length; i++) {
23467
+ const fieldName = ganttColumns[i].field;
23468
+ if (fieldName === taskSettingsFields.id) {
23469
+ tempRecord[fieldName] = taskId;
23470
+ }
23471
+ else if (ganttColumns[i].field === taskSettingsFields.startDate) {
23472
+ if (isNullOrUndefined(tempRecord[taskSettingsFields.endDate])) {
23473
+ tempRecord[fieldName] = this.parent.editModule.dialogModule.getMinimumStartDate();
23474
+ }
23475
+ else {
23476
+ tempRecord[fieldName] = new Date(tempRecord[taskSettingsFields.endDate]);
23477
+ }
23478
+ if (this.parent.timezone) {
23479
+ tempRecord[fieldName] = this.parent.dateValidationModule.remove(tempRecord[fieldName], this.parent.timezone);
23480
+ }
23481
+ }
23482
+ else if (ganttColumns[i].field === taskSettingsFields.endDate) {
23483
+ if (isNullOrUndefined(tempRecord[taskSettingsFields.startDate])) {
23484
+ tempRecord[fieldName] = this.parent.editModule.dialogModule.getMinimumStartDate();
23485
+ }
23486
+ else {
23487
+ tempRecord[fieldName] = new Date(tempRecord[taskSettingsFields.startDate]);
23488
+ }
23489
+ if (this.parent.timezone) {
23490
+ tempRecord[fieldName] = this.parent.dateValidationModule.remove(tempRecord[fieldName], this.parent.timezone);
23491
+ }
23492
+ }
23493
+ else if (ganttColumns[i].field === taskSettingsFields.duration) {
23494
+ tempRecord[fieldName] = 1;
23495
+ }
23496
+ else if (ganttColumns[i].field === taskSettingsFields.name) {
23497
+ tempRecord[fieldName] = this.parent.editModule.dialogModule['localeObj'].getConstant('addDialogTitle') + ' ' + taskId;
23498
+ }
23499
+ else if (ganttColumns[i].field === taskSettingsFields.progress) {
23500
+ tempRecord[fieldName] = 0;
23501
+ }
23502
+ else if (ganttColumns[i].field === taskSettingsFields.work) {
23503
+ tempRecord[fieldName] = 0;
23504
+ }
23505
+ else if (ganttColumns[i].field === 'taskType') {
23506
+ tempRecord[fieldName] = this.parent.taskType;
23507
+ }
23508
+ else {
23509
+ tempRecord[this.parent.ganttColumns[i].field] = '';
23510
+ }
23511
+ }
23512
+ return tempRecord;
23513
+ }
23407
23514
  validateTaskPosition(data, rowPosition, rowIndex, cAddedRecord) {
23408
23515
  const selectedRowIndex = isNullOrUndefined(rowIndex) || isNaN(parseInt(rowIndex.toString(), 10)) ?
23409
23516
  this.parent.selectionModule ?
@@ -23415,7 +23522,7 @@ class Edit$2 {
23415
23522
  this.parent.selectionModule.getSelectedRowCellIndexes()[0].rowIndex : null : null : rowIndex;
23416
23523
  this.addRowSelectedItem = isNullOrUndefined(selectedRowIndex) ? null : this.parent.updatedRecords[selectedRowIndex];
23417
23524
  rowPosition = isNullOrUndefined(rowPosition) ? this.parent.editSettings.newRowPosition : rowPosition;
23418
- data = isNullOrUndefined(data) ? this.parent.editModule.dialogModule.composeAddRecord() : data;
23525
+ data = isNullOrUndefined(data) ? this.createNewRecord() : data;
23419
23526
  if (((isNullOrUndefined(selectedRowIndex) || selectedRowIndex < 0 ||
23420
23527
  isNullOrUndefined(this.addRowSelectedItem)) && (rowPosition === 'Above'
23421
23528
  || rowPosition === 'Below'