@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.
@@ -1,25 +1,29 @@
1
1
  <template>
2
2
  <div>
3
3
  <div class="d-flex mb-1">
4
- <label class="flex-grow-1 m-0">{{ $t('Outbound Configuration') }}</label>
4
+ <label class="flex-grow-1 m-0">{{ $t("Outbound Configuration") }}</label>
5
5
  <button
6
6
  type="button"
7
7
  class="btn-special-assignment-action btn btn-secondary btn-sm px-2"
8
8
  @click="addMapping"
9
- >+ {{ $t('Property') }}
9
+ >
10
+ + {{ $t("Property") }}
10
11
  </button>
11
12
  </div>
12
13
  <table class="table table-striped table-sm border mb-1">
13
14
  <thead>
14
15
  <tr>
15
- <th scope="col">{{ $t('Type') }}</th>
16
- <th scope="col">{{ $t('Key') }}</th>
17
- <th scope="col"><div class="float-left">{{ $t('Value') }}</div> <mustache-helper class="float-left ml-2"/> </th>
16
+ <th scope="col">{{ $t("Type") }}</th>
17
+ <th scope="col">{{ $t("Key") }}</th>
18
+ <th scope="col">
19
+ <div class="float-left">{{ $t("Value") }}</div>
20
+ <mustache-helper class="float-left ml-2" />
21
+ </th>
18
22
  <th scope="col">&nbsp;</th>
19
23
  </tr>
20
24
  </thead>
21
25
  <tbody>
22
- <tr v-for="(row,i) in outboundConfig" :key="i">
26
+ <tr v-for="(row, i) in outboundConfig" :key="i">
23
27
  <td class="p-1">
24
28
  <multiselect
25
29
  v-model="row.type"
@@ -44,10 +48,10 @@
44
48
  @open="loadOptions(i)"
45
49
  >
46
50
  <template slot="noResult">
47
- <slot name="noResult">{{ $t('Not found') }}</slot>
51
+ <slot name="noResult">{{ $t("Not found") }}</slot>
48
52
  </template>
49
53
  <template slot="noOptions">
50
- <slot name="noOptions">{{ $t('Not available') }}</slot>
54
+ <slot name="noOptions">{{ $t("Not available") }}</slot>
51
55
  </template>
52
56
  </multiselect>
53
57
  </td>
@@ -58,10 +62,14 @@
58
62
  :placeholder="$t('New Value')"
59
63
  type="text"
60
64
  class="form-control"
61
- >
65
+ />
62
66
  </td>
63
67
  <td class="align-middle text-right p-1">
64
- <a href="javascript:void(0)" class="btn btn-sm btn-danger" @click="removeRowIndex(i)">
68
+ <a
69
+ class="btn btn-sm btn-danger"
70
+ href="javascript:void(0)"
71
+ @click="removeRowIndex(i)"
72
+ >
65
73
  <i class="fa fa-trash-alt" />
66
74
  </a>
67
75
  </td>
@@ -69,32 +77,61 @@
69
77
  </tbody>
70
78
  </table>
71
79
  <small class="form-text text-muted mb-3">
72
- {{ $t('Properties to map from a request variable to a Data Connector property') }}
73
- <br>
74
- {{ $t('The value can be a string or a mustache expression.') }} {{ $t('For example') }} <span v-pre> {{ var1 }} </span> {{ $t('will use the value stored in variable var1') }}
80
+ {{
81
+ $t(
82
+ "Properties to map from a request variable to a Data Connector property"
83
+ )
84
+ }}
85
+ <br />
86
+ {{ $t("The value can be a string or a mustache expression.") }}
87
+ {{ $t("For example") }} <span v-pre> {{ var1 }} </span>
88
+ {{ $t("will use the value stored in variable var1") }}
75
89
  </small>
76
90
  </div>
77
91
  </template>
78
92
 
79
-
80
93
  <script>
94
+ import { findIndex, get, isNil } from "lodash";
95
+ import MustacheHelper from "./mustache-helper.vue";
81
96
 
82
- import MustacheHelper from './mustache-helper';
83
97
  export default {
84
- components: { MustacheHelper },
98
+ components: {
99
+ MustacheHelper
100
+ },
85
101
  mixins: [],
86
102
  props: {
87
- value: String,
103
+ value: String
88
104
  },
89
105
  data() {
90
106
  return {
91
- field: '',
107
+ field: "",
92
108
  outboundConfig: [],
93
- types: ['PARAM', 'HEADER', 'BODY'],
109
+ types: ["PARAM", "HEADER", "BODY"],
94
110
  apiProperties: [],
95
- type: null,
111
+ type: null
96
112
  };
97
113
  },
114
+ watch: {
115
+ outboundConfig: {
116
+ deep: true,
117
+ immediate: true,
118
+ handler(outboundConfig) {
119
+ this.setConfig("outboundConfig", outboundConfig);
120
+ }
121
+ },
122
+ value: {
123
+ immediate: true,
124
+ handler() {
125
+ const { outboundConfig } = this.getConfig();
126
+ if (outboundConfig) {
127
+ this.outboundConfig.splice(0);
128
+ outboundConfig.forEach((element) => {
129
+ this.outboundConfig.push(element);
130
+ });
131
+ }
132
+ }
133
+ }
134
+ },
98
135
  methods: {
99
136
  getConfig() {
100
137
  try {
@@ -107,111 +144,94 @@ export default {
107
144
  const config = this.getConfig();
108
145
  if (JSON.stringify(config[name]) !== JSON.stringify(value)) {
109
146
  config[name] = value;
110
- this.$emit('input', JSON.stringify(config));
147
+ this.$emit("input", JSON.stringify(config));
111
148
  }
112
149
  },
113
150
  removeRowIndex(index) {
114
151
  this.outboundConfig.splice(index, 1);
115
152
  },
116
153
  addMapping() {
117
- this.outboundConfig.push({type: 'PARAM', key: '', value: ''});
154
+ this.outboundConfig.push({ type: "PARAM", key: "", value: "" });
118
155
  },
119
156
 
120
157
  loadOptions(index) {
121
158
  const config = this.getConfig();
122
159
  this.apiProperties = [];
123
- if (window._.isNil(config.dataSource) || window._.isNil(config.endpoint)) {
160
+ if (isNil(config.dataSource) || isNil(config.endpoint)) {
124
161
  return;
125
162
  }
126
163
 
127
164
  // Strip GET, POST, etc from endpoint name
128
- let endpoint = config.endpoint;
129
- const parts = config.endpoint.split(':');
165
+ let { endpoint } = config;
166
+ const parts = config.endpoint.split(":");
130
167
  if (parts.length > 1) {
131
168
  parts.shift();
132
- endpoint = parts.join('').trim();
169
+ endpoint = parts.join("").trim();
133
170
  }
134
171
 
135
-
136
- window.ProcessMaker.apiClient.get(`/data_sources/${config.dataSource}`)
137
- .then(response => {
172
+ window.ProcessMaker.apiClient
173
+ .get(`/data_sources/${config.dataSource}`)
174
+ .then((response) => {
138
175
  const rowType = this.outboundConfig[index].type;
139
- let endpointData = window._.get(response, `data.endpoints.${endpoint}`, null);
176
+ const endpointData = get(
177
+ response,
178
+ `data.endpoints.${endpoint}`,
179
+ null
180
+ );
140
181
  if (endpointData === null) {
141
182
  return;
142
183
  }
143
184
 
144
185
  this.apiProperties = [];
145
186
 
146
- if (rowType === 'HEADER') {
147
- let headerProps = window._.get(endpointData, 'headers', []);
187
+ if (rowType === "HEADER") {
188
+ const headerProps = get(endpointData, "headers", []);
148
189
 
149
190
  this.apiProperties = headerProps.reduce((acc, header) => {
150
- if (window._.findIndex(this.apiProperties, {'key': header.key}) < 0) {
191
+ if (findIndex(this.apiProperties, { key: header.key }) < 0) {
151
192
  acc.push(header.key);
152
193
  }
153
194
  return acc;
154
- },
155
- []);
195
+ }, []);
156
196
  }
157
197
 
158
- if (rowType === 'PARAM') {
159
- let paramProps = window._.get(endpointData, 'params', []);
198
+ if (rowType === "PARAM") {
199
+ const paramProps = get(endpointData, "params", []);
160
200
  this.apiProperties = paramProps.reduce((acc, param) => {
161
- if (window._.findIndex(this.apiProperties, {'key': param.key}) < 0) {
201
+ if (findIndex(this.apiProperties, { key: param.key }) < 0) {
162
202
  acc.push(param.key);
163
203
  }
164
204
  return acc;
165
- },
166
- []);
205
+ }, []);
167
206
 
168
- //add url parameters:
169
- const matchedParams = (endpointData.url || '').matchAll(/\{\{(.+?)\}\}/gm);
207
+ // add url parameters:
208
+ const matchedParams = (endpointData.url || "").matchAll(
209
+ /\{\{(.+?)}}/gm
210
+ );
170
211
  for (const match of matchedParams) {
171
212
  const urlParam = match[1];
172
213
  // Add url param if it is not defined withing the connector's param list
173
- if (this.apiProperties.every(item => item !== urlParam)) {
214
+ if (this.apiProperties.every((item) => item !== urlParam)) {
174
215
  this.apiProperties.push(urlParam);
175
216
  }
176
217
  }
177
218
  }
178
219
 
179
- if (rowType === 'BODY') {
180
- const matchedParams = (endpointData.body || '').matchAll(/\{\{(.+?)\}\}/gm);
220
+ if (rowType === "BODY") {
221
+ const matchedParams = (endpointData.body || "").matchAll(
222
+ /\{\{(.+?)}}/gm
223
+ );
181
224
  for (const match of matchedParams) {
182
225
  const urlParam = match[1];
183
226
  // Add url param if it is not defined withing the connector's param list
184
- if (this.apiProperties.every(item => item !== urlParam)) {
227
+ if (this.apiProperties.every((item) => item !== urlParam)) {
185
228
  this.apiProperties.push(urlParam);
186
229
  }
187
230
  }
188
231
  }
189
-
190
232
  });
191
- },
192
-
193
- },
194
- watch: {
195
- outboundConfig: {
196
- deep: true,
197
- immediate: true,
198
- handler(outboundConfig) {
199
- this.setConfig('outboundConfig', outboundConfig);
200
- },
201
- },
202
- value: {
203
- immediate: true,
204
- handler() {
205
- const outboundConfig = this.getConfig().outboundConfig;
206
- if (outboundConfig) {
207
- this.outboundConfig.splice(0);
208
- outboundConfig.forEach(element => {
209
- this.outboundConfig.push(element);
210
- });
211
- }
212
- },
213
- },
214
- },
233
+ }
234
+ }
215
235
  };
216
236
  </script>
217
237
 
@@ -3,7 +3,6 @@
3
3
  <label class="typo__label">{{ label }}</label>
4
4
  <multiselect
5
5
  :value="selectedOption"
6
- @input="change"
7
6
  :placeholder="placeholder"
8
7
  :options="options"
9
8
  :multiple="multiple"
@@ -12,76 +11,94 @@
12
11
  :searchable="true"
13
12
  :internal-search="false"
14
13
  label="title"
14
+ @input="change"
15
15
  @search-change="loadOptions"
16
16
  @open="loadOptions()"
17
17
  >
18
18
  <template slot="noResult">
19
- <slot name="noResult">{{ $t('Not found') }}</slot>
19
+ <slot name="noResult">{{ $t("Not found") }}</slot>
20
20
  </template>
21
21
  <template slot="noOptions">
22
- <slot name="noOptions">{{ $t('No Data Available') }}</slot>
22
+ <slot name="noOptions">{{ $t("No Data Available") }}</slot>
23
23
  </template>
24
24
  </multiselect>
25
- <div class="screen-link mt-2" v-if="value">
25
+ <div v-if="value" class="screen-link mt-2">
26
26
  <a :href="`/designer/screen-builder/${value}/edit`" target="_blank">
27
- {{ $t('Open Screen') }}
28
- <i class="ml-1 fas fa-external-link-alt"/>
27
+ {{ $t("Open Screen") }}
28
+ <i class="ml-1 fas fa-external-link-alt" />
29
29
  </a>
30
30
  </div>
31
31
  </div>
32
32
  </template>
33
33
 
34
34
  <script>
35
- import { get } from 'lodash';
36
- import { multiselectApi } from '@/mixins';
37
- import { formTypes } from '@/global-properties';
35
+ import { get } from "lodash";
36
+ import { multiselectApi } from "@/mixins";
37
+ import { formTypes } from "@/global-properties";
38
38
 
39
- const globalObject = typeof window === 'undefined'
40
- ? global
41
- : window;
39
+ const globalObject = typeof window === "undefined" ? global : window;
42
40
 
43
41
  export default {
44
42
  mixins: [multiselectApi],
45
43
  props: {
46
44
  api: {
47
45
  type: String,
48
- default: 'screens',
46
+ default: "screens"
49
47
  },
50
48
  builder: {
51
49
  type: Object,
52
- required: true,
50
+ required: true
53
51
  },
54
52
  screenType: {
55
53
  type: String,
56
- default: formTypes.form,
54
+ default: formTypes.form
57
55
  },
58
56
  validateNested: {
59
57
  type: Boolean,
60
- default: false,
61
- },
58
+ default: false
59
+ }
60
+ },
61
+ mounted() {
62
+ this.$root.$on("remove-nested", (nestedScreenId) => {
63
+ if (this.value === nestedScreenId) {
64
+ this.$emit("input", null);
65
+ }
66
+ });
67
+
68
+ let pmql = '(type = "FORM" or type = "DISPLAY")';
69
+ if (this.screenType === formTypes.display) {
70
+ pmql = '(type = "DISPLAY")';
71
+ }
72
+ if (this.builder.screen) {
73
+ pmql += ` and id != ${this.builder.screen.id}`;
74
+ }
75
+ this.pmql = pmql;
76
+ this.fields = "screens.id,title";
62
77
  },
63
78
  methods: {
64
79
  isNavButton(item) {
65
- return item.config && item.component === 'FormButton' && item.config.event === 'pageNavigate';
80
+ return (
81
+ item.config &&
82
+ item.component === "FormButton" &&
83
+ item.config.event === "pageNavigate"
84
+ );
66
85
  },
67
86
  containsNavbutton(config) {
68
- config.forEach(item => {
69
-
70
- //If the element has containers
87
+ config.forEach((item) => {
88
+ // If the element has containers
71
89
  if (Array.isArray(item)) {
72
90
  this.containsNavbutton(item);
73
91
  }
74
92
 
75
- //If the element has items
93
+ // If the element has items
76
94
  if (item.items) {
77
95
  this.containsNavbutton(item.items);
78
96
  }
79
97
 
80
- //hidden buttons
98
+ // hidden buttons
81
99
  if (this.isNavButton(item)) {
82
100
  this.nav = true;
83
101
  }
84
-
85
102
  });
86
103
  },
87
104
 
@@ -91,32 +108,18 @@ export default {
91
108
  this.nav = false;
92
109
  this.containsNavbutton(value.config);
93
110
  if (this.nav) {
94
- globalObject.ProcessMaker.alert(this.$t('The nested form contains navigation buttons'), 'warning');
111
+ globalObject.ProcessMaker.alert(
112
+ this.$t("The nested form contains navigation buttons"),
113
+ "warning"
114
+ );
95
115
  return false;
96
116
  }
97
117
  }
98
118
  const id = this.storeId ? get(value, this.trackBy) : value;
99
119
  // Make sure to load latest config from screen and nested screens
100
120
  this.$dataProvider.flushScreenCache();
101
- this.$emit('input', id);
102
- },
103
- },
104
- mounted() {
105
- this.$root.$on('remove-nested', (nestedScreenId) => {
106
- if (this.value === nestedScreenId) {
107
- this.$emit('input', null);
108
- }
109
- });
110
-
111
- let pmql = '(type = "FORM" or type = "DISPLAY")';
112
- if (this.screenType === formTypes.display) {
113
- pmql = '(type = "DISPLAY")';
121
+ this.$emit("input", id);
114
122
  }
115
- if (this.builder.screen) {
116
- pmql += ' and id != ' + this.builder.screen.id;
117
- }
118
- this.pmql = pmql;
119
- this.fields = 'screens.id,title';
120
- },
123
+ }
121
124
  };
122
125
  </script>
@@ -24,7 +24,7 @@
24
24
  </template>
25
25
 
26
26
  <script>
27
- import FormMultiselect from './form-multiselect';
27
+ import FormMultiselect from './form-multiselect.vue';
28
28
  import maskConfig from '../../form-input-mask-config';
29
29
 
30
30
  export default {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div v-if="buttonType !== 'submit'">
3
3
  <label class="typo__label">{{ label }}</label>
4
- <br >
4
+ <br />
5
5
  <label class="typo__label">{{ $t("Position") }}</label>
6
6
  <multiselect
7
7
  v-model="position"
@@ -34,123 +34,125 @@
34
34
  </template>
35
35
 
36
36
  <script>
37
- import _ from 'lodash';
37
+ import _ from "lodash";
38
+ import { FormTextArea } from "@processmaker/vue-form-elements";
38
39
 
39
40
  export default {
41
+ components: { FormTextArea },
40
42
  inheritAttrs: false,
41
- props: ['label', 'value', 'helper'],
43
+ props: ["label", "value", "helper"],
42
44
  data() {
43
45
  return {
44
46
  options: [
45
47
  {
46
- value: 'top',
47
- content: this.$t('Top'),
48
+ value: "top",
49
+ content: this.$t("Top")
48
50
  },
49
51
  {
50
- value: 'topleft',
51
- content: this.$t('Top Left'),
52
+ value: "topleft",
53
+ content: this.$t("Top Left")
52
54
  },
53
55
  {
54
- value: 'topright',
55
- content: this.$t('Top Right'),
56
+ value: "topright",
57
+ content: this.$t("Top Right")
56
58
  },
57
59
  {
58
- value: 'right',
59
- content: this.$t('Right'),
60
+ value: "right",
61
+ content: this.$t("Right")
60
62
  },
61
63
  {
62
- value: 'righttop',
63
- content: this.$t('Right Top'),
64
+ value: "righttop",
65
+ content: this.$t("Right Top")
64
66
  },
65
67
  {
66
- value: 'rightbottom',
67
- content: this.$t('Right Bottom'),
68
+ value: "rightbottom",
69
+ content: this.$t("Right Bottom")
68
70
  },
69
71
  {
70
- value: 'bottom',
71
- content: this.$t('Bottom'),
72
+ value: "bottom",
73
+ content: this.$t("Bottom")
72
74
  },
73
75
  {
74
- value: 'bottomleft',
75
- content: this.$t('Bottom Left'),
76
+ value: "bottomleft",
77
+ content: this.$t("Bottom Left")
76
78
  },
77
79
  {
78
- value: 'bottomright',
79
- content: this.$t('Bottom Right'),
80
+ value: "bottomright",
81
+ content: this.$t("Bottom Right")
80
82
  },
81
83
  {
82
- value: 'left',
83
- content: this.$t('Left'),
84
+ value: "left",
85
+ content: this.$t("Left")
84
86
  },
85
87
  {
86
- value: 'lefttop',
87
- content: this.$t('Left Top'),
88
+ value: "lefttop",
89
+ content: this.$t("Left Top")
88
90
  },
89
91
  {
90
- value: 'leftbottom',
91
- content: this.$t('Left Bottom'),
92
- },
92
+ value: "leftbottom",
93
+ content: this.$t("Left Bottom")
94
+ }
93
95
  ],
94
96
  optionsVariant: [
95
97
  {
96
- value: 'primary',
97
- content: this.$t('Primary'),
98
+ value: "primary",
99
+ content: this.$t("Primary")
98
100
  },
99
101
  {
100
- value: 'secondary',
101
- content: this.$t('Secondary'),
102
+ value: "secondary",
103
+ content: this.$t("Secondary")
102
104
  },
103
105
  {
104
- value: 'success',
105
- content: this.$t('Success'),
106
+ value: "success",
107
+ content: this.$t("Success")
106
108
  },
107
109
  {
108
- value: 'danger',
109
- content: this.$t('Danger'),
110
+ value: "danger",
111
+ content: this.$t("Danger")
110
112
  },
111
113
  {
112
- value: 'warning',
113
- content: this.$t('Warning'),
114
+ value: "warning",
115
+ content: this.$t("Warning")
114
116
  },
115
117
  {
116
- value: 'info',
117
- content: this.$t('Info'),
118
+ value: "info",
119
+ content: this.$t("Info")
118
120
  },
119
121
  {
120
- value: 'light',
121
- content: this.$t('Light'),
122
+ value: "light",
123
+ content: this.$t("Light")
122
124
  },
123
125
  {
124
- value: 'dark',
125
- content: this.$t('Dark'),
126
- },
126
+ value: "dark",
127
+ content: this.$t("Dark")
128
+ }
127
129
  ],
128
- position: 'top',
129
- content: '',
130
- variant: '',
130
+ position: "top",
131
+ content: "",
132
+ variant: ""
131
133
  };
132
134
  },
133
135
  computed: {
134
136
  buttonType() {
135
- return _.get(this.$attrs, 'selectedControl.config.event');
136
- },
137
+ return _.get(this.$attrs, "selectedControl.config.event");
138
+ }
137
139
  },
138
140
  watch: {
139
141
  value: {
140
142
  handler() {
141
143
  if (this.value) {
142
- this.position = this.value.position || '';
143
- this.content = this.value.content || '';
144
- this.variant = this.value.variant || '';
144
+ this.position = this.value.position || "";
145
+ this.content = this.value.content || "";
146
+ this.variant = this.value.variant || "";
145
147
  } else {
146
148
  this.value = {
147
- position: '',
148
- content: '',
149
- variant: '',
149
+ position: "",
150
+ content: "",
151
+ variant: ""
150
152
  };
151
153
  }
152
154
  },
153
- immediate: true,
155
+ immediate: true
154
156
  },
155
157
  position() {
156
158
  this.value.position = this.position;
@@ -160,7 +162,7 @@ export default {
160
162
  },
161
163
  variant() {
162
164
  this.value.variant = this.variant;
163
- },
165
+ }
164
166
  },
165
167
  methods: {
166
168
  getLabelFromValuePosition(value) {
@@ -174,7 +176,7 @@ export default {
174
176
  (option) => option.value == value
175
177
  );
176
178
  return selectedOption ? selectedOption.content : null;
177
- },
178
- },
179
+ }
180
+ }
179
181
  };
180
182
  </script>