@formio/js 5.0.0-rc.76 → 5.0.0-rc.78

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 (52) 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 +9 -9
  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 +9 -9
  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.min.js.LICENSE.txt +1 -1
  14. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  15. package/lib/cjs/components/_classes/multivalue/Multivalue.js +43 -25
  16. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  17. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +6 -0
  18. package/lib/cjs/components/address/Address.d.ts +6 -0
  19. package/lib/cjs/components/address/Address.js +7 -1
  20. package/lib/cjs/components/datagrid/DataGrid.js +1 -0
  21. package/lib/cjs/components/datagrid/fixtures/comp11.d.ts +50 -0
  22. package/lib/cjs/components/datagrid/fixtures/comp11.js +55 -0
  23. package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
  24. package/lib/cjs/components/datagrid/fixtures/index.js +5 -1
  25. package/lib/cjs/components/editgrid/EditGrid.js +1 -0
  26. package/lib/cjs/components/select/Select.d.ts +38 -0
  27. package/lib/cjs/components/select/Select.js +10 -0
  28. package/lib/cjs/components/select/fixtures/comp25.d.ts +44 -0
  29. package/lib/cjs/components/select/fixtures/comp25.js +59 -0
  30. package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
  31. package/lib/cjs/components/select/fixtures/index.js +3 -1
  32. package/lib/cjs/components/tags/Tags.js +3 -3
  33. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  34. package/lib/mjs/components/_classes/multivalue/Multivalue.js +43 -25
  35. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  36. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +6 -0
  37. package/lib/mjs/components/address/Address.d.ts +6 -0
  38. package/lib/mjs/components/address/Address.js +10 -1
  39. package/lib/mjs/components/datagrid/DataGrid.js +1 -0
  40. package/lib/mjs/components/datagrid/fixtures/comp11.d.ts +50 -0
  41. package/lib/mjs/components/datagrid/fixtures/comp11.js +53 -0
  42. package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
  43. package/lib/mjs/components/datagrid/fixtures/index.js +3 -1
  44. package/lib/mjs/components/editgrid/EditGrid.js +1 -0
  45. package/lib/mjs/components/select/Select.d.ts +38 -0
  46. package/lib/mjs/components/select/Select.js +13 -1
  47. package/lib/mjs/components/select/fixtures/comp25.d.ts +44 -0
  48. package/lib/mjs/components/select/fixtures/comp25.js +57 -0
  49. package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
  50. package/lib/mjs/components/select/fixtures/index.js +2 -1
  51. package/lib/mjs/components/tags/Tags.js +3 -3
  52. package/package.json +2 -2
@@ -10,7 +10,7 @@
10
10
  * MIT licensed
11
11
  */
12
12
 
13
- /*! formiojs v5.0.0-rc.76 | https://unpkg.com/formiojs@5.0.0-rc.76/LICENSE.txt */
13
+ /*! formiojs v5.0.0-rc.78 | https://unpkg.com/formiojs@5.0.0-rc.78/LICENSE.txt */
14
14
 
15
15
  /**
16
16
  * @license
@@ -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.76 | https://unpkg.com/formiojs@5.0.0-rc.76/LICENSE.txt */
23
+ /*! formiojs v5.0.0-rc.78 | https://unpkg.com/formiojs@5.0.0-rc.78/LICENSE.txt */
24
24
 
25
25
  /**
26
26
  * @license
@@ -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"));
@@ -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
@@ -9,9 +9,47 @@ export default class SelectComponent extends ListComponent {
9
9
  };
10
10
  static get serverConditionSettings(): {
11
11
  valueComponent(classComp: any): any;
12
+ dataTypeOperators: {
13
+ number: string[];
14
+ };
15
+ dataTypeValueComponents: {
16
+ number: {
17
+ lessThan: () => {
18
+ type: string;
19
+ };
20
+ greaterThan: () => {
21
+ type: string;
22
+ };
23
+ lessThanOrEqual: () => {
24
+ type: string;
25
+ };
26
+ greaterThanOrEqual: () => {
27
+ type: string;
28
+ };
29
+ };
30
+ };
12
31
  };
13
32
  static get conditionOperatorsSettings(): {
14
33
  valueComponent(classComp: any): any;
34
+ dataTypeOperators: {
35
+ number: string[];
36
+ };
37
+ dataTypeValueComponents: {
38
+ number: {
39
+ lessThan: () => {
40
+ type: string;
41
+ };
42
+ greaterThan: () => {
43
+ type: string;
44
+ };
45
+ lessThanOrEqual: () => {
46
+ type: string;
47
+ };
48
+ greaterThanOrEqual: () => {
49
+ type: string;
50
+ };
51
+ };
52
+ };
15
53
  };
16
54
  static savedValueTypes(schema: any): any[];
17
55
  templateData: {} | undefined;
@@ -63,6 +63,7 @@ class SelectComponent extends ListComponent_1.default {
63
63
  return SelectComponent.conditionOperatorsSettings;
64
64
  }
65
65
  static get conditionOperatorsSettings() {
66
+ const numberType = () => ({ type: 'number' });
66
67
  return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { valueComponent(classComp) {
67
68
  const valueComp = Object.assign(Object.assign({}, classComp), { type: 'select' });
68
69
  if ((0, utils_1.isSelectResourceWithObjectValue)(classComp)) {
@@ -77,6 +78,15 @@ class SelectComponent extends ListComponent_1.default {
77
78
  `;
78
79
  }
79
80
  return valueComp;
81
+ }, dataTypeOperators: {
82
+ number: ['lessThan', 'greaterThan', 'lessThanOrEqual', 'greaterThanOrEqual'],
83
+ }, dataTypeValueComponents: {
84
+ number: {
85
+ lessThan: numberType,
86
+ greaterThan: numberType,
87
+ lessThanOrEqual: numberType,
88
+ greaterThanOrEqual: numberType,
89
+ },
80
90
  } });
81
91
  }
82
92
  static savedValueTypes(schema) {
@@ -0,0 +1,44 @@
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
+ widget: string;
10
+ tableView: boolean;
11
+ data: {
12
+ values: {
13
+ label: string;
14
+ value: string;
15
+ }[];
16
+ };
17
+ dataType: string;
18
+ key: string;
19
+ type: string;
20
+ input: boolean;
21
+ applyMaskOn?: undefined;
22
+ conditional?: undefined;
23
+ } | {
24
+ label: string;
25
+ applyMaskOn: string;
26
+ tableView: boolean;
27
+ key: string;
28
+ type: string;
29
+ input: boolean;
30
+ conditional: {
31
+ show: boolean;
32
+ conjunction: string;
33
+ conditions: {
34
+ component: string;
35
+ operator: string;
36
+ value: number;
37
+ }[];
38
+ };
39
+ widget?: undefined;
40
+ data?: undefined;
41
+ dataType?: undefined;
42
+ })[];
43
+ }
44
+ export default _default;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ title: 'FIO-8072',
5
+ name: 'fio8072',
6
+ path: 'fio8072',
7
+ type: 'form',
8
+ display: 'form',
9
+ components: [
10
+ {
11
+ label: 'Select',
12
+ widget: 'choicesjs',
13
+ tableView: true,
14
+ data: {
15
+ values: [
16
+ {
17
+ label: 'A',
18
+ value: '1',
19
+ },
20
+ {
21
+ label: 'B',
22
+ value: '2',
23
+ },
24
+ {
25
+ label: 'C',
26
+ value: '10',
27
+ },
28
+ {
29
+ label: 'D',
30
+ value: '1d',
31
+ },
32
+ ],
33
+ },
34
+ dataType: 'number',
35
+ key: 'select',
36
+ type: 'select',
37
+ input: true,
38
+ },
39
+ {
40
+ label: 'Text Field',
41
+ applyMaskOn: 'change',
42
+ tableView: true,
43
+ key: 'textField',
44
+ type: 'textfield',
45
+ input: true,
46
+ conditional: {
47
+ show: true,
48
+ conjunction: 'all',
49
+ conditions: [
50
+ {
51
+ component: 'select',
52
+ operator: 'lessThan',
53
+ value: 5,
54
+ },
55
+ ],
56
+ },
57
+ },
58
+ ],
59
+ };
@@ -21,5 +21,6 @@ import comp21 from './comp21';
21
21
  import comp22 from './comp22';
22
22
  import comp23 from './comp23';
23
23
  import comp24 from './comp24';
24
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24 };
24
+ import comp25 from './comp25';
25
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25 };
25
26
  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.comp24 = exports.comp23 = exports.comp22 = exports.comp21 = exports.comp20 = 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;
6
+ exports.comp25 = exports.comp24 = exports.comp23 = exports.comp22 = exports.comp21 = exports.comp20 = 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"));
@@ -53,3 +53,5 @@ const comp23_1 = __importDefault(require("./comp23"));
53
53
  exports.comp23 = comp23_1.default;
54
54
  const comp24_1 = __importDefault(require("./comp24"));
55
55
  exports.comp24 = comp24_1.default;
56
+ const comp25_1 = __importDefault(require("./comp25"));
57
+ exports.comp25 = comp25_1.default;
@@ -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);
@@ -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';