@processmaker/screen-builder 2.83.1 → 2.83.3

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.
@@ -1,18 +1,36 @@
1
1
  <template>
2
2
  <div>
3
- <b-row class="justify-content-start" v-if="error">
3
+ <b-row v-if="error" class="justify-content-start">
4
4
  <b-col md="auto">
5
5
  <div class="invalid-feedback d-block">{{ error }}</div>
6
6
  </b-col>
7
7
  </b-row>
8
8
 
9
- <b-row class="justify-content-md-center" v-if="value && config.settings.add">
9
+ <b-row
10
+ v-if="value && config.settings.add"
11
+ class="justify-content-md-center"
12
+ >
10
13
  <b-col md="auto">
11
- <b-button size="sm" variant="secondary" class="ml-1 mr-1" @click="add" :title="$t('Add Item')" :data-cy="`loop-${config.name}-add`">
12
- <i class="fas fa-plus"/>
14
+ <b-button
15
+ size="sm"
16
+ variant="secondary"
17
+ class="ml-1 mr-1"
18
+ :title="$t('Add Item')"
19
+ :data-cy="`loop-${config.name}-add`"
20
+ @click="add"
21
+ >
22
+ <i class="fas fa-plus" />
13
23
  </b-button>
14
- <b-button v-if="value.length > 0" size="sm" variant="outline-danger" class="ml-1 mr-1" @click="removeConfirm" :title="$t('Delete Item')" :data-cy="`loop-${config.name}-remove`">
15
- <i class="fas fa-minus"/>
24
+ <b-button
25
+ v-if="value.length > 0"
26
+ size="sm"
27
+ variant="outline-danger"
28
+ class="ml-1 mr-1"
29
+ :title="$t('Delete Item')"
30
+ :data-cy="`loop-${config.name}-remove`"
31
+ @click="removeConfirm"
32
+ >
33
+ <i class="fas fa-minus" />
16
34
  </b-button>
17
35
  </b-col>
18
36
  </b-row>
@@ -20,13 +38,11 @@
20
38
  </template>
21
39
 
22
40
  <script>
23
- import { mapActions } from "vuex";
24
-
25
41
  export default {
26
42
  props: {
27
43
  value: Array,
28
44
  config: Object,
29
- error: String,
45
+ error: String
30
46
  },
31
47
  methods: {
32
48
  async add() {
@@ -34,19 +50,14 @@ export default {
34
50
  },
35
51
  remove() {
36
52
  const removed = this.value.pop();
37
- this.$root.$emit('removed-loop', this, removed);
53
+ this.$root.$emit("removed-loop", this, removed);
38
54
  },
39
55
  removeConfirm() {
40
- const message = this.$t('Are you sure you want to delete this?');
41
- window.ProcessMaker.confirmModal(
42
- this.$t('Caution!'),
43
- message,
44
- '',
45
- () => {
46
- this.remove();
47
- }
48
- );
49
- },
50
- },
56
+ const message = this.$t("Are you sure you want to delete this?");
57
+ window.ProcessMaker.confirmModal(this.$t("Caution!"), message, "", () => {
58
+ this.remove();
59
+ });
60
+ }
61
+ }
51
62
  };
52
63
  </script>
@@ -1,24 +1,18 @@
1
1
  <template>
2
- <div class="container mt-4">
3
- <div class="card">
4
- <div
5
- class="card-header d-flex justify-content-between align-items-center"
6
- >
7
- <span class="control-text">{{ title }}</span>
8
- <b-link @click="openExternalLink">
9
- <i class="fas fa-external-link-alt custom-icon" />
10
- </b-link>
11
- </div>
12
- <div>
13
- <div class="d-flex flex-wrap p-2">
14
- <template>
15
- <b-col cols="12">
16
- <b-card-text>
17
- <b-embed type="iframe" :src="graphic.link"></b-embed>
18
- </b-card-text>
19
- </b-col>
20
- </template>
21
- </div>
2
+ <div class="card" :style="customStyle">
3
+ <div class="card-header d-flex justify-content-between align-items-center">
4
+ <span class="mb-2 mt-2 control-text">{{ title }}</span>
5
+ <b-link @click="openExternalLink">
6
+ <i class="fas fa-external-link-alt custom-icon" />
7
+ </b-link>
8
+ </div>
9
+ <div>
10
+ <div class="d-flex flex-wrap p-2">
11
+ <b-col cols="12">
12
+ <b-card-text>
13
+ <b-embed type="iframe" :src="graphic.link"></b-embed>
14
+ </b-card-text>
15
+ </b-col>
22
16
  </div>
23
17
  </div>
24
18
  </div>
@@ -30,14 +24,12 @@ export default {
30
24
  data() {
31
25
  return {
32
26
  title: this.$t("Analytics Chart"),
33
- graphic: []
27
+ graphic: [],
28
+ customStyle: {
29
+ "border-radius": "8px"
30
+ }
34
31
  };
35
32
  },
36
- methods: {
37
- openExternalLink() {
38
- window.open("/package-analytics-reporting", "_blank");
39
- }
40
- },
41
33
  watch: {
42
34
  listChartOption() {
43
35
  if (this.listChartOption && this.listChartOption.name) {
@@ -49,6 +41,11 @@ export default {
49
41
  if (this.listChartOption && this.listChartOption.name) {
50
42
  this.graphic = this.listChartOption;
51
43
  }
44
+ },
45
+ methods: {
46
+ openExternalLink() {
47
+ window.open("/package-analytics-reporting", "_blank");
48
+ }
52
49
  }
53
50
  };
54
51
  </script>
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <div class="card mt-4 mb-4">
2
+ <div class="card" :style="customStyle">
3
3
  <div class="card-header d-flex justify-content-between align-items-center">
4
4
  <template v-if="dataControl.showControl">
5
- <div class="mb-2">
5
+ <div class="mb-1 mt-1">
6
6
  <b-avatar
7
7
  v-if="dataControl.showAvatar"
8
8
  size="2em"
@@ -10,11 +10,11 @@
10
10
  :text="dataControl.count"
11
11
  class="avatar-text"
12
12
  ></b-avatar>
13
- <p class="control-text" :style="dataControl.colorText">
13
+ <p class="control-text mb-0" :style="dataControl.colorText">
14
14
  {{ title }}
15
15
  </p>
16
16
  <template v-if="dataControl.dropdownShow === 'requests'">
17
- <b-dropdown variant="custom" no-caret>
17
+ <b-dropdown variant="outline-secondary" no-caret>
18
18
  <template #button-content>
19
19
  <i class="fas fa-caret-down" />
20
20
  </template>
@@ -38,9 +38,16 @@
38
38
  <div class="ml-auto d-flex align-items-center">
39
39
  <template v-if="dataControl.dropdownShow === 'requests'">
40
40
  <div class="mr-4">
41
- <b-dropdown variant="secondary" size="sm">
41
+ <b-dropdown variant="outline-secondary" size="sm">
42
42
  <template #button-content>
43
- <span>{{ $t(titleDropdown) }}</span>
43
+ <span>
44
+ <b-icon
45
+ v-if="showBadge"
46
+ icon="circle-fill"
47
+ :variant="badgeVariant"
48
+ />
49
+ {{ $t(titleDropdown) }}
50
+ </span>
44
51
  </template>
45
52
  <b-dropdown-item
46
53
  variant="success"
@@ -61,37 +68,38 @@
61
68
  <b-dropdown-item
62
69
  @click="handleDropdownSelection('requests_dropdown', 'all')"
63
70
  >
64
- {{ $t(titleDropdown) }}
71
+ {{ $t("View All") }}
65
72
  </b-dropdown-item>
66
73
  </b-dropdown>
67
74
  </div>
68
75
  </template>
69
76
  <template v-if="dataControl.dropdownShow === 'tasks'">
70
77
  <div class="mr-4">
71
- <b-dropdown variant="secondary" size="sm">
78
+ <b-dropdown variant="outline-secondary" size="sm">
72
79
  <template #button-content>
73
- <span>{{ $t(titleDropdown) }}</span>
80
+ <span>
81
+ <b-icon
82
+ v-if="showBadge"
83
+ icon="circle-fill"
84
+ :variant="badgeVariant"
85
+ />
86
+ {{ $t(titleDropdown) }}
87
+ </span>
74
88
  </template>
75
89
  <b-dropdown-item
90
+ variant="warning"
76
91
  @click="handleDropdownSelection('tasks', 'In Progress')"
77
92
  >
78
- <AvatarDropdown
79
- :variant="'warning'"
80
- :text="countInProgress"
81
- :label="'In Progress'"
82
- ></AvatarDropdown>
93
+ <i class="fas fa-circle mr-2" />{{ $t("In Progress") }}
83
94
  </b-dropdown-item>
84
95
  <b-dropdown-item
96
+ variant="danger"
85
97
  @click="handleDropdownSelection('tasks', 'Overdue')"
86
98
  >
87
- <AvatarDropdown
88
- :variant="'danger'"
89
- :text="countOverdue"
90
- :label="'Overdue'"
91
- ></AvatarDropdown>
99
+ <i class="fas fa-circle mr-2" />{{ $t("Overdue") }}
92
100
  </b-dropdown-item>
93
101
  <b-dropdown-item @click="handleDropdownSelection('tasks', 'all')">
94
- {{ $t(titleDropdown) }}
102
+ {{ $t("View All") }}
95
103
  </b-dropdown-item>
96
104
  </b-dropdown>
97
105
  </div>
@@ -99,7 +107,7 @@
99
107
  <div>
100
108
  <div class="d-flex justify-content-end">
101
109
  <button
102
- class="btn btn-outline-primary border-0 mr-1"
110
+ class="btn btn-outline-secondary border-0 mr-1"
103
111
  @click="toggleInput(dataControl.dropdownShow)"
104
112
  >
105
113
  <i class="fas fa-search" />
@@ -146,10 +154,9 @@
146
154
  import FormTasks from "./form-tasks.vue";
147
155
  import FormRequests from "./form-requests.vue";
148
156
  import FormNewRequest from "./form-new-request.vue";
149
- import AvatarDropdown from "./avatar-dropdown.vue";
150
157
 
151
158
  export default {
152
- components: { FormTasks, FormRequests, FormNewRequest, AvatarDropdown },
159
+ components: { FormTasks, FormRequests, FormNewRequest },
153
160
  mixins: [],
154
161
  props: ["listOption"],
155
162
  data() {
@@ -157,13 +164,18 @@ export default {
157
164
  optionRequest: "by_me",
158
165
  dropdownRequest: "In Progress",
159
166
  titleDropdown: "View All",
160
- countInProgress: "0",
161
- countOverdue: "0",
167
+ viewAll: "View All",
162
168
  title: this.$t("List Table"),
163
169
  dataControl: {},
164
170
  searchCriteria: "",
165
171
  showInput: false,
166
- pmql: ""
172
+ pmql: "",
173
+ badgeVariant: "",
174
+ typeSelected: "",
175
+ showBadge: false,
176
+ customStyle: {
177
+ "border-radius": "8px"
178
+ }
167
179
  };
168
180
  },
169
181
  watch: {
@@ -178,16 +190,18 @@ export default {
178
190
  methods: {
179
191
  getData(data) {
180
192
  this.dataControl = data.dataControls;
181
- this.countOverdue = data.tasksDropdown[0];
182
- this.countInProgress = data.tasksDropdown[1];
183
193
  },
184
194
  openExternalLink() {
185
195
  window.open(this.dataControl.url, "_blank");
186
196
  },
187
197
  handleDropdownSelection(listType, valueSelected) {
188
198
  const combinedFilter = [];
199
+ this.typeSelected = listType;
189
200
  if (listType === "tasks") {
190
201
  this.$root.$emit("dropdownSelectionTask", valueSelected);
202
+ this.titleDropdown =
203
+ valueSelected === "all" ? this.viewAll : valueSelected;
204
+ this.colorBadge();
191
205
  } else {
192
206
  if (listType === "requests_filter") {
193
207
  this.optionRequest = valueSelected;
@@ -199,6 +213,9 @@ export default {
199
213
  }
200
214
  }
201
215
  if (listType === "requests_dropdown") {
216
+ this.titleDropdown =
217
+ valueSelected === "all" ? this.viewAll : valueSelected;
218
+ this.colorBadge();
202
219
  this.dropdownRequest = valueSelected;
203
220
  }
204
221
  combinedFilter.push(this.optionRequest);
@@ -233,6 +250,36 @@ export default {
233
250
  clearSearch(listType) {
234
251
  this.searchCriteria = "";
235
252
  this.toggleInput(listType);
253
+ },
254
+ /**
255
+ * Set the badge's color of the filter selected
256
+ */
257
+ colorBadge() {
258
+ if (this.titleDropdown === "In Progress") {
259
+ if (this.typeSelected === "tasks") {
260
+ this.badgeVariant = "warning";
261
+ }
262
+ if (this.typeSelected === "requests_dropdown") {
263
+ this.badgeVariant = "success";
264
+ }
265
+ this.showBadge = true;
266
+ }
267
+ if (this.titleDropdown === "Overdue") {
268
+ this.badgeVariant = "danger";
269
+ this.showBadge = true;
270
+ }
271
+ if (this.titleDropdown === "Overdue") {
272
+ this.badgeVariant = "danger";
273
+ this.showBadge = true;
274
+ }
275
+ if (this.titleDropdown === "Completed") {
276
+ this.badgeVariant = "primary";
277
+ this.showBadge = true;
278
+ }
279
+ if (this.titleDropdown === "View All" || this.titleDropdown === "all") {
280
+ this.badgeVariant = "";
281
+ this.showBadge = false;
282
+ }
236
283
  }
237
284
  }
238
285
  };
@@ -276,7 +323,7 @@ export default {
276
323
  overflow: auto;
277
324
  }
278
325
 
279
- .btn-custom {
280
- background-color: #f7f7f7;
326
+ .btn-outline-secondary {
327
+ border: none;
281
328
  }
282
329
  </style>
@@ -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 = {