@syncfusion/ej2-gantt 19.3.57 → 19.4.38

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 (34) hide show
  1. package/CHANGELOG.md +7 -1
  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 +102 -46
  5. package/dist/es6/ej2-gantt.es2015.js.map +1 -1
  6. package/dist/es6/ej2-gantt.es5.js +99 -43
  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 +18 -18
  12. package/src/gantt/actions/context-menu.js +35 -14
  13. package/src/gantt/actions/dialog-edit.js +4 -1
  14. package/src/gantt/actions/edit.js +4 -0
  15. package/src/gantt/actions/rowdragdrop.js +2 -0
  16. package/src/gantt/actions/taskbar-edit.js +4 -1
  17. package/src/gantt/base/gantt.d.ts +15 -13
  18. package/src/gantt/base/gantt.js +30 -24
  19. package/src/gantt/base/task-processor.js +20 -3
  20. package/styles/bootstrap5-dark.css +6 -5
  21. package/styles/bootstrap5.css +6 -5
  22. package/styles/gantt/_bootstrap4-definition.scss +1 -0
  23. package/styles/gantt/_bootstrap5-definition.scss +1 -1
  24. package/styles/gantt/_fluent-definition.scss +163 -0
  25. package/styles/gantt/_layout.scss +1 -6
  26. package/styles/gantt/_theme.scss +2 -1
  27. package/styles/gantt/bootstrap5-dark.css +6 -5
  28. package/styles/gantt/bootstrap5.css +6 -5
  29. package/styles/gantt/icons/_fluent.scss +112 -0
  30. package/styles/gantt/icons/_tailwind-dark.scss +112 -112
  31. package/styles/gantt/tailwind-dark.css +1 -1
  32. package/styles/gantt/tailwind.css +1 -1
  33. package/styles/tailwind-dark.css +1 -1
  34. package/styles/tailwind.css +1 -1
@@ -2190,8 +2190,16 @@ class TaskProcessor extends DateProcessor {
2190
2190
  const ganttProperties = ganttData.ganttProperties;
2191
2191
  let duration = data[taskSettings.duration];
2192
2192
  duration = isNullOrUndefined(duration) || duration === '' ? null : duration;
2193
- const startDate = this.getDateFromFormat(data[taskSettings.startDate], true);
2194
- const endDate = this.getDateFromFormat(data[taskSettings.endDate], true);
2193
+ let startDate;
2194
+ let endDate;
2195
+ if (ganttProperties.startDate && ganttProperties.endDate) {
2196
+ startDate = this.getDateFromFormat(ganttProperties.startDate, true);
2197
+ endDate = this.getDateFromFormat(ganttProperties.endDate, true);
2198
+ }
2199
+ else {
2200
+ startDate = this.getDateFromFormat(data[taskSettings.startDate], true);
2201
+ endDate = this.getDateFromFormat(data[taskSettings.endDate], true);
2202
+ }
2195
2203
  const segments = taskSettings.segments ? (data[taskSettings.segments] ||
2196
2204
  ganttData.taskData[taskSettings.segments]) : null;
2197
2205
  const isMileStone = taskSettings.milestone ? data[taskSettings.milestone] ? true : false : false;
@@ -2790,7 +2798,10 @@ class TaskProcessor extends DateProcessor {
2790
2798
  if (!isNullOrUndefined(value)) {
2791
2799
  value = new Date(tempDate.getTime());
2792
2800
  }
2793
- this.parent.setRecordValue('taskData.' + mapping, value, task);
2801
+ if (!this.parent.isLoad && !this.parent.isDynamicData) {
2802
+ this.parent.setRecordValue('taskData.' + mapping, value, task);
2803
+ }
2804
+ this.parent.isDynamicData = false;
2794
2805
  }
2795
2806
  getDurationInDay(duration, durationUnit) {
2796
2807
  if (durationUnit === 'day') {
@@ -3608,8 +3619,14 @@ class TaskProcessor extends DateProcessor {
3608
3619
  }
3609
3620
  continue;
3610
3621
  }
3611
- const startDate = this.getValidStartDate(childData.ganttProperties);
3612
- const endDate = this.getValidEndDate(childData.ganttProperties);
3622
+ let startDate = this.getValidStartDate(childData.ganttProperties);
3623
+ if (parentData.hasChildRecords && !ganttProp.isAutoSchedule && !isNullOrUndefined(childData.ganttProperties.autoStartDate)) {
3624
+ startDate = childData.ganttProperties.autoStartDate;
3625
+ }
3626
+ let endDate = this.getValidEndDate(childData.ganttProperties);
3627
+ if (parentData.hasChildRecords && !ganttProp.isAutoSchedule && !isNullOrUndefined(childData.ganttProperties.autoEndDate)) {
3628
+ endDate = childData.ganttProperties.autoEndDate;
3629
+ }
3613
3630
  if (isNullOrUndefined(minStartDate)) {
3614
3631
  minStartDate = this.getDateFromFormat(startDate);
3615
3632
  }
@@ -12001,6 +12018,8 @@ let Gantt = class Gantt extends Component {
12001
12018
  /** @hidden */
12002
12019
  this.isExpandCollapseLevelMethod = false;
12003
12020
  /** @hidden */
12021
+ this.isDynamicData = false;
12022
+ /** @hidden */
12004
12023
  this.isConnectorLineUpdate = false;
12005
12024
  /** @hidden */
12006
12025
  this.staticSelectedRowIndex = -1;
@@ -12039,27 +12058,6 @@ let Gantt = class Gantt extends Component {
12039
12058
  getModuleName() {
12040
12059
  return 'gantt';
12041
12060
  }
12042
- /**
12043
- * To get timezone offset.
12044
- *
12045
- * @returns {number} .
12046
- * @private
12047
- */
12048
- getDefaultTZOffset() {
12049
- const janMonth = new Date(new Date().getFullYear(), 0, 1);
12050
- const julMonth = new Date(new Date().getFullYear(), 6, 1); //Because there is no reagions DST inbetwwen this range
12051
- return Math.max(janMonth.getTimezoneOffset(), julMonth.getTimezoneOffset());
12052
- }
12053
- /**
12054
- * To check whether the date is in DST.
12055
- *
12056
- * @param {Date} date .
12057
- * @returns {boolean} .
12058
- * @private
12059
- */
12060
- isInDst(date) {
12061
- return date.getTimezoneOffset() < this.getDefaultTZOffset();
12062
- }
12063
12061
  /**
12064
12062
  * For internal use only - Initialize the event handler
12065
12063
  *
@@ -12178,6 +12176,27 @@ let Gantt = class Gantt extends Component {
12178
12176
  return ganttDateFormat;
12179
12177
  }
12180
12178
  }
12179
+ /**
12180
+ * To get timezone offset.
12181
+ *
12182
+ * @returns {number} .
12183
+ * @private
12184
+ */
12185
+ getDefaultTZOffset() {
12186
+ const janMonth = new Date(new Date().getFullYear(), 0, 1);
12187
+ const julMonth = new Date(new Date().getFullYear(), 6, 1); //Because there is no reagions DST inbetwwen this range
12188
+ return Math.max(janMonth.getTimezoneOffset(), julMonth.getTimezoneOffset());
12189
+ }
12190
+ /**
12191
+ * To check whether the date is in DST.
12192
+ *
12193
+ * @param {Date} date .
12194
+ * @returns {boolean} .
12195
+ * @private
12196
+ */
12197
+ isInDst(date) {
12198
+ return date.getTimezoneOffset() < this.getDefaultTZOffset();
12199
+ }
12181
12200
  /**
12182
12201
  * Method to map resource fields.
12183
12202
  *
@@ -12330,7 +12349,7 @@ let Gantt = class Gantt extends Component {
12330
12349
  this.treeGrid.dataSource = { result: this.flatData, count: count };
12331
12350
  }
12332
12351
  else {
12333
- this.treeGrid.dataSource = this.flatData.length > 0 ? this.flatData : [];
12352
+ this.treeGrid.dataSource = this.flatData;
12334
12353
  }
12335
12354
  }
12336
12355
  else {
@@ -14376,6 +14395,7 @@ let Gantt = class Gantt extends Component {
14376
14395
  * @public
14377
14396
  */
14378
14397
  updateDataSource(dataSource, args) {
14398
+ this.isDynamicData = true;
14379
14399
  if (!isNullOrUndefined(args)) {
14380
14400
  for (let prop of Object.keys(args)) { // eslint-disable-line
14381
14401
  switch (prop) {
@@ -14578,12 +14598,15 @@ let Gantt = class Gantt extends Component {
14578
14598
  if (!isNullOrUndefined(rowData)) {
14579
14599
  const data = extend({}, {}, rowData.taskData, true);
14580
14600
  const taskfields = this.taskFields;
14601
+ if (data[taskfields.startDate]) {
14602
+ this.setRecordValue(taskfields.startDate, rowData.ganttProperties.startDate, data, true);
14603
+ }
14581
14604
  if (!isNullOrUndefined(taskfields.duration)) {
14582
14605
  data[taskfields.duration] = 0;
14583
14606
  }
14584
14607
  else {
14585
- data[taskfields.startDate] = new Date(rowData.taskData[taskfields.startDate]);
14586
- data[taskfields.endDate] = new Date(rowData.taskData[taskfields.startDate]);
14608
+ data[taskfields.startDate] = new Date(rowData.ganttProperties.startDate);
14609
+ data[taskfields.endDate] = new Date(rowData.ganttProperties.endDate);
14587
14610
  }
14588
14611
  if (!isNullOrUndefined(taskfields.milestone)) {
14589
14612
  if (data[taskfields.milestone] === false) {
@@ -16359,8 +16382,11 @@ class TaskbarEdit extends DateProcessor {
16359
16382
  if (this.isMouseDragged && this.taskBarEditAction) {
16360
16383
  const args = {
16361
16384
  cancel: false,
16362
- requestType: 'mergeSegment'
16385
+ requestType: 'taskbarediting'
16363
16386
  };
16387
+ if (this.segmentIndex !== -1) {
16388
+ args.requestType = 'mergeSegment';
16389
+ }
16364
16390
  this.parent.trigger('actionBegin', args, (arg) => {
16365
16391
  if (arg.cancel === false) {
16366
16392
  this.taskBarEditingAction(event, false);
@@ -18838,7 +18864,7 @@ class DialogEdit {
18838
18864
  const datePickerModel = this.beforeOpenArgs[generalTabString][this.parent.taskFields[fields[i]]];
18839
18865
  const value = args.rowData[args.column.field];
18840
18866
  setValue('value', value, datePickerModel);
18841
- const datePicker = new DatePicker(datePickerModel);
18867
+ const datePicker = new this.inputs[this.parent.columnByField[this.parent.taskFields[fields[i]]].editType](datePickerModel);
18842
18868
  datePicker.appendTo(args.element);
18843
18869
  },
18844
18870
  read: (args) => {
@@ -19710,6 +19736,9 @@ class DialogEdit {
19710
19736
  this.rowData.ganttProperties.segments = dataSource;
19711
19737
  this.parent.setRecordValue('segments', this.parent.dataOperation.setSegmentsInfo(this.rowData, false), this.rowData.ganttProperties, true);
19712
19738
  this.parent.setRecordValue('taskData.' + this.parent.taskFields.segments, userData, this.rowData);
19739
+ if (dataSource.length <= 0) {
19740
+ this.validateDuration(this.rowData);
19741
+ }
19713
19742
  }
19714
19743
  }
19715
19744
  // eslint-disable-next-line
@@ -23122,8 +23151,11 @@ class Edit$2 {
23122
23151
  */
23123
23152
  updateRealDataSource(addedRecord, rowPosition) {
23124
23153
  const taskFields = this.parent.taskFields;
23125
- const dataSource = isCountRequired(this.parent) ? getValue('result', this.parent.dataSource) :
23154
+ let dataSource = isCountRequired(this.parent) ? getValue('result', this.parent.dataSource) :
23126
23155
  this.parent.dataSource;
23156
+ if (this.parent.dataSource instanceof DataManager) {
23157
+ dataSource = this.parent.dataSource.dataSource.json;
23158
+ }
23127
23159
  for (let i = 0; i < addedRecord.length; i++) {
23128
23160
  if (isNullOrUndefined(rowPosition) || isNullOrUndefined(this.addRowSelectedItem)) {
23129
23161
  rowPosition = 'Top';
@@ -23195,6 +23227,7 @@ class Edit$2 {
23195
23227
  */
23196
23228
  addRecord(data, rowPosition, rowIndex) {
23197
23229
  if (this.parent.editModule && this.parent.editSettings.allowAdding) {
23230
+ this.parent.isDynamicData = true;
23198
23231
  const cAddedRecord = [];
23199
23232
  if (isNullOrUndefined(data)) {
23200
23233
  this.validateTaskPosition(data, rowPosition, rowIndex, cAddedRecord);
@@ -25944,6 +25977,12 @@ class ContextMenu$2 {
25944
25977
  position = this.item;
25945
25978
  data = extend({}, {}, this.rowData.taskData, true);
25946
25979
  taskfields = this.parent.taskFields;
25980
+ if (data[taskfields.startDate]) {
25981
+ this.parent.setRecordValue(taskfields.startDate, this.rowData.ganttProperties.startDate, data, true);
25982
+ }
25983
+ if (data[taskfields.endDate]) {
25984
+ this.parent.setRecordValue(taskfields.endDate, this.rowData.ganttProperties.endDate, data, true);
25985
+ }
25947
25986
  if (!isNullOrUndefined(taskfields.dependency)) {
25948
25987
  data[taskfields.dependency] = null;
25949
25988
  }
@@ -26133,7 +26172,12 @@ class ContextMenu$2 {
26133
26172
  for (const item of args.items) {
26134
26173
  // let target: EventTarget = target;
26135
26174
  if (!item.separator) {
26136
- this.updateItemStatus(item, target, rowIndex);
26175
+ if ((target.classList.contains('e-gantt-unscheduled-taskbar')) && ((item.text === this.getLocale('splitTask')) || (item.text === this.getLocale('mergeTask')))) {
26176
+ this.hideItems.push(item.text);
26177
+ }
26178
+ else {
26179
+ this.updateItemStatus(item, target, rowIndex);
26180
+ }
26137
26181
  }
26138
26182
  }
26139
26183
  args.rowData = this.rowData;
@@ -26245,24 +26289,34 @@ class ContextMenu$2 {
26245
26289
  break;
26246
26290
  case 'Indent':
26247
26291
  {
26248
- const index = this.parent.selectedRowIndex;
26249
- const isSelected = this.parent.selectionModule ? this.parent.selectionModule.selectedRowIndexes.length === 1 ||
26250
- this.parent.selectionModule.getSelectedRowCellIndexes().length === 1 ? true : false : false;
26251
- const prevRecord = this.parent.updatedRecords[this.parent.selectionModule.getSelectedRowIndexes()[0] - 1];
26252
- if (!this.parent.editSettings.allowEditing || index === 0 || index === -1 || !isSelected ||
26253
- this.parent.viewType === 'ResourceView' || this.parent.updatedRecords[index].level - prevRecord.level === 1) {
26254
- this.updateItemVisibility(item.text);
26292
+ if (!this.parent.allowSelection) {
26293
+ this.hideItems.push(item.text);
26294
+ }
26295
+ else {
26296
+ const index = this.parent.selectedRowIndex;
26297
+ const isSelected = this.parent.selectionModule ? this.parent.selectionModule.selectedRowIndexes.length === 1 ||
26298
+ this.parent.selectionModule.getSelectedRowCellIndexes().length === 1 ? true : false : false;
26299
+ const prevRecord = this.parent.updatedRecords[this.parent.selectionModule.getSelectedRowIndexes()[0] - 1];
26300
+ if (!this.parent.editSettings.allowEditing || index === 0 || index === -1 || !isSelected ||
26301
+ this.parent.viewType === 'ResourceView' || this.parent.updatedRecords[index].level - prevRecord.level === 1) {
26302
+ this.updateItemVisibility(item.text);
26303
+ }
26255
26304
  }
26256
26305
  break;
26257
26306
  }
26258
26307
  case 'Outdent':
26259
26308
  {
26260
- const ind = this.parent.selectionModule.getSelectedRowIndexes()[0];
26261
- const isSelect = this.parent.selectionModule ? this.parent.selectionModule.selectedRowIndexes.length === 1 ||
26262
- this.parent.selectionModule.getSelectedRowCellIndexes().length === 1 ? true : false : false;
26263
- if (!this.parent.editSettings.allowEditing || ind === -1 || ind === 0 || !isSelect ||
26264
- this.parent.viewType === 'ResourceView' || this.parent.updatedRecords[ind].level === 0) {
26265
- this.updateItemVisibility(item.text);
26309
+ if (!this.parent.allowSelection) {
26310
+ this.hideItems.push(item.text);
26311
+ }
26312
+ else {
26313
+ const ind = this.parent.selectionModule.getSelectedRowIndexes()[0];
26314
+ const isSelect = this.parent.selectionModule ? this.parent.selectionModule.selectedRowIndexes.length === 1 ||
26315
+ this.parent.selectionModule.getSelectedRowCellIndexes().length === 1 ? true : false : false;
26316
+ if (!this.parent.editSettings.allowEditing || ind === -1 || ind === 0 || !isSelect ||
26317
+ this.parent.viewType === 'ResourceView' || this.parent.updatedRecords[ind].level === 0) {
26318
+ this.updateItemVisibility(item.text);
26319
+ }
26266
26320
  }
26267
26321
  break;
26268
26322
  }
@@ -27132,6 +27186,7 @@ class RowDD$1 {
27132
27186
  else {
27133
27187
  const level = 1;
27134
27188
  draggedRecord.level = droppedRecord.level + 1;
27189
+ this.parent.setRecordValue('level', this.draggedRecord.level, this.draggedRecord);
27135
27190
  this.updateChildRecordLevel(draggedRecord, level);
27136
27191
  }
27137
27192
  droppedRecord.expanded = true;
@@ -27216,6 +27271,7 @@ class RowDD$1 {
27216
27271
  parentData = this.parent.treeGrid[id][record.parentItem.uniqueID];
27217
27272
  }
27218
27273
  currentRecord.level = record.parentItem ? parentData.level + level : record.level + 1;
27274
+ this.parent.setRecordValue('level', currentRecord.level, currentRecord);
27219
27275
  if (currentRecord.hasChildRecords) {
27220
27276
  level--;
27221
27277
  level = this.updateChildRecordLevel(currentRecord, level);