@formio/js 5.0.0-dev.5695.024ad9c → 5.0.0-dev.5704.492ccdf
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.builder.css +0 -1
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.form.css +0 -1
- package/dist/formio.form.js +60 -20
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.css +0 -1
- package/dist/formio.full.js +40 -20
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +57 -17
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/Webform.js +7 -0
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/checkbox/fixtures/comp6.d.ts +32 -0
- package/lib/cjs/components/checkbox/fixtures/comp6.js +30 -0
- package/lib/cjs/components/checkbox/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/checkbox/fixtures/index.js +3 -1
- package/lib/cjs/components/datagrid/fixtures/comp10.d.ts +81 -0
- package/lib/cjs/components/datagrid/fixtures/comp10.js +87 -0
- package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
- package/lib/cjs/components/day/fixtures/comp8.d.ts +41 -0
- package/lib/cjs/components/day/fixtures/comp8.js +40 -0
- package/lib/cjs/components/day/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/day/fixtures/index.js +3 -1
- package/lib/cjs/translations/en.d.ts +3 -0
- package/lib/cjs/translations/en.js +4 -1
- package/lib/cjs/utils/conditionOperators/IsEmptyValue.js +4 -3
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
- package/lib/cjs/utils/utils.d.ts +1 -10
- package/lib/cjs/utils/utils.js +59 -7
- package/lib/mjs/Webform.js +7 -0
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.js +1 -1
- package/lib/mjs/components/checkbox/fixtures/comp6.d.ts +32 -0
- package/lib/mjs/components/checkbox/fixtures/comp6.js +28 -0
- package/lib/mjs/components/checkbox/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/checkbox/fixtures/index.js +2 -1
- package/lib/mjs/components/datagrid/fixtures/comp10.d.ts +81 -0
- package/lib/mjs/components/datagrid/fixtures/comp10.js +85 -0
- package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
- package/lib/mjs/components/day/fixtures/comp8.d.ts +41 -0
- package/lib/mjs/components/day/fixtures/comp8.js +38 -0
- package/lib/mjs/components/day/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/day/fixtures/index.js +2 -1
- package/lib/mjs/translations/en.d.ts +3 -0
- package/lib/mjs/translations/en.js +4 -1
- package/lib/mjs/utils/conditionOperators/IsEmptyValue.js +3 -3
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
- package/lib/mjs/utils/utils.d.ts +1 -10
- package/lib/mjs/utils/utils.js +58 -7
- package/package.json +2 -2
package/lib/cjs/Webform.js
CHANGED
|
@@ -13,6 +13,10 @@ const Components_1 = __importDefault(require("./components/Components"));
|
|
|
13
13
|
const NestedDataComponent_1 = __importDefault(require("./components/_classes/nesteddata/NestedDataComponent"));
|
|
14
14
|
const utils_1 = require("./utils/utils");
|
|
15
15
|
const formUtils_1 = require("./utils/formUtils");
|
|
16
|
+
// We need this here because dragula pulls in CustomEvent class that requires global to exist.
|
|
17
|
+
if (typeof window !== 'undefined' && typeof window.global === 'undefined') {
|
|
18
|
+
window.global = window;
|
|
19
|
+
}
|
|
16
20
|
const dragula_1 = __importDefault(require("dragula"));
|
|
17
21
|
// Initialize the available forms.
|
|
18
22
|
Formio_1.Formio.forms = {};
|
|
@@ -845,6 +849,9 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
845
849
|
return changed;
|
|
846
850
|
}
|
|
847
851
|
getValue() {
|
|
852
|
+
if (!this._submission) {
|
|
853
|
+
this._submission = {};
|
|
854
|
+
}
|
|
848
855
|
if (!this._submission.data) {
|
|
849
856
|
this._submission.data = {};
|
|
850
857
|
}
|
|
@@ -43,7 +43,7 @@ export default class CheckBoxComponent extends Field {
|
|
|
43
43
|
attach(element: any): Promise<void>;
|
|
44
44
|
input: any;
|
|
45
45
|
detach(element: any): void;
|
|
46
|
-
get emptyValue(): false |
|
|
46
|
+
get emptyValue(): false | "";
|
|
47
47
|
getValueAt(index: any): any;
|
|
48
48
|
get checked(): boolean;
|
|
49
49
|
setCheckedState(value: any): any;
|
|
@@ -117,7 +117,7 @@ class CheckBoxComponent extends Field_1.default {
|
|
|
117
117
|
super.detach();
|
|
118
118
|
}
|
|
119
119
|
get emptyValue() {
|
|
120
|
-
return this.component.inputType === 'radio' ?
|
|
120
|
+
return this.component.inputType === 'radio' ? '' : false;
|
|
121
121
|
}
|
|
122
122
|
isEmpty(value = this.dataValue) {
|
|
123
123
|
return super.isEmpty(value) || value === false;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let name: string;
|
|
3
|
+
let path: string;
|
|
4
|
+
let type: string;
|
|
5
|
+
let display: string;
|
|
6
|
+
let components: ({
|
|
7
|
+
label: string;
|
|
8
|
+
inputType: string;
|
|
9
|
+
tableView: boolean;
|
|
10
|
+
defaultValue: boolean;
|
|
11
|
+
key: string;
|
|
12
|
+
type: string;
|
|
13
|
+
name: string;
|
|
14
|
+
value: string;
|
|
15
|
+
input: boolean;
|
|
16
|
+
'some name': boolean;
|
|
17
|
+
disableOnInvalid?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
type: string;
|
|
20
|
+
label: string;
|
|
21
|
+
key: string;
|
|
22
|
+
disableOnInvalid: boolean;
|
|
23
|
+
input: boolean;
|
|
24
|
+
tableView: boolean;
|
|
25
|
+
inputType?: undefined;
|
|
26
|
+
defaultValue?: undefined;
|
|
27
|
+
name?: undefined;
|
|
28
|
+
value?: undefined;
|
|
29
|
+
'some name'?: undefined;
|
|
30
|
+
})[];
|
|
31
|
+
}
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
name: 'ckeckbox',
|
|
5
|
+
path: 'ckeckbox',
|
|
6
|
+
type: 'form',
|
|
7
|
+
display: 'form',
|
|
8
|
+
components: [
|
|
9
|
+
{
|
|
10
|
+
label: 'Checkbox',
|
|
11
|
+
inputType: 'radio',
|
|
12
|
+
tableView: false,
|
|
13
|
+
defaultValue: false,
|
|
14
|
+
key: 'checkbox',
|
|
15
|
+
type: 'checkbox',
|
|
16
|
+
name: 'some name',
|
|
17
|
+
value: 'ok',
|
|
18
|
+
input: true,
|
|
19
|
+
'some name': false
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: 'button',
|
|
23
|
+
label: 'Submit',
|
|
24
|
+
key: 'submit',
|
|
25
|
+
disableOnInvalid: true,
|
|
26
|
+
input: true,
|
|
27
|
+
tableView: false
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
};
|
|
@@ -3,5 +3,6 @@ import comp2 from './comp2';
|
|
|
3
3
|
import comp3 from './comp3';
|
|
4
4
|
import comp4 from './comp4';
|
|
5
5
|
import comp5 from './comp5';
|
|
6
|
+
import comp6 from './comp6';
|
|
6
7
|
import customDefaultComponent from './customDefaultComponent';
|
|
7
|
-
export { comp1, comp2, comp3, comp4, comp5, customDefaultComponent };
|
|
8
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, customDefaultComponent };
|
|
@@ -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.customDefaultComponent = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
6
|
+
exports.customDefaultComponent = 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 customDefaultComponent_1 = __importDefault(require("./customDefaultComponent"));
|
|
@@ -16,3 +16,5 @@ const comp4_1 = __importDefault(require("./comp4"));
|
|
|
16
16
|
exports.comp4 = comp4_1.default;
|
|
17
17
|
const comp5_1 = __importDefault(require("./comp5"));
|
|
18
18
|
exports.comp5 = comp5_1.default;
|
|
19
|
+
const comp6_1 = __importDefault(require("./comp6"));
|
|
20
|
+
exports.comp6 = comp6_1.default;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let title: string;
|
|
3
|
+
let name: string;
|
|
4
|
+
let path: string;
|
|
5
|
+
let type: string;
|
|
6
|
+
let display: string;
|
|
7
|
+
let components: ({
|
|
8
|
+
label: string;
|
|
9
|
+
reorder: boolean;
|
|
10
|
+
addAnotherPosition: string;
|
|
11
|
+
layoutFixed: boolean;
|
|
12
|
+
enableRowGroups: boolean;
|
|
13
|
+
initEmpty: boolean;
|
|
14
|
+
tableView: boolean;
|
|
15
|
+
defaultValue: {}[];
|
|
16
|
+
validate: {
|
|
17
|
+
required: boolean;
|
|
18
|
+
};
|
|
19
|
+
key: string;
|
|
20
|
+
type: string;
|
|
21
|
+
input: boolean;
|
|
22
|
+
components: {
|
|
23
|
+
label: string;
|
|
24
|
+
columns: ({
|
|
25
|
+
components: {
|
|
26
|
+
label: string;
|
|
27
|
+
applyMaskOn: string;
|
|
28
|
+
tableView: boolean;
|
|
29
|
+
key: string;
|
|
30
|
+
type: string;
|
|
31
|
+
input: boolean;
|
|
32
|
+
}[];
|
|
33
|
+
width: number;
|
|
34
|
+
offset: number;
|
|
35
|
+
push: number;
|
|
36
|
+
pull: number;
|
|
37
|
+
size: string;
|
|
38
|
+
currentWidth: number;
|
|
39
|
+
} | {
|
|
40
|
+
components: {
|
|
41
|
+
label: string;
|
|
42
|
+
tableView: boolean;
|
|
43
|
+
key: string;
|
|
44
|
+
type: string;
|
|
45
|
+
input: boolean;
|
|
46
|
+
}[];
|
|
47
|
+
width: number;
|
|
48
|
+
offset: number;
|
|
49
|
+
push: number;
|
|
50
|
+
pull: number;
|
|
51
|
+
size: string;
|
|
52
|
+
currentWidth: number;
|
|
53
|
+
})[];
|
|
54
|
+
key: string;
|
|
55
|
+
type: string;
|
|
56
|
+
input: boolean;
|
|
57
|
+
tableView: boolean;
|
|
58
|
+
}[];
|
|
59
|
+
disableOnInvalid?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
type: string;
|
|
62
|
+
label: string;
|
|
63
|
+
key: string;
|
|
64
|
+
disableOnInvalid: boolean;
|
|
65
|
+
input: boolean;
|
|
66
|
+
tableView: boolean;
|
|
67
|
+
reorder?: undefined;
|
|
68
|
+
addAnotherPosition?: undefined;
|
|
69
|
+
layoutFixed?: undefined;
|
|
70
|
+
enableRowGroups?: undefined;
|
|
71
|
+
initEmpty?: undefined;
|
|
72
|
+
defaultValue?: undefined;
|
|
73
|
+
validate?: undefined;
|
|
74
|
+
components?: undefined;
|
|
75
|
+
})[];
|
|
76
|
+
let pdfComponents: never[];
|
|
77
|
+
namespace settings {
|
|
78
|
+
let logs: string;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export default _default;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
title: 'randomName',
|
|
5
|
+
name: 'randomName',
|
|
6
|
+
path: 'randomName',
|
|
7
|
+
type: 'form',
|
|
8
|
+
display: 'form',
|
|
9
|
+
components: [
|
|
10
|
+
{
|
|
11
|
+
label: 'Data Grid',
|
|
12
|
+
reorder: false,
|
|
13
|
+
addAnotherPosition: 'bottom',
|
|
14
|
+
layoutFixed: false,
|
|
15
|
+
enableRowGroups: false,
|
|
16
|
+
initEmpty: false,
|
|
17
|
+
tableView: false,
|
|
18
|
+
defaultValue: [
|
|
19
|
+
{}
|
|
20
|
+
],
|
|
21
|
+
validate: {
|
|
22
|
+
required: true
|
|
23
|
+
},
|
|
24
|
+
key: 'dataGrid',
|
|
25
|
+
type: 'datagrid',
|
|
26
|
+
input: true,
|
|
27
|
+
components: [
|
|
28
|
+
{
|
|
29
|
+
label: 'Columns',
|
|
30
|
+
columns: [
|
|
31
|
+
{
|
|
32
|
+
components: [
|
|
33
|
+
{
|
|
34
|
+
label: 'Text Field',
|
|
35
|
+
applyMaskOn: 'change',
|
|
36
|
+
tableView: true,
|
|
37
|
+
key: 'textField',
|
|
38
|
+
type: 'textfield',
|
|
39
|
+
input: true
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
width: 6,
|
|
43
|
+
offset: 0,
|
|
44
|
+
push: 0,
|
|
45
|
+
pull: 0,
|
|
46
|
+
size: 'md',
|
|
47
|
+
currentWidth: 6
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
components: [
|
|
51
|
+
{
|
|
52
|
+
label: 'Checkbox',
|
|
53
|
+
tableView: false,
|
|
54
|
+
key: 'checkbox',
|
|
55
|
+
type: 'checkbox',
|
|
56
|
+
input: true
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
width: 6,
|
|
60
|
+
offset: 0,
|
|
61
|
+
push: 0,
|
|
62
|
+
pull: 0,
|
|
63
|
+
size: 'md',
|
|
64
|
+
currentWidth: 6
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
key: 'columns',
|
|
68
|
+
type: 'columns',
|
|
69
|
+
input: false,
|
|
70
|
+
tableView: false
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: 'button',
|
|
76
|
+
label: 'Submit',
|
|
77
|
+
key: 'submit',
|
|
78
|
+
disableOnInvalid: true,
|
|
79
|
+
input: true,
|
|
80
|
+
tableView: false
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
pdfComponents: [],
|
|
84
|
+
settings: {
|
|
85
|
+
logs: 'true'
|
|
86
|
+
}
|
|
87
|
+
};
|
|
@@ -7,6 +7,7 @@ import comp6 from './comp6';
|
|
|
7
7
|
import comp7 from './comp7';
|
|
8
8
|
import comp8 from './comp8';
|
|
9
9
|
import comp9 from './comp9';
|
|
10
|
+
import comp10 from './comp10';
|
|
10
11
|
import withCollapsibleRowGroups from './comp-with-collapsible-groups';
|
|
11
12
|
import withConditionalFieldsAndValidations from './comp-with-conditional-components-and-validations';
|
|
12
13
|
import withDefValue from './comp-with-def-value';
|
|
@@ -17,4 +18,4 @@ import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
|
|
17
18
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
|
18
19
|
import withCheckboxes from './comp-with-checkboxes';
|
|
19
20
|
import withReorder from './comp-with-reorder';
|
|
20
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
|
21
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes, withReorder };
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.withReorder = exports.withCheckboxes = exports.twoWithAllowCalculatedOverride = exports.withAllowCalculateOverride = exports.modalWithRequiredFields = exports.withRowGroupsAndDefValue = exports.withLogic = exports.withDefValue = exports.withConditionalFieldsAndValidations = exports.withCollapsibleRowGroups = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
6
|
+
exports.withReorder = exports.withCheckboxes = exports.twoWithAllowCalculatedOverride = exports.withAllowCalculateOverride = exports.modalWithRequiredFields = exports.withRowGroupsAndDefValue = exports.withLogic = exports.withDefValue = exports.withConditionalFieldsAndValidations = exports.withCollapsibleRowGroups = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
7
7
|
const comp1_1 = __importDefault(require("./comp1"));
|
|
8
8
|
exports.comp1 = comp1_1.default;
|
|
9
9
|
const comp2_1 = __importDefault(require("./comp2"));
|
|
@@ -22,6 +22,8 @@ const comp8_1 = __importDefault(require("./comp8"));
|
|
|
22
22
|
exports.comp8 = comp8_1.default;
|
|
23
23
|
const comp9_1 = __importDefault(require("./comp9"));
|
|
24
24
|
exports.comp9 = comp9_1.default;
|
|
25
|
+
const comp10_1 = __importDefault(require("./comp10"));
|
|
26
|
+
exports.comp10 = comp10_1.default;
|
|
25
27
|
const comp_with_def_value_1 = __importDefault(require("./comp-with-def-value"));
|
|
26
28
|
exports.withDefValue = comp_with_def_value_1.default;
|
|
27
29
|
const comp_row_groups_with_def_value_1 = __importDefault(require("./comp-row-groups-with-def-value"));
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let components: ({
|
|
3
|
+
label: string;
|
|
4
|
+
hideInputLabels: boolean;
|
|
5
|
+
inputsLabelPosition: string;
|
|
6
|
+
useLocaleSettings: boolean;
|
|
7
|
+
alwaysEnabled: boolean;
|
|
8
|
+
tableView: boolean;
|
|
9
|
+
fields: {
|
|
10
|
+
day: {
|
|
11
|
+
hide: boolean;
|
|
12
|
+
required: boolean;
|
|
13
|
+
};
|
|
14
|
+
month: {
|
|
15
|
+
hide: boolean;
|
|
16
|
+
required: boolean;
|
|
17
|
+
};
|
|
18
|
+
year: {
|
|
19
|
+
hide: boolean;
|
|
20
|
+
required: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
key: string;
|
|
24
|
+
type: string;
|
|
25
|
+
input: boolean;
|
|
26
|
+
showValidations?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
label: string;
|
|
29
|
+
showValidations: boolean;
|
|
30
|
+
alwaysEnabled: boolean;
|
|
31
|
+
tableView: boolean;
|
|
32
|
+
key: string;
|
|
33
|
+
type: string;
|
|
34
|
+
input: boolean;
|
|
35
|
+
hideInputLabels?: undefined;
|
|
36
|
+
inputsLabelPosition?: undefined;
|
|
37
|
+
useLocaleSettings?: undefined;
|
|
38
|
+
fields?: undefined;
|
|
39
|
+
})[];
|
|
40
|
+
}
|
|
41
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
"components": [
|
|
5
|
+
{
|
|
6
|
+
"label": "Day - Table",
|
|
7
|
+
"hideInputLabels": false,
|
|
8
|
+
"inputsLabelPosition": "top",
|
|
9
|
+
"useLocaleSettings": false,
|
|
10
|
+
"alwaysEnabled": false,
|
|
11
|
+
"tableView": false,
|
|
12
|
+
"fields": {
|
|
13
|
+
"day": {
|
|
14
|
+
"hide": false,
|
|
15
|
+
"required": true
|
|
16
|
+
},
|
|
17
|
+
"month": {
|
|
18
|
+
"hide": false,
|
|
19
|
+
"required": true
|
|
20
|
+
},
|
|
21
|
+
"year": {
|
|
22
|
+
"hide": false,
|
|
23
|
+
"required": true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"key": "dayTable",
|
|
27
|
+
"type": "day",
|
|
28
|
+
"input": true
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"label": "Submit",
|
|
32
|
+
"showValidations": false,
|
|
33
|
+
"alwaysEnabled": false,
|
|
34
|
+
"tableView": false,
|
|
35
|
+
"key": "submit",
|
|
36
|
+
"type": "button",
|
|
37
|
+
"input": true
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
};
|
|
@@ -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;
|
|
@@ -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
|
-
|
|
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
|
-
&& ((
|
|
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
|
}
|
package/lib/cjs/utils/utils.d.ts
CHANGED
|
@@ -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.
|
package/lib/cjs/utils/utils.js
CHANGED
|
@@ -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
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
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/Webform.js
CHANGED
|
@@ -8,6 +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
|
+
// 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
|
+
}
|
|
11
15
|
import dragula from "dragula";
|
|
12
16
|
// Initialize the available forms.
|
|
13
17
|
Formio.forms = {};
|
|
@@ -849,6 +853,9 @@ export default class Webform extends NestedDataComponent {
|
|
|
849
853
|
return changed;
|
|
850
854
|
}
|
|
851
855
|
getValue() {
|
|
856
|
+
if (!this._submission) {
|
|
857
|
+
this._submission = {};
|
|
858
|
+
}
|
|
852
859
|
if (!this._submission.data) {
|
|
853
860
|
this._submission.data = {};
|
|
854
861
|
}
|
|
@@ -43,7 +43,7 @@ export default class CheckBoxComponent extends Field {
|
|
|
43
43
|
attach(element: any): Promise<void>;
|
|
44
44
|
input: any;
|
|
45
45
|
detach(element: any): void;
|
|
46
|
-
get emptyValue(): false |
|
|
46
|
+
get emptyValue(): false | "";
|
|
47
47
|
getValueAt(index: any): any;
|
|
48
48
|
get checked(): boolean;
|
|
49
49
|
setCheckedState(value: any): any;
|
|
@@ -116,7 +116,7 @@ export default class CheckBoxComponent extends Field {
|
|
|
116
116
|
super.detach();
|
|
117
117
|
}
|
|
118
118
|
get emptyValue() {
|
|
119
|
-
return this.component.inputType === 'radio' ?
|
|
119
|
+
return this.component.inputType === 'radio' ? '' : false;
|
|
120
120
|
}
|
|
121
121
|
isEmpty(value = this.dataValue) {
|
|
122
122
|
return super.isEmpty(value) || value === false;
|