@formio/js 5.0.0-dev.5695.024ad9c → 5.0.0-dev.5696.7642331

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 (132) hide show
  1. package/Changelog.md +14 -0
  2. package/dist/formio.builder.css +0 -1
  3. package/dist/formio.builder.min.css +1 -1
  4. package/dist/formio.embed.js +1 -1
  5. package/dist/formio.embed.min.js +1 -1
  6. package/dist/formio.form.css +0 -1
  7. package/dist/formio.form.js +68 -124
  8. package/dist/formio.form.min.css +1 -1
  9. package/dist/formio.form.min.js +1 -1
  10. package/dist/formio.full.css +0 -1
  11. package/dist/formio.full.js +49 -29
  12. package/dist/formio.full.min.css +1 -1
  13. package/dist/formio.full.min.js +1 -1
  14. package/dist/formio.js +2 -2
  15. package/dist/formio.min.js +1 -1
  16. package/dist/formio.utils.js +57 -17
  17. package/dist/formio.utils.min.js +1 -1
  18. package/lib/cjs/CDN.d.ts +1 -0
  19. package/lib/cjs/CDN.js +1 -0
  20. package/lib/cjs/Webform.js +5 -3
  21. package/lib/cjs/components/_classes/component/Component.d.ts +1 -0
  22. package/lib/cjs/components/_classes/component/Component.js +18 -0
  23. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +2 -1
  24. package/lib/cjs/components/_classes/nested/NestedComponent.js +4 -1
  25. package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
  26. package/lib/cjs/components/checkbox/Checkbox.js +1 -1
  27. package/lib/cjs/components/checkbox/fixtures/comp6.d.ts +32 -0
  28. package/lib/cjs/components/checkbox/fixtures/comp6.js +30 -0
  29. package/lib/cjs/components/checkbox/fixtures/index.d.ts +2 -1
  30. package/lib/cjs/components/checkbox/fixtures/index.js +3 -1
  31. package/lib/cjs/components/currency/Currency.d.ts +2 -0
  32. package/lib/cjs/components/datagrid/DataGrid.d.ts +2 -0
  33. package/lib/cjs/components/datagrid/DataGrid.js +38 -26
  34. package/lib/cjs/components/datagrid/fixtures/comp10.d.ts +81 -0
  35. package/lib/cjs/components/datagrid/fixtures/comp10.js +87 -0
  36. package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
  37. package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
  38. package/lib/cjs/components/datamap/DataMap.js +2 -2
  39. package/lib/cjs/components/day/fixtures/comp8.d.ts +41 -0
  40. package/lib/cjs/components/day/fixtures/comp8.js +40 -0
  41. package/lib/cjs/components/day/fixtures/index.d.ts +2 -1
  42. package/lib/cjs/components/day/fixtures/index.js +3 -1
  43. package/lib/cjs/components/editgrid/EditGrid.js +12 -1
  44. package/lib/cjs/components/editgrid/fixtures/comp-test-events.d.ts +54 -0
  45. package/lib/cjs/components/editgrid/fixtures/comp-test-events.js +54 -0
  46. package/lib/cjs/components/editgrid/fixtures/comp16.d.ts +52 -0
  47. package/lib/cjs/components/editgrid/fixtures/comp16.js +71 -0
  48. package/lib/cjs/components/editgrid/fixtures/index.d.ts +3 -1
  49. package/lib/cjs/components/editgrid/fixtures/index.js +5 -1
  50. package/lib/cjs/components/number/Number.d.ts +17 -2
  51. package/lib/cjs/components/number/Number.js +26 -6
  52. package/lib/cjs/components/number/fixtures/comp10.d.ts +18 -0
  53. package/lib/cjs/components/number/fixtures/comp10.js +21 -0
  54. package/lib/cjs/components/number/fixtures/comp9.d.ts +18 -0
  55. package/lib/cjs/components/number/fixtures/comp9.js +21 -0
  56. package/lib/cjs/components/number/fixtures/index.d.ts +3 -1
  57. package/lib/cjs/components/number/fixtures/index.js +5 -1
  58. package/lib/cjs/components/radio/Radio.js +7 -6
  59. package/lib/cjs/components/radio/fixtures/comp12.d.ts +29 -0
  60. package/lib/cjs/components/radio/fixtures/comp12.js +36 -0
  61. package/lib/cjs/components/radio/fixtures/index.d.ts +2 -1
  62. package/lib/cjs/components/radio/fixtures/index.js +3 -1
  63. package/lib/cjs/components/time/Time.d.ts +2 -2
  64. package/lib/cjs/components/time/Time.js +3 -2
  65. package/lib/cjs/components/time/fixtures/comp4.d.ts +166 -0
  66. package/lib/cjs/components/time/fixtures/comp4.js +171 -0
  67. package/lib/cjs/components/time/fixtures/index.d.ts +2 -1
  68. package/lib/cjs/components/time/fixtures/index.js +3 -1
  69. package/lib/cjs/translations/en.d.ts +3 -0
  70. package/lib/cjs/translations/en.js +4 -1
  71. package/lib/cjs/utils/conditionOperators/IsEmptyValue.js +4 -3
  72. package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
  73. package/lib/cjs/utils/utils.d.ts +1 -10
  74. package/lib/cjs/utils/utils.js +59 -7
  75. package/lib/mjs/CDN.d.ts +1 -0
  76. package/lib/mjs/CDN.js +1 -0
  77. package/lib/mjs/Webform.js +5 -3
  78. package/lib/mjs/components/_classes/component/Component.d.ts +1 -0
  79. package/lib/mjs/components/_classes/component/Component.js +7 -0
  80. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +2 -1
  81. package/lib/mjs/components/_classes/nested/NestedComponent.js +4 -1
  82. package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
  83. package/lib/mjs/components/checkbox/Checkbox.js +1 -1
  84. package/lib/mjs/components/checkbox/fixtures/comp6.d.ts +32 -0
  85. package/lib/mjs/components/checkbox/fixtures/comp6.js +28 -0
  86. package/lib/mjs/components/checkbox/fixtures/index.d.ts +2 -1
  87. package/lib/mjs/components/checkbox/fixtures/index.js +2 -1
  88. package/lib/mjs/components/currency/Currency.d.ts +2 -0
  89. package/lib/mjs/components/datagrid/DataGrid.d.ts +2 -0
  90. package/lib/mjs/components/datagrid/DataGrid.js +37 -25
  91. package/lib/mjs/components/datagrid/fixtures/comp10.d.ts +81 -0
  92. package/lib/mjs/components/datagrid/fixtures/comp10.js +85 -0
  93. package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
  94. package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
  95. package/lib/mjs/components/datamap/DataMap.js +1 -1
  96. package/lib/mjs/components/day/fixtures/comp8.d.ts +41 -0
  97. package/lib/mjs/components/day/fixtures/comp8.js +38 -0
  98. package/lib/mjs/components/day/fixtures/index.d.ts +2 -1
  99. package/lib/mjs/components/day/fixtures/index.js +2 -1
  100. package/lib/mjs/components/editgrid/EditGrid.js +12 -1
  101. package/lib/mjs/components/editgrid/fixtures/comp-test-events.d.ts +54 -0
  102. package/lib/mjs/components/editgrid/fixtures/comp-test-events.js +52 -0
  103. package/lib/mjs/components/editgrid/fixtures/comp16.d.ts +52 -0
  104. package/lib/mjs/components/editgrid/fixtures/comp16.js +69 -0
  105. package/lib/mjs/components/editgrid/fixtures/index.d.ts +3 -1
  106. package/lib/mjs/components/editgrid/fixtures/index.js +3 -1
  107. package/lib/mjs/components/number/Number.d.ts +17 -2
  108. package/lib/mjs/components/number/Number.js +25 -5
  109. package/lib/mjs/components/number/fixtures/comp10.d.ts +18 -0
  110. package/lib/mjs/components/number/fixtures/comp10.js +19 -0
  111. package/lib/mjs/components/number/fixtures/comp9.d.ts +18 -0
  112. package/lib/mjs/components/number/fixtures/comp9.js +19 -0
  113. package/lib/mjs/components/number/fixtures/index.d.ts +3 -1
  114. package/lib/mjs/components/number/fixtures/index.js +3 -1
  115. package/lib/mjs/components/radio/Radio.js +7 -6
  116. package/lib/mjs/components/radio/fixtures/comp12.d.ts +29 -0
  117. package/lib/mjs/components/radio/fixtures/comp12.js +34 -0
  118. package/lib/mjs/components/radio/fixtures/index.d.ts +2 -1
  119. package/lib/mjs/components/radio/fixtures/index.js +2 -1
  120. package/lib/mjs/components/time/Time.d.ts +2 -2
  121. package/lib/mjs/components/time/Time.js +3 -2
  122. package/lib/mjs/components/time/fixtures/comp4.d.ts +166 -0
  123. package/lib/mjs/components/time/fixtures/comp4.js +169 -0
  124. package/lib/mjs/components/time/fixtures/index.d.ts +2 -1
  125. package/lib/mjs/components/time/fixtures/index.js +2 -1
  126. package/lib/mjs/translations/en.d.ts +3 -0
  127. package/lib/mjs/translations/en.js +4 -1
  128. package/lib/mjs/utils/conditionOperators/IsEmptyValue.js +3 -3
  129. package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
  130. package/lib/mjs/utils/utils.d.ts +1 -10
  131. package/lib/mjs/utils/utils.js +58 -7
  132. package/package.json +2 -2
@@ -1,12 +1,12 @@
1
1
  export default class TimeComponent extends TextFieldComponent {
2
- rawData: string | never[];
2
+ rawData: any;
3
3
  get dataFormat(): any;
4
4
  get skipMaskValidation(): boolean;
5
5
  isNotCompleteInput(value: any): any;
6
6
  removeValue(index: any): void;
7
7
  resetRawData(index: any): void;
8
8
  setRawValue(value: any, index: any): void;
9
- getRawValue(index: any): string | never[];
9
+ getRawValue(index: any): any;
10
10
  getValueAt(index: any): any;
11
11
  setValueAt(index: any, value: any): void;
12
12
  getStringAsValue(view: any): any;
@@ -30,7 +30,8 @@ class TimeComponent extends TextField_1.default {
30
30
  this.component.inputType = isEdgeBrowser && edgeVersion <= 18
31
31
  ? 'text'
32
32
  : (this.component.inputType || 'time');
33
- this.rawData = this.component.multiple ? [] : this.emptyValue;
33
+ // If default value is given then the raw data needs to be set
34
+ this.rawData = this.component.multiple ? [] : this.getValueAsString(this.defaultValue) || this.emptyValue;
34
35
  }
35
36
  static get builderInfo() {
36
37
  return {
@@ -61,7 +62,7 @@ class TimeComponent extends TextField_1.default {
61
62
  return value;
62
63
  }
63
64
  get validationValue() {
64
- if (Array.isArray(this.rawData) && !this.rawData.length || !this.rawData) {
65
+ if ((Array.isArray(this.rawData) && !this.rawData.length) || !this.rawData) {
65
66
  return this.dataValue;
66
67
  }
67
68
  return this.rawData;
@@ -0,0 +1,166 @@
1
+ declare namespace _default {
2
+ let type: string;
3
+ let display: string;
4
+ let components: {
5
+ title: string;
6
+ breadcrumbClickable: boolean;
7
+ buttonSettings: {
8
+ previous: boolean;
9
+ cancel: boolean;
10
+ next: boolean;
11
+ };
12
+ navigateOnEnter: boolean;
13
+ saveOnEnter: boolean;
14
+ scrollToTop: boolean;
15
+ collapsible: boolean;
16
+ key: string;
17
+ type: string;
18
+ label: string;
19
+ components: {
20
+ label: string;
21
+ disabled: boolean;
22
+ alwaysEnabled: boolean;
23
+ tableView: boolean;
24
+ defaultValue: string;
25
+ key: string;
26
+ type: string;
27
+ input: boolean;
28
+ inputMask: string;
29
+ hideOnChildrenHidden: boolean;
30
+ id: string;
31
+ placeholder: string;
32
+ prefix: string;
33
+ customClass: string;
34
+ suffix: string;
35
+ multiple: boolean;
36
+ protected: boolean;
37
+ unique: boolean;
38
+ persistent: boolean;
39
+ hidden: boolean;
40
+ clearOnHide: boolean;
41
+ refreshOn: string;
42
+ redrawOn: string;
43
+ modalEdit: boolean;
44
+ dataGridLabel: boolean;
45
+ labelPosition: string;
46
+ description: string;
47
+ errorLabel: string;
48
+ tooltip: string;
49
+ hideLabel: boolean;
50
+ tabindex: string;
51
+ autofocus: boolean;
52
+ dbIndex: boolean;
53
+ customDefaultValue: string;
54
+ calculateValue: string;
55
+ calculateServer: boolean;
56
+ widget: {
57
+ type: string;
58
+ };
59
+ attributes: {};
60
+ validateOn: string;
61
+ validate: {
62
+ required: boolean;
63
+ custom: string;
64
+ customPrivate: boolean;
65
+ strictDateValidation: boolean;
66
+ multiple: boolean;
67
+ unique: boolean;
68
+ minLength: string;
69
+ maxLength: string;
70
+ pattern: string;
71
+ };
72
+ conditional: {
73
+ show: null;
74
+ when: null;
75
+ eq: string;
76
+ };
77
+ overlay: {
78
+ style: string;
79
+ left: string;
80
+ top: string;
81
+ width: string;
82
+ height: string;
83
+ };
84
+ allowCalculateOverride: boolean;
85
+ encrypted: boolean;
86
+ showCharCount: boolean;
87
+ showWordCount: boolean;
88
+ properties: {};
89
+ allowMultipleMasks: boolean;
90
+ addons: never[];
91
+ mask: boolean;
92
+ inputType: string;
93
+ inputFormat: string;
94
+ displayMask: string;
95
+ spellcheck: boolean;
96
+ truncateMultipleSpaces: boolean;
97
+ format: string;
98
+ dataFormat: string;
99
+ }[];
100
+ input: boolean;
101
+ tableView: boolean;
102
+ id: string;
103
+ placeholder: string;
104
+ prefix: string;
105
+ customClass: string;
106
+ suffix: string;
107
+ multiple: boolean;
108
+ defaultValue: null;
109
+ protected: boolean;
110
+ unique: boolean;
111
+ persistent: boolean;
112
+ hidden: boolean;
113
+ clearOnHide: boolean;
114
+ refreshOn: string;
115
+ redrawOn: string;
116
+ modalEdit: boolean;
117
+ dataGridLabel: boolean;
118
+ labelPosition: string;
119
+ description: string;
120
+ errorLabel: string;
121
+ tooltip: string;
122
+ hideLabel: boolean;
123
+ tabindex: string;
124
+ disabled: boolean;
125
+ autofocus: boolean;
126
+ dbIndex: boolean;
127
+ customDefaultValue: string;
128
+ calculateValue: string;
129
+ calculateServer: boolean;
130
+ widget: null;
131
+ attributes: {};
132
+ validateOn: string;
133
+ validate: {
134
+ required: boolean;
135
+ custom: string;
136
+ customPrivate: boolean;
137
+ strictDateValidation: boolean;
138
+ multiple: boolean;
139
+ unique: boolean;
140
+ };
141
+ conditional: {
142
+ show: null;
143
+ when: null;
144
+ eq: string;
145
+ };
146
+ overlay: {
147
+ style: string;
148
+ left: string;
149
+ top: string;
150
+ width: string;
151
+ height: string;
152
+ };
153
+ allowCalculateOverride: boolean;
154
+ encrypted: boolean;
155
+ showCharCount: boolean;
156
+ showWordCount: boolean;
157
+ properties: {};
158
+ allowMultipleMasks: boolean;
159
+ addons: never[];
160
+ tree: boolean;
161
+ lazyLoad: boolean;
162
+ theme: string;
163
+ breadcrumb: string;
164
+ }[];
165
+ }
166
+ export default _default;
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ "type": "form",
5
+ "display": "wizard",
6
+ "components": [
7
+ {
8
+ "title": "Page 1",
9
+ "breadcrumbClickable": true,
10
+ "buttonSettings": {
11
+ "previous": true,
12
+ "cancel": true,
13
+ "next": true
14
+ },
15
+ "navigateOnEnter": false,
16
+ "saveOnEnter": false,
17
+ "scrollToTop": false,
18
+ "collapsible": false,
19
+ "key": "page1",
20
+ "type": "panel",
21
+ "label": "Page 1",
22
+ "components": [
23
+ {
24
+ "label": "Time",
25
+ "disabled": true,
26
+ "alwaysEnabled": false,
27
+ "tableView": true,
28
+ "defaultValue": "03:03 PM",
29
+ "key": "time1",
30
+ "type": "time",
31
+ "input": true,
32
+ "inputMask": "99:99",
33
+ "hideOnChildrenHidden": false,
34
+ "id": "efw9yyq",
35
+ "placeholder": "",
36
+ "prefix": "",
37
+ "customClass": "",
38
+ "suffix": "",
39
+ "multiple": false,
40
+ "protected": false,
41
+ "unique": false,
42
+ "persistent": true,
43
+ "hidden": false,
44
+ "clearOnHide": true,
45
+ "refreshOn": "",
46
+ "redrawOn": "",
47
+ "modalEdit": false,
48
+ "dataGridLabel": false,
49
+ "labelPosition": "top",
50
+ "description": "",
51
+ "errorLabel": "",
52
+ "tooltip": "",
53
+ "hideLabel": false,
54
+ "tabindex": "",
55
+ "autofocus": false,
56
+ "dbIndex": false,
57
+ "customDefaultValue": "",
58
+ "calculateValue": "",
59
+ "calculateServer": false,
60
+ "widget": {
61
+ "type": "input"
62
+ },
63
+ "attributes": {},
64
+ "validateOn": "change",
65
+ "validate": {
66
+ "required": false,
67
+ "custom": "",
68
+ "customPrivate": false,
69
+ "strictDateValidation": false,
70
+ "multiple": false,
71
+ "unique": false,
72
+ "minLength": "",
73
+ "maxLength": "",
74
+ "pattern": ""
75
+ },
76
+ "conditional": {
77
+ "show": null,
78
+ "when": null,
79
+ "eq": ""
80
+ },
81
+ "overlay": {
82
+ "style": "",
83
+ "left": "",
84
+ "top": "",
85
+ "width": "",
86
+ "height": ""
87
+ },
88
+ "allowCalculateOverride": false,
89
+ "encrypted": false,
90
+ "showCharCount": false,
91
+ "showWordCount": false,
92
+ "properties": {},
93
+ "allowMultipleMasks": false,
94
+ "addons": [],
95
+ "mask": false,
96
+ "inputType": "time",
97
+ "inputFormat": "plain",
98
+ "displayMask": "",
99
+ "spellcheck": true,
100
+ "truncateMultipleSpaces": false,
101
+ "format": "HH:mm",
102
+ "dataFormat": "HH:mm:ss"
103
+ }
104
+ ],
105
+ "input": false,
106
+ "tableView": false,
107
+ "id": "e7vej1d",
108
+ "placeholder": "",
109
+ "prefix": "",
110
+ "customClass": "",
111
+ "suffix": "",
112
+ "multiple": false,
113
+ "defaultValue": null,
114
+ "protected": false,
115
+ "unique": false,
116
+ "persistent": false,
117
+ "hidden": false,
118
+ "clearOnHide": false,
119
+ "refreshOn": "",
120
+ "redrawOn": "",
121
+ "modalEdit": false,
122
+ "dataGridLabel": false,
123
+ "labelPosition": "top",
124
+ "description": "",
125
+ "errorLabel": "",
126
+ "tooltip": "",
127
+ "hideLabel": false,
128
+ "tabindex": "",
129
+ "disabled": false,
130
+ "autofocus": false,
131
+ "dbIndex": false,
132
+ "customDefaultValue": "",
133
+ "calculateValue": "",
134
+ "calculateServer": false,
135
+ "widget": null,
136
+ "attributes": {},
137
+ "validateOn": "change",
138
+ "validate": {
139
+ "required": false,
140
+ "custom": "",
141
+ "customPrivate": false,
142
+ "strictDateValidation": false,
143
+ "multiple": false,
144
+ "unique": false
145
+ },
146
+ "conditional": {
147
+ "show": null,
148
+ "when": null,
149
+ "eq": ""
150
+ },
151
+ "overlay": {
152
+ "style": "",
153
+ "left": "",
154
+ "top": "",
155
+ "width": "",
156
+ "height": ""
157
+ },
158
+ "allowCalculateOverride": false,
159
+ "encrypted": false,
160
+ "showCharCount": false,
161
+ "showWordCount": false,
162
+ "properties": {},
163
+ "allowMultipleMasks": false,
164
+ "addons": [],
165
+ "tree": false,
166
+ "lazyLoad": false,
167
+ "theme": "default",
168
+ "breadcrumb": "default"
169
+ }
170
+ ],
171
+ };
@@ -1,6 +1,7 @@
1
1
  import comp1 from './comp1';
2
2
  import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
+ import comp4 from './comp4';
4
5
  import timeForm from './timeForm';
5
6
  import timeForm2 from './timeForm2';
6
- export { comp1, comp2, comp3, timeForm, timeForm2 };
7
+ export { comp1, comp2, comp3, comp4, timeForm, timeForm2 };
@@ -3,13 +3,15 @@ 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.timeForm2 = exports.timeForm = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.timeForm2 = exports.timeForm = 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"));
10
10
  exports.comp2 = comp2_1.default;
11
11
  const comp3_1 = __importDefault(require("./comp3"));
12
12
  exports.comp3 = comp3_1.default;
13
+ const comp4_1 = __importDefault(require("./comp4"));
14
+ exports.comp4 = comp4_1.default;
13
15
  const timeForm_1 = __importDefault(require("./timeForm"));
14
16
  exports.timeForm = timeForm_1.default;
15
17
  const timeForm2_1 = __importDefault(require("./timeForm2"));
@@ -74,5 +74,8 @@ declare namespace _default {
74
74
  let apiKey: string;
75
75
  let typeRemaining: string;
76
76
  let typeCount: string;
77
+ let requiredDayField: string;
78
+ let requiredMonthField: string;
79
+ let requiredYearField: string;
77
80
  }
78
81
  export default _default;
@@ -75,5 +75,8 @@ exports.default = {
75
75
  reCaptchaTokenNotSpecifiedError: 'ReCAPTCHA: Token is not specified in submission',
76
76
  apiKey: 'API Key is not unique: {{key}}',
77
77
  typeRemaining: '{{ remaining }} {{ type }} remaining.',
78
- typeCount: '{{ count }} {{ type }}'
78
+ typeCount: '{{ count }} {{ type }}',
79
+ requiredDayField: '{{ field }} is required',
80
+ requiredMonthField: '{{ field }} is required',
81
+ requiredYearField: '{{ field }} is required'
79
82
  };
@@ -16,10 +16,11 @@ class IsEmptyValue extends ConditionOperator_1.default {
16
16
  return false;
17
17
  }
18
18
  execute({ value, instance, conditionComponentPath }) {
19
- const isEmptyValue = lodash_1.default.isEmpty(value);
19
+ var _a;
20
+ const isEmptyValue = lodash_1.default.isEmpty(lodash_1.default.isNumber(value) ? String(value) : value);
20
21
  if (instance && instance.root) {
21
- const conditionTriggerComponent = instance.root.getComponent(conditionComponentPath);
22
- return conditionTriggerComponent ? conditionTriggerComponent.isEmpty() : isEmptyValue;
22
+ const conditionTriggerComponent = ((_a = instance.root) === null || _a === void 0 ? void 0 : _a.getComponent) && instance.root.getComponent(conditionComponentPath);
23
+ return (conditionTriggerComponent === null || conditionTriggerComponent === void 0 ? void 0 : conditionTriggerComponent.isEmpty) ? conditionTriggerComponent.isEmpty() : isEmptyValue;
23
24
  }
24
25
  return isEmptyValue;
25
26
  }
@@ -14,7 +14,7 @@ class IsEqualTo extends ConditionOperator_1.default {
14
14
  return 'Is Equal To';
15
15
  }
16
16
  execute({ value, comparedValue, instance, conditionComponentPath }) {
17
- var _a;
17
+ var _a, _b;
18
18
  if ((value || value === false) && comparedValue && typeof value !== typeof comparedValue && lodash_1.default.isString(comparedValue)) {
19
19
  try {
20
20
  comparedValue = JSON.parse(comparedValue);
@@ -23,10 +23,10 @@ class IsEqualTo extends ConditionOperator_1.default {
23
23
  catch (e) { }
24
24
  }
25
25
  if (instance && instance.root) {
26
- const conditionTriggerComponent = instance.root.getComponent(conditionComponentPath);
26
+ const conditionTriggerComponent = ((_a = instance.root) === null || _a === void 0 ? void 0 : _a.getComponent) && instance.root.getComponent(conditionComponentPath);
27
27
  if (conditionTriggerComponent
28
28
  && (0, utils_1.isSelectResourceWithObjectValue)(conditionTriggerComponent.component)
29
- && ((_a = conditionTriggerComponent.component) === null || _a === void 0 ? void 0 : _a.template)) {
29
+ && ((_b = conditionTriggerComponent.component) === null || _b === void 0 ? void 0 : _b.template)) {
30
30
  if (!value || !lodash_1.default.isPlainObject(value)) {
31
31
  return false;
32
32
  }
@@ -56,16 +56,7 @@ export function isMongoId(text: string): boolean;
56
56
  * @param {*} rowData - The contextual row data for the component.
57
57
  */
58
58
  export function checkCalculated(component: import('@formio/core').Component, submission: import('@formio/core').Submission, rowData: any): void;
59
- /**
60
- * Check if a simple conditional evaluates to true.
61
- * @param {import('@formio/core').Component} component - The component to check for the conditional.
62
- * @param {import('@formio/core').SimpleConditional} condition - The condition to check.
63
- * @param {*} row - The row data for the component.
64
- * @param {*} data - The full submission data.
65
- * @param {import('../../src/components/_classes/component/Component').Component} instance - The instance of the component.
66
- * @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
67
- */
68
- export function checkSimpleConditional(component: import('@formio/core').Component, condition: import('@formio/core').SimpleConditional, row: any, data: any, instance: any): boolean;
59
+ export function checkSimpleConditional(component: any, condition: any, row: any, data: any, instance: any): boolean;
69
60
  /**
70
61
  * Returns a components normalized value.
71
62
  * @param {string} compPath - The full path to the component.
@@ -190,6 +190,44 @@ exports.checkCalculated = checkCalculated;
190
190
  * @param {import('../../src/components/_classes/component/Component').Component} instance - The instance of the component.
191
191
  * @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
192
192
  */
193
+ function getConditionalPathsRecursive(conditionPaths, data) {
194
+ let currentGlobalIndex = 0;
195
+ const conditionalPathsArray = [];
196
+ const getConditionalPaths = (data, currentPath = '', localIndex = 0) => {
197
+ currentPath = currentPath.replace(/^\.+|\.+$/g, '');
198
+ const currentLocalIndex = localIndex;
199
+ const currentData = lodash_1.default.get(data, currentPath);
200
+ if (Array.isArray(currentData) && currentData.filter(Boolean).length > 0) {
201
+ if (currentData.some(element => typeof element !== 'object')) {
202
+ return;
203
+ }
204
+ const hasInnerDataArray = currentData.find(x => Array.isArray(x[conditionPaths[currentLocalIndex]]));
205
+ if (hasInnerDataArray) {
206
+ currentData.forEach((_, indexOutside) => {
207
+ const innerCompDataPath = `${currentPath}[${indexOutside}].${conditionPaths[currentLocalIndex]}`;
208
+ getConditionalPaths(data, innerCompDataPath, currentLocalIndex + 1);
209
+ });
210
+ }
211
+ else {
212
+ currentData.forEach((x, index) => {
213
+ if (!lodash_1.default.isNil(x[conditionPaths[currentLocalIndex]])) {
214
+ const compDataPath = `${currentPath}[${index}].${conditionPaths[currentLocalIndex]}`;
215
+ conditionalPathsArray.push(compDataPath);
216
+ }
217
+ });
218
+ }
219
+ }
220
+ else {
221
+ if (!conditionPaths[currentGlobalIndex]) {
222
+ return;
223
+ }
224
+ currentGlobalIndex = currentGlobalIndex + 1;
225
+ getConditionalPaths(data, `${currentPath}.${conditionPaths[currentGlobalIndex - 1]}`, currentGlobalIndex);
226
+ }
227
+ };
228
+ getConditionalPaths(data);
229
+ return conditionalPathsArray;
230
+ }
193
231
  function checkSimpleConditional(component, condition, row, data, instance) {
194
232
  if (condition.when) {
195
233
  const value = getComponentActualValue(condition.when, data, row);
@@ -211,23 +249,37 @@ function checkSimpleConditional(component, condition, row, data, instance) {
211
249
  return true;
212
250
  }
213
251
  const conditionsResult = lodash_1.default.map(conditions, (cond) => {
252
+ var _a, _b;
214
253
  const { value: comparedValue, operator, component: conditionComponentPath } = cond;
215
254
  if (!conditionComponentPath) {
216
255
  return true;
217
256
  }
218
- const value = getComponentActualValue(conditionComponentPath, data, row);
219
- const ConditionOperator = conditionOperators_1.default[operator];
220
- return ConditionOperator
221
- ? new ConditionOperator().getResult({ value, comparedValue, instance, component, conditionComponentPath })
222
- : true;
257
+ const splittedConditionPath = conditionComponentPath.split('.');
258
+ const conditionalPaths = ((_a = instance === null || instance === void 0 ? void 0 : instance.parent) === null || _a === void 0 ? void 0 : _a.type) === 'datagrid' || ((_b = instance === null || instance === void 0 ? void 0 : instance.parent) === null || _b === void 0 ? void 0 : _b.type) === 'editgrid' ? [] : getConditionalPathsRecursive(splittedConditionPath, data);
259
+ if (conditionalPaths.length > 0) {
260
+ return conditionalPaths.map((path) => {
261
+ const value = getComponentActualValue(path, data, row);
262
+ const ConditionOperator = conditionOperators_1.default[operator];
263
+ return ConditionOperator
264
+ ? new ConditionOperator().getResult({ value, comparedValue, instance, component, conditionComponentPath })
265
+ : true;
266
+ });
267
+ }
268
+ else {
269
+ const value = getComponentActualValue(conditionComponentPath, data, row);
270
+ const СonditionOperator = conditionOperators_1.default[operator];
271
+ return СonditionOperator
272
+ ? new СonditionOperator().getResult({ value, comparedValue, instance, component, conditionComponentPath })
273
+ : true;
274
+ }
223
275
  });
224
276
  let result = false;
225
277
  switch (conjunction) {
226
278
  case 'any':
227
- result = lodash_1.default.some(conditionsResult, res => !!res);
279
+ result = lodash_1.default.some(conditionsResult.flat(), res => !!res);
228
280
  break;
229
281
  default:
230
- result = lodash_1.default.every(conditionsResult, res => !!res);
282
+ result = lodash_1.default.every(conditionsResult.flat(), res => !!res);
231
283
  }
232
284
  return show ? result : !result;
233
285
  }
package/lib/mjs/CDN.d.ts CHANGED
@@ -13,6 +13,7 @@ declare class CDN {
13
13
  bootswatch: string;
14
14
  'bootstrap-icons': string;
15
15
  ckeditor: string;
16
+ dragula: string;
16
17
  flatpickr: string;
17
18
  'flatpickr-formio': string;
18
19
  'font-awesome': string;
package/lib/mjs/CDN.js CHANGED
@@ -16,6 +16,7 @@ class CDN {
16
16
  'bootswatch': '5.3.3',
17
17
  'bootstrap-icons': '1.11.1',
18
18
  'ckeditor': '19.0.0',
19
+ 'dragula': '3.7.3',
19
20
  'flatpickr': '4.6.8',
20
21
  'flatpickr-formio': '4.6.13-formio.3',
21
22
  'font-awesome': '4.7.0',
@@ -8,7 +8,10 @@ import Components from "./components/Components";
8
8
  import NestedDataComponent from "./components/_classes/nesteddata/NestedDataComponent";
9
9
  import { fastCloneDeep, currentTimezone, unescapeHTML, getStringFromComponentPath, convertStringToHTMLElement, getArrayFromComponentPath, } from "./utils/utils";
10
10
  import { eachComponent } from "./utils/formUtils";
11
- import dragula from "dragula";
11
+ // We need this here because dragula pulls in CustomEvent class that requires global to exist.
12
+ if (typeof window !== 'undefined' && typeof window.global === 'undefined') {
13
+ window.global = window;
14
+ }
12
15
  // Initialize the available forms.
13
16
  Formio.forms = {};
14
17
  // Allow people to register components.
@@ -282,7 +285,6 @@ export default class Webform extends NestedDataComponent {
282
285
  // Ensure the root is set to this component.
283
286
  this.root = this;
284
287
  this.localRoot = this;
285
- this.root.dragulaLib = dragula;
286
288
  }
287
289
  /* eslint-enable max-statements */
288
290
  get language() {
@@ -1132,7 +1134,7 @@ export default class Webform extends NestedDataComponent {
1132
1134
  });
1133
1135
  const displayedErrors = [];
1134
1136
  if (errors.length) {
1135
- errors = _.uniqBy(errors, (error) => error.message);
1137
+ errors = _.uniqBy(errors, (error) => [error.message, error.component?.id, error.context?.path].join());
1136
1138
  const createListItem = (message, index) => {
1137
1139
  const err = errors[index];
1138
1140
  const messageFromIndex = !_.isUndefined(index) && errors && errors[index];
@@ -830,6 +830,7 @@ declare class Component extends Element {
830
830
  quill: any;
831
831
  get shouldSanitizeValue(): boolean;
832
832
  addAce(element: any, settings: any, onChange: any): any;
833
+ getDragula(): Promise<any>;
833
834
  get tree(): any;
834
835
  /**
835
836
  * The empty value for this component.
@@ -2351,6 +2351,13 @@ export default class Component extends Element {
2351
2351
  return editor;
2352
2352
  });
2353
2353
  }
2354
+ async getDragula() {
2355
+ return new Promise((resolve) => {
2356
+ return Formio.requireLibrary('dragula', 'dragula', `${Formio.cdn.dragula}/dragula.js`, true, (ready) => {
2357
+ return ready.then(resolve);
2358
+ });
2359
+ });
2360
+ }
2354
2361
  get tree() {
2355
2362
  return this.component.tree || false;
2356
2363
  }
@@ -211,11 +211,12 @@ export default class NestedComponent extends Field {
211
211
  calculateValue(data: any, flags: any, row: any): any;
212
212
  isLastPage(): boolean;
213
213
  isValid(data: any, dirty: any): any;
214
- validationProcessor({ scope, data, row, instance }: {
214
+ validationProcessor({ scope, data, row, instance, component }: {
215
215
  scope: any;
216
216
  data: any;
217
217
  row: any;
218
218
  instance: any;
219
+ component: any;
219
220
  }, flags: any): void;
220
221
  /**
221
222
  * Perform a validation on all child components of this nested component.