devexpress-gantt 3.0.15 → 3.0.19

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.
package/dist/dx-gantt.css CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * DevExpress Gantt (dx-gantt)
3
- * Version: 3.0.15
4
- * Build date: Tue Sep 28 2021
3
+ * Version: 3.0.19
4
+ * Build date: Fri Oct 29 2021
5
5
  *
6
6
  * Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED
7
7
  * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs
package/dist/dx-gantt.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * DevExpress Gantt (dx-gantt)
3
- * Version: 3.0.15
4
- * Build date: Tue Sep 28 2021
3
+ * Version: 3.0.19
4
+ * Build date: Fri Oct 29 2021
5
5
  *
6
6
  * Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED
7
7
  * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs
@@ -5062,6 +5062,7 @@ var GanttView = (function () {
5062
5062
  var _this = this;
5063
5063
  this.currentSelectedTaskID = "";
5064
5064
  this.isFocus = false;
5065
+ this._updateWithModelReloadLocked = false;
5065
5066
  this.scaleCount = 2;
5066
5067
  this.tickSize = new size_1.Size(0, 0);
5067
5068
  this.currentZoom = 1;
@@ -5078,7 +5079,7 @@ var GanttView = (function () {
5078
5079
  this.barManager = new BarManager_1.BarManager(this.commandManager, this.ganttOwner.bars);
5079
5080
  this.initTaskEditController();
5080
5081
  this.initEventManager();
5081
- this.history = new History_1.History();
5082
+ this.history = new History_1.History(this._getHistoryListener());
5082
5083
  this.initFullScreenModeHelper();
5083
5084
  this.onWindowResizelHandler = this.onBrowserWindowResize.bind(this);
5084
5085
  window.addEventListener("resize", this.onWindowResizelHandler);
@@ -5088,6 +5089,21 @@ var GanttView = (function () {
5088
5089
  }, 0);
5089
5090
  this.initializeStripLinesUpdater();
5090
5091
  }
5092
+ GanttView.prototype._getHistoryListener = function () {
5093
+ var listener = {
5094
+ onTransactionStart: this.onHistoryTransactionStart.bind(this),
5095
+ onTransactionEnd: this.onHistoryTransactionEnd.bind(this),
5096
+ };
5097
+ return listener;
5098
+ };
5099
+ GanttView.prototype.onHistoryTransactionStart = function () { this._updateWithModelReloadLocked = true; };
5100
+ GanttView.prototype.onHistoryTransactionEnd = function () {
5101
+ this._updateWithModelReloadLocked = false;
5102
+ if (this._pendingUpdateInfo) {
5103
+ this.updateWithDataReload(this._pendingUpdateInfo.keepExpandState);
5104
+ this._pendingUpdateInfo = null;
5105
+ }
5106
+ };
5091
5107
  GanttView.prototype.initValidationController = function () {
5092
5108
  var _this = this;
5093
5109
  var validationControllerSettings = ValidationControllerSettings_1.ValidationControllerSettings.parse({
@@ -5109,7 +5125,8 @@ var GanttView = (function () {
5109
5125
  getGanttSettings: function () { return _this.settings; },
5110
5126
  getViewModel: function () { return _this.viewModel; },
5111
5127
  getCommandManager: function () { return _this.commandManager; },
5112
- getModelManipulator: function () { return _this.modelManipulator; }
5128
+ getModelManipulator: function () { return _this.modelManipulator; },
5129
+ getValidationController: function () { return _this.validationController; }
5113
5130
  });
5114
5131
  this.taskEditController = new TaskEditController_1.TaskEditController(taskEditSettings);
5115
5132
  };
@@ -5310,7 +5327,7 @@ var GanttView = (function () {
5310
5327
  var item = this.getViewItem(index);
5311
5328
  return item === null || item === void 0 ? void 0 : item.selected;
5312
5329
  };
5313
- GanttView.prototype.getAllVisibleTaskIndices = function () { return this.viewModel.getAllVisibleTaskIndices(); };
5330
+ GanttView.prototype.getAllVisibleTaskIndices = function (start, end) { return this.viewModel.getAllVisibleTaskIndices(start, end); };
5314
5331
  GanttView.prototype.getVisibleDependencyKeysByTaskRange = function (indices) {
5315
5332
  var model = this.viewModel;
5316
5333
  var taskKeys = indices.map(function (i) { return model.tasks.items[i].internalId; });
@@ -5542,8 +5559,9 @@ var GanttView = (function () {
5542
5559
  };
5543
5560
  GanttView.prototype.updateTask = function (key, data) {
5544
5561
  var task = this.getTaskByPublicId(key.toString());
5545
- if (task && data)
5546
- this.commandManager.updateTaskCommand.execute(task.internalId, data);
5562
+ var dataToExecute = this._getTaskDataForUpdate(data, task);
5563
+ if (dataToExecute)
5564
+ this.commandManager.updateTaskCommand.execute(task.internalId, dataToExecute);
5547
5565
  };
5548
5566
  GanttView.prototype.getTaskData = function (key) {
5549
5567
  var task = this.getTaskByPublicId(key.toString());
@@ -5558,7 +5576,7 @@ var GanttView = (function () {
5558
5576
  var successorId = String(data.successorId);
5559
5577
  var successor = this.getTaskByPublicId(successorId);
5560
5578
  var type = data.type;
5561
- if (predecessor && successor)
5579
+ if (predecessor && successor && this.validationController.canCreateDependency(predecessorId, successorId))
5562
5580
  this.commandManager.createDependencyCommand.execute(predecessor.internalId, successor.internalId, type);
5563
5581
  };
5564
5582
  GanttView.prototype.deleteDependency = function (key) {
@@ -5613,6 +5631,18 @@ var GanttView = (function () {
5613
5631
  GanttView.prototype.getVisibleResourceAssignmentKeys = function () { return this.viewModel.getVisibleResourceAssignments().map(function (a) { return a.id; }); };
5614
5632
  GanttView.prototype.getTasksExpandedState = function () { return this.viewModel.getTasksExpandedState(); };
5615
5633
  GanttView.prototype.applyTasksExpandedState = function (state) { this.viewModel.applyTasksExpandedState(state); };
5634
+ GanttView.prototype.updateWithDataReload = function (keepExpandState) {
5635
+ if (this._updateWithModelReloadLocked) {
5636
+ this._pendingUpdateInfo = { keepExpandState: keepExpandState };
5637
+ return;
5638
+ }
5639
+ var state = keepExpandState && this.getTasksExpandedState();
5640
+ this.loadOptionsFromGanttOwner();
5641
+ if (keepExpandState)
5642
+ this.applyTasksExpandedState(state);
5643
+ else
5644
+ this.resetAndUpdate();
5645
+ };
5616
5646
  GanttView.prototype.setTaskValue = function (id, fieldName, newValue) {
5617
5647
  var manager = this.commandManager;
5618
5648
  var task = this.getTaskByPublicId(id);
@@ -5752,6 +5782,22 @@ var GanttView = (function () {
5752
5782
  GanttView.prototype.getCommandByKey = function (key) {
5753
5783
  return this.commandManager.getCommand(key);
5754
5784
  };
5785
+ GanttView.prototype._getTaskDataForUpdate = function (data, task) {
5786
+ var result = {};
5787
+ if (task && data) {
5788
+ if ((0, common_1.isDefined)(data.title) && data.title !== task.title)
5789
+ result["title"] = data.title;
5790
+ if ((0, common_1.isDefined)(data.progress) && data.progress !== task.progress)
5791
+ result["progress"] = data.progress;
5792
+ if ((0, common_1.isDefined)(data.start) && data.start !== task.start)
5793
+ result["start"] = data.start;
5794
+ if ((0, common_1.isDefined)(data.end) && data.end !== task.end)
5795
+ result["end"] = data.end;
5796
+ if ((0, common_1.isDefined)(data.color) && data.color !== task.color)
5797
+ result["color"] = data.color;
5798
+ }
5799
+ return Object.keys(result).length > 0 ? result : null;
5800
+ };
5755
5801
  GanttView.cachedPrefix = "cached_";
5756
5802
  GanttView.taskAreaScrollLeftKey = GanttView.cachedPrefix + "taskAreaScrollLeft";
5757
5803
  GanttView.taskAreaScrollTopKey = GanttView.cachedPrefix + "taskAreaScrollTop";
@@ -6610,6 +6656,13 @@ var TaskEditController = (function () {
6610
6656
  enumerable: false,
6611
6657
  configurable: true
6612
6658
  });
6659
+ Object.defineProperty(TaskEditController.prototype, "validationController", {
6660
+ get: function () {
6661
+ return this.settings.getValidationController();
6662
+ },
6663
+ enumerable: false,
6664
+ configurable: true
6665
+ });
6613
6666
  TaskEditController.prototype.raiseTaskMoving = function (task, newStart, newEnd, callback) {
6614
6667
  return this.settings.getModelManipulator().dispatcher.raiseTaskMoving(task, newStart, newEnd, callback);
6615
6668
  };
@@ -6726,10 +6779,9 @@ var TaskEditController = (function () {
6726
6779
  this.wrapInfo.position.x--;
6727
6780
  };
6728
6781
  TaskEditController.prototype.isAllowedToConnectTasks = function (taskIndex) {
6729
- var isAnotherTask = this.successorIndex !== taskIndex && this.taskIndex !== taskIndex;
6782
+ var _a;
6730
6783
  var successorViewItem = this.viewModel.items[taskIndex];
6731
- var isChild = this.viewItem.children.some(function (c) { return c.task.internalId === successorViewItem.task.internalId; });
6732
- return isAnotherTask && !isChild;
6784
+ return this.validationController.canCreateDependency(this.taskId, (_a = successorViewItem.task) === null || _a === void 0 ? void 0 : _a.internalId);
6733
6785
  };
6734
6786
  TaskEditController.prototype.showDependencySuccessor = function (taskIndex) {
6735
6787
  if (this.isAllowedToConnectTasks(taskIndex)) {
@@ -10013,6 +10065,7 @@ var RemoveTaskCommand = (function (_super) {
10013
10065
  this.modelManipulator.dispatcher.notifyTaskRemoving(args);
10014
10066
  if (args.cancel)
10015
10067
  return false;
10068
+ this.control.history.beginTransaction();
10016
10069
  this.control.viewModel.beginUpdate();
10017
10070
  var removeTaskHistoryItem = historyItem || new RemoveTaskHistoryItem_1.RemoveTaskHistoryItem(this.modelManipulator);
10018
10071
  removeTaskHistoryItem.addTask(id);
@@ -10036,6 +10089,7 @@ var RemoveTaskCommand = (function (_super) {
10036
10089
  var parent = this.control.viewModel.findItem(task.parentId);
10037
10090
  if (this.isUpdateParentTaskRequired)
10038
10091
  _super.prototype.updateParent.call(this, parent);
10092
+ this.control.history.endTransaction();
10039
10093
  this.control.viewModel.endUpdate();
10040
10094
  return true;
10041
10095
  };
@@ -13004,8 +13058,7 @@ var GanttExportCalculator = (function () {
13004
13058
  return points;
13005
13059
  };
13006
13060
  GanttExportCalculator.prototype.getTaskColor = function (index) {
13007
- var _a;
13008
- var color = ((_a = this._owner.getTask(index)) === null || _a === void 0 ? void 0 : _a.color) || this.taskAreaHelper.getTaskElementBackColor(index, GridLayoutCalculator_1.GridLayoutCalculator.taskClassName);
13061
+ var color = this.taskAreaHelper.getTaskElementBackColor(index, GridLayoutCalculator_1.GridLayoutCalculator.taskClassName);
13009
13062
  return new Color_1.Color(color);
13010
13063
  };
13011
13064
  GanttExportCalculator.prototype.getTaskProgressColor = function (index) {
@@ -13478,13 +13531,9 @@ var TaskAreaExportHelper = (function () {
13478
13531
  return point.x;
13479
13532
  };
13480
13533
  TaskAreaExportHelper.prototype.getTaskIndices = function () {
13481
- var _a, _b, _c, _d;
13482
- if (this.dataMode === Props_1.DataExportMode.all || this.exportRange) {
13483
- var allIndices = this._owner.getAllVisibleTaskIndices();
13484
- var start_1 = (_b = (_a = this.exportRange) === null || _a === void 0 ? void 0 : _a.startIndex) !== null && _b !== void 0 ? _b : allIndices[0];
13485
- var end_1 = (_d = (_c = this.exportRange) === null || _c === void 0 ? void 0 : _c.endIndex) !== null && _d !== void 0 ? _d : allIndices[allIndices.length - 1];
13486
- return allIndices.filter(function (tIndex) { return tIndex >= start_1 && tIndex <= end_1; });
13487
- }
13534
+ var _a, _b;
13535
+ if (this.dataMode === Props_1.DataExportMode.all || this.exportRange)
13536
+ return this._owner.getAllVisibleTaskIndices((_a = this.exportRange) === null || _a === void 0 ? void 0 : _a.startIndex, (_b = this.exportRange) === null || _b === void 0 ? void 0 : _b.endIndex);
13488
13537
  return this.getVisibleTaskIndices();
13489
13538
  };
13490
13539
  TaskAreaExportHelper.prototype.getVisibleTaskIndices = function () {
@@ -14711,12 +14760,13 @@ exports.History = void 0;
14711
14760
  var HistoryItemInfo_1 = __webpack_require__(172);
14712
14761
  var CompositionHistoryItem_1 = __webpack_require__(45);
14713
14762
  var History = (function () {
14714
- function History() {
14763
+ function History(listener) {
14715
14764
  this.historyItems = [];
14716
14765
  this.currentIndex = -1;
14717
14766
  this.currentProcessingItemInfo = null;
14718
14767
  this.transaction = null;
14719
14768
  this.transactionLevel = -1;
14769
+ this._listener = listener;
14720
14770
  }
14721
14771
  History.prototype.undo = function () {
14722
14772
  if (this.canUndo()) {
@@ -14731,11 +14781,14 @@ var History = (function () {
14731
14781
  }
14732
14782
  };
14733
14783
  History.prototype.beginTransaction = function () {
14784
+ var _a;
14734
14785
  this.transactionLevel++;
14735
14786
  if (this.transactionLevel == 0)
14736
14787
  this.transaction = new CompositionHistoryItem_1.CompositionHistoryItem();
14788
+ (_a = this._listener) === null || _a === void 0 ? void 0 : _a.onTransactionStart();
14737
14789
  };
14738
14790
  History.prototype.endTransaction = function () {
14791
+ var _a;
14739
14792
  if (--this.transactionLevel >= 0)
14740
14793
  return;
14741
14794
  var transactionLength = this.transaction.historyItems.length;
@@ -14744,6 +14797,7 @@ var History = (function () {
14744
14797
  else if (transactionLength == 1)
14745
14798
  this.addInternal(this.transaction.historyItems.pop());
14746
14799
  this.transaction = null;
14800
+ (_a = this._listener) === null || _a === void 0 ? void 0 : _a.onTransactionEnd();
14747
14801
  };
14748
14802
  History.prototype.addAndRedo = function (historyItem) {
14749
14803
  this.add(historyItem);
@@ -18775,6 +18829,8 @@ var TaskEditSettings = (function (_super) {
18775
18829
  result.formatDate = settings.formatDate;
18776
18830
  if ((0, common_1.isDefined)(settings.getModelManipulator))
18777
18831
  result.getModelManipulator = settings.getModelManipulator;
18832
+ if ((0, common_1.isDefined)(settings.getValidationController))
18833
+ result.getValidationController = settings.getValidationController;
18778
18834
  }
18779
18835
  return result;
18780
18836
  };
@@ -19100,12 +19156,6 @@ var ValidationController = (function () {
19100
19156
  };
19101
19157
  ValidationController.prototype.updateParentsIfRequired = function (childId) {
19102
19158
  if (this._parentAutoCalc) {
19103
- var task = this.viewModel.findItem(childId);
19104
- var parent_1 = task.parent;
19105
- while (!!parent_1 && !!parent_1.task) {
19106
- this.modelManipulator.dispatcher.notifyParentTaskUpdated(parent_1.task, this.viewModel.getDataUpdateErrorCallback());
19107
- parent_1 = parent_1.parent;
19108
- }
19109
19159
  this.updateParentsRangeByChild(childId);
19110
19160
  this.updateOwnerInAutoParentMode();
19111
19161
  }
@@ -19124,6 +19174,20 @@ var ValidationController = (function () {
19124
19174
  this.updateOwnerInAutoParentMode();
19125
19175
  }
19126
19176
  };
19177
+ ValidationController.prototype.canCreateDependency = function (predecessorId, successorId) {
19178
+ if (!predecessorId || !successorId || predecessorId === successorId)
19179
+ return false;
19180
+ var model = this.viewModel;
19181
+ if (model.dependencies.items.some(function (d) { return (d.predecessorId === predecessorId && d.successorId === successorId) || (d.predecessorId === successorId && d.successorId === predecessorId); }))
19182
+ return false;
19183
+ if (this._parentAutoCalc && this.validationSettings.validateDependencies) {
19184
+ if (model.checkParent(predecessorId, successorId))
19185
+ return false;
19186
+ if (model.checkParent(successorId, predecessorId))
19187
+ return false;
19188
+ }
19189
+ return true;
19190
+ };
19127
19191
  return ValidationController;
19128
19192
  }());
19129
19193
  exports.ValidationController = ValidationController;
@@ -19218,7 +19282,7 @@ var ViewVisualModel = (function () {
19218
19282
  this._itemList = new Array();
19219
19283
  this._viewItemList = new Array();
19220
19284
  this._workTimeCalculator = new WorkingTimeCalculator_1.WorkingTimeCalculator(dateRange, workTimeRules);
19221
- this.updateModel();
19285
+ this.updateModel(true);
19222
19286
  }
19223
19287
  Object.defineProperty(ViewVisualModel.prototype, "renderHelper", {
19224
19288
  get: function () {
@@ -19227,7 +19291,7 @@ var ViewVisualModel = (function () {
19227
19291
  enumerable: false,
19228
19292
  configurable: true
19229
19293
  });
19230
- ViewVisualModel.prototype.updateModel = function () {
19294
+ ViewVisualModel.prototype.updateModel = function (isFirstLoad) {
19231
19295
  this._itemList.splice(0, this._itemList.length);
19232
19296
  var tasks = this.tasks.items;
19233
19297
  for (var i = 0; i < tasks.length; i++) {
@@ -19235,12 +19299,12 @@ var ViewVisualModel = (function () {
19235
19299
  if (task)
19236
19300
  this._itemList.push(new ViewVisualModelItem_1.ViewVisualModelItem(task, this.getAssignedResources(task)));
19237
19301
  }
19238
- this.createHierarchy();
19302
+ this.createHierarchy(isFirstLoad);
19239
19303
  this.populateItemsForView();
19240
19304
  if (this.owner && this.owner.currentSelectedTaskID)
19241
19305
  this.changeTaskSelected(this.owner.currentSelectedTaskID, true);
19242
19306
  };
19243
- ViewVisualModel.prototype.createHierarchy = function () {
19307
+ ViewVisualModel.prototype.createHierarchy = function (isFirstLoad) {
19244
19308
  var _this = this;
19245
19309
  this.root = new ViewVisualModelItem_1.ViewVisualModelItem(null, null);
19246
19310
  var list = this._itemList;
@@ -19251,7 +19315,7 @@ var ViewVisualModel = (function () {
19251
19315
  previous[key] = item;
19252
19316
  return previous;
19253
19317
  }, {});
19254
- var recalculateParentRequired = this.requireFirstLoadParentAutoCalc;
19318
+ var recalculateParentRequired = this.requireFirstLoadParentAutoCalc && isFirstLoad;
19255
19319
  for (var i = 0; i < list.length; i++) {
19256
19320
  var item = list[i];
19257
19321
  var parentId = item.task.parentId;
@@ -19450,6 +19514,22 @@ var ViewVisualModel = (function () {
19450
19514
  task.internalId = hash[id];
19451
19515
  }
19452
19516
  };
19517
+ ViewVisualModel.prototype.getTaskTreeLine = function (taskId) {
19518
+ var result = [];
19519
+ var item = this.findItem(taskId);
19520
+ if (item) {
19521
+ result.push(taskId);
19522
+ item = item.parent;
19523
+ while (item === null || item === void 0 ? void 0 : item.task) {
19524
+ result.push(item === null || item === void 0 ? void 0 : item.task.internalId);
19525
+ item = item.parent;
19526
+ }
19527
+ }
19528
+ return result;
19529
+ };
19530
+ ViewVisualModel.prototype.checkParent = function (childId, parentId) {
19531
+ return this.getTaskTreeLine(childId).indexOf(parentId) > -1;
19532
+ };
19453
19533
  ViewVisualModel.prototype.getTasksExpandedState = function () {
19454
19534
  var items = this.tasks.items;
19455
19535
  var state = {};
@@ -19570,13 +19650,16 @@ var ViewVisualModel = (function () {
19570
19650
  var taskInternalKey = this.convertPublicToInternalKey("task", taskKey);
19571
19651
  return this.assignments.items.filter(function (val) { return val.resourceId === resourceInternalKey && val.taskId === taskInternalKey; })[0];
19572
19652
  };
19573
- ViewVisualModel.prototype.getAllVisibleTaskIndices = function () {
19574
- var _this = this;
19653
+ ViewVisualModel.prototype.getAllVisibleTaskIndices = function (start, end) {
19654
+ var _a;
19575
19655
  var result = [];
19576
- this.tasks.items.forEach(function (t, index) {
19577
- if (t && _this.getTaskVisibility(t.internalId) && t.isValid())
19578
- result.push(index);
19579
- });
19656
+ start !== null && start !== void 0 ? start : (start = 0);
19657
+ end !== null && end !== void 0 ? end : (end = this._viewItemList.length - 1);
19658
+ for (var i = start; i <= end; i++) {
19659
+ var item = this._viewItemList[i];
19660
+ if (item.getVisible() && ((_a = item.task) === null || _a === void 0 ? void 0 : _a.isValid))
19661
+ result.push(i);
19662
+ }
19580
19663
  return result;
19581
19664
  };
19582
19665
  ViewVisualModel.prototype.getVisibleTasks = function () {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * DevExpress Gantt (dx-gantt.min)
3
- * Version: 3.0.15
4
- * Build date: Tue Sep 28 2021
3
+ * Version: 3.0.19
4
+ * Build date: Fri Oct 29 2021
5
5
  *
6
6
  * Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED
7
7
  * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs