@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
@@ -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 };
@@ -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
@@ -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;
@@ -58,6 +58,7 @@ export default class SelectComponent extends ListComponent {
58
58
  return SelectComponent.conditionOperatorsSettings;
59
59
  }
60
60
  static get conditionOperatorsSettings() {
61
+ const numberType = () => ({ type: 'number' });
61
62
  return {
62
63
  ...super.conditionOperatorsSettings,
63
64
  valueComponent(classComp) {
@@ -74,7 +75,18 @@ export default class SelectComponent extends ListComponent {
74
75
  `;
75
76
  }
76
77
  return valueComp;
77
- }
78
+ },
79
+ dataTypeOperators: {
80
+ number: ['lessThan', 'greaterThan', 'lessThanOrEqual', 'greaterThanOrEqual'],
81
+ },
82
+ dataTypeValueComponents: {
83
+ number: {
84
+ lessThan: numberType,
85
+ greaterThan: numberType,
86
+ lessThanOrEqual: numberType,
87
+ greaterThanOrEqual: numberType,
88
+ },
89
+ },
78
90
  };
79
91
  }
80
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,57 @@
1
+ export default {
2
+ title: 'FIO-8072',
3
+ name: 'fio8072',
4
+ path: 'fio8072',
5
+ type: 'form',
6
+ display: 'form',
7
+ components: [
8
+ {
9
+ label: 'Select',
10
+ widget: 'choicesjs',
11
+ tableView: true,
12
+ data: {
13
+ values: [
14
+ {
15
+ label: 'A',
16
+ value: '1',
17
+ },
18
+ {
19
+ label: 'B',
20
+ value: '2',
21
+ },
22
+ {
23
+ label: 'C',
24
+ value: '10',
25
+ },
26
+ {
27
+ label: 'D',
28
+ value: '1d',
29
+ },
30
+ ],
31
+ },
32
+ dataType: 'number',
33
+ key: 'select',
34
+ type: 'select',
35
+ input: true,
36
+ },
37
+ {
38
+ label: 'Text Field',
39
+ applyMaskOn: 'change',
40
+ tableView: true,
41
+ key: 'textField',
42
+ type: 'textfield',
43
+ input: true,
44
+ conditional: {
45
+ show: true,
46
+ conjunction: 'all',
47
+ conditions: [
48
+ {
49
+ component: 'select',
50
+ operator: 'lessThan',
51
+ value: 5,
52
+ },
53
+ ],
54
+ },
55
+ },
56
+ ],
57
+ };
@@ -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";
@@ -22,4 +22,5 @@ import comp21 from './comp21';
22
22
  import comp22 from './comp22';
23
23
  import comp23 from './comp23';
24
24
  import comp24 from './comp24';
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 };
25
+ import comp25 from './comp25';
26
+ 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 };
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.76",
3
+ "version": "5.0.0-rc.78",
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.5",
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",