devexpress-gantt 4.1.22 → 4.1.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: 4.1.22
4
- * Build date: Mon Apr 18 2022
3
+ * Version: 4.1.23
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.1.22
4
- * Build date: Mon Apr 18 2022
3
+ * Version: 4.1.23
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
@@ -19133,18 +19133,7 @@ var ValidationController = (function () {
19133
19133
  }
19134
19134
  };
19135
19135
  ValidationController.prototype.canCreateDependency = function (predecessorId, successorId) {
19136
- if (!predecessorId || !successorId || predecessorId === successorId)
19137
- return false;
19138
- var model = this.viewModel;
19139
- if (model.dependencies.items.some(function (d) { return (d.predecessorId === predecessorId && d.successorId === successorId) || (d.predecessorId === successorId && d.successorId === predecessorId); }))
19140
- return false;
19141
- if (this._parentAutoCalc && this.isValidateDependenciesRequired) {
19142
- if (model.checkParent(predecessorId, successorId))
19143
- return false;
19144
- if (model.checkParent(successorId, predecessorId))
19145
- return false;
19146
- }
19147
- return true;
19136
+ return this.viewModel.canCreateDependency(predecessorId, successorId);
19148
19137
  };
19149
19138
  return ValidationController;
19150
19139
  }());
@@ -19474,6 +19463,22 @@ var ViewVisualModel = (function () {
19474
19463
  task.internalId = hash[id];
19475
19464
  }
19476
19465
  };
19466
+ ViewVisualModel.prototype.canCreateDependency = function (predecessorId, successorId) {
19467
+ if (!predecessorId || !successorId || predecessorId === successorId)
19468
+ return false;
19469
+ var hasLink = false;
19470
+ if (this.enableDependencyValidation) {
19471
+ var hash = this.getDependentTasksHash();
19472
+ if (this.parentAutoCalc)
19473
+ hasLink = this.checkTasksInterdependence(predecessorId, successorId, hash) || this.checkParent(predecessorId, successorId) || this.checkParent(successorId, predecessorId);
19474
+ else
19475
+ hasLink = this.checkDependencyChain([predecessorId], [successorId], hash, []);
19476
+ }
19477
+ return !hasLink;
19478
+ };
19479
+ ViewVisualModel.prototype.checkParent = function (childId, parentId) {
19480
+ return this.getTaskTreeLine(childId).indexOf(parentId) > -1;
19481
+ };
19477
19482
  ViewVisualModel.prototype.getTaskTreeLine = function (taskId) {
19478
19483
  var result = [];
19479
19484
  var item = this.findItem(taskId);
@@ -19487,8 +19492,65 @@ var ViewVisualModel = (function () {
19487
19492
  }
19488
19493
  return result;
19489
19494
  };
19490
- ViewVisualModel.prototype.checkParent = function (childId, parentId) {
19491
- return this.getTaskTreeLine(childId).indexOf(parentId) > -1;
19495
+ ViewVisualModel.prototype.getDependentTasksHash = function () {
19496
+ var result = {};
19497
+ this.dependencies.items.forEach(function (d) {
19498
+ var _a, _b;
19499
+ var id1 = d.predecessorId;
19500
+ var id2 = d.successorId;
19501
+ (_a = result[id1]) !== null && _a !== void 0 ? _a : (result[id1] = []);
19502
+ if (result[id1].indexOf(id2) < 0)
19503
+ result[id1].push(id2);
19504
+ (_b = result[id2]) !== null && _b !== void 0 ? _b : (result[id2] = []);
19505
+ if (result[id2].indexOf(id1) < 0)
19506
+ result[id2].push(id1);
19507
+ });
19508
+ return result;
19509
+ };
19510
+ ViewVisualModel.prototype.checkTasksInterdependence = function (id1, id2, depHash) {
19511
+ var treeLine1 = this.getTaskTreeLine(id1).reverse();
19512
+ var treeLine2 = this.getTaskTreeLine(id2).reverse();
19513
+ var group1Root;
19514
+ var group2Root;
19515
+ for (var i = 0; i < treeLine1.length - 1; i++) {
19516
+ var id = treeLine1[i];
19517
+ var index = treeLine2.indexOf(id);
19518
+ if (index > -1) {
19519
+ group1Root = treeLine1[i + 1];
19520
+ group2Root = treeLine2[index + 1];
19521
+ }
19522
+ }
19523
+ if (!group1Root && !group2Root) {
19524
+ group1Root = treeLine1[0];
19525
+ group2Root = treeLine2[0];
19526
+ }
19527
+ return this.checkDependencyChain(this.getBranchIds(group1Root), this.getBranchIds(group2Root), depHash, []);
19528
+ };
19529
+ ViewVisualModel.prototype.checkDependencyChain = function (group1, group2, depHash, checked) {
19530
+ if (group1.some(function (id) { return group2.indexOf(id) > -1; }))
19531
+ return true;
19532
+ checked.push.apply(checked, group1);
19533
+ for (var i = 0; i < group1.length; i++) {
19534
+ var id1 = group1[i];
19535
+ var dependent = depHash[id1];
19536
+ if (dependent && this.checkDependencyChain(dependent.filter(function (id) { return checked.indexOf(id) === -1; }), group2, depHash, checked))
19537
+ return true;
19538
+ }
19539
+ return false;
19540
+ };
19541
+ ViewVisualModel.prototype.getBranchIds = function (id) {
19542
+ var _this = this;
19543
+ var result = [id];
19544
+ var item = this.findItem(id);
19545
+ var children = item === null || item === void 0 ? void 0 : item.children;
19546
+ if (children)
19547
+ children.forEach(function (vi) {
19548
+ var _a;
19549
+ var key = (_a = vi.task) === null || _a === void 0 ? void 0 : _a.internalId;
19550
+ if (key)
19551
+ result = result.concat(_this.getBranchIds(key));
19552
+ });
19553
+ return result;
19492
19554
  };
19493
19555
  ViewVisualModel.prototype.getTasksExpandedState = function () {
19494
19556
  var items = this.tasks.items;
@@ -19544,6 +19606,15 @@ var ViewVisualModel = (function () {
19544
19606
  var item = this.findItem(id);
19545
19607
  return item && item.children.length > 0;
19546
19608
  };
19609
+ Object.defineProperty(ViewVisualModel.prototype, "enableDependencyValidation", {
19610
+ get: function () {
19611
+ var _a;
19612
+ var settings = this.owner && this.owner.settings;
19613
+ return (_a = settings === null || settings === void 0 ? void 0 : settings.validation) === null || _a === void 0 ? void 0 : _a.validateDependencies;
19614
+ },
19615
+ enumerable: false,
19616
+ configurable: true
19617
+ });
19547
19618
  Object.defineProperty(ViewVisualModel.prototype, "parentAutoCalc", {
19548
19619
  get: function () {
19549
19620
  var settings = this.owner && this.owner.settings;
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * DevExpress Gantt (dx-gantt.min)
3
- * Version: 4.1.22
4
- * Build date: Mon Apr 18 2022
3
+ * Version: 4.1.23
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