beta-glozic-workflow 1.23.0 → 1.26.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.
@@ -372,4 +372,65 @@
372
372
  color: #fff !important;
373
373
  background-color: #2bbbad !important;
374
374
  border-color: #2bbbad !important;
375
- }
375
+ }
376
+
377
+ .initial-branch::before {
378
+ position: absolute;
379
+ left: -19px;
380
+ top: 11px;
381
+ width: 53px;
382
+ z-index: 99;
383
+ font-size: 12px;
384
+ background: white;
385
+ }
386
+
387
+ .initial-if::before {
388
+ position: absolute;
389
+ left: -14px;
390
+ top: 11px;
391
+ width: 53px;
392
+ z-index: 99;
393
+ font-size: 12px;
394
+ background: white;
395
+
396
+ }
397
+
398
+ .initial-branch-value1::before {
399
+ content: "Branch 1";
400
+ }
401
+ .initial-branch-value2::before {
402
+ content: "Branch 2";
403
+ }
404
+ .initial-branch-value3::before {
405
+ content: "Branch 3";
406
+ }
407
+ .initial-branch-value4::before {
408
+ content: "Branch 4";
409
+ }
410
+ .initial-branch-value5::before {
411
+ content: "Branch 5";
412
+ }
413
+ .initial-branch-value6::before {
414
+ content: "Branch 6";
415
+ }
416
+ .initial-branch-value7::before {
417
+ content: "Branch 7";
418
+ }
419
+ .initial-branch-value8::before {
420
+ content: "Branch 8";
421
+ }
422
+ .initial-branch-value9::before {
423
+ content: "Branch 9";
424
+ }
425
+ .initial-branch-value10::before {
426
+ content: "Branch 10";
427
+ }
428
+ .initial-if-value1::before {
429
+ content: "False";
430
+ }
431
+
432
+ .initial-if-value2::before {
433
+ content: "True";
434
+ }
435
+
436
+
package/dist/index.js CHANGED
@@ -74,11 +74,68 @@ class Designer extends _react.Component {
74
74
  data.definition.actions = props.Nodes;
75
75
  this.importedJsonFile(data);
76
76
  } else if (props.options.updatedNodeId && props.options.properties) {
77
- console.log('on update action config');
78
- console.log(props.options);
77
+ //Update Properties
79
78
  if (this.nodes[props.options.updatedNodeId]) {
80
79
  this.nodes[props.options.updatedNodeId].configuration["properties"] = props.options.properties;
81
80
  }
81
+
82
+ // Update Branch
83
+ function updateBranchesByActionID(data, targetActionID, newBranches) {
84
+ try {
85
+ // Recursive function to traverse the structure
86
+ function traverse(actions) {
87
+ for (let action of actions) {
88
+ if (action.configuration && action.configuration.actionID === targetActionID) {
89
+ // Update branches array when actionID matches
90
+ var tempBranch = action.branches;
91
+ if (tempBranch.length > newBranches.length) {
92
+ tempBranch = tempBranch.slice(0, newBranches.length);
93
+ } else {
94
+ newBranches.forEach((ele, index) => {
95
+ if (!tempBranch[index]) {
96
+ tempBranch.push({
97
+ name: "branch".concat(index),
98
+ actions: []
99
+ });
100
+ }
101
+ });
102
+ }
103
+ action.branches = tempBranch;
104
+ return true; // Exit once the update is done
105
+ }
106
+
107
+ // Check nested branches if exist
108
+ if (action.branches) {
109
+ for (let branch of action.branches) {
110
+ if (traverse(branch.actions)) {
111
+ return true;
112
+ }
113
+ }
114
+ }
115
+ }
116
+ return false; // If no match found at this level
117
+ }
118
+
119
+ // Start traversing from the root actions
120
+ const isUpdated = traverse(data);
121
+
122
+ // Return status or data based on the update result
123
+ return isUpdated ? data : null;
124
+ } catch (error) {
125
+ console.error("An error occurred while updating branches:", error);
126
+ return null; // Return null if there's an error
127
+ }
128
+ }
129
+ if (this.nodes[props.options.updatedNodeId].nodeType == "BRANCH" && this.nodes[props.options.updatedNodeId].configuration) {
130
+ const newBranches = this.nodes[props.options.updatedNodeId].configuration.properties.branches;
131
+ const updatedData = updateBranchesByActionID(props.Nodes, props.options.updatedNodeId, newBranches);
132
+ let data = JSON.parse(JSON.stringify(layout));
133
+ data.definition.actions = updatedData;
134
+ this.importedJsonFile(data);
135
+ }
136
+ window.setTimeout(() => {
137
+ self.props.onChange(self.flowchartToJson());
138
+ }, 400);
82
139
  }
83
140
  }
84
141
  });
@@ -1028,6 +1085,7 @@ class Designer extends _react.Component {
1028
1085
  //let item = config.taskType[datatype.parent][datatype.type];
1029
1086
  let item = taskConfig[datatype.type];
1030
1087
  let branches = copyTask ? copyTask.branches ? copyTask.branches.length : null : item.branch;
1088
+ let nodeType = copyTask ? copyTask !== null && copyTask !== void 0 && copyTask.nodeType ? copyTask.nodeType : null : item === null || item === void 0 ? void 0 : item.nodeType;
1031
1089
  let connections = this.firstInstance.getConnections({
1032
1090
  source: source,
1033
1091
  target: target
@@ -1234,7 +1292,13 @@ class Designer extends _react.Component {
1234
1292
  let topPos = this.nodes[target].element.offsetTop - _workflow.config.nodeGap;
1235
1293
  newTopBranchNode.setAttribute('id', topBranchId);
1236
1294
  newBotBranchNode.setAttribute('id', botBranchId);
1237
- newTopBranchNode.className = 'fc-item fc-item-draggable fc-item-end-point';
1295
+ if (nodeType == "BRANCH") {
1296
+ newTopBranchNode.className = "fc-item fc-item-draggable fc-item-end-point initial-branch initial-branch-value".concat(i + 1);
1297
+ } else if (nodeType == "Condition") {
1298
+ newTopBranchNode.className = "fc-item fc-item-draggable fc-item-end-point initial-if initial-if-value".concat(i + 1);
1299
+ } else {
1300
+ newTopBranchNode.className = "fc-item fc-item-draggable fc-item-end-point";
1301
+ }
1238
1302
  newBotBranchNode.className = 'fc-item fc-item-draggable fc-item-end-point';
1239
1303
  let left;
1240
1304
  let top;
@@ -272,7 +272,7 @@ const taskConfig = exports.taskConfig = {
272
272
  "name": "branch1",
273
273
  "actions": []
274
274
  }],
275
- "title": "Parallel branches",
275
+ "title": "Branch",
276
276
  "nodeType": "BRANCH",
277
277
  "name": "BRANCH",
278
278
  "description": "IF_ELSE(CMP, branch_if_true, branch_if_false)",
@@ -9,7 +9,7 @@ var _taskConfig = require("./taskConfig");
9
9
  const config = exports.config = {
10
10
  MAXIMUM_NESTED: 5,
11
11
  logger: true,
12
- nodeGap: 60,
12
+ nodeGap: 100,
13
13
  nodeStartEndSize: 35,
14
14
  nodeWidthDefault: 160,
15
15
  nodeSizeDefault: 44,
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "components",
8
8
  "ui"
9
9
  ],
10
- "version": "1.23.0",
10
+ "version": "1.26.0",
11
11
  "private": false,
12
12
  "main": "dist/index.js",
13
13
  "module": "dist/index.js",