@formio/js 5.1.0-dev.5983.aa8260f → 5.1.0-dev.5988.8d481cd

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.
Files changed (47) hide show
  1. package/dist/formio.form.js +13 -13
  2. package/dist/formio.form.min.js +1 -1
  3. package/dist/formio.full.js +16 -16
  4. package/dist/formio.full.min.js +1 -1
  5. package/dist/formio.js +1 -1
  6. package/dist/formio.min.js +1 -1
  7. package/lib/cjs/Form.js +3 -1
  8. package/lib/cjs/Webform.d.ts +4 -1
  9. package/lib/cjs/Webform.js +26 -13
  10. package/lib/cjs/Wizard.js +1 -1
  11. package/lib/cjs/components/Components.d.ts +3 -0
  12. package/lib/cjs/components/_classes/component/Component.js +11 -2
  13. package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  14. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +1 -1
  15. package/lib/cjs/components/_classes/component/editForm/utils.d.ts +1 -0
  16. package/lib/cjs/components/_classes/component/editForm/utils.js +3 -0
  17. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  18. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +3 -0
  19. package/lib/cjs/components/day/Day.js +7 -5
  20. package/lib/cjs/components/file/File.js +2 -1
  21. package/lib/cjs/components/form/Form.js +15 -5
  22. package/lib/cjs/components/form/editForm/Form.edit.data.js +1 -1
  23. package/lib/cjs/components/form/editForm/Form.edit.form.js +2 -2
  24. package/lib/cjs/components/select/editForm/Select.edit.data.js +2 -2
  25. package/lib/cjs/providers/storage/googleDrive.js +3 -2
  26. package/lib/cjs/widgets/CalendarWidget.js +0 -14
  27. package/lib/mjs/Form.js +3 -1
  28. package/lib/mjs/Webform.d.ts +4 -1
  29. package/lib/mjs/Webform.js +26 -13
  30. package/lib/mjs/Wizard.js +1 -1
  31. package/lib/mjs/components/Components.d.ts +3 -0
  32. package/lib/mjs/components/_classes/component/Component.js +11 -2
  33. package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  34. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +1 -1
  35. package/lib/mjs/components/_classes/component/editForm/utils.d.ts +1 -0
  36. package/lib/mjs/components/_classes/component/editForm/utils.js +3 -0
  37. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  38. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +3 -0
  39. package/lib/mjs/components/day/Day.js +7 -5
  40. package/lib/mjs/components/file/File.js +2 -1
  41. package/lib/mjs/components/form/Form.js +15 -5
  42. package/lib/mjs/components/form/editForm/Form.edit.data.js +1 -1
  43. package/lib/mjs/components/form/editForm/Form.edit.form.js +2 -2
  44. package/lib/mjs/components/select/editForm/Select.edit.data.js +2 -2
  45. package/lib/mjs/providers/storage/googleDrive.js +3 -2
  46. package/lib/mjs/widgets/CalendarWidget.js +0 -14
  47. package/package.json +1 -1
@@ -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 (component.maxDate && component.maxDate.indexOf('moment(') === -1) {
57
- component.maxDate = moment(component.maxDate, 'YYYY-MM-DD').toISOString();
58
- }
59
- if (component.minDate && component.minDate.indexOf('moment(') === -1) {
60
- component.minDate = moment(component.minDate, 'YYYY-MM-DD').toISOString();
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
- return this.fileService.downloadFile(fileInfo).then((result) => result.url);
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
- return this.submitSubForm(false)
584
- .then(() => {
585
- return this.dataValue;
586
- })
587
- .then(() => super.beforeSubmit());
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;
@@ -6,7 +6,7 @@ export default [
6
6
  {
7
7
  weight: 140,
8
8
  type: 'checkbox',
9
- label: 'Clear Value When Hidden',
9
+ label: 'Omit Value From Submission Data When Conditionally Hidden',
10
10
  key: 'clearOnHide',
11
11
  defaultValue: true,
12
12
  tooltip: 'When a field is hidden, clear the value.',
@@ -66,7 +66,7 @@ export default [
66
66
  input: true,
67
67
  weight: 20,
68
68
  key: 'reference',
69
- label: 'Save as reference',
70
- tooltip: 'Using this option will save this field as a reference and link its value to the value of the origin record.'
69
+ label: 'Submit as reference',
70
+ tooltip: 'When "Submit as reference" is enabled, the form submission will be recorded against the Parent Form as well as the Child Form. When a submission recorded with "Submit as reference" is edited, the update is applied to each submission made against the Parent Form and Child Form.'
71
71
  }
72
72
  ];
@@ -635,8 +635,8 @@ export default [
635
635
  input: true,
636
636
  weight: 25,
637
637
  key: 'reference',
638
- label: 'Save as reference',
639
- tooltip: 'Using this option will save this field as a reference and link its value to the value of the origin record.',
638
+ label: 'Submit as reference',
639
+ tooltip: 'Using this option will submit this field as a reference id and link its value to the value of the origin record.',
640
640
  conditional: {
641
641
  json: { '===': [{ var: 'data.dataSrc' }, 'resource'] },
642
642
  },
@@ -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', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.5983.aa8260f",
3
+ "version": "5.1.0-dev.5988.8d481cd",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {