devexpress-diagram 2.2.0 → 2.2.2
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-diagram.css +2 -2
- package/dist/dx-diagram.js +118 -14
- package/dist/dx-diagram.min.css +2 -2
- package/dist/dx-diagram.min.js +1 -1
- package/dist/dx-diagram.min.js.LICENSE.txt +2 -2
- package/dist/lib/package.json +3 -6
- package/dist/lib/src/Data/DataSource.ts +2 -0
- package/dist/lib/src/Diagram.ts +1 -1
- package/dist/lib/src/History/Common/ChangeShapeTypeHistoryItem.ts +27 -0
- package/dist/lib/src/Model/ModelManipulator.ts +12 -2
- package/dist/lib/src/Model/ModelUtils.ts +43 -1
- package/dist/lib/src/Model/Shapes/Descriptions/Flowchart/InternalStorageShapeDescription.ts +1 -1
- package/dist/lib/src/Model/Shapes/Descriptions/Flowchart/PredefinedProcessShapeDescription.ts +1 -1
- package/dist/lib/src/Model/Shapes/Descriptions/General/ArrowHorizontalShapeDescription.ts +1 -1
- package/dist/lib/src/Model/Shapes/Descriptions/General/ArrowVerticalShapeDescription.ts +1 -1
- package/dist/lib/src/Model/Shapes/Descriptions/General/CrossShapeDescription.ts +1 -1
- package/dist/lib/src/Model/Shapes/Descriptions/General/StarShapeDescription.ts +1 -1
- package/dist/lib/src/Model/Shapes/Shape.ts +1 -1
- package/dist/lib/src/Model/Shapes/ShapeParameters.ts +12 -8
- package/dist/lib/tsconfig.json +1 -1
- package/package.json +3 -6
package/dist/dx-diagram.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* DevExpress Diagram (dx-diagram)
|
|
3
|
-
* Version: 2.2.
|
|
4
|
-
* Build date:
|
|
3
|
+
* Version: 2.2.2
|
|
4
|
+
* Build date: Wed Sep 13 2023
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
|
|
7
7
|
* Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs
|
package/dist/dx-diagram.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* DevExpress Diagram (dx-diagram)
|
|
3
|
-
* Version: 2.2.
|
|
4
|
-
* Build date:
|
|
3
|
+
* Version: 2.2.2
|
|
4
|
+
* Build date: Wed Sep 13 2023
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
|
|
7
7
|
* Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs
|
|
@@ -9518,6 +9518,8 @@ var DataSource = (function () {
|
|
|
9518
9518
|
if (node.top !== undefined)
|
|
9519
9519
|
point.y = ModelUtils_1.ModelUtils.getTwipsValue(model.units, node.top);
|
|
9520
9520
|
ModelUtils_1.ModelUtils.setShapePosition(history, model, shape, point, false);
|
|
9521
|
+
if (node.type !== undefined)
|
|
9522
|
+
ModelUtils_1.ModelUtils.changeShapeType(history, model, shape, node.type);
|
|
9521
9523
|
var size = shape.size.clone();
|
|
9522
9524
|
if (node.width !== undefined)
|
|
9523
9525
|
size.width = ModelUtils_1.ModelUtils.getTwipsValue(model.units, node.width);
|
|
@@ -10614,7 +10616,7 @@ var DiagramControl = (function () {
|
|
|
10614
10616
|
this.permissionsProvider = new PermissionsProvider_1.PermissionsProvider(this.apiController);
|
|
10615
10617
|
this.permissionsProvider.onRequestOperation.add(this);
|
|
10616
10618
|
this.routingModel = new ConnectorRoutingModel_1.ConnectorRoutingModel();
|
|
10617
|
-
this.modelManipulator = new ModelManipulator_1.ModelManipulator(this.model, this.routingModel, this.permissionsProvider);
|
|
10619
|
+
this.modelManipulator = new ModelManipulator_1.ModelManipulator(this.model, this.routingModel, this.permissionsProvider, this.shapeDescriptionManager);
|
|
10618
10620
|
this.modelManipulator.onModelChanged.add(this.permissionsProvider);
|
|
10619
10621
|
this.history = new History_1.History(this.modelManipulator, this);
|
|
10620
10622
|
this.barManager = new BarManager_1.BarManager(this);
|
|
@@ -15998,6 +16000,52 @@ var ChangeShapeParametersHistoryItem = (function (_super) {
|
|
|
15998
16000
|
exports.ChangeShapeParametersHistoryItem = ChangeShapeParametersHistoryItem;
|
|
15999
16001
|
|
|
16000
16002
|
|
|
16003
|
+
/***/ }),
|
|
16004
|
+
|
|
16005
|
+
/***/ 56:
|
|
16006
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
16007
|
+
|
|
16008
|
+
|
|
16009
|
+
var __extends = (this && this.__extends) || (function () {
|
|
16010
|
+
var extendStatics = function (d, b) {
|
|
16011
|
+
extendStatics = Object.setPrototypeOf ||
|
|
16012
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
16013
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
16014
|
+
return extendStatics(d, b);
|
|
16015
|
+
};
|
|
16016
|
+
return function (d, b) {
|
|
16017
|
+
extendStatics(d, b);
|
|
16018
|
+
function __() { this.constructor = d; }
|
|
16019
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16020
|
+
};
|
|
16021
|
+
})();
|
|
16022
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
16023
|
+
exports.ChangeShapeTypeHistoryItem = void 0;
|
|
16024
|
+
var ShapeParameters_1 = __webpack_require__(6629);
|
|
16025
|
+
var HistoryItem_1 = __webpack_require__(4412);
|
|
16026
|
+
var ChangeShapeTypeHistoryItem = (function (_super) {
|
|
16027
|
+
__extends(ChangeShapeTypeHistoryItem, _super);
|
|
16028
|
+
function ChangeShapeTypeHistoryItem(shape, newType) {
|
|
16029
|
+
var _this = _super.call(this) || this;
|
|
16030
|
+
_this.shapeKey = shape.key;
|
|
16031
|
+
_this.newType = newType;
|
|
16032
|
+
return _this;
|
|
16033
|
+
}
|
|
16034
|
+
ChangeShapeTypeHistoryItem.prototype.redo = function (manipulator) {
|
|
16035
|
+
var shape = manipulator.model.findShape(this.shapeKey);
|
|
16036
|
+
this.oldType = shape.description.key;
|
|
16037
|
+
this.oldParameters = shape.parameters.clone();
|
|
16038
|
+
manipulator.updateShapeType(shape, this.newType, new ShapeParameters_1.ShapeParameters());
|
|
16039
|
+
};
|
|
16040
|
+
ChangeShapeTypeHistoryItem.prototype.undo = function (manipulator) {
|
|
16041
|
+
var shape = manipulator.model.findShape(this.shapeKey);
|
|
16042
|
+
manipulator.updateShapeType(shape, this.oldType, this.oldParameters);
|
|
16043
|
+
};
|
|
16044
|
+
return ChangeShapeTypeHistoryItem;
|
|
16045
|
+
}(HistoryItem_1.HistoryItem));
|
|
16046
|
+
exports.ChangeShapeTypeHistoryItem = ChangeShapeTypeHistoryItem;
|
|
16047
|
+
|
|
16048
|
+
|
|
16001
16049
|
/***/ }),
|
|
16002
16050
|
|
|
16003
16051
|
/***/ 8930:
|
|
@@ -24727,11 +24775,12 @@ var Connector_1 = __webpack_require__(7959);
|
|
|
24727
24775
|
var ModelChange_1 = __webpack_require__(2004);
|
|
24728
24776
|
var ModelUtils_1 = __webpack_require__(4867);
|
|
24729
24777
|
var ModelManipulator = (function () {
|
|
24730
|
-
function ModelManipulator(model, routingModel, permissionsProvider) {
|
|
24778
|
+
function ModelManipulator(model, routingModel, permissionsProvider, descriptionManager) {
|
|
24731
24779
|
this.onModelChanged = new Utils_1.EventDispatcher();
|
|
24732
24780
|
this.onModelSizeChanged = new Utils_1.EventDispatcher();
|
|
24733
24781
|
this.initializeCore(model, routingModel);
|
|
24734
24782
|
this.permissionsProvider = permissionsProvider;
|
|
24783
|
+
this.descriptionManager = descriptionManager;
|
|
24735
24784
|
this.imageLoader = new ImageLoader_1.ImageLoader(this.updateShapeImage.bind(this));
|
|
24736
24785
|
}
|
|
24737
24786
|
ModelManipulator.prototype.initialize = function (model, routingModel) {
|
|
@@ -24917,6 +24966,13 @@ var ModelManipulator = (function () {
|
|
|
24917
24966
|
var shapes = this.model.findShapesByDescription(description);
|
|
24918
24967
|
this.commitItemsChangesCore(ModelChange_1.ItemChangeType.UpdateProperties, shapes);
|
|
24919
24968
|
};
|
|
24969
|
+
ModelManipulator.prototype.updateShapeType = function (shape, typeKey, shapeParameters) {
|
|
24970
|
+
var description = this.descriptionManager.get(typeKey);
|
|
24971
|
+
shape.description = description;
|
|
24972
|
+
shape.parameters = shapeParameters;
|
|
24973
|
+
description.createParameters(shapeParameters);
|
|
24974
|
+
this.raiseModelChanged([new ModelChange_1.ItemChange(shape, ModelChange_1.ItemChangeType.UpdateStructure)]);
|
|
24975
|
+
};
|
|
24920
24976
|
ModelManipulator.prototype.addConnector = function (connector, key) {
|
|
24921
24977
|
if (connector.beginItem || connector.endItem)
|
|
24922
24978
|
throw Error("Creating connector should not contain begin/end items");
|
|
@@ -25185,6 +25241,7 @@ var ConnectorProperties_1 = __webpack_require__(4612);
|
|
|
25185
25241
|
var ConnectorRenderPoint_1 = __webpack_require__(4717);
|
|
25186
25242
|
var ConnectorRenderPointsContext_1 = __webpack_require__(1510);
|
|
25187
25243
|
var Shape_1 = __webpack_require__(5503);
|
|
25244
|
+
var ChangeShapeTypeHistoryItem_1 = __webpack_require__(56);
|
|
25188
25245
|
var ModelUtils = (function () {
|
|
25189
25246
|
function ModelUtils() {
|
|
25190
25247
|
}
|
|
@@ -26067,6 +26124,49 @@ var ModelUtils = (function () {
|
|
|
26067
26124
|
ModelUtils.createRectangle = function (items) {
|
|
26068
26125
|
return Utils_1.GeometryUtils.getCommonRectangle(items.map(function (i) { return i.rectangle; }));
|
|
26069
26126
|
};
|
|
26127
|
+
ModelUtils.changeShapeType = function (history, model, shape, shapeType) {
|
|
26128
|
+
if (shape.description.key === shapeType)
|
|
26129
|
+
return;
|
|
26130
|
+
history.beginTransaction();
|
|
26131
|
+
var oldConPts = shape.getConnectionPoints();
|
|
26132
|
+
var oldConPtsSides = oldConPts.map(function (p) { return shape.getConnectionPointSide(p); });
|
|
26133
|
+
history.addAndRedo(new ChangeShapeTypeHistoryItem_1.ChangeShapeTypeHistoryItem(shape, shapeType));
|
|
26134
|
+
var newConPts = shape.getConnectionPoints();
|
|
26135
|
+
var newConPtsSides = newConPts.map(function (p) { return shape.getConnectionPointSide(p); });
|
|
26136
|
+
for (var i = 0, connector = void 0; connector = shape.attachedConnectors[i]; i++) {
|
|
26137
|
+
if (connector.beginItem === shape)
|
|
26138
|
+
this.updateConnectionIndexByNewShapeType(history, connector, Connector_1.ConnectorPosition.Begin, connector.beginConnectionPointIndex, oldConPts, oldConPtsSides, newConPts, newConPtsSides);
|
|
26139
|
+
if (connector.endItem === shape)
|
|
26140
|
+
this.updateConnectionIndexByNewShapeType(history, connector, Connector_1.ConnectorPosition.End, connector.endConnectionPointIndex, oldConPts, oldConPtsSides, newConPts, newConPtsSides);
|
|
26141
|
+
this.updateConnectorAttachedPoints(history, model, connector);
|
|
26142
|
+
}
|
|
26143
|
+
history.endTransaction();
|
|
26144
|
+
};
|
|
26145
|
+
ModelUtils.updateConnectionIndexByNewShapeType = function (history, connector, position, oldPointIndex, oldConPts, oldConPtsSides, newConPts, newConPtsSides) {
|
|
26146
|
+
if (oldPointIndex < 0)
|
|
26147
|
+
return;
|
|
26148
|
+
var oldSide = oldConPtsSides[oldPointIndex];
|
|
26149
|
+
var oldPt = oldConPts[oldPointIndex];
|
|
26150
|
+
if (oldPointIndex < newConPts.length && oldSide === newConPtsSides[oldPointIndex])
|
|
26151
|
+
return;
|
|
26152
|
+
var newIndex = this.findNearestPointIndex(newConPts, oldPt, function (i) { return newConPtsSides[i] === oldSide; });
|
|
26153
|
+
if (newIndex === -1)
|
|
26154
|
+
newIndex = this.findNearestPointIndex(newConPts, oldPt, function () { return true; });
|
|
26155
|
+
if (newIndex !== oldPointIndex)
|
|
26156
|
+
history.addAndRedo(new AddConnectionHistoryItem_1.SetConnectionPointIndexHistoryItem(connector, newIndex, position));
|
|
26157
|
+
};
|
|
26158
|
+
ModelUtils.findNearestPointIndex = function (points, initPoint, condition) {
|
|
26159
|
+
return points.reduce(function (acc, val, index) {
|
|
26160
|
+
if (condition(index)) {
|
|
26161
|
+
var dist = metrics_1.Metrics.euclideanDistance(initPoint, points[index]);
|
|
26162
|
+
if (acc.index === -1 || acc.distance > dist) {
|
|
26163
|
+
acc.index = index;
|
|
26164
|
+
acc.distance = dist;
|
|
26165
|
+
}
|
|
26166
|
+
}
|
|
26167
|
+
return acc;
|
|
26168
|
+
}, { distance: Number.MAX_SAFE_INTEGER, index: -1 }).index;
|
|
26169
|
+
};
|
|
26070
26170
|
ModelUtils.connectionPointActionSize = unit_converter_1.UnitConverter.pixelsToTwips(8);
|
|
26071
26171
|
return ModelUtils;
|
|
26072
26172
|
}());
|
|
@@ -28472,7 +28572,7 @@ var InternalStorageShapeDescription = (function (_super) {
|
|
|
28472
28572
|
]);
|
|
28473
28573
|
};
|
|
28474
28574
|
InternalStorageShapeDescription.prototype.createParameters = function (parameters) {
|
|
28475
|
-
parameters.
|
|
28575
|
+
parameters.addRangeIfNotExists([
|
|
28476
28576
|
new ShapeParameters_1.ShapeParameter(exports.InternalStorageHorizontalEdgeParameterName, this.defaultSize.width * 0.1),
|
|
28477
28577
|
new ShapeParameters_1.ShapeParameter(exports.InternalStorageVerticalEdgeParameterName, this.defaultSize.width * 0.1)
|
|
28478
28578
|
]);
|
|
@@ -29035,7 +29135,7 @@ var PredefinedProcessShapeDescription = (function (_super) {
|
|
|
29035
29135
|
]);
|
|
29036
29136
|
};
|
|
29037
29137
|
PredefinedProcessShapeDescription.prototype.createParameters = function (parameters) {
|
|
29038
|
-
parameters.
|
|
29138
|
+
parameters.addIfNotExists(new ShapeParameters_1.ShapeParameter(exports.PredefinedProcessEdgeParameterName, this.defaultSize.width * 0.1));
|
|
29039
29139
|
};
|
|
29040
29140
|
PredefinedProcessShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
|
|
29041
29141
|
this.changeParameterValue(parameters, exports.PredefinedProcessEdgeParameterName, function (p) { return Math.max(PredefinedProcessShapeDescription.minEdge, Math.min(shape.size.width * 0.3, p.value)); });
|
|
@@ -29492,7 +29592,7 @@ var ArrowHorizontalShapeDescription = (function (_super) {
|
|
|
29492
29592
|
configurable: true
|
|
29493
29593
|
});
|
|
29494
29594
|
ArrowHorizontalShapeDescription.prototype.createParameters = function (parameters) {
|
|
29495
|
-
parameters.
|
|
29595
|
+
parameters.addRangeIfNotExists([
|
|
29496
29596
|
new ShapeParameters_1.ShapeParameter(exports.ArrowVerticalTriangleWidthParameterName, Math.sqrt(Math.pow(this.defaultSize.height, 2) - Math.pow(this.defaultSize.height / 2, 2))),
|
|
29497
29597
|
new ShapeParameters_1.ShapeParameter(exports.ArrowVerticalLineHeightParameterName, this.defaultSize.height / 3)
|
|
29498
29598
|
]);
|
|
@@ -29984,7 +30084,7 @@ var ArrowVerticalShapeDescription = (function (_super) {
|
|
|
29984
30084
|
configurable: true
|
|
29985
30085
|
});
|
|
29986
30086
|
ArrowVerticalShapeDescription.prototype.createParameters = function (parameters) {
|
|
29987
|
-
parameters.
|
|
30087
|
+
parameters.addRangeIfNotExists([
|
|
29988
30088
|
new ShapeParameters_1.ShapeParameter(exports.ArrowVerticalTriangleHeightParameterName, Math.sqrt(Math.pow(this.defaultSize.width, 2) - Math.pow(this.defaultSize.width / 2, 2))),
|
|
29989
30089
|
new ShapeParameters_1.ShapeParameter(exports.ArrowVerticalLineWidthParameterName, this.defaultSize.width / 3)
|
|
29990
30090
|
]);
|
|
@@ -30084,7 +30184,7 @@ var CrossShapeDescription = (function (_super) {
|
|
|
30084
30184
|
];
|
|
30085
30185
|
};
|
|
30086
30186
|
CrossShapeDescription.prototype.createParameters = function (parameters) {
|
|
30087
|
-
parameters.
|
|
30187
|
+
parameters.addRangeIfNotExists([
|
|
30088
30188
|
new ShapeParameters_1.ShapeParameter(exports.CrossHorizontalWidthParameterName, this.defaultSize.width * 0.2),
|
|
30089
30189
|
new ShapeParameters_1.ShapeParameter(exports.CrossVerticalWidthParameterName, this.defaultSize.height * 0.2)
|
|
30090
30190
|
]);
|
|
@@ -30752,7 +30852,7 @@ var StarShapeDescription = (function (_super) {
|
|
|
30752
30852
|
];
|
|
30753
30853
|
};
|
|
30754
30854
|
StarShapeDescription.prototype.createParameters = function (parameters) {
|
|
30755
|
-
parameters.
|
|
30855
|
+
parameters.addRangeIfNotExists([
|
|
30756
30856
|
new ShapeParameters_1.ShapeParameter(exports.StarConvexParameterName, 300)
|
|
30757
30857
|
]);
|
|
30758
30858
|
};
|
|
@@ -32041,12 +32141,16 @@ var ShapeParameters = (function () {
|
|
|
32041
32141
|
function ShapeParameters() {
|
|
32042
32142
|
this.items = {};
|
|
32043
32143
|
}
|
|
32044
|
-
ShapeParameters.prototype.
|
|
32144
|
+
ShapeParameters.prototype.addIfNotExists = function (parameter) {
|
|
32145
|
+
if (!(parameter.key in this.items))
|
|
32146
|
+
this.set(parameter);
|
|
32147
|
+
};
|
|
32148
|
+
ShapeParameters.prototype.set = function (parameter) {
|
|
32045
32149
|
this.items[parameter.key] = parameter;
|
|
32046
32150
|
};
|
|
32047
|
-
ShapeParameters.prototype.
|
|
32151
|
+
ShapeParameters.prototype.addRangeIfNotExists = function (parameters) {
|
|
32048
32152
|
for (var i = 0; i < parameters.length; i++)
|
|
32049
|
-
this.
|
|
32153
|
+
this.addIfNotExists(parameters[i]);
|
|
32050
32154
|
};
|
|
32051
32155
|
ShapeParameters.prototype.get = function (key) {
|
|
32052
32156
|
return this.items[key];
|
|
@@ -32058,7 +32162,7 @@ var ShapeParameters = (function () {
|
|
|
32058
32162
|
};
|
|
32059
32163
|
ShapeParameters.prototype.clone = function () {
|
|
32060
32164
|
var result = new ShapeParameters();
|
|
32061
|
-
this.forEach(function (p) { result.
|
|
32165
|
+
this.forEach(function (p) { result.addIfNotExists(new ShapeParameter(p.key, p.value)); });
|
|
32062
32166
|
return result;
|
|
32063
32167
|
};
|
|
32064
32168
|
ShapeParameters.prototype.toObject = function () {
|
package/dist/dx-diagram.min.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* DevExpress Diagram (dx-diagram.min)
|
|
3
|
-
* Version: 2.2.
|
|
4
|
-
* Build date:
|
|
3
|
+
* Version: 2.2.2
|
|
4
|
+
* Build date: Wed Sep 13 2023
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
|
|
7
7
|
* Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs
|