@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.umd.js
CHANGED
|
@@ -76094,8 +76094,7 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76094
76094
|
_createClass(Multiplayer, [{
|
|
76095
76095
|
key: "init",
|
|
76096
76096
|
value: function init() {
|
|
76097
|
-
var _window$ProcessMaker
|
|
76098
|
-
_this = this;
|
|
76097
|
+
var _window$ProcessMaker$;
|
|
76099
76098
|
// Get the node id generator
|
|
76100
76099
|
_classPrivateFieldSet(this, _nodeIdGenerator, getNodeIdGenerator(this.modeler.definitions));
|
|
76101
76100
|
// Get the room name from the process id
|
|
@@ -76106,6 +76105,17 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76106
76105
|
this.clientIO = esm_lookup(window.ProcessMaker.multiplayer.host, {
|
|
76107
76106
|
transports: ['websocket', 'polling']
|
|
76108
76107
|
});
|
|
76108
|
+
if (window.ProcessMaker.multiplayer.enabled) {
|
|
76109
|
+
this.webSocketEvents();
|
|
76110
|
+
this.multiplayerEvents();
|
|
76111
|
+
} else {
|
|
76112
|
+
this.clientIO.disconnect();
|
|
76113
|
+
}
|
|
76114
|
+
}
|
|
76115
|
+
}, {
|
|
76116
|
+
key: "webSocketEvents",
|
|
76117
|
+
value: function webSocketEvents() {
|
|
76118
|
+
var _this = this;
|
|
76109
76119
|
this.clientIO.on('connect', function () {
|
|
76110
76120
|
var _window$ProcessMaker$2, _window$ProcessMaker$3;
|
|
76111
76121
|
// Join the room
|
|
@@ -76244,37 +76254,42 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76244
76254
|
// Update the element in the shared array
|
|
76245
76255
|
applyUpdate(_this.yDoc, new Uint8Array(updateDoc));
|
|
76246
76256
|
});
|
|
76257
|
+
}
|
|
76258
|
+
}, {
|
|
76259
|
+
key: "multiplayerEvents",
|
|
76260
|
+
value: function multiplayerEvents() {
|
|
76261
|
+
var _this2 = this;
|
|
76247
76262
|
window.ProcessMaker.EventBus.$on('multiplayer-addNode', function (data) {
|
|
76248
|
-
|
|
76263
|
+
_this2.addNode(data);
|
|
76249
76264
|
});
|
|
76250
76265
|
window.ProcessMaker.EventBus.$on('multiplayer-removeNode', function (data) {
|
|
76251
|
-
|
|
76266
|
+
_this2.removeNode(data);
|
|
76252
76267
|
});
|
|
76253
76268
|
window.ProcessMaker.EventBus.$on('multiplayer-updateNodes', function (data) {
|
|
76254
|
-
|
|
76269
|
+
_this2.updateNodes(data);
|
|
76255
76270
|
});
|
|
76256
76271
|
window.ProcessMaker.EventBus.$on('multiplayer-replaceNode', function (_ref3) {
|
|
76257
76272
|
var nodeData = _ref3.nodeData,
|
|
76258
76273
|
newControl = _ref3.newControl;
|
|
76259
|
-
|
|
76274
|
+
_this2.replaceNode(nodeData, newControl);
|
|
76260
76275
|
});
|
|
76261
76276
|
window.ProcessMaker.EventBus.$on('multiplayer-addFlow', function (data) {
|
|
76262
|
-
|
|
76277
|
+
_this2.addCommonElement(data);
|
|
76263
76278
|
});
|
|
76264
76279
|
window.ProcessMaker.EventBus.$on('multiplayer-addBoundaryEvent', function (data) {
|
|
76265
|
-
|
|
76280
|
+
_this2.addCommonElement(data);
|
|
76266
76281
|
});
|
|
76267
76282
|
window.ProcessMaker.EventBus.$on('multiplayer-addLanes', function (lanes) {
|
|
76268
|
-
|
|
76283
|
+
_this2.addLaneNodes(lanes);
|
|
76269
76284
|
});
|
|
76270
76285
|
window.ProcessMaker.EventBus.$on('multiplayer-updateInspectorProperty', function (data) {
|
|
76271
|
-
if (
|
|
76272
|
-
|
|
76286
|
+
if (_this2.modeler.isMultiplayer) {
|
|
76287
|
+
_this2.updateInspectorProperty(data);
|
|
76273
76288
|
}
|
|
76274
76289
|
});
|
|
76275
76290
|
window.ProcessMaker.EventBus.$on('multiplayer-updateFlows', function (data) {
|
|
76276
|
-
if (
|
|
76277
|
-
|
|
76291
|
+
if (_this2.modeler.isMultiplayer) {
|
|
76292
|
+
_this2.updateFlows(data);
|
|
76278
76293
|
}
|
|
76279
76294
|
});
|
|
76280
76295
|
}
|
|
@@ -76285,19 +76300,19 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76285
76300
|
}, {
|
|
76286
76301
|
key: "syncLocalNodes",
|
|
76287
76302
|
value: function syncLocalNodes(clientId) {
|
|
76288
|
-
var
|
|
76303
|
+
var _this3 = this;
|
|
76289
76304
|
// Get the process definition
|
|
76290
76305
|
var nodes = this.modeler.nodes.map(function (node) {
|
|
76291
|
-
return
|
|
76306
|
+
return _this3.modeler.multiplayerHook(node, false, true);
|
|
76292
76307
|
});
|
|
76293
76308
|
nodes.forEach(function (node) {
|
|
76294
76309
|
var yMapNested = new YMap();
|
|
76295
|
-
|
|
76296
|
-
|
|
76310
|
+
_this3.doTransact(yMapNested, node);
|
|
76311
|
+
_this3.yArray.push([yMapNested]);
|
|
76297
76312
|
// Encode the state as an update and send it to the server
|
|
76298
|
-
var stateUpdate = encodeStateAsUpdate(
|
|
76313
|
+
var stateUpdate = encodeStateAsUpdate(_this3.yDoc);
|
|
76299
76314
|
// Send the update to the web socket server
|
|
76300
|
-
|
|
76315
|
+
_this3.clientIO.emit('createElement', {
|
|
76301
76316
|
updateDoc: stateUpdate,
|
|
76302
76317
|
clientId: clientId
|
|
76303
76318
|
});
|
|
@@ -76335,10 +76350,10 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76335
76350
|
}, {
|
|
76336
76351
|
key: "createRemoteShape",
|
|
76337
76352
|
value: function createRemoteShape(changes) {
|
|
76338
|
-
var
|
|
76353
|
+
var _this4 = this;
|
|
76339
76354
|
return new Promise(function (resolve) {
|
|
76340
76355
|
changes.map(function (data) {
|
|
76341
|
-
|
|
76356
|
+
_this4.createShape(data);
|
|
76342
76357
|
});
|
|
76343
76358
|
resolve();
|
|
76344
76359
|
});
|
|
@@ -76406,14 +76421,14 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76406
76421
|
}, {
|
|
76407
76422
|
key: "updateNodes",
|
|
76408
76423
|
value: function updateNodes(data) {
|
|
76409
|
-
var
|
|
76424
|
+
var _this5 = this;
|
|
76410
76425
|
data.forEach(function (value) {
|
|
76411
|
-
var index =
|
|
76412
|
-
var nodeToUpdate =
|
|
76426
|
+
var index = _this5.getIndex(value.id);
|
|
76427
|
+
var nodeToUpdate = _this5.yArray.get(index);
|
|
76413
76428
|
var updateData = value.poolId ? _objectSpread2(_objectSpread2({}, value.properties), {
|
|
76414
76429
|
poolId: value.poolId
|
|
76415
76430
|
}) : value.properties;
|
|
76416
|
-
|
|
76431
|
+
_this5.doTransact(nodeToUpdate, updateData);
|
|
76417
76432
|
});
|
|
76418
76433
|
}
|
|
76419
76434
|
}, {
|
|
@@ -76494,7 +76509,7 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76494
76509
|
key: "updateShapes",
|
|
76495
76510
|
value: function () {
|
|
76496
76511
|
var _updateShapes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {
|
|
76497
|
-
var
|
|
76512
|
+
var _this6 = this;
|
|
76498
76513
|
var paper, element, newPool, sourceElem, targetElem, waypoint, startWaypoint, endWaypoint, newWaypoint, node;
|
|
76499
76514
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
76500
76515
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -76514,14 +76529,14 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76514
76529
|
startWaypoint = waypoint.shift();
|
|
76515
76530
|
endWaypoint = waypoint.pop(); // Update the element's waypoints
|
|
76516
76531
|
newWaypoint = waypoint.map(function (point) {
|
|
76517
|
-
return
|
|
76532
|
+
return _this6.modeler.moddle.create('dc:Point', point);
|
|
76518
76533
|
});
|
|
76519
76534
|
element.set('vertices', newWaypoint);
|
|
76520
76535
|
|
|
76521
76536
|
// Update the element's source anchor
|
|
76522
76537
|
element.source(sourceElem, {
|
|
76523
76538
|
anchor: function anchor() {
|
|
76524
|
-
return getDefaultAnchorPoint(
|
|
76539
|
+
return getDefaultAnchorPoint(_this6.getConnectionPoint(sourceElem, startWaypoint), sourceElem.findView(paper));
|
|
76525
76540
|
},
|
|
76526
76541
|
connectionPoint: {
|
|
76527
76542
|
name: 'boundary'
|
|
@@ -76531,7 +76546,7 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76531
76546
|
// Update the element's target anchor
|
|
76532
76547
|
element.target(targetElem, {
|
|
76533
76548
|
anchor: function anchor() {
|
|
76534
|
-
return getDefaultAnchorPoint(
|
|
76549
|
+
return getDefaultAnchorPoint(_this6.getConnectionPoint(targetElem, endWaypoint), targetElem.findView(paper));
|
|
76535
76550
|
},
|
|
76536
76551
|
connectionPoint: {
|
|
76537
76552
|
name: 'boundary'
|
|
@@ -76619,7 +76634,7 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76619
76634
|
}, {
|
|
76620
76635
|
key: "addLaneNodes",
|
|
76621
76636
|
value: function addLaneNodes(lanes) {
|
|
76622
|
-
var
|
|
76637
|
+
var _this7 = this;
|
|
76623
76638
|
var pool = this.getPool(lanes);
|
|
76624
76639
|
window.ProcessMaker.EventBus.$emit('multiplayer-updateNodes', [{
|
|
76625
76640
|
id: pool.component.node.definition.id,
|
|
@@ -76634,11 +76649,11 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76634
76649
|
this.yDoc.transact(function () {
|
|
76635
76650
|
lanes.forEach(function (lane) {
|
|
76636
76651
|
var yMapNested = new YMap();
|
|
76637
|
-
var data =
|
|
76638
|
-
|
|
76639
|
-
|
|
76640
|
-
var stateUpdate = encodeStateAsUpdate(
|
|
76641
|
-
|
|
76652
|
+
var data = _this7.prepareLaneData(lane);
|
|
76653
|
+
_this7.doTransact(yMapNested, data);
|
|
76654
|
+
_this7.yArray.push([yMapNested]);
|
|
76655
|
+
var stateUpdate = encodeStateAsUpdate(_this7.yDoc);
|
|
76656
|
+
_this7.clientIO.emit('createElement', {
|
|
76642
76657
|
updateDoc: stateUpdate
|
|
76643
76658
|
});
|
|
76644
76659
|
});
|
|
@@ -76812,11 +76827,11 @@ var Multiplayer = /*#__PURE__*/function () {
|
|
|
76812
76827
|
}, {
|
|
76813
76828
|
key: "updateFlows",
|
|
76814
76829
|
value: function updateFlows(data) {
|
|
76815
|
-
var
|
|
76830
|
+
var _this8 = this;
|
|
76816
76831
|
data.forEach(function (value) {
|
|
76817
|
-
var index =
|
|
76818
|
-
var nodeToUpdate =
|
|
76819
|
-
|
|
76832
|
+
var index = _this8.getIndex(value.id);
|
|
76833
|
+
var nodeToUpdate = _this8.yArray.get(index);
|
|
76834
|
+
_this8.yDoc.transact(function () {
|
|
76820
76835
|
for (var key in value) {
|
|
76821
76836
|
if (Object.hasOwn(value, key)) {
|
|
76822
76837
|
nodeToUpdate.set(key, value[key]);
|