@processmaker/screen-builder 2.26.0 → 2.27.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-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/screen-builder",
3
- "version": "2.26.0",
3
+ "version": "2.27.0",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/screen-builder",
3
- "version": "2.26.0",
3
+ "version": "2.27.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
package/src/.DS_Store CHANGED
Binary file
@@ -102,6 +102,12 @@ export default {
102
102
  },
103
103
  },
104
104
  mounted() {
105
+ this.$root.$on('remove-nested', (nestedScreenId) => {
106
+ if (this.value === nestedScreenId) {
107
+ this.$emit('input', null);
108
+ }
109
+ });
110
+
105
111
  let pmql = '(type = "FORM" or type = "DISPLAY")';
106
112
  if (this.screenType === formTypes.display) {
107
113
  pmql = '(type = "DISPLAY")';
@@ -116,6 +116,7 @@ export default {
116
116
  globalObject['nestedScreens'] = {};
117
117
  }
118
118
  globalObject.nestedScreens['id_' + id] = this.config;
119
+ this.$root.$emit('nested-screen-updated');
119
120
  }
120
121
  });
121
122
  }
@@ -474,6 +474,7 @@ export default {
474
474
  watch: {
475
475
  config: {
476
476
  handler() {
477
+ this.checkForCaptchaInLoops();
477
478
  this.$emit('change', this.config);
478
479
  this.loadVariablesTree();
479
480
  },
@@ -517,6 +518,36 @@ export default {
517
518
  refreshContent() {
518
519
  this.editorContentKey++;
519
520
  },
521
+ checkForCaptchaInLoops() {
522
+ this.config.forEach(page => {
523
+ this.checkForCaptcha(page.items);
524
+ });
525
+ },
526
+ checkForCaptcha(items, insideLoop = false, nestedScreen = null) {
527
+ items.forEach(item => {
528
+ if (!item.items && item.component == 'Captcha' && insideLoop) {
529
+ if (nestedScreen && nestedScreen.config.screen) {
530
+ this.$root.$emit('remove-nested', nestedScreen.config.screen);
531
+ nestedScreen.config.screen = null;
532
+ globalObject.ProcessMaker.alert(this.$t('You are trying to place a nested screen within CAPTCHA elements inside a loop. CAPTCHA controls cannot be placed within a Loop control.'), 'danger');
533
+ } else {
534
+ items.splice(items.indexOf(item), 1);
535
+ globalObject.ProcessMaker.alert(this.$t('CAPTCHA controls cannot be placed within a Loop control.'), 'danger');
536
+ }
537
+ }
538
+ if (item.items) {
539
+ this.checkForCaptcha(item.items, true);
540
+ }
541
+ if (item.component == 'FormNestedScreen' && insideLoop && item.config.screen && window.nestedScreens) {
542
+ let nestedScreenItems = window.nestedScreens['id_' + item.config.screen];
543
+ if (nestedScreenItems) {
544
+ nestedScreenItems.forEach(nestedScreenPage => {
545
+ this.checkForCaptcha(nestedScreenPage.items, true, item);
546
+ });
547
+ }
548
+ }
549
+ });
550
+ },
520
551
  loadVariablesTree() {
521
552
  const definition = {
522
553
  config : this.$parent.config,
@@ -843,6 +874,9 @@ export default {
843
874
  },
844
875
  mounted() {
845
876
  this.loadVariablesTree();
877
+ this.$root.$on('nested-screen-updated', () => {
878
+ this.checkForCaptchaInLoops();
879
+ });
846
880
  },
847
881
  };
848
882
  </script>
package/dist/demo.html DELETED
@@ -1,10 +0,0 @@
1
- <meta charset="utf-8">
2
- <title>vue-form-builder demo</title>
3
- <script src="./vue-form-builder.umd.js"></script>
4
-
5
- <link rel="stylesheet" href="./vue-form-builder.css">
6
-
7
-
8
- <script>
9
- console.log(vue-form-builder)
10
- </script>