@formio/js 5.0.0-rc.75 → 5.0.0-rc.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/formio.embed.js +1 -1
  2. package/dist/formio.embed.min.js +1 -1
  3. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  4. package/dist/formio.form.js +19 -19
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  7. package/dist/formio.full.js +21 -21
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  10. package/dist/formio.js +2 -2
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +1 -1
  13. package/dist/formio.utils.js +4 -4
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  16. package/lib/cjs/PDFBuilder.js +2 -1
  17. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  18. package/lib/cjs/components/_classes/multivalue/Multivalue.js +43 -25
  19. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  20. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +6 -0
  21. package/lib/cjs/components/address/Address.d.ts +6 -0
  22. package/lib/cjs/components/address/Address.js +7 -1
  23. package/lib/cjs/components/datagrid/DataGrid.js +1 -0
  24. package/lib/cjs/components/datagrid/fixtures/comp11.d.ts +50 -0
  25. package/lib/cjs/components/datagrid/fixtures/comp11.js +55 -0
  26. package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
  27. package/lib/cjs/components/datagrid/fixtures/index.js +5 -1
  28. package/lib/cjs/components/day/Day.d.ts +1 -1
  29. package/lib/cjs/components/day/Day.js +28 -7
  30. package/lib/cjs/components/editgrid/EditGrid.js +1 -0
  31. package/lib/cjs/components/file/File.d.ts +1 -1
  32. package/lib/cjs/components/file/File.js +3 -1
  33. package/lib/cjs/components/file/editForm/File.edit.display.js +1 -1
  34. package/lib/cjs/components/radio/Radio.d.ts +2 -18
  35. package/lib/cjs/components/radio/Radio.js +12 -21
  36. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +6 -0
  37. package/lib/cjs/components/recaptcha/ReCaptcha.js +6 -0
  38. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +0 -22
  39. package/lib/cjs/components/selectboxes/SelectBoxes.js +12 -9
  40. package/lib/cjs/components/tags/Tags.js +3 -3
  41. package/lib/cjs/components/time/Time.js +0 -5
  42. package/lib/mjs/PDFBuilder.js +1 -1
  43. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  44. package/lib/mjs/components/_classes/multivalue/Multivalue.js +43 -25
  45. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  46. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +6 -0
  47. package/lib/mjs/components/address/Address.d.ts +6 -0
  48. package/lib/mjs/components/address/Address.js +10 -1
  49. package/lib/mjs/components/datagrid/DataGrid.js +1 -0
  50. package/lib/mjs/components/datagrid/fixtures/comp11.d.ts +50 -0
  51. package/lib/mjs/components/datagrid/fixtures/comp11.js +53 -0
  52. package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
  53. package/lib/mjs/components/datagrid/fixtures/index.js +3 -1
  54. package/lib/mjs/components/day/Day.d.ts +1 -1
  55. package/lib/mjs/components/day/Day.js +27 -7
  56. package/lib/mjs/components/editgrid/EditGrid.js +1 -0
  57. package/lib/mjs/components/file/File.d.ts +1 -1
  58. package/lib/mjs/components/file/File.js +3 -1
  59. package/lib/mjs/components/file/editForm/File.edit.display.js +1 -1
  60. package/lib/mjs/components/radio/Radio.d.ts +2 -18
  61. package/lib/mjs/components/radio/Radio.js +15 -24
  62. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +6 -0
  63. package/lib/mjs/components/recaptcha/ReCaptcha.js +9 -0
  64. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +0 -22
  65. package/lib/mjs/components/selectboxes/SelectBoxes.js +16 -9
  66. package/lib/mjs/components/tags/Tags.js +3 -3
  67. package/lib/mjs/components/time/Time.js +0 -11
  68. package/package.json +2 -2
@@ -1,6 +1,5 @@
1
1
  export default class Multivalue extends Field {
2
2
  get addAnother(): string;
3
- useWrapper(): any;
4
3
  /**
5
4
  * @returns {Field} - The created field.
6
5
  */
@@ -1,12 +1,40 @@
1
1
  import Field from '../field/Field';
2
2
  import _ from 'lodash';
3
3
  export default class Multivalue extends Field {
4
- get dataValue() {
5
- const parent = super.dataValue;
6
- if (!parent && this.component.multiple) {
7
- return [];
4
+ /**
5
+ * Normalize values coming into updateValue.
6
+ * @param {*} value - The value to normalize before setting.
7
+ * @returns {*} - The normalized value.
8
+ */
9
+ normalizeValue(value) {
10
+ if (this.component.multiple) {
11
+ if (Array.isArray(value)) {
12
+ if (value.length === 0) {
13
+ return [this.emptyValue];
14
+ }
15
+ if (this.component.storeas === 'array') {
16
+ return super.normalizeValue([value]);
17
+ }
18
+ return super.normalizeValue(value);
19
+ }
20
+ else {
21
+ return super.normalizeValue(value == null ? [this.emptyValue] : [value]);
22
+ }
23
+ }
24
+ else {
25
+ if (Array.isArray(value) && this.component.storeas !== 'array') {
26
+ if (this.component.storeas === 'string') {
27
+ return super.normalizeValue(value.join(this.delimiter || ''));
28
+ }
29
+ return super.normalizeValue(value[0] || this.emptyValue);
30
+ }
31
+ else {
32
+ return super.normalizeValue(value);
33
+ }
8
34
  }
9
- return parent;
35
+ }
36
+ get dataValue() {
37
+ return super.dataValue;
10
38
  }
11
39
  set dataValue(value) {
12
40
  super.dataValue = value;
@@ -26,30 +54,20 @@ export default class Multivalue extends Field {
26
54
  get addAnother() {
27
55
  return this.t(this.component.addAnother || 'Add Another');
28
56
  }
29
- useWrapper() {
30
- return this.component.hasOwnProperty('multiple') && this.component.multiple;
31
- }
32
57
  /**
33
58
  * @returns {Field} - The created field.
34
59
  */
35
60
  render() {
36
- // If single value field.
37
- if (!this.useWrapper()) {
38
- return super.render(`<div ${this._referenceAttributeName}="element">
39
- ${this.renderElement(this.component.type !== 'hidden' ? this.dataValue : '')}
40
- </div>`);
41
- }
42
- // Make sure dataValue is in the correct array format.
43
- let dataValue = this.dataValue;
44
- if (!Array.isArray(dataValue)) {
45
- dataValue = dataValue ? [dataValue] : [];
46
- }
47
- // If multiple value field.
48
- return super.render(this.renderTemplate('multiValueTable', {
49
- rows: dataValue.map(this.renderRow.bind(this)).join(''),
50
- disabled: this.disabled,
51
- addAnother: this.addAnother,
52
- }));
61
+ let dataValue = this.normalizeValue(this.dataValue);
62
+ return this.component.hasOwnProperty('multiple') && this.component.multiple
63
+ ? super.render(this.renderTemplate('multiValueTable', {
64
+ rows: dataValue.map(this.renderRow.bind(this)).join(''),
65
+ disabled: this.disabled,
66
+ addAnother: this.addAnother,
67
+ }))
68
+ : super.render(`<div ${this._referenceAttributeName}="element">
69
+ ${this.renderElement(this.component.type !== 'hidden' ? dataValue : '')}
70
+ </div>`);
53
71
  }
54
72
  renderElement() {
55
73
  return '';
@@ -13,5 +13,6 @@ export default class NestedArrayComponent extends NestedDataComponent {
13
13
  getComponent(path: any, fn: any, originalPath: any): any;
14
14
  everyComponent(fn: any, rowIndex: any, options?: {}): void;
15
15
  getComponents(rowIndex: any): any;
16
+ removeSubmissionMetadataRow(index: any): void;
16
17
  }
17
18
  import NestedDataComponent from '../nesteddata/NestedDataComponent';
@@ -192,4 +192,10 @@ export default class NestedArrayComponent extends NestedDataComponent {
192
192
  }
193
193
  return super.getComponents();
194
194
  }
195
+ removeSubmissionMetadataRow(index) {
196
+ const componentMetadata = _.get(this.root, `submission.metadata.selectData.${this.path}`, null);
197
+ if (_.isArray(componentMetadata)) {
198
+ componentMetadata.splice(index, 1);
199
+ }
200
+ }
195
201
  }
@@ -11,6 +11,12 @@ export default class AddressComponent extends ContainerComponent {
11
11
  weight: number;
12
12
  schema: any;
13
13
  };
14
+ static get serverConditionSettings(): {
15
+ operators: string[];
16
+ };
17
+ static get conditionOperatorsSettings(): {
18
+ operators: string[];
19
+ };
14
20
  static get modeSwitcherRef(): string;
15
21
  static get removeValueIconRef(): string;
16
22
  static get searchInputRef(): string;
@@ -91,6 +91,15 @@ export default class AddressComponent extends ContainerComponent {
91
91
  schema: AddressComponent.schema(),
92
92
  };
93
93
  }
94
+ static get serverConditionSettings() {
95
+ return AddressComponent.conditionOperatorsSettings;
96
+ }
97
+ static get conditionOperatorsSettings() {
98
+ return {
99
+ ...super.conditionOperatorsSettings,
100
+ operators: ['isEmpty', 'isNotEmpty'],
101
+ };
102
+ }
94
103
  mergeSchema(component = {}) {
95
104
  let { defaultSchema } = this;
96
105
  if (component.components) {
@@ -181,7 +190,7 @@ export default class AddressComponent extends ContainerComponent {
181
190
  return (this.manualModeEnabled && this.dataValue) ? this.dataValue.address : this.dataValue;
182
191
  }
183
192
  set address(value) {
184
- if (this.manualModeEnabled && !this.isMultiple) {
193
+ if (this.manualModeEnabled && !this.isMultiple && !_.isEqual(value, this.emptyValue)) {
185
194
  this.dataValue.address = value;
186
195
  }
187
196
  else {
@@ -421,6 +421,7 @@ export default class DataGridComponent extends NestedArrayComponent {
421
421
  this.splice(index, flags);
422
422
  this.emit('dataGridDeleteRow', { index });
423
423
  const [row] = this.rows.splice(index, 1);
424
+ this.removeSubmissionMetadataRow(index);
424
425
  this.removeRowComponents(row);
425
426
  this.updateRowsComponents(index);
426
427
  this.setValue(this.dataValue, flags);
@@ -0,0 +1,50 @@
1
+ declare namespace _default {
2
+ let title: string;
3
+ let name: string;
4
+ let path: string;
5
+ let type: string;
6
+ let display: string;
7
+ let components: ({
8
+ label: string;
9
+ reorder: boolean;
10
+ addAnotherPosition: string;
11
+ layoutFixed: boolean;
12
+ enableRowGroups: boolean;
13
+ initEmpty: boolean;
14
+ tableView: boolean;
15
+ key: string;
16
+ type: string;
17
+ input: boolean;
18
+ components: {
19
+ label: string;
20
+ widget: string;
21
+ tableView: boolean;
22
+ data: {
23
+ values: {
24
+ label: string;
25
+ value: string;
26
+ }[];
27
+ };
28
+ validateWhenHidden: boolean;
29
+ key: string;
30
+ type: string;
31
+ input: boolean;
32
+ defaultValue: string;
33
+ }[];
34
+ disableOnInvalid?: undefined;
35
+ } | {
36
+ type: string;
37
+ label: string;
38
+ key: string;
39
+ disableOnInvalid: boolean;
40
+ input: boolean;
41
+ tableView: boolean;
42
+ reorder?: undefined;
43
+ addAnotherPosition?: undefined;
44
+ layoutFixed?: undefined;
45
+ enableRowGroups?: undefined;
46
+ initEmpty?: undefined;
47
+ components?: undefined;
48
+ })[];
49
+ }
50
+ export default _default;
@@ -0,0 +1,53 @@
1
+ export default {
2
+ title: 'Select in Data Grid',
3
+ name: 'selectInDataGrid',
4
+ path: 'selectInDataGrid',
5
+ type: 'form',
6
+ display: 'form',
7
+ components: [
8
+ {
9
+ label: 'Data Grid',
10
+ reorder: false,
11
+ addAnotherPosition: 'bottom',
12
+ layoutFixed: false,
13
+ enableRowGroups: false,
14
+ initEmpty: false,
15
+ tableView: false,
16
+ key: 'dataGrid',
17
+ type: 'datagrid',
18
+ input: true,
19
+ components: [
20
+ {
21
+ label: 'Select',
22
+ widget: 'choicesjs',
23
+ tableView: true,
24
+ data: {
25
+ values: [
26
+ {
27
+ label: 'Individual',
28
+ value: 'individual'
29
+ },
30
+ {
31
+ label: 'Entity',
32
+ value: 'entity'
33
+ }
34
+ ]
35
+ },
36
+ validateWhenHidden: false,
37
+ key: 'select',
38
+ type: 'select',
39
+ input: true,
40
+ defaultValue: 'entity'
41
+ },
42
+ ]
43
+ },
44
+ {
45
+ type: 'button',
46
+ label: 'Submit',
47
+ key: 'submit',
48
+ disableOnInvalid: true,
49
+ input: true,
50
+ tableView: false
51
+ }
52
+ ]
53
+ };
@@ -7,6 +7,7 @@ import comp6 from './comp6';
7
7
  import comp7 from './comp7';
8
8
  import comp8 from './comp8';
9
9
  import comp9 from './comp9';
10
+ import comp11 from './comp11';
10
11
  import withCollapsibleRowGroups from './comp-with-collapsible-groups';
11
12
  import withConditionalFieldsAndValidations from './comp-with-conditional-components-and-validations';
12
13
  import withDefValue from './comp-with-def-value';
@@ -17,4 +18,4 @@ import withAllowCalculateOverride from './comp-with-allow-calculate-override';
17
18
  import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
18
19
  import withCheckboxes from './comp-with-checkboxes';
19
20
  import withReorder from './comp-with-reorder';
20
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
21
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
@@ -7,6 +7,8 @@ import comp6 from './comp6';
7
7
  import comp7 from './comp7';
8
8
  import comp8 from './comp8';
9
9
  import comp9 from './comp9';
10
+ import comp10 from './comp10';
11
+ import comp11 from './comp11';
10
12
  import withDefValue from './comp-with-def-value';
11
13
  import withRowGroupsAndDefValue from './comp-row-groups-with-def-value';
12
14
  import modalWithRequiredFields from './comp-modal-with-required-fields';
@@ -17,4 +19,4 @@ import withAllowCalculateOverride from './comp-with-allow-calculate-override';
17
19
  import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
18
20
  import withCheckboxes from './comp-with-checkboxes';
19
21
  import withReorder from './comp-with-reorder';
20
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
22
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
@@ -132,6 +132,6 @@ export default class DayComponent extends Field {
132
132
  getValueAsString(value: any): string | null;
133
133
  focus(field: any): void;
134
134
  isPartialDay(value: any): boolean;
135
- getValidationFormat(): "DD-MM-YYYY" | "MM-DD-YYYY";
135
+ getValidationFormat(): string;
136
136
  }
137
137
  import Field from '../_classes/field/Field';
@@ -25,7 +25,8 @@ export default class DayComponent extends Field {
25
25
  required: false
26
26
  }
27
27
  },
28
- dayFirst: false
28
+ dayFirst: false,
29
+ defaultValue: ''
29
30
  }, ...extend);
30
31
  }
31
32
  static get builderInfo() {
@@ -341,15 +342,21 @@ export default class DayComponent extends Field {
341
342
  const valueParts = value.split('/');
342
343
  const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
343
344
  const defaultValue = this.component.defaultValue ? this.component.defaultValue.split('/') : '';
344
- const getNextPart = (shouldTake, defaultValue) => dateParts.push(shouldTake ? valueParts.shift() : defaultValue);
345
+ const getNextPart = (shouldTake, defaultValue) => {
346
+ // Only push the part if it's not an empty string
347
+ const part = shouldTake ? valueParts.shift() : defaultValue;
348
+ if (part !== '') {
349
+ dateParts.push(part);
350
+ }
351
+ };
345
352
  if (this.dayFirst) {
346
- getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '00');
353
+ getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '');
347
354
  }
348
- getNextPart(this.showMonth, defaultValue ? defaultValue[MONTH] : '00');
355
+ getNextPart(this.showMonth, defaultValue ? defaultValue[MONTH] : '');
349
356
  if (!this.dayFirst) {
350
- getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '00');
357
+ getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '');
351
358
  }
352
- getNextPart(this.showYear, defaultValue ? defaultValue[YEAR] : '0000');
359
+ getNextPart(this.showYear, defaultValue ? defaultValue[YEAR] : '');
353
360
  return dateParts.join('/');
354
361
  }
355
362
  /**
@@ -554,9 +561,22 @@ export default class DayComponent extends Field {
554
561
  }
555
562
  const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
556
563
  const values = value.split('/');
564
+ if (values.length < 3) {
565
+ return true;
566
+ }
557
567
  return (values[DAY] === '00' || values[MONTH] === '00' || values[YEAR] === '0000');
558
568
  }
559
569
  getValidationFormat() {
560
- return this.dayFirst ? 'DD-MM-YYYY' : 'MM-DD-YYYY';
570
+ let validationFormat = this.dayFirst ? 'DD-MM-YYYY' : 'MM-DD-YYYY';
571
+ if (this.fields?.day?.hide) {
572
+ validationFormat = validationFormat.replace('DD-', '');
573
+ }
574
+ if (this.fields?.month?.hide) {
575
+ validationFormat = validationFormat.replace('MM-', '');
576
+ }
577
+ if (this.fields?.year?.hide) {
578
+ validationFormat = validationFormat.replace('-YYYY', '');
579
+ }
580
+ return validationFormat;
561
581
  }
562
582
  }
@@ -875,6 +875,7 @@ export default class EditGridComponent extends NestedArrayComponent {
875
875
  }
876
876
  this.clearErrors(rowIndex);
877
877
  this.baseRemoveRow(rowIndex);
878
+ this.removeSubmissionMetadataRow(rowIndex);
878
879
  this.splice(rowIndex);
879
880
  this.emit('editGridDeleteRow', {
880
881
  index: rowIndex
@@ -38,7 +38,7 @@ export default class FileComponent extends Field {
38
38
  get hasTypes(): any;
39
39
  _fileBrowseHidden: any;
40
40
  get shouldSyncFiles(): boolean;
41
- get autoSync(): any;
41
+ get autoSync(): boolean;
42
42
  get columnsSize(): {
43
43
  name: number;
44
44
  size: number;
@@ -135,7 +135,9 @@ export default class FileComponent extends Field {
135
135
  return Boolean(this.filesToSync.filesToDelete.length || this.filesToSync.filesToUpload.length);
136
136
  }
137
137
  get autoSync() {
138
- return _.get(this, 'component.autoSync', false);
138
+ // Disable autoSync for now
139
+ return false;
140
+ // return _.get(this, 'component.autoSync', false);
139
141
  }
140
142
  get columnsSize() {
141
143
  const actionsColumn = this.disabled ? 0 : this.autoSync ? 2 : 1;
@@ -4,7 +4,7 @@ export default [
4
4
  ignore: true
5
5
  },
6
6
  {
7
- type: 'checkbox',
7
+ type: 'hidden',
8
8
  label: 'Files Synchronization feature',
9
9
  tooltip: 'Enable ability to control files synchronization. Files will be auto synced before submit.',
10
10
  key: 'autoSync',
@@ -8,26 +8,10 @@ export default class RadioComponent extends ListComponent {
8
8
  schema: any;
9
9
  };
10
10
  static get conditionOperatorsSettings(): {
11
- valueComponent(classComp: any): {
12
- type: string;
13
- dataSrc: string;
14
- valueProperty: string;
15
- dataType: any;
16
- data: {
17
- custom(): any;
18
- };
19
- };
11
+ valueComponent(classComp: any): any;
20
12
  };
21
13
  static get serverConditionSettings(): {
22
- valueComponent(classComp: any): {
23
- type: string;
24
- dataSrc: string;
25
- valueProperty: string;
26
- dataType: any;
27
- data: {
28
- custom: string;
29
- };
30
- };
14
+ valueComponent(classComp: any): any;
31
15
  };
32
16
  static savedValueTypes(schema: any): any[];
33
17
  constructor(component: any, options: any, data: any);
@@ -30,35 +30,26 @@ export default class RadioComponent extends ListComponent {
30
30
  return {
31
31
  ...super.conditionOperatorsSettings,
32
32
  valueComponent(classComp) {
33
- return {
34
- type: 'select',
35
- dataSrc: 'custom',
36
- valueProperty: 'value',
37
- dataType: classComp.dataType || '',
38
- data: {
39
- custom() {
40
- return classComp.values;
33
+ const isValuesSrc = !classComp.dataSrc || classComp.dataSrc === 'values';
34
+ return isValuesSrc
35
+ ? {
36
+ type: 'select',
37
+ dataSrc: 'custom',
38
+ valueProperty: 'value',
39
+ dataType: classComp.dataType || '',
40
+ data: {
41
+ custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`,
41
42
  }
42
- },
43
- };
43
+ }
44
+ : {
45
+ ...classComp,
46
+ type: 'select',
47
+ };
44
48
  }
45
49
  };
46
50
  }
47
51
  static get serverConditionSettings() {
48
- return {
49
- ...super.serverConditionSettings,
50
- valueComponent(classComp) {
51
- return {
52
- type: 'select',
53
- dataSrc: 'custom',
54
- valueProperty: 'value',
55
- dataType: classComp.dataType || '',
56
- data: {
57
- custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`,
58
- },
59
- };
60
- },
61
- };
52
+ return RadioComponent.conditionOperatorsSettings;
62
53
  }
63
54
  static savedValueTypes(schema) {
64
55
  const { boolean, string, number, object, array } = componentValueTypes;
@@ -1,6 +1,12 @@
1
1
  export default class ReCaptchaComponent extends Component {
2
2
  static get builderInfo(): {};
3
3
  static savedValueTypes(): never[];
4
+ static get conditionOperatorsSettings(): {
5
+ operators: string[];
6
+ };
7
+ static get serverConditionSettings(): {
8
+ operators: string[];
9
+ };
4
10
  render(): string;
5
11
  recaptchaResult: any;
6
12
  createInput(): void;
@@ -17,6 +17,15 @@ export default class ReCaptchaComponent extends Component {
17
17
  static savedValueTypes() {
18
18
  return [];
19
19
  }
20
+ static get conditionOperatorsSettings() {
21
+ return {
22
+ ...super.conditionOperatorsSettings,
23
+ operators: ['isEmpty', 'isNotEmpty'],
24
+ };
25
+ }
26
+ static get serverConditionSettings() {
27
+ return ReCaptchaComponent.conditionOperatorsSettings;
28
+ }
20
29
  render() {
21
30
  this.recaptchaResult = null;
22
31
  if (this.builderMode) {
@@ -1,26 +1,4 @@
1
1
  export default class SelectBoxesComponent extends RadioComponent {
2
- static get serverConditionSettings(): {
3
- valueComponent(classComp: any): {
4
- type: string;
5
- dataSrc: string;
6
- valueProperty: string;
7
- dataType: string;
8
- data: {
9
- custom: string;
10
- };
11
- };
12
- };
13
- static get conditionOperatorsSettings(): {
14
- valueComponent(classComp: any): {
15
- type: string;
16
- dataSrc: string;
17
- valueProperty: string;
18
- dataType: string;
19
- data: {
20
- custom: string;
21
- };
22
- };
23
- };
24
2
  static savedValueTypes(schema: any): string[];
25
3
  constructor(...args: any[]);
26
4
  get emptyValue(): any;
@@ -27,15 +27,22 @@ export default class SelectBoxesComponent extends RadioComponent {
27
27
  return {
28
28
  ...super.conditionOperatorsSettings,
29
29
  valueComponent(classComp) {
30
- return {
31
- type: 'select',
32
- dataSrc: 'custom',
33
- valueProperty: 'value',
34
- dataType: 'string',
35
- data: {
36
- custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`
37
- },
38
- };
30
+ const isValuesSrc = !classComp.dataSrc || classComp.dataSrc === 'values';
31
+ return isValuesSrc
32
+ ? {
33
+ type: 'select',
34
+ dataSrc: 'custom',
35
+ valueProperty: 'value',
36
+ dataType: 'string',
37
+ data: {
38
+ custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`
39
+ },
40
+ }
41
+ : {
42
+ ...classComp,
43
+ dataType: 'string',
44
+ type: 'select',
45
+ };
39
46
  }
40
47
  };
41
48
  }
@@ -116,12 +116,12 @@ export default class TagsComponent extends Input {
116
116
  }
117
117
  normalizeValue(value) {
118
118
  if (this.component.storeas === 'string' && Array.isArray(value)) {
119
- return value.join(this.delimiter);
119
+ return super.normalizeValue(value.join(this.delimiter));
120
120
  }
121
121
  else if (this.component.storeas === 'array' && typeof value === 'string') {
122
- return value.split(this.delimiter).filter(result => result);
122
+ return super.normalizeValue(value.split(this.delimiter).filter(result => result));
123
123
  }
124
- return value;
124
+ return super.normalizeValue(value);
125
125
  }
126
126
  setValue(value, flags = {}) {
127
127
  const changed = super.setValue(value, flags);
@@ -13,17 +13,6 @@ export default class TimeComponent extends TextFieldComponent {
13
13
  dataFormat: defaultDataFormat,
14
14
  }, ...extend);
15
15
  }
16
- static get serverConditionSettings() {
17
- return {
18
- ...super.serverConditionSettings,
19
- valueComponent(classComp) {
20
- return {
21
- ...classComp,
22
- type: 'time',
23
- };
24
- },
25
- };
26
- }
27
16
  constructor(component, options, data) {
28
17
  super(component, options, data);
29
18
  const { edge: isEdgeBrowser, version: edgeVersion } = getBrowserInfo();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.75",
3
+ "version": "5.0.0-rc.77",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -81,7 +81,7 @@
81
81
  "dependencies": {
82
82
  "@formio/bootstrap": "3.0.0-rc.37",
83
83
  "@formio/choices.js": "^10.2.1",
84
- "@formio/core": "2.2.2-rc.3",
84
+ "@formio/core": "2.2.2",
85
85
  "@formio/text-mask-addons": "^3.8.0-formio.2",
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
87
87
  "abortcontroller-polyfill": "^1.7.5",