devexpress-gantt 0.0.22 → 0.0.23

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: 0.0.22
4
- * Build date: Wed Oct 16 2019
3
+ * Version: 0.0.23
4
+ * Build date: Thu Oct 17 2019
5
5
  *
6
6
  * Copyright (c) 2012 - 2019 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: 0.0.22
4
- * Build date: Wed Oct 16 2019
3
+ * Version: 0.0.23
4
+ * Build date: Thu Oct 17 2019
5
5
  *
6
6
  * Copyright (c) 2012 - 2019 Developer Express Inc. ALL RIGHTS RESERVED
7
7
  * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs
@@ -730,19 +730,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
730
730
  var Utils_1 = __webpack_require__(0);
731
731
  var DataObject = (function () {
732
732
  function DataObject() {
733
- this.internalId = this.generateId();
733
+ this.internalId = this.generateGuid();
734
734
  }
735
735
  DataObject.prototype.assignFromObject = function (sourceObj) {
736
736
  if (!Utils_1.JsonUtils.isExists(sourceObj))
737
737
  return;
738
738
  if (Utils_1.JsonUtils.isExists(sourceObj.id)) {
739
- this.id = String(sourceObj.id);
739
+ this.id = sourceObj.id;
740
740
  this.internalId = String(sourceObj.id);
741
741
  }
742
742
  };
743
- DataObject.prototype.generateId = function () {
744
- var rnd = Math.floor(Math.random() * 10000);
745
- return "id" + rnd;
743
+ DataObject.prototype.generateGuid = function () {
744
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
745
+ var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
746
+ return v.toString(16);
747
+ });
746
748
  };
747
749
  return DataObject;
748
750
  }());
@@ -993,7 +995,7 @@ var TaskAreaManager = (function () {
993
995
  TaskAreaManager.prototype.onDocumentMouseUp = function (evt) {
994
996
  var _this = this;
995
997
  this.ganttView.isFocus = DomUtils_1.DomUtils.GetIsParent(this.ganttView.taskArea, DomUtils_1.DomUtils.getEventSource(evt)) ? true : false;
996
- if (this.ganttView.isFocus && this.ganttView.settings.allowSelectTask && !this.isConnectorLine(evt))
998
+ if (this.ganttView.isFocus && !this.preventSelect && this.ganttView.settings.allowSelectTask && !this.isConnectorLine(evt))
997
999
  setTimeout(function () { _this.changeTaskSelection(_this.getClickedTaskIndex(evt)); }, 0);
998
1000
  this.eventManager.onMouseUp(evt);
999
1001
  };
@@ -1032,7 +1034,7 @@ var TaskAreaManager = (function () {
1032
1034
  var clickedTask = this.ganttView.viewModel.items[index];
1033
1035
  if (clickedTask) {
1034
1036
  this.ganttView.unselectCurrentSelectedTask();
1035
- this.ganttView.ganttOwner.changeGanttTaskSelection(clickedTask.task.internalId, true);
1037
+ this.ganttView.ganttOwner.changeGanttTaskSelection(clickedTask.task.id, true);
1036
1038
  this.ganttView.selectTask(clickedTask.task.internalId);
1037
1039
  }
1038
1040
  };
@@ -1765,7 +1767,7 @@ var TaskTitleManipulator = (function (_super) {
1765
1767
  };
1766
1768
  TaskTitleManipulator.prototype.setPropertyValue = function (task, value) {
1767
1769
  task.title = value;
1768
- this.dispatcher.notifyTaskTitleChanged(task.internalId, value);
1770
+ this.dispatcher.notifyTaskTitleChanged(task.id, value);
1769
1771
  };
1770
1772
  return TaskTitleManipulator;
1771
1773
  }(TaskPropertyManipulator));
@@ -1779,7 +1781,7 @@ var TaskDescriptionManipulator = (function (_super) {
1779
1781
  };
1780
1782
  TaskDescriptionManipulator.prototype.setPropertyValue = function (task, value) {
1781
1783
  task.description = value;
1782
- this.dispatcher.notifyTaskDescriptionChanged(task.internalId, value);
1784
+ this.dispatcher.notifyTaskDescriptionChanged(task.id, value);
1783
1785
  };
1784
1786
  return TaskDescriptionManipulator;
1785
1787
  }(TaskPropertyManipulator));
@@ -1793,7 +1795,7 @@ var TaskProgressManipulator = (function (_super) {
1793
1795
  };
1794
1796
  TaskProgressManipulator.prototype.setPropertyValue = function (task, value) {
1795
1797
  task.progress = value;
1796
- this.dispatcher.notifyTaskProgressChanged(task.internalId, value);
1798
+ this.dispatcher.notifyTaskProgressChanged(task.id, value);
1797
1799
  };
1798
1800
  return TaskProgressManipulator;
1799
1801
  }(TaskPropertyManipulator));
@@ -1807,7 +1809,7 @@ var TaskStartDateManipulator = (function (_super) {
1807
1809
  };
1808
1810
  TaskStartDateManipulator.prototype.setPropertyValue = function (task, value) {
1809
1811
  task.start = value;
1810
- this.dispatcher.notifyTaskStartChanged(task.internalId, value);
1812
+ this.dispatcher.notifyTaskStartChanged(task.id, value);
1811
1813
  };
1812
1814
  return TaskStartDateManipulator;
1813
1815
  }(TaskPropertyManipulator));
@@ -1821,7 +1823,7 @@ var TaskEndDateManipulator = (function (_super) {
1821
1823
  };
1822
1824
  TaskEndDateManipulator.prototype.setPropertyValue = function (task, value) {
1823
1825
  task.end = value;
1824
- this.dispatcher.notifyTaskEndChanged(task.internalId, value);
1826
+ this.dispatcher.notifyTaskEndChanged(task.id, value);
1825
1827
  };
1826
1828
  return TaskEndDateManipulator;
1827
1829
  }(TaskPropertyManipulator));
@@ -3013,7 +3015,7 @@ var TaskEditController = (function () {
3013
3015
  TaskEditController.prototype.endDependency = function (type) {
3014
3016
  this.editing = false;
3015
3017
  if (type != null)
3016
- this.gantt.commandManager.createDependencyCommand.execute(this.task.id, this.successorId, type);
3018
+ this.gantt.commandManager.createDependencyCommand.execute(this.task.internalId, this.successorId, type);
3017
3019
  var parentNode = this.dependencyLine.parentNode;
3018
3020
  if (parentNode)
3019
3021
  parentNode.removeChild(this.dependencyLine);
@@ -3795,6 +3797,11 @@ var GanttView = (function () {
3795
3797
  return Enums_1.ViewType.Hours;
3796
3798
  return Enums_1.ViewType.TenMinutes;
3797
3799
  };
3800
+ GanttView.prototype.changeTaskExpanded = function (publicId, expanded) {
3801
+ var task = this.getTaskByPublicId(publicId);
3802
+ if (task)
3803
+ this.viewModel.changeTaskExpanded(task.internalId, expanded);
3804
+ };
3798
3805
  GanttView.prototype.expandTask = function (id) { this.viewModel.changeTaskExpanded(id, true); };
3799
3806
  GanttView.prototype.collapseTask = function (id) { this.viewModel.changeTaskExpanded(id, false); };
3800
3807
  GanttView.prototype.showTask = function (id) { this.viewModel.changeTaskVisibility(id, true); };
@@ -3851,7 +3858,15 @@ var GanttView = (function () {
3851
3858
  this.viewModel.changeTaskSelected(id, true);
3852
3859
  this.currentSelectedTaskID = id;
3853
3860
  };
3854
- GanttView.prototype.unselectTask = function (id) { this.viewModel.changeTaskSelected(id, false); };
3861
+ GanttView.prototype.unselectTask = function (id) {
3862
+ this.viewModel.changeTaskSelected(id, false);
3863
+ };
3864
+ GanttView.prototype.selectTaskById = function (publicId) {
3865
+ this.unselectCurrentSelectedTask();
3866
+ var task = this.getTaskByPublicId(publicId);
3867
+ if (task)
3868
+ this.selectTask(task.internalId);
3869
+ };
3855
3870
  GanttView.prototype.getTaskAreaContainer = function () {
3856
3871
  return this.taskAreaContainer;
3857
3872
  };
@@ -5832,7 +5847,7 @@ var TaskDependencyManipulator = (function (_super) {
5832
5847
  dependency.successorId = successorId;
5833
5848
  dependency.type = type;
5834
5849
  this.viewModel.dependencies.add(dependency);
5835
- this.dispatcher.notifyDependencyInserted(dependency);
5850
+ this.dispatcher.notifyDependencyInserted(this.getObjectForDataSource(dependency), function (id) { return dependency.id = id; });
5836
5851
  this.viewModel.updateVisibleItemDependencies();
5837
5852
  this.viewModel.owner.resetAndUpdate();
5838
5853
  return dependency;
@@ -5840,11 +5855,19 @@ var TaskDependencyManipulator = (function (_super) {
5840
5855
  TaskDependencyManipulator.prototype.removeDependency = function (dependencyId) {
5841
5856
  var dependency = this.viewModel.dependencies.getItemById(dependencyId);
5842
5857
  this.viewModel.dependencies.remove(dependency);
5843
- this.dispatcher.notifyDependencyRemoved(dependency);
5858
+ this.dispatcher.notifyDependencyRemoved(dependency.id);
5844
5859
  this.viewModel.updateVisibleItemDependencies();
5845
5860
  this.viewModel.owner.resetAndUpdate();
5846
5861
  return dependency;
5847
5862
  };
5863
+ TaskDependencyManipulator.prototype.getObjectForDataSource = function (dependency) {
5864
+ return {
5865
+ id: dependency.id,
5866
+ predecessorId: this.viewModel.tasks.getItemById(dependency.predecessorId).id,
5867
+ successorId: this.viewModel.tasks.getItemById(dependency.successorId).id,
5868
+ type: dependency.type
5869
+ };
5870
+ };
5848
5871
  return TaskDependencyManipulator;
5849
5872
  }(TaskPropertiesManipulator_1.BaseManipulator));
5850
5873
  exports.TaskDependencyManipulator = TaskDependencyManipulator;
@@ -5899,7 +5922,7 @@ var ResourcesManipulator = (function (_super) {
5899
5922
  if (id)
5900
5923
  resource.internalId = id;
5901
5924
  this.viewModel.resources.add(resource);
5902
- this.dispatcher.notifyResourceCreated(resource);
5925
+ this.dispatcher.notifyResourceCreated(this.getResourceObjectForDataSource(resource), function (id) { return resource.id = id; });
5903
5926
  return resource;
5904
5927
  };
5905
5928
  ResourcesManipulator.prototype.remove = function (resourceId) {
@@ -5910,7 +5933,7 @@ var ResourcesManipulator = (function (_super) {
5910
5933
  if (assignments.length)
5911
5934
  throw new Error("Can't delete assigned resource");
5912
5935
  this.viewModel.resources.remove(resource);
5913
- this.dispatcher.notifyResourceRemoved(resource);
5936
+ this.dispatcher.notifyResourceRemoved(resource.id);
5914
5937
  return resource;
5915
5938
  };
5916
5939
  ResourcesManipulator.prototype.assign = function (resourceID, taskId) {
@@ -5918,7 +5941,7 @@ var ResourcesManipulator = (function (_super) {
5918
5941
  assignment.resourceId = resourceID;
5919
5942
  assignment.taskId = taskId;
5920
5943
  this.viewModel.assignments.add(assignment);
5921
- this.dispatcher.notifyResourceAssigned(assignment);
5944
+ this.dispatcher.notifyResourceAssigned(this.getResourceAssignmentObjectForDataSource(assignment), function (id) { return assignment.id = id; });
5922
5945
  this.viewModel.updateModel();
5923
5946
  this.viewModel.owner.resetAndUpdate();
5924
5947
  return assignment;
@@ -5931,6 +5954,19 @@ var ResourcesManipulator = (function (_super) {
5931
5954
  this.viewModel.owner.resetAndUpdate();
5932
5955
  return assignment;
5933
5956
  };
5957
+ ResourcesManipulator.prototype.getResourceObjectForDataSource = function (resource) {
5958
+ return {
5959
+ id: resource.id,
5960
+ text: resource.text
5961
+ };
5962
+ };
5963
+ ResourcesManipulator.prototype.getResourceAssignmentObjectForDataSource = function (resourceAssignment) {
5964
+ return {
5965
+ id: resourceAssignment,
5966
+ taskId: this.viewModel.tasks.getItemById(resourceAssignment.taskId).id,
5967
+ resourceId: this.viewModel.resources.getItemById(resourceAssignment.resourceId).id
5968
+ };
5969
+ };
5934
5970
  return ResourcesManipulator;
5935
5971
  }(TaskPropertiesManipulator_1.BaseManipulator));
5936
5972
  exports.ResourcesManipulator = ResourcesManipulator;
@@ -5980,7 +6016,7 @@ var TaskManipulator = (function (_super) {
5980
6016
  task.id = task.internalId;
5981
6017
  this.viewModel.tasks.add(task);
5982
6018
  this.viewModel.updateModel();
5983
- this.dispatcher.notifyTaskCreated(task);
6019
+ this.dispatcher.notifyTaskCreated(this.getObjectForDataSource(task), function (id) { return task.id = id; });
5984
6020
  this.viewModel.owner.resetAndUpdate();
5985
6021
  return task;
5986
6022
  };
@@ -5995,11 +6031,26 @@ var TaskManipulator = (function (_super) {
5995
6031
  if (assignments.length)
5996
6032
  throw new Error("Can't delete task with assigned resource");
5997
6033
  this.viewModel.tasks.remove(task);
5998
- this.dispatcher.notifyTaskRemoved(task);
6034
+ this.dispatcher.notifyTaskRemoved(task.id);
5999
6035
  this.viewModel.updateModel();
6000
6036
  this.viewModel.owner.resetAndUpdate();
6001
6037
  return task;
6002
6038
  };
6039
+ TaskManipulator.prototype.getObjectForDataSource = function (task) {
6040
+ return {
6041
+ id: task.id,
6042
+ start: task.start,
6043
+ end: task.end,
6044
+ duration: task.duration,
6045
+ description: task.description,
6046
+ parentId: this.viewModel.tasks.getItemById(task.parentId).id,
6047
+ progress: task.progress,
6048
+ taskType: task.taskType,
6049
+ title: task.title,
6050
+ customFields: task.customFields,
6051
+ expanded: task.expanded
6052
+ };
6053
+ };
6003
6054
  return TaskManipulator;
6004
6055
  }(TaskPropertiesManipulator_1.BaseManipulator));
6005
6056
  exports.TaskManipulator = TaskManipulator;
@@ -6873,11 +6924,11 @@ var ModelChangesDispatcher = (function () {
6873
6924
  function ModelChangesDispatcher() {
6874
6925
  this.onModelChanged = new EventDispatcher_1.EventDispatcher();
6875
6926
  }
6876
- ModelChangesDispatcher.prototype.notifyTaskCreated = function (task) {
6877
- this.onModelChanged.raise("NotifyTaskCreated", task);
6927
+ ModelChangesDispatcher.prototype.notifyTaskCreated = function (task, callback) {
6928
+ this.onModelChanged.raise("NotifyTaskCreated", task, callback);
6878
6929
  };
6879
- ModelChangesDispatcher.prototype.notifyTaskRemoved = function (task) {
6880
- this.onModelChanged.raise("NotifyTaskRemoved", task);
6930
+ ModelChangesDispatcher.prototype.notifyTaskRemoved = function (taskID) {
6931
+ this.onModelChanged.raise("NotifyTaskRemoved", taskID);
6881
6932
  };
6882
6933
  ModelChangesDispatcher.prototype.notifyTaskTitleChanged = function (taskID, newValue) {
6883
6934
  this.onModelChanged.raise("NotifyTaskTitleChanged", taskID, newValue);
@@ -6894,23 +6945,23 @@ var ModelChangesDispatcher = (function () {
6894
6945
  ModelChangesDispatcher.prototype.notifyTaskProgressChanged = function (taskID, newValue) {
6895
6946
  this.onModelChanged.raise("NotifyTaskProgressChanged", taskID, newValue);
6896
6947
  };
6897
- ModelChangesDispatcher.prototype.notifyDependencyInserted = function (dependency) {
6898
- this.onModelChanged.raise("NotifyDependencyInserted", dependency);
6948
+ ModelChangesDispatcher.prototype.notifyDependencyInserted = function (dependency, callback) {
6949
+ this.onModelChanged.raise("NotifyDependencyInserted", dependency, callback);
6899
6950
  };
6900
- ModelChangesDispatcher.prototype.notifyDependencyRemoved = function (dependency) {
6901
- this.onModelChanged.raise("NotifyDependencyRemoved", dependency);
6951
+ ModelChangesDispatcher.prototype.notifyDependencyRemoved = function (dependencyID) {
6952
+ this.onModelChanged.raise("NotifyDependencyRemoved", dependencyID);
6902
6953
  };
6903
- ModelChangesDispatcher.prototype.notifyResourceCreated = function (resource) {
6904
- this.onModelChanged.raise("NotifyResourceCreated", resource);
6954
+ ModelChangesDispatcher.prototype.notifyResourceCreated = function (resource, callback) {
6955
+ this.onModelChanged.raise("NotifyResourceCreated", resource, callback);
6905
6956
  };
6906
- ModelChangesDispatcher.prototype.notifyResourceRemoved = function (resource) {
6907
- this.onModelChanged.raise("NotifyResourceRemoved", resource);
6957
+ ModelChangesDispatcher.prototype.notifyResourceRemoved = function (resourceID) {
6958
+ this.onModelChanged.raise("NotifyResourceRemoved", resourceID);
6908
6959
  };
6909
- ModelChangesDispatcher.prototype.notifyResourceAssigned = function (assignment) {
6910
- this.onModelChanged.raise("NotifyResourceAssigned", assignment);
6960
+ ModelChangesDispatcher.prototype.notifyResourceAssigned = function (assignment, callback) {
6961
+ this.onModelChanged.raise("NotifyResourceAssigned", assignment, callback);
6911
6962
  };
6912
- ModelChangesDispatcher.prototype.notifyResourceUnassigned = function (assignment) {
6913
- this.onModelChanged.raise("NotifyResourceUnassigned", assignment);
6963
+ ModelChangesDispatcher.prototype.notifyResourceUnassigned = function (assignmentID) {
6964
+ this.onModelChanged.raise("NotifyResourceUnassigned", assignmentID);
6914
6965
  };
6915
6966
  return ModelChangesDispatcher;
6916
6967
  }());
@@ -7130,6 +7181,11 @@ var CreateTaskCommand = (function (_super) {
7130
7181
  return _super.prototype.execute.call(this, start, end, title, parentId);
7131
7182
  };
7132
7183
  CreateTaskCommand.prototype.executeInternal = function (start, end, title, parentId) {
7184
+ if (!parentId) {
7185
+ var selectedTask = this.control.viewModel.findItem(this.control.currentSelectedTaskID).task;
7186
+ if (selectedTask)
7187
+ parentId = selectedTask.parentId;
7188
+ }
7133
7189
  var referenceItem = this.control.viewModel.findItem(parentId) || this.control.viewModel.items[0];
7134
7190
  var referenceTask = referenceItem.task;
7135
7191
  start = start || new Date(referenceTask.start.getTime());
@@ -7190,11 +7246,11 @@ var RemoveTaskCommand = (function (_super) {
7190
7246
  var dependencies = this.control.viewModel.dependencies.items.filter(function (d) { return d.predecessorId == id || d.successorId == id; });
7191
7247
  if (dependencies.length)
7192
7248
  if (this.control.settings.editing.allowDependencyDeleting)
7193
- dependencies.forEach(function (d) { return _this.history.addAndRedo(new TaskDependencyHistoryItem_1.RemoveDependencyHistoryItem(_this.modelManipulator, d.id)); });
7249
+ dependencies.forEach(function (d) { return _this.history.addAndRedo(new TaskDependencyHistoryItem_1.RemoveDependencyHistoryItem(_this.modelManipulator, d.internalId)); });
7194
7250
  else
7195
7251
  return false;
7196
7252
  var assignments = this.control.viewModel.assignments.items.filter(function (a) { return a.taskId == id; });
7197
- assignments.forEach(function (a) { return _this.history.addAndRedo(new ResourceHistoryItem_1.DeassignResourceHistoryItem(_this.modelManipulator, a.id)); });
7253
+ assignments.forEach(function (a) { return _this.history.addAndRedo(new ResourceHistoryItem_1.DeassignResourceHistoryItem(_this.modelManipulator, a.internalId)); });
7198
7254
  this.history.addAndRedo(new TaskHistoryItem_1.RemoveTaskHistoryItem(this.modelManipulator, id));
7199
7255
  this.history.endTransaction();
7200
7256
  return true;
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * DevExpress Gantt (dx-gantt.min)
3
- * Version: 0.0.22
4
- * Build date: Wed Oct 16 2019
3
+ * Version: 0.0.23
4
+ * Build date: Thu Oct 17 2019
5
5
  *
6
6
  * Copyright (c) 2012 - 2019 Developer Express Inc. ALL RIGHTS RESERVED
7
7
  * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs