@formio/js 5.6.1 → 5.7.0-api912.2

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.
Files changed (104) hide show
  1. package/dist/formio.builder.css +5 -5
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.embed.js +1 -1
  4. package/dist/formio.embed.min.js +1 -1
  5. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  6. package/dist/formio.form.css +5 -5
  7. package/dist/formio.form.js +5212 -5185
  8. package/dist/formio.form.min.css +1 -1
  9. package/dist/formio.form.min.js +1 -1
  10. package/dist/formio.form.min.js.LICENSE.txt +3 -1
  11. package/dist/formio.full.css +5 -5
  12. package/dist/formio.full.js +6063 -6036
  13. package/dist/formio.full.min.css +1 -1
  14. package/dist/formio.full.min.js +1 -1
  15. package/dist/formio.full.min.js.LICENSE.txt +3 -1
  16. package/dist/formio.js +1211 -1184
  17. package/dist/formio.min.js +1 -1
  18. package/dist/formio.min.js.LICENSE.txt +3 -1
  19. package/dist/formio.utils.js +1102 -1075
  20. package/dist/formio.utils.min.js +1 -1
  21. package/dist/formio.utils.min.js.LICENSE.txt +3 -1
  22. package/lib/cjs/Embed.js +38 -25
  23. package/lib/cjs/Form.d.ts +8 -2
  24. package/lib/cjs/Form.js +1 -1
  25. package/lib/cjs/Formio.js +1 -1
  26. package/lib/cjs/PDF.d.ts +1 -0
  27. package/lib/cjs/PDF.js +21 -5
  28. package/lib/cjs/PDFBuilder.d.ts +1 -0
  29. package/lib/cjs/PDFBuilder.js +1 -0
  30. package/lib/cjs/Webform.d.ts +13 -1
  31. package/lib/cjs/Webform.js +79 -26
  32. package/lib/cjs/Wizard.d.ts +1 -1
  33. package/lib/cjs/Wizard.js +12 -6
  34. package/lib/cjs/components/_classes/component/Component.js +0 -65
  35. package/lib/cjs/components/_classes/nested/NestedComponent.form.js +13 -0
  36. package/lib/cjs/components/_classes/nested/NestedComponent.js +4 -0
  37. package/lib/cjs/components/content/editForm/Content.edit.display.js +8 -0
  38. package/lib/cjs/components/currency/editForm/Currency.edit.display.js +20 -0
  39. package/lib/cjs/components/day/editForm/Day.edit.display.js +8 -0
  40. package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -0
  41. package/lib/cjs/components/editgrid/EditGrid.js +22 -2
  42. package/lib/cjs/components/email/editForm/Email.edit.display.js +12 -0
  43. package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
  44. package/lib/cjs/components/file/editForm/File.edit.file.js +1 -1
  45. package/lib/cjs/components/form/Form.js +21 -1
  46. package/lib/cjs/components/hidden/Hidden.d.ts +0 -1
  47. package/lib/cjs/components/hidden/Hidden.js +1 -1
  48. package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
  49. package/lib/cjs/components/html/editForm/HTML.edit.display.js +8 -0
  50. package/lib/cjs/components/number/Number.d.ts +11 -0
  51. package/lib/cjs/components/number/Number.js +35 -0
  52. package/lib/cjs/components/number/editForm/Number.edit.display.js +12 -0
  53. package/lib/cjs/components/password/editForm/Password.edit.display.js +12 -0
  54. package/lib/cjs/components/phonenumber/PhoneNumber.form.js +8 -0
  55. package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
  56. package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -0
  57. package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
  58. package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
  59. package/lib/cjs/components/url/editForm/Url.edit.display.js +12 -0
  60. package/lib/cjs/components/well/editForm/Well.edit.display.js +8 -0
  61. package/lib/cjs/package.json +1 -1
  62. package/lib/cjs/utils/utils.js +6 -18
  63. package/lib/mjs/Embed.js +37 -24
  64. package/lib/mjs/Form.d.ts +8 -2
  65. package/lib/mjs/Form.js +1 -1
  66. package/lib/mjs/Formio.js +1 -1
  67. package/lib/mjs/PDF.d.ts +1 -0
  68. package/lib/mjs/PDF.js +21 -5
  69. package/lib/mjs/PDFBuilder.d.ts +1 -0
  70. package/lib/mjs/PDFBuilder.js +1 -0
  71. package/lib/mjs/Webform.d.ts +13 -1
  72. package/lib/mjs/Webform.js +75 -24
  73. package/lib/mjs/Wizard.d.ts +1 -1
  74. package/lib/mjs/Wizard.js +12 -6
  75. package/lib/mjs/components/_classes/component/Component.js +0 -65
  76. package/lib/mjs/components/_classes/nested/NestedComponent.form.js +13 -0
  77. package/lib/mjs/components/_classes/nested/NestedComponent.js +4 -0
  78. package/lib/mjs/components/content/editForm/Content.edit.display.js +8 -0
  79. package/lib/mjs/components/currency/editForm/Currency.edit.display.js +20 -0
  80. package/lib/mjs/components/day/editForm/Day.edit.display.js +8 -0
  81. package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -0
  82. package/lib/mjs/components/editgrid/EditGrid.js +22 -2
  83. package/lib/mjs/components/email/editForm/Email.edit.display.js +12 -0
  84. package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
  85. package/lib/mjs/components/file/editForm/File.edit.file.js +1 -1
  86. package/lib/mjs/components/form/Form.js +21 -1
  87. package/lib/mjs/components/hidden/Hidden.d.ts +0 -1
  88. package/lib/mjs/components/hidden/Hidden.js +1 -1
  89. package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
  90. package/lib/mjs/components/html/editForm/HTML.edit.display.js +8 -0
  91. package/lib/mjs/components/number/Number.d.ts +11 -0
  92. package/lib/mjs/components/number/Number.js +34 -0
  93. package/lib/mjs/components/number/editForm/Number.edit.display.js +12 -0
  94. package/lib/mjs/components/password/editForm/Password.edit.display.js +12 -0
  95. package/lib/mjs/components/phonenumber/PhoneNumber.form.js +8 -0
  96. package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
  97. package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -0
  98. package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
  99. package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
  100. package/lib/mjs/components/url/editForm/Url.edit.display.js +12 -0
  101. package/lib/mjs/components/well/editForm/Well.edit.display.js +8 -0
  102. package/lib/mjs/package.json +1 -1
  103. package/lib/mjs/utils/utils.js +6 -18
  104. package/package.json +1 -1
@@ -3,6 +3,14 @@ export default [
3
3
  key: 'labelPosition',
4
4
  ignore: true,
5
5
  },
6
+ {
7
+ key: 'labelWidth',
8
+ ignore: true,
9
+ },
10
+ {
11
+ key: 'labelMargin',
12
+ ignore: true,
13
+ },
6
14
  {
7
15
  key: 'placeholder',
8
16
  ignore: true,
@@ -3,6 +3,14 @@ export default [
3
3
  key: 'labelPosition',
4
4
  ignore: true,
5
5
  },
6
+ {
7
+ key: 'labelWidth',
8
+ ignore: true,
9
+ },
10
+ {
11
+ key: 'labelMargin',
12
+ ignore: true,
13
+ },
6
14
  {
7
15
  key: 'placeholder',
8
16
  ignore: true,
@@ -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,
@@ -11,4 +11,16 @@ 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
  ];
@@ -18,6 +18,14 @@ export default function (...extend) {
18
18
  key: 'showCharCount',
19
19
  ignore: true,
20
20
  },
21
+ {
22
+ key: 'widget.type',
23
+ ignore: true,
24
+ },
25
+ {
26
+ key: 'widget',
27
+ ignore: true,
28
+ },
21
29
  ],
22
30
  },
23
31
  {
@@ -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;
@@ -619,6 +619,7 @@ export default [
619
619
  },
620
620
  {
621
621
  key: 'selectData',
622
+ type: 'hidden',
622
623
  conditional: {
623
624
  json: {
624
625
  and: [
@@ -3,6 +3,14 @@ export default [
3
3
  key: 'labelPosition',
4
4
  ignore: true,
5
5
  },
6
+ {
7
+ key: 'labelWidth',
8
+ ignore: true,
9
+ },
10
+ {
11
+ key: 'labelMargin',
12
+ ignore: true,
13
+ },
6
14
  {
7
15
  key: 'placeholder',
8
16
  ignore: true,
@@ -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,
@@ -3,6 +3,14 @@ export default [
3
3
  key: 'labelPosition',
4
4
  ignore: true,
5
5
  },
6
+ {
7
+ key: 'labelWidth',
8
+ ignore: true,
9
+ },
10
+ {
11
+ key: 'labelMargin',
12
+ ignore: true,
13
+ },
6
14
  {
7
15
  key: 'placeholder',
8
16
  ignore: true,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "5.6.1"
3
+ "version": "5.7.0-api912.2"
4
4
 
5
5
  }
@@ -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 (typeof value === 'number' || value === null) {
1709
- if (value != null && value !== '') {
1710
- if (!isNaN(max) && value > max) {
1711
- message += `Number cannot be greater than ${max}. `;
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.6.1",
3
+ "version": "5.7.0-api912.2",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {