@formio/js 5.1.0-rc.2 → 5.1.0-rc.20
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.
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +27 -27
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +30 -30
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +13 -13
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +11 -11
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDFBuilder.js +2 -2
- package/lib/cjs/Webform.d.ts +2 -2
- package/lib/cjs/Webform.js +6 -3
- package/lib/cjs/WebformBuilder.d.ts +1 -0
- package/lib/cjs/WebformBuilder.js +14 -3
- package/lib/cjs/Wizard.js +2 -1
- package/lib/cjs/components/_classes/component/Component.js +8 -2
- package/lib/cjs/components/_classes/field/Field.d.ts +2 -2
- package/lib/cjs/components/_classes/field/Field.js +1 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +1 -1
- package/lib/cjs/components/_classes/nested/fixtures/comp4.d.ts +11 -1
- package/lib/cjs/components/_classes/nested/fixtures/comp4.js +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +3 -0
- package/lib/cjs/components/address/Address.d.ts +1 -2
- package/lib/cjs/components/address/Address.js +1 -1
- package/lib/cjs/components/address/fixtures/comp5.d.ts +46 -0
- package/lib/cjs/components/address/fixtures/comp5.js +87 -0
- package/lib/cjs/components/address/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/address/fixtures/index.js +3 -1
- package/lib/cjs/components/button/Button.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/columns/Columns.d.ts +1 -1
- package/lib/cjs/components/datagrid/DataGrid.d.ts +1 -1
- package/lib/cjs/components/datagrid/DataGrid.js +4 -1
- package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/cjs/components/datetime/DateTime.js +7 -3
- package/lib/cjs/components/datetime/fixtures/index.d.ts +6 -5
- package/lib/cjs/components/datetime/fixtures/index.js +3 -1
- package/lib/cjs/components/datetime/fixtures/requiredFieldLogicComp.d.ts +57 -0
- package/lib/cjs/components/datetime/fixtures/requiredFieldLogicComp.js +64 -0
- package/lib/cjs/components/day/Day.d.ts +1 -1
- package/lib/cjs/components/day/Day.js +2 -18
- package/lib/cjs/components/editgrid/fixtures/index.d.ts +1 -1
- package/lib/cjs/components/editgrid/fixtures/index.js +1 -5
- package/lib/cjs/components/file/File.d.ts +1 -1
- package/lib/cjs/components/form/Form.d.ts +5 -2
- package/lib/cjs/components/form/Form.js +35 -15
- package/lib/cjs/components/form/editForm/Form.edit.data.js +1 -1
- package/lib/cjs/components/radio/Radio.d.ts +1 -1
- package/lib/cjs/components/select/Select.d.ts +1 -1
- package/lib/cjs/components/selectboxes/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/selectboxes/fixtures/index.js +3 -1
- package/lib/cjs/components/survey/Survey.d.ts +1 -1
- package/lib/cjs/components/table/Table.d.ts +1 -1
- package/lib/cjs/components/tabs/Tabs.d.ts +1 -1
- package/lib/cjs/components/tags/fixtures/index.d.ts +1 -1
- package/lib/cjs/components/tags/fixtures/index.js +1 -5
- package/lib/cjs/components/textfield/TextField.js +3 -0
- package/lib/cjs/components/textfield/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/textfield/fixtures/index.js +3 -1
- package/lib/cjs/components/textfield/fixtures/requiredFieldLogicComp.d.ts +48 -0
- package/lib/cjs/components/textfield/fixtures/requiredFieldLogicComp.js +55 -0
- package/lib/cjs/formio.embed.d.ts +1 -1
- package/lib/cjs/formio.embed.js +3 -0
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +5 -0
- package/lib/cjs/providers/address/GoogleAddressProvider.js +23 -1
- package/lib/cjs/translations/en.js +2 -2
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/utils.d.ts +2 -1
- package/lib/cjs/utils/utils.js +3 -2
- package/lib/mjs/Embed.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDFBuilder.js +2 -2
- package/lib/mjs/Webform.d.ts +2 -2
- package/lib/mjs/Webform.js +6 -3
- package/lib/mjs/WebformBuilder.d.ts +1 -0
- package/lib/mjs/WebformBuilder.js +13 -2
- package/lib/mjs/Wizard.js +2 -1
- package/lib/mjs/components/_classes/component/Component.js +8 -2
- package/lib/mjs/components/_classes/field/Field.d.ts +2 -2
- package/lib/mjs/components/_classes/field/Field.js +1 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +1 -1
- package/lib/mjs/components/_classes/nested/fixtures/comp4.d.ts +11 -1
- package/lib/mjs/components/_classes/nested/fixtures/comp4.js +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +3 -0
- package/lib/mjs/components/address/Address.d.ts +1 -2
- package/lib/mjs/components/address/Address.js +1 -1
- package/lib/mjs/components/address/fixtures/comp5.d.ts +46 -0
- package/lib/mjs/components/address/fixtures/comp5.js +85 -0
- package/lib/mjs/components/address/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/address/fixtures/index.js +2 -1
- package/lib/mjs/components/button/Button.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/columns/Columns.d.ts +1 -1
- package/lib/mjs/components/datagrid/DataGrid.d.ts +1 -1
- package/lib/mjs/components/datagrid/DataGrid.js +4 -1
- package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/mjs/components/datetime/DateTime.js +8 -4
- package/lib/mjs/components/datetime/fixtures/index.d.ts +6 -5
- package/lib/mjs/components/datetime/fixtures/index.js +2 -1
- package/lib/mjs/components/datetime/fixtures/requiredFieldLogicComp.d.ts +57 -0
- package/lib/mjs/components/datetime/fixtures/requiredFieldLogicComp.js +62 -0
- package/lib/mjs/components/day/Day.d.ts +1 -1
- package/lib/mjs/components/day/Day.js +2 -18
- package/lib/mjs/components/editgrid/fixtures/index.d.ts +1 -1
- package/lib/mjs/components/editgrid/fixtures/index.js +1 -3
- package/lib/mjs/components/file/File.d.ts +1 -1
- package/lib/mjs/components/form/Form.d.ts +5 -2
- package/lib/mjs/components/form/Form.js +34 -15
- package/lib/mjs/components/form/editForm/Form.edit.data.js +1 -1
- package/lib/mjs/components/radio/Radio.d.ts +1 -1
- package/lib/mjs/components/select/Select.d.ts +1 -1
- package/lib/mjs/components/selectboxes/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/selectboxes/fixtures/index.js +2 -1
- package/lib/mjs/components/survey/Survey.d.ts +1 -1
- package/lib/mjs/components/table/Table.d.ts +1 -1
- package/lib/mjs/components/tabs/Tabs.d.ts +1 -1
- package/lib/mjs/components/tags/fixtures/index.d.ts +1 -1
- package/lib/mjs/components/tags/fixtures/index.js +1 -3
- package/lib/mjs/components/textfield/TextField.js +3 -0
- package/lib/mjs/components/textfield/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/textfield/fixtures/index.js +2 -1
- package/lib/mjs/components/textfield/fixtures/requiredFieldLogicComp.d.ts +48 -0
- package/lib/mjs/components/textfield/fixtures/requiredFieldLogicComp.js +53 -0
- package/lib/mjs/formio.embed.d.ts +1 -1
- package/lib/mjs/formio.embed.js +1 -0
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +5 -0
- package/lib/mjs/providers/address/GoogleAddressProvider.js +22 -1
- package/lib/mjs/translations/en.js +2 -2
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/utils.d.ts +2 -1
- package/lib/mjs/utils/utils.js +3 -2
- package/package.json +4 -4
@@ -1,8 +1,4 @@
|
|
1
1
|
import comp1 from './comp1';
|
2
|
-
import comp10 from './comp10';
|
3
|
-
import comp11 from './comp11';
|
4
|
-
import comp12 from './comp12';
|
5
|
-
import comp13 from './comp13';
|
6
2
|
import comp2 from './comp2';
|
7
3
|
import comp3 from './comp3';
|
8
4
|
import comp5 from './comp5';
|
@@ -10,4 +6,9 @@ import comp6 from './comp6';
|
|
10
6
|
import comp7 from './comp7';
|
11
7
|
import comp8 from './comp8';
|
12
8
|
import comp9 from './comp9';
|
13
|
-
|
9
|
+
import comp10 from './comp10';
|
10
|
+
import comp11 from './comp11';
|
11
|
+
import comp12 from './comp12';
|
12
|
+
import comp13 from './comp13';
|
13
|
+
import requiredFieldLogicComp from './requiredFieldLogicComp';
|
14
|
+
export { comp1, comp2, comp3, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, requiredFieldLogicComp };
|
@@ -10,4 +10,5 @@ import comp10 from './comp10';
|
|
10
10
|
import comp11 from './comp11';
|
11
11
|
import comp12 from './comp12';
|
12
12
|
import comp13 from './comp13';
|
13
|
-
|
13
|
+
import requiredFieldLogicComp from './requiredFieldLogicComp';
|
14
|
+
export { comp1, comp2, comp3, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, requiredFieldLogicComp };
|
@@ -0,0 +1,57 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
let components: {
|
3
|
+
label: string;
|
4
|
+
displayInTimezone: string;
|
5
|
+
format: string;
|
6
|
+
tableView: boolean;
|
7
|
+
datePicker: {
|
8
|
+
disableWeekends: boolean;
|
9
|
+
disableWeekdays: boolean;
|
10
|
+
};
|
11
|
+
timePicker: {
|
12
|
+
showMeridian: boolean;
|
13
|
+
};
|
14
|
+
enableMinDateInput: boolean;
|
15
|
+
enableMaxDateInput: boolean;
|
16
|
+
validateWhenHidden: boolean;
|
17
|
+
key: string;
|
18
|
+
logic: {
|
19
|
+
name: string;
|
20
|
+
trigger: {
|
21
|
+
type: string;
|
22
|
+
javascript: string;
|
23
|
+
};
|
24
|
+
actions: {
|
25
|
+
name: string;
|
26
|
+
type: string;
|
27
|
+
property: {
|
28
|
+
label: string;
|
29
|
+
value: string;
|
30
|
+
type: string;
|
31
|
+
};
|
32
|
+
state: boolean;
|
33
|
+
}[];
|
34
|
+
}[];
|
35
|
+
type: string;
|
36
|
+
input: boolean;
|
37
|
+
widget: {
|
38
|
+
type: string;
|
39
|
+
displayInTimezone: string;
|
40
|
+
locale: string;
|
41
|
+
useLocaleSettings: boolean;
|
42
|
+
allowInput: boolean;
|
43
|
+
mode: string;
|
44
|
+
enableTime: boolean;
|
45
|
+
noCalendar: boolean;
|
46
|
+
format: string;
|
47
|
+
hourIncrement: number;
|
48
|
+
minuteIncrement: number;
|
49
|
+
time_24hr: boolean;
|
50
|
+
minDate: null;
|
51
|
+
disableWeekends: boolean;
|
52
|
+
disableWeekdays: boolean;
|
53
|
+
maxDate: null;
|
54
|
+
};
|
55
|
+
}[];
|
56
|
+
}
|
57
|
+
export default _default;
|
@@ -0,0 +1,62 @@
|
|
1
|
+
export default {
|
2
|
+
components: [
|
3
|
+
{
|
4
|
+
"label": "dateTime",
|
5
|
+
"displayInTimezone": "submission",
|
6
|
+
"format": "MM/dd/yyyy:HH:mm:ss",
|
7
|
+
"tableView": false,
|
8
|
+
"datePicker": {
|
9
|
+
"disableWeekends": false,
|
10
|
+
"disableWeekdays": false
|
11
|
+
},
|
12
|
+
"timePicker": {
|
13
|
+
"showMeridian": false
|
14
|
+
},
|
15
|
+
"enableMinDateInput": false,
|
16
|
+
"enableMaxDateInput": false,
|
17
|
+
"validateWhenHidden": false,
|
18
|
+
"key": "dateTime",
|
19
|
+
"logic": [
|
20
|
+
{
|
21
|
+
"name": "requiredLogic",
|
22
|
+
"trigger": {
|
23
|
+
"type": "javascript",
|
24
|
+
"javascript": "result = true;"
|
25
|
+
},
|
26
|
+
"actions": [
|
27
|
+
{
|
28
|
+
"name": "setRequired",
|
29
|
+
"type": "property",
|
30
|
+
"property": {
|
31
|
+
"label": "Required",
|
32
|
+
"value": "validate.required",
|
33
|
+
"type": "boolean"
|
34
|
+
},
|
35
|
+
"state": true
|
36
|
+
}
|
37
|
+
]
|
38
|
+
}
|
39
|
+
],
|
40
|
+
"type": "datetime",
|
41
|
+
"input": true,
|
42
|
+
"widget": {
|
43
|
+
"type": "calendar",
|
44
|
+
"displayInTimezone": "submission",
|
45
|
+
"locale": "en",
|
46
|
+
"useLocaleSettings": false,
|
47
|
+
"allowInput": true,
|
48
|
+
"mode": "single",
|
49
|
+
"enableTime": true,
|
50
|
+
"noCalendar": false,
|
51
|
+
"format": "MM/dd/yyyy:HH:mm:ss",
|
52
|
+
"hourIncrement": 1,
|
53
|
+
"minuteIncrement": 1,
|
54
|
+
"time_24hr": true,
|
55
|
+
"minDate": null,
|
56
|
+
"disableWeekends": false,
|
57
|
+
"disableWeekdays": false,
|
58
|
+
"maxDate": null
|
59
|
+
}
|
60
|
+
}
|
61
|
+
]
|
62
|
+
};
|
@@ -85,7 +85,7 @@ export default class DayComponent extends Field {
|
|
85
85
|
}[] | undefined;
|
86
86
|
setErrorClasses(elements: any, dirty: any, hasError: any): void;
|
87
87
|
dayFirst: any;
|
88
|
-
render():
|
88
|
+
render(): string;
|
89
89
|
renderField(name: any): any;
|
90
90
|
attach(element: any): Promise<void>;
|
91
91
|
set disabled(disabled: any);
|
@@ -2,6 +2,7 @@ import _ from 'lodash';
|
|
2
2
|
import moment from 'moment';
|
3
3
|
import Field from '../_classes/field/Field';
|
4
4
|
import { boolValue, componentValueTypes, getComponentSavedTypes, getLocaleDateFormatInfo } from '../../utils/utils';
|
5
|
+
import { getDayFormat } from '@formio/core';
|
5
6
|
export default class DayComponent extends Field {
|
6
7
|
static schema(...extend) {
|
7
8
|
return Field.schema({
|
@@ -474,24 +475,7 @@ export default class DayComponent extends Field {
|
|
474
475
|
* @returns {string} - the format for the value string.
|
475
476
|
*/
|
476
477
|
get format() {
|
477
|
-
|
478
|
-
if (this.component.dayFirst && this.showDay) {
|
479
|
-
format += 'D/';
|
480
|
-
}
|
481
|
-
if (this.showMonth) {
|
482
|
-
format += 'M/';
|
483
|
-
}
|
484
|
-
if (!this.component.dayFirst && this.showDay) {
|
485
|
-
format += 'D/';
|
486
|
-
}
|
487
|
-
if (this.showYear) {
|
488
|
-
format += 'YYYY';
|
489
|
-
return format;
|
490
|
-
}
|
491
|
-
else {
|
492
|
-
// Trim off the "/" from the end of the format string.
|
493
|
-
return format.length ? format.substring(0, format.length - 1) : format;
|
494
|
-
}
|
478
|
+
return getDayFormat(this.component);
|
495
479
|
}
|
496
480
|
/**
|
497
481
|
* Return the date for this component.
|
@@ -20,4 +20,4 @@ import comp20 from './comp20';
|
|
20
20
|
import compOpenWhenEmpty from './comp-openWhenEmpty';
|
21
21
|
import withOpenWhenEmptyAndConditions from './comp-with-conditions-and-openWhenEmpty';
|
22
22
|
import compWithCustomDefaultValue from './comp-with-custom-default-value';
|
23
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16,
|
23
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp18, comp19, comp20, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue };
|
@@ -14,12 +14,10 @@ import comp13 from './comp13';
|
|
14
14
|
import comp14 from './comp14';
|
15
15
|
import comp15 from './comp15';
|
16
16
|
import comp16 from './comp16';
|
17
|
-
import comp17 from './comp17';
|
18
17
|
import comp18 from './comp18';
|
19
18
|
import comp19 from './comp19';
|
20
19
|
import comp20 from './comp20';
|
21
20
|
import withOpenWhenEmptyAndConditions from './comp-with-conditions-and-openWhenEmpty';
|
22
21
|
import compOpenWhenEmpty from './comp-openWhenEmpty';
|
23
22
|
import compWithCustomDefaultValue from './comp-with-custom-default-value';
|
24
|
-
|
25
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
|
23
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp18, comp19, comp20, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue };
|
@@ -45,7 +45,7 @@ export default class FileComponent extends Field {
|
|
45
45
|
type: number;
|
46
46
|
actions: number;
|
47
47
|
};
|
48
|
-
render():
|
48
|
+
render(): string;
|
49
49
|
getVideoStream(constraints: any): any;
|
50
50
|
stopVideoStream(videoStream: any): void;
|
51
51
|
getFrame(videoPlayer: any): Promise<any>;
|
@@ -32,6 +32,7 @@ export default class FormComponent extends Component {
|
|
32
32
|
attach(element: any): Promise<void>;
|
33
33
|
get hasLoadedForm(): any;
|
34
34
|
get isRevisionChanged(): any;
|
35
|
+
get subFormData(): any;
|
35
36
|
subFormReady: Promise<any> | null | undefined;
|
36
37
|
/**
|
37
38
|
* Pass everyComponent to subform.
|
@@ -44,16 +45,18 @@ export default class FormComponent extends Component {
|
|
44
45
|
/**
|
45
46
|
* Create a subform instance.
|
46
47
|
* @param {boolean} [fromAttach] - This function is being called from an `attach` method.
|
48
|
+
* @param {boolean} [beforeSubmit] - This function is being called from a `beforeSubmit` method.
|
47
49
|
* @returns {*} - The subform instance.
|
48
50
|
*/
|
49
|
-
createSubForm(fromAttach?: boolean | undefined): any;
|
51
|
+
createSubForm(fromAttach?: boolean | undefined, beforeSubmit?: boolean | undefined): any;
|
50
52
|
hideSubmitButton(component: any): void;
|
51
53
|
/**
|
52
54
|
* Load the subform.
|
53
55
|
* @param {boolean} fromAttach - This function is being called from an `attach` method.
|
56
|
+
* @param {boolean} beforeSubmit - This function is being called from a `beforeSubmit` method.
|
54
57
|
* @returns {Promise} - The promise that resolves when the subform is loaded.
|
55
58
|
*/
|
56
|
-
loadSubForm(fromAttach: boolean): Promise<any>;
|
59
|
+
loadSubForm(fromAttach: boolean, beforeSubmit: boolean): Promise<any>;
|
57
60
|
subFormLoading: boolean | undefined;
|
58
61
|
checkComponentConditions(data: any, flags: any, row: any): any;
|
59
62
|
calculateValue(data: any, flags: any, row: any): any;
|
@@ -138,6 +138,8 @@ export default class FormComponent extends Component {
|
|
138
138
|
options.events = this.createEmitter();
|
139
139
|
// Make sure to not show the submit button in wizards in the nested forms.
|
140
140
|
_.set(options, 'buttonSettings.showSubmit', false);
|
141
|
+
// Set the parent option to the subform so those references are stable when the subform is created
|
142
|
+
options.parent = this;
|
141
143
|
if (!this.options) {
|
142
144
|
return options;
|
143
145
|
}
|
@@ -327,6 +329,9 @@ export default class FormComponent extends Component {
|
|
327
329
|
&& _.isNumber(this.formObj._vid)
|
328
330
|
&& this.formObj._vid !== this.subFormRevision;
|
329
331
|
}
|
332
|
+
get subFormData() {
|
333
|
+
return this.dataValue?.data || {};
|
334
|
+
}
|
330
335
|
destroy(all = false) {
|
331
336
|
if (this.subForm) {
|
332
337
|
this.subForm.destroy(all);
|
@@ -370,10 +375,11 @@ export default class FormComponent extends Component {
|
|
370
375
|
/**
|
371
376
|
* Create a subform instance.
|
372
377
|
* @param {boolean} [fromAttach] - This function is being called from an `attach` method.
|
378
|
+
* @param {boolean} [beforeSubmit] - This function is being called from a `beforeSubmit` method.
|
373
379
|
* @returns {*} - The subform instance.
|
374
380
|
*/
|
375
|
-
createSubForm(fromAttach) {
|
376
|
-
this.subFormReady = this.loadSubForm(fromAttach).then((form) => {
|
381
|
+
createSubForm(fromAttach, beforeSubmit) {
|
382
|
+
this.subFormReady = this.loadSubForm(fromAttach, beforeSubmit).then((form) => {
|
377
383
|
if (!form) {
|
378
384
|
return;
|
379
385
|
}
|
@@ -389,12 +395,11 @@ export default class FormComponent extends Component {
|
|
389
395
|
return (new Form(form, this.getSubOptions())).ready.then((instance) => {
|
390
396
|
this.subForm = instance;
|
391
397
|
this.subForm.currentForm = this;
|
398
|
+
this.subForm.parentVisible = this.visible;
|
392
399
|
const componentsMap = this.componentsMap;
|
393
400
|
const formComponentsMap = this.subForm.componentsMap;
|
394
401
|
_.assign(componentsMap, formComponentsMap);
|
395
402
|
this.component.components = this.subForm.components.map((comp) => comp.component);
|
396
|
-
this.subForm.parent = this;
|
397
|
-
this.subForm.parentVisible = this.visible;
|
398
403
|
this.subForm.on('change', () => {
|
399
404
|
if (this.subForm) {
|
400
405
|
this.dataValue = this.subForm.getValue();
|
@@ -431,10 +436,12 @@ export default class FormComponent extends Component {
|
|
431
436
|
/**
|
432
437
|
* Load the subform.
|
433
438
|
* @param {boolean} fromAttach - This function is being called from an `attach` method.
|
439
|
+
* @param {boolean} beforeSubmit - This function is being called from a `beforeSubmit` method.
|
434
440
|
* @returns {Promise} - The promise that resolves when the subform is loaded.
|
435
441
|
*/
|
436
|
-
loadSubForm(fromAttach) {
|
437
|
-
|
442
|
+
loadSubForm(fromAttach, beforeSubmit) {
|
443
|
+
const loadHiddenForm = beforeSubmit && !this.component.clearOnHide;
|
444
|
+
if (this.builderMode || (this.conditionallyHidden && !loadHiddenForm) || (this.isSubFormLazyLoad() && !fromAttach)) {
|
438
445
|
return Promise.resolve();
|
439
446
|
}
|
440
447
|
if (this.hasLoadedForm && !this.isRevisionChanged &&
|
@@ -476,14 +483,14 @@ export default class FormComponent extends Component {
|
|
476
483
|
return visible;
|
477
484
|
}
|
478
485
|
if (this.subForm) {
|
479
|
-
return this.subForm.checkConditions(
|
486
|
+
return this.subForm.checkConditions(this.subFormData, flags);
|
480
487
|
}
|
481
488
|
// There are few cases when subForm is not loaded when a change is triggered,
|
482
489
|
// so we need to perform checkConditions after it is ready, or some conditional fields might be hidden in View mode
|
483
490
|
else if (this.subFormReady) {
|
484
491
|
this.subFormReady.then(() => {
|
485
492
|
if (this.subForm) {
|
486
|
-
return this.subForm.checkConditions(
|
493
|
+
return this.subForm.checkConditions(this.subFormData, flags);
|
487
494
|
}
|
488
495
|
});
|
489
496
|
}
|
@@ -491,7 +498,7 @@ export default class FormComponent extends Component {
|
|
491
498
|
}
|
492
499
|
calculateValue(data, flags, row) {
|
493
500
|
if (this.subForm) {
|
494
|
-
return this.subForm.calculateValue(
|
501
|
+
return this.subForm.calculateValue(this.subFormData, flags);
|
495
502
|
}
|
496
503
|
return super.calculateValue(data, flags, row);
|
497
504
|
}
|
@@ -506,7 +513,7 @@ export default class FormComponent extends Component {
|
|
506
513
|
* @returns {*|boolean} - TRUE if the subform should be submitted, FALSE if it should not.
|
507
514
|
*/
|
508
515
|
get shouldSubmit() {
|
509
|
-
return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && !this.conditionallyHidden;
|
516
|
+
return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && (!this.conditionallyHidden || !this.component.clearOnHide);
|
510
517
|
}
|
511
518
|
/**
|
512
519
|
* Returns the data for the subform.
|
@@ -576,11 +583,23 @@ export default class FormComponent extends Component {
|
|
576
583
|
this.dataValue = submission;
|
577
584
|
return Promise.resolve(this.dataValue);
|
578
585
|
}
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
586
|
+
// we need to load a hidden form (when clearOnHide is disabled) in order to get and submit (if needed) its data
|
587
|
+
const loadHiddenForm = !this.subForm && !this.component.clearOnHide;
|
588
|
+
if ((this.isSubFormLazyLoad() || loadHiddenForm) && !this.subFormLoading) {
|
589
|
+
return this.createSubForm(true, true)
|
590
|
+
.then(this.submitSubForm(false))
|
591
|
+
.then(() => {
|
592
|
+
return this.dataValue;
|
593
|
+
})
|
594
|
+
.then(() => super.beforeSubmit());
|
595
|
+
}
|
596
|
+
else {
|
597
|
+
return this.submitSubForm(false)
|
598
|
+
.then(() => {
|
599
|
+
return this.dataValue;
|
600
|
+
})
|
601
|
+
.then(() => super.beforeSubmit());
|
602
|
+
}
|
584
603
|
}
|
585
604
|
isSubFormLazyLoad() {
|
586
605
|
return this.root?._form?.display === 'wizard' && this.component.lazyLoad;
|
@@ -28,7 +28,7 @@ export default class RadioComponent extends ListComponent {
|
|
28
28
|
optionsLoaded: boolean | undefined;
|
29
29
|
loadedOptions: any[] | undefined;
|
30
30
|
beforeSubmit(): Promise<any>;
|
31
|
-
render():
|
31
|
+
render(): string;
|
32
32
|
attach(element: any): Promise<void>;
|
33
33
|
detach(element: any): void;
|
34
34
|
validateValueProperty(): boolean;
|
@@ -112,7 +112,7 @@ export default class SelectComponent extends ListComponent {
|
|
112
112
|
activate(): void;
|
113
113
|
setLoadingItem(addToCurrentList?: boolean): void;
|
114
114
|
get active(): boolean | undefined;
|
115
|
-
render():
|
115
|
+
render(): string;
|
116
116
|
wrapElement(element: any): any;
|
117
117
|
choicesOptions(): any;
|
118
118
|
attach(element: any): Promise<void> | undefined;
|
@@ -5,4 +5,5 @@ import comp4 from './comp4';
|
|
5
5
|
import comp5 from './comp5';
|
6
6
|
import comp6 from './comp6';
|
7
7
|
import comp7 from './comp7';
|
8
|
-
|
8
|
+
import comp8 from './comp8';
|
9
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
|
@@ -5,4 +5,5 @@ import comp4 from './comp4';
|
|
5
5
|
import comp5 from './comp5';
|
6
6
|
import comp6 from './comp6';
|
7
7
|
import comp7 from './comp7';
|
8
|
-
|
8
|
+
import comp8 from './comp8';
|
9
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
|
@@ -14,7 +14,7 @@ export default class SurveyComponent extends Field {
|
|
14
14
|
operators: string[];
|
15
15
|
};
|
16
16
|
static savedValueTypes(schema: any): string[];
|
17
|
-
render():
|
17
|
+
render(): string;
|
18
18
|
attach(element: any): Promise<void>;
|
19
19
|
setValue(value: any, flags?: {}): boolean;
|
20
20
|
get emptyValue(): {};
|
@@ -19,6 +19,6 @@ export default class TableComponent extends NestedComponent {
|
|
19
19
|
get colWidth(): string;
|
20
20
|
noField: boolean;
|
21
21
|
table: any[] | undefined;
|
22
|
-
render():
|
22
|
+
render(): string;
|
23
23
|
}
|
24
24
|
import NestedComponent from '../_classes/nested/NestedComponent';
|
@@ -16,7 +16,7 @@ export default class TabsComponent extends NestedComponent {
|
|
16
16
|
currentTab: number;
|
17
17
|
noField: boolean;
|
18
18
|
tabs: any[] | undefined;
|
19
|
-
render():
|
19
|
+
render(): string;
|
20
20
|
detach(all: any): void;
|
21
21
|
/**
|
22
22
|
* Set the current tab.
|
@@ -4,6 +4,4 @@ import comp3 from './comp3';
|
|
4
4
|
import comp4 from './comp4';
|
5
5
|
import comp5 from './comp5';
|
6
6
|
import comp6 from './comp6';
|
7
|
-
|
8
|
-
import comp8 from './comp8';
|
9
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
|
7
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6 };
|
@@ -86,6 +86,9 @@ export default class TextFieldComponent extends Input {
|
|
86
86
|
locale: this.component.widget.locale || this.options.language,
|
87
87
|
saveAs: 'text'
|
88
88
|
};
|
89
|
+
// update originalComponent to include widget settings after component initialization
|
90
|
+
// originalComponent is used to restore the component (and widget) after evaluating field logic
|
91
|
+
this.originalComponent = FormioUtils.fastCloneDeep(this.component);
|
89
92
|
}
|
90
93
|
}
|
91
94
|
attach(element) {
|
@@ -6,4 +6,5 @@ import comp5 from './comp5';
|
|
6
6
|
import comp6 from './comp6';
|
7
7
|
import comp7 from './comp7';
|
8
8
|
import withDisplayAndInputMasks from './comp-with-display-and-value-masks';
|
9
|
-
|
9
|
+
import requiredFieldLogicComp from './requiredFieldLogicComp';
|
10
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, withDisplayAndInputMasks, requiredFieldLogicComp };
|
@@ -6,4 +6,5 @@ import comp5 from './comp5';
|
|
6
6
|
import comp6 from './comp6';
|
7
7
|
import withDisplayAndInputMasks from './comp-with-display-and-value-masks';
|
8
8
|
import comp7 from './comp7';
|
9
|
-
|
9
|
+
import requiredFieldLogicComp from './requiredFieldLogicComp';
|
10
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, withDisplayAndInputMasks, requiredFieldLogicComp };
|
@@ -0,0 +1,48 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
let components: {
|
3
|
+
label: string;
|
4
|
+
widget: {
|
5
|
+
type: string;
|
6
|
+
altInput: boolean;
|
7
|
+
allowInput: boolean;
|
8
|
+
clickOpens: boolean;
|
9
|
+
enableDate: boolean;
|
10
|
+
enableTime: boolean;
|
11
|
+
mode: string;
|
12
|
+
noCalendar: boolean;
|
13
|
+
format: string;
|
14
|
+
dateFormat: string;
|
15
|
+
useLocaleSettings: boolean;
|
16
|
+
hourIncrement: number;
|
17
|
+
minuteIncrement: number;
|
18
|
+
time_24hr: boolean;
|
19
|
+
saveAs: string;
|
20
|
+
displayInTimezone: string;
|
21
|
+
locale: string;
|
22
|
+
};
|
23
|
+
applyMaskOn: string;
|
24
|
+
tableView: boolean;
|
25
|
+
validateWhenHidden: boolean;
|
26
|
+
key: string;
|
27
|
+
logic: {
|
28
|
+
name: string;
|
29
|
+
trigger: {
|
30
|
+
type: string;
|
31
|
+
javascript: string;
|
32
|
+
};
|
33
|
+
actions: {
|
34
|
+
name: string;
|
35
|
+
type: string;
|
36
|
+
property: {
|
37
|
+
label: string;
|
38
|
+
value: string;
|
39
|
+
type: string;
|
40
|
+
};
|
41
|
+
state: boolean;
|
42
|
+
}[];
|
43
|
+
}[];
|
44
|
+
type: string;
|
45
|
+
input: boolean;
|
46
|
+
}[];
|
47
|
+
}
|
48
|
+
export default _default;
|
@@ -0,0 +1,53 @@
|
|
1
|
+
export default {
|
2
|
+
components: [
|
3
|
+
{
|
4
|
+
"label": "Text Field",
|
5
|
+
"widget": {
|
6
|
+
"type": "calendar",
|
7
|
+
"altInput": true,
|
8
|
+
"allowInput": true,
|
9
|
+
"clickOpens": true,
|
10
|
+
"enableDate": true,
|
11
|
+
"enableTime": true,
|
12
|
+
"mode": "single",
|
13
|
+
"noCalendar": false,
|
14
|
+
"format": "MM/dd/yyyy:HH:mm:ss",
|
15
|
+
"dateFormat": "MM/dd/yyyy:HH:mm:ss",
|
16
|
+
"useLocaleSettings": false,
|
17
|
+
"hourIncrement": 1,
|
18
|
+
"minuteIncrement": 5,
|
19
|
+
"time_24hr": false,
|
20
|
+
"saveAs": "text",
|
21
|
+
"displayInTimezone": "viewer",
|
22
|
+
"locale": "en"
|
23
|
+
},
|
24
|
+
"applyMaskOn": "change",
|
25
|
+
"tableView": true,
|
26
|
+
"validateWhenHidden": false,
|
27
|
+
"key": "textField",
|
28
|
+
"logic": [
|
29
|
+
{
|
30
|
+
"name": "requiredLogic",
|
31
|
+
"trigger": {
|
32
|
+
"type": "javascript",
|
33
|
+
"javascript": "result = true;"
|
34
|
+
},
|
35
|
+
"actions": [
|
36
|
+
{
|
37
|
+
"name": "setRequired",
|
38
|
+
"type": "property",
|
39
|
+
"property": {
|
40
|
+
"label": "Required",
|
41
|
+
"value": "validate.required",
|
42
|
+
"type": "boolean"
|
43
|
+
},
|
44
|
+
"state": true
|
45
|
+
}
|
46
|
+
]
|
47
|
+
}
|
48
|
+
],
|
49
|
+
"type": "textfield",
|
50
|
+
"input": true
|
51
|
+
}
|
52
|
+
]
|
53
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
export {};
|
1
|
+
export { Formio } from "./InlineEmbed";
|
package/lib/mjs/formio.embed.js
CHANGED
@@ -82,6 +82,11 @@ export class GoogleAddressProvider extends AddressProvider {
|
|
82
82
|
search(): Promise<void>;
|
83
83
|
makeRequest(): Promise<void>;
|
84
84
|
getDisplayValue(address: any): any;
|
85
|
+
/**
|
86
|
+
* Tries to remove the library if api key for loaded script is different.
|
87
|
+
* @param {ProviderOptions} options - The options for the provider.
|
88
|
+
*/
|
89
|
+
tryRemoveLibrary(options?: ProviderOptions): void;
|
85
90
|
}
|
86
91
|
export type AutocompleteOptions = {
|
87
92
|
/**
|