@formio/js 5.0.0-dev.5642.f9208f7 → 5.0.0-dev.5643.17b8168
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/Changelog.md +6 -0
- package/dist/formio.form.js +4 -4
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +5 -5
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/WebformBuilder.js +8 -2
- package/lib/cjs/components/_classes/component/Component.js +1 -1
- package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
- package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.js +36 -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/file/File.js +1 -1
- package/lib/cjs/components/form/Form.js +4 -4
- package/lib/cjs/components/radio/Radio.js +3 -2
- package/lib/mjs/WebformBuilder.js +8 -2
- package/lib/mjs/components/_classes/component/Component.js +1 -1
- package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
- package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.js +34 -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/file/File.js +1 -1
- package/lib/mjs/components/form/Form.js +2 -2
- package/lib/mjs/components/radio/Radio.js +3 -2
- package/package.json +1 -1
|
@@ -986,8 +986,14 @@ class WebformBuilder extends Component_1.default {
|
|
|
986
986
|
else if (parent.formioComponent && parent.formioComponent.removeChildComponent) {
|
|
987
987
|
parent.formioComponent.removeChildComponent(component);
|
|
988
988
|
}
|
|
989
|
-
if (component.input && componentInstance &&
|
|
990
|
-
lodash_1.default.
|
|
989
|
+
if (component.input && componentInstance && parent.formioComponent) {
|
|
990
|
+
const parentDefaultValue = lodash_1.default.get(parent.formioComponent, 'component.defaultValue', null);
|
|
991
|
+
if (Array.isArray(parentDefaultValue)) {
|
|
992
|
+
parentDefaultValue.forEach(v => lodash_1.default.unset(v, componentInstance.key));
|
|
993
|
+
}
|
|
994
|
+
else if (typeof parentDefaultValue === 'object') {
|
|
995
|
+
lodash_1.default.unset(parentDefaultValue, componentInstance.key);
|
|
996
|
+
}
|
|
991
997
|
}
|
|
992
998
|
const rebuild = parent.formioComponent.rebuild() || Promise.resolve();
|
|
993
999
|
rebuild.then(() => {
|
|
@@ -2559,7 +2559,7 @@ class Component extends Element_1.default {
|
|
|
2559
2559
|
}
|
|
2560
2560
|
this.calculatedValue = (0, utils_1.fastCloneDeep)(calculatedValue);
|
|
2561
2561
|
if (changed) {
|
|
2562
|
-
if (!flags.noPristineChangeOnModified) {
|
|
2562
|
+
if (!flags.noPristineChangeOnModified && this.root.initialized) {
|
|
2563
2563
|
this.pristine = false;
|
|
2564
2564
|
}
|
|
2565
2565
|
flags.triggeredComponentId = this.id;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let label: string;
|
|
3
|
+
let reorder: boolean;
|
|
4
|
+
let addAnotherPosition: string;
|
|
5
|
+
let layoutFixed: boolean;
|
|
6
|
+
let enableRowGroups: boolean;
|
|
7
|
+
let initEmpty: boolean;
|
|
8
|
+
let tableView: boolean;
|
|
9
|
+
let defaultValue: {}[];
|
|
10
|
+
let key: string;
|
|
11
|
+
let type: string;
|
|
12
|
+
let input: boolean;
|
|
13
|
+
let components: {
|
|
14
|
+
label: string;
|
|
15
|
+
optionsLabelPosition: string;
|
|
16
|
+
inline: boolean;
|
|
17
|
+
tableView: boolean;
|
|
18
|
+
values: {
|
|
19
|
+
label: string;
|
|
20
|
+
value: string;
|
|
21
|
+
shortcut: string;
|
|
22
|
+
}[];
|
|
23
|
+
key: string;
|
|
24
|
+
type: string;
|
|
25
|
+
input: boolean;
|
|
26
|
+
inputType: string;
|
|
27
|
+
}[];
|
|
28
|
+
}
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
'label': 'Data Grid',
|
|
5
|
+
'reorder': false,
|
|
6
|
+
'addAnotherPosition': 'bottom',
|
|
7
|
+
'layoutFixed': false,
|
|
8
|
+
'enableRowGroups': false,
|
|
9
|
+
'initEmpty': false,
|
|
10
|
+
'tableView': false,
|
|
11
|
+
'defaultValue': [
|
|
12
|
+
{}
|
|
13
|
+
],
|
|
14
|
+
'key': 'dataGrid',
|
|
15
|
+
'type': 'datagrid',
|
|
16
|
+
'input': true,
|
|
17
|
+
'components': [
|
|
18
|
+
{
|
|
19
|
+
'label': 'Radio',
|
|
20
|
+
'optionsLabelPosition': 'right',
|
|
21
|
+
'inline': false,
|
|
22
|
+
'tableView': false,
|
|
23
|
+
'values': [
|
|
24
|
+
{
|
|
25
|
+
'label': 'yes',
|
|
26
|
+
'value': 'yes',
|
|
27
|
+
'shortcut': ''
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
'key': 'radio',
|
|
31
|
+
'type': 'radio',
|
|
32
|
+
'input': true,
|
|
33
|
+
'inputType': 'checkbox'
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
};
|
|
@@ -14,4 +14,5 @@ import withRowGroupsAndDefValue from './comp-row-groups-with-def-value';
|
|
|
14
14
|
import modalWithRequiredFields from './comp-modal-with-required-fields';
|
|
15
15
|
import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
|
16
16
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
|
17
|
-
|
|
17
|
+
import withCheckboxes from './comp-with-checkboxes';
|
|
18
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes };
|
|
@@ -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.twoWithAllowCalculatedOverride = exports.withAllowCalculateOverride = exports.modalWithRequiredFields = exports.withRowGroupsAndDefValue = exports.withLogic = exports.withDefValue = exports.withConditionalFieldsAndValidations = exports.withCollapsibleRowGroups = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
6
|
+
exports.withCheckboxes = exports.twoWithAllowCalculatedOverride = exports.withAllowCalculateOverride = exports.modalWithRequiredFields = exports.withRowGroupsAndDefValue = exports.withLogic = exports.withDefValue = exports.withConditionalFieldsAndValidations = exports.withCollapsibleRowGroups = 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,3 +36,5 @@ const comp_with_allow_calculate_override_1 = __importDefault(require("./comp-wit
|
|
|
36
36
|
exports.withAllowCalculateOverride = comp_with_allow_calculate_override_1.default;
|
|
37
37
|
const two_comp_with_allow_calculate_override_1 = __importDefault(require("./two-comp-with-allow-calculate-override"));
|
|
38
38
|
exports.twoWithAllowCalculatedOverride = two_comp_with_allow_calculate_override_1.default;
|
|
39
|
+
const comp_with_checkboxes_1 = __importDefault(require("./comp-with-checkboxes"));
|
|
40
|
+
exports.withCheckboxes = comp_with_checkboxes_1.default;
|
|
@@ -652,7 +652,7 @@ class FileComponent extends Field_1.default {
|
|
|
652
652
|
// Check if file with the same name is being uploaded
|
|
653
653
|
const fileWithSameNameUploading = this.filesToSync.filesToUpload
|
|
654
654
|
.some(fileToSync => { var _a; return ((_a = fileToSync.file) === null || _a === void 0 ? void 0 : _a.name) === file.name; });
|
|
655
|
-
const fileWithSameNameUploaded = this.dataValue
|
|
655
|
+
const fileWithSameNameUploaded = this.dataValue
|
|
656
656
|
.some(fileStatus => fileStatus.originalName === file.name);
|
|
657
657
|
return fileWithSameNameUploaded || fileWithSameNameUploading
|
|
658
658
|
? {
|
|
@@ -431,7 +431,7 @@ class FormComponent extends Component_1.default {
|
|
|
431
431
|
* Load the subform.
|
|
432
432
|
*/
|
|
433
433
|
loadSubForm(fromAttach) {
|
|
434
|
-
var _a, _b, _c;
|
|
434
|
+
var _a, _b, _c, _d, _e;
|
|
435
435
|
if (this.builderMode || this.isHidden() || (this.isSubFormLazyLoad() && !fromAttach)) {
|
|
436
436
|
return Promise.resolve();
|
|
437
437
|
}
|
|
@@ -445,7 +445,7 @@ class FormComponent extends Component_1.default {
|
|
|
445
445
|
}
|
|
446
446
|
else if (this.formSrc) {
|
|
447
447
|
this.subFormLoading = true;
|
|
448
|
-
const options = ((_b = this.root
|
|
448
|
+
const options = ((_c = (_b = this.root) === null || _b === void 0 ? void 0 : _b.formio) === null || _c === void 0 ? void 0 : _c.base) && ((_e = (_d = this.root) === null || _d === void 0 ? void 0 : _d.formio) === null || _e === void 0 ? void 0 : _e.projectUrl)
|
|
449
449
|
? {
|
|
450
450
|
base: this.root.formio.base,
|
|
451
451
|
project: this.root.formio.projectUrl,
|
|
@@ -625,7 +625,7 @@ class FormComponent extends Component_1.default {
|
|
|
625
625
|
return changed;
|
|
626
626
|
}
|
|
627
627
|
setSubFormValue(submission, flags) {
|
|
628
|
-
var _a, _b;
|
|
628
|
+
var _a, _b, _c, _d;
|
|
629
629
|
const shouldLoadSubmissionById = submission
|
|
630
630
|
&& submission._id
|
|
631
631
|
&& this.subForm.formio
|
|
@@ -634,7 +634,7 @@ class FormComponent extends Component_1.default {
|
|
|
634
634
|
if (shouldLoadSubmissionById || shouldLoadDraftById) {
|
|
635
635
|
const formId = submission.form || this.formObj.form || this.component.form;
|
|
636
636
|
const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id || this.subForm.submission._id}`;
|
|
637
|
-
const options = ((_a = this.root
|
|
637
|
+
const options = ((_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.formio) === null || _b === void 0 ? void 0 : _b.base) && ((_d = (_c = this.root) === null || _c === void 0 ? void 0 : _c.formio) === null || _d === void 0 ? void 0 : _d.projectUrl)
|
|
638
638
|
? {
|
|
639
639
|
base: this.root.formio.base,
|
|
640
640
|
project: this.root.formio.projectUrl,
|
|
@@ -200,7 +200,8 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
200
200
|
if (this.viewOnly || !this.refs.input || !this.refs.input.length) {
|
|
201
201
|
return this.dataValue;
|
|
202
202
|
}
|
|
203
|
-
|
|
203
|
+
// If the input type of the component is checkbox the value should be determined by the checkboxes checked property
|
|
204
|
+
let value = this.component.inputType === 'checkbox' ? '' : this.dataValue;
|
|
204
205
|
this.refs.input.forEach((input, index) => {
|
|
205
206
|
if (input.checked) {
|
|
206
207
|
value = (this.isSelectURL && lodash_1.default.isObject(this.loadedOptions[index].value)) ?
|
|
@@ -322,7 +323,7 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
322
323
|
const value = this.dataValue;
|
|
323
324
|
this.refs.wrapper.forEach((wrapper, index) => {
|
|
324
325
|
const input = this.refs.input[index];
|
|
325
|
-
const checked = (input.type === 'checkbox') ? value[input.value] : (input.value.toString() === value.toString());
|
|
326
|
+
const checked = (input.type === 'checkbox') ? value[input.value] || input.checked : (input.value.toString() === value.toString());
|
|
326
327
|
if (checked) {
|
|
327
328
|
//add class to container when selected
|
|
328
329
|
this.addClass(wrapper, this.optionSelectedClass);
|
|
@@ -970,8 +970,14 @@ export default class WebformBuilder extends Component {
|
|
|
970
970
|
else if (parent.formioComponent && parent.formioComponent.removeChildComponent) {
|
|
971
971
|
parent.formioComponent.removeChildComponent(component);
|
|
972
972
|
}
|
|
973
|
-
if (component.input && componentInstance &&
|
|
974
|
-
_.
|
|
973
|
+
if (component.input && componentInstance && parent.formioComponent) {
|
|
974
|
+
const parentDefaultValue = _.get(parent.formioComponent, 'component.defaultValue', null);
|
|
975
|
+
if (Array.isArray(parentDefaultValue)) {
|
|
976
|
+
parentDefaultValue.forEach(v => _.unset(v, componentInstance.key));
|
|
977
|
+
}
|
|
978
|
+
else if (typeof parentDefaultValue === 'object') {
|
|
979
|
+
_.unset(parentDefaultValue, componentInstance.key);
|
|
980
|
+
}
|
|
975
981
|
}
|
|
976
982
|
const rebuild = parent.formioComponent.rebuild() || Promise.resolve();
|
|
977
983
|
rebuild.then(() => {
|
|
@@ -2527,7 +2527,7 @@ export default class Component extends Element {
|
|
|
2527
2527
|
}
|
|
2528
2528
|
this.calculatedValue = fastCloneDeep(calculatedValue);
|
|
2529
2529
|
if (changed) {
|
|
2530
|
-
if (!flags.noPristineChangeOnModified) {
|
|
2530
|
+
if (!flags.noPristineChangeOnModified && this.root.initialized) {
|
|
2531
2531
|
this.pristine = false;
|
|
2532
2532
|
}
|
|
2533
2533
|
flags.triggeredComponentId = this.id;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let label: string;
|
|
3
|
+
let reorder: boolean;
|
|
4
|
+
let addAnotherPosition: string;
|
|
5
|
+
let layoutFixed: boolean;
|
|
6
|
+
let enableRowGroups: boolean;
|
|
7
|
+
let initEmpty: boolean;
|
|
8
|
+
let tableView: boolean;
|
|
9
|
+
let defaultValue: {}[];
|
|
10
|
+
let key: string;
|
|
11
|
+
let type: string;
|
|
12
|
+
let input: boolean;
|
|
13
|
+
let components: {
|
|
14
|
+
label: string;
|
|
15
|
+
optionsLabelPosition: string;
|
|
16
|
+
inline: boolean;
|
|
17
|
+
tableView: boolean;
|
|
18
|
+
values: {
|
|
19
|
+
label: string;
|
|
20
|
+
value: string;
|
|
21
|
+
shortcut: string;
|
|
22
|
+
}[];
|
|
23
|
+
key: string;
|
|
24
|
+
type: string;
|
|
25
|
+
input: boolean;
|
|
26
|
+
inputType: string;
|
|
27
|
+
}[];
|
|
28
|
+
}
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
'label': 'Data Grid',
|
|
3
|
+
'reorder': false,
|
|
4
|
+
'addAnotherPosition': 'bottom',
|
|
5
|
+
'layoutFixed': false,
|
|
6
|
+
'enableRowGroups': false,
|
|
7
|
+
'initEmpty': false,
|
|
8
|
+
'tableView': false,
|
|
9
|
+
'defaultValue': [
|
|
10
|
+
{}
|
|
11
|
+
],
|
|
12
|
+
'key': 'dataGrid',
|
|
13
|
+
'type': 'datagrid',
|
|
14
|
+
'input': true,
|
|
15
|
+
'components': [
|
|
16
|
+
{
|
|
17
|
+
'label': 'Radio',
|
|
18
|
+
'optionsLabelPosition': 'right',
|
|
19
|
+
'inline': false,
|
|
20
|
+
'tableView': false,
|
|
21
|
+
'values': [
|
|
22
|
+
{
|
|
23
|
+
'label': 'yes',
|
|
24
|
+
'value': 'yes',
|
|
25
|
+
'shortcut': ''
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
'key': 'radio',
|
|
29
|
+
'type': 'radio',
|
|
30
|
+
'input': true,
|
|
31
|
+
'inputType': 'checkbox'
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
};
|
|
@@ -14,4 +14,5 @@ import withRowGroupsAndDefValue from './comp-row-groups-with-def-value';
|
|
|
14
14
|
import modalWithRequiredFields from './comp-modal-with-required-fields';
|
|
15
15
|
import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
|
16
16
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
|
17
|
-
|
|
17
|
+
import withCheckboxes from './comp-with-checkboxes';
|
|
18
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes };
|
|
@@ -14,4 +14,5 @@ import withLogic from './comp-with-logic';
|
|
|
14
14
|
import withCollapsibleRowGroups from './comp-with-collapsible-groups';
|
|
15
15
|
import withAllowCalculateOverride from './comp-with-allow-calculate-override';
|
|
16
16
|
import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
|
|
17
|
-
|
|
17
|
+
import withCheckboxes from './comp-with-checkboxes';
|
|
18
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes };
|
|
@@ -649,7 +649,7 @@ export default class FileComponent extends Field {
|
|
|
649
649
|
// Check if file with the same name is being uploaded
|
|
650
650
|
const fileWithSameNameUploading = this.filesToSync.filesToUpload
|
|
651
651
|
.some(fileToSync => fileToSync.file?.name === file.name);
|
|
652
|
-
const fileWithSameNameUploaded = this.dataValue
|
|
652
|
+
const fileWithSameNameUploaded = this.dataValue
|
|
653
653
|
.some(fileStatus => fileStatus.originalName === file.name);
|
|
654
654
|
return fileWithSameNameUploaded || fileWithSameNameUploading
|
|
655
655
|
? {
|
|
@@ -440,7 +440,7 @@ export default class FormComponent extends Component {
|
|
|
440
440
|
}
|
|
441
441
|
else if (this.formSrc) {
|
|
442
442
|
this.subFormLoading = true;
|
|
443
|
-
const options = this.root
|
|
443
|
+
const options = this.root?.formio?.base && this.root?.formio?.projectUrl
|
|
444
444
|
? {
|
|
445
445
|
base: this.root.formio.base,
|
|
446
446
|
project: this.root.formio.projectUrl,
|
|
@@ -624,7 +624,7 @@ export default class FormComponent extends Component {
|
|
|
624
624
|
if (shouldLoadSubmissionById || shouldLoadDraftById) {
|
|
625
625
|
const formId = submission.form || this.formObj.form || this.component.form;
|
|
626
626
|
const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id || this.subForm.submission._id}`;
|
|
627
|
-
const options = this.root
|
|
627
|
+
const options = this.root?.formio?.base && this.root?.formio?.projectUrl
|
|
628
628
|
? {
|
|
629
629
|
base: this.root.formio.base,
|
|
630
630
|
project: this.root.formio.projectUrl,
|
|
@@ -200,7 +200,8 @@ export default class RadioComponent extends ListComponent {
|
|
|
200
200
|
if (this.viewOnly || !this.refs.input || !this.refs.input.length) {
|
|
201
201
|
return this.dataValue;
|
|
202
202
|
}
|
|
203
|
-
|
|
203
|
+
// If the input type of the component is checkbox the value should be determined by the checkboxes checked property
|
|
204
|
+
let value = this.component.inputType === 'checkbox' ? '' : this.dataValue;
|
|
204
205
|
this.refs.input.forEach((input, index) => {
|
|
205
206
|
if (input.checked) {
|
|
206
207
|
value = (this.isSelectURL && _.isObject(this.loadedOptions[index].value)) ?
|
|
@@ -322,7 +323,7 @@ export default class RadioComponent extends ListComponent {
|
|
|
322
323
|
const value = this.dataValue;
|
|
323
324
|
this.refs.wrapper.forEach((wrapper, index) => {
|
|
324
325
|
const input = this.refs.input[index];
|
|
325
|
-
const checked = (input.type === 'checkbox') ? value[input.value] : (input.value.toString() === value.toString());
|
|
326
|
+
const checked = (input.type === 'checkbox') ? value[input.value] || input.checked : (input.value.toString() === value.toString());
|
|
326
327
|
if (checked) {
|
|
327
328
|
//add class to container when selected
|
|
328
329
|
this.addClass(wrapper, this.optionSelectedClass);
|