@formio/js 5.0.0-dev.5844.c491f7d → 5.0.0-dev.5846.796fec1
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/dist/formio.form.js +4 -4
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +4 -4
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/Webform.js +5 -3
- package/lib/cjs/components/_classes/component/Component.js +7 -6
- package/lib/cjs/components/_classes/nested/NestedComponent.js +7 -6
- package/lib/cjs/components/editgrid/EditGrid.js +1 -0
- package/lib/mjs/Webform.js +5 -3
- package/lib/mjs/components/_classes/component/Component.js +6 -6
- package/lib/mjs/components/_classes/nested/NestedComponent.js +7 -6
- package/lib/mjs/components/editgrid/EditGrid.js +1 -0
- package/package.json +1 -1
package/lib/cjs/Webform.js
CHANGED
|
@@ -710,6 +710,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
710
710
|
*/
|
|
711
711
|
onSetSubmission(submission, flags = {}) {
|
|
712
712
|
this.submissionSet = true;
|
|
713
|
+
flags.submission = structuredClone(submission);
|
|
713
714
|
this.triggerChange(flags);
|
|
714
715
|
this.emit('beforeSetSubmission', submission);
|
|
715
716
|
this.setValue(submission, flags);
|
|
@@ -1247,9 +1248,10 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
1247
1248
|
this.pristine = false;
|
|
1248
1249
|
}
|
|
1249
1250
|
this.checkData(value.data, flags);
|
|
1250
|
-
|
|
1251
|
-
flags.
|
|
1252
|
-
|
|
1251
|
+
let shouldValidate = flags.noValidate ? false :
|
|
1252
|
+
lodash_1.default.isUndefined(flags.noValidate) ||
|
|
1253
|
+
flags.fromIframe ||
|
|
1254
|
+
(flags.fromSubmission && this.rootPristine && this.pristine);
|
|
1253
1255
|
const errors = shouldValidate
|
|
1254
1256
|
? this.validate(value.data, Object.assign(Object.assign({}, flags), { noValidate: false, process: 'change' }))
|
|
1255
1257
|
: [];
|
|
@@ -2456,7 +2456,6 @@ class Component extends Element_1.default {
|
|
|
2456
2456
|
return;
|
|
2457
2457
|
}
|
|
2458
2458
|
lodash_1.default.set(this._data, this.key, value);
|
|
2459
|
-
return;
|
|
2460
2459
|
}
|
|
2461
2460
|
/**
|
|
2462
2461
|
* Splice a value from the dataValue.
|
|
@@ -2959,17 +2958,19 @@ class Component extends Element_1.default {
|
|
|
2959
2958
|
* @returns {boolean} - TRUE if the component is valid.
|
|
2960
2959
|
*/
|
|
2961
2960
|
showValidationErrors(errors, data, row, flags) {
|
|
2961
|
+
var _a;
|
|
2962
2962
|
if (flags.silentCheck) {
|
|
2963
2963
|
return [];
|
|
2964
2964
|
}
|
|
2965
|
+
let dirty = this.dirty || flags.dirty;
|
|
2965
2966
|
if (this.options.alwaysDirty) {
|
|
2966
|
-
|
|
2967
|
+
dirty = true;
|
|
2967
2968
|
}
|
|
2968
|
-
if (flags.fromSubmission &&
|
|
2969
|
-
|
|
2969
|
+
if (flags.fromSubmission && !lodash_1.default.isUndefined(lodash_1.default.get((_a = flags === null || flags === void 0 ? void 0 : flags.submission) === null || _a === void 0 ? void 0 : _a.data, this.key)) && !(this.pristine && this.protected)) {
|
|
2970
|
+
dirty = true;
|
|
2970
2971
|
}
|
|
2971
|
-
this.setDirty(
|
|
2972
|
-
return this.setComponentValidity(errors,
|
|
2972
|
+
this.setDirty(dirty);
|
|
2973
|
+
return this.setComponentValidity(errors, dirty, flags.silentCheck, flags.fromSubmission);
|
|
2973
2974
|
}
|
|
2974
2975
|
/**
|
|
2975
2976
|
* Perform a component validation.
|
|
@@ -827,22 +827,23 @@ class NestedComponent extends Field_1.default {
|
|
|
827
827
|
}
|
|
828
828
|
setNestedValue(component, value, flags = {}) {
|
|
829
829
|
component._data = this.componentContext(component);
|
|
830
|
+
let componentFlags = Object.assign({}, flags);
|
|
830
831
|
if (component.type === 'button') {
|
|
831
832
|
return false;
|
|
832
833
|
}
|
|
833
834
|
if (component.type === 'components') {
|
|
834
835
|
if (component.tree && component.hasValue(value)) {
|
|
835
|
-
return component.setValue(lodash_1.default.get(value, component.key),
|
|
836
|
+
return component.setValue(lodash_1.default.get(value, component.key), componentFlags);
|
|
836
837
|
}
|
|
837
|
-
return component.setValue(value,
|
|
838
|
+
return component.setValue(value, componentFlags);
|
|
838
839
|
}
|
|
839
840
|
else if (value && component.hasValue(value)) {
|
|
840
|
-
return component.setValue(lodash_1.default.get(value, component.key),
|
|
841
|
+
return component.setValue(lodash_1.default.get(value, component.key), componentFlags);
|
|
841
842
|
}
|
|
842
843
|
else if ((!this.rootPristine || component.visible) && component.shouldAddDefaultValue) {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
return component.setValue(component.defaultValue,
|
|
844
|
+
componentFlags.noValidate = !componentFlags.dirty;
|
|
845
|
+
componentFlags.resetValue = true;
|
|
846
|
+
return component.setValue(component.defaultValue, componentFlags);
|
|
846
847
|
}
|
|
847
848
|
}
|
|
848
849
|
setValue(value, flags = {}) {
|
|
@@ -983,6 +983,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
983
983
|
editRow.state === EditRowState.New ||
|
|
984
984
|
editRow.state === EditRowState.Editing ||
|
|
985
985
|
editRow.alerts ||
|
|
986
|
+
this.dirty ||
|
|
986
987
|
dirty;
|
|
987
988
|
}
|
|
988
989
|
validateRow(editRow, dirty, forceSilentCheck) {
|
package/lib/mjs/Webform.js
CHANGED
|
@@ -708,6 +708,7 @@ export default class Webform extends NestedDataComponent {
|
|
|
708
708
|
*/
|
|
709
709
|
onSetSubmission(submission, flags = {}) {
|
|
710
710
|
this.submissionSet = true;
|
|
711
|
+
flags.submission = structuredClone(submission);
|
|
711
712
|
this.triggerChange(flags);
|
|
712
713
|
this.emit('beforeSetSubmission', submission);
|
|
713
714
|
this.setValue(submission, flags);
|
|
@@ -1249,9 +1250,10 @@ export default class Webform extends NestedDataComponent {
|
|
|
1249
1250
|
this.pristine = false;
|
|
1250
1251
|
}
|
|
1251
1252
|
this.checkData(value.data, flags);
|
|
1252
|
-
|
|
1253
|
-
flags.
|
|
1254
|
-
|
|
1253
|
+
let shouldValidate = flags.noValidate ? false :
|
|
1254
|
+
_.isUndefined(flags.noValidate) ||
|
|
1255
|
+
flags.fromIframe ||
|
|
1256
|
+
(flags.fromSubmission && this.rootPristine && this.pristine);
|
|
1255
1257
|
const errors = shouldValidate
|
|
1256
1258
|
? this.validate(value.data, {
|
|
1257
1259
|
...flags,
|
|
@@ -2422,7 +2422,6 @@ export default class Component extends Element {
|
|
|
2422
2422
|
return;
|
|
2423
2423
|
}
|
|
2424
2424
|
_.set(this._data, this.key, value);
|
|
2425
|
-
return;
|
|
2426
2425
|
}
|
|
2427
2426
|
/**
|
|
2428
2427
|
* Splice a value from the dataValue.
|
|
@@ -2926,14 +2925,15 @@ export default class Component extends Element {
|
|
|
2926
2925
|
if (flags.silentCheck) {
|
|
2927
2926
|
return [];
|
|
2928
2927
|
}
|
|
2928
|
+
let dirty = this.dirty || flags.dirty;
|
|
2929
2929
|
if (this.options.alwaysDirty) {
|
|
2930
|
-
|
|
2930
|
+
dirty = true;
|
|
2931
2931
|
}
|
|
2932
|
-
if (flags.fromSubmission &&
|
|
2933
|
-
|
|
2932
|
+
if (flags.fromSubmission && !_.isUndefined(_.get(flags?.submission?.data, this.key)) && !(this.pristine && this.protected)) {
|
|
2933
|
+
dirty = true;
|
|
2934
2934
|
}
|
|
2935
|
-
this.setDirty(
|
|
2936
|
-
return this.setComponentValidity(errors,
|
|
2935
|
+
this.setDirty(dirty);
|
|
2936
|
+
return this.setComponentValidity(errors, dirty, flags.silentCheck, flags.fromSubmission);
|
|
2937
2937
|
}
|
|
2938
2938
|
/**
|
|
2939
2939
|
* Perform a component validation.
|
|
@@ -822,22 +822,23 @@ export default class NestedComponent extends Field {
|
|
|
822
822
|
}
|
|
823
823
|
setNestedValue(component, value, flags = {}) {
|
|
824
824
|
component._data = this.componentContext(component);
|
|
825
|
+
let componentFlags = { ...flags };
|
|
825
826
|
if (component.type === 'button') {
|
|
826
827
|
return false;
|
|
827
828
|
}
|
|
828
829
|
if (component.type === 'components') {
|
|
829
830
|
if (component.tree && component.hasValue(value)) {
|
|
830
|
-
return component.setValue(_.get(value, component.key),
|
|
831
|
+
return component.setValue(_.get(value, component.key), componentFlags);
|
|
831
832
|
}
|
|
832
|
-
return component.setValue(value,
|
|
833
|
+
return component.setValue(value, componentFlags);
|
|
833
834
|
}
|
|
834
835
|
else if (value && component.hasValue(value)) {
|
|
835
|
-
return component.setValue(_.get(value, component.key),
|
|
836
|
+
return component.setValue(_.get(value, component.key), componentFlags);
|
|
836
837
|
}
|
|
837
838
|
else if ((!this.rootPristine || component.visible) && component.shouldAddDefaultValue) {
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
return component.setValue(component.defaultValue,
|
|
839
|
+
componentFlags.noValidate = !componentFlags.dirty;
|
|
840
|
+
componentFlags.resetValue = true;
|
|
841
|
+
return component.setValue(component.defaultValue, componentFlags);
|
|
841
842
|
}
|
|
842
843
|
}
|
|
843
844
|
setValue(value, flags = {}) {
|
|
@@ -973,6 +973,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
973
973
|
editRow.state === EditRowState.New ||
|
|
974
974
|
editRow.state === EditRowState.Editing ||
|
|
975
975
|
editRow.alerts ||
|
|
976
|
+
this.dirty ||
|
|
976
977
|
dirty;
|
|
977
978
|
}
|
|
978
979
|
validateRow(editRow, dirty, forceSilentCheck) {
|