@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
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
7
7
  const comp1_1 = __importDefault(require("./comp1"));
8
8
  exports.comp1 = comp1_1.default;
9
9
  const comp2_1 = __importDefault(require("./comp2"));
@@ -12,3 +12,5 @@ const comp3_1 = __importDefault(require("./comp3"));
12
12
  exports.comp3 = comp3_1.default;
13
13
  const comp4_1 = __importDefault(require("./comp4"));
14
14
  exports.comp4 = comp4_1.default;
15
+ const comp5_1 = __importDefault(require("./comp5"));
16
+ exports.comp5 = comp5_1.default;
@@ -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
  }
@@ -27,6 +27,9 @@ class FieldsetComponent extends NestedComponent_1.default {
27
27
  schema: FieldsetComponent.schema()
28
28
  };
29
29
  }
30
+ static savedValueTypes() {
31
+ return [];
32
+ }
30
33
  get defaultSchema() {
31
34
  return FieldsetComponent.schema();
32
35
  }
@@ -7,6 +7,27 @@ export default class FileComponent extends Field {
7
7
  weight: number;
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
  support: {
11
32
  filereader: boolean;
12
33
  formdata: boolean;
@@ -54,7 +75,6 @@ export default class FileComponent extends Field {
54
75
  validateMaxSize(file: any, val: any): boolean;
55
76
  upload(files: any): void;
56
77
  filesUploading: any[] | undefined;
57
- abortUpload: any;
58
78
  getFile(fileInfo: any): any;
59
79
  focus(): void;
60
80
  }
@@ -68,7 +68,14 @@ class FileComponent extends Field_1.default {
68
68
  };
69
69
  }
70
70
  static get serverConditionSettings() {
71
- return Object.assign(Object.assign({}, super.serverConditionSettings), { operators: ['isEmpty', 'isNotEmpty'] });
71
+ return FileComponent.conditionOperatorsSettings;
72
+ }
73
+ static get conditionOperatorsSettings() {
74
+ return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: ['isEmpty', 'isNotEmpty'] });
75
+ }
76
+ static savedValueTypes(schema) {
77
+ schema = schema || {};
78
+ return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.object];
72
79
  }
73
80
  init() {
74
81
  super.init();
@@ -354,8 +361,10 @@ class FileComponent extends Field_1.default {
354
361
  this.refs.fileStatusRemove.forEach((fileStatusRemove, index) => {
355
362
  this.addEventListener(fileStatusRemove, 'click', (event) => {
356
363
  event.preventDefault();
357
- if (this.abortUpload) {
358
- this.abortUpload();
364
+ const fileUpload = this.statuses[index];
365
+ lodash_1.default.pull(this.filesUploading, fileUpload.originalName);
366
+ if (fileUpload.abort) {
367
+ fileUpload.abort();
359
368
  }
360
369
  this.statuses.splice(index, 1);
361
370
  this.redraw();
@@ -561,6 +570,7 @@ class FileComponent extends Field_1.default {
561
570
  const fileName = (0, utils_1.uniqueName)(file.name, this.component.fileNameTemplate, this.evalContext());
562
571
  const escapedFileName = file.name ? file.name.replaceAll('<', '&lt;').replaceAll('>', '&gt;') : file.name;
563
572
  const fileUpload = {
573
+ abort: () => null,
564
574
  originalName: escapedFileName,
565
575
  name: fileName,
566
576
  size: file.size,
@@ -680,7 +690,7 @@ class FileComponent extends Field_1.default {
680
690
  }
681
691
  }
682
692
  }
683
- fileUpload.message = this.t('Starting upload.');
693
+ fileUpload.message = this.t('Starting upload...');
684
694
  this.redraw();
685
695
  const filePromise = fileService.uploadFile(storage, processedFile || file, fileName, dir,
686
696
  // Progress callback
@@ -693,9 +703,7 @@ class FileComponent extends Field_1.default {
693
703
  // Upload start callback
694
704
  () => {
695
705
  this.emit('fileUploadingStart', filePromise);
696
- },
697
- // Abort upload callback
698
- (abort) => this.abortUpload = abort).then((fileInfo) => {
706
+ }, (abort) => fileUpload.abort = abort).then((fileInfo) => {
699
707
  const index = this.statuses.indexOf(fileUpload);
700
708
  if (index !== -1) {
701
709
  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;
@@ -33,6 +33,9 @@ class FormComponent extends Component_1.default {
33
33
  schema: FormComponent.schema()
34
34
  };
35
35
  }
36
+ static savedValueTypes() {
37
+ return [utils_1.componentValueTypes.object];
38
+ }
36
39
  init() {
37
40
  super.init();
38
41
  this.formObj = {
@@ -389,7 +392,8 @@ class FormComponent extends Component_1.default {
389
392
  if (this.builderMode || this.isHidden() || (this.isSubFormLazyLoad() && !fromAttach)) {
390
393
  return Promise.resolve();
391
394
  }
392
- if (this.hasLoadedForm && !this.isRevisionChanged) {
395
+ if (this.hasLoadedForm && !this.isRevisionChanged &&
396
+ !(this.options.pdf && this.useOriginalRevision && lodash_1.default.isNull(this.subForm) && !this.subFormLoading)) {
393
397
  // Pass config down to sub forms.
394
398
  if (this.root && this.root.form && this.root.form.config && !this.formObj.config) {
395
399
  this.formObj.config = this.root.form.config;
@@ -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;
@@ -28,6 +28,9 @@ class HTMLComponent extends Component_1.default {
28
28
  schema: HTMLComponent.schema()
29
29
  };
30
30
  }
31
+ static savedValueTypes() {
32
+ return [];
33
+ }
31
34
  get defaultSchema() {
32
35
  return HTMLComponent.schema();
33
36
  }
@@ -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;
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const text_mask_addons_1 = require("@formio/text-mask-addons");
7
7
  const vanilla_text_mask_1 = require("@formio/vanilla-text-mask");
8
8
  const lodash_1 = __importDefault(require("lodash"));
9
- const utils_1 = require("../../utils/utils");
10
9
  const Input_1 = __importDefault(require("../_classes/input/Input"));
10
+ const utils_1 = require("../../utils/utils");
11
11
  class NumberComponent extends Input_1.default {
12
12
  static schema(...extend) {
13
13
  return Input_1.default.schema({
@@ -33,21 +33,16 @@ class NumberComponent extends Input_1.default {
33
33
  };
34
34
  }
35
35
  static get serverConditionSettings() {
36
- return {
37
- operators: [
38
- 'isEqual',
39
- 'isNotEqual',
40
- 'isEmpty',
41
- 'isNotEmpty',
42
- 'greaterThan',
43
- 'greaterThanOrEqual',
44
- 'lessThan',
45
- 'lessThanOrEqual',
46
- ],
47
- valueComponent(classComp) {
36
+ return NumberComponent.conditionOperatorsSettings;
37
+ }
38
+ static get conditionOperatorsSettings() {
39
+ return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: [...super.conditionOperatorsSettings.operators, 'lessThan', 'greaterThan', 'lessThanOrEqual', 'greaterThanOrEqual'], valueComponent(classComp) {
48
40
  return Object.assign(Object.assign({}, classComp), { type: 'number' });
49
- },
50
- };
41
+ } });
42
+ }
43
+ static savedValueTypes(schema) {
44
+ schema = schema || {};
45
+ return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.number];
51
46
  }
52
47
  constructor(...args) {
53
48
  var _a, _b;
@@ -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;
@@ -38,6 +38,9 @@ class PanelComponent extends NestedComponent_1.default {
38
38
  get templateName() {
39
39
  return 'panel';
40
40
  }
41
+ static savedValueTypes() {
42
+ return [];
43
+ }
41
44
  constructor(...args) {
42
45
  super(...args);
43
46
  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(): {
@@ -31,6 +31,36 @@ class RadioComponent extends ListComponent_1.default {
31
31
  schema: RadioComponent.schema()
32
32
  };
33
33
  }
34
+ static get conditionOperatorsSettings() {
35
+ return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { valueComponent(classComp) {
36
+ return {
37
+ type: 'select',
38
+ dataSrc: 'custom',
39
+ valueProperty: 'value',
40
+ dataType: classComp.dataType || '',
41
+ data: {
42
+ custom() {
43
+ return classComp.values;
44
+ }
45
+ },
46
+ };
47
+ } });
48
+ }
49
+ static savedValueTypes(schema) {
50
+ const { boolean, string, number, object, array } = utils_1.componentValueTypes;
51
+ const { dataType } = schema;
52
+ const types = (0, utils_1.getComponentSavedTypes)(schema);
53
+ if (types) {
54
+ return types;
55
+ }
56
+ if (dataType === 'object') {
57
+ return [object, array];
58
+ }
59
+ if (utils_1.componentValueTypes[dataType]) {
60
+ return [utils_1.componentValueTypes[dataType]];
61
+ }
62
+ return [boolean, string, number, object, array];
63
+ }
34
64
  constructor(component, options, data) {
35
65
  super(component, options, data);
36
66
  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;
@@ -26,6 +26,9 @@ class ReCaptchaComponent extends Component_1.default {
26
26
  schema: ReCaptchaComponent.schema()
27
27
  };
28
28
  }
29
+ static savedValueTypes() {
30
+ return [];
31
+ }
29
32
  render() {
30
33
  this.recaptchaResult = null;
31
34
  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;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const lodash_1 = __importDefault(require("lodash"));
7
7
  const Formio_1 = require("../../Formio");
8
8
  const ListComponent_1 = __importDefault(require("../_classes/list/ListComponent"));
9
+ const Input_1 = __importDefault(require("../_classes/input/Input"));
9
10
  const Form_1 = __importDefault(require("../../Form"));
10
11
  const utils_1 = require("../../utils/utils");
11
12
  const ChoicesWrapper_1 = __importDefault(require("../../utils/ChoicesWrapper"));
@@ -59,10 +60,31 @@ class SelectComponent extends ListComponent_1.default {
59
60
  };
60
61
  }
61
62
  static get serverConditionSettings() {
62
- return Object.assign(Object.assign({}, super.serverConditionSettings), { valueComponent(classComp) {
63
+ return SelectComponent.conditionOperatorsSettings;
64
+ }
65
+ static get conditionOperatorsSettings() {
66
+ return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { valueComponent(classComp) {
63
67
  return Object.assign(Object.assign({}, classComp), { type: 'select' });
64
68
  } });
65
69
  }
70
+ static savedValueTypes(schema) {
71
+ const { boolean, string, number, object, array } = utils_1.componentValueTypes;
72
+ const { dataType, reference } = schema;
73
+ const types = (0, utils_1.getComponentSavedTypes)(schema);
74
+ if (types) {
75
+ return types;
76
+ }
77
+ if (reference) {
78
+ return [object];
79
+ }
80
+ if (dataType === 'object') {
81
+ return [object, array];
82
+ }
83
+ if (utils_1.componentValueTypes[dataType]) {
84
+ return [utils_1.componentValueTypes[dataType]];
85
+ }
86
+ return [boolean, string, number, object, array];
87
+ }
66
88
  init() {
67
89
  super.init();
68
90
  this.templateData = {};
@@ -174,6 +196,15 @@ class SelectComponent extends ListComponent_1.default {
174
196
  get shouldDisabled() {
175
197
  return super.shouldDisabled || this.parentDisabled;
176
198
  }
199
+ get shouldInitialLoad() {
200
+ if (this.component.widget === 'html5' &&
201
+ this.isEntireObjectDisplay() &&
202
+ this.component.searchField &&
203
+ this.dataValue) {
204
+ return false;
205
+ }
206
+ return super.shouldLoad;
207
+ }
177
208
  isEntireObjectDisplay() {
178
209
  return this.component.dataSrc === 'resource' && this.valueProperty === 'data';
179
210
  }
@@ -482,7 +513,11 @@ class SelectComponent extends ListComponent_1.default {
482
513
  });
483
514
  // Add search capability.
484
515
  if (this.component.searchField && search) {
485
- const searchValue = Array.isArray(search) ? search.join(',') : search;
516
+ const searchValue = Array.isArray(search)
517
+ ? search.join(',')
518
+ : typeof search === 'object'
519
+ ? JSON.stringify(search)
520
+ : search;
486
521
  query[this.component.searchField] = this.component.searchField.endsWith('__regex')
487
522
  ? lodash_1.default.escapeRegExp(searchValue)
488
523
  : searchValue;
@@ -774,7 +809,7 @@ class SelectComponent extends ListComponent_1.default {
774
809
  this.choices.containerOuter.element.setAttribute('tabIndex', '-1');
775
810
  this.addEventListener(this.choices.containerOuter.element, 'focus', () => this.focusableElement.focus());
776
811
  }
777
- this.addFocusBlurEvents(this.focusableElement);
812
+ Input_1.default.prototype.addFocusBlurEvents.call(this, this.focusableElement);
778
813
  if (this.itemsFromUrl && !this.component.noRefreshOnScroll) {
779
814
  this.scrollList = this.choices.choiceList.element;
780
815
  this.addEventListener(this.scrollList, 'scroll', () => this.onScroll());
@@ -1167,7 +1202,7 @@ class SelectComponent extends ListComponent_1.default {
1167
1202
  !this.active &&
1168
1203
  !this.selectOptions.length &&
1169
1204
  hasValue &&
1170
- this.shouldLoad &&
1205
+ this.shouldInitialLoad &&
1171
1206
  this.visible && (this.component.searchField || this.component.valueProperty);
1172
1207
  }
1173
1208
  setChoicesValue(value, hasPreviousValue, flags = {}) {
@@ -0,0 +1,23 @@
1
+ declare namespace _default {
2
+ const type: string;
3
+ const display: string;
4
+ const components: {
5
+ label: string;
6
+ widget: string;
7
+ tableView: boolean;
8
+ data: {
9
+ values: {
10
+ label: string;
11
+ value: string;
12
+ }[];
13
+ };
14
+ validateOn: string;
15
+ validate: {
16
+ custom: string;
17
+ };
18
+ key: string;
19
+ type: string;
20
+ input: boolean;
21
+ }[];
22
+ }
23
+ export default _default;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ type: 'form',
5
+ display: 'form',
6
+ components: [
7
+ {
8
+ label: 'Select',
9
+ widget: 'choicesjs',
10
+ tableView: true,
11
+ data: {
12
+ values: [
13
+ {
14
+ label: 'Banana',
15
+ value: 'banana'
16
+ },
17
+ {
18
+ label: 'Apple',
19
+ value: 'apple'
20
+ },
21
+ {
22
+ label: 'Pineapple',
23
+ value: 'pineapple'
24
+ }
25
+ ]
26
+ },
27
+ validateOn: 'blur',
28
+ validate: {
29
+ custom: "valid = data.select == 'apple' ? true : 'You must select an apple';"
30
+ },
31
+ key: 'select',
32
+ type: 'select',
33
+ input: true
34
+ },
35
+ ]
36
+ };
@@ -15,5 +15,6 @@ import comp15 from './comp15';
15
15
  import comp16 from './comp16';
16
16
  import comp17 from './comp17';
17
17
  import comp18 from './comp18';
18
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18 };
18
+ import comp19 from './comp19';
19
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19 };
19
20
  export { multiSelect, multiSelectOptions } from "./comp3";
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.comp18 = exports.comp17 = exports.comp16 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp2 = exports.comp1 = exports.multiSelectOptions = exports.multiSelect = void 0;
6
+ exports.comp19 = exports.comp18 = exports.comp17 = exports.comp16 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp2 = exports.comp1 = exports.multiSelectOptions = exports.multiSelect = void 0;
7
7
  const comp1_1 = __importDefault(require("./comp1"));
8
8
  exports.comp1 = comp1_1.default;
9
9
  const comp2_1 = __importDefault(require("./comp2"));
@@ -41,3 +41,5 @@ const comp17_1 = __importDefault(require("./comp17"));
41
41
  exports.comp17 = comp17_1.default;
42
42
  const comp18_1 = __importDefault(require("./comp18"));
43
43
  exports.comp18 = comp18_1.default;
44
+ const comp19_1 = __importDefault(require("./comp19"));
45
+ exports.comp19 = comp19_1.default;
@@ -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;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const lodash_1 = __importDefault(require("lodash"));
7
+ const utils_1 = require("../../utils/utils");
7
8
  const Radio_1 = __importDefault(require("../radio/Radio"));
8
9
  class SelectBoxesComponent extends Radio_1.default {
9
10
  static schema(...extend) {
@@ -25,7 +26,10 @@ class SelectBoxesComponent extends Radio_1.default {
25
26
  };
26
27
  }
27
28
  static get serverConditionSettings() {
28
- return Object.assign(Object.assign({}, super.serverConditionSettings), { valueComponent(classComp) {
29
+ return SelectBoxesComponent.conditionOperatorsSettings;
30
+ }
31
+ static get conditionOperatorsSettings() {
32
+ return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { valueComponent(classComp) {
29
33
  return {
30
34
  type: 'select',
31
35
  dataSrc: 'custom',
@@ -37,6 +41,9 @@ class SelectBoxesComponent extends Radio_1.default {
37
41
  };
38
42
  } });
39
43
  }
44
+ static savedValueTypes(schema) {
45
+ return (0, utils_1.getComponentSavedTypes)(schema) || [utils_1.componentValueTypes.object];
46
+ }
40
47
  constructor(...args) {
41
48
  super(...args);
42
49
  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;