@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
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Formio = exports.embed = void 0;
4
+ const Embed_1 = require("./Embed");
5
+ Object.defineProperty(exports, "Formio", { enumerable: true, get: function () { return Embed_1.Formio; } });
6
+ /**
7
+ * Inline embed a form within a webpage.
8
+ * @param {*} config - Configuration to configure how the inline embed is rendered.
9
+ */
10
+ function embed(config = {}) {
11
+ const scripts = document.getElementsByTagName('script');
12
+ config = Object.assign({}, window.FormioConfig || {}, config);
13
+ let thisScript = null;
14
+ let i = scripts.length;
15
+ const scriptName = config.scriptName || 'formio.embed.';
16
+ while (i--) {
17
+ if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
18
+ thisScript = scripts[i];
19
+ break;
20
+ }
21
+ }
22
+ if (thisScript) {
23
+ const query = {};
24
+ const queryString = thisScript.src.replace(/^[^?]+\??/, '');
25
+ queryString.replace(/\?/g, '&').split('&').forEach((item) => {
26
+ query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
27
+ });
28
+ let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
29
+ scriptSrc.pop();
30
+ if (config.formioPath) {
31
+ config.formioPath(scriptSrc);
32
+ }
33
+ scriptSrc = scriptSrc.join('/');
34
+ const debug = (query.debug === 'true' || query.debug === '1');
35
+ const renderer = debug ? 'formio.form' : 'formio.form.min';
36
+ Embed_1.Formio.config = Object.assign({
37
+ script: query.script || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.js`),
38
+ style: query.styles || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.css`),
39
+ cdn: query.cdn,
40
+ class: (query.class || 'formio-form-wrapper'),
41
+ src: query.src,
42
+ form: null,
43
+ submission: null,
44
+ project: query.project,
45
+ base: query.base || 'https://api.form.io',
46
+ submit: query.submit,
47
+ includeLibs: (query.libs === 'true' || query.libs === '1'),
48
+ template: query.template,
49
+ debug: debug,
50
+ config: {},
51
+ redirect: (query.return || query.redirect),
52
+ embedCSS: (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.embed.css`),
53
+ success: query.success || 'Thank you for your submission!',
54
+ before: null,
55
+ after: null
56
+ }, config);
57
+ const form = (Embed_1.Formio.config.form || Embed_1.Formio.config.src);
58
+ if (form) {
59
+ Embed_1.Formio.debug('Embedding Configuration', config);
60
+ if (Embed_1.Formio.config.addPremiumLib) {
61
+ Embed_1.Formio.config.addPremiumLib(Embed_1.Formio.config, scriptSrc);
62
+ }
63
+ // The id for this embedded form.
64
+ Embed_1.Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
65
+ Embed_1.Formio.debug('Creating form element');
66
+ const element = Embed_1.Formio.createElement('div', {
67
+ 'id': Embed_1.Formio.config.id,
68
+ class: Embed_1.Formio.config.class
69
+ });
70
+ // insertAfter doesn't exist, but effect is identical.
71
+ thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
72
+ Embed_1.Formio.createForm(element, form, Embed_1.Formio.config.config).then((instance) => {
73
+ if (Embed_1.Formio.config.submit) {
74
+ instance.nosubmit = true;
75
+ }
76
+ // Configure a redirect.
77
+ instance.on('submit', (submission) => {
78
+ Embed_1.Formio.debug("on('submit')", submission);
79
+ if (Embed_1.Formio.config.submit) {
80
+ Embed_1.Formio.debug(`Sending submission to ${Embed_1.Formio.config.submit}`);
81
+ const headers = {
82
+ 'content-type': 'application/json'
83
+ };
84
+ const token = Embed_1.Formio.FormioClass.getToken();
85
+ if (token) {
86
+ headers['x-jwt-token'] = token;
87
+ }
88
+ Embed_1.Formio.FormioClass.fetch(Embed_1.Formio.config.submit, {
89
+ body: JSON.stringify(submission),
90
+ headers: headers,
91
+ method: 'POST',
92
+ mode: 'cors',
93
+ })
94
+ .then(resp => resp.json())
95
+ .then(submission => Embed_1.Formio.submitDone(instance, submission));
96
+ }
97
+ else {
98
+ Embed_1.Formio.submitDone(instance, submission);
99
+ }
100
+ });
101
+ });
102
+ }
103
+ }
104
+ else {
105
+ // Show an error if the script cannot be found.
106
+ document.write('<span>Could not locate the Embedded form.</span>');
107
+ }
108
+ }
109
+ exports.embed = embed;
package/lib/cjs/PDF.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export default class PDF extends Webform {
2
- constructor(element: any, options: any);
3
2
  components: any[];
4
3
  init(): void;
5
4
  render(): any;
@@ -89,14 +89,14 @@
89
89
  declare class Webform extends NestedDataComponent {
90
90
  /**
91
91
  * Creates a new Form instance.
92
- * @param {HTMLElement | object | FormOptions} [elementOrOptions] - The DOM element to render this form within or the options to create this form instance.
93
- * @param {FormOptions} [options] - The options to create a new form instance.
92
+ * @param {HTMLElement | object | import('Form').FormOptions} [elementOrOptions] - The DOM element to render this form within or the options to create this form instance.
93
+ * @param {import('Form').FormOptions} [options] - The options to create a new form instance.
94
94
  */
95
- constructor(elementOrOptions?: HTMLElement | object | FormOptions, options?: FormOptions | undefined);
95
+ constructor(elementOrOptions?: HTMLElement | object | import('Form').FormOptions, options?: any);
96
96
  /**
97
- * @type {FormOptions} - the options for this Webform.
97
+ * @type {import('Form').FormOptions} - the options for this Webform.
98
98
  */
99
- options: FormOptions;
99
+ options: any;
100
100
  _src: string;
101
101
  _loading: boolean;
102
102
  _form: {};
@@ -359,7 +359,7 @@ declare class Webform extends NestedDataComponent {
359
359
  executeFormController(): false | undefined;
360
360
  build(element: any): Promise<any>;
361
361
  getClassName(): string;
362
- render(): string;
362
+ render(): import("./components/_classes/field/Field").default;
363
363
  redraw(): Promise<void> | Promise<boolean>;
364
364
  attach(element: any): Promise<boolean>;
365
365
  hasRequiredFields(): boolean;
@@ -140,8 +140,8 @@ function getOptions(options) {
140
140
  class Webform extends NestedDataComponent_1.default {
141
141
  /**
142
142
  * Creates a new Form instance.
143
- * @param {HTMLElement | object | FormOptions} [elementOrOptions] - The DOM element to render this form within or the options to create this form instance.
144
- * @param {FormOptions} [options] - The options to create a new form instance.
143
+ * @param {HTMLElement | object | import('Form').FormOptions} [elementOrOptions] - The DOM element to render this form within or the options to create this form instance.
144
+ * @param {import('Form').FormOptions} [options] - The options to create a new form instance.
145
145
  */
146
146
  constructor(elementOrOptions, options) {
147
147
  let element, formOptions;
@@ -88,7 +88,7 @@ declare class Wizard extends Webform {
88
88
  }): any[];
89
89
  findRootPanel(component: any): any;
90
90
  setRootPanelId(component: any): void;
91
- establishPages(data?: any): any[];
91
+ establishPages(data?: object): any[];
92
92
  updatePages(): void;
93
93
  addComponents(): void;
94
94
  setPage(num: any): Promise<void>;
@@ -680,25 +680,26 @@ export default class PasswordStrengthAddon extends FormioAddon {
680
680
  };
681
681
  /**
682
682
  * Determines is a password is secure enough to submit
683
- * @returns {boolean}
683
+ * @returns {boolean} - returns TRUE if password is valid, FALSE if it is not.
684
684
  */
685
685
  isValid(): boolean;
686
686
  /**
687
687
  * Handles the result of check and constructs a new error object or returns an amount of points to add to the current entropy
688
688
  * @param {boolean|number} valid - Determines if the validation was failed or an amount of points if it was passed
689
689
  * @param {*} validation - Validation configuration
690
- * @param {string} value - Value which was validated
691
690
  * @param {string} message - Message which should be shown if validation was not passed
692
- * @param errors
691
+ * @param {any[]} errors - The errors array (will be mutated)
692
+ * @returns {number} - Returns an amount of points to add to the current entropy
693
693
  */
694
- handleRuleCheckResult(valid: boolean | number, validation: any, message: string, errors: any): any;
694
+ handleRuleCheckResult(valid: boolean | number, validation: any, message: string, errors: any[]): number;
695
695
  performChecks(value: any): {
696
696
  charactersPoolSize: number;
697
697
  errors: any[];
698
698
  };
699
699
  /**
700
700
  * Performs checks to validate password security
701
- * @param {string} value - Suggested password
701
+ * @param {string} value - The password value to be checked.
702
+ * @returns {boolean} - Returns TRUE if password is strong enough, FALSE if it is not.
702
703
  */
703
704
  checkValidity(value: string): boolean;
704
705
  handleBlackListCheckResult(result: any, errors: any): void;
@@ -709,8 +710,9 @@ export default class PasswordStrengthAddon extends FormioAddon {
709
710
  /**
710
711
  * Finds the level which one the passed entropy suits
711
712
  * @param {number} entropy - Points of password's security
713
+ * @returns {object} - Returns the level object
712
714
  */
713
- getLevel(entropy?: number): any;
715
+ getLevel(entropy?: number): object;
714
716
  /**
715
717
  * Update the current view of the password's security indicator
716
718
  */
@@ -204,7 +204,7 @@ class PasswordStrengthAddon extends FormioAddon_1.default {
204
204
  }
205
205
  /**
206
206
  * Determines is a password is secure enough to submit
207
- * @returns {boolean}
207
+ * @returns {boolean} - returns TRUE if password is valid, FALSE if it is not.
208
208
  */
209
209
  isValid() {
210
210
  const isValidCheck = this.settings.isValid;
@@ -221,9 +221,9 @@ class PasswordStrengthAddon extends FormioAddon_1.default {
221
221
  * Handles the result of check and constructs a new error object or returns an amount of points to add to the current entropy
222
222
  * @param {boolean|number} valid - Determines if the validation was failed or an amount of points if it was passed
223
223
  * @param {*} validation - Validation configuration
224
- * @param {string} value - Value which was validated
225
224
  * @param {string} message - Message which should be shown if validation was not passed
226
- * @param errors
225
+ * @param {any[]} errors - The errors array (will be mutated)
226
+ * @returns {number} - Returns an amount of points to add to the current entropy
227
227
  */
228
228
  handleRuleCheckResult(valid, validation, message, errors) {
229
229
  if (valid !== true) {
@@ -263,7 +263,8 @@ class PasswordStrengthAddon extends FormioAddon_1.default {
263
263
  }
264
264
  /**
265
265
  * Performs checks to validate password security
266
- * @param {string} value - Suggested password
266
+ * @param {string} value - The password value to be checked.
267
+ * @returns {boolean} - Returns TRUE if password is strong enough, FALSE if it is not.
267
268
  */
268
269
  checkValidity(value) {
269
270
  var _a;
@@ -363,6 +364,7 @@ class PasswordStrengthAddon extends FormioAddon_1.default {
363
364
  /**
364
365
  * Finds the level which one the passed entropy suits
365
366
  * @param {number} entropy - Points of password's security
367
+ * @returns {object} - Returns the level object
366
368
  */
367
369
  getLevel(entropy = this.entropy) {
368
370
  const lowestLevel = this.levels[0];
@@ -1,5 +1,14 @@
1
1
  export default class Field extends Component {
2
- render(element: any): string;
3
- saveCaretPosition(element: any, index: any): void;
2
+ /**
3
+ * @param {object} element - The component to create.
4
+ * @returns {Field} - The created field.
5
+ */
6
+ render(element: object): Field;
7
+ /**
8
+ /* Saves current caret position to restore it after the component is redrawn
9
+ * @param {HTMLElement} element - The element to save the caret position for.
10
+ * @param {number} index - The index of the element.
11
+ */
12
+ saveCaretPosition(element: HTMLElement, index: number): void;
4
13
  }
5
14
  import Component from '../component/Component';
@@ -4,7 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Component_1 = __importDefault(require("../component/Component"));
7
+ /*
8
+ * Field class is a base class for all fields.
9
+ * @extends Component
10
+ */
7
11
  class Field extends Component_1.default {
12
+ /**
13
+ * @param {object} element - The component to create.
14
+ * @returns {Field} - The created field.
15
+ */
8
16
  render(element) {
9
17
  if (this.noField) {
10
18
  return super.render(element);
@@ -19,7 +27,11 @@ class Field extends Component_1.default {
19
27
  }));
20
28
  }
21
29
  }
22
- // Saves current caret position to restore it after the component is redrawn
30
+ /**
31
+ /* Saves current caret position to restore it after the component is redrawn
32
+ * @param {HTMLElement} element - The element to save the caret position for.
33
+ * @param {number} index - The index of the element.
34
+ */
23
35
  saveCaretPosition(element, index) {
24
36
  var _a, _b;
25
37
  if (((_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.focusedComponent) === null || _b === void 0 ? void 0 : _b.path) === this.path) {
@@ -30,13 +30,14 @@ export default class Input extends Multivalue {
30
30
  updateValue(value: any, flags: any, index: any): boolean;
31
31
  parseValue(value: any): any;
32
32
  formatValue(value: any): any;
33
+ attach(element: any): Promise<any>;
33
34
  getWidget(index: any): any;
34
35
  attachElement(element: any, index: any): Promise<void>;
35
36
  /**
36
37
  * Creates an instance of a widget for this component.
37
- * @param index
38
- * @returns {null}
38
+ * @param {number} index - The index of the widget.
39
+ * @returns {*} - The widget instance.
39
40
  */
40
- createWidget(index: any): null;
41
+ createWidget(index: number): any;
41
42
  }
42
43
  import Multivalue from '../multivalue/Multivalue';
@@ -244,8 +244,8 @@ class Input extends Multivalue_1.default {
244
244
  }
245
245
  /**
246
246
  * Creates an instance of a widget for this component.
247
- * @param index
248
- * @returns {null}
247
+ * @param {number} index - The index of the widget.
248
+ * @returns {*} - The widget instance.
249
249
  */
250
250
  createWidget(index) {
251
251
  var _a, _b;
@@ -1,7 +1,6 @@
1
1
  /**
2
- *
3
- * @param {...any} extend
2
+ * List Component edit form.
3
+ * @param {...any} extend - The extended schema.
4
+ * @returns {object} - The List Component edit form.
4
5
  */
5
- export default function _default(...extend: any[]): {
6
- components: any;
7
- };
6
+ export default function _default(...extend: any[]): object;
@@ -6,8 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Components_1 = __importDefault(require("../../Components"));
7
7
  const ListComponent_edit_data_1 = __importDefault(require("./editForm/ListComponent.edit.data"));
8
8
  /**
9
- *
10
- * @param {...any} extend
9
+ * List Component edit form.
10
+ * @param {...any} extend - The extended schema.
11
+ * @returns {object} - The List Component edit form.
11
12
  */
12
13
  function default_1(...extend) {
13
14
  return Components_1.default.baseEditForm([
@@ -1,24 +1,55 @@
1
1
  export default class Multivalue extends Field {
2
2
  get addAnother(): string;
3
3
  useWrapper(): any;
4
- render(): string;
4
+ /**
5
+ * @returns {Field} - The created field.
6
+ */
7
+ render(): Field;
5
8
  renderElement(): string;
6
- renderRow(value: any, index: any): any;
7
- attach(dom: any): Promise<any[]>;
9
+ /**
10
+ * Renders a single row for multi-value components.
11
+ * @param {any} value - The value associated with the row to render.
12
+ * @param {number} index - The index of the row in the multi-value list.
13
+ * @returns {any} Returns the HTML string representation of the row.
14
+ */
15
+ renderRow(value: any, index: number): any;
16
+ /**
17
+ * @param {HTMLElement} dom - The DOM element to which the component will attach.
18
+ * @returns {Promise} - Promise that resolves when all asynchronous tasks that have finished.
19
+ */
20
+ attach(dom: HTMLElement): Promise<any>;
8
21
  /**
9
22
  * Attach inputs to the element.
10
- * @param element
11
- * @param index
23
+ * @param {HTMLElement} element - The element to attach.
24
+ * @param {number} index - The index of the element to attach.
25
+ */
26
+ attachElement(element: HTMLElement, index: number): void;
27
+ /**
28
+ * Event handler for selecting a mask from a dropdown.
29
+ * @param {Event} event - Event triggered by changing the selected option in mask.
30
+ */
31
+ onSelectMaskHandler(event: Event): void;
32
+ /**
33
+ * Retrieves the mask pattern for a given mask name
34
+ * @param {string} maskName - The name of the mask to retrieve.
35
+ * @returns {any} The mask pattern associated with the given mask name.
12
36
  */
13
- attachElement(element: any, index: any): void;
14
- onSelectMaskHandler(event: any): void;
15
- getMaskPattern(maskName: any): any;
37
+ getMaskPattern(maskName: string): any;
16
38
  multiMasks: {} | undefined;
17
- attachMultiMask(index: any): boolean;
18
- updateMask(input: any, mask: any): void;
39
+ /**
40
+ * Attaches a selectable mask to an input field based on its configuration.
41
+ * @param {number} index - The index of the select or input in component array.
42
+ * @returns {boolean} - Returns true if the mask was successfully attached
43
+ */
44
+ attachMultiMask(index: number): boolean;
45
+ /**
46
+ * @param {any} input - The input element on which the mask is to be applied.
47
+ * @param {string} mask - The mask pattern to apply to the input element. Exit early if no mask.
48
+ */
49
+ updateMask(input: any, mask: string): void;
19
50
  /**
20
51
  * Adds a new empty value to the data array.
21
- * @param value
52
+ * @param {any} value -A value to be added to the data array.
22
53
  */
23
54
  addNewValue(value: any): void;
24
55
  /**
@@ -34,6 +34,9 @@ class Multivalue extends Field_1.default {
34
34
  useWrapper() {
35
35
  return this.component.hasOwnProperty('multiple') && this.component.multiple;
36
36
  }
37
+ /**
38
+ * @returns {Field} - The created field.
39
+ */
37
40
  render() {
38
41
  // If single value field.
39
42
  if (!this.useWrapper()) {
@@ -56,6 +59,12 @@ class Multivalue extends Field_1.default {
56
59
  renderElement() {
57
60
  return '';
58
61
  }
62
+ /**
63
+ * Renders a single row for multi-value components.
64
+ * @param {any} value - The value associated with the row to render.
65
+ * @param {number} index - The index of the row in the multi-value list.
66
+ * @returns {any} Returns the HTML string representation of the row.
67
+ */
59
68
  renderRow(value, index) {
60
69
  return this.renderTemplate('multiValueRow', {
61
70
  index,
@@ -63,6 +72,10 @@ class Multivalue extends Field_1.default {
63
72
  element: `${this.renderElement(value, index)}`,
64
73
  });
65
74
  }
75
+ /**
76
+ * @param {HTMLElement} dom - The DOM element to which the component will attach.
77
+ * @returns {Promise} - Promise that resolves when all asynchronous tasks that have finished.
78
+ */
66
79
  attach(dom) {
67
80
  const superAttach = super.attach(dom);
68
81
  this.loadRefs(dom, {
@@ -96,6 +109,9 @@ class Multivalue extends Field_1.default {
96
109
  return Promise.all(promises);
97
110
  });
98
111
  }
112
+ /**
113
+ * Remove all event handlers.
114
+ */
99
115
  detach() {
100
116
  if (this.refs.input && this.refs.input.length) {
101
117
  this.refs.input.forEach((input) => {
@@ -118,8 +134,8 @@ class Multivalue extends Field_1.default {
118
134
  }
119
135
  /**
120
136
  * Attach inputs to the element.
121
- * @param element
122
- * @param index
137
+ * @param {HTMLElement} element - The element to attach.
138
+ * @param {number} index - The index of the element to attach.
123
139
  */
124
140
  attachElement(element, index) {
125
141
  this.addEventListener(element, this.inputInfo.changeEvent, () => {
@@ -181,9 +197,18 @@ class Multivalue extends Field_1.default {
181
197
  }
182
198
  }
183
199
  }
200
+ /**
201
+ * Event handler for selecting a mask from a dropdown.
202
+ * @param {Event} event - Event triggered by changing the selected option in mask.
203
+ */
184
204
  onSelectMaskHandler(event) {
185
205
  this.updateMask(event.target.maskInput, this.getMaskPattern(event.target.value));
186
206
  }
207
+ /**
208
+ * Retrieves the mask pattern for a given mask name
209
+ * @param {string} maskName - The name of the mask to retrieve.
210
+ * @returns {any} The mask pattern associated with the given mask name.
211
+ */
187
212
  getMaskPattern(maskName) {
188
213
  if (!this.multiMasks) {
189
214
  this.multiMasks = {};
@@ -195,6 +220,11 @@ class Multivalue extends Field_1.default {
195
220
  this.multiMasks[maskName] = mask ? mask.mask : this.component.inputMasks[0].mask;
196
221
  return this.multiMasks[maskName];
197
222
  }
223
+ /**
224
+ * Attaches a selectable mask to an input field based on its configuration.
225
+ * @param {number} index - The index of the select or input in component array.
226
+ * @returns {boolean} - Returns true if the mask was successfully attached
227
+ */
198
228
  attachMultiMask(index) {
199
229
  if (!(this.isMultipleMasksField && this.component.inputMasks.length && this.refs.input.length)) {
200
230
  return false;
@@ -205,6 +235,10 @@ class Multivalue extends Field_1.default {
205
235
  this.setInputMask(maskSelect.maskInput, this.component.inputMasks[0].mask);
206
236
  return true;
207
237
  }
238
+ /**
239
+ * @param {any} input - The input element on which the mask is to be applied.
240
+ * @param {string} mask - The mask pattern to apply to the input element. Exit early if no mask.
241
+ */
208
242
  updateMask(input, mask) {
209
243
  if (!mask) {
210
244
  return;
@@ -214,7 +248,7 @@ class Multivalue extends Field_1.default {
214
248
  }
215
249
  /**
216
250
  * Adds a new empty value to the data array.
217
- * @param value
251
+ * @param {any} value -A value to be added to the data array.
218
252
  */
219
253
  addNewValue(value) {
220
254
  if (value === undefined) {