@formio/js 5.0.0-dev.5826.02fa4d9 → 5.0.0-dev.5829.167a315

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.
@@ -1253,7 +1253,7 @@ class Webform extends NestedDataComponent_1.default {
1253
1253
  const errors = shouldValidate
1254
1254
  ? this.validate(value.data, Object.assign(Object.assign({}, flags), { noValidate: false, process: 'change' }))
1255
1255
  : [];
1256
- value.isValid = (errors || []).filter(err => !err.fromServer).length === 0;
1256
+ value.isValid = errors.length === 0;
1257
1257
  this.loading = false;
1258
1258
  if (this.submitted) {
1259
1259
  // show server errors while they are not cleaned/fixed
@@ -881,6 +881,11 @@ declare class Component extends Element {
881
881
  * @returns {boolean} - If the value changed.
882
882
  */
883
883
  setValue(value: any, flags?: any): boolean;
884
+ /**
885
+ * Returns if the value (e.g. array) should be divided between several inputs
886
+ * @returns {boolean}
887
+ */
888
+ isSingleInputValue(): boolean;
884
889
  /**
885
890
  * Set the value at a specific index.
886
891
  * @param {number} index - The index to set the value at.
@@ -2586,11 +2586,18 @@ class Component extends Element_1.default {
2586
2586
  }
2587
2587
  for (const i in this.refs.input) {
2588
2588
  if (this.refs.input.hasOwnProperty(i)) {
2589
- this.setValueAt(i, isArray ? value[i] : value, flags);
2589
+ this.setValueAt(i, isArray && !this.isSingleInputValue() ? value[i] : value, flags);
2590
2590
  }
2591
2591
  }
2592
2592
  return changed;
2593
2593
  }
2594
+ /**
2595
+ * Returns if the value (e.g. array) should be divided between several inputs
2596
+ * @returns {boolean}
2597
+ */
2598
+ isSingleInputValue() {
2599
+ return false;
2600
+ }
2594
2601
  /**
2595
2602
  * Set the value at a specific index.
2596
2603
  * @param {number} index - The index to set the value at.
@@ -309,6 +309,9 @@ class TextAreaComponent extends TextField_1.default {
309
309
  get isJsonValue() {
310
310
  return this.component.as && this.component.as === 'json';
311
311
  }
312
+ isSingleInputValue() {
313
+ return !this.component.multiple;
314
+ }
312
315
  setConvertedValue(value, index) {
313
316
  if (this.isJsonValue && !lodash_1.default.isNil(value)) {
314
317
  try {
@@ -1259,7 +1259,7 @@ export default class Webform extends NestedDataComponent {
1259
1259
  process: 'change'
1260
1260
  })
1261
1261
  : [];
1262
- value.isValid = (errors || []).filter(err => !err.fromServer).length === 0;
1262
+ value.isValid = errors.length === 0;
1263
1263
  this.loading = false;
1264
1264
  if (this.submitted) {
1265
1265
  // show server errors while they are not cleaned/fixed
@@ -881,6 +881,11 @@ declare class Component extends Element {
881
881
  * @returns {boolean} - If the value changed.
882
882
  */
883
883
  setValue(value: any, flags?: any): boolean;
884
+ /**
885
+ * Returns if the value (e.g. array) should be divided between several inputs
886
+ * @returns {boolean}
887
+ */
888
+ isSingleInputValue(): boolean;
884
889
  /**
885
890
  * Set the value at a specific index.
886
891
  * @param {number} index - The index to set the value at.
@@ -2552,11 +2552,18 @@ export default class Component extends Element {
2552
2552
  }
2553
2553
  for (const i in this.refs.input) {
2554
2554
  if (this.refs.input.hasOwnProperty(i)) {
2555
- this.setValueAt(i, isArray ? value[i] : value, flags);
2555
+ this.setValueAt(i, isArray && !this.isSingleInputValue() ? value[i] : value, flags);
2556
2556
  }
2557
2557
  }
2558
2558
  return changed;
2559
2559
  }
2560
+ /**
2561
+ * Returns if the value (e.g. array) should be divided between several inputs
2562
+ * @returns {boolean}
2563
+ */
2564
+ isSingleInputValue() {
2565
+ return false;
2566
+ }
2560
2567
  /**
2561
2568
  * Set the value at a specific index.
2562
2569
  * @param {number} index - The index to set the value at.
@@ -304,6 +304,9 @@ export default class TextAreaComponent extends TextFieldComponent {
304
304
  get isJsonValue() {
305
305
  return this.component.as && this.component.as === 'json';
306
306
  }
307
+ isSingleInputValue() {
308
+ return !this.component.multiple;
309
+ }
307
310
  setConvertedValue(value, index) {
308
311
  if (this.isJsonValue && !_.isNil(value)) {
309
312
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5826.02fa4d9",
3
+ "version": "5.0.0-dev.5829.167a315",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -82,7 +82,7 @@
82
82
  "dependencies": {
83
83
  "@formio/bootstrap": "3.0.0-dev.98.17ba6ea",
84
84
  "@formio/choices.js": "^10.2.1",
85
- "@formio/core": "2.1.0-dev.146.e57530c",
85
+ "@formio/core": "v2.1.0-dev.156.226c48b",
86
86
  "@formio/text-mask-addons": "^3.8.0-formio.2",
87
87
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
88
88
  "abortcontroller-polyfill": "^1.7.5",