@formio/js 5.0.0-dev.5830.bf15879 → 5.0.0-dev.5834.98680ce
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/Changelog.md +1 -0
- package/dist/formio.form.js +15 -15
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +15 -15
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +11 -11
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/Webform.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +5 -0
- package/lib/cjs/components/_classes/component/Component.js +8 -1
- package/lib/cjs/components/textarea/TextArea.d.ts +7 -0
- package/lib/cjs/components/textarea/TextArea.js +20 -0
- package/lib/cjs/components/time/Time.js +0 -6
- package/lib/mjs/Webform.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +5 -0
- package/lib/mjs/components/_classes/component/Component.js +8 -1
- package/lib/mjs/components/textarea/TextArea.d.ts +7 -0
- package/lib/mjs/components/textarea/TextArea.js +20 -0
- package/lib/mjs/components/time/Time.js +0 -6
- package/package.json +2 -2
package/lib/cjs/Webform.js
CHANGED
|
@@ -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.length === 0;
|
|
1256
|
+
value.isValid = (errors || []).filter(err => !err.fromServer).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.
|
|
@@ -19,6 +19,13 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
|
19
19
|
setContent(element: any, content: any, forceSanitize: any): void;
|
|
20
20
|
setReadOnlyValue(value: any, index: any): void;
|
|
21
21
|
get isJsonValue(): any;
|
|
22
|
+
/**
|
|
23
|
+
* Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
|
|
24
|
+
* @param {*} value - The value to normalize
|
|
25
|
+
* @returns {*} - Returns the normalized value
|
|
26
|
+
*/
|
|
27
|
+
normalizeValue(value: any): any;
|
|
28
|
+
normalizeSingleValue(value: any): any;
|
|
22
29
|
setConvertedValue(value: any, index: any): any;
|
|
23
30
|
setAsyncConvertedValue(value: any): Promise<any>;
|
|
24
31
|
setImagesUrl(images: any): Promise<any>;
|
|
@@ -309,6 +309,26 @@ class TextAreaComponent extends TextField_1.default {
|
|
|
309
309
|
get isJsonValue() {
|
|
310
310
|
return this.component.as && this.component.as === 'json';
|
|
311
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
|
|
314
|
+
* @param {*} value - The value to normalize
|
|
315
|
+
* @returns {*} - Returns the normalized value
|
|
316
|
+
*/
|
|
317
|
+
normalizeValue(value) {
|
|
318
|
+
if (this.component.multiple && Array.isArray(value)) {
|
|
319
|
+
return value.map((singleValue) => this.normalizeSingleValue(singleValue));
|
|
320
|
+
}
|
|
321
|
+
return super.normalizeValue(this.normalizeSingleValue(value));
|
|
322
|
+
}
|
|
323
|
+
normalizeSingleValue(value) {
|
|
324
|
+
if (lodash_1.default.isNil(value)) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
return this.isJsonValue ? value : String(value);
|
|
328
|
+
}
|
|
329
|
+
isSingleInputValue() {
|
|
330
|
+
return !this.component.multiple;
|
|
331
|
+
}
|
|
312
332
|
setConvertedValue(value, index) {
|
|
313
333
|
if (this.isJsonValue && !lodash_1.default.isNil(value)) {
|
|
314
334
|
try {
|
|
@@ -56,12 +56,6 @@ class TimeComponent extends TextField_1.default {
|
|
|
56
56
|
}
|
|
57
57
|
return value;
|
|
58
58
|
}
|
|
59
|
-
get validationValue() {
|
|
60
|
-
if ((Array.isArray(this.rawData) && !this.rawData.length) || !this.rawData) {
|
|
61
|
-
return this.dataValue;
|
|
62
|
-
}
|
|
63
|
-
return this.rawData;
|
|
64
|
-
}
|
|
65
59
|
get inputInfo() {
|
|
66
60
|
const info = super.inputInfo;
|
|
67
61
|
info.attr.type = this.component.inputType;
|
package/lib/mjs/Webform.js
CHANGED
|
@@ -1259,7 +1259,7 @@ export default class Webform extends NestedDataComponent {
|
|
|
1259
1259
|
process: 'change'
|
|
1260
1260
|
})
|
|
1261
1261
|
: [];
|
|
1262
|
-
value.isValid = errors.length === 0;
|
|
1262
|
+
value.isValid = (errors || []).filter(err => !err.fromServer).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.
|
|
@@ -19,6 +19,13 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
|
19
19
|
setContent(element: any, content: any, forceSanitize: any): void;
|
|
20
20
|
setReadOnlyValue(value: any, index: any): void;
|
|
21
21
|
get isJsonValue(): any;
|
|
22
|
+
/**
|
|
23
|
+
* Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
|
|
24
|
+
* @param {*} value - The value to normalize
|
|
25
|
+
* @returns {*} - Returns the normalized value
|
|
26
|
+
*/
|
|
27
|
+
normalizeValue(value: any): any;
|
|
28
|
+
normalizeSingleValue(value: any): any;
|
|
22
29
|
setConvertedValue(value: any, index: any): any;
|
|
23
30
|
setAsyncConvertedValue(value: any): Promise<any>;
|
|
24
31
|
setImagesUrl(images: any): Promise<any>;
|
|
@@ -304,6 +304,26 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
|
304
304
|
get isJsonValue() {
|
|
305
305
|
return this.component.as && this.component.as === 'json';
|
|
306
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
|
|
309
|
+
* @param {*} value - The value to normalize
|
|
310
|
+
* @returns {*} - Returns the normalized value
|
|
311
|
+
*/
|
|
312
|
+
normalizeValue(value) {
|
|
313
|
+
if (this.component.multiple && Array.isArray(value)) {
|
|
314
|
+
return value.map((singleValue) => this.normalizeSingleValue(singleValue));
|
|
315
|
+
}
|
|
316
|
+
return super.normalizeValue(this.normalizeSingleValue(value));
|
|
317
|
+
}
|
|
318
|
+
normalizeSingleValue(value) {
|
|
319
|
+
if (_.isNil(value)) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
return this.isJsonValue ? value : String(value);
|
|
323
|
+
}
|
|
324
|
+
isSingleInputValue() {
|
|
325
|
+
return !this.component.multiple;
|
|
326
|
+
}
|
|
307
327
|
setConvertedValue(value, index) {
|
|
308
328
|
if (this.isJsonValue && !_.isNil(value)) {
|
|
309
329
|
try {
|
|
@@ -51,12 +51,6 @@ export default class TimeComponent extends TextFieldComponent {
|
|
|
51
51
|
}
|
|
52
52
|
return value;
|
|
53
53
|
}
|
|
54
|
-
get validationValue() {
|
|
55
|
-
if ((Array.isArray(this.rawData) && !this.rawData.length) || !this.rawData) {
|
|
56
|
-
return this.dataValue;
|
|
57
|
-
}
|
|
58
|
-
return this.rawData;
|
|
59
|
-
}
|
|
60
54
|
get inputInfo() {
|
|
61
55
|
const info = super.inputInfo;
|
|
62
56
|
info.attr.type = this.component.inputType;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formio/js",
|
|
3
|
-
"version": "5.0.0-dev.
|
|
3
|
+
"version": "5.0.0-dev.5834.98680ce",
|
|
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": "
|
|
85
|
+
"@formio/core": "v2.1.0-dev.160.d45b496",
|
|
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",
|