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

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.1.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.5/LICENSE */
22
22
 
23
- /*! formiojs v5.0.0-rc.75 | https://unpkg.com/formiojs@5.0.0-rc.75/LICENSE.txt */
23
+ /*! formiojs v5.0.0-rc.77 | https://unpkg.com/formiojs@5.0.0-rc.77/LICENSE.txt */
24
24
 
25
25
  /**
26
26
  * @license
@@ -403,6 +403,7 @@ class PDFBuilder extends WebformBuilder_1.default {
403
403
  return false;
404
404
  }
405
405
  onDragEnd(e) {
406
+ var _a;
406
407
  // IMPORTANT - must retrieve offsets BEFORE disabling the dropzone - offsets will
407
408
  // reflect absolute positioning if accessed after the target element is hidden
408
409
  const iframeRect = this.webform.refs.iframeContainer.getBoundingClientRect();
@@ -435,7 +436,7 @@ class PDFBuilder extends WebformBuilder_1.default {
435
436
  lodash_1.default.merge(schema, info);
436
437
  }
437
438
  // Set a unique key for this component.
438
- builder_1.default.uniquify([this.webform._form], schema);
439
+ builder_1.default.uniquify(((_a = this.webform._form) === null || _a === void 0 ? void 0 : _a.components) || [], schema);
439
440
  this.webform._form.components.push(schema);
440
441
  schema.overlay = {
441
442
  top: layerY ? (layerY - this.itemOffsetY + HEIGHT) : (e.clientY - iframeRect.top - (this.itemOffsetY - HEIGHT) * 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
  */
@@ -6,12 +6,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Field_1 = __importDefault(require("../field/Field"));
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
8
  class Multivalue extends Field_1.default {
9
- get dataValue() {
10
- const parent = super.dataValue;
11
- if (!parent && this.component.multiple) {
12
- return [];
9
+ /**
10
+ * Normalize values coming into updateValue.
11
+ * @param {*} value - The value to normalize before setting.
12
+ * @returns {*} - The normalized value.
13
+ */
14
+ normalizeValue(value) {
15
+ if (this.component.multiple) {
16
+ if (Array.isArray(value)) {
17
+ if (value.length === 0) {
18
+ return [this.emptyValue];
19
+ }
20
+ if (this.component.storeas === 'array') {
21
+ return super.normalizeValue([value]);
22
+ }
23
+ return super.normalizeValue(value);
24
+ }
25
+ else {
26
+ return super.normalizeValue(value == null ? [this.emptyValue] : [value]);
27
+ }
28
+ }
29
+ else {
30
+ if (Array.isArray(value) && this.component.storeas !== 'array') {
31
+ if (this.component.storeas === 'string') {
32
+ return super.normalizeValue(value.join(this.delimiter || ''));
33
+ }
34
+ return super.normalizeValue(value[0] || this.emptyValue);
35
+ }
36
+ else {
37
+ return super.normalizeValue(value);
38
+ }
13
39
  }
14
- return parent;
40
+ }
41
+ get dataValue() {
42
+ return super.dataValue;
15
43
  }
16
44
  set dataValue(value) {
17
45
  super.dataValue = value;
@@ -31,30 +59,20 @@ class Multivalue extends Field_1.default {
31
59
  get addAnother() {
32
60
  return this.t(this.component.addAnother || 'Add Another');
33
61
  }
34
- useWrapper() {
35
- return this.component.hasOwnProperty('multiple') && this.component.multiple;
36
- }
37
62
  /**
38
63
  * @returns {Field} - The created field.
39
64
  */
40
65
  render() {
41
- // If single value field.
42
- if (!this.useWrapper()) {
43
- return super.render(`<div ${this._referenceAttributeName}="element">
44
- ${this.renderElement(this.component.type !== 'hidden' ? this.dataValue : '')}
45
- </div>`);
46
- }
47
- // Make sure dataValue is in the correct array format.
48
- let dataValue = this.dataValue;
49
- if (!Array.isArray(dataValue)) {
50
- dataValue = dataValue ? [dataValue] : [];
51
- }
52
- // If multiple value field.
53
- return super.render(this.renderTemplate('multiValueTable', {
54
- rows: dataValue.map(this.renderRow.bind(this)).join(''),
55
- disabled: this.disabled,
56
- addAnother: this.addAnother,
57
- }));
66
+ let dataValue = this.normalizeValue(this.dataValue);
67
+ return this.component.hasOwnProperty('multiple') && this.component.multiple
68
+ ? super.render(this.renderTemplate('multiValueTable', {
69
+ rows: dataValue.map(this.renderRow.bind(this)).join(''),
70
+ disabled: this.disabled,
71
+ addAnother: this.addAnother,
72
+ }))
73
+ : super.render(`<div ${this._referenceAttributeName}="element">
74
+ ${this.renderElement(this.component.type !== 'hidden' ? dataValue : '')}
75
+ </div>`);
58
76
  }
59
77
  renderElement() {
60
78
  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';
@@ -197,5 +197,11 @@ class NestedArrayComponent extends NestedDataComponent_1.default {
197
197
  }
198
198
  return super.getComponents();
199
199
  }
200
+ removeSubmissionMetadataRow(index) {
201
+ const componentMetadata = lodash_1.default.get(this.root, `submission.metadata.selectData.${this.path}`, null);
202
+ if (lodash_1.default.isArray(componentMetadata)) {
203
+ componentMetadata.splice(index, 1);
204
+ }
205
+ }
200
206
  }
201
207
  exports.default = NestedArrayComponent;
@@ -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;
@@ -97,6 +97,12 @@ class AddressComponent extends Container_1.default {
97
97
  schema: AddressComponent.schema(),
98
98
  };
99
99
  }
100
+ static get serverConditionSettings() {
101
+ return AddressComponent.conditionOperatorsSettings;
102
+ }
103
+ static get conditionOperatorsSettings() {
104
+ return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: ['isEmpty', 'isNotEmpty'] });
105
+ }
100
106
  mergeSchema(component = {}) {
101
107
  let { defaultSchema } = this;
102
108
  if (component.components) {
@@ -188,7 +194,7 @@ class AddressComponent extends Container_1.default {
188
194
  return (this.manualModeEnabled && this.dataValue) ? this.dataValue.address : this.dataValue;
189
195
  }
190
196
  set address(value) {
191
- if (this.manualModeEnabled && !this.isMultiple) {
197
+ if (this.manualModeEnabled && !this.isMultiple && !lodash_1.default.isEqual(value, this.emptyValue)) {
192
198
  this.dataValue.address = value;
193
199
  }
194
200
  else {
@@ -425,6 +425,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
425
425
  this.splice(index, flags);
426
426
  this.emit('dataGridDeleteRow', { index });
427
427
  const [row] = this.rows.splice(index, 1);
428
+ this.removeSubmissionMetadataRow(index);
428
429
  this.removeRowComponents(row);
429
430
  this.updateRowsComponents(index);
430
431
  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,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ title: 'Select in Data Grid',
5
+ name: 'selectInDataGrid',
6
+ path: 'selectInDataGrid',
7
+ type: 'form',
8
+ display: 'form',
9
+ components: [
10
+ {
11
+ label: 'Data Grid',
12
+ reorder: false,
13
+ addAnotherPosition: 'bottom',
14
+ layoutFixed: false,
15
+ enableRowGroups: false,
16
+ initEmpty: false,
17
+ tableView: false,
18
+ key: 'dataGrid',
19
+ type: 'datagrid',
20
+ input: true,
21
+ components: [
22
+ {
23
+ label: 'Select',
24
+ widget: 'choicesjs',
25
+ tableView: true,
26
+ data: {
27
+ values: [
28
+ {
29
+ label: 'Individual',
30
+ value: 'individual'
31
+ },
32
+ {
33
+ label: 'Entity',
34
+ value: 'entity'
35
+ }
36
+ ]
37
+ },
38
+ validateWhenHidden: false,
39
+ key: 'select',
40
+ type: 'select',
41
+ input: true,
42
+ defaultValue: 'entity'
43
+ },
44
+ ]
45
+ },
46
+ {
47
+ type: 'button',
48
+ label: 'Submit',
49
+ key: 'submit',
50
+ disableOnInvalid: true,
51
+ input: true,
52
+ tableView: false
53
+ }
54
+ ]
55
+ };
@@ -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 };
@@ -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.withReorder = exports.withCheckboxes = exports.twoWithAllowCalculatedOverride = exports.withAllowCalculateOverride = exports.modalWithRequiredFields = exports.withRowGroupsAndDefValue = exports.withLogic = exports.withDefValue = exports.withConditionalFieldsAndValidations = exports.withCollapsibleRowGroups = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.withReorder = exports.withCheckboxes = exports.twoWithAllowCalculatedOverride = exports.withAllowCalculateOverride = exports.modalWithRequiredFields = exports.withRowGroupsAndDefValue = exports.withLogic = exports.withDefValue = exports.withConditionalFieldsAndValidations = exports.withCollapsibleRowGroups = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = 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"));
@@ -22,6 +22,10 @@ const comp8_1 = __importDefault(require("./comp8"));
22
22
  exports.comp8 = comp8_1.default;
23
23
  const comp9_1 = __importDefault(require("./comp9"));
24
24
  exports.comp9 = comp9_1.default;
25
+ const comp10_1 = __importDefault(require("./comp10"));
26
+ exports.comp10 = comp10_1.default;
27
+ const comp11_1 = __importDefault(require("./comp11"));
28
+ exports.comp11 = comp11_1.default;
25
29
  const comp_with_def_value_1 = __importDefault(require("./comp-with-def-value"));
26
30
  exports.withDefValue = comp_with_def_value_1.default;
27
31
  const comp_row_groups_with_def_value_1 = __importDefault(require("./comp-row-groups-with-def-value"));
@@ -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';
@@ -30,7 +30,8 @@ class DayComponent extends Field_1.default {
30
30
  required: false
31
31
  }
32
32
  },
33
- dayFirst: false
33
+ dayFirst: false,
34
+ defaultValue: ''
34
35
  }, ...extend);
35
36
  }
36
37
  static get builderInfo() {
@@ -343,15 +344,21 @@ class DayComponent extends Field_1.default {
343
344
  const valueParts = value.split('/');
344
345
  const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
345
346
  const defaultValue = this.component.defaultValue ? this.component.defaultValue.split('/') : '';
346
- const getNextPart = (shouldTake, defaultValue) => dateParts.push(shouldTake ? valueParts.shift() : defaultValue);
347
+ const getNextPart = (shouldTake, defaultValue) => {
348
+ // Only push the part if it's not an empty string
349
+ const part = shouldTake ? valueParts.shift() : defaultValue;
350
+ if (part !== '') {
351
+ dateParts.push(part);
352
+ }
353
+ };
347
354
  if (this.dayFirst) {
348
- getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '00');
355
+ getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '');
349
356
  }
350
- getNextPart(this.showMonth, defaultValue ? defaultValue[MONTH] : '00');
357
+ getNextPart(this.showMonth, defaultValue ? defaultValue[MONTH] : '');
351
358
  if (!this.dayFirst) {
352
- getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '00');
359
+ getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '');
353
360
  }
354
- getNextPart(this.showYear, defaultValue ? defaultValue[YEAR] : '0000');
361
+ getNextPart(this.showYear, defaultValue ? defaultValue[YEAR] : '');
355
362
  return dateParts.join('/');
356
363
  }
357
364
  /**
@@ -558,10 +565,24 @@ class DayComponent extends Field_1.default {
558
565
  }
559
566
  const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
560
567
  const values = value.split('/');
568
+ if (values.length < 3) {
569
+ return true;
570
+ }
561
571
  return (values[DAY] === '00' || values[MONTH] === '00' || values[YEAR] === '0000');
562
572
  }
563
573
  getValidationFormat() {
564
- return this.dayFirst ? 'DD-MM-YYYY' : 'MM-DD-YYYY';
574
+ var _a, _b, _c, _d, _e, _f;
575
+ let validationFormat = this.dayFirst ? 'DD-MM-YYYY' : 'MM-DD-YYYY';
576
+ if ((_b = (_a = this.fields) === null || _a === void 0 ? void 0 : _a.day) === null || _b === void 0 ? void 0 : _b.hide) {
577
+ validationFormat = validationFormat.replace('DD-', '');
578
+ }
579
+ if ((_d = (_c = this.fields) === null || _c === void 0 ? void 0 : _c.month) === null || _d === void 0 ? void 0 : _d.hide) {
580
+ validationFormat = validationFormat.replace('MM-', '');
581
+ }
582
+ if ((_f = (_e = this.fields) === null || _e === void 0 ? void 0 : _e.year) === null || _f === void 0 ? void 0 : _f.hide) {
583
+ validationFormat = validationFormat.replace('-YYYY', '');
584
+ }
585
+ return validationFormat;
565
586
  }
566
587
  }
567
588
  exports.default = DayComponent;
@@ -885,6 +885,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
885
885
  }
886
886
  this.clearErrors(rowIndex);
887
887
  this.baseRemoveRow(rowIndex);
888
+ this.removeSubmissionMetadataRow(rowIndex);
888
889
  this.splice(rowIndex);
889
890
  this.emit('editGridDeleteRow', {
890
891
  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;
@@ -146,7 +146,9 @@ class FileComponent extends Field_1.default {
146
146
  return Boolean(this.filesToSync.filesToDelete.length || this.filesToSync.filesToUpload.length);
147
147
  }
148
148
  get autoSync() {
149
- return lodash_1.default.get(this, 'component.autoSync', false);
149
+ // Disable autoSync for now
150
+ return false;
151
+ // return _.get(this, 'component.autoSync', false);
150
152
  }
151
153
  get columnsSize() {
152
154
  const actionsColumn = this.disabled ? 0 : this.autoSync ? 2 : 1;
@@ -6,7 +6,7 @@ exports.default = [
6
6
  ignore: true
7
7
  },
8
8
  {
9
- type: 'checkbox',
9
+ type: 'hidden',
10
10
  label: 'Files Synchronization feature',
11
11
  tooltip: 'Enable ability to control files synchronization. Files will be auto synced before submit.',
12
12
  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);
@@ -33,31 +33,22 @@ class RadioComponent extends ListComponent_1.default {
33
33
  }
34
34
  static get conditionOperatorsSettings() {
35
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;
36
+ const isValuesSrc = !classComp.dataSrc || classComp.dataSrc === 'values';
37
+ return isValuesSrc
38
+ ? {
39
+ type: 'select',
40
+ dataSrc: 'custom',
41
+ valueProperty: 'value',
42
+ dataType: classComp.dataType || '',
43
+ data: {
44
+ custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`,
44
45
  }
45
- },
46
- };
46
+ }
47
+ : Object.assign(Object.assign({}, classComp), { type: 'select' });
47
48
  } });
48
49
  }
49
50
  static get serverConditionSettings() {
50
- return Object.assign(Object.assign({}, super.serverConditionSettings), { 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
- } });
51
+ return RadioComponent.conditionOperatorsSettings;
61
52
  }
62
53
  static savedValueTypes(schema) {
63
54
  const { boolean, string, number, object, array } = utils_1.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;
@@ -31,6 +31,12 @@ class ReCaptchaComponent extends Component_1.default {
31
31
  static savedValueTypes() {
32
32
  return [];
33
33
  }
34
+ static get conditionOperatorsSettings() {
35
+ return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: ['isEmpty', 'isNotEmpty'] });
36
+ }
37
+ static get serverConditionSettings() {
38
+ return ReCaptchaComponent.conditionOperatorsSettings;
39
+ }
34
40
  render() {
35
41
  this.recaptchaResult = null;
36
42
  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;
@@ -30,15 +30,18 @@ class SelectBoxesComponent extends Radio_1.default {
30
30
  }
31
31
  static get conditionOperatorsSettings() {
32
32
  return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { valueComponent(classComp) {
33
- return {
34
- type: 'select',
35
- dataSrc: 'custom',
36
- valueProperty: 'value',
37
- dataType: 'string',
38
- data: {
39
- custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`
40
- },
41
- };
33
+ const isValuesSrc = !classComp.dataSrc || classComp.dataSrc === 'values';
34
+ return isValuesSrc
35
+ ? {
36
+ type: 'select',
37
+ dataSrc: 'custom',
38
+ valueProperty: 'value',
39
+ dataType: 'string',
40
+ data: {
41
+ custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`
42
+ },
43
+ }
44
+ : Object.assign(Object.assign({}, classComp), { dataType: 'string', type: 'select' });
42
45
  } });
43
46
  }
44
47
  static savedValueTypes(schema) {
@@ -118,12 +118,12 @@ class TagsComponent extends Input_1.default {
118
118
  }
119
119
  normalizeValue(value) {
120
120
  if (this.component.storeas === 'string' && Array.isArray(value)) {
121
- return value.join(this.delimiter);
121
+ return super.normalizeValue(value.join(this.delimiter));
122
122
  }
123
123
  else if (this.component.storeas === 'array' && typeof value === 'string') {
124
- return value.split(this.delimiter).filter(result => result);
124
+ return super.normalizeValue(value.split(this.delimiter).filter(result => result));
125
125
  }
126
- return value;
126
+ return super.normalizeValue(value);
127
127
  }
128
128
  setValue(value, flags = {}) {
129
129
  const changed = super.setValue(value, flags);
@@ -18,11 +18,6 @@ class TimeComponent extends TextField_1.default {
18
18
  dataFormat: defaultDataFormat,
19
19
  }, ...extend);
20
20
  }
21
- static get serverConditionSettings() {
22
- return Object.assign(Object.assign({}, super.serverConditionSettings), { valueComponent(classComp) {
23
- return Object.assign(Object.assign({}, classComp), { type: 'time' });
24
- } });
25
- }
26
21
  constructor(component, options, data) {
27
22
  super(component, options, data);
28
23
  const { edge: isEdgeBrowser, version: edgeVersion } = (0, utils_1.getBrowserInfo)();
@@ -429,7 +429,7 @@ export default class PDFBuilder extends WebformBuilder {
429
429
  _.merge(schema, info);
430
430
  }
431
431
  // Set a unique key for this component.
432
- BuilderUtils.uniquify([this.webform._form], schema);
432
+ BuilderUtils.uniquify(this.webform._form?.components || [], schema);
433
433
  this.webform._form.components.push(schema);
434
434
  schema.overlay = {
435
435
  top: layerY ? (layerY - this.itemOffsetY + HEIGHT) : (e.clientY - iframeRect.top - (this.itemOffsetY - HEIGHT) * 2),