devexpress-gantt 3.1.23 → 3.1.27

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.1.23
4
- * Build date: Mon Oct 04 2021
3
+ * Version: 3.1.27
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.1.23
4
- * Build date: Mon Oct 04 2021
3
+ * Version: 3.1.27
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
@@ -5078,6 +5078,7 @@ var GanttView = (function () {
5078
5078
  var _this = this;
5079
5079
  this.currentSelectedTaskID = "";
5080
5080
  this.isFocus = false;
5081
+ this._updateWithModelReloadLocked = false;
5081
5082
  this.scaleCount = 2;
5082
5083
  this.tickSize = new size_1.Size(0, 0);
5083
5084
  this.currentZoom = 1;
@@ -5093,7 +5094,7 @@ var GanttView = (function () {
5093
5094
  this.barManager = new BarManager_1.BarManager(this.commandManager, this.ganttOwner.bars);
5094
5095
  this.initTaskEditController();
5095
5096
  this.initEventManager();
5096
- this.history = new History_1.History();
5097
+ this.history = new History_1.History(this._getHistoryListener());
5097
5098
  this.initFullScreenModeHelper();
5098
5099
  this.onWindowResizelHandler = this.onBrowserWindowResize.bind(this);
5099
5100
  window.addEventListener("resize", this.onWindowResizelHandler);
@@ -5107,6 +5108,21 @@ var GanttView = (function () {
5107
5108
  GanttView.prototype.initGanttViewApi = function () {
5108
5109
  this.ganttViewApi = new GanttViewApi_1.GanttViewApi(this);
5109
5110
  };
5111
+ GanttView.prototype._getHistoryListener = function () {
5112
+ var listener = {
5113
+ onTransactionStart: this.onHistoryTransactionStart.bind(this),
5114
+ onTransactionEnd: this.onHistoryTransactionEnd.bind(this),
5115
+ };
5116
+ return listener;
5117
+ };
5118
+ GanttView.prototype.onHistoryTransactionStart = function () { this._updateWithModelReloadLocked = true; };
5119
+ GanttView.prototype.onHistoryTransactionEnd = function () {
5120
+ this._updateWithModelReloadLocked = false;
5121
+ if (this._pendingUpdateInfo) {
5122
+ this.updateWithDataReload(this._pendingUpdateInfo.keepExpandState);
5123
+ this._pendingUpdateInfo = null;
5124
+ }
5125
+ };
5110
5126
  GanttView.prototype.initValidationController = function () {
5111
5127
  var _this = this;
5112
5128
  var validationControllerSettings = ValidationControllerSettings_1.ValidationControllerSettings.parse({
@@ -5129,7 +5145,8 @@ var GanttView = (function () {
5129
5145
  getGanttSettings: function () { return _this.settings; },
5130
5146
  getViewModel: function () { return _this.viewModel; },
5131
5147
  getCommandManager: function () { return _this.commandManager; },
5132
- getModelManipulator: function () { return _this.modelManipulator; }
5148
+ getModelManipulator: function () { return _this.modelManipulator; },
5149
+ getValidationController: function () { return _this.validationController; }
5133
5150
  });
5134
5151
  this.taskEditController = new TaskEditController_1.TaskEditController(taskEditSettings);
5135
5152
  };
@@ -5311,7 +5328,7 @@ var GanttView = (function () {
5311
5328
  var item = this.getViewItem(index);
5312
5329
  return item === null || item === void 0 ? void 0 : item.selected;
5313
5330
  };
5314
- GanttView.prototype.getAllVisibleTaskIndices = function () { return this.viewModel.getAllVisibleTaskIndices(); };
5331
+ GanttView.prototype.getAllVisibleTaskIndices = function (start, end) { return this.viewModel.getAllVisibleTaskIndices(start, end); };
5315
5332
  GanttView.prototype.getVisibleDependencyKeysByTaskRange = function (indices) {
5316
5333
  var model = this.viewModel;
5317
5334
  var taskKeys = indices.map(function (i) { return model.tasks.items[i].internalId; });
@@ -5563,8 +5580,9 @@ var GanttView = (function () {
5563
5580
  };
5564
5581
  GanttView.prototype.updateTask = function (key, data) {
5565
5582
  var task = this.getTaskByPublicId(key.toString());
5566
- if (task && data)
5567
- this.commandManager.updateTaskCommand.execute(task.internalId, data);
5583
+ var dataToExecute = this._getTaskDataForUpdate(data, task);
5584
+ if (dataToExecute)
5585
+ this.commandManager.updateTaskCommand.execute(task.internalId, dataToExecute);
5568
5586
  };
5569
5587
  GanttView.prototype.getTaskData = function (key) {
5570
5588
  var task = this.getTaskByPublicId(key.toString());
@@ -5579,7 +5597,7 @@ var GanttView = (function () {
5579
5597
  var successorId = String(data.successorId);
5580
5598
  var successor = this.getTaskByPublicId(successorId);
5581
5599
  var type = data.type;
5582
- if (predecessor && successor)
5600
+ if (predecessor && successor && this.validationController.canCreateDependency(predecessorId, successorId))
5583
5601
  this.commandManager.createDependencyCommand.execute(predecessor.internalId, successor.internalId, type);
5584
5602
  };
5585
5603
  GanttView.prototype.deleteDependency = function (key) {
@@ -5640,6 +5658,18 @@ var GanttView = (function () {
5640
5658
  GanttView.prototype.getVisibleResourceAssignmentKeys = function () { return this.viewModel.getVisibleResourceAssignments().map(function (a) { return a.id; }); };
5641
5659
  GanttView.prototype.getTasksExpandedState = function () { return this.viewModel.getTasksExpandedState(); };
5642
5660
  GanttView.prototype.applyTasksExpandedState = function (state) { this.viewModel.applyTasksExpandedState(state); };
5661
+ GanttView.prototype.updateWithDataReload = function (keepExpandState) {
5662
+ if (this._updateWithModelReloadLocked) {
5663
+ this._pendingUpdateInfo = { keepExpandState: keepExpandState };
5664
+ return;
5665
+ }
5666
+ var state = keepExpandState && this.getTasksExpandedState();
5667
+ this.loadOptionsFromGanttOwner();
5668
+ if (keepExpandState)
5669
+ this.applyTasksExpandedState(state);
5670
+ else
5671
+ this.resetAndUpdate();
5672
+ };
5643
5673
  GanttView.prototype.setTaskValue = function (id, fieldName, newValue) {
5644
5674
  var manager = this.commandManager;
5645
5675
  var task = this.getTaskByPublicId(id);
@@ -5784,6 +5814,22 @@ var GanttView = (function () {
5784
5814
  GanttView.prototype.getCommandByKey = function (key) {
5785
5815
  return this.commandManager.getCommand(key);
5786
5816
  };
5817
+ GanttView.prototype._getTaskDataForUpdate = function (data, task) {
5818
+ var result = {};
5819
+ if (task && data) {
5820
+ if ((0, common_1.isDefined)(data.title) && data.title !== task.title)
5821
+ result["title"] = data.title;
5822
+ if ((0, common_1.isDefined)(data.progress) && data.progress !== task.progress)
5823
+ result["progress"] = data.progress;
5824
+ if ((0, common_1.isDefined)(data.start) && data.start !== task.start)
5825
+ result["start"] = data.start;
5826
+ if ((0, common_1.isDefined)(data.end) && data.end !== task.end)
5827
+ result["end"] = data.end;
5828
+ if ((0, common_1.isDefined)(data.color) && data.color !== task.color)
5829
+ result["color"] = data.color;
5830
+ }
5831
+ return Object.keys(result).length > 0 ? result : null;
5832
+ };
5787
5833
  GanttView.cachedPrefix = "cached_";
5788
5834
  GanttView.taskAreaScrollLeftKey = GanttView.cachedPrefix + "taskAreaScrollLeft";
5789
5835
  GanttView.taskAreaScrollTopKey = GanttView.cachedPrefix + "taskAreaScrollTop";
@@ -6642,6 +6688,13 @@ var TaskEditController = (function () {
6642
6688
  enumerable: false,
6643
6689
  configurable: true
6644
6690
  });
6691
+ Object.defineProperty(TaskEditController.prototype, "validationController", {
6692
+ get: function () {
6693
+ return this.settings.getValidationController();
6694
+ },
6695
+ enumerable: false,
6696
+ configurable: true
6697
+ });
6645
6698
  TaskEditController.prototype.raiseTaskMoving = function (task, newStart, newEnd, callback) {
6646
6699
  return this.settings.getModelManipulator().dispatcher.raiseTaskMoving(task, newStart, newEnd, callback);
6647
6700
  };
@@ -6758,10 +6811,9 @@ var TaskEditController = (function () {
6758
6811
  this.wrapInfo.position.x--;
6759
6812
  };
6760
6813
  TaskEditController.prototype.isAllowedToConnectTasks = function (taskIndex) {
6761
- var isAnotherTask = this.successorIndex !== taskIndex && this.taskIndex !== taskIndex;
6814
+ var _a;
6762
6815
  var successorViewItem = this.viewModel.items[taskIndex];
6763
- var isChild = this.viewItem.children.some(function (c) { return c.task.internalId === successorViewItem.task.internalId; });
6764
- return isAnotherTask && !isChild;
6816
+ return this.validationController.canCreateDependency(this.taskId, (_a = successorViewItem.task) === null || _a === void 0 ? void 0 : _a.internalId);
6765
6817
  };
6766
6818
  TaskEditController.prototype.showDependencySuccessor = function (taskIndex) {
6767
6819
  if (this.isAllowedToConnectTasks(taskIndex)) {
@@ -9937,6 +9989,7 @@ var RemoveTaskCommand = (function (_super) {
9937
9989
  this.modelManipulator.dispatcher.notifyTaskRemoving(args);
9938
9990
  if (args.cancel)
9939
9991
  return false;
9992
+ this.control.history.beginTransaction();
9940
9993
  this.control.viewModel.beginUpdate();
9941
9994
  var removeTaskHistoryItem = historyItem || new RemoveTaskHistoryItem_1.RemoveTaskHistoryItem(this.modelManipulator);
9942
9995
  removeTaskHistoryItem.addTask(id);
@@ -9960,6 +10013,7 @@ var RemoveTaskCommand = (function (_super) {
9960
10013
  var parent = this.control.viewModel.findItem(task.parentId);
9961
10014
  if (this.isUpdateParentTaskRequired)
9962
10015
  _super.prototype.updateParent.call(this, parent);
10016
+ this.control.history.endTransaction();
9963
10017
  this.control.viewModel.endUpdate();
9964
10018
  return true;
9965
10019
  };
@@ -13235,8 +13289,7 @@ var GanttExportCalculator = (function () {
13235
13289
  return points;
13236
13290
  };
13237
13291
  GanttExportCalculator.prototype.getTaskColor = function (index) {
13238
- var _a;
13239
- var color = ((_a = this._owner.getTask(index)) === null || _a === void 0 ? void 0 : _a.color) || this.taskAreaHelper.getTaskElementBackColor(index, GridLayoutCalculator_1.GridLayoutCalculator.taskClassName);
13292
+ var color = this.taskAreaHelper.getTaskElementBackColor(index, GridLayoutCalculator_1.GridLayoutCalculator.taskClassName);
13240
13293
  return new Color_1.Color(color);
13241
13294
  };
13242
13295
  GanttExportCalculator.prototype.getTaskProgressColor = function (index) {
@@ -13658,13 +13711,9 @@ var TaskAreaExportHelper = (function () {
13658
13711
  return point.x;
13659
13712
  };
13660
13713
  TaskAreaExportHelper.prototype.getTaskIndices = function () {
13661
- var _a, _b, _c, _d;
13662
- if (this.dataMode === Props_1.DataExportMode.all || this.exportRange) {
13663
- var allIndices = this._owner.getAllVisibleTaskIndices();
13664
- var start_1 = (_b = (_a = this.exportRange) === null || _a === void 0 ? void 0 : _a.startIndex) !== null && _b !== void 0 ? _b : allIndices[0];
13665
- var end_1 = (_d = (_c = this.exportRange) === null || _c === void 0 ? void 0 : _c.endIndex) !== null && _d !== void 0 ? _d : allIndices[allIndices.length - 1];
13666
- return allIndices.filter(function (tIndex) { return tIndex >= start_1 && tIndex <= end_1; });
13667
- }
13714
+ var _a, _b;
13715
+ if (this.dataMode === Props_1.DataExportMode.all || this.exportRange)
13716
+ 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);
13668
13717
  return this.getVisibleTaskIndices();
13669
13718
  };
13670
13719
  TaskAreaExportHelper.prototype.getVisibleTaskIndices = function () {
@@ -14873,12 +14922,13 @@ exports.History = void 0;
14873
14922
  var HistoryItemInfo_1 = __webpack_require__(174);
14874
14923
  var CompositionHistoryItem_1 = __webpack_require__(45);
14875
14924
  var History = (function () {
14876
- function History() {
14925
+ function History(listener) {
14877
14926
  this.historyItems = [];
14878
14927
  this.currentIndex = -1;
14879
14928
  this.currentProcessingItemInfo = null;
14880
14929
  this.transaction = null;
14881
14930
  this.transactionLevel = -1;
14931
+ this._listener = listener;
14882
14932
  }
14883
14933
  History.prototype.undo = function () {
14884
14934
  if (this.canUndo()) {
@@ -14893,11 +14943,14 @@ var History = (function () {
14893
14943
  }
14894
14944
  };
14895
14945
  History.prototype.beginTransaction = function () {
14946
+ var _a;
14896
14947
  this.transactionLevel++;
14897
14948
  if (this.transactionLevel == 0)
14898
14949
  this.transaction = new CompositionHistoryItem_1.CompositionHistoryItem();
14950
+ (_a = this._listener) === null || _a === void 0 ? void 0 : _a.onTransactionStart();
14899
14951
  };
14900
14952
  History.prototype.endTransaction = function () {
14953
+ var _a;
14901
14954
  if (--this.transactionLevel >= 0)
14902
14955
  return;
14903
14956
  var transactionLength = this.transaction.historyItems.length;
@@ -14906,6 +14959,7 @@ var History = (function () {
14906
14959
  else if (transactionLength == 1)
14907
14960
  this.addInternal(this.transaction.historyItems.pop());
14908
14961
  this.transaction = null;
14962
+ (_a = this._listener) === null || _a === void 0 ? void 0 : _a.onTransactionEnd();
14909
14963
  };
14910
14964
  History.prototype.addAndRedo = function (historyItem) {
14911
14965
  this.add(historyItem);
@@ -19226,6 +19280,8 @@ var TaskEditSettings = (function (_super) {
19226
19280
  result.formatDate = settings.formatDate;
19227
19281
  if ((0, common_1.isDefined)(settings.getModelManipulator))
19228
19282
  result.getModelManipulator = settings.getModelManipulator;
19283
+ if ((0, common_1.isDefined)(settings.getValidationController))
19284
+ result.getValidationController = settings.getValidationController;
19229
19285
  }
19230
19286
  return result;
19231
19287
  };
@@ -19558,12 +19614,6 @@ var ValidationController = (function () {
19558
19614
  };
19559
19615
  ValidationController.prototype.updateParentsIfRequired = function (childId) {
19560
19616
  if (this._parentAutoCalc) {
19561
- var task = this.viewModel.findItem(childId);
19562
- var parent_1 = task.parent;
19563
- while (!!parent_1 && !!parent_1.task) {
19564
- this.modelManipulator.dispatcher.notifyParentTaskUpdated(parent_1.task, this.viewModel.getDataUpdateErrorCallback());
19565
- parent_1 = parent_1.parent;
19566
- }
19567
19617
  this.updateParentsRangeByChild(childId);
19568
19618
  this.updateOwnerInAutoParentMode();
19569
19619
  }
@@ -19582,6 +19632,20 @@ var ValidationController = (function () {
19582
19632
  this.updateOwnerInAutoParentMode();
19583
19633
  }
19584
19634
  };
19635
+ ValidationController.prototype.canCreateDependency = function (predecessorId, successorId) {
19636
+ if (!predecessorId || !successorId || predecessorId === successorId)
19637
+ return false;
19638
+ var model = this.viewModel;
19639
+ if (model.dependencies.items.some(function (d) { return (d.predecessorId === predecessorId && d.successorId === successorId) || (d.predecessorId === successorId && d.successorId === predecessorId); }))
19640
+ return false;
19641
+ if (this._parentAutoCalc && this.isValidateDependenciesRequired) {
19642
+ if (model.checkParent(predecessorId, successorId))
19643
+ return false;
19644
+ if (model.checkParent(successorId, predecessorId))
19645
+ return false;
19646
+ }
19647
+ return true;
19648
+ };
19585
19649
  return ValidationController;
19586
19650
  }());
19587
19651
  exports.ValidationController = ValidationController;
@@ -19678,7 +19742,7 @@ var ViewVisualModel = (function () {
19678
19742
  this._itemList = new Array();
19679
19743
  this._viewItemList = new Array();
19680
19744
  this._workTimeCalculator = new WorkingTimeCalculator_1.WorkingTimeCalculator(dateRange, workTimeRules);
19681
- this.updateModel();
19745
+ this.updateModel(true);
19682
19746
  }
19683
19747
  Object.defineProperty(ViewVisualModel.prototype, "renderHelper", {
19684
19748
  get: function () {
@@ -19687,7 +19751,7 @@ var ViewVisualModel = (function () {
19687
19751
  enumerable: false,
19688
19752
  configurable: true
19689
19753
  });
19690
- ViewVisualModel.prototype.updateModel = function () {
19754
+ ViewVisualModel.prototype.updateModel = function (isFirstLoad) {
19691
19755
  this._itemList.splice(0, this._itemList.length);
19692
19756
  var tasks = this.tasks.items;
19693
19757
  for (var i = 0; i < tasks.length; i++) {
@@ -19695,12 +19759,12 @@ var ViewVisualModel = (function () {
19695
19759
  if (task)
19696
19760
  this._itemList.push(new ViewVisualModelItem_1.ViewVisualModelItem(task, this.getAssignedResources(task)));
19697
19761
  }
19698
- this.createHierarchy();
19762
+ this.createHierarchy(isFirstLoad);
19699
19763
  this.populateItemsForView();
19700
19764
  if (this.owner && this.owner.currentSelectedTaskID)
19701
19765
  this.changeTaskSelected(this.owner.currentSelectedTaskID, true);
19702
19766
  };
19703
- ViewVisualModel.prototype.createHierarchy = function () {
19767
+ ViewVisualModel.prototype.createHierarchy = function (isFirstLoad) {
19704
19768
  var _this = this;
19705
19769
  this.root = new ViewVisualModelItem_1.ViewVisualModelItem(null, null);
19706
19770
  var list = this._itemList;
@@ -19711,7 +19775,7 @@ var ViewVisualModel = (function () {
19711
19775
  previous[key] = item;
19712
19776
  return previous;
19713
19777
  }, {});
19714
- var recalculateParentRequired = this.requireFirstLoadParentAutoCalc;
19778
+ var recalculateParentRequired = this.requireFirstLoadParentAutoCalc && isFirstLoad;
19715
19779
  for (var i = 0; i < list.length; i++) {
19716
19780
  var item = list[i];
19717
19781
  var parentId = item.task.parentId;
@@ -19910,6 +19974,22 @@ var ViewVisualModel = (function () {
19910
19974
  task.internalId = hash[id];
19911
19975
  }
19912
19976
  };
19977
+ ViewVisualModel.prototype.getTaskTreeLine = function (taskId) {
19978
+ var result = [];
19979
+ var item = this.findItem(taskId);
19980
+ if (item) {
19981
+ result.push(taskId);
19982
+ item = item.parent;
19983
+ while (item === null || item === void 0 ? void 0 : item.task) {
19984
+ result.push(item === null || item === void 0 ? void 0 : item.task.internalId);
19985
+ item = item.parent;
19986
+ }
19987
+ }
19988
+ return result;
19989
+ };
19990
+ ViewVisualModel.prototype.checkParent = function (childId, parentId) {
19991
+ return this.getTaskTreeLine(childId).indexOf(parentId) > -1;
19992
+ };
19913
19993
  ViewVisualModel.prototype.getTasksExpandedState = function () {
19914
19994
  var items = this.tasks.items;
19915
19995
  var state = {};
@@ -20033,13 +20113,16 @@ var ViewVisualModel = (function () {
20033
20113
  ViewVisualModel.prototype.findAllTaskAssignments = function (taskInternalKey) {
20034
20114
  return this.assignments.items.filter(function (val) { return val.taskId === taskInternalKey; });
20035
20115
  };
20036
- ViewVisualModel.prototype.getAllVisibleTaskIndices = function () {
20037
- var _this = this;
20116
+ ViewVisualModel.prototype.getAllVisibleTaskIndices = function (start, end) {
20117
+ var _a;
20038
20118
  var result = [];
20039
- this.tasks.items.forEach(function (t, index) {
20040
- if (t && _this.getTaskVisibility(t.internalId) && t.isValid())
20041
- result.push(index);
20042
- });
20119
+ start !== null && start !== void 0 ? start : (start = 0);
20120
+ end !== null && end !== void 0 ? end : (end = this._viewItemList.length - 1);
20121
+ for (var i = start; i <= end; i++) {
20122
+ var item = this._viewItemList[i];
20123
+ if (item.getVisible() && ((_a = item.task) === null || _a === void 0 ? void 0 : _a.isValid))
20124
+ result.push(i);
20125
+ }
20043
20126
  return result;
20044
20127
  };
20045
20128
  ViewVisualModel.prototype.getVisibleTasks = function () {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * DevExpress Gantt (dx-gantt.min)
3
- * Version: 3.1.23
4
- * Build date: Mon Oct 04 2021
3
+ * Version: 3.1.27
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