devexpress-gantt 4.0.17 → 4.0.18

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: 4.0.17
4
- * Build date: Mon Apr 18 2022
3
+ * Version: 4.0.18
4
+ * Build date: Thu Apr 21 2022
5
5
  *
6
6
  * Copyright (c) 2012 - 2022 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: 4.0.17
4
- * Build date: Mon Apr 18 2022
3
+ * Version: 4.0.18
4
+ * Build date: Thu Apr 21 2022
5
5
  *
6
6
  * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
7
7
  * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs
@@ -19836,18 +19836,7 @@ var ValidationController = (function () {
19836
19836
  }
19837
19837
  };
19838
19838
  ValidationController.prototype.canCreateDependency = function (predecessorId, successorId) {
19839
- if (!predecessorId || !successorId || predecessorId === successorId)
19840
- return false;
19841
- var model = this.viewModel;
19842
- if (model.dependencies.items.some(function (d) { return (d.predecessorId === predecessorId && d.successorId === successorId) || (d.predecessorId === successorId && d.successorId === predecessorId); }))
19843
- return false;
19844
- if (this._parentAutoCalc && this.isValidateDependenciesRequired) {
19845
- if (model.checkParent(predecessorId, successorId))
19846
- return false;
19847
- if (model.checkParent(successorId, predecessorId))
19848
- return false;
19849
- }
19850
- return true;
19839
+ return this.viewModel.canCreateDependency(predecessorId, successorId);
19851
19840
  };
19852
19841
  return ValidationController;
19853
19842
  }());
@@ -20177,6 +20166,22 @@ var ViewVisualModel = (function () {
20177
20166
  task.internalId = hash[id];
20178
20167
  }
20179
20168
  };
20169
+ ViewVisualModel.prototype.canCreateDependency = function (predecessorId, successorId) {
20170
+ if (!predecessorId || !successorId || predecessorId === successorId)
20171
+ return false;
20172
+ var hasLink = false;
20173
+ if (this.enableDependencyValidation) {
20174
+ var hash = this.getDependentTasksHash();
20175
+ if (this.parentAutoCalc)
20176
+ hasLink = this.checkTasksInterdependence(predecessorId, successorId, hash) || this.checkParent(predecessorId, successorId) || this.checkParent(successorId, predecessorId);
20177
+ else
20178
+ hasLink = this.checkDependencyChain([predecessorId], [successorId], hash, []);
20179
+ }
20180
+ return !hasLink;
20181
+ };
20182
+ ViewVisualModel.prototype.checkParent = function (childId, parentId) {
20183
+ return this.getTaskTreeLine(childId).indexOf(parentId) > -1;
20184
+ };
20180
20185
  ViewVisualModel.prototype.getTaskTreeLine = function (taskId) {
20181
20186
  var result = [];
20182
20187
  var item = this.findItem(taskId);
@@ -20190,8 +20195,65 @@ var ViewVisualModel = (function () {
20190
20195
  }
20191
20196
  return result;
20192
20197
  };
20193
- ViewVisualModel.prototype.checkParent = function (childId, parentId) {
20194
- return this.getTaskTreeLine(childId).indexOf(parentId) > -1;
20198
+ ViewVisualModel.prototype.getDependentTasksHash = function () {
20199
+ var result = {};
20200
+ this.dependencies.items.forEach(function (d) {
20201
+ var _a, _b;
20202
+ var id1 = d.predecessorId;
20203
+ var id2 = d.successorId;
20204
+ (_a = result[id1]) !== null && _a !== void 0 ? _a : (result[id1] = []);
20205
+ if (result[id1].indexOf(id2) < 0)
20206
+ result[id1].push(id2);
20207
+ (_b = result[id2]) !== null && _b !== void 0 ? _b : (result[id2] = []);
20208
+ if (result[id2].indexOf(id1) < 0)
20209
+ result[id2].push(id1);
20210
+ });
20211
+ return result;
20212
+ };
20213
+ ViewVisualModel.prototype.checkTasksInterdependence = function (id1, id2, depHash) {
20214
+ var treeLine1 = this.getTaskTreeLine(id1).reverse();
20215
+ var treeLine2 = this.getTaskTreeLine(id2).reverse();
20216
+ var group1Root;
20217
+ var group2Root;
20218
+ for (var i = 0; i < treeLine1.length - 1; i++) {
20219
+ var id = treeLine1[i];
20220
+ var index = treeLine2.indexOf(id);
20221
+ if (index > -1) {
20222
+ group1Root = treeLine1[i + 1];
20223
+ group2Root = treeLine2[index + 1];
20224
+ }
20225
+ }
20226
+ if (!group1Root && !group2Root) {
20227
+ group1Root = treeLine1[0];
20228
+ group2Root = treeLine2[0];
20229
+ }
20230
+ return this.checkDependencyChain(this.getBranchIds(group1Root), this.getBranchIds(group2Root), depHash, []);
20231
+ };
20232
+ ViewVisualModel.prototype.checkDependencyChain = function (group1, group2, depHash, checked) {
20233
+ if (group1.some(function (id) { return group2.indexOf(id) > -1; }))
20234
+ return true;
20235
+ checked.push.apply(checked, group1);
20236
+ for (var i = 0; i < group1.length; i++) {
20237
+ var id1 = group1[i];
20238
+ var dependent = depHash[id1];
20239
+ if (dependent && this.checkDependencyChain(dependent.filter(function (id) { return checked.indexOf(id) === -1; }), group2, depHash, checked))
20240
+ return true;
20241
+ }
20242
+ return false;
20243
+ };
20244
+ ViewVisualModel.prototype.getBranchIds = function (id) {
20245
+ var _this = this;
20246
+ var result = [id];
20247
+ var item = this.findItem(id);
20248
+ var children = item === null || item === void 0 ? void 0 : item.children;
20249
+ if (children)
20250
+ children.forEach(function (vi) {
20251
+ var _a;
20252
+ var key = (_a = vi.task) === null || _a === void 0 ? void 0 : _a.internalId;
20253
+ if (key)
20254
+ result = result.concat(_this.getBranchIds(key));
20255
+ });
20256
+ return result;
20195
20257
  };
20196
20258
  ViewVisualModel.prototype.getTasksExpandedState = function () {
20197
20259
  var items = this.tasks.items;
@@ -20247,6 +20309,15 @@ var ViewVisualModel = (function () {
20247
20309
  var item = this.findItem(id);
20248
20310
  return item && item.children.length > 0;
20249
20311
  };
20312
+ Object.defineProperty(ViewVisualModel.prototype, "enableDependencyValidation", {
20313
+ get: function () {
20314
+ var _a;
20315
+ var settings = this.owner && this.owner.settings;
20316
+ return (_a = settings === null || settings === void 0 ? void 0 : settings.validation) === null || _a === void 0 ? void 0 : _a.validateDependencies;
20317
+ },
20318
+ enumerable: false,
20319
+ configurable: true
20320
+ });
20250
20321
  Object.defineProperty(ViewVisualModel.prototype, "parentAutoCalc", {
20251
20322
  get: function () {
20252
20323
  var settings = this.owner && this.owner.settings;
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * DevExpress Gantt (dx-gantt.min)
3
- * Version: 4.0.17
4
- * Build date: Mon Apr 18 2022
3
+ * Version: 4.0.18
4
+ * Build date: Thu Apr 21 2022
5
5
  *
6
6
  * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
7
7
  * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs