@formio/js 5.0.0-rc.52 → 5.0.0-rc.54

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. package/dist/formio.embed.js +1 -1
  2. package/dist/formio.embed.min.js +1 -1
  3. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  4. package/dist/formio.form.js +551 -541
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +3 -1
  7. package/dist/formio.full.js +553 -543
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +3 -1
  10. package/dist/formio.js +10 -10
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +1 -1
  13. package/dist/formio.utils.js +14 -4
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +3 -1
  16. package/embed.d.ts +1 -0
  17. package/form.d.ts +1 -0
  18. package/lib/cjs/Form.d.ts +281 -10
  19. package/lib/cjs/Form.js +22 -35
  20. package/lib/cjs/FormBuilder.d.ts +187 -2
  21. package/lib/cjs/FormBuilder.js +29 -6
  22. package/lib/cjs/InlineEmbed.d.ts +7 -0
  23. package/lib/cjs/InlineEmbed.js +109 -0
  24. package/lib/cjs/PDF.d.ts +0 -1
  25. package/lib/cjs/Webform.d.ts +6 -6
  26. package/lib/cjs/Webform.js +2 -2
  27. package/lib/cjs/Wizard.d.ts +1 -1
  28. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -6
  29. package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -4
  30. package/lib/cjs/components/_classes/field/Field.d.ts +11 -2
  31. package/lib/cjs/components/_classes/field/Field.js +13 -1
  32. package/lib/cjs/components/_classes/input/Input.d.ts +4 -3
  33. package/lib/cjs/components/_classes/input/Input.js +2 -2
  34. package/lib/cjs/components/_classes/list/ListComponent.form.d.ts +4 -5
  35. package/lib/cjs/components/_classes/list/ListComponent.form.js +3 -2
  36. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +42 -11
  37. package/lib/cjs/components/_classes/multivalue/Multivalue.js +37 -3
  38. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +127 -33
  39. package/lib/cjs/components/_classes/nested/NestedComponent.js +133 -15
  40. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +6 -0
  41. package/lib/cjs/components/address/Address.d.ts +2 -1
  42. package/lib/cjs/components/button/Button.d.ts +1 -1
  43. package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
  44. package/lib/cjs/components/columns/Columns.d.ts +1 -1
  45. package/lib/cjs/components/container/Container.d.ts +1 -0
  46. package/lib/cjs/components/datagrid/DataGrid.d.ts +1 -1
  47. package/lib/cjs/components/day/Day.d.ts +1 -1
  48. package/lib/cjs/components/editgrid/EditGrid.d.ts +2 -0
  49. package/lib/cjs/components/file/File.d.ts +2 -2
  50. package/lib/cjs/components/number/Number.d.ts +1 -1
  51. package/lib/cjs/components/radio/Radio.d.ts +1 -1
  52. package/lib/cjs/components/radio/Radio.form.d.ts +1 -3
  53. package/lib/cjs/components/radio/Radio.js +3 -3
  54. package/lib/cjs/components/select/Select.d.ts +9 -14
  55. package/lib/cjs/components/select/Select.form.d.ts +1 -3
  56. package/lib/cjs/components/select/Select.js +11 -15
  57. package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +1 -3
  58. package/lib/cjs/components/survey/Survey.d.ts +1 -1
  59. package/lib/cjs/components/table/Table.d.ts +1 -1
  60. package/lib/cjs/components/tabs/Tabs.d.ts +1 -1
  61. package/lib/cjs/components/textfield/TextField.d.ts +1 -1
  62. package/lib/cjs/formio.embed.d.ts +1 -2
  63. package/lib/cjs/formio.embed.js +2 -100
  64. package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +1 -1
  65. package/lib/cjs/providers/address/NominatimAddressProvider.js +5 -1
  66. package/lib/cjs/providers/processor/fileProcessor.d.ts +7 -1
  67. package/lib/cjs/providers/processor/fileProcessor.js +6 -0
  68. package/lib/cjs/providers/storage/azure.d.ts +4 -15
  69. package/lib/cjs/providers/storage/azure.js +3 -2
  70. package/lib/cjs/providers/storage/base64.d.ts +3 -7
  71. package/lib/cjs/providers/storage/base64.js +2 -1
  72. package/lib/cjs/providers/storage/dropbox.d.ts +4 -6
  73. package/lib/cjs/providers/storage/dropbox.js +3 -2
  74. package/lib/cjs/providers/storage/googleDrive.d.ts +4 -6
  75. package/lib/cjs/providers/storage/googleDrive.js +3 -1
  76. package/lib/cjs/providers/storage/indexeddb.d.ts +3 -8
  77. package/lib/cjs/providers/storage/indexeddb.js +2 -1
  78. package/lib/cjs/providers/storage/s3.d.ts +4 -22
  79. package/lib/cjs/providers/storage/s3.js +3 -2
  80. package/lib/cjs/providers/storage/url.d.ts +3 -8
  81. package/lib/cjs/providers/storage/url.js +4 -3
  82. package/lib/cjs/providers/storage/util.d.ts +22 -6
  83. package/lib/cjs/providers/storage/util.js +16 -5
  84. package/lib/cjs/utils/builder.d.ts +9 -7
  85. package/lib/cjs/utils/builder.js +10 -5
  86. package/lib/cjs/utils/calendarUtils.d.ts +6 -10
  87. package/lib/cjs/utils/calendarUtils.js +7 -11
  88. package/lib/cjs/utils/formUtils.d.ts +4 -4
  89. package/lib/cjs/utils/formUtils.js +3 -3
  90. package/lib/cjs/utils/utils.d.ts +123 -121
  91. package/lib/cjs/utils/utils.js +99 -94
  92. package/lib/mjs/Form.d.ts +281 -10
  93. package/lib/mjs/Form.js +112 -28
  94. package/lib/mjs/FormBuilder.d.ts +187 -2
  95. package/lib/mjs/FormBuilder.js +31 -6
  96. package/lib/mjs/InlineEmbed.d.ts +7 -0
  97. package/lib/mjs/InlineEmbed.js +105 -0
  98. package/lib/mjs/PDF.d.ts +0 -1
  99. package/lib/mjs/Webform.d.ts +6 -6
  100. package/lib/mjs/Webform.js +3 -3
  101. package/lib/mjs/Wizard.d.ts +1 -1
  102. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -6
  103. package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -4
  104. package/lib/mjs/components/_classes/field/Field.d.ts +11 -2
  105. package/lib/mjs/components/_classes/field/Field.js +13 -1
  106. package/lib/mjs/components/_classes/input/Input.d.ts +4 -3
  107. package/lib/mjs/components/_classes/input/Input.js +2 -2
  108. package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +4 -5
  109. package/lib/mjs/components/_classes/list/ListComponent.form.js +3 -2
  110. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +42 -11
  111. package/lib/mjs/components/_classes/multivalue/Multivalue.js +37 -3
  112. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +127 -33
  113. package/lib/mjs/components/_classes/nested/NestedComponent.js +133 -15
  114. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +6 -0
  115. package/lib/mjs/components/address/Address.d.ts +2 -1
  116. package/lib/mjs/components/button/Button.d.ts +1 -1
  117. package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
  118. package/lib/mjs/components/columns/Columns.d.ts +1 -1
  119. package/lib/mjs/components/container/Container.d.ts +1 -0
  120. package/lib/mjs/components/datagrid/DataGrid.d.ts +1 -1
  121. package/lib/mjs/components/day/Day.d.ts +1 -1
  122. package/lib/mjs/components/editgrid/EditGrid.d.ts +2 -0
  123. package/lib/mjs/components/file/File.d.ts +2 -2
  124. package/lib/mjs/components/number/Number.d.ts +1 -1
  125. package/lib/mjs/components/radio/Radio.d.ts +1 -1
  126. package/lib/mjs/components/radio/Radio.form.d.ts +1 -3
  127. package/lib/mjs/components/radio/Radio.js +3 -3
  128. package/lib/mjs/components/select/Select.d.ts +9 -14
  129. package/lib/mjs/components/select/Select.form.d.ts +1 -3
  130. package/lib/mjs/components/select/Select.js +11 -15
  131. package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +1 -3
  132. package/lib/mjs/components/survey/Survey.d.ts +1 -1
  133. package/lib/mjs/components/table/Table.d.ts +1 -1
  134. package/lib/mjs/components/tabs/Tabs.d.ts +1 -1
  135. package/lib/mjs/components/textfield/TextField.d.ts +1 -1
  136. package/lib/mjs/formio.embed.d.ts +1 -2
  137. package/lib/mjs/formio.embed.js +2 -99
  138. package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +1 -1
  139. package/lib/mjs/providers/address/NominatimAddressProvider.js +5 -1
  140. package/lib/mjs/providers/processor/fileProcessor.d.ts +7 -1
  141. package/lib/mjs/providers/processor/fileProcessor.js +6 -0
  142. package/lib/mjs/providers/storage/azure.d.ts +4 -15
  143. package/lib/mjs/providers/storage/azure.js +3 -2
  144. package/lib/mjs/providers/storage/base64.d.ts +3 -7
  145. package/lib/mjs/providers/storage/base64.js +2 -1
  146. package/lib/mjs/providers/storage/dropbox.d.ts +4 -6
  147. package/lib/mjs/providers/storage/dropbox.js +3 -2
  148. package/lib/mjs/providers/storage/googleDrive.d.ts +4 -6
  149. package/lib/mjs/providers/storage/googleDrive.js +3 -1
  150. package/lib/mjs/providers/storage/indexeddb.d.ts +3 -8
  151. package/lib/mjs/providers/storage/indexeddb.js +2 -1
  152. package/lib/mjs/providers/storage/s3.d.ts +4 -22
  153. package/lib/mjs/providers/storage/s3.js +3 -2
  154. package/lib/mjs/providers/storage/url.d.ts +3 -8
  155. package/lib/mjs/providers/storage/url.js +4 -3
  156. package/lib/mjs/providers/storage/util.d.ts +22 -6
  157. package/lib/mjs/providers/storage/util.js +16 -5
  158. package/lib/mjs/utils/builder.d.ts +9 -7
  159. package/lib/mjs/utils/builder.js +10 -5
  160. package/lib/mjs/utils/calendarUtils.d.ts +6 -10
  161. package/lib/mjs/utils/calendarUtils.js +7 -11
  162. package/lib/mjs/utils/formUtils.d.ts +4 -4
  163. package/lib/mjs/utils/formUtils.js +3 -3
  164. package/lib/mjs/utils/utils.d.ts +123 -121
  165. package/lib/mjs/utils/utils.js +99 -94
  166. package/package.json +17 -13
  167. package/sdk.d.ts +1 -0
  168. package/utils.d.ts +1 -0
@@ -1,99 +1,2 @@
1
- import { Formio } from './Embed';
2
- const scripts = document.getElementsByTagName('script');
3
- const config = window.FormioConfig || {};
4
- let thisScript = null;
5
- let i = scripts.length;
6
- const scriptName = config.scriptName || 'formio.embed.';
7
- while (i--) {
8
- if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
9
- thisScript = scripts[i];
10
- break;
11
- }
12
- }
13
- if (thisScript) {
14
- const query = {};
15
- const queryString = thisScript.src.replace(/^[^?]+\??/, '');
16
- queryString.replace(/\?/g, '&').split('&').forEach((item) => {
17
- query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
18
- });
19
- let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
20
- scriptSrc.pop();
21
- if (config.formioPath) {
22
- config.formioPath(scriptSrc);
23
- }
24
- scriptSrc = scriptSrc.join('/');
25
- const debug = (query.debug === 'true' || query.debug === '1');
26
- const renderer = debug ? 'formio.form' : 'formio.form.min';
27
- Formio.config = Object.assign({
28
- script: query.script || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.js`),
29
- style: query.styles || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.css`),
30
- cdn: query.cdn,
31
- class: (query.class || 'formio-form-wrapper'),
32
- src: query.src,
33
- form: null,
34
- submission: null,
35
- project: query.project,
36
- base: query.base || 'https://api.form.io',
37
- submit: query.submit,
38
- includeLibs: (query.libs === 'true' || query.libs === '1'),
39
- template: query.template,
40
- debug: debug,
41
- config: {},
42
- redirect: (query.return || query.redirect),
43
- embedCSS: (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.embed.css`),
44
- success: query.success || 'Thank you for your submission!',
45
- before: null,
46
- after: null
47
- }, config);
48
- const form = (Formio.config.form || Formio.config.src);
49
- if (form) {
50
- Formio.debug('Embedding Configuration', config);
51
- if (Formio.config.addPremiumLib) {
52
- Formio.config.addPremiumLib(Formio.config, scriptSrc);
53
- }
54
- // The id for this embedded form.
55
- Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
56
- Formio.debug('Creating form element');
57
- const element = Formio.createElement('div', {
58
- 'id': Formio.config.id,
59
- class: Formio.config.class
60
- });
61
- // insertAfter doesn't exist, but effect is identical.
62
- thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
63
- Formio.createForm(element, form, Formio.config.config).then((instance) => {
64
- if (Formio.config.submit) {
65
- instance.nosubmit = true;
66
- }
67
- // Configure a redirect.
68
- instance.on('submit', (submission) => {
69
- Formio.debug("on('submit')", submission);
70
- if (Formio.config.submit) {
71
- Formio.debug(`Sending submission to ${Formio.config.submit}`);
72
- const headers = {
73
- 'content-type': 'application/json'
74
- };
75
- const token = Formio.FormioClass.getToken();
76
- if (token) {
77
- headers['x-jwt-token'] = token;
78
- }
79
- Formio.FormioClass.fetch(Formio.config.submit, {
80
- body: JSON.stringify(submission),
81
- headers: headers,
82
- method: 'POST',
83
- mode: 'cors',
84
- })
85
- .then(resp => resp.json())
86
- .then(submission => Formio.submitDone(instance, submission));
87
- }
88
- else {
89
- Formio.submitDone(instance, submission);
90
- }
91
- });
92
- });
93
- }
94
- }
95
- else {
96
- // Show an error if the script cannot be found.
97
- document.write('<span>Could not locate the Embedded form.</span>');
98
- }
99
- export { Formio };
1
+ import { embed } from './InlineEmbed';
2
+ embed();
@@ -19,7 +19,7 @@ export class NominatimAddressProvider extends AddressProvider {
19
19
  get displayValueProperty(): string;
20
20
  /**
21
21
  * Generates the request URL for the address provider with options.
22
- * @param {NominatimAddressProviderOptionsParams} options
22
+ * @param {NominatimAddressProviderOptionsParams} options - The request options.
23
23
  * @returns {string} The formatted Url.
24
24
  */
25
25
  getRequestUrl(options?: NominatimAddressProviderOptionsParams): string;
@@ -8,6 +8,10 @@ import { AddressProvider } from './AddressProvider';
8
8
  * {extends AddressProvider}
9
9
  */
10
10
  export class NominatimAddressProvider extends AddressProvider {
11
+ /**
12
+ * Gets the name of the address provider.
13
+ * @type {string}
14
+ */
11
15
  static get name() {
12
16
  return 'nominatim';
13
17
  }
@@ -46,7 +50,7 @@ export class NominatimAddressProvider extends AddressProvider {
46
50
  }
47
51
  /**
48
52
  * Generates the request URL for the address provider with options.
49
- * @param {NominatimAddressProviderOptionsParams} options
53
+ * @param {NominatimAddressProviderOptionsParams} options - The request options.
50
54
  * @returns {string} The formatted Url.
51
55
  */
52
56
  getRequestUrl(options = {}) {
@@ -1,2 +1,8 @@
1
1
  export default fileProcessor;
2
- declare function fileProcessor(formio: any, config: any): (file: any, options: any) => Promise<any>;
2
+ /**
3
+ * Creates a file processor function.
4
+ * @param {Formio} formio - The Formio instance.
5
+ * @param {object} config - The configuration object.
6
+ * @returns {function(File, object): Promise<FormData>} A function that takes a file and options, and returns a Promise that resolves with the processed file.
7
+ */
8
+ declare function fileProcessor(formio: Formio, config: object): (arg0: File, arg1: object) => Promise<FormData>;
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Creates a file processor function.
3
+ * @param {Formio} formio - The Formio instance.
4
+ * @param {object} config - The configuration object.
5
+ * @returns {function(File, object): Promise<FormData>} A function that takes a file and options, and returns a Promise that resolves with the processed file.
6
+ */
1
7
  const fileProcessor = (formio, config) => (file, options) => new Promise((resolve, reject) => {
2
8
  const xhr = new XMLHttpRequest();
3
9
  // Fire on network error.
@@ -1,21 +1,10 @@
1
1
  export default azure;
2
2
  /**
3
- *
4
- * @param formio
3
+ * Azure File Services provider for file storage.
4
+ * @param {object} formio formio instance
5
+ * @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
5
6
  */
6
- declare function azure(formio: any): {
7
- uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<{
8
- storage: string;
9
- name: any;
10
- size: any;
11
- type: any;
12
- groupPermissions: any;
13
- groupId: any;
14
- key: any;
15
- }>;
16
- downloadFile(file: any): any;
17
- deleteFile: (fileInfo: any) => any;
18
- };
7
+ declare function azure(formio: object): any;
19
8
  declare namespace azure {
20
9
  let title: string;
21
10
  }
@@ -1,7 +1,8 @@
1
1
  import XHR from './xhr';
2
2
  /**
3
- *
4
- * @param formio
3
+ * Azure File Services provider for file storage.
4
+ * @param {object} formio formio instance
5
+ * @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
5
6
  */
6
7
  function azure(formio) {
7
8
  return {
@@ -1,13 +1,9 @@
1
1
  export default base64;
2
2
  /**
3
- *
3
+ * base64 File Services provider for file storage.
4
+ * @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
4
5
  */
5
- declare function base64(): {
6
- title: string;
7
- name: string;
8
- uploadFile(file: any, fileName: any): Promise<any>;
9
- downloadFile(file: any): Promise<any>;
10
- };
6
+ declare function base64(): any;
11
7
  declare namespace base64 {
12
8
  let title: string;
13
9
  }
@@ -1,5 +1,6 @@
1
1
  /**
2
- *
2
+ * base64 File Services provider for file storage.
3
+ * @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
3
4
  */
4
5
  function base64() {
5
6
  return {
@@ -1,12 +1,10 @@
1
1
  export default dropbox;
2
2
  /**
3
- *
4
- * @param formio
3
+ * Dropbox provider for file storage.
4
+ * @param {object} formio formio instance
5
+ * @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
5
6
  */
6
- declare function dropbox(formio: any): {
7
- uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<any>;
8
- downloadFile(file: any): Promise<any>;
9
- };
7
+ declare function dropbox(formio: object): any;
10
8
  declare namespace dropbox {
11
9
  let title: string;
12
10
  }
@@ -1,7 +1,8 @@
1
1
  import { setXhrHeaders } from './xhr';
2
2
  /**
3
- *
4
- * @param formio
3
+ * Dropbox provider for file storage.
4
+ * @param {object} formio formio instance
5
+ * @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
5
6
  */
6
7
  function dropbox(formio) {
7
8
  return {
@@ -1,13 +1,11 @@
1
1
  export default googledrive;
2
2
  /**
3
3
  *
4
- * @param formio
4
+ * Google Drive provider for file storage.
5
+ * @param {object} formio - formio instance
6
+ * @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
5
7
  */
6
- declare function googledrive(formio: any): {
7
- uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<any>;
8
- downloadFile(file: any): Promise<any>;
9
- deleteFile: (fileInfo: any) => any;
10
- };
8
+ declare function googledrive(formio: object): any;
11
9
  declare namespace googledrive {
12
10
  let title: string;
13
11
  }
@@ -1,7 +1,9 @@
1
1
  import { setXhrHeaders } from './xhr';
2
2
  /**
3
3
  *
4
- * @param formio
4
+ * Google Drive provider for file storage.
5
+ * @param {object} formio - formio instance
6
+ * @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
5
7
  */
6
8
  function googledrive(formio) {
7
9
  return {
@@ -1,14 +1,9 @@
1
1
  export default indexeddb;
2
2
  /**
3
- *
3
+ * indexedDb provider for file storage.
4
+ * @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
4
5
  */
5
- declare function indexeddb(): {
6
- title: string;
7
- name: string;
8
- uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any): Promise<any> | undefined;
9
- downloadFile(file: any, options: any): Promise<any>;
10
- deleteFile(file: any, options: any): Promise<any>;
11
- };
6
+ declare function indexeddb(): any;
12
7
  declare namespace indexeddb {
13
8
  let title: string;
14
9
  }
@@ -1,6 +1,7 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
2
  /**
3
- *
3
+ * indexedDb provider for file storage.
4
+ * @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
4
5
  */
5
6
  function indexeddb() {
6
7
  return {
@@ -1,28 +1,10 @@
1
1
  export default s3;
2
2
  /**
3
- *
4
- * @param formio
3
+ * S3 File Services provider for file storage.
4
+ * @param {object} formio formio instance
5
+ * @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
5
6
  */
6
- declare function s3(formio: any): {
7
- uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any, multipartOptions: any): Promise<{
8
- storage: string;
9
- name: any;
10
- bucket: any;
11
- key: any;
12
- url: any;
13
- acl: any;
14
- size: any;
15
- type: any;
16
- }>;
17
- completeMultipartUpload(serverResponse: any, parts: any, multipart: any): Promise<void>;
18
- abortMultipartUpload(serverResponse: any): void;
19
- uploadParts(file: any, urls: any, headers: any, partSize: any, multipart: any, abortSignal: any): Promise<{
20
- ETag: string;
21
- PartNumber: number;
22
- }[]>;
23
- downloadFile(file: any): any;
24
- deleteFile(fileInfo: any): any;
25
- };
7
+ declare function s3(formio: object): any;
26
8
  declare namespace s3 {
27
9
  let title: string;
28
10
  }
@@ -6,8 +6,9 @@ const loadAbortControllerPolyfill = async () => {
6
6
  }
7
7
  };
8
8
  /**
9
- *
10
- * @param formio
9
+ * S3 File Services provider for file storage.
10
+ * @param {object} formio formio instance
11
+ * @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
11
12
  */
12
13
  function s3(formio) {
13
14
  return {
@@ -1,15 +1,10 @@
1
1
  export default url;
2
2
  /**
3
3
  *
4
- * @param formio
4
+ * @param {object} formio - formio instance
5
+ * @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
5
6
  */
6
- declare function url(formio: any): {
7
- title: string;
8
- name: string;
9
- uploadFile(file: any, name: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): any;
10
- deleteFile(fileInfo: any, options: any): Promise<any>;
11
- downloadFile(file: any): Promise<any>;
12
- };
7
+ declare function url(formio: object): any;
13
8
  declare namespace url {
14
9
  let title: string;
15
10
  }
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  *
3
- * @param formio
3
+ * @param {object} formio - formio instance
4
+ * @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
4
5
  */
5
6
  function url(formio) {
6
7
  /**
7
8
  *
8
- * @param options
9
- * @param xhr
9
+ * @param {object} options - options to set on the xhr
10
+ * @param {object} xhr - the xhr object
10
11
  */
11
12
  function setOptions(options, xhr) {
12
13
  const parsedOptions = typeof options === 'string' ? JSON.parse(options) : options;
@@ -1,8 +1,24 @@
1
1
  /**
2
- *
3
- * @param fn
4
- * @param args
5
- * @param retries
6
- * @param err
2
+ * @typedef {any[]} Args
7
3
  */
8
- export function withRetries(fn: any, args: any, retries?: number, err?: null): Promise<any>;
4
+ /**
5
+ * Function to be retried
6
+ * @callback RetryFunction
7
+ * @param {...Args} args
8
+ * @returns {Promise<any>}
9
+ */
10
+ /**
11
+ * Executes a function with retries in case of failure.
12
+ * @param {RetryFunction} fn - The function to be executed.
13
+ * @param {Args} args - The arguments to be passed to the function.
14
+ * @param {number} [retries] - The number of retries in case of failure.
15
+ * @param {string} [err] - The error message to be thrown after all retries have failed.
16
+ * @returns {Promise<any>} The result of the function execution.
17
+ * @throws {Error} When all retries have failed.
18
+ */
19
+ export function withRetries(fn: RetryFunction, args: Args, retries?: number | undefined, err?: string | undefined): Promise<any>;
20
+ export type Args = any[];
21
+ /**
22
+ * Function to be retried
23
+ */
24
+ export type RetryFunction = (...args: Args[]) => Promise<any>;
@@ -1,9 +1,20 @@
1
1
  /**
2
- *
3
- * @param fn
4
- * @param args
5
- * @param retries
6
- * @param err
2
+ * @typedef {any[]} Args
3
+ */
4
+ /**
5
+ * Function to be retried
6
+ * @callback RetryFunction
7
+ * @param {...Args} args
8
+ * @returns {Promise<any>}
9
+ */
10
+ /**
11
+ * Executes a function with retries in case of failure.
12
+ * @param {RetryFunction} fn - The function to be executed.
13
+ * @param {Args} args - The arguments to be passed to the function.
14
+ * @param {number} [retries] - The number of retries in case of failure.
15
+ * @param {string} [err] - The error message to be thrown after all retries have failed.
16
+ * @returns {Promise<any>} The result of the function execution.
17
+ * @throws {Error} When all retries have failed.
7
18
  */
8
19
  export async function withRetries(fn, args, retries = 3, err = null) {
9
20
  if (!retries) {
@@ -1,17 +1,19 @@
1
1
  declare namespace _default {
2
2
  /**
3
3
  * Appends a number to a component.key to keep it unique
4
- * @param {object} form
5
- * The components parent form.
6
- * @param container
7
- * @param {object} component
8
- * The component to uniquify
4
+ * @param {import('@formio/core').Component[]} container - The container of components to uniquify against
5
+ * @param {import('@formio/core').Component} component - The Component to uniqify.
6
+ * @returns {boolean} - If the component was changed.
9
7
  */
10
- function uniquify(container: any, component: object): boolean;
8
+ function uniquify(container: import("@formio/core").Component[], component: import("@formio/core").Component): boolean;
11
9
  namespace additionalShortcuts {
12
10
  let button: string[];
13
11
  }
14
- function getAlphaShortcuts(): any;
12
+ /**
13
+ * Returns the alpha character shortcuts.
14
+ * @returns {string[]} - An array of shortcuts of alpha characters.
15
+ */
16
+ function getAlphaShortcuts(): string[];
15
17
  function getAdditionalShortcuts(type: any): any;
16
18
  function getBindedShortcuts(components: any, input: any): any[];
17
19
  function getAvailableShortcuts(form: any, component: any): {
@@ -3,11 +3,9 @@ import { eachComponent, uniqueKey } from './utils';
3
3
  export default {
4
4
  /**
5
5
  * Appends a number to a component.key to keep it unique
6
- * @param {object} form
7
- * The components parent form.
8
- * @param container
9
- * @param {object} component
10
- * The component to uniquify
6
+ * @param {import('@formio/core').Component[]} container - The container of components to uniquify against
7
+ * @param {import('@formio/core').Component} component - The Component to uniqify.
8
+ * @returns {boolean} - If the component was changed.
11
9
  */
12
10
  uniquify(container, component) {
13
11
  let changed = false;
@@ -36,12 +34,19 @@ export default {
36
34
  }, true);
37
35
  return changed;
38
36
  },
37
+ /**
38
+ * Additional shortcuts for the builder.
39
+ */
39
40
  additionalShortcuts: {
40
41
  button: [
41
42
  'Enter',
42
43
  'Esc'
43
44
  ]
44
45
  },
46
+ /**
47
+ * Returns the alpha character shortcuts.
48
+ * @returns {string[]} - An array of shortcuts of alpha characters.
49
+ */
45
50
  getAlphaShortcuts() {
46
51
  return _.range('A'.charCodeAt(), 'Z'.charCodeAt() + 1).map((charCode) => String.fromCharCode(charCode));
47
52
  },
@@ -8,7 +8,7 @@
8
8
  * The max date.
9
9
  * @param {Date} minDate
10
10
  * The min date.
11
- * @returns {{message: string, result: boolean}}
11
+ * @returns {{message: string, result: boolean}} - The response object.
12
12
  */
13
13
  export function lessOrGreater(value: typeof moment, format: [string], maxDate: Date, minDate: Date): {
14
14
  message: string;
@@ -16,15 +16,11 @@ export function lessOrGreater(value: typeof moment, format: [string], maxDate: D
16
16
  };
17
17
  /**
18
18
  * Checks the entered date for validity.
19
- * @param {string} value
20
- * The value to check.
21
- * @param {[string]} format
22
- * A moment formats.
23
- * @param {Date} maxDate
24
- * The max date.
25
- * @param {Date} minDate
26
- * The min date.
27
- * @returns {{message: string, result: boolean}}
19
+ * @param {string} value - The value to check.
20
+ * @param {[string]} format - A moment formats.
21
+ * @param {Date} minDate - The minimum date.
22
+ * @param {Date} maxDate - The maximum date.
23
+ * @returns {{message: string, result: boolean}} - The response object.
28
24
  */
29
25
  export function checkInvalidDate(value: string, format: [string], minDate: Date, maxDate: Date): {
30
26
  message: string;
@@ -16,7 +16,7 @@ export const CALENDAR_ERROR_MESSAGES = {
16
16
  * The message for response.
17
17
  * @param {boolean} result
18
18
  * The boolean flag for response.
19
- * @returns {{message: string, result: boolean}}
19
+ * @returns {{message: string, result: boolean}} - The response object.
20
20
  */
21
21
  function buildResponse(message, result) {
22
22
  return {
@@ -34,7 +34,7 @@ function buildResponse(message, result) {
34
34
  * The max date.
35
35
  * @param {Date} minDate
36
36
  * The min date.
37
- * @returns {{message: string, result: boolean}}
37
+ * @returns {{message: string, result: boolean}} - The response object.
38
38
  */
39
39
  export function lessOrGreater(value, format, maxDate, minDate) {
40
40
  let message = '';
@@ -60,15 +60,11 @@ export function lessOrGreater(value, format, maxDate, minDate) {
60
60
  }
61
61
  /**
62
62
  * Checks the entered date for validity.
63
- * @param {string} value
64
- * The value to check.
65
- * @param {[string]} format
66
- * A moment formats.
67
- * @param {Date} maxDate
68
- * The max date.
69
- * @param {Date} minDate
70
- * The min date.
71
- * @returns {{message: string, result: boolean}}
63
+ * @param {string} value - The value to check.
64
+ * @param {[string]} format - A moment formats.
65
+ * @param {Date} minDate - The minimum date.
66
+ * @param {Date} maxDate - The maximum date.
67
+ * @returns {{message: string, result: boolean}} - The response object.
72
68
  */
73
69
  export function checkInvalidDate(value, format, minDate, maxDate) {
74
70
  const date = moment(value, format, true);
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Deprecated version of findComponents. Renamed to searchComponents.
3
- * @param components
4
- * @param query
5
- * @returns {*}
3
+ * @param {import('@formio/core').Component[]} components - The components to find components within.
4
+ * @param {object} query - The query to use when searching for the components.
5
+ * @returns {import('@formio/core').Component[]} - The result of the component that is found.
6
6
  */
7
- export function findComponents(components: any, query: any): any;
7
+ export function findComponents(components: import('@formio/core').Component[], query: object): import('@formio/core').Component[];
8
8
  export const flattenComponents: typeof Utils.flattenComponents;
9
9
  export const guid: typeof Utils.guid;
10
10
  export const uniqueName: typeof Utils.uniqueName;
@@ -2,9 +2,9 @@ import { Utils } from '@formio/core';
2
2
  const { flattenComponents, guid, uniqueName, MODEL_TYPES, getModelType, getComponentAbsolutePath, getComponentPath, isComponentModelType, isComponentNestedDataType, componentPath, componentChildPath, eachComponentDataAsync, eachComponentData, getComponentKey, getContextualRowPath, getContextualRowData, componentInfo, eachComponent, eachComponentAsync, getComponentData, getComponentActualValue, isLayoutComponent, matchComponent, getComponent, searchComponents, removeComponent, hasCondition, parseFloatExt, formatAsCurrency, escapeRegExCharacters, getValue, getStrings, generateFormChange, applyFormChanges, findComponent, getEmptyValue, isComponentDataEmpty } = Utils;
3
3
  /**
4
4
  * Deprecated version of findComponents. Renamed to searchComponents.
5
- * @param components
6
- * @param query
7
- * @returns {*}
5
+ * @param {import('@formio/core').Component[]} components - The components to find components within.
6
+ * @param {object} query - The query to use when searching for the components.
7
+ * @returns {import('@formio/core').Component[]} - The result of the component that is found.
8
8
  */
9
9
  export function findComponents(components, query) {
10
10
  console.warn('formio.js/utils findComponents is deprecated. Use searchComponents instead.');