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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) 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/embed.d.ts +1 -0
  20. package/lib/cjs/CDN.js +12 -6
  21. package/lib/cjs/Webform.js +4 -1
  22. package/lib/cjs/Wizard.js +6 -9
  23. package/lib/cjs/components/_classes/component/Component.js +6 -1
  24. package/lib/cjs/components/_classes/nested/NestedComponent.js +1 -1
  25. package/lib/cjs/components/container/fixtures/comp4.js +45 -0
  26. package/lib/cjs/components/container/fixtures/index.js +3 -1
  27. package/lib/cjs/components/datetime/DateTime.js +6 -0
  28. package/lib/cjs/components/file/File.js +465 -215
  29. package/lib/cjs/components/file/editForm/File.edit.display.js +17 -0
  30. package/lib/cjs/components/textarea/TextArea.js +2 -2
  31. package/lib/cjs/components/textfield/TextField.js +3 -1
  32. package/lib/cjs/components/time/Time.js +3 -0
  33. package/lib/cjs/providers/storage/azure.js +6 -1
  34. package/lib/cjs/providers/storage/base64.js +1 -1
  35. package/lib/cjs/providers/storage/googleDrive.js +5 -1
  36. package/lib/cjs/providers/storage/indexeddb.js +1 -1
  37. package/lib/cjs/providers/storage/s3.js +5 -1
  38. package/lib/cjs/providers/storage/xhr.js +10 -0
  39. package/lib/mjs/CDN.js +12 -6
  40. package/lib/mjs/Webform.js +4 -1
  41. package/lib/mjs/Wizard.js +6 -9
  42. package/lib/mjs/components/_classes/component/Component.js +6 -1
  43. package/lib/mjs/components/_classes/nested/NestedComponent.js +1 -1
  44. package/lib/mjs/components/container/fixtures/comp4.js +43 -0
  45. package/lib/mjs/components/container/fixtures/index.js +2 -1
  46. package/lib/mjs/components/datetime/DateTime.js +6 -0
  47. package/lib/mjs/components/file/File.js +463 -224
  48. package/lib/mjs/components/file/editForm/File.edit.display.js +17 -0
  49. package/lib/mjs/components/textarea/TextArea.js +2 -2
  50. package/lib/mjs/components/textfield/TextField.js +6 -0
  51. package/lib/mjs/components/time/Time.js +3 -0
  52. package/lib/mjs/providers/storage/azure.js +6 -1
  53. package/lib/mjs/providers/storage/base64.js +1 -1
  54. package/lib/mjs/providers/storage/googleDrive.js +5 -1
  55. package/lib/mjs/providers/storage/indexeddb.js +1 -1
  56. package/lib/mjs/providers/storage/s3.js +5 -1
  57. package/lib/mjs/providers/storage/xhr.js +10 -0
  58. package/package.json +6 -3
  59. package/sdk.d.ts +1 -0
  60. package/types/components/_classes/component/component.d.ts +1 -1
  61. package/types/components/schema.d.ts +1 -1
  62. package/types/formio.d.ts +1 -0
  63. package/types/index.d.ts +1 -1
  64. package/types/sdk.d.ts +1 -0
  65. package/utils.d.ts +1 -0
@@ -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.36",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -34,7 +34,10 @@
34
34
  "dist",
35
35
  "lib",
36
36
  "types",
37
- "index.d.ts"
37
+ "index.d.ts",
38
+ "embed.d.ts",
39
+ "sdk.d.ts",
40
+ "utils.d.ts"
38
41
  ],
39
42
  "pre-commit": [
40
43
  "lint"
@@ -81,7 +84,7 @@
81
84
  },
82
85
  "homepage": "https://github.com/formio/formio.js#readme",
83
86
  "dependencies": {
84
- "@formio/bootstrap": "^3.0.0-rc.19",
87
+ "@formio/bootstrap": "^3.0.0-rc.20",
85
88
  "@formio/choices.js": "^10.2.0",
86
89
  "@formio/core": "^2.0.0-rc.2",
87
90
  "@formio/text-mask-addons": "^3.8.0-formio.2",
package/sdk.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './types/formio';
@@ -1,5 +1,5 @@
1
1
  import { Element } from '../../../element';
2
- import { ValidateOptions } from '../../../Formio';
2
+ import { ValidateOptions } from '../../../formio';
3
3
  import { ComponentSchema, ElementInfo, ExtendedComponentSchema } from './../../schema.d';
4
4
 
5
5
  export class Component extends Element {
@@ -1,4 +1,4 @@
1
- import { ConditionalOptions, ValidateOptions } from '../Formio';
1
+ import { ConditionalOptions, ValidateOptions } from '../formio';
2
2
 
3
3
  export interface ComponentSchema<T = any> {
4
4
  /**
package/types/formio.d.ts CHANGED
@@ -19,6 +19,7 @@ export interface FormioOptions {
19
19
  */
20
20
  project?: string;
21
21
  useSessionToken?: boolean;
22
+ formOnly?: boolean;
22
23
  }
23
24
  /**
24
25
  * The different path types for a project.
package/types/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export * from './components/components';
2
2
  export * from './components/schema';
3
3
  export * from './form';
4
4
  export * from './formbuilder';
5
- export * from './Formio';
5
+ export * from './formio';
6
6
  export * from './templates';
7
7
  export * from './displays';
8
8
  export * from './widgets';
package/types/sdk.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './formio';
package/utils.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './types/utils';