@processmaker/screen-builder 2.83.2 → 2.83.4

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.
@@ -3,139 +3,165 @@
3
3
  <div :selector="config.customCssSelector">
4
4
  <div class="row">
5
5
  <template v-for="(item, index) in items">
6
- <draggable :class="classColumn(index)"
7
- class="column-draggable"
8
- v-model="items[index]"
9
- :value="items[index]"
10
- @input="updateContainerConfig($event, index)"
11
- group="controls"
12
- :key="index"
6
+ <draggable
7
+ :key="index"
8
+ v-model="items[index]"
9
+ :class="classColumn(index)"
10
+ class="column-draggable"
11
+ :value="items[index]"
12
+ group="controls"
13
+ @input="updateContainerConfig($event, index)"
13
14
  >
14
- <div class="control-item"
15
- :class="{selected: selected === element, hasError: hasError(element)}"
16
- v-for="(element,row) in item"
17
- :key="row"
18
- @click.stop="inspect(element)"
19
- >
20
- <div v-if="element.container" @click.stop="inspect(element)">
21
- <div
22
- class="m-2 card border-0"
23
- :class="{ 'ai-section-card': isAiSection(element) && selected === element}"
24
- >
25
15
  <div
26
- v-if="selected === element"
27
- class="card-header form-element-header d-flex align-items-center border rounded"
28
- :class="{ 'pulse': isAiSection(element) }"
16
+ v-for="(element, row) in item"
17
+ :key="row"
18
+ class="control-item"
19
+ :class="{
20
+ selected: selected === element,
21
+ hasError: hasError(element)
22
+ }"
23
+ @click.stop="inspect(element)"
29
24
  >
30
- <i class="fas fa-arrows-alt-v mr-1 text-muted"/>
31
- <i v-if="element.config.icon" :class="element.config.icon" class="mr-2 ml-1"/>
32
- {{ element.config.name || $t('Variable Name') }}
33
- <div class="ml-auto">
34
- <button
35
- v-if="isAiSection(element) && aiPreview(element)"
36
- class="btn btn-sm btn-primary mr-2"
37
- :title="$t('Apply Changes')"
38
- @click="applyAiChanges(element)"
39
- >
40
- {{ $t("Apply Changes") }}
41
- </button>
42
- <button
43
- v-if="!(isAiSection(element) && aiPreview(element))"
44
- class="btn btn-sm btn-secondary mr-2"
45
- @click="duplicateItem(index, row)"
46
- :aria-label="$t('Duplicate')"
25
+ <div v-if="element.container" @click.stop="inspect(element)">
26
+ <div
27
+ class="m-2 card border-0"
28
+ :class="{
29
+ 'ai-section-card':
30
+ isAiSection(element) && selected === element
31
+ }"
32
+ >
33
+ <div
34
+ v-if="selected === element"
35
+ class="card-header form-element-header d-flex align-items-center border rounded"
36
+ :class="{ pulse: isAiSection(element) }"
37
+ >
38
+ <i class="fas fa-arrows-alt-v mr-1 text-muted" />
39
+ <i
40
+ v-if="element.config.icon"
41
+ :class="element.config.icon"
42
+ class="mr-2 ml-1"
43
+ />
44
+ {{ element.config.name || $t("Variable Name") }}
45
+ <div class="ml-auto">
46
+ <button
47
+ v-if="isAiSection(element) && aiPreview(element)"
48
+ class="btn btn-sm btn-primary mr-2"
49
+ :title="$t('Apply Changes')"
50
+ @click="applyAiChanges(element)"
51
+ >
52
+ {{ $t("Apply Changes") }}
53
+ </button>
54
+ <button
55
+ v-if="!(isAiSection(element) && aiPreview(element))"
56
+ class="btn btn-sm btn-secondary mr-2"
57
+ :aria-label="$t('Duplicate')"
58
+ @click="duplicateItem(index, row)"
59
+ >
60
+ <i class="fas fa-copy text-light" />
61
+ </button>
62
+ <button
63
+ class="btn btn-sm btn-danger"
64
+ :aria-label="$t('Delete')"
65
+ @click="deleteItem(index, row)"
66
+ >
67
+ <i class="far fa-trash-alt text-light" />
68
+ </button>
69
+ </div>
70
+ </div>
71
+ <component
72
+ v-model="element.items"
73
+ :is="element['editor-component']"
74
+ :class="elementCssClass(element)"
75
+ :validation-errors="validationErrors"
76
+ class="mb-3 mr-3 ml-3"
77
+ :selected="selected"
78
+ :ai-element="element"
79
+ :config="element.config"
80
+ @inspect="inspect"
81
+ @update-state="$emit('update-state')"
82
+ />
83
+ </div>
84
+ </div>
85
+
86
+ <div
87
+ v-else
88
+ :id="element.config.name ? element.config.name : undefined"
47
89
  >
48
- <i class="fas fa-copy text-light"/>
49
- </button>
50
- <button
51
- class="btn btn-sm btn-danger"
52
- @click="deleteItem(index, row)"
53
- :aria-label="$t('Delete')"
54
- >
55
- <i class="far fa-trash-alt text-light"/>
56
- </button>
57
- </div>
90
+ <div class="m-2" :class="{ card: selected === element }">
91
+ <div
92
+ v-if="selected === element"
93
+ class="card-header form-element-header d-flex align-items-center"
94
+ >
95
+ <i class="fas fa-arrows-alt-v mr-1 text-muted" />
96
+ <i
97
+ v-if="element.config.icon"
98
+ :class="element.config.icon"
99
+ class="mr-2 ml-1"
100
+ />
101
+ {{ element.config.name || $t("Variable Name") }}
102
+ <div class="ml-auto">
103
+ <button
104
+ class="btn btn-sm btn-secondary mr-2"
105
+ :title="$t('Copy Control')"
106
+ @click="duplicateItem(index, row)"
107
+ >
108
+ <i class="fas fa-copy text-light" />
109
+ </button>
110
+ <button
111
+ class="btn btn-sm btn-danger"
112
+ :aria-label="$t('Delete')"
113
+ @click="deleteItem(index, row)"
114
+ >
115
+ <i class="far fa-trash-alt text-light" />
116
+ </button>
117
+ </div>
118
+ </div>
119
+
120
+ <component
121
+ v-bind="element.config"
122
+ :is="element['editor-component']"
123
+ class="p-3"
124
+ :class="[
125
+ elementCssClass(element),
126
+ { 'prevent-interaction': !element.config.interactive }
127
+ ]"
128
+ :tabindex="element.config.interactive ? 0 : -1"
129
+ :config="element.config"
130
+ @input="
131
+ element.config.interactive
132
+ ? (element.config.content = $event)
133
+ : null
134
+ "
135
+ />
136
+ </div>
137
+ </div>
138
+ </div>
139
+ </draggable>
140
+ </template>
58
141
  </div>
59
- <component :class="elementCssClass(element)"
60
- :validationErrors="validationErrors"
61
- class="mb-3 mr-3 ml-3"
62
- :selected="selected"
63
- :ai-element="element"
64
- @inspect="inspect"
65
- @update-state="$emit('update-state')"
66
- v-model="element.items"
67
- :config="element.config"
68
- :is="element['editor-component']"
69
- />
70
142
  </div>
71
143
  </div>
72
-
73
- <div v-else :id="element.config.name ? element.config.name : undefined">
74
- <div class="m-2" :class="{ 'card' : selected === element }">
75
- <div
76
- v-if="selected === element"
77
- class="card-header form-element-header d-flex align-items-center"
78
- >
79
- <i class="fas fa-arrows-alt-v mr-1 text-muted"/>
80
- <i v-if="element.config.icon" :class="element.config.icon" class="mr-2 ml-1"/>
81
- {{ element.config.name || $t('Variable Name') }}
82
- <div class="ml-auto">
83
- <button
84
- class="btn btn-sm btn-secondary mr-2"
85
- :title="$t('Copy Control')"
86
- @click="duplicateItem(index, row)"
87
- >
88
- <i class="fas fa-copy text-light"/>
89
- </button>
90
- <button
91
- class="btn btn-sm btn-danger"
92
- @click="deleteItem(index, row)"
93
- :aria-label="$t('Delete')"
94
- >
95
- <i class="far fa-trash-alt text-light"/>
96
- </button>
97
- </div>
98
- </div>
99
-
100
- <component
101
- class="p-3"
102
- :class="[elementCssClass(element), { 'prevent-interaction': !element.config.interactive }]"
103
- :tabindex="element.config.interactive ? 0 : -1"
104
- v-bind="element.config"
105
- :config="element.config"
106
- @input="element.config.interactive ? element.config.content = $event : null"
107
- :is="element['editor-component']"/>
108
- </div>
109
- </div>
110
- </div>
111
- </draggable>
112
- </template>
113
- </div>
114
- </div>
115
- </div>
116
144
  </template>
117
145
 
118
146
  <script>
119
- import draggable from 'vuedraggable';
120
- import { HasColorProperty } from '@/mixins';
121
- import * as renderer from '@/components/renderer';
122
- import _ from 'lodash';
123
-
147
+ import draggable from "vuedraggable";
148
+ import _ from "lodash";
124
149
  import {
125
- FormInput,
126
- FormSelectList,
127
- FormTextArea,
128
150
  FormCheckbox,
129
151
  FormDatePicker,
130
152
  FormHtmlEditor,
131
153
  FormHtmlViewer,
132
- } from '@processmaker/vue-form-elements';
154
+ FormInput,
155
+ FormSelectList,
156
+ FormTextArea
157
+ } from "@processmaker/vue-form-elements";
158
+ import { HasColorProperty } from "@/mixins";
159
+ import * as renderer from "@/components/renderer";
160
+
133
161
  const defaultColumnWidth = 1;
134
162
 
135
163
  export default {
136
- name: 'MultiColumn',
137
- mixins: [HasColorProperty],
138
- props: ['value', 'name', 'config', 'selected', 'validationErrors'],
164
+ name: "MultiColumn",
139
165
  components: {
140
166
  draggable,
141
167
  FormInput,
@@ -145,14 +171,37 @@ export default {
145
171
  FormDatePicker,
146
172
  FormHtmlEditor,
147
173
  FormHtmlViewer,
148
- ...renderer,
174
+ ...renderer
149
175
  },
176
+ mixins: [HasColorProperty],
177
+ props: ["value", "name", "config", "selected", "validationErrors"],
150
178
  data() {
151
179
  return {
152
180
  items: [],
153
181
  cancelledJobs: []
154
182
  };
155
183
  },
184
+ computed: {
185
+ classContainer() {
186
+ return this.items.length > 0 ? "form-group" : "column-draggable";
187
+ }
188
+ },
189
+ watch: {
190
+ value: {
191
+ handler() {
192
+ this.items = this.value;
193
+ },
194
+ immediate: true
195
+ },
196
+ items() {
197
+ this.$emit("input", this.items);
198
+ },
199
+ "config.options": function (options) {
200
+ this.items = options.map((option, index) => {
201
+ return this.items[index] ? this.items[index] : [];
202
+ });
203
+ }
204
+ },
156
205
  mounted() {
157
206
  if (
158
207
  !localStorage.getItem("cancelledJobs") ||
@@ -170,58 +219,35 @@ export default {
170
219
  this.updateProgress(progress, nonce);
171
220
  });
172
221
  },
173
- watch: {
174
- value: {
175
- handler() {
176
- this.items = this.value;
177
- },
178
- immediate: true,
179
- },
180
- items() {
181
- this.$emit('input', this.items);
182
- },
183
- 'config.options'(options) {
184
- this.items = options.map((option, index) => {
185
- return this.items[index]
186
- ? this.items[index]
187
- : [];
188
- });
189
- },
190
- },
191
- computed: {
192
- classContainer() {
193
- return this.items.length > 0 ? 'form-group' : 'column-draggable';
194
- },
195
- },
196
222
  methods: {
197
223
  hasError(element) {
198
224
  return this.validationErrors.some(({ item }) => item === element);
199
225
  },
200
226
  updateContainerConfig(config, index) {
201
227
  this.items[index] = config;
202
- this.$emit('update-state');
228
+ this.$emit("update-state");
203
229
  },
204
230
  classColumn(index) {
205
231
  let column = defaultColumnWidth;
206
-
232
+
207
233
  if (this.config.options[index] && this.config.options[index].content) {
208
234
  column = this.config.options[index].content;
209
235
  }
210
-
211
- return 'col-sm-' + column;
236
+
237
+ return `col-sm-${column}`;
212
238
  },
213
239
  inspect(element) {
214
- this.$emit('inspect', element);
240
+ this.$emit("inspect", element);
215
241
  },
216
242
  deleteItem(col, index) {
217
243
  // Remove the item from the array in currentPage
218
244
  this.items[col].splice(index, 1);
219
- this.$emit('update-state');
245
+ this.$emit("update-state");
220
246
  },
221
- duplicateItem(col,index) {
247
+ duplicateItem(col, index) {
222
248
  const duplicate = _.cloneDeep(this.items[col][index]);
223
249
  this.items[col].push(duplicate);
224
- this.$emit('update-state');
250
+ this.$emit("update-state");
225
251
  },
226
252
  isAiSection(element) {
227
253
  return element.component === "AiSection";
@@ -267,7 +293,7 @@ export default {
267
293
  .hasError {
268
294
  border: 1px solid red;
269
295
  border-radius: 0.25rem;
270
-
296
+
271
297
  .form-element-header {
272
298
  border-bottom: 1px solid red;
273
299
  color: red;
@@ -282,25 +308,25 @@ export default {
282
308
 
283
309
  .control-item {
284
310
  position: relative;
285
-
311
+
286
312
  .delete {
287
313
  position: absolute;
288
314
  top: 0px;
289
315
  right: 0px;
290
316
  display: none;
291
317
  }
292
-
318
+
293
319
  &.selected,
294
320
  &:hover {
295
321
  .mask {
296
322
  border: 1px solid red;
297
323
  }
298
-
324
+
299
325
  .delete {
300
326
  display: inline-block;
301
327
  }
302
328
  }
303
-
329
+
304
330
  .mask {
305
331
  position: absolute;
306
332
  top: 0px;
@@ -5,13 +5,13 @@
5
5
  <b-form-select
6
6
  id="collection"
7
7
  v-model="collectionId"
8
- @change="resetFields"
9
8
  :options="collections"
10
9
  data-cy="inspector-collection"
10
+ @change="resetFields"
11
11
  />
12
12
  </div>
13
13
 
14
- <div class="mt-3" v-if="fields.length > 1">
14
+ <div v-if="fields.length > 1" class="mt-3">
15
15
  <label for="label">{{ $t("Label") }}</label>
16
16
  <b-form-select
17
17
  id="label"
@@ -21,7 +21,7 @@
21
21
  />
22
22
  </div>
23
23
 
24
- <div class="mt-3" v-if="fields.length > 1">
24
+ <div v-if="fields.length > 1" class="mt-3">
25
25
  <label for="value">{{ $t("Value") }}</label>
26
26
  <b-form-select
27
27
  id="value"
@@ -31,52 +31,57 @@
31
31
  />
32
32
  </div>
33
33
 
34
- <div class="mt-3" v-if="fields.length > 1">
34
+ <div v-if="fields.length > 1" class="mt-3">
35
35
  <pmql-input
36
- :search-type="'collections_w_mustaches'"
37
- class="mb-1"
38
- data-cy="inspector-collection-pmql"
39
- :input-label="'PMQL'"
40
- v-model="pmql"
41
- :condensed="true"
42
- :ai-enabled="true"
43
- :placeholder="$t('PMQL')">
44
- </pmql-input>
45
- <small class="form-text text-muted">{{ $t('Advanced data search') }}</small>
36
+ v-model="pmql"
37
+ :search-type="'collections_w_mustaches'"
38
+ class="mb-1"
39
+ data-cy="inspector-collection-pmql"
40
+ :input-label="'PMQL'"
41
+ :condensed="true"
42
+ :ai-enabled="true"
43
+ :placeholder="$t('PMQL')"
44
+ >
45
+ </pmql-input>
46
+ <small class="form-text text-muted">{{
47
+ $t("Advanced data search")
48
+ }}</small>
46
49
  </div>
47
50
 
48
- <div class="mt-3" v-if="fields.length > 1">
51
+ <div v-if="fields.length > 1" class="mt-3">
49
52
  <form-checkbox
50
- :label="$t('Ignore duplicates in list')"
51
53
  v-model="unique"
52
- :helper="$t('Select to show only distinct list entries if labels are repeated. Only the first value will be used if duplicate labels have different values.')"
54
+ :label="$t('Ignore duplicates in list')"
55
+ :helper="
56
+ $t(
57
+ 'Select to show only distinct list entries if labels are repeated. Only the first value will be used if duplicate labels have different values.'
58
+ )
59
+ "
53
60
  data-cy="inspector-collection-isDependent"
54
61
  />
55
62
  </div>
56
-
57
63
  </div>
58
64
  </template>
59
65
 
60
66
  <script>
61
67
  import { debounce } from "lodash";
62
- import _ from "lodash";
63
- import MustacheHelper from "./mustache-helper";
64
- import ScreenVariableSelector from '../screen-variable-selector.vue';
68
+ import MustacheHelper from "./mustache-helper.vue";
69
+ import ScreenVariableSelector from "../screen-variable-selector.vue";
65
70
 
66
71
  const CONFIG_FIELDS = [
67
72
  "collectionId",
68
73
  "labelField",
69
74
  "valueField",
70
75
  "pmql",
71
- "unique",
76
+ "unique"
72
77
  ];
73
78
 
74
79
  export default {
75
- props: ["value"],
76
80
  components: {
77
81
  MustacheHelper,
78
- ScreenVariableSelector,
82
+ ScreenVariableSelector
79
83
  },
84
+ props: ["value"],
80
85
  data() {
81
86
  return {
82
87
  collections: [],
@@ -85,16 +90,23 @@ export default {
85
90
  labelField: null,
86
91
  valueField: null,
87
92
  pmql: "",
88
- unique: false,
93
+ unique: false
89
94
  };
90
95
  },
96
+ computed: {
97
+ options() {
98
+ return Object.fromEntries(
99
+ CONFIG_FIELDS.map((field) => [field, this[field]])
100
+ );
101
+ }
102
+ },
91
103
  watch: {
92
104
  value: {
93
105
  handler(value) {
94
106
  if (!value) {
95
107
  return;
96
108
  }
97
- CONFIG_FIELDS.forEach(field => this[field] = value[field]);
109
+ CONFIG_FIELDS.forEach((field) => (this[field] = value[field]));
98
110
  },
99
111
  immediate: true
100
112
  },
@@ -115,9 +127,10 @@ export default {
115
127
  this.onPmqlChange(pmql);
116
128
  }, 1000);
117
129
  },
118
- computed: {
119
- options() {
120
- return Object.fromEntries(CONFIG_FIELDS.map(field => [field, this[field]]));
130
+ mounted() {
131
+ this.getCollections();
132
+ if (this.collectionId) {
133
+ this.getFields();
121
134
  }
122
135
  },
123
136
  methods: {
@@ -164,12 +177,6 @@ export default {
164
177
  onPmqlChange(pmql) {
165
178
  this.pmql = pmql;
166
179
  }
167
- },
168
- mounted() {
169
- this.getCollections();
170
- if (this.collectionId) {
171
- this.getFields();
172
- }
173
180
  }
174
181
  };
175
- </script>
182
+ </script>
@@ -12,7 +12,12 @@
12
12
  </template>
13
13
 
14
14
  <script>
15
+ import { FormInput } from '@processmaker/vue-form-elements';
16
+
15
17
  export default {
18
+ components: {
19
+ FormInput
20
+ },
16
21
  props: ['value', 'selectedControl'],
17
22
  data() {
18
23
  return {
@@ -1,9 +1,9 @@
1
1
  <template>
2
- <div v-if="event === 'submit'" style="border-style: none !important;">
2
+ <div v-if="event === 'submit'" style="border-style: none !important">
3
3
  <div>
4
4
  <form-checkbox
5
- :label="$t('Loading Submit Button')"
6
5
  v-model="loading"
6
+ :label="$t('Loading Submit Button')"
7
7
  :toggle="false"
8
8
  :helper="$t('Loading Submit Button')"
9
9
  />
@@ -12,8 +12,11 @@
12
12
  </template>
13
13
 
14
14
  <script>
15
+ import { FormCheckbox } from "@processmaker/vue-form-elements";
16
+
15
17
  export default {
16
- props: ['value', 'selectedControl'],
18
+ components: { FormCheckbox },
19
+ props: ["value", "selectedControl"],
17
20
  data() {
18
21
  return {
19
22
  event: "",
@@ -23,11 +26,11 @@ export default {
23
26
  computed: {
24
27
  mode() {
25
28
  return this.$root.$children[0].mode;
26
- },
29
+ }
27
30
  },
28
31
  watch: {
29
32
  loading() {
30
- this.$emit('input', this.loading);
33
+ this.$emit("input", this.loading);
31
34
  },
32
35
  value() {
33
36
  this.loading = this.value;