@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.
@@ -9,21 +9,34 @@
9
9
  :watchers="null"
10
10
  :is-loop="true"
11
11
  :debug-context="'Loop #' + loopIndex"
12
- @submit="submit"
13
- @pageNavigate="$emit('pageNavigate', $event)"
14
- @update="setMatrixValue(loopIndex, $event)"
15
12
  :mode="mode"
16
13
  :loop-context="getLoopContext(loopIndex)"
17
14
  :form-config="formConfig"
15
+ @submit="submit"
16
+ @pageNavigate="$emit('pageNavigate', $event)"
17
+ @update="setMatrixValue(loopIndex, $event)"
18
18
  />
19
19
  </form>
20
- <b-row class="justify-content-md-center" v-if="config.settings.add">
20
+ <b-row v-if="config.settings.add" class="justify-content-md-center">
21
21
  <b-col md="auto">
22
- <b-button size="sm" variant="secondary" class="ml-1 mr-1" @click="add" :title="$t('Add Item')">
23
- <i class="fas fa-plus"/>
22
+ <b-button
23
+ size="sm"
24
+ variant="secondary"
25
+ class="ml-1 mr-1"
26
+ :title="$t('Add Item')"
27
+ @click="add"
28
+ >
29
+ <i class="fas fa-plus" />
24
30
  </b-button>
25
- <b-button v-if="times.length > 0" size="sm" variant="outline-danger" class="ml-1 mr-1" @click="removeConfirm" :title="$t('Delete Item')">
26
- <i class="fas fa-minus"/>
31
+ <b-button
32
+ v-if="times.length > 0"
33
+ size="sm"
34
+ variant="outline-danger"
35
+ class="ml-1 mr-1"
36
+ :title="$t('Delete Item')"
37
+ @click="removeConfirm"
38
+ >
39
+ <i class="fas fa-minus" />
27
40
  </b-button>
28
41
  </b-col>
29
42
  </b-row>
@@ -31,27 +44,31 @@
31
44
  </template>
32
45
 
33
46
  <script>
34
- import Mustache from 'mustache';
35
- import _ from 'lodash';
47
+ import Mustache from "mustache";
48
+ import _ from "lodash";
49
+ import VueFormRenderer from "../vue-form-renderer.vue";
36
50
 
37
51
  export default {
38
- name: 'FormLoop',
52
+ name: "FormLoop",
53
+ components: {
54
+ VueFormRenderer
55
+ },
39
56
  mixins: [],
40
- props: ['value', 'config', 'transientData', 'name', 'mode', 'formConfig'],
57
+ props: ["value", "config", "transientData", "name", "mode", "formConfig"],
41
58
  data() {
42
59
  return {
43
60
  matrix: [],
44
61
  items: [],
45
62
  additionalItems: 0,
46
63
  transientDataCopy: null,
47
- parentObjectChanges: [],
64
+ parentObjectChanges: []
48
65
  };
49
66
  },
50
67
  computed: {
51
68
  parentLoopContext() {
52
69
  let parent = this.$parent;
53
70
  let i = 0;
54
- let context = '';
71
+ let context = "";
55
72
  while (!parent.loopContext) {
56
73
  parent = parent.$parent;
57
74
 
@@ -59,9 +76,9 @@ export default {
59
76
  parent = null;
60
77
  break;
61
78
  }
62
-
79
+
63
80
  if (i > 100) {
64
- throw 'Loop Error';
81
+ throw new Error("Loop Error");
65
82
  }
66
83
 
67
84
  i++;
@@ -74,18 +91,20 @@ export default {
74
91
  return context;
75
92
  },
76
93
  rendererConfig() {
77
- let items = this.items;
78
- return [{
79
- name: 'LoopItem',
80
- items,
81
- }];
94
+ const { items } = this;
95
+ return [
96
+ {
97
+ name: "LoopItem",
98
+ items
99
+ }
100
+ ];
82
101
  },
83
102
  times() {
84
103
  if (!this.config || !this.config.settings) {
85
104
  return [];
86
105
  }
87
106
 
88
- if (this.config.settings.type === 'existing') {
107
+ if (this.config.settings.type === "existing") {
89
108
  const itemsFromData = _.get(this.transientData, this.name, null);
90
109
  if (!itemsFromData) {
91
110
  return [];
@@ -93,11 +112,13 @@ export default {
93
112
  return [...itemsFromData.keys()];
94
113
  }
95
114
 
96
- let times = this.config.settings.times;
115
+ let { times } = this.config.settings;
97
116
 
98
117
  try {
99
118
  times = Mustache.render(times, this.transientData);
100
- } catch (error) { error; }
119
+ } catch (error) {
120
+ throw new Error(error);
121
+ }
101
122
 
102
123
  times = parseInt(times);
103
124
 
@@ -112,7 +133,7 @@ export default {
112
133
  times += this.additionalItems;
113
134
 
114
135
  return [...Array(times).keys()];
115
- },
136
+ }
116
137
  },
117
138
  watch: {
118
139
  transientData: {
@@ -120,7 +141,7 @@ export default {
120
141
  this.transientDataCopy = _.cloneDeep(this.transientData);
121
142
  this.$delete(this.transientDataCopy, this.name);
122
143
 
123
- const data = _.get(this, 'transientData.' + this.name, null);
144
+ const data = _.get(this, `transientData.${this.name}`, null);
124
145
  if (data && Array.isArray(data)) {
125
146
  this.matrix = data;
126
147
  } else {
@@ -128,82 +149,92 @@ export default {
128
149
  }
129
150
  this.setupMatrix();
130
151
  },
131
- immediate: true,
152
+ immediate: true
132
153
  },
133
154
  value: {
134
155
  handler() {
135
156
  this.items = this.value;
136
157
  },
137
- immediate: true,
158
+ immediate: true
138
159
  },
139
160
  matrix: {
140
161
  handler() {
141
162
  if (_.isEqual(this.$parent.transientData[this.name], this.matrix)) {
142
163
  return;
143
164
  }
144
- this.$set(this.$parent.transientData, this.name, _.cloneDeep(this.matrix));
165
+ this.$set(
166
+ this.$parent.transientData,
167
+ this.name,
168
+ _.cloneDeep(this.matrix)
169
+ );
145
170
  },
146
- deep: true,
171
+ deep: true
147
172
  },
148
173
  times() {
149
174
  this.setupMatrix();
150
175
  },
151
- 'config.settings.times': {
176
+ "config.settings.times": {
152
177
  handler() {
153
178
  this.additionalItems = 0;
154
- },
155
- },
179
+ }
180
+ }
181
+ },
182
+ mounted() {
183
+ this.$set(this.$parent.transientData, this.name, _.cloneDeep(this.matrix));
156
184
  },
157
185
  methods: {
158
186
  getLoopContext(i) {
159
- let context = this.name + '.' + i.toString();
160
- if (this.parentLoopContext !== '') {
161
- context = this.parentLoopContext + '.' + context;
187
+ let context = `${this.name}.${i.toString()}`;
188
+ if (this.parentLoopContext !== "") {
189
+ context = `${this.parentLoopContext}.${context}`;
162
190
  }
163
191
  return context;
164
192
  },
165
193
  add() {
166
- if (this.config.settings.type === 'existing') {
194
+ if (this.config.settings.type === "existing") {
167
195
  this.setMatrixValue(this.matrix.length, {});
168
196
  } else {
169
197
  this.additionalItems++;
170
198
  }
171
199
  },
172
200
  remove() {
173
- if (this.config.settings.type === 'existing') {
201
+ if (this.config.settings.type === "existing") {
174
202
  this.$delete(this.matrix, this.matrix.length - 1);
175
203
  } else {
176
204
  this.additionalItems--;
177
205
  }
178
206
  },
179
207
  removeConfirm() {
180
- const message = this.$t('Are you sure you want to delete this?');
181
- window.ProcessMaker.confirmModal(
182
- this.$t('Caution!'),
183
- message,
184
- '',
185
- () => {
186
- this.remove();
187
- }
188
- );
208
+ const message = this.$t("Are you sure you want to delete this?");
209
+ window.ProcessMaker.confirmModal(this.$t("Caution!"), message, "", () => {
210
+ this.remove();
211
+ });
189
212
  },
190
213
  setMatrixValue(i, v) {
191
- let item = _.omit(v, '_parent');
214
+ const item = _.omit(v, "_parent");
192
215
  this.registerParentVariableChanges(v);
193
216
  this.$set(this.matrix, i, item);
194
217
  this.setChagnedParentVariables();
195
218
  },
196
219
  registerParentVariableChanges(obj) {
197
220
  if (obj._parent) {
198
- Object.keys(obj._parent).forEach(parentKey => {
199
- if (!_.isEqual(this.transientDataCopy[parentKey], obj._parent[parentKey])) {
200
- this.parentObjectChanges.push({key: parentKey, value: obj._parent[parentKey]});
221
+ Object.keys(obj._parent).forEach((parentKey) => {
222
+ if (
223
+ !_.isEqual(
224
+ this.transientDataCopy[parentKey],
225
+ obj._parent[parentKey]
226
+ )
227
+ ) {
228
+ this.parentObjectChanges.push({
229
+ key: parentKey,
230
+ value: obj._parent[parentKey]
231
+ });
201
232
  }
202
233
  });
203
234
  }
204
235
  },
205
236
  setChagnedParentVariables() {
206
- this.parentObjectChanges.forEach(change => {
237
+ this.parentObjectChanges.forEach((change) => {
207
238
  this.$set(this.$parent.transientData, change.key, change.value);
208
239
  });
209
240
  this.parentObjectChanges = [];
@@ -213,13 +244,13 @@ export default {
213
244
  if (!val) {
214
245
  val = {};
215
246
  }
216
-
247
+
217
248
  val._parent = _.cloneDeep(this.transientDataCopy);
218
249
  return val;
219
250
  },
220
251
  setupMatrix() {
221
252
  for (const i of this.times) {
222
- if (typeof this.matrix[i] === 'undefined') {
253
+ if (typeof this.matrix[i] === "undefined") {
223
254
  this.setMatrixValue(i, {});
224
255
  }
225
256
  }
@@ -230,11 +261,8 @@ export default {
230
261
  },
231
262
  submit() {
232
263
  // Just bubble up
233
- this.$emit('submit');
234
- },
235
- },
236
- mounted() {
237
- this.$set(this.$parent.transientData, this.name, _.cloneDeep(this.matrix));
238
- },
264
+ this.$emit("submit");
265
+ }
266
+ }
239
267
  };
240
268
  </script>
@@ -51,7 +51,7 @@ import {
51
51
  getUserDateTimeFormat,
52
52
  ValidationMixin
53
53
  } from "@processmaker/vue-form-elements";
54
- import Inputmasked from "./form-input-masked";
54
+ import Inputmasked from "./form-input-masked.vue";
55
55
 
56
56
  const uniqIdsMixin = createUniqIdsMixin();
57
57
  const componentTypes = {
@@ -18,6 +18,8 @@
18
18
  </template>
19
19
 
20
20
  <script>
21
+ import VueFormRenderer from '../vue-form-renderer.vue';
22
+
21
23
  const globalObject = typeof window === 'undefined'
22
24
  ? global
23
25
  : window;
@@ -30,6 +32,9 @@ const defaultConfig = [
30
32
  ];
31
33
 
32
34
  export default {
35
+ components:{
36
+ VueFormRenderer
37
+ },
33
38
  props: {
34
39
  name: String,
35
40
  screen: Number,
@@ -42,9 +42,13 @@
42
42
  <template v-else-if="isImage(field, item)">
43
43
  <img :src="mustache(field.key, item)" style="record-list-image" />
44
44
  </template>
45
+ <template v-else-if="isWebEntryFile(field, item)">
46
+ {{ formatIfWebEntryFile(field, item) }}
47
+ </template>
45
48
  <template v-else>
46
49
  {{ formatIfDate(mustache(field.key, item)) }}
47
50
  </template>
51
+
48
52
  </template>
49
53
  <template #cell(__actions)="{ index, item }">
50
54
  <div class="actions">
@@ -180,6 +184,7 @@
180
184
  <script>
181
185
  import _ from "lodash";
182
186
  import { dateUtils } from "@processmaker/vue-form-elements";
187
+ import VueFormRenderer from "@/components/vue-form-renderer.vue";
183
188
  import mustacheEvaluation from "../../mixins/mustacheEvaluation";
184
189
 
185
190
  const jsonOptionsActionsColumn = {
@@ -190,6 +195,9 @@ const jsonOptionsActionsColumn = {
190
195
  };
191
196
 
192
197
  export default {
198
+ components: {
199
+ VueFormRenderer
200
+ },
193
201
  mixins: [mustacheEvaluation],
194
202
  props: [
195
203
  "name",
@@ -341,6 +349,23 @@ export default {
341
349
  typeof content === "string" && content.substr(0, 11) === "data:image/"
342
350
  );
343
351
  },
352
+ isWebEntryFile(field, item) {
353
+ const content = _.get(item, field.key);
354
+ const regex = /^webentry_.*:*$/;
355
+ let checkWebEntryValue = content;
356
+
357
+ if (Array.isArray(content)) {
358
+ checkWebEntryValue = content[0].file;
359
+ }
360
+
361
+ return regex.test(checkWebEntryValue);
362
+ },
363
+ formatIfWebEntryFile(field, item) {
364
+ const requestFiles = _.get(window, "PM4ConfigOverrides.requestFiles", {});
365
+ const fileInfo = requestFiles[`${field.key}.${item.row_id}`];
366
+
367
+ return fileInfo.map((file) => file.file_name).join(", ");
368
+ },
344
369
  isFiledownload(field) {
345
370
  return field.key === "__filedownload";
346
371
  },
@@ -35,10 +35,11 @@ import { getItemsFromConfig } from "../itemProcessingUtils";
35
35
  import { ValidatorFactory } from "../factories/ValidatorFactory";
36
36
  import CurrentPageProperty from "../mixins/CurrentPageProperty";
37
37
  import DeviceDetector, { MAX_MOBILE_WIDTH } from "../mixins/DeviceDetector";
38
+ import ScreenRenderer from "@/components/screen-renderer.vue";
38
39
 
39
40
  export default {
40
41
  name: "VueFormRenderer",
41
- components: { CustomCssOutput },
42
+ components: { ScreenRenderer, CustomCssOutput },
42
43
  mixins: [CurrentPageProperty, DeviceDetector],
43
44
  model: {
44
45
  prop: "data",
package/src/main.js CHANGED
@@ -269,7 +269,7 @@ window.Echo = {
269
269
 
270
270
  window.axios = axios.create({
271
271
  baseURL: "/api/1.0/",
272
- adapter: cacheAdapterEnhancer(axios.defaults.adapter, {
272
+ adapter: cacheAdapterEnhancer(axios.getAdapter(axios.defaults.adapter), {
273
273
  enabledByDefault: window.ProcessMaker.screen.cacheEnabled,
274
274
  cacheFlag: "useCache",
275
275
  defaultCache: new LRUCache({
@@ -279,7 +279,9 @@ window.axios = axios.create({
279
279
  })
280
280
  });
281
281
 
282
- const scenario = (window.location.search.substr(1).match(/\w+=(\w+)/) || [])[1];
282
+ const searchParams = new URLSearchParams(window.location.search);
283
+
284
+ const scenario = searchParams?.get("scenario");
283
285
  if (scenario) {
284
286
  if (!TestComponents[scenario]) {
285
287
  // eslint-disable-next-line no-console