@formio/js 5.0.0-rc.34 → 5.0.0-rc.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/dist/fonts/bootstrap-icons.woff +0 -0
  2. package/dist/fonts/bootstrap-icons.woff2 +0 -0
  3. package/dist/formio.builder.css +19 -15
  4. package/dist/formio.builder.min.css +1 -1
  5. package/dist/formio.embed.js +1 -1
  6. package/dist/formio.embed.min.js +1 -1
  7. package/dist/formio.form.css +19 -15
  8. package/dist/formio.form.js +19 -19
  9. package/dist/formio.form.min.css +1 -1
  10. package/dist/formio.form.min.js +1 -1
  11. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  12. package/dist/formio.full.css +363 -19
  13. package/dist/formio.full.js +20 -20
  14. package/dist/formio.full.min.css +3 -3
  15. package/dist/formio.full.min.js +1 -1
  16. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  17. package/dist/formio.js +8 -8
  18. package/dist/formio.min.js +1 -1
  19. package/lib/cjs/CDN.js +12 -6
  20. package/lib/cjs/Webform.js +4 -1
  21. package/lib/cjs/Wizard.js +6 -9
  22. package/lib/cjs/components/_classes/component/Component.js +6 -1
  23. package/lib/cjs/components/_classes/nested/NestedComponent.js +1 -1
  24. package/lib/cjs/components/container/fixtures/comp4.js +45 -0
  25. package/lib/cjs/components/container/fixtures/index.js +3 -1
  26. package/lib/cjs/components/datetime/DateTime.js +6 -0
  27. package/lib/cjs/components/file/File.js +465 -215
  28. package/lib/cjs/components/file/editForm/File.edit.display.js +17 -0
  29. package/lib/cjs/components/textarea/TextArea.js +2 -2
  30. package/lib/cjs/components/textfield/TextField.js +3 -1
  31. package/lib/cjs/components/time/Time.js +3 -0
  32. package/lib/cjs/providers/storage/azure.js +6 -1
  33. package/lib/cjs/providers/storage/base64.js +1 -1
  34. package/lib/cjs/providers/storage/googleDrive.js +5 -1
  35. package/lib/cjs/providers/storage/indexeddb.js +1 -1
  36. package/lib/cjs/providers/storage/s3.js +5 -1
  37. package/lib/cjs/providers/storage/xhr.js +10 -0
  38. package/lib/mjs/CDN.js +12 -6
  39. package/lib/mjs/Webform.js +4 -1
  40. package/lib/mjs/Wizard.js +6 -9
  41. package/lib/mjs/components/_classes/component/Component.js +6 -1
  42. package/lib/mjs/components/_classes/nested/NestedComponent.js +1 -1
  43. package/lib/mjs/components/container/fixtures/comp4.js +43 -0
  44. package/lib/mjs/components/container/fixtures/index.js +2 -1
  45. package/lib/mjs/components/datetime/DateTime.js +6 -0
  46. package/lib/mjs/components/file/File.js +463 -224
  47. package/lib/mjs/components/file/editForm/File.edit.display.js +17 -0
  48. package/lib/mjs/components/textarea/TextArea.js +2 -2
  49. package/lib/mjs/components/textfield/TextField.js +6 -0
  50. package/lib/mjs/components/time/Time.js +3 -0
  51. package/lib/mjs/providers/storage/azure.js +6 -1
  52. package/lib/mjs/providers/storage/base64.js +1 -1
  53. package/lib/mjs/providers/storage/googleDrive.js +5 -1
  54. package/lib/mjs/providers/storage/indexeddb.js +1 -1
  55. package/lib/mjs/providers/storage/s3.js +5 -1
  56. package/lib/mjs/providers/storage/xhr.js +10 -0
  57. package/package.json +2 -2
package/lib/cjs/CDN.js CHANGED
@@ -57,19 +57,25 @@ class CDN {
57
57
  this.updateUrls();
58
58
  }
59
59
  buildUrl(cdnUrl, lib, version) {
60
- let url;
61
- if (version === 'latest' || version === '') {
62
- url = `${cdnUrl}/${lib}`;
60
+ let url = cdnUrl;
61
+ if (lib) {
62
+ url += `/${lib}`;
63
63
  }
64
- else {
65
- url = `${cdnUrl}/${lib}/${version}`;
64
+ if (version && version !== 'latest') {
65
+ url += `/${version}`;
66
66
  }
67
67
  return url;
68
68
  }
69
69
  updateUrls() {
70
70
  for (const lib in this.libs) {
71
71
  if (lib in this.overrides) {
72
- this[lib] = this.buildUrl(this.overrides[lib], lib, this.libs[lib]);
72
+ if (typeof this.overrides[lib] === 'string') {
73
+ this[lib] = this.buildUrl(this.overrides[lib], lib, this.libs[lib]);
74
+ }
75
+ else {
76
+ const override = this.overrides[lib];
77
+ this[lib] = this.buildUrl(override.cdn, override.lib || '', override.version || '');
78
+ }
73
79
  }
74
80
  else {
75
81
  this[lib] = this.buildUrl(this.baseUrl, lib, this.libs[lib]);
@@ -778,7 +778,10 @@ class Webform extends NestedDataComponent_1.default {
778
778
  this.component.input = false;
779
779
  this.addComponents();
780
780
  this.on('submitButton', options => {
781
- this.submit(false, options).catch(e => e !== false && e !== undefined && console.log(e));
781
+ this.submit(false, options).catch(e => {
782
+ options.instance.loading = false;
783
+ return e !== false && e !== undefined && console.log(e);
784
+ });
782
785
  }, true);
783
786
  this.on('checkValidity', (data) => this.validate(data, { dirty: true, process: 'change' }), true);
784
787
  this.on('requestUrl', (args) => (this.submitUrl(args.url, args.headers)), true);
package/lib/cjs/Wizard.js CHANGED
@@ -788,21 +788,18 @@ class Wizard extends Webform_1.default {
788
788
  }
789
789
  }
790
790
  setValue(submission, flags = {}, ignoreEstablishment) {
791
- this._submission = submission;
792
- if ((flags && flags.fromSubmission && (this.options.readOnly || this.editMode) && !this.isHtmlRenderMode()) ||
793
- (flags && flags.fromSubmission && (this.prefixComps.length || this.suffixComps.length) && submission._id) ||
794
- (this.options.server && (this.prefixComps.length || this.suffixComps.length))) {
795
- this._data = submission.data;
796
- }
797
- if (!ignoreEstablishment) {
798
- this.establishPages(submission.data);
799
- }
800
791
  const changed = this.getPages({ all: true }).reduce((changed, page) => {
801
792
  return this.setNestedValue(page, submission.data, flags, changed) || changed;
802
793
  }, false);
794
+ this.mergeData(this.data, submission.data);
803
795
  if (changed) {
804
796
  this.pageFieldLogic(this.page);
805
797
  }
798
+ submission.data = this.data;
799
+ this._submission = submission;
800
+ if (!ignoreEstablishment) {
801
+ this.establishPages(submission.data);
802
+ }
806
803
  this.setEditMode(submission);
807
804
  return changed;
808
805
  }
@@ -201,7 +201,12 @@ class Component extends Element_1.default {
201
201
  return {
202
202
  operators: ['isEqual', 'isNotEqual', 'isEmpty', 'isNotEmpty'],
203
203
  valueComponent() {
204
- return { type: 'textfield' };
204
+ return {
205
+ type: 'textfield',
206
+ widget: {
207
+ type: 'input'
208
+ }
209
+ };
205
210
  }
206
211
  };
207
212
  }
@@ -524,7 +524,7 @@ class NestedComponent extends Field_1.default {
524
524
  clearOnHide(show) {
525
525
  super.clearOnHide(show);
526
526
  if (this.component.clearOnHide) {
527
- if (this.allowData && !this.hasValue()) {
527
+ if (this.allowData && !this.hasValue() && !(this.options.server && !this.visible)) {
528
528
  this.dataValue = this.defaultValue;
529
529
  }
530
530
  if (this.hasValue()) {
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ type: 'form',
5
+ display: 'form',
6
+ components: [
7
+ {
8
+ label: 'Checkbox',
9
+ tableView: false,
10
+ key: 'checkbox',
11
+ type: 'checkbox',
12
+ input: true,
13
+ },
14
+ {
15
+ label: 'Container',
16
+ tableView: false,
17
+ key: 'container',
18
+ conditional: {
19
+ show: true,
20
+ when: 'checkbox',
21
+ eq: 'true',
22
+ },
23
+ type: 'container',
24
+ input: true,
25
+ components: [
26
+ {
27
+ label: 'Text Field',
28
+ applyMaskOn: 'change',
29
+ tableView: true,
30
+ key: 'textField',
31
+ type: 'textfield',
32
+ input: true,
33
+ },
34
+ ],
35
+ },
36
+ {
37
+ type: 'button',
38
+ label: 'Submit',
39
+ key: 'submit',
40
+ disableOnInvalid: true,
41
+ input: true,
42
+ tableView: false,
43
+ },
44
+ ],
45
+ };
@@ -3,10 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
7
7
  const comp1_1 = __importDefault(require("./comp1"));
8
8
  exports.comp1 = comp1_1.default;
9
9
  const comp2_1 = __importDefault(require("./comp2"));
10
10
  exports.comp2 = comp2_1.default;
11
11
  const comp3_1 = __importDefault(require("./comp3"));
12
12
  exports.comp3 = comp3_1.default;
13
+ const comp4_1 = __importDefault(require("./comp4"));
14
+ exports.comp4 = comp4_1.default;
@@ -154,8 +154,14 @@ class DateTimeComponent extends Input_1.default {
154
154
  format += format.match(/z$/) ? '' : ' z';
155
155
  const timezone = this.timezone;
156
156
  if (value && !this.attached && timezone) {
157
+ if (Array.isArray(value) && this.component.multiple) {
158
+ return value.map(item => lodash_1.default.trim(utils_1.default.momentDate(item, format, timezone).format(format))).join(', ');
159
+ }
157
160
  return lodash_1.default.trim(utils_1.default.momentDate(value, format, timezone).format(format));
158
161
  }
162
+ if (Array.isArray(value) && this.component.multiple) {
163
+ return value.map(item => lodash_1.default.trim((0, moment_1.default)(item).format(format))).join(', ');
164
+ }
159
165
  return (value ? lodash_1.default.trim((0, moment_1.default)(value).format(format)) : value) || '';
160
166
  }
161
167
  }