@formio/js 5.0.0-rc.20 → 5.0.0-rc.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. package/dist/formio.embed.css +1 -39
  2. package/dist/formio.embed.js +2 -90
  3. package/dist/formio.embed.min.js +1 -1
  4. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  5. package/dist/formio.form.js +58 -36
  6. package/dist/formio.form.min.js +1 -1
  7. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  8. package/dist/formio.full.js +59 -37
  9. package/dist/formio.full.min.js +1 -1
  10. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  11. package/dist/formio.js +2 -2
  12. package/dist/formio.min.js +1 -1
  13. package/dist/formio.min.js.LICENSE.txt +1 -1
  14. package/dist/formio.utils.js +1 -1
  15. package/dist/formio.utils.min.js +1 -1
  16. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  17. package/lib/cjs/CDN.d.ts +1 -0
  18. package/lib/cjs/CDN.js +1 -0
  19. package/lib/cjs/Element.js +5 -0
  20. package/lib/cjs/Embed.d.ts +21 -1
  21. package/lib/cjs/Embed.js +211 -308
  22. package/lib/cjs/Form.d.ts +1 -1
  23. package/lib/cjs/Form.js +1 -1
  24. package/lib/cjs/Webform.d.ts +6 -6
  25. package/lib/cjs/Webform.js +6 -6
  26. package/lib/cjs/WebformBuilder.js +1 -1
  27. package/lib/cjs/components/_classes/component/Component.d.ts +16 -6
  28. package/lib/cjs/components/_classes/component/Component.js +26 -6
  29. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  30. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
  31. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  32. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
  33. package/lib/cjs/components/address/Address.js +5 -0
  34. package/lib/cjs/components/button/Button.d.ts +1 -0
  35. package/lib/cjs/components/button/Button.js +3 -0
  36. package/lib/cjs/components/checkbox/Checkbox.d.ts +28 -0
  37. package/lib/cjs/components/checkbox/Checkbox.js +17 -2
  38. package/lib/cjs/components/columns/Columns.d.ts +1 -0
  39. package/lib/cjs/components/columns/Columns.js +3 -0
  40. package/lib/cjs/components/container/Container.js +3 -0
  41. package/lib/cjs/components/content/Content.d.ts +1 -0
  42. package/lib/cjs/components/content/Content.js +3 -0
  43. package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
  44. package/lib/cjs/components/datamap/DataMap.js +3 -0
  45. package/lib/cjs/components/datetime/DateTime.d.ts +19 -0
  46. package/lib/cjs/components/datetime/DateTime.js +9 -10
  47. package/lib/cjs/components/day/Day.d.ts +21 -0
  48. package/lib/cjs/components/day/Day.js +12 -10
  49. package/lib/cjs/components/day/fixtures/comp5.d.ts +29 -0
  50. package/lib/cjs/components/day/fixtures/comp5.js +32 -0
  51. package/lib/cjs/components/day/fixtures/index.d.ts +2 -1
  52. package/lib/cjs/components/day/fixtures/index.js +3 -1
  53. package/lib/cjs/components/fieldset/Fieldset.d.ts +1 -0
  54. package/lib/cjs/components/fieldset/Fieldset.js +3 -0
  55. package/lib/cjs/components/file/File.d.ts +21 -1
  56. package/lib/cjs/components/file/File.js +15 -7
  57. package/lib/cjs/components/form/Form.d.ts +1 -0
  58. package/lib/cjs/components/form/Form.js +5 -1
  59. package/lib/cjs/components/html/HTML.d.ts +1 -0
  60. package/lib/cjs/components/html/HTML.js +3 -0
  61. package/lib/cjs/components/number/Number.d.ts +20 -1
  62. package/lib/cjs/components/number/Number.js +10 -15
  63. package/lib/cjs/components/panel/Panel.d.ts +1 -0
  64. package/lib/cjs/components/panel/Panel.js +3 -0
  65. package/lib/cjs/components/radio/Radio.d.ts +19 -0
  66. package/lib/cjs/components/radio/Radio.js +30 -0
  67. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -0
  68. package/lib/cjs/components/recaptcha/ReCaptcha.js +3 -0
  69. package/lib/cjs/components/select/Select.d.ts +19 -1
  70. package/lib/cjs/components/select/Select.js +39 -4
  71. package/lib/cjs/components/select/fixtures/comp19.d.ts +23 -0
  72. package/lib/cjs/components/select/fixtures/comp19.js +36 -0
  73. package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
  74. package/lib/cjs/components/select/fixtures/index.js +3 -1
  75. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +26 -1
  76. package/lib/cjs/components/selectboxes/SelectBoxes.js +8 -1
  77. package/lib/cjs/components/signature/Signature.d.ts +21 -0
  78. package/lib/cjs/components/signature/Signature.js +9 -1
  79. package/lib/cjs/components/survey/Survey.d.ts +21 -0
  80. package/lib/cjs/components/survey/Survey.js +7 -1
  81. package/lib/cjs/components/table/Table.d.ts +1 -0
  82. package/lib/cjs/components/table/Table.js +3 -0
  83. package/lib/cjs/components/tabs/Tabs.d.ts +1 -0
  84. package/lib/cjs/components/tabs/Tabs.js +3 -0
  85. package/lib/cjs/components/tags/Tags.d.ts +21 -0
  86. package/lib/cjs/components/tags/Tags.js +11 -1
  87. package/lib/cjs/components/tags/fixtures/comp6.d.ts +17 -0
  88. package/lib/cjs/components/tags/fixtures/comp6.js +20 -0
  89. package/lib/cjs/components/tags/fixtures/index.d.ts +2 -1
  90. package/lib/cjs/components/tags/fixtures/index.js +3 -1
  91. package/lib/cjs/components/textfield/TextField.d.ts +21 -0
  92. package/lib/cjs/components/textfield/TextField.js +7 -1
  93. package/lib/cjs/components/time/Time.d.ts +8 -1
  94. package/lib/cjs/components/well/Well.d.ts +1 -0
  95. package/lib/cjs/components/well/Well.js +3 -0
  96. package/lib/cjs/formio.embed.d.ts +2 -1
  97. package/lib/cjs/formio.embed.js +96 -1
  98. package/lib/cjs/formio.form.d.ts +4 -3
  99. package/lib/cjs/formio.form.js +17 -8
  100. package/lib/cjs/licenses/Licenses.d.ts +7 -0
  101. package/lib/cjs/licenses/Licenses.js +22 -0
  102. package/lib/cjs/licenses/index.d.ts +2 -0
  103. package/lib/cjs/licenses/index.js +7 -0
  104. package/lib/cjs/utils/utils.d.ts +10 -0
  105. package/lib/cjs/utils/utils.js +21 -1
  106. package/lib/mjs/CDN.d.ts +1 -0
  107. package/lib/mjs/CDN.js +1 -0
  108. package/lib/mjs/Element.js +5 -0
  109. package/lib/mjs/Embed.d.ts +21 -1
  110. package/lib/mjs/Embed.js +208 -322
  111. package/lib/mjs/Form.d.ts +1 -1
  112. package/lib/mjs/Form.js +1 -1
  113. package/lib/mjs/Webform.d.ts +6 -6
  114. package/lib/mjs/Webform.js +6 -6
  115. package/lib/mjs/WebformBuilder.js +1 -1
  116. package/lib/mjs/components/_classes/component/Component.d.ts +16 -6
  117. package/lib/mjs/components/_classes/component/Component.js +26 -6
  118. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  119. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
  120. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  121. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
  122. package/lib/mjs/components/address/Address.js +5 -0
  123. package/lib/mjs/components/button/Button.d.ts +1 -0
  124. package/lib/mjs/components/button/Button.js +4 -1
  125. package/lib/mjs/components/checkbox/Checkbox.d.ts +28 -0
  126. package/lib/mjs/components/checkbox/Checkbox.js +18 -3
  127. package/lib/mjs/components/columns/Columns.d.ts +1 -0
  128. package/lib/mjs/components/columns/Columns.js +3 -0
  129. package/lib/mjs/components/container/Container.js +4 -1
  130. package/lib/mjs/components/content/Content.d.ts +1 -0
  131. package/lib/mjs/components/content/Content.js +3 -0
  132. package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
  133. package/lib/mjs/components/datamap/DataMap.js +4 -1
  134. package/lib/mjs/components/datetime/DateTime.d.ts +19 -0
  135. package/lib/mjs/components/datetime/DateTime.js +11 -12
  136. package/lib/mjs/components/day/Day.d.ts +21 -0
  137. package/lib/mjs/components/day/Day.js +16 -14
  138. package/lib/mjs/components/day/fixtures/comp5.d.ts +29 -0
  139. package/lib/mjs/components/day/fixtures/comp5.js +30 -0
  140. package/lib/mjs/components/day/fixtures/index.d.ts +2 -1
  141. package/lib/mjs/components/day/fixtures/index.js +2 -1
  142. package/lib/mjs/components/fieldset/Fieldset.d.ts +1 -0
  143. package/lib/mjs/components/fieldset/Fieldset.js +3 -0
  144. package/lib/mjs/components/file/File.d.ts +21 -1
  145. package/lib/mjs/components/file/File.js +16 -8
  146. package/lib/mjs/components/form/Form.d.ts +1 -0
  147. package/lib/mjs/components/form/Form.js +6 -2
  148. package/lib/mjs/components/html/HTML.d.ts +1 -0
  149. package/lib/mjs/components/html/HTML.js +3 -0
  150. package/lib/mjs/components/number/Number.d.ts +20 -1
  151. package/lib/mjs/components/number/Number.js +11 -12
  152. package/lib/mjs/components/panel/Panel.d.ts +1 -0
  153. package/lib/mjs/components/panel/Panel.js +3 -0
  154. package/lib/mjs/components/radio/Radio.d.ts +19 -0
  155. package/lib/mjs/components/radio/Radio.js +34 -1
  156. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -0
  157. package/lib/mjs/components/recaptcha/ReCaptcha.js +3 -0
  158. package/lib/mjs/components/select/Select.d.ts +19 -1
  159. package/lib/mjs/components/select/Select.js +41 -6
  160. package/lib/mjs/components/select/fixtures/comp19.d.ts +23 -0
  161. package/lib/mjs/components/select/fixtures/comp19.js +34 -0
  162. package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
  163. package/lib/mjs/components/select/fixtures/index.js +2 -1
  164. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +26 -1
  165. package/lib/mjs/components/selectboxes/SelectBoxes.js +8 -1
  166. package/lib/mjs/components/signature/Signature.d.ts +21 -0
  167. package/lib/mjs/components/signature/Signature.js +9 -1
  168. package/lib/mjs/components/survey/Survey.d.ts +21 -0
  169. package/lib/mjs/components/survey/Survey.js +8 -2
  170. package/lib/mjs/components/table/Table.d.ts +1 -0
  171. package/lib/mjs/components/table/Table.js +3 -0
  172. package/lib/mjs/components/tabs/Tabs.d.ts +1 -0
  173. package/lib/mjs/components/tabs/Tabs.js +3 -0
  174. package/lib/mjs/components/tags/Tags.d.ts +21 -0
  175. package/lib/mjs/components/tags/Tags.js +12 -2
  176. package/lib/mjs/components/tags/fixtures/comp6.d.ts +17 -0
  177. package/lib/mjs/components/tags/fixtures/comp6.js +18 -0
  178. package/lib/mjs/components/tags/fixtures/index.d.ts +2 -1
  179. package/lib/mjs/components/tags/fixtures/index.js +2 -1
  180. package/lib/mjs/components/textfield/TextField.d.ts +21 -0
  181. package/lib/mjs/components/textfield/TextField.js +8 -2
  182. package/lib/mjs/components/time/Time.d.ts +8 -1
  183. package/lib/mjs/components/well/Well.d.ts +1 -0
  184. package/lib/mjs/components/well/Well.js +3 -0
  185. package/lib/mjs/formio.embed.d.ts +2 -1
  186. package/lib/mjs/formio.embed.js +96 -2
  187. package/lib/mjs/formio.form.d.ts +4 -3
  188. package/lib/mjs/formio.form.js +16 -8
  189. package/lib/mjs/licenses/Licenses.d.ts +7 -0
  190. package/lib/mjs/licenses/Licenses.js +17 -0
  191. package/lib/mjs/licenses/index.d.ts +2 -0
  192. package/lib/mjs/licenses/index.js +2 -0
  193. package/lib/mjs/utils/utils.d.ts +10 -0
  194. package/lib/mjs/utils/utils.js +19 -0
  195. package/package.json +5 -1
  196. package/types/index.d.ts +1 -0
  197. package/types/licenses.d.ts +7 -0
  198. package/types/utils.d.ts +2 -0
@@ -131,7 +131,7 @@ export default class Webform extends NestedDataComponent {
131
131
  * @type {Promise}
132
132
  *
133
133
  * @example
134
- * import Webform from 'formiojs/Webform';
134
+ * import Webform from '@formio/js/Webform';
135
135
  * let form = new Webform(document.getElementById('formio'));
136
136
  * form.formReady.then(() => {
137
137
  * console.log('The form is ready!');
@@ -157,7 +157,7 @@ export default class Webform extends NestedDataComponent {
157
157
  * @type {Promise}
158
158
  *
159
159
  * @example
160
- * import Webform from 'formiojs/Webform';
160
+ * import Webform from '@formio/js/Webform';
161
161
  * let form = new Webform(document.getElementById('formio'));
162
162
  * form.submissionReady.then(() => {
163
163
  * console.log('The submission is ready!');
@@ -368,7 +368,7 @@ export default class Webform extends NestedDataComponent {
368
368
  * @param {string} value - The value of the form embed url.
369
369
  *
370
370
  * @example
371
- * import Webform from 'formiojs/Webform';
371
+ * import Webform from '@formio/js/Webform';
372
372
  * let form = new Webform(document.getElementById('formio'));
373
373
  * form.formReady.then(() => {
374
374
  * console.log('The form is formReady!');
@@ -473,7 +473,7 @@ export default class Webform extends NestedDataComponent {
473
473
  * Sets the JSON schema for the form to be rendered.
474
474
  *
475
475
  * @example
476
- * import Webform from 'formiojs/Webform';
476
+ * import Webform from '@formio/js/Webform';
477
477
  * let form = new Webform(document.getElementById('formio'));
478
478
  * form.setForm({
479
479
  * components: [
@@ -606,7 +606,7 @@ export default class Webform extends NestedDataComponent {
606
606
  * Sets the submission of a form.
607
607
  *
608
608
  * @example
609
- * import Webform from 'formiojs/Webform';
609
+ * import Webform from '@formio/js/Webform';
610
610
  * let form = new Webform(document.getElementById('formio'));
611
611
  * form.src = 'https://examples.form.io/example';
612
612
  * form.submission = {data: {
@@ -1340,7 +1340,7 @@ export default class Webform extends NestedDataComponent {
1340
1340
  * Submits the form.
1341
1341
  *
1342
1342
  * @example
1343
- * import Webform from 'formiojs/Webform';
1343
+ * import Webform from '@formio/js/Webform';
1344
1344
  * let form = new Webform(document.getElementById('formio'));
1345
1345
  * form.src = 'https://examples.form.io/example';
1346
1346
  * form.submission = {data: {
@@ -393,7 +393,7 @@ export default class WebformBuilder extends Component {
393
393
  premium: {
394
394
  title: 'Premium',
395
395
  weight: 40
396
- },
396
+ }
397
397
  };
398
398
  }
399
399
  redraw() {
@@ -4,6 +4,21 @@
4
4
  */
5
5
  declare class Component extends Element {
6
6
  static schema(...sources: any[]): any;
7
+ /**
8
+ * Return the simple condition settings as part of the component.
9
+ *
10
+ * @return {Object}
11
+ *
12
+ */
13
+ static get conditionOperatorsSettings(): Object;
14
+ /**
15
+ * Return the array of possible types of component value absed on its schema.
16
+ *
17
+ * @param schema
18
+ * @return {Array}
19
+ *
20
+ */
21
+ static savedValueTypes(schema: any): any[];
7
22
  /**
8
23
  * Provides a table view for this component. Override if you wish to do something different than using getView
9
24
  * method of your instance.
@@ -12,12 +27,7 @@ declare class Component extends Element {
12
27
  * @param options
13
28
  */
14
29
  static tableView(value: any, options: any): void;
15
- static get serverConditionSettings(): {
16
- operators: string[];
17
- valueComponent(): {
18
- type: string;
19
- };
20
- };
30
+ static get serverConditionSettings(): Object;
21
31
  /**
22
32
  * Initialize a new Component.
23
33
  *
@@ -172,6 +172,31 @@ export default class Component extends Element {
172
172
  static get Validator() {
173
173
  return Validator;
174
174
  }
175
+ /**
176
+ * Return the simple condition settings as part of the component.
177
+ *
178
+ * @return {Object}
179
+ *
180
+ */
181
+ static get conditionOperatorsSettings() {
182
+ return {
183
+ operators: ['isEqual', 'isNotEqual', 'isEmpty', 'isNotEmpty'],
184
+ valueComponent() {
185
+ return { type: 'textfield' };
186
+ }
187
+ };
188
+ }
189
+ /**
190
+ * Return the array of possible types of component value absed on its schema.
191
+ *
192
+ * @param schema
193
+ * @return {Array}
194
+ *
195
+ */
196
+ static savedValueTypes(schema) {
197
+ schema = schema || {};
198
+ return FormioUtils.getComponentSavedTypes(schema) || [FormioUtils.componentValueTypes.any];
199
+ }
175
200
  /**
176
201
  * Provides a table view for this component. Override if you wish to do something different than using getView
177
202
  * method of your instance.
@@ -1370,12 +1395,7 @@ export default class Component extends Element {
1370
1395
  return customCSS;
1371
1396
  }
1372
1397
  static get serverConditionSettings() {
1373
- return {
1374
- operators: ['isEqual', 'isNotEqual', 'isEmpty', 'isNotEmpty'],
1375
- valueComponent() {
1376
- return { type: 'textfield' };
1377
- },
1378
- };
1398
+ return Component.conditionOperatorsSettings;
1379
1399
  }
1380
1400
  get isMobile() {
1381
1401
  return isMobile();
@@ -1,4 +1,5 @@
1
1
  export default class NestedArrayComponent extends NestedDataComponent {
2
+ static savedValueTypes(): string[];
2
3
  componentContext(component: any): any;
3
4
  get iteratableRows(): void;
4
5
  prevHasAddButton: any;
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  import _ from 'lodash';
3
+ import { componentValueTypes } from '../../../utils/utils';
3
4
  import Component from '../component/Component';
4
5
  import NestedDataComponent from '../nesteddata/NestedDataComponent';
5
6
  export default class NestedArrayComponent extends NestedDataComponent {
@@ -8,6 +9,9 @@ export default class NestedArrayComponent extends NestedDataComponent {
8
9
  disableAddingRemovingRows: false
9
10
  }, ...extend);
10
11
  }
12
+ static savedValueTypes() {
13
+ return [componentValueTypes.array];
14
+ }
11
15
  componentContext(component) {
12
16
  return this.iteratableRows[component.rowIndex].data;
13
17
  }
@@ -1,4 +1,5 @@
1
1
  export default class NestedDataComponent extends NestedComponent {
2
+ static savedValueTypes(schema: any): string[];
2
3
  hasChanged(newValue: any, oldValue: any): boolean;
3
4
  get allowData(): boolean;
4
5
  get emptyValue(): {};
@@ -2,6 +2,7 @@
2
2
  import Component from '../component/Component';
3
3
  import NestedComponent from '../nested/NestedComponent';
4
4
  import _ from 'lodash';
5
+ import { componentValueTypes, getComponentSavedTypes } from '../../../utils/utils';
5
6
  export default class NestedDataComponent extends NestedComponent {
6
7
  hasChanged(newValue, oldValue) {
7
8
  // If we do not have a value and are getting set to anything other than undefined or null, then we changed.
@@ -12,6 +13,9 @@ export default class NestedDataComponent extends NestedComponent {
12
13
  }
13
14
  return !_.isEqual(newValue, oldValue);
14
15
  }
16
+ static savedValueTypes(schema) {
17
+ return getComponentSavedTypes(schema) || [componentValueTypes.object];
18
+ }
15
19
  get allowData() {
16
20
  return true;
17
21
  }
@@ -5,6 +5,7 @@ import { GoogleAddressProvider } from '../../providers/address/GoogleAddressProv
5
5
  import Field from '../_classes/field/Field';
6
6
  import NestedComponent from '../_classes/nested/NestedComponent';
7
7
  import ContainerComponent from '../container/Container';
8
+ import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
8
9
  export const AddressComponentMode = {
9
10
  Autocomplete: 'autocomplete',
10
11
  Manual: 'manual',
@@ -76,6 +77,10 @@ export default class AddressComponent extends ContainerComponent {
76
77
  ],
77
78
  }, ...extend);
78
79
  }
80
+ static savedValueTypes(schema) {
81
+ schema = schema || {};
82
+ return getComponentSavedTypes(schema) || [componentValueTypes.object];
83
+ }
79
84
  static get builderInfo() {
80
85
  return {
81
86
  title: 'Address',
@@ -7,6 +7,7 @@ export default class ButtonComponent extends Field {
7
7
  weight: number;
8
8
  schema: any;
9
9
  };
10
+ static savedValueTypes(schema: any): string[];
10
11
  constructor(component: any, options: any, data: any);
11
12
  filesUploading: any[];
12
13
  get inputInfo(): {
@@ -1,7 +1,7 @@
1
1
  import _ from 'lodash';
2
2
  import Field from '../_classes/field/Field';
3
3
  import Input from '../_classes/input/Input';
4
- import { eachComponent, getArrayFromComponentPath } from '../../utils/utils';
4
+ import { componentValueTypes, eachComponent, getArrayFromComponentPath, getComponentSavedTypes } from '../../utils/utils';
5
5
  export default class ButtonComponent extends Field {
6
6
  static schema(...extend) {
7
7
  return Input.schema({
@@ -29,6 +29,9 @@ export default class ButtonComponent extends Field {
29
29
  schema: ButtonComponent.schema()
30
30
  };
31
31
  }
32
+ static savedValueTypes(schema) {
33
+ return getComponentSavedTypes(schema) || [componentValueTypes.boolean];
34
+ }
32
35
  constructor(component, options, data) {
33
36
  super(component, options, data);
34
37
  this.filesUploading = [];
@@ -19,7 +19,35 @@ export default class CheckBoxComponent extends Field {
19
19
  };
20
20
  type: string;
21
21
  };
22
+ constructor: Function;
23
+ toString(): string;
24
+ toLocaleString(): string;
25
+ valueOf(): Object;
26
+ hasOwnProperty(v: PropertyKey): boolean;
27
+ isPrototypeOf(v: Object): boolean;
28
+ propertyIsEnumerable(v: PropertyKey): boolean;
22
29
  };
30
+ static get conditionOperatorsSettings(): {
31
+ operators: string[];
32
+ valueComponent(): {
33
+ valueType: string;
34
+ data: {
35
+ values: {
36
+ label: string;
37
+ value: string;
38
+ }[];
39
+ };
40
+ type: string;
41
+ };
42
+ constructor: Function;
43
+ toString(): string;
44
+ toLocaleString(): string;
45
+ valueOf(): Object;
46
+ hasOwnProperty(v: PropertyKey): boolean;
47
+ isPrototypeOf(v: Object): boolean;
48
+ propertyIsEnumerable(v: PropertyKey): boolean;
49
+ };
50
+ static savedValueTypes(schema: any): string[] | null;
23
51
  get labelClass(): string;
24
52
  get inputInfo(): {
25
53
  type: string;
@@ -1,4 +1,5 @@
1
1
  import _ from 'lodash';
2
+ import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
2
3
  import Field from '../_classes/field/Field';
3
4
  export default class CheckBoxComponent extends Field {
4
5
  static schema(...extend) {
@@ -24,8 +25,11 @@ export default class CheckBoxComponent extends Field {
24
25
  };
25
26
  }
26
27
  static get serverConditionSettings() {
28
+ return CheckBoxComponent.conditionOperatorsSettings;
29
+ }
30
+ static get conditionOperatorsSettings() {
27
31
  return {
28
- ...super.serverConditionSettings,
32
+ ...super.conditionOperatorsSettings,
29
33
  operators: ['isEqual'],
30
34
  valueComponent() {
31
35
  return {
@@ -36,11 +40,22 @@ export default class CheckBoxComponent extends Field {
36
40
  { label: 'Not Checked', value: 'false' },
37
41
  ]
38
42
  },
39
- type: 'select',
43
+ type: 'select'
40
44
  };
41
- },
45
+ }
42
46
  };
43
47
  }
48
+ static savedValueTypes(schema) {
49
+ schema = schema || {};
50
+ const types = getComponentSavedTypes(schema);
51
+ if (_.isArray(types)) {
52
+ return types;
53
+ }
54
+ if (schema.inputType === 'radio') {
55
+ return [componentValueTypes.string];
56
+ }
57
+ return [componentValueTypes.boolean];
58
+ }
44
59
  get defaultSchema() {
45
60
  return CheckBoxComponent.schema();
46
61
  }
@@ -8,6 +8,7 @@ export default class ColumnsComponent extends NestedComponent {
8
8
  weight: number;
9
9
  schema: any;
10
10
  };
11
+ static savedValueTypes(): never[];
11
12
  rows: any[];
12
13
  get columnKey(): string;
13
14
  columns: any[] | undefined;
@@ -28,6 +28,9 @@ export default class ColumnsComponent extends NestedComponent {
28
28
  schema: ColumnsComponent.schema()
29
29
  };
30
30
  }
31
+ static savedValueTypes() {
32
+ return [];
33
+ }
31
34
  constructor(component, options, data) {
32
35
  super(component, options, data);
33
36
  this.rows = [];
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import { getFocusableElements } from '../../utils/utils';
2
+ import { componentValueTypes, getComponentSavedTypes, getFocusableElements } from '../../utils/utils';
3
3
  import Component from '../_classes/component/Component';
4
4
  import Field from '../_classes/field/Field';
5
5
  import NestedDataComponent from '../_classes/nesteddata/NestedDataComponent';
@@ -31,6 +31,9 @@ export default class ContainerComponent extends NestedDataComponent {
31
31
  super(...args);
32
32
  this.type = 'container';
33
33
  }
34
+ static savedValueTypes(schema) {
35
+ return getComponentSavedTypes(schema) || [componentValueTypes.object];
36
+ }
34
37
  addComponents(data, options) {
35
38
  return super.addComponents(this.dataValue, options);
36
39
  }
@@ -8,6 +8,7 @@ export default class ContentComponent extends Component {
8
8
  weight: number;
9
9
  schema: any;
10
10
  };
11
+ static savedValueTypes(): never[];
11
12
  get content(): any;
12
13
  render(): any;
13
14
  get dataReady(): any;
@@ -21,6 +21,9 @@ export default class ContentComponent extends Component {
21
21
  schema: ContentComponent.schema()
22
22
  };
23
23
  }
24
+ static savedValueTypes() {
25
+ return [];
26
+ }
24
27
  get defaultSchema() {
25
28
  return ContentComponent.schema();
26
29
  }
@@ -1,4 +1,5 @@
1
1
  export default class DataMapComponent extends DataGridComponent {
2
+ static savedValueTypes(schema: any): string[];
2
3
  constructor(component: any, options: any, data: any);
3
4
  get emptyValue(): {};
4
5
  set dataValue(arg: any);
@@ -2,7 +2,7 @@ import Component from '../_classes/component/Component';
2
2
  import DataGridComponent from '../datagrid/DataGrid';
3
3
  import _ from 'lodash';
4
4
  import EventEmitter from 'eventemitter3';
5
- import { uniqueKey } from '../../utils/utils';
5
+ import { componentValueTypes, getComponentSavedTypes, uniqueKey } from '../../utils/utils';
6
6
  export default class DataMapComponent extends DataGridComponent {
7
7
  static schema(...extend) {
8
8
  return Component.schema({
@@ -44,6 +44,9 @@ export default class DataMapComponent extends DataGridComponent {
44
44
  }
45
45
  return _.omit(schema, 'components');
46
46
  }
47
+ static savedValueTypes(schema) {
48
+ return getComponentSavedTypes(schema) || [componentValueTypes.object];
49
+ }
47
50
  constructor(component, options, data) {
48
51
  super(component, options, data);
49
52
  this.type = 'datamap';
@@ -10,7 +10,26 @@ export default class DateTimeComponent extends Input {
10
10
  static get serverConditionSettings(): {
11
11
  operators: string[];
12
12
  valueComponent(classComp: any): any;
13
+ constructor: Function;
14
+ toString(): string;
15
+ toLocaleString(): string;
16
+ valueOf(): Object;
17
+ hasOwnProperty(v: PropertyKey): boolean;
18
+ isPrototypeOf(v: Object): boolean;
19
+ propertyIsEnumerable(v: PropertyKey): boolean;
13
20
  };
21
+ static get conditionOperatorsSettings(): {
22
+ operators: string[];
23
+ valueComponent(classComp: any): any;
24
+ constructor: Function;
25
+ toString(): string;
26
+ toLocaleString(): string;
27
+ valueOf(): Object;
28
+ hasOwnProperty(v: PropertyKey): boolean;
29
+ isPrototypeOf(v: Object): boolean;
30
+ propertyIsEnumerable(v: PropertyKey): boolean;
31
+ };
32
+ static savedValueTypes(schema: any): string[];
14
33
  get emptyValue(): string;
15
34
  get momentFormat(): string;
16
35
  createWrapper(): boolean;
@@ -1,6 +1,7 @@
1
1
  import _ from 'lodash';
2
2
  import moment from 'moment';
3
3
  import FormioUtils from '../../utils';
4
+ import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
4
5
  import Input from '../_classes/input/Input';
5
6
  export default class DateTimeComponent extends Input {
6
7
  static schema(...extend) {
@@ -51,26 +52,24 @@ export default class DateTimeComponent extends Input {
51
52
  };
52
53
  }
53
54
  static get serverConditionSettings() {
55
+ return DateTimeComponent.conditionOperatorsSettings;
56
+ }
57
+ static get conditionOperatorsSettings() {
54
58
  return {
55
- ...super.serverConditionSettings,
56
- operators: [
57
- 'isDateEqual',
58
- 'isNotDateEqual',
59
- 'isEmpty',
60
- 'isNotEmpty',
61
- 'dateLessThan',
62
- 'dateGreaterThan',
63
- 'dateLessThanOrEqual',
64
- 'dateGreaterThanOrEqual',
65
- ],
59
+ ...super.conditionOperatorsSettings,
60
+ operators: ['isDateEqual', 'isNotDateEqual', 'isEmpty', 'isNotEmpty', 'dateLessThan', 'dateGreaterThan', 'dateLessThanOrEqual', 'dateGreaterThanOrEqual'],
66
61
  valueComponent(classComp) {
67
62
  return {
68
63
  ...classComp,
69
64
  type: 'datetime',
70
65
  };
71
- },
66
+ }
72
67
  };
73
68
  }
69
+ static savedValueTypes(schema) {
70
+ schema = schema || {};
71
+ return getComponentSavedTypes(schema) || [componentValueTypes.date];
72
+ }
74
73
  constructor(component, options, data) {
75
74
  super(component, options, data);
76
75
  const timezone = (this.component.timezone || this.options.timezone);
@@ -7,6 +7,27 @@ export default class DayComponent extends Field {
7
7
  weight: number;
8
8
  schema: any;
9
9
  };
10
+ static get conditionOperatorsSettings(): {
11
+ operators: string[];
12
+ constructor: Function;
13
+ toString(): string;
14
+ toLocaleString(): string;
15
+ valueOf(): Object;
16
+ hasOwnProperty(v: PropertyKey): boolean;
17
+ isPrototypeOf(v: Object): boolean;
18
+ propertyIsEnumerable(v: PropertyKey): boolean;
19
+ };
20
+ static savedValueTypes(schema: any): string[];
21
+ static get serverConditionSettings(): {
22
+ operators: string[];
23
+ constructor: Function;
24
+ toString(): string;
25
+ toLocaleString(): string;
26
+ valueOf(): Object;
27
+ hasOwnProperty(v: PropertyKey): boolean;
28
+ isPrototypeOf(v: Object): boolean;
29
+ propertyIsEnumerable(v: PropertyKey): boolean;
30
+ };
10
31
  constructor(component: any, options: any, data: any);
11
32
  /**
12
33
  * The empty value for day component.
@@ -1,7 +1,8 @@
1
1
  import _ from 'lodash';
2
2
  import moment from 'moment';
3
3
  import Field from '../_classes/field/Field';
4
- import { boolValue, getLocaleDateFormatInfo } from '../../utils/utils';
4
+ import Input from '../_classes/input/Input';
5
+ import { boolValue, componentValueTypes, getComponentSavedTypes, getLocaleDateFormatInfo } from '../../utils/utils';
5
6
  export default class DayComponent extends Field {
6
7
  static schema(...extend) {
7
8
  return Field.schema({
@@ -38,6 +39,16 @@ export default class DayComponent extends Field {
38
39
  schema: DayComponent.schema()
39
40
  };
40
41
  }
42
+ static get conditionOperatorsSettings() {
43
+ return {
44
+ ...super.conditionOperatorsSettings,
45
+ operators: ['isDateEqual', 'isNotDateEqual', 'isEmpty', 'isNotEmpty', 'dateLessThan', 'dateGreaterThan', 'dateLessThanOrEqual', 'dateGreaterThanOrEqual'],
46
+ };
47
+ }
48
+ static savedValueTypes(schema) {
49
+ schema = schema || {};
50
+ return getComponentSavedTypes(schema) || [componentValueTypes.string];
51
+ }
41
52
  constructor(component, options, data) {
42
53
  if (component.maxDate) {
43
54
  component.maxDate = moment(component.maxDate, 'YYYY-MM-DD').toISOString();
@@ -48,19 +59,7 @@ export default class DayComponent extends Field {
48
59
  super(component, options, data);
49
60
  }
50
61
  static get serverConditionSettings() {
51
- return {
52
- ...super.serverConditionSettings,
53
- operators: [
54
- 'isDateEqual',
55
- 'isNotDateEqual',
56
- 'isEmpty',
57
- 'isNotEmpty',
58
- 'dateLessThan',
59
- 'dateGreaterThan',
60
- 'dateLessThanOrEqual',
61
- 'dateGreaterThanOrEqual',
62
- ],
63
- };
62
+ return DayComponent.conditionOperatorsSettings;
64
63
  }
65
64
  /**
66
65
  * The empty value for day component.
@@ -291,6 +290,9 @@ export default class DayComponent extends Field {
291
290
  this.addEventListener(this.refs.input, this.info.changeEvent, () => this.updateValue(null, {
292
291
  modified: true
293
292
  }));
293
+ [this.refs.day, this.refs.month, this.refs.year].forEach((element) => {
294
+ Input.prototype.addFocusBlurEvents.call(this, element);
295
+ });
294
296
  }
295
297
  this.setValue(this.dataValue);
296
298
  // Force the disabled state with getters and setters.
@@ -0,0 +1,29 @@
1
+ declare namespace _default {
2
+ const type: string;
3
+ const display: string;
4
+ const components: {
5
+ label: string;
6
+ hideInputLabels: boolean;
7
+ inputsLabelPosition: string;
8
+ useLocaleSettings: boolean;
9
+ tableView: boolean;
10
+ fields: {
11
+ day: {
12
+ hide: boolean;
13
+ required: boolean;
14
+ };
15
+ month: {
16
+ hide: boolean;
17
+ };
18
+ year: {
19
+ hide: boolean;
20
+ };
21
+ };
22
+ validateOn: string;
23
+ key: string;
24
+ type: string;
25
+ input: boolean;
26
+ defaultValue: string;
27
+ }[];
28
+ }
29
+ export default _default;
@@ -0,0 +1,30 @@
1
+ export default {
2
+ type: 'form',
3
+ display: 'form',
4
+ components: [
5
+ {
6
+ label: 'Day',
7
+ hideInputLabels: false,
8
+ inputsLabelPosition: 'top',
9
+ useLocaleSettings: false,
10
+ tableView: false,
11
+ fields: {
12
+ day: {
13
+ hide: false,
14
+ required: true
15
+ },
16
+ month: {
17
+ hide: false
18
+ },
19
+ year: {
20
+ hide: false
21
+ }
22
+ },
23
+ validateOn: 'blur',
24
+ key: 'day',
25
+ type: 'day',
26
+ input: true,
27
+ defaultValue: '00/00/0000'
28
+ },
29
+ ]
30
+ };
@@ -2,4 +2,5 @@ import comp1 from './comp1';
2
2
  import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
- export { comp1, comp2, comp3, comp4 };
5
+ import comp5 from './comp5';
6
+ export { comp1, comp2, comp3, comp4, comp5 };
@@ -2,4 +2,5 @@ import comp1 from './comp1';
2
2
  import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
- export { comp1, comp2, comp3, comp4 };
5
+ import comp5 from './comp5';
6
+ export { comp1, comp2, comp3, comp4, comp5 };
@@ -8,6 +8,7 @@ export default class FieldsetComponent extends NestedComponent {
8
8
  weight: number;
9
9
  schema: any;
10
10
  };
11
+ static savedValueTypes(): never[];
11
12
  constructor(...args: any[]);
12
13
  noField: boolean;
13
14
  }
@@ -22,6 +22,9 @@ export default class FieldsetComponent extends NestedComponent {
22
22
  schema: FieldsetComponent.schema()
23
23
  };
24
24
  }
25
+ static savedValueTypes() {
26
+ return [];
27
+ }
25
28
  get defaultSchema() {
26
29
  return FieldsetComponent.schema();
27
30
  }