@processmaker/screen-builder 2.40.0 → 2.50.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.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/screen-builder",
3
- "version": "2.40.0",
3
+ "version": "2.50.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -38,7 +38,7 @@
38
38
  "@cypress/code-coverage": "^3.8.1",
39
39
  "@fortawesome/fontawesome-free": "^5.6.1",
40
40
  "@panter/vue-i18next": "^0.15.2",
41
- "@processmaker/vue-form-elements": "0.30.0",
41
+ "@processmaker/vue-form-elements": "0.40.0",
42
42
  "@processmaker/vue-multiselect": "^2.2.0",
43
43
  "@vue/cli-plugin-babel": "^3.6.0",
44
44
  "@vue/cli-plugin-e2e-cypress": "^4.0.3",
@@ -87,7 +87,7 @@
87
87
  },
88
88
  "peerDependencies": {
89
89
  "@panter/vue-i18next": "^0.15.0",
90
- "@processmaker/vue-form-elements": "0.30.0",
90
+ "@processmaker/vue-form-elements": "0.40.0",
91
91
  "i18next": "^15.0.8",
92
92
  "vue": "^2.6.12",
93
93
  "vuex": "^3.1.1"
package/src/.DS_Store CHANGED
Binary file
@@ -136,23 +136,7 @@ export default {
136
136
  }
137
137
  url += this.authQueryString();
138
138
 
139
- if (window.ProcessMaker && window.ProcessMaker.debounce !== undefined && window.ProcessMaker.debounce === false) {
140
- return this.post(url, params, { timeout: 0});
141
- }
142
-
143
- if (window.ProcessMaker.cachedDataSources === undefined) {
144
- window.ProcessMaker.cachedDataSources = [];
145
- }
146
- let cachedDataSources = window.ProcessMaker.cachedDataSources;
147
- let cached = cachedDataSources.find(item => item.url === url);
148
- if (cached) {
149
- return cached.value;
150
- }
151
- else {
152
- let post = this.post(url, params, { timeout: 0});
153
- cachedDataSources.push({url, value: post});
154
- return post;
155
- }
139
+ return this.post(url, params, { timeout: 0});
156
140
  },
157
141
 
158
142
  authQueryString() {
@@ -109,12 +109,10 @@ export default {
109
109
  this.setValue(this.$parent, this.name, this.fieldValue);
110
110
  }
111
111
  if (this.event === 'submit') {
112
- window.setTimeout(() => {
113
- this.$emit('input', this.fieldValue);
114
- this.$nextTick(()=>{
115
- this.$emit('submit', this.eventData);
116
- });
117
- }, 600);
112
+ this.$emit('input', this.fieldValue);
113
+ this.$nextTick(()=>{
114
+ this.$emit('submit', this.eventData);
115
+ });
118
116
  return;
119
117
  }
120
118
  this.$emit(this.event, this.eventData);
@@ -4,8 +4,7 @@
4
4
  <component
5
5
  v-if="componentType!=='input'"
6
6
  :is="componentType"
7
- :value="internalValue"
8
- @input="updateInternalValue"
7
+ v-model="localValue"
9
8
  v-bind="componentConfig"
10
9
  v-uni-id="name"
11
10
  :name="name"
@@ -14,8 +13,7 @@
14
13
  type="text"
15
14
  />
16
15
  <input v-else
17
- :value="internalValue"
18
- @input="updateInternalValue"
16
+ v-model="localValue"
19
17
  v-bind="componentConfig"
20
18
  v-uni-id="name"
21
19
  :name="name"
@@ -43,7 +41,6 @@ import { TheMask } from 'vue-the-mask';
43
41
  import { getUserDateFormat, getUserDateTimeFormat } from '@processmaker/vue-form-elements/src/dateUtils';
44
42
  import ValidationMixin from '@processmaker/vue-form-elements/src/components/mixins/validation';
45
43
  import moment from 'moment';
46
- import InputDebounce from '@processmaker/vue-form-elements/src/components/mixins/InputDebounce';
47
44
 
48
45
  const uniqIdsMixin = createUniqIdsMixin();
49
46
  const componentTypes = {
@@ -64,7 +61,7 @@ const componentTypesConfigs = {
64
61
  export default {
65
62
  inheritAttrs: false,
66
63
  components: { TheMask, Inputmasked },
67
- mixins: [ uniqIdsMixin, ValidationMixin, InputDebounce ],
64
+ mixins: [ uniqIdsMixin, ValidationMixin ],
68
65
  props: [
69
66
  'value',
70
67
  'label',
@@ -226,7 +223,7 @@ export default {
226
223
  },
227
224
  watch: {
228
225
  value(value) {
229
- if (!this.touched) {
226
+ if (this.localValue !== value) {
230
227
  this.localValue = value;
231
228
  }
232
229
  },
@@ -239,6 +236,7 @@ export default {
239
236
  data() {
240
237
  return {
241
238
  validator: null,
239
+ localValue: null,
242
240
  validationRules: {
243
241
  'percentage': 'regex:/^[+-]?\\d+(\\.\\d+)?$/',
244
242
  },
@@ -26,7 +26,7 @@ import Json2Vue from '../mixins/Json2Vue';
26
26
  import CurrentPageProperty from '../mixins/CurrentPageProperty';
27
27
  import WatchersSynchronous from '@/components/watchers-synchronous';
28
28
  import ScreenRendererError from '../components/renderer/screen-renderer-error';
29
- import { cloneDeep, isEqual, debounce, get as getFromObject} from 'lodash';
29
+ import { cloneDeep, isEqual } from 'lodash';
30
30
 
31
31
  export default {
32
32
  name: 'screen-renderer',
@@ -42,28 +42,7 @@ export default {
42
42
  },
43
43
  mounted() {
44
44
  this.currentDefinition = cloneDeep(this.definition);
45
-
46
- let screenName = getFromObject(this.currentDefinition, 'config.0.name');
47
- const itemName = `hash${this.hash(JSON.stringify(this.currentDefinition))}`;
48
-
49
- if (['empty', undefined, null].includes(screenName)) {
50
- this.component = this.buildComponent(this.currentDefinition);
51
- return;
52
- }
53
-
54
- if (window.ProcessMaker.cachedScreens === undefined) {
55
- window.ProcessMaker.cachedScreens = [];
56
- }
57
- let cachedScreen = window.ProcessMaker.cachedScreens.find(x => x.name === itemName);
58
- if (cachedScreen) {
59
- this.component = cachedScreen.component;
60
- }
61
- else {
62
- let component = this.buildComponent(this.currentDefinition);
63
- this.component = component;
64
- window.ProcessMaker.cachedScreens.push({name: itemName, component: cloneDeep(component), definition: this.definition});
65
- }
66
-
45
+ this.component = this.buildComponent(this.currentDefinition);
67
46
  },
68
47
  watch: {
69
48
  definition: {
@@ -73,19 +52,12 @@ export default {
73
52
  },
74
53
  },
75
54
  },
76
- created() {
77
- this.rebuildScreen = debounce(function(definition) {
55
+ methods: {
56
+ rebuildScreen(definition) {
78
57
  if (!isEqual(definition, this.currentDefinition)) {
79
58
  this.currentDefinition = cloneDeep(definition);
80
59
  this.component = this.buildComponent(this.currentDefinition);
81
60
  }
82
- }, 500);
83
- },
84
- methods: {
85
- hash(s) {
86
- for (var i=0,h=9;i<s.length;)
87
- h=Math.imul(h^s.charCodeAt(i++),9**9);
88
- return h^h>>>9;
89
61
  },
90
62
  onAsyncWatcherOn() {
91
63
  this.displayAsyncLoading = typeof this._parent === 'undefined';
@@ -6,12 +6,12 @@
6
6
  </template>
7
7
 
8
8
  <script>
9
- import {size, cloneDeep, debounce, get} from 'lodash';
9
+ import _ from 'lodash';
10
10
  import CustomCssOutput from './custom-css-output';
11
11
  import currencies from '../currency.json';
12
12
  import Inputmask from 'inputmask';
13
- import {getItemsFromConfig} from '@/itemProcessingUtils';
14
- import {ValidatorFactory} from '@/factories/ValidatorFactory';
13
+ import { getItemsFromConfig } from '../itemProcessingUtils';
14
+ import { ValidatorFactory } from '../factories/ValidatorFactory';
15
15
  import CurrentPageProperty from '../mixins/CurrentPageProperty';
16
16
  import globalErrorsModule from '@/store/modules/global-errors';
17
17
 
@@ -19,9 +19,9 @@ const csstree = require('css-tree');
19
19
  const Scrollparent = require('scrollparent');
20
20
 
21
21
  export default {
22
- name: 'VueFormRenderer',
23
- components: {CustomCssOutput},
24
- mixins: [CurrentPageProperty],
22
+ name: 'VueFormRenderer',
23
+ components: { CustomCssOutput },
24
+ mixins: [CurrentPageProperty],
25
25
  props: ['config', 'data', '_parent', 'page', 'computed', 'customCss', 'mode', 'watchers', 'isLoop', 'ancestorScreens', 'loopContext', 'showErrors', 'testScreenDefinition'],
26
26
  model: {
27
27
  prop: 'data',
@@ -69,7 +69,7 @@ export default {
69
69
  };
70
70
  return function(text) {
71
71
  const params = JSON.parse(`[${text}]`);
72
- return format(get(this, params[0]), params[1]);
72
+ return format(_.get(this, params[0]), params[1]);
73
73
  };
74
74
  },
75
75
  },
@@ -91,8 +91,8 @@ export default {
91
91
  data: {
92
92
  deep: true,
93
93
  handler() {
94
- this.debouncedWatch();
95
- },
94
+ this.$emit('update', this.data);
95
+ },
96
96
  },
97
97
  computed: {
98
98
  deep: true,
@@ -108,13 +108,9 @@ export default {
108
108
  },
109
109
  },
110
110
  created() {
111
- this.debouncedWatch = debounce(() => this.$emit('update', this.data), 500);
112
111
  this.registerStoreModule('globalErrorsModule', globalErrorsModule);
113
- this.parseCss = debounce(this.parseCss, 500, {leading: true});
112
+ this.parseCss = _.debounce(this.parseCss, 500, {leading: true});
114
113
  },
115
- beforeUnmount() {
116
- this.debouncedWatch.cancel();
117
- },
118
114
  mounted() {
119
115
  this.parseCss();
120
116
  this.registerCustomFunctions();
@@ -166,7 +162,7 @@ export default {
166
162
  */
167
163
  isValid() {
168
164
  const items = getItemsFromConfig(this.definition.config);
169
- let config = cloneDeep(this.definition.config);
165
+ let config = _.cloneDeep(this.definition.config);
170
166
 
171
167
  this.checkForRecordList(items, config);
172
168
  this.dataTypeValidator = ValidatorFactory(config, this.data);
@@ -175,7 +171,7 @@ export default {
175
171
  if (this.errors) {
176
172
  this.formSubmitErrorClass = 'invalid-form-submission';
177
173
  }
178
- return size(this.errors) === 0;
174
+ return _.size(this.errors) === 0;
179
175
  },
180
176
  registerCustomFunctions(node=this) {
181
177
  if (node.registerCustomFunction instanceof Function) {
package/src/main.js CHANGED
@@ -93,7 +93,6 @@ window.exampleScreens = [
93
93
  },
94
94
  ];
95
95
  window.ProcessMaker = {
96
- debounce: false,
97
96
  isStub: true,
98
97
  user: {
99
98
  id: 1,
@@ -375,7 +375,7 @@ export default {
375
375
  }
376
376
  });
377
377
  };
378
- updateValidationRules = debounce(updateValidationRules, 100);
378
+ updateValidationRules = debounce(updateValidationRules, 25);
379
379
  component.methods.loadValidationRules = function() {
380
380
  // Asynchronous loading of validations
381
381
  const validations = {};
@@ -7,28 +7,12 @@ const stringFormats = ['string', 'datetime', 'date', 'password'];
7
7
  export default {
8
8
  schema: [
9
9
  function() {
10
- if (window.ProcessMaker.cachedSchemas === undefined) {
11
- window.ProcessMaker.cachedSchemas = [];
12
- }
13
-
14
-
15
10
  if (window.ProcessMaker && window.ProcessMaker.packages && window.ProcessMaker.packages.includes('package-vocabularies')) {
16
11
  if (window.ProcessMaker.VocabulariesSchemaUrl) {
17
- let cachedSchemas = window.ProcessMaker.cachedSchemas;
18
- let schemaUrl = window.ProcessMaker.VocabulariesSchemaUrl;
19
- let cached = cachedSchemas.find(item => item.url === schemaUrl);
20
- if (cached) {
21
- return cached.value;
22
- }
23
- else {
24
- let response = window.ProcessMaker.apiClient.get(window.ProcessMaker.VocabulariesSchemaUrl);
25
- let result = response.then(response => {
26
- window.ProcessMaker.cachedSchema = response.data;
27
- return response.data;
28
- });
29
- cachedSchemas.push({url: schemaUrl, value: result});
30
- return result;
31
- }
12
+ let response = window.ProcessMaker.apiClient.get(window.ProcessMaker.VocabulariesSchemaUrl);
13
+ return response.then(response => {
14
+ return response.data;
15
+ });
32
16
  }
33
17
  if (window.ProcessMaker.VocabulariesPreview) {
34
18
  return window.ProcessMaker.VocabulariesPreview;
@@ -194,10 +178,6 @@ export default {
194
178
  return;
195
179
  }
196
180
 
197
- if (Number.isNaN(originalValue)) {
198
- delete object[attr];
199
- }
200
-
201
181
  this.$set(
202
182
  object,
203
183
  attr,