@formio/js 5.0.0-dev.5634.e1468ca → 5.0.0-dev.5639.43f7313
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 +2 -2
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +3 -3
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/Webform.js +2 -1
- package/lib/cjs/WebformBuilder.js +1 -6
- package/lib/cjs/components/form/Form.js +3 -2
- package/lib/mjs/Webform.js +2 -1
- package/lib/mjs/WebformBuilder.js +1 -6
- package/lib/mjs/components/form/Form.js +3 -2
- package/package.json +1 -1
package/lib/cjs/Webform.js
CHANGED
|
@@ -787,7 +787,8 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
787
787
|
formio.loadSubmissions({
|
|
788
788
|
params: {
|
|
789
789
|
state: 'draft',
|
|
790
|
-
owner: userId
|
|
790
|
+
owner: userId,
|
|
791
|
+
sort: '-created'
|
|
791
792
|
}
|
|
792
793
|
}).then(submissions => {
|
|
793
794
|
if (submissions.length > 0 && !this.options.skipDraftRestore) {
|
|
@@ -987,12 +987,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
987
987
|
parent.formioComponent.removeChildComponent(component);
|
|
988
988
|
}
|
|
989
989
|
if (component.input && componentInstance && componentInstance.parent) {
|
|
990
|
-
|
|
991
|
-
parent.formioComponent.component.defaultValue.forEach(v => lodash_1.default.unset(v, componentInstance.key));
|
|
992
|
-
}
|
|
993
|
-
else if (typeof parent.formioComponent.component.defaultValue === 'object') {
|
|
994
|
-
lodash_1.default.unset(parent.formioComponent.component.defaultValue, componentInstance.key);
|
|
995
|
-
}
|
|
990
|
+
lodash_1.default.unset(componentInstance._data, componentInstance.key);
|
|
996
991
|
}
|
|
997
992
|
const rebuild = parent.formioComponent.rebuild() || Promise.resolve();
|
|
998
993
|
rebuild.then(() => {
|
|
@@ -630,9 +630,10 @@ class FormComponent extends Component_1.default {
|
|
|
630
630
|
&& submission._id
|
|
631
631
|
&& this.subForm.formio
|
|
632
632
|
&& lodash_1.default.isEmpty(submission.data);
|
|
633
|
-
|
|
633
|
+
const shouldLoadDraftById = this.options.saveDraft && lodash_1.default.isEmpty(submission.data) && lodash_1.default.get(this.subForm, 'submission._id');
|
|
634
|
+
if (shouldLoadSubmissionById || shouldLoadDraftById) {
|
|
634
635
|
const formId = submission.form || this.formObj.form || this.component.form;
|
|
635
|
-
const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id}`;
|
|
636
|
+
const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id || this.subForm.submission._id}`;
|
|
636
637
|
const options = ((_a = this.root.formio) === null || _a === void 0 ? void 0 : _a.base) && ((_b = this.root.formio) === null || _b === void 0 ? void 0 : _b.projectUrl)
|
|
637
638
|
? {
|
|
638
639
|
base: this.root.formio.base,
|
package/lib/mjs/Webform.js
CHANGED
|
@@ -791,7 +791,8 @@ export default class Webform extends NestedDataComponent {
|
|
|
791
791
|
formio.loadSubmissions({
|
|
792
792
|
params: {
|
|
793
793
|
state: 'draft',
|
|
794
|
-
owner: userId
|
|
794
|
+
owner: userId,
|
|
795
|
+
sort: '-created'
|
|
795
796
|
}
|
|
796
797
|
}).then(submissions => {
|
|
797
798
|
if (submissions.length > 0 && !this.options.skipDraftRestore) {
|
|
@@ -971,12 +971,7 @@ export default class WebformBuilder extends Component {
|
|
|
971
971
|
parent.formioComponent.removeChildComponent(component);
|
|
972
972
|
}
|
|
973
973
|
if (component.input && componentInstance && componentInstance.parent) {
|
|
974
|
-
|
|
975
|
-
parent.formioComponent.component.defaultValue.forEach(v => _.unset(v, componentInstance.key));
|
|
976
|
-
}
|
|
977
|
-
else if (typeof parent.formioComponent.component.defaultValue === 'object') {
|
|
978
|
-
_.unset(parent.formioComponent.component.defaultValue, componentInstance.key);
|
|
979
|
-
}
|
|
974
|
+
_.unset(componentInstance._data, componentInstance.key);
|
|
980
975
|
}
|
|
981
976
|
const rebuild = parent.formioComponent.rebuild() || Promise.resolve();
|
|
982
977
|
rebuild.then(() => {
|
|
@@ -620,9 +620,10 @@ export default class FormComponent extends Component {
|
|
|
620
620
|
&& submission._id
|
|
621
621
|
&& this.subForm.formio
|
|
622
622
|
&& _.isEmpty(submission.data);
|
|
623
|
-
|
|
623
|
+
const shouldLoadDraftById = this.options.saveDraft && _.isEmpty(submission.data) && _.get(this.subForm, 'submission._id');
|
|
624
|
+
if (shouldLoadSubmissionById || shouldLoadDraftById) {
|
|
624
625
|
const formId = submission.form || this.formObj.form || this.component.form;
|
|
625
|
-
const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id}`;
|
|
626
|
+
const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id || this.subForm.submission._id}`;
|
|
626
627
|
const options = this.root.formio?.base && this.root.formio?.projectUrl
|
|
627
628
|
? {
|
|
628
629
|
base: this.root.formio.base,
|