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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) 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 +57 -35
  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 +58 -36
  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/Embed.d.ts +21 -1
  20. package/lib/cjs/Embed.js +211 -308
  21. package/lib/cjs/Form.d.ts +1 -1
  22. package/lib/cjs/Form.js +1 -1
  23. package/lib/cjs/Webform.d.ts +6 -6
  24. package/lib/cjs/Webform.js +6 -6
  25. package/lib/cjs/WebformBuilder.js +1 -1
  26. package/lib/cjs/components/_classes/component/Component.d.ts +16 -6
  27. package/lib/cjs/components/_classes/component/Component.js +26 -6
  28. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  29. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
  30. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  31. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
  32. package/lib/cjs/components/address/Address.js +5 -0
  33. package/lib/cjs/components/button/Button.d.ts +1 -0
  34. package/lib/cjs/components/button/Button.js +3 -0
  35. package/lib/cjs/components/checkbox/Checkbox.d.ts +28 -0
  36. package/lib/cjs/components/checkbox/Checkbox.js +17 -2
  37. package/lib/cjs/components/columns/Columns.d.ts +1 -0
  38. package/lib/cjs/components/columns/Columns.js +3 -0
  39. package/lib/cjs/components/container/Container.js +3 -0
  40. package/lib/cjs/components/content/Content.d.ts +1 -0
  41. package/lib/cjs/components/content/Content.js +3 -0
  42. package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
  43. package/lib/cjs/components/datamap/DataMap.js +3 -0
  44. package/lib/cjs/components/datetime/DateTime.d.ts +19 -0
  45. package/lib/cjs/components/datetime/DateTime.js +9 -10
  46. package/lib/cjs/components/day/Day.d.ts +21 -0
  47. package/lib/cjs/components/day/Day.js +8 -10
  48. package/lib/cjs/components/fieldset/Fieldset.d.ts +1 -0
  49. package/lib/cjs/components/fieldset/Fieldset.js +3 -0
  50. package/lib/cjs/components/file/File.d.ts +21 -1
  51. package/lib/cjs/components/file/File.js +15 -7
  52. package/lib/cjs/components/form/Form.d.ts +1 -0
  53. package/lib/cjs/components/form/Form.js +3 -0
  54. package/lib/cjs/components/html/HTML.d.ts +1 -0
  55. package/lib/cjs/components/html/HTML.js +3 -0
  56. package/lib/cjs/components/number/Number.d.ts +20 -1
  57. package/lib/cjs/components/number/Number.js +10 -15
  58. package/lib/cjs/components/panel/Panel.d.ts +1 -0
  59. package/lib/cjs/components/panel/Panel.js +3 -0
  60. package/lib/cjs/components/radio/Radio.d.ts +19 -0
  61. package/lib/cjs/components/radio/Radio.js +30 -0
  62. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -0
  63. package/lib/cjs/components/recaptcha/ReCaptcha.js +3 -0
  64. package/lib/cjs/components/select/Select.d.ts +19 -1
  65. package/lib/cjs/components/select/Select.js +37 -3
  66. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +26 -1
  67. package/lib/cjs/components/selectboxes/SelectBoxes.js +8 -1
  68. package/lib/cjs/components/signature/Signature.d.ts +21 -0
  69. package/lib/cjs/components/signature/Signature.js +9 -1
  70. package/lib/cjs/components/survey/Survey.d.ts +21 -0
  71. package/lib/cjs/components/survey/Survey.js +7 -1
  72. package/lib/cjs/components/table/Table.d.ts +1 -0
  73. package/lib/cjs/components/table/Table.js +3 -0
  74. package/lib/cjs/components/tabs/Tabs.d.ts +1 -0
  75. package/lib/cjs/components/tabs/Tabs.js +3 -0
  76. package/lib/cjs/components/tags/Tags.d.ts +21 -0
  77. package/lib/cjs/components/tags/Tags.js +9 -1
  78. package/lib/cjs/components/textfield/TextField.d.ts +21 -0
  79. package/lib/cjs/components/textfield/TextField.js +7 -1
  80. package/lib/cjs/components/time/Time.d.ts +8 -1
  81. package/lib/cjs/components/well/Well.d.ts +1 -0
  82. package/lib/cjs/components/well/Well.js +3 -0
  83. package/lib/cjs/formio.embed.d.ts +2 -1
  84. package/lib/cjs/formio.embed.js +96 -1
  85. package/lib/cjs/formio.form.d.ts +4 -3
  86. package/lib/cjs/formio.form.js +17 -8
  87. package/lib/cjs/licenses/Licenses.d.ts +7 -0
  88. package/lib/cjs/licenses/Licenses.js +22 -0
  89. package/lib/cjs/licenses/index.d.ts +2 -0
  90. package/lib/cjs/licenses/index.js +7 -0
  91. package/lib/cjs/utils/utils.d.ts +10 -0
  92. package/lib/cjs/utils/utils.js +21 -1
  93. package/lib/mjs/CDN.d.ts +1 -0
  94. package/lib/mjs/CDN.js +1 -0
  95. package/lib/mjs/Embed.d.ts +21 -1
  96. package/lib/mjs/Embed.js +208 -322
  97. package/lib/mjs/Form.d.ts +1 -1
  98. package/lib/mjs/Form.js +1 -1
  99. package/lib/mjs/Webform.d.ts +6 -6
  100. package/lib/mjs/Webform.js +6 -6
  101. package/lib/mjs/WebformBuilder.js +1 -1
  102. package/lib/mjs/components/_classes/component/Component.d.ts +16 -6
  103. package/lib/mjs/components/_classes/component/Component.js +26 -6
  104. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  105. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
  106. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  107. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
  108. package/lib/mjs/components/address/Address.js +5 -0
  109. package/lib/mjs/components/button/Button.d.ts +1 -0
  110. package/lib/mjs/components/button/Button.js +4 -1
  111. package/lib/mjs/components/checkbox/Checkbox.d.ts +28 -0
  112. package/lib/mjs/components/checkbox/Checkbox.js +18 -3
  113. package/lib/mjs/components/columns/Columns.d.ts +1 -0
  114. package/lib/mjs/components/columns/Columns.js +3 -0
  115. package/lib/mjs/components/container/Container.js +4 -1
  116. package/lib/mjs/components/content/Content.d.ts +1 -0
  117. package/lib/mjs/components/content/Content.js +3 -0
  118. package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
  119. package/lib/mjs/components/datamap/DataMap.js +4 -1
  120. package/lib/mjs/components/datetime/DateTime.d.ts +19 -0
  121. package/lib/mjs/components/datetime/DateTime.js +11 -12
  122. package/lib/mjs/components/day/Day.d.ts +21 -0
  123. package/lib/mjs/components/day/Day.js +12 -14
  124. package/lib/mjs/components/fieldset/Fieldset.d.ts +1 -0
  125. package/lib/mjs/components/fieldset/Fieldset.js +3 -0
  126. package/lib/mjs/components/file/File.d.ts +21 -1
  127. package/lib/mjs/components/file/File.js +16 -8
  128. package/lib/mjs/components/form/Form.d.ts +1 -0
  129. package/lib/mjs/components/form/Form.js +4 -1
  130. package/lib/mjs/components/html/HTML.d.ts +1 -0
  131. package/lib/mjs/components/html/HTML.js +3 -0
  132. package/lib/mjs/components/number/Number.d.ts +20 -1
  133. package/lib/mjs/components/number/Number.js +11 -12
  134. package/lib/mjs/components/panel/Panel.d.ts +1 -0
  135. package/lib/mjs/components/panel/Panel.js +3 -0
  136. package/lib/mjs/components/radio/Radio.d.ts +19 -0
  137. package/lib/mjs/components/radio/Radio.js +34 -1
  138. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -0
  139. package/lib/mjs/components/recaptcha/ReCaptcha.js +3 -0
  140. package/lib/mjs/components/select/Select.d.ts +19 -1
  141. package/lib/mjs/components/select/Select.js +39 -5
  142. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +26 -1
  143. package/lib/mjs/components/selectboxes/SelectBoxes.js +8 -1
  144. package/lib/mjs/components/signature/Signature.d.ts +21 -0
  145. package/lib/mjs/components/signature/Signature.js +9 -1
  146. package/lib/mjs/components/survey/Survey.d.ts +21 -0
  147. package/lib/mjs/components/survey/Survey.js +8 -2
  148. package/lib/mjs/components/table/Table.d.ts +1 -0
  149. package/lib/mjs/components/table/Table.js +3 -0
  150. package/lib/mjs/components/tabs/Tabs.d.ts +1 -0
  151. package/lib/mjs/components/tabs/Tabs.js +3 -0
  152. package/lib/mjs/components/tags/Tags.d.ts +21 -0
  153. package/lib/mjs/components/tags/Tags.js +10 -2
  154. package/lib/mjs/components/textfield/TextField.d.ts +21 -0
  155. package/lib/mjs/components/textfield/TextField.js +8 -2
  156. package/lib/mjs/components/time/Time.d.ts +8 -1
  157. package/lib/mjs/components/well/Well.d.ts +1 -0
  158. package/lib/mjs/components/well/Well.js +3 -0
  159. package/lib/mjs/formio.embed.d.ts +2 -1
  160. package/lib/mjs/formio.embed.js +96 -2
  161. package/lib/mjs/formio.form.d.ts +4 -3
  162. package/lib/mjs/formio.form.js +16 -8
  163. package/lib/mjs/licenses/Licenses.d.ts +7 -0
  164. package/lib/mjs/licenses/Licenses.js +17 -0
  165. package/lib/mjs/licenses/index.d.ts +2 -0
  166. package/lib/mjs/licenses/index.js +2 -0
  167. package/lib/mjs/utils/utils.d.ts +10 -0
  168. package/lib/mjs/utils/utils.js +19 -0
  169. package/package.json +5 -1
  170. package/types/index.d.ts +1 -0
  171. package/types/licenses.d.ts +7 -0
  172. package/types/utils.d.ts +2 -0
@@ -1,5 +1,5 @@
1
1
  import Field from '../_classes/field/Field';
2
- import { uniqueName } from '../../utils/utils';
2
+ import { componentValueTypes, getComponentSavedTypes, uniqueName } from '../../utils/utils';
3
3
  import download from 'downloadjs';
4
4
  import _ from 'lodash';
5
5
  import fileProcessor from '../../providers/processor/fileProcessor';
@@ -54,11 +54,18 @@ export default class FileComponent extends Field {
54
54
  };
55
55
  }
56
56
  static get serverConditionSettings() {
57
+ return FileComponent.conditionOperatorsSettings;
58
+ }
59
+ static get conditionOperatorsSettings() {
57
60
  return {
58
- ...super.serverConditionSettings,
61
+ ...super.conditionOperatorsSettings,
59
62
  operators: ['isEmpty', 'isNotEmpty'],
60
63
  };
61
64
  }
65
+ static savedValueTypes(schema) {
66
+ schema = schema || {};
67
+ return getComponentSavedTypes(schema) || [componentValueTypes.object];
68
+ }
62
69
  init() {
63
70
  super.init();
64
71
  webViewCamera = navigator.camera || Camera;
@@ -353,8 +360,10 @@ export default class FileComponent extends Field {
353
360
  this.refs.fileStatusRemove.forEach((fileStatusRemove, index) => {
354
361
  this.addEventListener(fileStatusRemove, 'click', (event) => {
355
362
  event.preventDefault();
356
- if (this.abortUpload) {
357
- this.abortUpload();
363
+ const fileUpload = this.statuses[index];
364
+ _.pull(this.filesUploading, fileUpload.originalName);
365
+ if (fileUpload.abort) {
366
+ fileUpload.abort();
358
367
  }
359
368
  this.statuses.splice(index, 1);
360
369
  this.redraw();
@@ -560,6 +569,7 @@ export default class FileComponent extends Field {
560
569
  const fileName = uniqueName(file.name, this.component.fileNameTemplate, this.evalContext());
561
570
  const escapedFileName = file.name ? file.name.replaceAll('<', '&lt;').replaceAll('>', '&gt;') : file.name;
562
571
  const fileUpload = {
572
+ abort: () => null,
563
573
  originalName: escapedFileName,
564
574
  name: fileName,
565
575
  size: file.size,
@@ -678,7 +688,7 @@ export default class FileComponent extends Field {
678
688
  }
679
689
  }
680
690
  }
681
- fileUpload.message = this.t('Starting upload.');
691
+ fileUpload.message = this.t('Starting upload...');
682
692
  this.redraw();
683
693
  const filePromise = fileService.uploadFile(storage, processedFile || file, fileName, dir,
684
694
  // Progress callback
@@ -691,9 +701,7 @@ export default class FileComponent extends Field {
691
701
  // Upload start callback
692
702
  () => {
693
703
  this.emit('fileUploadingStart', filePromise);
694
- },
695
- // Abort upload callback
696
- (abort) => this.abortUpload = abort).then((fileInfo) => {
704
+ }, (abort) => fileUpload.abort = abort).then((fileInfo) => {
697
705
  const index = this.statuses.indexOf(fileUpload);
698
706
  if (index !== -1) {
699
707
  this.statuses.splice(index, 1);
@@ -7,6 +7,7 @@ export default class FormComponent extends Component {
7
7
  weight: number;
8
8
  schema: any;
9
9
  };
10
+ static savedValueTypes(): string[];
10
11
  init(): any;
11
12
  formObj: any;
12
13
  valueChanged: boolean | undefined;
@@ -2,7 +2,7 @@ import _ from 'lodash';
2
2
  import Component from '../_classes/component/Component';
3
3
  import ComponentModal from '../_classes/componentModal/ComponentModal';
4
4
  import EventEmitter from 'eventemitter3';
5
- import { isMongoId, eachComponent, getStringFromComponentPath, getArrayFromComponentPath } from '../../utils/utils';
5
+ import { isMongoId, eachComponent, getStringFromComponentPath, getArrayFromComponentPath, componentValueTypes } from '../../utils/utils';
6
6
  import { Formio } from '../../Formio';
7
7
  import Form from '../../Form';
8
8
  export default class FormComponent extends Component {
@@ -28,6 +28,9 @@ export default class FormComponent extends Component {
28
28
  schema: FormComponent.schema()
29
29
  };
30
30
  }
31
+ static savedValueTypes() {
32
+ return [componentValueTypes.object];
33
+ }
31
34
  init() {
32
35
  super.init();
33
36
  this.formObj = {
@@ -8,6 +8,7 @@ export default class HTMLComponent extends Component {
8
8
  showPreview: boolean;
9
9
  schema: any;
10
10
  };
11
+ static savedValueTypes(): never[];
11
12
  get content(): any;
12
13
  get singleTags(): string[];
13
14
  checkRefreshOn(changed: any): void;
@@ -23,6 +23,9 @@ export default class HTMLComponent extends Component {
23
23
  schema: HTMLComponent.schema()
24
24
  };
25
25
  }
26
+ static savedValueTypes() {
27
+ return [];
28
+ }
26
29
  get defaultSchema() {
27
30
  return HTMLComponent.schema();
28
31
  }
@@ -8,9 +8,28 @@ export default class NumberComponent extends Input {
8
8
  schema: any;
9
9
  };
10
10
  static get serverConditionSettings(): {
11
- operators: string[];
11
+ operators: any[];
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: any[];
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
  constructor(...args: any[]);
15
34
  validators: string[];
16
35
  delimiter: any;
@@ -1,8 +1,8 @@
1
1
  import { createNumberMask } from '@formio/text-mask-addons';
2
2
  import { conformToMask, maskInput } from '@formio/vanilla-text-mask';
3
3
  import _ from 'lodash';
4
- import { getNumberDecimalLimit, getNumberSeparators } from '../../utils/utils';
5
4
  import Input from '../_classes/input/Input';
5
+ import { getNumberSeparators, getNumberDecimalLimit, componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
6
6
  export default class NumberComponent extends Input {
7
7
  static schema(...extend) {
8
8
  return Input.schema({
@@ -28,22 +28,21 @@ export default class NumberComponent extends Input {
28
28
  };
29
29
  }
30
30
  static get serverConditionSettings() {
31
+ return NumberComponent.conditionOperatorsSettings;
32
+ }
33
+ static get conditionOperatorsSettings() {
31
34
  return {
32
- operators: [
33
- 'isEqual',
34
- 'isNotEqual',
35
- 'isEmpty',
36
- 'isNotEmpty',
37
- 'greaterThan',
38
- 'greaterThanOrEqual',
39
- 'lessThan',
40
- 'lessThanOrEqual',
41
- ],
35
+ ...super.conditionOperatorsSettings,
36
+ operators: [...super.conditionOperatorsSettings.operators, 'lessThan', 'greaterThan', 'lessThanOrEqual', 'greaterThanOrEqual'],
42
37
  valueComponent(classComp) {
43
38
  return { ...classComp, type: 'number' };
44
- },
39
+ }
45
40
  };
46
41
  }
42
+ static savedValueTypes(schema) {
43
+ schema = schema || {};
44
+ return getComponentSavedTypes(schema) || [componentValueTypes.number];
45
+ }
47
46
  constructor(...args) {
48
47
  super(...args);
49
48
  this.validators = this.validators.concat(['min', 'max']);
@@ -7,6 +7,7 @@ export default class PanelComponent extends NestedComponent {
7
7
  weight: number;
8
8
  schema: any;
9
9
  };
10
+ static savedValueTypes(): never[];
10
11
  constructor(...args: any[]);
11
12
  noField: boolean;
12
13
  getComponent(path: any, fn: any, originalPath: any): Object;
@@ -33,6 +33,9 @@ export default class PanelComponent extends NestedComponent {
33
33
  get templateName() {
34
34
  return 'panel';
35
35
  }
36
+ static savedValueTypes() {
37
+ return [];
38
+ }
36
39
  constructor(...args) {
37
40
  super(...args);
38
41
  this.noField = true;
@@ -7,6 +7,25 @@ export default class RadioComponent extends ListComponent {
7
7
  documentation: string;
8
8
  schema: any;
9
9
  };
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
+ };
20
+ constructor: Function;
21
+ toString(): string;
22
+ toLocaleString(): string;
23
+ valueOf(): Object;
24
+ hasOwnProperty(v: PropertyKey): boolean;
25
+ isPrototypeOf(v: Object): boolean;
26
+ propertyIsEnumerable(v: PropertyKey): boolean;
27
+ };
28
+ static savedValueTypes(schema: any): any[];
10
29
  constructor(component: any, options: any, data: any);
11
30
  previousValue: any;
12
31
  get inputInfo(): {
@@ -1,7 +1,7 @@
1
1
  import _ from 'lodash';
2
2
  import ListComponent from '../_classes/list/ListComponent';
3
3
  import { Formio } from '../../Formio';
4
- import { boolValue } from '../../utils/utils';
4
+ import { boolValue, componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
5
5
  export default class RadioComponent extends ListComponent {
6
6
  static schema(...extend) {
7
7
  return ListComponent.schema({
@@ -26,6 +26,39 @@ export default class RadioComponent extends ListComponent {
26
26
  schema: RadioComponent.schema()
27
27
  };
28
28
  }
29
+ static get conditionOperatorsSettings() {
30
+ return {
31
+ ...super.conditionOperatorsSettings,
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;
41
+ }
42
+ },
43
+ };
44
+ }
45
+ };
46
+ }
47
+ static savedValueTypes(schema) {
48
+ const { boolean, string, number, object, array } = componentValueTypes;
49
+ const { dataType } = schema;
50
+ const types = getComponentSavedTypes(schema);
51
+ if (types) {
52
+ return types;
53
+ }
54
+ if (dataType === 'object') {
55
+ return [object, array];
56
+ }
57
+ if (componentValueTypes[dataType]) {
58
+ return [componentValueTypes[dataType]];
59
+ }
60
+ return [boolean, string, number, object, array];
61
+ }
29
62
  constructor(component, options, data) {
30
63
  super(component, options, data);
31
64
  this.previousValue = this.dataValue || null;
@@ -7,6 +7,7 @@ export default class ReCaptchaComponent extends Component {
7
7
  weight: number;
8
8
  schema: any;
9
9
  };
10
+ static savedValueTypes(): never[];
10
11
  render(): any;
11
12
  recaptchaResult: any;
12
13
  createInput(): void;
@@ -21,6 +21,9 @@ export default class ReCaptchaComponent extends Component {
21
21
  schema: ReCaptchaComponent.schema()
22
22
  };
23
23
  }
24
+ static savedValueTypes() {
25
+ return [];
26
+ }
24
27
  render() {
25
28
  this.recaptchaResult = null;
26
29
  if (this.builderMode) {
@@ -9,8 +9,25 @@ export default class SelectComponent extends ListComponent {
9
9
  };
10
10
  static get serverConditionSettings(): {
11
11
  valueComponent(classComp: any): any;
12
- 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;
13
19
  };
20
+ static get conditionOperatorsSettings(): {
21
+ valueComponent(classComp: any): any;
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;
29
+ };
30
+ static savedValueTypes(schema: any): any[];
14
31
  templateData: {} | undefined;
15
32
  triggerUpdate: ((...args: any[]) => any) | undefined;
16
33
  set itemsLoaded(arg: any);
@@ -40,6 +57,7 @@ export default class SelectComponent extends ListComponent {
40
57
  get isSelectResource(): boolean;
41
58
  get itemsFromUrl(): boolean;
42
59
  get isInfiniteScrollProvided(): boolean;
60
+ get shouldInitialLoad(): any;
43
61
  isEntireObjectDisplay(): boolean;
44
62
  selectValueAndLabel(data: any): {
45
63
  value: any;
@@ -2,7 +2,7 @@ import _ from 'lodash';
2
2
  import { Formio } from '../../Formio';
3
3
  import ListComponent from '../_classes/list/ListComponent';
4
4
  import Form from '../../Form';
5
- import { getRandomComponentId, boolValue, isPromise } from '../../utils/utils';
5
+ import { getRandomComponentId, boolValue, isPromise, componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
6
6
  import Choices from '../../utils/ChoicesWrapper';
7
7
  export default class SelectComponent extends ListComponent {
8
8
  static schema(...extend) {
@@ -54,13 +54,34 @@ export default class SelectComponent extends ListComponent {
54
54
  };
55
55
  }
56
56
  static get serverConditionSettings() {
57
+ return SelectComponent.conditionOperatorsSettings;
58
+ }
59
+ static get conditionOperatorsSettings() {
57
60
  return {
58
- ...super.serverConditionSettings,
61
+ ...super.conditionOperatorsSettings,
59
62
  valueComponent(classComp) {
60
63
  return { ...classComp, type: 'select' };
61
- },
64
+ }
62
65
  };
63
66
  }
67
+ static savedValueTypes(schema) {
68
+ const { boolean, string, number, object, array } = componentValueTypes;
69
+ const { dataType, reference } = schema;
70
+ const types = getComponentSavedTypes(schema);
71
+ if (types) {
72
+ return types;
73
+ }
74
+ if (reference) {
75
+ return [object];
76
+ }
77
+ if (dataType === 'object') {
78
+ return [object, array];
79
+ }
80
+ if (componentValueTypes[dataType]) {
81
+ return [componentValueTypes[dataType]];
82
+ }
83
+ return [boolean, string, number, object, array];
84
+ }
64
85
  init() {
65
86
  super.init();
66
87
  this.templateData = {};
@@ -172,6 +193,15 @@ export default class SelectComponent extends ListComponent {
172
193
  get shouldDisabled() {
173
194
  return super.shouldDisabled || this.parentDisabled;
174
195
  }
196
+ get shouldInitialLoad() {
197
+ if (this.component.widget === 'html5' &&
198
+ this.isEntireObjectDisplay() &&
199
+ this.component.searchField &&
200
+ this.dataValue) {
201
+ return false;
202
+ }
203
+ return super.shouldLoad;
204
+ }
175
205
  isEntireObjectDisplay() {
176
206
  return this.component.dataSrc === 'resource' && this.valueProperty === 'data';
177
207
  }
@@ -482,7 +512,11 @@ export default class SelectComponent extends ListComponent {
482
512
  });
483
513
  // Add search capability.
484
514
  if (this.component.searchField && search) {
485
- const searchValue = Array.isArray(search) ? search.join(',') : search;
515
+ const searchValue = Array.isArray(search)
516
+ ? search.join(',')
517
+ : typeof search === 'object'
518
+ ? JSON.stringify(search)
519
+ : search;
486
520
  query[this.component.searchField] = this.component.searchField.endsWith('__regex')
487
521
  ? _.escapeRegExp(searchValue)
488
522
  : searchValue;
@@ -1195,7 +1229,7 @@ export default class SelectComponent extends ListComponent {
1195
1229
  !this.active &&
1196
1230
  !this.selectOptions.length &&
1197
1231
  hasValue &&
1198
- this.shouldLoad &&
1232
+ this.shouldInitialLoad &&
1199
1233
  this.visible && (this.component.searchField || this.component.valueProperty);
1200
1234
  }
1201
1235
  setChoicesValue(value, hasPreviousValue, flags = {}) {
@@ -9,8 +9,33 @@ export default class SelectBoxesComponent extends RadioComponent {
9
9
  custom: string;
10
10
  };
11
11
  };
12
- 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;
13
19
  };
20
+ static get conditionOperatorsSettings(): {
21
+ valueComponent(classComp: any): {
22
+ type: string;
23
+ dataSrc: string;
24
+ valueProperty: string;
25
+ valueType: string;
26
+ data: {
27
+ custom: string;
28
+ };
29
+ };
30
+ constructor: Function;
31
+ toString(): string;
32
+ toLocaleString(): string;
33
+ valueOf(): Object;
34
+ hasOwnProperty(v: PropertyKey): boolean;
35
+ isPrototypeOf(v: Object): boolean;
36
+ propertyIsEnumerable(v: PropertyKey): boolean;
37
+ };
38
+ static savedValueTypes(schema: any): string[];
14
39
  constructor(...args: any[]);
15
40
  validators: string[];
16
41
  get emptyValue(): any;
@@ -1,4 +1,5 @@
1
1
  import _ from 'lodash';
2
+ import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
2
3
  import RadioComponent from '../radio/Radio';
3
4
  export default class SelectBoxesComponent extends RadioComponent {
4
5
  static schema(...extend) {
@@ -20,8 +21,11 @@ export default class SelectBoxesComponent extends RadioComponent {
20
21
  };
21
22
  }
22
23
  static get serverConditionSettings() {
24
+ return SelectBoxesComponent.conditionOperatorsSettings;
25
+ }
26
+ static get conditionOperatorsSettings() {
23
27
  return {
24
- ...super.serverConditionSettings,
28
+ ...super.conditionOperatorsSettings,
25
29
  valueComponent(classComp) {
26
30
  return {
27
31
  type: 'select',
@@ -35,6 +39,9 @@ export default class SelectBoxesComponent extends RadioComponent {
35
39
  }
36
40
  };
37
41
  }
42
+ static savedValueTypes(schema) {
43
+ return getComponentSavedTypes(schema) || [componentValueTypes.object];
44
+ }
38
45
  constructor(...args) {
39
46
  super(...args);
40
47
  this.validators = this.validators.concat('minSelectedCount', 'maxSelectedCount', 'availableValueProperty');
@@ -7,6 +7,27 @@ export default class SignatureComponent extends Input {
7
7
  documentation: string;
8
8
  schema: any;
9
9
  };
10
+ static get serverConditionSettings(): {
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 get conditionOperatorsSettings(): {
21
+ operators: string[];
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;
29
+ };
30
+ static savedValueTypes(schema: any): string[];
10
31
  currentWidth: any;
11
32
  scale: any;
12
33
  ratio: number | undefined;
@@ -2,6 +2,7 @@ import SignaturePad from 'signature_pad';
2
2
  import _ResizeObserver from 'resize-observer-polyfill';
3
3
  import Input from '../_classes/input/Input';
4
4
  import _ from 'lodash';
5
+ import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
5
6
  export default class SignatureComponent extends Input {
6
7
  static schema(...extend) {
7
8
  return Input.schema({
@@ -29,11 +30,18 @@ export default class SignatureComponent extends Input {
29
30
  };
30
31
  }
31
32
  static get serverConditionSettings() {
33
+ return SignatureComponent.conditionOperatorsSettings;
34
+ }
35
+ static get conditionOperatorsSettings() {
32
36
  return {
33
- ...super.serverConditionSettings,
37
+ ...super.conditionOperatorsSettings,
34
38
  operators: ['isEmpty', 'isNotEmpty'],
35
39
  };
36
40
  }
41
+ static savedValueTypes(schema) {
42
+ schema = schema || {};
43
+ return getComponentSavedTypes(schema) || [componentValueTypes.string];
44
+ }
37
45
  init() {
38
46
  super.init();
39
47
  this.currentWidth = 0;
@@ -7,6 +7,27 @@ export default class SurveyComponent extends Field {
7
7
  documentation: string;
8
8
  schema: any;
9
9
  };
10
+ static get serverConditionSettings(): {
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 get conditionOperatorsSettings(): {
21
+ operators: string[];
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;
29
+ };
30
+ static savedValueTypes(schema: any): string[];
10
31
  render(): any;
11
32
  setValue(value: any, flags?: {}): boolean;
12
33
  get emptyValue(): {};
@@ -1,6 +1,6 @@
1
1
  import _ from 'lodash';
2
2
  import Field from '../_classes/field/Field';
3
- import { boolValue } from '../../utils/utils';
3
+ import { boolValue, componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
4
4
  export default class SurveyComponent extends Field {
5
5
  static schema(...extend) {
6
6
  return Field.schema({
@@ -22,11 +22,17 @@ export default class SurveyComponent extends Field {
22
22
  };
23
23
  }
24
24
  static get serverConditionSettings() {
25
+ return SurveyComponent.conditionOperatorsSettings;
26
+ }
27
+ static get conditionOperatorsSettings() {
25
28
  return {
26
- ...super.serverConditionSettings,
29
+ ...super.conditionOperatorsSettings,
27
30
  operators: ['isEmpty', 'isNotEmpty'],
28
31
  };
29
32
  }
33
+ static savedValueTypes(schema) {
34
+ return getComponentSavedTypes(schema) || [componentValueTypes.object];
35
+ }
30
36
  get defaultSchema() {
31
37
  return SurveyComponent.schema();
32
38
  }
@@ -11,6 +11,7 @@ export default class TableComponent extends NestedComponent {
11
11
  showPreview: boolean;
12
12
  schema: any;
13
13
  };
14
+ static savedValueTypes(): never[];
14
15
  constructor(...args: any[]);
15
16
  get cellClassName(): string;
16
17
  get tableKey(): string;
@@ -43,6 +43,9 @@ export default class TableComponent extends NestedComponent {
43
43
  schema: TableComponent.schema()
44
44
  };
45
45
  }
46
+ static savedValueTypes() {
47
+ return [];
48
+ }
46
49
  get defaultSchema() {
47
50
  return TableComponent.schema();
48
51
  }
@@ -8,6 +8,7 @@ export default class TabsComponent extends NestedComponent {
8
8
  showPreview: boolean;
9
9
  schema: any;
10
10
  };
11
+ static savedValueTypes(): never[];
11
12
  constructor(...args: any[]);
12
13
  get tabKey(): string;
13
14
  get tabLikey(): string;
@@ -30,6 +30,9 @@ export default class TabsComponent extends NestedComponent {
30
30
  schema: TabsComponent.schema(),
31
31
  };
32
32
  }
33
+ static savedValueTypes() {
34
+ return [];
35
+ }
33
36
  get defaultSchema() {
34
37
  return TabsComponent.schema();
35
38
  }
@@ -7,6 +7,27 @@ export default class TagsComponent extends Input {
7
7
  weight: number;
8
8
  schema: any;
9
9
  };
10
+ static get serverConditionSettings(): {
11
+ operators: any[];
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 get conditionOperatorsSettings(): {
21
+ operators: any[];
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;
29
+ };
30
+ static savedValueTypes(schema: any): any[];
10
31
  get emptyValue(): "" | never[];
11
32
  get delimiter(): any;
12
33
  attachElement(element: any, index: any): void;