@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
@@ -3,4 +3,21 @@ export default [
3
3
  key: 'placeholder',
4
4
  ignore: true
5
5
  },
6
+ {
7
+ type: 'checkbox',
8
+ label: 'Files Synchronization feature',
9
+ tooltip: 'Enable ability to control files synchronization. Files will be auto synced before submit.',
10
+ key: 'autoSync',
11
+ input: true,
12
+ conditional: {
13
+ json: {
14
+ in: [
15
+ {
16
+ var: 'data.storage'
17
+ },
18
+ ['s3', 'azure', 'googledrive']
19
+ ],
20
+ }
21
+ }
22
+ },
6
23
  ];
@@ -293,10 +293,10 @@ export default class TextAreaComponent extends TextFieldComponent {
293
293
  if (this.options.readOnly || this.disabled) {
294
294
  if (this.refs.input && this.refs.input[index]) {
295
295
  if (this.component.inputFormat === 'plain') {
296
- this.refs.input[index].innerText = this.interpolate(value, {}, { noeval: true });
296
+ this.refs.input[index].innerText = this.isPlain ? value : this.interpolate(value, {}, { noeval: true });
297
297
  }
298
298
  else {
299
- this.setContent(this.refs.input[index], this.interpolate(value, {}, { noeval: true }), this.shouldSanitizeValue);
299
+ this.setContent(this.refs.input[index], this.isPlain ? value : this.interpolate(value, {}, { noeval: true }), this.shouldSanitizeValue);
300
300
  }
301
301
  }
302
302
  }
@@ -40,6 +40,12 @@ export default class TextFieldComponent extends Input {
40
40
  return {
41
41
  ...super.conditionOperatorsSettings,
42
42
  operators: [...super.conditionOperatorsSettings.operators, 'includes', 'notIncludes', 'endsWith', 'startsWith'],
43
+ valueComponent(classComp) {
44
+ return {
45
+ ...classComp,
46
+ type: 'textfield',
47
+ };
48
+ }
43
49
  };
44
50
  }
45
51
  static savedValueTypes(schema) {
@@ -126,6 +126,9 @@ export default class TimeComponent extends TextFieldComponent {
126
126
  return view ? moment(view, this.component.format).format(this.component.dataFormat) : view;
127
127
  }
128
128
  getValueAsString(value) {
129
+ if (Array.isArray(value) && this.component.multiple) {
130
+ return value.map(item => moment(item, this.component.dataFormat).format(this.component.format)).join(', ');
131
+ }
129
132
  return (value ? moment(value, this.component.dataFormat).format(this.component.format) : value) || '';
130
133
  }
131
134
  getInputMaskFromFormat(format) {
@@ -7,7 +7,7 @@ function azure(formio) {
7
7
  xhr.setRequestHeader('Content-Type', file.type);
8
8
  xhr.setRequestHeader('x-ms-blob-type', 'BlockBlob');
9
9
  return file;
10
- }, file, fileName, dir, progressCallback, groupPermissions, groupId, abortCallback).then(() => {
10
+ }, file, fileName, dir, progressCallback, groupPermissions, groupId, abortCallback).then((response) => {
11
11
  return {
12
12
  storage: 'azure',
13
13
  name: XHR.path([dir, fileName]),
@@ -15,11 +15,16 @@ function azure(formio) {
15
15
  type: file.type,
16
16
  groupPermissions,
17
17
  groupId,
18
+ key: response.key,
18
19
  };
19
20
  });
20
21
  },
21
22
  downloadFile(file) {
22
23
  return formio.makeRequest('file', `${formio.formUrl}/storage/azure?name=${XHR.trim(file.name)}`, 'GET');
24
+ },
25
+ deleteFile: function deleteFile(fileInfo) {
26
+ var url = `${formio.formUrl}/storage/azure?name=${XHR.trim(fileInfo.name)}&key=${XHR.trim(fileInfo.key)}`;
27
+ return formio.makeRequest('', url, 'delete');
23
28
  }
24
29
  };
25
30
  }
@@ -24,7 +24,7 @@ function base64() {
24
24
  downloadFile(file) {
25
25
  // Return the original as there is nothing to do.
26
26
  return Promise.resolve(file);
27
- }
27
+ },
28
28
  };
29
29
  }
30
30
  base64.title = 'Base64';
@@ -49,7 +49,11 @@ function googledrive(formio) {
49
49
  file.url =
50
50
  `${formio.formUrl}/storage/gdrive?fileId=${file.id}&fileName=${file.originalName}${token ? `&x-jwt-token=${token}` : ''}`;
51
51
  return Promise.resolve(file);
52
- }
52
+ },
53
+ deleteFile: function deleteFile(fileInfo) {
54
+ var url = ''.concat(formio.formUrl, `/storage/gdrive?id=${fileInfo.id}&name=${fileInfo.originalName}`);
55
+ return formio.makeRequest('', url, 'delete');
56
+ },
53
57
  };
54
58
  }
55
59
  googledrive.title = 'Google Drive';
@@ -113,7 +113,7 @@ function indexeddb() {
113
113
  };
114
114
  });
115
115
  });
116
- }
116
+ },
117
117
  };
118
118
  }
119
119
  indexeddb.title = 'IndexedDB';
@@ -130,7 +130,11 @@ function s3(formio) {
130
130
  else {
131
131
  return Promise.resolve(file);
132
132
  }
133
- }
133
+ },
134
+ deleteFile(fileInfo) {
135
+ const url = `${formio.formUrl}/storage/s3?bucket=${XHR.trim(fileInfo.bucket)}&key=${XHR.trim(fileInfo.key)}`;
136
+ return formio.makeRequest('', url, 'delete');
137
+ },
134
138
  };
135
139
  }
136
140
  s3.title = 'S3';
@@ -48,6 +48,11 @@ const XHR = {
48
48
  throw err;
49
49
  }
50
50
  if (!response.ok) {
51
+ if (response.status === 504) {
52
+ const error = new Error('Network request failed');
53
+ error.networkError = true;
54
+ throw error;
55
+ }
51
56
  const message = await response.text();
52
57
  throw new Error(message || 'Unable to sign file.');
53
58
  }
@@ -90,6 +95,11 @@ const XHR = {
90
95
  if (xhr.status >= 200 && xhr.status < 300) {
91
96
  resolve(serverResponse);
92
97
  }
98
+ else if (xhr.status === 504) {
99
+ const error = new Error('Network request failed');
100
+ error.networkError = true;
101
+ reject(error);
102
+ }
93
103
  else {
94
104
  reject(xhr.response || 'Unable to upload file');
95
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.34",
3
+ "version": "5.0.0-rc.35",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -81,7 +81,7 @@
81
81
  },
82
82
  "homepage": "https://github.com/formio/formio.js#readme",
83
83
  "dependencies": {
84
- "@formio/bootstrap": "^3.0.0-rc.19",
84
+ "@formio/bootstrap": "^3.0.0-rc.20",
85
85
  "@formio/choices.js": "^10.2.0",
86
86
  "@formio/core": "^2.0.0-rc.2",
87
87
  "@formio/text-mask-addons": "^3.8.0-formio.2",