@formio/js 5.0.0-rc.41 → 5.0.0-rc.42

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 (40) hide show
  1. package/dist/formio.builder.css +2 -2
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.embed.js +1 -1
  4. package/dist/formio.embed.min.js +1 -1
  5. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  6. package/dist/formio.form.css +2 -2
  7. package/dist/formio.form.js +64 -31
  8. package/dist/formio.form.min.css +1 -1
  9. package/dist/formio.form.min.js +1 -1
  10. package/dist/formio.form.min.js.LICENSE.txt +5 -5
  11. package/dist/formio.full.css +2 -2
  12. package/dist/formio.full.js +65 -32
  13. package/dist/formio.full.min.css +1 -1
  14. package/dist/formio.full.min.js +1 -1
  15. package/dist/formio.full.min.js.LICENSE.txt +5 -5
  16. package/dist/formio.js +3 -3
  17. package/dist/formio.min.js +1 -1
  18. package/dist/formio.min.js.LICENSE.txt +1 -1
  19. package/dist/formio.utils.js +3 -3
  20. package/dist/formio.utils.min.js +1 -1
  21. package/dist/formio.utils.min.js.LICENSE.txt +3 -3
  22. package/lib/cjs/Form.js +32 -1
  23. package/lib/cjs/Webform.js +1 -1
  24. package/lib/cjs/WebformBuilder.js +18 -2
  25. package/lib/cjs/components/datagrid/DataGrid.js +1 -1
  26. package/lib/cjs/components/datetime/fixtures/comp13.js +118 -0
  27. package/lib/cjs/components/datetime/fixtures/index.js +3 -1
  28. package/lib/cjs/components/form/Form.js +27 -3
  29. package/lib/cjs/components/radio/Radio.js +13 -0
  30. package/lib/cjs/widgets/CalendarWidget.js +8 -0
  31. package/lib/mjs/Form.js +32 -1
  32. package/lib/mjs/Webform.js +1 -1
  33. package/lib/mjs/WebformBuilder.js +17 -1
  34. package/lib/mjs/components/datagrid/DataGrid.js +1 -1
  35. package/lib/mjs/components/datetime/fixtures/comp13.js +116 -0
  36. package/lib/mjs/components/datetime/fixtures/index.js +2 -1
  37. package/lib/mjs/components/form/Form.js +25 -2
  38. package/lib/mjs/components/radio/Radio.js +16 -0
  39. package/lib/mjs/widgets/CalendarWidget.js +8 -0
  40. package/package.json +6 -6
@@ -1,3 +1,4 @@
1
+ /* eslint-disable max-statements */
1
2
  import _ from 'lodash';
2
3
  import Component from '../_classes/component/Component';
3
4
  import ComponentModal from '../_classes/componentModal/ComponentModal';
@@ -191,6 +192,12 @@ export default class FormComponent extends Component {
191
192
  if (this.options.inEditGrid) {
192
193
  options.inEditGrid = this.options.inEditGrid;
193
194
  }
195
+ if (this.options.saveDraft) {
196
+ options.saveDraft = this.options.saveDraft;
197
+ }
198
+ if (this.options.saveDraftThrottle) {
199
+ options.saveDraftThrottle = this.options.saveDraftThrottle;
200
+ }
194
201
  return options;
195
202
  }
196
203
  render() {
@@ -392,6 +399,10 @@ export default class FormComponent extends Component {
392
399
  this.subForm.nosubmit = true;
393
400
  this.subForm.root = this.root;
394
401
  this.subForm.localRoot = this.isNestedWizard ? this.localRoot : this.subForm;
402
+ if (this.parent) {
403
+ this.subForm.draftEnabled = this.parent.draftEnabled;
404
+ this.subForm.savingDraft = this.parent.savingDraft;
405
+ }
395
406
  this.restoreValue();
396
407
  this.valueChanged = this.hasSetValue;
397
408
  this.onChange();
@@ -427,7 +438,13 @@ export default class FormComponent extends Component {
427
438
  }
428
439
  else if (this.formSrc) {
429
440
  this.subFormLoading = true;
430
- return (new Formio(this.formSrc)).loadForm({ params: { live: 1 } })
441
+ const options = this.root.formio?.base && this.root.formio?.projectUrl
442
+ ? {
443
+ base: this.root.formio.base,
444
+ project: this.root.formio.projectUrl,
445
+ }
446
+ : {};
447
+ return (new Formio(this.formSrc, options)).loadForm({ params: { live: 1 } })
431
448
  .then((formObj) => {
432
449
  this.formObj = formObj;
433
450
  if (this.options.pdf && this.component.useOriginalRevision) {
@@ -599,7 +616,13 @@ export default class FormComponent extends Component {
599
616
  if (shouldLoadSubmissionById) {
600
617
  const formId = submission.form || this.formObj.form || this.component.form;
601
618
  const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id}`;
602
- this.subForm.setUrl(submissionUrl, this.options);
619
+ const options = this.root.formio?.base && this.root.formio?.projectUrl
620
+ ? {
621
+ base: this.root.formio.base,
622
+ project: this.root.formio.projectUrl,
623
+ }
624
+ : {};
625
+ this.subForm.setUrl(submissionUrl, { ...this.options, ...options });
603
626
  this.subForm.loadSubmission().catch((err) => {
604
627
  console.error(`Unable to load subform submission ${submission._id}:`, err);
605
628
  });
@@ -44,6 +44,22 @@ export default class RadioComponent extends ListComponent {
44
44
  }
45
45
  };
46
46
  }
47
+ static get serverConditionSettings() {
48
+ return {
49
+ ...super.serverConditionSettings,
50
+ valueComponent(classComp) {
51
+ return {
52
+ type: 'select',
53
+ dataSrc: 'custom',
54
+ valueProperty: 'value',
55
+ dataType: classComp.dataType || '',
56
+ data: {
57
+ custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`,
58
+ },
59
+ };
60
+ },
61
+ };
62
+ }
47
63
  static savedValueTypes(schema) {
48
64
  const { boolean, string, number, object, array } = componentValueTypes;
49
65
  const { dataType } = schema;
@@ -409,6 +409,14 @@ export default class CalendarWidget extends InputWidget {
409
409
  }
410
410
  }
411
411
  });
412
+ // If other fields are used to calculate disabled dates, we need to redraw calendar to refresh disabled dates
413
+ if (this.settings.disableFunction && this.componentInstance && this.componentInstance.root) {
414
+ this.componentInstance.root.on('change', (e) => {
415
+ if (e.changed && this.calendar) {
416
+ this.calendar.redraw();
417
+ }
418
+ });
419
+ }
412
420
  // Restore the calendar value from the component value.
413
421
  this.setValue(this.componentValue);
414
422
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.41",
3
+ "version": "5.0.0-rc.42",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -84,9 +84,9 @@
84
84
  },
85
85
  "homepage": "https://github.com/formio/formio.js#readme",
86
86
  "dependencies": {
87
- "@formio/bootstrap": "^3.0.0-rc.21",
87
+ "@formio/bootstrap": "^3.0.0-rc.22",
88
88
  "@formio/choices.js": "^10.2.1",
89
- "@formio/core": "^2.0.0-rc.18",
89
+ "@formio/core": "^2.0.0-tt.dev-882e7ea",
90
90
  "@formio/text-mask-addons": "^3.8.0-formio.2",
91
91
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
92
92
  "abortcontroller-polyfill": "^1.7.5",
@@ -114,17 +114,17 @@
114
114
  "lodash": "^4.17.21",
115
115
  "moment": "^2.29.4",
116
116
  "moment-timezone": "^0.5.44",
117
- "quill": "^2.0.0-dev.3",
117
+ "quill": "^2.0.0-rc.4",
118
118
  "signature_pad": "^4.2.0",
119
119
  "string-hash": "^1.1.3",
120
120
  "tippy.js": "^6.3.7",
121
121
  "uuid": "^9.0.0",
122
- "vanilla-picker": "^2.12.2"
122
+ "vanilla-picker": "^2.12.3"
123
123
  },
124
124
  "devDependencies": {
125
125
  "@typescript-eslint/eslint-plugin": "^7.3.0",
126
126
  "@typescript-eslint/parser": "^7.3.0",
127
- "ace-builds": "1.32.7",
127
+ "ace-builds": "1.32.9",
128
128
  "async-limiter": "^2.0.0",
129
129
  "bootstrap-icons": "^1.10.5",
130
130
  "bootswatch": "^5.3.3",