@formio/js 5.0.0-dev.5704.492ccdf → 5.0.0-dev.5704.50db01f

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 (193) hide show
  1. package/Changelog.md +47 -0
  2. package/dist/formio.embed.js +1 -1
  3. package/dist/formio.embed.min.js +1 -1
  4. package/dist/formio.form.js +55 -131
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +2 -0
  7. package/dist/formio.full.js +61 -41
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +2 -0
  10. package/dist/formio.js +1 -1
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.utils.js +25 -5
  13. package/dist/formio.utils.min.js +1 -1
  14. package/dist/formio.utils.min.js.LICENSE.txt +2 -0
  15. package/lib/cjs/CDN.d.ts +1 -0
  16. package/lib/cjs/CDN.js +2 -2
  17. package/lib/cjs/Form.d.ts +2 -2
  18. package/lib/cjs/Form.js +11 -5
  19. package/lib/cjs/PDF.js +1 -1
  20. package/lib/cjs/PDFBuilder.js +2 -1
  21. package/lib/cjs/Webform.js +3 -6
  22. package/lib/cjs/WebformBuilder.js +13 -3
  23. package/lib/cjs/Wizard.js +1 -1
  24. package/lib/cjs/components/_classes/component/Component.d.ts +2 -1
  25. package/lib/cjs/components/_classes/component/Component.js +25 -6
  26. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  27. package/lib/cjs/components/_classes/multivalue/Multivalue.js +43 -25
  28. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +2 -1
  29. package/lib/cjs/components/_classes/nested/NestedComponent.js +5 -1
  30. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +3 -0
  31. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +56 -29
  32. package/lib/cjs/components/address/Address.d.ts +6 -0
  33. package/lib/cjs/components/address/Address.js +7 -1
  34. package/lib/cjs/components/currency/Currency.d.ts +2 -0
  35. package/lib/cjs/components/datagrid/DataGrid.d.ts +2 -1
  36. package/lib/cjs/components/datagrid/DataGrid.js +40 -35
  37. package/lib/cjs/components/datagrid/fixtures/comp11.d.ts +50 -0
  38. package/lib/cjs/components/datagrid/fixtures/comp11.js +55 -0
  39. package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
  40. package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
  41. package/lib/cjs/components/datamap/DataMap.js +2 -2
  42. package/lib/cjs/components/day/Day.d.ts +3 -4
  43. package/lib/cjs/components/day/Day.js +31 -10
  44. package/lib/cjs/components/editgrid/EditGrid.js +14 -6
  45. package/lib/cjs/components/editgrid/fixtures/comp-test-events.d.ts +54 -0
  46. package/lib/cjs/components/editgrid/fixtures/comp-test-events.js +54 -0
  47. package/lib/cjs/components/editgrid/fixtures/comp16.d.ts +52 -0
  48. package/lib/cjs/components/editgrid/fixtures/comp16.js +71 -0
  49. package/lib/cjs/components/editgrid/fixtures/comp17.d.ts +80 -0
  50. package/lib/cjs/components/editgrid/fixtures/comp17.js +99 -0
  51. package/lib/cjs/components/editgrid/fixtures/index.d.ts +10 -7
  52. package/lib/cjs/components/editgrid/fixtures/index.js +7 -1
  53. package/lib/cjs/components/file/File.d.ts +2 -2
  54. package/lib/cjs/components/file/File.js +13 -2
  55. package/lib/cjs/components/file/editForm/File.edit.display.js +1 -1
  56. package/lib/cjs/components/form/editForm/Form.edit.form.js +1 -1
  57. package/lib/cjs/components/form/fixtures/index.d.ts +2 -1
  58. package/lib/cjs/components/form/fixtures/index.js +3 -1
  59. package/lib/cjs/components/form/fixtures/nestedWizardForm.d.ts +771 -0
  60. package/lib/cjs/components/form/fixtures/nestedWizardForm.js +765 -0
  61. package/lib/cjs/components/number/Number.d.ts +17 -2
  62. package/lib/cjs/components/number/Number.js +26 -6
  63. package/lib/cjs/components/number/fixtures/comp10.d.ts +18 -0
  64. package/lib/cjs/components/number/fixtures/comp10.js +21 -0
  65. package/lib/cjs/components/number/fixtures/comp9.d.ts +18 -0
  66. package/lib/cjs/components/number/fixtures/comp9.js +21 -0
  67. package/lib/cjs/components/number/fixtures/index.d.ts +3 -1
  68. package/lib/cjs/components/number/fixtures/index.js +5 -1
  69. package/lib/cjs/components/panel/Panel.d.ts +1 -0
  70. package/lib/cjs/components/panel/Panel.js +1 -0
  71. package/lib/cjs/components/radio/Radio.d.ts +2 -18
  72. package/lib/cjs/components/radio/Radio.js +29 -27
  73. package/lib/cjs/components/radio/fixtures/comp12.d.ts +29 -0
  74. package/lib/cjs/components/radio/fixtures/comp12.js +36 -0
  75. package/lib/cjs/components/radio/fixtures/index.d.ts +2 -1
  76. package/lib/cjs/components/radio/fixtures/index.js +3 -1
  77. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +6 -0
  78. package/lib/cjs/components/recaptcha/ReCaptcha.js +6 -0
  79. package/lib/cjs/components/select/Select.d.ts +38 -0
  80. package/lib/cjs/components/select/Select.js +13 -3
  81. package/lib/cjs/components/select/fixtures/comp25.d.ts +59 -0
  82. package/lib/cjs/components/select/fixtures/comp25.js +66 -0
  83. package/lib/cjs/components/select/fixtures/comp26.d.ts +44 -0
  84. package/lib/cjs/components/select/fixtures/comp26.js +59 -0
  85. package/lib/cjs/components/select/fixtures/index.d.ts +3 -1
  86. package/lib/cjs/components/select/fixtures/index.js +5 -1
  87. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +0 -22
  88. package/lib/cjs/components/selectboxes/SelectBoxes.js +12 -9
  89. package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
  90. package/lib/cjs/components/signature/editForm/Signature.edit.display.js +0 -1
  91. package/lib/cjs/components/tags/Tags.js +3 -3
  92. package/lib/cjs/components/time/Time.d.ts +2 -2
  93. package/lib/cjs/components/time/Time.form.js +2 -2
  94. package/lib/cjs/components/time/Time.js +3 -7
  95. package/lib/cjs/components/time/fixtures/comp4.d.ts +166 -0
  96. package/lib/cjs/components/time/fixtures/comp4.js +171 -0
  97. package/lib/cjs/components/time/fixtures/index.d.ts +2 -1
  98. package/lib/cjs/components/time/fixtures/index.js +3 -1
  99. package/lib/cjs/templates/Templates.js +1 -1
  100. package/lib/cjs/translations/en.d.ts +1 -0
  101. package/lib/cjs/translations/en.js +1 -0
  102. package/lib/cjs/utils/utils.d.ts +9 -1
  103. package/lib/cjs/utils/utils.js +14 -13
  104. package/lib/mjs/CDN.d.ts +1 -0
  105. package/lib/mjs/CDN.js +2 -2
  106. package/lib/mjs/Form.d.ts +2 -2
  107. package/lib/mjs/Form.js +11 -5
  108. package/lib/mjs/PDF.js +1 -1
  109. package/lib/mjs/PDFBuilder.js +1 -1
  110. package/lib/mjs/Webform.js +7 -6
  111. package/lib/mjs/WebformBuilder.js +12 -3
  112. package/lib/mjs/Wizard.js +1 -1
  113. package/lib/mjs/components/_classes/component/Component.d.ts +2 -1
  114. package/lib/mjs/components/_classes/component/Component.js +11 -3
  115. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  116. package/lib/mjs/components/_classes/multivalue/Multivalue.js +43 -25
  117. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +2 -1
  118. package/lib/mjs/components/_classes/nested/NestedComponent.js +5 -1
  119. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +3 -0
  120. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +57 -29
  121. package/lib/mjs/components/address/Address.d.ts +6 -0
  122. package/lib/mjs/components/address/Address.js +10 -1
  123. package/lib/mjs/components/currency/Currency.d.ts +2 -0
  124. package/lib/mjs/components/datagrid/DataGrid.d.ts +2 -1
  125. package/lib/mjs/components/datagrid/DataGrid.js +39 -34
  126. package/lib/mjs/components/datagrid/fixtures/comp11.d.ts +50 -0
  127. package/lib/mjs/components/datagrid/fixtures/comp11.js +53 -0
  128. package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
  129. package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
  130. package/lib/mjs/components/datamap/DataMap.js +2 -2
  131. package/lib/mjs/components/day/Day.d.ts +3 -4
  132. package/lib/mjs/components/day/Day.js +30 -10
  133. package/lib/mjs/components/editgrid/EditGrid.js +14 -6
  134. package/lib/mjs/components/editgrid/fixtures/comp-test-events.d.ts +54 -0
  135. package/lib/mjs/components/editgrid/fixtures/comp-test-events.js +52 -0
  136. package/lib/mjs/components/editgrid/fixtures/comp16.d.ts +52 -0
  137. package/lib/mjs/components/editgrid/fixtures/comp16.js +69 -0
  138. package/lib/mjs/components/editgrid/fixtures/comp17.d.ts +80 -0
  139. package/lib/mjs/components/editgrid/fixtures/comp17.js +97 -0
  140. package/lib/mjs/components/editgrid/fixtures/index.d.ts +10 -7
  141. package/lib/mjs/components/editgrid/fixtures/index.js +4 -1
  142. package/lib/mjs/components/file/File.d.ts +2 -2
  143. package/lib/mjs/components/file/File.js +13 -2
  144. package/lib/mjs/components/file/editForm/File.edit.display.js +1 -1
  145. package/lib/mjs/components/form/editForm/Form.edit.form.js +1 -1
  146. package/lib/mjs/components/form/fixtures/index.d.ts +2 -1
  147. package/lib/mjs/components/form/fixtures/index.js +2 -1
  148. package/lib/mjs/components/form/fixtures/nestedWizardForm.d.ts +771 -0
  149. package/lib/mjs/components/form/fixtures/nestedWizardForm.js +763 -0
  150. package/lib/mjs/components/number/Number.d.ts +17 -2
  151. package/lib/mjs/components/number/Number.js +25 -5
  152. package/lib/mjs/components/number/fixtures/comp10.d.ts +18 -0
  153. package/lib/mjs/components/number/fixtures/comp10.js +19 -0
  154. package/lib/mjs/components/number/fixtures/comp9.d.ts +18 -0
  155. package/lib/mjs/components/number/fixtures/comp9.js +19 -0
  156. package/lib/mjs/components/number/fixtures/index.d.ts +3 -1
  157. package/lib/mjs/components/number/fixtures/index.js +3 -1
  158. package/lib/mjs/components/panel/Panel.d.ts +1 -0
  159. package/lib/mjs/components/panel/Panel.js +1 -0
  160. package/lib/mjs/components/radio/Radio.d.ts +2 -18
  161. package/lib/mjs/components/radio/Radio.js +32 -30
  162. package/lib/mjs/components/radio/fixtures/comp12.d.ts +29 -0
  163. package/lib/mjs/components/radio/fixtures/comp12.js +34 -0
  164. package/lib/mjs/components/radio/fixtures/index.d.ts +2 -1
  165. package/lib/mjs/components/radio/fixtures/index.js +2 -1
  166. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +6 -0
  167. package/lib/mjs/components/recaptcha/ReCaptcha.js +9 -0
  168. package/lib/mjs/components/select/Select.d.ts +38 -0
  169. package/lib/mjs/components/select/Select.js +16 -4
  170. package/lib/mjs/components/select/fixtures/comp25.d.ts +59 -0
  171. package/lib/mjs/components/select/fixtures/comp25.js +64 -0
  172. package/lib/mjs/components/select/fixtures/comp26.d.ts +44 -0
  173. package/lib/mjs/components/select/fixtures/comp26.js +57 -0
  174. package/lib/mjs/components/select/fixtures/index.d.ts +3 -1
  175. package/lib/mjs/components/select/fixtures/index.js +3 -1
  176. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +0 -22
  177. package/lib/mjs/components/selectboxes/SelectBoxes.js +16 -9
  178. package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
  179. package/lib/mjs/components/signature/editForm/Signature.edit.display.js +0 -1
  180. package/lib/mjs/components/tags/Tags.js +3 -3
  181. package/lib/mjs/components/time/Time.d.ts +2 -2
  182. package/lib/mjs/components/time/Time.form.js +2 -2
  183. package/lib/mjs/components/time/Time.js +3 -13
  184. package/lib/mjs/components/time/fixtures/comp4.d.ts +166 -0
  185. package/lib/mjs/components/time/fixtures/comp4.js +169 -0
  186. package/lib/mjs/components/time/fixtures/index.d.ts +2 -1
  187. package/lib/mjs/components/time/fixtures/index.js +2 -1
  188. package/lib/mjs/templates/Templates.js +1 -1
  189. package/lib/mjs/translations/en.d.ts +1 -0
  190. package/lib/mjs/translations/en.js +1 -0
  191. package/lib/mjs/utils/utils.d.ts +9 -1
  192. package/lib/mjs/utils/utils.js +14 -2
  193. package/package.json +4 -4
@@ -27,11 +27,26 @@ export default class NumberComponent extends Input {
27
27
  */
28
28
  createNumberMask(): any;
29
29
  isDecimalAllowed(): any;
30
- parseNumber(value: any): number;
30
+ /**
31
+ * parses a numeric string by removing the delimiters and replacing the decimal separator back to '.' so that it can
32
+ * be processed by either parseInt or parseFloat
33
+ * @param {string} value the value to be parsed
34
+ * @returns {number} a parsed number
35
+ */
36
+ parseNumber(value: string): number;
31
37
  setInputMask(input: any): void;
32
38
  getValueAt(index: any): number | null;
33
39
  setValueAt(index: any, value: any, flags?: {}): void;
34
- parseValue(input: any): number;
40
+ /**
41
+ * Converts a string to a floating point number, formats the number based on the parsed float function
42
+ * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat) and then returns the
43
+ * formatted number back as a string
44
+ * Example Input: "123.456,22"
45
+ * Example Output: "123456,22"
46
+ * @param {string | number} input the numeric string to parse
47
+ * @returns {string | null} a parsed string
48
+ */
49
+ parseValue(input: string | number): string | null;
35
50
  focus(): void;
36
51
  getMaskedValue(value: any): any;
37
52
  getValueAsString(value: any, options: any): any;
@@ -50,12 +50,12 @@ export default class NumberComponent extends Input {
50
50
  || this.options.properties?.decimalSeparator
51
51
  || separators.decimalSeparator;
52
52
  if (this.component.delimiter) {
53
- if (this.options.hasOwnProperty('thousandsSeparator')) {
54
- console.warn("Property 'thousandsSeparator' is deprecated. Please use i18n to specify delimiter.");
55
- }
56
- this.delimiter = this.options.properties?.thousandsSeparator || this.options.thousandsSeparator || separators.delimiter;
53
+ this.delimiter = this.component.thousandsSeparator || this.options.properties?.thousandsSeparator || this.options.thousandsSeparator || separators.delimiter;
57
54
  }
58
55
  else {
56
+ if (this.component.thousandsSeparator || this.options.properties?.thousandsSeparator || this.options.thousandsSeparator) {
57
+ console.warn('In order for thousands separator to work properly, you must set the delimiter to true in the component json');
58
+ }
59
59
  this.delimiter = '';
60
60
  }
61
61
  const requireDecimal = _.get(this.component, 'requireDecimal', false);
@@ -77,7 +77,7 @@ export default class NumberComponent extends Input {
77
77
  prefix: '',
78
78
  suffix: '',
79
79
  requireDecimal: _.get(this.component, 'requireDecimal', false),
80
- thousandsSeparatorSymbol: _.get(this.component, 'thousandsSeparator', this.delimiter),
80
+ thousandsSeparatorSymbol: this.delimiter || '',
81
81
  decimalSymbol: _.get(this.component, 'decimalSymbol', this.decimalSeparator),
82
82
  decimalLimit: _.get(this.component, 'decimalLimit', this.decimalLimit),
83
83
  allowNegative: _.get(this.component, 'allowNegative', true),
@@ -89,6 +89,11 @@ export default class NumberComponent extends Input {
89
89
  }
90
90
  get defaultValue() {
91
91
  let defaultValue = super.defaultValue;
92
+ if (typeof defaultValue === 'string') {
93
+ // Default value may be a string or have custom thousands separators or decimal symbols, so we need to call
94
+ // parseNumber on it
95
+ defaultValue = this.parseNumber(defaultValue);
96
+ }
92
97
  if (!defaultValue && this.component.defaultValue === 0) {
93
98
  defaultValue = this.component.defaultValue;
94
99
  }
@@ -100,6 +105,12 @@ export default class NumberComponent extends Input {
100
105
  isDecimalAllowed() {
101
106
  return _.get(this.component, 'allowDecimal', !(this.component.validate && this.component.validate.integer));
102
107
  }
108
+ /**
109
+ * parses a numeric string by removing the delimiters and replacing the decimal separator back to '.' so that it can
110
+ * be processed by either parseInt or parseFloat
111
+ * @param {string} value the value to be parsed
112
+ * @returns {number} a parsed number
113
+ */
103
114
  parseNumber(value) {
104
115
  // Remove delimiters and convert decimal separator to dot.
105
116
  value = value.split(this.delimiter).join('').replace(this.decimalSeparator, '.');
@@ -144,6 +155,15 @@ export default class NumberComponent extends Input {
144
155
  setValueAt(index, value, flags = {}) {
145
156
  return super.setValueAt(index, this.formatValue(this.parseValue(value)), flags);
146
157
  }
158
+ /**
159
+ * Converts a string to a floating point number, formats the number based on the parsed float function
160
+ * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat) and then returns the
161
+ * formatted number back as a string
162
+ * Example Input: "123.456,22"
163
+ * Example Output: "123456,22"
164
+ * @param {string | number} input the numeric string to parse
165
+ * @returns {string | null} a parsed string
166
+ */
147
167
  parseValue(input) {
148
168
  if (typeof input === 'string') {
149
169
  input = input.split(this.delimiter).join('').replace(this.decimalSeparator, '.');
@@ -0,0 +1,18 @@
1
+ declare namespace _default {
2
+ let components: {
3
+ label: string;
4
+ applyMaskOn: string;
5
+ mask: boolean;
6
+ tableView: boolean;
7
+ delimiter: boolean;
8
+ requireDecimal: boolean;
9
+ inputFormat: string;
10
+ truncateMultipleSpaces: boolean;
11
+ validateWhenHidden: boolean;
12
+ key: string;
13
+ type: string;
14
+ input: boolean;
15
+ defaultValue: string;
16
+ }[];
17
+ }
18
+ export default _default;
@@ -0,0 +1,19 @@
1
+ export default {
2
+ components: [
3
+ {
4
+ "label": "Number",
5
+ "applyMaskOn": "change",
6
+ "mask": false,
7
+ "tableView": false,
8
+ "delimiter": false,
9
+ "requireDecimal": false,
10
+ "inputFormat": "plain",
11
+ "truncateMultipleSpaces": false,
12
+ "validateWhenHidden": false,
13
+ "key": "number",
14
+ "type": "number",
15
+ "input": true,
16
+ "defaultValue": "123.23"
17
+ }
18
+ ]
19
+ };
@@ -0,0 +1,18 @@
1
+ declare namespace _default {
2
+ let components: {
3
+ label: string;
4
+ applyMaskOn: string;
5
+ mask: boolean;
6
+ tableView: boolean;
7
+ delimiter: boolean;
8
+ requireDecimal: boolean;
9
+ inputFormat: string;
10
+ truncateMultipleSpaces: boolean;
11
+ key: string;
12
+ type: string;
13
+ input: boolean;
14
+ decimalSymbol: string;
15
+ thousandsSeparator: string;
16
+ }[];
17
+ }
18
+ export default _default;
@@ -0,0 +1,19 @@
1
+ export default {
2
+ components: [
3
+ {
4
+ "label": "Number",
5
+ "applyMaskOn": "change",
6
+ "mask": false,
7
+ "tableView": false,
8
+ "delimiter": true,
9
+ "requireDecimal": false,
10
+ "inputFormat": "plain",
11
+ "truncateMultipleSpaces": false,
12
+ "key": "number",
13
+ "type": "number",
14
+ "input": true,
15
+ "decimalSymbol": ",",
16
+ "thousandsSeparator": "."
17
+ }
18
+ ]
19
+ };
@@ -6,4 +6,6 @@ import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
7
  import comp7 from './comp7';
8
8
  import comp8 from './comp8';
9
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
9
+ import comp9 from './comp9';
10
+ import comp10 from './comp10';
11
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10 };
@@ -6,4 +6,6 @@ import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
7
  import comp7 from './comp7';
8
8
  import comp8 from './comp8';
9
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
9
+ import comp9 from './comp9';
10
+ import comp10 from './comp10';
11
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10 };
@@ -4,6 +4,7 @@ export default class PanelComponent extends NestedComponent {
4
4
  icon: string;
5
5
  group: string;
6
6
  documentation: string;
7
+ showPreview: boolean;
7
8
  weight: number;
8
9
  schema: any;
9
10
  };
@@ -22,6 +22,7 @@ export default class PanelComponent extends NestedComponent {
22
22
  icon: 'list-alt',
23
23
  group: 'layout',
24
24
  documentation: '/userguide/form-building/layout-components#panel',
25
+ showPreview: false,
25
26
  weight: 30,
26
27
  schema: PanelComponent.schema()
27
28
  };
@@ -8,26 +8,10 @@ export default class RadioComponent extends ListComponent {
8
8
  schema: any;
9
9
  };
10
10
  static get conditionOperatorsSettings(): {
11
- valueComponent(classComp: any): {
12
- type: string;
13
- dataSrc: string;
14
- valueProperty: string;
15
- dataType: any;
16
- data: {
17
- custom(): any;
18
- };
19
- };
11
+ valueComponent(classComp: any): any;
20
12
  };
21
13
  static get serverConditionSettings(): {
22
- valueComponent(classComp: any): {
23
- type: string;
24
- dataSrc: string;
25
- valueProperty: string;
26
- dataType: any;
27
- data: {
28
- custom: string;
29
- };
30
- };
14
+ valueComponent(classComp: any): any;
31
15
  };
32
16
  static savedValueTypes(schema: any): any[];
33
17
  constructor(component: any, options: any, data: any);
@@ -30,35 +30,26 @@ export default class RadioComponent extends ListComponent {
30
30
  return {
31
31
  ...super.conditionOperatorsSettings,
32
32
  valueComponent(classComp) {
33
- return {
34
- type: 'select',
35
- dataSrc: 'custom',
36
- valueProperty: 'value',
37
- dataType: classComp.dataType || '',
38
- data: {
39
- custom() {
40
- return classComp.values;
33
+ const isValuesSrc = !classComp.dataSrc || classComp.dataSrc === 'values';
34
+ return isValuesSrc
35
+ ? {
36
+ type: 'select',
37
+ dataSrc: 'custom',
38
+ valueProperty: 'value',
39
+ dataType: classComp.dataType || '',
40
+ data: {
41
+ custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`,
41
42
  }
42
- },
43
- };
43
+ }
44
+ : {
45
+ ...classComp,
46
+ type: 'select',
47
+ };
44
48
  }
45
49
  };
46
50
  }
47
51
  static get serverConditionSettings() {
48
- return {
49
- ...super.serverConditionSettings,
50
- valueComponent(classComp) {
51
- return {
52
- type: 'select',
53
- dataSrc: 'custom',
54
- valueProperty: 'value',
55
- dataType: classComp.dataType || '',
56
- data: {
57
- custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`,
58
- },
59
- };
60
- },
61
- };
52
+ return RadioComponent.conditionOperatorsSettings;
62
53
  }
63
54
  static savedValueTypes(schema) {
64
55
  const { boolean, string, number, object, array } = componentValueTypes;
@@ -264,6 +255,16 @@ export default class RadioComponent extends ListComponent {
264
255
  if (method.toUpperCase() === 'GET') {
265
256
  body = null;
266
257
  }
258
+ const limit = this.component.limit || 100;
259
+ const skip = this.isScrollLoading ? this.selectOptions.length : 0;
260
+ // Allow for url interpolation.
261
+ url = this.sanitize(this.interpolate(url, {
262
+ formioBase: Formio.getBaseUrl(),
263
+ search,
264
+ limit,
265
+ skip,
266
+ page: Math.abs(Math.floor(skip / limit))
267
+ }), this.shouldSanitizeValue);
267
268
  // Set ignoreCache if it is
268
269
  options.ignoreCache = this.component.ignoreCache;
269
270
  // Make the request.
@@ -295,14 +296,15 @@ export default class RadioComponent extends ListComponent {
295
296
  setItems(items) {
296
297
  const listData = [];
297
298
  items?.forEach((item, i) => {
299
+ const valueAtProperty = _.get(item, this.component.valueProperty);
298
300
  this.loadedOptions[i] = {
299
- value: this.component.valueProperty ? item[this.component.valueProperty] : item,
300
- label: this.component.valueProperty ? this.itemTemplate(item, item[this.component.valueProperty]) : this.itemTemplate(item, item, i)
301
+ value: this.component.valueProperty ? valueAtProperty : item,
302
+ label: this.component.valueProperty ? this.itemTemplate(item, valueAtProperty) : this.itemTemplate(item, item, i)
301
303
  };
302
- listData.push(this.templateData[this.component.valueProperty ? item[this.component.valueProperty] : i]);
303
- if ((this.component.valueProperty || !this.isRadio) && (_.isUndefined(item[this.component.valueProperty]) ||
304
- (!this.isRadio && _.isObject(item[this.component.valueProperty])) ||
305
- (!this.isRadio && _.isBoolean(item[this.component.valueProperty])))) {
304
+ listData.push(this.templateData[this.component.valueProperty ? valueAtProperty : i]);
305
+ if ((this.component.valueProperty || !this.isRadio) && (_.isUndefined(valueAtProperty) ||
306
+ (!this.isRadio && _.isObject(valueAtProperty)) ||
307
+ (!this.isRadio && _.isBoolean(valueAtProperty)))) {
306
308
  this.loadedOptions[i].invalid = true;
307
309
  }
308
310
  });
@@ -0,0 +1,29 @@
1
+ declare namespace _default {
2
+ let components: {
3
+ label: string;
4
+ optionsLabelPosition: string;
5
+ tableView: boolean;
6
+ dataSrc: string;
7
+ values: {
8
+ label: string;
9
+ value: string;
10
+ shortcut: string;
11
+ }[];
12
+ valueProperty: string;
13
+ validateWhenHidden: boolean;
14
+ key: string;
15
+ type: string;
16
+ data: {
17
+ url: string;
18
+ headers: {
19
+ key: string;
20
+ value: string;
21
+ }[];
22
+ };
23
+ template: string;
24
+ authenticate: boolean;
25
+ input: boolean;
26
+ inputType: string;
27
+ }[];
28
+ }
29
+ export default _default;
@@ -0,0 +1,34 @@
1
+ export default {
2
+ components: [
3
+ {
4
+ "label": "Select Boxes",
5
+ "optionsLabelPosition": "right",
6
+ "tableView": false,
7
+ "dataSrc": "url",
8
+ "values": [
9
+ {
10
+ "label": "",
11
+ "value": "",
12
+ "shortcut": ""
13
+ }
14
+ ],
15
+ "valueProperty": "data.name",
16
+ "validateWhenHidden": false,
17
+ "key": "selectBoxes",
18
+ "type": "selectboxes",
19
+ "data": {
20
+ "url": "https://remote-dev.form.io/projectId/name/submission",
21
+ "headers": [
22
+ {
23
+ "key": "",
24
+ "value": ""
25
+ }
26
+ ]
27
+ },
28
+ "template": "<span>{{ item.data.name }}</span>",
29
+ "authenticate": true,
30
+ "input": true,
31
+ "inputType": "checkbox"
32
+ }
33
+ ]
34
+ };
@@ -9,4 +9,5 @@ import comp8 from './comp8';
9
9
  import comp9 from './comp9';
10
10
  import comp10 from './comp10';
11
11
  import comp11 from './comp11';
12
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11 };
12
+ import comp12 from './comp12';
13
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12 };
@@ -9,4 +9,5 @@ import comp8 from './comp8';
9
9
  import comp9 from './comp9';
10
10
  import comp10 from './comp10';
11
11
  import comp11 from './comp11';
12
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11 };
12
+ import comp12 from './comp12';
13
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12 };
@@ -1,6 +1,12 @@
1
1
  export default class ReCaptchaComponent extends Component {
2
2
  static get builderInfo(): {};
3
3
  static savedValueTypes(): never[];
4
+ static get conditionOperatorsSettings(): {
5
+ operators: string[];
6
+ };
7
+ static get serverConditionSettings(): {
8
+ operators: string[];
9
+ };
4
10
  render(): string;
5
11
  recaptchaResult: any;
6
12
  createInput(): void;
@@ -17,6 +17,15 @@ export default class ReCaptchaComponent extends Component {
17
17
  static savedValueTypes() {
18
18
  return [];
19
19
  }
20
+ static get conditionOperatorsSettings() {
21
+ return {
22
+ ...super.conditionOperatorsSettings,
23
+ operators: ['isEmpty', 'isNotEmpty'],
24
+ };
25
+ }
26
+ static get serverConditionSettings() {
27
+ return ReCaptchaComponent.conditionOperatorsSettings;
28
+ }
20
29
  render() {
21
30
  this.recaptchaResult = null;
22
31
  if (this.builderMode) {
@@ -9,9 +9,47 @@ export default class SelectComponent extends ListComponent {
9
9
  };
10
10
  static get serverConditionSettings(): {
11
11
  valueComponent(classComp: any): any;
12
+ dataTypeOperators: {
13
+ number: string[];
14
+ };
15
+ dataTypeValueComponents: {
16
+ number: {
17
+ lessThan: () => {
18
+ type: string;
19
+ };
20
+ greaterThan: () => {
21
+ type: string;
22
+ };
23
+ lessThanOrEqual: () => {
24
+ type: string;
25
+ };
26
+ greaterThanOrEqual: () => {
27
+ type: string;
28
+ };
29
+ };
30
+ };
12
31
  };
13
32
  static get conditionOperatorsSettings(): {
14
33
  valueComponent(classComp: any): any;
34
+ dataTypeOperators: {
35
+ number: string[];
36
+ };
37
+ dataTypeValueComponents: {
38
+ number: {
39
+ lessThan: () => {
40
+ type: string;
41
+ };
42
+ greaterThan: () => {
43
+ type: string;
44
+ };
45
+ lessThanOrEqual: () => {
46
+ type: string;
47
+ };
48
+ greaterThanOrEqual: () => {
49
+ type: string;
50
+ };
51
+ };
52
+ };
15
53
  };
16
54
  static savedValueTypes(schema: any): any[];
17
55
  templateData: {} | undefined;
@@ -57,6 +57,7 @@ export default class SelectComponent extends ListComponent {
57
57
  return SelectComponent.conditionOperatorsSettings;
58
58
  }
59
59
  static get conditionOperatorsSettings() {
60
+ const numberType = () => ({ type: 'number' });
60
61
  return {
61
62
  ...super.conditionOperatorsSettings,
62
63
  valueComponent(classComp) {
@@ -73,7 +74,18 @@ export default class SelectComponent extends ListComponent {
73
74
  `;
74
75
  }
75
76
  return valueComp;
76
- }
77
+ },
78
+ dataTypeOperators: {
79
+ number: ['lessThan', 'greaterThan', 'lessThanOrEqual', 'greaterThanOrEqual'],
80
+ },
81
+ dataTypeValueComponents: {
82
+ number: {
83
+ lessThan: numberType,
84
+ greaterThan: numberType,
85
+ lessThanOrEqual: numberType,
86
+ greaterThanOrEqual: numberType,
87
+ },
88
+ },
77
89
  };
78
90
  }
79
91
  static savedValueTypes(schema) {
@@ -526,13 +538,13 @@ export default class SelectComponent extends ListComponent {
526
538
  skip,
527
539
  };
528
540
  // Allow for url interpolation.
529
- url = this.interpolate(url, {
541
+ url = this.sanitize(this.interpolate(url, {
530
542
  formioBase: Formio.getBaseUrl(),
531
543
  search,
532
544
  limit,
533
545
  skip,
534
546
  page: Math.abs(Math.floor(skip / limit))
535
- });
547
+ }), this.shouldSanitizeValue);
536
548
  // Add search capability.
537
549
  if (this.component.searchField && search) {
538
550
  const searchValue = Array.isArray(search)
@@ -1581,8 +1593,8 @@ export default class SelectComponent extends ListComponent {
1581
1593
  super.detach();
1582
1594
  }
1583
1595
  focus() {
1596
+ super.focus.call(this);
1584
1597
  if (this.focusableElement) {
1585
- super.focus.call(this);
1586
1598
  this.focusableElement.focus();
1587
1599
  }
1588
1600
  }
@@ -0,0 +1,59 @@
1
+ declare namespace _default {
2
+ let components: ({
3
+ label: string;
4
+ tableView: boolean;
5
+ modal: boolean;
6
+ rowDrafts: boolean;
7
+ key: string;
8
+ type: string;
9
+ displayAsTable: boolean;
10
+ input: boolean;
11
+ components: ({
12
+ label: string;
13
+ widget: string;
14
+ tableView: boolean;
15
+ data: {
16
+ values: {
17
+ label: string;
18
+ value: string;
19
+ }[];
20
+ };
21
+ validate: {
22
+ required: boolean;
23
+ };
24
+ key: string;
25
+ type: string;
26
+ input: boolean;
27
+ applyMaskOn?: undefined;
28
+ validateWhenHidden?: undefined;
29
+ } | {
30
+ label: string;
31
+ applyMaskOn: string;
32
+ tableView: boolean;
33
+ validate: {
34
+ required: boolean;
35
+ };
36
+ validateWhenHidden: boolean;
37
+ key: string;
38
+ type: string;
39
+ input: boolean;
40
+ widget?: undefined;
41
+ data?: undefined;
42
+ })[];
43
+ showValidations?: undefined;
44
+ saveOnEnter?: undefined;
45
+ } | {
46
+ label: string;
47
+ showValidations: boolean;
48
+ tableView: boolean;
49
+ key: string;
50
+ type: string;
51
+ input: boolean;
52
+ saveOnEnter: boolean;
53
+ modal?: undefined;
54
+ rowDrafts?: undefined;
55
+ displayAsTable?: undefined;
56
+ components?: undefined;
57
+ })[];
58
+ }
59
+ export default _default;
@@ -0,0 +1,64 @@
1
+ export default {
2
+ "components": [
3
+ {
4
+ "label": "Edit Grid",
5
+ "tableView": false,
6
+ "modal": true,
7
+ "rowDrafts": true,
8
+ "key": "editGrid",
9
+ "type": "editgrid",
10
+ "displayAsTable": false,
11
+ "input": true,
12
+ "components": [
13
+ {
14
+ "label": "Select",
15
+ "widget": "choicesjs",
16
+ "tableView": true,
17
+ "data": {
18
+ "values": [
19
+ {
20
+ "label": "a",
21
+ "value": "a"
22
+ },
23
+ {
24
+ "label": "b",
25
+ "value": "b"
26
+ },
27
+ {
28
+ "label": "c",
29
+ "value": "c"
30
+ }
31
+ ]
32
+ },
33
+ "validate": {
34
+ "required": true
35
+ },
36
+ "key": "select",
37
+ "type": "select",
38
+ "input": true
39
+ },
40
+ {
41
+ "label": "Text Field",
42
+ "applyMaskOn": "change",
43
+ "tableView": true,
44
+ "validate": {
45
+ "required": true
46
+ },
47
+ "validateWhenHidden": false,
48
+ "key": "textField",
49
+ "type": "textfield",
50
+ "input": true
51
+ }
52
+ ]
53
+ },
54
+ {
55
+ "label": "Submit",
56
+ "showValidations": false,
57
+ "tableView": false,
58
+ "key": "submit",
59
+ "type": "button",
60
+ "input": true,
61
+ "saveOnEnter": false
62
+ }
63
+ ]
64
+ };