@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
@@ -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,64 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
components: [
|
5
|
+
{
|
6
|
+
"label": "dateTime",
|
7
|
+
"displayInTimezone": "submission",
|
8
|
+
"format": "MM/dd/yyyy:HH:mm:ss",
|
9
|
+
"tableView": false,
|
10
|
+
"datePicker": {
|
11
|
+
"disableWeekends": false,
|
12
|
+
"disableWeekdays": false
|
13
|
+
},
|
14
|
+
"timePicker": {
|
15
|
+
"showMeridian": false
|
16
|
+
},
|
17
|
+
"enableMinDateInput": false,
|
18
|
+
"enableMaxDateInput": false,
|
19
|
+
"validateWhenHidden": false,
|
20
|
+
"key": "dateTime",
|
21
|
+
"logic": [
|
22
|
+
{
|
23
|
+
"name": "requiredLogic",
|
24
|
+
"trigger": {
|
25
|
+
"type": "javascript",
|
26
|
+
"javascript": "result = true;"
|
27
|
+
},
|
28
|
+
"actions": [
|
29
|
+
{
|
30
|
+
"name": "setRequired",
|
31
|
+
"type": "property",
|
32
|
+
"property": {
|
33
|
+
"label": "Required",
|
34
|
+
"value": "validate.required",
|
35
|
+
"type": "boolean"
|
36
|
+
},
|
37
|
+
"state": true
|
38
|
+
}
|
39
|
+
]
|
40
|
+
}
|
41
|
+
],
|
42
|
+
"type": "datetime",
|
43
|
+
"input": true,
|
44
|
+
"widget": {
|
45
|
+
"type": "calendar",
|
46
|
+
"displayInTimezone": "submission",
|
47
|
+
"locale": "en",
|
48
|
+
"useLocaleSettings": false,
|
49
|
+
"allowInput": true,
|
50
|
+
"mode": "single",
|
51
|
+
"enableTime": true,
|
52
|
+
"noCalendar": false,
|
53
|
+
"format": "MM/dd/yyyy:HH:mm:ss",
|
54
|
+
"hourIncrement": 1,
|
55
|
+
"minuteIncrement": 1,
|
56
|
+
"time_24hr": true,
|
57
|
+
"minDate": null,
|
58
|
+
"disableWeekends": false,
|
59
|
+
"disableWeekdays": false,
|
60
|
+
"maxDate": null
|
61
|
+
}
|
62
|
+
}
|
63
|
+
]
|
64
|
+
};
|
@@ -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);
|
@@ -7,6 +7,7 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
8
8
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
9
9
|
const utils_1 = require("../../utils/utils");
|
10
|
+
const core_1 = require("@formio/core");
|
10
11
|
class DayComponent extends Field_1.default {
|
11
12
|
static schema(...extend) {
|
12
13
|
return Field_1.default.schema({
|
@@ -474,24 +475,7 @@ class DayComponent extends Field_1.default {
|
|
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 (0, core_1.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 };
|
@@ -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.
|
6
|
+
exports.compWithCustomDefaultValue = exports.withOpenWhenEmptyAndConditions = exports.compOpenWhenEmpty = exports.comp20 = exports.comp19 = exports.comp18 = 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.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"));
|
@@ -36,8 +36,6 @@ const comp15_1 = __importDefault(require("./comp15"));
|
|
36
36
|
exports.comp15 = comp15_1.default;
|
37
37
|
const comp16_1 = __importDefault(require("./comp16"));
|
38
38
|
exports.comp16 = comp16_1.default;
|
39
|
-
const comp17_1 = __importDefault(require("./comp17"));
|
40
|
-
exports.comp17 = comp17_1.default;
|
41
39
|
const comp18_1 = __importDefault(require("./comp18"));
|
42
40
|
exports.comp18 = comp18_1.default;
|
43
41
|
const comp19_1 = __importDefault(require("./comp19"));
|
@@ -50,5 +48,3 @@ const comp_openWhenEmpty_1 = __importDefault(require("./comp-openWhenEmpty"));
|
|
50
48
|
exports.compOpenWhenEmpty = comp_openWhenEmpty_1.default;
|
51
49
|
const comp_with_custom_default_value_1 = __importDefault(require("./comp-with-custom-default-value"));
|
52
50
|
exports.compWithCustomDefaultValue = comp_with_custom_default_value_1.default;
|
53
|
-
const comp_test_events_1 = __importDefault(require("./comp-test-events"));
|
54
|
-
exports.compTestEvents = comp_test_events_1.default;
|
@@ -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;
|
@@ -144,6 +144,8 @@ class FormComponent extends Component_1.default {
|
|
144
144
|
options.events = this.createEmitter();
|
145
145
|
// Make sure to not show the submit button in wizards in the nested forms.
|
146
146
|
lodash_1.default.set(options, 'buttonSettings.showSubmit', false);
|
147
|
+
// Set the parent option to the subform so those references are stable when the subform is created
|
148
|
+
options.parent = this;
|
147
149
|
if (!this.options) {
|
148
150
|
return options;
|
149
151
|
}
|
@@ -330,6 +332,10 @@ class FormComponent extends Component_1.default {
|
|
330
332
|
&& lodash_1.default.isNumber(this.formObj._vid)
|
331
333
|
&& this.formObj._vid !== this.subFormRevision;
|
332
334
|
}
|
335
|
+
get subFormData() {
|
336
|
+
var _a;
|
337
|
+
return ((_a = this.dataValue) === null || _a === void 0 ? void 0 : _a.data) || {};
|
338
|
+
}
|
333
339
|
destroy(all = false) {
|
334
340
|
if (this.subForm) {
|
335
341
|
this.subForm.destroy(all);
|
@@ -374,10 +380,11 @@ class FormComponent extends Component_1.default {
|
|
374
380
|
/**
|
375
381
|
* Create a subform instance.
|
376
382
|
* @param {boolean} [fromAttach] - This function is being called from an `attach` method.
|
383
|
+
* @param {boolean} [beforeSubmit] - This function is being called from a `beforeSubmit` method.
|
377
384
|
* @returns {*} - The subform instance.
|
378
385
|
*/
|
379
|
-
createSubForm(fromAttach) {
|
380
|
-
this.subFormReady = this.loadSubForm(fromAttach).then((form) => {
|
386
|
+
createSubForm(fromAttach, beforeSubmit) {
|
387
|
+
this.subFormReady = this.loadSubForm(fromAttach, beforeSubmit).then((form) => {
|
381
388
|
if (!form) {
|
382
389
|
return;
|
383
390
|
}
|
@@ -393,12 +400,11 @@ class FormComponent extends Component_1.default {
|
|
393
400
|
return (new Form_1.default(form, this.getSubOptions())).ready.then((instance) => {
|
394
401
|
this.subForm = instance;
|
395
402
|
this.subForm.currentForm = this;
|
403
|
+
this.subForm.parentVisible = this.visible;
|
396
404
|
const componentsMap = this.componentsMap;
|
397
405
|
const formComponentsMap = this.subForm.componentsMap;
|
398
406
|
lodash_1.default.assign(componentsMap, formComponentsMap);
|
399
407
|
this.component.components = this.subForm.components.map((comp) => comp.component);
|
400
|
-
this.subForm.parent = this;
|
401
|
-
this.subForm.parentVisible = this.visible;
|
402
408
|
this.subForm.on('change', () => {
|
403
409
|
if (this.subForm) {
|
404
410
|
this.dataValue = this.subForm.getValue();
|
@@ -435,11 +441,13 @@ class FormComponent extends Component_1.default {
|
|
435
441
|
/**
|
436
442
|
* Load the subform.
|
437
443
|
* @param {boolean} fromAttach - This function is being called from an `attach` method.
|
444
|
+
* @param {boolean} beforeSubmit - This function is being called from a `beforeSubmit` method.
|
438
445
|
* @returns {Promise} - The promise that resolves when the subform is loaded.
|
439
446
|
*/
|
440
|
-
loadSubForm(fromAttach) {
|
447
|
+
loadSubForm(fromAttach, beforeSubmit) {
|
441
448
|
var _a, _b, _c, _d, _e;
|
442
|
-
|
449
|
+
const loadHiddenForm = beforeSubmit && !this.component.clearOnHide;
|
450
|
+
if (this.builderMode || (this.conditionallyHidden && !loadHiddenForm) || (this.isSubFormLazyLoad() && !fromAttach)) {
|
443
451
|
return Promise.resolve();
|
444
452
|
}
|
445
453
|
if (this.hasLoadedForm && !this.isRevisionChanged &&
|
@@ -481,14 +489,14 @@ class FormComponent extends Component_1.default {
|
|
481
489
|
return visible;
|
482
490
|
}
|
483
491
|
if (this.subForm) {
|
484
|
-
return this.subForm.checkConditions(
|
492
|
+
return this.subForm.checkConditions(this.subFormData, flags);
|
485
493
|
}
|
486
494
|
// There are few cases when subForm is not loaded when a change is triggered,
|
487
495
|
// so we need to perform checkConditions after it is ready, or some conditional fields might be hidden in View mode
|
488
496
|
else if (this.subFormReady) {
|
489
497
|
this.subFormReady.then(() => {
|
490
498
|
if (this.subForm) {
|
491
|
-
return this.subForm.checkConditions(
|
499
|
+
return this.subForm.checkConditions(this.subFormData, flags);
|
492
500
|
}
|
493
501
|
});
|
494
502
|
}
|
@@ -496,7 +504,7 @@ class FormComponent extends Component_1.default {
|
|
496
504
|
}
|
497
505
|
calculateValue(data, flags, row) {
|
498
506
|
if (this.subForm) {
|
499
|
-
return this.subForm.calculateValue(
|
507
|
+
return this.subForm.calculateValue(this.subFormData, flags);
|
500
508
|
}
|
501
509
|
return super.calculateValue(data, flags, row);
|
502
510
|
}
|
@@ -511,7 +519,7 @@ class FormComponent extends Component_1.default {
|
|
511
519
|
* @returns {*|boolean} - TRUE if the subform should be submitted, FALSE if it should not.
|
512
520
|
*/
|
513
521
|
get shouldSubmit() {
|
514
|
-
return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && !this.conditionallyHidden;
|
522
|
+
return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && (!this.conditionallyHidden || !this.component.clearOnHide);
|
515
523
|
}
|
516
524
|
/**
|
517
525
|
* Returns the data for the subform.
|
@@ -582,11 +590,23 @@ class FormComponent extends Component_1.default {
|
|
582
590
|
this.dataValue = submission;
|
583
591
|
return Promise.resolve(this.dataValue);
|
584
592
|
}
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
593
|
+
// we need to load a hidden form (when clearOnHide is disabled) in order to get and submit (if needed) its data
|
594
|
+
const loadHiddenForm = !this.subForm && !this.component.clearOnHide;
|
595
|
+
if ((this.isSubFormLazyLoad() || loadHiddenForm) && !this.subFormLoading) {
|
596
|
+
return this.createSubForm(true, true)
|
597
|
+
.then(this.submitSubForm(false))
|
598
|
+
.then(() => {
|
599
|
+
return this.dataValue;
|
600
|
+
})
|
601
|
+
.then(() => super.beforeSubmit());
|
602
|
+
}
|
603
|
+
else {
|
604
|
+
return this.submitSubForm(false)
|
605
|
+
.then(() => {
|
606
|
+
return this.dataValue;
|
607
|
+
})
|
608
|
+
.then(() => super.beforeSubmit());
|
609
|
+
}
|
590
610
|
}
|
591
611
|
isSubFormLazyLoad() {
|
592
612
|
var _a, _b;
|
@@ -11,7 +11,7 @@ exports.default = [
|
|
11
11
|
{
|
12
12
|
weight: 140,
|
13
13
|
type: 'checkbox',
|
14
|
-
label: '
|
14
|
+
label: 'Omit Value From Submission Data When Conditionally Hidden',
|
15
15
|
key: 'clearOnHide',
|
16
16
|
defaultValue: true,
|
17
17
|
tooltip: 'When a field is hidden, clear the value.',
|
@@ -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 };
|
@@ -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.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
6
|
+
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"));
|
@@ -18,3 +18,5 @@ const comp6_1 = __importDefault(require("./comp6"));
|
|
18
18
|
exports.comp6 = comp6_1.default;
|
19
19
|
const comp7_1 = __importDefault(require("./comp7"));
|
20
20
|
exports.comp7 = comp7_1.default;
|
21
|
+
const comp8_1 = __importDefault(require("./comp8"));
|
22
|
+
exports.comp8 = comp8_1.default;
|
@@ -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.
|
@@ -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.
|
6
|
+
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"));
|
@@ -16,7 +16,3 @@ const comp5_1 = __importDefault(require("./comp5"));
|
|
16
16
|
exports.comp5 = comp5_1.default;
|
17
17
|
const comp6_1 = __importDefault(require("./comp6"));
|
18
18
|
exports.comp6 = comp6_1.default;
|
19
|
-
const comp7_1 = __importDefault(require("./comp7"));
|
20
|
-
exports.comp7 = comp7_1.default;
|
21
|
-
const comp8_1 = __importDefault(require("./comp8"));
|
22
|
-
exports.comp8 = comp8_1.default;
|
@@ -102,6 +102,9 @@ class TextFieldComponent extends Input_1.default {
|
|
102
102
|
if (((_c = this.component.widget) === null || _c === void 0 ? void 0 : _c.type) === 'calendar') {
|
103
103
|
this.component.widget = Object.assign(Object.assign({}, this.component.widget), { readOnly: this.options.readOnly, timezone,
|
104
104
|
displayInTimezone, locale: this.component.widget.locale || this.options.language, saveAs: 'text' });
|
105
|
+
// update originalComponent to include widget settings after component initialization
|
106
|
+
// originalComponent is used to restore the component (and widget) after evaluating field logic
|
107
|
+
this.originalComponent = FormioUtils.fastCloneDeep(this.component);
|
105
108
|
}
|
106
109
|
}
|
107
110
|
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 };
|
@@ -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.withDisplayAndInputMasks = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
6
|
+
exports.requiredFieldLogicComp = exports.withDisplayAndInputMasks = 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"));
|
@@ -20,3 +20,5 @@ const comp_with_display_and_value_masks_1 = __importDefault(require("./comp-with
|
|
20
20
|
exports.withDisplayAndInputMasks = comp_with_display_and_value_masks_1.default;
|
21
21
|
const comp7_1 = __importDefault(require("./comp7"));
|
22
22
|
exports.comp7 = comp7_1.default;
|
23
|
+
const requiredFieldLogicComp_1 = __importDefault(require("./requiredFieldLogicComp"));
|
24
|
+
exports.requiredFieldLogicComp = requiredFieldLogicComp_1.default;
|
@@ -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,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
components: [
|
5
|
+
{
|
6
|
+
"label": "Text Field",
|
7
|
+
"widget": {
|
8
|
+
"type": "calendar",
|
9
|
+
"altInput": true,
|
10
|
+
"allowInput": true,
|
11
|
+
"clickOpens": true,
|
12
|
+
"enableDate": true,
|
13
|
+
"enableTime": true,
|
14
|
+
"mode": "single",
|
15
|
+
"noCalendar": false,
|
16
|
+
"format": "MM/dd/yyyy:HH:mm:ss",
|
17
|
+
"dateFormat": "MM/dd/yyyy:HH:mm:ss",
|
18
|
+
"useLocaleSettings": false,
|
19
|
+
"hourIncrement": 1,
|
20
|
+
"minuteIncrement": 5,
|
21
|
+
"time_24hr": false,
|
22
|
+
"saveAs": "text",
|
23
|
+
"displayInTimezone": "viewer",
|
24
|
+
"locale": "en"
|
25
|
+
},
|
26
|
+
"applyMaskOn": "change",
|
27
|
+
"tableView": true,
|
28
|
+
"validateWhenHidden": false,
|
29
|
+
"key": "textField",
|
30
|
+
"logic": [
|
31
|
+
{
|
32
|
+
"name": "requiredLogic",
|
33
|
+
"trigger": {
|
34
|
+
"type": "javascript",
|
35
|
+
"javascript": "result = true;"
|
36
|
+
},
|
37
|
+
"actions": [
|
38
|
+
{
|
39
|
+
"name": "setRequired",
|
40
|
+
"type": "property",
|
41
|
+
"property": {
|
42
|
+
"label": "Required",
|
43
|
+
"value": "validate.required",
|
44
|
+
"type": "boolean"
|
45
|
+
},
|
46
|
+
"state": true
|
47
|
+
}
|
48
|
+
]
|
49
|
+
}
|
50
|
+
],
|
51
|
+
"type": "textfield",
|
52
|
+
"input": true
|
53
|
+
}
|
54
|
+
]
|
55
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
export {};
|
1
|
+
export { Formio } from "./InlineEmbed";
|
package/lib/cjs/formio.embed.js
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Formio = void 0;
|
3
4
|
const InlineEmbed_1 = require("./InlineEmbed");
|
4
5
|
(0, InlineEmbed_1.embed)();
|
6
|
+
var InlineEmbed_2 = require("./InlineEmbed");
|
7
|
+
Object.defineProperty(exports, "Formio", { enumerable: true, get: function () { return InlineEmbed_2.Formio; } });
|
@@ -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
|
/**
|