@formio/js 5.1.0-dev.6104.98e707b → 5.1.0-dev.6105.96dde7b
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.form.js +2 -2
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +2 -2
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/components/datagrid/DataGrid.js +4 -0
- package/lib/cjs/components/radio/Radio.d.ts +0 -8
- package/lib/cjs/components/radio/Radio.js +5 -15
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +0 -6
- package/lib/mjs/components/datagrid/DataGrid.js +5 -1
- package/lib/mjs/components/radio/Radio.d.ts +0 -8
- package/lib/mjs/components/radio/Radio.js +5 -15
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +0 -6
- package/package.json +1 -1
@@ -492,6 +492,10 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
492
492
|
options.row = `${rowIndex}-${colIndex}`;
|
493
493
|
options.rowIndex = rowIndex;
|
494
494
|
options.onChange = (flags, changed, modified) => {
|
495
|
+
if (changed.component.type === 'form') {
|
496
|
+
const formComp = (0, utils_1.getComponent)(this.component.components, changed.component.key);
|
497
|
+
lodash_1.default.set(formComp, 'components', changed.component.components);
|
498
|
+
}
|
495
499
|
this.triggerChange({ modified });
|
496
500
|
};
|
497
501
|
let columnComponent;
|
@@ -28,7 +28,6 @@ export default class RadioComponent extends ListComponent {
|
|
28
28
|
optionsLoaded: boolean | undefined;
|
29
29
|
loadedOptions: any[] | undefined;
|
30
30
|
beforeSubmit(): Promise<any>;
|
31
|
-
convertValues(values: any): any;
|
32
31
|
render(): string;
|
33
32
|
attach(element: any): Promise<void>;
|
34
33
|
detach(element: any): void;
|
@@ -42,12 +41,5 @@ export default class RadioComponent extends ListComponent {
|
|
42
41
|
setSelectedClasses(): void;
|
43
42
|
updateValue(value: any, flags: any): boolean;
|
44
43
|
currentValue: any;
|
45
|
-
/**
|
46
|
-
* Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
|
47
|
-
* @param {*} value - The value to normalize
|
48
|
-
* @returns {*} - Returns the normalized value
|
49
|
-
*/
|
50
|
-
convertByDataType(value: any): any;
|
51
|
-
normalizeValue(value: any): any;
|
52
44
|
}
|
53
45
|
import ListComponent from '../_classes/list/ListComponent';
|
@@ -153,12 +153,6 @@ class RadioComponent extends ListComponent_1.default {
|
|
153
153
|
this.dataReady.then(() => res(true));
|
154
154
|
});
|
155
155
|
}
|
156
|
-
convertValues(values) {
|
157
|
-
if (this.options.renderMode === 'html' && this.type === 'radio') {
|
158
|
-
return values.map(x => (Object.assign(Object.assign({}, x), { value: this.convertByDataType(x.value) })));
|
159
|
-
}
|
160
|
-
return values;
|
161
|
-
}
|
162
156
|
render() {
|
163
157
|
if (!this.optionsLoaded) {
|
164
158
|
return super.render(this.renderTemplate('loader'));
|
@@ -166,7 +160,7 @@ class RadioComponent extends ListComponent_1.default {
|
|
166
160
|
return super.render(this.renderTemplate('radio', {
|
167
161
|
input: this.inputInfo,
|
168
162
|
inline: this.component.inline,
|
169
|
-
values: this.component.dataSrc === 'values' ? this.
|
163
|
+
values: this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions,
|
170
164
|
value: this.dataValue,
|
171
165
|
row: this.row,
|
172
166
|
}));
|
@@ -412,7 +406,7 @@ class RadioComponent extends ListComponent_1.default {
|
|
412
406
|
* @param {*} value - The value to normalize
|
413
407
|
* @returns {*} - Returns the normalized value
|
414
408
|
*/
|
415
|
-
|
409
|
+
normalizeValue(value) {
|
416
410
|
const dataType = this.component.dataType || 'auto';
|
417
411
|
if (value === this.emptyValue) {
|
418
412
|
return value;
|
@@ -444,18 +438,14 @@ class RadioComponent extends ListComponent_1.default {
|
|
444
438
|
value = !(!value || value.toString() === 'false');
|
445
439
|
break;
|
446
440
|
}
|
447
|
-
|
448
|
-
}
|
449
|
-
normalizeValue(value) {
|
450
|
-
const valueConverted = this.convertByDataType(value);
|
451
|
-
if (this.isSelectURL && this.templateData && this.templateData[valueConverted]) {
|
441
|
+
if (this.isSelectURL && this.templateData && this.templateData[value]) {
|
452
442
|
const submission = this.root.submission;
|
453
443
|
if (!submission.metadata.selectData) {
|
454
444
|
submission.metadata.selectData = {};
|
455
445
|
}
|
456
|
-
lodash_1.default.set(submission.metadata.selectData, this.path, this.templateData[
|
446
|
+
lodash_1.default.set(submission.metadata.selectData, this.path, this.templateData[value]);
|
457
447
|
}
|
458
|
-
return super.normalizeValue(
|
448
|
+
return super.normalizeValue(value);
|
459
449
|
}
|
460
450
|
}
|
461
451
|
exports.default = RadioComponent;
|
@@ -8,12 +8,6 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
8
8
|
* @returns {boolean} - If the value is empty.
|
9
9
|
*/
|
10
10
|
isEmpty(value?: any): boolean;
|
11
|
-
/**
|
12
|
-
* Normalize values coming into updateValue.
|
13
|
-
* @param {any} value - The value to normalize.
|
14
|
-
* @returns {*} - The normalized value
|
15
|
-
*/
|
16
|
-
normalizeValue(value: any): any;
|
17
11
|
setInputsDisabled(value: any, onlyUnchecked: any): void;
|
18
12
|
checkComponentValidity(data: any, dirty: any, rowData: any, options: any, errors?: any[]): boolean;
|
19
13
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import NestedArrayComponent from '../_classes/nestedarray/NestedArrayComponent';
|
3
|
-
import { fastCloneDeep, getFocusableElements } from '../../utils/utils';
|
3
|
+
import { fastCloneDeep, getFocusableElements, getComponent } from '../../utils/utils';
|
4
4
|
export default class DataGridComponent extends NestedArrayComponent {
|
5
5
|
static schema(...extend) {
|
6
6
|
return NestedArrayComponent.schema({
|
@@ -488,6 +488,10 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
488
488
|
options.row = `${rowIndex}-${colIndex}`;
|
489
489
|
options.rowIndex = rowIndex;
|
490
490
|
options.onChange = (flags, changed, modified) => {
|
491
|
+
if (changed.component.type === 'form') {
|
492
|
+
const formComp = getComponent(this.component.components, changed.component.key);
|
493
|
+
_.set(formComp, 'components', changed.component.components);
|
494
|
+
}
|
491
495
|
this.triggerChange({ modified });
|
492
496
|
};
|
493
497
|
let columnComponent;
|
@@ -28,7 +28,6 @@ export default class RadioComponent extends ListComponent {
|
|
28
28
|
optionsLoaded: boolean | undefined;
|
29
29
|
loadedOptions: any[] | undefined;
|
30
30
|
beforeSubmit(): Promise<any>;
|
31
|
-
convertValues(values: any): any;
|
32
31
|
render(): string;
|
33
32
|
attach(element: any): Promise<void>;
|
34
33
|
detach(element: any): void;
|
@@ -42,12 +41,5 @@ export default class RadioComponent extends ListComponent {
|
|
42
41
|
setSelectedClasses(): void;
|
43
42
|
updateValue(value: any, flags: any): boolean;
|
44
43
|
currentValue: any;
|
45
|
-
/**
|
46
|
-
* Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
|
47
|
-
* @param {*} value - The value to normalize
|
48
|
-
* @returns {*} - Returns the normalized value
|
49
|
-
*/
|
50
|
-
convertByDataType(value: any): any;
|
51
|
-
normalizeValue(value: any): any;
|
52
44
|
}
|
53
45
|
import ListComponent from '../_classes/list/ListComponent';
|
@@ -153,12 +153,6 @@ export default class RadioComponent extends ListComponent {
|
|
153
153
|
this.dataReady.then(() => res(true));
|
154
154
|
});
|
155
155
|
}
|
156
|
-
convertValues(values) {
|
157
|
-
if (this.options.renderMode === 'html' && this.type === 'radio') {
|
158
|
-
return values.map(x => ({ ...x, value: this.convertByDataType(x.value) }));
|
159
|
-
}
|
160
|
-
return values;
|
161
|
-
}
|
162
156
|
render() {
|
163
157
|
if (!this.optionsLoaded) {
|
164
158
|
return super.render(this.renderTemplate('loader'));
|
@@ -166,7 +160,7 @@ export default class RadioComponent extends ListComponent {
|
|
166
160
|
return super.render(this.renderTemplate('radio', {
|
167
161
|
input: this.inputInfo,
|
168
162
|
inline: this.component.inline,
|
169
|
-
values: this.component.dataSrc === 'values' ? this.
|
163
|
+
values: this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions,
|
170
164
|
value: this.dataValue,
|
171
165
|
row: this.row,
|
172
166
|
}));
|
@@ -412,7 +406,7 @@ export default class RadioComponent extends ListComponent {
|
|
412
406
|
* @param {*} value - The value to normalize
|
413
407
|
* @returns {*} - Returns the normalized value
|
414
408
|
*/
|
415
|
-
|
409
|
+
normalizeValue(value) {
|
416
410
|
const dataType = this.component.dataType || 'auto';
|
417
411
|
if (value === this.emptyValue) {
|
418
412
|
return value;
|
@@ -444,17 +438,13 @@ export default class RadioComponent extends ListComponent {
|
|
444
438
|
value = !(!value || value.toString() === 'false');
|
445
439
|
break;
|
446
440
|
}
|
447
|
-
|
448
|
-
}
|
449
|
-
normalizeValue(value) {
|
450
|
-
const valueConverted = this.convertByDataType(value);
|
451
|
-
if (this.isSelectURL && this.templateData && this.templateData[valueConverted]) {
|
441
|
+
if (this.isSelectURL && this.templateData && this.templateData[value]) {
|
452
442
|
const submission = this.root.submission;
|
453
443
|
if (!submission.metadata.selectData) {
|
454
444
|
submission.metadata.selectData = {};
|
455
445
|
}
|
456
|
-
_.set(submission.metadata.selectData, this.path, this.templateData[
|
446
|
+
_.set(submission.metadata.selectData, this.path, this.templateData[value]);
|
457
447
|
}
|
458
|
-
return super.normalizeValue(
|
448
|
+
return super.normalizeValue(value);
|
459
449
|
}
|
460
450
|
}
|
@@ -8,12 +8,6 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
8
8
|
* @returns {boolean} - If the value is empty.
|
9
9
|
*/
|
10
10
|
isEmpty(value?: any): boolean;
|
11
|
-
/**
|
12
|
-
* Normalize values coming into updateValue.
|
13
|
-
* @param {any} value - The value to normalize.
|
14
|
-
* @returns {*} - The normalized value
|
15
|
-
*/
|
16
|
-
normalizeValue(value: any): any;
|
17
11
|
setInputsDisabled(value: any, onlyUnchecked: any): void;
|
18
12
|
checkComponentValidity(data: any, dirty: any, rowData: any, options: any, errors?: any[]): boolean;
|
19
13
|
}
|