@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
@@ -403,14 +403,13 @@ function checkCondition(component, row, data, form, instance) {
403
403
  exports.checkCondition = checkCondition;
404
404
  /**
405
405
  * Test a trigger on a component.
406
- * @param component
407
- * @param action
408
- * @param trigger
409
- * @param data
410
- * @param row
411
- * @param form
412
- * @param instance
413
- * @returns {mixed}
406
+ * @param {import('@formio/core').Component} component - The component to test the trigger against.
407
+ * @param {import('@formio/core').LogicTrigger} trigger - The trigger configuration.
408
+ * @param {import('@formio/core').DataObject} row - The contextual row data.
409
+ * @param {import('@formio/core').DataObject} data - The root data object.
410
+ * @param {import('@formio/core').Form} form - The form object.
411
+ * @param {any} instance - The component that is performing the trigger.
412
+ * @returns {boolean} - TRUE if the trigger should fire; FALSE otherwise.
414
413
  */
415
414
  function checkTrigger(component, trigger, row, data, form, instance) {
416
415
  // If trigger is empty, don't fire it
@@ -431,13 +430,14 @@ function checkTrigger(component, trigger, row, data, form, instance) {
431
430
  }
432
431
  exports.checkTrigger = checkTrigger;
433
432
  /**
434
- *
435
- * @param component
436
- * @param action
437
- * @param result
438
- * @param row
439
- * @param data
440
- * @param instance
433
+ * Sets a property on a component via an executed Logic action.
434
+ * @param {import('@formio/core').Component} component - The component to set the property on.
435
+ * @param {import('@formio/core').LogicAction} action - The action to perform on the component.
436
+ * @param {string} result - The name of the variable in the evaulation to use as the result.
437
+ * @param {import('@formio/core').DataObject} row - The contextual row data.
438
+ * @param {import('@formio/core').DataObject} data - The full submission data.
439
+ * @param {any} instance - The component instance.
440
+ * @returns {import('@formio/core').Component} - The modified component.
441
441
  */
442
442
  function setActionProperty(component, action, result, row, data, instance) {
443
443
  const property = action.property.value;
@@ -473,8 +473,8 @@ function setActionProperty(component, action, result, row, data, instance) {
473
473
  exports.setActionProperty = setActionProperty;
474
474
  /**
475
475
  * Unescape HTML characters like &lt, &gt, &amp and etc.
476
- * @param str
477
- * @returns {string}
476
+ * @param {string} str - The string to unescape.
477
+ * @returns {string} - The unescaped string.
478
478
  */
479
479
  function unescapeHTML(str) {
480
480
  if (typeof window === 'undefined' || !('DOMParser' in window)) {
@@ -486,14 +486,9 @@ function unescapeHTML(str) {
486
486
  exports.unescapeHTML = unescapeHTML;
487
487
  /**
488
488
  * Make HTML element from string
489
- * @param str
490
- * @param selector
491
- * @returns {HTMLElement}
492
- */
493
- /**
494
- *
495
- * @param str
496
- * @param selector
489
+ * @param {string} str - The string to convert to an HTML element.
490
+ * @param {string} selector - The selector to use to get the element once it is created.
491
+ * @returns {HTMLElement} - The HTML element that was created.
497
492
  */
498
493
  function convertStringToHTMLElement(str, selector) {
499
494
  const doc = new window.DOMParser().parseFromString(str, 'text/html');
@@ -502,10 +497,10 @@ function convertStringToHTMLElement(str, selector) {
502
497
  exports.convertStringToHTMLElement = convertStringToHTMLElement;
503
498
  /**
504
499
  * Make a filename guaranteed to be unique.
505
- * @param name
506
- * @param template
507
- * @param evalContext
508
- * @returns {string}
500
+ * @param {string} name - The original name of the file.
501
+ * @param {string} template - The template to use for the unique name.
502
+ * @param {object} evalContext - The context to use for the evaluation.
503
+ * @returns {string} - A unique filename.
509
504
  */
510
505
  function uniqueName(name, template, evalContext) {
511
506
  template = template || '{{fileName}}-{{guid}}';
@@ -530,7 +525,8 @@ function uniqueName(name, template, evalContext) {
530
525
  }
531
526
  exports.uniqueName = uniqueName;
532
527
  /**
533
- *
528
+ * Returns a GUID
529
+ * @returns {string} - A GUID.
534
530
  */
535
531
  function guid() {
536
532
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
@@ -544,8 +540,8 @@ function guid() {
544
540
  exports.guid = guid;
545
541
  /**
546
542
  * Return a translated date setting.
547
- * @param date
548
- * @returns {(null|Date)}
543
+ * @param {string|Date} date - The date to translate.
544
+ * @returns {(null|Date)} - The translated date.
549
545
  */
550
546
  function getDateSetting(date) {
551
547
  if (lodash_1.default.isNil(date) || lodash_1.default.isNaN(date) || date === '') {
@@ -588,8 +584,9 @@ function getDateSetting(date) {
588
584
  }
589
585
  exports.getDateSetting = getDateSetting;
590
586
  /**
591
- *
592
- * @param date
587
+ * Returns true if the date is a valid date. False otherwise.
588
+ * @param {Date|string} date - The date to check for validity.
589
+ * @returns {boolean} - TRUE if the date is valid; FALSE otherwise.
593
590
  */
594
591
  function isValidDate(date) {
595
592
  return lodash_1.default.isDate(date) && !lodash_1.default.isNaN(date.getDate());
@@ -597,7 +594,7 @@ function isValidDate(date) {
597
594
  exports.isValidDate = isValidDate;
598
595
  /**
599
596
  * Get the current timezone string.
600
- * @returns {string}
597
+ * @returns {string} - The current timezone.
601
598
  */
602
599
  function currentTimezone() {
603
600
  if (moment_timezone_1.default.currentTimezone) {
@@ -609,9 +606,9 @@ function currentTimezone() {
609
606
  exports.currentTimezone = currentTimezone;
610
607
  /**
611
608
  * Get an offset date provided a date object and timezone object.
612
- * @param date
613
- * @param timezone
614
- * @returns {Date}
609
+ * @param {Date} date - The date to offset.
610
+ * @param {string} timezone - The timezone to offset the date to.
611
+ * @returns {Date} - The offset date.
615
612
  */
616
613
  function offsetDate(date, timezone) {
617
614
  if (timezone === 'UTC') {
@@ -629,7 +626,7 @@ function offsetDate(date, timezone) {
629
626
  exports.offsetDate = offsetDate;
630
627
  /**
631
628
  * Returns if the zones are loaded.
632
- * @returns {boolean}
629
+ * @returns {boolean} - TRUE if the zones are loaded; FALSE otherwise.
633
630
  */
634
631
  function zonesLoaded() {
635
632
  return moment_timezone_1.default.zonesLoaded;
@@ -637,8 +634,8 @@ function zonesLoaded() {
637
634
  exports.zonesLoaded = zonesLoaded;
638
635
  /**
639
636
  * Returns if we should load the zones.
640
- * @param timezone
641
- * @returns {boolean}
637
+ * @param {string} timezone - The timezone to check if we should load the zones.
638
+ * @returns {boolean} - TRUE if we should load the zones; FALSE otherwise.
642
639
  */
643
640
  function shouldLoadZones(timezone) {
644
641
  if (timezone === currentTimezone() || timezone === 'UTC') {
@@ -649,9 +646,9 @@ function shouldLoadZones(timezone) {
649
646
  exports.shouldLoadZones = shouldLoadZones;
650
647
  /**
651
648
  * Externally load the timezone data.
652
- * @param url
653
- * @param timezone
654
- * @returns {Promise<any> | *}
649
+ * @param {string} url - The URL to load the timezone data from.
650
+ * @param {string} timezone - The timezone to load.
651
+ * @returns {Promise<any> | *} - Resolves when the zones for this timezone are loaded.
655
652
  */
656
653
  function loadZones(url, timezone) {
657
654
  if (timezone && !shouldLoadZones(timezone)) {
@@ -676,10 +673,10 @@ function loadZones(url, timezone) {
676
673
  exports.loadZones = loadZones;
677
674
  /**
678
675
  * Get the moment date object for translating dates with timezones.
679
- * @param value
680
- * @param format
681
- * @param timezone
682
- * @returns {*}
676
+ * @param {string|Date} value - The value to convert into a moment date.
677
+ * @param {string} format - The format to convert the date to.
678
+ * @param {string} timezone - The timezone to convert the date to.
679
+ * @returns {Date} - The moment date object.
683
680
  */
684
681
  function momentDate(value, format, timezone) {
685
682
  const momentDate = (0, moment_timezone_1.default)(value);
@@ -697,12 +694,12 @@ function momentDate(value, format, timezone) {
697
694
  exports.momentDate = momentDate;
698
695
  /**
699
696
  * Format a date provided a value, format, and timezone object.
700
- * @param timezonesUrl
701
- * @param value
702
- * @param format
703
- * @param timezone
704
- * @param flatPickrInputFormat
705
- * @returns {string}
697
+ * @param {string} timezonesUrl - The URL to load the timezone data from.
698
+ * @param {string|Date} value - The value to format.
699
+ * @param {string} format - The format to format the date to.
700
+ * @param {string} timezone - The timezone to format the date to.
701
+ * @param {string} flatPickrInputFormat - The format to use for flatpickr input.
702
+ * @returns {string} - The formatted date.
706
703
  */
707
704
  function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat) {
708
705
  const momentDate = (0, moment_timezone_1.default)(value, flatPickrInputFormat || undefined);
@@ -736,12 +733,12 @@ function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat)
736
733
  exports.formatDate = formatDate;
737
734
  /**
738
735
  * Pass a format function to format within a timezone.
739
- * @param timezonesUrl
740
- * @param formatFn
741
- * @param date
742
- * @param format
743
- * @param timezone
744
- * @returns {string}
736
+ * @param {string} timezonesUrl - The URL to load the timezone data from.
737
+ * @param {Function} formatFn - The format function to use.
738
+ * @param {Date|string} date - The date to format.
739
+ * @param {string} format - The format to format the date to.
740
+ * @param {string} timezone - The timezone to format the date to.
741
+ * @returns {string} - The formatted date.
745
742
  */
746
743
  function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
747
744
  if (timezone === currentTimezone()) {
@@ -762,8 +759,9 @@ function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
762
759
  }
763
760
  exports.formatOffset = formatOffset;
764
761
  /**
765
- *
766
- * @param locale
762
+ * Returns the local date format information.
763
+ * @param {Intl.LocalesArgument} locale - The locale to get the date format for.
764
+ * @returns {object} - The local date format information.
767
765
  */
768
766
  function getLocaleDateFormatInfo(locale) {
769
767
  const formatInfo = {};
@@ -776,8 +774,8 @@ function getLocaleDateFormatInfo(locale) {
776
774
  exports.getLocaleDateFormatInfo = getLocaleDateFormatInfo;
777
775
  /**
778
776
  * Convert the format from the angular-datepicker module to flatpickr format.
779
- * @param format
780
- * @returns {string}
777
+ * @param {string} format - The format to convert.
778
+ * @returns {string} - The converted format.
781
779
  */
782
780
  function convertFormatToFlatpickr(format) {
783
781
  return format
@@ -808,8 +806,8 @@ function convertFormatToFlatpickr(format) {
808
806
  exports.convertFormatToFlatpickr = convertFormatToFlatpickr;
809
807
  /**
810
808
  * Convert the format from the angular-datepicker module to moment format.
811
- * @param format
812
- * @returns {string}
809
+ * @param {string} format - The format to convert.
810
+ * @returns {string} - The converted format.
813
811
  */
814
812
  function convertFormatToMoment(format) {
815
813
  return format
@@ -826,8 +824,9 @@ function convertFormatToMoment(format) {
826
824
  }
827
825
  exports.convertFormatToMoment = convertFormatToMoment;
828
826
  /**
829
- *
830
- * @param format
827
+ * Convert the format from the angular-datepicker module to mask format.
828
+ * @param {string} format - The format to convert.
829
+ * @returns {string} - The converted format.
831
830
  */
832
831
  function convertFormatToMask(format) {
833
832
  return format
@@ -889,10 +888,11 @@ function getInputMask(mask, placeholderChar) {
889
888
  }
890
889
  exports.getInputMask = getInputMask;
891
890
  /**
892
- *
893
- * @param value
894
- * @param mask
895
- * @param placeholderChar
891
+ * Unmasks a value using the provided mask and placeholder characters.
892
+ * @param {string} value - The value to unmask.
893
+ * @param {string} mask - The mask to use for unmasking.
894
+ * @param {string} placeholderChar - The placeholder character to use for unmasking.
895
+ * @returns {string} - The unmasked value.
896
896
  */
897
897
  function unmaskValue(value, mask, placeholderChar) {
898
898
  if (!mask || !value || value.length > mask.length) {
@@ -911,9 +911,10 @@ function unmaskValue(value, mask, placeholderChar) {
911
911
  }
912
912
  exports.unmaskValue = unmaskValue;
913
913
  /**
914
- *
915
- * @param value
916
- * @param inputMask
914
+ * Returns true if the value matches the input mask format.
915
+ * @param {string} value - The value to check.
916
+ * @param {string} inputMask - The input mask to check against.
917
+ * @returns {boolean} - TRUE if the value matches the input mask; FALSE otherwise.
917
918
  */
918
919
  function matchInputMask(value, inputMask) {
919
920
  if (!inputMask) {
@@ -934,8 +935,9 @@ function matchInputMask(value, inputMask) {
934
935
  }
935
936
  exports.matchInputMask = matchInputMask;
936
937
  /**
937
- *
938
- * @param lang
938
+ * Returns the number separators (i.e. 1,000) for the provided language.
939
+ * @param {string} lang - The language code to get the number separators for.
940
+ * @returns {{delimiter: string, decimalSeparator: string}} - The number separators.
939
941
  */
940
942
  function getNumberSeparators(lang = 'en') {
941
943
  const formattedNumberString = (12345.6789).toLocaleString(lang);
@@ -953,9 +955,10 @@ function getNumberSeparators(lang = 'en') {
953
955
  }
954
956
  exports.getNumberSeparators = getNumberSeparators;
955
957
  /**
956
- *
957
- * @param component
958
- * @param defaultLimit
958
+ * Returns the number for the maximum amount of decimal places for a number.
959
+ * @param {import('@formio/core').Component} component - The component to check for decimal limits.
960
+ * @param {number} defaultLimit - The default limit to use if none is provided in the component.
961
+ * @returns {number} - The number of decimal places allowed.
959
962
  */
960
963
  function getNumberDecimalLimit(component, defaultLimit) {
961
964
  if (lodash_1.default.has(component, 'decimalLimit')) {
@@ -974,12 +977,13 @@ function getNumberDecimalLimit(component, defaultLimit) {
974
977
  }
975
978
  exports.getNumberDecimalLimit = getNumberDecimalLimit;
976
979
  /**
977
- *
978
- * @param root0
979
- * @param root0.currency
980
- * @param root0.decimalLimit
981
- * @param root0.decimalSeparator
982
- * @param root0.lang
980
+ * Returns the currency affixes for a specific language.
981
+ * @param {object} arg0 - The arguments object.
982
+ * @param {string} arg0.currency - The currency code to get the affixes for.
983
+ * @param {number} arg0.decimalLimit - The number of decimal places to use.
984
+ * @param {string} arg0.decimalSeparator - The decimal separator to use.
985
+ * @param {string} arg0.lang - The language code to use.
986
+ * @returns {{prefix: string, suffix: string}} - The currency affixes.
983
987
  */
984
988
  function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }) {
985
989
  // Get the prefix and suffix from the localized string.
@@ -1003,9 +1007,9 @@ function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, })
1003
1007
  exports.getCurrencyAffixes = getCurrencyAffixes;
1004
1008
  /**
1005
1009
  * Fetch the field data provided a component.
1006
- * @param data
1007
- * @param component
1008
- * @returns {*}
1010
+ * @param {import('@formio/core').DataObject} data - The data object to fetch the field data from.
1011
+ * @param {import('@formio/core').Component} component - The component to fetch the field data for.
1012
+ * @returns {*} - The field data.
1009
1013
  */
1010
1014
  function fieldData(data, component) {
1011
1015
  if (!data) {
@@ -1052,10 +1056,10 @@ function fieldData(data, component) {
1052
1056
  exports.fieldData = fieldData;
1053
1057
  /**
1054
1058
  * Delays function execution with possibility to execute function synchronously or cancel it.
1055
- * @param fn Function to delay
1056
- * @param delay Delay time
1057
- * @param {...any} args
1058
- * @returns {*}
1059
+ * @param {Function} fn - Function to delay
1060
+ * @param {number} delay - Delay time
1061
+ * @param {...any} args - Arguments to pass to the function
1062
+ * @returns {*} - Function to cancel the delay
1059
1063
  */
1060
1064
  function delay(fn, delay = 0, ...args) {
1061
1065
  const timer = setTimeout(fn, delay, ...args);
@@ -1066,7 +1070,8 @@ function delay(fn, delay = 0, ...args) {
1066
1070
  clearTimeout(timer);
1067
1071
  }
1068
1072
  /**
1069
- *
1073
+ * Execute the function early.
1074
+ * @returns {*} - The result of the function.
1070
1075
  */
1071
1076
  function earlyCall() {
1072
1077
  cancel();
package/lib/mjs/Form.d.ts CHANGED
@@ -1,27 +1,298 @@
1
1
  export default class Form extends Element {
2
2
  static embed(embed: any): Promise<any>;
3
+ constructor(elementOrForm: any, formOrOptions: any, options?: {});
4
+ /**
5
+ * Represents a JSON value.
6
+ * @typedef {(string | number | boolean | null | JSONArray | JSONObject)} JSON
7
+ */
8
+ /**
9
+ * Represents a JSON array.
10
+ * @typedef {Array<JSON>} JSONArray
11
+ */
12
+ /**
13
+ * Represents a JSON object.
14
+ * @typedef {{[key: string]: JSON}} JSONObject
15
+ */
16
+ /**
17
+ * @typedef {object} FormioHooks
18
+ * @property {Function} [beforeSubmit]
19
+ * @property {Function} [beforeCancel]
20
+ * @property {Function} [beforeNext]
21
+ * @property {Function} [beforePrev]
22
+ * @property {Function} [attachComponent]
23
+ * @property {Function} [setDataValue]
24
+ * @property {Function} [addComponents]
25
+ * @property {Function} [addComponent]
26
+ * @property {Function} [customValidation]
27
+ * @property {Function} [attachWebform]
28
+ */
29
+ /**
30
+ * @typedef {object} SanitizeConfig
31
+ * @property {string[]} [addAttr]
32
+ * @property {string[]} [addTags]
33
+ * @property {string[]} [allowedAttrs]
34
+ * @property {string[]} [allowedTags]
35
+ * @property {string[]} [allowedUriRegex]
36
+ * @property {string[]} [addUriSafeAttr]
37
+ */
38
+ /**
39
+ * @typedef {object} ButtonSettings
40
+ * @property {boolean} [showPrevious]
41
+ * @property {boolean} [showNext]
42
+ * @property {boolean} [showCancel]
43
+ * @property {boolean} [showSubmit]
44
+ */
45
+ /**
46
+ * @typedef {object} FormOptions
47
+ * @property {boolean} [saveDraft] - Enable the save draft feature.
48
+ * @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
49
+ * @property {boolean} [readOnly] - Set this form to readOnly.
50
+ * @property {boolean} [noAlerts] - Disable the alerts dialog.
51
+ * @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
52
+ * @property {string} [template] - Custom logic for creation of elements.
53
+ * @property {boolean} [noDefaults] - Exclude default values from the settings.
54
+ * @property {any} [fileService] - The file service for this form.
55
+ * @property {EventEmitter} [events] - The EventEmitter for this form.
56
+ * @property {string} [language] - The language to render this form in.
57
+ * @property {{[key: string]: string}} [i18next] - The i18next configuration for this form.
58
+ * @property {boolean} [viewAsHtml] - View the form as raw HTML.
59
+ * @property {'form' | 'html' | 'flat' | 'builder' | 'pdf'} [renderMode] - The render mode for this form.
60
+ * @property {boolean} [highlightErrors] - Highlight any errors on the form.
61
+ * @property {string} [componentErrorClass] - The error class for components.
62
+ * @property {any} [templates] - The templates for this form.
63
+ * @property {string} [iconset] - The iconset for this form.
64
+ * @property {import('@formio/core').Component[]} [components] - The components for this form.
65
+ * @property {{[key: string]: boolean}} [disabled] - Disabled components for this form.
66
+ * @property {boolean} [showHiddenFields] - Show hidden fields.
67
+ * @property {{[key: string]: boolean}} [hide] - Hidden components for this form.
68
+ * @property {{[key: string]: boolean}} [show] - Components to show for this form.
69
+ * @property {Formio} [formio] - The Formio instance for this form.
70
+ * @property {string} [decimalSeparator] - The decimal separator for this form.
71
+ * @property {string} [thousandsSeparator] - The thousands separator for this form.
72
+ * @property {FormioHooks} [hooks] - The hooks for this form.
73
+ * @property {boolean} [alwaysDirty] - Always be dirty.
74
+ * @property {boolean} [skipDraftRestore] - Skip restoring a draft.
75
+ * @property {'form' | 'wizard' | 'pdf'} [display] - The display for this form.
76
+ * @property {string} [cdnUrl] - The CDN url for this form.
77
+ * @property {boolean} [flatten] - Flatten the form.
78
+ * @property {boolean} [sanitize] - Sanitize the form.
79
+ * @property {SanitizeConfig} [sanitizeConfig] - The sanitize configuration for this form.
80
+ * @property {ButtonSettings} [buttonSettings] - The button settings for this form.
81
+ * @property {object} [breadcrumbSettings] - The breadcrumb settings for this form.
82
+ * @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
83
+ * @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
84
+ * @property {boolean} [showCheckboxBackground] - Show the checkbox background.
85
+ * @property {number} [zoom] - The zoom for PDF forms.
86
+ */
3
87
  /**
4
88
  * Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.
5
- * @param {object} element - The DOM element you wish to render this form within.
6
- * @param {object | string} form - Either a Form JSON schema or the URL of a hosted form via. form.io.
7
- * @param {object} options - The options to create a new form instance.
8
- * @param {boolean} options.readOnly - Set this form to readOnly
9
- * @param {boolean} options.noAlerts - Set to true to disable the alerts dialog.
10
- * @param {boolean} options.i18n - The translation file for this rendering. @see https://github.com/formio/formio.js/blob/master/i18n.js
11
- * @param {boolean} options.template - Provides a way to inject custom logic into the creation of every element rendered within the form.
12
- * @param {...any} args
89
+ * @param {object} elementOrForm - The DOM element you wish to render this form within, or the form definition.
90
+ * @param {object | string | FormOptions} formOrOptions - A Form JSON schema, the URL of a hosted form, or the form options.
91
+ * @param {FormOptions} [options] - The options to create a new form instance.
13
92
  * @example
14
93
  * import Form from '@formio/js/Form';
15
94
  * const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');
16
95
  * form.build();
17
96
  */
18
- constructor(...args: any[]);
97
+ /**
98
+ * @type {FormOptions} - the options for this Form.
99
+ */
100
+ options: {
101
+ /**
102
+ * - Enable the save draft feature.
103
+ */
104
+ saveDraft?: boolean | undefined;
105
+ /**
106
+ * - The throttle for the save draft feature.
107
+ */
108
+ saveDraftThrottle?: number | undefined;
109
+ /**
110
+ * - Set this form to readOnly.
111
+ */
112
+ readOnly?: boolean | undefined;
113
+ /**
114
+ * - Disable the alerts dialog.
115
+ */
116
+ noAlerts?: boolean | undefined;
117
+ /**
118
+ * - The translation file for this rendering.
119
+ */
120
+ i18n?: {
121
+ [key: string]: string;
122
+ } | undefined;
123
+ /**
124
+ * - Custom logic for creation of elements.
125
+ */
126
+ template?: string | undefined;
127
+ /**
128
+ * - Exclude default values from the settings.
129
+ */
130
+ noDefaults?: boolean | undefined;
131
+ /**
132
+ * - The file service for this form.
133
+ */
134
+ fileService?: any;
135
+ /**
136
+ * - The EventEmitter for this form.
137
+ */
138
+ events?: any;
139
+ /**
140
+ * - The language to render this form in.
141
+ */
142
+ language?: string | undefined;
143
+ /**
144
+ * - The i18next configuration for this form.
145
+ */
146
+ i18next?: {
147
+ [key: string]: string;
148
+ } | undefined;
149
+ /**
150
+ * - View the form as raw HTML.
151
+ */
152
+ viewAsHtml?: boolean | undefined;
153
+ /**
154
+ * - The render mode for this form.
155
+ */
156
+ renderMode?: "builder" | "form" | "html" | "flat" | "pdf" | undefined;
157
+ /**
158
+ * - Highlight any errors on the form.
159
+ */
160
+ highlightErrors?: boolean | undefined;
161
+ /**
162
+ * - The error class for components.
163
+ */
164
+ componentErrorClass?: string | undefined;
165
+ /**
166
+ * - The templates for this form.
167
+ */
168
+ templates?: any;
169
+ /**
170
+ * - The iconset for this form.
171
+ */
172
+ iconset?: string | undefined;
173
+ /**
174
+ * - The components for this form.
175
+ */
176
+ components?: import("@formio/core").Component[] | undefined;
177
+ /**
178
+ * - Disabled components for this form.
179
+ */
180
+ disabled?: {
181
+ [key: string]: boolean;
182
+ } | undefined;
183
+ /**
184
+ * - Show hidden fields.
185
+ */
186
+ showHiddenFields?: boolean | undefined;
187
+ /**
188
+ * - Hidden components for this form.
189
+ */
190
+ hide?: {
191
+ [key: string]: boolean;
192
+ } | undefined;
193
+ /**
194
+ * - Components to show for this form.
195
+ */
196
+ show?: {
197
+ [key: string]: boolean;
198
+ } | undefined;
199
+ /**
200
+ * - The Formio instance for this form.
201
+ */
202
+ formio?: any;
203
+ /**
204
+ * - The decimal separator for this form.
205
+ */
206
+ decimalSeparator?: string | undefined;
207
+ /**
208
+ * - The thousands separator for this form.
209
+ */
210
+ thousandsSeparator?: string | undefined;
211
+ /**
212
+ * - The hooks for this form.
213
+ */
214
+ hooks?: {
215
+ beforeSubmit?: Function | undefined;
216
+ beforeCancel?: Function | undefined;
217
+ beforeNext?: Function | undefined;
218
+ beforePrev?: Function | undefined;
219
+ attachComponent?: Function | undefined;
220
+ setDataValue?: Function | undefined;
221
+ addComponents?: Function | undefined;
222
+ addComponent?: Function | undefined;
223
+ customValidation?: Function | undefined;
224
+ attachWebform?: Function | undefined;
225
+ } | undefined;
226
+ /**
227
+ * - Always be dirty.
228
+ */
229
+ alwaysDirty?: boolean | undefined;
230
+ /**
231
+ * - Skip restoring a draft.
232
+ */
233
+ skipDraftRestore?: boolean | undefined;
234
+ /**
235
+ * - The display for this form.
236
+ */
237
+ display?: "form" | "pdf" | "wizard" | undefined;
238
+ /**
239
+ * - The CDN url for this form.
240
+ */
241
+ cdnUrl?: string | undefined;
242
+ /**
243
+ * - Flatten the form.
244
+ */
245
+ flatten?: boolean | undefined;
246
+ /**
247
+ * - Sanitize the form.
248
+ */
249
+ sanitize?: boolean | undefined;
250
+ /**
251
+ * - The sanitize configuration for this form.
252
+ */
253
+ sanitizeConfig?: {
254
+ addAttr?: string[] | undefined;
255
+ addTags?: string[] | undefined;
256
+ allowedAttrs?: string[] | undefined;
257
+ allowedTags?: string[] | undefined;
258
+ allowedUriRegex?: string[] | undefined;
259
+ addUriSafeAttr?: string[] | undefined;
260
+ } | undefined;
261
+ /**
262
+ * - The button settings for this form.
263
+ */
264
+ buttonSettings?: {
265
+ showPrevious?: boolean | undefined;
266
+ showNext?: boolean | undefined;
267
+ showCancel?: boolean | undefined;
268
+ showSubmit?: boolean | undefined;
269
+ } | undefined;
270
+ /**
271
+ * - The breadcrumb settings for this form.
272
+ */
273
+ breadcrumbSettings?: object | undefined;
274
+ /**
275
+ * - Allow the previous button (for Wizard forms).
276
+ */
277
+ allowPrevious?: boolean | undefined;
278
+ /**
279
+ * - The order of the buttons (for Wizard forms).
280
+ */
281
+ wizardButtonOrder?: string[] | undefined;
282
+ /**
283
+ * - Show the checkbox background.
284
+ */
285
+ showCheckboxBackground?: boolean | undefined;
286
+ /**
287
+ * - The zoom for PDF forms.
288
+ */
289
+ zoom?: number | undefined;
290
+ };
19
291
  ready: Promise<any>;
20
292
  readyResolve: (value: any) => void;
21
293
  readyReject: (reason?: any) => void;
22
294
  instance: any;
23
295
  element: any;
24
- options: any;
25
296
  display: string;
26
297
  createElement(tag: any, attrs: any, children: any): any;
27
298
  set loading(load: any);