@formio/js 5.6.1 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/formio.builder.css +5 -5
- package/dist/formio.builder.min.css +1 -1
- 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.css +5 -5
- package/dist/formio.form.js +5195 -5189
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +4 -2
- package/dist/formio.full.css +5 -5
- package/dist/formio.full.js +6046 -6040
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +4 -2
- package/dist/formio.js +1193 -1187
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +4 -2
- package/dist/formio.utils.js +1084 -1078
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +4 -2
- package/lib/cjs/Embed.js +38 -25
- package/lib/cjs/Form.d.ts +8 -2
- package/lib/cjs/Form.js +1 -1
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDF.d.ts +1 -0
- package/lib/cjs/PDF.js +21 -5
- package/lib/cjs/PDFBuilder.d.ts +1 -0
- package/lib/cjs/PDFBuilder.js +1 -0
- package/lib/cjs/Webform.d.ts +13 -1
- package/lib/cjs/Webform.js +79 -26
- package/lib/cjs/Wizard.d.ts +1 -1
- package/lib/cjs/Wizard.js +12 -6
- package/lib/cjs/components/_classes/component/Component.js +0 -65
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.js +4 -0
- package/lib/cjs/components/content/editForm/Content.edit.display.js +8 -0
- package/lib/cjs/components/currency/editForm/Currency.edit.display.js +20 -0
- package/lib/cjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -0
- package/lib/cjs/components/editgrid/EditGrid.js +22 -2
- package/lib/cjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/cjs/components/file/editForm/File.edit.file.js +1 -1
- package/lib/cjs/components/form/Form.js +21 -1
- package/lib/cjs/components/hidden/Hidden.d.ts +0 -1
- package/lib/cjs/components/hidden/Hidden.js +1 -1
- package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/cjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/cjs/components/number/Number.d.ts +11 -0
- package/lib/cjs/components/number/Number.js +35 -0
- package/lib/cjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/cjs/components/password/editForm/Password.edit.display.js +12 -0
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +8 -0
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -0
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
- package/lib/cjs/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/cjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/utils/utils.js +6 -18
- package/lib/mjs/Embed.js +37 -24
- package/lib/mjs/Form.d.ts +8 -2
- package/lib/mjs/Form.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDF.d.ts +1 -0
- package/lib/mjs/PDF.js +21 -5
- package/lib/mjs/PDFBuilder.d.ts +1 -0
- package/lib/mjs/PDFBuilder.js +1 -0
- package/lib/mjs/Webform.d.ts +13 -1
- package/lib/mjs/Webform.js +75 -24
- package/lib/mjs/Wizard.d.ts +1 -1
- package/lib/mjs/Wizard.js +12 -6
- package/lib/mjs/components/_classes/component/Component.js +0 -65
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.js +4 -0
- package/lib/mjs/components/content/editForm/Content.edit.display.js +8 -0
- package/lib/mjs/components/currency/editForm/Currency.edit.display.js +20 -0
- package/lib/mjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -0
- package/lib/mjs/components/editgrid/EditGrid.js +22 -2
- package/lib/mjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/mjs/components/file/editForm/File.edit.file.js +1 -1
- package/lib/mjs/components/form/Form.js +21 -1
- package/lib/mjs/components/hidden/Hidden.d.ts +0 -1
- package/lib/mjs/components/hidden/Hidden.js +1 -1
- package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/mjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/mjs/components/number/Number.d.ts +11 -0
- package/lib/mjs/components/number/Number.js +34 -0
- package/lib/mjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/mjs/components/password/editForm/Password.edit.display.js +12 -0
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +8 -0
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -0
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
- package/lib/mjs/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/mjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/utils/utils.js +6 -18
- package/package.json +1 -1
|
@@ -51,5 +51,16 @@ export default class NumberComponent extends Input {
|
|
|
51
51
|
focus(): void;
|
|
52
52
|
getMaskedValue(value: any): any;
|
|
53
53
|
getValueAsString(value: any, options: any): any;
|
|
54
|
+
setErrorClasses(elements: any, dirty: any, hasErrors: any, hasMessages: any, element?: any): void;
|
|
55
|
+
/**
|
|
56
|
+
* Points the invalid inputs at the rendered error messages through `aria-describedby`, so a
|
|
57
|
+
* screen reader announces what is wrong with the value. The base class only marks the input
|
|
58
|
+
* `aria-invalid`, which says the value was rejected but not why.
|
|
59
|
+
* @param {Array<HTMLElement>} elements - The input elements the errors apply to.
|
|
60
|
+
* @param {boolean} hasErrors - TRUE if the component currently has errors.
|
|
61
|
+
* @returns {void}
|
|
62
|
+
*/
|
|
63
|
+
linkErrorMessages(elements: Array<HTMLElement>, hasErrors: boolean): void;
|
|
64
|
+
errorMessageIds: any[] | undefined;
|
|
54
65
|
}
|
|
55
66
|
import Input from '../_classes/input/Input';
|
|
@@ -268,4 +268,38 @@ export default class NumberComponent extends Input {
|
|
|
268
268
|
element.value = this.getValueAsString(this.formatValue(this.parseValue(element.value)));
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
|
+
setErrorClasses(elements, dirty, hasErrors, hasMessages, element = this.element) {
|
|
272
|
+
super.setErrorClasses(elements, dirty, hasErrors, hasMessages, element);
|
|
273
|
+
this.linkErrorMessages(elements, hasErrors);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Points the invalid inputs at the rendered error messages through `aria-describedby`, so a
|
|
277
|
+
* screen reader announces what is wrong with the value. The base class only marks the input
|
|
278
|
+
* `aria-invalid`, which says the value was rejected but not why.
|
|
279
|
+
* @param {Array<HTMLElement>} elements - The input elements the errors apply to.
|
|
280
|
+
* @param {boolean} hasErrors - TRUE if the component currently has errors.
|
|
281
|
+
* @returns {void}
|
|
282
|
+
*/
|
|
283
|
+
linkErrorMessages(elements, hasErrors) {
|
|
284
|
+
const previousIds = this.errorMessageIds || [];
|
|
285
|
+
const renderedMessages = Array.from(this.refs.messageContainer?.children || []);
|
|
286
|
+
const errorIds = hasErrors ? renderedMessages.map((message) => message.id).filter(Boolean) : [];
|
|
287
|
+
const invalidInputs = hasErrors ? Array.from(elements || []) : [];
|
|
288
|
+
const isOwnErrorId = (id) => previousIds.includes(id) || errorIds.includes(id);
|
|
289
|
+
Array.from(this.refs.input || []).forEach((input) => {
|
|
290
|
+
const describedBy = (input.getAttribute('aria-describedby') || '')
|
|
291
|
+
.split(' ')
|
|
292
|
+
.filter((id) => id && !isOwnErrorId(id));
|
|
293
|
+
if (invalidInputs.includes(input)) {
|
|
294
|
+
describedBy.push(...errorIds);
|
|
295
|
+
}
|
|
296
|
+
if (describedBy.length) {
|
|
297
|
+
input.setAttribute('aria-describedby', describedBy.join(' '));
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
input.removeAttribute('aria-describedby');
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
this.errorMessageIds = errorIds;
|
|
304
|
+
}
|
|
271
305
|
}
|
|
@@ -11,6 +11,18 @@ export default [
|
|
|
11
11
|
key: 'allowMultipleMasks',
|
|
12
12
|
ignore: true,
|
|
13
13
|
},
|
|
14
|
+
{
|
|
15
|
+
key: 'inputMasks',
|
|
16
|
+
ignore: true,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
key: 'widget.type',
|
|
20
|
+
ignore: true,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: 'widget',
|
|
24
|
+
ignore: true,
|
|
25
|
+
},
|
|
14
26
|
{
|
|
15
27
|
key: 'showWordCount',
|
|
16
28
|
ignore: true,
|
|
@@ -1057,6 +1057,7 @@ declare const _default: ({
|
|
|
1057
1057
|
alwaysEnabled?: undefined;
|
|
1058
1058
|
} | {
|
|
1059
1059
|
key: string;
|
|
1060
|
+
type: string;
|
|
1060
1061
|
conditional: {
|
|
1061
1062
|
json: {
|
|
1062
1063
|
and: ({
|
|
@@ -1107,7 +1108,6 @@ declare const _default: ({
|
|
|
1107
1108
|
};
|
|
1108
1109
|
};
|
|
1109
1110
|
data?: undefined;
|
|
1110
|
-
type?: undefined;
|
|
1111
1111
|
as?: undefined;
|
|
1112
1112
|
editor?: undefined;
|
|
1113
1113
|
weight?: undefined;
|
|
@@ -9,10 +9,22 @@ export default [
|
|
|
9
9
|
key: 'allowMultipleMasks',
|
|
10
10
|
ignore: true,
|
|
11
11
|
},
|
|
12
|
+
{
|
|
13
|
+
key: 'inputMasks',
|
|
14
|
+
ignore: true,
|
|
15
|
+
},
|
|
12
16
|
{
|
|
13
17
|
key: 'mask',
|
|
14
18
|
ignore: true,
|
|
15
19
|
},
|
|
20
|
+
{
|
|
21
|
+
key: 'widget.type',
|
|
22
|
+
ignore: true,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
key: 'widget',
|
|
26
|
+
ignore: true,
|
|
27
|
+
},
|
|
16
28
|
{
|
|
17
29
|
type: 'number',
|
|
18
30
|
input: true,
|
|
@@ -7,6 +7,18 @@ export default [
|
|
|
7
7
|
key: 'allowMultipleMasks',
|
|
8
8
|
ignore: true,
|
|
9
9
|
},
|
|
10
|
+
{
|
|
11
|
+
key: 'inputMasks',
|
|
12
|
+
ignore: true,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
key: 'widget.type',
|
|
16
|
+
ignore: true,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
key: 'widget',
|
|
20
|
+
ignore: true,
|
|
21
|
+
},
|
|
10
22
|
{
|
|
11
23
|
key: 'showWordCount',
|
|
12
24
|
ignore: true,
|
package/lib/mjs/package.json
CHANGED
package/lib/mjs/utils/utils.js
CHANGED
|
@@ -449,9 +449,7 @@ export function setActionProperty(component, action, result, row, data, instance
|
|
|
449
449
|
case 'string': {
|
|
450
450
|
const safeData = escapeInterpolationDataStrings(data);
|
|
451
451
|
const safeRow = escapeInterpolationDataStrings(row);
|
|
452
|
-
const safeResult = typeof result === 'string'
|
|
453
|
-
? _.escape(result)
|
|
454
|
-
: escapeInterpolationDataStrings(result);
|
|
452
|
+
const safeResult = typeof result === 'string' ? _.escape(result) : escapeInterpolationDataStrings(result);
|
|
455
453
|
const evalData = {
|
|
456
454
|
data: safeData,
|
|
457
455
|
row: safeRow,
|
|
@@ -1705,21 +1703,11 @@ function getScreenReaderMessage(component, type, value) {
|
|
|
1705
1703
|
}
|
|
1706
1704
|
}
|
|
1707
1705
|
}
|
|
1708
|
-
else if (
|
|
1709
|
-
if (
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
}
|
|
1713
|
-
if (!isNaN(min) && value < min) {
|
|
1714
|
-
message += `Number cannot be less than ${min}.`;
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
else {
|
|
1718
|
-
if (!isNaN(min))
|
|
1719
|
-
message += `Minimum value ${min}. `;
|
|
1720
|
-
if (!isNaN(max))
|
|
1721
|
-
message += `Maximum value ${max}. `;
|
|
1722
|
-
}
|
|
1706
|
+
else if (value === null) {
|
|
1707
|
+
if (!isNaN(min))
|
|
1708
|
+
message += `Minimum value ${min}. `;
|
|
1709
|
+
if (!isNaN(max))
|
|
1710
|
+
message += `Maximum value ${max}. `;
|
|
1723
1711
|
}
|
|
1724
1712
|
return message.trim();
|
|
1725
1713
|
}
|