@processmaker/modeler 1.39.32 → 1.40.0
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/modeler.common.js +54 -39
- package/dist/modeler.common.js.map +1 -1
- package/dist/modeler.umd.js +54 -39
- package/dist/modeler.umd.js.map +1 -1
- package/dist/modeler.umd.min.js +1 -1
- package/dist/modeler.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/multiplayer/multiplayer.js +13 -0
- package/src/setup/globals.js +1 -1
package/dist/modeler.common.js
CHANGED
|
@@ -75996,8 +75996,7 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
75996
75996
|
_createClass(Multiplayer, [{
|
|
75997
75997
|
key: "init",
|
|
75998
75998
|
value: function init() {
|
|
75999
|
-
var _window$ProcessMaker
|
|
76000
|
-
_this = this;
|
|
75999
|
+
var _window$ProcessMaker$;
|
|
76001
76000
|
// Get the node id generator
|
|
76002
76001
|
_classPrivateFieldSet(this, _nodeIdGenerator, getNodeIdGenerator(this.modeler.definitions));
|
|
76003
76002
|
// Get the room name from the process id
|
|
@@ -76008,6 +76007,17 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76008
76007
|
this.clientIO = esm_lookup(window.ProcessMaker.multiplayer.host, {
|
|
76009
76008
|
transports: ['websocket', 'polling']
|
|
76010
76009
|
});
|
|
76010
|
+
if (window.ProcessMaker.multiplayer.enabled) {
|
|
76011
|
+
this.webSocketEvents();
|
|
76012
|
+
this.multiplayerEvents();
|
|
76013
|
+
} else {
|
|
76014
|
+
this.clientIO.disconnect();
|
|
76015
|
+
}
|
|
76016
|
+
}
|
|
76017
|
+
}, {
|
|
76018
|
+
key: "webSocketEvents",
|
|
76019
|
+
value: function webSocketEvents() {
|
|
76020
|
+
var _this = this;
|
|
76011
76021
|
this.clientIO.on('connect', function () {
|
|
76012
76022
|
var _window$ProcessMaker$2, _window$ProcessMaker$3;
|
|
76013
76023
|
// Join the room
|
|
@@ -76146,37 +76156,42 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76146
76156
|
// Update the element in the shared array
|
|
76147
76157
|
applyUpdate(_this.yDoc, new Uint8Array(updateDoc));
|
|
76148
76158
|
});
|
|
76159
|
+
}
|
|
76160
|
+
}, {
|
|
76161
|
+
key: "multiplayerEvents",
|
|
76162
|
+
value: function multiplayerEvents() {
|
|
76163
|
+
var _this2 = this;
|
|
76149
76164
|
window.ProcessMaker.EventBus.$on('multiplayer-addNode', function (data) {
|
|
76150
|
-
|
|
76165
|
+
_this2.addNode(data);
|
|
76151
76166
|
});
|
|
76152
76167
|
window.ProcessMaker.EventBus.$on('multiplayer-removeNode', function (data) {
|
|
76153
|
-
|
|
76168
|
+
_this2.removeNode(data);
|
|
76154
76169
|
});
|
|
76155
76170
|
window.ProcessMaker.EventBus.$on('multiplayer-updateNodes', function (data) {
|
|
76156
|
-
|
|
76171
|
+
_this2.updateNodes(data);
|
|
76157
76172
|
});
|
|
76158
76173
|
window.ProcessMaker.EventBus.$on('multiplayer-replaceNode', function (_ref3) {
|
|
76159
76174
|
var nodeData = _ref3.nodeData,
|
|
76160
76175
|
newControl = _ref3.newControl;
|
|
76161
|
-
|
|
76176
|
+
_this2.replaceNode(nodeData, newControl);
|
|
76162
76177
|
});
|
|
76163
76178
|
window.ProcessMaker.EventBus.$on('multiplayer-addFlow', function (data) {
|
|
76164
|
-
|
|
76179
|
+
_this2.addCommonElement(data);
|
|
76165
76180
|
});
|
|
76166
76181
|
window.ProcessMaker.EventBus.$on('multiplayer-addBoundaryEvent', function (data) {
|
|
76167
|
-
|
|
76182
|
+
_this2.addCommonElement(data);
|
|
76168
76183
|
});
|
|
76169
76184
|
window.ProcessMaker.EventBus.$on('multiplayer-addLanes', function (lanes) {
|
|
76170
|
-
|
|
76185
|
+
_this2.addLaneNodes(lanes);
|
|
76171
76186
|
});
|
|
76172
76187
|
window.ProcessMaker.EventBus.$on('multiplayer-updateInspectorProperty', function (data) {
|
|
76173
|
-
if (
|
|
76174
|
-
|
|
76188
|
+
if (_this2.modeler.isMultiplayer) {
|
|
76189
|
+
_this2.updateInspectorProperty(data);
|
|
76175
76190
|
}
|
|
76176
76191
|
});
|
|
76177
76192
|
window.ProcessMaker.EventBus.$on('multiplayer-updateFlows', function (data) {
|
|
76178
|
-
if (
|
|
76179
|
-
|
|
76193
|
+
if (_this2.modeler.isMultiplayer) {
|
|
76194
|
+
_this2.updateFlows(data);
|
|
76180
76195
|
}
|
|
76181
76196
|
});
|
|
76182
76197
|
}
|
|
@@ -76187,19 +76202,19 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76187
76202
|
}, {
|
|
76188
76203
|
key: "syncLocalNodes",
|
|
76189
76204
|
value: function syncLocalNodes(clientId) {
|
|
76190
|
-
var
|
|
76205
|
+
var _this3 = this;
|
|
76191
76206
|
// Get the process definition
|
|
76192
76207
|
var nodes = this.modeler.nodes.map(function (node) {
|
|
76193
|
-
return
|
|
76208
|
+
return _this3.modeler.multiplayerHook(node, false, true);
|
|
76194
76209
|
});
|
|
76195
76210
|
nodes.forEach(function (node) {
|
|
76196
76211
|
var yMapNested = new YMap();
|
|
76197
|
-
|
|
76198
|
-
|
|
76212
|
+
_this3.doTransact(yMapNested, node);
|
|
76213
|
+
_this3.yArray.push([yMapNested]);
|
|
76199
76214
|
// Encode the state as an update and send it to the server
|
|
76200
|
-
var stateUpdate = encodeStateAsUpdate(
|
|
76215
|
+
var stateUpdate = encodeStateAsUpdate(_this3.yDoc);
|
|
76201
76216
|
// Send the update to the web socket server
|
|
76202
|
-
|
|
76217
|
+
_this3.clientIO.emit('createElement', {
|
|
76203
76218
|
updateDoc: stateUpdate,
|
|
76204
76219
|
clientId: clientId
|
|
76205
76220
|
});
|
|
@@ -76237,10 +76252,10 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76237
76252
|
}, {
|
|
76238
76253
|
key: "createRemoteShape",
|
|
76239
76254
|
value: function createRemoteShape(changes) {
|
|
76240
|
-
var
|
|
76255
|
+
var _this4 = this;
|
|
76241
76256
|
return new Promise(function (resolve) {
|
|
76242
76257
|
changes.map(function (data) {
|
|
76243
|
-
|
|
76258
|
+
_this4.createShape(data);
|
|
76244
76259
|
});
|
|
76245
76260
|
resolve();
|
|
76246
76261
|
});
|
|
@@ -76308,14 +76323,14 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76308
76323
|
}, {
|
|
76309
76324
|
key: "updateNodes",
|
|
76310
76325
|
value: function updateNodes(data) {
|
|
76311
|
-
var
|
|
76326
|
+
var _this5 = this;
|
|
76312
76327
|
data.forEach(function (value) {
|
|
76313
|
-
var index =
|
|
76314
|
-
var nodeToUpdate =
|
|
76328
|
+
var index = _this5.getIndex(value.id);
|
|
76329
|
+
var nodeToUpdate = _this5.yArray.get(index);
|
|
76315
76330
|
var updateData = value.poolId ? _objectSpread2(_objectSpread2({}, value.properties), {
|
|
76316
76331
|
poolId: value.poolId
|
|
76317
76332
|
}) : value.properties;
|
|
76318
|
-
|
|
76333
|
+
_this5.doTransact(nodeToUpdate, updateData);
|
|
76319
76334
|
});
|
|
76320
76335
|
}
|
|
76321
76336
|
}, {
|
|
@@ -76396,7 +76411,7 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76396
76411
|
key: "updateShapes",
|
|
76397
76412
|
value: function () {
|
|
76398
76413
|
var _updateShapes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {
|
|
76399
|
-
var
|
|
76414
|
+
var _this6 = this;
|
|
76400
76415
|
var paper, element, newPool, sourceElem, targetElem, waypoint, startWaypoint, endWaypoint, newWaypoint, node;
|
|
76401
76416
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
76402
76417
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -76416,14 +76431,14 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76416
76431
|
startWaypoint = waypoint.shift();
|
|
76417
76432
|
endWaypoint = waypoint.pop(); // Update the element's waypoints
|
|
76418
76433
|
newWaypoint = waypoint.map(function (point) {
|
|
76419
|
-
return
|
|
76434
|
+
return _this6.modeler.moddle.create('dc:Point', point);
|
|
76420
76435
|
});
|
|
76421
76436
|
element.set('vertices', newWaypoint);
|
|
76422
76437
|
|
|
76423
76438
|
// Update the element's source anchor
|
|
76424
76439
|
element.source(sourceElem, {
|
|
76425
76440
|
anchor: function anchor() {
|
|
76426
|
-
return getDefaultAnchorPoint(
|
|
76441
|
+
return getDefaultAnchorPoint(_this6.getConnectionPoint(sourceElem, startWaypoint), sourceElem.findView(paper));
|
|
76427
76442
|
},
|
|
76428
76443
|
connectionPoint: {
|
|
76429
76444
|
name: 'boundary'
|
|
@@ -76433,7 +76448,7 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76433
76448
|
// Update the element's target anchor
|
|
76434
76449
|
element.target(targetElem, {
|
|
76435
76450
|
anchor: function anchor() {
|
|
76436
|
-
return getDefaultAnchorPoint(
|
|
76451
|
+
return getDefaultAnchorPoint(_this6.getConnectionPoint(targetElem, endWaypoint), targetElem.findView(paper));
|
|
76437
76452
|
},
|
|
76438
76453
|
connectionPoint: {
|
|
76439
76454
|
name: 'boundary'
|
|
@@ -76521,7 +76536,7 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76521
76536
|
}, {
|
|
76522
76537
|
key: "addLaneNodes",
|
|
76523
76538
|
value: function addLaneNodes(lanes) {
|
|
76524
|
-
var
|
|
76539
|
+
var _this7 = this;
|
|
76525
76540
|
var pool = this.getPool(lanes);
|
|
76526
76541
|
window.ProcessMaker.EventBus.$emit('multiplayer-updateNodes', [{
|
|
76527
76542
|
id: pool.component.node.definition.id,
|
|
@@ -76536,11 +76551,11 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76536
76551
|
this.yDoc.transact(function () {
|
|
76537
76552
|
lanes.forEach(function (lane) {
|
|
76538
76553
|
var yMapNested = new YMap();
|
|
76539
|
-
var data =
|
|
76540
|
-
|
|
76541
|
-
|
|
76542
|
-
var stateUpdate = encodeStateAsUpdate(
|
|
76543
|
-
|
|
76554
|
+
var data = _this7.prepareLaneData(lane);
|
|
76555
|
+
_this7.doTransact(yMapNested, data);
|
|
76556
|
+
_this7.yArray.push([yMapNested]);
|
|
76557
|
+
var stateUpdate = encodeStateAsUpdate(_this7.yDoc);
|
|
76558
|
+
_this7.clientIO.emit('createElement', {
|
|
76544
76559
|
updateDoc: stateUpdate
|
|
76545
76560
|
});
|
|
76546
76561
|
});
|
|
@@ -76714,11 +76729,11 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76714
76729
|
}, {
|
|
76715
76730
|
key: "updateFlows",
|
|
76716
76731
|
value: function updateFlows(data) {
|
|
76717
|
-
var
|
|
76732
|
+
var _this8 = this;
|
|
76718
76733
|
data.forEach(function (value) {
|
|
76719
|
-
var index =
|
|
76720
|
-
var nodeToUpdate =
|
|
76721
|
-
|
|
76734
|
+
var index = _this8.getIndex(value.id);
|
|
76735
|
+
var nodeToUpdate = _this8.yArray.get(index);
|
|
76736
|
+
_this8.yDoc.transact(function () {
|
|
76722
76737
|
for (var key in value) {
|
|
76723
76738
|
if (Object.hasOwn(value, key)) {
|
|
76724
76739
|
nodeToUpdate.set(key, value[key]);
|