@processmaker/modeler 1.39.27 → 1.39.28

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.
@@ -75781,6 +75781,7 @@ var Multiplayer = /*#__PURE__*/function () {
75781
75781
  };
75782
75782
  _this.modeler.addPlayer(newPlayer);
75783
75783
  });
75784
+ _this.syncLocalNodes(_this.clientIO.id);
75784
75785
  }
75785
75786
  });
75786
75787
  this.clientIO.on('clientLeft', function (payload) {
@@ -75794,22 +75795,7 @@ var Multiplayer = /*#__PURE__*/function () {
75794
75795
 
75795
75796
  // Check if the current client is the first client
75796
75797
  if (firstClient.id === _this.clientIO.id) {
75797
- // Get the process definition
75798
- var nodes = _this.modeler.nodes.map(function (node) {
75799
- return _this.modeler.multiplayerHook(node, false, true);
75800
- });
75801
- nodes.forEach(function (node) {
75802
- var yMapNested = new YMap();
75803
- _this.doTransact(yMapNested, node);
75804
- _this.yArray.push([yMapNested]);
75805
- // Encode the state as an update and send it to the server
75806
- var stateUpdate = encodeStateAsUpdate(_this.yDoc);
75807
- // Send the update to the web socket server
75808
- _this.clientIO.emit('createElement', {
75809
- updateDoc: stateUpdate,
75810
- clientId: clientId
75811
- });
75812
- });
75798
+ _this.syncLocalNodes(clientId);
75813
75799
  }
75814
75800
  });
75815
75801
 
@@ -75932,6 +75918,31 @@ var Multiplayer = /*#__PURE__*/function () {
75932
75918
  }
75933
75919
  });
75934
75920
  }
75921
+ /**
75922
+ * Sync the modeler nodes with the microservice
75923
+ * @param {String} clientId
75924
+ */
75925
+ }, {
75926
+ key: "syncLocalNodes",
75927
+ value: function syncLocalNodes(clientId) {
75928
+ var _this2 = this;
75929
+ // Get the process definition
75930
+ var nodes = this.modeler.nodes.map(function (node) {
75931
+ return _this2.modeler.multiplayerHook(node, false, true);
75932
+ });
75933
+ nodes.forEach(function (node) {
75934
+ var yMapNested = new YMap();
75935
+ _this2.doTransact(yMapNested, node);
75936
+ _this2.yArray.push([yMapNested]);
75937
+ // Encode the state as an update and send it to the server
75938
+ var stateUpdate = encodeStateAsUpdate(_this2.yDoc);
75939
+ // Send the update to the web socket server
75940
+ _this2.clientIO.emit('createElement', {
75941
+ updateDoc: stateUpdate,
75942
+ clientId: clientId
75943
+ });
75944
+ });
75945
+ }
75935
75946
  }, {
75936
75947
  key: "addNode",
75937
75948
  value: function addNode(data) {
@@ -75964,10 +75975,10 @@ var Multiplayer = /*#__PURE__*/function () {
75964
75975
  }, {
75965
75976
  key: "createRemoteShape",
75966
75977
  value: function createRemoteShape(changes) {
75967
- var _this2 = this;
75978
+ var _this3 = this;
75968
75979
  return new Promise(function (resolve) {
75969
75980
  changes.map(function (data) {
75970
- _this2.createShape(data);
75981
+ _this3.createShape(data);
75971
75982
  });
75972
75983
  resolve();
75973
75984
  });
@@ -76033,14 +76044,14 @@ var Multiplayer = /*#__PURE__*/function () {
76033
76044
  }, {
76034
76045
  key: "updateNodes",
76035
76046
  value: function updateNodes(data) {
76036
- var _this3 = this;
76047
+ var _this4 = this;
76037
76048
  data.forEach(function (value) {
76038
- var index = _this3.getIndex(value.id);
76039
- var nodeToUpdate = _this3.yArray.get(index);
76049
+ var index = _this4.getIndex(value.id);
76050
+ var nodeToUpdate = _this4.yArray.get(index);
76040
76051
  var updateData = value.poolId ? _objectSpread2(_objectSpread2({}, value.properties), {
76041
76052
  poolId: value.poolId
76042
76053
  }) : value.properties;
76043
- _this3.doTransact(nodeToUpdate, updateData);
76054
+ _this4.doTransact(nodeToUpdate, updateData);
76044
76055
  });
76045
76056
  }
76046
76057
  }, {
@@ -76121,7 +76132,7 @@ var Multiplayer = /*#__PURE__*/function () {
76121
76132
  key: "updateShapes",
76122
76133
  value: function () {
76123
76134
  var _updateShapes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {
76124
- var _this4 = this;
76135
+ var _this5 = this;
76125
76136
  var paper, element, newPool, sourceElem, targetElem, waypoint, startWaypoint, endWaypoint, newWaypoint, node;
76126
76137
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
76127
76138
  while (1) switch (_context3.prev = _context3.next) {
@@ -76141,14 +76152,14 @@ var Multiplayer = /*#__PURE__*/function () {
76141
76152
  startWaypoint = waypoint.shift();
76142
76153
  endWaypoint = waypoint.pop(); // Update the element's waypoints
76143
76154
  newWaypoint = waypoint.map(function (point) {
76144
- return _this4.modeler.moddle.create('dc:Point', point);
76155
+ return _this5.modeler.moddle.create('dc:Point', point);
76145
76156
  });
76146
76157
  element.set('vertices', newWaypoint);
76147
76158
 
76148
76159
  // Update the element's source anchor
76149
76160
  element.source(sourceElem, {
76150
76161
  anchor: function anchor() {
76151
- return getDefaultAnchorPoint(_this4.getConnectionPoint(sourceElem, startWaypoint), sourceElem.findView(paper));
76162
+ return getDefaultAnchorPoint(_this5.getConnectionPoint(sourceElem, startWaypoint), sourceElem.findView(paper));
76152
76163
  },
76153
76164
  connectionPoint: {
76154
76165
  name: 'boundary'
@@ -76158,7 +76169,7 @@ var Multiplayer = /*#__PURE__*/function () {
76158
76169
  // Update the element's target anchor
76159
76170
  element.target(targetElem, {
76160
76171
  anchor: function anchor() {
76161
- return getDefaultAnchorPoint(_this4.getConnectionPoint(targetElem, endWaypoint), targetElem.findView(paper));
76172
+ return getDefaultAnchorPoint(_this5.getConnectionPoint(targetElem, endWaypoint), targetElem.findView(paper));
76162
76173
  },
76163
76174
  connectionPoint: {
76164
76175
  name: 'boundary'
@@ -76246,7 +76257,7 @@ var Multiplayer = /*#__PURE__*/function () {
76246
76257
  }, {
76247
76258
  key: "addLaneNodes",
76248
76259
  value: function addLaneNodes(lanes) {
76249
- var _this5 = this;
76260
+ var _this6 = this;
76250
76261
  var pool = this.getPool(lanes);
76251
76262
  window.ProcessMaker.EventBus.$emit('multiplayer-updateNodes', [{
76252
76263
  id: pool.component.node.definition.id,
@@ -76261,11 +76272,11 @@ var Multiplayer = /*#__PURE__*/function () {
76261
76272
  this.yDoc.transact(function () {
76262
76273
  lanes.forEach(function (lane) {
76263
76274
  var yMapNested = new YMap();
76264
- var data = _this5.prepareLaneData(lane);
76265
- _this5.doTransact(yMapNested, data);
76266
- _this5.yArray.push([yMapNested]);
76267
- var stateUpdate = encodeStateAsUpdate(_this5.yDoc);
76268
- _this5.clientIO.emit('createElement', {
76275
+ var data = _this6.prepareLaneData(lane);
76276
+ _this6.doTransact(yMapNested, data);
76277
+ _this6.yArray.push([yMapNested]);
76278
+ var stateUpdate = encodeStateAsUpdate(_this6.yDoc);
76279
+ _this6.clientIO.emit('createElement', {
76269
76280
  updateDoc: stateUpdate
76270
76281
  });
76271
76282
  });