devexpress-diagram 2.2.11 → 2.2.13

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.
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * DevExpress Diagram (dx-diagram)
3
- * Version: 2.2.11
4
- * Build date: Thu Sep 19 2024
3
+ * Version: 2.2.13
4
+ * Build date: Mon Nov 11 2024
5
5
  *
6
6
  * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
7
7
  * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * DevExpress Diagram (dx-diagram)
3
- * Version: 2.2.11
4
- * Build date: Thu Sep 19 2024
3
+ * Version: 2.2.13
4
+ * Build date: Mon Nov 11 2024
5
5
  *
6
6
  * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
7
7
  * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs
@@ -4861,13 +4861,51 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
4861
4861
  exports.PasteSelectionCommand = void 0;
4862
4862
  var point_1 = __webpack_require__(8900);
4863
4863
  var PasteSelectionCommandBase_1 = __webpack_require__(7688);
4864
+ var Shape_1 = __webpack_require__(5503);
4865
+ var Connector_1 = __webpack_require__(7959);
4864
4866
  var PasteSelectionCommand = (function (_super) {
4865
4867
  __extends(PasteSelectionCommand, _super);
4866
4868
  function PasteSelectionCommand() {
4867
4869
  return _super !== null && _super.apply(this, arguments) || this;
4868
4870
  }
4869
- PasteSelectionCommand.prototype.getEventPositionOffset = function (_items, _evtPosition) {
4870
- return new point_1.Point(0, 0);
4871
+ PasteSelectionCommand.prototype.getEventPositionOffset = function (items, _evtPosition) {
4872
+ var topLeftItem = items.reduce(function (acc, item) {
4873
+ var x = item instanceof Shape_1.Shape ? item.position.x : item instanceof Connector_1.Connector ? item.getMinX() : Number.MAX_VALUE;
4874
+ var y = item instanceof Shape_1.Shape ? item.position.y : item instanceof Connector_1.Connector ? item.getMinY() : Number.MAX_VALUE;
4875
+ if (y < acc.y || (y === acc.y && x < acc.x)) {
4876
+ acc.topLeftItem = item;
4877
+ acc.x = x;
4878
+ acc.y = y;
4879
+ }
4880
+ return acc;
4881
+ }, {
4882
+ topLeftItem: items[0],
4883
+ x: Number.MAX_VALUE,
4884
+ y: Number.MAX_VALUE
4885
+ }).topLeftItem;
4886
+ if (topLeftItem instanceof Shape_1.Shape) {
4887
+ var newPoint = this.getShapeCorrectedPosition(this.control.model, topLeftItem);
4888
+ return new point_1.Point(newPoint.x - topLeftItem.position.x, newPoint.y - topLeftItem.position.y);
4889
+ }
4890
+ else if (topLeftItem instanceof Connector_1.Connector) {
4891
+ var newPoints = this.getConnectorCorrectedPoints(this.control.model, topLeftItem);
4892
+ return new point_1.Point(topLeftItem.points[0].x - newPoints[0].x, topLeftItem.points[0].y - newPoints[0].y);
4893
+ }
4894
+ };
4895
+ PasteSelectionCommand.prototype.getShapeCorrectedPosition = function (model, shape) {
4896
+ var position = shape.position.clone();
4897
+ while (model.findShapeAtPosition(position))
4898
+ position.offset(PasteSelectionCommandBase_1.PasteSelectionCommandBase.positionOffset, PasteSelectionCommandBase_1.PasteSelectionCommandBase.positionOffset);
4899
+ return position;
4900
+ };
4901
+ PasteSelectionCommand.prototype.getConnectorCorrectedPoints = function (model, connector) {
4902
+ var points = connector.points.map(function (p) { return p.clone(); });
4903
+ while (model.findConnectorAtPoints(points))
4904
+ points.forEach(function (pt) {
4905
+ pt.x += PasteSelectionCommandBase_1.PasteSelectionCommandBase.positionOffset;
4906
+ pt.y += PasteSelectionCommandBase_1.PasteSelectionCommandBase.positionOffset;
4907
+ });
4908
+ return points;
4871
4909
  };
4872
4910
  return PasteSelectionCommand;
4873
4911
  }(PasteSelectionCommandBase_1.PasteSelectionCommandBase));
@@ -4903,7 +4941,6 @@ var Connector_1 = __webpack_require__(7959);
4903
4941
  var ImportConnectorHistoryItem_1 = __webpack_require__(3849);
4904
4942
  var ModelUtils_1 = __webpack_require__(4867);
4905
4943
  var SetSelectionHistoryItem_1 = __webpack_require__(4297);
4906
- var point_1 = __webpack_require__(8900);
4907
4944
  var unit_converter_1 = __webpack_require__(9291);
4908
4945
  var PasteSelectionCommandBase = (function (_super) {
4909
4946
  __extends(PasteSelectionCommandBase, _super);
@@ -4921,39 +4958,16 @@ var PasteSelectionCommandBase = (function (_super) {
4921
4958
  var importer = new Importer_1.Importer(this.control.shapeDescriptionManager, data);
4922
4959
  items = importer.importItems(this.control.model);
4923
4960
  var offset = this.getEventPositionOffset(items, this.control.contextMenuPosition);
4924
- offset = this.getCorrectedOffsetByModel(items, offset);
4925
4961
  for (var i = 0; i < items.length; i++) {
4926
4962
  var item = items[i];
4927
4963
  if (item instanceof Shape_1.Shape)
4928
4964
  item.position.offsetByPoint(offset);
4929
- else if (item instanceof Connector_1.Connector)
4965
+ else if (item instanceof Connector_1.Connector) {
4930
4966
  item.points.forEach(function (p) { return p.offsetByPoint(offset); });
4931
- }
4932
- return items;
4933
- };
4934
- PasteSelectionCommandBase.prototype.getCorrectedOffsetByModel = function (items, baseOffset) {
4935
- var topLeftItem = items.reduce(function (acc, item) {
4936
- var x = item instanceof Shape_1.Shape ? item.position.x : item instanceof Connector_1.Connector ? item.getMinX() : Number.MAX_VALUE;
4937
- var y = item instanceof Shape_1.Shape ? item.position.y : item instanceof Connector_1.Connector ? item.getMinY() : Number.MAX_VALUE;
4938
- if (y < acc.y || (y === acc.y && x < acc.x)) {
4939
- acc.topLeftItem = item;
4940
- acc.x = x;
4941
- acc.y = y;
4967
+ item.clearRenderPoints();
4942
4968
  }
4943
- return acc;
4944
- }, {
4945
- topLeftItem: items[0],
4946
- x: Number.MAX_VALUE,
4947
- y: Number.MAX_VALUE
4948
- }).topLeftItem;
4949
- if (topLeftItem instanceof Shape_1.Shape) {
4950
- var newPoint = this.getShapeCorrectedPosition(this.control.model, topLeftItem, baseOffset);
4951
- return new point_1.Point(newPoint.x - topLeftItem.position.x, newPoint.y - topLeftItem.position.y);
4952
- }
4953
- else if (topLeftItem instanceof Connector_1.Connector) {
4954
- var newPoints = this.getConnectorCorrectedPoints(this.control.model, topLeftItem, baseOffset);
4955
- return new point_1.Point(topLeftItem.points[0].x - newPoints[0].x, topLeftItem.points[0].y - newPoints[0].y);
4956
4969
  }
4970
+ return items;
4957
4971
  };
4958
4972
  PasteSelectionCommandBase.prototype.executeCore = function (state, parameter) {
4959
4973
  var _this = this;
@@ -5029,21 +5043,6 @@ var PasteSelectionCommandBase = (function (_super) {
5029
5043
  this.control.endUpdateCanvas();
5030
5044
  this.control.barManager.updateItemsState();
5031
5045
  };
5032
- PasteSelectionCommandBase.prototype.getShapeCorrectedPosition = function (model, shape, initOffset) {
5033
- var position = shape.position.clone().offsetByPoint(initOffset);
5034
- while (model.findShapeAtPosition(position))
5035
- position.offset(PasteSelectionCommandBase.positionOffset, PasteSelectionCommandBase.positionOffset);
5036
- return position;
5037
- };
5038
- PasteSelectionCommandBase.prototype.getConnectorCorrectedPoints = function (model, connector, initOffset) {
5039
- var points = connector.points.map(function (p) { return p.clone().offsetByPoint(initOffset); });
5040
- while (model.findConnectorAtPoints(points))
5041
- points.forEach(function (pt) {
5042
- pt.x += PasteSelectionCommandBase.positionOffset;
5043
- pt.y += PasteSelectionCommandBase.positionOffset;
5044
- });
5045
- return points;
5046
- };
5047
5046
  Object.defineProperty(PasteSelectionCommandBase.prototype, "isPermissionsRequired", {
5048
5047
  get: function () { return true; },
5049
5048
  enumerable: false,
@@ -6361,6 +6360,7 @@ var MoveCommand = (function (_super) {
6361
6360
  helper.initDraggingShapes(selection.getSelectedShapes(false, true), false);
6362
6361
  helper.initDraggingConnectors(selection.getSelectedConnectors(false, true), false);
6363
6362
  helper.move(false, function (p) { return _this.getPosition(p); }, function () { }, function () { });
6363
+ helper.finish();
6364
6364
  ModelUtils_1.ModelUtils.tryUpdateModelRectangle(this.control.history, function (offsetLeft, offsetTop) { return helper.onTryUpdateModelSize(offsetLeft, offsetTop); });
6365
6365
  this.control.history.endTransaction();
6366
6366
  return true;
@@ -11262,7 +11262,7 @@ var ContextMenuHandler = (function (_super) {
11262
11262
  window.setTimeout(function () {
11263
11263
  _this.onVisibilityChanged.raise1(function (l) { return l.notifyShowContextMenu(eventPoint, modelPoint); });
11264
11264
  _this.contextMenuVisible = true;
11265
- }, 0);
11265
+ }, 1);
11266
11266
  };
11267
11267
  ContextMenuHandler.prototype.hideContextMenu = function () {
11268
11268
  var _this = this;
@@ -11270,7 +11270,7 @@ var ContextMenuHandler = (function (_super) {
11270
11270
  window.setTimeout(function () {
11271
11271
  _this.onVisibilityChanged.raise1(function (l) { return l.notifyHideContextMenu(); });
11272
11272
  _this.contextMenuVisible = false;
11273
- }, 0);
11273
+ }, 1);
11274
11274
  };
11275
11275
  ContextMenuHandler.prototype.notifyDragStart = function (itemKeys) { };
11276
11276
  ContextMenuHandler.prototype.notifyDragEnd = function (itemKeys) { };
@@ -11515,6 +11515,16 @@ var MouseEventSource = (function () {
11515
11515
  this.key = key;
11516
11516
  this.value = value;
11517
11517
  }
11518
+ Object.defineProperty(MouseEventSource.prototype, "isConnector", {
11519
+ get: function () { return this.type === MouseEventElementType.Connector || this.type === MouseEventElementType.ConnectorText; },
11520
+ enumerable: false,
11521
+ configurable: true
11522
+ });
11523
+ Object.defineProperty(MouseEventSource.prototype, "isShape", {
11524
+ get: function () { return this.type === MouseEventElementType.Shape || this.type === MouseEventElementType.ShapeConnectionPoint; },
11525
+ enumerable: false,
11526
+ configurable: true
11527
+ });
11518
11528
  return MouseEventSource;
11519
11529
  }());
11520
11530
  exports.MouseEventSource = MouseEventSource;
@@ -11975,7 +11985,7 @@ var MouseHandler = (function () {
11975
11985
  return false;
11976
11986
  if (!this.copyDiagramItemsByCtrlAndShift)
11977
11987
  return true;
11978
- return evt.source.type !== Event_1.MouseEventElementType.Shape && evt.source.type !== Event_1.MouseEventElementType.Connector;
11988
+ return !evt.source.isConnector && !evt.source.isShape;
11979
11989
  }
11980
11990
  return this.allowScrollPage && this.shouldScrollPage;
11981
11991
  };
@@ -12591,9 +12601,9 @@ var MouseHandlerDefaultState = (function (_super) {
12591
12601
  MouseHandlerDefaultState.prototype.onDragDiagramItemOnMouseDown = function (evt) {
12592
12602
  if (!this.handler.canAddDiagramItemToSelection(evt))
12593
12603
  _super.prototype.onDragDiagramItemOnMouseDown.call(this, evt);
12594
- else if (evt.source.type === Event_1.MouseEventElementType.Shape)
12604
+ else if (evt.source.isShape)
12595
12605
  this.handler.switchState(new MouseHandlerMoveShapeState_1.MouseHandlerMoveShapeState(this.handler, this.history, this.model, this.selection, this.visualizerManager));
12596
- else if (evt.source.type === Event_1.MouseEventElementType.Connector)
12606
+ else if (evt.source.isConnector)
12597
12607
  this.handler.switchState(new MouseHandlerMoveConnectorState_1.MouseHandlerMoveConnectorState(this.handler, this.history, this.model, this.selection, this.visualizerManager));
12598
12608
  };
12599
12609
  MouseHandlerDefaultState.prototype.onDragStart = function (evt) {
@@ -12784,8 +12794,7 @@ var MouseHandlerDefaultStateBase = (function (_super) {
12784
12794
  return this.selection.hasKey(key);
12785
12795
  };
12786
12796
  MouseHandlerDefaultStateBase.prototype.hasDiagramItem = function (evt) {
12787
- return evt.source.type === Event_1.MouseEventElementType.Shape ||
12788
- evt.source.type === Event_1.MouseEventElementType.Connector;
12797
+ return evt.source.isShape || evt.source.isConnector;
12789
12798
  };
12790
12799
  MouseHandlerDefaultStateBase.prototype.onShapeExpandBtnMouseDown = function (evt) {
12791
12800
  this.handler.addDiagramItemToSelection(evt);
@@ -12908,6 +12917,8 @@ var MouseHandlerDragDiagramItemStateBase = (function (_super) {
12908
12917
  return _this;
12909
12918
  }
12910
12919
  MouseHandlerDragDiagramItemStateBase.prototype.finish = function () {
12920
+ var _a;
12921
+ (_a = this.dragHelper) === null || _a === void 0 ? void 0 : _a.finish();
12911
12922
  this.visualizerManager.resetExtensionLines();
12912
12923
  this.visualizerManager.resetContainerTarget();
12913
12924
  this.visualizerManager.resetConnectionTarget();
@@ -19312,9 +19323,10 @@ var SugiyamaNodesOrderer = (function () {
19312
19323
  var blocks = [];
19313
19324
  var isBottom = alignment === MedianAlignmentMode.BottomLeft || alignment === MedianAlignmentMode.BottomRight;
19314
19325
  var allNodesInfo = new ListUtils_1.HashSet(nodeInfos.slice(0).sort(function (a, b) { return isBottom ? (a.layer - b.layer) : (b.layer - a.layer); }), function (n) { return n.key; });
19326
+ var knownNodes = new ListUtils_1.HashSet();
19315
19327
  while (allNodesInfo.length) {
19316
19328
  var firstNode = allNodesInfo.item(0);
19317
- var block = this.getBlock(graph, firstNode, medians, alignment);
19329
+ var block = this.getBlock(graph, firstNode, medians, alignment).filter(function (n) { return knownNodes.tryPush(n.key); });
19318
19330
  blocks.push(block);
19319
19331
  block.forEach(function (n) { return allNodesInfo.remove(n); });
19320
19332
  }
@@ -22503,6 +22515,9 @@ var Connector = (function (_super) {
22503
22515
  this.actualRoutingMode = undefined;
22504
22516
  this.invalidateRenderPoints();
22505
22517
  };
22518
+ Connector.prototype.unlockCreateRenderPoints = function () {
22519
+ this.lockCreateRenderPoints = false;
22520
+ };
22506
22521
  Connector.prototype.replaceRenderPointsCore = function (renderPoints, lockCreateRenderPoints, mode) {
22507
22522
  this.changeRenderPoints(renderPoints);
22508
22523
  this.lockCreateRenderPoints = lockCreateRenderPoints;
@@ -24693,6 +24708,9 @@ var SelectionDragHelper = (function () {
24693
24708
  pi.point.y += offsetTop;
24694
24709
  });
24695
24710
  };
24711
+ SelectionDragHelper.prototype.finish = function () {
24712
+ this.draggingConnectors.forEach(function (c) { return c.connector.unlockCreateRenderPoints(); });
24713
+ };
24696
24714
  SelectionDragHelper.prototype.moveConnector = function (dc, shouldClone, getMovePoint) {
24697
24715
  var startPoints = dc.startPoints;
24698
24716
  var offset = vector_1.Vector.fromPoints(startPoints[0].clone(), getMovePoint(startPoints[0]).clone());
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * DevExpress Diagram (dx-diagram.min)
3
- * Version: 2.2.11
4
- * Build date: Thu Sep 19 2024
3
+ * Version: 2.2.13
4
+ * Build date: Mon Nov 11 2024
5
5
  *
6
6
  * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
7
7
  * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs