@formio/js 5.0.0-rc.52 → 5.0.0-rc.53
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +551 -541
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -1
- package/dist/formio.full.js +553 -543
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -1
- package/dist/formio.js +10 -10
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +14 -4
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +3 -1
- package/lib/cjs/Form.d.ts +281 -10
- package/lib/cjs/Form.js +22 -35
- package/lib/cjs/FormBuilder.d.ts +187 -2
- package/lib/cjs/FormBuilder.js +29 -6
- package/lib/cjs/PDF.d.ts +0 -1
- package/lib/cjs/Webform.d.ts +6 -6
- package/lib/cjs/Webform.js +2 -2
- package/lib/cjs/Wizard.d.ts +1 -1
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -6
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -4
- package/lib/cjs/components/_classes/field/Field.d.ts +11 -2
- package/lib/cjs/components/_classes/field/Field.js +13 -1
- package/lib/cjs/components/_classes/input/Input.d.ts +4 -3
- package/lib/cjs/components/_classes/input/Input.js +2 -2
- package/lib/cjs/components/_classes/list/ListComponent.form.d.ts +4 -5
- package/lib/cjs/components/_classes/list/ListComponent.form.js +3 -2
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +42 -11
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +37 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +127 -33
- package/lib/cjs/components/_classes/nested/NestedComponent.js +133 -15
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +6 -0
- package/lib/cjs/components/address/Address.d.ts +2 -1
- package/lib/cjs/components/button/Button.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/columns/Columns.d.ts +1 -1
- package/lib/cjs/components/container/Container.d.ts +1 -0
- package/lib/cjs/components/datagrid/DataGrid.d.ts +1 -1
- package/lib/cjs/components/day/Day.d.ts +1 -1
- package/lib/cjs/components/editgrid/EditGrid.d.ts +2 -0
- package/lib/cjs/components/file/File.d.ts +2 -2
- package/lib/cjs/components/number/Number.d.ts +1 -1
- package/lib/cjs/components/radio/Radio.d.ts +1 -1
- package/lib/cjs/components/radio/Radio.form.d.ts +1 -3
- package/lib/cjs/components/radio/Radio.js +3 -3
- package/lib/cjs/components/select/Select.d.ts +9 -14
- package/lib/cjs/components/select/Select.form.d.ts +1 -3
- package/lib/cjs/components/select/Select.js +11 -15
- package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +1 -3
- package/lib/cjs/components/survey/Survey.d.ts +1 -1
- package/lib/cjs/components/table/Table.d.ts +1 -1
- package/lib/cjs/components/tabs/Tabs.d.ts +1 -1
- package/lib/cjs/components/textfield/TextField.d.ts +1 -1
- package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +1 -1
- package/lib/cjs/providers/address/NominatimAddressProvider.js +5 -1
- package/lib/cjs/providers/processor/fileProcessor.d.ts +7 -1
- package/lib/cjs/providers/processor/fileProcessor.js +6 -0
- package/lib/cjs/providers/storage/azure.d.ts +4 -15
- package/lib/cjs/providers/storage/azure.js +3 -2
- package/lib/cjs/providers/storage/base64.d.ts +3 -7
- package/lib/cjs/providers/storage/base64.js +2 -1
- package/lib/cjs/providers/storage/dropbox.d.ts +4 -6
- package/lib/cjs/providers/storage/dropbox.js +3 -2
- package/lib/cjs/providers/storage/googleDrive.d.ts +4 -6
- package/lib/cjs/providers/storage/googleDrive.js +3 -1
- package/lib/cjs/providers/storage/indexeddb.d.ts +3 -8
- package/lib/cjs/providers/storage/indexeddb.js +2 -1
- package/lib/cjs/providers/storage/s3.d.ts +4 -22
- package/lib/cjs/providers/storage/s3.js +3 -2
- package/lib/cjs/providers/storage/url.d.ts +3 -8
- package/lib/cjs/providers/storage/url.js +4 -3
- package/lib/cjs/providers/storage/util.d.ts +22 -6
- package/lib/cjs/providers/storage/util.js +16 -5
- package/lib/cjs/utils/builder.d.ts +9 -7
- package/lib/cjs/utils/builder.js +10 -5
- package/lib/cjs/utils/calendarUtils.d.ts +6 -10
- package/lib/cjs/utils/calendarUtils.js +7 -11
- package/lib/cjs/utils/formUtils.d.ts +4 -4
- package/lib/cjs/utils/formUtils.js +3 -3
- package/lib/cjs/utils/utils.d.ts +123 -121
- package/lib/cjs/utils/utils.js +99 -94
- package/lib/mjs/Form.d.ts +281 -10
- package/lib/mjs/Form.js +112 -28
- package/lib/mjs/FormBuilder.d.ts +187 -2
- package/lib/mjs/FormBuilder.js +31 -6
- package/lib/mjs/PDF.d.ts +0 -1
- package/lib/mjs/Webform.d.ts +6 -6
- package/lib/mjs/Webform.js +3 -3
- package/lib/mjs/Wizard.d.ts +1 -1
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -6
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -4
- package/lib/mjs/components/_classes/field/Field.d.ts +11 -2
- package/lib/mjs/components/_classes/field/Field.js +13 -1
- package/lib/mjs/components/_classes/input/Input.d.ts +4 -3
- package/lib/mjs/components/_classes/input/Input.js +2 -2
- package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +4 -5
- package/lib/mjs/components/_classes/list/ListComponent.form.js +3 -2
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +42 -11
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +37 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +127 -33
- package/lib/mjs/components/_classes/nested/NestedComponent.js +133 -15
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +6 -0
- package/lib/mjs/components/address/Address.d.ts +2 -1
- package/lib/mjs/components/button/Button.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/columns/Columns.d.ts +1 -1
- package/lib/mjs/components/container/Container.d.ts +1 -0
- package/lib/mjs/components/datagrid/DataGrid.d.ts +1 -1
- package/lib/mjs/components/day/Day.d.ts +1 -1
- package/lib/mjs/components/editgrid/EditGrid.d.ts +2 -0
- package/lib/mjs/components/file/File.d.ts +2 -2
- package/lib/mjs/components/number/Number.d.ts +1 -1
- package/lib/mjs/components/radio/Radio.d.ts +1 -1
- package/lib/mjs/components/radio/Radio.form.d.ts +1 -3
- package/lib/mjs/components/radio/Radio.js +3 -3
- package/lib/mjs/components/select/Select.d.ts +9 -14
- package/lib/mjs/components/select/Select.form.d.ts +1 -3
- package/lib/mjs/components/select/Select.js +11 -15
- package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +1 -3
- package/lib/mjs/components/survey/Survey.d.ts +1 -1
- package/lib/mjs/components/table/Table.d.ts +1 -1
- package/lib/mjs/components/tabs/Tabs.d.ts +1 -1
- package/lib/mjs/components/textfield/TextField.d.ts +1 -1
- package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +1 -1
- package/lib/mjs/providers/address/NominatimAddressProvider.js +5 -1
- package/lib/mjs/providers/processor/fileProcessor.d.ts +7 -1
- package/lib/mjs/providers/processor/fileProcessor.js +6 -0
- package/lib/mjs/providers/storage/azure.d.ts +4 -15
- package/lib/mjs/providers/storage/azure.js +3 -2
- package/lib/mjs/providers/storage/base64.d.ts +3 -7
- package/lib/mjs/providers/storage/base64.js +2 -1
- package/lib/mjs/providers/storage/dropbox.d.ts +4 -6
- package/lib/mjs/providers/storage/dropbox.js +3 -2
- package/lib/mjs/providers/storage/googleDrive.d.ts +4 -6
- package/lib/mjs/providers/storage/googleDrive.js +3 -1
- package/lib/mjs/providers/storage/indexeddb.d.ts +3 -8
- package/lib/mjs/providers/storage/indexeddb.js +2 -1
- package/lib/mjs/providers/storage/s3.d.ts +4 -22
- package/lib/mjs/providers/storage/s3.js +3 -2
- package/lib/mjs/providers/storage/url.d.ts +3 -8
- package/lib/mjs/providers/storage/url.js +4 -3
- package/lib/mjs/providers/storage/util.d.ts +22 -6
- package/lib/mjs/providers/storage/util.js +16 -5
- package/lib/mjs/utils/builder.d.ts +9 -7
- package/lib/mjs/utils/builder.js +10 -5
- package/lib/mjs/utils/calendarUtils.d.ts +6 -10
- package/lib/mjs/utils/calendarUtils.js +7 -11
- package/lib/mjs/utils/formUtils.d.ts +4 -4
- package/lib/mjs/utils/formUtils.js +3 -3
- package/lib/mjs/utils/utils.d.ts +123 -121
- package/lib/mjs/utils/utils.js +99 -94
- package/package.json +10 -10
package/lib/mjs/utils/utils.js
CHANGED
@@ -353,14 +353,13 @@ export function checkCondition(component, row, data, form, instance) {
|
|
353
353
|
}
|
354
354
|
/**
|
355
355
|
* Test a trigger on a component.
|
356
|
-
* @param component
|
357
|
-
* @param
|
358
|
-
* @param
|
359
|
-
* @param data
|
360
|
-
* @param
|
361
|
-
* @param
|
362
|
-
* @
|
363
|
-
* @returns {mixed}
|
356
|
+
* @param {import('@formio/core').Component} component - The component to test the trigger against.
|
357
|
+
* @param {import('@formio/core').LogicTrigger} trigger - The trigger configuration.
|
358
|
+
* @param {import('@formio/core').DataObject} row - The contextual row data.
|
359
|
+
* @param {import('@formio/core').DataObject} data - The root data object.
|
360
|
+
* @param {import('@formio/core').Form} form - The form object.
|
361
|
+
* @param {any} instance - The component that is performing the trigger.
|
362
|
+
* @returns {boolean} - TRUE if the trigger should fire; FALSE otherwise.
|
364
363
|
*/
|
365
364
|
export function checkTrigger(component, trigger, row, data, form, instance) {
|
366
365
|
// If trigger is empty, don't fire it
|
@@ -380,13 +379,14 @@ export function checkTrigger(component, trigger, row, data, form, instance) {
|
|
380
379
|
return false;
|
381
380
|
}
|
382
381
|
/**
|
383
|
-
*
|
384
|
-
* @param component
|
385
|
-
* @param action
|
386
|
-
* @param result
|
387
|
-
* @param row
|
388
|
-
* @param data
|
389
|
-
* @param instance
|
382
|
+
* Sets a property on a component via an executed Logic action.
|
383
|
+
* @param {import('@formio/core').Component} component - The component to set the property on.
|
384
|
+
* @param {import('@formio/core').LogicAction} action - The action to perform on the component.
|
385
|
+
* @param {string} result - The name of the variable in the evaulation to use as the result.
|
386
|
+
* @param {import('@formio/core').DataObject} row - The contextual row data.
|
387
|
+
* @param {import('@formio/core').DataObject} data - The full submission data.
|
388
|
+
* @param {any} instance - The component instance.
|
389
|
+
* @returns {import('@formio/core').Component} - The modified component.
|
390
390
|
*/
|
391
391
|
export function setActionProperty(component, action, result, row, data, instance) {
|
392
392
|
const property = action.property.value;
|
@@ -421,8 +421,8 @@ export function setActionProperty(component, action, result, row, data, instance
|
|
421
421
|
}
|
422
422
|
/**
|
423
423
|
* Unescape HTML characters like <, >, & and etc.
|
424
|
-
* @param str
|
425
|
-
* @returns {string}
|
424
|
+
* @param {string} str - The string to unescape.
|
425
|
+
* @returns {string} - The unescaped string.
|
426
426
|
*/
|
427
427
|
export function unescapeHTML(str) {
|
428
428
|
if (typeof window === 'undefined' || !('DOMParser' in window)) {
|
@@ -433,14 +433,9 @@ export function unescapeHTML(str) {
|
|
433
433
|
}
|
434
434
|
/**
|
435
435
|
* Make HTML element from string
|
436
|
-
* @param str
|
437
|
-
* @param selector
|
438
|
-
* @returns {HTMLElement}
|
439
|
-
*/
|
440
|
-
/**
|
441
|
-
*
|
442
|
-
* @param str
|
443
|
-
* @param selector
|
436
|
+
* @param {string} str - The string to convert to an HTML element.
|
437
|
+
* @param {string} selector - The selector to use to get the element once it is created.
|
438
|
+
* @returns {HTMLElement} - The HTML element that was created.
|
444
439
|
*/
|
445
440
|
export function convertStringToHTMLElement(str, selector) {
|
446
441
|
const doc = new window.DOMParser().parseFromString(str, 'text/html');
|
@@ -448,10 +443,10 @@ export function convertStringToHTMLElement(str, selector) {
|
|
448
443
|
}
|
449
444
|
/**
|
450
445
|
* Make a filename guaranteed to be unique.
|
451
|
-
* @param name
|
452
|
-
* @param template
|
453
|
-
* @param evalContext
|
454
|
-
* @returns {string}
|
446
|
+
* @param {string} name - The original name of the file.
|
447
|
+
* @param {string} template - The template to use for the unique name.
|
448
|
+
* @param {object} evalContext - The context to use for the evaluation.
|
449
|
+
* @returns {string} - A unique filename.
|
455
450
|
*/
|
456
451
|
export function uniqueName(name, template, evalContext) {
|
457
452
|
template = template || '{{fileName}}-{{guid}}';
|
@@ -475,7 +470,8 @@ export function uniqueName(name, template, evalContext) {
|
|
475
470
|
return uniqueName;
|
476
471
|
}
|
477
472
|
/**
|
478
|
-
*
|
473
|
+
* Returns a GUID
|
474
|
+
* @returns {string} - A GUID.
|
479
475
|
*/
|
480
476
|
export function guid() {
|
481
477
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
@@ -488,8 +484,8 @@ export function guid() {
|
|
488
484
|
}
|
489
485
|
/**
|
490
486
|
* Return a translated date setting.
|
491
|
-
* @param date
|
492
|
-
* @returns {(null|Date)}
|
487
|
+
* @param {string|Date} date - The date to translate.
|
488
|
+
* @returns {(null|Date)} - The translated date.
|
493
489
|
*/
|
494
490
|
export function getDateSetting(date) {
|
495
491
|
if (_.isNil(date) || _.isNaN(date) || date === '') {
|
@@ -531,15 +527,16 @@ export function getDateSetting(date) {
|
|
531
527
|
return dateSetting.toDate();
|
532
528
|
}
|
533
529
|
/**
|
534
|
-
*
|
535
|
-
* @param date
|
530
|
+
* Returns true if the date is a valid date. False otherwise.
|
531
|
+
* @param {Date|string} date - The date to check for validity.
|
532
|
+
* @returns {boolean} - TRUE if the date is valid; FALSE otherwise.
|
536
533
|
*/
|
537
534
|
export function isValidDate(date) {
|
538
535
|
return _.isDate(date) && !_.isNaN(date.getDate());
|
539
536
|
}
|
540
537
|
/**
|
541
538
|
* Get the current timezone string.
|
542
|
-
* @returns {string}
|
539
|
+
* @returns {string} - The current timezone.
|
543
540
|
*/
|
544
541
|
export function currentTimezone() {
|
545
542
|
if (moment.currentTimezone) {
|
@@ -550,9 +547,9 @@ export function currentTimezone() {
|
|
550
547
|
}
|
551
548
|
/**
|
552
549
|
* Get an offset date provided a date object and timezone object.
|
553
|
-
* @param date
|
554
|
-
* @param timezone
|
555
|
-
* @returns {Date}
|
550
|
+
* @param {Date} date - The date to offset.
|
551
|
+
* @param {string} timezone - The timezone to offset the date to.
|
552
|
+
* @returns {Date} - The offset date.
|
556
553
|
*/
|
557
554
|
export function offsetDate(date, timezone) {
|
558
555
|
if (timezone === 'UTC') {
|
@@ -569,15 +566,15 @@ export function offsetDate(date, timezone) {
|
|
569
566
|
}
|
570
567
|
/**
|
571
568
|
* Returns if the zones are loaded.
|
572
|
-
* @returns {boolean}
|
569
|
+
* @returns {boolean} - TRUE if the zones are loaded; FALSE otherwise.
|
573
570
|
*/
|
574
571
|
export function zonesLoaded() {
|
575
572
|
return moment.zonesLoaded;
|
576
573
|
}
|
577
574
|
/**
|
578
575
|
* Returns if we should load the zones.
|
579
|
-
* @param timezone
|
580
|
-
* @returns {boolean}
|
576
|
+
* @param {string} timezone - The timezone to check if we should load the zones.
|
577
|
+
* @returns {boolean} - TRUE if we should load the zones; FALSE otherwise.
|
581
578
|
*/
|
582
579
|
export function shouldLoadZones(timezone) {
|
583
580
|
if (timezone === currentTimezone() || timezone === 'UTC') {
|
@@ -587,9 +584,9 @@ export function shouldLoadZones(timezone) {
|
|
587
584
|
}
|
588
585
|
/**
|
589
586
|
* Externally load the timezone data.
|
590
|
-
* @param url
|
591
|
-
* @param timezone
|
592
|
-
* @returns {Promise<any> | *}
|
587
|
+
* @param {string} url - The URL to load the timezone data from.
|
588
|
+
* @param {string} timezone - The timezone to load.
|
589
|
+
* @returns {Promise<any> | *} - Resolves when the zones for this timezone are loaded.
|
593
590
|
*/
|
594
591
|
export function loadZones(url, timezone) {
|
595
592
|
if (timezone && !shouldLoadZones(timezone)) {
|
@@ -613,10 +610,10 @@ export function loadZones(url, timezone) {
|
|
613
610
|
}
|
614
611
|
/**
|
615
612
|
* Get the moment date object for translating dates with timezones.
|
616
|
-
* @param value
|
617
|
-
* @param format
|
618
|
-
* @param timezone
|
619
|
-
* @returns {
|
613
|
+
* @param {string|Date} value - The value to convert into a moment date.
|
614
|
+
* @param {string} format - The format to convert the date to.
|
615
|
+
* @param {string} timezone - The timezone to convert the date to.
|
616
|
+
* @returns {Date} - The moment date object.
|
620
617
|
*/
|
621
618
|
export function momentDate(value, format, timezone) {
|
622
619
|
const momentDate = moment(value);
|
@@ -633,12 +630,12 @@ export function momentDate(value, format, timezone) {
|
|
633
630
|
}
|
634
631
|
/**
|
635
632
|
* Format a date provided a value, format, and timezone object.
|
636
|
-
* @param timezonesUrl
|
637
|
-
* @param value
|
638
|
-
* @param format
|
639
|
-
* @param timezone
|
640
|
-
* @param flatPickrInputFormat
|
641
|
-
* @returns {string}
|
633
|
+
* @param {string} timezonesUrl - The URL to load the timezone data from.
|
634
|
+
* @param {string|Date} value - The value to format.
|
635
|
+
* @param {string} format - The format to format the date to.
|
636
|
+
* @param {string} timezone - The timezone to format the date to.
|
637
|
+
* @param {string} flatPickrInputFormat - The format to use for flatpickr input.
|
638
|
+
* @returns {string} - The formatted date.
|
642
639
|
*/
|
643
640
|
export function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat) {
|
644
641
|
const momentDate = moment(value, flatPickrInputFormat || undefined);
|
@@ -671,12 +668,12 @@ export function formatDate(timezonesUrl, value, format, timezone, flatPickrInput
|
|
671
668
|
}
|
672
669
|
/**
|
673
670
|
* Pass a format function to format within a timezone.
|
674
|
-
* @param timezonesUrl
|
675
|
-
* @param formatFn
|
676
|
-
* @param date
|
677
|
-
* @param format
|
678
|
-
* @param timezone
|
679
|
-
* @returns {string}
|
671
|
+
* @param {string} timezonesUrl - The URL to load the timezone data from.
|
672
|
+
* @param {Function} formatFn - The format function to use.
|
673
|
+
* @param {Date|string} date - The date to format.
|
674
|
+
* @param {string} format - The format to format the date to.
|
675
|
+
* @param {string} timezone - The timezone to format the date to.
|
676
|
+
* @returns {string} - The formatted date.
|
680
677
|
*/
|
681
678
|
export function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
|
682
679
|
if (timezone === currentTimezone()) {
|
@@ -696,8 +693,9 @@ export function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
|
|
696
693
|
}
|
697
694
|
}
|
698
695
|
/**
|
699
|
-
*
|
700
|
-
* @param locale
|
696
|
+
* Returns the local date format information.
|
697
|
+
* @param {Intl.LocalesArgument} locale - The locale to get the date format for.
|
698
|
+
* @returns {object} - The local date format information.
|
701
699
|
*/
|
702
700
|
export function getLocaleDateFormatInfo(locale) {
|
703
701
|
const formatInfo = {};
|
@@ -709,8 +707,8 @@ export function getLocaleDateFormatInfo(locale) {
|
|
709
707
|
}
|
710
708
|
/**
|
711
709
|
* Convert the format from the angular-datepicker module to flatpickr format.
|
712
|
-
* @param format
|
713
|
-
* @returns {string}
|
710
|
+
* @param {string} format - The format to convert.
|
711
|
+
* @returns {string} - The converted format.
|
714
712
|
*/
|
715
713
|
export function convertFormatToFlatpickr(format) {
|
716
714
|
return format
|
@@ -740,8 +738,8 @@ export function convertFormatToFlatpickr(format) {
|
|
740
738
|
}
|
741
739
|
/**
|
742
740
|
* Convert the format from the angular-datepicker module to moment format.
|
743
|
-
* @param format
|
744
|
-
* @returns {string}
|
741
|
+
* @param {string} format - The format to convert.
|
742
|
+
* @returns {string} - The converted format.
|
745
743
|
*/
|
746
744
|
export function convertFormatToMoment(format) {
|
747
745
|
return format
|
@@ -757,8 +755,9 @@ export function convertFormatToMoment(format) {
|
|
757
755
|
.replace(/U/g, 'X');
|
758
756
|
}
|
759
757
|
/**
|
760
|
-
*
|
761
|
-
* @param format
|
758
|
+
* Convert the format from the angular-datepicker module to mask format.
|
759
|
+
* @param {string} format - The format to convert.
|
760
|
+
* @returns {string} - The converted format.
|
762
761
|
*/
|
763
762
|
export function convertFormatToMask(format) {
|
764
763
|
return format
|
@@ -818,10 +817,11 @@ export function getInputMask(mask, placeholderChar) {
|
|
818
817
|
return maskArray;
|
819
818
|
}
|
820
819
|
/**
|
821
|
-
*
|
822
|
-
* @param value
|
823
|
-
* @param mask
|
824
|
-
* @param placeholderChar
|
820
|
+
* Unmasks a value using the provided mask and placeholder characters.
|
821
|
+
* @param {string} value - The value to unmask.
|
822
|
+
* @param {string} mask - The mask to use for unmasking.
|
823
|
+
* @param {string} placeholderChar - The placeholder character to use for unmasking.
|
824
|
+
* @returns {string} - The unmasked value.
|
825
825
|
*/
|
826
826
|
export function unmaskValue(value, mask, placeholderChar) {
|
827
827
|
if (!mask || !value || value.length > mask.length) {
|
@@ -839,9 +839,10 @@ export function unmaskValue(value, mask, placeholderChar) {
|
|
839
839
|
return unmaskedValue;
|
840
840
|
}
|
841
841
|
/**
|
842
|
-
*
|
843
|
-
* @param value
|
844
|
-
* @param inputMask
|
842
|
+
* Returns true if the value matches the input mask format.
|
843
|
+
* @param {string} value - The value to check.
|
844
|
+
* @param {string} inputMask - The input mask to check against.
|
845
|
+
* @returns {boolean} - TRUE if the value matches the input mask; FALSE otherwise.
|
845
846
|
*/
|
846
847
|
export function matchInputMask(value, inputMask) {
|
847
848
|
if (!inputMask) {
|
@@ -861,8 +862,9 @@ export function matchInputMask(value, inputMask) {
|
|
861
862
|
return true;
|
862
863
|
}
|
863
864
|
/**
|
864
|
-
*
|
865
|
-
* @param lang
|
865
|
+
* Returns the number separators (i.e. 1,000) for the provided language.
|
866
|
+
* @param {string} lang - The language code to get the number separators for.
|
867
|
+
* @returns {{delimiter: string, decimalSeparator: string}} - The number separators.
|
866
868
|
*/
|
867
869
|
export function getNumberSeparators(lang = 'en') {
|
868
870
|
const formattedNumberString = (12345.6789).toLocaleString(lang);
|
@@ -879,9 +881,10 @@ export function getNumberSeparators(lang = 'en') {
|
|
879
881
|
};
|
880
882
|
}
|
881
883
|
/**
|
882
|
-
*
|
883
|
-
* @param component
|
884
|
-
* @param defaultLimit
|
884
|
+
* Returns the number for the maximum amount of decimal places for a number.
|
885
|
+
* @param {import('@formio/core').Component} component - The component to check for decimal limits.
|
886
|
+
* @param {number} defaultLimit - The default limit to use if none is provided in the component.
|
887
|
+
* @returns {number} - The number of decimal places allowed.
|
885
888
|
*/
|
886
889
|
export function getNumberDecimalLimit(component, defaultLimit) {
|
887
890
|
if (_.has(component, 'decimalLimit')) {
|
@@ -899,12 +902,13 @@ export function getNumberDecimalLimit(component, defaultLimit) {
|
|
899
902
|
return decimalLimit;
|
900
903
|
}
|
901
904
|
/**
|
902
|
-
*
|
903
|
-
* @param
|
904
|
-
* @param
|
905
|
-
* @param
|
906
|
-
* @param
|
907
|
-
* @param
|
905
|
+
* Returns the currency affixes for a specific language.
|
906
|
+
* @param {object} arg0 - The arguments object.
|
907
|
+
* @param {string} arg0.currency - The currency code to get the affixes for.
|
908
|
+
* @param {number} arg0.decimalLimit - The number of decimal places to use.
|
909
|
+
* @param {string} arg0.decimalSeparator - The decimal separator to use.
|
910
|
+
* @param {string} arg0.lang - The language code to use.
|
911
|
+
* @returns {{prefix: string, suffix: string}} - The currency affixes.
|
908
912
|
*/
|
909
913
|
export function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }) {
|
910
914
|
// Get the prefix and suffix from the localized string.
|
@@ -927,9 +931,9 @@ export function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, l
|
|
927
931
|
}
|
928
932
|
/**
|
929
933
|
* Fetch the field data provided a component.
|
930
|
-
* @param data
|
931
|
-
* @param component
|
932
|
-
* @returns {*}
|
934
|
+
* @param {import('@formio/core').DataObject} data - The data object to fetch the field data from.
|
935
|
+
* @param {import('@formio/core').Component} component - The component to fetch the field data for.
|
936
|
+
* @returns {*} - The field data.
|
933
937
|
*/
|
934
938
|
export function fieldData(data, component) {
|
935
939
|
if (!data) {
|
@@ -975,10 +979,10 @@ export function fieldData(data, component) {
|
|
975
979
|
}
|
976
980
|
/**
|
977
981
|
* Delays function execution with possibility to execute function synchronously or cancel it.
|
978
|
-
* @param fn Function to delay
|
979
|
-
* @param delay Delay time
|
980
|
-
* @param {...any} args
|
981
|
-
* @returns {*}
|
982
|
+
* @param {Function} fn - Function to delay
|
983
|
+
* @param {number} delay - Delay time
|
984
|
+
* @param {...any} args - Arguments to pass to the function
|
985
|
+
* @returns {*} - Function to cancel the delay
|
982
986
|
*/
|
983
987
|
export function delay(fn, delay = 0, ...args) {
|
984
988
|
const timer = setTimeout(fn, delay, ...args);
|
@@ -989,7 +993,8 @@ export function delay(fn, delay = 0, ...args) {
|
|
989
993
|
clearTimeout(timer);
|
990
994
|
}
|
991
995
|
/**
|
992
|
-
*
|
996
|
+
* Execute the function early.
|
997
|
+
* @returns {*} - The result of the function.
|
993
998
|
*/
|
994
999
|
function earlyCall() {
|
995
1000
|
cancel();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@formio/js",
|
3
|
-
"version": "5.0.0-rc.
|
3
|
+
"version": "5.0.0-rc.53",
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
5
5
|
"main": "lib/cjs/index.js",
|
6
6
|
"exports": {
|
@@ -86,10 +86,10 @@
|
|
86
86
|
"browser-cookies": "^1.2.0",
|
87
87
|
"browser-md5-file": "^1.1.1",
|
88
88
|
"compare-versions": "^6.0.0-rc.2",
|
89
|
-
"core-js": "^3.37.
|
89
|
+
"core-js": "^3.37.1",
|
90
90
|
"dialog-polyfill": "^0.5.6",
|
91
91
|
"dom-autoscroller": "^2.3.4",
|
92
|
-
"dompurify": "^3.1.
|
92
|
+
"dompurify": "^3.1.3",
|
93
93
|
"downloadjs": "^1.4.7",
|
94
94
|
"dragula": "^3.7.3",
|
95
95
|
"eventemitter3": "^5.0.1",
|
@@ -105,7 +105,7 @@
|
|
105
105
|
"lodash": "^4.17.21",
|
106
106
|
"moment": "^2.29.4",
|
107
107
|
"moment-timezone": "^0.5.44",
|
108
|
-
"quill": "^2.0.
|
108
|
+
"quill": "^2.0.2",
|
109
109
|
"signature_pad": "^4.2.0",
|
110
110
|
"string-hash": "^1.1.3",
|
111
111
|
"tippy.js": "^6.3.7",
|
@@ -113,9 +113,9 @@
|
|
113
113
|
"vanilla-picker": "^2.12.3"
|
114
114
|
},
|
115
115
|
"devDependencies": {
|
116
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
117
|
-
"@typescript-eslint/parser": "^7.
|
118
|
-
"ace-builds": "1.33.
|
116
|
+
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
117
|
+
"@typescript-eslint/parser": "^7.9.0",
|
118
|
+
"ace-builds": "1.33.2",
|
119
119
|
"async-limiter": "^2.0.0",
|
120
120
|
"bootstrap-icons": "^1.10.5",
|
121
121
|
"bootswatch": "^5.3.3",
|
@@ -127,7 +127,7 @@
|
|
127
127
|
"esdoc-ecmascript-proposal-plugin": "^1.0.0",
|
128
128
|
"esdoc-standard-plugin": "^1.0.0",
|
129
129
|
"eslint": "^8.57.0",
|
130
|
-
"eslint-plugin-jsdoc": "^48.2.
|
130
|
+
"eslint-plugin-jsdoc": "^48.2.5",
|
131
131
|
"fetch-mock": "^9.11.0",
|
132
132
|
"file-loader": "^6.2.0",
|
133
133
|
"flatpickr": "^4.6.13",
|
@@ -143,7 +143,6 @@
|
|
143
143
|
"gulp-sync": "^0.1.4",
|
144
144
|
"gulp-watch": "^5.0.1",
|
145
145
|
"hoek": "^6.1.3",
|
146
|
-
"jsdoc": "^4.0.2",
|
147
146
|
"jsdom": "22.1.0",
|
148
147
|
"jsdom-global": "^3.0.2",
|
149
148
|
"karma": "^6.4.3",
|
@@ -160,13 +159,14 @@
|
|
160
159
|
"pretty": "^2.0.0",
|
161
160
|
"pygments-css": "^1.0.0",
|
162
161
|
"raw-loader": "^4.0.2",
|
163
|
-
"sass": "^1.
|
162
|
+
"sass": "^1.77.1",
|
164
163
|
"shortcut-buttons-flatpickr": "^0.4.0",
|
165
164
|
"sinon": "^17.0.1",
|
166
165
|
"string-replace-loader": "^3.1.0",
|
167
166
|
"ts-loader": "^9.4.4",
|
168
167
|
"ts-node": "^10.9.1",
|
169
168
|
"tsc": "^2.0.4",
|
169
|
+
"typedoc": "^0.25.13",
|
170
170
|
"typescript": "5.3.2",
|
171
171
|
"webpack": "^5.90.3",
|
172
172
|
"webpack-bundle-analyzer": "^4.10.2",
|