@formio/js 5.1.0-dev.5984.de9f6d7 → 5.1.0-dev.5992.ff65eb8
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 +8 -8
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +8 -8
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- package/lib/cjs/Webform.js +10 -2
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/components/_classes/component/Component.js +1 -1
- package/lib/cjs/components/day/Day.js +7 -5
- package/lib/cjs/components/file/File.js +2 -1
- package/lib/cjs/components/form/Form.js +15 -5
- package/lib/cjs/providers/storage/googleDrive.js +3 -2
- package/lib/cjs/widgets/CalendarWidget.js +0 -14
- package/lib/mjs/Webform.js +10 -2
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/components/_classes/component/Component.js +1 -1
- package/lib/mjs/components/day/Day.js +7 -5
- package/lib/mjs/components/file/File.js +2 -1
- package/lib/mjs/components/form/Form.js +15 -5
- package/lib/mjs/providers/storage/googleDrive.js +3 -2
- package/lib/mjs/widgets/CalendarWidget.js +0 -14
- package/package.json +1 -1
package/lib/cjs/Webform.js
CHANGED
@@ -1530,7 +1530,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
1530
1530
|
}
|
1531
1531
|
}
|
1532
1532
|
triggerCaptcha() {
|
1533
|
-
if (!this || !this.components) {
|
1533
|
+
if (!this || !this.components || this.options.preview) {
|
1534
1534
|
return;
|
1535
1535
|
}
|
1536
1536
|
const captchaComponent = [];
|
@@ -1540,7 +1540,15 @@ class Webform extends NestedDataComponent_1.default {
|
|
1540
1540
|
}
|
1541
1541
|
});
|
1542
1542
|
if (captchaComponent.length > 0) {
|
1543
|
-
|
1543
|
+
if (this.parent) {
|
1544
|
+
this.parent.subFormReady.then(() => {
|
1545
|
+
captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
|
1546
|
+
});
|
1547
|
+
}
|
1548
|
+
else {
|
1549
|
+
captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
|
1550
|
+
}
|
1551
|
+
;
|
1544
1552
|
}
|
1545
1553
|
}
|
1546
1554
|
set nosubmit(value) {
|
package/lib/cjs/Wizard.js
CHANGED
@@ -667,7 +667,7 @@ class Wizard extends Webform_1.default {
|
|
667
667
|
return this.page - 1;
|
668
668
|
}
|
669
669
|
beforeSubmit() {
|
670
|
-
const pages = this.getPages();
|
670
|
+
const pages = this.getPages({ all: true });
|
671
671
|
return Promise.all(pages.map((page) => {
|
672
672
|
page.options.beforeSubmit = true;
|
673
673
|
return page.beforeSubmit();
|
@@ -1296,7 +1296,7 @@ class Component extends Element_1.default {
|
|
1296
1296
|
detach() {
|
1297
1297
|
// First iterate through each ref and delete the component so there are no dangling component references.
|
1298
1298
|
lodash_1.default.each(this.refs, (ref) => {
|
1299
|
-
if (
|
1299
|
+
if (ref instanceof NodeList) {
|
1300
1300
|
ref.forEach((elem) => {
|
1301
1301
|
delete elem.component;
|
1302
1302
|
});
|
@@ -53,11 +53,13 @@ class DayComponent extends Field_1.default {
|
|
53
53
|
return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.string];
|
54
54
|
}
|
55
55
|
constructor(component, options, data) {
|
56
|
-
if (
|
57
|
-
component.maxDate
|
58
|
-
|
59
|
-
|
60
|
-
component.minDate
|
56
|
+
if (!options.inFormBuilder && !options.building) {
|
57
|
+
if (component.maxDate && component.maxDate.indexOf('moment(') === -1) {
|
58
|
+
component.maxDate = (0, moment_1.default)(component.maxDate, 'YYYY-MM-DD').toISOString();
|
59
|
+
}
|
60
|
+
if (component.minDate && component.minDate.indexOf('moment(') === -1) {
|
61
|
+
component.minDate = (0, moment_1.default)(component.minDate, 'YYYY-MM-DD').toISOString();
|
62
|
+
}
|
61
63
|
}
|
62
64
|
super(component, options, data);
|
63
65
|
}
|
@@ -109,7 +109,8 @@ class FileComponent extends Field_1.default {
|
|
109
109
|
if (this.component.privateDownload) {
|
110
110
|
fileInfo.private = true;
|
111
111
|
}
|
112
|
-
|
112
|
+
// pass the component to the downloadFile method
|
113
|
+
return this.fileService.downloadFile(fileInfo, this.component).then((result) => result.url);
|
113
114
|
}
|
114
115
|
get emptyValue() {
|
115
116
|
return [];
|
@@ -587,11 +587,21 @@ class FormComponent extends Component_1.default {
|
|
587
587
|
this.dataValue = submission;
|
588
588
|
return Promise.resolve(this.dataValue);
|
589
589
|
}
|
590
|
-
|
591
|
-
.
|
592
|
-
|
593
|
-
|
594
|
-
|
590
|
+
if (this.isSubFormLazyLoad() && !this.subFormLoading) {
|
591
|
+
return this.createSubForm(true)
|
592
|
+
.then(this.submitSubForm(false))
|
593
|
+
.then(() => {
|
594
|
+
return this.dataValue;
|
595
|
+
})
|
596
|
+
.then(() => super.beforeSubmit());
|
597
|
+
}
|
598
|
+
else {
|
599
|
+
return this.submitSubForm(false)
|
600
|
+
.then(() => {
|
601
|
+
return this.dataValue;
|
602
|
+
})
|
603
|
+
.then(() => super.beforeSubmit());
|
604
|
+
}
|
595
605
|
}
|
596
606
|
isSubFormLazyLoad() {
|
597
607
|
var _a, _b;
|
@@ -52,10 +52,11 @@ function googledrive(formio) {
|
|
52
52
|
xhr.send(fd);
|
53
53
|
}));
|
54
54
|
},
|
55
|
-
downloadFile(file) {
|
55
|
+
downloadFile(file, component) {
|
56
56
|
const token = formio.getToken();
|
57
|
+
// Constructed the url with the fileId, fileName, displayImage, imageSize if applicable
|
57
58
|
file.url =
|
58
|
-
`${formio.formUrl}/storage/gdrive?fileId=${file.id}&fileName=${file.originalName}${token ? `&x-jwt-token=${token}` : ''}`;
|
59
|
+
`${formio.formUrl}/storage/gdrive?fileId=${file.id}&fileName=${file.originalName}${token ? `&x-jwt-token=${token}` : ''}${component.image ? '&displayImage=true' : ''}${component.imageSize ? `&imageSize=${component.imageSize}` : ''}`;
|
59
60
|
return Promise.resolve(file);
|
60
61
|
},
|
61
62
|
deleteFile: function deleteFile(fileInfo) {
|
@@ -93,8 +93,6 @@ class CalendarWidget extends InputWidget_1.default {
|
|
93
93
|
this.settings.disableWeekends ? this.settings.disable.push(this.disableWeekends) : '';
|
94
94
|
this.settings.disableWeekdays ? this.settings.disable.push(this.disableWeekdays) : '';
|
95
95
|
this.settings.disableFunction ? this.settings.disable.push(this.disableFunction) : '';
|
96
|
-
this.settings.wasDefaultValueChanged = false;
|
97
|
-
this.settings.defaultValue = '';
|
98
96
|
this.settings.manualInputValue = '';
|
99
97
|
this.settings.isManuallyOverriddenValue = false;
|
100
98
|
this.settings.currentValue = '';
|
@@ -115,10 +113,6 @@ class CalendarWidget extends InputWidget_1.default {
|
|
115
113
|
this.calendar._input.value = this.settings.isManuallyOverriddenValue ? this.settings.manualInputValue : this.calendar.altInput.value;
|
116
114
|
this.emit('update');
|
117
115
|
}
|
118
|
-
if (this.settings.wasDefaultValueChanged) {
|
119
|
-
this.calendar._input.value = this.settings.defaultValue;
|
120
|
-
this.settings.wasDefaultValueChanged = false;
|
121
|
-
}
|
122
116
|
if (this.calendar) {
|
123
117
|
this.emit('blur');
|
124
118
|
}
|
@@ -360,14 +354,6 @@ class CalendarWidget extends InputWidget_1.default {
|
|
360
354
|
this.settings.currentValue = event.target.value;
|
361
355
|
this.emit('update');
|
362
356
|
}
|
363
|
-
if (event.target.value === '' && this.calendar.selectedDates.length > 0) {
|
364
|
-
this.settings.wasDefaultValueChanged = true;
|
365
|
-
this.settings.defaultValue = event.target.value;
|
366
|
-
this.calendar.clear();
|
367
|
-
}
|
368
|
-
else {
|
369
|
-
this.settings.wasDefaultValueChanged = false;
|
370
|
-
}
|
371
357
|
});
|
372
358
|
if (this.calendar.daysContainer) {
|
373
359
|
this.calendar.daysContainer.addEventListener('click', () => {
|
package/lib/mjs/Webform.js
CHANGED
@@ -1530,7 +1530,7 @@ export default class Webform extends NestedDataComponent {
|
|
1530
1530
|
}
|
1531
1531
|
}
|
1532
1532
|
triggerCaptcha() {
|
1533
|
-
if (!this || !this.components) {
|
1533
|
+
if (!this || !this.components || this.options.preview) {
|
1534
1534
|
return;
|
1535
1535
|
}
|
1536
1536
|
const captchaComponent = [];
|
@@ -1540,7 +1540,15 @@ export default class Webform extends NestedDataComponent {
|
|
1540
1540
|
}
|
1541
1541
|
});
|
1542
1542
|
if (captchaComponent.length > 0) {
|
1543
|
-
|
1543
|
+
if (this.parent) {
|
1544
|
+
this.parent.subFormReady.then(() => {
|
1545
|
+
captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
|
1546
|
+
});
|
1547
|
+
}
|
1548
|
+
else {
|
1549
|
+
captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
|
1550
|
+
}
|
1551
|
+
;
|
1544
1552
|
}
|
1545
1553
|
}
|
1546
1554
|
set nosubmit(value) {
|
package/lib/mjs/Wizard.js
CHANGED
@@ -657,7 +657,7 @@ export default class Wizard extends Webform {
|
|
657
657
|
return this.page - 1;
|
658
658
|
}
|
659
659
|
beforeSubmit() {
|
660
|
-
const pages = this.getPages();
|
660
|
+
const pages = this.getPages({ all: true });
|
661
661
|
return Promise.all(pages.map((page) => {
|
662
662
|
page.options.beforeSubmit = true;
|
663
663
|
return page.beforeSubmit();
|
@@ -1264,7 +1264,7 @@ export default class Component extends Element {
|
|
1264
1264
|
detach() {
|
1265
1265
|
// First iterate through each ref and delete the component so there are no dangling component references.
|
1266
1266
|
_.each(this.refs, (ref) => {
|
1267
|
-
if (
|
1267
|
+
if (ref instanceof NodeList) {
|
1268
1268
|
ref.forEach((elem) => {
|
1269
1269
|
delete elem.component;
|
1270
1270
|
});
|
@@ -53,11 +53,13 @@ export default class DayComponent extends Field {
|
|
53
53
|
// Empty value used before 9.3.x
|
54
54
|
static oldEmptyValue = '00/00/0000';
|
55
55
|
constructor(component, options, data) {
|
56
|
-
if (
|
57
|
-
component.maxDate
|
58
|
-
|
59
|
-
|
60
|
-
component.minDate
|
56
|
+
if (!options.inFormBuilder && !options.building) {
|
57
|
+
if (component.maxDate && component.maxDate.indexOf('moment(') === -1) {
|
58
|
+
component.maxDate = moment(component.maxDate, 'YYYY-MM-DD').toISOString();
|
59
|
+
}
|
60
|
+
if (component.minDate && component.minDate.indexOf('moment(') === -1) {
|
61
|
+
component.minDate = moment(component.minDate, 'YYYY-MM-DD').toISOString();
|
62
|
+
}
|
61
63
|
}
|
62
64
|
super(component, options, data);
|
63
65
|
}
|
@@ -98,7 +98,8 @@ export default class FileComponent extends Field {
|
|
98
98
|
if (this.component.privateDownload) {
|
99
99
|
fileInfo.private = true;
|
100
100
|
}
|
101
|
-
|
101
|
+
// pass the component to the downloadFile method
|
102
|
+
return this.fileService.downloadFile(fileInfo, this.component).then((result) => result.url);
|
102
103
|
}
|
103
104
|
get emptyValue() {
|
104
105
|
return [];
|
@@ -580,11 +580,21 @@ export default class FormComponent extends Component {
|
|
580
580
|
this.dataValue = submission;
|
581
581
|
return Promise.resolve(this.dataValue);
|
582
582
|
}
|
583
|
-
|
584
|
-
.
|
585
|
-
|
586
|
-
|
587
|
-
|
583
|
+
if (this.isSubFormLazyLoad() && !this.subFormLoading) {
|
584
|
+
return this.createSubForm(true)
|
585
|
+
.then(this.submitSubForm(false))
|
586
|
+
.then(() => {
|
587
|
+
return this.dataValue;
|
588
|
+
})
|
589
|
+
.then(() => super.beforeSubmit());
|
590
|
+
}
|
591
|
+
else {
|
592
|
+
return this.submitSubForm(false)
|
593
|
+
.then(() => {
|
594
|
+
return this.dataValue;
|
595
|
+
})
|
596
|
+
.then(() => super.beforeSubmit());
|
597
|
+
}
|
588
598
|
}
|
589
599
|
isSubFormLazyLoad() {
|
590
600
|
return this.root?._form?.display === 'wizard' && this.component.lazyLoad;
|
@@ -50,10 +50,11 @@ function googledrive(formio) {
|
|
50
50
|
xhr.send(fd);
|
51
51
|
}));
|
52
52
|
},
|
53
|
-
downloadFile(file) {
|
53
|
+
downloadFile(file, component) {
|
54
54
|
const token = formio.getToken();
|
55
|
+
// Constructed the url with the fileId, fileName, displayImage, imageSize if applicable
|
55
56
|
file.url =
|
56
|
-
`${formio.formUrl}/storage/gdrive?fileId=${file.id}&fileName=${file.originalName}${token ? `&x-jwt-token=${token}` : ''}`;
|
57
|
+
`${formio.formUrl}/storage/gdrive?fileId=${file.id}&fileName=${file.originalName}${token ? `&x-jwt-token=${token}` : ''}${component.image ? '&displayImage=true' : ''}${component.imageSize ? `&imageSize=${component.imageSize}` : ''}`;
|
57
58
|
return Promise.resolve(file);
|
58
59
|
},
|
59
60
|
deleteFile: function deleteFile(fileInfo) {
|
@@ -87,8 +87,6 @@ export default class CalendarWidget extends InputWidget {
|
|
87
87
|
this.settings.disableWeekends ? this.settings.disable.push(this.disableWeekends) : '';
|
88
88
|
this.settings.disableWeekdays ? this.settings.disable.push(this.disableWeekdays) : '';
|
89
89
|
this.settings.disableFunction ? this.settings.disable.push(this.disableFunction) : '';
|
90
|
-
this.settings.wasDefaultValueChanged = false;
|
91
|
-
this.settings.defaultValue = '';
|
92
90
|
this.settings.manualInputValue = '';
|
93
91
|
this.settings.isManuallyOverriddenValue = false;
|
94
92
|
this.settings.currentValue = '';
|
@@ -109,10 +107,6 @@ export default class CalendarWidget extends InputWidget {
|
|
109
107
|
this.calendar._input.value = this.settings.isManuallyOverriddenValue ? this.settings.manualInputValue : this.calendar.altInput.value;
|
110
108
|
this.emit('update');
|
111
109
|
}
|
112
|
-
if (this.settings.wasDefaultValueChanged) {
|
113
|
-
this.calendar._input.value = this.settings.defaultValue;
|
114
|
-
this.settings.wasDefaultValueChanged = false;
|
115
|
-
}
|
116
110
|
if (this.calendar) {
|
117
111
|
this.emit('blur');
|
118
112
|
}
|
@@ -351,14 +345,6 @@ export default class CalendarWidget extends InputWidget {
|
|
351
345
|
this.settings.currentValue = event.target.value;
|
352
346
|
this.emit('update');
|
353
347
|
}
|
354
|
-
if (event.target.value === '' && this.calendar.selectedDates.length > 0) {
|
355
|
-
this.settings.wasDefaultValueChanged = true;
|
356
|
-
this.settings.defaultValue = event.target.value;
|
357
|
-
this.calendar.clear();
|
358
|
-
}
|
359
|
-
else {
|
360
|
-
this.settings.wasDefaultValueChanged = false;
|
361
|
-
}
|
362
348
|
});
|
363
349
|
if (this.calendar.daysContainer) {
|
364
350
|
this.calendar.daysContainer.addEventListener('click', () => {
|