devexpress-gantt 4.0.15 → 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.15
4
- * Build date: Tue Apr 05 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.15
4
- * Build date: Tue Apr 05 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
@@ -3156,7 +3156,7 @@ var GridLayoutCalculator = (function () {
3156
3156
  var topTaskRightCenter = this.getTaskRightCenter(topTaskPoint, topTaskIndex);
3157
3157
  var isBottomMilestone = this.getTask(bottomTaskIndex).isMilestone();
3158
3158
  var bottomTaskTopCenter = this.getTaskTopCenter(bottomTaskPoint, bottomTaskIndex);
3159
- var endPointIndent = shiftEndPointToRight ? this.getTaskWidth(bottomTaskIndex) - this.minLineLength : this.minLineLength;
3159
+ var endPointIndent = this.getHorizontalIndentFromTaskEdge(bottomTaskIndex, shiftEndPointToRight);
3160
3160
  result.push(new point_1.Point(Math.floor(topTaskRightCenter.x), Math.floor(topTaskRightCenter.y)));
3161
3161
  result.push(new point_1.Point(Math.floor(isBottomMilestone ? bottomTaskTopCenter.x : bottomTaskPoint.x + endPointIndent), Math.floor(result[0].y)));
3162
3162
  result.push(new point_1.Point(Math.floor(result[1].x), Math.floor(bottomTaskTopCenter.y)));
@@ -3201,7 +3201,7 @@ var GridLayoutCalculator = (function () {
3201
3201
  var topTaskBottomCenter = this.getTaskBottomCenter(topTaskPoint, topTaskIndex);
3202
3202
  var isTopMilestone = this.getTask(topTaskIndex).isMilestone();
3203
3203
  var bottomTaskRightCenter = this.getTaskRightCenter(bottomTaskPoint, bottomTaskIndex);
3204
- var startPointIndent = shiftStartPointToRight ? this.getTaskWidth(topTaskIndex) - this.minLineLength : this.minLineLength;
3204
+ var startPointIndent = this.getHorizontalIndentFromTaskEdge(topTaskIndex, shiftStartPointToRight);
3205
3205
  result.push(new point_1.Point(Math.floor(isTopMilestone ? topTaskBottomCenter.x : topTaskPoint.x + startPointIndent), Math.floor(topTaskBottomCenter.y)));
3206
3206
  result.push(new point_1.Point(Math.floor(result[0].x), Math.floor(bottomTaskRightCenter.y)));
3207
3207
  result.push(new point_1.Point(Math.floor(bottomTaskRightCenter.x), Math.floor(bottomTaskRightCenter.y)));
@@ -3214,7 +3214,7 @@ var GridLayoutCalculator = (function () {
3214
3214
  var topTaskBottomCenter = this.getTaskBottomCenter(topTaskPoint, topTaskIndex);
3215
3215
  var isTopMilestone = this.getTask(topTaskIndex).isMilestone();
3216
3216
  var bottomTaskLeftCenter = this.getTaskLeftCenter(bottomTaskPoint, bottomTaskIndex);
3217
- var startPointIndent = shiftStartPointToRight ? this.getTaskWidth(topTaskIndex) - this.minLineLength : this.minLineLength;
3217
+ var startPointIndent = this.getHorizontalIndentFromTaskEdge(topTaskIndex, shiftStartPointToRight);
3218
3218
  result.push(new point_1.Point(Math.floor(isTopMilestone ? topTaskBottomCenter.x : topTaskPoint.x + startPointIndent), Math.floor(topTaskBottomCenter.y)));
3219
3219
  result.push(new point_1.Point(Math.floor(result[0].x), Math.floor(bottomTaskLeftCenter.y)));
3220
3220
  result.push(new point_1.Point(Math.floor(bottomTaskLeftCenter.x), Math.floor(bottomTaskLeftCenter.y)));
@@ -3227,7 +3227,7 @@ var GridLayoutCalculator = (function () {
3227
3227
  var topTaskLeftCenter = this.getTaskLeftCenter(topTaskPoint, topTaskIndex);
3228
3228
  var bottomTaskTopCenter = this.getTaskTopCenter(bottomTaskPoint, bottomTaskIndex);
3229
3229
  var isBottomMilestone = this.getTask(bottomTaskIndex).isMilestone();
3230
- var endPointIndent = shiftEndPointToRight ? this.getTaskWidth(bottomTaskIndex) - this.minLineLength : this.minLineLength;
3230
+ var endPointIndent = this.getHorizontalIndentFromTaskEdge(bottomTaskIndex, shiftEndPointToRight);
3231
3231
  result.push(new point_1.Point(Math.floor(topTaskLeftCenter.x), Math.floor(topTaskLeftCenter.y)));
3232
3232
  result.push(new point_1.Point(Math.floor(isBottomMilestone ? bottomTaskTopCenter.x : bottomTaskPoint.x + endPointIndent), Math.floor(result[0].y)));
3233
3233
  result.push(new point_1.Point(Math.floor(result[1].x), Math.floor(bottomTaskTopCenter.y)));
@@ -3291,6 +3291,12 @@ var GridLayoutCalculator = (function () {
3291
3291
  var isMilestone = viewItem.task.isMilestone() && !viewItem.isCustom;
3292
3292
  return isMilestone ? this.getTaskHeight(index) * (Math.sqrt(2) - 1) / 2 : 0;
3293
3293
  };
3294
+ GridLayoutCalculator.prototype.getHorizontalIndentFromTaskEdge = function (index, shiftToRight) {
3295
+ if (shiftToRight === void 0) { shiftToRight = false; }
3296
+ var taskWidth = this.getTaskWidth(index);
3297
+ var indentFromEdge = this.minLineLength < taskWidth / 3 ? this.minLineLength : 0.2 * taskWidth;
3298
+ return shiftToRight ? taskWidth - indentFromEdge : indentFromEdge;
3299
+ };
3294
3300
  GridLayoutCalculator.prototype.getRenderedRowColumnIndices = function (scrollPos, isVertical) {
3295
3301
  var visibleAreaSizeValue = isVertical ? this.visibleTaskAreaSize.height : this.visibleTaskAreaSize.width;
3296
3302
  var firstVisibleIndex = isVertical ? this.getFirstVisibleGridCellIndex(scrollPos, this.tickSize.height) : this.getFirstScaleVisibleIndex(scrollPos);
@@ -5267,7 +5273,7 @@ var TaskEditController = (function () {
5267
5273
  this.baseElement.className = this.baseElement.className + " milestone";
5268
5274
  else {
5269
5275
  if (!this.isTaskUpdateAllowed())
5270
- this.baseElement.className = this.baseElement.className + " hide-updating";
5276
+ this.baseElement.className = this.baseElement.className + " " + TaskEditController.CLASSNAMES.TASK_EDIT_HIDE_UPDATING;
5271
5277
  if (this.viewItem.isCustom)
5272
5278
  this.baseElement.classList.add(TaskEditController.CLASSNAMES.TASK_EDIT_BOX_CUSTOM);
5273
5279
  }
@@ -5621,7 +5627,8 @@ var TaskEditController = (function () {
5621
5627
  TASK_EDIT_FRAME_SUCCESSOR: "dx-gantt-task-edit-frame-successor",
5622
5628
  TASK_EDIT_SUCCESSOR_DEPENDENCY_RIGTH: "dx-gantt-task-edit-successor-dependency-r",
5623
5629
  TASK_EDIT_SUCCESSOR_DEPENDENCY_LEFT: "dx-gantt-task-edit-successor-dependency-l",
5624
- TASK_EDIT_TOUCH: "dx-gantt-edit-touch"
5630
+ TASK_EDIT_TOUCH: "dx-gantt-edit-touch",
5631
+ TASK_EDIT_HIDE_UPDATING: "hide-updating"
5625
5632
  };
5626
5633
  return TaskEditController;
5627
5634
  }());
@@ -16055,8 +16062,13 @@ var RenderHelper = (function () {
16055
16062
  };
16056
16063
  RenderHelper.prototype.createTaskArea = function (parent) {
16057
16064
  this._taskArea = this._taskAreaRender.createTaskArea();
16065
+ this._taskArea.setAttribute("task-edit-enabled", this.isTaskUpdateAllowed().toString());
16058
16066
  parent.appendChild(this._taskArea);
16059
16067
  };
16068
+ RenderHelper.prototype.isTaskUpdateAllowed = function () {
16069
+ var settings = this.ganttViewSettings.editing;
16070
+ return settings.enabled && settings.allowTaskUpdate;
16071
+ };
16060
16072
  RenderHelper.prototype.setSizeForTaskArea = function () {
16061
16073
  var width = this.getTaskAreaWidth();
16062
16074
  var height = this.getTaskAreaHeight();
@@ -17204,7 +17216,7 @@ var TaskAreaStateController = (function () {
17204
17216
  this._pointers = {};
17205
17217
  this._listener = listener;
17206
17218
  this._listener.setHandler(TaskAreaStateEventNames_1.TaskAreaStateEventNames.STATE_EXIT, function () { _this.switchToDefaultState(); });
17207
- this._listener.setHandler(TaskAreaStateEventNames_1.TaskAreaStateEventNames.GET_POINTERS_INFO, function () { return _this.getPointersInfo(); });
17219
+ this._listener.setHandler(TaskAreaStateEventNames_1.TaskAreaStateEventNames.GET_POINTERS_INFO, function (args) { return _this.getPointersInfo(args.triggerEvent); });
17208
17220
  this._taskArea = taskArea;
17209
17221
  this._cellSize = cellSize;
17210
17222
  this.switchToDefaultState();
@@ -17336,7 +17348,10 @@ var TaskAreaStateController = (function () {
17336
17348
  this.switchState(TaskAreaScrollState_1.TaskAreaScrollState);
17337
17349
  break;
17338
17350
  case Enums_1.TaskAreaEventSource.TaskEdit_Frame:
17339
- this.switchState(TaskMoveState_1.TaskMoveState);
17351
+ if (!this.isTaskUpdateDisabled())
17352
+ this.switchState(TaskMoveState_1.TaskMoveState);
17353
+ else
17354
+ this.switchState(TaskAreaScrollState_1.TaskAreaScrollState);
17340
17355
  break;
17341
17356
  case Enums_1.TaskAreaEventSource.TaskEdit_Progress:
17342
17357
  case Enums_1.TaskAreaEventSource.TaskEdit_Start:
@@ -17358,13 +17373,16 @@ var TaskAreaStateController = (function () {
17358
17373
  TaskAreaStateController.prototype.checkEventInTaskEditFrameArea = function (evt) {
17359
17374
  var _a, _b;
17360
17375
  var frame = this.getTaskEditFrameElement();
17361
- if (!frame)
17376
+ if (this.isTaskUpdateDisabled() || !frame)
17362
17377
  return false;
17363
17378
  var eventX = (evt === null || evt === void 0 ? void 0 : evt.clientX) || ((_a = evt === null || evt === void 0 ? void 0 : evt.touches[0]) === null || _a === void 0 ? void 0 : _a.clientX);
17364
17379
  var eventY = (evt === null || evt === void 0 ? void 0 : evt.clientY) || ((_b = evt === null || evt === void 0 ? void 0 : evt.touches[0]) === null || _b === void 0 ? void 0 : _b.clientY);
17365
17380
  var rect = frame.getBoundingClientRect();
17366
17381
  return eventX >= rect.left && eventX <= rect.left + rect.width && eventY >= rect.top && eventY <= rect.top + rect.height;
17367
17382
  };
17383
+ TaskAreaStateController.prototype.isTaskUpdateDisabled = function () {
17384
+ return this._taskArea.getAttribute("task-edit-enabled") === "false";
17385
+ };
17368
17386
  TaskAreaStateController.prototype.isInTaskArea = function (evt) {
17369
17387
  return dom_1.DomUtils.isItParent(this._taskArea, evt_1.EvtUtils.getEventSource(evt));
17370
17388
  };
@@ -17375,7 +17393,8 @@ var TaskAreaStateController = (function () {
17375
17393
  var key = evt.pointerId;
17376
17394
  this._pointers[key] = {
17377
17395
  pageX: evt.pageX,
17378
- pageY: evt.pageY
17396
+ pageY: evt.pageY,
17397
+ pointerType: evt.pointerType
17379
17398
  };
17380
17399
  };
17381
17400
  TaskAreaStateController.prototype._clearPointerInfo = function (evt) {
@@ -17385,13 +17404,18 @@ var TaskAreaStateController = (function () {
17385
17404
  TaskAreaStateController.prototype.isTouchEvent = function (evt) { return TaskAreaDomHelper_1.TaskAreaDomHelper.isTouchEvent(evt); };
17386
17405
  TaskAreaStateController.prototype.isPointerEvent = function (evt) { return TaskAreaDomHelper_1.TaskAreaDomHelper.isPointerEvent(evt); };
17387
17406
  TaskAreaStateController.prototype._getActivePointersCount = function (evt) {
17407
+ var _this = this;
17388
17408
  if (this.isTouchEvent(evt))
17389
17409
  return evt.touches.length;
17390
- return Object.keys(this._pointers).length;
17410
+ return Object.keys(this._pointers).filter(function (p) { return _this._pointers[p].pointerType === evt.pointerType; }).length;
17391
17411
  };
17392
- TaskAreaStateController.prototype.getPointersInfo = function () {
17412
+ TaskAreaStateController.prototype.getPointersInfo = function (evt) {
17393
17413
  var _this = this;
17394
- return Object.keys(this._pointers).map(function (k) { return _this._pointers[k]; });
17414
+ var pointerType = evt === null || evt === void 0 ? void 0 : evt.pointerType;
17415
+ var pointers = Object.keys(this._pointers).map(function (k) { return _this._pointers[k]; });
17416
+ if (pointerType)
17417
+ pointers = pointers.filter(function (p) { return p.pointerType === pointerType; });
17418
+ return pointers;
17395
17419
  };
17396
17420
  TaskAreaStateController.prototype._canStartDrag = function (evt) {
17397
17421
  if (this._getActivePointersCount(evt) > 1)
@@ -18659,7 +18683,7 @@ var TaskRender = (function () {
18659
18683
  return;
18660
18684
  var taskTextElement = RenderElementUtils_1.RenderElementUtils.create(taskTextInfo, index, parent);
18661
18685
  var text = this.getTaskText(index);
18662
- if (this.taskTitlePosition === Enums_1.TaskTitlePosition.Outside) {
18686
+ if (this.taskTitlePosition === Enums_1.TaskTitlePosition.Outside && taskTextInfo.size.width > 0) {
18663
18687
  var style = getComputedStyle(taskTextElement);
18664
18688
  var avaliableTextWidth = taskTextInfo.size.width - dom_1.DomUtils.pxToInt(style.paddingLeft);
18665
18689
  if (avaliableTextWidth >= this.minTextWidth) {
@@ -19812,18 +19836,7 @@ var ValidationController = (function () {
19812
19836
  }
19813
19837
  };
19814
19838
  ValidationController.prototype.canCreateDependency = function (predecessorId, successorId) {
19815
- if (!predecessorId || !successorId || predecessorId === successorId)
19816
- return false;
19817
- var model = this.viewModel;
19818
- if (model.dependencies.items.some(function (d) { return (d.predecessorId === predecessorId && d.successorId === successorId) || (d.predecessorId === successorId && d.successorId === predecessorId); }))
19819
- return false;
19820
- if (this._parentAutoCalc && this.isValidateDependenciesRequired) {
19821
- if (model.checkParent(predecessorId, successorId))
19822
- return false;
19823
- if (model.checkParent(successorId, predecessorId))
19824
- return false;
19825
- }
19826
- return true;
19839
+ return this.viewModel.canCreateDependency(predecessorId, successorId);
19827
19840
  };
19828
19841
  return ValidationController;
19829
19842
  }());
@@ -20153,6 +20166,22 @@ var ViewVisualModel = (function () {
20153
20166
  task.internalId = hash[id];
20154
20167
  }
20155
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
+ };
20156
20185
  ViewVisualModel.prototype.getTaskTreeLine = function (taskId) {
20157
20186
  var result = [];
20158
20187
  var item = this.findItem(taskId);
@@ -20166,8 +20195,65 @@ var ViewVisualModel = (function () {
20166
20195
  }
20167
20196
  return result;
20168
20197
  };
20169
- ViewVisualModel.prototype.checkParent = function (childId, parentId) {
20170
- 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;
20171
20257
  };
20172
20258
  ViewVisualModel.prototype.getTasksExpandedState = function () {
20173
20259
  var items = this.tasks.items;
@@ -20223,6 +20309,15 @@ var ViewVisualModel = (function () {
20223
20309
  var item = this.findItem(id);
20224
20310
  return item && item.children.length > 0;
20225
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
+ });
20226
20321
  Object.defineProperty(ViewVisualModel.prototype, "parentAutoCalc", {
20227
20322
  get: function () {
20228
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.15
4
- * Build date: Tue Apr 05 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