@processmaker/screen-builder 3.5.7 → 3.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/screen-builder",
3
- "version": "3.5.7",
3
+ "version": "3.7.0",
4
4
  "scripts": {
5
5
  "dev": "VITE_COVERAGE=true vite",
6
6
  "build": "vite build",
@@ -617,13 +617,16 @@ export default {
617
617
  return;
618
618
  }
619
619
  const newOption = {
620
- [this.valueField]: this.optionContent,
621
- [this.keyField]: this.optionValue,
622
- };
620
+ [this.valueField]: this.optionContent,
621
+ [this.keyField]: this.optionValue
622
+ };
623
623
  if (this.renderAs === "checkbox") {
624
+ const index = this.optionsList.length;
624
625
  this.optionsList.push(newOption);
625
- this.optionsListExtra.push({...newOption, [this.ariaLabelField]: this.optionAriaLabel});
626
-
626
+ this.optionsListExtra[index] = {
627
+ ...newOption,
628
+ [this.ariaLabelField]: this.optionAriaLabel
629
+ };
627
630
  } else {
628
631
  this.optionsList.push(newOption);
629
632
  }
@@ -635,7 +638,10 @@ export default {
635
638
  this.optionsList[this.editIndex][this.keyField] = this.optionValue;
636
639
  this.optionsList[this.editIndex][this.valueField] = this.optionContent;
637
640
  if (this.renderAs === "checkbox") {
638
- this.optionsListExtra[this.editIndex] = {...this.optionsList[this.editIndex], [this.ariaLabelField]: this.optionAriaLabel};
641
+ this.optionsListExtra[this.editIndex] = {
642
+ ...this.optionsList[this.editIndex],
643
+ [this.ariaLabelField]: this.optionAriaLabel
644
+ };
639
645
  }
640
646
  }
641
647
 
@@ -247,7 +247,11 @@ export default {
247
247
  return json;
248
248
  },
249
249
  showSimpleErrorMessage() {
250
- this.renderComponent = 'simpleErrorMessage';
250
+ // This triggers a re-render if it has already been displayed.
251
+ this.renderComponent = null;
252
+ setTimeout(() => {
253
+ this.renderComponent = 'simpleErrorMessage';
254
+ }, 0);
251
255
  },
252
256
  loadScreen(id) {
253
257
  this.disabled = true;
@@ -978,6 +982,9 @@ export default {
978
982
  if (
979
983
  ['ACTIVITY_ACTIVATED'].includes(data.event)
980
984
  ) {
985
+ if (data.activeTokens?.includes(this.taskId)) {
986
+ return;
987
+ }
981
988
  this.closeTask(this.parentRequest);
982
989
  }
983
990
  if (
@@ -1381,15 +1381,27 @@ export default {
1381
1381
  }
1382
1382
  return index > this.pageDelete ? index - 1 : index;
1383
1383
  },
1384
+ // This function is used to calculate the new index of the references FormRecordList
1385
+ calcNewIndexForFormRecordList(index, referencedBy, config) {
1386
+ if (config[this.pageDelete].items.length > 0) {
1387
+ throw new Error(
1388
+ `${this.$t(
1389
+ "Can not delete this page, it is referenced by"
1390
+ )}: ${referencedBy}`
1391
+ );
1392
+ }
1393
+ return index > this.pageDelete ? index - 1 : index;
1394
+ },
1384
1395
  // Update Record list references
1385
1396
  updateRecordListReferences() {
1386
1397
  this.config.forEach((page) => {
1387
1398
  page.items.forEach((item) => {
1388
1399
  if (item.component === "FormRecordList") {
1389
1400
  // eslint-disable-next-line no-param-reassign
1390
- item.config.form = this.calcNewIndexFor(
1401
+ item.config.form = this.calcNewIndexForFormRecordList(
1391
1402
  item.config.form * 1,
1392
- item.config.label
1403
+ item.config.label,
1404
+ this.config,
1393
1405
  );
1394
1406
  }
1395
1407
  });
@@ -222,6 +222,7 @@ export default [
222
222
  allowMultiSelect: false,
223
223
  selectedOptions: [],
224
224
  optionsList: [],
225
+ optionsListExtra: [],
225
226
  key:'value',
226
227
  value:'content',
227
228
  ariaLabel: 'ariaLabel',